@cascivo/react 0.9.0 → 0.10.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 +5 -5
- package/dist/command-menu/command-menu.js +2 -2
- package/dist/field/field.js +24 -15
- package/dist/index.d.ts +13 -0
- package/dist/node/accordion/accordion.js +95 -0
- package/dist/node/accordion/accordion.module.js +13 -0
- package/dist/node/action-sheet/action-sheet.js +91 -0
- package/dist/node/action-sheet/action-sheet.module.js +14 -0
- package/dist/node/alert/alert.js +55 -0
- package/dist/node/alert/alert.module.js +13 -0
- package/dist/node/alert-dialog/alert-dialog.js +68 -0
- package/dist/node/alert-dialog/alert-dialog.module.js +13 -0
- package/dist/node/app-shell/app-shell.js +80 -0
- package/dist/node/app-shell/app-shell.module.js +14 -0
- package/dist/node/aspect-ratio/aspect-ratio.js +22 -0
- package/dist/node/aspect-ratio/aspect-ratio.module.js +8 -0
- package/dist/node/avatar/avatar.js +57 -0
- package/dist/node/avatar/avatar.module.js +10 -0
- package/dist/node/avatar-group/avatar-group.js +26 -0
- package/dist/node/avatar-group/avatar-group.module.js +8 -0
- package/dist/node/badge/badge.js +17 -0
- package/dist/node/badge/badge.module.js +5 -0
- package/dist/node/blockquote/blockquote.js +18 -0
- package/dist/node/blockquote/blockquote.module.js +8 -0
- package/dist/node/bottom-sheet/bottom-sheet.js +111 -0
- package/dist/node/bottom-sheet/bottom-sheet.module.js +16 -0
- package/dist/node/breadcrumb/breadcrumb.js +28 -0
- package/dist/node/breadcrumb/breadcrumb.module.js +5 -0
- package/dist/node/button/button.js +31 -0
- package/dist/node/button/button.module.js +5 -0
- package/dist/node/button-group/button-group.js +39 -0
- package/dist/node/button-group/button-group.module.js +5 -0
- package/dist/node/calendar/calendar.js +195 -0
- package/dist/node/calendar/calendar.module.js +16 -0
- package/dist/node/card/card.js +45 -0
- package/dist/node/card/card.module.js +11 -0
- package/dist/node/carousel/carousel.js +138 -0
- package/dist/node/carousel/carousel.module.js +15 -0
- package/dist/node/chat-bubble/chat-bubble.js +33 -0
- package/dist/node/chat-bubble/chat-bubble.module.js +13 -0
- package/dist/node/checkbox/checkbox.js +38 -0
- package/dist/node/checkbox/checkbox.module.js +10 -0
- package/dist/node/checkbox-card/checkbox-card.js +48 -0
- package/dist/node/checkbox-card/checkbox-card.module.js +13 -0
- package/dist/node/code/code.js +16 -0
- package/dist/node/code/code.module.js +5 -0
- package/dist/node/code-snippet/code-snippet.js +116 -0
- package/dist/node/code-snippet/code-snippet.module.js +19 -0
- package/dist/node/code-snippet/highlight.js +69 -0
- package/dist/node/collapsible/collapsible.js +42 -0
- package/dist/node/collapsible/collapsible.module.js +10 -0
- package/dist/node/color-picker/color-picker.js +268 -0
- package/dist/node/color-picker/color-picker.module.js +20 -0
- package/dist/node/combobox/combobox.js +164 -0
- package/dist/node/combobox/combobox.module.js +21 -0
- package/dist/node/command-menu/command-menu.js +425 -0
- package/dist/node/command-menu/command-menu.module.js +36 -0
- package/dist/node/comparison/comparison.js +69 -0
- package/dist/node/comparison/comparison.module.js +11 -0
- package/dist/node/contained-list/contained-list.js +41 -0
- package/dist/node/contained-list/contained-list.module.js +13 -0
- package/dist/node/context-menu/context-menu.js +89 -0
- package/dist/node/context-menu/context-menu.module.js +9 -0
- package/dist/node/copy-button/copy-button.js +58 -0
- package/dist/node/copy-button/copy-button.module.js +8 -0
- package/dist/node/data-list/data-list.js +27 -0
- package/dist/node/data-list/data-list.module.js +10 -0
- package/dist/node/data-table/data-table.js +370 -0
- package/dist/node/data-table/data-table.module.js +35 -0
- package/dist/node/date-picker/date-picker.js +218 -0
- package/dist/node/date-picker/date-picker.module.js +25 -0
- package/dist/node/date-range-picker/date-range-picker.js +196 -0
- package/dist/node/date-range-picker/date-range-picker.module.js +20 -0
- package/dist/node/dock/dock.js +34 -0
- package/dist/node/dock/dock.module.js +10 -0
- package/dist/node/drawer/drawer.js +95 -0
- package/dist/node/drawer/drawer.module.js +15 -0
- package/dist/node/dropdown/dropdown.js +109 -0
- package/dist/node/dropdown/dropdown.module.js +11 -0
- package/dist/node/editable/editable.js +67 -0
- package/dist/node/editable/editable.module.js +13 -0
- package/dist/node/empty-state/empty-state.js +34 -0
- package/dist/node/empty-state/empty-state.module.js +11 -0
- package/dist/node/fab/fab.js +93 -0
- package/dist/node/fab/fab.module.js +14 -0
- package/dist/node/field/field.js +48 -0
- package/dist/node/field/field.module.js +9 -0
- package/dist/node/file-uploader/file-uploader.js +122 -0
- package/dist/node/file-uploader/file-uploader.module.js +20 -0
- package/dist/node/filter/filter.js +34 -0
- package/dist/node/filter/filter.module.js +8 -0
- package/dist/node/form/form.js +95 -0
- package/dist/node/form/form.module.js +5 -0
- package/dist/node/header/header.js +44 -0
- package/dist/node/header/header.module.js +13 -0
- package/dist/node/header-panel/header-panel.js +74 -0
- package/dist/node/header-panel/header-panel.module.js +11 -0
- package/dist/node/heading/heading.js +24 -0
- package/dist/node/heading/heading.module.js +5 -0
- package/dist/node/hover-card/hover-card.js +84 -0
- package/dist/node/hover-card/hover-card.module.js +8 -0
- package/dist/node/icon-button/icon-button.js +21 -0
- package/dist/node/icon-button/icon-button.module.js +5 -0
- package/dist/node/image/image.js +64 -0
- package/dist/node/image/image.module.js +11 -0
- package/dist/node/index.js +2 -0
- package/dist/node/indicator/indicator.js +18 -0
- package/dist/node/indicator/indicator.module.js +8 -0
- package/dist/node/inline-loading/inline-loading.js +76 -0
- package/dist/node/inline-loading/inline-loading.module.js +11 -0
- package/dist/node/input/input.js +54 -0
- package/dist/node/input/input.module.js +11 -0
- package/dist/node/input-group/input-group.js +41 -0
- package/dist/node/input-group/input-group.module.js +11 -0
- package/dist/node/item/item.js +52 -0
- package/dist/node/item/item.module.js +12 -0
- package/dist/node/join/join.js +14 -0
- package/dist/node/join/join.module.js +5 -0
- package/dist/node/kbd/kbd.js +16 -0
- package/dist/node/kbd/kbd.module.js +5 -0
- package/dist/node/label/label.js +25 -0
- package/dist/node/label/label.module.js +9 -0
- package/dist/node/layouts/src/auto-grid/auto-grid.js +19 -0
- package/dist/node/layouts/src/auto-grid/auto-grid.module.js +6 -0
- package/dist/node/layouts/src/center/center.js +18 -0
- package/dist/node/layouts/src/center/center.module.js +5 -0
- package/dist/node/layouts/src/columns/columns.js +23 -0
- package/dist/node/layouts/src/columns/columns.module.js +8 -0
- package/dist/node/layouts/src/flex/flex.js +22 -0
- package/dist/node/layouts/src/flex/flex.module.js +5 -0
- package/dist/node/layouts/src/grid/grid.js +57 -0
- package/dist/node/layouts/src/grid/grid.module.js +9 -0
- package/dist/node/layouts/src/spacer/spacer.js +19 -0
- package/dist/node/layouts/src/spacer/spacer.module.js +5 -0
- package/dist/node/link/link.js +22 -0
- package/dist/node/link/link.module.js +5 -0
- package/dist/node/list/list.js +23 -0
- package/dist/node/list/list.module.js +8 -0
- package/dist/node/log-viewer/log-viewer.js +184 -0
- package/dist/node/log-viewer/log-viewer.module.js +18 -0
- package/dist/node/menu/menu.js +121 -0
- package/dist/node/menu/menu.module.js +10 -0
- package/dist/node/menu-button/menu-button.js +92 -0
- package/dist/node/menu-button/menu-button.module.js +10 -0
- package/dist/node/menubar/menubar.js +103 -0
- package/dist/node/menubar/menubar.module.js +10 -0
- package/dist/node/modal/modal.js +70 -0
- package/dist/node/modal/modal.module.js +13 -0
- package/dist/node/multi-select/multi-select.js +106 -0
- package/dist/node/multi-select/multi-select.module.js +17 -0
- package/dist/node/native-select/native-select.js +37 -0
- package/dist/node/native-select/native-select.module.js +9 -0
- package/dist/node/navigation-menu/navigation-menu.js +99 -0
- package/dist/node/navigation-menu/navigation-menu.module.js +12 -0
- package/dist/node/notification/notification.js +134 -0
- package/dist/node/notification/notification.module.js +13 -0
- package/dist/node/number-input/number-input.js +145 -0
- package/dist/node/number-input/number-input.module.js +14 -0
- package/dist/node/otp-input/otp-input.js +70 -0
- package/dist/node/otp-input/otp-input.module.js +8 -0
- package/dist/node/overflow-menu/overflow-menu.js +65 -0
- package/dist/node/overflow-menu/overflow-menu.module.js +9 -0
- package/dist/node/pagination/pagination.js +92 -0
- package/dist/node/pagination/pagination.module.js +13 -0
- package/dist/node/password-input/password-input.js +80 -0
- package/dist/node/password-input/password-input.module.js +13 -0
- package/dist/node/popover/popover.js +49 -0
- package/dist/node/popover/popover.module.js +8 -0
- package/dist/node/popover/use-popover.js +57 -0
- package/dist/node/progress/progress.js +17 -0
- package/dist/node/progress/progress.module.js +8 -0
- package/dist/node/progress-bar/progress-bar.js +44 -0
- package/dist/node/progress-bar/progress-bar.module.js +13 -0
- package/dist/node/progress-circle/progress-circle.js +48 -0
- package/dist/node/progress-circle/progress-circle.module.js +11 -0
- package/dist/node/progress-indicator/progress-indicator.js +36 -0
- package/dist/node/progress-indicator/progress-indicator.module.js +12 -0
- package/dist/node/prose/prose.js +15 -0
- package/dist/node/prose/prose.module.js +5 -0
- package/dist/node/pull-to-refresh/pull-to-refresh.js +82 -0
- package/dist/node/pull-to-refresh/pull-to-refresh.module.js +11 -0
- package/dist/node/qr-code/encode.js +585 -0
- package/dist/node/qr-code/qr-code.js +41 -0
- package/dist/node/qr-code/qr-code.module.js +8 -0
- package/dist/node/radial-progress/radial-progress.js +28 -0
- package/dist/node/radial-progress/radial-progress.module.js +8 -0
- package/dist/node/radio/radio.js +49 -0
- package/dist/node/radio/radio.module.js +11 -0
- package/dist/node/radio-card/radio-card.js +63 -0
- package/dist/node/radio-card/radio-card.module.js +13 -0
- package/dist/node/rating-group/rating-group.js +37 -0
- package/dist/node/rating-group/rating-group.module.js +8 -0
- package/dist/node/react/src/index.js +138 -0
- package/dist/node/react/src/theme.js +54 -0
- package/dist/node/relative-time/relative-time.js +66 -0
- package/dist/node/relative-time/relative-time.module.js +5 -0
- package/dist/node/resizable/resizable.js +80 -0
- package/dist/node/resizable/resizable.module.js +10 -0
- package/dist/node/scroll-area/scroll-area.js +38 -0
- package/dist/node/scroll-area/scroll-area.module.js +5 -0
- package/dist/node/search/search.js +94 -0
- package/dist/node/search/search.module.js +11 -0
- package/dist/node/segmented-control/segmented-control.js +43 -0
- package/dist/node/segmented-control/segmented-control.module.js +8 -0
- package/dist/node/select/select.js +71 -0
- package/dist/node/select/select.module.js +13 -0
- package/dist/node/separator/separator.js +21 -0
- package/dist/node/separator/separator.module.js +5 -0
- package/dist/node/sheet/sheet.js +50 -0
- package/dist/node/sheet/sheet.module.js +11 -0
- package/dist/node/shell-header/shell-header.js +166 -0
- package/dist/node/shell-header/shell-header.module.js +25 -0
- package/dist/node/side-nav/side-nav.js +333 -0
- package/dist/node/side-nav/side-nav.module.js +33 -0
- package/dist/node/skeleton/skeleton.js +25 -0
- package/dist/node/skeleton/skeleton.module.js +9 -0
- package/dist/node/skip-nav/skip-nav.js +27 -0
- package/dist/node/skip-nav/skip-nav.module.js +5 -0
- package/dist/node/slider/slider.js +29 -0
- package/dist/node/slider/slider.module.js +9 -0
- package/dist/node/spinner/spinner.js +18 -0
- package/dist/node/spinner/spinner.module.js +8 -0
- package/dist/node/stack/stack.js +19 -0
- package/dist/node/stack/stack.module.js +8 -0
- package/dist/node/stat/stat.js +41 -0
- package/dist/node/stat/stat.module.js +13 -0
- package/dist/node/status/status.js +20 -0
- package/dist/node/status/status.module.js +9 -0
- package/dist/node/steps/steps.js +35 -0
- package/dist/node/steps/steps.module.js +10 -0
- package/dist/node/storage/src/drivers.js +36 -0
- package/dist/node/storage/src/persisted-signal.js +43 -0
- package/dist/node/structured-list/structured-list.js +101 -0
- package/dist/node/structured-list/structured-list.module.js +14 -0
- package/dist/node/swap/swap.js +36 -0
- package/dist/node/swap/swap.module.js +9 -0
- package/dist/node/swipe-item/swipe-item.js +62 -0
- package/dist/node/swipe-item/swipe-item.module.js +14 -0
- package/dist/node/switcher/switcher.js +32 -0
- package/dist/node/switcher/switcher.module.js +10 -0
- package/dist/node/tabs/tabs.js +95 -0
- package/dist/node/tabs/tabs.module.js +10 -0
- package/dist/node/tag/tag.js +26 -0
- package/dist/node/tag/tag.module.js +8 -0
- package/dist/node/tags-input/tags-input.js +64 -0
- package/dist/node/tags-input/tags-input.module.js +10 -0
- package/dist/node/text/text.js +18 -0
- package/dist/node/text/text.module.js +5 -0
- package/dist/node/textarea/textarea.js +56 -0
- package/dist/node/textarea/textarea.module.js +11 -0
- package/dist/node/tile/tile.js +39 -0
- package/dist/node/tile/tile.module.js +9 -0
- package/dist/node/time-picker/time-picker.js +62 -0
- package/dist/node/time-picker/time-picker.module.js +11 -0
- package/dist/node/timeline/timeline.js +41 -0
- package/dist/node/timeline/timeline.module.js +13 -0
- package/dist/node/toast/toast.js +85 -0
- package/dist/node/toast/toast.module.js +13 -0
- package/dist/node/toc/toc.js +42 -0
- package/dist/node/toc/toc.module.js +5 -0
- package/dist/node/toc/use-toc-from-region.js +18 -0
- package/dist/node/toggle/toggle.js +39 -0
- package/dist/node/toggle/toggle.module.js +10 -0
- package/dist/node/toggle-group/toggle-group.js +55 -0
- package/dist/node/toggle-group/toggle-group.module.js +8 -0
- package/dist/node/toggletip/toggletip.js +49 -0
- package/dist/node/toggletip/toggletip.module.js +9 -0
- package/dist/node/tooltip/tooltip.js +58 -0
- package/dist/node/tooltip/tooltip.module.js +8 -0
- package/dist/node/tree-view/tree-view.js +201 -0
- package/dist/node/tree-view/tree-view.module.js +15 -0
- package/dist/node/user/user.js +37 -0
- package/dist/node/user/user.module.js +11 -0
- package/dist/node/visually-hidden/visually-hidden.js +15 -0
- package/dist/node/visually-hidden/visually-hidden.module.js +5 -0
- package/dist/react/src/theme.js +35 -29
- package/package.json +3 -2
- package/readme.body.md +5 -5
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./radio-card.module.js";
|
|
4
|
+
import { cn as t } from "@cascivo/core";
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
import { createContext as i } from "react";
|
|
7
|
+
//#region ../components/src/radio-card/radio-card.tsx
|
|
8
|
+
var a = i({ name: "" });
|
|
9
|
+
function o({ name: r, label: i, value: o, defaultValue: s, onValueChange: c, children: l, className: u }) {
|
|
10
|
+
return /* @__PURE__ */ n(a.Provider, {
|
|
11
|
+
value: {
|
|
12
|
+
name: r,
|
|
13
|
+
value: o,
|
|
14
|
+
defaultValue: s,
|
|
15
|
+
onValueChange: c
|
|
16
|
+
},
|
|
17
|
+
children: /* @__PURE__ */ n("div", {
|
|
18
|
+
role: "radiogroup",
|
|
19
|
+
"aria-label": i,
|
|
20
|
+
className: t(e.group, u),
|
|
21
|
+
children: l
|
|
22
|
+
})
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
function s({ value: t, title: i, description: o, disabled: s, hideIndicator: c, ...l }) {
|
|
26
|
+
return /* @__PURE__ */ n(a.Consumer, { children: (a) => /* @__PURE__ */ r("label", {
|
|
27
|
+
className: e.card,
|
|
28
|
+
"data-disabled": s || void 0,
|
|
29
|
+
children: [
|
|
30
|
+
/* @__PURE__ */ n("input", {
|
|
31
|
+
type: "radio",
|
|
32
|
+
className: e.input,
|
|
33
|
+
name: a.name,
|
|
34
|
+
value: t,
|
|
35
|
+
disabled: s,
|
|
36
|
+
...a.value === void 0 ? {
|
|
37
|
+
defaultChecked: a.defaultValue === t,
|
|
38
|
+
onChange: () => a.onValueChange?.(t)
|
|
39
|
+
} : {
|
|
40
|
+
checked: a.value === t,
|
|
41
|
+
onChange: () => a.onValueChange?.(t)
|
|
42
|
+
},
|
|
43
|
+
...l
|
|
44
|
+
}),
|
|
45
|
+
!c && /* @__PURE__ */ n("span", {
|
|
46
|
+
className: e.glyph,
|
|
47
|
+
"aria-hidden": "true"
|
|
48
|
+
}),
|
|
49
|
+
/* @__PURE__ */ r("span", {
|
|
50
|
+
className: e.body,
|
|
51
|
+
children: [/* @__PURE__ */ n("span", {
|
|
52
|
+
className: e.title,
|
|
53
|
+
children: i
|
|
54
|
+
}), o && /* @__PURE__ */ n("span", {
|
|
55
|
+
className: e.description,
|
|
56
|
+
children: o
|
|
57
|
+
})]
|
|
58
|
+
})
|
|
59
|
+
]
|
|
60
|
+
}) });
|
|
61
|
+
}
|
|
62
|
+
//#endregion
|
|
63
|
+
export { s as RadioCard, o as RadioCardGroup };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
var e = {
|
|
4
|
+
group: "_group_1290l_2",
|
|
5
|
+
card: "_card_1290l_7",
|
|
6
|
+
input: "_input_1290l_39",
|
|
7
|
+
glyph: "_glyph_1290l_48",
|
|
8
|
+
body: "_body_1290l_65",
|
|
9
|
+
title: "_title_1290l_71",
|
|
10
|
+
description: "_description_1290l_77"
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as default };
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./rating-group.module.js";
|
|
4
|
+
import { cn as t } from "@cascivo/core";
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
//#region ../components/src/rating-group/rating-group.tsx
|
|
7
|
+
function r(e, t) {
|
|
8
|
+
return `${e} of ${t} stars`;
|
|
9
|
+
}
|
|
10
|
+
function i({ value: i, onValueChange: a, max: o = 5, size: s = "md", disabled: c = !1, readOnly: l = !1, labels: u, className: d, ...f }) {
|
|
11
|
+
let p = u?.rating ?? r, m = !c && !l && a !== void 0;
|
|
12
|
+
return /* @__PURE__ */ n("div", {
|
|
13
|
+
className: t(e.wrapper, d),
|
|
14
|
+
"data-size": s,
|
|
15
|
+
role: "radiogroup",
|
|
16
|
+
...f,
|
|
17
|
+
children: Array.from({ length: o }, (t, r) => {
|
|
18
|
+
let s = r + 1, l = s <= i;
|
|
19
|
+
return /* @__PURE__ */ n("button", {
|
|
20
|
+
type: "button",
|
|
21
|
+
role: "radio",
|
|
22
|
+
"aria-checked": s === i,
|
|
23
|
+
"aria-label": p(s, o),
|
|
24
|
+
className: e.star,
|
|
25
|
+
"data-filled": l ? "" : void 0,
|
|
26
|
+
"data-value": s,
|
|
27
|
+
disabled: c,
|
|
28
|
+
tabIndex: m ? 0 : -1,
|
|
29
|
+
onClick: () => {
|
|
30
|
+
m && a(s);
|
|
31
|
+
}
|
|
32
|
+
}, s);
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
//#endregion
|
|
37
|
+
export { i as RatingGroup };
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Spinner as e } from "../../spinner/spinner.js";
|
|
4
|
+
import { Button as t } from "../../button/button.js";
|
|
5
|
+
import { Input as n } from "../../input/input.js";
|
|
6
|
+
import { Card as r, CardContent as i, CardFooter as a, CardHeader as o, CardTitle as s } from "../../card/card.js";
|
|
7
|
+
import { Badge as c } from "../../badge/badge.js";
|
|
8
|
+
import { Modal as l } from "../../modal/modal.js";
|
|
9
|
+
import { Separator as u } from "../../separator/separator.js";
|
|
10
|
+
import { Alert as d } from "../../alert/alert.js";
|
|
11
|
+
import { Avatar as f } from "../../avatar/avatar.js";
|
|
12
|
+
import { AvatarGroup as p } from "../../avatar-group/avatar-group.js";
|
|
13
|
+
import { User as m } from "../../user/user.js";
|
|
14
|
+
import { Image as h } from "../../image/image.js";
|
|
15
|
+
import { Textarea as g } from "../../textarea/textarea.js";
|
|
16
|
+
import { Select as _ } from "../../select/select.js";
|
|
17
|
+
import { Checkbox as v } from "../../checkbox/checkbox.js";
|
|
18
|
+
import { Radio as y, RadioGroup as b } from "../../radio/radio.js";
|
|
19
|
+
import { Toggle as x } from "../../toggle/toggle.js";
|
|
20
|
+
import { Slider as S } from "../../slider/slider.js";
|
|
21
|
+
import { Tooltip as C } from "../../tooltip/tooltip.js";
|
|
22
|
+
import { Dropdown as w } from "../../dropdown/dropdown.js";
|
|
23
|
+
import { ToastProvider as T, dismissAllToasts as E, useToast as D } from "../../toast/toast.js";
|
|
24
|
+
import { Tabs as O, TabsContent as k, TabsList as A, TabsTrigger as j } from "../../tabs/tabs.js";
|
|
25
|
+
import { Accordion as M, AccordionContent as N, AccordionItem as P, AccordionTrigger as F } from "../../accordion/accordion.js";
|
|
26
|
+
import { ActionSheet as I } from "../../action-sheet/action-sheet.js";
|
|
27
|
+
import { Kbd as L } from "../../kbd/kbd.js";
|
|
28
|
+
import { Link as R } from "../../link/link.js";
|
|
29
|
+
import { Breadcrumb as z } from "../../breadcrumb/breadcrumb.js";
|
|
30
|
+
import { Toc as B } from "../../toc/toc.js";
|
|
31
|
+
import { useTocFromRegion as V } from "../../toc/use-toc-from-region.js";
|
|
32
|
+
import { Header as H } from "../../header/header.js";
|
|
33
|
+
import { usePopover as U } from "../../popover/use-popover.js";
|
|
34
|
+
import { SideNav as W } from "../../side-nav/side-nav.js";
|
|
35
|
+
import { Pagination as G } from "../../pagination/pagination.js";
|
|
36
|
+
import { ProgressIndicator as K } from "../../progress-indicator/progress-indicator.js";
|
|
37
|
+
import { Tag as q } from "../../tag/tag.js";
|
|
38
|
+
import { Skeleton as J } from "../../skeleton/skeleton.js";
|
|
39
|
+
import { ProgressBar as Y } from "../../progress-bar/progress-bar.js";
|
|
40
|
+
import { EmptyState as X } from "../../empty-state/empty-state.js";
|
|
41
|
+
import { Fab as Z } from "../../fab/fab.js";
|
|
42
|
+
import { OverflowMenu as Q } from "../../overflow-menu/overflow-menu.js";
|
|
43
|
+
import { Search as $ } from "../../search/search.js";
|
|
44
|
+
import { NumberInput as ee } from "../../number-input/number-input.js";
|
|
45
|
+
import { DataTable as te } from "../../data-table/data-table.js";
|
|
46
|
+
import { CommandMenu as ne, fuzzyMatch as re, fuzzyScore as ie } from "../../command-menu/command-menu.js";
|
|
47
|
+
import { Form as ae, createForm as oe, useForm as se } from "../../form/form.js";
|
|
48
|
+
import { Combobox as ce } from "../../combobox/combobox.js";
|
|
49
|
+
import { DatePicker as le } from "../../date-picker/date-picker.js";
|
|
50
|
+
import { FileUploader as ue } from "../../file-uploader/file-uploader.js";
|
|
51
|
+
import { TimePicker as de } from "../../time-picker/time-picker.js";
|
|
52
|
+
import { Popover as fe, PopoverContent as pe, PopoverTrigger as me } from "../../popover/popover.js";
|
|
53
|
+
import { Menu as he, MenuItem as ge, MenuSeparator as _e, MenuTrigger as ve } from "../../menu/menu.js";
|
|
54
|
+
import { AlertDialog as ye } from "../../alert-dialog/alert-dialog.js";
|
|
55
|
+
import { Sheet as be } from "../../sheet/sheet.js";
|
|
56
|
+
import { BottomSheet as xe } from "../../bottom-sheet/bottom-sheet.js";
|
|
57
|
+
import { ContextMenu as Se, ContextMenuItem as Ce } from "../../context-menu/context-menu.js";
|
|
58
|
+
import { Comparison as we } from "../../comparison/comparison.js";
|
|
59
|
+
import { HoverCard as Te, HoverCardContent as Ee, HoverCardTrigger as De } from "../../hover-card/hover-card.js";
|
|
60
|
+
import { PasswordInput as Oe } from "../../password-input/password-input.js";
|
|
61
|
+
import { MultiSelect as ke } from "../../multi-select/multi-select.js";
|
|
62
|
+
import { TagsInput as Ae } from "../../tags-input/tags-input.js";
|
|
63
|
+
import { OtpInput as je } from "../../otp-input/otp-input.js";
|
|
64
|
+
import { SegmentedControl as Me } from "../../segmented-control/segmented-control.js";
|
|
65
|
+
import { InputGroup as Ne, InputGroupAddon as Pe } from "../../input-group/input-group.js";
|
|
66
|
+
import { RatingGroup as Fe } from "../../rating-group/rating-group.js";
|
|
67
|
+
import { Editable as Ie } from "../../editable/editable.js";
|
|
68
|
+
import { RadioCard as Le, RadioCardGroup as Re } from "../../radio-card/radio-card.js";
|
|
69
|
+
import { ShellHeader as ze } from "../../shell-header/shell-header.js";
|
|
70
|
+
import { HeaderPanel as Be } from "../../header-panel/header-panel.js";
|
|
71
|
+
import { Switcher as Ve } from "../../switcher/switcher.js";
|
|
72
|
+
import { CheckboxCard as He } from "../../checkbox-card/checkbox-card.js";
|
|
73
|
+
import { CopyButton as Ue } from "../../copy-button/copy-button.js";
|
|
74
|
+
import { Stat as We } from "../../stat/stat.js";
|
|
75
|
+
import { Status as Ge } from "../../status/status.js";
|
|
76
|
+
import { VisuallyHidden as Ke } from "../../visually-hidden/visually-hidden.js";
|
|
77
|
+
import { SkipNavLink as qe, SkipNavTarget as Je } from "../../skip-nav/skip-nav.js";
|
|
78
|
+
import { Progress as Ye } from "../../progress/progress.js";
|
|
79
|
+
import { ProgressCircle as Xe } from "../../progress-circle/progress-circle.js";
|
|
80
|
+
import { Heading as Ze } from "../../heading/heading.js";
|
|
81
|
+
import { Text as Qe } from "../../text/text.js";
|
|
82
|
+
import { Code as $e } from "../../code/code.js";
|
|
83
|
+
import { Blockquote as et } from "../../blockquote/blockquote.js";
|
|
84
|
+
import { List as tt, ListItem as nt } from "../../list/list.js";
|
|
85
|
+
import { LogViewer as rt } from "../../log-viewer/log-viewer.js";
|
|
86
|
+
import { Prose as it } from "../../prose/prose.js";
|
|
87
|
+
import { PullToRefresh as at } from "../../pull-to-refresh/pull-to-refresh.js";
|
|
88
|
+
import { QrCode as ot } from "../../qr-code/qr-code.js";
|
|
89
|
+
import { RelativeTime as st } from "../../relative-time/relative-time.js";
|
|
90
|
+
import { Label as ct } from "../../label/label.js";
|
|
91
|
+
import { Field as lt } from "../../field/field.js";
|
|
92
|
+
import { Filter as ut } from "../../filter/filter.js";
|
|
93
|
+
import { IconButton as dt } from "../../icon-button/icon-button.js";
|
|
94
|
+
import { ButtonGroup as ft } from "../../button-group/button-group.js";
|
|
95
|
+
import { ToggleGroup as pt } from "../../toggle-group/toggle-group.js";
|
|
96
|
+
import { InlineLoading as mt } from "../../inline-loading/inline-loading.js";
|
|
97
|
+
import { Notification as ht } from "../../notification/notification.js";
|
|
98
|
+
import { ScrollArea as gt } from "../../scroll-area/scroll-area.js";
|
|
99
|
+
import { Collapsible as _t } from "../../collapsible/collapsible.js";
|
|
100
|
+
import { AspectRatio as vt } from "../../aspect-ratio/aspect-ratio.js";
|
|
101
|
+
import { MenuButton as yt } from "../../menu-button/menu-button.js";
|
|
102
|
+
import { Toggletip as bt } from "../../toggletip/toggletip.js";
|
|
103
|
+
import { Menubar as xt } from "../../menubar/menubar.js";
|
|
104
|
+
import { NavigationMenu as St } from "../../navigation-menu/navigation-menu.js";
|
|
105
|
+
import { TreeView as Ct, treeViewMessages as wt } from "../../tree-view/tree-view.js";
|
|
106
|
+
import { StructuredList as Tt } from "../../structured-list/structured-list.js";
|
|
107
|
+
import { ContainedList as Et, ContainedListItem as Dt } from "../../contained-list/contained-list.js";
|
|
108
|
+
import { DataList as Ot } from "../../data-list/data-list.js";
|
|
109
|
+
import { Timeline as kt } from "../../timeline/timeline.js";
|
|
110
|
+
import { Item as At, ItemActions as jt, ItemContent as Mt, ItemDescription as Nt, ItemMedia as Pt, ItemTitle as Ft } from "../../item/item.js";
|
|
111
|
+
import { Calendar as It } from "../../calendar/calendar.js";
|
|
112
|
+
import { DateRangePicker as Lt } from "../../date-range-picker/date-range-picker.js";
|
|
113
|
+
import { ColorPicker as Rt } from "../../color-picker/color-picker.js";
|
|
114
|
+
import { Carousel as zt } from "../../carousel/carousel.js";
|
|
115
|
+
import { Resizable as Bt } from "../../resizable/resizable.js";
|
|
116
|
+
import { Dock as Vt } from "../../dock/dock.js";
|
|
117
|
+
import { Drawer as Ht } from "../../drawer/drawer.js";
|
|
118
|
+
import { NativeSelect as Ut } from "../../native-select/native-select.js";
|
|
119
|
+
import { CodeSnippet as Wt } from "../../code-snippet/code-snippet.js";
|
|
120
|
+
import { Steps as Gt } from "../../steps/steps.js";
|
|
121
|
+
import { Tile as Kt } from "../../tile/tile.js";
|
|
122
|
+
import { Indicator as qt } from "../../indicator/indicator.js";
|
|
123
|
+
import { Join as Jt } from "../../join/join.js";
|
|
124
|
+
import { Stack as Yt } from "../../stack/stack.js";
|
|
125
|
+
import { AppShell as Xt } from "../../app-shell/app-shell.js";
|
|
126
|
+
import { ChatBubble as Zt } from "../../chat-bubble/chat-bubble.js";
|
|
127
|
+
import { RadialProgress as Qt } from "../../radial-progress/radial-progress.js";
|
|
128
|
+
import { Swap as $t } from "../../swap/swap.js";
|
|
129
|
+
import { SwipeItem as en } from "../../swipe-item/swipe-item.js";
|
|
130
|
+
import { Grid as tn, GridItem as nn } from "../../layouts/src/grid/grid.js";
|
|
131
|
+
import { Flex as rn } from "../../layouts/src/flex/flex.js";
|
|
132
|
+
import { Columns as an } from "../../layouts/src/columns/columns.js";
|
|
133
|
+
import { Center as on } from "../../layouts/src/center/center.js";
|
|
134
|
+
import { Spacer as sn } from "../../layouts/src/spacer/spacer.js";
|
|
135
|
+
import { AutoGrid as cn } from "../../layouts/src/auto-grid/auto-grid.js";
|
|
136
|
+
import { ThemeProvider as ln, setTheme as un, themePreloadScript as dn, useTheme as fn } from "./theme.js";
|
|
137
|
+
import { ErrorBoundary as pn, FocusScope as mn, Portal as hn, SuspenseBoundary as gn, getLinkComponent as _n, setLinkComponent as vn } from "@cascivo/core";
|
|
138
|
+
export { M as Accordion, N as AccordionContent, P as AccordionItem, F as AccordionTrigger, I as ActionSheet, d as Alert, ye as AlertDialog, Xt as AppShell, vt as AspectRatio, cn as AutoGrid, f as Avatar, p as AvatarGroup, c as Badge, et as Blockquote, xe as BottomSheet, z as Breadcrumb, t as Button, ft as ButtonGroup, It as Calendar, r as Card, i as CardContent, a as CardFooter, o as CardHeader, s as CardTitle, zt as Carousel, on as Center, Zt as ChatBubble, v as Checkbox, He as CheckboxCard, $e as Code, Wt as CodeSnippet, _t as Collapsible, Rt as ColorPicker, an as Columns, ce as Combobox, ne as CommandMenu, we as Comparison, Et as ContainedList, Dt as ContainedListItem, Se as ContextMenu, Ce as ContextMenuItem, Ue as CopyButton, Ot as DataList, te as DataTable, le as DatePicker, Lt as DateRangePicker, Vt as Dock, Ht as Drawer, w as Dropdown, Ie as Editable, X as EmptyState, pn as ErrorBoundary, Z as Fab, lt as Field, ue as FileUploader, ut as Filter, rn as Flex, mn as FocusScope, ae as Form, tn as Grid, nn as GridItem, H as Header, Be as HeaderPanel, Ze as Heading, Te as HoverCard, Ee as HoverCardContent, De as HoverCardTrigger, dt as IconButton, h as Image, qt as Indicator, mt as InlineLoading, n as Input, Ne as InputGroup, Pe as InputGroupAddon, At as Item, jt as ItemActions, Mt as ItemContent, Nt as ItemDescription, Pt as ItemMedia, Ft as ItemTitle, Jt as Join, L as Kbd, ct as Label, R as Link, tt as List, nt as ListItem, rt as LogViewer, he as Menu, yt as MenuButton, ge as MenuItem, _e as MenuSeparator, ve as MenuTrigger, xt as Menubar, l as Modal, ke as MultiSelect, Ut as NativeSelect, St as NavigationMenu, ht as Notification, ee as NumberInput, je as OtpInput, Q as OverflowMenu, G as Pagination, Oe as PasswordInput, fe as Popover, pe as PopoverContent, me as PopoverTrigger, hn as Portal, Ye as Progress, Y as ProgressBar, Xe as ProgressCircle, K as ProgressIndicator, it as Prose, at as PullToRefresh, ot as QrCode, Qt as RadialProgress, y as Radio, Le as RadioCard, Re as RadioCardGroup, b as RadioGroup, Fe as RatingGroup, st as RelativeTime, Bt as Resizable, gt as ScrollArea, $ as Search, Me as SegmentedControl, _ as Select, u as Separator, be as Sheet, ze as ShellHeader, W as SideNav, J as Skeleton, qe as SkipNavLink, Je as SkipNavTarget, S as Slider, sn as Spacer, e as Spinner, Yt as Stack, We as Stat, Ge as Status, Gt as Steps, Tt as StructuredList, gn as SuspenseBoundary, $t as Swap, en as SwipeItem, Ve as Switcher, O as Tabs, k as TabsContent, A as TabsList, j as TabsTrigger, q as Tag, Ae as TagsInput, Qe as Text, g as Textarea, ln as ThemeProvider, Kt as Tile, de as TimePicker, kt as Timeline, T as ToastProvider, B as Toc, x as Toggle, pt as ToggleGroup, bt as Toggletip, C as Tooltip, Ct as TreeView, m as User, Ke as VisuallyHidden, oe as createForm, E as dismissAllToasts, re as fuzzyMatch, ie as fuzzyScore, _n as getLinkComponent, vn as setLinkComponent, un as setTheme, dn as themePreloadScript, wt as treeViewMessages, se as useForm, U as usePopover, fn as useTheme, D as useToast, V as useTocFromRegion };
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { persistedSignal as e } from "../../storage/src/persisted-signal.js";
|
|
4
|
+
import { useSignalEffect as t, useSignals as n } from "@cascivo/core";
|
|
5
|
+
import { Fragment as r, jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import { useRef as o } from "react";
|
|
7
|
+
//#region src/theme.tsx
|
|
8
|
+
var s = "cascivo-theme", c = "data-theme", l = null, u = {
|
|
9
|
+
storageKey: s,
|
|
10
|
+
defaultTheme: "light",
|
|
11
|
+
explicit: !1
|
|
12
|
+
};
|
|
13
|
+
function d(e) {
|
|
14
|
+
return typeof window > "u" || typeof window.matchMedia != "function" ? e : window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : window.matchMedia("(prefers-color-scheme: light)").matches ? "light" : e;
|
|
15
|
+
}
|
|
16
|
+
function f() {
|
|
17
|
+
return u.explicit ? u.defaultTheme : d(u.defaultTheme);
|
|
18
|
+
}
|
|
19
|
+
function p() {
|
|
20
|
+
return l ??= e(u.storageKey, f()), l;
|
|
21
|
+
}
|
|
22
|
+
function m(e) {
|
|
23
|
+
p().value = e;
|
|
24
|
+
}
|
|
25
|
+
function h() {
|
|
26
|
+
return n(), [p(), m];
|
|
27
|
+
}
|
|
28
|
+
function g(e) {
|
|
29
|
+
return JSON.stringify(e).replace(/</g, "\\u003c");
|
|
30
|
+
}
|
|
31
|
+
function _({ defaultTheme: e, value: n, storageKey: d = s, attribute: f = c, target: m, onChange: h, nonce: _, children: v }) {
|
|
32
|
+
let y = o(!1);
|
|
33
|
+
y.current || (y.current = !0, (l === null || u.storageKey !== d) && (u = {
|
|
34
|
+
storageKey: d,
|
|
35
|
+
defaultTheme: e ?? "light",
|
|
36
|
+
explicit: e !== void 0
|
|
37
|
+
}, l = null));
|
|
38
|
+
let b = p();
|
|
39
|
+
n !== void 0 && (b.value = n);
|
|
40
|
+
let x = o(h);
|
|
41
|
+
return x.current = h, t(() => {
|
|
42
|
+
let e = b.value;
|
|
43
|
+
(m ? m.current : typeof document < "u" ? document.documentElement : null)?.setAttribute(f, e), x.current?.(e);
|
|
44
|
+
}), n !== void 0 && !m ? /* @__PURE__ */ a(r, { children: [/* @__PURE__ */ i("script", {
|
|
45
|
+
nonce: _,
|
|
46
|
+
dangerouslySetInnerHTML: { __html: `document.documentElement.setAttribute(${g(f)},${g(n)})` }
|
|
47
|
+
}), v] }) : /* @__PURE__ */ i(r, { children: v });
|
|
48
|
+
}
|
|
49
|
+
function v(e = {}) {
|
|
50
|
+
let t = JSON.stringify(e.storageKey ?? s), n = JSON.stringify(e.attribute ?? c), r = JSON.stringify(e.defaultTheme ?? "light"), i = e.defaultTheme === void 0 ? "if(typeof matchMedia==='function'){if(matchMedia('(prefers-color-scheme: dark)').matches)v='dark';else if(matchMedia('(prefers-color-scheme: light)').matches)v='light';}" : "";
|
|
51
|
+
return `(function(){try{var v=${r};` + i + `var raw=localStorage.getItem(${t});if(raw){v=raw;try{var e=JSON.parse(raw);if(e&&typeof e==='object'&&'value'in e)v=e.value;}catch(_){}}document.documentElement.setAttribute(${n},v);}catch(_){}})();`;
|
|
52
|
+
}
|
|
53
|
+
//#endregion
|
|
54
|
+
export { _ as ThemeProvider, m as setTheme, v as themePreloadScript, h as useTheme };
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./relative-time.module.js";
|
|
4
|
+
import { cn as t, useSignal as n, useSignalEffect as r, useSignals as i } from "@cascivo/core";
|
|
5
|
+
import { formatDate as a, formatRelativeTime as o } from "@cascivo/i18n";
|
|
6
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
7
|
+
//#region ../components/src/relative-time/relative-time.tsx
|
|
8
|
+
var c = 1e3, l = 60 * c, u = 60 * l, d = 24 * u, f = 7 * d, p = 30 * d, m = 365 * d;
|
|
9
|
+
function h(e) {
|
|
10
|
+
let t = Math.abs(e);
|
|
11
|
+
return t < l ? {
|
|
12
|
+
value: Math.round(e / c),
|
|
13
|
+
unit: "second",
|
|
14
|
+
nextUpdateMs: c
|
|
15
|
+
} : t < u ? {
|
|
16
|
+
value: Math.round(e / l),
|
|
17
|
+
unit: "minute",
|
|
18
|
+
nextUpdateMs: l
|
|
19
|
+
} : t < d ? {
|
|
20
|
+
value: Math.round(e / u),
|
|
21
|
+
unit: "hour",
|
|
22
|
+
nextUpdateMs: u
|
|
23
|
+
} : t < f ? {
|
|
24
|
+
value: Math.round(e / d),
|
|
25
|
+
unit: "day",
|
|
26
|
+
nextUpdateMs: d
|
|
27
|
+
} : t < p ? {
|
|
28
|
+
value: Math.round(e / f),
|
|
29
|
+
unit: "week",
|
|
30
|
+
nextUpdateMs: d
|
|
31
|
+
} : t < m ? {
|
|
32
|
+
value: Math.round(e / p),
|
|
33
|
+
unit: "month",
|
|
34
|
+
nextUpdateMs: d
|
|
35
|
+
} : {
|
|
36
|
+
value: Math.round(e / m),
|
|
37
|
+
unit: "year",
|
|
38
|
+
nextUpdateMs: d
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
var g = (e) => e instanceof Date ? e.getTime() : typeof e == "number" ? e : Date.parse(e);
|
|
42
|
+
function _({ date: c, sync: l = !0, now: u, format: d, className: f, ...p }) {
|
|
43
|
+
i();
|
|
44
|
+
let m = g(c), _ = u !== void 0, v = n(u ?? Date.now());
|
|
45
|
+
_ && (v.value = u), r(() => {
|
|
46
|
+
if (_ || typeof window > "u" || (v.value = Date.now(), !l)) return;
|
|
47
|
+
let { nextUpdateMs: e } = h(m - v.value), t = window.setInterval(() => {
|
|
48
|
+
v.value = Date.now();
|
|
49
|
+
}, e);
|
|
50
|
+
return () => window.clearInterval(t);
|
|
51
|
+
});
|
|
52
|
+
let { value: y, unit: b } = h(m - v.value), x = o(y, b, d);
|
|
53
|
+
return /* @__PURE__ */ s("time", {
|
|
54
|
+
dateTime: new Date(m).toISOString(),
|
|
55
|
+
title: a(m, {
|
|
56
|
+
dateStyle: "long",
|
|
57
|
+
timeStyle: "short"
|
|
58
|
+
}),
|
|
59
|
+
className: t(e.relativeTime, f),
|
|
60
|
+
suppressHydrationWarning: !0,
|
|
61
|
+
...p,
|
|
62
|
+
children: x
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
//#endregion
|
|
66
|
+
export { _ as RelativeTime };
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./resizable.module.js";
|
|
4
|
+
import { cn as t, useControllableSignal as n, useSignal as r, useSignalEffect as i, useSignals as a } from "@cascivo/core";
|
|
5
|
+
import { builtin as o, t as s } from "@cascivo/i18n";
|
|
6
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
7
|
+
import { Children as u, useRef as d } from "react";
|
|
8
|
+
//#region ../components/src/resizable/resizable.tsx
|
|
9
|
+
function f(e, t, n) {
|
|
10
|
+
return Math.min(n, Math.max(t, e));
|
|
11
|
+
}
|
|
12
|
+
function p({ children: p, orientation: m = "horizontal", defaultRatio: h = .5, ratio: g, minRatio: _ = .1, maxRatio: v = .9, onRatioChange: y, className: b, label: x }) {
|
|
13
|
+
a();
|
|
14
|
+
let [S, C] = u.toArray(p), [w, T] = n({
|
|
15
|
+
value: g,
|
|
16
|
+
defaultValue: h,
|
|
17
|
+
onChange: y
|
|
18
|
+
}), E = d(null), D = r(!1), O = (e) => {
|
|
19
|
+
T(f(e, _, v));
|
|
20
|
+
}, k = (e, t) => {
|
|
21
|
+
let n = E.current;
|
|
22
|
+
if (!n) return w.value;
|
|
23
|
+
let r = n.getBoundingClientRect();
|
|
24
|
+
return m === "horizontal" ? (e - r.left) / r.width : (t - r.top) / r.height;
|
|
25
|
+
};
|
|
26
|
+
i(() => {
|
|
27
|
+
if (!D.value) return;
|
|
28
|
+
let e = (e) => O(k(e.clientX, e.clientY)), t = () => {
|
|
29
|
+
D.value = !1;
|
|
30
|
+
};
|
|
31
|
+
return window.addEventListener("pointermove", e), window.addEventListener("pointerup", t), () => {
|
|
32
|
+
window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", t);
|
|
33
|
+
};
|
|
34
|
+
});
|
|
35
|
+
let A = (e) => {
|
|
36
|
+
let t = e.shiftKey ? .1 : .02, n = m === "horizontal" ? "ArrowLeft" : "ArrowUp", r = m === "horizontal" ? "ArrowRight" : "ArrowDown";
|
|
37
|
+
if (e.key === n) O(w.value - t);
|
|
38
|
+
else if (e.key === r) O(w.value + t);
|
|
39
|
+
else if (e.key === "Home") O(_);
|
|
40
|
+
else if (e.key === "End") O(v);
|
|
41
|
+
else return;
|
|
42
|
+
e.preventDefault();
|
|
43
|
+
}, j = x ?? s(o.resizable.handle), M = Math.round(w.value * 100);
|
|
44
|
+
return /* @__PURE__ */ l("div", {
|
|
45
|
+
ref: E,
|
|
46
|
+
className: t(e.resizable, b),
|
|
47
|
+
"data-orientation": m,
|
|
48
|
+
style: { "--cascivo-resizable-ratio": w.value },
|
|
49
|
+
children: [
|
|
50
|
+
/* @__PURE__ */ c("div", {
|
|
51
|
+
className: e.pane,
|
|
52
|
+
children: S
|
|
53
|
+
}),
|
|
54
|
+
/* @__PURE__ */ c("div", {
|
|
55
|
+
className: e.handle,
|
|
56
|
+
role: "separator",
|
|
57
|
+
"aria-orientation": m,
|
|
58
|
+
"aria-label": j,
|
|
59
|
+
"aria-valuenow": M,
|
|
60
|
+
"aria-valuemin": Math.round(_ * 100),
|
|
61
|
+
"aria-valuemax": Math.round(v * 100),
|
|
62
|
+
tabIndex: 0,
|
|
63
|
+
onKeyDown: A,
|
|
64
|
+
onPointerDown: (e) => {
|
|
65
|
+
e.preventDefault(), D.value = !0;
|
|
66
|
+
},
|
|
67
|
+
children: /* @__PURE__ */ c("span", {
|
|
68
|
+
className: e.grip,
|
|
69
|
+
"aria-hidden": "true"
|
|
70
|
+
})
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ c("div", {
|
|
73
|
+
className: e.pane,
|
|
74
|
+
children: C
|
|
75
|
+
})
|
|
76
|
+
]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { p as Resizable };
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./scroll-area.module.js";
|
|
4
|
+
import { cn as t, useSignalEffect as n, useSignals as r } from "@cascivo/core";
|
|
5
|
+
import { jsx as i } from "react/jsx-runtime";
|
|
6
|
+
import { useRef as a } from "react";
|
|
7
|
+
//#region ../components/src/scroll-area/scroll-area.tsx
|
|
8
|
+
function o({ height: o, width: s, orientation: c = "vertical", edges: l = "shadow", className: u, style: d, children: f, ...p }) {
|
|
9
|
+
r();
|
|
10
|
+
let m = a(null);
|
|
11
|
+
n(() => {
|
|
12
|
+
let e = m.current;
|
|
13
|
+
if (!e) return;
|
|
14
|
+
let t = () => {
|
|
15
|
+
let t = e.scrollTop <= 0, n = e.scrollTop + e.clientHeight >= e.scrollHeight - 1, r = e.scrollLeft <= 0, i = e.scrollLeft + e.clientWidth >= e.scrollWidth - 1;
|
|
16
|
+
e.toggleAttribute("data-scroll-top", !t), e.toggleAttribute("data-scroll-bottom", !n), e.toggleAttribute("data-scroll-start", !r), e.toggleAttribute("data-scroll-end", !i);
|
|
17
|
+
};
|
|
18
|
+
return t(), e.addEventListener("scroll", t, { passive: !0 }), () => {
|
|
19
|
+
e.removeEventListener("scroll", t);
|
|
20
|
+
};
|
|
21
|
+
});
|
|
22
|
+
let h = {
|
|
23
|
+
...o === void 0 ? {} : { "--cascivo-scroll-area-height": o },
|
|
24
|
+
...s === void 0 ? {} : { "--cascivo-scroll-area-width": s },
|
|
25
|
+
...d
|
|
26
|
+
};
|
|
27
|
+
return /* @__PURE__ */ i("div", {
|
|
28
|
+
ref: m,
|
|
29
|
+
"data-orientation": c,
|
|
30
|
+
"data-edges": l,
|
|
31
|
+
className: t(e.root, u),
|
|
32
|
+
style: h,
|
|
33
|
+
...p,
|
|
34
|
+
children: f
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
//#endregion
|
|
38
|
+
export { o as ScrollArea };
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./search.module.js";
|
|
4
|
+
import { cn as t, useSignal as n, useSignalEffect as r, useSignals as i } from "@cascivo/core";
|
|
5
|
+
import { builtin as a, t as o } from "@cascivo/i18n";
|
|
6
|
+
import { jsx as s, jsxs as c } from "react/jsx-runtime";
|
|
7
|
+
import { useRef as l } from "react";
|
|
8
|
+
//#region ../components/src/search/search.tsx
|
|
9
|
+
var u = 0;
|
|
10
|
+
function d() {
|
|
11
|
+
return /* @__PURE__ */ c("svg", {
|
|
12
|
+
viewBox: "0 0 16 16",
|
|
13
|
+
width: "16",
|
|
14
|
+
height: "16",
|
|
15
|
+
fill: "none",
|
|
16
|
+
stroke: "currentColor",
|
|
17
|
+
strokeWidth: "1.5",
|
|
18
|
+
strokeLinecap: "round",
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
children: [/* @__PURE__ */ s("circle", {
|
|
21
|
+
cx: "7",
|
|
22
|
+
cy: "7",
|
|
23
|
+
r: "4.5"
|
|
24
|
+
}), /* @__PURE__ */ s("line", {
|
|
25
|
+
x1: "10.5",
|
|
26
|
+
y1: "10.5",
|
|
27
|
+
x2: "14",
|
|
28
|
+
y2: "14"
|
|
29
|
+
})]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
function f({ value: f, defaultValue: p = "", onValueChange: m, onChange: h, onSearch: g, debounceMs: _ = 300, placeholder: v, size: y = "md", label: b, disabled: x = !1, clearLabel: S, id: C, className: w }) {
|
|
33
|
+
i();
|
|
34
|
+
let T = v ?? o(a.search.placeholder), E = b ?? o(a.search.label), D = S ?? o(a.search.clear), O = l(null), k = l("");
|
|
35
|
+
k.current === "" && (u += 1, k.current = `cascade-search-${u}`);
|
|
36
|
+
let A = C ?? k.current, j = f !== void 0, M = n(j ? f : p);
|
|
37
|
+
j && (M.value = f);
|
|
38
|
+
let N = l(g);
|
|
39
|
+
N.current = g;
|
|
40
|
+
let P = l(null), F = () => {
|
|
41
|
+
P.current !== null && (clearTimeout(P.current), P.current = null);
|
|
42
|
+
};
|
|
43
|
+
r(() => F);
|
|
44
|
+
let I = (e) => {
|
|
45
|
+
let t = e.target.value;
|
|
46
|
+
j || (M.value = t), (m ?? h)?.(t), F(), P.current = setTimeout(() => {
|
|
47
|
+
P.current = null, N.current?.(t);
|
|
48
|
+
}, _);
|
|
49
|
+
}, L = (e) => {
|
|
50
|
+
e.key === "Enter" && (F(), g?.(M.value));
|
|
51
|
+
}, R = () => {
|
|
52
|
+
F(), j || (M.value = ""), (m ?? h)?.(""), g?.(""), O.current?.focus();
|
|
53
|
+
}, z = M.value !== "";
|
|
54
|
+
return /* @__PURE__ */ c("div", {
|
|
55
|
+
className: t(e.root, w),
|
|
56
|
+
"data-size": y,
|
|
57
|
+
"data-state": z ? "filled" : "empty",
|
|
58
|
+
children: [
|
|
59
|
+
/* @__PURE__ */ s("label", {
|
|
60
|
+
className: e.label,
|
|
61
|
+
htmlFor: A,
|
|
62
|
+
children: E
|
|
63
|
+
}),
|
|
64
|
+
/* @__PURE__ */ s("span", {
|
|
65
|
+
className: e.icon,
|
|
66
|
+
children: /* @__PURE__ */ s(d, {})
|
|
67
|
+
}),
|
|
68
|
+
/* @__PURE__ */ s("input", {
|
|
69
|
+
ref: O,
|
|
70
|
+
id: A,
|
|
71
|
+
type: "search",
|
|
72
|
+
className: e.input,
|
|
73
|
+
value: M.value,
|
|
74
|
+
placeholder: T,
|
|
75
|
+
disabled: x,
|
|
76
|
+
onChange: I,
|
|
77
|
+
onKeyDown: L
|
|
78
|
+
}),
|
|
79
|
+
z && /* @__PURE__ */ s("button", {
|
|
80
|
+
type: "button",
|
|
81
|
+
className: e.clear,
|
|
82
|
+
"aria-label": D,
|
|
83
|
+
disabled: x,
|
|
84
|
+
onClick: R,
|
|
85
|
+
children: /* @__PURE__ */ s("span", {
|
|
86
|
+
"aria-hidden": "true",
|
|
87
|
+
children: "✕"
|
|
88
|
+
})
|
|
89
|
+
})
|
|
90
|
+
]
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
//#endregion
|
|
94
|
+
export { f as Search };
|