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
|
@@ -0,0 +1,102 @@
|
|
|
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 { ChevronDownIcon as n } from "../../icons/ChevronDownIcon.js";
|
|
6
|
+
import { resolveCascade as r, resolveRadiusKey as i } from "../../utils/resolve-token.js";
|
|
7
|
+
import { FieldShell as a } from "../field/FieldShell.js";
|
|
8
|
+
import { Button as ee } from "../button/Button.js";
|
|
9
|
+
import { Menu as te } from "../menu/Menu.js";
|
|
10
|
+
import { useMenuFloating as o } from "../menu/use-menu-floating.js";
|
|
11
|
+
import { FALLBACK_SELECT_CONFIG as s } from "./dropmenu-config.js";
|
|
12
|
+
import { SELECT_STATUS_BORDER_CLASS as c } from "./dropmenu-styles.js";
|
|
13
|
+
import { forwardRef as l, useCallback as u, useId as ne, useMemo as d, useState as f } from "react";
|
|
14
|
+
import { Fragment as p, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
15
|
+
//#region src/components/dropmenu/Dropmenu.tsx
|
|
16
|
+
var g = l(({ options: l = [], value: g, onChange: _, onValueChange: v, size: y, radius: b, variant: x, color: re, status: S, label: ie, labelAlign: ae, description: C, message: w, required: oe, isLoading: T, disabled: E, isSearch: D = !1, searchPlaceholder: O = "Search options...", searchInputName: k = "select-search", initialValue: A, belowList: j, placeholder: M = "Dropmenu...", className: N, id: P, name: F, menu: I, style: L, startContent: R, endContent: z }, B) => {
|
|
17
|
+
let V = t(), H = V.components?.dropmenu, U = ne(), W = P ?? U, [G, K] = f(!1), [q, J] = f(""), se = r(y, H?.size, void 0, s.size), ce = r(x, H?.variant, V.defaultVariant, s.variant), le = r(re, H?.color, V.defaultColor, s.color), ue = i(b, H?.radius, V.defaultRadius, s.radius), Y = S ?? s.status, de = r(ae, H?.labelAlign, void 0, s.labelAlign), fe = Y === "default" ? "" : c[Y], X = d(() => l.find((e) => e.value === g), [l, g]), { refs: Z, context: pe, floatingStyles: me, isPositioned: he, getReferenceProps: ge, getFloatingProps: _e } = o({
|
|
18
|
+
isOpen: G,
|
|
19
|
+
onOpenChange: K,
|
|
20
|
+
disabled: E
|
|
21
|
+
}), ve = u((e) => {
|
|
22
|
+
v?.(e.value), _ && _({ target: {
|
|
23
|
+
value: e.value,
|
|
24
|
+
name: F ?? ""
|
|
25
|
+
} }), K(!1), J("");
|
|
26
|
+
}, [
|
|
27
|
+
F,
|
|
28
|
+
_,
|
|
29
|
+
v
|
|
30
|
+
]), ye = d(() => X?.label ? X.label : A === void 0 ? M : String(A), [
|
|
31
|
+
X,
|
|
32
|
+
A,
|
|
33
|
+
M
|
|
34
|
+
]), be = d(() => g == null ? [] : [g], [g]), Q = C ? `${W}-description` : void 0, $ = w ? `${W}-message` : void 0, xe = [Q, $].filter(Boolean).join(" ") || void 0, Se = ge({ onKeyDown: u((e) => {
|
|
35
|
+
E || (e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), K(!0));
|
|
36
|
+
}, [E]) });
|
|
37
|
+
return /* @__PURE__ */ m(a, {
|
|
38
|
+
id: W,
|
|
39
|
+
label: ie,
|
|
40
|
+
labelAlign: de,
|
|
41
|
+
description: C,
|
|
42
|
+
descriptionId: Q,
|
|
43
|
+
message: w,
|
|
44
|
+
messageId: $,
|
|
45
|
+
status: Y,
|
|
46
|
+
required: oe,
|
|
47
|
+
isLoading: T,
|
|
48
|
+
children: /* @__PURE__ */ h("div", {
|
|
49
|
+
className: "w-full relative inline-block",
|
|
50
|
+
children: [/* @__PURE__ */ m(ee, {
|
|
51
|
+
ref: (e) => {
|
|
52
|
+
Z.setReference(e), typeof B == "function" ? B(e) : B && (B.current = e);
|
|
53
|
+
},
|
|
54
|
+
id: W,
|
|
55
|
+
type: "button",
|
|
56
|
+
variant: ce,
|
|
57
|
+
color: le,
|
|
58
|
+
animate: !1,
|
|
59
|
+
size: se,
|
|
60
|
+
radius: ue,
|
|
61
|
+
isDisabled: E,
|
|
62
|
+
isLoading: T,
|
|
63
|
+
fullWidth: !0,
|
|
64
|
+
"aria-expanded": G,
|
|
65
|
+
"aria-haspopup": "listbox",
|
|
66
|
+
"aria-invalid": Y === "error",
|
|
67
|
+
"aria-describedby": xe,
|
|
68
|
+
className: e("font-normal text-left justify-between", fe, N),
|
|
69
|
+
style: L,
|
|
70
|
+
startContent: R,
|
|
71
|
+
endContent: /* @__PURE__ */ h(p, { children: [z, /* @__PURE__ */ m(n, { className: e("shrink-0 text-foreground/70 transition-transform duration-200", G && "rotate-180") })] }),
|
|
72
|
+
...Se,
|
|
73
|
+
children: /* @__PURE__ */ m("span", {
|
|
74
|
+
className: e("truncate", X || A ? "text-foreground" : "text-foreground/70"),
|
|
75
|
+
children: ye
|
|
76
|
+
})
|
|
77
|
+
}), /* @__PURE__ */ m(te, {
|
|
78
|
+
isOpen: G,
|
|
79
|
+
context: pe,
|
|
80
|
+
floatingStyles: me,
|
|
81
|
+
getFloatingProps: _e,
|
|
82
|
+
setFloatingRef: Z.setFloating,
|
|
83
|
+
isPositioned: he,
|
|
84
|
+
returnFocus: !0,
|
|
85
|
+
options: l,
|
|
86
|
+
selectedValues: be,
|
|
87
|
+
onOptionSelect: ve,
|
|
88
|
+
isSearch: D,
|
|
89
|
+
searchPlaceholder: O,
|
|
90
|
+
searchInputName: k,
|
|
91
|
+
searchQuery: q,
|
|
92
|
+
onSearchChange: J,
|
|
93
|
+
belowList: j,
|
|
94
|
+
menuProps: I,
|
|
95
|
+
menuConfig: H?.menu
|
|
96
|
+
})]
|
|
97
|
+
})
|
|
98
|
+
});
|
|
99
|
+
});
|
|
100
|
+
g.displayName = "Dropmenu";
|
|
101
|
+
//#endregion
|
|
102
|
+
export { g as Dropmenu };
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { InputConfig } from '../input';
|
|
2
|
-
import { MenuConfig } from '../
|
|
2
|
+
import { MenuConfig } from '../menu';
|
|
3
3
|
/**
|
|
4
|
-
* Theme configuration options for the
|
|
4
|
+
* Theme configuration options for the Dropmenu component.
|
|
5
5
|
*
|
|
6
6
|
* Inherits the shared field config (label handling) and adds trigger
|
|
7
|
-
* and dropdown-menu overrides. Set under `components.
|
|
7
|
+
* and dropdown-menu overrides. Set under `components.dropmenu` in
|
|
8
8
|
* the AsheeUI config.
|
|
9
9
|
*/
|
|
10
|
-
export interface
|
|
10
|
+
export interface DropmenuConfig extends InputConfig {
|
|
11
11
|
/**
|
|
12
12
|
* Configuration for the dropdown menu.
|
|
13
13
|
* Controls the menu's visual appearance and behavior.
|
|
@@ -15,9 +15,9 @@ export interface SelectConfig extends InputConfig {
|
|
|
15
15
|
menu?: MenuConfig;
|
|
16
16
|
}
|
|
17
17
|
/**
|
|
18
|
-
* Default config values registered for the
|
|
18
|
+
* Default config values registered for the Dropmenu component.
|
|
19
19
|
*/
|
|
20
|
-
export declare const
|
|
20
|
+
export declare const defaultDropmenuConfig: DropmenuConfig;
|
|
21
21
|
/**
|
|
22
22
|
* Hard fallback values used when no config tier provides a value.
|
|
23
23
|
* These values are used when instance props, component config,
|
|
@@ -26,7 +26,7 @@ export declare const defaultSelectConfig: SelectConfig;
|
|
|
26
26
|
export declare const FALLBACK_SELECT_CONFIG: Required<import('../field').FieldConfig>;
|
|
27
27
|
declare module "../../libs/registry" {
|
|
28
28
|
interface ComponentTypeConfigRegistry {
|
|
29
|
-
|
|
29
|
+
dropmenu: DropmenuConfig;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
//# sourceMappingURL=
|
|
32
|
+
//# sourceMappingURL=dropmenu-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropmenu-config.d.ts","sourceRoot":"","sources":["../../../src/components/dropmenu/dropmenu-config.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,OAAO,EAAsB,KAAK,WAAW,EAAE,MAAM,UAAU,CAAC;AAChE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAE1C;;;;;;GAMG;AACH,MAAM,WAAW,cAAe,SAAQ,WAAW;IACjD;;;OAGG;IACH,IAAI,CAAC,EAAE,UAAU,CAAC;CACnB;AAED;;GAEG;AACH,eAAO,MAAM,qBAAqB,EAAE,cAAmC,CAAC;AAExE;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,0CAAwB,CAAC;AAE5D,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,QAAQ,EAAE,cAAc,CAAC;KAC1B;CACF"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
import { registerComponentDefaults as e } from "../../libs/registry.js";
|
|
3
3
|
import { FALLBACK_FIELD_CONFIG as t } from "../field/field-config.js";
|
|
4
4
|
import { defaultInputConfig as n } from "../input/input-config.js";
|
|
5
|
-
//#region src/components/
|
|
5
|
+
//#region src/components/dropmenu/dropmenu-config.ts
|
|
6
6
|
var r = n, i = t;
|
|
7
|
-
e("
|
|
7
|
+
e("dropmenu", r);
|
|
8
8
|
//#endregion
|
|
9
|
-
export { i as FALLBACK_SELECT_CONFIG, r as
|
|
9
|
+
export { i as FALLBACK_SELECT_CONFIG, r as defaultDropmenuConfig };
|
|
@@ -11,4 +11,4 @@ export declare const SELECT_SIZE_CLASS: Record<FieldSizeKey, string>;
|
|
|
11
11
|
* focus ring colors. Re-exports FIELD_STATUS_BORDER_CLASS.
|
|
12
12
|
*/
|
|
13
13
|
export declare const SELECT_STATUS_BORDER_CLASS: Record<FieldStatus, string>;
|
|
14
|
-
//# sourceMappingURL=
|
|
14
|
+
//# sourceMappingURL=dropmenu-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dropmenu-styles.d.ts","sourceRoot":"","sources":["../../../src/components/dropmenu/dropmenu-styles.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAGvE;;;;GAIG;AACH,eAAO,MAAM,iBAAiB,EAAE,MAAM,CAAC,YAAY,EAAE,MAAM,CAI1D,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,0BAA0B,EAAE,MAAM,CAAC,WAAW,EAAE,MAAM,CACxC,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { FIELD_STATUS_BORDER_CLASS as e } from "../field/field-styles.js";
|
|
3
|
-
//#region src/components/
|
|
3
|
+
//#region src/components/dropmenu/dropmenu-styles.ts
|
|
4
4
|
var t = e;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { t as SELECT_STATUS_BORDER_CLASS };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dropmenu/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,mBAAmB,CAAC"}
|
|
@@ -10,6 +10,18 @@ export interface FieldShellProps {
|
|
|
10
10
|
* Used to associate the label with the input via htmlFor.
|
|
11
11
|
*/
|
|
12
12
|
id: string;
|
|
13
|
+
/**
|
|
14
|
+
* ID for the label element.
|
|
15
|
+
* A container that groups several controls (a radio group, for example)
|
|
16
|
+
* references the visible label with `aria-labelledby` instead of `htmlFor`.
|
|
17
|
+
*/
|
|
18
|
+
labelId?: string;
|
|
19
|
+
/**
|
|
20
|
+
* ID of the control the label describes.
|
|
21
|
+
* Defaults to `id`. Pass `null` when the label describes a group of controls
|
|
22
|
+
* rather than one control, so no reference is emitted.
|
|
23
|
+
*/
|
|
24
|
+
htmlFor?: string | null;
|
|
13
25
|
/**
|
|
14
26
|
* The label text for the field.
|
|
15
27
|
*/
|
|
@@ -99,5 +111,5 @@ export interface FieldShellProps {
|
|
|
99
111
|
*
|
|
100
112
|
* @see FieldConfig - The configuration type for field components.
|
|
101
113
|
*/
|
|
102
|
-
export declare function FieldShell({ id, label, labelAlign, description, descriptionId, message, messageId, status, required, isLoading, children, }: FieldShellProps): import("react").JSX.Element;
|
|
114
|
+
export declare function FieldShell({ id, labelId, htmlFor, label, labelAlign, description, descriptionId, message, messageId, status, required, isLoading, children, }: FieldShellProps): import("react").JSX.Element;
|
|
103
115
|
//# sourceMappingURL=FieldShell.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldShell.d.ts","sourceRoot":"","sources":["../../../src/components/field/FieldShell.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAuB9D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,UAAU,CAAC,EACzB,EAAE,EACF,KAAK,EACL,UAAmB,EACnB,WAAW,EACX,aAAa,EACb,OAAO,EACP,SAAS,EACT,MAAkB,EAClB,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,EAAE,eAAe,+
|
|
1
|
+
{"version":3,"file":"FieldShell.d.ts","sourceRoot":"","sources":["../../../src/components/field/FieldShell.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAuB9D;;;GAGG;AACH,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,EAAE,EAAE,MAAM,CAAC;IAEX;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;;OAIG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAExB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf;;;OAGG;IACH,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;OAGG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IAEvB;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB;;;;OAIG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;OAGG;IACH,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,wBAAgB,UAAU,CAAC,EACzB,EAAE,EACF,OAAO,EACP,OAAO,EACP,KAAK,EACL,UAAmB,EACnB,WAAW,EACX,aAAa,EACb,OAAO,EACP,SAAS,EACT,MAAkB,EAClB,QAAQ,EACR,SAAS,EACT,QAAQ,GACT,EAAE,eAAe,+BAwCjB"}
|
|
@@ -13,37 +13,38 @@ var i = {
|
|
|
13
13
|
warning: "text-warning",
|
|
14
14
|
success: "text-success"
|
|
15
15
|
};
|
|
16
|
-
function o({ id: o,
|
|
16
|
+
function o({ id: o, labelId: s, htmlFor: c, label: l, labelAlign: u = "left", description: d, descriptionId: f, message: p, messageId: m, status: h = "default", required: g, isLoading: _, children: v }) {
|
|
17
17
|
return /* @__PURE__ */ r("div", {
|
|
18
18
|
className: "flex flex-col gap-1.5",
|
|
19
19
|
children: [
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
l && /* @__PURE__ */ n("label", {
|
|
21
|
+
id: s,
|
|
22
|
+
htmlFor: c === null ? void 0 : c ?? o,
|
|
23
|
+
className: e("text-sm font-medium text-foreground", i[u]),
|
|
23
24
|
children: /* @__PURE__ */ r("span", {
|
|
24
25
|
className: "inline-flex items-center gap-1.5",
|
|
25
26
|
children: [
|
|
26
|
-
|
|
27
|
-
|
|
27
|
+
l,
|
|
28
|
+
g && /* @__PURE__ */ n("span", {
|
|
28
29
|
"aria-hidden": "true",
|
|
29
30
|
className: "text-danger",
|
|
30
31
|
children: "*"
|
|
31
32
|
}),
|
|
32
|
-
|
|
33
|
+
_ && /* @__PURE__ */ n(t, { size: "sm" })
|
|
33
34
|
]
|
|
34
35
|
})
|
|
35
36
|
}),
|
|
36
|
-
l && /* @__PURE__ */ n("p", {
|
|
37
|
-
id: u,
|
|
38
|
-
className: e("text-sm text-foreground/60"),
|
|
39
|
-
children: l
|
|
40
|
-
}),
|
|
41
|
-
g,
|
|
42
37
|
d && /* @__PURE__ */ n("p", {
|
|
43
38
|
id: f,
|
|
44
|
-
|
|
45
|
-
className: e("text-sm", a[p]),
|
|
39
|
+
className: e("text-sm text-foreground/60"),
|
|
46
40
|
children: d
|
|
41
|
+
}),
|
|
42
|
+
v,
|
|
43
|
+
p && /* @__PURE__ */ n("p", {
|
|
44
|
+
id: m,
|
|
45
|
+
role: h === "error" ? "alert" : void 0,
|
|
46
|
+
className: e("text-sm", a[h]),
|
|
47
|
+
children: p
|
|
47
48
|
})
|
|
48
49
|
]
|
|
49
50
|
});
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { ElementType, FormHTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
import { FormConfig } from './form-config';
|
|
3
|
+
type BaseFormProps = FormConfig & Omit<FormHTMLAttributes<HTMLFormElement>, "color" | "children">;
|
|
4
|
+
/**
|
|
5
|
+
* Configuration options for the Form component.
|
|
6
|
+
*/
|
|
7
|
+
export interface FormProps extends BaseFormProps {
|
|
8
|
+
/**
|
|
9
|
+
* The fields and other content of the form.
|
|
10
|
+
*/
|
|
11
|
+
children?: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* Legend that groups the fields.
|
|
14
|
+
* When it is given the fields are wrapped in a `fieldset` with that legend,
|
|
15
|
+
* which is how a form tells assistive technology which set of controls it is
|
|
16
|
+
* describing. A form whose fields are already grouped by other landmarks
|
|
17
|
+
* omits it and names itself with `aria-label` or `aria-labelledby`.
|
|
18
|
+
*/
|
|
19
|
+
legend?: string;
|
|
20
|
+
/**
|
|
21
|
+
* Label of the submit control.
|
|
22
|
+
* When it is given the component renders an AsheeUI `Button` as the form's
|
|
23
|
+
* submit control, so no consumer has to rebuild one. Without it the
|
|
24
|
+
* consumer places its own control.
|
|
25
|
+
*/
|
|
26
|
+
submitLabel?: string;
|
|
27
|
+
/**
|
|
28
|
+
* Whether a submission is in progress.
|
|
29
|
+
* While it is true the submit control is disabled and busy, which is how a
|
|
30
|
+
* consumer shows a pending submission without bespoke markup.
|
|
31
|
+
*
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
isPending?: boolean;
|
|
35
|
+
/**
|
|
36
|
+
* Component that replaces the native `form` element, such as a framework
|
|
37
|
+
* form primitive.
|
|
38
|
+
*
|
|
39
|
+
* The substitution API is shared with `Link` and `Image`: `component` names
|
|
40
|
+
* the component and `componentProps` carries the props it needs.
|
|
41
|
+
*/
|
|
42
|
+
component?: ElementType;
|
|
43
|
+
/**
|
|
44
|
+
* Additional props for `component`.
|
|
45
|
+
*/
|
|
46
|
+
componentProps?: Record<string, unknown>;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* A framework-native form element.
|
|
50
|
+
*
|
|
51
|
+
* Form wraps the native `form` element the way `Link` wraps the anchor and
|
|
52
|
+
* `Image` wraps the picture, so form-level improvements have one home without
|
|
53
|
+
* the framework taking responsibility for form state. It preserves native
|
|
54
|
+
* submission and validation: `action`, `method`, `encType`, `target`,
|
|
55
|
+
* `noValidate` and the submit event all pass through untouched, and the
|
|
56
|
+
* forwarded ref reaches the element itself.
|
|
57
|
+
*
|
|
58
|
+
* It is deliberately thin, because a consumer's form state belongs to the
|
|
59
|
+
* consumer or to a form library. There is no AsheeUI field registry, no
|
|
60
|
+
* validation schema, and no submission state: `onSubmit` is the native event,
|
|
61
|
+
* so a form library binds to it exactly as it binds to a plain form.
|
|
62
|
+
*
|
|
63
|
+
* Fields keep their own presentation through the framework's field
|
|
64
|
+
* components, and the component renders an AsheeUI `Button` as the submit
|
|
65
|
+
* control when a label is given for it. Page layout stays with the consumer's
|
|
66
|
+
* Tailwind classes.
|
|
67
|
+
*
|
|
68
|
+
* The form never moves focus, on mount or on a rejected submission: where a
|
|
69
|
+
* consumer sends focus after a failed validation is a consumer decision.
|
|
70
|
+
*
|
|
71
|
+
* The form element itself can be replaced, the way `Link` replaces the anchor
|
|
72
|
+
* and `Image` replaces the picture: pass `component` to name a form component
|
|
73
|
+
* and `componentProps` for the props it needs.
|
|
74
|
+
*
|
|
75
|
+
* @param props - Form configuration options and native form attributes.
|
|
76
|
+
* @param props.children - The fields and other content of the form.
|
|
77
|
+
* @param props.legend - Legend that groups the fields.
|
|
78
|
+
* @param props.submitLabel - Label of the submit control the component renders.
|
|
79
|
+
* @param props.isPending - Whether a submission is in progress. Defaults to false.
|
|
80
|
+
* @param props.component - Component that replaces the native form element.
|
|
81
|
+
* @param props.componentProps - Additional props for that component.
|
|
82
|
+
* @param props.submitVariant - Style of the submit control. Defaults to the configured value.
|
|
83
|
+
* @param props.submitColor - Colour of the submit control. Defaults to the configured value.
|
|
84
|
+
* @param props.submitSize - Size of the submit control. Defaults to "md".
|
|
85
|
+
* @param props.submitRadius - Corner rounding of the submit control. Defaults to "md".
|
|
86
|
+
* @param props.className - Extra classes applied last.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```tsx
|
|
90
|
+
* <Form legend="Invoice details" submitLabel="Save" onSubmit={handleSubmit}>
|
|
91
|
+
* <Input label="Reference" name="reference" />
|
|
92
|
+
* <Textarea label="Notes" name="notes" />
|
|
93
|
+
* </Form>
|
|
94
|
+
* ```
|
|
95
|
+
*
|
|
96
|
+
* @example
|
|
97
|
+
* ```tsx
|
|
98
|
+
* // A form library binds to the native submit event, unchanged.
|
|
99
|
+
* <Form onSubmit={form.handleSubmit(save)}>
|
|
100
|
+
* <Input label="Email" name="email" />
|
|
101
|
+
* </Form>
|
|
102
|
+
* ```
|
|
103
|
+
*
|
|
104
|
+
* @see FormConfig - The configuration type for component defaults.
|
|
105
|
+
* @see Button - The submit control the component renders.
|
|
106
|
+
*/
|
|
107
|
+
export declare const Form: import('react').ForwardRefExoticComponent<FormProps & import('react').RefAttributes<HTMLFormElement>>;
|
|
108
|
+
export {};
|
|
109
|
+
//# sourceMappingURL=Form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Form.d.ts","sourceRoot":"","sources":["../../../src/components/form/Form.tsx"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,EACL,KAAK,WAAW,EAChB,KAAK,kBAAkB,EAEvB,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AAMf,OAAO,EAAE,KAAK,UAAU,EAAwB,MAAM,eAAe,CAAC;AAQtE,KAAK,aAAa,GAAG,UAAU,GAC7B,IAAI,CAAC,kBAAkB,CAAC,eAAe,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC,CAAC;AAElE;;GAEG;AACH,MAAM,WAAW,SAAU,SAAQ,aAAa;IAC9C;;OAEG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAC;IAErB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAEhB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;;;OAMG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC;IAExB;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA0DG;AACH,eAAO,MAAM,IAAI,uGAyFhB,CAAC"}
|
|
@@ -0,0 +1,42 @@
|
|
|
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 { Button as i } from "../button/Button.js";
|
|
7
|
+
import { FALLBACK_FORM_CONFIG as a } from "./form-config.js";
|
|
8
|
+
import { FORM_BASE_CLASS as o, FORM_FIELD_GROUP_CLASS as s, FORM_LEGEND_CLASS as c } from "./form-styles.js";
|
|
9
|
+
import { forwardRef as l } from "react";
|
|
10
|
+
import { Fragment as u, jsx as d, jsxs as f } from "react/jsx-runtime";
|
|
11
|
+
//#region src/components/form/Form.tsx
|
|
12
|
+
var p = l(({ children: l, legend: p, submitLabel: m, isPending: h = !1, component: g, componentProps: _, submitVariant: v, submitColor: y, submitSize: b, submitRadius: x, className: S, ...C }, w) => {
|
|
13
|
+
let T = t(), E = T.components?.form, D = n(v, E?.submitVariant, T.defaultVariant, a.submitVariant), O = n(y, E?.submitColor, T.defaultColor, a.submitColor), k = n(b, E?.submitSize, void 0, a.submitSize), A = r(x, E?.submitRadius, T.defaultRadius, a.submitRadius), j = /* @__PURE__ */ f(u, { children: [l, m && /* @__PURE__ */ d("div", {
|
|
14
|
+
className: "flex items-center gap-2 mt-4",
|
|
15
|
+
children: /* @__PURE__ */ d(i, {
|
|
16
|
+
type: "submit",
|
|
17
|
+
variant: D,
|
|
18
|
+
color: O,
|
|
19
|
+
size: k,
|
|
20
|
+
radius: A,
|
|
21
|
+
isLoading: h,
|
|
22
|
+
isDisabled: h,
|
|
23
|
+
children: m
|
|
24
|
+
})
|
|
25
|
+
})] });
|
|
26
|
+
return /* @__PURE__ */ d(g || "form", {
|
|
27
|
+
ref: w,
|
|
28
|
+
className: e(o, S),
|
|
29
|
+
...C,
|
|
30
|
+
..._,
|
|
31
|
+
children: p ? /* @__PURE__ */ f("fieldset", {
|
|
32
|
+
className: s,
|
|
33
|
+
children: [/* @__PURE__ */ d("legend", {
|
|
34
|
+
className: c,
|
|
35
|
+
children: p
|
|
36
|
+
}), j]
|
|
37
|
+
}) : j
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
p.displayName = "Form";
|
|
41
|
+
//#endregion
|
|
42
|
+
export { p as Form };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Color, Radius, Size, Variant } from '../../shared';
|
|
2
|
+
/**
|
|
3
|
+
* Theme configuration options for the Form component.
|
|
4
|
+
*
|
|
5
|
+
* Set under `components.form` in the AsheeUI config. Values feed the
|
|
6
|
+
* component-level fallback tier of the theme cascade.
|
|
7
|
+
*
|
|
8
|
+
* The form element itself carries no visual treatment: it is a grouping and
|
|
9
|
+
* submission element, and the fields inside it style themselves. These options
|
|
10
|
+
* describe the submit control the component renders when a label is given for
|
|
11
|
+
* it.
|
|
12
|
+
*/
|
|
13
|
+
export interface FormConfig {
|
|
14
|
+
/**
|
|
15
|
+
* Visual style variant of the submit control.
|
|
16
|
+
*
|
|
17
|
+
* @default "solid"
|
|
18
|
+
*/
|
|
19
|
+
submitVariant?: Variant;
|
|
20
|
+
/**
|
|
21
|
+
* Theme accent colour of the submit control.
|
|
22
|
+
*
|
|
23
|
+
* @default "primary"
|
|
24
|
+
*/
|
|
25
|
+
submitColor?: Color;
|
|
26
|
+
/**
|
|
27
|
+
* Size of the submit control.
|
|
28
|
+
*
|
|
29
|
+
* @default "md"
|
|
30
|
+
*/
|
|
31
|
+
submitSize?: Size;
|
|
32
|
+
/**
|
|
33
|
+
* Corner rounding of the submit control.
|
|
34
|
+
*
|
|
35
|
+
* @default "md"
|
|
36
|
+
*/
|
|
37
|
+
submitRadius?: Radius;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* Default config values registered for the Form component.
|
|
41
|
+
*
|
|
42
|
+
* The visual tokens are intentionally absent so they inherit from the global
|
|
43
|
+
* defaults and the built-in fallback.
|
|
44
|
+
*/
|
|
45
|
+
export declare const defaultFormConfig: FormConfig;
|
|
46
|
+
/**
|
|
47
|
+
* Hard fallback values used when no config tier provides a value.
|
|
48
|
+
* These values are used when instance props, component config,
|
|
49
|
+
* and global defaults are all undefined.
|
|
50
|
+
*/
|
|
51
|
+
export declare const FALLBACK_FORM_CONFIG: Required<FormConfig>;
|
|
52
|
+
declare module "../../libs/registry" {
|
|
53
|
+
interface ComponentTypeConfigRegistry {
|
|
54
|
+
form: FormConfig;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=form-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-config.d.ts","sourceRoot":"","sources":["../../../src/components/form/form-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AAEjE;;;;;;;;;;GAUG;AACH,MAAM,WAAW,UAAU;IACzB;;;;OAIG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;;OAIG;IACH,WAAW,CAAC,EAAE,KAAK,CAAC;IAEpB;;;;OAIG;IACH,UAAU,CAAC,EAAE,IAAI,CAAC;IAElB;;;;OAIG;IACH,YAAY,CAAC,EAAE,MAAM,CAAC;CACvB;AAED;;;;;GAKG;AACH,eAAO,MAAM,iBAAiB,EAAE,UAE/B,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,EAAE,QAAQ,CAAC,UAAU,CAK5C,CAAC;AAEX,OAAO,QAAQ,qBAAqB,CAAC;IACnC,UAAU,2BAA2B;QACnC,IAAI,EAAE,UAAU,CAAC;KAClB;CACF"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { registerComponentDefaults as e } from "../../libs/registry.js";
|
|
3
|
+
//#region src/components/form/form-config.ts
|
|
4
|
+
var t = { submitRadius: "md" }, n = {
|
|
5
|
+
submitVariant: "solid",
|
|
6
|
+
submitColor: "primary",
|
|
7
|
+
submitSize: "md",
|
|
8
|
+
submitRadius: "md"
|
|
9
|
+
};
|
|
10
|
+
e("form", t);
|
|
11
|
+
//#endregion
|
|
12
|
+
export { n as FALLBACK_FORM_CONFIG, t as defaultFormConfig };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Form component styles for AsheeUI.
|
|
3
|
+
* This file provides the static classes the Form component is built from.
|
|
4
|
+
*
|
|
5
|
+
* The list is deliberately short: a form groups and submits, and page layout
|
|
6
|
+
* belongs to the consumer's Tailwind classes. Nothing here styles
|
|
7
|
+
* a field, because fields are the framework's field components.
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Base classes for the form element.
|
|
11
|
+
*/
|
|
12
|
+
export declare const FORM_BASE_CLASS = "w-full";
|
|
13
|
+
/**
|
|
14
|
+
* Classes for the group that wraps the fields when the consumer names them.
|
|
15
|
+
* The browser's default fieldset frame is removed, because the grouping is
|
|
16
|
+
* semantic rather than visual.
|
|
17
|
+
*/
|
|
18
|
+
export declare const FORM_FIELD_GROUP_CLASS = "border-0 p-0 m-0 min-w-0";
|
|
19
|
+
/**
|
|
20
|
+
* Classes for the legend of that group.
|
|
21
|
+
*/
|
|
22
|
+
export declare const FORM_LEGEND_CLASS = "p-0 mb-2 text-sm font-medium text-foreground";
|
|
23
|
+
/**
|
|
24
|
+
* Classes for the row that holds the submit control.
|
|
25
|
+
*/
|
|
26
|
+
export declare const FORM_SUBMIT_ROW_CLASS = "flex items-center gap-2 mt-4";
|
|
27
|
+
//# sourceMappingURL=form-styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-styles.d.ts","sourceRoot":"","sources":["../../../src/components/form/form-styles.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH;;GAEG;AACH,eAAO,MAAM,eAAe,WAAW,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,6BAA6B,CAAC;AAEjE;;GAEG;AACH,eAAO,MAAM,iBAAiB,iDAAiD,CAAC;AAEhF;;GAEG;AACH,eAAO,MAAM,qBAAqB,iCAAiC,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
//#region src/components/form/form-styles.ts
|
|
3
|
+
var e = "w-full", t = "border-0 p-0 m-0 min-w-0", n = "p-0 mb-2 text-sm font-medium text-foreground", r = "flex items-center gap-2 mt-4";
|
|
4
|
+
//#endregion
|
|
5
|
+
export { e as FORM_BASE_CLASS, t as FORM_FIELD_GROUP_CLASS, n as FORM_LEGEND_CLASS, r as FORM_SUBMIT_ROW_CLASS };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/form/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC"}
|
|
@@ -17,14 +17,13 @@ export interface ImageProps extends BaseImageProps {
|
|
|
17
17
|
*/
|
|
18
18
|
component?: ElementType;
|
|
19
19
|
/**
|
|
20
|
-
* Additional props
|
|
21
|
-
* (e.g. `{ priority: true, sizes: "..." }`).
|
|
20
|
+
* Additional props for `component` (for example `{ priority: true }`).
|
|
22
21
|
*
|
|
23
22
|
* If `component` is set and neither `width`/`height` nor `fill`
|
|
24
23
|
* are provided here, `fill: true` is applied automatically since
|
|
25
24
|
* this component is container/ratio driven.
|
|
26
25
|
*/
|
|
27
|
-
|
|
26
|
+
componentProps?: Record<string, unknown>;
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
30
29
|
* An image element with ratio locking, object-fit control, radius
|
|
@@ -51,7 +50,7 @@ export interface ImageProps extends BaseImageProps {
|
|
|
51
50
|
* @param props.showSkeleton - Loading placeholder. Defaults to true.
|
|
52
51
|
* @param props.className - Extra classes for the image element.
|
|
53
52
|
* @param props.component - Custom image component.
|
|
54
|
-
* @param props.
|
|
53
|
+
* @param props.componentProps - Props forwarded to the image component.
|
|
55
54
|
* @param props.src - The image source URL.
|
|
56
55
|
* @param props.onLoad - Callback fired when the image loads.
|
|
57
56
|
* @param props.onError - Callback fired when the image fails to load.
|
|
@@ -83,7 +82,7 @@ export interface ImageProps extends BaseImageProps {
|
|
|
83
82
|
* src="/hero.png"
|
|
84
83
|
* alt="Hero image"
|
|
85
84
|
* component={NextImage}
|
|
86
|
-
*
|
|
85
|
+
* componentProps={{ priority: true, sizes: "100vw" }}
|
|
87
86
|
* />
|
|
88
87
|
* ```
|
|
89
88
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/components/image/Image.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AASf,OAAO,EAEL,KAAK,WAAW,EAGjB,MAAM,gBAAgB,CAAC;AAGxB,KAAK,cAAc,GAAG,WAAW,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC;IAExB
|
|
1
|
+
{"version":3,"file":"Image.d.ts","sourceRoot":"","sources":["../../../src/components/image/Image.tsx"],"names":[],"mappings":"AAUA,OAAO,EACL,KAAK,WAAW,EAEhB,KAAK,iBAAiB,EAKvB,MAAM,OAAO,CAAC;AASf,OAAO,EAEL,KAAK,WAAW,EAGjB,MAAM,gBAAgB,CAAC;AAGxB,KAAK,cAAc,GAAG,WAAW,GAAG,iBAAiB,CAAC,gBAAgB,CAAC,CAAC;AAExE;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAChD;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;;OAIG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC;IAExB;;;;;;OAMG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC1C;AAUD;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG;AACH,eAAO,MAAM,KAAK,yGAsNjB,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
"use client";
|
|
3
3
|
import { cn as e } from "../../utils/cn.js";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
4
|
+
import { RADIUS_CLASS as t } from "../../shared/radius.js";
|
|
5
|
+
import { useAsheeConfig as n } from "../../libs/context.js";
|
|
6
6
|
import { resolveCascade as r, resolveClassKey as i, resolveRadiusKey as a } from "../../utils/resolve-token.js";
|
|
7
7
|
import { FALLBACK_IMAGE_CONFIG as o } from "./image-config.js";
|
|
8
8
|
import { IMAGE_FIT_CLASS as s, IMAGE_RATIO_CLASS as c } from "./image-styles.js";
|
|
@@ -12,8 +12,8 @@ import { jsx as p, jsxs as m } from "react/jsx-runtime";
|
|
|
12
12
|
function h(e) {
|
|
13
13
|
return typeof e == "string" && e.trim().length > 0;
|
|
14
14
|
}
|
|
15
|
-
var g = l(({ alt: l, fit: g, ratio: _, radius: v, fallbackSrc: y, showSkeleton: ee, loading: b, src: x, className: S, onLoad: C, onError: w, component: T,
|
|
16
|
-
let k =
|
|
15
|
+
var g = l(({ alt: l, fit: g, ratio: _, radius: v, fallbackSrc: y, showSkeleton: ee, loading: b, src: x, className: S, onLoad: C, onError: w, component: T, componentProps: E, ...D }, O) => {
|
|
16
|
+
let k = n(), A = k.components?.image, [j, M] = f(!1), [N, P] = f(x), F = d(null);
|
|
17
17
|
u(() => {
|
|
18
18
|
P(x), M(!1);
|
|
19
19
|
}, [x]), u(() => {
|
|
@@ -30,7 +30,7 @@ var g = l(({ alt: l, fit: g, ratio: _, radius: v, fallbackSrc: y, showSkeleton:
|
|
|
30
30
|
M(!0), w?.(e);
|
|
31
31
|
}, R = (e) => {
|
|
32
32
|
F.current = e, typeof O == "function" ? O(e) : O && (O.current = e);
|
|
33
|
-
}, z = r(g, A?.fit, void 0, o.fit), B = r(_, A?.ratio, void 0, o.ratio), V = a(v, A?.radius, k.defaultRadius, o.radius), H = r(b, A?.loading, void 0, o.loading), U = r(ee, A?.showSkeleton, void 0, o.showSkeleton), W = i(z, s, o.fit), G = i(B, c, o.ratio), K = i(V,
|
|
33
|
+
}, z = r(g, A?.fit, void 0, o.fit), B = r(_, A?.ratio, void 0, o.ratio), V = a(v, A?.radius, k.defaultRadius, o.radius), H = r(b, A?.loading, void 0, o.loading), U = r(ee, A?.showSkeleton, void 0, o.showSkeleton), W = i(z, s, o.fit), G = i(B, c, o.ratio), K = i(V, t, o.radius), q = T || "img", J = !!T, Y = h(N), X = E?.width !== void 0 || E?.height !== void 0 || E?.fill !== void 0, Z = J && !X ? {
|
|
34
34
|
fill: !0,
|
|
35
35
|
sizes: "100%"
|
|
36
36
|
} : {}, Q = e("h-full w-full transition-opacity duration-300", W, j ? "opacity-100" : "opacity-0", K, S), $ = { ...E ?? {} };
|