@choice-ui/react 1.4.0 → 1.4.2

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.
Files changed (77) hide show
  1. package/dist/components/button/dist/index.d.ts +1 -1
  2. package/dist/components/button/src/button.d.ts +1 -1
  3. package/dist/components/calendar/dist/index.d.ts +1 -1
  4. package/dist/components/calendar/src/date-input/date-input.d.ts +1 -1
  5. package/dist/components/calendar/src/date-range-input/date-range-input.d.ts +1 -1
  6. package/dist/components/calendar/src/time-input/time-input.d.ts +1 -1
  7. package/dist/components/calendar/src/time-range-input/time-range-input.d.ts +1 -1
  8. package/dist/components/combobox/dist/index.d.ts +1 -1
  9. package/dist/components/combobox/src/combobox.d.ts +1 -1
  10. package/dist/components/command/dist/index.d.ts +4 -4
  11. package/dist/components/command/src/components/command-input.d.ts +1 -1
  12. package/dist/components/command/src/components/command-item.d.ts +1 -1
  13. package/dist/components/command/src/components/command-list.d.ts +1 -1
  14. package/dist/components/command/src/components/command-tabs.d.ts +1 -1
  15. package/dist/components/command/src/index.d.ts +2 -2
  16. package/dist/components/context-input/dist/index.d.ts +1 -1
  17. package/dist/components/context-input/src/components/copy-button.d.ts +1 -1
  18. package/dist/components/context-input/src/components/insert-mentions-button.d.ts +1 -1
  19. package/dist/components/context-menu/dist/index.d.ts +1 -1
  20. package/dist/components/context-menu/src/context-menu.d.ts +1 -1
  21. package/dist/components/dialog/dist/index.d.ts +2 -2
  22. package/dist/components/dialog/src/components/dialog-header.d.ts +1 -1
  23. package/dist/components/dialog/src/dialog.d.ts +1 -1
  24. package/dist/components/dropdown/dist/index.d.ts +1 -1
  25. package/dist/components/dropdown/src/dropdown.d.ts +1 -1
  26. package/dist/components/form/dist/index.d.ts +11 -11
  27. package/dist/components/form/src/index.d.ts +1 -1
  28. package/dist/components/form/src/types.d.ts +10 -10
  29. package/dist/components/icon-button/dist/index.d.ts +1 -1
  30. package/dist/components/icon-button/src/icon-button.d.ts +1 -1
  31. package/dist/components/list/dist/index.d.ts +2 -2
  32. package/dist/components/list/src/components/list-item.d.ts +1 -1
  33. package/dist/components/list/src/list.d.ts +1 -1
  34. package/dist/components/md-input/dist/index.d.ts +2 -2
  35. package/dist/components/md-input/src/components/md-input-editor.d.ts +1 -1
  36. package/dist/components/md-input/src/components/md-input-render.d.ts +1 -1
  37. package/dist/components/menus/dist/index.d.ts +4 -4
  38. package/dist/components/menus/src/components/menu-button.d.ts +1 -1
  39. package/dist/components/menus/src/components/menu-input.d.ts +1 -1
  40. package/dist/components/menus/src/components/menu-item.d.ts +1 -1
  41. package/dist/components/menus/src/components/menu-search.d.ts +1 -1
  42. package/dist/components/menus/src/components/menu-trigger.d.ts +1 -1
  43. package/dist/components/modal/dist/index.d.ts +3 -3
  44. package/dist/components/modal/src/components/modal-input.d.ts +1 -1
  45. package/dist/components/modal/src/components/modal-select.d.ts +1 -1
  46. package/dist/components/modal/src/components/modal-textarea.d.ts +1 -1
  47. package/dist/components/multi-select/dist/index.d.ts +2 -2
  48. package/dist/components/multi-select/src/components/multi-select-trigger.d.ts +1 -1
  49. package/dist/components/multi-select/src/multi-select.d.ts +2 -2
  50. package/dist/components/numeric-input/dist/index.d.ts +2 -2
  51. package/dist/components/numeric-input/src/components/numeric-input-menu-trigger.d.ts +1 -1
  52. package/dist/components/numeric-input/src/numeric-input.d.ts +1 -1
  53. package/dist/components/pagination/dist/index.d.ts +1 -1
  54. package/dist/components/pagination/src/types.d.ts +1 -1
  55. package/dist/components/popover/dist/index.d.ts +1 -1
  56. package/dist/components/popover/src/components/popover-header.d.ts +1 -1
  57. package/dist/components/popover/src/popover.d.ts +1 -1
  58. package/dist/components/progress/dist/index.d.ts +1 -1
  59. package/dist/components/progress/src/progress-bar.d.ts +1 -1
  60. package/dist/components/rich-input/dist/index.d.ts +1 -1
  61. package/dist/components/rich-input/src/types/props-types.d.ts +1 -1
  62. package/dist/components/search-input/dist/index.d.ts +1 -1
  63. package/dist/components/search-input/src/search-input.d.ts +1 -1
  64. package/dist/components/segmented/dist/index.d.ts +1 -1
  65. package/dist/components/segmented/src/segmented-item.d.ts +1 -1
  66. package/dist/components/segmented/src/segmented.d.ts +1 -1
  67. package/dist/components/select/dist/index.d.ts +1 -1
  68. package/dist/components/select/src/select.d.ts +1 -1
  69. package/dist/components/text-field/dist/index.d.ts +2 -2
  70. package/dist/components/text-field/src/text-field.d.ts +2 -2
  71. package/dist/components/toggle-button/dist/index.d.ts +1 -1
  72. package/dist/components/toggle-button/src/toggle-button.d.ts +1 -1
  73. package/dist/components/tooltip/dist/index.d.ts +1 -1
  74. package/dist/components/tooltip/src/types.d.ts +1 -1
  75. package/dist/index.d.ts +1 -2
  76. package/dist/shared/index.d.ts +420 -0
  77. package/package.json +2 -2
@@ -1,5 +1,5 @@
1
1
  import { HTMLProps } from 'react';
2
- import { TooltipProps } from '@choice-ui/tooltip';
2
+ import { TooltipProps } from '../../tooltip/src';
3
3
  import * as react from 'react';
4
4
 
