asheeui 0.7.0 → 1.0.0
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.map +1 -1
- package/dist/AsheeUIProvider.js +22 -15
- package/dist/components/accordion/Accordion.d.ts.map +1 -1
- package/dist/components/accordion/Accordion.js +9 -7
- package/dist/components/alert/Alert.d.ts +88 -0
- package/dist/components/alert/Alert.d.ts.map +1 -0
- package/dist/components/alert/Alert.js +61 -0
- package/dist/components/alert/alert-config.d.ts +56 -0
- package/dist/components/alert/alert-config.d.ts.map +1 -0
- package/dist/components/alert/alert-config.js +14 -0
- package/dist/components/alert/alert-styles.d.ts +32 -0
- package/dist/components/alert/alert-styles.d.ts.map +1 -0
- package/dist/components/alert/alert-styles.js +20 -0
- package/dist/components/alert/index.d.ts +3 -0
- package/dist/components/alert/index.d.ts.map +1 -0
- package/dist/components/alert/index.js +3 -0
- package/dist/components/autocomplete/Autocomplete.d.ts +6 -6
- package/dist/components/autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/autocomplete/Autocomplete.js +94 -58
- package/dist/components/autocomplete/autocomplete-config.d.ts +1 -1
- package/dist/components/autocomplete/autocomplete-config.d.ts.map +1 -1
- package/dist/components/avatar/Avatar.d.ts +87 -0
- package/dist/components/avatar/Avatar.d.ts.map +1 -0
- package/dist/components/avatar/Avatar.js +43 -0
- package/dist/components/avatar/avatar-config.d.ts +48 -0
- package/dist/components/avatar/avatar-config.d.ts.map +1 -0
- package/dist/components/avatar/avatar-config.js +14 -0
- package/dist/components/avatar/avatar-styles.d.ts +21 -0
- package/dist/components/avatar/avatar-styles.d.ts.map +1 -0
- package/dist/components/avatar/avatar-styles.js +13 -0
- package/dist/components/avatar/avatar.helpers.d.ts +19 -0
- package/dist/components/avatar/avatar.helpers.d.ts.map +1 -0
- package/dist/components/avatar/avatar.helpers.js +11 -0
- package/dist/components/avatar/index.d.ts +3 -0
- package/dist/components/avatar/index.d.ts.map +1 -0
- package/dist/components/avatar/index.js +4 -0
- package/dist/components/badge/Badge.d.ts +69 -0
- package/dist/components/badge/Badge.d.ts.map +1 -0
- package/dist/components/badge/Badge.js +39 -0
- package/dist/components/badge/badge-config.d.ts +63 -0
- package/dist/components/badge/badge-config.d.ts.map +1 -0
- package/dist/components/badge/badge-config.js +15 -0
- package/dist/components/badge/badge-styles.d.ts +27 -0
- package/dist/components/badge/badge-styles.d.ts.map +1 -0
- package/dist/components/badge/badge-styles.js +25 -0
- package/dist/components/badge/index.d.ts +3 -0
- package/dist/components/badge/index.d.ts.map +1 -0
- package/dist/components/badge/index.js +3 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +106 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/components/breadcrumb/Breadcrumb.js +52 -0
- package/dist/components/breadcrumb/breadcrumb-config.d.ts +41 -0
- package/dist/components/breadcrumb/breadcrumb-config.d.ts.map +1 -0
- package/dist/components/breadcrumb/breadcrumb-config.js +10 -0
- package/dist/components/breadcrumb/breadcrumb-styles.d.ts +28 -0
- package/dist/components/breadcrumb/breadcrumb-styles.d.ts.map +1 -0
- package/dist/components/breadcrumb/breadcrumb-styles.js +17 -0
- package/dist/components/breadcrumb/index.d.ts +3 -0
- package/dist/components/breadcrumb/index.d.ts.map +1 -0
- package/dist/components/breadcrumb/index.js +3 -0
- package/dist/components/button/Button.d.ts.map +1 -1
- package/dist/components/button/Button.js +10 -7
- package/dist/components/{date-picker/DatePicker.d.ts → calendar/Calendar.d.ts} +21 -21
- package/dist/components/calendar/Calendar.d.ts.map +1 -0
- package/dist/components/{date-picker/DatePicker.js → calendar/Calendar.js} +11 -11
- package/dist/components/{date-picker/Calendar.d.ts → calendar/DateGrid.d.ts} +7 -7
- package/dist/components/calendar/DateGrid.d.ts.map +1 -0
- package/dist/components/calendar/DateGrid.js +194 -0
- package/dist/components/calendar/TimeSpinner.d.ts.map +1 -0
- package/dist/components/{date-picker → calendar}/TimeSpinner.js +3 -3
- package/dist/components/{date-picker/date-picker-config.d.ts → calendar/calendar-config.d.ts} +17 -17
- package/dist/components/calendar/calendar-config.d.ts.map +1 -0
- package/dist/components/{date-picker/date-picker-config.js → calendar/calendar-config.js} +3 -3
- package/dist/components/{date-picker/date-picker-styles.d.ts → calendar/calendar-styles.d.ts} +1 -1
- package/dist/components/calendar/calendar-styles.d.ts.map +1 -0
- package/dist/components/{date-picker/date-picker-styles.js → calendar/calendar-styles.js} +1 -1
- package/dist/components/{date-picker/date-picker.helpers.d.ts → calendar/calendar.helpers.d.ts} +9 -9
- package/dist/components/calendar/calendar.helpers.d.ts.map +1 -0
- package/dist/components/{date-picker/date-picker.helpers.js → calendar/calendar.helpers.js} +4 -4
- package/dist/components/calendar/index.d.ts +3 -0
- package/dist/components/calendar/index.d.ts.map +1 -0
- package/dist/components/calendar/index.js +6 -0
- package/dist/components/card/Card.d.ts +6 -6
- package/dist/components/card/Card.d.ts.map +1 -1
- package/dist/components/card/Card.js +8 -8
- package/dist/components/carousel/Carousel.d.ts.map +1 -1
- package/dist/components/carousel/Carousel.js +85 -83
- package/dist/components/carousel/carousel-styles.d.ts +1 -20
- package/dist/components/carousel/carousel-styles.d.ts.map +1 -1
- package/dist/components/chip/Chip.js +5 -5
- package/dist/components/drawer/Drawer.d.ts +8 -4
- package/dist/components/drawer/Drawer.d.ts.map +1 -1
- package/dist/components/drawer/Drawer.js +54 -38
- package/dist/components/{select/Select.d.ts → dropmenu/Dropmenu.d.ts} +21 -21
- package/dist/components/{select/Select.d.ts.map → dropmenu/Dropmenu.d.ts.map} +1 -1
- package/dist/components/dropmenu/Dropmenu.js +102 -0
- package/dist/components/{select/select-config.d.ts → dropmenu/dropmenu-config.d.ts} +8 -8
- package/dist/components/dropmenu/dropmenu-config.d.ts.map +1 -0
- package/dist/components/{select/select-config.js → dropmenu/dropmenu-config.js} +3 -3
- package/dist/components/{select/select-styles.d.ts → dropmenu/dropmenu-styles.d.ts} +1 -1
- package/dist/components/dropmenu/dropmenu-styles.d.ts.map +1 -0
- package/dist/components/{select/select-styles.js → dropmenu/dropmenu-styles.js} +1 -1
- package/dist/components/dropmenu/index.d.ts +3 -0
- package/dist/components/dropmenu/index.d.ts.map +1 -0
- package/dist/components/dropmenu/index.js +3 -0
- package/dist/components/field/FieldShell.d.ts +13 -1
- package/dist/components/field/FieldShell.d.ts.map +1 -1
- package/dist/components/field/FieldShell.js +16 -15
- package/dist/components/form/Form.d.ts +109 -0
- package/dist/components/form/Form.d.ts.map +1 -0
- package/dist/components/form/Form.js +42 -0
- package/dist/components/form/form-config.d.ts +57 -0
- package/dist/components/form/form-config.d.ts.map +1 -0
- package/dist/components/form/form-config.js +12 -0
- package/dist/components/form/form-styles.d.ts +27 -0
- package/dist/components/form/form-styles.d.ts.map +1 -0
- package/dist/components/form/form-styles.js +5 -0
- package/dist/components/form/index.d.ts +3 -0
- package/dist/components/form/index.d.ts.map +1 -0
- package/dist/components/form/index.js +3 -0
- package/dist/components/image/Image.d.ts +4 -5
- package/dist/components/image/Image.d.ts.map +1 -1
- package/dist/components/image/Image.js +5 -5
- package/dist/components/input/Input.js +5 -5
- package/dist/components/link/Link.d.ts +12 -10
- package/dist/components/link/Link.d.ts.map +1 -1
- package/dist/components/link/Link.js +1 -1
- package/dist/components/marquee/Marquee.d.ts.map +1 -1
- package/dist/components/marquee/Marquee.js +36 -33
- package/dist/components/{select-menu/SelectMenu.d.ts → menu/Menu.d.ts} +52 -19
- package/dist/components/menu/Menu.d.ts.map +1 -0
- package/dist/components/menu/Menu.js +161 -0
- package/dist/components/menu/index.d.ts +5 -0
- package/dist/components/menu/index.d.ts.map +1 -0
- package/dist/components/menu/index.js +4 -0
- package/dist/components/{select-menu/select-menu-config.d.ts → menu/menu-config.d.ts} +5 -5
- package/dist/components/menu/menu-config.d.ts.map +1 -0
- package/dist/components/{select-menu/select-menu-config.js → menu/menu-config.js} +2 -2
- package/dist/components/menu/menu-navigation.d.ts +38 -0
- package/dist/components/menu/menu-navigation.d.ts.map +1 -0
- package/dist/components/menu/menu-navigation.js +20 -0
- package/dist/components/{select-menu/use-select-floating.d.ts → menu/use-menu-floating.d.ts} +10 -10
- package/dist/components/menu/use-menu-floating.d.ts.map +1 -0
- package/dist/components/{select-menu/use-select-floating.js → menu/use-menu-floating.js} +2 -2
- package/dist/components/modal/Modal.d.ts +6 -1
- package/dist/components/modal/Modal.d.ts.map +1 -1
- package/dist/components/modal/Modal.js +62 -45
- package/dist/components/multi-select/MultiSelect.d.ts +11 -10
- package/dist/components/multi-select/MultiSelect.d.ts.map +1 -1
- package/dist/components/multi-select/MultiSelect.js +99 -86
- package/dist/components/multi-select/multi-select-config.d.ts +1 -1
- package/dist/components/multi-select/multi-select-config.d.ts.map +1 -1
- package/dist/components/pagination/Pagination.d.ts +91 -0
- package/dist/components/pagination/Pagination.d.ts.map +1 -0
- package/dist/components/pagination/Pagination.js +66 -0
- package/dist/components/pagination/index.d.ts +3 -0
- package/dist/components/pagination/index.d.ts.map +1 -0
- package/dist/components/pagination/index.js +4 -0
- package/dist/components/pagination/pagination-config.d.ts +66 -0
- package/dist/components/pagination/pagination-config.d.ts.map +1 -0
- package/dist/components/pagination/pagination-config.js +19 -0
- package/dist/components/pagination/pagination-styles.d.ts +19 -0
- package/dist/components/pagination/pagination-styles.d.ts.map +1 -0
- package/dist/components/pagination/pagination-styles.js +5 -0
- package/dist/components/pagination/pagination.helpers.d.ts +26 -0
- package/dist/components/pagination/pagination.helpers.d.ts.map +1 -0
- package/dist/components/pagination/pagination.helpers.js +12 -0
- package/dist/components/radio/Radio.d.ts +53 -107
- package/dist/components/radio/Radio.d.ts.map +1 -1
- package/dist/components/radio/Radio.js +50 -36
- package/dist/components/radio/RadioGroup.d.ts +107 -53
- package/dist/components/radio/RadioGroup.d.ts.map +1 -1
- package/dist/components/radio/RadioGroup.js +43 -49
- package/dist/components/radio/index.d.ts +0 -1
- package/dist/components/radio/index.d.ts.map +1 -1
- package/dist/components/resizable-screen/ResizableScreen.d.ts +4 -4
- package/dist/components/scrollbar/index.js +1 -0
- package/dist/components/scrollbar/scrollbar-config.js +13 -0
- package/dist/components/sidebar/Sidebar.d.ts.map +1 -1
- package/dist/components/sidebar/Sidebar.js +92 -90
- package/dist/components/skeleton/Skeleton.d.ts +65 -0
- package/dist/components/skeleton/Skeleton.d.ts.map +1 -0
- package/dist/components/skeleton/Skeleton.js +29 -0
- package/dist/components/skeleton/index.d.ts +3 -0
- package/dist/components/skeleton/index.d.ts.map +1 -0
- package/dist/components/skeleton/index.js +3 -0
- package/dist/components/skeleton/skeleton-config.d.ts +40 -0
- package/dist/components/skeleton/skeleton-config.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton-config.js +13 -0
- package/dist/components/skeleton/skeleton-styles.d.ts +19 -0
- package/dist/components/skeleton/skeleton-styles.d.ts.map +1 -0
- package/dist/components/skeleton/skeleton-styles.js +5 -0
- package/dist/components/switch/Switch.d.ts.map +1 -1
- package/dist/components/switch/Switch.js +7 -5
- package/dist/components/table/Table.js +3 -3
- package/dist/components/tabs/Tabs.js +3 -3
- package/dist/components/textarea/Textarea.d.ts +10 -10
- package/dist/components/textarea/Textarea.js +7 -7
- package/dist/components/textarea/textarea-config.d.ts +2 -2
- package/dist/components/toast/ToastItem.d.ts.map +1 -1
- package/dist/components/toast/ToastItem.js +8 -7
- package/dist/components/tooltip/Tooltip.js +5 -5
- package/dist/components/typography/Typography.d.ts +60 -0
- package/dist/components/typography/Typography.d.ts.map +1 -0
- package/dist/components/typography/Typography.js +28 -0
- package/dist/components/typography/index.d.ts +3 -0
- package/dist/components/typography/index.d.ts.map +1 -0
- package/dist/components/typography/index.js +3 -0
- package/dist/components/typography/typography-config.d.ts +54 -0
- package/dist/components/typography/typography-config.d.ts.map +1 -0
- package/dist/components/typography/typography-config.js +12 -0
- package/dist/components/typography/typography-styles.d.ts +21 -0
- package/dist/components/typography/typography-styles.d.ts.map +1 -0
- package/dist/components/typography/typography-styles.js +19 -0
- package/dist/config/default-config.d.ts.map +1 -1
- package/dist/config/default-config.js +2 -2
- package/dist/config/index.js +1 -0
- package/dist/config/validate-config.d.ts +34 -0
- package/dist/config/validate-config.d.ts.map +1 -0
- package/dist/config/validate-config.js +190 -0
- package/dist/index.d.ts +15 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +61 -47
- package/dist/libs/index.js +3 -0
- package/dist/libs/use-body-scroll-lock.d.ts +21 -0
- package/dist/libs/use-body-scroll-lock.d.ts.map +1 -0
- package/dist/libs/use-body-scroll-lock.js +27 -0
- package/dist/libs/use-dialog-overlay.d.ts +21 -0
- package/dist/libs/use-dialog-overlay.d.ts.map +1 -0
- package/dist/libs/use-dialog-overlay.js +21 -0
- package/dist/libs/use-prefers-reduced-motion.d.ts +23 -0
- package/dist/libs/use-prefers-reduced-motion.d.ts.map +1 -0
- package/dist/libs/use-prefers-reduced-motion.js +19 -0
- package/dist/scripts/AsheeThemeScript.js +43 -8
- package/dist/shared/index.d.ts +1 -0
- package/dist/shared/index.d.ts.map +1 -1
- package/dist/shared/typography.d.ts +81 -0
- package/dist/shared/typography.d.ts.map +1 -0
- package/dist/shared/typography.js +137 -0
- package/dist/utils/stacking.d.ts +2 -2
- package/dist/utils/stacking.d.ts.map +1 -1
- package/package.json +13 -6
- package/dist/components/date-picker/Calendar.d.ts.map +0 -1
- package/dist/components/date-picker/Calendar.js +0 -143
- package/dist/components/date-picker/DatePicker.d.ts.map +0 -1
- package/dist/components/date-picker/TimeSpinner.d.ts.map +0 -1
- package/dist/components/date-picker/date-picker-config.d.ts.map +0 -1
- package/dist/components/date-picker/date-picker-styles.d.ts.map +0 -1
- package/dist/components/date-picker/date-picker.helpers.d.ts.map +0 -1
- package/dist/components/date-picker/index.d.ts +0 -3
- package/dist/components/date-picker/index.d.ts.map +0 -1
- package/dist/components/date-picker/index.js +0 -6
- package/dist/components/select/Select.js +0 -98
- package/dist/components/select/index.d.ts +0 -3
- package/dist/components/select/index.d.ts.map +0 -1
- package/dist/components/select/index.js +0 -3
- package/dist/components/select/select-config.d.ts.map +0 -1
- package/dist/components/select/select-styles.d.ts.map +0 -1
- package/dist/components/select-menu/SelectMenu.d.ts.map +0 -1
- package/dist/components/select-menu/SelectMenu.js +0 -104
- package/dist/components/select-menu/index.d.ts +0 -4
- package/dist/components/select-menu/index.d.ts.map +0 -1
- package/dist/components/select-menu/index.js +0 -3
- package/dist/components/select-menu/select-menu-config.d.ts.map +0 -1
- package/dist/components/select-menu/use-select-floating.d.ts.map +0 -1
- /package/dist/components/{date-picker → calendar}/TimeSpinner.d.ts +0 -0
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { cn as e } from "../../utils/cn.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
4
|
+
import { RADIUS_CLASS as t } from "../../shared/radius.js";
|
|
5
|
+
import { resolveVariantClass as n } from "../../shared/variant.js";
|
|
6
|
+
import { useAsheeConfig as r } from "../../libs/context.js";
|
|
7
7
|
import { resolveCascade as i, resolveClassKey as a, resolveRadiusKey as o } from "../../utils/resolve-token.js";
|
|
8
8
|
import { FieldShell as s } from "../field/FieldShell.js";
|
|
9
9
|
import { FALLBACK_FIELD_CONFIG as c } from "../field/field-config.js";
|
|
@@ -13,13 +13,13 @@ import d, { forwardRef as f, useCallback as p, useId as m, useImperativeHandle a
|
|
|
13
13
|
import { jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
14
14
|
//#region src/components/input/Input.tsx
|
|
15
15
|
var v = f(({ size: f, radius: v, variant: y, color: b, status: x, label: S, labelAlign: C, description: w, message: T, required: E, isLoading: D, id: O, className: k, disabled: A, startContent: j, endContent: M, style: N, onFocus: P, onBlur: F, enableVirtualKeyboard: I = !0, ...L }, R) => {
|
|
16
|
-
let z =
|
|
16
|
+
let z = r(), B = z.components?.input, V = te(null);
|
|
17
17
|
h(R, () => V.current);
|
|
18
18
|
let H = m(), U = O ?? H, W = w ? `${U}-description` : void 0, G = T ? `${U}-message` : void 0, K = [W, G].filter(Boolean).join(" ") || void 0, { handleFocus: q, handleBlur: J } = l(U, V, !!I, typeof I == "object" && I ? I : void 0), Y = p((e) => {
|
|
19
19
|
q(e), P?.(e);
|
|
20
20
|
}, [q, P]), X = p((e) => {
|
|
21
21
|
J(), F?.(e);
|
|
22
|
-
}, [J, F]), Z = i(f, B?.size, void 0, c.size), Q = i(y, B?.variant, z.defaultVariant, c.variant), ne = i(b, B?.color, z.defaultColor, c.color), re = o(typeof v == "string" ? v : void 0, typeof B?.radius == "string" ? B.radius : void 0, z.defaultRadius, c.radius), $ = x ?? c.status, ie = $ === "error" ? "danger" : $ === "success" ? "success" : $ === "warning" ? "warning" : ne, ae = i(C, B?.labelAlign, void 0, c.labelAlign), oe =
|
|
22
|
+
}, [J, F]), Z = i(f, B?.size, void 0, c.size), Q = i(y, B?.variant, z.defaultVariant, c.variant), ne = i(b, B?.color, z.defaultColor, c.color), re = o(typeof v == "string" ? v : void 0, typeof B?.radius == "string" ? B.radius : void 0, z.defaultRadius, c.radius), $ = x ?? c.status, ie = $ === "error" ? "danger" : $ === "success" ? "success" : $ === "warning" ? "warning" : ne, ae = i(C, B?.labelAlign, void 0, c.labelAlign), oe = n(Q, ie), se = $ === "default" ? "" : ee[$], ce = Q === "underlined" ? "rounded-none" : a(re, t, c.radius);
|
|
23
23
|
return /* @__PURE__ */ g(s, {
|
|
24
24
|
id: U,
|
|
25
25
|
label: S,
|
|
@@ -35,15 +35,17 @@ export interface LinkProps extends BaseLinkProps {
|
|
|
35
35
|
*/
|
|
36
36
|
children?: ReactNode;
|
|
37
37
|
/**
|
|
38
|
-
*
|
|
39
|
-
*
|
|
38
|
+
* Component that replaces the native anchor, such as a framework router link.
|
|
39
|
+
*
|
|
40
|
+
* The substitution API is shared with `Image` and `Form`: `component` names
|
|
41
|
+
* the component and `componentProps` carries the props it needs.
|
|
40
42
|
*/
|
|
41
|
-
|
|
43
|
+
component?: ElementType;
|
|
42
44
|
/**
|
|
43
|
-
* Additional props
|
|
44
|
-
* These take precedence over the
|
|
45
|
+
* Additional props for `component` (for example `{ prefetch: true }`).
|
|
46
|
+
* These take precedence over the props the framework passes itself.
|
|
45
47
|
*/
|
|
46
|
-
|
|
48
|
+
componentProps?: Record<string, unknown>;
|
|
47
49
|
}
|
|
48
50
|
/**
|
|
49
51
|
* A navigational link with support for variants, colors, sizes, and
|
|
@@ -72,8 +74,8 @@ export interface LinkProps extends BaseLinkProps {
|
|
|
72
74
|
* @param props.startIcon - Icon rendered before the link text.
|
|
73
75
|
* @param props.endIcon - Icon rendered after the link text.
|
|
74
76
|
* @param props.children - The link text content.
|
|
75
|
-
* @param props.
|
|
76
|
-
* @param props.
|
|
77
|
+
* @param props.component - Component that replaces the native anchor.
|
|
78
|
+
* @param props.componentProps - Additional props for that component.
|
|
77
79
|
* @param props.className - Extra CSS classes for the link.
|
|
78
80
|
* @param props.target - Native target attribute.
|
|
79
81
|
* @param props.rel - Native rel attribute.
|
|
@@ -102,8 +104,8 @@ export interface LinkProps extends BaseLinkProps {
|
|
|
102
104
|
*
|
|
103
105
|
* <Link
|
|
104
106
|
* href="/blog/post-1"
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
+
* component={NextLink}
|
|
108
|
+
* componentProps={{ prefetch: true }}
|
|
107
109
|
* isExternal={false}
|
|
108
110
|
* >
|
|
109
111
|
* Read Post
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/components/link/Link.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAEhB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,OAAO,EAEL,KAAK,UAAU,EAGhB,MAAM,eAAe,CAAC;AASvB,KAAK,aAAa,GAAG,UAAU,GAC7B,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB
|
|
1
|
+
{"version":3,"file":"Link.d.ts","sourceRoot":"","sources":["../../../src/components/link/Link.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,WAAW,EAEhB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,OAAO,EAEL,KAAK,UAAU,EAGhB,MAAM,eAAe,CAAC;AASvB,KAAK,aAAa,GAAG,UAAU,GAC7B,IAAI,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,EAAE,MAAM,CAAC,CAAC;AAExD;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;;OAGG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IAEtB;;;OAGG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IAEpB;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;OAKG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC;IAExB;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+EG;AACH,eAAO,MAAM,IAAI,yGAqLhB,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { LINK_COLOR_CLASS as o, LINK_ICON_SIZE_CLASS as s, LINK_SIZE_CLASS as c,
|
|
|
9
9
|
import { forwardRef as d } from "react";
|
|
10
10
|
import { jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
11
11
|
//#region src/components/link/Link.tsx
|
|
12
|
-
var m = d(({ href: d, variant: m, color: h, size: g, underline: _, isExternal: v, disabled: y = !1, startIcon: b, endIcon: x, children: S, className: C, style: w, target: T, rel: E, onClick: D,
|
|
12
|
+
var m = d(({ href: d, variant: m, color: h, size: g, underline: _, isExternal: v, disabled: y = !1, startIcon: b, endIcon: x, children: S, className: C, style: w, target: T, rel: E, onClick: D, component: O, componentProps: k, ...A }, j) => {
|
|
13
13
|
let M = t(), N = M.components?.link, P = n(g, N?.size, void 0, a.size), F = n(m, N?.variant, void 0, a.variant), I = n(h, N?.color, M.defaultColor, a.color), L = n(_, N?.underline, void 0, a.underline), R = v ?? N?.isExternal ?? a.isExternal, z = F === "muted" ? u.muted : e(r(I, o, a.color), r(F, u, a.variant)), B = r(P, c, a.size), V = r(P, s, a.size), H = r(L, l, a.underline), U = T ?? (R ? "_blank" : void 0), W = E ?? (R || U === "_blank" ? "noopener noreferrer" : void 0), G = (e) => {
|
|
14
14
|
if (y) {
|
|
15
15
|
e.preventDefault();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Marquee.d.ts","sourceRoot":"","sources":["../../../src/components/marquee/Marquee.tsx"],"names":[],"mappings":"AAUA,OAAO,EAA8B,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Marquee.d.ts","sourceRoot":"","sources":["../../../src/components/marquee/Marquee.tsx"],"names":[],"mappings":"AAUA,OAAO,EAA8B,KAAK,SAAS,EAAW,MAAM,OAAO,CAAC;AAK5E,OAAO,EAGL,KAAK,aAAa,EAGnB,MAAM,kBAAkB,CAAC;AAO1B,KAAK,gBAAgB,GAAG,aAAa,GACnC,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC;AAEzD;;GAEG;AACH,MAAM,WAAW,YAAa,SAAQ,gBAAgB;IACpD;;;OAGG;IACH,QAAQ,EAAE,SAAS,EAAE,CAAC;IAEtB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8DG;AACH,eAAO,MAAM,OAAO,yGA4KnB,CAAC"}
|
|
@@ -3,54 +3,57 @@
|
|
|
3
3
|
import { cn as e } from "../../utils/cn.js";
|
|
4
4
|
import { useAsheeConfig as t } from "../../libs/context.js";
|
|
5
5
|
import { resolveCascade as n } from "../../utils/resolve-token.js";
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
6
|
+
import { usePrefersReducedMotion as r } from "../../libs/use-prefers-reduced-motion.js";
|
|
7
|
+
import { FALLBACK_MARQUEE_CONFIG as i } from "./marquee-config.js";
|
|
8
|
+
import { MARQUEE_FADE_END_CLASS as a, MARQUEE_FADE_START_CLASS as o, MARQUEE_SPEED_PRESETS as s } from "./marquee-styles.js";
|
|
9
|
+
import { forwardRef as c, isValidElement as l, useMemo as u } from "react";
|
|
10
|
+
import { Fragment as d, jsx as f, jsxs as p } from "react/jsx-runtime";
|
|
10
11
|
//#region src/components/marquee/Marquee.tsx
|
|
11
|
-
var
|
|
12
|
-
let
|
|
12
|
+
var m = c(({ children: c, axis: m, direction: h, speed: g, gap: _, pauseOnHover: v, fadeEdges: y, className: b, itemClassName: x, ...S }, C) => {
|
|
13
|
+
let w = t().components?.marquee, T = n(m, w?.axis, void 0, i.axis), E = n(h, w?.direction, void 0, i.direction), D = n(g, w?.speed, void 0, i.speed), O = n(_, w?.gap, void 0, i.gap), k = n(v, w?.pauseOnHover, void 0, i.pauseOnHover), A = n(y, w?.fadeEdges, void 0, i.fadeEdges), j = typeof D == "number" ? D : s[D] ?? s.normal, M = T === "y", N = r(), P = u(() => [c, c].map((t, n) => {
|
|
13
14
|
let r = n === 0 ? "primary" : "secondary";
|
|
14
|
-
return /* @__PURE__ */
|
|
15
|
-
className: e("flex shrink-0",
|
|
16
|
-
style: { gap:
|
|
15
|
+
return /* @__PURE__ */ f("div", {
|
|
16
|
+
className: e("flex shrink-0", M ? "flex-col" : "flex-row"),
|
|
17
|
+
style: { gap: O },
|
|
17
18
|
"aria-hidden": n === 1,
|
|
18
19
|
children: t.map((t, n) => {
|
|
19
|
-
let i =
|
|
20
|
-
return /* @__PURE__ */
|
|
21
|
-
className: e("shrink-0",
|
|
20
|
+
let i = l(t) && t.key ? `${r}-${t.key}` : `${r}-item-${n}`;
|
|
21
|
+
return /* @__PURE__ */ f("div", {
|
|
22
|
+
className: e("shrink-0", x),
|
|
22
23
|
children: t
|
|
23
24
|
}, i);
|
|
24
25
|
})
|
|
25
26
|
}, `${r}-set`);
|
|
26
27
|
}), [
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
c,
|
|
29
|
+
M,
|
|
30
|
+
O,
|
|
31
|
+
x
|
|
31
32
|
]);
|
|
32
|
-
return /* @__PURE__ */
|
|
33
|
-
ref:
|
|
34
|
-
className: e("group relative scrollbar-hide overflow-hidden",
|
|
35
|
-
...
|
|
33
|
+
return /* @__PURE__ */ p("div", {
|
|
34
|
+
ref: C,
|
|
35
|
+
className: e("group relative scrollbar-hide overflow-hidden", M ? "h-full" : "w-full", b),
|
|
36
|
+
...S,
|
|
36
37
|
children: [
|
|
37
|
-
/* @__PURE__ */
|
|
38
|
-
/* @__PURE__ */
|
|
39
|
-
className: e("flex",
|
|
38
|
+
/* @__PURE__ */ f("style", { children: "\n @keyframes marquee-x {\n from { transform: translateX(0%); }\n to { transform: translateX(-50%); }\n }\n @keyframes marquee-y {\n from { transform: translateY(0%); }\n to { transform: translateY(-50%); }\n }\n " }),
|
|
39
|
+
/* @__PURE__ */ f("div", {
|
|
40
|
+
className: e("flex", M ? "flex-col" : "flex-row w-max", k && "group-hover:[animation-play-state:paused]"),
|
|
40
41
|
style: {
|
|
41
|
-
gap:
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
42
|
+
gap: O,
|
|
43
|
+
...N ? { animation: "none" } : {
|
|
44
|
+
animationName: M ? "marquee-y" : "marquee-x",
|
|
45
|
+
animationDuration: `${j}s`,
|
|
46
|
+
animationTimingFunction: "linear",
|
|
47
|
+
animationIterationCount: "infinite",
|
|
48
|
+
animationDirection: E === "reverse" ? "reverse" : "normal"
|
|
49
|
+
}
|
|
47
50
|
},
|
|
48
|
-
children:
|
|
51
|
+
children: P
|
|
49
52
|
}),
|
|
50
|
-
|
|
53
|
+
A && /* @__PURE__ */ p(d, { children: [/* @__PURE__ */ f("div", { className: e("absolute z-10 pointer-events-none", o[T]) }), /* @__PURE__ */ f("div", { className: e("absolute z-10 pointer-events-none", a[T]) })] })
|
|
51
54
|
]
|
|
52
55
|
});
|
|
53
56
|
});
|
|
54
|
-
|
|
57
|
+
m.displayName = "Marquee";
|
|
55
58
|
//#endregion
|
|
56
|
-
export {
|
|
59
|
+
export { m as Marquee };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { FloatingContext } from '@floating-ui/react';
|
|
2
2
|
import { ReactNode } from 'react';
|
|
3
|
-
import { MenuConfig,
|
|
3
|
+
import { MenuConfig, MenuOption } from './menu-config';
|
|
4
4
|
/**
|
|
5
5
|
* Menu props that extend MenuConfig with className.
|
|
6
6
|
* Used for menu configuration overrides.
|
|
@@ -12,9 +12,9 @@ export type MenuProps = MenuConfig & {
|
|
|
12
12
|
className?: string;
|
|
13
13
|
};
|
|
14
14
|
/**
|
|
15
|
-
* Props for the
|
|
15
|
+
* Props for the Menu component.
|
|
16
16
|
*/
|
|
17
|
-
export interface
|
|
17
|
+
export interface MenuComponentProps {
|
|
18
18
|
/**
|
|
19
19
|
* Whether the menu is open.
|
|
20
20
|
*/
|
|
@@ -49,7 +49,7 @@ export interface SelectMenuProps {
|
|
|
49
49
|
/**
|
|
50
50
|
* Available options to display in the menu.
|
|
51
51
|
*/
|
|
52
|
-
options:
|
|
52
|
+
options: MenuOption[];
|
|
53
53
|
/**
|
|
54
54
|
* Currently selected values.
|
|
55
55
|
* Used to highlight selected options with a checkmark.
|
|
@@ -59,7 +59,7 @@ export interface SelectMenuProps {
|
|
|
59
59
|
* Callback fired when an option is selected.
|
|
60
60
|
* Receives the selected option object.
|
|
61
61
|
*/
|
|
62
|
-
|
|
62
|
+
onOptionSelect: (option: MenuOption) => void;
|
|
63
63
|
/**
|
|
64
64
|
* Whether search input is shown in the menu.
|
|
65
65
|
* @default true
|
|
@@ -72,7 +72,7 @@ export interface SelectMenuProps {
|
|
|
72
72
|
searchPlaceholder?: string;
|
|
73
73
|
/**
|
|
74
74
|
* Name attribute for the search input.
|
|
75
|
-
* @default "
|
|
75
|
+
* @default "menu-search"
|
|
76
76
|
*/
|
|
77
77
|
searchInputName?: string;
|
|
78
78
|
/**
|
|
@@ -100,7 +100,7 @@ export interface SelectMenuProps {
|
|
|
100
100
|
* Custom render function for each option.
|
|
101
101
|
* Receives the option and a boolean indicating if it's selected.
|
|
102
102
|
*/
|
|
103
|
-
renderOption?: (option:
|
|
103
|
+
renderOption?: (option: MenuOption, isSelected: boolean) => ReactNode;
|
|
104
104
|
/**
|
|
105
105
|
* Initial focus target for the FloatingFocusManager.
|
|
106
106
|
*/
|
|
@@ -110,13 +110,43 @@ export interface SelectMenuProps {
|
|
|
110
110
|
* @default false
|
|
111
111
|
*/
|
|
112
112
|
returnFocus?: boolean;
|
|
113
|
+
/**
|
|
114
|
+
* Index of the option that keyboard navigation treats as current.
|
|
115
|
+
* When omitted, the menu tracks the current option itself.
|
|
116
|
+
*/
|
|
117
|
+
activeIndex?: number | null;
|
|
118
|
+
/**
|
|
119
|
+
* Called when the current option changes through keyboard navigation.
|
|
120
|
+
* A consumer that keeps focus in its own trigger uses this to mirror the
|
|
121
|
+
* current option in `aria-activedescendant`.
|
|
122
|
+
*/
|
|
123
|
+
onActiveIndexChange?: (index: number | null) => void;
|
|
124
|
+
/**
|
|
125
|
+
* Whether the listbox accepts more than one selection.
|
|
126
|
+
* Exposed as `aria-multiselectable` on the option list.
|
|
127
|
+
*
|
|
128
|
+
* @default false
|
|
129
|
+
*/
|
|
130
|
+
isMultiSelectable?: boolean;
|
|
113
131
|
}
|
|
132
|
+
/**
|
|
133
|
+
* Identifier of one option inside a menu listbox.
|
|
134
|
+
*
|
|
135
|
+
* The listbox id comes from the floating element, so the identifier a consumer
|
|
136
|
+
* publishes through `aria-activedescendant` and the identifier the option
|
|
137
|
+
* carries are built the same way from the same id.
|
|
138
|
+
*
|
|
139
|
+
* @param listboxId - Id of the option list container.
|
|
140
|
+
* @param index - Position of the option in the rendered list.
|
|
141
|
+
* @returns The option id, or `undefined` when the list has no id yet.
|
|
142
|
+
*/
|
|
143
|
+
export declare function menuOptionId(listboxId: string | undefined, index: number): string | undefined;
|
|
114
144
|
/**
|
|
115
145
|
* A reusable dropdown menu for selecting options from a list.
|
|
116
146
|
*
|
|
117
|
-
*
|
|
147
|
+
* Menu renders a floating dropdown with search, option list, and
|
|
118
148
|
* selection state management. It is designed to be used as the dropdown
|
|
119
|
-
* implementation for
|
|
149
|
+
* implementation for Dropmenu, MultiSelect, and Autocomplete components.
|
|
120
150
|
*
|
|
121
151
|
* The component uses Floating UI for positioning and accessibility, and
|
|
122
152
|
* supports custom option rendering, search filtering, and configurable
|
|
@@ -128,7 +158,7 @@ export interface SelectMenuProps {
|
|
|
128
158
|
* the `menuProps.portal` prop if the menu needs to stay within a specific
|
|
129
159
|
* parent container. This is typically controlled by the parent component.
|
|
130
160
|
*
|
|
131
|
-
* @param props -
|
|
161
|
+
* @param props - Menu configuration options.
|
|
132
162
|
* @param props.isOpen - Whether the menu is open.
|
|
133
163
|
* @param props.context - Floating UI context.
|
|
134
164
|
* @param props.getFloatingProps - Props getter for the floating element.
|
|
@@ -136,10 +166,10 @@ export interface SelectMenuProps {
|
|
|
136
166
|
* @param props.isPositioned - Whether the floating element has been positioned by Floating UI. Defaults to true.
|
|
137
167
|
* @param props.options - Available options to display.
|
|
138
168
|
* @param props.selectedValues - Currently selected values.
|
|
139
|
-
* @param props.
|
|
169
|
+
* @param props.onOptionSelect - Callback fired when an option is selected.
|
|
140
170
|
* @param props.isSearch - Whether search is enabled. Defaults to true.
|
|
141
171
|
* @param props.searchPlaceholder - Search placeholder. Defaults to "Search...".
|
|
142
|
-
* @param props.searchInputName - Name attribute for the search input. Defaults to "
|
|
172
|
+
* @param props.searchInputName - Name attribute for the search input. Defaults to "menu-search".
|
|
143
173
|
* @param props.searchQuery - Controlled search query value.
|
|
144
174
|
* @param props.onSearchChange - Callback fired when the search query changes.
|
|
145
175
|
* @param props.belowList - Content below the options list.
|
|
@@ -148,33 +178,36 @@ export interface SelectMenuProps {
|
|
|
148
178
|
* @param props.renderOption - Custom render function for options.
|
|
149
179
|
* @param props.initialFocus - Initial focus target for the FloatingFocusManager.
|
|
150
180
|
* @param props.returnFocus - Whether to return focus to the trigger after closing. Defaults to false.
|
|
181
|
+
* @param props.activeIndex - Index the menu treats as the current option. Defaults to the menu tracking it itself.
|
|
182
|
+
* @param props.onActiveIndexChange - Called when the current option changes through keyboard navigation.
|
|
183
|
+
* @param props.isMultiSelectable - Whether the option list accepts more than one selection. Defaults to false.
|
|
151
184
|
*
|
|
152
185
|
* @example
|
|
153
186
|
* ```tsx
|
|
154
187
|
* const { refs, context } = useFloating(...);
|
|
155
188
|
*
|
|
156
|
-
* <
|
|
189
|
+
* <Menu
|
|
157
190
|
* isOpen={isOpen}
|
|
158
191
|
* context={context}
|
|
159
192
|
* getFloatingProps={getFloatingProps}
|
|
160
193
|
* setFloatingRef={refs.setFloating}
|
|
161
194
|
* options={options}
|
|
162
195
|
* selectedValues={selectedValues}
|
|
163
|
-
*
|
|
196
|
+
* onOptionSelect={handleSelect}
|
|
164
197
|
* />
|
|
165
198
|
* ```
|
|
166
199
|
*
|
|
167
200
|
* @example
|
|
168
201
|
* ```tsx
|
|
169
202
|
* // With custom menu configuration
|
|
170
|
-
* <
|
|
203
|
+
* <Menu
|
|
171
204
|
* isOpen={isOpen}
|
|
172
205
|
* context={context}
|
|
173
206
|
* getFloatingProps={getFloatingProps}
|
|
174
207
|
* setFloatingRef={refs.setFloating}
|
|
175
208
|
* options={options}
|
|
176
209
|
* selectedValues={selectedValues}
|
|
177
|
-
*
|
|
210
|
+
* onOptionSelect={handleSelect}
|
|
178
211
|
* menuProps={{
|
|
179
212
|
* className: "custom-dropdown",
|
|
180
213
|
* portal: false,
|
|
@@ -187,8 +220,8 @@ export interface SelectMenuProps {
|
|
|
187
220
|
* @see MenuConfig - The configuration type for menu items.
|
|
188
221
|
* @see Button - The button component used for menu items.
|
|
189
222
|
*/
|
|
190
|
-
export declare const
|
|
191
|
-
({ isOpen, floatingStyles, context, getFloatingProps, setFloatingRef, isPositioned, options, selectedValues,
|
|
223
|
+
export declare const Menu: {
|
|
224
|
+
({ isOpen, floatingStyles, context, getFloatingProps, setFloatingRef, isPositioned, options, selectedValues, onOptionSelect, isSearch, searchPlaceholder, searchInputName, searchQuery, onSearchChange, belowList, menuConfig, menuProps, renderOption, initialFocus, returnFocus, activeIndex: activeIndexProp, onActiveIndexChange, isMultiSelectable, }: MenuComponentProps): import("react").JSX.Element | null;
|
|
192
225
|
displayName: string;
|
|
193
226
|
};
|
|
194
|
-
//# sourceMappingURL=
|
|
227
|
+
//# sourceMappingURL=Menu.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Menu.d.ts","sourceRoot":"","sources":["../../../src/components/menu/Menu.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,eAAe,EAGrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAKL,KAAK,SAAS,EAMf,MAAM,OAAO,CAAC;AAUf,OAAO,EAEL,KAAK,UAAU,EACf,KAAK,UAAU,EAChB,MAAM,eAAe,CAAC;AAOvB;;;GAGG;AACH,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG;IACnC;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC;;OAEG;IACH,MAAM,EAAE,OAAO,CAAC;IAEhB;;OAEG;IACH,cAAc,EAAE,KAAK,CAAC,aAAa,CAAC;IAEpC;;OAEG;IACH,OAAO,EAAE,eAAe,CAAC;IAEzB;;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;;;;;;;;;OASG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,OAAO,EAAE,UAAU,EAAE,CAAC;IAEtB;;;OAGG;IACH,cAAc,CAAC,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IAErC;;;OAGG;IACH,cAAc,EAAE,CAAC,MAAM,EAAE,UAAU,KAAK,IAAI,CAAC;IAE7C;;;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,UAAU,EAAE,UAAU,EAAE,OAAO,KAAK,SAAS,CAAC;IAEtE;;OAEG;IACH,YAAY,CAAC,EAAE,MAAM,GAAG,KAAK,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC;IAErD;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAE5B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;IAErD;;;;;OAKG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC7B;AAwBD;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAC1B,SAAS,EAAE,MAAM,GAAG,SAAS,EAC7B,KAAK,EAAE,MAAM,GACZ,MAAM,GAAG,SAAS,CAEpB;AA0ED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8EG;AACH,eAAO,MAAM,IAAI;gWAwBd,kBAAkB;;CAyXpB,CAAC"}
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { cn as e } from "../../utils/cn.js";
|
|
4
|
+
import { useAsheeConfig as t } from "../../libs/context.js";
|
|
5
|
+
import { resolveCascade as n, resolveRadiusKey as r } from "../../utils/resolve-token.js";
|
|
6
|
+
import { CheckIcon as i } from "../../icons/CheckIcon.js";
|
|
7
|
+
import { Button as a } from "../button/Button.js";
|
|
8
|
+
import { Input as o } from "../input/Input.js";
|
|
9
|
+
import { SearchIcon as s } from "../../icons/SearchIcon.js";
|
|
10
|
+
import { useBodyScrollLock as c } from "../../libs/use-body-scroll-lock.js";
|
|
11
|
+
import { FALLBACK_MENU_CONFIG as l } from "./menu-config.js";
|
|
12
|
+
import { edgeOptionIndex as u, matchingOptionIndex as d, nextOptionIndex as f } from "./menu-navigation.js";
|
|
13
|
+
import { memo as p, useCallback as m, useEffect as h, useMemo as g, useRef as _, useState as v } from "react";
|
|
14
|
+
import { Fragment as y, jsx as b, jsxs as x } from "react/jsx-runtime";
|
|
15
|
+
import { FloatingFocusManager as S, FloatingPortal as C } from "@floating-ui/react";
|
|
16
|
+
//#region src/components/menu/Menu.tsx
|
|
17
|
+
function w(e, t) {
|
|
18
|
+
return e ? `${e}-option-${t}` : void 0;
|
|
19
|
+
}
|
|
20
|
+
var ee = p(function({ filteredOptions: e, selectedValues: t, onOptionSelect: n, renderOption: r, itemVariant: o, itemColor: s, activeItemVariant: c, activeItemColor: l, radius: u, size: d, optionRefs: f, listboxId: p, onOptionFocus: m }) {
|
|
21
|
+
let h = (e) => t.includes(e);
|
|
22
|
+
return e.length === 0 ? /* @__PURE__ */ b("div", {
|
|
23
|
+
role: "status",
|
|
24
|
+
className: "px-3 py-4 text-xs text-foreground/70 text-center",
|
|
25
|
+
children: "No options found"
|
|
26
|
+
}) : /* @__PURE__ */ b(y, { children: e.map((e, t) => {
|
|
27
|
+
let g = h(e.value);
|
|
28
|
+
return r ? r(e, g) : /* @__PURE__ */ x(a, {
|
|
29
|
+
ref: (e) => {
|
|
30
|
+
f.current[t] = e;
|
|
31
|
+
},
|
|
32
|
+
id: w(p, t),
|
|
33
|
+
role: "option",
|
|
34
|
+
"aria-selected": g,
|
|
35
|
+
"aria-disabled": e.disabled ? !0 : void 0,
|
|
36
|
+
onFocus: () => m(t),
|
|
37
|
+
variant: g ? c : o,
|
|
38
|
+
color: g ? l : s,
|
|
39
|
+
radius: u,
|
|
40
|
+
size: d,
|
|
41
|
+
isDisabled: e.disabled,
|
|
42
|
+
onClick: () => n(e),
|
|
43
|
+
className: "w-full justify-between font-normal text-left transition-colors truncate",
|
|
44
|
+
children: [/* @__PURE__ */ b("span", { children: e.label }), g && /* @__PURE__ */ b(i, { className: "w-3.5 h-3.5 shrink-0 ml-2" })]
|
|
45
|
+
}, String(e.value));
|
|
46
|
+
}) });
|
|
47
|
+
}), T = ({ isOpen: i, floatingStyles: a, context: p, getFloatingProps: y, setFloatingRef: w, isPositioned: T = !0, options: E = [], selectedValues: te = [], onOptionSelect: ne, isSearch: D = !0, searchPlaceholder: re = "Search...", searchInputName: ie = "menu-search", searchQuery: ae, onSearchChange: O, belowList: k, menuConfig: A, menuProps: j = {}, renderOption: oe, initialFocus: se, returnFocus: ce, activeIndex: M, onActiveIndexChange: N, isMultiSelectable: le = !1 }) => {
|
|
48
|
+
let P = t(), [ue, de] = v(""), F = ae ?? ue, fe = (e) => {
|
|
49
|
+
O ? O(e) : de(e);
|
|
50
|
+
}, pe = n(j?.lockScroll, A?.lockScroll, void 0, l.lockScroll), me = n(j?.portal, A?.portal, void 0, l.portal), he = n(j?.portalTarget, A?.portalTarget, void 0, typeof document < "u" ? document.body : null);
|
|
51
|
+
c(i && pe);
|
|
52
|
+
let I = g(() => !D || !F.trim() ? E : E.filter((e) => e.label.toLowerCase().includes(F.toLowerCase())), [
|
|
53
|
+
E,
|
|
54
|
+
D,
|
|
55
|
+
F
|
|
56
|
+
]), L = _([]), R = _(null), z = _(""), B = _(null), [ge, _e] = v(null), ve = m((e) => {
|
|
57
|
+
R.current = e, w(e);
|
|
58
|
+
}, [w]), V = M === void 0 ? ge : M, H = V !== null && V >= 0 && V < I.length ? V : null, U = m((e) => {
|
|
59
|
+
_e(e), N?.(e);
|
|
60
|
+
}, [N]), ye = m((e) => {
|
|
61
|
+
U(e);
|
|
62
|
+
}, [U]), W = m((e) => {
|
|
63
|
+
let t = L.current[e];
|
|
64
|
+
t && R.current?.contains(document.activeElement) && t.focus();
|
|
65
|
+
}, []), G = m((e) => {
|
|
66
|
+
e !== null && (U(e), W(e));
|
|
67
|
+
}, [W, U]), K = m((e) => {
|
|
68
|
+
G(f(I, H, e));
|
|
69
|
+
}, [
|
|
70
|
+
G,
|
|
71
|
+
H,
|
|
72
|
+
I
|
|
73
|
+
]), q = m((e) => {
|
|
74
|
+
G(u(I, e));
|
|
75
|
+
}, [G, I]), be = m((e) => {
|
|
76
|
+
z.current += e, G(d(I, z.current)), B.current && clearTimeout(B.current), B.current = setTimeout(() => {
|
|
77
|
+
z.current = "";
|
|
78
|
+
}, 500);
|
|
79
|
+
}, [G, I]);
|
|
80
|
+
h(() => () => {
|
|
81
|
+
B.current && clearTimeout(B.current);
|
|
82
|
+
}, []);
|
|
83
|
+
let xe = (e) => {
|
|
84
|
+
let t = e.target, n = t.tagName === "INPUT" || t.tagName === "TEXTAREA";
|
|
85
|
+
if (!(n && e.key !== "ArrowDown" && e.key !== "ArrowUp")) switch (e.key) {
|
|
86
|
+
case "ArrowDown":
|
|
87
|
+
e.preventDefault(), K(1);
|
|
88
|
+
return;
|
|
89
|
+
case "ArrowUp":
|
|
90
|
+
e.preventDefault(), K(-1);
|
|
91
|
+
return;
|
|
92
|
+
case "Home":
|
|
93
|
+
e.preventDefault(), q("first");
|
|
94
|
+
return;
|
|
95
|
+
case "End":
|
|
96
|
+
e.preventDefault(), q("last");
|
|
97
|
+
return;
|
|
98
|
+
default: !n && e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey && be(e.key);
|
|
99
|
+
}
|
|
100
|
+
}, J = n(j?.itemVariant, A?.itemVariant, void 0, l.itemVariant), Y = n(j?.itemColor, A?.itemColor, P.defaultColor, l.itemColor), Se = n(j?.activeItemVariant, A?.activeItemVariant, P.defaultVariant, l.activeItemVariant), Ce = n(j?.activeItemColor, A?.activeItemColor, P.defaultColor, l.activeItemColor), X = r(j?.radius, A?.radius, P.defaultRadius, l.radius), Z = n(j?.size, A?.size, void 0, l.size), Q = y({ onKeyDown: xe }), we = typeof Q.id == "string" ? Q.id : void 0;
|
|
101
|
+
if (!i) return null;
|
|
102
|
+
let $ = /* @__PURE__ */ b(S, {
|
|
103
|
+
context: p,
|
|
104
|
+
modal: !1,
|
|
105
|
+
initialFocus: se,
|
|
106
|
+
returnFocus: ce,
|
|
107
|
+
children: /* @__PURE__ */ x("div", {
|
|
108
|
+
ref: ve,
|
|
109
|
+
style: { ...a },
|
|
110
|
+
className: e("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", "transition-none", T ? "animate-in fade-in-0 zoom-in-95 slide-in-from-top-1 duration-150 ease-out" : "invisible opacity-0 pointer-events-none", j?.className),
|
|
111
|
+
role: "listbox",
|
|
112
|
+
"aria-multiselectable": le ? !0 : void 0,
|
|
113
|
+
...Q,
|
|
114
|
+
children: [
|
|
115
|
+
D && /* @__PURE__ */ b("div", {
|
|
116
|
+
className: "w-full p-1 mb-1 sticky top-0 z-10 border-b border-border",
|
|
117
|
+
children: /* @__PURE__ */ b(o, {
|
|
118
|
+
name: ie,
|
|
119
|
+
type: "text",
|
|
120
|
+
variant: "bordered",
|
|
121
|
+
radius: X,
|
|
122
|
+
color: Y,
|
|
123
|
+
size: Z,
|
|
124
|
+
value: F,
|
|
125
|
+
onChange: (e) => fe(e.target.value),
|
|
126
|
+
startContent: /* @__PURE__ */ b(s, { className: "w-3.5 h-3.5 text-foreground/70" }),
|
|
127
|
+
placeholder: re,
|
|
128
|
+
autoFocus: !0,
|
|
129
|
+
className: "w-full pl-8 h-8 text-xs bg-secondary/30 border-none focus-visible:ring-0"
|
|
130
|
+
})
|
|
131
|
+
}),
|
|
132
|
+
/* @__PURE__ */ b(ee, {
|
|
133
|
+
filteredOptions: I,
|
|
134
|
+
selectedValues: te,
|
|
135
|
+
onOptionSelect: ne,
|
|
136
|
+
renderOption: oe,
|
|
137
|
+
itemVariant: J,
|
|
138
|
+
itemColor: Y,
|
|
139
|
+
activeItemVariant: Se,
|
|
140
|
+
activeItemColor: Ce,
|
|
141
|
+
radius: X,
|
|
142
|
+
size: Z,
|
|
143
|
+
optionRefs: L,
|
|
144
|
+
listboxId: we,
|
|
145
|
+
onOptionFocus: ye
|
|
146
|
+
}),
|
|
147
|
+
k && /* @__PURE__ */ b("div", {
|
|
148
|
+
className: "border-t border-border pt-1 mt-1",
|
|
149
|
+
children: k
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
})
|
|
153
|
+
});
|
|
154
|
+
return me ? /* @__PURE__ */ b(C, {
|
|
155
|
+
root: he,
|
|
156
|
+
children: $
|
|
157
|
+
}) : $;
|
|
158
|
+
};
|
|
159
|
+
T.displayName = "Menu";
|
|
160
|
+
//#endregion
|
|
161
|
+
export { T as Menu, w as menuOptionId };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/menu/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC"}
|
|
@@ -3,7 +3,7 @@ import { Color, Radius, Size, Variant } from '../../shared';
|
|
|
3
3
|
* A single option in the select menu.
|
|
4
4
|
* Each option must have a label and a unique value.
|
|
5
5
|
*/
|
|
6
|
-
export interface
|
|
6
|
+
export interface MenuOption {
|
|
7
7
|
/**
|
|
8
8
|
* Text displayed in the input and in the options list.
|
|
9
9
|
*/
|
|
@@ -26,7 +26,7 @@ export interface SelectMenuOption {
|
|
|
26
26
|
[key: string]: unknown;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
-
* Theme configuration options for the
|
|
29
|
+
* Theme configuration options for the Menu component.
|
|
30
30
|
* Controls the visual appearance of the dropdown menu and its items.
|
|
31
31
|
*/
|
|
32
32
|
export interface MenuConfig {
|
|
@@ -86,7 +86,7 @@ export interface MenuConfig {
|
|
|
86
86
|
* Whether to render the menu through Floating UI's `FloatingPortal`.
|
|
87
87
|
* When true, the menu is rendered at the document body level.
|
|
88
88
|
* Defaults to true. This is typically controlled by the parent
|
|
89
|
-
* component (
|
|
89
|
+
* component (Dropmenu, MultiSelect, Autocomplete) via their own
|
|
90
90
|
* config or props.
|
|
91
91
|
*
|
|
92
92
|
* @see FloatingPortal - https://floating-ui.com/docs/FloatingPortal
|
|
@@ -104,7 +104,7 @@ export interface MenuConfig {
|
|
|
104
104
|
* These values are used when instance props, component config,
|
|
105
105
|
* and global defaults are all undefined.
|
|
106
106
|
*/
|
|
107
|
-
export declare const
|
|
107
|
+
export declare const FALLBACK_MENU_CONFIG: {
|
|
108
108
|
radius: Radius;
|
|
109
109
|
size: Size;
|
|
110
110
|
itemVariant: Variant;
|
|
@@ -114,4 +114,4 @@ export declare const FALLBACK_SELECT_MENU_CONFIG: {
|
|
|
114
114
|
lockScroll: boolean;
|
|
115
115
|
portal: boolean;
|
|
116
116
|
};
|
|
117
|
-
//# sourceMappingURL=
|
|
117
|
+
//# sourceMappingURL=menu-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"menu-config.d.ts","sourceRoot":"","sources":["../../../src/components/menu/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,UAAU;IACzB;;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;;;;;;;;OAQG;IACH,UAAU,CAAC,EAAE,OAAO,CAAC;IAErB;;;;;;;;OAQG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB;;;;OAIG;IACH,YAAY,CAAC,EAAE,WAAW,GAAG,IAAI,CAAC;CACnC;AAED;;;;GAIG;AACH,eAAO,MAAM,oBAAoB;YACf,MAAM;UACR,IAAI;iBACM,OAAO;eACP,KAAK;uBACC,OAAO;qBACP,KAAK;;;CAGpC,CAAC"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
//#region src/components/
|
|
2
|
+
//#region src/components/menu/menu-config.ts
|
|
3
3
|
var e = {
|
|
4
4
|
radius: "md",
|
|
5
5
|
size: "md",
|
|
@@ -11,4 +11,4 @@ var e = {
|
|
|
11
11
|
portal: !0
|
|
12
12
|
};
|
|
13
13
|
//#endregion
|
|
14
|
-
export { e as
|
|
14
|
+
export { e as FALLBACK_MENU_CONFIG };
|