asheeui 0.6.7 → 0.6.9
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 +90 -106
- package/dist/components/autocomplete/autocomplete-config.d.ts +2 -20
- package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
- package/dist/components/autocomplete/autocomplete-config.js +9 -13
- 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 +21 -1
- package/dist/components/date-picker/date-picker-config.d.ts.map +1 -1
- package/dist/components/date-picker/date-picker-config.js +10 -14
- 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/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +59 -65
- 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 -188
- package/dist/components/multi-select/multi-select-config.d.ts +2 -20
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/multi-select/multi-select-config.js +10 -14
- 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 +149 -161
- package/dist/components/select/select-config.d.ts +3 -29
- package/dist/components/select/select-config.d.ts.map +1 -1
- package/dist/components/select/select-config.js +6 -14
- package/dist/components/select/select-styles.js +1 -6
- package/dist/components/select-menu/SelectMenu.d.ts +48 -42
- package/dist/components/select-menu/SelectMenu.d.ts.map +1 -1
- package/dist/components/select-menu/SelectMenu.js +137 -123
- package/dist/components/select-menu/select-menu-config.d.ts +33 -2
- package/dist/components/select-menu/select-menu-config.d.ts.map +1 -1
- package/dist/components/select-menu/select-menu-config.js +3 -1
- package/dist/components/sidebar/Sidebar.js +1 -1
- 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-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/tabs/Tabs.js +1 -1
- 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 +188 -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/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.css +24 -2
- package/dist/index.d.ts +1 -0
- package/dist/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,16 +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
4
|
/**
|
|
5
|
-
*
|
|
6
|
-
*
|
|
5
|
+
* Menu props that extend MenuConfig with className.
|
|
6
|
+
* Used for menu configuration overrides.
|
|
7
7
|
*/
|
|
8
|
-
export
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
8
|
+
export type MenuProps = MenuConfig & {
|
|
9
|
+
/**
|
|
10
|
+
* Extra CSS classes for the menu container.
|
|
11
|
+
*/
|
|
12
|
+
className?: string;
|
|
13
|
+
};
|
|
14
14
|
/**
|
|
15
15
|
* Props for the SelectMenu component.
|
|
16
16
|
*/
|
|
@@ -38,7 +38,7 @@ export interface SelectMenuProps {
|
|
|
38
38
|
/**
|
|
39
39
|
* Available options to display in the menu.
|
|
40
40
|
*/
|
|
41
|
-
options:
|
|
41
|
+
options: SelectMenuOption[];
|
|
42
42
|
/**
|
|
43
43
|
* Currently selected values.
|
|
44
44
|
* Used to highlight selected options with a checkmark.
|
|
@@ -48,7 +48,7 @@ export interface SelectMenuProps {
|
|
|
48
48
|
* Callback fired when an option is selected.
|
|
49
49
|
* Receives the selected option object.
|
|
50
50
|
*/
|
|
51
|
-
|
|
51
|
+
onSelectMenuOption: (option: SelectMenuOption) => void;
|
|
52
52
|
/**
|
|
53
53
|
* Whether search input is shown in the menu.
|
|
54
54
|
* @default true
|
|
@@ -76,23 +76,20 @@ export interface SelectMenuProps {
|
|
|
76
76
|
* Content rendered below the options list.
|
|
77
77
|
*/
|
|
78
78
|
belowList?: ReactNode;
|
|
79
|
-
/**
|
|
80
|
-
* Extra CSS classes for the dropdown.
|
|
81
|
-
*/
|
|
82
|
-
dropdownClassName?: string;
|
|
83
79
|
/**
|
|
84
80
|
* Configuration for menu items from the parent component.
|
|
85
81
|
*/
|
|
86
|
-
menuConfig?:
|
|
82
|
+
menuConfig?: MenuConfig;
|
|
87
83
|
/**
|
|
88
84
|
* Props override for menu configuration.
|
|
85
|
+
* Includes className, portal, portalTarget, and visual style options.
|
|
89
86
|
*/
|
|
90
|
-
menuProps?:
|
|
87
|
+
menuProps?: MenuProps;
|
|
91
88
|
/**
|
|
92
89
|
* Custom render function for each option.
|
|
93
90
|
* Receives the option and a boolean indicating if it's selected.
|
|
94
91
|
*/
|
|
95
|
-
renderOption?: (option:
|
|
92
|
+
renderOption?: (option: SelectMenuOption, isSelected: boolean) => ReactNode;
|
|
96
93
|
/**
|
|
97
94
|
* Initial focus target for the FloatingFocusManager.
|
|
98
95
|
*/
|
|
@@ -102,20 +99,6 @@ export interface SelectMenuProps {
|
|
|
102
99
|
* @default false
|
|
103
100
|
*/
|
|
104
101
|
returnFocus?: boolean;
|
|
105
|
-
/**
|
|
106
|
-
* Whether to render the menu in a React portal.
|
|
107
|
-
* When true, the menu is rendered at the document body level.
|
|
108
|
-
* Defaults to true. This is typically controlled by the parent
|
|
109
|
-
* component (Select, MultiSelect, Autocomplete) via their own
|
|
110
|
-
* config or props.
|
|
111
|
-
*/
|
|
112
|
-
portal?: boolean;
|
|
113
|
-
/**
|
|
114
|
-
* Custom portal target element for the menu.
|
|
115
|
-
* When portal is enabled, the menu is rendered into this element.
|
|
116
|
-
* Defaults to document.body.
|
|
117
|
-
*/
|
|
118
|
-
portalTarget?: HTMLElement | null;
|
|
119
102
|
}
|
|
120
103
|
/**
|
|
121
104
|
* A reusable dropdown menu for selecting options from a list.
|
|
@@ -131,8 +114,8 @@ export interface SelectMenuProps {
|
|
|
131
114
|
* By default, the menu uses React's createPortal to render at the document
|
|
132
115
|
* body level. This ensures the menu escapes CSS containment, overflow
|
|
133
116
|
* clipping, and stacking context issues. The portal can be disabled via
|
|
134
|
-
* the `portal` prop if the menu needs to stay within a specific
|
|
135
|
-
* 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.
|
|
136
119
|
*
|
|
137
120
|
* @param props - SelectMenu configuration options.
|
|
138
121
|
* @param props.isOpen - Whether the menu is open.
|
|
@@ -142,16 +125,18 @@ export interface SelectMenuProps {
|
|
|
142
125
|
* @param props.setFloatingRef - Ref setter for the floating element.
|
|
143
126
|
* @param props.options - Available options to display.
|
|
144
127
|
* @param props.selectedValues - Currently selected values.
|
|
145
|
-
* @param props.
|
|
128
|
+
* @param props.onSelectMenuOption - Callback fired when an option is selected.
|
|
146
129
|
* @param props.isSearch - Whether search is enabled. Defaults to true.
|
|
147
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.
|
|
148
134
|
* @param props.belowList - Content below the options list.
|
|
149
|
-
* @param props.dropdownClassName - Extra classes for the dropdown.
|
|
150
135
|
* @param props.menuConfig - Configuration for menu items.
|
|
151
|
-
* @param props.menuProps - Props override for menu configuration.
|
|
136
|
+
* @param props.menuProps - Props override for menu configuration. Includes className, portal, portalTarget, and visual styles.
|
|
152
137
|
* @param props.renderOption - Custom render function for options.
|
|
153
|
-
* @param props.
|
|
154
|
-
* @param props.
|
|
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.
|
|
155
140
|
*
|
|
156
141
|
* @example
|
|
157
142
|
* ```tsx
|
|
@@ -165,15 +150,36 @@ export interface SelectMenuProps {
|
|
|
165
150
|
* setFloatingRef={refs.setFloating}
|
|
166
151
|
* options={options}
|
|
167
152
|
* selectedValues={selectedValues}
|
|
168
|
-
*
|
|
153
|
+
* onSelectMenuOption={handleSelect}
|
|
154
|
+
* />
|
|
155
|
+
* ```
|
|
156
|
+
*
|
|
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
|
+
* }}
|
|
169
175
|
* />
|
|
170
176
|
* ```
|
|
171
177
|
*
|
|
172
|
-
* @see
|
|
178
|
+
* @see MenuConfig - The configuration type for menu items.
|
|
173
179
|
* @see Button - The button component used for menu items.
|
|
174
180
|
*/
|
|
175
181
|
export declare const SelectMenu: {
|
|
176
|
-
({ isOpen, context, floatingStyles, getFloatingProps, setFloatingRef, options, selectedValues,
|
|
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;
|
|
177
183
|
displayName: string;
|
|
178
184
|
};
|
|
179
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,
|
|
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,147 +1,161 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as a, jsxs 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
|
|
15
|
-
isOpen:
|
|
16
|
-
context:
|
|
17
|
-
floatingStyles:
|
|
18
|
-
getFloatingProps:
|
|
19
|
-
setFloatingRef:
|
|
20
|
-
options:
|
|
21
|
-
selectedValues:
|
|
22
|
-
|
|
23
|
-
isSearch:
|
|
24
|
-
searchPlaceholder:
|
|
25
|
-
searchInputName:
|
|
26
|
-
searchQuery:
|
|
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
|
+
isOpen: s,
|
|
16
|
+
context: A,
|
|
17
|
+
floatingStyles: F,
|
|
18
|
+
getFloatingProps: L,
|
|
19
|
+
setFloatingRef: M,
|
|
20
|
+
options: v = [],
|
|
21
|
+
selectedValues: E = [],
|
|
22
|
+
onSelectMenuOption: Q,
|
|
23
|
+
isSearch: y = !0,
|
|
24
|
+
searchPlaceholder: T = "Search...",
|
|
25
|
+
searchInputName: j = "select-menu-search",
|
|
26
|
+
searchQuery: K,
|
|
27
27
|
onSearchChange: b,
|
|
28
28
|
belowList: h,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
menuProps: e,
|
|
29
|
+
menuConfig: l,
|
|
30
|
+
menuProps: t = {},
|
|
32
31
|
renderOption: x,
|
|
33
|
-
initialFocus:
|
|
34
|
-
returnFocus:
|
|
35
|
-
portal: R = !0,
|
|
36
|
-
portalTarget: _
|
|
32
|
+
initialFocus: R,
|
|
33
|
+
returnFocus: _
|
|
37
34
|
}) => {
|
|
38
|
-
const
|
|
39
|
-
b ? b(
|
|
40
|
-
},
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
const c = p(), [B, D] = Y(""), i = K ?? B, G = (e) => {
|
|
36
|
+
b ? b(e) : D(e);
|
|
37
|
+
}, w = r(
|
|
38
|
+
t == null ? void 0 : t.lockScroll,
|
|
39
|
+
l == null ? void 0 : l.lockScroll,
|
|
40
|
+
void 0,
|
|
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
|
|
52
|
+
);
|
|
53
|
+
Z(() => {
|
|
54
|
+
if (!s || !w) return;
|
|
55
|
+
const e = document.body.style.overflow, o = document.body.style.position, J = document.body.style.width;
|
|
56
|
+
return document.body.style.overflow = "hidden", document.body.style.position = "fixed", document.body.style.width = "100%", () => {
|
|
57
|
+
document.body.style.overflow = e, document.body.style.position = o, document.body.style.width = J;
|
|
58
|
+
};
|
|
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(
|
|
44
63
|
t == null ? void 0 : t.itemVariant,
|
|
64
|
+
l == null ? void 0 : l.itemVariant,
|
|
45
65
|
void 0,
|
|
46
|
-
|
|
47
|
-
),
|
|
48
|
-
e == null ? void 0 : e.itemColor,
|
|
66
|
+
d.itemVariant
|
|
67
|
+
), S = r(
|
|
49
68
|
t == null ? void 0 : t.itemColor,
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
69
|
+
l == null ? void 0 : l.itemColor,
|
|
70
|
+
c.defaultColor,
|
|
71
|
+
d.itemColor
|
|
72
|
+
), q = r(
|
|
54
73
|
t == null ? void 0 : t.activeItemVariant,
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
74
|
+
l == null ? void 0 : l.activeItemVariant,
|
|
75
|
+
c.defaultVariant,
|
|
76
|
+
d.activeItemVariant
|
|
77
|
+
), H = r(
|
|
59
78
|
t == null ? void 0 : t.activeItemColor,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
79
|
+
l == null ? void 0 : l.activeItemColor,
|
|
80
|
+
c.defaultColor,
|
|
81
|
+
d.activeItemColor
|
|
82
|
+
), f = C(
|
|
64
83
|
t == null ? void 0 : t.radius,
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
84
|
+
l == null ? void 0 : l.radius,
|
|
85
|
+
c.defaultRadius,
|
|
86
|
+
d.radius
|
|
87
|
+
), k = r(
|
|
69
88
|
t == null ? void 0 : t.size,
|
|
89
|
+
l == null ? void 0 : l.size,
|
|
70
90
|
void 0,
|
|
71
|
-
|
|
72
|
-
)
|
|
73
|
-
if (!
|
|
74
|
-
const
|
|
75
|
-
|
|
91
|
+
d.size
|
|
92
|
+
);
|
|
93
|
+
if (!s) return null;
|
|
94
|
+
const z = /* @__PURE__ */ a(
|
|
95
|
+
X,
|
|
76
96
|
{
|
|
77
|
-
context:
|
|
97
|
+
context: A,
|
|
78
98
|
modal: !1,
|
|
79
|
-
initialFocus:
|
|
80
|
-
returnFocus:
|
|
81
|
-
children: /* @__PURE__ */
|
|
99
|
+
initialFocus: R,
|
|
100
|
+
returnFocus: _,
|
|
101
|
+
children: /* @__PURE__ */ V(
|
|
82
102
|
"div",
|
|
83
103
|
{
|
|
84
|
-
ref:
|
|
85
|
-
style: { ...
|
|
86
|
-
className:
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
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
|
-
h && /* @__PURE__ */ a("div", { className: "border-t border-border pt-1 mt-1", children: h })
|
|
135
|
-
]
|
|
136
|
-
}
|
|
137
|
-
)
|
|
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
|
+
]
|
|
138
152
|
}
|
|
139
153
|
)
|
|
140
154
|
}
|
|
141
155
|
);
|
|
142
|
-
return
|
|
156
|
+
return O && I ? n(z, I) : z;
|
|
143
157
|
};
|
|
144
|
-
|
|
158
|
+
lt.displayName = "SelectMenu";
|
|
145
159
|
export {
|
|
146
|
-
|
|
160
|
+
lt as SelectMenu
|
|
147
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.
|
|
@@ -72,11 +72,42 @@ export interface SelectMenuConfig {
|
|
|
72
72
|
* @default "primary"
|
|
73
73
|
*/
|
|
74
74
|
activeItemColor?: Color;
|
|
75
|
+
/**
|
|
76
|
+
* Whether to lock body scroll when the dropdown is open.
|
|
77
|
+
* When true, the page behind the dropdown cannot scroll.
|
|
78
|
+
* This prevents the page from scrolling while interacting with the dropdown.
|
|
79
|
+
*
|
|
80
|
+
* @default false
|
|
81
|
+
*/
|
|
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;
|
|
75
97
|
}
|
|
76
98
|
/**
|
|
77
99
|
* Hard fallback values used when no config tier provides a value.
|
|
78
100
|
* These values are used when instance props, component config,
|
|
79
101
|
* and global defaults are all undefined.
|
|
80
102
|
*/
|
|
81
|
-
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
|
+
};
|
|
82
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,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"}
|