@cascivo/react 0.8.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 +24 -11
- package/dist/combobox/combobox.js +73 -73
- package/dist/command-menu/command-menu.js +2 -2
- package/dist/date-picker/date-picker.js +95 -95
- package/dist/field/field.js +24 -15
- package/dist/filter/filter.js +12 -12
- package/dist/index.d.ts +74 -8
- package/dist/index.js +2 -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/number-input/number-input.js +41 -41
- package/dist/react/src/theme.js +42 -31
- package/dist/search/search.js +35 -35
- package/dist/swap/swap.js +12 -12
- package/dist/time-picker/time-picker.js +24 -24
- package/dist/toggle/toggle.js +12 -12
- package/package.json +7 -6
- package/readme.body.md +24 -11
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./comparison.module.js";
|
|
4
|
+
import { cn as t, useControllableSignal as n, useSignal 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/comparison/comparison.tsx
|
|
9
|
+
var u = (e) => Math.min(100, Math.max(0, e));
|
|
10
|
+
function d({ after: d, before: f, position: p, defaultPosition: m = 50, onPositionChange: h, orientation: g = "horizontal", keyboardStep: _ = 5, label: v, className: y, ...b }) {
|
|
11
|
+
i();
|
|
12
|
+
let x = l(null), S = r(!1), [C, w] = n({
|
|
13
|
+
value: p,
|
|
14
|
+
defaultValue: m,
|
|
15
|
+
onChange: h
|
|
16
|
+
}), T = Math.round(u(C.value)), E = (e) => {
|
|
17
|
+
let t = x.current;
|
|
18
|
+
if (!t) return;
|
|
19
|
+
let n = t.getBoundingClientRect();
|
|
20
|
+
w(u(g === "vertical" ? (e.clientY - n.top) / n.height * 100 : (e.clientX - n.left) / n.width * 100));
|
|
21
|
+
}, D = (e) => {
|
|
22
|
+
let t = g === "vertical" ? "ArrowUp" : "ArrowLeft", n = g === "vertical" ? "ArrowDown" : "ArrowRight", r = null;
|
|
23
|
+
e.key === t || e.key === "ArrowLeft" || e.key === "ArrowUp" ? r = T - _ : e.key === n || e.key === "ArrowRight" || e.key === "ArrowDown" ? r = T + _ : e.key === "Home" ? r = 0 : e.key === "End" ? r = 100 : e.key === "PageUp" ? r = T + _ * 2 : e.key === "PageDown" && (r = T - _ * 2), r !== null && (e.preventDefault(), w(u(r)));
|
|
24
|
+
};
|
|
25
|
+
return /* @__PURE__ */ c("div", {
|
|
26
|
+
ref: x,
|
|
27
|
+
"data-orientation": g,
|
|
28
|
+
"data-dragging": S.value || void 0,
|
|
29
|
+
className: t(e.comparison, y),
|
|
30
|
+
style: { "--position": `${T}%` },
|
|
31
|
+
onPointerDown: (e) => {
|
|
32
|
+
S.value = !0, e.currentTarget.setPointerCapture?.(e.pointerId), E(e);
|
|
33
|
+
},
|
|
34
|
+
onPointerMove: (e) => {
|
|
35
|
+
S.value && E(e);
|
|
36
|
+
},
|
|
37
|
+
onPointerUp: (e) => {
|
|
38
|
+
S.value = !1, e.currentTarget.releasePointerCapture?.(e.pointerId);
|
|
39
|
+
},
|
|
40
|
+
...b,
|
|
41
|
+
children: [
|
|
42
|
+
/* @__PURE__ */ s("div", {
|
|
43
|
+
className: e.item,
|
|
44
|
+
children: d
|
|
45
|
+
}),
|
|
46
|
+
/* @__PURE__ */ s("div", {
|
|
47
|
+
className: e.before,
|
|
48
|
+
"aria-hidden": "true",
|
|
49
|
+
children: f
|
|
50
|
+
}),
|
|
51
|
+
/* @__PURE__ */ s("div", {
|
|
52
|
+
className: e.divider,
|
|
53
|
+
children: /* @__PURE__ */ s("div", {
|
|
54
|
+
role: "slider",
|
|
55
|
+
tabIndex: 0,
|
|
56
|
+
"aria-label": v ?? o(a.comparison.label),
|
|
57
|
+
"aria-orientation": g,
|
|
58
|
+
"aria-valuemin": 0,
|
|
59
|
+
"aria-valuemax": 100,
|
|
60
|
+
"aria-valuenow": T,
|
|
61
|
+
className: e.handle,
|
|
62
|
+
onKeyDown: D
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
]
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { d as Comparison };
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./contained-list.module.js";
|
|
4
|
+
import { Slot as t, cn as n } from "@cascivo/core";
|
|
5
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
6
|
+
//#region ../components/src/contained-list/contained-list.tsx
|
|
7
|
+
function a({ label: t, kind: a = "on-page", action: o, className: s, children: c, ...l }) {
|
|
8
|
+
return /* @__PURE__ */ i("div", {
|
|
9
|
+
"data-kind": a,
|
|
10
|
+
className: n(e.root, s),
|
|
11
|
+
...l,
|
|
12
|
+
children: [/* @__PURE__ */ i("div", {
|
|
13
|
+
className: e.header,
|
|
14
|
+
children: [/* @__PURE__ */ r("h3", {
|
|
15
|
+
className: e.label,
|
|
16
|
+
children: t
|
|
17
|
+
}), o ? /* @__PURE__ */ r("div", {
|
|
18
|
+
className: e.action,
|
|
19
|
+
children: o
|
|
20
|
+
}) : null]
|
|
21
|
+
}), /* @__PURE__ */ r("ul", {
|
|
22
|
+
className: e.list,
|
|
23
|
+
children: c
|
|
24
|
+
})]
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
function o({ asChild: i = !1, onClick: a, className: o, children: s, ...c }) {
|
|
28
|
+
let l = i || typeof a == "function", u = i ? t : "div";
|
|
29
|
+
return /* @__PURE__ */ r("li", {
|
|
30
|
+
className: e.item,
|
|
31
|
+
"data-interactive": l ? "" : void 0,
|
|
32
|
+
children: /* @__PURE__ */ r(u, {
|
|
33
|
+
className: n(e.itemContent, o),
|
|
34
|
+
onClick: a,
|
|
35
|
+
...c,
|
|
36
|
+
children: s
|
|
37
|
+
})
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
//#endregion
|
|
41
|
+
export { a as ContainedList, o as ContainedListItem };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
var e = {
|
|
4
|
+
root: "_root_u2rtc_2",
|
|
5
|
+
header: "_header_u2rtc_11",
|
|
6
|
+
label: "_label_u2rtc_25",
|
|
7
|
+
action: "_action_u2rtc_33",
|
|
8
|
+
list: "_list_u2rtc_39",
|
|
9
|
+
item: "_item_u2rtc_45",
|
|
10
|
+
itemContent: "_itemContent_u2rtc_57"
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as default };
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./context-menu.module.js";
|
|
4
|
+
import { useSignal as t, useSignalEffect as n, useSignals as r } from "@cascivo/core";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import { useRef as o } from "react";
|
|
7
|
+
//#region ../components/src/context-menu/context-menu.tsx
|
|
8
|
+
function s({ children: s }) {
|
|
9
|
+
r();
|
|
10
|
+
let c = o(null), l = o(null), u = t(!1), d = () => {
|
|
11
|
+
let e = c.current;
|
|
12
|
+
return e ? Array.from(e.querySelectorAll("[role=\"menuitem\"]:not([aria-disabled=\"true\"])")) : [];
|
|
13
|
+
}, f = (e) => {
|
|
14
|
+
let t = d();
|
|
15
|
+
t.length !== 0 && t[e(t, t.indexOf(document.activeElement))]?.focus();
|
|
16
|
+
}, p = (e) => {
|
|
17
|
+
switch (e.key) {
|
|
18
|
+
case "ArrowDown":
|
|
19
|
+
e.preventDefault(), f((e, t) => t < 0 ? 0 : (t + 1) % e.length);
|
|
20
|
+
break;
|
|
21
|
+
case "ArrowUp":
|
|
22
|
+
e.preventDefault(), f((e, t) => t < 0 ? e.length - 1 : (t - 1 + e.length) % e.length);
|
|
23
|
+
break;
|
|
24
|
+
case "Home":
|
|
25
|
+
e.preventDefault(), f(() => 0);
|
|
26
|
+
break;
|
|
27
|
+
case "End":
|
|
28
|
+
e.preventDefault(), f((e) => e.length - 1);
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
};
|
|
32
|
+
n(() => {
|
|
33
|
+
let e = c.current;
|
|
34
|
+
if (e) if (u.value) {
|
|
35
|
+
try {
|
|
36
|
+
e.showPopover();
|
|
37
|
+
} catch {}
|
|
38
|
+
d()[0]?.focus();
|
|
39
|
+
} else try {
|
|
40
|
+
e.hidePopover();
|
|
41
|
+
} catch {}
|
|
42
|
+
}), n(() => {
|
|
43
|
+
let e = c.current;
|
|
44
|
+
if (!e) return;
|
|
45
|
+
let t = (e) => {
|
|
46
|
+
e.newState === "closed" && (u.value = !1);
|
|
47
|
+
};
|
|
48
|
+
return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
|
|
49
|
+
});
|
|
50
|
+
function m(e) {
|
|
51
|
+
e.preventDefault();
|
|
52
|
+
let t = l.current;
|
|
53
|
+
t && (t.style.setProperty("--cascivo-context-x", `${e.clientX}px`), t.style.setProperty("--cascivo-context-y", `${e.clientY}px`), u.value = !0);
|
|
54
|
+
}
|
|
55
|
+
let [h, ...g] = Array.isArray(s) ? s : [s];
|
|
56
|
+
return /* @__PURE__ */ a("div", {
|
|
57
|
+
ref: l,
|
|
58
|
+
onContextMenu: m,
|
|
59
|
+
className: e.wrapper,
|
|
60
|
+
children: [h, /* @__PURE__ */ i("div", {
|
|
61
|
+
ref: c,
|
|
62
|
+
popover: "auto",
|
|
63
|
+
role: "menu",
|
|
64
|
+
"data-state": u.value ? "open" : "closed",
|
|
65
|
+
className: e.menu,
|
|
66
|
+
onKeyDown: p,
|
|
67
|
+
children: g
|
|
68
|
+
})]
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
function c({ children: t, onSelect: n, disabled: r }) {
|
|
72
|
+
function a() {
|
|
73
|
+
r || n();
|
|
74
|
+
}
|
|
75
|
+
function o(e) {
|
|
76
|
+
(e.key === "Enter" || e.key === " ") && (e.preventDefault(), a());
|
|
77
|
+
}
|
|
78
|
+
return /* @__PURE__ */ i("div", {
|
|
79
|
+
role: "menuitem",
|
|
80
|
+
tabIndex: r ? -1 : 0,
|
|
81
|
+
"aria-disabled": r,
|
|
82
|
+
onClick: a,
|
|
83
|
+
onKeyDown: o,
|
|
84
|
+
className: e.item,
|
|
85
|
+
children: t
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
//#endregion
|
|
89
|
+
export { s as ContextMenu, c as ContextMenuItem };
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./copy-button.module.js";
|
|
4
|
+
import { cn as t, useSignal as n, useSignals as r } from "@cascivo/core";
|
|
5
|
+
import { builtin as i, t as a } from "@cascivo/i18n";
|
|
6
|
+
import { jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
7
|
+
//#region ../components/src/copy-button/copy-button.tsx
|
|
8
|
+
function c({ value: c, size: l = "md", labels: u, className: d, ...f }) {
|
|
9
|
+
r();
|
|
10
|
+
let p = n(!1), m = u?.copy ?? a(i.copyButton.copy), h = u?.copied ?? a(i.copyButton.copied);
|
|
11
|
+
return /* @__PURE__ */ o("button", {
|
|
12
|
+
type: "button",
|
|
13
|
+
"aria-label": p.value ? h : m,
|
|
14
|
+
"data-state": p.value ? "copied" : "idle",
|
|
15
|
+
"data-size": l,
|
|
16
|
+
className: t(e.copyButton, d),
|
|
17
|
+
onClick: () => {
|
|
18
|
+
navigator.clipboard.writeText(c), p.value = !0, setTimeout(() => {
|
|
19
|
+
p.value = !1;
|
|
20
|
+
}, 2e3);
|
|
21
|
+
},
|
|
22
|
+
...f,
|
|
23
|
+
children: p.value ? /* @__PURE__ */ o("svg", {
|
|
24
|
+
"aria-hidden": "true",
|
|
25
|
+
viewBox: "0 0 16 16",
|
|
26
|
+
className: e.icon,
|
|
27
|
+
children: /* @__PURE__ */ o("path", {
|
|
28
|
+
d: "M13.5 4.5 6 12 2.5 8.5",
|
|
29
|
+
fill: "none",
|
|
30
|
+
stroke: "currentColor",
|
|
31
|
+
strokeWidth: "1.5",
|
|
32
|
+
strokeLinecap: "round",
|
|
33
|
+
strokeLinejoin: "round"
|
|
34
|
+
})
|
|
35
|
+
}) : /* @__PURE__ */ s("svg", {
|
|
36
|
+
"aria-hidden": "true",
|
|
37
|
+
viewBox: "0 0 16 16",
|
|
38
|
+
className: e.icon,
|
|
39
|
+
children: [/* @__PURE__ */ o("rect", {
|
|
40
|
+
x: "5.5",
|
|
41
|
+
y: "5.5",
|
|
42
|
+
width: "8",
|
|
43
|
+
height: "8",
|
|
44
|
+
rx: "1.5",
|
|
45
|
+
fill: "none",
|
|
46
|
+
stroke: "currentColor",
|
|
47
|
+
strokeWidth: "1.5"
|
|
48
|
+
}), /* @__PURE__ */ o("path", {
|
|
49
|
+
d: "M3.5 10.5h-1a1 1 0 0 1-1-1v-7a1 1 0 0 1 1-1h7a1 1 0 0 1 1 1v1",
|
|
50
|
+
fill: "none",
|
|
51
|
+
stroke: "currentColor",
|
|
52
|
+
strokeWidth: "1.5"
|
|
53
|
+
})]
|
|
54
|
+
})
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//#endregion
|
|
58
|
+
export { c as CopyButton };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./data-list.module.js";
|
|
4
|
+
import { cn as t } from "@cascivo/core";
|
|
5
|
+
import { jsx as n, jsxs as r } from "react/jsx-runtime";
|
|
6
|
+
//#region ../components/src/data-list/data-list.tsx
|
|
7
|
+
function i({ items: i, orientation: a = "horizontal", dividers: o = !1, size: s = "md", className: c, ...l }) {
|
|
8
|
+
return /* @__PURE__ */ n("dl", {
|
|
9
|
+
"data-orientation": a,
|
|
10
|
+
"data-size": s,
|
|
11
|
+
"data-dividers": o ? "" : void 0,
|
|
12
|
+
className: t(e.list, c),
|
|
13
|
+
...l,
|
|
14
|
+
children: i.map((t, i) => /* @__PURE__ */ r("div", {
|
|
15
|
+
className: e.row,
|
|
16
|
+
children: [/* @__PURE__ */ n("dt", {
|
|
17
|
+
className: e.term,
|
|
18
|
+
children: t.label
|
|
19
|
+
}), /* @__PURE__ */ n("dd", {
|
|
20
|
+
className: e.detail,
|
|
21
|
+
children: t.value
|
|
22
|
+
})]
|
|
23
|
+
}, t.id ?? i))
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
//#endregion
|
|
27
|
+
export { i as DataList };
|