@choice-ui/react 1.5.3 → 1.5.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/calendar/dist/index.js +2 -2
- package/dist/components/calendar/src/time-calendar/time-calendar.js +2 -2
- package/dist/components/code-block/dist/index.js +13 -13
- package/dist/components/code-block/src/code-block.js +11 -11
- package/dist/components/code-block/src/hooks/use-line-count.js +3 -3
- package/dist/components/combobox/dist/index.d.ts +2 -1
- package/dist/components/combobox/dist/index.js +7 -6
- package/dist/components/combobox/src/combobox.d.ts +2 -1
- package/dist/components/combobox/src/combobox.js +7 -6
- package/dist/components/command/src/components/command-group.js +2 -2
- package/dist/components/command/src/components/command-item.js +3 -3
- package/dist/components/command/src/hooks/index.js +2 -2
- package/dist/components/command/src/hooks/use-command-state.js +3 -3
- package/dist/components/command/src/hooks/use-command.js +2 -2
- package/dist/components/command/src/utils/helpers.js +4 -4
- package/dist/components/comments/src/comment-item/comment-item.js +2 -2
- package/dist/components/comments/src/comment-item/components/comment-item-reactions.js +2 -2
- package/dist/components/conditions/src/hooks/use-drag-and-drop.js +3 -3
- package/dist/components/context-input/src/components/copy-button.js +2 -2
- package/dist/components/context-input/src/components/mention.js +2 -2
- package/dist/components/context-input/src/components/slate-editor.js +3 -3
- package/dist/components/context-input/src/context-input.js +5 -5
- package/dist/components/context-menu/dist/index.d.ts +2 -1
- package/dist/components/context-menu/src/context-menu.d.ts +2 -1
- package/dist/components/context-menu/src/context-menu.js +14 -13
- package/dist/components/dialog/dist/index.js +2 -2
- package/dist/components/dialog/src/dialog.js +2 -2
- package/dist/components/dropdown/dist/index.d.ts +2 -1
- package/dist/components/dropdown/dist/index.js +8 -7
- package/dist/components/dropdown/src/dropdown.d.ts +2 -1
- package/dist/components/dropdown/src/dropdown.js +8 -7
- package/dist/components/index.d.ts +1 -0
- package/dist/components/md-input/src/components/toolbar/toolbar.js +2 -2
- package/dist/components/md-input/src/md-input.js +3 -3
- package/dist/components/menus/dist/index.d.ts +6 -1
- package/dist/components/menus/dist/index.js +26 -2
- package/dist/components/menus/src/components/index.d.ts +1 -0
- package/dist/components/menus/src/components/menu-empty.d.ts +4 -0
- package/dist/components/menus/src/components/menu-empty.js +20 -0
- package/dist/components/menus/src/index.d.ts +1 -1
- package/dist/components/menus/src/menus.js +2 -2
- package/dist/components/menus/src/tv.d.ts +25 -0
- package/dist/components/menus/src/tv.js +11 -0
- package/dist/components/multi-select/dist/index.d.ts +2 -1
- package/dist/components/multi-select/dist/index.js +15 -8
- package/dist/components/multi-select/src/multi-select.d.ts +2 -1
- package/dist/components/multi-select/src/multi-select.js +8 -4
- package/dist/components/multi-select/src/utils/extract-options.d.ts +16 -2
- package/dist/components/multi-select/src/utils/extract-options.js +8 -5
- package/dist/components/otp-input/dist/index.d.ts +30 -0
- package/dist/components/otp-input/src/index.d.ts +2 -0
- package/dist/components/otp-input/src/otp-input.d.ts +27 -0
- package/dist/components/otp-input/src/otp-input.js +115 -0
- package/dist/components/otp-input/src/otp-input.module.css +15 -0
- package/dist/components/otp-input/src/otp-input.module.css.js +8 -0
- package/dist/components/otp-input/src/tv.d.ts +121 -0
- package/dist/components/otp-input/src/tv.js +150 -0
- package/dist/components/otp-input/tsup.config.d.ts +2 -0
- package/dist/components/panel/src/components/panel-sortable.js +3 -3
- package/dist/components/rich-input/src/hooks/use-editor-config.js +3 -3
- package/dist/components/rich-input/src/utils/custom-options.js +15 -15
- package/dist/components/select/dist/index.d.ts +2 -1
- package/dist/components/select/dist/index.js +15 -8
- package/dist/components/select/src/select.d.ts +2 -1
- package/dist/components/select/src/select.js +15 -8
- package/dist/components/slot/dist/index.d.ts +10 -10
- package/dist/components/slot/dist/index.js +7 -15
- package/dist/components/slot/src/slot.d.ts +12 -12
- package/dist/components/slot/src/slot.js +10 -18
- package/dist/components/textarea/dist/index.js +14 -14
- package/dist/components/textarea/src/components/autosize/hooks.js +5 -5
- package/dist/components/textarea/src/components/autosize/index.js +10 -10
- package/dist/components/tree-list/src/tree-list.js +3 -3
- package/dist/components/virtualized-grid/src/error-boundary.js +2 -2
- package/dist/index.js +4 -0
- package/dist/node_modules/.pnpm/input-otp@1.4.2_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/input-otp/dist/index.js +200 -0
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { Slot } from "../../slot/dist/index.js";
|
|
3
3
|
import { ModalFooter, ModalBackdrop, ModalContent, Modal } from "../../modal/dist/index.js";
|
|
4
4
|
import { FloatingPortal, FloatingOverlay, FloatingFocusManager } from "@floating-ui/react";
|
|
5
|
-
import
|
|
5
|
+
import React__default, { memo, useRef, useId, useMemo } from "react";
|
|
6
6
|
import { DialogContext } from "./dialog-context.js";
|
|
7
7
|
import { dragDialogTv } from "./tv.js";
|
|
8
8
|
import { DialogHeader } from "./components/dialog-header.js";
|
|
@@ -134,7 +134,7 @@ const DialogComponent = memo(function DialogComponent2({
|
|
|
134
134
|
const backdropContent = useMemo(() => {
|
|
135
135
|
const backdropChild = findChildByType(children, ModalBackdrop);
|
|
136
136
|
if (!backdropChild) return null;
|
|
137
|
-
return
|
|
137
|
+
return React__default.cloneElement(backdropChild, {
|
|
138
138
|
isOpen: floating.innerOpen,
|
|
139
139
|
onClose: floating.handleClose,
|
|
140
140
|
...backdropChild.props
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuButton, MenuContextContent, MenuDivider, MenuInput, MenuContextItem, MenuContextLabel, MenuSearch, MenuContextSubTrigger, MenuTrigger, MenuValue } from '../../menus/src';
|
|
1
|
+
import { MenuButton, MenuContextContent, MenuDivider, MenuEmpty, MenuInput, MenuContextItem, MenuContextLabel, MenuSearch, MenuContextSubTrigger, MenuTrigger, MenuValue } from '../../menus/src';
|
|
2
2
|
import { FloatingFocusManagerProps, Placement } from '@floating-ui/react';
|
|
3
3
|
import { default as React } from 'react';
|
|
4
4
|
interface DropdownProps {
|
|
@@ -31,6 +31,7 @@ interface DropdownComponentType extends React.ForwardRefExoticComponent<Dropdown
|
|
|
31
31
|
Button: typeof MenuButton;
|
|
32
32
|
Content: typeof MenuContextContent;
|
|
33
33
|
Divider: typeof MenuDivider;
|
|
34
|
+
Empty: typeof MenuEmpty;
|
|
34
35
|
Input: typeof MenuInput;
|
|
35
36
|
Item: typeof MenuContextItem;
|
|
36
37
|
Label: typeof MenuContextLabel;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Slot } from "../../slot/dist/index.js";
|
|
2
|
-
import { MenuValue,
|
|
2
|
+
import { MenuValue, MenuTrigger, MenuContextSubTrigger, MenuSearch, MenuContextLabel, MenuContextItem, MenuInput, MenuEmpty, MenuDivider, MenuContextContent, MenuButton, useMenuBaseRefs, MenuContext, useMenuTree, useMenuScrollHeight, useMenuScroll, MenuScrollArrow } from "../../menus/dist/index.js";
|
|
3
3
|
import { useFloatingParentNodeId, FloatingTree, useFloating, offset, flip, shift, size, autoUpdate, useHover, safePolygon, useClick, useRole, useDismiss, useListNavigation, useTypeahead, useInteractions, FloatingNode, FloatingList, FloatingPortal, FloatingOverlay, FloatingFocusManager } from "@floating-ui/react";
|
|
4
4
|
import { memo, useState, useId, useContext, useRef, useMemo, useEffect, Children, isValidElement, cloneElement } from "react";
|
|
5
5
|
import { useEventCallback } from "usehooks-ts";
|
|
@@ -383,15 +383,16 @@ var BaseDropdown = memo(function Dropdown(props) {
|
|
|
383
383
|
});
|
|
384
384
|
var Dropdown2 = Object.assign(BaseDropdown, {
|
|
385
385
|
displayName: "Dropdown",
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
SubTrigger: MenuContextSubTrigger,
|
|
386
|
+
Button: MenuButton,
|
|
387
|
+
Content: MenuContextContent,
|
|
389
388
|
Divider: MenuDivider,
|
|
389
|
+
Empty: MenuEmpty,
|
|
390
|
+
Input: MenuInput,
|
|
391
|
+
Item: MenuContextItem,
|
|
390
392
|
Label: MenuContextLabel,
|
|
391
393
|
Search: MenuSearch,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
Content: MenuContextContent,
|
|
394
|
+
SubTrigger: MenuContextSubTrigger,
|
|
395
|
+
Trigger: MenuTrigger,
|
|
395
396
|
Value: MenuValue
|
|
396
397
|
});
|
|
397
398
|
export {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { MenuButton, MenuContextContent, MenuContextItem, MenuContextLabel, MenuContextSubTrigger, MenuDivider, MenuInput, MenuSearch, MenuTrigger, MenuValue } from '../../menus/src';
|
|
1
|
+
import { MenuButton, MenuContextContent, MenuContextItem, MenuContextLabel, MenuContextSubTrigger, MenuDivider, MenuEmpty, MenuInput, MenuSearch, MenuTrigger, MenuValue } from '../../menus/src';
|
|
2
2
|
import { FloatingFocusManagerProps, Placement } from '@floating-ui/react';
|
|
3
3
|
import { default as React } from 'react';
|
|
4
4
|
export interface DropdownProps {
|
|
@@ -31,6 +31,7 @@ interface DropdownComponentType extends React.ForwardRefExoticComponent<Dropdown
|
|
|
31
31
|
Button: typeof MenuButton;
|
|
32
32
|
Content: typeof MenuContextContent;
|
|
33
33
|
Divider: typeof MenuDivider;
|
|
34
|
+
Empty: typeof MenuEmpty;
|
|
34
35
|
Input: typeof MenuInput;
|
|
35
36
|
Item: typeof MenuContextItem;
|
|
36
37
|
Label: typeof MenuContextLabel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Slot } from "../../slot/dist/index.js";
|
|
3
|
-
import { MenuValue,
|
|
3
|
+
import { MenuValue, MenuTrigger, MenuContextSubTrigger, MenuSearch, MenuContextLabel, MenuContextItem, MenuInput, MenuEmpty, MenuDivider, MenuContextContent, MenuButton, useMenuBaseRefs, MenuContext, useMenuTree, useMenuScrollHeight, useMenuScroll, MenuScrollArrow } from "../../menus/dist/index.js";
|
|
4
4
|
import { useFloatingParentNodeId, FloatingTree, useFloating, offset, flip, shift, size, autoUpdate, useHover, safePolygon, useClick, useRole, useDismiss, useListNavigation, useTypeahead, useInteractions, FloatingNode, FloatingList, FloatingPortal, FloatingOverlay, FloatingFocusManager } from "@floating-ui/react";
|
|
5
5
|
import { memo, useState, useId, useContext, useRef, useMemo, useEffect, Children, isValidElement, cloneElement } from "react";
|
|
6
6
|
import { useEventCallback } from "usehooks-ts";
|
|
@@ -383,15 +383,16 @@ const BaseDropdown = memo(function Dropdown2(props) {
|
|
|
383
383
|
});
|
|
384
384
|
const Dropdown = Object.assign(BaseDropdown, {
|
|
385
385
|
displayName: "Dropdown",
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
SubTrigger: MenuContextSubTrigger,
|
|
386
|
+
Button: MenuButton,
|
|
387
|
+
Content: MenuContextContent,
|
|
389
388
|
Divider: MenuDivider,
|
|
389
|
+
Empty: MenuEmpty,
|
|
390
|
+
Input: MenuInput,
|
|
391
|
+
Item: MenuContextItem,
|
|
390
392
|
Label: MenuContextLabel,
|
|
391
393
|
Search: MenuSearch,
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
Content: MenuContextContent,
|
|
394
|
+
SubTrigger: MenuContextSubTrigger,
|
|
395
|
+
Trigger: MenuTrigger,
|
|
395
396
|
Value: MenuValue
|
|
396
397
|
});
|
|
397
398
|
export {
|
|
@@ -36,6 +36,7 @@ export * from './modal/src';
|
|
|
36
36
|
export * from './multi-select/src';
|
|
37
37
|
export * from './notifications/src';
|
|
38
38
|
export * from './numeric-input/src';
|
|
39
|
+
export * from './otp-input/src';
|
|
39
40
|
export * from './pagination/src';
|
|
40
41
|
export * from './panel/src';
|
|
41
42
|
export * from './picture-preview/src';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default, { memo, forwardRef, useContext, useMemo } from "react";
|
|
3
3
|
import { useEventCallback } from "usehooks-ts";
|
|
4
4
|
import { DEFAULT_TOOLBAR_GROUPS } from "./default-actions.js";
|
|
5
5
|
import { ToolbarButton } from "./toolbar-button.js";
|
|
@@ -66,7 +66,7 @@ const Toolbar = memo(
|
|
|
66
66
|
...rest,
|
|
67
67
|
children: [
|
|
68
68
|
beforeElement,
|
|
69
|
-
filteredGroups.map((group, groupIndex) => /* @__PURE__ */ jsxs(
|
|
69
|
+
filteredGroups.map((group, groupIndex) => /* @__PURE__ */ jsxs(React__default.Fragment, { children: [
|
|
70
70
|
groupIndex > 0 && /* @__PURE__ */ jsx("div", { className: tcx(tv.divider()) }),
|
|
71
71
|
group.map((action) => /* @__PURE__ */ jsx(
|
|
72
72
|
ToolbarButton,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default, { memo, forwardRef, useState, useRef, useMemo } from "react";
|
|
3
3
|
import { useEventCallback } from "usehooks-ts";
|
|
4
4
|
import { MdInputContainer } from "./components/md-input-container.js";
|
|
5
5
|
import { MdInputEditor } from "./components/md-input-editor.js";
|
|
@@ -37,10 +37,10 @@ const MdInputRoot = memo(
|
|
|
37
37
|
const hasTabs = useMemo(() => {
|
|
38
38
|
const checkForTabs = (node) => {
|
|
39
39
|
let found = false;
|
|
40
|
-
|
|
40
|
+
React__default.Children.forEach(node, (child) => {
|
|
41
41
|
var _a;
|
|
42
42
|
if (found) return;
|
|
43
|
-
if (
|
|
43
|
+
if (React__default.isValidElement(child)) {
|
|
44
44
|
const type = child.type;
|
|
45
45
|
if (type.displayName === "MdInputTabs" || type === MdInputTabs) {
|
|
46
46
|
found = true;
|
|
@@ -19,6 +19,11 @@ declare const MenuCheckbox: react.NamedExoticComponent<MenuCheckboxProps>;
|
|
|
19
19
|
|
|
20
20
|
declare const MenuDivider: react.ForwardRefExoticComponent<Omit<HTMLProps<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
21
21
|
|
|
22
|
+
interface MenuEmptyProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
}
|
|
25
|
+
declare const MenuEmpty: react.NamedExoticComponent<MenuEmptyProps>;
|
|
26
|
+
|
|
22
27
|
interface MenuItemProps extends React.HTMLAttributes<HTMLButtonElement> {
|
|
23
28
|
active?: boolean;
|
|
24
29
|
children?: ReactNode;
|
|
@@ -480,4 +485,4 @@ declare const MenuContextLabel: react.NamedExoticComponent<MenuLabelProps>;
|
|
|
480
485
|
|
|
481
486
|
declare const MenuContextSubTrigger: react.MemoExoticComponent<react.ForwardRefExoticComponent<MenuItemProps & react.RefAttributes<HTMLButtonElement>>>;
|
|
482
487
|
|
|
483
|
-
export { MenuButton, MenuCheckbox, type MenuCheckboxProps, MenuContext, MenuContextContent, MenuContextItem, type MenuContextItemProps, MenuContextLabel, MenuContextSubTrigger, type MenuContextType, MenuDivider, MenuInput, MenuItem, type MenuItemProps, MenuLabel, type MenuLabelProps, MenuScrollArrow, type MenuScrollArrowProps, MenuSearch, MenuSearchEmpty, MenuTrigger, type MenuTriggerProps, MenuValue, Menus, type MenusProps, useMenuBaseRefs, useMenuChildren, useMenuFloating, useMenuRefs, useMenuScroll, useMenuScrollHeight, useMenuSelection, useMenuState, useMenuTree };
|
|
488
|
+
export { MenuButton, MenuCheckbox, type MenuCheckboxProps, MenuContext, MenuContextContent, MenuContextItem, type MenuContextItemProps, MenuContextLabel, MenuContextSubTrigger, type MenuContextType, MenuDivider, MenuEmpty, MenuInput, MenuItem, type MenuItemProps, MenuLabel, type MenuLabelProps, MenuScrollArrow, type MenuScrollArrowProps, MenuSearch, MenuSearchEmpty, MenuTrigger, type MenuTriggerProps, MenuValue, Menus, type MenusProps, useMenuBaseRefs, useMenuChildren, useMenuFloating, useMenuRefs, useMenuScroll, useMenuScrollHeight, useMenuSelection, useMenuState, useMenuTree };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Button } from "../../button/dist/index.js";
|
|
2
|
-
import
|
|
2
|
+
import React__default, { forwardRef, memo, useContext, createContext, useMemo, startTransition, useCallback, useRef, Children, isValidElement, Fragment as Fragment$1, useState, useEffect } from "react";
|
|
3
3
|
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { Check, ChevronRightSmall, ChevronDownSmall, ChevronUpSmall } from "@choiceform/icons-react";
|
|
5
5
|
import { Kbd } from "../../kbd/dist/index.js";
|
|
@@ -192,6 +192,16 @@ var MenuSearchEmptyTv = tcv({
|
|
|
192
192
|
text: "text-white/50"
|
|
193
193
|
}
|
|
194
194
|
});
|
|
195
|
+
var MenuEmptyTv = tcv({
|
|
196
|
+
slots: {
|
|
197
|
+
root: [
|
|
198
|
+
"flex items-center justify-center py-3 px-2",
|
|
199
|
+
"text-body-medium text-secondary-foreground",
|
|
200
|
+
"group-data-[variant=light]/menus:text-gray-500",
|
|
201
|
+
"group-data-[variant=default]/menus:text-white/50"
|
|
202
|
+
]
|
|
203
|
+
}
|
|
204
|
+
});
|
|
195
205
|
var MenuLabelTv = tcv({
|
|
196
206
|
base: "flex h-6 w-full flex-none items-center gap-2 opacity-50",
|
|
197
207
|
variants: {
|
|
@@ -322,6 +332,19 @@ var MenuDivider = forwardRef((props, ref) => {
|
|
|
322
332
|
);
|
|
323
333
|
});
|
|
324
334
|
MenuDivider.displayName = "MenuDivider";
|
|
335
|
+
var MenuEmpty = memo(function MenuEmpty2(props) {
|
|
336
|
+
const { children, className, ...rest } = props;
|
|
337
|
+
const tv = MenuEmptyTv();
|
|
338
|
+
return /* @__PURE__ */ jsx(
|
|
339
|
+
"div",
|
|
340
|
+
{
|
|
341
|
+
...rest,
|
|
342
|
+
className: tcx(tv.root(), className),
|
|
343
|
+
children
|
|
344
|
+
}
|
|
345
|
+
);
|
|
346
|
+
});
|
|
347
|
+
MenuEmpty.displayName = "MenuEmpty";
|
|
325
348
|
var MenuItem = memo(
|
|
326
349
|
forwardRef((props, ref) => {
|
|
327
350
|
const {
|
|
@@ -703,7 +726,7 @@ var MenusBase = forwardRef((props, ref) => {
|
|
|
703
726
|
return processChildren(child.props.children);
|
|
704
727
|
}
|
|
705
728
|
if (child.props.children) {
|
|
706
|
-
return
|
|
729
|
+
return React__default.cloneElement(child, {
|
|
707
730
|
...child.props,
|
|
708
731
|
children: processChildren(child.props.children)
|
|
709
732
|
});
|
|
@@ -1125,6 +1148,7 @@ export {
|
|
|
1125
1148
|
MenuContextLabel,
|
|
1126
1149
|
MenuContextSubTrigger,
|
|
1127
1150
|
MenuDivider,
|
|
1151
|
+
MenuEmpty,
|
|
1128
1152
|
MenuInput,
|
|
1129
1153
|
MenuItem,
|
|
1130
1154
|
MenuLabel,
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { memo } from "react";
|
|
3
|
+
import { MenuEmptyTv } from "../tv.js";
|
|
4
|
+
import { tcx } from "../../../../shared/utils/tcx/tcx.js";
|
|
5
|
+
const MenuEmpty = memo(function MenuEmpty2(props) {
|
|
6
|
+
const { children, className, ...rest } = props;
|
|
7
|
+
const tv = MenuEmptyTv();
|
|
8
|
+
return /* @__PURE__ */ jsx(
|
|
9
|
+
"div",
|
|
10
|
+
{
|
|
11
|
+
...rest,
|
|
12
|
+
className: tcx(tv.root(), className),
|
|
13
|
+
children
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
});
|
|
17
|
+
MenuEmpty.displayName = "MenuEmpty";
|
|
18
|
+
export {
|
|
19
|
+
MenuEmpty
|
|
20
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { MenuButton, MenuCheckbox, MenuDivider, MenuInput, MenuItem, MenuLabel, MenuSearch, MenuSearchEmpty, MenuValue, MenuTrigger, MenuScrollArrow, } from './components';
|
|
1
|
+
export { MenuButton, MenuCheckbox, MenuDivider, MenuEmpty, MenuInput, MenuItem, MenuLabel, MenuSearch, MenuSearchEmpty, MenuValue, MenuTrigger, MenuScrollArrow, } from './components';
|
|
2
2
|
export { Menus } from './menus';
|
|
3
3
|
export { useMenuBaseRefs, useMenuChildren, useMenuFloating, useMenuRefs, useMenuScroll, useMenuScrollHeight, useMenuSelection, useMenuState, useMenuTree, } from './hooks';
|
|
4
4
|
export { MenuContext, MenuContextSubTrigger, MenuContextContent, MenuContextItem, MenuContextLabel, } from './context';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import
|
|
2
|
+
import React__default, { forwardRef, Children, isValidElement, Fragment } from "react";
|
|
3
3
|
import { MenuButton } from "./components/menu-button.js";
|
|
4
4
|
import { MenuCheckbox } from "./components/menu-checkbox.js";
|
|
5
5
|
import { MenuDivider } from "./components/menu-divider.js";
|
|
@@ -20,7 +20,7 @@ const MenusBase = forwardRef((props, ref) => {
|
|
|
20
20
|
return processChildren(child.props.children);
|
|
21
21
|
}
|
|
22
22
|
if (child.props.children) {
|
|
23
|
-
return
|
|
23
|
+
return React__default.cloneElement(child, {
|
|
24
24
|
...child.props,
|
|
25
25
|
children: processChildren(child.props.children)
|
|
26
26
|
});
|
|
@@ -339,6 +339,31 @@ export declare const MenuSearchEmptyTv: import('tailwind-variants').TVReturnType
|
|
|
339
339
|
root: string;
|
|
340
340
|
text: string;
|
|
341
341
|
}, undefined, unknown, unknown, undefined>>;
|
|
342
|
+
export declare const MenuEmptyTv: import('tailwind-variants').TVReturnType<{
|
|
343
|
+
[key: string]: {
|
|
344
|
+
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
345
|
+
root?: import('tailwind-merge').ClassNameValue;
|
|
346
|
+
};
|
|
347
|
+
};
|
|
348
|
+
} | {
|
|
349
|
+
[x: string]: {
|
|
350
|
+
[x: string]: import('tailwind-merge').ClassNameValue | {
|
|
351
|
+
root?: import('tailwind-merge').ClassNameValue;
|
|
352
|
+
};
|
|
353
|
+
};
|
|
354
|
+
} | {}, {
|
|
355
|
+
root: string[];
|
|
356
|
+
}, undefined, {
|
|
357
|
+
[key: string]: {
|
|
358
|
+
[key: string]: import('tailwind-merge').ClassNameValue | {
|
|
359
|
+
root?: import('tailwind-merge').ClassNameValue;
|
|
360
|
+
};
|
|
361
|
+
};
|
|
362
|
+
} | {}, {
|
|
363
|
+
root: string[];
|
|
364
|
+
}, import('tailwind-variants').TVReturnType<unknown, {
|
|
365
|
+
root: string[];
|
|
366
|
+
}, undefined, unknown, unknown, undefined>>;
|
|
342
367
|
export declare const MenuLabelTv: import('tailwind-variants').TVReturnType<{
|
|
343
368
|
selection: {
|
|
344
369
|
true: string;
|
|
@@ -180,6 +180,16 @@ const MenuSearchEmptyTv = tcv({
|
|
|
180
180
|
text: "text-white/50"
|
|
181
181
|
}
|
|
182
182
|
});
|
|
183
|
+
const MenuEmptyTv = tcv({
|
|
184
|
+
slots: {
|
|
185
|
+
root: [
|
|
186
|
+
"flex items-center justify-center py-3 px-2",
|
|
187
|
+
"text-body-medium text-secondary-foreground",
|
|
188
|
+
"group-data-[variant=light]/menus:text-gray-500",
|
|
189
|
+
"group-data-[variant=default]/menus:text-white/50"
|
|
190
|
+
]
|
|
191
|
+
}
|
|
192
|
+
});
|
|
183
193
|
const MenuLabelTv = tcv({
|
|
184
194
|
base: "flex h-6 w-full flex-none items-center gap-2 opacity-50",
|
|
185
195
|
variants: {
|
|
@@ -278,6 +288,7 @@ export {
|
|
|
278
288
|
MenuButtonTv,
|
|
279
289
|
MenuCheckboxTv,
|
|
280
290
|
MenuDividerTv,
|
|
291
|
+
MenuEmptyTv,
|
|
281
292
|
MenuItemTv,
|
|
282
293
|
MenuLabelTv,
|
|
283
294
|
MenuScrollArrowTv,
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChipProps } from '../../chip/src';
|
|
2
|
-
import { MenuContextContent, MenuDivider, MenuContextItem, MenuContextLabel, MenuValue } from '../../menus/src';
|
|
2
|
+
import { MenuContextContent, MenuDivider, MenuEmpty, MenuContextItem, MenuContextLabel, MenuValue } from '../../menus/src';
|
|
3
3
|
import { FloatingFocusManagerProps, Placement } from '@floating-ui/react';
|
|
4
4
|
import { default as React__default, HTMLProps, ReactNode } from 'react';
|
|
5
5
|
import * as React$1 from 'react';
|
|
@@ -67,6 +67,7 @@ interface MultiSelectProps {
|
|
|
67
67
|
interface MultiSelectComponentType extends React__default.ForwardRefExoticComponent<MultiSelectProps & React__default.RefAttributes<HTMLDivElement>> {
|
|
68
68
|
Content: typeof MenuContextContent;
|
|
69
69
|
Divider: typeof MenuDivider;
|
|
70
|
+
Empty: typeof MenuEmpty;
|
|
70
71
|
Item: typeof MenuContextItem;
|
|
71
72
|
Label: typeof MenuContextLabel;
|
|
72
73
|
Trigger: typeof MultiSelectTrigger;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Slot } from "../../slot/dist/index.js";
|
|
2
|
-
import { MenuValue,
|
|
2
|
+
import { MenuValue, MenuContextLabel, MenuContextItem, MenuEmpty, MenuDivider, MenuContextContent, useMenuBaseRefs, useMenuScroll, useMenuScrollHeight, MenuContext, MenuScrollArrow } from "../../menus/dist/index.js";
|
|
3
3
|
import { useFloatingParentNodeId, FloatingTree, useFloatingNodeId, useFloatingTree, offset, flip, shift, size, useFloating, autoUpdate, useClick, useDismiss, useRole, useListNavigation, useTypeahead, useInteractions, FloatingNode, FloatingPortal, FloatingOverlay, FloatingFocusManager, FloatingList } from "@floating-ui/react";
|
|
4
|
-
import
|
|
4
|
+
import React__default, { memo, forwardRef, useRef, useCallback, useMemo, Children, isValidElement, useId, useEffect, useState, cloneElement } from "react";
|
|
5
5
|
import { useEventCallback } from "usehooks-ts";
|
|
6
6
|
import { Chip } from "../../chip/dist/index.js";
|
|
7
7
|
import { ChevronDownSmall } from "@choiceform/icons-react";
|
|
@@ -354,9 +354,9 @@ function extractItemElements(children) {
|
|
|
354
354
|
const result = [];
|
|
355
355
|
children2.forEach((child) => {
|
|
356
356
|
if (!isValidElement(child)) return;
|
|
357
|
-
if (child.type === MenuContextItem || child.type === MenuDivider || child.type === MenuContextLabel) {
|
|
357
|
+
if (child.type === MenuContextItem || child.type === MenuDivider || child.type === MenuContextLabel || child.type === MenuEmpty) {
|
|
358
358
|
result.push(child);
|
|
359
|
-
} else if (child.type ===
|
|
359
|
+
} else if (child.type === React__default.Fragment && child.props.children) {
|
|
360
360
|
const fragmentChildren = Children.toArray(child.props.children);
|
|
361
361
|
result.push(...extractItems(fragmentChildren));
|
|
362
362
|
}
|
|
@@ -375,6 +375,9 @@ function processOptions(itemElements) {
|
|
|
375
375
|
if (child.type === MenuContextLabel) {
|
|
376
376
|
return { label: true, children: child.props.children };
|
|
377
377
|
}
|
|
378
|
+
if (child.type === MenuEmpty) {
|
|
379
|
+
return { empty: true, children: child.props.children, element: child };
|
|
380
|
+
}
|
|
378
381
|
const {
|
|
379
382
|
value: itemValue,
|
|
380
383
|
children: itemChildren,
|
|
@@ -390,7 +393,7 @@ function processOptions(itemElements) {
|
|
|
390
393
|
});
|
|
391
394
|
}
|
|
392
395
|
function filterSelectableOptions(options) {
|
|
393
|
-
return options.filter((option) => !option.divider && !option.label);
|
|
396
|
+
return options.filter((option) => !option.divider && !option.label && !option.empty);
|
|
394
397
|
}
|
|
395
398
|
var PORTAL_ROOT_ID = "floating-menu-root";
|
|
396
399
|
var MultiSelectComponent = memo(
|
|
@@ -654,6 +657,9 @@ var MultiSelectComponent = memo(
|
|
|
654
657
|
if (option.label) {
|
|
655
658
|
return /* @__PURE__ */ jsx(MenuContextLabel, { children: option.children }, `label-${index}`);
|
|
656
659
|
}
|
|
660
|
+
if (option.empty) {
|
|
661
|
+
return /* @__PURE__ */ jsx(MenuEmpty, { children: option.children }, `empty-${index}`);
|
|
662
|
+
}
|
|
657
663
|
const currentSelectableIndex = selectableIndex;
|
|
658
664
|
selectableIndex++;
|
|
659
665
|
const isSelected = values.includes(option.value || "");
|
|
@@ -844,11 +850,12 @@ var BaseMultiSelect = memo(function MultiSelect(props) {
|
|
|
844
850
|
return /* @__PURE__ */ jsx(MultiSelectComponent, { ...props, children });
|
|
845
851
|
});
|
|
846
852
|
var MultiSelect2 = Object.assign(BaseMultiSelect, {
|
|
847
|
-
|
|
848
|
-
Trigger: MultiSelectTrigger,
|
|
853
|
+
Content: MenuContextContent,
|
|
849
854
|
Divider: MenuDivider,
|
|
855
|
+
Empty: MenuEmpty,
|
|
856
|
+
Item: MenuContextItem,
|
|
850
857
|
Label: MenuContextLabel,
|
|
851
|
-
|
|
858
|
+
Trigger: MultiSelectTrigger,
|
|
852
859
|
Value: MenuValue
|
|
853
860
|
});
|
|
854
861
|
MultiSelect2.displayName = "MultiSelect";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ChipProps } from '../../chip/src';
|
|
2
|
-
import { MenuContextContent, MenuContextItem, MenuContextLabel, MenuDivider, MenuValue } from '../../menus/src';
|
|
2
|
+
import { MenuContextContent, MenuContextItem, MenuContextLabel, MenuDivider, MenuEmpty, MenuValue } from '../../menus/src';
|
|
3
3
|
import { FloatingFocusManagerProps, Placement } from '@floating-ui/react';
|
|
4
4
|
import { default as React } from 'react';
|
|
5
5
|
import { MultiSelectTrigger } from './components';
|
|
@@ -42,6 +42,7 @@ export interface MultiSelectProps {
|
|
|
42
42
|
interface MultiSelectComponentType extends React.ForwardRefExoticComponent<MultiSelectProps & React.RefAttributes<HTMLDivElement>> {
|
|
43
43
|
Content: typeof MenuContextContent;
|
|
44
44
|
Divider: typeof MenuDivider;
|
|
45
|
+
Empty: typeof MenuEmpty;
|
|
45
46
|
Item: typeof MenuContextItem;
|
|
46
47
|
Label: typeof MenuContextLabel;
|
|
47
48
|
Trigger: typeof MultiSelectTrigger;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Slot } from "../../slot/dist/index.js";
|
|
3
|
-
import { MenuValue,
|
|
3
|
+
import { MenuValue, MenuContextLabel, MenuContextItem, MenuEmpty, MenuDivider, MenuContextContent, useMenuBaseRefs, useMenuScroll, useMenuScrollHeight, MenuContext, MenuScrollArrow } from "../../menus/dist/index.js";
|
|
4
4
|
import { useFloatingParentNodeId, FloatingTree, useFloatingNodeId, useFloatingTree, offset, flip, shift, size, useFloating, autoUpdate, useClick, useDismiss, useRole, useListNavigation, useTypeahead, useInteractions, FloatingNode, FloatingPortal, FloatingOverlay, FloatingFocusManager, FloatingList } from "@floating-ui/react";
|
|
5
5
|
import { memo, forwardRef, useMemo, Children, isValidElement, useRef, useId, useEffect, useState, cloneElement } from "react";
|
|
6
6
|
import { useEventCallback } from "usehooks-ts";
|
|
@@ -272,6 +272,9 @@ const MultiSelectComponent = memo(
|
|
|
272
272
|
if (option.label) {
|
|
273
273
|
return /* @__PURE__ */ jsx(MenuContextLabel, { children: option.children }, `label-${index}`);
|
|
274
274
|
}
|
|
275
|
+
if (option.empty) {
|
|
276
|
+
return /* @__PURE__ */ jsx(MenuEmpty, { children: option.children }, `empty-${index}`);
|
|
277
|
+
}
|
|
275
278
|
const currentSelectableIndex = selectableIndex;
|
|
276
279
|
selectableIndex++;
|
|
277
280
|
const isSelected = values.includes(option.value || "");
|
|
@@ -462,11 +465,12 @@ const BaseMultiSelect = memo(function MultiSelect2(props) {
|
|
|
462
465
|
return /* @__PURE__ */ jsx(MultiSelectComponent, { ...props, children });
|
|
463
466
|
});
|
|
464
467
|
const MultiSelect = Object.assign(BaseMultiSelect, {
|
|
465
|
-
|
|
466
|
-
Trigger: MultiSelectTrigger,
|
|
468
|
+
Content: MenuContextContent,
|
|
467
469
|
Divider: MenuDivider,
|
|
470
|
+
Empty: MenuEmpty,
|
|
471
|
+
Item: MenuContextItem,
|
|
468
472
|
Label: MenuContextLabel,
|
|
469
|
-
|
|
473
|
+
Trigger: MultiSelectTrigger,
|
|
470
474
|
Value: MenuValue
|
|
471
475
|
});
|
|
472
476
|
MultiSelect.displayName = "MultiSelect";
|
|
@@ -4,18 +4,29 @@ export declare function processOptions(itemElements: React.ReactNode[]): ({
|
|
|
4
4
|
divider: boolean;
|
|
5
5
|
label?: undefined;
|
|
6
6
|
children?: undefined;
|
|
7
|
+
empty?: undefined;
|
|
8
|
+
element?: undefined;
|
|
7
9
|
value?: undefined;
|
|
8
10
|
disabled?: undefined;
|
|
9
11
|
_originalIndex?: undefined;
|
|
10
|
-
element?: undefined;
|
|
11
12
|
} | {
|
|
12
13
|
label: boolean;
|
|
13
14
|
children: any;
|
|
14
15
|
divider?: undefined;
|
|
16
|
+
empty?: undefined;
|
|
17
|
+
element?: undefined;
|
|
18
|
+
value?: undefined;
|
|
19
|
+
disabled?: undefined;
|
|
20
|
+
_originalIndex?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
empty: boolean;
|
|
23
|
+
children: any;
|
|
24
|
+
element: React.ReactPortal | React.ReactElement<unknown, string | React.JSXElementConstructor<any>>;
|
|
25
|
+
divider?: undefined;
|
|
26
|
+
label?: undefined;
|
|
15
27
|
value?: undefined;
|
|
16
28
|
disabled?: undefined;
|
|
17
29
|
_originalIndex?: undefined;
|
|
18
|
-
element?: undefined;
|
|
19
30
|
} | {
|
|
20
31
|
value: string | undefined;
|
|
21
32
|
disabled: boolean | undefined;
|
|
@@ -24,17 +35,20 @@ export declare function processOptions(itemElements: React.ReactNode[]): ({
|
|
|
24
35
|
children: React.ReactNode;
|
|
25
36
|
divider?: undefined;
|
|
26
37
|
label?: undefined;
|
|
38
|
+
empty?: undefined;
|
|
27
39
|
})[];
|
|
28
40
|
export declare function filterSelectableOptions(options: Array<{
|
|
29
41
|
disabled?: boolean;
|
|
30
42
|
divider?: boolean;
|
|
31
43
|
element?: React.ReactElement;
|
|
44
|
+
empty?: boolean;
|
|
32
45
|
label?: boolean;
|
|
33
46
|
value?: string;
|
|
34
47
|
}>): {
|
|
35
48
|
disabled?: boolean;
|
|
36
49
|
divider?: boolean;
|
|
37
50
|
element?: React.ReactElement;
|
|
51
|
+
empty?: boolean;
|
|
38
52
|
label?: boolean;
|
|
39
53
|
value?: string;
|
|
40
54
|
}[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { MenuDivider, MenuContextLabel, MenuContextItem } from "../../../menus/dist/index.js";
|
|
2
|
-
import
|
|
1
|
+
import { MenuDivider, MenuContextLabel, MenuEmpty, MenuContextItem } from "../../../menus/dist/index.js";
|
|
2
|
+
import React__default, { Children, isValidElement } from "react";
|
|
3
3
|
function extractItemElements(children) {
|
|
4
4
|
if (!children) return [];
|
|
5
5
|
const childrenArray = Children.toArray(children);
|
|
@@ -7,9 +7,9 @@ function extractItemElements(children) {
|
|
|
7
7
|
const result = [];
|
|
8
8
|
children2.forEach((child) => {
|
|
9
9
|
if (!isValidElement(child)) return;
|
|
10
|
-
if (child.type === MenuContextItem || child.type === MenuDivider || child.type === MenuContextLabel) {
|
|
10
|
+
if (child.type === MenuContextItem || child.type === MenuDivider || child.type === MenuContextLabel || child.type === MenuEmpty) {
|
|
11
11
|
result.push(child);
|
|
12
|
-
} else if (child.type ===
|
|
12
|
+
} else if (child.type === React__default.Fragment && child.props.children) {
|
|
13
13
|
const fragmentChildren = Children.toArray(child.props.children);
|
|
14
14
|
result.push(...extractItems(fragmentChildren));
|
|
15
15
|
}
|
|
@@ -28,6 +28,9 @@ function processOptions(itemElements) {
|
|
|
28
28
|
if (child.type === MenuContextLabel) {
|
|
29
29
|
return { label: true, children: child.props.children };
|
|
30
30
|
}
|
|
31
|
+
if (child.type === MenuEmpty) {
|
|
32
|
+
return { empty: true, children: child.props.children, element: child };
|
|
33
|
+
}
|
|
31
34
|
const {
|
|
32
35
|
value: itemValue,
|
|
33
36
|
children: itemChildren,
|
|
@@ -43,7 +46,7 @@ function processOptions(itemElements) {
|
|
|
43
46
|
});
|
|
44
47
|
}
|
|
45
48
|
function filterSelectableOptions(options) {
|
|
46
|
-
return options.filter((option) => !option.divider && !option.label);
|
|
49
|
+
return options.filter((option) => !option.divider && !option.label && !option.empty);
|
|
47
50
|
}
|
|
48
51
|
export {
|
|
49
52
|
extractItemElements,
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { OTPInput } from 'input-otp';
|
|
2
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
type OTPInputVariant = "default" | "light" | "dark";
|
|
6
|
+
interface OTPInputRootProps extends Omit<ComponentProps<typeof OTPInput>, "disabled" | "containerClassName" | "render"> {
|
|
7
|
+
variant?: OTPInputVariant;
|
|
8
|
+
disabled?: boolean;
|
|
9
|
+
isInvalid?: boolean;
|
|
10
|
+
inputClassName?: string;
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
}
|
|
13
|
+
declare function OTPInputRoot({ className, inputClassName, variant, disabled, isInvalid, children, ...props }: OTPInputRootProps): react_jsx_runtime.JSX.Element;
|
|
14
|
+
interface OTPInputGroupProps extends ComponentProps<"div"> {
|
|
15
|
+
}
|
|
16
|
+
declare function OTPInputGroup({ className, ...props }: OTPInputGroupProps): react_jsx_runtime.JSX.Element;
|
|
17
|
+
interface OTPInputSlotProps extends ComponentProps<"div"> {
|
|
18
|
+
index: number;
|
|
19
|
+
}
|
|
20
|
+
declare function OTPInputSlot({ className, index, ...props }: OTPInputSlotProps): react_jsx_runtime.JSX.Element;
|
|
21
|
+
interface OTPInputSeparatorProps extends ComponentProps<"div"> {
|
|
22
|
+
}
|
|
23
|
+
declare function OTPInputSeparator({ className, children, ...props }: OTPInputSeparatorProps): react_jsx_runtime.JSX.Element;
|
|
24
|
+
declare const OtpInput: typeof OTPInputRoot & {
|
|
25
|
+
Group: typeof OTPInputGroup;
|
|
26
|
+
Slot: typeof OTPInputSlot;
|
|
27
|
+
Separator: typeof OTPInputSeparator;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export { type OTPInputGroupProps, type OTPInputRootProps, type OTPInputSeparatorProps, type OTPInputSlotProps, OtpInput };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { OTPInput } from 'input-otp';
|
|
2
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
type OTPInputVariant = "default" | "light" | "dark";
|
|
4
|
+
export interface OTPInputRootProps extends Omit<ComponentProps<typeof OTPInput>, "disabled" | "containerClassName" | "render"> {
|
|
5
|
+
variant?: OTPInputVariant;
|
|
6
|
+
disabled?: boolean;
|
|
7
|
+
isInvalid?: boolean;
|
|
8
|
+
inputClassName?: string;
|
|
9
|
+
children: ReactNode;
|
|
10
|
+
}
|
|
11
|
+
declare function OTPInputRoot({ className, inputClassName, variant, disabled, isInvalid, children, ...props }: OTPInputRootProps): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export interface OTPInputGroupProps extends ComponentProps<"div"> {
|
|
13
|
+
}
|
|
14
|
+
declare function OTPInputGroup({ className, ...props }: OTPInputGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
export interface OTPInputSlotProps extends ComponentProps<"div"> {
|
|
16
|
+
index: number;
|
|
17
|
+
}
|
|
18
|
+
declare function OTPInputSlot({ className, index, ...props }: OTPInputSlotProps): import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export interface OTPInputSeparatorProps extends ComponentProps<"div"> {
|
|
20
|
+
}
|
|
21
|
+
declare function OTPInputSeparator({ className, children, ...props }: OTPInputSeparatorProps): import("react/jsx-runtime").JSX.Element;
|
|
22
|
+
export declare const OtpInput: typeof OTPInputRoot & {
|
|
23
|
+
Group: typeof OTPInputGroup;
|
|
24
|
+
Slot: typeof OTPInputSlot;
|
|
25
|
+
Separator: typeof OTPInputSeparator;
|
|
26
|
+
};
|
|
27
|
+
export {};
|