@rockshin/tao-ui 0.0.2 → 0.0.4

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 (49) hide show
  1. package/dist/components/breadcrumb/breadcrumb.css +2 -976
  2. package/dist/components/button/button.css +2 -976
  3. package/dist/components/checkbox/checkbox.css +3 -976
  4. package/dist/components/collapsible/collapsible.css +2 -976
  5. package/dist/components/context-menu/context-menu.css +1 -1141
  6. package/dist/components/context-menu/context-menu.js +10 -8
  7. package/dist/components/date-picker/calendar/month-grid.d.ts +1 -1
  8. package/dist/components/date-picker/calendar/time-panel.d.ts +1 -1
  9. package/dist/components/date-picker/calendar/year-grid.d.ts +1 -1
  10. package/dist/components/date-picker/date-picker.css +23 -1147
  11. package/dist/components/date-picker/date-picker.js +9 -7
  12. package/dist/components/date-picker/range-picker.js +9 -7
  13. package/dist/components/drawer/drawer.css +29 -1006
  14. package/dist/components/drawer/drawer.js +27 -18
  15. package/dist/components/dropdown/dropdown.css +0 -975
  16. package/dist/components/dropdown/dropdown.js +17 -15
  17. package/dist/components/form-field/form.css +4 -977
  18. package/dist/components/input/input.css +0 -1134
  19. package/dist/components/menu/menu-render.js +11 -8
  20. package/dist/components/menu/menu.css +4 -978
  21. package/dist/components/modal/modal.css +7 -981
  22. package/dist/components/modal/modal.js +27 -18
  23. package/dist/components/pagination/pagination.css +4 -977
  24. package/dist/components/pagination/pagination.js +3 -1
  25. package/dist/components/radio/radio.css +4 -977
  26. package/dist/components/scroll-area/scroll-area.css +11 -981
  27. package/dist/components/select/mobile-select.css +9 -976
  28. package/dist/components/select/mobile-select.d.ts +4 -1
  29. package/dist/components/select/mobile-select.js +103 -121
  30. package/dist/components/select/select.css +31 -1150
  31. package/dist/components/select/select.d.ts +58 -4
  32. package/dist/components/select/select.js +356 -410
  33. package/dist/components/spinner/spinner.css +97 -0
  34. package/dist/components/spinner/spinner.d.ts +26 -0
  35. package/dist/components/spinner/spinner.js +229 -0
  36. package/dist/components/splitter/splitter.css +7 -978
  37. package/dist/components/switch/switch.css +8 -981
  38. package/dist/components/table/table.css +13 -992
  39. package/dist/components/tabs/tabs.css +4 -977
  40. package/dist/components/tag/tag.css +6 -977
  41. package/dist/components/textarea/textarea.css +0 -1134
  42. package/dist/index.d.ts +32 -29
  43. package/dist/index.js +6 -3
  44. package/dist/layouts/stack/layout.css +0 -975
  45. package/dist/provider/tao-provider.d.ts +17 -1
  46. package/dist/provider/tao-provider.js +53 -15
  47. package/dist/theme/control.css +35 -983
  48. package/dist/theme/theme.css +74 -902
  49. package/package.json +13 -16
@@ -1,5 +1,6 @@
1
- import { type ReactNode } from 'react';
1
+ import { type CSSProperties, type ReactNode } from 'react';
2
2
  import { type TaoSize, type TaoVariant } from '../../provider/tao-provider';
3
+ import { type SemanticClassNames, type SemanticStyles } from '../../utils/semantic';
3
4
  import './select.css';
