@craftzbay/ui 0.11.2 → 0.11.4
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-lib/_virtual/_rolldown/runtime.js +11 -0
- package/dist-lib/components/ui/Accordion.js +42 -67
- package/dist-lib/components/ui/Accordion.js.map +1 -1
- package/dist-lib/components/ui/Alert.js +71 -77
- package/dist-lib/components/ui/Alert.js.map +1 -1
- package/dist-lib/components/ui/Avatar.js +67 -92
- package/dist-lib/components/ui/Avatar.js.map +1 -1
- package/dist-lib/components/ui/Badge.js +119 -74
- package/dist-lib/components/ui/Badge.js.map +1 -1
- package/dist-lib/components/ui/Breadcrumbs.js +62 -50
- package/dist-lib/components/ui/Breadcrumbs.js.map +1 -1
- package/dist-lib/components/ui/Button.js +129 -127
- package/dist-lib/components/ui/Button.js.map +1 -1
- package/dist-lib/components/ui/Calendar.d.ts +1 -1
- package/dist-lib/components/ui/Calendar.js +99 -136
- package/dist-lib/components/ui/Calendar.js.map +1 -1
- package/dist-lib/components/ui/Card.js +88 -94
- package/dist-lib/components/ui/Card.js.map +1 -1
- package/dist-lib/components/ui/Carousel.js +125 -170
- package/dist-lib/components/ui/Carousel.js.map +1 -1
- package/dist-lib/components/ui/Chart.d.ts +3 -3
- package/dist-lib/components/ui/Chart.js +435 -464
- package/dist-lib/components/ui/Chart.js.map +1 -1
- package/dist-lib/components/ui/Checkbox.js +60 -69
- package/dist-lib/components/ui/Checkbox.js.map +1 -1
- package/dist-lib/components/ui/Combobox.js +179 -192
- package/dist-lib/components/ui/Combobox.js.map +1 -1
- package/dist-lib/components/ui/CommandPalette.d.ts +2 -2
- package/dist-lib/components/ui/CommandPalette.js +106 -167
- package/dist-lib/components/ui/CommandPalette.js.map +1 -1
- package/dist-lib/components/ui/ContextMenu.d.ts +1 -1
- package/dist-lib/components/ui/ContextMenu.js +89 -154
- package/dist-lib/components/ui/ContextMenu.js.map +1 -1
- package/dist-lib/components/ui/DataGrid.d.ts +1 -1
- package/dist-lib/components/ui/DataGrid.js +99 -96
- package/dist-lib/components/ui/DataGrid.js.map +1 -1
- package/dist-lib/components/ui/DatePicker.js +151 -188
- package/dist-lib/components/ui/DatePicker.js.map +1 -1
- package/dist-lib/components/ui/DesignSystemProvider.d.ts +1 -1
- package/dist-lib/components/ui/DesignSystemProvider.js +120 -130
- package/dist-lib/components/ui/DesignSystemProvider.js.map +1 -1
- package/dist-lib/components/ui/Dialog.d.ts +3 -3
- package/dist-lib/components/ui/Dialog.js +108 -156
- package/dist-lib/components/ui/Dialog.js.map +1 -1
- package/dist-lib/components/ui/Drawer.d.ts +3 -3
- package/dist-lib/components/ui/Drawer.js +90 -124
- package/dist-lib/components/ui/Drawer.js.map +1 -1
- package/dist-lib/components/ui/DropdownMenu.d.ts +1 -1
- package/dist-lib/components/ui/DropdownMenu.js +92 -158
- package/dist-lib/components/ui/DropdownMenu.js.map +1 -1
- package/dist-lib/components/ui/EmptyState.js +31 -44
- package/dist-lib/components/ui/EmptyState.js.map +1 -1
- package/dist-lib/components/ui/ErrorState.js +57 -67
- package/dist-lib/components/ui/ErrorState.js.map +1 -1
- package/dist-lib/components/ui/FileUpload.js +113 -107
- package/dist-lib/components/ui/FileUpload.js.map +1 -1
- package/dist-lib/components/ui/Form.d.ts +6 -4
- package/dist-lib/components/ui/Form.js +117 -122
- package/dist-lib/components/ui/Form.js.map +1 -1
- package/dist-lib/components/ui/Icon.d.ts +1 -1
- package/dist-lib/components/ui/Icon.js +30 -29
- package/dist-lib/components/ui/Icon.js.map +1 -1
- package/dist-lib/components/ui/IconButton.js +61 -61
- package/dist-lib/components/ui/IconButton.js.map +1 -1
- package/dist-lib/components/ui/Input.js +133 -156
- package/dist-lib/components/ui/Input.js.map +1 -1
- package/dist-lib/components/ui/Kbd.js +14 -21
- package/dist-lib/components/ui/Kbd.js.map +1 -1
- package/dist-lib/components/ui/MultiSelect.js +176 -208
- package/dist-lib/components/ui/MultiSelect.js.map +1 -1
- package/dist-lib/components/ui/Pagination.js +152 -149
- package/dist-lib/components/ui/Pagination.js.map +1 -1
- package/dist-lib/components/ui/Popover.js +18 -33
- package/dist-lib/components/ui/Popover.js.map +1 -1
- package/dist-lib/components/ui/Progress.js +77 -99
- package/dist-lib/components/ui/Progress.js.map +1 -1
- package/dist-lib/components/ui/RadioGroup.js +51 -80
- package/dist-lib/components/ui/RadioGroup.js.map +1 -1
- package/dist-lib/components/ui/RelativeTime.js +22 -29
- package/dist-lib/components/ui/RelativeTime.js.map +1 -1
- package/dist-lib/components/ui/ScrollArea.js +39 -58
- package/dist-lib/components/ui/ScrollArea.js.map +1 -1
- package/dist-lib/components/ui/Select.js +108 -131
- package/dist-lib/components/ui/Select.js.map +1 -1
- package/dist-lib/components/ui/Separator.js +18 -24
- package/dist-lib/components/ui/Separator.js.map +1 -1
- package/dist-lib/components/ui/Sheet.d.ts +2 -2
- package/dist-lib/components/ui/Sheet.js +77 -129
- package/dist-lib/components/ui/Sheet.js.map +1 -1
- package/dist-lib/components/ui/Sidebar.d.ts +1 -1
- package/dist-lib/components/ui/Sidebar.js +168 -207
- package/dist-lib/components/ui/Sidebar.js.map +1 -1
- package/dist-lib/components/ui/Skeleton.js +17 -27
- package/dist-lib/components/ui/Skeleton.js.map +1 -1
- package/dist-lib/components/ui/Slider.js +45 -62
- package/dist-lib/components/ui/Slider.js.map +1 -1
- package/dist-lib/components/ui/Snackbar.js +75 -55
- package/dist-lib/components/ui/Snackbar.js.map +1 -1
- package/dist-lib/components/ui/Spinner.js +45 -52
- package/dist-lib/components/ui/Spinner.js.map +1 -1
- package/dist-lib/components/ui/Stepper.js +56 -108
- package/dist-lib/components/ui/Stepper.js.map +1 -1
- package/dist-lib/components/ui/Switch.js +46 -79
- package/dist-lib/components/ui/Switch.js.map +1 -1
- package/dist-lib/components/ui/Table.js +108 -169
- package/dist-lib/components/ui/Table.js.map +1 -1
- package/dist-lib/components/ui/Tabs.js +57 -88
- package/dist-lib/components/ui/Tabs.js.map +1 -1
- package/dist-lib/components/ui/TagInput.js +76 -109
- package/dist-lib/components/ui/TagInput.js.map +1 -1
- package/dist-lib/components/ui/Textarea.js +74 -86
- package/dist-lib/components/ui/Textarea.js.map +1 -1
- package/dist-lib/components/ui/Timeline.d.ts +3 -3
- package/dist-lib/components/ui/Timeline.js +61 -49
- package/dist-lib/components/ui/Timeline.js.map +1 -1
- package/dist-lib/components/ui/Toast.d.ts +1 -1
- package/dist-lib/components/ui/Toast.js +136 -150
- package/dist-lib/components/ui/Toast.js.map +1 -1
- package/dist-lib/components/ui/Tooltip.d.ts +2 -2
- package/dist-lib/components/ui/Tooltip.js +35 -56
- package/dist-lib/components/ui/Tooltip.js.map +1 -1
- package/dist-lib/components/ui/TopNav.js +46 -66
- package/dist-lib/components/ui/TopNav.js.map +1 -1
- package/dist-lib/components/ui/Tree.js +134 -168
- package/dist-lib/components/ui/Tree.js.map +1 -1
- package/dist-lib/hooks/use-debounce.js +27 -33
- package/dist-lib/hooks/use-debounce.js.map +1 -1
- package/dist-lib/hooks/use-delayed-loading.js +19 -18
- package/dist-lib/hooks/use-delayed-loading.js.map +1 -1
- package/dist-lib/hooks/use-field-ids.js +14 -16
- package/dist-lib/hooks/use-field-ids.js.map +1 -1
- package/dist-lib/hooks/use-media-query.js +15 -19
- package/dist-lib/hooks/use-media-query.js.map +1 -1
- package/dist-lib/hooks/use-modifier-key.js +20 -15
- package/dist-lib/hooks/use-modifier-key.js.map +1 -1
- package/dist-lib/hooks/use-strings.js +10 -10
- package/dist-lib/hooks/use-strings.js.map +1 -1
- package/dist-lib/hooks/use-toast.js +73 -62
- package/dist-lib/hooks/use-toast.js.map +1 -1
- package/dist-lib/icon.js +2 -6
- package/dist-lib/icons/index.js +166 -163
- package/dist-lib/icons/index.js.map +1 -1
- package/dist-lib/illustrations/index.d.ts +7 -7
- package/dist-lib/illustrations/index.js +255 -106
- package/dist-lib/illustrations/index.js.map +1 -1
- package/dist-lib/index.js +69 -291
- package/dist-lib/lib/cva.js +2 -0
- package/dist-lib/lib/format.js +71 -87
- package/dist-lib/lib/format.js.map +1 -1
- package/dist-lib/lib/return-focus.js +11 -11
- package/dist-lib/lib/return-focus.js.map +1 -1
- package/dist-lib/lib/strings.js +167 -135
- package/dist-lib/lib/strings.js.map +1 -1
- package/dist-lib/lib/strings.mn.js +150 -113
- package/dist-lib/lib/strings.mn.js.map +1 -1
- package/dist-lib/lib/utils.js +9 -9
- package/dist-lib/lib/utils.js.map +1 -1
- package/dist-lib/styles.css +3 -1
- package/dist-lib/theme.css +18 -5
- package/package.json +50 -50
- package/dist-lib/__tests__/helpers/color.d.ts +0 -9
- package/dist-lib/__tests__/helpers/theme.d.ts +0 -18
- package/dist-lib/icon.js.map +0 -1
- package/dist-lib/index.js.map +0 -1
|
@@ -1,131 +1,133 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { cva as t } from "../../lib/cva.js";
|
|
4
|
+
import { Loader2 as n } from "../../icons/index.js";
|
|
5
|
+
import { forwardRef as r } from "react";
|
|
6
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
7
|
+
import { Slot as o } from "@radix-ui/react-slot";
|
|
8
|
+
//#region src/components/ui/Button.tsx
|
|
9
|
+
var s = t([
|
|
10
|
+
"inline-flex items-center justify-center gap-2 whitespace-nowrap",
|
|
11
|
+
"rounded-md text-sm font-medium",
|
|
12
|
+
"transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]",
|
|
13
|
+
"outline-none",
|
|
14
|
+
"focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",
|
|
15
|
+
"focus-visible:ring-offset-background",
|
|
16
|
+
"disabled:pointer-events-none disabled:opacity-50",
|
|
17
|
+
"aria-busy:pointer-events-none",
|
|
18
|
+
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
19
|
+
], {
|
|
20
|
+
variants: {
|
|
21
|
+
variant: {
|
|
22
|
+
primary: [
|
|
23
|
+
"bg-accent text-on-accent",
|
|
24
|
+
"hover:bg-accent-hover",
|
|
25
|
+
"active:bg-accent-active"
|
|
26
|
+
],
|
|
27
|
+
secondary: [
|
|
28
|
+
"bg-background-muted text-foreground border border-border-strong",
|
|
29
|
+
"hover:bg-surface-hover",
|
|
30
|
+
"active:bg-surface-active"
|
|
31
|
+
],
|
|
32
|
+
outline: [
|
|
33
|
+
"border border-border-strong bg-transparent text-foreground",
|
|
34
|
+
"hover:bg-background-muted",
|
|
35
|
+
"active:bg-background-subtle"
|
|
36
|
+
],
|
|
37
|
+
ghost: [
|
|
38
|
+
"bg-transparent text-foreground",
|
|
39
|
+
"hover:bg-background-muted",
|
|
40
|
+
"active:bg-background-subtle"
|
|
41
|
+
],
|
|
42
|
+
destructive: [
|
|
43
|
+
"bg-danger text-on-danger",
|
|
44
|
+
"hover:bg-danger-hover",
|
|
45
|
+
"active:bg-danger-active"
|
|
46
|
+
],
|
|
47
|
+
link: [
|
|
48
|
+
"bg-transparent text-accent underline-offset-4 px-0",
|
|
49
|
+
"hover:underline",
|
|
50
|
+
"active:text-accent-hover"
|
|
51
|
+
]
|
|
52
|
+
},
|
|
53
|
+
size: {
|
|
54
|
+
sm: "h-8 px-3 text-xs [&_svg]:size-4",
|
|
55
|
+
md: "h-9 px-3.5 text-sm [&_svg]:size-4",
|
|
56
|
+
lg: "h-10 px-4 text-sm [&_svg]:size-5",
|
|
57
|
+
xl: "h-11 px-5 text-base [&_svg]:size-5",
|
|
58
|
+
icon: "h-9 w-9 [&_svg]:size-4"
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
compoundVariants: [
|
|
62
|
+
{
|
|
63
|
+
variant: "link",
|
|
64
|
+
size: "sm",
|
|
65
|
+
class: "h-auto px-0"
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
variant: "link",
|
|
69
|
+
size: "md",
|
|
70
|
+
class: "h-auto px-0"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
variant: "link",
|
|
74
|
+
size: "lg",
|
|
75
|
+
class: "h-auto px-0"
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
variant: "link",
|
|
79
|
+
size: "xl",
|
|
80
|
+
class: "h-auto px-0"
|
|
81
|
+
}
|
|
82
|
+
],
|
|
83
|
+
defaultVariants: {
|
|
84
|
+
variant: "primary",
|
|
85
|
+
size: "md"
|
|
86
|
+
}
|
|
87
|
+
}), c = r(function({ className: t, variant: r, size: c, asChild: d = !1, loading: f = !1, leadingIcon: p, trailingIcon: m, disabled: h, children: g, type: _ = "button", onClick: v, ...y }, b) {
|
|
88
|
+
let x = e(s({
|
|
89
|
+
variant: r,
|
|
90
|
+
size: c
|
|
91
|
+
}), t);
|
|
92
|
+
return d ? /* @__PURE__ */ i(o, {
|
|
93
|
+
ref: b,
|
|
94
|
+
"aria-busy": f || void 0,
|
|
95
|
+
"aria-disabled": f || void 0,
|
|
96
|
+
"data-loading": f || void 0,
|
|
97
|
+
className: x,
|
|
98
|
+
onClick: v,
|
|
99
|
+
onClickCapture: f ? l : void 0,
|
|
100
|
+
onKeyDownCapture: f ? u : void 0,
|
|
101
|
+
...y,
|
|
102
|
+
children: g
|
|
103
|
+
}) : /* @__PURE__ */ a("button", {
|
|
104
|
+
ref: b,
|
|
105
|
+
type: _,
|
|
106
|
+
"aria-busy": f || void 0,
|
|
107
|
+
"aria-disabled": f || void 0,
|
|
108
|
+
disabled: h,
|
|
109
|
+
"data-loading": f || void 0,
|
|
110
|
+
className: x,
|
|
111
|
+
onClick: f ? l : v,
|
|
112
|
+
...y,
|
|
113
|
+
children: [
|
|
114
|
+
f ? /* @__PURE__ */ i(n, {
|
|
115
|
+
className: "animate-spin",
|
|
116
|
+
"aria-hidden": "true"
|
|
117
|
+
}) : p,
|
|
118
|
+
g,
|
|
119
|
+
!f && m
|
|
120
|
+
]
|
|
121
|
+
});
|
|
120
122
|
});
|
|
121
|
-
|
|
122
|
-
function
|
|
123
|
-
|
|
123
|
+
c.displayName = "Button";
|
|
124
|
+
function l(e) {
|
|
125
|
+
e.preventDefault(), e.stopPropagation();
|
|
124
126
|
}
|
|
125
|
-
function
|
|
126
|
-
|
|
127
|
+
function u(e) {
|
|
128
|
+
(e.key === "Enter" || e.key === " ") && l(e);
|
|
127
129
|
}
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
//# sourceMappingURL=Button.js.map
|
|
130
|
+
//#endregion
|
|
131
|
+
export { c as Button };
|
|
132
|
+
|
|
133
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sources":["../../../src/components/ui/Button.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n type ButtonHTMLAttributes,\n type MouseEvent,\n type ReactNode,\n type SyntheticEvent,\n} from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { Loader2 } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { cva, type VariantProps } from '@/lib/cva';\n\n/* -----------------------------------------------------------------------------\n * Variants — the entire visual surface of the Button.\n *\n * All sizes share the same border radius (md = 6px) per the refined-minimal\n * rules. Focus state is the standardised 2px-ring + 2px-offset on every\n * variant, including `link`.\n * --------------------------------------------------------------------------- */\nconst button = cva(\n [\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap',\n 'rounded-md text-sm font-medium',\n 'transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]',\n 'outline-none',\n 'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',\n 'focus-visible:ring-offset-background',\n 'disabled:pointer-events-none disabled:opacity-50',\n // Loading keeps focus (no `disabled`) but blocks interaction.\n 'aria-busy:pointer-events-none',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0',\n ],\n {\n variants: {\n variant: {\n primary: ['bg-accent text-on-accent', 'hover:bg-accent-hover', 'active:bg-accent-active'],\n secondary: [\n 'bg-background-muted text-foreground border border-border-
|
|
1
|
+
{"version":3,"file":"Button.js","names":[],"sources":["../../../src/components/ui/Button.tsx"],"sourcesContent":["'use client';\n\nimport {\n forwardRef,\n type ButtonHTMLAttributes,\n type MouseEvent,\n type ReactNode,\n type SyntheticEvent,\n} from 'react';\nimport { Slot } from '@radix-ui/react-slot';\nimport { Loader2 } from '@/icons';\nimport { cn } from '@/lib/utils';\nimport { cva, type VariantProps } from '@/lib/cva';\n\n/* -----------------------------------------------------------------------------\n * Variants — the entire visual surface of the Button.\n *\n * All sizes share the same border radius (md = 6px) per the refined-minimal\n * rules. Focus state is the standardised 2px-ring + 2px-offset on every\n * variant, including `link`.\n * --------------------------------------------------------------------------- */\nconst button = cva(\n [\n 'inline-flex items-center justify-center gap-2 whitespace-nowrap',\n 'rounded-md text-sm font-medium',\n 'transition-colors duration-[var(--duration-fast)] ease-[var(--ease-out)]',\n 'outline-none',\n 'focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2',\n 'focus-visible:ring-offset-background',\n 'disabled:pointer-events-none disabled:opacity-50',\n // Loading keeps focus (no `disabled`) but blocks interaction.\n 'aria-busy:pointer-events-none',\n '[&_svg]:pointer-events-none [&_svg]:shrink-0',\n ],\n {\n variants: {\n variant: {\n primary: ['bg-accent text-on-accent', 'hover:bg-accent-hover', 'active:bg-accent-active'],\n // A button carries its own label, so its edge is not what identifies it:\n // WCAG 1.4.11 asks for 3:1 only where the boundary is the sole cue\n // (fields, checkbox, radio). --border-strong keeps the shape without\n // eight dark rectangles in a toolbar; prefers-contrast: more darkens it.\n secondary: [\n 'bg-background-muted text-foreground border border-border-strong',\n 'hover:bg-surface-hover',\n 'active:bg-surface-active',\n ],\n outline: [\n 'border border-border-strong bg-transparent text-foreground',\n 'hover:bg-background-muted',\n 'active:bg-background-subtle',\n ],\n ghost: [\n 'bg-transparent text-foreground',\n 'hover:bg-background-muted',\n 'active:bg-background-subtle',\n ],\n destructive: [\n 'bg-danger text-on-danger',\n 'hover:bg-danger-hover',\n 'active:bg-danger-active',\n ],\n link: [\n 'bg-transparent text-accent underline-offset-4 px-0',\n 'hover:underline',\n 'active:text-accent-hover',\n ],\n },\n size: {\n sm: 'h-8 px-3 text-xs [&_svg]:size-4',\n md: 'h-9 px-3.5 text-sm [&_svg]:size-4',\n lg: 'h-10 px-4 text-sm [&_svg]:size-5',\n // 44px — touch-first screens and marketing CTAs.\n xl: 'h-11 px-5 text-base [&_svg]:size-5',\n icon: 'h-9 w-9 [&_svg]:size-4',\n },\n },\n compoundVariants: [\n // The `link` variant ignores horizontal padding from the size variant.\n { variant: 'link', size: 'sm', class: 'h-auto px-0' },\n { variant: 'link', size: 'md', class: 'h-auto px-0' },\n { variant: 'link', size: 'lg', class: 'h-auto px-0' },\n { variant: 'link', size: 'xl', class: 'h-auto px-0' },\n ],\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n },\n },\n);\n\nexport interface ButtonProps\n extends ButtonHTMLAttributes<HTMLButtonElement>, VariantProps<typeof button> {\n /**\n * Render as a different element via Radix Slot. Useful when wrapping a\n * link: `<Button asChild><a href=\"…\">…</a></Button>`.\n * @default false\n */\n asChild?: boolean;\n /**\n * Show a spinner in place of the leading icon and block interaction while\n * keeping keyboard focus (`aria-disabled` + `aria-busy`, not `disabled`, so\n * focus is not lost mid-submit). With `asChild` no spinner is rendered —\n * the child is only marked busy and made inert.\n * @default false\n */\n loading?: boolean;\n /** Icon rendered before the label. Replaced by a spinner when loading. */\n leadingIcon?: ReactNode;\n /** Icon rendered after the label. Hidden while loading. */\n trailingIcon?: ReactNode;\n}\n\n/**\n * Primary interactive element. Variants:\n *\n * - `primary` — accent fill, the single most prominent action on a screen.\n * - `secondary` — neutral fill, sits next to a primary or stands alone for\n * secondary actions.\n * - `outline` — border only, transparent fill. Use when next to a primary.\n * - `ghost` — no border, hover background. Use in dense toolbars and tables.\n * - `destructive` — danger fill, reserved for irreversible actions.\n * - `link` — text styled as a link.\n *\n * @example Two-button row\n * <div className=\"flex gap-2 justify-end\">\n * <Button variant=\"outline\">Cancel</Button>\n * <Button>Save changes</Button>\n * </div>\n *\n * @example Loading state\n * <Button loading leadingIcon={<Mail />}>Sending…</Button>\n *\n * @do Use one primary button per major surface. Verb-first labels.\n * @dont Stack three primary buttons in a row — only the most important\n * action gets the primary variant.\n */\nexport const Button = forwardRef<HTMLButtonElement, ButtonProps>(function Button(\n {\n className,\n variant,\n size,\n asChild = false,\n loading = false,\n leadingIcon,\n trailingIcon,\n disabled,\n children,\n type = 'button',\n onClick,\n ...props\n },\n ref,\n) {\n const classes = cn(button({ variant, size }), className);\n\n if (asChild) {\n // Slot requires exactly one element child — pass the consumer's element\n // through untouched. The consumer is responsible for any leading/trailing\n // icons inside that element. While loading, a capture-phase guard stops\n // the child's own handlers (and link navigation) before they run.\n return (\n <Slot\n ref={ref}\n aria-busy={loading || undefined}\n aria-disabled={loading || undefined}\n data-loading={loading || undefined}\n className={classes}\n onClick={onClick}\n onClickCapture={loading ? blockEvent : undefined}\n onKeyDownCapture={loading ? blockActivationKey : undefined}\n {...props}\n >\n {children}\n </Slot>\n );\n }\n\n return (\n <button\n ref={ref}\n type={type}\n aria-busy={loading || undefined}\n aria-disabled={loading || undefined}\n disabled={disabled}\n data-loading={loading || undefined}\n className={classes}\n onClick={loading ? blockEvent : onClick}\n {...props}\n >\n {loading ? <Loader2 className=\"animate-spin\" aria-hidden=\"true\" /> : leadingIcon}\n {children}\n {!loading && trailingIcon}\n </button>\n );\n});\n\nButton.displayName = 'Button';\n\nfunction blockEvent(e: SyntheticEvent | MouseEvent) {\n e.preventDefault();\n e.stopPropagation();\n}\n\nfunction blockActivationKey(e: React.KeyboardEvent) {\n if (e.key === 'Enter' || e.key === ' ') blockEvent(e);\n}\n"],"mappings":";;;;;;;;AAqBA,IAAM,IAAS,EACb;CACE;CACA;CACA;CACA;CACA;CACA;CACA;CAEA;CACA;AACF,GACA;CACE,UAAU;EACR,SAAS;GACP,SAAS;IAAC;IAA4B;IAAyB;GAAyB;GAKxF,WAAW;IACT;IACA;IACA;GACF;GACA,SAAS;IACP;IACA;IACA;GACF;GACA,OAAO;IACL;IACA;IACA;GACF;GACA,aAAa;IACX;IACA;IACA;GACF;GACA,MAAM;IACJ;IACA;IACA;GACF;EACF;EACA,MAAM;GACJ,IAAI;GACJ,IAAI;GACJ,IAAI;GAEJ,IAAI;GACJ,MAAM;EACR;CACF;CACA,kBAAkB;EAEhB;GAAE,SAAS;GAAQ,MAAM;GAAM,OAAO;EAAc;EACpD;GAAE,SAAS;GAAQ,MAAM;GAAM,OAAO;EAAc;EACpD;GAAE,SAAS;GAAQ,MAAM;GAAM,OAAO;EAAc;EACpD;GAAE,SAAS;GAAQ,MAAM;GAAM,OAAO;EAAc;CACtD;CACA,iBAAiB;EACf,SAAS;EACT,MAAM;CACR;AACF,CACF,GAgDa,IAAS,EAA2C,SAC/D,EACE,cACA,YACA,SACA,aAAU,IACV,aAAU,IACV,gBACA,iBACA,aACA,aACA,UAAO,UACP,YACA,GAAG,KAEL,GACA;CACA,IAAM,IAAU,EAAG,EAAO;EAAE;EAAS;CAAK,CAAC,GAAG,CAAS;CAwBvD,OAtBI,IAMA,kBAAC,GAAD;EACO;EACL,aAAW,KAAW,KAAA;EACtB,iBAAe,KAAW,KAAA;EAC1B,gBAAc,KAAW,KAAA;EACzB,WAAW;EACF;EACT,gBAAgB,IAAU,IAAa,KAAA;EACvC,kBAAkB,IAAU,IAAqB,KAAA;EACjD,GAAI;EAEH;CACG,CAAA,IAKR,kBAAC,UAAD;EACO;EACC;EACN,aAAW,KAAW,KAAA;EACtB,iBAAe,KAAW,KAAA;EAChB;EACV,gBAAc,KAAW,KAAA;EACzB,WAAW;EACX,SAAS,IAAU,IAAa;EAChC,GAAI;EATN,UAAA;GAWG,IAAU,kBAAC,GAAD;IAAS,WAAU;IAAe,eAAY;GAAQ,CAAA,IAAI;GACpE;GACA,CAAC,KAAW;EACP;;AAEZ,CAAC;AAED,EAAO,cAAc;AAErB,SAAS,EAAW,GAAgC;CAElD,AADA,EAAE,eAAe,GACjB,EAAE,gBAAgB;AACpB;AAEA,SAAS,EAAmB,GAAwB;CAClD,CAAI,EAAE,QAAQ,WAAW,EAAE,QAAQ,QAAK,EAAW,CAAC;AACtD"}
|
|
@@ -9,7 +9,7 @@ export type CalendarProps = DayPickerProps & {
|
|
|
9
9
|
* Not a forwardRef: RDP v9's `DayPicker` is a plain function component and
|
|
10
10
|
* exposes no root ref, so a forwarded ref would silently be dropped.
|
|
11
11
|
*/
|
|
12
|
-
export declare function Calendar({ className, classNames, captionLayout, startMonth, endMonth, labels, weekStartsOn, ...props }: CalendarProps): import("react
|
|
12
|
+
export declare function Calendar({ className, classNames, captionLayout, startMonth, endMonth, labels, weekStartsOn, ...props }: CalendarProps): import("react").JSX.Element;
|
|
13
13
|
export declare namespace Calendar {
|
|
14
14
|
var displayName: string;
|
|
15
15
|
}
|
|
@@ -1,139 +1,102 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
})
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/* @__PURE__ */ t(u.Icon, { asChild: !0, children: /* @__PURE__ */ t(g, { className: "size-3.5 opacity-60", "aria-hidden": !0 }) })
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
),
|
|
43
|
-
/* @__PURE__ */ t(D, { className: "max-h-64", children: l.map((e) => /* @__PURE__ */ t(j, { value: String(e.value), disabled: e.disabled, children: e.label }, e.value)) })
|
|
44
|
-
]
|
|
45
|
-
}
|
|
46
|
-
);
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { useStrings as t } from "../../hooks/use-strings.js";
|
|
4
|
+
import { ChevronDown as n, ChevronLeft as r, ChevronRight as i } from "../../icons/index.js";
|
|
5
|
+
import { Select as a, SelectContent as o, SelectItem as s } from "./Select.js";
|
|
6
|
+
import { useMemo as c } from "react";
|
|
7
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
8
|
+
import { DayPicker as d, getDefaultClassNames as f } from "react-day-picker";
|
|
9
|
+
import * as p from "@radix-ui/react-select";
|
|
10
|
+
//#region src/components/ui/Calendar.tsx
|
|
11
|
+
var m = f();
|
|
12
|
+
function h({ options: t = [], value: r, onChange: i, disabled: c, "aria-label": d }) {
|
|
13
|
+
let f = t.find((e) => e.value === Number(r));
|
|
14
|
+
return /* @__PURE__ */ u(a, {
|
|
15
|
+
value: r === void 0 ? void 0 : String(r),
|
|
16
|
+
onValueChange: (e) => {
|
|
17
|
+
i?.({ target: { value: e } });
|
|
18
|
+
},
|
|
19
|
+
disabled: c,
|
|
20
|
+
children: [/* @__PURE__ */ u(p.Trigger, {
|
|
21
|
+
"aria-label": d,
|
|
22
|
+
className: e("border-border bg-card text-foreground inline-flex h-7 items-center gap-1 rounded-md border px-2 text-sm font-medium", "hover:bg-background-muted focus-visible:ring-ring focus-visible:ring-offset-background outline-none focus-visible:ring-2 focus-visible:ring-offset-2", "disabled:pointer-events-none disabled:opacity-50"),
|
|
23
|
+
children: [/* @__PURE__ */ l(p.Value, { children: f?.label }), /* @__PURE__ */ l(p.Icon, {
|
|
24
|
+
asChild: !0,
|
|
25
|
+
children: /* @__PURE__ */ l(n, {
|
|
26
|
+
className: "size-3.5 opacity-60",
|
|
27
|
+
"aria-hidden": !0
|
|
28
|
+
})
|
|
29
|
+
})]
|
|
30
|
+
}), /* @__PURE__ */ l(o, {
|
|
31
|
+
className: "max-h-64",
|
|
32
|
+
children: t.map((e) => /* @__PURE__ */ l(s, {
|
|
33
|
+
value: String(e.value),
|
|
34
|
+
disabled: e.disabled,
|
|
35
|
+
children: e.label
|
|
36
|
+
}, e.value))
|
|
37
|
+
})]
|
|
38
|
+
});
|
|
47
39
|
}
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
week: "mt-0.5 grid grid-cols-7",
|
|
106
|
-
day: "relative h-9 w-9 p-0 text-center",
|
|
107
|
-
day_button: n(
|
|
108
|
-
"inline-flex h-9 w-9 items-center justify-center rounded-md text-sm hover:bg-background-muted",
|
|
109
|
-
"outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"
|
|
110
|
-
),
|
|
111
|
-
// RDP 9 puts aria-selected / the modifier classes on the <td>, so the
|
|
112
|
-
// button is styled through its cell. `[&_button:hover]` outranks the
|
|
113
|
-
// button's own `hover:` rule so selected days keep the accent on hover.
|
|
114
|
-
selected: n(
|
|
115
|
-
"[&_button]:bg-accent [&_button]:text-on-accent [&_button:hover]:bg-accent-hover",
|
|
116
|
-
"[&_button]:focus-visible:ring-offset-accent-soft"
|
|
117
|
-
),
|
|
118
|
-
today: "[&_button]:border [&_button]:border-border",
|
|
119
|
-
outside: "text-foreground-subtle",
|
|
120
|
-
disabled: "opacity-40 pointer-events-none",
|
|
121
|
-
range_start: "[&_button]:rounded-r-none",
|
|
122
|
-
range_end: "[&_button]:rounded-l-none",
|
|
123
|
-
range_middle: "[&_button]:bg-accent-soft [&_button]:text-foreground [&_button:hover]:bg-accent-soft [&_button]:rounded-none",
|
|
124
|
-
hidden: "invisible",
|
|
125
|
-
...r
|
|
126
|
-
},
|
|
127
|
-
components: {
|
|
128
|
-
Dropdown: S,
|
|
129
|
-
Chevron: ({ orientation: a }) => a === "left" ? /* @__PURE__ */ t(y, { className: "size-4" }) : a === "right" ? /* @__PURE__ */ t(N, { className: "size-4" }) : /* @__PURE__ */ t(g, { className: "size-3.5 opacity-60" })
|
|
130
|
-
},
|
|
131
|
-
...v
|
|
132
|
-
}
|
|
133
|
-
);
|
|
40
|
+
var g = e("pointer-events-auto inline-flex h-7 w-7 items-center justify-center rounded-md text-foreground-muted hover:bg-background-muted", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background", "disabled:opacity-40 disabled:pointer-events-none");
|
|
41
|
+
function _({ className: a, classNames: o, captionLayout: s = "dropdown", startMonth: u, endMonth: f, labels: p, weekStartsOn: _ = 1, ...v }) {
|
|
42
|
+
let y = t(), { start: b, end: x } = c(() => {
|
|
43
|
+
let e = /* @__PURE__ */ new Date();
|
|
44
|
+
return {
|
|
45
|
+
start: u ?? new Date(e.getFullYear() - 100, 0, 1),
|
|
46
|
+
end: f ?? new Date(e.getFullYear() + 10, 11, 31)
|
|
47
|
+
};
|
|
48
|
+
}, [u, f]);
|
|
49
|
+
return /* @__PURE__ */ l(d, {
|
|
50
|
+
showOutsideDays: !0,
|
|
51
|
+
weekStartsOn: _,
|
|
52
|
+
captionLayout: s,
|
|
53
|
+
startMonth: b,
|
|
54
|
+
endMonth: x,
|
|
55
|
+
className: e("border-border bg-card inline-block rounded-lg border p-3", a),
|
|
56
|
+
labels: {
|
|
57
|
+
labelPrevious: () => y.calendar.previous,
|
|
58
|
+
labelNext: () => y.calendar.next,
|
|
59
|
+
labelMonthDropdown: () => y.calendar.chooseMonth,
|
|
60
|
+
labelYearDropdown: () => y.calendar.chooseYear,
|
|
61
|
+
labelNav: () => y.calendar.nav,
|
|
62
|
+
...p
|
|
63
|
+
},
|
|
64
|
+
classNames: {
|
|
65
|
+
...m,
|
|
66
|
+
root: e(m.root, "relative"),
|
|
67
|
+
months: "relative flex flex-col gap-4 sm:flex-row sm:gap-6",
|
|
68
|
+
month: "flex flex-col gap-3",
|
|
69
|
+
month_caption: "relative flex h-8 items-center justify-center px-8",
|
|
70
|
+
dropdowns: "flex items-center justify-center gap-2",
|
|
71
|
+
caption_label: "flex items-center gap-1 text-sm font-medium",
|
|
72
|
+
nav: "pointer-events-none absolute inset-x-0 top-0 z-10 flex h-8 items-center justify-between",
|
|
73
|
+
button_previous: g,
|
|
74
|
+
button_next: g,
|
|
75
|
+
month_grid: "w-full border-collapse",
|
|
76
|
+
weekdays: "grid grid-cols-7",
|
|
77
|
+
weekday: "h-8 w-9 text-center text-xs font-medium uppercase tracking-wide text-foreground-subtle",
|
|
78
|
+
week: "mt-0.5 grid grid-cols-7",
|
|
79
|
+
day: "relative h-9 w-9 p-0 text-center",
|
|
80
|
+
day_button: e("inline-flex h-9 w-9 items-center justify-center rounded-md text-sm hover:bg-background-muted", "outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background"),
|
|
81
|
+
selected: e("[&_button]:bg-accent [&_button]:text-on-accent [&_button:hover]:bg-accent-hover", "[&_button]:focus-visible:ring-offset-accent-soft"),
|
|
82
|
+
today: "[&_button]:border [&_button]:border-border",
|
|
83
|
+
outside: "text-foreground-subtle",
|
|
84
|
+
disabled: "opacity-40 pointer-events-none",
|
|
85
|
+
range_start: "[&_button]:rounded-r-none",
|
|
86
|
+
range_end: "[&_button]:rounded-l-none",
|
|
87
|
+
range_middle: "[&_button]:bg-accent-soft [&_button]:text-foreground [&_button:hover]:bg-accent-soft [&_button]:rounded-none",
|
|
88
|
+
hidden: "invisible",
|
|
89
|
+
...o
|
|
90
|
+
},
|
|
91
|
+
components: {
|
|
92
|
+
Dropdown: h,
|
|
93
|
+
Chevron: ({ orientation: e }) => e === "left" ? /* @__PURE__ */ l(r, { className: "size-4" }) : e === "right" ? /* @__PURE__ */ l(i, { className: "size-4" }) : /* @__PURE__ */ l(n, { className: "size-3.5 opacity-60" })
|
|
94
|
+
},
|
|
95
|
+
...v
|
|
96
|
+
});
|
|
134
97
|
}
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
//# sourceMappingURL=Calendar.js.map
|
|
98
|
+
_.displayName = "Calendar";
|
|
99
|
+
//#endregion
|
|
100
|
+
export { _ as Calendar };
|
|
101
|
+
|
|
102
|
+
//# sourceMappingURL=Calendar.js.map
|