asheeui 0.6.8 → 0.6.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/autocomplete/Autocomplete.d.ts +34 -17
- package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/Autocomplete.js +86 -102
- package/dist/components/autocomplete/autocomplete-config.d.ts +4 -22
- package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete-config.js +8 -11
- package/dist/components/button/Button.d.ts +31 -5
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +68 -64
- package/dist/components/card/Card.d.ts +58 -54
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +152 -158
- package/dist/components/card/card-config.d.ts +66 -33
- package/dist/components/card/card-config.d.ts.map +1 -1
- package/dist/components/card/card-config.js +9 -9
- package/dist/components/date-picker/Calendar.d.ts +57 -0
- package/dist/components/date-picker/Calendar.d.ts.map +1 -0
- package/dist/components/date-picker/Calendar.js +224 -0
- package/dist/components/date-picker/DatePicker.d.ts +68 -155
- package/dist/components/date-picker/DatePicker.d.ts.map +1 -1
- package/dist/components/date-picker/DatePicker.js +194 -466
- package/dist/components/date-picker/TimeSpinner.d.ts +46 -0
- package/dist/components/date-picker/TimeSpinner.d.ts.map +1 -0
- package/dist/components/date-picker/TimeSpinner.js +84 -0
- package/dist/components/date-picker/date-picker-config.d.ts +24 -3
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-config.js +9 -12
- package/dist/components/date-picker/date-picker-styles.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-styles.js +4 -11
- package/dist/components/date-picker/date-picker.helpers.d.ts +111 -0
- package/dist/components/date-picker/date-picker.helpers.d.ts.map +1 -0
- package/dist/components/date-picker/date-picker.helpers.js +110 -0
- package/dist/components/date-picker/index.js +3 -0
- package/dist/components/input/Input.d.ts +13 -7
- package/dist/components/input/Input.d.ts.map +1 -1
- package/dist/components/input/Input.js +96 -91
- package/dist/components/keyboard/KeyboardContext.d.ts +130 -0
- package/dist/components/keyboard/KeyboardContext.d.ts.map +1 -0
- package/dist/components/keyboard/KeyboardContext.js +13 -0
- package/dist/components/keyboard/KeyboardProvider.d.ts +78 -0
- package/dist/components/keyboard/KeyboardProvider.d.ts.map +1 -0
- package/dist/components/keyboard/KeyboardProvider.js +183 -0
- package/dist/components/keyboard/OnScreenKeyboard.d.ts +65 -43
- package/dist/components/keyboard/OnScreenKeyboard.d.ts.map +1 -1
- package/dist/components/keyboard/OnScreenKeyboard.js +119 -113
- package/dist/components/keyboard/index.d.ts +2 -1
- package/dist/components/keyboard/index.d.ts.map +1 -1
- package/dist/components/keyboard/index.js +2 -1
- package/dist/components/keyboard/keyboard-config.d.ts +40 -36
- package/dist/components/keyboard/keyboard-config.d.ts.map +1 -1
- package/dist/components/keyboard/keyboard-config.js +15 -10
- package/dist/components/keyboard/use-keyboard-field.d.ts +6 -4
- package/dist/components/keyboard/use-keyboard-field.d.ts.map +1 -1
- package/dist/components/keyboard/use-keyboard-field.js +12 -12
- package/dist/components/multi-select/MultiSelect.d.ts +75 -40
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +188 -187
- package/dist/components/multi-select/multi-select-config.d.ts +4 -22
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-config.js +11 -14
- package/dist/components/radio/radio-config.d.ts +3 -2
- package/dist/components/radio/radio-config.d.ts.map +1 -1
- package/dist/components/radio/radio-config.js +9 -8
- package/dist/components/select/Select.d.ts +60 -45
- package/dist/components/select/Select.d.ts.map +1 -1
- package/dist/components/select/Select.js +147 -159
- package/dist/components/select/select-config.d.ts +5 -33
- package/dist/components/select/select-config.d.ts.map +1 -1
- package/dist/components/select/select-config.js +6 -13
- package/dist/components/select/select-styles.js +1 -6
- package/dist/components/select-menu/SelectMenu.d.ts +45 -30
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +125 -124
- package/dist/components/select-menu/select-menu-config.d.ts +25 -2
- package/dist/components/select-menu/select-menu-config.d.ts.map +1 -1
- package/dist/components/select-menu/select-menu-config.js +4 -3
- package/dist/components/switch/Switch.d.ts +9 -33
- package/dist/components/switch/Switch.d.ts.map +1 -1
- package/dist/components/switch/Switch.js +68 -74
- package/dist/components/switch/switch-config.d.ts +3 -2
- package/dist/components/switch/switch-config.d.ts.map +1 -1
- package/dist/components/switch/switch-config.js +6 -5
- package/dist/components/switch/switch-styles.d.ts +1 -6
- package/dist/components/switch/switch-styles.d.ts.map +1 -1
- package/dist/components/switch/switch-styles.js +6 -12
- package/dist/components/textarea/Textarea.d.ts +19 -1
- package/dist/components/textarea/Textarea.d.ts.map +1 -1
- package/dist/components/textarea/Textarea.js +95 -90
- package/dist/components/toast/ToastContext.d.ts +122 -0
- package/dist/components/toast/ToastContext.d.ts.map +1 -0
- package/dist/components/toast/ToastContext.js +28 -0
- package/dist/components/toast/ToastProvider.d.ts +98 -0
- package/dist/components/toast/ToastProvider.d.ts.map +1 -0
- package/dist/components/toast/ToastProvider.js +192 -0
- package/dist/components/toast/index.d.ts +2 -1
- package/dist/components/toast/index.d.ts.map +1 -1
- package/dist/components/toast/index.js +2 -1
- package/dist/components/toast/toast-config.d.ts +36 -0
- package/dist/components/toast/toast-config.d.ts.map +1 -1
- package/dist/components/toast/toast-styles.d.ts +8 -0
- package/dist/components/toast/toast-styles.d.ts.map +1 -1
- package/dist/components/toast/toast-styles.js +11 -3
- package/dist/icons/ChevronUpIcon.d.ts +3 -0
- package/dist/icons/ChevronUpIcon.d.ts.map +1 -0
- package/dist/icons/ChevronUpIcon.js +21 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.d.ts.map +1 -1
- package/dist/index.js +62 -59
- package/dist/theme/color.js +2 -2
- package/package.json +1 -1
- package/dist/components/keyboard/keyboard-context.d.ts +0 -118
- package/dist/components/keyboard/keyboard-context.d.ts.map +0 -1
- package/dist/components/keyboard/keyboard-context.js +0 -90
- package/dist/components/toast/toast-context.d.ts +0 -163
- package/dist/components/toast/toast-context.d.ts.map +0 -1
- package/dist/components/toast/toast-context.js +0 -177
|
@@ -1,11 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { FIELD_STATUS_BORDER_CLASS as S } from "../field/field-styles.js";
|
|
3
|
-
const
|
|
4
|
-
sm: "h-8 px-2.5 text-xs",
|
|
5
|
-
md: "h-10 px-3 text-sm",
|
|
6
|
-
lg: "h-12 px-4 text-base"
|
|
7
|
-
}, E = S;
|
|
3
|
+
const E = S;
|
|
8
4
|
export {
|
|
9
|
-
x as SELECT_SIZE_CLASS,
|
|
10
5
|
E as SELECT_STATUS_BORDER_CLASS
|
|
11
6
|
};
|
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
import { FloatingContext } from '@floating-ui/react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import {
|
|
3
|
+
import { MenuConfig, SelectMenuOption } from './select-menu-config';
|
|
4
|
+
/**
|
|
5
|
+
* Menu props that extend MenuConfig with className.
|
|
6
|
+
* Used for menu configuration overrides.
|
|
7
|
+
*/
|
|
8
|
+
export type MenuProps = MenuConfig & {
|
|
9
|
+
/**
|
|
10
|
+
* Extra CSS classes for the menu container.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
4
14
|
/**
|
|
5
15
|
* Props for the SelectMenu component.
|
|
6
16
|
*/
|
|
@@ -66,18 +76,15 @@ export interface SelectMenuProps {
|
|
|
66
76
|
* Content rendered below the options list.
|
|
67
77
|
*/
|
|
68
78
|
belowList?: ReactNode;
|
|
69
|
-
/**
|
|
70
|
-
* Extra CSS classes for the dropdown.
|
|
71
|
-
*/
|
|
72
|
-
dropdownClassName?: string;
|
|
73
79
|
/**
|
|
74
80
|
* Configuration for menu items from the parent component.
|
|
75
81
|
*/
|
|
76
|
-
menuConfig?:
|
|
82
|
+
menuConfig?: MenuConfig;
|
|
77
83
|
/**
|
|
78
84
|
* Props override for menu configuration.
|
|
85
|
+
* Includes className, portal, portalTarget, and visual style options.
|
|
79
86
|
*/
|
|
80
|
-
menuProps?:
|
|
87
|
+
menuProps?: MenuProps;
|
|
81
88
|
/**
|
|
82
89
|
* Custom render function for each option.
|
|
83
90
|
* Receives the option and a boolean indicating if it's selected.
|
|
@@ -92,20 +99,6 @@ export interface SelectMenuProps {
|
|
|
92
99
|
* @default false
|
|
93
100
|
*/
|
|
94
101
|
returnFocus?: boolean;
|
|
95
|
-
/**
|
|
96
|
-
* Whether to render the menu in a React portal.
|
|
97
|
-
* When true, the menu is rendered at the document body level.
|
|
98
|
-
* Defaults to true. This is typically controlled by the parent
|
|
99
|
-
* component (Select, MultiSelect, Autocomplete) via their own
|
|
100
|
-
* config or props.
|
|
101
|
-
*/
|
|
102
|
-
portal?: boolean;
|
|
103
|
-
/**
|
|
104
|
-
* Custom portal target element for the menu.
|
|
105
|
-
* When portal is enabled, the menu is rendered into this element.
|
|
106
|
-
* Defaults to document.body.
|
|
107
|
-
*/
|
|
108
|
-
portalTarget?: HTMLElement | null;
|
|
109
102
|
}
|
|
110
103
|
/**
|
|
111
104
|
* A reusable dropdown menu for selecting options from a list.
|
|
@@ -121,8 +114,8 @@ export interface SelectMenuProps {
|
|
|
121
114
|
* By default, the menu uses React's createPortal to render at the document
|
|
122
115
|
* body level. This ensures the menu escapes CSS containment, overflow
|
|
123
116
|
* clipping, and stacking context issues. The portal can be disabled via
|
|
124
|
-
* the `portal` prop if the menu needs to stay within a specific
|
|
125
|
-
* container. This is typically controlled by the parent component.
|
|
117
|
+
* the `menuProps.portal` prop if the menu needs to stay within a specific
|
|
118
|
+
* parent container. This is typically controlled by the parent component.
|
|
126
119
|
*
|
|
127
120
|
* @param props - SelectMenu configuration options.
|
|
128
121
|
* @param props.isOpen - Whether the menu is open.
|
|
@@ -135,14 +128,15 @@ export interface SelectMenuProps {
|
|
|
135
128
|
* @param props.onSelectMenuOption - Callback fired when an option is selected.
|
|
136
129
|
* @param props.isSearch - Whether search is enabled. Defaults to true.
|
|
137
130
|
* @param props.searchPlaceholder - Search placeholder. Defaults to "Search...".
|
|
131
|
+
* @param props.searchInputName - Name attribute for the search input. Defaults to "select-menu-search".
|
|
132
|
+
* @param props.searchQuery - Controlled search query value.
|
|
133
|
+
* @param props.onSearchChange - Callback fired when the search query changes.
|
|
138
134
|
* @param props.belowList - Content below the options list.
|
|
139
|
-
* @param props.dropdownClassName - Extra classes for the dropdown.
|
|
140
135
|
* @param props.menuConfig - Configuration for menu items.
|
|
141
|
-
* @param props.menuProps - Props override for menu configuration.
|
|
136
|
+
* @param props.menuProps - Props override for menu configuration. Includes className, portal, portalTarget, and visual styles.
|
|
142
137
|
* @param props.renderOption - Custom render function for options.
|
|
143
|
-
* @param props.
|
|
144
|
-
* @param props.
|
|
145
|
-
* @param props.lockScroll - Whether to lock body scroll. Defaults to true.
|
|
138
|
+
* @param props.initialFocus - Initial focus target for the FloatingFocusManager.
|
|
139
|
+
* @param props.returnFocus - Whether to return focus to the trigger after closing. Defaults to false.
|
|
146
140
|
*
|
|
147
141
|
* @example
|
|
148
142
|
* ```tsx
|
|
@@ -160,11 +154,32 @@ export interface SelectMenuProps {
|
|
|
160
154
|
* />
|
|
161
155
|
* ```
|
|
162
156
|
*
|
|
163
|
-
* @
|
|
157
|
+
* @example
|
|
158
|
+
* ```tsx
|
|
159
|
+
* // With custom menu configuration
|
|
160
|
+
* <SelectMenu
|
|
161
|
+
* isOpen={isOpen}
|
|
162
|
+
* context={context}
|
|
163
|
+
* floatingStyles={floatingStyles}
|
|
164
|
+
* getFloatingProps={getFloatingProps}
|
|
165
|
+
* setFloatingRef={refs.setFloating}
|
|
166
|
+
* options={options}
|
|
167
|
+
* selectedValues={selectedValues}
|
|
168
|
+
* onSelectMenuOption={handleSelect}
|
|
169
|
+
* menuProps={{
|
|
170
|
+
* className: "custom-dropdown",
|
|
171
|
+
* portal: false,
|
|
172
|
+
* itemVariant: "solid",
|
|
173
|
+
* activeItemColor: "success"
|
|
174
|
+
* }}
|
|
175
|
+
* />
|
|
176
|
+
* ```
|
|
177
|
+
*
|
|
178
|
+
* @see MenuConfig - The configuration type for menu items.
|
|
164
179
|
* @see Button - The button component used for menu items.
|
|
165
180
|
*/
|
|
166
181
|
export declare const SelectMenu: {
|
|
167
|
-
({ isOpen, context, floatingStyles, getFloatingProps, setFloatingRef, options, selectedValues, onSelectMenuOption, isSearch, searchPlaceholder, searchInputName, searchQuery, onSearchChange, belowList,
|
|
182
|
+
({ isOpen, context, floatingStyles, getFloatingProps, setFloatingRef, options, selectedValues, onSelectMenuOption, isSearch, searchPlaceholder, searchInputName, searchQuery, onSearchChange, belowList, menuConfig, menuProps, renderOption, initialFocus, returnFocus, }: SelectMenuProps): import("react").JSX.Element | null;
|
|
168
183
|
displayName: string;
|
|
169
184
|
};
|
|
170
185
|
//# sourceMappingURL=SelectMenu.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SelectMenu.d.ts","sourceRoot":"","sources":["../../../src/components/select-menu/SelectMenu.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAEL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAUf,OAAO,EAEL,KAAK,
|
|
1
|
+
{"version":3,"file":"SelectMenu.d.ts","sourceRoot":"","sources":["../../../src/components/select-menu/SelectMenu.tsx"],"names":[],"mappings":"AAUA,OAAO,EAAE,KAAK,eAAe,EAAwB,MAAM,oBAAoB,CAAC;AAChF,OAAO,EAEL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAUf,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,gBAAgB,EACtB,MAAM,sBAAsB,CAAC;AAE9B;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG;IACnC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC;IAEzB;;OAEG;IACH,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC;IAEpC;;OAEG;IACH,gBAAgB,EAAE,CAChB,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAChC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAE7B;;OAEG;IACH,cAAc,EAAE,CAAC,IAAI,EAAE,WAAW,GAAG,IAAI,KAAK,IAAI,CAAC;IAEnD;;OAEG;IACH,OAAO,EAAE,gBAAgB,EAAE,CAAC;IAE5B;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAErC;;;OAGG;IACH,kBAAkB,EAAE,CAAC,MAAM,EAAE,gBAAgB,KAAK,IAAI,CAAC;IAEvD;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,eAAe,CAAC,EAAE,MAAM,CAAC;IAEzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;OAEG;IACH,cAAc,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAEzC;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;OAEG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,MAAM,EAAE,gBAAgB,EAAE,UAAU,EAAE,OAAO,KAAK,SAAS,CAAC;IAE5E;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAErD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6EG;AACH,eAAO,MAAM,UAAU;gRAoBpB,eAAe;;CA2NjB,CAAC"}
|
|
@@ -1,160 +1,161 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as
|
|
3
|
-
import { FloatingFocusManager as
|
|
4
|
-
import { useState as
|
|
5
|
-
import { createPortal as
|
|
6
|
-
import { CheckIcon as
|
|
7
|
-
import { SearchIcon as
|
|
8
|
-
import { useAsheeConfig as
|
|
9
|
-
import { resolveCascade as
|
|
10
|
-
import { Button as
|
|
11
|
-
import { Input as
|
|
12
|
-
import { FALLBACK_SELECT_MENU_CONFIG as
|
|
13
|
-
import { cn as
|
|
14
|
-
const
|
|
2
|
+
import { jsx as a, jsxs as V } from "react/jsx-runtime";
|
|
3
|
+
import { FloatingFocusManager as X } from "@floating-ui/react";
|
|
4
|
+
import { useState as Y, useEffect as Z, useMemo as $ } from "react";
|
|
5
|
+
import { createPortal as n } from "react-dom";
|
|
6
|
+
import { CheckIcon as u } from "../../icons/CheckIcon.js";
|
|
7
|
+
import { SearchIcon as m } from "../../icons/SearchIcon.js";
|
|
8
|
+
import { useAsheeConfig as p } from "../../libs/context.js";
|
|
9
|
+
import { resolveCascade as r, resolveRadiusKey as C } from "../../utils/resolve-token.js";
|
|
10
|
+
import { Button as g } from "../button/Button.js";
|
|
11
|
+
import { Input as P } from "../input/Input.js";
|
|
12
|
+
import { FALLBACK_SELECT_MENU_CONFIG as d } from "./select-menu-config.js";
|
|
13
|
+
import { cn as tt } from "../../utils/cn.js";
|
|
14
|
+
const lt = ({
|
|
15
15
|
isOpen: s,
|
|
16
|
-
context:
|
|
17
|
-
floatingStyles:
|
|
18
|
-
getFloatingProps:
|
|
19
|
-
setFloatingRef:
|
|
16
|
+
context: A,
|
|
17
|
+
floatingStyles: F,
|
|
18
|
+
getFloatingProps: L,
|
|
19
|
+
setFloatingRef: M,
|
|
20
20
|
options: v = [],
|
|
21
|
-
selectedValues:
|
|
22
|
-
onSelectMenuOption:
|
|
21
|
+
selectedValues: E = [],
|
|
22
|
+
onSelectMenuOption: Q,
|
|
23
23
|
isSearch: y = !0,
|
|
24
|
-
searchPlaceholder:
|
|
25
|
-
searchInputName:
|
|
26
|
-
searchQuery:
|
|
24
|
+
searchPlaceholder: T = "Search...",
|
|
25
|
+
searchInputName: j = "select-menu-search",
|
|
26
|
+
searchQuery: K,
|
|
27
27
|
onSearchChange: b,
|
|
28
28
|
belowList: h,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
returnFocus: R,
|
|
35
|
-
portal: _ = !0,
|
|
36
|
-
portalTarget: B
|
|
29
|
+
menuConfig: l,
|
|
30
|
+
menuProps: t = {},
|
|
31
|
+
renderOption: x,
|
|
32
|
+
initialFocus: R,
|
|
33
|
+
returnFocus: _
|
|
37
34
|
}) => {
|
|
38
|
-
const c =
|
|
39
|
-
b ? b(
|
|
40
|
-
},
|
|
41
|
-
e == null ? void 0 : e.lockScroll,
|
|
35
|
+
const c = p(), [B, D] = Y(""), i = K ?? B, G = (e) => {
|
|
36
|
+
b ? b(e) : D(e);
|
|
37
|
+
}, w = r(
|
|
42
38
|
t == null ? void 0 : t.lockScroll,
|
|
39
|
+
l == null ? void 0 : l.lockScroll,
|
|
43
40
|
void 0,
|
|
44
|
-
|
|
41
|
+
d.lockScroll
|
|
42
|
+
), O = r(
|
|
43
|
+
t == null ? void 0 : t.portal,
|
|
44
|
+
l == null ? void 0 : l.portal,
|
|
45
|
+
void 0,
|
|
46
|
+
d.portal
|
|
47
|
+
), I = r(
|
|
48
|
+
t == null ? void 0 : t.portalTarget,
|
|
49
|
+
l == null ? void 0 : l.portalTarget,
|
|
50
|
+
void 0,
|
|
51
|
+
typeof document < "u" ? document.body : null
|
|
45
52
|
);
|
|
46
|
-
|
|
47
|
-
if (!s || !
|
|
48
|
-
const
|
|
53
|
+
Z(() => {
|
|
54
|
+
if (!s || !w) return;
|
|
55
|
+
const e = document.body.style.overflow, o = document.body.style.position, J = document.body.style.width;
|
|
49
56
|
return document.body.style.overflow = "hidden", document.body.style.position = "fixed", document.body.style.width = "100%", () => {
|
|
50
|
-
document.body.style.overflow =
|
|
57
|
+
document.body.style.overflow = e, document.body.style.position = o, document.body.style.width = J;
|
|
51
58
|
};
|
|
52
|
-
}, [s,
|
|
53
|
-
const
|
|
54
|
-
(
|
|
55
|
-
), [v, y, i]),
|
|
56
|
-
e == null ? void 0 : e.itemVariant,
|
|
59
|
+
}, [s, w]);
|
|
60
|
+
const N = $(() => !y || !i.trim() ? v : v.filter(
|
|
61
|
+
(e) => e.label.toLowerCase().includes(i.toLowerCase())
|
|
62
|
+
), [v, y, i]), U = (e) => E.includes(e), W = r(
|
|
57
63
|
t == null ? void 0 : t.itemVariant,
|
|
64
|
+
l == null ? void 0 : l.itemVariant,
|
|
58
65
|
void 0,
|
|
59
|
-
|
|
60
|
-
),
|
|
61
|
-
e == null ? void 0 : e.itemColor,
|
|
66
|
+
d.itemVariant
|
|
67
|
+
), S = r(
|
|
62
68
|
t == null ? void 0 : t.itemColor,
|
|
69
|
+
l == null ? void 0 : l.itemColor,
|
|
63
70
|
c.defaultColor,
|
|
64
|
-
|
|
65
|
-
),
|
|
66
|
-
e == null ? void 0 : e.activeItemVariant,
|
|
71
|
+
d.itemColor
|
|
72
|
+
), q = r(
|
|
67
73
|
t == null ? void 0 : t.activeItemVariant,
|
|
74
|
+
l == null ? void 0 : l.activeItemVariant,
|
|
68
75
|
c.defaultVariant,
|
|
69
|
-
|
|
70
|
-
),
|
|
71
|
-
e == null ? void 0 : e.activeItemColor,
|
|
76
|
+
d.activeItemVariant
|
|
77
|
+
), H = r(
|
|
72
78
|
t == null ? void 0 : t.activeItemColor,
|
|
79
|
+
l == null ? void 0 : l.activeItemColor,
|
|
73
80
|
c.defaultColor,
|
|
74
|
-
|
|
75
|
-
),
|
|
76
|
-
e == null ? void 0 : e.radius,
|
|
81
|
+
d.activeItemColor
|
|
82
|
+
), f = C(
|
|
77
83
|
t == null ? void 0 : t.radius,
|
|
84
|
+
l == null ? void 0 : l.radius,
|
|
78
85
|
c.defaultRadius,
|
|
79
|
-
|
|
80
|
-
),
|
|
81
|
-
e == null ? void 0 : e.size,
|
|
86
|
+
d.radius
|
|
87
|
+
), k = r(
|
|
82
88
|
t == null ? void 0 : t.size,
|
|
89
|
+
l == null ? void 0 : l.size,
|
|
83
90
|
void 0,
|
|
84
|
-
|
|
85
|
-
)
|
|
91
|
+
d.size
|
|
92
|
+
);
|
|
86
93
|
if (!s) return null;
|
|
87
|
-
const
|
|
88
|
-
|
|
94
|
+
const z = /* @__PURE__ */ a(
|
|
95
|
+
X,
|
|
89
96
|
{
|
|
90
|
-
context:
|
|
97
|
+
context: A,
|
|
91
98
|
modal: !1,
|
|
92
|
-
initialFocus:
|
|
93
|
-
returnFocus:
|
|
94
|
-
children: /* @__PURE__ */
|
|
99
|
+
initialFocus: R,
|
|
100
|
+
returnFocus: _,
|
|
101
|
+
children: /* @__PURE__ */ V(
|
|
95
102
|
"div",
|
|
96
103
|
{
|
|
97
|
-
ref:
|
|
98
|
-
style: { ...
|
|
99
|
-
className:
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
);
|
|
146
|
-
}),
|
|
147
|
-
h && /* @__PURE__ */ r("div", { className: "border-t border-border pt-1 mt-1", children: h })
|
|
148
|
-
]
|
|
149
|
-
}
|
|
150
|
-
)
|
|
104
|
+
ref: M,
|
|
105
|
+
style: { ...F },
|
|
106
|
+
className: tt(
|
|
107
|
+
"z-100 w-full outline-none max-h-60 shadow-xl bg-background border border-border p-1 flex flex-col gap-0.5 overflow-y-auto scrollable-hidden",
|
|
108
|
+
"animate-in fade-in-0 zoom-in-95 slide-in-from-top-1 duration-150 ease-out",
|
|
109
|
+
t == null ? void 0 : t.className
|
|
110
|
+
),
|
|
111
|
+
...L(),
|
|
112
|
+
children: [
|
|
113
|
+
y && /* @__PURE__ */ a("div", { className: "w-full p-1 mb-1 sticky top-0 z-10 border-b border-border", children: /* @__PURE__ */ a(
|
|
114
|
+
P,
|
|
115
|
+
{
|
|
116
|
+
name: j,
|
|
117
|
+
type: "text",
|
|
118
|
+
variant: "bordered",
|
|
119
|
+
radius: f,
|
|
120
|
+
color: S,
|
|
121
|
+
size: k,
|
|
122
|
+
value: i,
|
|
123
|
+
onChange: (e) => G(e.target.value),
|
|
124
|
+
startContent: /* @__PURE__ */ a(m, { className: "w-3.5 h-3.5 text-foreground/70" }),
|
|
125
|
+
placeholder: T,
|
|
126
|
+
autoFocus: !0,
|
|
127
|
+
className: "w-full pl-8 h-8 text-xs bg-secondary/30 border-none focus-visible:ring-0"
|
|
128
|
+
}
|
|
129
|
+
) }),
|
|
130
|
+
N.length === 0 ? /* @__PURE__ */ a("div", { className: "px-3 py-4 text-xs text-foreground/70 text-center", children: "No options found" }) : N.map((e) => {
|
|
131
|
+
const o = U(e.value);
|
|
132
|
+
return x ? x(e, o) : /* @__PURE__ */ V(
|
|
133
|
+
g,
|
|
134
|
+
{
|
|
135
|
+
variant: o ? q : W,
|
|
136
|
+
color: o ? H : S,
|
|
137
|
+
radius: f,
|
|
138
|
+
size: k,
|
|
139
|
+
isDisabled: e.disabled,
|
|
140
|
+
onClick: () => Q(e),
|
|
141
|
+
className: "w-full justify-between font-normal text-left transition-colors truncate",
|
|
142
|
+
children: [
|
|
143
|
+
/* @__PURE__ */ a("span", { children: e.label }),
|
|
144
|
+
o && /* @__PURE__ */ a(u, { className: "w-3.5 h-3.5 shrink-0 ml-2" })
|
|
145
|
+
]
|
|
146
|
+
},
|
|
147
|
+
String(e.value)
|
|
148
|
+
);
|
|
149
|
+
}),
|
|
150
|
+
h && /* @__PURE__ */ a("div", { className: "border-t border-border pt-1 mt-1", children: h })
|
|
151
|
+
]
|
|
151
152
|
}
|
|
152
153
|
)
|
|
153
154
|
}
|
|
154
155
|
);
|
|
155
|
-
return
|
|
156
|
+
return O && I ? n(z, I) : z;
|
|
156
157
|
};
|
|
157
|
-
|
|
158
|
+
lt.displayName = "SelectMenu";
|
|
158
159
|
export {
|
|
159
|
-
|
|
160
|
+
lt as SelectMenu
|
|
160
161
|
};
|
|
@@ -29,7 +29,7 @@ export interface SelectMenuOption {
|
|
|
29
29
|
* Theme configuration options for the SelectMenu component.
|
|
30
30
|
* Controls the visual appearance of the dropdown menu and its items.
|
|
31
31
|
*/
|
|
32
|
-
export interface
|
|
32
|
+
export interface MenuConfig {
|
|
33
33
|
/**
|
|
34
34
|
* Corner rounding of the dropdown menu.
|
|
35
35
|
* Controls the border-radius of the menu container.
|
|
@@ -80,11 +80,34 @@ export interface SelectMenuConfig {
|
|
|
80
80
|
* @default false
|
|
81
81
|
*/
|
|
82
82
|
lockScroll?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Whether to render the menu in a React portal.
|
|
85
|
+
* When true, the menu is rendered at the document body level.
|
|
86
|
+
* Defaults to true. This is typically controlled by the parent
|
|
87
|
+
* component (Select, MultiSelect, Autocomplete) via their own
|
|
88
|
+
* config or props.
|
|
89
|
+
*/
|
|
90
|
+
portal?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Custom portal target element for the menu.
|
|
93
|
+
* When portal is enabled, the menu is rendered into this element.
|
|
94
|
+
* Defaults to document.body.
|
|
95
|
+
*/
|
|
96
|
+
portalTarget?: HTMLElement | null;
|
|
83
97
|
}
|
|
84
98
|
/**
|
|
85
99
|
* Hard fallback values used when no config tier provides a value.
|
|
86
100
|
* These values are used when instance props, component config,
|
|
87
101
|
* and global defaults are all undefined.
|
|
88
102
|
*/
|
|
89
|
-
export declare const FALLBACK_SELECT_MENU_CONFIG:
|
|
103
|
+
export declare const FALLBACK_SELECT_MENU_CONFIG: {
|
|
104
|
+
radius: Radius;
|
|
105
|
+
size: Size;
|
|
106
|
+
itemVariant: Variant;
|
|
107
|
+
itemColor: Color;
|
|
108
|
+
activeItemVariant: Variant;
|
|
109
|
+
activeItemColor: Color;
|
|
110
|
+
lockScroll: boolean;
|
|
111
|
+
portal: boolean;
|
|
112
|
+
};
|
|
90
113
|
//# sourceMappingURL=select-menu-config.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select-menu-config.d.ts","sourceRoot":"","sources":["../../../src/components/select-menu/select-menu-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,
|
|
1
|
+
{"version":3,"file":"select-menu-config.d.ts","sourceRoot":"","sources":["../../../src/components/select-menu/select-menu-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEjE;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,KAAK,EAAE,MAAM,GAAG,MAAM,CAAC;IAEvB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;OAGG;IACH,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB;;;;;OAKG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,IAAI,CAAC,EAAE,IAAI,CAAC;IAEZ;;;;;OAKG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,KAAK,CAAC;IAElB;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAE5B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,KAAK,CAAC;IAExB;;;;;;OAMG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC;AAED;;;;GAIG;AACH,eAAO,MAAM,2BAA2B;YACtB,MAAM;UACR,IAAI;iBACM,OAAO;eACP,KAAK;uBACC,OAAO;qBACP,KAAK;;;CAGpC,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
const
|
|
2
|
+
const t = {
|
|
3
3
|
radius: "md",
|
|
4
4
|
size: "md",
|
|
5
5
|
itemVariant: "ghost",
|
|
6
6
|
itemColor: "primary",
|
|
7
7
|
activeItemVariant: "faded",
|
|
8
8
|
activeItemColor: "primary",
|
|
9
|
-
lockScroll: !1
|
|
9
|
+
lockScroll: !1,
|
|
10
|
+
portal: !0
|
|
10
11
|
};
|
|
11
12
|
export {
|
|
12
|
-
|
|
13
|
+
t as FALLBACK_SELECT_MENU_CONFIG
|
|
13
14
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ChangeEvent, InputHTMLAttributes } from 'react';
|
|
2
2
|
import { SwitchConfig } from './switch-config';
|
|
3
|
-
type BaseSwitchProps = SwitchConfig & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange" | "children" | "color">;
|
|
3
|
+
type BaseSwitchProps = Omit<SwitchConfig, "status"> & Omit<InputHTMLAttributes<HTMLInputElement>, "size" | "onChange" | "children" | "color">;
|
|
4
4
|
/**
|
|
5
5
|
* Configuration options for the Switch component.
|
|
6
6
|
*/
|
|
@@ -15,11 +15,6 @@ export interface SwitchProps extends BaseSwitchProps {
|
|
|
15
15
|
* Provides additional context for the switch.
|
|
16
16
|
*/
|
|
17
17
|
description?: string;
|
|
18
|
-
/**
|
|
19
|
-
* Validation message shown below the switch.
|
|
20
|
-
* Color is determined by the status prop.
|
|
21
|
-
*/
|
|
22
|
-
message?: string;
|
|
23
18
|
/**
|
|
24
19
|
* Whether the field is required.
|
|
25
20
|
* Adds a required indicator to the label.
|
|
@@ -51,23 +46,20 @@ export interface SwitchProps extends BaseSwitchProps {
|
|
|
51
46
|
onChange?: (checked: boolean, event: ChangeEvent<HTMLInputElement>) => void;
|
|
52
47
|
}
|
|
53
48
|
/**
|
|
54
|
-
* A toggle switch with label
|
|
49
|
+
* A toggle switch with label and description support.
|
|
55
50
|
*
|
|
56
51
|
* Switch renders a toggle input that can be checked or unchecked. It
|
|
57
|
-
* supports controlled and uncontrolled usage,
|
|
58
|
-
*
|
|
59
|
-
*
|
|
60
|
-
* handling.
|
|
52
|
+
* supports controlled and uncontrolled usage, and the standard AsheeUI
|
|
53
|
+
* cascade for visual tokens. The component integrates with FieldShell for
|
|
54
|
+
* label and description handling.
|
|
61
55
|
*
|
|
62
56
|
* The component automatically handles accessibility attributes including
|
|
63
|
-
* role="switch", aria-checked,
|
|
64
|
-
*
|
|
65
|
-
* input element.
|
|
57
|
+
* role="switch", aria-checked, and aria-busy for loading states. It also
|
|
58
|
+
* supports proper focus management through the native input element.
|
|
66
59
|
*
|
|
67
60
|
* @param props - Switch configuration options.
|
|
68
61
|
* @param props.label - Label text for the switch.
|
|
69
62
|
* @param props.description - Description text.
|
|
70
|
-
* @param props.message - Validation message.
|
|
71
63
|
* @param props.required - Whether the field is required. Defaults to false.
|
|
72
64
|
* @param props.isLoading - Loading state. Defaults to false.
|
|
73
65
|
* @param props.checked - Controlled checked state.
|
|
@@ -76,7 +68,6 @@ export interface SwitchProps extends BaseSwitchProps {
|
|
|
76
68
|
* @param props.size - Size scale. Defaults to "md".
|
|
77
69
|
* @param props.color - Theme accent color. Defaults to "primary".
|
|
78
70
|
* @param props.radius - Corner rounding. Defaults to "full".
|
|
79
|
-
* @param props.status - Validation status. Defaults to "default".
|
|
80
71
|
* @param props.labelAlign - Alignment of the label. Defaults to "left".
|
|
81
72
|
* @param props.disabled - Whether the switch is disabled.
|
|
82
73
|
* @param props.className - Extra CSS classes for the switch.
|
|
@@ -91,29 +82,14 @@ export interface SwitchProps extends BaseSwitchProps {
|
|
|
91
82
|
* const [checked, setChecked] = useState(false);
|
|
92
83
|
*
|
|
93
84
|
* return (
|
|
94
|
-
* <Switch
|
|
95
|
-
* label="Enable notifications"
|
|
96
|
-
* description="Receive email notifications for updates"
|
|
97
|
-
* checked={checked}
|
|
98
|
-
* onChange={(checked) => setChecked(checked)}
|
|
85
|
+
* <Switch * checked="{checked}" description="Receive email notifications for updates" label="Enable notifications" onChange="{(checked)"> setChecked(checked)}
|
|
99
86
|
* />
|
|
100
87
|
* );
|
|
101
88
|
* }
|
|
102
89
|
* ```
|
|
103
90
|
*
|
|
104
|
-
* @example
|
|
105
|
-
* ```tsx
|
|
106
|
-
* // With validation
|
|
107
|
-
* <Switch
|
|
108
|
-
* label="Terms accepted"
|
|
109
|
-
* status="error"
|
|
110
|
-
* message="You must accept the terms to continue"
|
|
111
|
-
* required
|
|
112
|
-
* />
|
|
113
|
-
* ```
|
|
114
|
-
*
|
|
115
91
|
* @see SwitchConfig - The configuration type for component defaults.
|
|
116
|
-
* @see FieldShell - The wrapper component for label and
|
|
92
|
+
* @see FieldShell - The wrapper component for label and layout.
|
|
117
93
|
* @see useAsheeConfig - Hook for accessing the global configuration.
|
|
118
94
|
*/
|
|
119
95
|
export declare const Switch: import('react').ForwardRefExoticComponent<SwitchProps & import('react').RefAttributes<HTMLInputElement>>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/switch/Switch.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,mBAAmB,EAIzB,MAAM,OAAO,CAAC;AAWf,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;
|
|
1
|
+
{"version":3,"file":"Switch.d.ts","sourceRoot":"","sources":["../../../src/components/switch/Switch.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,mBAAmB,EAIzB,MAAM,OAAO,CAAC;AAWf,OAAO,EAA0B,KAAK,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAS5E,KAAK,eAAe,GAAG,IAAI,CAAC,YAAY,EAAE,QAAQ,CAAC,GACjD,IAAI,CACF,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,MAAM,GAAG,UAAU,GAAG,UAAU,GAAG,OAAO,CAC3C,CAAC;AAEJ;;GAEG;AACH,MAAM,WAAW,WAAY,SAAQ,eAAe;IAClD;;;OAGG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;OAGG;IACH,cAAc,CAAC,EAAE,OAAO,CAAC;IAEzB;;;OAGG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC7E;AAID;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AACH,eAAO,MAAM,MAAM,0GAqKlB,CAAC"}
|