4
5
  export interface SelectOption {
5
6
  label: ReactNode;
@@ -9,28 +10,81 @@ export interface SelectOption {
9
10
  icon?: ReactNode;
10
11
  /** Secondary description line shown under the label in the option row. */
11
12
  description?: ReactNode;
13
+ /** Nested options turn this entry into a group; `label` becomes the group title. */
14
+ options?: SelectOption[];
12
15
  }
16
+ export type SelectSemanticPart = 'root' | 'prefix' | 'suffix' | 'placeholder' | 'clear' | 'popup' | 'search' | 'group' | 'groupLabel' | 'item' | 'itemIcon' | 'itemLabel' | 'itemDesc' | 'empty';
17
+ export type SelectPlacement = 'bottomLeft' | 'bottomRight' | 'topLeft' | 'topRight';
13
18
  export interface SelectProps {
14
19
  options: SelectOption[];
15
20
  value?: string;
16
- onChange?: (value: string) => void;
21
+ defaultValue?: string;
22
+ /** Fired on selection or clear. `option` is undefined when cleared. */
23
+ onChange?: (value: string, option?: SelectOption) => void;
24
+ /** Fired only when an option is picked (not on clear). */
25
+ onSelect?: (value: string, option: SelectOption) => void;
26
+ /** Fired when the value is cleared via the clear button. */
27
+ onClear?: () => void;
17
28
  placeholder?: string;
18
29
  size?: TaoSize;
19
30
  variant?: TaoVariant;
20
31
  disabled?: boolean;
32
+ /** Validation status. */
33
+ status?: 'error' | 'warning';
21
34
  /** Show search input in dropdown */
22
35
  showSearch?: boolean;
23
36
  /** Custom filter function, default matches label string */
24
37
  filterOption?: (input: string, option: SelectOption) => boolean;
25
- /** Allow clearing the value */
26
- allowClear?: boolean;
38
+ /** Controlled search text. */
39
+ searchValue?: string;
40
+ /** Fired when the search text changes. */
41
+ onSearch?: (value: string) => void;
42
+ /** Allow clearing the value; pass an object to customize the clear icon. */
43
+ allowClear?: boolean | {
44
+ clearIcon?: ReactNode;
45
+ };
27
46
  /** Show loading spinner */
28
47
  loading?: boolean;
48
+ /** Custom loading icon. */
49
+ loadingIcon?: ReactNode;
29
50
  /** Content when no options match */
30
51
  notFoundContent?: ReactNode;
31
52
  /** Prefix icon/element */
32
53
  prefix?: ReactNode;
54
+ /** Custom suffix (arrow) icon. */
55
+ suffixIcon?: ReactNode;
56
+ autoFocus?: boolean;
57
+ id?: string;
58
+ /** Name for hidden form field. */
59
+ name?: string;
60
+ /** Controlled open state of the dropdown. */
61
+ open?: boolean;
62
+ defaultOpen?: boolean;
63
+ onOpenChange?: (open: boolean) => void;
64
+ /** Dropdown position. Defaults to `bottomLeft`. */
65
+ placement?: SelectPlacement;
66
+ /** Match popup width to trigger (true), a fixed px width (number), or fit content (false). */
67
+ popupMatchSelectWidth?: boolean | number;
68
+ /** Max height of the option list. Defaults to 256. */
69
+ listHeight?: number;
70
+ /** Parent node the popup renders into. Defaults to body. */
71
+ getPopupContainer?: (trigger: HTMLElement) => HTMLElement;
72
+ /** Customize the rendering of each dropdown option. */
73
+ optionRender?: (option: SelectOption, info: {
74
+ index: number;
75
+ }) => ReactNode;
76
+ /** Customize the selected label shown in the trigger. */
77
+ labelRender?: (option: SelectOption) => ReactNode;
78
+ /** Wrap/customize the dropdown content. */
79
+ popupRender?: (menu: ReactNode) => ReactNode;
33
80
  /** Force mobile mode (bottom sheet) regardless of screen size */
34
81
  mobile?: boolean;
82
+ /** Merged onto the trigger root; use to override width etc. */
83
+ className?: string;
84
+ style?: CSSProperties;
85
+ classNames?: SemanticClassNames<SelectSemanticPart>;
86
+ styles?: SemanticStyles<SelectSemanticPart>;
35
87
  }
36
88
  export declare function Select(props: SelectProps): import("react/jsx-runtime").JSX.Element;
89
+ /** Double chevron (↕) for a switcher-style trigger. Pass to `suffixIcon`. */
90
+ export declare function ChevronsUpDownIcon(): import("react/jsx-runtime").JSX.Element;