asheeui 0.6.1 → 0.6.3
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/AsheeUIProvider.d.ts +34 -0
- package/dist/AsheeUIProvider.d.ts.map +1 -1
- package/dist/components/accordion/Accordion.d.ts +55 -44
- package/dist/components/accordion/Accordion.d.ts.map +1 -1
- package/dist/components/accordion/Accordion.js +27 -27
- package/dist/components/accordion/accordion-config.d.ts +41 -12
- package/dist/components/accordion/accordion-config.d.ts.map +1 -1
- package/dist/components/accordion/accordion-styles.d.ts +20 -0
- package/dist/components/accordion/accordion-styles.d.ts.map +1 -1
- package/dist/components/accordion/accordion-styles.js +1 -1
- package/dist/components/autocomplete/Autocomplete.d.ts +59 -39
- package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/Autocomplete.js +98 -91
- package/dist/components/autocomplete/autocomplete-config.d.ts +9 -62
- package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete-config.js +6 -21
- package/dist/components/button/Button.d.ts +50 -51
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +19 -19
- package/dist/components/button/button-config.d.ts +23 -15
- package/dist/components/button/button-config.d.ts.map +1 -1
- package/dist/components/button/button-styles.d.ts +11 -1
- package/dist/components/button/button-styles.d.ts.map +1 -1
- package/dist/components/card/Card.d.ts +85 -43
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +49 -49
- package/dist/components/card/card-config.d.ts +35 -18
- package/dist/components/card/card-config.d.ts.map +1 -1
- package/dist/components/card/card-config.js +0 -2
- package/dist/components/card/card-styles.d.ts +17 -1
- package/dist/components/card/card-styles.d.ts.map +1 -1
- package/dist/components/carousel/Carousel.d.ts +107 -12
- package/dist/components/carousel/Carousel.d.ts.map +1 -1
- package/dist/components/carousel/Carousel.js +63 -64
- package/dist/components/carousel/carousel-config.d.ts +94 -7
- package/dist/components/carousel/carousel-config.d.ts.map +1 -1
- package/dist/components/carousel/carousel-config.js +6 -4
- package/dist/components/carousel/carousel-styles.d.ts +32 -1
- package/dist/components/carousel/carousel-styles.d.ts.map +1 -1
- package/dist/components/chip/Chip.d.ts +55 -34
- package/dist/components/chip/Chip.d.ts.map +1 -1
- package/dist/components/chip/Chip.js +71 -72
- package/dist/components/chip/chip-config.d.ts +29 -15
- package/dist/components/chip/chip-config.d.ts.map +1 -1
- package/dist/components/chip/chip-config.js +5 -6
- package/dist/components/chip/chip-styles.d.ts +21 -1
- package/dist/components/chip/chip-styles.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.d.ts +166 -2
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +110 -99
- package/dist/components/date-picker/date-picker-config.d.ts +31 -0
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-config.js +8 -16
- package/dist/components/date-picker/date-picker-styles.d.ts +21 -1
- package/dist/components/date-picker/date-picker-styles.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-styles.js +7 -11
- package/dist/components/drawer/Drawer.d.ts +97 -7
- package/dist/components/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.js +9 -9
- package/dist/components/drawer/drawer-config.d.ts +54 -1
- package/dist/components/drawer/drawer-config.d.ts.map +1 -1
- package/dist/components/drawer/drawer-styles.d.ts +21 -0
- package/dist/components/drawer/drawer-styles.d.ts.map +1 -1
- package/dist/components/field/FieldShell.d.ts +86 -0
- package/dist/components/field/FieldShell.d.ts.map +1 -1
- package/dist/components/field/field-config.d.ts +66 -3
- package/dist/components/field/field-config.d.ts.map +1 -1
- package/dist/components/field/field-config.js +2 -1
- package/dist/components/field/field-styles.d.ts +22 -0
- package/dist/components/field/field-styles.d.ts.map +1 -1
- package/dist/components/field/field-styles.js +10 -0
- package/dist/components/field/index.js +1 -0
- package/dist/components/image/Image.d.ts +35 -28
- package/dist/components/image/Image.d.ts.map +1 -1
- package/dist/components/image/Image.js +7 -7
- package/dist/components/image/image-config.d.ts +25 -7
- package/dist/components/image/image-config.d.ts.map +1 -1
- package/dist/components/image/image-styles.d.ts +9 -0
- package/dist/components/image/image-styles.d.ts.map +1 -1
- package/dist/components/input/Input.d.ts +117 -10
- package/dist/components/input/Input.d.ts.map +1 -1
- package/dist/components/input/Input.js +20 -20
- package/dist/components/input/PasswordInput.d.ts +48 -0
- package/dist/components/input/PasswordInput.d.ts.map +1 -1
- package/dist/components/input/input-config.d.ts +10 -1
- package/dist/components/input/input-config.d.ts.map +1 -1
- package/dist/components/input/input-config.js +5 -8
- package/dist/components/input/input-styles.d.ts +10 -0
- package/dist/components/input/input-styles.d.ts.map +1 -1
- package/dist/components/input/input-styles.js +5 -9
- package/dist/components/keyboard/OnScreenKeyboard.d.ts +58 -8
- package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
- package/dist/components/keyboard/OnScreenKeyboard.js +49 -48
- package/dist/components/keyboard/index.js +1 -1
- package/dist/components/keyboard/keyboard-config.d.ts +88 -3
- package/dist/components/keyboard/keyboard-config.d.ts.map +1 -1
- package/dist/components/keyboard/{default-keyboard-config.js → keyboard-config.js} +7 -1
- package/dist/components/keyboard/keyboard-context.d.ts +103 -13
- package/dist/components/keyboard/keyboard-context.d.ts.map +1 -1
- package/dist/components/keyboard/keyboard-context.js +66 -68
- package/dist/components/keyboard/use-keyboard-field.d.ts +37 -0
- package/dist/components/keyboard/use-keyboard-field.d.ts.map +1 -1
- package/dist/components/link/Link.d.ts +118 -9
- package/dist/components/link/Link.d.ts.map +1 -1
- package/dist/components/link/Link.js +29 -30
- package/dist/components/link/link-config.d.ts +58 -5
- package/dist/components/link/link-config.d.ts.map +1 -1
- package/dist/components/link/link-styles.d.ts +24 -4
- package/dist/components/link/link-styles.d.ts.map +1 -1
- package/dist/components/marquee/Marquee.d.ts +77 -8
- package/dist/components/marquee/Marquee.d.ts.map +1 -1
- package/dist/components/marquee/Marquee.js +5 -5
- package/dist/components/marquee/marquee-config.d.ts +74 -0
- package/dist/components/marquee/marquee-config.d.ts.map +1 -1
- package/dist/components/marquee/marquee-styles.d.ts +12 -0
- package/dist/components/marquee/marquee-styles.d.ts.map +1 -1
- package/dist/components/modal/Modal.d.ts +113 -25
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +75 -82
- package/dist/components/modal/modal-config.d.ts +59 -1
- package/dist/components/modal/modal-config.d.ts.map +1 -1
- package/dist/components/modal/modal-styles.d.ts +8 -1
- package/dist/components/modal/modal-styles.d.ts.map +1 -1
- package/dist/components/modal/modal-styles.js +4 -11
- package/dist/components/multi-select/MultiSelect.d.ts +152 -23
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +195 -217
- package/dist/components/multi-select/multi-select-config.d.ts +61 -23
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-config.js +16 -25
- package/dist/components/multi-select/multi-select-styles.d.ts +17 -0
- package/dist/components/multi-select/multi-select-styles.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-styles.js +9 -13
- package/dist/components/radio/Radio.d.ts +137 -13
- package/dist/components/radio/Radio.d.ts.map +1 -1
- package/dist/components/radio/Radio.js +66 -141
- package/dist/components/radio/RadioGroup.d.ts +88 -23
- package/dist/components/radio/RadioGroup.d.ts.map +1 -1
- package/dist/components/radio/RadioGroup.js +141 -66
- package/dist/components/radio/radio-config.d.ts +36 -11
- package/dist/components/radio/radio-config.d.ts.map +1 -1
- package/dist/components/radio/radio-config.js +9 -11
- package/dist/components/radio/radio-context.d.ts +44 -1
- package/dist/components/radio/radio-context.d.ts.map +1 -1
- package/dist/components/radio/radio-styles.d.ts +24 -1
- package/dist/components/radio/radio-styles.d.ts.map +1 -1
- package/dist/components/resizable-screen/ResizableScreen.d.ts +79 -32
- package/dist/components/resizable-screen/ResizableScreen.d.ts.map +1 -1
- package/dist/components/resizable-screen/ResizableScreen.js +77 -72
- package/dist/components/resizable-screen/resizable-screen-config.d.ts +62 -0
- package/dist/components/resizable-screen/resizable-screen-config.d.ts.map +1 -1
- package/dist/components/scrollbar/scrollbar-config.d.ts +44 -9
- package/dist/components/scrollbar/scrollbar-config.d.ts.map +1 -1
- package/dist/components/select/Select.d.ts +157 -17
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +141 -152
- package/dist/components/select/select-config.d.ts +26 -19
- package/dist/components/select/select-config.d.ts.map +1 -1
- package/dist/components/select/select-config.js +5 -21
- package/dist/components/select/select-styles.d.ts +10 -0
- package/dist/components/select/select-styles.d.ts.map +1 -1
- package/dist/components/select/select-styles.js +5 -9
- package/dist/components/select-menu/SelectMenu.d.ts +125 -8
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +107 -79
- package/dist/components/select-menu/index.d.ts +2 -0
- package/dist/components/select-menu/index.d.ts.map +1 -1
- package/dist/components/select-menu/index.js +1 -0
- package/dist/components/select-menu/select-menu-config.d.ts +82 -0
- package/dist/components/select-menu/select-menu-config.d.ts.map +1 -0
- package/dist/components/select-menu/select-menu-config.js +12 -0
- package/dist/components/sidebar/Sidebar.d.ts +151 -51
- package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/sidebar/Sidebar.js +211 -232
- package/dist/components/sidebar/sidebar-config.d.ts +140 -21
- package/dist/components/sidebar/sidebar-config.d.ts.map +1 -1
- package/dist/components/sidebar/sidebar-config.js +9 -12
- package/dist/components/sidebar/sidebar-styles.d.ts +24 -0
- package/dist/components/sidebar/sidebar-styles.d.ts.map +1 -1
- package/dist/components/spinner/spinner-config.d.ts +15 -9
- package/dist/components/spinner/spinner-config.d.ts.map +1 -1
- package/dist/components/spinner/spinner-styles.d.ts +10 -3
- package/dist/components/spinner/spinner-styles.d.ts.map +1 -1
- package/dist/components/spinner/spinner.d.ts +27 -20
- package/dist/components/spinner/spinner.d.ts.map +1 -1
- package/dist/components/spinner/spinner.js +18 -18
- package/dist/components/switch/Switch.d.ts +109 -9
- package/dist/components/switch/Switch.d.ts.map +1 -1
- package/dist/components/switch/Switch.js +19 -19
- package/dist/components/switch/switch-config.d.ts +20 -6
- package/dist/components/switch/switch-config.d.ts.map +1 -1
- package/dist/components/switch/switch-config.js +8 -16
- package/dist/components/switch/switch-styles.d.ts +17 -0
- package/dist/components/switch/switch-styles.d.ts.map +1 -1
- package/dist/components/table/Table.d.ts +101 -28
- package/dist/components/table/Table.d.ts.map +1 -1
- package/dist/components/table/Table.js +56 -56
- package/dist/components/table/table-config.d.ts +75 -8
- package/dist/components/table/table-config.d.ts.map +1 -1
- package/dist/components/table/table-styles.d.ts +25 -6
- package/dist/components/table/table-styles.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.d.ts +84 -31
- package/dist/components/tabs/Tabs.d.ts.map +1 -1
- package/dist/components/tabs/Tabs.js +44 -44
- package/dist/components/tabs/tabs-config.d.ts +102 -9
- package/dist/components/tabs/tabs-config.d.ts.map +1 -1
- package/dist/components/tabs/tabs-styles.d.ts +16 -4
- package/dist/components/tabs/tabs-styles.d.ts.map +1 -1
- package/dist/components/textarea/Textarea.d.ts +105 -11
- package/dist/components/textarea/Textarea.d.ts.map +1 -1
- package/dist/components/textarea/Textarea.js +27 -24
- package/dist/components/textarea/textarea-config.d.ts +21 -0
- package/dist/components/textarea/textarea-config.d.ts.map +1 -1
- package/dist/components/textarea/textarea-config.js +8 -16
- package/dist/components/textarea/textarea-styles.d.ts +9 -0
- package/dist/components/textarea/textarea-styles.d.ts.map +1 -1
- package/dist/components/textarea/textarea-styles.js +5 -9
- package/dist/components/toast/ToastItem.d.ts +58 -4
- package/dist/components/toast/ToastItem.d.ts.map +1 -1
- package/dist/components/toast/ToastItem.js +18 -18
- package/dist/components/toast/toast-config.d.ts +104 -6
- package/dist/components/toast/toast-config.d.ts.map +1 -1
- package/dist/components/toast/toast-context.d.ts +123 -11
- package/dist/components/toast/toast-context.d.ts.map +1 -1
- package/dist/components/toast/toast-context.js +19 -19
- package/dist/components/toast/toast-styles.d.ts +27 -5
- package/dist/components/toast/toast-styles.d.ts.map +1 -1
- package/dist/components/toast/use-pausable-timeout.d.ts +29 -0
- package/dist/components/toast/use-pausable-timeout.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.d.ts +76 -16
- package/dist/components/tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/tooltip/Tooltip.js +25 -25
- package/dist/components/tooltip/tooltip-config.d.ts +73 -3
- package/dist/components/tooltip/tooltip-config.d.ts.map +1 -1
- package/dist/components/tooltip/tooltip-styles.d.ts +12 -0
- package/dist/components/tooltip/tooltip-styles.d.ts.map +1 -1
- package/dist/config/config.d.ts +50 -2
- package/dist/config/config.d.ts.map +1 -1
- package/dist/config/default-config.d.ts +5 -0
- package/dist/config/default-config.d.ts.map +1 -1
- package/dist/config/default-config.js +23 -0
- package/dist/config/define-config.d.ts +23 -0
- package/dist/config/define-config.d.ts.map +1 -1
- package/dist/config/resolve-color.d.ts +25 -0
- package/dist/config/resolve-color.d.ts.map +1 -1
- package/dist/config/resolve-config.d.ts +23 -0
- package/dist/config/resolve-config.d.ts.map +1 -1
- package/dist/index.css +43 -7
- package/dist/index.d.ts +30 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +120 -115
- package/dist/libs/context.d.ts +50 -1
- package/dist/libs/context.d.ts.map +1 -1
- package/dist/libs/registry.d.ts +61 -5
- package/dist/libs/registry.d.ts.map +1 -1
- package/dist/libs/use-isomorphic-layout-effect.d.ts +18 -0
- package/dist/libs/use-isomorphic-layout-effect.d.ts.map +1 -1
- package/dist/shared/index.d.ts +3 -0
- package/dist/shared/index.d.ts.map +1 -0
- package/dist/shared/radius.d.ts +37 -1
- package/dist/shared/radius.d.ts.map +1 -1
- package/dist/shared/variant.d.ts +31 -0
- package/dist/shared/variant.d.ts.map +1 -1
- package/dist/shared/variant.js +132 -45
- package/dist/theme/color.d.ts +89 -1
- package/dist/theme/color.d.ts.map +1 -1
- package/dist/theme/controller.d.ts +121 -0
- package/dist/theme/controller.d.ts.map +1 -1
- package/dist/theme/controller.js +84 -0
- package/dist/theme/useTheme.d.ts +68 -0
- package/dist/theme/useTheme.d.ts.map +1 -1
- package/dist/theme/useTheme.js +23 -0
- package/dist/utils/index.d.ts +0 -7
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/resolve-token.d.ts +101 -0
- package/dist/utils/resolve-token.d.ts.map +1 -1
- package/package.json +1 -2
- package/dist/components/keyboard/default-keyboard-config.d.ts +0 -10
- package/dist/components/keyboard/default-keyboard-config.d.ts.map +0 -1
- package/dist/shared/size.d.ts +0 -2
- package/dist/shared/size.d.ts.map +0 -1
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import { ExternalConfig } from './config/config';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the AsheeUIProvider component.
|
|
5
|
+
*/
|
|
3
6
|
export interface AsheeUIProviderProps {
|
|
4
7
|
/**
|
|
5
8
|
* Optional partial runtime config merged over the library defaults.
|
|
@@ -9,6 +12,9 @@ export interface AsheeUIProviderProps {
|
|
|
9
12
|
* defaults and per-component options at runtime.
|
|
10
13
|
*/
|
|
11
14
|
config?: ExternalConfig;
|
|
15
|
+
/**
|
|
16
|
+
* The child components to render within the provider context.
|
|
17
|
+
*/
|
|
12
18
|
children: ReactNode;
|
|
13
19
|
}
|
|
14
20
|
/**
|
|
@@ -19,6 +25,15 @@ export interface AsheeUIProviderProps {
|
|
|
19
25
|
* (consumed via `useAsheeConfig` / `useAshee`). Theme controller
|
|
20
26
|
* setup and the pre-paint theme script are wired automatically.
|
|
21
27
|
*
|
|
28
|
+
* This component must wrap the root of your application to enable
|
|
29
|
+
* all AsheeUI features. It sets up the theme system, config context,
|
|
30
|
+
* and ensures the theme is applied before the initial paint.
|
|
31
|
+
*
|
|
32
|
+
* @param props - The component props.
|
|
33
|
+
* @param props.config - Optional custom configuration.
|
|
34
|
+
* @param props.children - The child elements.
|
|
35
|
+
* @returns The provider component with theme and configuration context.
|
|
36
|
+
*
|
|
22
37
|
* @example
|
|
23
38
|
* ```tsx
|
|
24
39
|
* import { AsheeUIProvider } from "asheeui";
|
|
@@ -28,6 +43,25 @@ export interface AsheeUIProviderProps {
|
|
|
28
43
|
* return <AsheeUIProvider config={config}>{children}</AsheeUIProvider>;
|
|
29
44
|
* }
|
|
30
45
|
* ```
|
|
46
|
+
*
|
|
47
|
+
* @example
|
|
48
|
+
* ```tsx
|
|
49
|
+
* // Inline configuration
|
|
50
|
+
* <AsheeUIProvider
|
|
51
|
+
* config={{
|
|
52
|
+
* defaultTheme: 'dark',
|
|
53
|
+
* defaultVariant: 'ghost',
|
|
54
|
+
* components: {
|
|
55
|
+
* Button: { radius: 'lg' }
|
|
56
|
+
* }
|
|
57
|
+
* }}
|
|
58
|
+
* >
|
|
59
|
+
* <App />
|
|
60
|
+
* </AsheeUIProvider>
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* @see useAsheeConfig - Hook for accessing the resolved configuration.
|
|
64
|
+
* @see AsheeThemeScript - Component that applies theme class before paint.
|
|
31
65
|
*/
|
|
32
66
|
export declare function AsheeUIProvider({ config, children, }: AsheeUIProviderProps): import("react").JSX.Element;
|
|
33
67
|
//# sourceMappingURL=AsheeUIProvider.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AsheeUIProvider.d.ts","sourceRoot":"","sources":["../src/AsheeUIProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"AsheeUIProvider.d.ts","sourceRoot":"","sources":["../src/AsheeUIProvider.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAChD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAOtD;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,cAAc,CAAC;IAExB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,wBAAgB,eAAe,CAAC,EAC9B,MAAW,EACX,QAAQ,GACT,EAAE,oBAAoB,+BAgBtB"}
|
|
@@ -1,64 +1,52 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
2
|
+
import { AccordionConfig, AccordionItem } from './accordion-config';
|
|
3
|
+
type BaseAccordionProps = AccordionConfig & Omit<React.HTMLAttributes<HTMLDivElement>, "value" | "defaultValue" | "onChange">;
|
|
4
4
|
/**
|
|
5
5
|
* Configuration options for the Accordion component.
|
|
6
6
|
*/
|
|
7
|
-
export interface AccordionProps extends
|
|
8
|
-
/**
|
|
7
|
+
export interface AccordionProps extends BaseAccordionProps {
|
|
8
|
+
/**
|
|
9
|
+
* The accordion items to render.
|
|
10
|
+
* Each item must have a title and content, with optional id, subtitle,
|
|
11
|
+
* icon, and disabled state.
|
|
9
12
|
*
|
|
10
13
|
* @default []
|
|
11
14
|
*/
|
|
12
15
|
items: AccordionItem[];
|
|
13
|
-
/**
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*/
|
|
17
|
-
variant?: AccordionVariant;
|
|
18
|
-
/** Padding and spacing scale.
|
|
19
|
-
*
|
|
20
|
-
* @default "md"
|
|
21
|
-
*/
|
|
22
|
-
size?: AccordionSizeKey;
|
|
23
|
-
/** Corner rounding applied to separated and ghost item containers.
|
|
24
|
-
*
|
|
25
|
-
* @default "md"
|
|
26
|
-
*/
|
|
27
|
-
radius?: Radius;
|
|
28
|
-
/** Allows more than one item to remain open at the same time.
|
|
29
|
-
*
|
|
30
|
-
* @default false
|
|
31
|
-
*/
|
|
32
|
-
allowMultiple?: boolean;
|
|
33
|
-
/** Initial open item keys for the uncontrolled mode.
|
|
34
|
-
*
|
|
35
|
-
* Pass a `string` for single-open mode or `string[]` when
|
|
36
|
-
* `allowMultiple` is enabled.
|
|
16
|
+
/**
|
|
17
|
+
* Default open item keys for uncontrolled usage.
|
|
18
|
+
* Can be a single key or array of keys when allowMultiple is true.
|
|
37
19
|
*/
|
|
38
20
|
defaultValue?: string | string[];
|
|
39
|
-
/**
|
|
21
|
+
/**
|
|
22
|
+
* Controlled open item keys.
|
|
40
23
|
*
|
|
41
24
|
* When provided, the component becomes controlled and updates are
|
|
42
25
|
* reported through `onValueChange`.
|
|
43
26
|
*/
|
|
44
27
|
value?: string | string[];
|
|
45
|
-
/**
|
|
28
|
+
/**
|
|
29
|
+
* Callback fired with the current open item keys.
|
|
30
|
+
* Called whenever the open state changes.
|
|
31
|
+
*/
|
|
46
32
|
onValueChange?: (value: string[]) => void;
|
|
47
|
-
/**
|
|
33
|
+
/**
|
|
34
|
+
* Custom node rendered as the expand indicator.
|
|
48
35
|
*
|
|
49
36
|
* Defaults to a rotating chevron-down icon.
|
|
50
37
|
*/
|
|
51
38
|
expandIcon?: ReactNode;
|
|
52
|
-
/**
|
|
53
|
-
*
|
|
54
|
-
* @default false
|
|
39
|
+
/**
|
|
40
|
+
* Extra classes applied to each item container.
|
|
55
41
|
*/
|
|
56
|
-
disableAnimation?: boolean;
|
|
57
|
-
/** Extra classes applied to each item container. */
|
|
58
42
|
itemClassName?: string;
|
|
59
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Extra classes applied to each header trigger button.
|
|
45
|
+
*/
|
|
60
46
|
headerClassName?: string;
|
|
61
|
-
/**
|
|
47
|
+
/**
|
|
48
|
+
* Extra classes applied to each content panel.
|
|
49
|
+
*/
|
|
62
50
|
contentClassName?: string;
|
|
63
51
|
}
|
|
64
52
|
/**
|
|
@@ -71,23 +59,28 @@ export interface AccordionProps extends Omit<React.HTMLAttributes<HTMLDivElement
|
|
|
71
59
|
* through the standard AsheeUI cascade: prop, component config, global
|
|
72
60
|
* theme defaults, and finally the built-in fallback.
|
|
73
61
|
*
|
|
74
|
-
*
|
|
75
|
-
*
|
|
62
|
+
* The component automatically handles accessibility attributes including
|
|
63
|
+
* aria-expanded, aria-controls, and proper keyboard interaction. Each
|
|
64
|
+
* item's header acts as a button that toggles the visibility of its
|
|
65
|
+
* corresponding content panel.
|
|
66
|
+
*
|
|
67
|
+
* @param props - Accordion configuration options and HTML div element props.
|
|
76
68
|
* @param props.items - Accordion items to render.
|
|
77
69
|
* @param props.variant - Visual style variant. Defaults to "separated".
|
|
78
70
|
* @param props.size - Density scale. Defaults to "md".
|
|
79
71
|
* @param props.radius - Corner rounding. Defaults to "md".
|
|
80
|
-
* @param props.allowMultiple - Allow multiple open items. Defaults to
|
|
81
|
-
* false.
|
|
72
|
+
* @param props.allowMultiple - Allow multiple open items. Defaults to false.
|
|
82
73
|
* @param props.defaultValue - Uncontrolled initial open keys.
|
|
83
74
|
* @param props.value - Controlled open keys.
|
|
84
75
|
* @param props.onValueChange - Change callback with open keys.
|
|
85
76
|
* @param props.expandIcon - Custom expand indicator node.
|
|
86
|
-
* @param props.disableAnimation - Disable animations. Defaults to
|
|
87
|
-
* false.
|
|
77
|
+
* @param props.disableAnimation - Disable animations. Defaults to false.
|
|
88
78
|
* @param props.itemClassName - Extra classes for each item.
|
|
89
79
|
* @param props.headerClassName - Extra classes for each header.
|
|
90
80
|
* @param props.contentClassName - Extra classes for each content panel.
|
|
81
|
+
* @param props.className - Extra classes for the container.
|
|
82
|
+
* @param props.style - Inline styles for the container.
|
|
83
|
+
* @param props.id - Optional ID for the container element.
|
|
91
84
|
*
|
|
92
85
|
* @example
|
|
93
86
|
* ```tsx
|
|
@@ -105,6 +98,24 @@ export interface AccordionProps extends Omit<React.HTMLAttributes<HTMLDivElement
|
|
|
105
98
|
* );
|
|
106
99
|
* }
|
|
107
100
|
* ```
|
|
101
|
+
*
|
|
102
|
+
* @example
|
|
103
|
+
* ```tsx
|
|
104
|
+
* // Controlled accordion with multiple open items
|
|
105
|
+
* const [openItems, setOpenItems] = useState(['item-1']);
|
|
106
|
+
*
|
|
107
|
+
* <Accordion
|
|
108
|
+
* value={openItems}
|
|
109
|
+
* onValueChange={setOpenItems}
|
|
110
|
+
* allowMultiple
|
|
111
|
+
* items={items}
|
|
112
|
+
* />
|
|
113
|
+
* ```
|
|
114
|
+
*
|
|
115
|
+
* @see AccordionConfig - The configuration type for component defaults.
|
|
116
|
+
* @see AccordionItem - The structure of a single accordion item.
|
|
117
|
+
* @see useAsheeConfig - Hook for accessing the global configuration.
|
|
108
118
|
*/
|
|
109
119
|
export declare const Accordion: import('react').ForwardRefExoticComponent<AccordionProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
120
|
+
export {};
|
|
110
121
|
//# sourceMappingURL=Accordion.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/Accordion.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Accordion.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/Accordion.tsx"],"names":[],"mappings":"AAUA,OAAO,EAEL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAUf,OAAO,EACL,KAAK,eAAe,EACpB,KAAK,aAAa,EAInB,MAAM,oBAAoB,CAAC;AAU5B,KAAK,kBAAkB,GAAG,eAAe,GACvC,IAAI,CACF,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EACpC,OAAO,GAAG,cAAc,GAAG,UAAU,CACtC,CAAC;AAEJ;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,kBAAkB;IACxD;;;;;;OAMG;IACH,KAAK,EAAE,aAAa,EAAE,CAAC;IAEvB;;;OAGG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAEjC;;;;;OAKG;IACH,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAE1B;;;OAGG;IACH,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IAE1C;;;;OAIG;IACH,UAAU,CAAC,EAAE,SAAS,CAAC;IAEvB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAkEG;AACH,eAAO,MAAM,SAAS,2GAmOrB,CAAC"}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as t, jsxs as u } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef as Y, useId as ee, useCallback as
|
|
3
|
+
import { forwardRef as Y, useId as ee, useCallback as O, useState as se } from "react";
|
|
4
4
|
import { ChevronDownIcon as re } from "../../icons/ChevronDownIcon.js";
|
|
5
5
|
import { useAsheeConfig as te } from "../../libs/context.js";
|
|
6
|
-
import {
|
|
7
|
-
import { resolveCascade as v, resolveRadiusKey as ie, resolveClassKey as A } from "../../utils/resolve-token.js";
|
|
6
|
+
import { resolveCascade as v, resolveRadiusKey as oe, resolveClassKey as A } from "../../utils/resolve-token.js";
|
|
8
7
|
import { FALLBACK_ACCORDION_CONFIG as o } from "./accordion-config.js";
|
|
9
|
-
import { ACCORDION_HEADER_SIZE_CLASS as
|
|
8
|
+
import { ACCORDION_HEADER_SIZE_CLASS as ie, ACCORDION_CONTENT_SIZE_CLASS as ne, ACCORDION_VARIANT_ITEM_CLASS as _, ACCORDION_VARIANT_CONTAINER_CLASS as R } from "./accordion-styles.js";
|
|
9
|
+
import { RADIUS_CLASS as ae } from "../../shared/radius.js";
|
|
10
10
|
import { cn as n } from "../../utils/cn.js";
|
|
11
11
|
const le = Y(
|
|
12
12
|
({
|
|
13
13
|
items: g = [],
|
|
14
14
|
variant: z,
|
|
15
|
-
size:
|
|
16
|
-
radius:
|
|
15
|
+
size: K,
|
|
16
|
+
radius: D,
|
|
17
17
|
allowMultiple: E,
|
|
18
18
|
defaultValue: L,
|
|
19
19
|
value: b,
|
|
@@ -29,8 +29,8 @@ const le = Y(
|
|
|
29
29
|
...k
|
|
30
30
|
}, B) => {
|
|
31
31
|
var S;
|
|
32
|
-
const f = te(), s = (S = f.components) == null ? void 0 : S.accordion, G = ee(), m = Z ?? G,
|
|
33
|
-
|
|
32
|
+
const f = te(), s = (S = f.components) == null ? void 0 : S.accordion, G = ee(), m = Z ?? G, w = v(
|
|
33
|
+
K,
|
|
34
34
|
s == null ? void 0 : s.size,
|
|
35
35
|
void 0,
|
|
36
36
|
o.size
|
|
@@ -39,40 +39,40 @@ const le = Y(
|
|
|
39
39
|
s == null ? void 0 : s.variant,
|
|
40
40
|
f.defaultVariant,
|
|
41
41
|
o.variant
|
|
42
|
-
),
|
|
42
|
+
), I = v(
|
|
43
43
|
E,
|
|
44
44
|
s == null ? void 0 : s.allowMultiple,
|
|
45
45
|
void 0,
|
|
46
46
|
o.allowMultiple
|
|
47
|
-
), H =
|
|
48
|
-
|
|
47
|
+
), H = oe(
|
|
48
|
+
D,
|
|
49
49
|
s == null ? void 0 : s.radius,
|
|
50
50
|
f.defaultRadius,
|
|
51
51
|
o.radius
|
|
52
52
|
), U = R[i] ?? R.separated, q = _[i] ?? _.separated, J = A(
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
w,
|
|
54
|
+
ie,
|
|
55
55
|
o.size
|
|
56
56
|
), P = A(
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
w,
|
|
58
|
+
ne,
|
|
59
59
|
o.size
|
|
60
|
-
),
|
|
60
|
+
), h = A(
|
|
61
61
|
H,
|
|
62
|
-
|
|
62
|
+
ae,
|
|
63
63
|
o.radius
|
|
64
|
-
), p = b !== void 0, C =
|
|
64
|
+
), p = b !== void 0, C = O(
|
|
65
65
|
(e) => e === void 0 ? [] : Array.isArray(e) ? e : [e],
|
|
66
66
|
[]
|
|
67
67
|
), [Q, W] = se(
|
|
68
68
|
() => C(L)
|
|
69
|
-
), a = p ? C(b) : Q, X =
|
|
69
|
+
), a = p ? C(b) : Q, X = O(
|
|
70
70
|
(e, N) => {
|
|
71
71
|
if (N) return;
|
|
72
72
|
let r;
|
|
73
|
-
a.includes(e) ? r = a.filter((c) => c !== e) : r =
|
|
73
|
+
a.includes(e) ? r = a.filter((c) => c !== e) : r = I ? [...a, e] : [e], p || W(r), d == null || d(r);
|
|
74
74
|
},
|
|
75
|
-
[a, p, d,
|
|
75
|
+
[a, p, d, I]
|
|
76
76
|
);
|
|
77
77
|
return /* @__PURE__ */ t(
|
|
78
78
|
"div",
|
|
@@ -82,20 +82,20 @@ const le = Y(
|
|
|
82
82
|
className: n(
|
|
83
83
|
"w-full",
|
|
84
84
|
U,
|
|
85
|
-
i !== "ghost" && i !== "flush" &&
|
|
85
|
+
i !== "ghost" && i !== "flush" && h,
|
|
86
86
|
V
|
|
87
87
|
),
|
|
88
88
|
style: F,
|
|
89
89
|
...k,
|
|
90
90
|
children: g.map((e, N) => {
|
|
91
|
-
const r = e.id || `item-${N}`, l = a.includes(r), c = `${m}-header-${r}`,
|
|
91
|
+
const r = e.id || `item-${N}`, l = a.includes(r), c = `${m}-header-${r}`, y = `${m}-content-${r}`;
|
|
92
92
|
return /* @__PURE__ */ u(
|
|
93
93
|
"div",
|
|
94
94
|
{
|
|
95
95
|
className: n(
|
|
96
96
|
"w-full transition-colors box-border",
|
|
97
97
|
q,
|
|
98
|
-
(i === "separated" || i === "ghost") &&
|
|
98
|
+
(i === "separated" || i === "ghost") && h,
|
|
99
99
|
$
|
|
100
100
|
),
|
|
101
101
|
children: [
|
|
@@ -105,7 +105,7 @@ const le = Y(
|
|
|
105
105
|
id: c,
|
|
106
106
|
type: "button",
|
|
107
107
|
"aria-expanded": l,
|
|
108
|
-
"aria-controls":
|
|
108
|
+
"aria-controls": y,
|
|
109
109
|
disabled: e.disabled,
|
|
110
110
|
onClick: () => X(r, e.disabled),
|
|
111
111
|
className: n(
|
|
@@ -138,7 +138,7 @@ const le = Y(
|
|
|
138
138
|
/* @__PURE__ */ t(
|
|
139
139
|
"section",
|
|
140
140
|
{
|
|
141
|
-
id:
|
|
141
|
+
id: y,
|
|
142
142
|
"aria-labelledby": c,
|
|
143
143
|
"data-state": l ? "open" : "closed",
|
|
144
144
|
className: n(
|
|
@@ -146,7 +146,7 @@ const le = Y(
|
|
|
146
146
|
x ? "transition-none" : "",
|
|
147
147
|
l ? "grid-rows-[1fr] opacity-100" : "grid-rows-[0fr] opacity-0 pointer-events-none"
|
|
148
148
|
),
|
|
149
|
-
children: /* @__PURE__ */ t("div", { className: "overflow-
|
|
149
|
+
children: /* @__PURE__ */ t("div", { className: "overflow-clip w-full", children: /* @__PURE__ */ t(
|
|
150
150
|
"div",
|
|
151
151
|
{
|
|
152
152
|
className: n(
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Radius } from '../../shared
|
|
3
|
-
import { Size } from '../../shared/size';
|
|
2
|
+
import { Radius, Size } from '../../shared';
|
|
4
3
|
/**
|
|
5
4
|
* Visual style of the accordion.
|
|
6
5
|
*
|
|
@@ -10,7 +9,10 @@ import { Size } from '../../shared/size';
|
|
|
10
9
|
* - `flush`: No container, borders, or dividers.
|
|
11
10
|
*/
|
|
12
11
|
export type AccordionVariant = "bordered" | "separated" | "ghost" | "flush";
|
|
13
|
-
/**
|
|
12
|
+
/**
|
|
13
|
+
* Padding and spacing scale used by accordion headers and content.
|
|
14
|
+
* Maps to the standard Size type: "sm", "md", or "lg".
|
|
15
|
+
*/
|
|
14
16
|
export type AccordionSizeKey = Size;
|
|
15
17
|
/**
|
|
16
18
|
* A single accordion entry.
|
|
@@ -22,15 +24,25 @@ export interface AccordionItem {
|
|
|
22
24
|
* When omitted, the item's `title` is used as the key.
|
|
23
25
|
*/
|
|
24
26
|
id?: string;
|
|
25
|
-
/**
|
|
27
|
+
/**
|
|
28
|
+
* Item header label.
|
|
29
|
+
*/
|
|
26
30
|
title: ReactNode;
|
|
27
|
-
/**
|
|
31
|
+
/**
|
|
32
|
+
* Expandable content rendered below the header.
|
|
33
|
+
*/
|
|
28
34
|
content: ReactNode;
|
|
29
|
-
/**
|
|
35
|
+
/**
|
|
36
|
+
* Optional secondary text shown under the title.
|
|
37
|
+
*/
|
|
30
38
|
subtitle?: ReactNode;
|
|
31
|
-
/**
|
|
39
|
+
/**
|
|
40
|
+
* Optional leading icon rendered before the title.
|
|
41
|
+
*/
|
|
32
42
|
icon?: ReactNode;
|
|
33
|
-
/**
|
|
43
|
+
/**
|
|
44
|
+
* Disables the item's trigger when `true`.
|
|
45
|
+
* Disabled items cannot be opened or closed by the user.
|
|
34
46
|
*
|
|
35
47
|
* @default false
|
|
36
48
|
*/
|
|
@@ -43,26 +55,41 @@ export interface AccordionItem {
|
|
|
43
55
|
* under `components.accordion` in the AsheeUI config.
|
|
44
56
|
*/
|
|
45
57
|
export interface AccordionConfig {
|
|
46
|
-
/**
|
|
58
|
+
/**
|
|
59
|
+
* Visual style variant.
|
|
60
|
+
* Controls the container and item appearance.
|
|
47
61
|
*
|
|
48
62
|
* @default "separated"
|
|
49
63
|
*/
|
|
50
64
|
variant?: AccordionVariant;
|
|
51
|
-
/**
|
|
65
|
+
/**
|
|
66
|
+
* Padding and spacing scale.
|
|
67
|
+
* Controls the density of headers and content panels.
|
|
52
68
|
*
|
|
53
69
|
* @default "md"
|
|
54
70
|
*/
|
|
55
71
|
size?: AccordionSizeKey;
|
|
56
|
-
/**
|
|
72
|
+
/**
|
|
73
|
+
* Corner rounding.
|
|
74
|
+
* Controls the border-radius of the container or individual items.
|
|
57
75
|
*
|
|
58
76
|
* @default "md"
|
|
59
77
|
*/
|
|
60
78
|
radius?: Radius;
|
|
61
|
-
/**
|
|
79
|
+
/**
|
|
80
|
+
* Allows more than one item to stay open at a time.
|
|
81
|
+
* When false, opening one item closes all others.
|
|
62
82
|
*
|
|
63
83
|
* @default false
|
|
64
84
|
*/
|
|
65
85
|
allowMultiple?: boolean;
|
|
86
|
+
/**
|
|
87
|
+
* Disables all expand/collapse animations.
|
|
88
|
+
* When true, items open and close instantly without transitions.
|
|
89
|
+
*
|
|
90
|
+
* @default false
|
|
91
|
+
*/
|
|
92
|
+
disableAnimation?: boolean;
|
|
66
93
|
}
|
|
67
94
|
/**
|
|
68
95
|
* Default config values registered for the Accordion component.
|
|
@@ -78,6 +105,8 @@ declare module "../../libs/registry" {
|
|
|
78
105
|
}
|
|
79
106
|
/**
|
|
80
107
|
* Hard fallback values used when no config tier provides a value.
|
|
108
|
+
* These values are used when all other cascade tiers (instance prop,
|
|
109
|
+
* component config, and global default) are undefined.
|
|
81
110
|
*/
|
|
82
111
|
export declare const FALLBACK_ACCORDION_CONFIG: {
|
|
83
112
|
readonly size: "md";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-config.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/accordion-config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"accordion-config.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/accordion-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEjD;;;;;;;GAOG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,WAAW,GAAG,OAAO,GAAG,OAAO,CAAC;AAE5E;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GAAG,IAAI,CAAC;AAEpC;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B;;;;OAIG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IAEZ;;OAEG;IACH,KAAK,EAAE,SAAS,CAAC;IAEjB;;OAEG;IACH,OAAO,EAAE,SAAS,CAAC;IAEnB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;OAEG;IACH,IAAI,CAAC,EAAE,SAAS,CAAC;IAEjB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B;;;;;OAKG;IACH,OAAO,CAAC,EAAE,gBAAgB,CAAC;IAE3B;;;;;OAKG;IACH,IAAI,CAAC,EAAE,gBAAgB,CAAC;IAExB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;;OAKG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,EAAE,eAGpC,CAAC;AAEF,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,SAAS,EAAE,eAAe,CAAC;KAC5B;CACF;AAID;;;;GAIG;AACH,eAAO,MAAM,yBAAyB;;;;;CAK5B,CAAC"}
|
|
@@ -1,6 +1,26 @@
|
|
|
1
1
|
import { AccordionSizeKey, AccordionVariant } from './accordion-config';
|
|
2
|
+
/**
|
|
3
|
+
* CSS classes for accordion header padding and font size.
|
|
4
|
+
* Maps size keys to Tailwind classes that control the header's
|
|
5
|
+
* spacing and typography.
|
|
6
|
+
*/
|
|
2
7
|
export declare const ACCORDION_HEADER_SIZE_CLASS: Record<AccordionSizeKey, string>;
|
|
8
|
+
/**
|
|
9
|
+
* CSS classes for accordion content padding and font size.
|
|
10
|
+
* Maps size keys to Tailwind classes that control the content panel's
|
|
11
|
+
* spacing and typography.
|
|
12
|
+
*/
|
|
3
13
|
export declare const ACCORDION_CONTENT_SIZE_CLASS: Record<AccordionSizeKey, string>;
|
|
14
|
+
/**
|
|
15
|
+
* CSS classes for accordion container based on variant.
|
|
16
|
+
* These classes control the overall container appearance, including
|
|
17
|
+
* borders, dividers, and spacing between items.
|
|
18
|
+
*/
|
|
4
19
|
export declare const ACCORDION_VARIANT_CONTAINER_CLASS: Record<AccordionVariant, string>;
|
|
20
|
+
/**
|
|
21
|
+
* CSS classes for individual accordion items based on variant.
|
|
22
|
+
* These classes control the appearance of each item, including
|
|
23
|
+
* backgrounds, borders, and hover states.
|
|
24
|
+
*/
|
|
5
25
|
export declare const ACCORDION_VARIANT_ITEM_CLASS: Record<AccordionVariant, string>;
|
|
6
26
|
//# sourceMappingURL=accordion-styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"accordion-styles.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/accordion-styles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE7E,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAIxE,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAIzE,CAAC;AAEF,eAAO,MAAM,iCAAiC,EAAE,MAAM,CACpD,gBAAgB,EAChB,MAAM,CAMP,CAAC;AAEF,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAMzE,CAAC"}
|
|
1
|
+
{"version":3,"file":"accordion-styles.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/accordion-styles.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAE7E;;;;GAIG;AACH,eAAO,MAAM,2BAA2B,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAIxE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAIzE,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,iCAAiC,EAAE,MAAM,CACpD,gBAAgB,EAChB,MAAM,CAMP,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,4BAA4B,EAAE,MAAM,CAAC,gBAAgB,EAAE,MAAM,CAMzE,CAAC"}
|
|
@@ -13,7 +13,7 @@ const r = {
|
|
|
13
13
|
ghost: "divide-y divide-border border-y border-border",
|
|
14
14
|
flush: "space-y-1"
|
|
15
15
|
}, s = {
|
|
16
|
-
bordered: "bg-secondary transition-colors hover:bg-
|
|
16
|
+
bordered: "bg-secondary transition-colors hover:bg-foreground/10",
|
|
17
17
|
separated: "border border-border bg-secondary transition-colors hover:bg-secondary/30 shadow-xs",
|
|
18
18
|
ghost: "bg-transparent transition-colors hover:bg-secondary/20",
|
|
19
19
|
flush: "bg-transparent hover:bg-secondary/50 transition-colors"
|
|
@@ -1,55 +1,53 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
-
import { Radius } from '../../shared/radius';
|
|
3
|
-
import { Size } from '../../shared/size';
|
|
4
|
-
import { Color, Variant } from '../../shared/variant';
|
|
5
2
|
import { InputProps } from '../input/Input';
|
|
6
|
-
import {
|
|
3
|
+
import { SelectMenuOption } from '../select-menu';
|
|
4
|
+
import { AutocompleteConfig } from './autocomplete-config';
|
|
5
|
+
type BaseAutocompleteProps = AutocompleteConfig & Omit<InputProps, "value" | "onChange">;
|
|
7
6
|
/**
|
|
8
7
|
* Configuration options for the Autocomplete component.
|
|
9
8
|
*/
|
|
10
|
-
export interface AutocompleteProps extends
|
|
11
|
-
/**
|
|
9
|
+
export interface AutocompleteProps extends BaseAutocompleteProps {
|
|
10
|
+
/**
|
|
11
|
+
* Suggestions shown while the user types.
|
|
12
|
+
* Each option must have a label and a unique value.
|
|
12
13
|
*
|
|
13
14
|
* @default []
|
|
14
15
|
*/
|
|
15
|
-
options:
|
|
16
|
-
/**
|
|
16
|
+
options: SelectMenuOption[];
|
|
17
|
+
/**
|
|
18
|
+
* Controlled selected value, shown as its option label.
|
|
19
|
+
* When allowCustomValue is true, this can be a free-form string.
|
|
20
|
+
*/
|
|
17
21
|
value?: string | number;
|
|
18
|
-
/**
|
|
19
|
-
|
|
20
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Callback fired with the selected value and option.
|
|
24
|
+
* Called when a suggestion is selected from the dropdown.
|
|
25
|
+
*/
|
|
26
|
+
onValueChange?: (value: string | number, option?: SelectMenuOption) => void;
|
|
27
|
+
/**
|
|
28
|
+
* Callback fired whenever the raw input text changes.
|
|
29
|
+
* Called on every keystroke, providing the current input value.
|
|
30
|
+
*/
|
|
21
31
|
onInputChange?: (inputValue: string) => void;
|
|
22
|
-
/**
|
|
32
|
+
/**
|
|
33
|
+
* Allows free-form values that are not in the options list.
|
|
23
34
|
*
|
|
24
35
|
* When enabled, typing emits the raw text through `onValueChange`.
|
|
36
|
+
* The dropdown will still show filtered suggestions, but the user
|
|
37
|
+
* can enter any text.
|
|
25
38
|
*
|
|
26
39
|
* @default false
|
|
27
40
|
*/
|
|
28
41
|
allowCustomValue?: boolean;
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
dropdownClassName?: string;
|
|
33
|
-
/** Visual style of the dropdown menu.
|
|
34
|
-
*
|
|
35
|
-
* @default "solid"
|
|
36
|
-
*/
|
|
37
|
-
menuVariant?: Variant;
|
|
38
|
-
/** Theme accent color of the dropdown menu.
|
|
39
|
-
*
|
|
40
|
-
* @default "default"
|
|
41
|
-
*/
|
|
42
|
-
menuColor?: Color;
|
|
43
|
-
/** Corner rounding of the dropdown menu.
|
|
44
|
-
*
|
|
45
|
-
* @default "md"
|
|
42
|
+
/**
|
|
43
|
+
* Content rendered below the options list.
|
|
44
|
+
* Useful for adding "Add new" buttons or status messages.
|
|
46
45
|
*/
|
|
47
|
-
|
|
48
|
-
/**
|
|
49
|
-
*
|
|
50
|
-
* @default "sm"
|
|
46
|
+
belowList?: ReactNode;
|
|
47
|
+
/**
|
|
48
|
+
* Extra classes applied to the floating dropdown.
|
|
51
49
|
*/
|
|
52
|
-
|
|
50
|
+
dropdownClassName?: string;
|
|
53
51
|
}
|
|
54
52
|
/**
|
|
55
53
|
* A text input with a filterable suggestion dropdown.
|
|
@@ -60,19 +58,25 @@ export interface AutocompleteProps extends Omit<InputProps, "value" | "onChange"
|
|
|
60
58
|
* values are supported via `allowCustomValue`. Menu tokens resolve
|
|
61
59
|
* through the standard AsheeUI cascade.
|
|
62
60
|
*
|
|
61
|
+
* The component handles accessibility through Floating UI's interaction
|
|
62
|
+
* hooks, including focus management, dismissal on outside clicks,
|
|
63
|
+
* and proper ARIA roles for the combobox pattern.
|
|
64
|
+
*
|
|
63
65
|
* @param props - Autocomplete configuration options and input props.
|
|
64
66
|
* @param props.options - Suggestion list.
|
|
65
67
|
* @param props.value - Controlled selected value.
|
|
66
68
|
* @param props.onValueChange - Selection callback.
|
|
67
69
|
* @param props.onInputChange - Raw input change callback.
|
|
68
|
-
* @param props.allowCustomValue - Allow free-form values. Defaults to
|
|
69
|
-
* false.
|
|
70
|
+
* @param props.allowCustomValue - Allow free-form values. Defaults to false.
|
|
70
71
|
* @param props.belowList - Content below the options list.
|
|
71
72
|
* @param props.dropdownClassName - Extra dropdown classes.
|
|
72
73
|
* @param props.menuVariant - Dropdown variant. Defaults to "solid".
|
|
73
|
-
* @param props.
|
|
74
|
-
* @param props.
|
|
75
|
-
* @param props.
|
|
74
|
+
* @param props.color - Dropdown color. Defaults to "default".
|
|
75
|
+
* @param props.radius - Dropdown radius. Defaults to "md".
|
|
76
|
+
* @param props.size - Dropdown density. Defaults to "sm".
|
|
77
|
+
* @param props.disabled - Whether the input is disabled.
|
|
78
|
+
* @param props.placeholder - Placeholder text for the input.
|
|
79
|
+
* @param props.className - Extra classes for the input.
|
|
76
80
|
*
|
|
77
81
|
* @example
|
|
78
82
|
* ```tsx
|
|
@@ -91,6 +95,22 @@ export interface AutocompleteProps extends Omit<InputProps, "value" | "onChange"
|
|
|
91
95
|
* );
|
|
92
96
|
* }
|
|
93
97
|
* ```
|
|
98
|
+
*
|
|
99
|
+
* @example
|
|
100
|
+
* ```tsx
|
|
101
|
+
* // With free-form values
|
|
102
|
+
* <Autocomplete
|
|
103
|
+
* allowCustomValue
|
|
104
|
+
* options={fruits}
|
|
105
|
+
* onValueChange={(value) => console.log('Selected:', value)}
|
|
106
|
+
* placeholder="Type a fruit name..."
|
|
107
|
+
* />
|
|
108
|
+
* ```
|
|
109
|
+
*
|
|
110
|
+
* @see AutocompleteConfig - The configuration type for component defaults.
|
|
111
|
+
* @see SelectMenu - The dropdown component used for suggestions.
|
|
112
|
+
* @see useAsheeConfig - Hook for accessing the global configuration.
|
|
94
113
|
*/
|
|
95
114
|
export declare const Autocomplete: import('react').ForwardRefExoticComponent<AutocompleteProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
115
|
+
export {};
|
|
96
116
|
//# sourceMappingURL=Autocomplete.d.ts.map
|