@ponti-studios/ui 2.0.1 → 3.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/README.md +36 -3
- package/dist/auth/index.d.ts +3 -0
- package/dist/auth/index.js +3 -0
- package/dist/components/data-display/accordion.d.ts +10 -0
- package/dist/components/data-display/accordion.js +53 -0
- package/{src/components/data-display/index.ts → dist/components/data-display/index.d.ts} +1 -10
- package/dist/components/data-display/index.js +8 -0
- package/dist/components/data-display/metric-card.d.ts +9 -0
- package/dist/components/data-display/metric-card.js +25 -0
- package/dist/components/data-display/sort-controls.d.ts +13 -0
- package/dist/components/data-display/sort-controls.js +57 -0
- package/dist/components/data-display/sort-row.d.ts +10 -0
- package/dist/components/data-display/sort-row.js +52 -0
- package/dist/components/data-display/table.d.ts +10 -0
- package/dist/components/data-display/table.js +57 -0
- package/dist/components/feedback/alert.d.ts +9 -0
- package/dist/components/feedback/alert.js +38 -0
- package/dist/components/feedback/empty-state.d.ts +18 -0
- package/dist/components/feedback/empty-state.js +36 -0
- package/{src/components/feedback/index.ts → dist/components/feedback/index.d.ts} +2 -0
- package/dist/components/feedback/index.js +7 -0
- package/dist/components/feedback/progress.d.ts +6 -0
- package/dist/components/feedback/progress.js +25 -0
- package/dist/components/feedback/skeleton.d.ts +2 -0
- package/dist/components/feedback/skeleton.js +11 -0
- package/dist/components/feedback/spinner.d.ts +14 -0
- package/dist/components/feedback/spinner.js +27 -0
- package/dist/components/feedback/update-guard.d.ts +13 -0
- package/dist/components/feedback/update-guard.js +38 -0
- package/dist/components/filters/active-filters-bar.d.ts +14 -0
- package/dist/components/filters/active-filters-bar.js +44 -0
- package/dist/components/filters/filter-chip.d.ts +11 -0
- package/dist/components/filters/filter-chip.js +33 -0
- package/dist/components/filters/filter-select.d.ts +17 -0
- package/dist/components/filters/filter-select.js +46 -0
- package/dist/components/filters/index.js +4 -0
- package/dist/components/forms/checkbox.d.ts +4 -0
- package/dist/components/forms/checkbox.js +24 -0
- package/dist/components/forms/date-month-select.d.ts +11 -0
- package/dist/components/forms/date-month-select.js +47 -0
- package/dist/components/forms/date-picker.d.ts +60 -0
- package/dist/components/forms/date-picker.js +193 -0
- package/dist/components/forms/date-utils.d.ts +14 -0
- package/dist/components/forms/date-utils.js +18 -0
- package/dist/components/forms/drop-zone.d.ts +42 -0
- package/dist/components/forms/drop-zone.js +184 -0
- package/{src/components/forms/index.ts → dist/components/forms/index.d.ts} +3 -9
- package/dist/components/forms/index.js +17 -0
- package/dist/components/forms/input.d.ts +3 -0
- package/dist/components/forms/input.js +15 -0
- package/dist/components/forms/label.d.ts +3 -0
- package/dist/components/forms/label.js +14 -0
- package/dist/components/forms/passkey-management.d.ts +14 -0
- package/dist/components/forms/passkey-management.js +132 -0
- package/dist/components/forms/radio-group.d.ts +6 -0
- package/dist/components/forms/radio-group.js +28 -0
- package/dist/components/forms/select.d.ts +18 -0
- package/dist/components/forms/select.js +103 -0
- package/dist/components/forms/slider.d.ts +9 -0
- package/dist/components/forms/slider.js +25 -0
- package/dist/components/forms/stepper.d.ts +15 -0
- package/dist/components/forms/stepper.js +41 -0
- package/dist/components/forms/switch.d.ts +6 -0
- package/dist/components/forms/switch.js +21 -0
- package/dist/components/forms/text-field.d.ts +15 -0
- package/dist/components/forms/text-field.js +46 -0
- package/dist/components/forms/text-field.types.d.ts +8 -0
- package/dist/components/forms/textarea.d.ts +3 -0
- package/dist/components/forms/textarea.js +14 -0
- package/dist/components/layout/index.js +5 -0
- package/dist/components/layout/particle-background.d.ts +19 -0
- package/dist/components/layout/particle-background.js +171 -0
- package/dist/components/layout/scroll-area.d.ts +9 -0
- package/dist/components/layout/scroll-area.js +35 -0
- package/dist/components/layout/section-intro.d.ts +12 -0
- package/dist/components/layout/section-intro.js +28 -0
- package/dist/components/layout/surface-panel.d.ts +7 -0
- package/dist/components/layout/surface-panel.js +11 -0
- package/dist/components/navigation/app-navigation.d.ts +67 -0
- package/dist/components/navigation/app-navigation.js +106 -0
- package/{src/components/navigation/index.ts → dist/components/navigation/index.d.ts} +1 -7
- package/dist/components/navigation/index.js +4 -0
- package/dist/components/navigation/pagination-controls.d.ts +7 -0
- package/dist/components/navigation/pagination-controls.js +50 -0
- package/dist/components/navigation/tabs.d.ts +7 -0
- package/dist/components/navigation/tabs.js +35 -0
- package/dist/components/overlays/bottom-sheet.d.ts +20 -0
- package/dist/components/overlays/bottom-sheet.js +101 -0
- package/dist/components/overlays/command.d.ts +29 -0
- package/dist/components/overlays/command.js +123 -0
- package/dist/components/overlays/dialog.d.ts +30 -0
- package/dist/components/overlays/dialog.js +105 -0
- package/dist/components/overlays/dropdown-menu.d.ts +29 -0
- package/dist/components/overlays/dropdown-menu.js +128 -0
- package/dist/components/overlays/index.d.ts +7 -0
- package/dist/components/overlays/index.js +8 -0
- package/dist/components/overlays/popover.d.ts +14 -0
- package/dist/components/overlays/popover.js +56 -0
- package/dist/components/overlays/sheet.d.ts +27 -0
- package/dist/components/overlays/sheet.js +81 -0
- package/dist/components/overlays/tooltip.d.ts +10 -0
- package/dist/components/overlays/tooltip.js +23 -0
- package/dist/components/primitives/avatar.d.ts +14 -0
- package/dist/components/primitives/avatar.js +72 -0
- package/dist/components/primitives/badge.d.ts +7 -0
- package/dist/components/primitives/badge.js +27 -0
- package/dist/components/primitives/button.d.ts +13 -0
- package/dist/components/primitives/button.js +113 -0
- package/{src/components/primitives/button.types.ts → dist/components/primitives/button.types.d.ts} +4 -6
- package/dist/components/primitives/card.d.ts +9 -0
- package/dist/components/primitives/card.js +56 -0
- package/{src/components/primitives/index.ts → dist/components/primitives/index.d.ts} +1 -9
- package/dist/components/primitives/index.js +7 -0
- package/dist/components/primitives/segmented-control.d.ts +20 -0
- package/dist/components/primitives/segmented-control.js +27 -0
- package/dist/components/primitives/separator.d.ts +4 -0
- package/dist/components/primitives/separator.js +16 -0
- package/dist/constants/chart-colors.d.ts +33 -0
- package/dist/constants/chart-colors.js +31 -0
- package/dist/hooks/index.js +9 -0
- package/{src/hooks/sort.types.ts → dist/hooks/sort.types.d.ts} +2 -4
- package/dist/hooks/use-api-client.d.ts +30 -0
- package/dist/hooks/use-api-client.js +106 -0
- package/dist/hooks/use-debounced-value.d.ts +1 -0
- package/dist/hooks/use-debounced-value.js +12 -0
- package/dist/hooks/use-derived-filter-state.d.ts +20 -0
- package/dist/hooks/use-derived-filter-state.js +39 -0
- package/dist/hooks/use-filter-state.d.ts +12 -0
- package/dist/hooks/use-filter-state.js +37 -0
- package/dist/hooks/use-media-query.d.ts +6 -0
- package/dist/hooks/use-media-query.js +27 -0
- package/dist/hooks/use-mobile.d.ts +1 -0
- package/dist/hooks/use-mobile.js +14 -0
- package/dist/hooks/use-sort.d.ts +11 -0
- package/dist/hooks/use-sort.js +14 -0
- package/{src/index.ts → dist/index.d.ts} +4 -32
- package/dist/index.js +15 -0
- package/dist/integrations/service-worker.d.ts +2 -0
- package/dist/integrations/service-worker.js +2 -0
- package/dist/lib/auth.d.ts +2 -0
- package/dist/lib/auth.js +7 -0
- package/dist/lib/clipboard.d.ts +1 -0
- package/dist/lib/clipboard.js +10 -0
- package/dist/lib/index.js +4 -0
- package/{src/lib/slot.tsx → dist/lib/slot.d.ts} +2 -15
- package/dist/lib/slot.js +14 -0
- package/dist/lib/utils.d.ts +2 -0
- package/dist/lib/utils.js +8 -0
- package/dist/native/components.d.ts +41 -0
- package/dist/native/components.js +135 -0
- package/dist/native/index.js +3 -0
- package/dist/native/theme.d.ts +19 -0
- package/dist/native/theme.js +58 -0
- package/dist/styles/tokens/css-vars.d.ts +7 -0
- package/dist/styles/tokens/css-vars.js +5 -0
- package/dist/styles/tokens/generated/dark.colors.generated.d.ts +40 -0
- package/dist/styles/tokens/generated/dark.colors.generated.js +39 -0
- package/dist/styles/tokens/generated/foundations.generated.d.ts +323 -0
- package/dist/styles/tokens/generated/foundations.generated.js +453 -0
- package/dist/styles/tokens/generated/light.colors.generated.d.ts +40 -0
- package/dist/styles/tokens/generated/light.colors.generated.js +39 -0
- package/dist/styles/tokens/index.d.ts +317 -0
- package/dist/styles/tokens/index.js +14 -0
- package/dist/styles.css +1 -1
- package/dist/translations/en.d.ts +34 -0
- package/dist/translations/index.d.ts +39 -0
- package/dist/translations/ui-provider.d.ts +9 -0
- package/dist/translations/ui-provider.js +16 -0
- package/dist/types/upload.d.ts +36 -0
- package/package.json +50 -33
- package/src/components/data-display/accordion.stories.tsx +0 -57
- package/src/components/data-display/accordion.tsx +0 -86
- package/src/components/data-display/metric-card.stories.tsx +0 -48
- package/src/components/data-display/metric-card.tsx +0 -20
- package/src/components/data-display/sort-controls.stories.tsx +0 -45
- package/src/components/data-display/sort-controls.tsx +0 -96
- package/src/components/data-display/sort-row.tsx +0 -88
- package/src/components/data-display/table.stories.tsx +0 -75
- package/src/components/data-display/table.tsx +0 -80
- package/src/components/feedback/alert.stories.tsx +0 -51
- package/src/components/feedback/alert.tsx +0 -64
- package/src/components/feedback/empty-state.tsx +0 -76
- package/src/components/feedback/progress.stories.tsx +0 -54
- package/src/components/feedback/progress.tsx +0 -41
- package/src/components/feedback/skeleton.stories.tsx +0 -36
- package/src/components/feedback/skeleton.tsx +0 -7
- package/src/components/feedback/spinner.stories.tsx +0 -52
- package/src/components/feedback/spinner.tsx +0 -47
- package/src/components/feedback/update-guard.stories.tsx +0 -28
- package/src/components/feedback/update-guard.tsx +0 -57
- package/src/components/filters/active-filters-bar.stories.tsx +0 -114
- package/src/components/filters/active-filters-bar.tsx +0 -61
- package/src/components/filters/filter-chip.tsx +0 -57
- package/src/components/filters/filter-select.stories.tsx +0 -71
- package/src/components/filters/filter-select.tsx +0 -68
- package/src/components/forms/checkbox.stories.tsx +0 -35
- package/src/components/forms/checkbox.tsx +0 -38
- package/src/components/forms/date-month-select.stories.tsx +0 -26
- package/src/components/forms/date-month-select.tsx +0 -79
- package/src/components/forms/date-picker.stories.tsx +0 -188
- package/src/components/forms/date-picker.tsx +0 -303
- package/src/components/forms/date-utils.ts +0 -37
- package/src/components/forms/drop-zone.stories.tsx +0 -140
- package/src/components/forms/drop-zone.tsx +0 -298
- package/src/components/forms/input.stories.tsx +0 -47
- package/src/components/forms/input.tsx +0 -24
- package/src/components/forms/label.stories.tsx +0 -16
- package/src/components/forms/label.tsx +0 -25
- package/src/components/forms/passkey-management.stories.tsx +0 -85
- package/src/components/forms/passkey-management.tsx +0 -168
- package/src/components/forms/radio-group.stories.tsx +0 -46
- package/src/components/forms/radio-group.tsx +0 -44
- package/src/components/forms/select.stories.tsx +0 -207
- package/src/components/forms/select.tsx +0 -182
- package/src/components/forms/slider.stories.tsx +0 -70
- package/src/components/forms/slider.tsx +0 -50
- package/src/components/forms/stepper.stories.tsx +0 -111
- package/src/components/forms/stepper.tsx +0 -66
- package/src/components/forms/switch.stories.tsx +0 -144
- package/src/components/forms/switch.tsx +0 -39
- package/src/components/forms/text-field.stories.tsx +0 -87
- package/src/components/forms/text-field.tsx +0 -75
- package/src/components/forms/text-field.types.ts +0 -9
- package/src/components/forms/textarea.stories.tsx +0 -150
- package/src/components/forms/textarea.tsx +0 -22
- package/src/components/layout/particle-background.stories.tsx +0 -38
- package/src/components/layout/particle-background.tsx +0 -378
- package/src/components/layout/scroll-area.stories.tsx +0 -91
- package/src/components/layout/scroll-area.tsx +0 -79
- package/src/components/layout/section-intro.stories.tsx +0 -29
- package/src/components/layout/section-intro.tsx +0 -31
- package/src/components/layout/surface-panel.stories.tsx +0 -32
- package/src/components/layout/surface-panel.tsx +0 -23
- package/src/components/navigation/app-navigation.stories.tsx +0 -217
- package/src/components/navigation/app-navigation.tsx +0 -234
- package/src/components/navigation/pagination-controls.stories.tsx +0 -41
- package/src/components/navigation/pagination-controls.tsx +0 -46
- package/src/components/navigation/tabs.stories.tsx +0 -48
- package/src/components/navigation/tabs.tsx +0 -52
- package/src/components/overlays/bottom-sheet.stories.tsx +0 -52
- package/src/components/overlays/bottom-sheet.tsx +0 -179
- package/src/components/overlays/command.stories.tsx +0 -65
- package/src/components/overlays/command.tsx +0 -227
- package/src/components/overlays/dialog.stories.tsx +0 -148
- package/src/components/overlays/dialog.tsx +0 -203
- package/src/components/overlays/dropdown-menu.stories.tsx +0 -74
- package/src/components/overlays/dropdown-menu.tsx +0 -236
- package/src/components/overlays/index.ts +0 -56
- package/src/components/overlays/popover.stories.tsx +0 -51
- package/src/components/overlays/popover.tsx +0 -78
- package/src/components/overlays/sheet.stories.tsx +0 -68
- package/src/components/overlays/sheet.tsx +0 -155
- package/src/components/overlays/tooltip.stories.tsx +0 -29
- package/src/components/overlays/tooltip.tsx +0 -41
- package/src/components/primitives/avatar-placeholder.svg +0 -13
- package/src/components/primitives/avatar.stories.tsx +0 -72
- package/src/components/primitives/avatar.tsx +0 -136
- package/src/components/primitives/badge.stories.tsx +0 -43
- package/src/components/primitives/badge.tsx +0 -43
- package/src/components/primitives/button.stories.tsx +0 -113
- package/src/components/primitives/button.tsx +0 -131
- package/src/components/primitives/card.stories.tsx +0 -59
- package/src/components/primitives/card.tsx +0 -66
- package/src/components/primitives/segmented-control.stories.tsx +0 -54
- package/src/components/primitives/segmented-control.tsx +0 -73
- package/src/components/primitives/separator.stories.tsx +0 -34
- package/src/components/primitives/separator.tsx +0 -27
- package/src/constants/chart-colors.ts +0 -39
- package/src/env.d.ts +0 -9
- package/src/hooks/use-api-client.ts +0 -122
- package/src/hooks/use-debounced-value.ts +0 -12
- package/src/hooks/use-derived-filter-state.ts +0 -70
- package/src/hooks/use-filter-state.ts +0 -66
- package/src/hooks/use-media-query.ts +0 -69
- package/src/hooks/use-mobile.tsx +0 -19
- package/src/hooks/use-sort.ts +0 -20
- package/src/lib/auth.ts +0 -5
- package/src/lib/clipboard.ts +0 -8
- package/src/lib/utils.ts +0 -6
- package/src/native/components.tsx +0 -198
- package/src/native/theme.tsx +0 -69
- package/src/storybook/controls.ts +0 -117
- package/src/storybook/options.ts +0 -52
- package/src/styles/build.ts +0 -1
- package/src/styles/index.css +0 -423
- package/src/styles/nokia.css +0 -36
- package/src/styles/package.css +0 -3
- package/src/styles/tokens/chart-colors.stories.tsx +0 -189
- package/src/styles/tokens/color-systems.stories.tsx +0 -190
- package/src/styles/tokens/css-vars.ts +0 -15
- package/src/styles/tokens/generated/dark-class.css +0 -39
- package/src/styles/tokens/generated/dark.colors.generated.ts +0 -39
- package/src/styles/tokens/generated/dark.css +0 -39
- package/src/styles/tokens/generated/foundations.css +0 -149
- package/src/styles/tokens/generated/foundations.generated.ts +0 -454
- package/src/styles/tokens/generated/light.colors.generated.ts +0 -39
- package/src/styles/tokens/generated/light.css +0 -39
- package/src/styles/tokens/index.ts +0 -70
- package/src/styles/tokens/layout.stories.tsx +0 -50
- package/src/styles/tokens/scripts/check-foundations.mjs +0 -126
- package/src/styles/tokens/scripts/check-source.mjs +0 -53
- package/src/styles/tokens/source/dark.tokens.json +0 -138
- package/src/styles/tokens/source/foundations.tokens.json +0 -344
- package/src/styles/tokens/source/light.tokens.json +0 -138
- package/src/styles/tokens/style-dictionary.dark-class.json +0 -16
- package/src/styles/tokens/style-dictionary.dark-storybook.json +0 -16
- package/src/styles/tokens/style-dictionary.dark.json +0 -21
- package/src/styles/tokens/style-dictionary.foundations.json +0 -21
- package/src/styles/tokens/style-dictionary.light-storybook.json +0 -16
- package/src/styles/tokens/style-dictionary.light.json +0 -21
- package/src/styles/tokens/typography.stories.tsx +0 -157
- package/src/translations/en.ts +0 -34
- package/src/translations/index.ts +0 -32
- package/src/types/upload.ts +0 -42
- /package/{src/components/filters/index.ts → dist/components/filters/index.d.ts} +0 -0
- /package/{src/components/layout/index.ts → dist/components/layout/index.d.ts} +0 -0
- /package/{src/hooks/index.ts → dist/hooks/index.d.ts} +0 -0
- /package/{src/lib/index.ts → dist/lib/index.d.ts} +0 -0
- /package/{src/native/index.ts → dist/native/index.d.ts} +0 -0
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import { Button as t } from "../primitives/button.js";
|
|
4
|
+
import { Progress as n } from "../feedback/progress.js";
|
|
5
|
+
import { useCallback as r, useId as i, useRef as a, useState as o } from "react";
|
|
6
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
import { FileIcon as u, UploadIcon as d, XIcon as f } from "lucide-react";
|
|
8
|
+
//#region src/components/forms/drop-zone.tsx
|
|
9
|
+
function p(e) {
|
|
10
|
+
return e < 1024 ? `${e} B` : e < 1024 * 1024 ? `${(e / 1024).toFixed(1)} KB` : `${(e / (1024 * 1024)).toFixed(2)} MB`;
|
|
11
|
+
}
|
|
12
|
+
function m({ status: m, file: h = null, error: g = null, notice: _ = null, accept: v, multiple: y = !1, disabled: b = !1, className: x, emptyLabel: S = /* @__PURE__ */ l(s, { children: ["Drop a file here, or ", /* @__PURE__ */ c("span", {
|
|
13
|
+
className: "text-accent-text font-medium",
|
|
14
|
+
children: "browse"
|
|
15
|
+
})] }), emptyHint: C, draggingLabel: w = "Release to attach", busyLabel: T = "Processing…", busyDescription: E, submitLabel: D = "Upload", retryLabel: O = "Try again", clearLabel: k = "Use a different file", cancelLabel: A = "Cancel", failedActions: j, onFiles: M, onSubmit: N, onClear: P, onCancel: F, onRetry: I }) {
|
|
16
|
+
let L = i(), R = a(null), z = a(null), [B, V] = o(!1), H = m === "busy", U = !b && !H, W = r(() => {
|
|
17
|
+
U && R.current?.click();
|
|
18
|
+
}, [U]), G = r((e) => {
|
|
19
|
+
if (!e || !U) return;
|
|
20
|
+
let t = Array.from(e);
|
|
21
|
+
t.length !== 0 && M(t);
|
|
22
|
+
}, [U, M]), K = (e) => {
|
|
23
|
+
e.preventDefault(), e.stopPropagation(), U && V(!0);
|
|
24
|
+
}, q = (e) => {
|
|
25
|
+
e.preventDefault(), e.stopPropagation(), e.dataTransfer && (e.dataTransfer.dropEffect = "copy");
|
|
26
|
+
}, J = (e) => {
|
|
27
|
+
e.preventDefault(), e.stopPropagation();
|
|
28
|
+
let t = e.relatedTarget;
|
|
29
|
+
t instanceof Node && z.current?.contains(t) || V(!1);
|
|
30
|
+
}, Y = (e) => {
|
|
31
|
+
e.preventDefault(), e.stopPropagation(), V(!1), U && G(e.dataTransfer.files);
|
|
32
|
+
}, X = (e) => {
|
|
33
|
+
G(e.target.files), e.target.value = "";
|
|
34
|
+
}, Z = (e) => {
|
|
35
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), W());
|
|
36
|
+
}, Q = B && U, $ = e(Q && "border-ring bg-primary/5", m === "failed" && !Q && "border-destructive bg-destructive/5", m === "busy" && "border-border bg-muted/30", m !== "failed" && m !== "busy" && !Q && "border-border bg-card");
|
|
37
|
+
return /* @__PURE__ */ l("div", {
|
|
38
|
+
className: e("w-full space-y-3", x),
|
|
39
|
+
children: [
|
|
40
|
+
/* @__PURE__ */ c("input", {
|
|
41
|
+
ref: R,
|
|
42
|
+
id: L,
|
|
43
|
+
type: "file",
|
|
44
|
+
accept: v,
|
|
45
|
+
multiple: y,
|
|
46
|
+
disabled: !U,
|
|
47
|
+
className: "pointer-events-none sr-only",
|
|
48
|
+
onChange: X,
|
|
49
|
+
tabIndex: -1,
|
|
50
|
+
"aria-hidden": !0
|
|
51
|
+
}),
|
|
52
|
+
/* @__PURE__ */ c("div", {
|
|
53
|
+
ref: z,
|
|
54
|
+
role: "button",
|
|
55
|
+
tabIndex: U ? 0 : -1,
|
|
56
|
+
"aria-disabled": !U,
|
|
57
|
+
"aria-busy": H,
|
|
58
|
+
"aria-label": "File upload drop zone",
|
|
59
|
+
className: e("relative flex min-h-44 w-full flex-col items-center justify-center overflow-hidden rounded-2xl border border-dashed p-6 text-center outline-none", "focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2", "motion-safe:transition-[transform,opacity] motion-safe:duration-200 motion-safe:ease-in-out motion-reduce:transition-none", U ? "cursor-pointer" : "cursor-default", Q ? "scale-[1.01] motion-reduce:scale-100" : "scale-100", $),
|
|
60
|
+
onClick: U ? W : void 0,
|
|
61
|
+
onKeyDown: U ? Z : void 0,
|
|
62
|
+
onDragEnter: K,
|
|
63
|
+
onDragOver: q,
|
|
64
|
+
onDragLeave: J,
|
|
65
|
+
onDrop: Y,
|
|
66
|
+
children: /* @__PURE__ */ l("div", {
|
|
67
|
+
className: "flex w-full max-w-sm flex-col items-center gap-3",
|
|
68
|
+
children: [
|
|
69
|
+
Q ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(d, {
|
|
70
|
+
className: "text-accent-text size-8 motion-safe:transition-[transform,opacity] motion-safe:duration-200 motion-safe:ease-in-out motion-reduce:transition-none motion-safe:-translate-y-0.5 motion-reduce:translate-y-0",
|
|
71
|
+
"aria-hidden": !0
|
|
72
|
+
}), /* @__PURE__ */ c("p", {
|
|
73
|
+
className: "body-3 text-foreground",
|
|
74
|
+
children: w
|
|
75
|
+
})] }) : null,
|
|
76
|
+
!Q && m === "empty" ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(d, {
|
|
77
|
+
className: "size-8 text-muted-foreground",
|
|
78
|
+
"aria-hidden": !0
|
|
79
|
+
}), /* @__PURE__ */ l("div", {
|
|
80
|
+
className: "space-y-1",
|
|
81
|
+
children: [/* @__PURE__ */ c("p", {
|
|
82
|
+
className: "body-3 text-foreground",
|
|
83
|
+
children: S
|
|
84
|
+
}), C ? /* @__PURE__ */ c("p", {
|
|
85
|
+
className: "body-4 text-muted-foreground",
|
|
86
|
+
children: C
|
|
87
|
+
}) : null]
|
|
88
|
+
})] }) : null,
|
|
89
|
+
!Q && m === "armed" && h ? /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(u, {
|
|
90
|
+
className: "size-8 text-muted-foreground",
|
|
91
|
+
"aria-hidden": !0
|
|
92
|
+
}), /* @__PURE__ */ l("div", {
|
|
93
|
+
className: "min-w-0 max-w-full space-y-1",
|
|
94
|
+
children: [/* @__PURE__ */ c("p", {
|
|
95
|
+
className: "subheading-4 truncate text-foreground",
|
|
96
|
+
children: h.name
|
|
97
|
+
}), /* @__PURE__ */ c("p", {
|
|
98
|
+
className: "body-4 text-muted-foreground",
|
|
99
|
+
children: p(h.size)
|
|
100
|
+
})]
|
|
101
|
+
})] }) : null,
|
|
102
|
+
!Q && m === "busy" ? /* @__PURE__ */ l("div", {
|
|
103
|
+
className: "w-full space-y-3",
|
|
104
|
+
children: [/* @__PURE__ */ l("div", {
|
|
105
|
+
className: "space-y-1",
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ c("p", {
|
|
108
|
+
className: "subheading-4 text-foreground",
|
|
109
|
+
children: T
|
|
110
|
+
}),
|
|
111
|
+
E ? /* @__PURE__ */ c("p", {
|
|
112
|
+
className: "body-4 text-muted-foreground",
|
|
113
|
+
children: E
|
|
114
|
+
}) : null,
|
|
115
|
+
h ? /* @__PURE__ */ c("p", {
|
|
116
|
+
className: "body-4 truncate text-muted-foreground",
|
|
117
|
+
children: h.name
|
|
118
|
+
}) : null
|
|
119
|
+
]
|
|
120
|
+
}), /* @__PURE__ */ c(n, {
|
|
121
|
+
className: "h-1.5 opacity-80 motion-safe:animate-pulse",
|
|
122
|
+
"aria-label": typeof T == "string" ? T : "Processing",
|
|
123
|
+
value: 50
|
|
124
|
+
})]
|
|
125
|
+
}) : null,
|
|
126
|
+
!Q && m === "failed" ? /* @__PURE__ */ l("div", {
|
|
127
|
+
className: "w-full space-y-2",
|
|
128
|
+
children: [
|
|
129
|
+
h ? /* @__PURE__ */ c("p", {
|
|
130
|
+
className: "subheading-4 truncate text-foreground",
|
|
131
|
+
children: h.name
|
|
132
|
+
}) : null,
|
|
133
|
+
g ? /* @__PURE__ */ c("p", {
|
|
134
|
+
className: "body-3 text-destructive-text",
|
|
135
|
+
children: g
|
|
136
|
+
}) : null,
|
|
137
|
+
j
|
|
138
|
+
]
|
|
139
|
+
}) : null
|
|
140
|
+
]
|
|
141
|
+
})
|
|
142
|
+
}),
|
|
143
|
+
_ ? /* @__PURE__ */ c("p", {
|
|
144
|
+
className: "body-4 text-muted-foreground",
|
|
145
|
+
children: _
|
|
146
|
+
}) : null,
|
|
147
|
+
/* @__PURE__ */ l("div", {
|
|
148
|
+
className: "grid gap-2",
|
|
149
|
+
children: [
|
|
150
|
+
m === "armed" && N ? /* @__PURE__ */ l(t, {
|
|
151
|
+
type: "button",
|
|
152
|
+
className: "w-full",
|
|
153
|
+
onClick: N,
|
|
154
|
+
children: [/* @__PURE__ */ c(d, { className: "size-4" }), D]
|
|
155
|
+
}) : null,
|
|
156
|
+
m === "failed" && I ? /* @__PURE__ */ c(t, {
|
|
157
|
+
type: "button",
|
|
158
|
+
className: "w-full",
|
|
159
|
+
onClick: I,
|
|
160
|
+
children: O
|
|
161
|
+
}) : null,
|
|
162
|
+
m === "busy" && F ? /* @__PURE__ */ l(t, {
|
|
163
|
+
type: "button",
|
|
164
|
+
variant: "outline",
|
|
165
|
+
className: "w-full",
|
|
166
|
+
onClick: F,
|
|
167
|
+
children: [/* @__PURE__ */ c(f, { className: "size-4" }), A]
|
|
168
|
+
}) : null,
|
|
169
|
+
(m === "armed" || m === "failed") && P ? /* @__PURE__ */ c(t, {
|
|
170
|
+
type: "button",
|
|
171
|
+
variant: "ghost",
|
|
172
|
+
className: "w-full",
|
|
173
|
+
onClick: (e) => {
|
|
174
|
+
e.stopPropagation(), P();
|
|
175
|
+
},
|
|
176
|
+
children: k
|
|
177
|
+
}) : null
|
|
178
|
+
]
|
|
179
|
+
})
|
|
180
|
+
]
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
//#endregion
|
|
184
|
+
export { m as DropZone };
|
|
@@ -10,18 +10,12 @@ export { DropZone } from "./drop-zone";
|
|
|
10
10
|
export type { DropZoneProps } from "./drop-zone";
|
|
11
11
|
export { Input } from "./input";
|
|
12
12
|
export { Label } from "./label";
|
|
13
|
+
/** @deprecated Import from `@ponti-studios/ui/auth` instead. */
|
|
13
14
|
export { PasskeyManagement } from "./passkey-management";
|
|
15
|
+
/** @deprecated Import from `@ponti-studios/ui/auth` instead. */
|
|
14
16
|
export type { PasskeyManagementProps, PasskeyRecord } from "./passkey-management";
|
|
15
17
|
export { RadioGroup, RadioGroupItem } from "./radio-group";
|
|
16
|
-
export {
|
|
17
|
-
Select,
|
|
18
|
-
SelectContent,
|
|
19
|
-
SelectGroup,
|
|
20
|
-
SelectItem,
|
|
21
|
-
SelectLabel,
|
|
22
|
-
SelectTrigger,
|
|
23
|
-
SelectValue,
|
|
24
|
-
} from "./select";
|
|
18
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue, } from "./select";
|
|
25
19
|
export { Slider } from "./slider";
|
|
26
20
|
export { Stepper } from "./stepper";
|
|
27
21
|
export type { StepperProps } from "./stepper";
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Select as e, SelectContent as t, SelectGroup as n, SelectItem as r, SelectLabel as i, SelectTrigger as a, SelectValue as o } from "./select.js";
|
|
2
|
+
import { FilterSelect as s } from "../filters/filter-select.js";
|
|
3
|
+
import { Checkbox as c } from "./checkbox.js";
|
|
4
|
+
import { formatDateInput as l, parseDateInput as u, todayDateInput as d } from "./date-utils.js";
|
|
5
|
+
import { DatePicker as f } from "./date-picker.js";
|
|
6
|
+
import { DateMonthSelect as p, getCurrentMonthYear as m } from "./date-month-select.js";
|
|
7
|
+
import { DropZone as h } from "./drop-zone.js";
|
|
8
|
+
import { Input as g } from "./input.js";
|
|
9
|
+
import { Label as _ } from "./label.js";
|
|
10
|
+
import { PasskeyManagement as v } from "./passkey-management.js";
|
|
11
|
+
import { RadioGroup as y, RadioGroupItem as b } from "./radio-group.js";
|
|
12
|
+
import { Slider as x } from "./slider.js";
|
|
13
|
+
import { Stepper as S } from "./stepper.js";
|
|
14
|
+
import { Switch as C } from "./switch.js";
|
|
15
|
+
import { TextField as w } from "./text-field.js";
|
|
16
|
+
import { Textarea as T } from "./textarea.js";
|
|
17
|
+
export { c as Checkbox, p as DateMonthSelect, f as DatePicker, h as DropZone, s as FilterSelect, g as Input, _ as Label, v as PasskeyManagement, y as RadioGroup, b as RadioGroupItem, e as Select, t as SelectContent, n as SelectGroup, r as SelectItem, i as SelectLabel, a as SelectTrigger, o as SelectValue, x as Slider, S as Stepper, C as Switch, w as TextField, T as Textarea, l as formatDateInput, m as getCurrentMonthYear, u as parseDateInput, d as todayDateInput };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/forms/input.tsx
|
|
6
|
+
function n({ className: n, type: r, ...i }) {
|
|
7
|
+
return /* @__PURE__ */ t("input", {
|
|
8
|
+
type: r,
|
|
9
|
+
"data-slot": "input",
|
|
10
|
+
className: e("bg-background text-foreground border-input h-9 w-full min-w-0 rounded-md border px-3 py-1 text-base transition-colors md:text-sm", "file:text-foreground file:inline-flex file:h-7 file:border-0 file:bg-transparent file:text-sm file:font-medium", "placeholder:text-muted-foreground selection:bg-primary selection:text-primary-foreground", "focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none", "disabled:pointer-events-none disabled:cursor-not-allowed disabled:opacity-50", "aria-invalid:ring-destructive/20 aria-invalid:border-destructive", n),
|
|
11
|
+
...i
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { n as Input };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import "react";
|
|
4
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
5
|
+
//#region src/components/forms/label.tsx
|
|
6
|
+
function n({ className: n, ...r }) {
|
|
7
|
+
return /* @__PURE__ */ t("label", {
|
|
8
|
+
"data-slot": "label",
|
|
9
|
+
className: e("text-sm leading-none font-medium select-none", "peer-disabled:cursor-not-allowed peer-disabled:opacity-50", "group-has-disabled:cursor-not-allowed group-has-disabled:opacity-50", n),
|
|
10
|
+
...r
|
|
11
|
+
});
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { n as Label };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export interface PasskeyRecord {
|
|
2
|
+
id: string;
|
|
3
|
+
name?: string;
|
|
4
|
+
createdAt?: string;
|
|
5
|
+
}
|
|
6
|
+
export interface PasskeyManagementProps {
|
|
7
|
+
passkeys?: PasskeyRecord[];
|
|
8
|
+
isLoading?: boolean;
|
|
9
|
+
error?: string | null;
|
|
10
|
+
onAdd: () => Promise<boolean>;
|
|
11
|
+
onDelete: (id: string) => Promise<boolean>;
|
|
12
|
+
}
|
|
13
|
+
/** List, add, and remove passkeys. The host app owns the WebAuthn ceremony via `onAdd`/`onDelete`. */
|
|
14
|
+
export declare function PasskeyManagement({ passkeys: passkeysProp, isLoading, error: externalError, onAdd, onDelete, }: PasskeyManagementProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { Spinner as e } from "../feedback/spinner.js";
|
|
3
|
+
import { Button as t } from "../primitives/button.js";
|
|
4
|
+
import { Card as n, CardHeader as r } from "../primitives/card.js";
|
|
5
|
+
import { useCallback as i, useState as a } from "react";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
import { KeyRound as c, Plus as l, Trash2 as u, X as d } from "lucide-react";
|
|
8
|
+
//#region src/components/forms/passkey-management.tsx
|
|
9
|
+
function f({ passkeys: f, isLoading: p = !1, error: m, onAdd: h, onDelete: g }) {
|
|
10
|
+
let [_, v] = a(!1), [y, b] = a(null), [x, S] = a(null), C = f ?? [], w = m ?? (x?.passkeyId ? null : x?.message), T = i(async () => {
|
|
11
|
+
v(!0), S(null);
|
|
12
|
+
try {
|
|
13
|
+
await h() || S({ message: "Passkey registration was cancelled or failed." });
|
|
14
|
+
} catch {
|
|
15
|
+
S({ message: "An error occurred during passkey registration." });
|
|
16
|
+
} finally {
|
|
17
|
+
v(!1);
|
|
18
|
+
}
|
|
19
|
+
}, [h]), E = i(async (e) => {
|
|
20
|
+
b(e), S(null);
|
|
21
|
+
try {
|
|
22
|
+
if (!await g(e)) throw Error("Failed to delete passkey");
|
|
23
|
+
} catch {
|
|
24
|
+
S({
|
|
25
|
+
message: "Could not delete passkey. Please try again.",
|
|
26
|
+
passkeyId: e
|
|
27
|
+
});
|
|
28
|
+
} finally {
|
|
29
|
+
b(null);
|
|
30
|
+
}
|
|
31
|
+
}, [g]);
|
|
32
|
+
return /* @__PURE__ */ s(n, {
|
|
33
|
+
"aria-labelledby": "passkey-heading",
|
|
34
|
+
className: "gap-0 overflow-hidden w-full",
|
|
35
|
+
children: [
|
|
36
|
+
/* @__PURE__ */ s(r, {
|
|
37
|
+
className: "flex-row items-center border-b p-4",
|
|
38
|
+
children: [/* @__PURE__ */ o("h2", {
|
|
39
|
+
id: "passkey-heading",
|
|
40
|
+
className: "text-foreground text-sm font-medium",
|
|
41
|
+
children: "Passkeys"
|
|
42
|
+
}), /* @__PURE__ */ o(t, {
|
|
43
|
+
type: "button",
|
|
44
|
+
size: "sm",
|
|
45
|
+
onClick: () => void T(),
|
|
46
|
+
isLoading: _,
|
|
47
|
+
loadingLabel: "Adding passkey",
|
|
48
|
+
"aria-label": "Add a passkey",
|
|
49
|
+
className: "ml-auto",
|
|
50
|
+
children: /* @__PURE__ */ o(l, {
|
|
51
|
+
className: "size-4",
|
|
52
|
+
"aria-hidden": !0
|
|
53
|
+
})
|
|
54
|
+
})]
|
|
55
|
+
}),
|
|
56
|
+
w ? /* @__PURE__ */ o("p", {
|
|
57
|
+
role: "alert",
|
|
58
|
+
className: "text-destructive-text border-b px-4 py-3 text-sm",
|
|
59
|
+
children: w
|
|
60
|
+
}) : null,
|
|
61
|
+
p ? /* @__PURE__ */ o(e, {
|
|
62
|
+
presentation: "centered",
|
|
63
|
+
size: "sm",
|
|
64
|
+
label: "Loading passkeys"
|
|
65
|
+
}) : C.length === 0 ? /* @__PURE__ */ s("div", {
|
|
66
|
+
className: "text-muted-foreground flex items-center gap-3 p-4 text-sm",
|
|
67
|
+
children: [/* @__PURE__ */ o(c, {
|
|
68
|
+
className: "size-4 shrink-0",
|
|
69
|
+
"aria-hidden": !0
|
|
70
|
+
}), /* @__PURE__ */ o("span", { children: "No passkeys registered. Add one to sign in faster." })]
|
|
71
|
+
}) : /* @__PURE__ */ o("ul", {
|
|
72
|
+
className: "divide-border divide-y",
|
|
73
|
+
"aria-label": "Registered passkeys",
|
|
74
|
+
children: C.map((t) => {
|
|
75
|
+
let n = x?.passkeyId === t.id ? x.message : null;
|
|
76
|
+
return /* @__PURE__ */ s("li", {
|
|
77
|
+
className: "flex flex-col gap-2 px-4 py-3 text-sm",
|
|
78
|
+
children: [/* @__PURE__ */ s("div", {
|
|
79
|
+
className: "flex items-center justify-between gap-4",
|
|
80
|
+
children: [/* @__PURE__ */ s("div", {
|
|
81
|
+
className: "flex min-w-0 items-center gap-3",
|
|
82
|
+
children: [/* @__PURE__ */ o(c, {
|
|
83
|
+
className: "text-muted-foreground size-4 shrink-0",
|
|
84
|
+
"aria-hidden": !0
|
|
85
|
+
}), /* @__PURE__ */ s("div", {
|
|
86
|
+
className: "min-w-0",
|
|
87
|
+
children: [/* @__PURE__ */ o("span", {
|
|
88
|
+
className: "font-medium",
|
|
89
|
+
children: t.name ?? "Passkey"
|
|
90
|
+
}), t.createdAt ? /* @__PURE__ */ s("span", {
|
|
91
|
+
className: "text-muted-foreground ml-2 text-xs",
|
|
92
|
+
children: ["Added ", new Date(t.createdAt).toLocaleDateString()]
|
|
93
|
+
}) : null]
|
|
94
|
+
})]
|
|
95
|
+
}), /* @__PURE__ */ o("button", {
|
|
96
|
+
type: "button",
|
|
97
|
+
onClick: () => void E(t.id),
|
|
98
|
+
disabled: y === t.id,
|
|
99
|
+
"aria-busy": y === t.id,
|
|
100
|
+
"aria-label": `Remove passkey ${t.name ?? t.id}`,
|
|
101
|
+
className: "hover:text-destructive-text text-muted-foreground focus-visible:ring-ring rounded-sm focus-visible:ring-2 focus-visible:outline-none disabled:opacity-50",
|
|
102
|
+
children: y === t.id ? /* @__PURE__ */ o(e, {
|
|
103
|
+
size: "sm",
|
|
104
|
+
"aria-hidden": !0
|
|
105
|
+
}) : /* @__PURE__ */ o(u, {
|
|
106
|
+
className: "size-4",
|
|
107
|
+
"aria-hidden": !0
|
|
108
|
+
})
|
|
109
|
+
})]
|
|
110
|
+
}), n ? /* @__PURE__ */ s("div", {
|
|
111
|
+
role: "alert",
|
|
112
|
+
className: "bg-destructive/5 text-destructive-text flex items-start justify-between gap-3 rounded-md px-3 py-2 text-sm",
|
|
113
|
+
children: [/* @__PURE__ */ o("span", { children: n }), /* @__PURE__ */ o("button", {
|
|
114
|
+
type: "button",
|
|
115
|
+
onClick: () => S(null),
|
|
116
|
+
"aria-label": "Dismiss passkey error",
|
|
117
|
+
title: "Dismiss error",
|
|
118
|
+
className: "hover:text-destructive focus-visible:ring-ring -m-1 shrink-0 rounded-sm p-1 focus-visible:ring-2 focus-visible:outline-none",
|
|
119
|
+
children: /* @__PURE__ */ o(d, {
|
|
120
|
+
className: "size-4",
|
|
121
|
+
"aria-hidden": !0
|
|
122
|
+
})
|
|
123
|
+
})]
|
|
124
|
+
}) : null]
|
|
125
|
+
}, t.id);
|
|
126
|
+
})
|
|
127
|
+
})
|
|
128
|
+
]
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
//#endregion
|
|
132
|
+
export { f as PasskeyManagement };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Radio as RadioPrimitive } from "@base-ui/react/radio";
|
|
2
|
+
import { RadioGroup as RadioGroupPrimitive } from "@base-ui/react/radio-group";
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
declare const RadioGroup: React.ForwardRefExoticComponent<Omit<RadioGroupPrimitive.Props<unknown>, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
5
|
+
declare const RadioGroupItem: React.ForwardRefExoticComponent<Omit<RadioPrimitive.Root.Props<unknown>, "ref"> & React.RefAttributes<HTMLSpanElement>>;
|
|
6
|
+
export { RadioGroup, RadioGroupItem };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
5
|
+
import { Circle as r } from "lucide-react";
|
|
6
|
+
import { Radio as i } from "@base-ui/react/radio";
|
|
7
|
+
import { RadioGroup as a } from "@base-ui/react/radio-group";
|
|
8
|
+
//#region src/components/forms/radio-group.tsx
|
|
9
|
+
var o = t.forwardRef(({ className: t, ...r }, i) => /* @__PURE__ */ n(a, {
|
|
10
|
+
className: e("grid gap-2", t),
|
|
11
|
+
...r,
|
|
12
|
+
ref: i
|
|
13
|
+
}));
|
|
14
|
+
o.displayName = "RadioGroup";
|
|
15
|
+
var s = t.forwardRef(({ className: t, ...a }, o) => /* @__PURE__ */ n(i.Root, {
|
|
16
|
+
"data-slot": "radio-group-item",
|
|
17
|
+
ref: o,
|
|
18
|
+
className: e("border-ring bg-background flex aspect-square size-6 items-center justify-center rounded-full border", "focus-visible:border-ring focus-visible:bg-muted/25 focus-visible:ring-ring focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none", "disabled:cursor-not-allowed disabled:opacity-50", t),
|
|
19
|
+
...a,
|
|
20
|
+
children: /* @__PURE__ */ n(i.Indicator, {
|
|
21
|
+
keepMounted: !0,
|
|
22
|
+
className: "data-unchecked:opacity-0 data-checked:opacity-100 data-starting-style:animate-fade-in data-ending-style:animate-fade-out",
|
|
23
|
+
children: /* @__PURE__ */ n(r, { className: "fill-ring size-5" })
|
|
24
|
+
})
|
|
25
|
+
}));
|
|
26
|
+
s.displayName = "Radio";
|
|
27
|
+
//#endregion
|
|
28
|
+
export { o as RadioGroup, s as RadioGroupItem };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { Select as SelectPrimitive } from "@base-ui/react/select";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type SelectProps = Omit<React.ComponentProps<typeof SelectPrimitive.Root<string>>, "value" | "defaultValue"> & {
|
|
4
|
+
value?: string | null;
|
|
5
|
+
defaultValue?: string | null;
|
|
6
|
+
};
|
|
7
|
+
declare function Select({ children, items, ...props }: SelectProps): React.JSX.Element;
|
|
8
|
+
declare function SelectGroup({ ...props }: React.ComponentProps<typeof SelectPrimitive.Group>): React.JSX.Element;
|
|
9
|
+
declare function SelectValue({ ...props }: React.ComponentProps<typeof SelectPrimitive.Value>): React.JSX.Element;
|
|
10
|
+
declare function SelectTrigger({ className, size, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Trigger> & {
|
|
11
|
+
size?: "sm" | "default";
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
declare function SelectContent({ className, children, position: _position, ...props }: React.ComponentProps<typeof SelectPrimitive.Popup> & {
|
|
14
|
+
position?: "item-aligned" | "popper";
|
|
15
|
+
}): React.JSX.Element;
|
|
16
|
+
declare function SelectLabel({ className, ...props }: React.ComponentProps<typeof SelectPrimitive.Label>): React.JSX.Element;
|
|
17
|
+
declare function SelectItem({ className, children, ...props }: React.ComponentProps<typeof SelectPrimitive.Item>): React.JSX.Element;
|
|
18
|
+
export { Select, SelectContent, SelectGroup, SelectItem, SelectLabel, SelectTrigger, SelectValue };
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
import { Select as i } from "@base-ui/react/select";
|
|
6
|
+
import { CheckIcon as a, ChevronDownIcon as o, ChevronUpIcon as s } from "lucide-react";
|
|
7
|
+
//#region src/components/forms/select.tsx
|
|
8
|
+
function c({ children: e, items: t, ...r }) {
|
|
9
|
+
let a = t ?? h(e);
|
|
10
|
+
return /* @__PURE__ */ n(i.Root, {
|
|
11
|
+
"data-slot": "select",
|
|
12
|
+
items: a,
|
|
13
|
+
...r,
|
|
14
|
+
children: e
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function l({ ...e }) {
|
|
18
|
+
return /* @__PURE__ */ n(i.Group, {
|
|
19
|
+
"data-slot": "select-group",
|
|
20
|
+
...e
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
function u({ ...e }) {
|
|
24
|
+
return /* @__PURE__ */ n(i.Value, {
|
|
25
|
+
"data-slot": "select-value",
|
|
26
|
+
...e
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
function d({ className: t, size: a = "default", children: s, ...c }) {
|
|
30
|
+
return /* @__PURE__ */ r(i.Trigger, {
|
|
31
|
+
"data-slot": "select-trigger",
|
|
32
|
+
"data-size": a,
|
|
33
|
+
className: e("border-input flex w-fit items-center justify-between gap-2 rounded-md border bg-transparent px-3 py-2 text-sm whitespace-nowrap transition-[color,box-shadow] outline-none", "data-placeholder:text-muted-foreground [&_svg:not([class*='text-'])]:text-muted-foreground", "focus-visible:border-ring focus-visible:ring-ring/50 focus-visible:ring-[3px] focus-visible:ring-inset", "aria-invalid:ring-destructive/20 aria-invalid:border-destructive", "disabled:cursor-not-allowed disabled:opacity-50", "data-[size=default]:h-9 data-[size=sm]:h-8", "*:data-[slot=select-value]:line-clamp-1 *:data-[slot=select-value]:flex *:data-[slot=select-value]:items-center *:data-[slot=select-value]:gap-2", "[&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", t),
|
|
34
|
+
...c,
|
|
35
|
+
children: [s, /* @__PURE__ */ n(i.Icon, { children: /* @__PURE__ */ n(o, { className: "size-4 opacity-50" }) })]
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
function f({ className: t, children: a, position: o = "popper", ...s }) {
|
|
39
|
+
return /* @__PURE__ */ r(i.Portal, { children: [/* @__PURE__ */ n(i.Backdrop, { className: "ui-mobile-sheet-backdrop" }), /* @__PURE__ */ n(i.Positioner, {
|
|
40
|
+
className: "ui-mobile-sheet-positioner",
|
|
41
|
+
alignItemWithTrigger: o === "item-aligned",
|
|
42
|
+
sideOffset: 4,
|
|
43
|
+
children: /* @__PURE__ */ r(i.Popup, {
|
|
44
|
+
"data-slot": "select-content",
|
|
45
|
+
className: e("bg-popover text-popover-foreground data-open:animate-in data-closed:animate-out data-closed:zoom-out-95 data-open:zoom-in-95 relative z-50 max-h-(--available-height) min-w-(--anchor-width) origin-(--transform-origin) overflow-x-hidden overflow-y-auto rounded-md border p-1 outline-none ui-mobile-sheet-popup", t),
|
|
46
|
+
...s,
|
|
47
|
+
children: [
|
|
48
|
+
/* @__PURE__ */ n(g, {}),
|
|
49
|
+
/* @__PURE__ */ n(i.List, { children: a }),
|
|
50
|
+
/* @__PURE__ */ n(_, {})
|
|
51
|
+
]
|
|
52
|
+
})
|
|
53
|
+
})] });
|
|
54
|
+
}
|
|
55
|
+
function p({ className: t, ...r }) {
|
|
56
|
+
return /* @__PURE__ */ n(i.Label, {
|
|
57
|
+
"data-slot": "select-label",
|
|
58
|
+
className: e("text-muted-foreground px-2 py-1.5 text-xs", t),
|
|
59
|
+
...r
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
function m({ className: t, children: o, ...s }) {
|
|
63
|
+
return /* @__PURE__ */ r(i.Item, {
|
|
64
|
+
"data-slot": "select-item",
|
|
65
|
+
className: e("data-highlighted:bg-muted data-highlighted:text-muted-foreground relative flex w-full cursor-default items-center gap-2 rounded-md py-1.5 pr-8 pl-2 text-sm outline-hidden select-none data-disabled:pointer-events-none data-disabled:opacity-50", t),
|
|
66
|
+
...s,
|
|
67
|
+
children: [/* @__PURE__ */ n("span", {
|
|
68
|
+
className: "absolute right-2 flex size-3.5 items-center justify-center",
|
|
69
|
+
children: /* @__PURE__ */ n(i.ItemIndicator, { children: /* @__PURE__ */ n(a, { className: "size-4" }) })
|
|
70
|
+
}), /* @__PURE__ */ n(i.ItemText, { children: o })]
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
function h(e) {
|
|
74
|
+
let n = {};
|
|
75
|
+
return t.Children.forEach(e, (e) => {
|
|
76
|
+
if (!t.isValidElement(e)) return;
|
|
77
|
+
let r = e;
|
|
78
|
+
if (r.type === m) {
|
|
79
|
+
let e = r.props.value;
|
|
80
|
+
typeof e == "string" && (n[e] = r.props.children);
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
r.props.children && Object.assign(n, h(r.props.children));
|
|
84
|
+
}), n;
|
|
85
|
+
}
|
|
86
|
+
function g({ className: t, ...r }) {
|
|
87
|
+
return /* @__PURE__ */ n(i.ScrollUpArrow, {
|
|
88
|
+
"data-slot": "select-scroll-up-button",
|
|
89
|
+
className: e("flex cursor-default items-center justify-center py-1", t),
|
|
90
|
+
...r,
|
|
91
|
+
children: /* @__PURE__ */ n(s, { className: "size-4" })
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
function _({ className: t, ...r }) {
|
|
95
|
+
return /* @__PURE__ */ n(i.ScrollDownArrow, {
|
|
96
|
+
"data-slot": "select-scroll-down-button",
|
|
97
|
+
className: e("flex cursor-default items-center justify-center py-1", t),
|
|
98
|
+
...r,
|
|
99
|
+
children: /* @__PURE__ */ n(o, { className: "size-4" })
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
//#endregion
|
|
103
|
+
export { c as Select, f as SelectContent, l as SelectGroup, m as SelectItem, p as SelectLabel, d as SelectTrigger, u as SelectValue };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Slider as SliderPrimitive } from "@base-ui/react/slider";
|
|
2
|
+
import * as React from "react";
|
|
3
|
+
type SliderProps = Omit<React.ComponentProps<typeof SliderPrimitive.Root>, "onValueChange" | "value" | "defaultValue"> & {
|
|
4
|
+
value?: number[];
|
|
5
|
+
defaultValue?: number[];
|
|
6
|
+
onValueChange?: (value: number[]) => void;
|
|
7
|
+
};
|
|
8
|
+
declare const Slider: React.ForwardRefExoticComponent<Omit<SliderProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
9
|
+
export { Slider };
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { cn as e } from "../../lib/utils.js";
|
|
3
|
+
import * as t from "react";
|
|
4
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
5
|
+
import { Slider as i } from "@base-ui/react/slider";
|
|
6
|
+
//#region src/components/forms/slider.tsx
|
|
7
|
+
var a = t.forwardRef(({ className: t, onValueChange: a, "aria-label": o, "aria-labelledby": s, ...c }, l) => /* @__PURE__ */ n(i.Root, {
|
|
8
|
+
ref: l,
|
|
9
|
+
...c,
|
|
10
|
+
onValueChange: (e) => a?.(Array.isArray(e) ? [...e] : [e]),
|
|
11
|
+
children: /* @__PURE__ */ n(i.Control, {
|
|
12
|
+
className: e("relative flex w-full touch-none items-center py-2 select-none", t),
|
|
13
|
+
children: /* @__PURE__ */ r(i.Track, {
|
|
14
|
+
className: "bg-muted relative h-2 w-full grow rounded-full",
|
|
15
|
+
children: [/* @__PURE__ */ n(i.Indicator, { className: "bg-primary absolute h-full rounded-full" }), /* @__PURE__ */ n(i.Thumb, {
|
|
16
|
+
"aria-label": o ?? "Slider",
|
|
17
|
+
"aria-labelledby": s,
|
|
18
|
+
className: "border-border focus-visible:border-ring focus-visible:bg-primary focus-visible:ring-ring bg-background z-10 block h-6 w-6 rounded-full border shadow-sm ring-1 ring-border/5 transition-colors focus-visible:ring-2 focus-visible:ring-offset-2 focus-visible:outline-none disabled:pointer-events-none disabled:opacity-50"
|
|
19
|
+
})]
|
|
20
|
+
})
|
|
21
|
+
})
|
|
22
|
+
}));
|
|
23
|
+
a.displayName = "Slider";
|
|
24
|
+
//#endregion
|
|
25
|
+
export { a as Slider };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
interface StepperProps {
|
|
2
|
+
value: number;
|
|
3
|
+
min?: number;
|
|
4
|
+
max?: number;
|
|
5
|
+
step?: number;
|
|
6
|
+
format?: (value: number) => string;
|
|
7
|
+
onChange: (value: number) => void;
|
|
8
|
+
className?: string;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
increaseLabel?: string;
|
|
11
|
+
decreaseLabel?: string;
|
|
12
|
+
}
|
|
13
|
+
declare function Stepper({ value, min, max, step, format, onChange, className, disabled, increaseLabel, decreaseLabel, }: StepperProps): import("react").JSX.Element;
|
|
14
|
+
export { Stepper };
|
|
15
|
+
export type { StepperProps };
|