@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,56 @@
|
|
|
1
|
+
import { cn as e } from "../../lib/utils.js";
|
|
2
|
+
import "react";
|
|
3
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
4
|
+
//#region src/components/primitives/card.tsx
|
|
5
|
+
function n({ className: n, ...r }) {
|
|
6
|
+
return /* @__PURE__ */ t("div", {
|
|
7
|
+
"data-slot": "card",
|
|
8
|
+
className: e("bg-card text-card-foreground flex flex-col gap-4 rounded border", n),
|
|
9
|
+
...r
|
|
10
|
+
});
|
|
11
|
+
}
|
|
12
|
+
function r({ className: n, ...r }) {
|
|
13
|
+
return /* @__PURE__ */ t("div", {
|
|
14
|
+
"data-slot": "card-header",
|
|
15
|
+
className: e("flex flex-col items-start justify-between gap-1 p-4 has-data-[slot=card-action]:grid has-data-[slot=card-action]:grid-cols-[1fr_auto]", n),
|
|
16
|
+
...r
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
function i({ className: n, ...r }) {
|
|
20
|
+
return /* @__PURE__ */ t("h3", {
|
|
21
|
+
"data-slot": "card-title",
|
|
22
|
+
className: e("text-xl", n),
|
|
23
|
+
...r,
|
|
24
|
+
children: r.children
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function a({ className: n, ...r }) {
|
|
28
|
+
return /* @__PURE__ */ t("div", {
|
|
29
|
+
"data-slot": "card-description",
|
|
30
|
+
className: e("text-muted-foreground text-xs", n),
|
|
31
|
+
...r
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
function o({ className: n, ...r }) {
|
|
35
|
+
return /* @__PURE__ */ t("div", {
|
|
36
|
+
"data-slot": "card-action",
|
|
37
|
+
className: e("col-start-2 self-start justify-self-end", n),
|
|
38
|
+
...r
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
function s({ className: n, ...r }) {
|
|
42
|
+
return /* @__PURE__ */ t("div", {
|
|
43
|
+
"data-slot": "card-content",
|
|
44
|
+
className: e("p-4", n),
|
|
45
|
+
...r
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
function c({ className: n, ...r }) {
|
|
49
|
+
return /* @__PURE__ */ t("div", {
|
|
50
|
+
"data-slot": "card-footer",
|
|
51
|
+
className: e("flex items-center p-4", n),
|
|
52
|
+
...r
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
//#endregion
|
|
56
|
+
export { n as Card, o as CardAction, s as CardContent, a as CardDescription, c as CardFooter, r as CardHeader, i as CardTitle };
|
|
@@ -3,12 +3,4 @@ export { Badge, badgeVariants } from "./badge";
|
|
|
3
3
|
export { Button, buttonVariants } from "./button";
|
|
4
4
|
export { SegmentedControl, type SegmentedControlProps, type SegmentedOption } from "./segmented-control";
|
|
5
5
|
export { Separator } from "./separator";
|
|
6
|
-
export {
|
|
7
|
-
Card,
|
|
8
|
-
CardAction,
|
|
9
|
-
CardContent,
|
|
10
|
-
CardDescription,
|
|
11
|
-
CardFooter,
|
|
12
|
-
CardHeader,
|
|
13
|
-
CardTitle,
|
|
14
|
-
} from "./card";
|
|
6
|
+
export { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle, } from "./card";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Avatar as e, AvatarFallback as t, AvatarGroup as n, AvatarGroupCount as r, AvatarImage as i } from "./avatar.js";
|
|
2
|
+
import { Badge as a, badgeVariants as o } from "./badge.js";
|
|
3
|
+
import { Button as s, buttonVariants as c } from "./button.js";
|
|
4
|
+
import { SegmentedControl as l } from "./segmented-control.js";
|
|
5
|
+
import { Separator as u } from "./separator.js";
|
|
6
|
+
import { Card as d, CardAction as f, CardContent as p, CardDescription as m, CardFooter as h, CardHeader as g, CardTitle as _ } from "./card.js";
|
|
7
|
+
export { e as Avatar, t as AvatarFallback, n as AvatarGroup, r as AvatarGroupCount, i as AvatarImage, a as Badge, s as Button, d as Card, f as CardAction, p as CardContent, m as CardDescription, h as CardFooter, g as CardHeader, _ as CardTitle, l as SegmentedControl, u as Separator, o as badgeVariants, c as buttonVariants };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type SegmentedOption = {
|
|
3
|
+
value: string;
|
|
4
|
+
label: React.ReactNode;
|
|
5
|
+
ariaLabel?: string;
|
|
6
|
+
};
|
|
7
|
+
export type SegmentedControlProps = {
|
|
8
|
+
options: SegmentedOption[];
|
|
9
|
+
/** Selected values. Single mode: pass at most one. */
|
|
10
|
+
value?: string[];
|
|
11
|
+
defaultValue?: string[];
|
|
12
|
+
onValueChange?: (value: string[]) => void;
|
|
13
|
+
/** @default false — single-select. True allows several pressed. */
|
|
14
|
+
multiple?: boolean;
|
|
15
|
+
/** Accessible name for the group. Falls back to joining option labels. */
|
|
16
|
+
label?: string;
|
|
17
|
+
className?: string;
|
|
18
|
+
itemClassName?: string;
|
|
19
|
+
};
|
|
20
|
+
export declare function SegmentedControl({ options, value, defaultValue, onValueChange, multiple, label, className, itemClassName, }: SegmentedControlProps): React.JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
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
|
+
import { ToggleGroup as n } from "@base-ui/react/toggle-group";
|
|
6
|
+
import { Toggle as r } from "@base-ui/react/toggle";
|
|
7
|
+
//#region src/components/primitives/segmented-control.tsx
|
|
8
|
+
function i({ options: i, value: a, defaultValue: o, onValueChange: s, multiple: c = !1, label: l, className: u, itemClassName: d }) {
|
|
9
|
+
return /* @__PURE__ */ t(n, {
|
|
10
|
+
"data-slot": "segmented-control",
|
|
11
|
+
"aria-label": l ?? i.map((e) => e.ariaLabel ?? e.value).join(", "),
|
|
12
|
+
multiple: c,
|
|
13
|
+
value: a,
|
|
14
|
+
defaultValue: o,
|
|
15
|
+
onValueChange: s,
|
|
16
|
+
className: e("border-border bg-card inline-flex items-center gap-0.5 rounded-full border p-0.5", u),
|
|
17
|
+
children: i.map((n) => /* @__PURE__ */ t(r, {
|
|
18
|
+
"data-slot": "segmented-control-item",
|
|
19
|
+
value: n.value,
|
|
20
|
+
"aria-label": n.ariaLabel ?? (typeof n.label == "string" ? n.label : n.value),
|
|
21
|
+
className: e("text-muted-foreground hover:text-foreground rounded-full px-4 py-1.5 text-[11px] font-semibold tracking-wider whitespace-nowrap uppercase transition-colors", "data-pressed:bg-foreground data-pressed:text-background", "focus-visible:outline-ring focus-visible:outline-2 focus-visible:outline-offset-2", "data-disabled:pointer-events-none data-disabled:opacity-50", d),
|
|
22
|
+
children: n.label
|
|
23
|
+
}, n.value))
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { i as SegmentedControl };
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
import { Separator as n } from "@base-ui/react/separator";
|
|
6
|
+
//#region src/components/primitives/separator.tsx
|
|
7
|
+
function r({ className: r, orientation: i = "horizontal", ...a }) {
|
|
8
|
+
return /* @__PURE__ */ t(n, {
|
|
9
|
+
"data-slot": "separator",
|
|
10
|
+
orientation: i,
|
|
11
|
+
className: e("bg-border shrink-0", i === "horizontal" ? "h-px w-full" : "h-full w-px", r),
|
|
12
|
+
...a
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { r as Separator };
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart colors are CSS-variable-backed so they stay in sync with the active
|
|
3
|
+
* color system and mode at runtime.
|
|
4
|
+
*/
|
|
5
|
+
export declare const CHART_COLORS: {
|
|
6
|
+
readonly chart1: "var(--chart-1)";
|
|
7
|
+
readonly chart2: "var(--chart-2)";
|
|
8
|
+
readonly chart3: "var(--chart-3)";
|
|
9
|
+
readonly chart4: "var(--chart-4)";
|
|
10
|
+
readonly chart5: "var(--chart-5)";
|
|
11
|
+
readonly positive: "var(--chart-positive)";
|
|
12
|
+
readonly negative: "var(--chart-negative)";
|
|
13
|
+
readonly neutral: "var(--chart-neutral)";
|
|
14
|
+
readonly background: "var(--color-background)";
|
|
15
|
+
readonly grid: "var(--color-border)";
|
|
16
|
+
readonly axis: "var(--color-muted-foreground)";
|
|
17
|
+
readonly label: "var(--color-muted-foreground)";
|
|
18
|
+
readonly tooltip: {
|
|
19
|
+
readonly background: "var(--color-card)";
|
|
20
|
+
readonly text: "var(--color-foreground)";
|
|
21
|
+
readonly border: "var(--color-border)";
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
export declare const CHART_CSS_VARS: {
|
|
25
|
+
readonly positive: "var(--chart-positive)";
|
|
26
|
+
readonly negative: "var(--chart-negative)";
|
|
27
|
+
readonly neutral: "var(--chart-neutral)";
|
|
28
|
+
readonly chart1: "var(--chart-1)";
|
|
29
|
+
readonly chart2: "var(--chart-2)";
|
|
30
|
+
readonly chart3: "var(--chart-3)";
|
|
31
|
+
readonly chart4: "var(--chart-4)";
|
|
32
|
+
readonly chart5: "var(--chart-5)";
|
|
33
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
//#region src/constants/chart-colors.ts
|
|
2
|
+
var e = {
|
|
3
|
+
chart1: "var(--chart-1)",
|
|
4
|
+
chart2: "var(--chart-2)",
|
|
5
|
+
chart3: "var(--chart-3)",
|
|
6
|
+
chart4: "var(--chart-4)",
|
|
7
|
+
chart5: "var(--chart-5)",
|
|
8
|
+
positive: "var(--chart-positive)",
|
|
9
|
+
negative: "var(--chart-negative)",
|
|
10
|
+
neutral: "var(--chart-neutral)",
|
|
11
|
+
background: "var(--color-background)",
|
|
12
|
+
grid: "var(--color-border)",
|
|
13
|
+
axis: "var(--color-muted-foreground)",
|
|
14
|
+
label: "var(--color-muted-foreground)",
|
|
15
|
+
tooltip: {
|
|
16
|
+
background: "var(--color-card)",
|
|
17
|
+
text: "var(--color-foreground)",
|
|
18
|
+
border: "var(--color-border)"
|
|
19
|
+
}
|
|
20
|
+
}, t = {
|
|
21
|
+
positive: "var(--chart-positive)",
|
|
22
|
+
negative: "var(--chart-negative)",
|
|
23
|
+
neutral: "var(--chart-neutral)",
|
|
24
|
+
chart1: "var(--chart-1)",
|
|
25
|
+
chart2: "var(--chart-2)",
|
|
26
|
+
chart3: "var(--chart-3)",
|
|
27
|
+
chart4: "var(--chart-4)",
|
|
28
|
+
chart5: "var(--chart-5)"
|
|
29
|
+
};
|
|
30
|
+
//#endregion
|
|
31
|
+
export { e as CHART_COLORS, t as CHART_CSS_VARS };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useApiClient as e } from "./use-api-client.js";
|
|
3
|
+
import { useDebouncedValue as t } from "./use-debounced-value.js";
|
|
4
|
+
import { useDerivedFilterState as n } from "./use-derived-filter-state.js";
|
|
5
|
+
import { useFilterState as r } from "./use-filter-state.js";
|
|
6
|
+
import { useMediaQuery as i } from "./use-media-query.js";
|
|
7
|
+
import { useIsMobile as a } from "./use-mobile.js";
|
|
8
|
+
import { useSort as o } from "./use-sort.js";
|
|
9
|
+
export { e as useApiClient, t as useDebouncedValue, n as useDerivedFilterState, r as useFilterState, a as useIsMobile, i as useMediaQuery, o as useSort };
|
|
@@ -2,11 +2,9 @@
|
|
|
2
2
|
* Sort types for use across packages
|
|
3
3
|
* These types are exported from the shared UI package for shared usage
|
|
4
4
|
*/
|
|
5
|
-
|
|
6
5
|
export type SortField = string;
|
|
7
6
|
export type SortDirection = "asc" | "desc";
|
|
8
|
-
|
|
9
7
|
export interface SortOption {
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
field: SortField;
|
|
9
|
+
direction: SortDirection;
|
|
12
10
|
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface UseApiClientOptions {
|
|
2
|
+
/** Base URL prepended to relative endpoints. Defaults to same-origin requests. */
|
|
3
|
+
baseUrl?: string;
|
|
4
|
+
/** Fetch credentials policy. Defaults to the browser's same-origin behavior. */
|
|
5
|
+
credentials?: RequestCredentials;
|
|
6
|
+
/** Injectable Fetch implementation for custom runtimes and deterministic tests. */
|
|
7
|
+
fetcher?: typeof fetch;
|
|
8
|
+
}
|
|
9
|
+
export interface ApiRequestOptions<T> {
|
|
10
|
+
method?: "GET" | "POST" | "PUT" | "DELETE";
|
|
11
|
+
body?: T | null;
|
|
12
|
+
headers?: HeadersInit;
|
|
13
|
+
stream?: boolean;
|
|
14
|
+
signal?: AbortSignal;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Same-origin by default, with explicit configuration for applications that
|
|
18
|
+
* need another API host. The hook owns request status only; server state and
|
|
19
|
+
* caching belong in the consuming application's query layer.
|
|
20
|
+
*/
|
|
21
|
+
export declare function useApiClient({ baseUrl, credentials, fetcher, }?: UseApiClientOptions): {
|
|
22
|
+
get: <S>(endpoint: string, options?: Omit<ApiRequestOptions<never>, "method" | "body">) => Promise<S>;
|
|
23
|
+
post: <T, S>(endpoint: string, data?: T, options?: Omit<ApiRequestOptions<T>, "method">) => Promise<S>;
|
|
24
|
+
postStream: <T>(endpoint: string, data: T, options?: Omit<ApiRequestOptions<T>, "method" | "stream">) => Promise<Response>;
|
|
25
|
+
postFormData: <S>(endpoint: string, formData: FormData, options?: Omit<ApiRequestOptions<FormData>, "method">) => Promise<S>;
|
|
26
|
+
put: <T, S>(endpoint: string, data: T, options?: Omit<ApiRequestOptions<T>, "method">) => Promise<S>;
|
|
27
|
+
delete: <S>(endpoint: string, options?: Omit<ApiRequestOptions<never>, "method">) => Promise<S>;
|
|
28
|
+
isLoading: boolean;
|
|
29
|
+
error: Error | null;
|
|
30
|
+
};
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback as e, useMemo as t, useRef as n, useState as r } from "react";
|
|
3
|
+
//#region src/hooks/use-api-client.ts
|
|
4
|
+
function i(e, t) {
|
|
5
|
+
if (/^https?:\/\//i.test(t)) return t;
|
|
6
|
+
let n = e.replace(/\/+$/, ""), r = t.replace(/^\/+/, "");
|
|
7
|
+
return n ? `${n}/${r}` : `/${r}`;
|
|
8
|
+
}
|
|
9
|
+
async function a(e) {
|
|
10
|
+
if ((e.headers.get("content-type") ?? "").includes("json")) {
|
|
11
|
+
let t = await e.json().catch(() => null);
|
|
12
|
+
if (t && typeof t == "object" && "message" in t) {
|
|
13
|
+
let e = t.message;
|
|
14
|
+
if (typeof e == "string" && e.length > 0) return e;
|
|
15
|
+
}
|
|
16
|
+
} else {
|
|
17
|
+
let t = await e.text().catch(() => "");
|
|
18
|
+
if (t.length > 0) return t;
|
|
19
|
+
}
|
|
20
|
+
return `Request failed with status ${e.status}`;
|
|
21
|
+
}
|
|
22
|
+
function o({ baseUrl: o = "", credentials: s = "same-origin", fetcher: c = fetch } = {}) {
|
|
23
|
+
let [l, u] = r({
|
|
24
|
+
isLoading: !1,
|
|
25
|
+
error: null
|
|
26
|
+
}), d = n(0), f = e(async (e, t = {}) => {
|
|
27
|
+
let { method: n = "GET", body: r, headers: l, stream: f = !1, signal: p } = t;
|
|
28
|
+
d.current += 1, u((e) => ({
|
|
29
|
+
...e,
|
|
30
|
+
isLoading: !0,
|
|
31
|
+
error: null
|
|
32
|
+
}));
|
|
33
|
+
try {
|
|
34
|
+
let t = new Headers(l), u = typeof FormData < "u" && r instanceof FormData, d = r != null;
|
|
35
|
+
d && !u && !t.has("Content-Type") && t.set("Content-Type", "application/json");
|
|
36
|
+
let m = await c(i(o, e), {
|
|
37
|
+
method: n,
|
|
38
|
+
headers: t,
|
|
39
|
+
body: d ? u ? r : JSON.stringify(r) : null,
|
|
40
|
+
credentials: s,
|
|
41
|
+
signal: p
|
|
42
|
+
});
|
|
43
|
+
if (!m.ok) throw Error(await a(m));
|
|
44
|
+
if (f) return m;
|
|
45
|
+
if (m.status === 204 || m.status === 205) return;
|
|
46
|
+
if ((m.headers.get("content-type") ?? "").includes("json")) return await m.json();
|
|
47
|
+
if (m.status === 0 || m.headers.get("content-length") === "0") return;
|
|
48
|
+
let h = await m.text();
|
|
49
|
+
return h.length === 0 ? void 0 : h;
|
|
50
|
+
} catch (e) {
|
|
51
|
+
let t = e instanceof Error ? e : /* @__PURE__ */ Error("An unknown request error occurred");
|
|
52
|
+
throw u((e) => ({
|
|
53
|
+
...e,
|
|
54
|
+
error: t
|
|
55
|
+
})), t;
|
|
56
|
+
} finally {
|
|
57
|
+
d.current = Math.max(0, d.current - 1);
|
|
58
|
+
let e = d.current > 0;
|
|
59
|
+
u((t) => ({
|
|
60
|
+
...t,
|
|
61
|
+
isLoading: e
|
|
62
|
+
}));
|
|
63
|
+
}
|
|
64
|
+
}, [
|
|
65
|
+
o,
|
|
66
|
+
s,
|
|
67
|
+
c
|
|
68
|
+
]);
|
|
69
|
+
return {
|
|
70
|
+
...t(() => ({
|
|
71
|
+
get: (e, t) => f(e, {
|
|
72
|
+
...t,
|
|
73
|
+
method: "GET"
|
|
74
|
+
}),
|
|
75
|
+
post: (e, t, n) => f(e, {
|
|
76
|
+
...n,
|
|
77
|
+
method: "POST",
|
|
78
|
+
body: t
|
|
79
|
+
}),
|
|
80
|
+
postStream: (e, t, n) => f(e, {
|
|
81
|
+
...n,
|
|
82
|
+
method: "POST",
|
|
83
|
+
body: t,
|
|
84
|
+
stream: !0
|
|
85
|
+
}),
|
|
86
|
+
postFormData: (e, t, n) => f(e, {
|
|
87
|
+
...n,
|
|
88
|
+
method: "POST",
|
|
89
|
+
body: t
|
|
90
|
+
}),
|
|
91
|
+
put: (e, t, n) => f(e, {
|
|
92
|
+
...n,
|
|
93
|
+
method: "PUT",
|
|
94
|
+
body: t
|
|
95
|
+
}),
|
|
96
|
+
delete: (e, t) => f(e, {
|
|
97
|
+
...t,
|
|
98
|
+
method: "DELETE"
|
|
99
|
+
})
|
|
100
|
+
}), [f]),
|
|
101
|
+
isLoading: l.isLoading,
|
|
102
|
+
error: l.error
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
//#endregion
|
|
106
|
+
export { o as useApiClient };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useDebouncedValue<T>(value: T, delayMs: number): T;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useEffect as e, useState as t } from "react";
|
|
3
|
+
//#region src/hooks/use-debounced-value.ts
|
|
4
|
+
function n(n, r) {
|
|
5
|
+
let [i, a] = t(n);
|
|
6
|
+
return e(() => {
|
|
7
|
+
let e = setTimeout(() => a(n), r);
|
|
8
|
+
return () => clearTimeout(e);
|
|
9
|
+
}, [r, n]), i;
|
|
10
|
+
}
|
|
11
|
+
//#endregion
|
|
12
|
+
export { n as useDebouncedValue };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { ActiveFilter } from "../components/filters/active-filters-bar";
|
|
2
|
+
export interface FilterConfig {
|
|
3
|
+
default: string;
|
|
4
|
+
label?: (value: string) => string;
|
|
5
|
+
}
|
|
6
|
+
interface UseDerivedFilterStateOptions<T extends Record<string, FilterConfig>> {
|
|
7
|
+
fields: T;
|
|
8
|
+
sync: {
|
|
9
|
+
read: () => Record<string, string>;
|
|
10
|
+
write: (values: Record<string, string>) => void;
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
export declare function useDerivedFilterState<T extends Record<string, FilterConfig>>({ fields, sync, }: UseDerivedFilterStateOptions<T>): {
|
|
14
|
+
values: Record<string, string>;
|
|
15
|
+
setValue: (key: string, value: string) => void;
|
|
16
|
+
activeFilters: ActiveFilter[];
|
|
17
|
+
clearAll: () => void;
|
|
18
|
+
hasActive: boolean;
|
|
19
|
+
};
|
|
20
|
+
export {};
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback as e, useMemo as t, useState as n } from "react";
|
|
3
|
+
//#region src/hooks/use-derived-filter-state.ts
|
|
4
|
+
function r({ fields: r, sync: i }) {
|
|
5
|
+
let [a, o] = n(() => {
|
|
6
|
+
let e = i.read(), t = {};
|
|
7
|
+
for (let n of Object.keys(r)) t[n] = e[n] ?? r[n].default;
|
|
8
|
+
return t;
|
|
9
|
+
}), s = e((e, t) => {
|
|
10
|
+
o((n) => {
|
|
11
|
+
let r = {
|
|
12
|
+
...n,
|
|
13
|
+
[e]: t
|
|
14
|
+
};
|
|
15
|
+
return i.write(r), r;
|
|
16
|
+
});
|
|
17
|
+
}, [i]), c = e(() => {
|
|
18
|
+
let e = {};
|
|
19
|
+
for (let t of Object.keys(r)) e[t] = r[t].default;
|
|
20
|
+
o(e), i.write(e);
|
|
21
|
+
}, [r, i]), l = t(() => Object.entries(a).filter(([, e]) => e !== "").map(([e, t]) => ({
|
|
22
|
+
id: e,
|
|
23
|
+
label: r[e]?.label ? r[e].label(t) : `${e}: ${t}`,
|
|
24
|
+
onRemove: () => s(e, "")
|
|
25
|
+
})), [
|
|
26
|
+
a,
|
|
27
|
+
r,
|
|
28
|
+
s
|
|
29
|
+
]);
|
|
30
|
+
return {
|
|
31
|
+
values: a,
|
|
32
|
+
setValue: s,
|
|
33
|
+
activeFilters: l,
|
|
34
|
+
clearAll: c,
|
|
35
|
+
hasActive: l.length > 0
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
//#endregion
|
|
39
|
+
export { r as useDerivedFilterState };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
interface UseFilterStateOptions<T> {
|
|
2
|
+
initialFilters: T;
|
|
3
|
+
onFiltersChange?: (filters: T) => void;
|
|
4
|
+
debounceMs?: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function useFilterState<T extends Record<string, unknown>>(options: UseFilterStateOptions<T>): {
|
|
7
|
+
filters: T;
|
|
8
|
+
setFilters: (newFilters: T | ((prev: T) => T)) => void;
|
|
9
|
+
updateFilter: <K extends keyof T>(key: K, value: T[K]) => void;
|
|
10
|
+
clearFilters: () => void;
|
|
11
|
+
};
|
|
12
|
+
export {};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback as e, useEffect as t, useRef as n, useState as r } from "react";
|
|
3
|
+
//#region src/hooks/use-filter-state.ts
|
|
4
|
+
function i(i) {
|
|
5
|
+
let { initialFilters: a, onFiltersChange: o, debounceMs: s } = i, [c, l] = r(a), u = n(o), d = n(c);
|
|
6
|
+
u.current = o;
|
|
7
|
+
let f = e((e) => {
|
|
8
|
+
l(e);
|
|
9
|
+
}, []), p = e((e, t) => {
|
|
10
|
+
f((n) => ({
|
|
11
|
+
...n,
|
|
12
|
+
[e]: t
|
|
13
|
+
}));
|
|
14
|
+
}, [f]), m = e(() => {
|
|
15
|
+
l(a);
|
|
16
|
+
}, [a]);
|
|
17
|
+
return t(() => {
|
|
18
|
+
if (Object.is(d.current, c)) return;
|
|
19
|
+
if (d.current = c, !s || s <= 0) {
|
|
20
|
+
u.current?.(c);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
let e = setTimeout(() => {
|
|
24
|
+
u.current?.(c);
|
|
25
|
+
}, s);
|
|
26
|
+
return () => {
|
|
27
|
+
clearTimeout(e);
|
|
28
|
+
};
|
|
29
|
+
}, [c, s]), {
|
|
30
|
+
filters: c,
|
|
31
|
+
setFilters: f,
|
|
32
|
+
updateFilter: p,
|
|
33
|
+
clearFilters: m
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { i as useFilterState };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Listens for changes to a media query and returns a boolean indicating whether the query matches.
|
|
3
|
+
* @param query - The media query string to listen for.
|
|
4
|
+
* @returns A boolean indicating whether the media query matches.
|
|
5
|
+
*/
|
|
6
|
+
export declare function useMediaQuery(query: string): boolean;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useCallback as e, useSyncExternalStore as t } from "react";
|
|
3
|
+
//#region src/hooks/use-media-query.ts
|
|
4
|
+
function n(e, t) {
|
|
5
|
+
if (t?.width !== void 0) {
|
|
6
|
+
let n = e.match(/\(min-width:\s*(\d+)px\)/), r = e.match(/\(max-width:\s*(\d+)px\)/);
|
|
7
|
+
if (n && n[1]) return t.width >= Number.parseInt(n[1], 10);
|
|
8
|
+
if (r && r[1]) return t.width <= Number.parseInt(r[1], 10);
|
|
9
|
+
}
|
|
10
|
+
return window.matchMedia(e).matches;
|
|
11
|
+
}
|
|
12
|
+
function r() {
|
|
13
|
+
return !1;
|
|
14
|
+
}
|
|
15
|
+
function i(i) {
|
|
16
|
+
return t(e((e) => {
|
|
17
|
+
if (typeof window > "u") return () => {};
|
|
18
|
+
let t = window.matchMedia(i), n = () => {
|
|
19
|
+
e();
|
|
20
|
+
};
|
|
21
|
+
return t.addEventListener("change", n), () => {
|
|
22
|
+
t.removeEventListener("change", n);
|
|
23
|
+
};
|
|
24
|
+
}, [i]), e(() => typeof window > "u" ? !1 : n(i), [i]), r);
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { i as useMediaQuery };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useIsMobile(): boolean;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import * as e from "react";
|
|
2
|
+
//#region src/hooks/use-mobile.tsx
|
|
3
|
+
var t = 768;
|
|
4
|
+
function n() {
|
|
5
|
+
let [n, r] = e.useState(void 0);
|
|
6
|
+
return e.useEffect(() => {
|
|
7
|
+
let e = window.matchMedia(`(max-width: ${t - 1}px)`), n = () => {
|
|
8
|
+
r(window.innerWidth < t);
|
|
9
|
+
};
|
|
10
|
+
return e.addEventListener("change", n), r(window.innerWidth < t), () => e.removeEventListener("change", n);
|
|
11
|
+
}, []), !!n;
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { n as useIsMobile };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { SortOption } from "./sort.types";
|
|
2
|
+
interface UseSortOptions {
|
|
3
|
+
initialSortOptions?: SortOption[];
|
|
4
|
+
}
|
|
5
|
+
export declare function useSort(options?: UseSortOptions): {
|
|
6
|
+
sortOptions: SortOption[];
|
|
7
|
+
addSortOption: (opt: SortOption) => void;
|
|
8
|
+
updateSortOption: (index: number, opt: SortOption) => void;
|
|
9
|
+
removeSortOption: (index: number) => void;
|
|
10
|
+
};
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { useState as e } from "react";
|
|
3
|
+
//#region src/hooks/use-sort.ts
|
|
4
|
+
function t(t = {}) {
|
|
5
|
+
let [n, r] = e(t.initialSortOptions ?? []);
|
|
6
|
+
return {
|
|
7
|
+
sortOptions: n,
|
|
8
|
+
addSortOption: (e) => r((t) => [...t, e]),
|
|
9
|
+
updateSortOption: (e, t) => r((n) => n.map((n, r) => r === e ? t : n)),
|
|
10
|
+
removeSortOption: (e) => r((t) => t.filter((t, n) => n !== e))
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
//#endregion
|
|
14
|
+
export { t as useSort };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import "../dist/styles.css";
|
|
2
|
-
|
|
3
2
|
export { CHART_COLORS, CHART_CSS_VARS } from "./constants/chart-colors";
|
|
4
3
|
export type { SortDirection, SortField, SortOption } from "./hooks/sort.types";
|
|
5
4
|
export { useApiClient } from "./hooks/use-api-client";
|
|
@@ -13,34 +12,7 @@ export { normalizeOtp, OTP_LENGTH } from "./lib/auth";
|
|
|
13
12
|
export { copyToClipboard } from "./lib/clipboard";
|
|
14
13
|
export { cn } from "./lib/utils";
|
|
15
14
|
export { colors } from "./styles/tokens/css-vars";
|
|
16
|
-
export {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
colorTokenNames,
|
|
21
|
-
containers,
|
|
22
|
-
easing,
|
|
23
|
-
fontFamilies,
|
|
24
|
-
fontWeights,
|
|
25
|
-
leading,
|
|
26
|
-
radii,
|
|
27
|
-
shadows,
|
|
28
|
-
spacing,
|
|
29
|
-
textLineHeights,
|
|
30
|
-
textSizes,
|
|
31
|
-
tracking,
|
|
32
|
-
transitionDurations,
|
|
33
|
-
zIndices,
|
|
34
|
-
} from "./styles/tokens/index";
|
|
35
|
-
export type {
|
|
36
|
-
ColorMode,
|
|
37
|
-
ColorTheme,
|
|
38
|
-
ColorToken,
|
|
39
|
-
FontWeightToken,
|
|
40
|
-
LeadingToken,
|
|
41
|
-
RadiusToken,
|
|
42
|
-
ShadowToken,
|
|
43
|
-
SpacingToken,
|
|
44
|
-
TextSizeToken,
|
|
45
|
-
TrackingToken,
|
|
46
|
-
} from "./styles/tokens/index";
|
|
15
|
+
export { animations, breakpoints, colorThemes, colorTokenNames, containers, easing, fontFamilies, fontWeights, leading, radii, shadows, spacing, textLineHeights, textSizes, tracking, transitionDurations, zIndices, } from "./styles/tokens/index";
|
|
16
|
+
export type { ColorMode, ColorTheme, ColorToken, FontWeightToken, LeadingToken, RadiusToken, ShadowToken, SpacingToken, TextSizeToken, TrackingToken, } from "./styles/tokens/index";
|
|
17
|
+
export { UiTextProvider, useUiText } from "./translations/ui-provider";
|
|
18
|
+
export type { UiMessageKey, UiMessages } from "./translations/ui-provider";
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { CHART_COLORS as e, CHART_CSS_VARS as t } from "./constants/chart-colors.js";
|
|
2
|
+
import { useApiClient as n } from "./hooks/use-api-client.js";
|
|
3
|
+
import { useDebouncedValue as r } from "./hooks/use-debounced-value.js";
|
|
4
|
+
import { useDerivedFilterState as i } from "./hooks/use-derived-filter-state.js";
|
|
5
|
+
import { useFilterState as a } from "./hooks/use-filter-state.js";
|
|
6
|
+
import { useMediaQuery as o } from "./hooks/use-media-query.js";
|
|
7
|
+
import { useIsMobile as s } from "./hooks/use-mobile.js";
|
|
8
|
+
import { OTP_LENGTH as c, normalizeOtp as l } from "./lib/auth.js";
|
|
9
|
+
import { copyToClipboard as u } from "./lib/clipboard.js";
|
|
10
|
+
import { cn as d } from "./lib/utils.js";
|
|
11
|
+
import { animations as f, breakpoints as p, colorThemes as m, colorTokenNames as h, containers as g, easing as _, fontFamilies as v, fontWeights as y, leading as b, radii as x, shadows as S, spacing as C, textLineHeights as w, textSizes as T, tracking as E, transitionDurations as D, zIndices as O } from "./styles/tokens/index.js";
|
|
12
|
+
import { colors as k } from "./styles/tokens/css-vars.js";
|
|
13
|
+
import { UiTextProvider as A, useUiText as j } from "./translations/ui-provider.js";
|
|
14
|
+
import "../dist/styles.css";
|
|
15
|
+
export { e as CHART_COLORS, t as CHART_CSS_VARS, c as OTP_LENGTH, A as UiTextProvider, f as animations, p as breakpoints, d as cn, m as colorThemes, h as colorTokenNames, k as colors, g as containers, u as copyToClipboard, _ as easing, v as fontFamilies, y as fontWeights, b as leading, l as normalizeOtp, x as radii, S as shadows, C as spacing, w as textLineHeights, T as textSizes, E as tracking, D as transitionDurations, n as useApiClient, r as useDebouncedValue, i as useDerivedFilterState, a as useFilterState, s as useIsMobile, o as useMediaQuery, j as useUiText, O as zIndices };
|