5
5
  interface ButtonProps extends Omit<HTMLProps<HTMLButtonElement>, "size"> {
@@ -1,4 +1,4 @@
1
- import { TooltipProps } from '@choice-ui/tooltip';
1
+ import { TooltipProps } from '../../tooltip/src';
2
2
  import { HTMLProps } from 'react';
3
3
  export interface ButtonProps extends Omit<HTMLProps<HTMLButtonElement>, "size"> {
4
4
  active?: boolean;
@@ -1,6 +1,6 @@
1
1
  import { default as React__default } from 'react';
2
2
  import { Locale, Quarter as Quarter$1, Day, isSameDay, isSameMonth, isSameYear, addMonths, startOfMonth, endOfMonth, startOfWeek, endOfWeek } from 'date-fns';
3
- import { TextFieldProps } from '@choice-ui/text-field';
3
+ import { TextFieldProps } from '../../text-field/src';
4
4
  import { TZDate } from '@date-fns/tz';
5
5
  import { Locale as Locale$1 } from 'date-fns/locale';
6
6
  import { PressMoveProps } from '../../../../../shared/src';
@@ -1,4 +1,4 @@
1
- import { TextFieldProps } from '@choice-ui/text-field';
1
+ import { TextFieldProps } from '../../../text-field/src';
2
2
  import { Locale } from 'date-fns';
3
3
  import { default as React } from 'react';
4
4
  import { DateDataFormat } from '../types';
@@ -1,4 +1,4 @@
1
- import { TextFieldProps } from '@choice-ui/text-field';
1
+ import { TextFieldProps } from '../../../text-field/src';
2
2
  import { Locale } from 'date-fns';
3
3
  import { DateDataFormat } from '../types';
4
4
  interface DateRangeInputProps extends Omit<TextFieldProps, "value" | "onChange" | "step" | "defaultValue"> {
@@ -1,4 +1,4 @@
1
- import { TextFieldProps } from '@choice-ui/text-field';
1
+ import { TextFieldProps } from '../../../text-field/src';
2
2
  import { default as React } from 'react';
3
3
  import { BaseTimeProps, StepProps, TimeInteractionProps } from '../types';
4
4
  interface TimeInputProps extends Omit<TextFieldProps, "value" | "onChange" | "format" | "defaultValue" | "step">, BaseTimeProps, StepProps, TimeInteractionProps {
@@ -1,4 +1,4 @@
1
- import { TextFieldProps } from '@choice-ui/text-field';
1
+ import { TextFieldProps } from '../../../text-field/src';
2
2
  import { Locale } from 'date-fns';
3
3
  import { TimeDataFormat } from '../types';
4
4
  interface TimeRangeInputProps extends Omit<TextFieldProps, "value" | "onChange" | "step" | "defaultValue"> {
@@ -1,4 +1,4 @@
1
- import { MenuButton, MenuContextContent, MenuDivider, MenuInput, MenuContextItem, MenuContextLabel, MenuValue } from '@choice-ui/menus';
1
+ import { MenuButton, MenuContextContent, MenuDivider, MenuInput, MenuContextItem, MenuContextLabel, MenuValue } from '../../menus/src';
2
2
  import { FloatingFocusManagerProps, Placement } from '@floating-ui/react';
3
3
  import { default as React, HTMLProps, ReactNode } from 'react';
4
4
  interface ComboboxTriggerProps extends Omit<HTMLProps<HTMLInputElement>, "size" | "onChange"> {
@@ -1,4 +1,4 @@
1
- import { MenuButton, MenuContextContent, MenuContextItem, MenuContextLabel, MenuDivider, MenuInput, MenuValue } from '@choice-ui/menus';
1
+ import { MenuButton, MenuContextContent, MenuContextItem, MenuContextLabel, MenuDivider, MenuInput, MenuValue } from '../../menus/src';
2
2
  import { FloatingFocusManagerProps, Placement } from '@floating-ui/react';
3
3
  import { default as React } from 'react';
4
4
  import { ComboboxTrigger } from './combobox-trigger';
@@ -1,8 +1,8 @@
1
1
  import { default as react__default, HTMLProps, ReactNode } from 'react';
2
- import { InputProps } from '@choice-ui/input';
3
- import { KbdKey } from '@choice-ui/kbd';
4
- import { ScrollAreaProps } from '@choice-ui/scroll-area';
5
- import * as _choice_ui_tabs from '@choice-ui/tabs';
2
+ import { InputProps } from '../../input/src';
3
+ import { KbdKey } from '../../kbd/src';
4
+ import { ScrollAreaProps } from '../../scroll-area/src';
5
+ import * as _choice_ui_tabs from '../../tabs/src';
6
6
  import * as react from 'react';
7
7
 
8
8
  interface CommandEmptyProps extends HTMLProps<HTMLDivElement> {
@@ -1,4 +1,4 @@
1
- import { InputProps } from '@choice-ui/input';
1
+ import { InputProps } from '../../../input/src';
2
2
  import { ReactNode } from 'react';
3
3
  export interface CommandInputProps extends Omit<InputProps, "value" | "onChange" | "type"> {
4
4
  onChange?: (search: string) => void;
@@ -1,4 +1,4 @@
1
- import { KbdKey } from '@choice-ui/kbd';
1
+ import { KbdKey } from '../../../kbd/src';
2
2
  import { default as React, HTMLProps, ReactNode } from 'react';
3
3
  export interface CommandItemProps extends Omit<HTMLProps<HTMLDivElement>, "onSelect"> {
4
4
  disabled?: boolean;
@@ -1,4 +1,4 @@
1
- import { ScrollAreaProps } from '@choice-ui/scroll-area';
1
+ import { ScrollAreaProps } from '../../../scroll-area/src';
2
2
  export interface CommandListProps extends ScrollAreaProps {
3
3
  children: React.ReactNode;
4
4
  className?: string;
@@ -1,2 +1,2 @@
1
- import { TabsProps } from '@choice-ui/tabs';
1
+ import { TabsProps } from '../../../tabs/src';
2
2
  export declare const CommandTabs: import('react').ForwardRefExoticComponent<Omit<TabsProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
@@ -10,6 +10,6 @@ export declare const Command: import('react').ForwardRefExoticComponent<import('
10
10
  Loading: import('react').ForwardRefExoticComponent<import('./components').CommandLoadingProps & import('react').RefAttributes<HTMLDivElement>>;
11
11
  Divider: import('react').ForwardRefExoticComponent<Omit<import('./components').CommandDividerProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
12
12
  Value: import('react').ForwardRefExoticComponent<Omit<import('react').HTMLProps<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
13
- Tabs: import('react').ForwardRefExoticComponent<Omit<import('@choice-ui/tabs').TabsProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
14
- TabItem: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<Omit<import('@choice-ui/tabs').TabItemProps, "ref"> & import('react').RefAttributes<HTMLElement>>>;
13
+ Tabs: import('react').ForwardRefExoticComponent<Omit<import('../../tabs/src').TabsProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
14
+ TabItem: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<Omit<import('../../tabs/src').TabItemProps, "ref"> & import('react').RefAttributes<HTMLElement>>>;
15
15
  };
@@ -1,5 +1,5 @@
1
1
  import { default as React__default, ComponentType } from 'react';
2
- import { IconButtonProps } from '@choice-ui/icon-button';
2
+ import { IconButtonProps } from '../../icon-button/src';
3
3
  import { RenderElementProps, ReactEditor } from 'slate-react';
4
4
  import { Descendant, Editor, Range } from 'slate';
5
5
  import { HistoryEditor } from 'slate-history';
@@ -1,4 +1,4 @@
1
- import { IconButtonProps } from '@choice-ui/icon-button';
1
+ import { IconButtonProps } from '../../../icon-button/src';
2
2
  import { default as React } from 'react';
3
3
  export interface CopyButtonProps extends Omit<IconButtonProps, "onClick"> {
4
4
  onClick?: (copiedText: string) => void;
@@ -1,4 +1,4 @@
1
- import { IconButtonProps } from '@choice-ui/icon-button';
1
+ import { IconButtonProps } from '../../../icon-button/src';
2
2
  interface InsertMentionsButtonProps extends IconButtonProps {
3
3
  onClick?: () => void;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { MenuButton, MenuContextContent, MenuDivider, MenuInput, MenuContextItem, MenuContextLabel, MenuSearch, MenuContextSubTrigger, MenuValue } from '@choice-ui/menus';
1
+ import { MenuButton, MenuContextContent, MenuDivider, MenuInput, MenuContextItem, MenuContextLabel, MenuSearch, MenuContextSubTrigger, MenuValue } from '../../menus/src';
2
2
  import { FloatingFocusManagerProps, Placement } from '@floating-ui/react';
3
3
  import { default as React, HTMLProps, ReactNode } from 'react';
4
4
  interface ContextMenuProps extends HTMLProps<HTMLDivElement> {
@@ -1,4 +1,4 @@
1
- import { MenuButton, MenuContextContent, MenuContextItem, MenuContextLabel, MenuContextSubTrigger, MenuDivider, MenuInput, MenuSearch, MenuValue } from '@choice-ui/menus';
1
+ import { MenuButton, MenuContextContent, MenuContextItem, MenuContextLabel, MenuContextSubTrigger, MenuDivider, MenuInput, MenuSearch, MenuValue } from '../../menus/src';
2
2
  import { FloatingFocusManagerProps, Placement } from '@floating-ui/react';
3
3
  import { default as React, HTMLProps, ReactNode } from 'react';
4
4
  export interface ContextMenuProps extends HTMLProps<HTMLDivElement> {
@@ -1,7 +1,7 @@
1
- import { ModalBackdrop, ModalContent, ModalFooter } from '@choice-ui/modal';
1
+ import { ModalBackdrop, ModalContent, ModalFooter } from '../../modal/src';
2
2
  import { FloatingFocusManagerProps, UseTransitionStylesProps } from '@floating-ui/react';
3
3
  import { default as react__default } from 'react';
4
- import * as _choice_ui_modal from '@choice-ui/modal';
4
+ import * as _choice_ui_modal from '../../modal/src';
5
5
  import * as react from 'react';
6
6
 
7
7
  declare const DialogHeader: react.MemoExoticComponent<react.ForwardRefExoticComponent<Omit<Omit<_choice_ui_modal.ModalHeaderProps, "ref"> & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>>;
@@ -1 +1 @@
1
- export declare const DialogHeader: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<Omit<Omit<import('@choice-ui/modal').ModalHeaderProps, "ref"> & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>>;
1
+ export declare const DialogHeader: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<Omit<Omit<import('../../../modal/src').ModalHeaderProps, "ref"> & import('react').RefAttributes<HTMLDivElement>, "ref"> & import('react').RefAttributes<HTMLDivElement>>>;
@@ -1,4 +1,4 @@
1
- import { ModalBackdrop, ModalContent, ModalFooter } from '@choice-ui/modal';
1
+ import { ModalBackdrop, ModalContent, ModalFooter } from '../../modal/src';
2
2
  import { FloatingFocusManagerProps, UseTransitionStylesProps } from '@floating-ui/react';
3
3
  import { default as React } from 'react';
4
4
  import { DialogHeader, DialogTrigger } from './components';
@@ -1,4 +1,4 @@
1
- import { MenuButton, MenuContextContent, MenuDivider, MenuInput, MenuContextItem, MenuContextLabel, MenuSearch, MenuContextSubTrigger, MenuTrigger, MenuValue } from '@choice-ui/menus';
1
+ import { MenuButton, MenuContextContent, MenuDivider, 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 {
@@ -1,4 +1,4 @@
1
- import { MenuButton, MenuContextContent, MenuContextItem, MenuContextLabel, MenuContextSubTrigger, MenuDivider, MenuInput, MenuSearch, MenuTrigger, MenuValue } from '@choice-ui/menus';
1
+ import { MenuButton, MenuContextContent, MenuContextItem, MenuContextLabel, MenuContextSubTrigger, MenuDivider, 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 {
@@ -1,16 +1,16 @@
1
1
  import { ReactNode } from 'react';
2
- import { CheckboxProps } from '@choice-ui/checkbox';
3
- import { InputProps } from '@choice-ui/input';
4
- import { SelectProps } from '@choice-ui/select';
5
- import { TextareaProps } from '@choice-ui/textarea';
6
- import { RadioGroupProps } from '@choice-ui/radio';
7
- import { SwitchProps } from '@choice-ui/switch';
8
- import { RangeProps } from '@choice-ui/range';
9
- import { NumericInputProps } from '@choice-ui/numeric-input';
10
- import { MultiSelectProps } from '@choice-ui/multi-select';
11
- import { SegmentedProps } from '@choice-ui/segmented';
2
+ import { CheckboxProps } from '../../checkbox/src';
3
+ import { InputProps } from '../../input/src';
4
+ import { SelectProps } from '../../select/src';
5
+ import { TextareaProps } from '../../textarea/src';
6
+ import { RadioGroupProps } from '../../radio/src';
7
+ import { SwitchProps } from '../../switch/src';
8
+ import { RangeProps } from '../../range/src';
9
+ import { NumericInputProps } from '../../numeric-input/src';
10
+ import { MultiSelectProps } from '../../multi-select/src';
11
+ import { SegmentedProps } from '../../segmented/src';
12
12
  import * as react from 'react';
13
- import * as _choice_ui_button from '@choice-ui/button';
13
+ import * as _choice_ui_button from '../../button/src';
14
14
  import * as _tanstack_react_form from '@tanstack/react-form';
15
15
  export { _tanstack_react_form as TanstackReactForm };
16
16
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -32,5 +32,5 @@ export declare function useForm(options: {
32
32
  NumericInput: typeof NumericInputAdapter;
33
33
  MultiSelect: typeof MultiSelectAdapter;
34
34
  Segmented: typeof SegmentedAdapter;
35
- Button: import('react').ForwardRefExoticComponent<Omit<import('@choice-ui/button').ButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
35
+ Button: import('react').ForwardRefExoticComponent<Omit<import('../../button/src').ButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>;
36
36
  };
@@ -1,14 +1,14 @@
1
1
  import { ReactNode } from 'react';
2
- import { CheckboxProps } from '@choice-ui/checkbox';
3
- import { InputProps } from '@choice-ui/input';
4
- import { SelectProps } from '@choice-ui/select';
5
- import { TextareaProps } from '@choice-ui/textarea';
6
- import { RadioGroupProps } from '@choice-ui/radio';
7
- import { SwitchProps } from '@choice-ui/switch';
8
- import { RangeProps } from '@choice-ui/range';
9
- import { NumericInputProps } from '@choice-ui/numeric-input';
10
- import { MultiSelectProps } from '@choice-ui/multi-select';
11
- import { SegmentedProps } from '@choice-ui/segmented';
2
+ import { CheckboxProps } from '../../checkbox/src';
3
+ import { InputProps } from '../../input/src';
4
+ import { SelectProps } from '../../select/src';
5
+ import { TextareaProps } from '../../textarea/src';
6
+ import { RadioGroupProps } from '../../radio/src';
7
+ import { SwitchProps } from '../../switch/src';
8
+ import { RangeProps } from '../../range/src';
9
+ import { NumericInputProps } from '../../numeric-input/src';
10
+ import { MultiSelectProps } from '../../multi-select/src';
11
+ import { SegmentedProps } from '../../segmented/src';
12
12
  /**
13
13
  * 表单验证器类型
14
14
  */
@@ -1,5 +1,5 @@
1
1
  import { HTMLProps } from 'react';
2
- import { TooltipProps } from '@choice-ui/tooltip';
2
+ import { TooltipProps } from '../../tooltip/src';
3
3
  import * as react from 'react';
4
4
 
5
5
  interface IconButtonProps extends Omit<HTMLProps<HTMLElement>, "size" | "as"> {
@@ -1,4 +1,4 @@
1
- import { TooltipProps } from '@choice-ui/tooltip';
1
+ import { TooltipProps } from '../../tooltip/src';
2
2
  import { HTMLProps } from 'react';
3
3
  export interface IconButtonProps extends Omit<HTMLProps<HTMLElement>, "size" | "as"> {
4
4
  active?: boolean;
@@ -1,6 +1,6 @@
1
1
  import { ReactNode, HTMLProps } from 'react';
2
- import { MenuValue } from '@choice-ui/menus';
3
- import { KbdKey } from '@choice-ui/kbd';
2
+ import { MenuValue } from '../../menus/src';
3
+ import { KbdKey } from '../../kbd/src';
4
4
  import * as react from 'react';
5
5
 
6
6
  interface ListContentProps extends React.HTMLProps<HTMLDivElement> {
@@ -1,4 +1,4 @@
1
- import { KbdKey } from '@choice-ui/kbd';
1
+ import { KbdKey } from '../../../kbd/src';
2
2
  import { ReactNode } from 'react';
3
3
  export interface ListItemProps extends React.HTMLAttributes<HTMLElement> {
4
4
  active?: boolean;
@@ -1,4 +1,4 @@
1
- import { MenuValue } from '@choice-ui/menus';
1
+ import { MenuValue } from '../../menus/src';
2
2
  import { HTMLProps } from 'react';
3
3
  import { ListContent } from './components/list-content';
4
4
  import { ListDivider } from './components/list-divider';
@@ -1,6 +1,6 @@
1
1
  import { default as react__default, HTMLAttributes } from 'react';
2
- import { TextareaProps } from '@choice-ui/textarea';
3
- import { MdRenderProps } from '@choice-ui/md-render';
2
+ import { TextareaProps } from '../../textarea/src';
3
+ import { MdRenderProps } from '../../md-render/src';
4
4
  import * as react from 'react';
5
5
 
6
6
  interface MdInputContainerProps {
@@ -1,4 +1,4 @@
1
- import { TextareaProps } from '@choice-ui/textarea';
1
+ import { TextareaProps } from '../../../textarea/src';
2
2
  export interface MdInputEditorProps extends Omit<TextareaProps, "value" | "onChange"> {
3
3
  className?: string;
4
4
  }
@@ -1,4 +1,4 @@
1
- import { MdRenderProps } from '@choice-ui/md-render';
1
+ import { MdRenderProps } from '../../../md-render/src';
2
2
  export interface MdInputRenderProps extends Omit<MdRenderProps, "content"> {
3
3
  className?: string;
4
4
  contentRef?: React.RefObject<HTMLDivElement>;
@@ -1,8 +1,8 @@
1
1
  import { default as react__default, HTMLProps, ReactNode } from 'react';
2
- import { ButtonProps } from '@choice-ui/button';
3
- import { KbdKey } from '@choice-ui/kbd';
4
- import { SearchInputProps } from '@choice-ui/search-input';
5
- import { InputProps } from '@choice-ui/input';
2
+ import { ButtonProps } from '../../button/src';
3
+ import { KbdKey } from '../../kbd/src';
4
+ import { SearchInputProps } from '../../search-input/src';
5
+ import { InputProps } from '../../input/src';
6
6
  import { SideObject, Placement, useFloating, useHover, useInteractions, useListItem, useFloatingTree } from '@floating-ui/react';
7
7
  import * as react from 'react';
8
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -1,2 +1,2 @@
1
- import { ButtonProps } from '@choice-ui/button';
1
+ import { ButtonProps } from '../../../button/src';
2
2
  export declare const MenuButton: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<Omit<ButtonProps, "ref"> & import('react').RefAttributes<HTMLButtonElement>>>;
@@ -1,2 +1,2 @@
1
- import { InputProps } from '@choice-ui/input';
1
+ import { InputProps } from '../../../input/src';
2
2
  export declare const MenuInput: import('react').ForwardRefExoticComponent<Omit<InputProps, "ref"> & import('react').RefAttributes<HTMLInputElement>>;
@@ -1,4 +1,4 @@
1
- import { KbdKey } from '@choice-ui/kbd';
1
+ import { KbdKey } from '../../../kbd/src';
2
2
  import { ReactNode } from 'react';
3
3
  export interface MenuItemProps extends React.HTMLAttributes<HTMLButtonElement> {
4
4
  active?: boolean;
@@ -1,4 +1,4 @@
1
- import { SearchInputProps } from '@choice-ui/search-input';
1
+ import { SearchInputProps } from '../../../search-input/src';
2
2
  export declare const MenuSearch: import('react').ForwardRefExoticComponent<Omit<SearchInputProps, "ref"> & import('react').RefAttributes<HTMLInputElement>>;
3
3
  interface MenuSearchEmptyProps extends React.HTMLAttributes<HTMLDivElement> {
4
4
  children?: React.ReactNode;
@@ -1,4 +1,4 @@
1
- import { ButtonProps } from '@choice-ui/button';
1
+ import { ButtonProps } from '../../../button/src';
2
2
  import { ReactNode } from 'react';
3
3
  export interface MenuTriggerProps extends Omit<ButtonProps, "children"> {
4
4
  asChild?: boolean;
@@ -1,8 +1,8 @@
1
1
  import { HTMLProps, ReactNode } from 'react';
2
- import { SelectProps } from '@choice-ui/select';
2
+ import { SelectProps } from '../../select/src';
3
3
  import { MotionProps } from 'framer-motion';
4
- import { InputProps } from '@choice-ui/input';
5
- import { TextareaProps } from '@choice-ui/textarea';
4
+ import { InputProps } from '../../input/src';
5
+ import { TextareaProps } from '../../textarea/src';
6
6
  import * as react from 'react';
7
7
 
8
8
  declare const ModalContent: react.ForwardRefExoticComponent<Omit<HTMLProps<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
@@ -1,4 +1,4 @@
1
- import { InputProps } from '@choice-ui/input';
1
+ import { InputProps } from '../../../input/src';
2
2
  interface ModalInputProps extends Omit<InputProps, "size" | "label"> {
3
3
  description?: string;
4
4
  label?: React.ReactNode;
@@ -1,4 +1,4 @@
1
- import { SelectProps } from '@choice-ui/select';
1
+ import { SelectProps } from '../../../select/src';
2
2
  interface ModalSelectProps extends Omit<SelectProps, "label"> {
3
3
  className?: string;
4
4
  description?: string;
@@ -1,4 +1,4 @@
1
- import { TextareaProps } from '@choice-ui/textarea';
1
+ import { TextareaProps } from '../../../textarea/src';
2
2
  interface ModalTextareaProps extends Omit<TextareaProps, "children" | "label"> {
3
3
  description?: string;
4
4
  label?: React.ReactNode;
@@ -1,5 +1,5 @@
1
- import { ChipProps } from '@choice-ui/chip';
2
- import { MenuContextContent, MenuDivider, MenuContextItem, MenuContextLabel, MenuValue } from '@choice-ui/menus';
1
+ import { ChipProps } from '../../chip/src';
2
+ import { MenuContextContent, MenuDivider, 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';
@@ -1,4 +1,4 @@
1
- import { ChipProps } from '@choice-ui/chip';
1
+ import { ChipProps } from '../../../chip/src';
2
2
  import { HTMLProps, ReactNode } from 'react';
3
3
  export interface MultiSelectTriggerProps extends Omit<HTMLProps<HTMLDivElement>, "title" | "size"> {
4
4
  children?: ReactNode;
@@ -1,5 +1,5 @@
1
- import { ChipProps } from '@choice-ui/chip';
2
- import { MenuContextContent, MenuContextItem, MenuContextLabel, MenuDivider, MenuValue } from '@choice-ui/menus';
1
+ import { ChipProps } from '../../chip/src';
2
+ import { MenuContextContent, MenuContextItem, MenuContextLabel, MenuDivider, 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';
@@ -1,7 +1,7 @@
1
1
  import { default as React__default, ReactNode, HTMLProps, RefObject } from 'react';
2
- import { IconButtonProps } from '@choice-ui/icon-button';
2
+ import { IconButtonProps } from '../../icon-button/src';
3
3
  import { PressMoveProps } from '../../../../../shared/src';
4
- import { TooltipProps } from '@choice-ui/tooltip';
4
+ import { TooltipProps } from '../../tooltip/src';
5
5
  import * as React$1 from 'react';
6
6
 
7
7
  type ElementType = "action" | "handler" | "menu";
@@ -1,4 +1,4 @@
1
- import { IconButtonProps } from '@choice-ui/icon-button';
1
+ import { IconButtonProps } from '../../../icon-button/src';
2
2
  import { HTMLProps } from 'react';
3
3
  interface NumericInputMenuTriggerProps extends IconButtonProps {
4
4
  className?: string;
@@ -1,4 +1,4 @@
1
- import { TooltipProps } from '@choice-ui/tooltip';
1
+ import { TooltipProps } from '../../tooltip/src';
2
2
  import { default as React, HTMLProps, ReactNode } from 'react';
3
3
  import { NumericInputElement, NumericInputMenuActionPrompt, NumericInputMenuTrigger, NumericInputVariable } from './components';
4
4
  import { NumericInputContextValue } from './context';
@@ -1,5 +1,5 @@
1
1
  import { HTMLProps } from 'react';
2
- import { ButtonProps } from '@choice-ui/button';
2
+ import { ButtonProps } from '../../button/src';
3
3
  import * as react from 'react';
4
4
 
5
5
  interface PaginationLabels {
@@ -1,4 +1,4 @@
1
- import { ButtonProps } from '@choice-ui/button';
1
+ import { ButtonProps } from '../../button/src';
2
2
  import { HTMLProps } from 'react';
3
3
  export interface PaginationLabels {
4
4
  page: string;
@@ -1,4 +1,4 @@
1
- import { ModalHeaderProps, ModalContent, ModalFooter } from '@choice-ui/modal';
1
+ import { ModalHeaderProps, ModalContent, ModalFooter } from '../../modal/src';
2
2
  import { FloatingFocusManagerProps, Placement } from '@floating-ui/react';
3
3
  import { default as react__default } from 'react';
4
4
  import * as react from 'react';
@@ -1,2 +1,2 @@
1
- import { ModalHeaderProps } from '@choice-ui/modal';
1
+ import { ModalHeaderProps } from '../../../modal/src';
2
2
  export declare const PopoverHeader: import('react').MemoExoticComponent<import('react').ForwardRefExoticComponent<Omit<ModalHeaderProps, "ref"> & import('react').RefAttributes<HTMLDivElement>>>;
@@ -1,4 +1,4 @@
1
- import { ModalContent, ModalFooter } from '@choice-ui/modal';
1
+ import { ModalContent, ModalFooter } from '../../modal/src';
2
2
  import { FloatingFocusManagerProps, Placement } from '@floating-ui/react';
3
3
  import { default as React } from 'react';
4
4
  import { PopoverHeader, PopoverTrigger } from './components';
@@ -1,4 +1,4 @@
1
- import { Label } from '@choice-ui/label';
1
+ import { Label } from '../../label/src';
2
2
  import { default as React } from 'react';
3
3
  import * as react_jsx_runtime from 'react/jsx-runtime';
4
4
 
@@ -1,4 +1,4 @@
1
- import { Label } from '@choice-ui/label';
1
+ import { Label } from '../../label/src';
2
2
  import { default as React } from 'react';
3
3
  export interface ProgressBarProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "role"> {
4
4
  dynamicColors?: Array<string | {
@@ -1,5 +1,5 @@
1
1
  import { default as react__default } from 'react';
2
- import { IconButtonProps } from '@choice-ui/icon-button';
2
+ import { IconButtonProps } from '../../icon-button/src';
3
3
  import { UseFloatingReturn } from '@floating-ui/react';
4
4
  import { Editor, BaseElement, BaseText, Descendant } from 'slate';
5
5
  import { ReactEditor, RenderElementProps, RenderLeafProps } from 'slate-react';
@@ -1,4 +1,4 @@
1
- import { IconButtonProps } from '@choice-ui/icon-button';
1
+ import { IconButtonProps } from '../../../icon-button/src';
2
2
  import { UseFloatingReturn } from '@floating-ui/react';
3
3
  import { Descendant, Editor } from 'slate';
4
4
  import { RenderElementProps, RenderLeafProps } from 'slate-react';
@@ -1,4 +1,4 @@
1
- import { TextFieldProps } from '@choice-ui/text-field';
1
+ import { TextFieldProps } from '../../text-field/src';
2
2
  import * as react from 'react';
3
3
 
4
4
  interface SearchInputProps extends TextFieldProps {
@@ -1,4 +1,4 @@
1
- import { TextFieldProps } from '@choice-ui/text-field';
1
+ import { TextFieldProps } from '../../text-field/src';
2
2
  export interface SearchInputProps extends TextFieldProps {
3
3
  /**
4
4
  * Whether to show the clear button when there is a value
@@ -1,5 +1,5 @@
1
1
  import { ReactNode, HTMLProps } from 'react';
2
- import { TooltipProps } from '@choice-ui/tooltip';
2
+ import { TooltipProps } from '../../tooltip/src';
3
3
  import * as react from 'react';
4
4
 
5
5
  interface SegmentedItemProps {
@@ -1,4 +1,4 @@
1
- import { TooltipProps } from '@choice-ui/tooltip';
1
+ import { TooltipProps } from '../../tooltip/src';
2
2
  import { ReactNode } from 'react';
3
3
  export interface SegmentedItemProps {
4
4
  "aria-label"?: string;
@@ -1,4 +1,4 @@
1
- import { TooltipProps } from '@choice-ui/tooltip';
1
+ import { TooltipProps } from '../../tooltip/src';
2
2
  import { HTMLProps, ReactNode } from 'react';
3
3
  export interface SegmentedProps extends Omit<HTMLProps<HTMLDivElement>, "onChange"> {
4
4
  children?: ReactNode;
@@ -1,4 +1,4 @@
1
- import { MenuContextContent, MenuDivider, MenuContextItem, MenuContextLabel, MenuTrigger, MenuValue } from '@choice-ui/menus';
1
+ import { MenuContextContent, MenuDivider, MenuContextItem, MenuContextLabel, MenuTrigger, MenuValue } from '../../menus/src';
2
2
  import { FloatingFocusManagerProps } from '@floating-ui/react';
3
3
  import { default as React } from 'react';
4
4
  interface SelectProps {
@@ -1,4 +1,4 @@
1
- import { MenuContextContent, MenuContextItem, MenuContextLabel, MenuDivider, MenuTrigger, MenuValue } from '@choice-ui/menus';
1
+ import { MenuContextContent, MenuContextItem, MenuContextLabel, MenuDivider, MenuTrigger, MenuValue } from '../../menus/src';
2
2
  import { FloatingFocusManagerProps } from '@floating-ui/react';
3
3
  import { default as React } from 'react';
4
4
  export interface SelectProps {
@@ -1,5 +1,5 @@
1
- import { InputProps } from '@choice-ui/input';
2
- import { Label } from '@choice-ui/label';
1
+ import { InputProps } from '../../input/src';
2
+ import { Label } from '../../label/src';
3
3
  import { default as react__default, HTMLProps, ReactNode } from 'react';
4
4
  import * as react from 'react';
5
5
 
@@ -1,5 +1,5 @@
1
- import { InputProps } from '@choice-ui/input';
2
- import { Label } from '@choice-ui/label';
1
+ import { InputProps } from '../../input/src';
2
+ import { Label } from '../../label/src';
3
3
  import { default as React, ReactNode } from 'react';
4
4
  import { FieldAddon, FieldDescription } from './components';
5
5
  export interface TextFieldProps extends Omit<InputProps, "children"> {
@@ -1,5 +1,5 @@
1
1
  import { HTMLProps } from 'react';
2
- import { TooltipProps } from '@choice-ui/tooltip';
2
+ import { TooltipProps } from '../../tooltip/src';
3
3
  import * as react from 'react';
4
4
 
5
5
  interface ToggleButtonProps extends Omit<HTMLProps<HTMLInputElement>, "value" | "onChange" | "size"> {
@@ -1,4 +1,4 @@
1
- import { TooltipProps } from '@choice-ui/tooltip';
1
+ import { TooltipProps } from '../../tooltip/src';
2
2
  import { HTMLProps } from 'react';
3
3
  export interface ToggleButtonProps extends Omit<HTMLProps<HTMLInputElement>, "value" | "onChange" | "size"> {
4
4
  active?: boolean;
@@ -1,6 +1,6 @@
1
1
  import { HTMLProps, ReactNode } from 'react';
2
2
  import { Placement, UseFloatingReturn } from '@floating-ui/react';
3
- import { KbdKey } from '@choice-ui/kbd';
3
+ import { KbdKey } from '../../kbd/src';
4
4
  import * as react from 'react';
5
5
  export { FloatingDelayGroup as TooltipProvider } from '@floating-ui/react';
6
6
  import * as react_jsx_runtime from 'react/jsx-runtime';
@@ -1,6 +1,6 @@
1
1
  import { Placement, UseFloatingReturn } from '@floating-ui/react';
2
2
  import { ReactNode } from 'react';
3
- import { KbdKey } from '@choice-ui/kbd';
3
+ import { KbdKey } from '../../kbd/src';
4
4
  export interface TooltipOptions {
5
5
  disabled?: boolean;
6
6
  initialOpen?: boolean;
package/dist/index.d.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from './components';
2
- export * from './shared/hooks';
3
- export * from './shared/utils';
2
+ export * from './shared';
@@ -0,0 +1,420 @@
1
+ import * as React$1 from 'react';
2
+ import { useLayoutEffect, MutableRefObject, SetStateAction, PointerEvent as PointerEvent$1, KeyboardEvent, ReactNode, ComponentType, ReactElement } from 'react';
3
+ import cx from 'classnames';
4
+ import { TV } from 'tailwind-variants';
5
+ export { TV, TVReturnType, VariantProps } from 'tailwind-variants';
6
+
7
+ /**
8
+ * 创建一个始终保持最新值的稳定引用
9
+ *
10
+ * 这个 Hook 解决了闭包中访问过期值的问题,确保在回调函数中始终能访问到最新的 props 或 state。
11
+ * 它会在每次渲染时同步更新 ref 的值,但 ref 对象本身保持不变。
12
+ *
13
+ * @param data - 需要保持最新引用的数据
14
+ * @returns 包含最新数据的稳定引用对象
15
+ *
16
+ * @example
17
+ * ```tsx
18
+ * const Component = ({ onClick }) => {
19
+ * const onClickRef = useAsRef(onClick)
20
+ *
21
+ * const handleClick = useCallback(() => {
22
+ * // 总是调用最新的 onClick 函数
23
+ * onClickRef.current?.()
24
+ * }, [onClickRef])
25
+ *
26
+ * return <button onClick={handleClick}>Click me</button>
27
+ * }
28
+ * ```
29
+ */
30
+ declare function useAsRef<T>(data: T): React$1.MutableRefObject<T>;
31
+
32
+ /**
33
+ * 同构布局效果 Hook
34
+ *
35
+ * 这个 Hook 解决了 SSR(服务端渲染)环境中 useLayoutEffect 的兼容性问题。
36
+ * 在浏览器环境中使用 useLayoutEffect,在服务端环境中使用 useEffect。
37
+ *
38
+ * useLayoutEffect 在 DOM 更新后同步执行,适用于需要同步读取 DOM 布局信息的场景。
39
+ * 但在服务端环境中,window 对象不存在,使用 useLayoutEffect 会产生警告。
40
+ *
41
+ * @example
42
+ * ```tsx
43
+ * const Component = () => {
44
+ * const [height, setHeight] = useState(0)
45
+ * const ref = useRef<HTMLDivElement>(null)
46
+ *
47
+ * useIsomorphicLayoutEffect(() => {
48
+ * if (ref.current) {
49
+ * // 同步读取 DOM 尺寸信息
50
+ * setHeight(ref.current.offsetHeight)
51
+ * }
52
+ * }, [])
53
+ *
54
+ * return <div ref={ref}>高度: {height}px</div>
55
+ * }
56
+ * ```
57
+ */
58
+ declare const useIsomorphicLayoutEffect: typeof useLayoutEffect;
59
+
60
+ type Direction = "ltr" | "rtl";
61
+ /**
62
+ * 文本方向上下文
63
+ *
64
+ * 用于在组件树中传递文本方向信息(从左到右或从右到左)
65
+ */
66
+ declare const DirectionContext: React$1.Context<Direction | undefined>;
67
+ /**
68
+ * 获取文本方向的 Hook
69
+ *
70
+ * 这个 Hook 用于确定组件的文本方向,支持国际化应用。
71
+ * 优先级:props > context > 默认值(ltr)
72
+ *
73
+ * @param dirProp - 通过 props 传入的方向值
74
+ * @returns 最终确定的文本方向
75
+ *
76
+ * @example
77
+ * ```tsx
78
+ * const Component = ({ dir }) => {
79
+ * const direction = useDirection(dir)
80
+ *
81
+ * return (
82
+ * <div dir={direction}>
83
+ * {direction === 'rtl' ? 'من اليمين إلى اليسار' : 'Left to Right'}
84
+ * </div>
85
+ * )
86
+ * }
87
+ * ```
88
+ */
89
+ declare function useDirection(dirProp?: Direction): Direction;
90
+
91
+ declare function useDisableScroll({ ref }: {
92
+ ref: React.RefObject<HTMLDivElement>;
93
+ }): {
94
+ disableScrollProps: {
95
+ onFocus: () => void;
96
+ onBlur: () => void;
97
+ onMouseEnter: () => void;
98
+ onMouseLeave: () => void;
99
+ };
100
+ };
101
+
102
+ /**
103
+ * 懒加载引用 Hook
104
+ *
105
+ * 这个 Hook 用于延迟初始化一个引用值,只有在第一次访问时才会执行初始化函数。
106
+ * 适用于创建成本较高的对象(如 Map、Set、复杂对象等)。
107
+ *
108
+ * 与 useState 的懒加载不同,这个 Hook 创建的是一个稳定的引用,
109
+ * 不会触发组件重新渲染,适用于需要在多次渲染间保持同一个对象实例的场景。
110
+ *
111
+ * @param fn - 初始化函数,只会在第一次调用时执行
112
+ * @returns 包含初始化值的稳定引用对象
113
+ *
114
+ * @example
115
+ * ```tsx
116
+ * const Component = () => {
117
+ * // 只在第一次渲染时创建 Map 实例
118
+ * const mapRef = useLazyRef(() => new Map<string, any>())
119
+ *
120
+ * const addItem = (key: string, value: any) => {
121
+ * mapRef.current!.set(key, value)
122
+ * }
123
+ *
124
+ * return (
125
+ * <div>
126
+ * <button onClick={() => addItem('key1', 'value1')}>
127
+ * 添加项目
128
+ * </button>
129
+ * <p>Map 大小: {mapRef.current!.size}</p>
130
+ * </div>
131
+ * )
132
+ * }
133
+ * ```
134
+ */
135
+ declare function useLazyRef<T>(fn: () => T): MutableRefObject<T>;
136
+
137
+ /**
138
+ * useMergedValue 钩子的配置选项
139
+ * @template T - 状态值的类型
140
+ */
141
+ type Options<T> = {
142
+ /**
143
+ * 是否允许使用空值。当设置为 true 时,
144
+ * 即使所有值源都是 undefined,也不会显示警告。
145
+ */
146
+ allowEmpty?: boolean;
147
+ /**
148
+ * 内部状态的默认值,当 value 和 defaultValue 都未提供时使用。
149
+ * 可以是一个值或返回值的函数(惰性初始化)。
150
+ */
151
+ defaultStateValue?: T | (() => T);
152
+ /**
153
+ * 非受控模式下的初始值。仅在组件首次渲染时使用。
154
+ * 只有在未提供 value 时才会使用此值。
155
+ */
156
+ defaultValue?: T;
157
+ /**
158
+ * 值变化时的回调函数。
159
+ * 在受控模式下,此回调应更新 value。
160
+ */
161
+ onChange?: (value: T) => void;
162
+ /**
163
+ * 当尝试设置与当前值相同的值时触发的回调。
164
+ */
165
+ onUnchange?: () => void;
166
+ /**
167
+ * 受控模式下的值。提供此参数会使组件进入受控模式。
168
+ * 在受控模式下,组件状态完全由此值控制。
169
+ */
170
+ value?: T;
171
+ };
172
+ /**
173
+ * 合并受控和非受控状态的 Hook
174
+ *
175
+ * 该 Hook 处理组件的受控和非受控两种模式:
176
+ * - 受控模式:当提供 value 时,组件状态完全由外部控制
177
+ * - 非受控模式:当仅提供 defaultValue 时,组件内部维护自己的状态
178
+ *
179
+ * @template T - 状态值的类型
180
+ * @param options - 配置选项
181
+ * @returns [currentValue, setValue] - 当前值和设置值的函数
182
+ */
183
+ declare function useMergedValue<T>(options: Options<T>): readonly [T, (this: any, v: SetStateAction<T>, forceTrigger?: any) => void];
184
+
185
+ /**
186
+ * 处理键盘修饰键状态的钩子
187
+ * @param disabled 是否禁用键盘监听
188
+ * @returns 修饰键状态
189
+ */
190
+ declare function useModifierKeys(disabled?: boolean): {
191
+ shiftPressed: boolean;
192
+ metaPressed: boolean;
193
+ ctrlPressed: boolean;
194
+ };
195
+
196
+ type PressEvent = PointerEvent$1<HTMLElement> | KeyboardEvent<HTMLElement>;
197
+ type PressProps = {
198
+ disabled?: boolean;
199
+ onPress?: (event: PressEvent) => void;
200
+ onPressEnd?: (event: PressEvent) => void;
201
+ onPressStart?: (event: PressEvent) => void;
202
+ };
203
+ declare function usePress({ disabled, onPress, onPressStart, onPressEnd }: PressProps): {
204
+ isPressed: boolean;
205
+ pressProps: {
206
+ onPointerDown: (event: PointerEvent$1<HTMLElement>) => void;
207
+ onKeyDown: (event: KeyboardEvent<HTMLElement>) => void;
208
+ onKeyUp: (event: KeyboardEvent<HTMLElement>) => void;
209
+ };
210
+ };
211
+
212
+ type PressMoveProps = PressProps & {
213
+ disabled?: boolean;
214
+ onPressEnd?: (e: PointerEvent) => void;
215
+ onPressMove?: (e: PointerEvent) => void;
216
+ onPressMoveBottom?: (delta: number) => void;
217
+ onPressMoveLeft?: (delta: number) => void;
218
+ onPressMoveRight?: (delta: number) => void;
219
+ onPressMoveTop?: (delta: number) => void;
220
+ onPressStart?: (e: PointerEvent) => void;
221
+ };
222
+ interface PressMoveResult {
223
+ isPressed: boolean;
224
+ pressMoveProps: {
225
+ onPointerDown: (e: React.PointerEvent<HTMLElement>) => void;
226
+ ref: (el: HTMLElement | null) => void;
227
+ style?: React.CSSProperties;
228
+ };
229
+ }
230
+ declare const usePressMove: ({ onPressMove, onPressMoveLeft, onPressMoveRight, onPressMoveTop, onPressMoveBottom, onPressStart, onPressEnd, ...rest }: PressMoveProps) => PressMoveResult;
231
+
232
+ declare const tcx: (...args: cx.ArgumentArray) => string;
233
+ declare const tcv: TV;
234
+
235
+ interface Props {
236
+ [key: string]: unknown;
237
+ }
238
+ type PropsArg = Props | null | undefined;
239
+ type TupleTypes<T> = {
240
+ [P in keyof T]: T[P];
241
+ } extends {
242
+ [key: number]: infer V;
243
+ } ? NullToObject<V> : never;
244
+ type NullToObject<T> = T extends null | undefined ? object : T;
245
+ type UnionToIntersection<U> = (U extends unknown ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
246
+ /**
247
+ * Merges multiple props objects together. Event handlers are chained,
248
+ * classNames are combined, and ids are deduplicated.
249
+ * For all other props, the last prop object overrides all previous ones.
250
+ * @param args - Multiple sets of props to merge together.
251
+ */
252
+ declare function mergeProps<T extends PropsArg[]>(...args: T): UnionToIntersection<TupleTypes<T>>;
253
+
254
+ type ReactRef<T> = React$1.RefObject<T> | React$1.MutableRefObject<T> | React$1.Ref<T>;
255
+ /**
256
+ * Assigns a value to a ref function or object
257
+ *
258
+ * @param ref the ref to assign to
259
+ * @param value the value
260
+ */
261
+ declare function assignRef<T>(ref: ReactRef<T> | undefined, value: T | null): void;
262
+ /**
263
+ * Combine multiple React refs into a single ref function.
264
+ * This is used mostly when you need to allow consumers forward refs to
265
+ * internal components
266
+ *
267
+ * @param refs refs to assign to value to
268
+ */
269
+ declare function mergeRefs<T>(...refs: (ReactRef<T> | undefined)[]): (node: T | null) => void;
270
+
271
+ declare function assert(condition: unknown, message?: string): asserts condition;
272
+ declare function assertNever(value: never, message?: string): never;
273
+ type Dict<T = unknown> = Record<string, T>;
274
+ declare function isArray<T>(value: unknown): value is Array<T>;
275
+ declare function isEmptyArray(value: unknown): boolean;
276
+ declare function isObject(value: unknown): value is Dict;
277
+ declare function isEmptyObject(value: unknown): boolean;
278
+ declare function isEmpty(value: unknown): boolean;
279
+ declare function isFunction<T extends (...args: unknown[]) => unknown = (...args: unknown[]) => unknown>(value: unknown): value is T;
280
+ type Booleanish = boolean | "true" | "false";
281
+ declare const dataAttr: (condition: boolean | undefined) => Booleanish;
282
+ declare const isNumeric: (value?: string | number) => boolean;
283
+ declare const isMultiElement: (children: ReactNode) => boolean;
284
+ declare const findChildByType: (children: ReactNode, componentType: ComponentType<any>) => ReactElement | null;
285
+
286
+ declare function formatBytes(bytes: number): string;
287
+
288
+ type SupportedLanguage = "en" | "cn" | "ja" | "ko" | "es" | "fr" | "de" | "pt" | "ru" | "ar";
289
+ interface TimezoneOptions {
290
+ referenceTime?: Date;
291
+ useUTC?: boolean;
292
+ }
293
+ interface CustomFormatOptions {
294
+ fullDate?: string;
295
+ monthDay?: string;
296
+ time?: string;
297
+ }
298
+ interface FormatRelativeTimeOptions {
299
+ customFormat?: CustomFormatOptions;
300
+ daysThreshold?: number;
301
+ forceNumericFormat?: boolean;
302
+ language?: SupportedLanguage;
303
+ showSpecificTime?: boolean;
304
+ timezone?: TimezoneOptions;
305
+ yearThreshold?: number;
306
+ }
307
+
308
+ /**
309
+ * Formats a date into a human-readable relative time string with internationalization support
310
+ *
311
+ * @param date - The date to format
312
+ * @param options - Configuration options for formatting
313
+ * @returns A formatted date string
314
+ *
315
+ * @example
316
+ * ```typescript
317
+ * // Basic usage
318
+ * formatRelativeTime(new Date()) // "a few seconds ago"
319
+ *
320
+ * // With Chinese locale
321
+ * formatRelativeTime(new Date(), { language: "cn" }) // "几秒前"
322
+ *
323
+ * // Show specific time for recent dates
324
+ * formatRelativeTime(new Date(), {
325
+ * showSpecificTime: true,
326
+ * language: "en"
327
+ * }) // "Today at 2:30 PM"
328
+ *
329
+ * // Custom thresholds
330
+ * formatRelativeTime(oldDate, {
331
+ * daysThreshold: 30,
332
+ * yearThreshold: 2
333
+ * })
334
+ * ```
335
+ */
336
+ declare const formatRelativeTime: (date: Date, options?: FormatRelativeTimeOptions) => string;
337
+ /**
338
+ * Creates a date formatter with default configuration
339
+ *
340
+ * @param defaultOptions - Default options to use for all formatting operations
341
+ * @returns A configured formatter function
342
+ *
343
+ * @example
344
+ * ```typescript
345
+ * const formatter = createDateFormatter({
346
+ * language: "cn",
347
+ * daysThreshold: 14,
348
+ * showSpecificTime: true
349
+ * })
350
+ *
351
+ * formatter(new Date()) // Uses configured defaults
352
+ * formatter(new Date(), { language: "en" }) // Overrides language
353
+ * ```
354
+ */
355
+ declare const createDateFormatter: (defaultOptions?: FormatRelativeTimeOptions) => (date: Date, options?: FormatRelativeTimeOptions) => string;
356
+ /**
357
+ * Formats a date to a simple readable format
358
+ *
359
+ * @param date - The date to format
360
+ * @param options - Formatting options
361
+ * @returns A simple formatted date string
362
+ *
363
+ * @example
364
+ * ```typescript
365
+ * formatSimpleDate(new Date()) // "Jan 15, 2024"
366
+ * formatSimpleDate(new Date(), { language: "cn" }) // "2024年1月15日"
367
+ * ```
368
+ */
369
+ declare const formatSimpleDate: (date: Date, options?: Pick<FormatRelativeTimeOptions, "language" | "customFormat">) => string;
370
+ /**
371
+ * Formats time only from a date
372
+ *
373
+ * @param date - The date to extract time from
374
+ * @param options - Formatting options
375
+ * @returns A formatted time string
376
+ *
377
+ * @example
378
+ * ```typescript
379
+ * formatTime(new Date()) // "2:30 PM"
380
+ * formatTime(new Date(), { language: "cn" }) // "14:30"
381
+ * ```
382
+ */
383
+ declare const formatTime: (date: Date, options?: Pick<FormatRelativeTimeOptions, "language" | "customFormat">) => string;
384
+
385
+ /**
386
+ * 通用 i18n 工具系统
387
+ * 提供简洁的API,无需为每个组件单独封装Hook
388
+ */
389
+ /**
390
+ * 深度合并两个对象,用户配置会覆盖默认配置
391
+ */
392
+ declare const mergeI18nConfig: <T extends Record<string, unknown>>(defaultConfig: T, userConfig?: Partial<T>) => T;
393
+ /**
394
+ * 通用的 i18n Hook,自动缓存合并结果
395
+ * 直接使用,无需为每个组件单独封装
396
+ *
397
+ * @example
398
+ * const i18n = useI18n(defaultConfig, userConfig)
399
+ */
400
+ declare const useI18n: <T extends Record<string, unknown>>(defaultConfig: T, userConfig?: Partial<T>) => T;
401
+ /**
402
+ * 从嵌套对象中安全获取值,支持点号路径
403
+ * @example getI18nText(i18n, 'url.placeholder') // 获取 i18n.url.placeholder
404
+ */
405
+ declare const getI18nText: <T extends Record<string, unknown>>(i18n: T, path: string, fallback?: string) => string;
406
+
407
+ /**
408
+ * Check if code is running in browser environment
409
+ */
410
+ declare const isBrowser: boolean;
411
+ /**
412
+ * SSR-safe window access helper
413
+ */
414
+ declare function getWindow(): Window | undefined;
415
+ /**
416
+ * SSR-safe document access helper
417
+ */
418
+ declare function getDocument(): Document | undefined;
419
+
420
+ export { type Dict, DirectionContext, type FormatRelativeTimeOptions, type PressMoveProps, type PressMoveResult, type PressProps, type ReactRef, type SupportedLanguage, assert, assertNever, assignRef, createDateFormatter, dataAttr, findChildByType, formatBytes, formatRelativeTime, formatSimpleDate, formatTime, getDocument, getI18nText, getWindow, isArray, isBrowser, isEmpty, isEmptyArray, isEmptyObject, isFunction, isMultiElement, isNumeric, isObject, mergeI18nConfig, mergeProps, mergeRefs, tcv, tcx, useAsRef, useDirection, useDisableScroll, useI18n, useIsomorphicLayoutEffect, useLazyRef, useMergedValue, useModifierKeys, usePress, usePressMove };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@choice-ui/react",
3
- "version": "1.4.0",
3
+ "version": "1.4.2",
4
4
  "description": "A desktop-first React UI component library built for professional desktop applications with comprehensive documentation",
5
5
  "sideEffects": false,
6
6
  "type": "module",
@@ -113,7 +113,7 @@
113
113
  "react-dom": ">=18.0.0"
114
114
  },
115
115
  "scripts": {
116
- "build": "pnpm run clean && vite build",
116
+ "build": "pnpm run clean && pnpm --filter @choice-ui/shared build && vite build",
117
117
  "build:watch": "vite build --watch",
118
118
  "format": "prettier --write \"**/*.{js,jsx,ts,tsx,json,css,md}\"",
119
119
  "lint": "eslint --ignore-path .gitignore --cache --cache-location ./node_modules/.cache/eslint .",