Skip to content

Commit 09b04eb

Browse files
committed
chore: revert
1 parent b7be396 commit 09b04eb

File tree

13 files changed

+44
-170
lines changed

13 files changed

+44
-170
lines changed

docs/package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,6 @@
1515
"dependencies": {
1616
"@diceui/checkbox-group": "workspace:*",
1717
"@diceui/combobox": "workspace:*",
18-
"@diceui/masonry": "workspace:*",
1918
"@diceui/mention": "workspace:*",
2019
"@diceui/tags-input": "workspace:*",
2120
"@dnd-kit/core": "^6.3.1",

docs/registry/default/ui/kanban.tsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -154,12 +154,12 @@ const ITEM_HANDLE_NAME = "KanbanItemHandle";
154154
const OVERLAY_NAME = "KanbanOverlay";
155155

156156
const KANBAN_ERROR = {
157-
[ROOT_NAME]: `${ROOT_NAME} components must be within ${ROOT_NAME}`,
158-
[BOARD_NAME]: `${BOARD_NAME} must be within ${ROOT_NAME}`,
159-
[COLUMN_NAME]: `${COLUMN_NAME} must be within ${BOARD_NAME}`,
160-
[ITEM_NAME]: `${ITEM_NAME} must be within ${COLUMN_NAME}`,
161-
[ITEM_HANDLE_NAME]: `${ITEM_HANDLE_NAME} must be within ${ITEM_NAME}`,
162-
[OVERLAY_NAME]: `${OVERLAY_NAME} must be within ${ROOT_NAME}`,
157+
[ROOT_NAME]: `\`${ROOT_NAME}\` components must be within \`${ROOT_NAME}\``,
158+
[BOARD_NAME]: `\`${BOARD_NAME}\` must be within \`${ROOT_NAME}\``,
159+
[COLUMN_NAME]: `\`${COLUMN_NAME}\` must be within \`${BOARD_NAME}\``,
160+
[ITEM_NAME]: `\`${ITEM_NAME}\` must be within \`${COLUMN_NAME}\``,
161+
[ITEM_HANDLE_NAME]: `\`${ITEM_HANDLE_NAME}\` must be within \`${ITEM_NAME}\``,
162+
[OVERLAY_NAME]: `\`${OVERLAY_NAME}\` must be within \`${ROOT_NAME}\``,
163163
} as const;
164164

165165
interface KanbanContextValue<T> {

docs/registry/default/ui/sortable.tsx

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -66,11 +66,11 @@ const ITEM_HANDLE_NAME = "SortableItemHandle";
6666
const OVERLAY_NAME = "SortableOverlay";
6767

6868
const SORTABLE_ERROR = {
69-
[ROOT_NAME]: `${ROOT_NAME} components must be within ${ROOT_NAME}`,
70-
[CONTENT_NAME]: `${CONTENT_NAME} must be within ${ROOT_NAME}`,
71-
[ITEM_NAME]: `${ITEM_NAME} must be within ${CONTENT_NAME}`,
72-
[ITEM_HANDLE_NAME]: `${ITEM_HANDLE_NAME} must be within ${ITEM_NAME}`,
73-
[OVERLAY_NAME]: `${OVERLAY_NAME} must be within ${ROOT_NAME}`,
69+
[ROOT_NAME]: `\`${ROOT_NAME}\` components must be within \`${ROOT_NAME}\``,
70+
[CONTENT_NAME]: `\`${CONTENT_NAME}\` must be within \`${ROOT_NAME}\``,
71+
[ITEM_NAME]: `\`${ITEM_NAME}\` must be within \`${CONTENT_NAME}\``,
72+
[ITEM_HANDLE_NAME]: `\`${ITEM_HANDLE_NAME}\` must be within \`${ITEM_NAME}\``,
73+
[OVERLAY_NAME]: `\`${OVERLAY_NAME}\` must be within \`${ROOT_NAME}\``,
7474
} as const;
7575

7676
interface SortableRootContextValue<T> {

packages/combobox/src/combobox-item.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ const ComboboxItem = React.forwardRef<ItemElement, ComboboxItemProps>(
5252
(props, forwardedRef) => {
5353
const { value, label: labelProp, disabled, ...itemProps } = props;
5454
const context = useComboboxContext(ITEM_NAME);
55-
// Make the group context optional by passing false, so item can be used outside of a group
56-
const groupContext = useComboboxGroupContext(ITEM_NAME, false);
55+
// Make the group context optional by passing true, so item can be used outside of a group
56+
const groupContext = useComboboxGroupContext(ITEM_NAME, true);
5757
const { label, onLabelChange } = useLabel<ItemTextElement>({
5858
defaultValue: labelProp,
5959
});

packages/masonry/README.md

Lines changed: 0 additions & 15 deletions
This file was deleted.

packages/masonry/package.json

Lines changed: 0 additions & 53 deletions
This file was deleted.

packages/masonry/src/index.ts

Lines changed: 0 additions & 1 deletion
This file was deleted.

packages/masonry/tsconfig.json

Lines changed: 0 additions & 8 deletions
This file was deleted.

packages/masonry/tsup.config.ts

Lines changed: 0 additions & 25 deletions
This file was deleted.

packages/shared/src/components/create-context.tsx

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -32,30 +32,30 @@ function createContext<T extends object | null>(
3232

3333
Provider.displayName = `${rootComponentName}Provider`;
3434

35-
type ContextReturn<Required extends boolean> = Required extends true
36-
? T
37-
: T | undefined;
35+
type ContextReturn<Optional extends boolean> = Optional extends true
36+
? T | undefined
37+
: T;
3838

3939
/**
4040
* @param consumerName The name of the component that is consuming the context
41-
* @param required Whether the context is required
41+
* @param optional Whether the context is optional (defaults to false)
4242
*/
43-
function useContext<Required extends boolean = true>(
43+
function useContext<Optional extends boolean = false>(
4444
consumerName: string,
45-
required?: Required,
46-
): ContextReturn<Required> {
45+
optional?: Optional,
46+
): ContextReturn<Optional> {
4747
const context = React.useContext(Context);
4848

49-
if (context) return context;
50-
if (defaultValue !== undefined) return defaultValue;
51-
52-
if (required) {
49+
if (!context && !optional) {
5350
throw new Error(
5451
`\`${consumerName}\` must be used within \`${rootComponentName}\``,
5552
);
5653
}
5754

58-
return undefined as ContextReturn<Required>;
55+
if (context) return context;
56+
if (defaultValue !== undefined) return defaultValue;
57+
58+
return undefined as ContextReturn<Optional>;
5959
}
6060

6161
return [Provider, useContext] as const;

0 commit comments

Comments
 (0)