@cascivo/react 0.3.4 → 0.3.7
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 +12 -9
- package/dist/accordion/accordion.css +1 -0
- package/dist/accordion/accordion.js +95 -0
- package/dist/accordion/accordion.module.js +14 -0
- package/dist/action-sheet/action-sheet.css +1 -0
- package/dist/action-sheet/action-sheet.js +91 -0
- package/dist/action-sheet/action-sheet.module.js +15 -0
- package/dist/alert/alert.css +1 -0
- package/dist/alert/alert.js +55 -0
- package/dist/alert/alert.module.js +14 -0
- package/dist/alert-dialog/alert-dialog.css +1 -0
- package/dist/alert-dialog/alert-dialog.js +68 -0
- package/dist/alert-dialog/alert-dialog.module.js +14 -0
- package/dist/app-shell/app-shell.css +1 -0
- package/dist/app-shell/app-shell.js +80 -0
- package/dist/app-shell/app-shell.module.js +15 -0
- package/dist/aspect-ratio/aspect-ratio.css +1 -0
- package/dist/aspect-ratio/aspect-ratio.js +22 -0
- package/dist/aspect-ratio/aspect-ratio.module.js +9 -0
- package/dist/avatar/avatar.css +1 -0
- package/dist/avatar/avatar.js +45 -0
- package/dist/avatar/avatar.module.js +11 -0
- package/dist/avatar-group/avatar-group.css +1 -0
- package/dist/avatar-group/avatar-group.js +26 -0
- package/dist/avatar-group/avatar-group.module.js +9 -0
- package/dist/badge/badge.css +1 -0
- package/dist/badge/badge.js +17 -0
- package/dist/badge/badge.module.js +6 -0
- package/dist/blockquote/blockquote.css +1 -0
- package/dist/blockquote/blockquote.js +18 -0
- package/dist/blockquote/blockquote.module.js +9 -0
- package/dist/bottom-sheet/bottom-sheet.css +1 -0
- package/dist/bottom-sheet/bottom-sheet.js +111 -0
- package/dist/bottom-sheet/bottom-sheet.module.js +17 -0
- package/dist/breadcrumb/breadcrumb.css +1 -0
- package/dist/breadcrumb/breadcrumb.js +28 -0
- package/dist/breadcrumb/breadcrumb.module.js +6 -0
- package/dist/button/button.css +1 -0
- package/dist/button/button.js +31 -0
- package/dist/button/button.module.js +6 -0
- package/dist/button-group/button-group.css +1 -0
- package/dist/button-group/button-group.js +39 -0
- package/dist/button-group/button-group.module.js +6 -0
- package/dist/calendar/calendar.css +1 -0
- package/dist/calendar/calendar.js +195 -0
- package/dist/calendar/calendar.module.js +17 -0
- package/dist/card/card.css +1 -0
- package/dist/card/card.js +45 -0
- package/dist/card/card.module.js +12 -0
- package/dist/carousel/carousel.css +1 -0
- package/dist/carousel/carousel.js +138 -0
- package/dist/carousel/carousel.module.js +16 -0
- package/dist/chat-bubble/chat-bubble.css +1 -0
- package/dist/chat-bubble/chat-bubble.js +33 -0
- package/dist/chat-bubble/chat-bubble.module.js +14 -0
- package/dist/checkbox/checkbox.css +1 -0
- package/dist/checkbox/checkbox.js +38 -0
- package/dist/checkbox/checkbox.module.js +11 -0
- package/dist/checkbox-card/checkbox-card.css +1 -0
- package/dist/checkbox-card/checkbox-card.js +48 -0
- package/dist/checkbox-card/checkbox-card.module.js +14 -0
- package/dist/code/code.css +1 -0
- package/dist/code/code.js +16 -0
- package/dist/code/code.module.js +6 -0
- package/dist/code-snippet/code-snippet.css +1 -0
- package/dist/code-snippet/code-snippet.js +116 -0
- package/dist/code-snippet/code-snippet.module.js +20 -0
- package/dist/code-snippet/highlight.js +69 -0
- package/dist/collapsible/collapsible.css +1 -0
- package/dist/collapsible/collapsible.js +42 -0
- package/dist/collapsible/collapsible.module.js +11 -0
- package/dist/color-picker/color-picker.css +1 -0
- package/dist/color-picker/color-picker.js +268 -0
- package/dist/color-picker/color-picker.module.js +21 -0
- package/dist/combobox/combobox.css +1 -0
- package/dist/combobox/combobox.js +164 -0
- package/dist/combobox/combobox.module.js +22 -0
- package/dist/command-menu/command-menu.css +1 -0
- package/dist/command-menu/command-menu.js +263 -0
- package/dist/command-menu/command-menu.module.js +22 -0
- package/dist/comparison/comparison.css +1 -0
- package/dist/comparison/comparison.js +69 -0
- package/dist/comparison/comparison.module.js +12 -0
- package/dist/contained-list/contained-list.css +1 -0
- package/dist/contained-list/contained-list.js +41 -0
- package/dist/contained-list/contained-list.module.js +14 -0
- package/dist/context-menu/context-menu.css +1 -0
- package/dist/context-menu/context-menu.js +60 -0
- package/dist/context-menu/context-menu.module.js +10 -0
- package/dist/copy-button/copy-button.css +1 -0
- package/dist/copy-button/copy-button.js +58 -0
- package/dist/copy-button/copy-button.module.js +9 -0
- package/dist/data-list/data-list.css +1 -0
- package/dist/data-list/data-list.js +27 -0
- package/dist/data-list/data-list.module.js +11 -0
- package/dist/data-table/data-table.css +1 -0
- package/dist/data-table/data-table.js +368 -0
- package/dist/data-table/data-table.module.js +36 -0
- package/dist/date-picker/date-picker.css +1 -0
- package/dist/date-picker/date-picker.js +218 -0
- package/dist/date-picker/date-picker.module.js +26 -0
- package/dist/date-range-picker/date-range-picker.css +1 -0
- package/dist/date-range-picker/date-range-picker.js +195 -0
- package/dist/date-range-picker/date-range-picker.module.js +21 -0
- package/dist/dock/dock.css +1 -0
- package/dist/dock/dock.js +32 -0
- package/dist/dock/dock.module.js +11 -0
- package/dist/drawer/drawer.css +1 -0
- package/dist/drawer/drawer.js +95 -0
- package/dist/drawer/drawer.module.js +16 -0
- package/dist/dropdown/dropdown.css +1 -0
- package/dist/dropdown/dropdown.js +109 -0
- package/dist/dropdown/dropdown.module.js +12 -0
- package/dist/editable/editable.css +1 -0
- package/dist/editable/editable.js +67 -0
- package/dist/editable/editable.module.js +14 -0
- package/dist/empty-state/empty-state.css +1 -0
- package/dist/empty-state/empty-state.js +34 -0
- package/dist/empty-state/empty-state.module.js +12 -0
- package/dist/fab/fab.css +1 -0
- package/dist/fab/fab.js +93 -0
- package/dist/fab/fab.module.js +15 -0
- package/dist/field/field.css +1 -0
- package/dist/field/field.js +39 -0
- package/dist/field/field.module.js +10 -0
- package/dist/file-uploader/file-uploader.css +1 -0
- package/dist/file-uploader/file-uploader.js +122 -0
- package/dist/file-uploader/file-uploader.module.js +21 -0
- package/dist/filter/filter.css +1 -0
- package/dist/filter/filter.js +34 -0
- package/dist/filter/filter.module.js +9 -0
- package/dist/form/form.css +1 -0
- package/dist/form/form.js +88 -0
- package/dist/form/form.module.js +6 -0
- package/dist/header/header.css +1 -0
- package/dist/header/header.js +44 -0
- package/dist/header/header.module.js +14 -0
- package/dist/header-panel/header-panel.css +1 -0
- package/dist/header-panel/header-panel.js +74 -0
- package/dist/header-panel/header-panel.module.js +12 -0
- package/dist/heading/heading.css +1 -0
- package/dist/heading/heading.js +24 -0
- package/dist/heading/heading.module.js +6 -0
- package/dist/hover-card/hover-card.css +1 -0
- package/dist/hover-card/hover-card.js +84 -0
- package/dist/hover-card/hover-card.module.js +9 -0
- package/dist/icon-button/icon-button.css +1 -0
- package/dist/icon-button/icon-button.js +21 -0
- package/dist/icon-button/icon-button.module.js +6 -0
- package/dist/image/image.css +1 -0
- package/dist/image/image.js +64 -0
- package/dist/image/image.module.js +12 -0
- package/dist/indicator/indicator.css +1 -0
- package/dist/indicator/indicator.js +18 -0
- package/dist/indicator/indicator.module.js +9 -0
- package/dist/inline-loading/inline-loading.css +1 -0
- package/dist/inline-loading/inline-loading.js +76 -0
- package/dist/inline-loading/inline-loading.module.js +12 -0
- package/dist/input/input.css +1 -0
- package/dist/input/input.js +54 -0
- package/dist/input/input.module.js +12 -0
- package/dist/input-group/input-group.css +1 -0
- package/dist/input-group/input-group.js +41 -0
- package/dist/input-group/input-group.module.js +12 -0
- package/dist/item/item.css +1 -0
- package/dist/item/item.js +52 -0
- package/dist/item/item.module.js +13 -0
- package/dist/join/join.css +1 -0
- package/dist/join/join.js +14 -0
- package/dist/join/join.module.js +6 -0
- package/dist/kbd/kbd.css +1 -0
- package/dist/kbd/kbd.js +16 -0
- package/dist/kbd/kbd.module.js +6 -0
- package/dist/label/label.css +1 -0
- package/dist/label/label.js +25 -0
- package/dist/label/label.module.js +10 -0
- package/dist/link/link.css +1 -0
- package/dist/link/link.js +22 -0
- package/dist/link/link.module.js +6 -0
- package/dist/list/list.css +1 -0
- package/dist/list/list.js +23 -0
- package/dist/list/list.module.js +9 -0
- package/dist/menu/menu.css +1 -0
- package/dist/menu/menu.js +96 -0
- package/dist/menu/menu.module.js +11 -0
- package/dist/menu-button/menu-button.css +1 -0
- package/dist/menu-button/menu-button.js +92 -0
- package/dist/menu-button/menu-button.module.js +11 -0
- package/dist/menubar/menubar.css +1 -0
- package/dist/menubar/menubar.js +103 -0
- package/dist/menubar/menubar.module.js +11 -0
- package/dist/modal/modal.css +1 -0
- package/dist/modal/modal.js +73 -0
- package/dist/modal/modal.module.js +14 -0
- package/dist/multi-select/multi-select.css +1 -0
- package/dist/multi-select/multi-select.js +105 -0
- package/dist/multi-select/multi-select.module.js +18 -0
- package/dist/native-select/native-select.css +1 -0
- package/dist/native-select/native-select.js +37 -0
- package/dist/native-select/native-select.module.js +10 -0
- package/dist/navigation-menu/navigation-menu.css +1 -0
- package/dist/navigation-menu/navigation-menu.js +95 -0
- package/dist/navigation-menu/navigation-menu.module.js +13 -0
- package/dist/notification/notification.css +1 -0
- package/dist/notification/notification.js +134 -0
- package/dist/notification/notification.module.js +14 -0
- package/dist/number-input/number-input.css +1 -0
- package/dist/number-input/number-input.js +145 -0
- package/dist/number-input/number-input.module.js +15 -0
- package/dist/otp-input/otp-input.css +1 -0
- package/dist/otp-input/otp-input.js +70 -0
- package/dist/otp-input/otp-input.module.js +9 -0
- package/dist/overflow-menu/overflow-menu.css +1 -0
- package/dist/overflow-menu/overflow-menu.js +65 -0
- package/dist/overflow-menu/overflow-menu.module.js +10 -0
- package/dist/pagination/pagination.css +1 -0
- package/dist/pagination/pagination.js +92 -0
- package/dist/pagination/pagination.module.js +14 -0
- package/dist/password-input/password-input.css +1 -0
- package/dist/password-input/password-input.js +76 -0
- package/dist/password-input/password-input.module.js +14 -0
- package/dist/popover/popover.css +1 -0
- package/dist/popover/popover.js +49 -0
- package/dist/popover/popover.module.js +9 -0
- package/dist/popover/use-popover.js +57 -0
- package/dist/progress/progress.css +1 -0
- package/dist/progress/progress.js +17 -0
- package/dist/progress/progress.module.js +9 -0
- package/dist/progress-bar/progress-bar.css +1 -0
- package/dist/progress-bar/progress-bar.js +44 -0
- package/dist/progress-bar/progress-bar.module.js +14 -0
- package/dist/progress-circle/progress-circle.css +1 -0
- package/dist/progress-circle/progress-circle.js +48 -0
- package/dist/progress-circle/progress-circle.module.js +12 -0
- package/dist/progress-indicator/progress-indicator.css +1 -0
- package/dist/progress-indicator/progress-indicator.js +36 -0
- package/dist/progress-indicator/progress-indicator.module.js +13 -0
- package/dist/prose/prose.css +1 -0
- package/dist/prose/prose.js +15 -0
- package/dist/prose/prose.module.js +6 -0
- package/dist/pull-to-refresh/pull-to-refresh.css +1 -0
- package/dist/pull-to-refresh/pull-to-refresh.js +82 -0
- package/dist/pull-to-refresh/pull-to-refresh.module.js +12 -0
- package/dist/qr-code/encode.js +585 -0
- package/dist/qr-code/qr-code.css +1 -0
- package/dist/qr-code/qr-code.js +41 -0
- package/dist/qr-code/qr-code.module.js +9 -0
- package/dist/radial-progress/radial-progress.css +1 -0
- package/dist/radial-progress/radial-progress.js +25 -0
- package/dist/radial-progress/radial-progress.module.js +9 -0
- package/dist/radio/radio.css +1 -0
- package/dist/radio/radio.js +49 -0
- package/dist/radio/radio.module.js +12 -0
- package/dist/radio-card/radio-card.css +1 -0
- package/dist/radio-card/radio-card.js +63 -0
- package/dist/radio-card/radio-card.module.js +14 -0
- package/dist/rating-group/rating-group.css +1 -0
- package/dist/rating-group/rating-group.js +37 -0
- package/dist/rating-group/rating-group.module.js +9 -0
- package/dist/react/src/index.js +130 -0
- package/dist/relative-time/relative-time.css +1 -0
- package/dist/relative-time/relative-time.js +65 -0
- package/dist/relative-time/relative-time.module.js +6 -0
- package/dist/resizable/resizable.css +1 -0
- package/dist/resizable/resizable.js +80 -0
- package/dist/resizable/resizable.module.js +11 -0
- package/dist/scroll-area/scroll-area.css +1 -0
- package/dist/scroll-area/scroll-area.js +38 -0
- package/dist/scroll-area/scroll-area.module.js +6 -0
- package/dist/search/search.css +1 -0
- package/dist/search/search.js +94 -0
- package/dist/search/search.module.js +12 -0
- package/dist/segmented-control/segmented-control.css +1 -0
- package/dist/segmented-control/segmented-control.js +43 -0
- package/dist/segmented-control/segmented-control.module.js +9 -0
- package/dist/select/select.css +1 -0
- package/dist/select/select.js +71 -0
- package/dist/select/select.module.js +14 -0
- package/dist/separator/separator.css +1 -0
- package/dist/separator/separator.js +21 -0
- package/dist/separator/separator.module.js +6 -0
- package/dist/sheet/sheet.css +1 -0
- package/dist/sheet/sheet.js +50 -0
- package/dist/sheet/sheet.module.js +12 -0
- package/dist/shell-header/shell-header.css +1 -0
- package/dist/shell-header/shell-header.js +165 -0
- package/dist/shell-header/shell-header.module.js +26 -0
- package/dist/side-nav/side-nav.css +1 -0
- package/dist/side-nav/side-nav.js +326 -0
- package/dist/side-nav/side-nav.module.js +34 -0
- package/dist/skeleton/skeleton.css +1 -0
- package/dist/skeleton/skeleton.js +25 -0
- package/dist/skeleton/skeleton.module.js +10 -0
- package/dist/skip-nav/skip-nav.css +1 -0
- package/dist/skip-nav/skip-nav.js +27 -0
- package/dist/skip-nav/skip-nav.module.js +6 -0
- package/dist/slider/slider.css +1 -0
- package/dist/slider/slider.js +29 -0
- package/dist/slider/slider.module.js +10 -0
- package/dist/spinner/spinner.css +1 -0
- package/dist/spinner/spinner.js +18 -0
- package/dist/spinner/spinner.module.js +9 -0
- package/dist/stack/stack.css +1 -0
- package/dist/stack/stack.js +19 -0
- package/dist/stack/stack.module.js +9 -0
- package/dist/stat/stat.css +1 -0
- package/dist/stat/stat.js +37 -0
- package/dist/stat/stat.module.js +13 -0
- package/dist/status/status.css +1 -0
- package/dist/status/status.js +20 -0
- package/dist/status/status.module.js +10 -0
- package/dist/steps/steps.css +1 -0
- package/dist/steps/steps.js +32 -0
- package/dist/steps/steps.module.js +11 -0
- package/dist/structured-list/structured-list.css +1 -0
- package/dist/structured-list/structured-list.js +101 -0
- package/dist/structured-list/structured-list.module.js +15 -0
- package/dist/styles.css +248 -0
- package/dist/swap/swap.css +1 -0
- package/dist/swap/swap.js +36 -0
- package/dist/swap/swap.module.js +10 -0
- package/dist/swipe-item/swipe-item.css +1 -0
- package/dist/swipe-item/swipe-item.js +62 -0
- package/dist/swipe-item/swipe-item.module.js +15 -0
- package/dist/switcher/switcher.css +1 -0
- package/dist/switcher/switcher.js +29 -0
- package/dist/switcher/switcher.module.js +11 -0
- package/dist/tabs/tabs.css +1 -0
- package/dist/tabs/tabs.js +95 -0
- package/dist/tabs/tabs.module.js +11 -0
- package/dist/tag/tag.css +1 -0
- package/dist/tag/tag.js +26 -0
- package/dist/tag/tag.module.js +9 -0
- package/dist/tags-input/tags-input.css +1 -0
- package/dist/tags-input/tags-input.js +63 -0
- package/dist/tags-input/tags-input.module.js +11 -0
- package/dist/text/text.css +1 -0
- package/dist/text/text.js +18 -0
- package/dist/text/text.module.js +6 -0
- package/dist/textarea/textarea.css +1 -0
- package/dist/textarea/textarea.js +56 -0
- package/dist/textarea/textarea.module.js +12 -0
- package/dist/tile/tile.css +1 -0
- package/dist/tile/tile.js +39 -0
- package/dist/tile/tile.module.js +10 -0
- package/dist/time-picker/time-picker.css +1 -0
- package/dist/time-picker/time-picker.js +62 -0
- package/dist/time-picker/time-picker.module.js +12 -0
- package/dist/timeline/timeline.css +1 -0
- package/dist/timeline/timeline.js +41 -0
- package/dist/timeline/timeline.module.js +14 -0
- package/dist/toast/toast.css +1 -0
- package/dist/toast/toast.js +85 -0
- package/dist/toast/toast.module.js +14 -0
- package/dist/toc/toc.css +1 -0
- package/dist/toc/toc.js +42 -0
- package/dist/toc/toc.module.js +6 -0
- package/dist/toc/use-toc-from-region.js +17 -0
- package/dist/toggle/toggle.css +1 -0
- package/dist/toggle/toggle.js +39 -0
- package/dist/toggle/toggle.module.js +11 -0
- package/dist/toggle-group/toggle-group.css +1 -0
- package/dist/toggle-group/toggle-group.js +55 -0
- package/dist/toggle-group/toggle-group.module.js +9 -0
- package/dist/toggletip/toggletip.css +1 -0
- package/dist/toggletip/toggletip.js +49 -0
- package/dist/toggletip/toggletip.module.js +10 -0
- package/dist/tooltip/tooltip.css +1 -0
- package/dist/tooltip/tooltip.js +58 -0
- package/dist/tooltip/tooltip.module.js +9 -0
- package/dist/tree-view/tree-view.css +1 -0
- package/dist/tree-view/tree-view.js +201 -0
- package/dist/tree-view/tree-view.module.js +16 -0
- package/dist/user/user.css +1 -0
- package/dist/user/user.js +33 -0
- package/dist/user/user.module.js +12 -0
- package/dist/visually-hidden/visually-hidden.css +1 -0
- package/dist/visually-hidden/visually-hidden.js +15 -0
- package/dist/visually-hidden/visually-hidden.module.js +6 -0
- package/package.json +6 -6
- package/readme.body.md +12 -9
- package/dist/cascivo.css +0 -2
- package/dist/index.js +0 -9174
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./tree-view.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/tree-view/tree-view.tsx
|
|
9
|
+
function u(e, t) {
|
|
10
|
+
let n = [], r = (e, i, a) => {
|
|
11
|
+
for (let o of e) {
|
|
12
|
+
let e = !!o.children && o.children.length > 0, s = t.has(o.id);
|
|
13
|
+
n.push({
|
|
14
|
+
id: o.id,
|
|
15
|
+
level: i,
|
|
16
|
+
parentId: a,
|
|
17
|
+
hasChildren: e,
|
|
18
|
+
expanded: s
|
|
19
|
+
}), e && s && r(o.children, i + 1, o.id);
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
return r(e, 1, null), n;
|
|
23
|
+
}
|
|
24
|
+
function d(e) {
|
|
25
|
+
return e === void 0 ? [] : Array.isArray(e) ? e : e === "" ? [] : [e];
|
|
26
|
+
}
|
|
27
|
+
function f({ items: a, selectionMode: o = "single", selected: c, defaultSelected: f, onSelectChange: h, expanded: g, defaultExpanded: _, onExpandedChange: v, className: y, "aria-label": b }) {
|
|
28
|
+
i();
|
|
29
|
+
let [x, S] = n({
|
|
30
|
+
value: g,
|
|
31
|
+
defaultValue: _ ?? [],
|
|
32
|
+
onChange: v
|
|
33
|
+
}), [C, w] = n({
|
|
34
|
+
value: c,
|
|
35
|
+
defaultValue: f ?? (o === "multi" ? [] : ""),
|
|
36
|
+
onChange: h
|
|
37
|
+
}), T = r(null), E = l(/* @__PURE__ */ new Map()), D = new Set(x.value), O = u(a, D), k = new Map(O.map((e, t) => [e.id, t])), A = d(C.value), j = new Set(A), M = T.value ?? A[0] ?? O[0]?.id ?? null, N = (e) => S([...e]), P = (e) => {
|
|
38
|
+
if (D.has(e)) return;
|
|
39
|
+
let t = new Set(D);
|
|
40
|
+
t.add(e), N(t);
|
|
41
|
+
}, F = (e) => {
|
|
42
|
+
if (!D.has(e)) return;
|
|
43
|
+
let t = new Set(D);
|
|
44
|
+
t.delete(e), N(t);
|
|
45
|
+
}, I = (e) => {
|
|
46
|
+
T.value = e, E.current.get(e)?.focus();
|
|
47
|
+
}, L = (e) => {
|
|
48
|
+
if (o === "multi") {
|
|
49
|
+
let t = new Set(j);
|
|
50
|
+
t.has(e) ? t.delete(e) : t.add(e), w([...t]);
|
|
51
|
+
} else w(e);
|
|
52
|
+
}, R = l({
|
|
53
|
+
buffer: "",
|
|
54
|
+
at: 0
|
|
55
|
+
}), z = (e, t) => {
|
|
56
|
+
let n = k.get(t.id);
|
|
57
|
+
if (n === void 0) return;
|
|
58
|
+
let { hasChildren: r, level: i, parentId: o, expanded: s } = O[n];
|
|
59
|
+
switch (e.key) {
|
|
60
|
+
case "ArrowDown": {
|
|
61
|
+
e.preventDefault();
|
|
62
|
+
let t = O[n + 1];
|
|
63
|
+
t && I(t.id);
|
|
64
|
+
break;
|
|
65
|
+
}
|
|
66
|
+
case "ArrowUp": {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
let t = O[n - 1];
|
|
69
|
+
t && I(t.id);
|
|
70
|
+
break;
|
|
71
|
+
}
|
|
72
|
+
case "ArrowRight":
|
|
73
|
+
if (e.preventDefault(), r && !s) P(t.id);
|
|
74
|
+
else if (r && s) {
|
|
75
|
+
let e = O[n + 1];
|
|
76
|
+
e && e.level > i && I(e.id);
|
|
77
|
+
}
|
|
78
|
+
break;
|
|
79
|
+
case "ArrowLeft":
|
|
80
|
+
e.preventDefault(), r && s ? F(t.id) : o && I(o);
|
|
81
|
+
break;
|
|
82
|
+
case "Home":
|
|
83
|
+
e.preventDefault(), O[0] && I(O[0].id);
|
|
84
|
+
break;
|
|
85
|
+
case "End": {
|
|
86
|
+
e.preventDefault();
|
|
87
|
+
let t = O[O.length - 1];
|
|
88
|
+
t && I(t.id);
|
|
89
|
+
break;
|
|
90
|
+
}
|
|
91
|
+
case "Enter":
|
|
92
|
+
case " ":
|
|
93
|
+
e.preventDefault(), L(t.id);
|
|
94
|
+
break;
|
|
95
|
+
default:
|
|
96
|
+
if (e.key.length === 1 && !e.metaKey && !e.ctrlKey && !e.altKey) {
|
|
97
|
+
let t = R.current, r = Date.now();
|
|
98
|
+
t.buffer = r - t.at > 500 ? e.key : t.buffer + e.key, t.at = r;
|
|
99
|
+
let i = t.buffer.toLowerCase(), o = (e) => typeof e.label == "string" && e.label.toLowerCase().startsWith(i), s = p(a, D), c = [...O.slice(n + 1), ...O.slice(0, n + 1)].find((e) => {
|
|
100
|
+
let t = s.get(e.id);
|
|
101
|
+
return t ? o(t) : !1;
|
|
102
|
+
});
|
|
103
|
+
c && I(c.id);
|
|
104
|
+
}
|
|
105
|
+
break;
|
|
106
|
+
}
|
|
107
|
+
}, B = (e, t, n, r) => {
|
|
108
|
+
let i = !!e.children && e.children.length > 0, a = D.has(e.id), o = j.has(e.id), c = M === e.id, l = e.children?.length ?? 0;
|
|
109
|
+
return /* @__PURE__ */ s(m, {
|
|
110
|
+
node: e,
|
|
111
|
+
level: t,
|
|
112
|
+
posInSet: n,
|
|
113
|
+
setSize: r,
|
|
114
|
+
hasChildren: i,
|
|
115
|
+
isExpanded: a,
|
|
116
|
+
isSelected: o,
|
|
117
|
+
isTabbable: c,
|
|
118
|
+
itemRefs: E,
|
|
119
|
+
onFocusNode: () => T.value = e.id,
|
|
120
|
+
onKeyDown: (t) => z(t, e),
|
|
121
|
+
onActivate: () => {
|
|
122
|
+
I(e.id), i && (a ? F : P)(e.id), L(e.id);
|
|
123
|
+
},
|
|
124
|
+
children: i && e.children.map((e, n) => B(e, t + 1, n + 1, l))
|
|
125
|
+
}, e.id);
|
|
126
|
+
};
|
|
127
|
+
return /* @__PURE__ */ s("ul", {
|
|
128
|
+
role: "tree",
|
|
129
|
+
"aria-label": b,
|
|
130
|
+
className: t(e.tree, y),
|
|
131
|
+
children: a.map((e, t) => B(e, 1, t + 1, a.length))
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function p(e, t) {
|
|
135
|
+
let n = /* @__PURE__ */ new Map(), r = (e) => {
|
|
136
|
+
for (let i of e) n.set(i.id, i), i.children && i.children.length > 0 && t.has(i.id) && r(i.children);
|
|
137
|
+
};
|
|
138
|
+
return r(e), n;
|
|
139
|
+
}
|
|
140
|
+
function m({ node: t, level: n, posInSet: r, setSize: i, hasChildren: a, isExpanded: o, isSelected: l, isTabbable: u, itemRefs: d, onFocusNode: f, onKeyDown: p, onActivate: m, children: h }) {
|
|
141
|
+
return /* @__PURE__ */ c("li", {
|
|
142
|
+
role: "treeitem",
|
|
143
|
+
"aria-level": n,
|
|
144
|
+
"aria-posinset": r,
|
|
145
|
+
"aria-setsize": i,
|
|
146
|
+
"aria-selected": l,
|
|
147
|
+
"aria-expanded": a ? o : void 0,
|
|
148
|
+
tabIndex: u ? 0 : -1,
|
|
149
|
+
"data-selected": l || void 0,
|
|
150
|
+
"data-state": a ? o ? "open" : "closed" : void 0,
|
|
151
|
+
style: { "--cascivo-tree-level": n },
|
|
152
|
+
className: e.item,
|
|
153
|
+
ref: (e) => {
|
|
154
|
+
e ? d.current.set(t.id, e) : d.current.delete(t.id);
|
|
155
|
+
},
|
|
156
|
+
onFocus: (e) => {
|
|
157
|
+
e.target === e.currentTarget && f();
|
|
158
|
+
},
|
|
159
|
+
onKeyDown: p,
|
|
160
|
+
onClick: (e) => {
|
|
161
|
+
e.stopPropagation(), m();
|
|
162
|
+
},
|
|
163
|
+
children: [/* @__PURE__ */ c("span", {
|
|
164
|
+
className: e.row,
|
|
165
|
+
children: [
|
|
166
|
+
a ? /* @__PURE__ */ s("span", {
|
|
167
|
+
className: e.twisty,
|
|
168
|
+
"aria-hidden": "true",
|
|
169
|
+
"data-state": o ? "open" : "closed"
|
|
170
|
+
}) : /* @__PURE__ */ s("span", {
|
|
171
|
+
className: e.twistySpacer,
|
|
172
|
+
"aria-hidden": "true"
|
|
173
|
+
}),
|
|
174
|
+
t.icon && /* @__PURE__ */ s("span", {
|
|
175
|
+
className: e.icon,
|
|
176
|
+
"aria-hidden": "true",
|
|
177
|
+
children: t.icon
|
|
178
|
+
}),
|
|
179
|
+
/* @__PURE__ */ s("span", {
|
|
180
|
+
className: e.label,
|
|
181
|
+
children: t.label
|
|
182
|
+
})
|
|
183
|
+
]
|
|
184
|
+
}), a && /* @__PURE__ */ s("div", {
|
|
185
|
+
className: e.groupWrap,
|
|
186
|
+
"data-state": o ? "open" : "closed",
|
|
187
|
+
children: /* @__PURE__ */ s("ul", {
|
|
188
|
+
role: "group",
|
|
189
|
+
className: e.group,
|
|
190
|
+
children: h
|
|
191
|
+
})
|
|
192
|
+
})]
|
|
193
|
+
});
|
|
194
|
+
}
|
|
195
|
+
var h = {
|
|
196
|
+
loading: () => o(a.treeView.loading),
|
|
197
|
+
expand: () => o(a.treeView.expand),
|
|
198
|
+
collapse: () => o(a.treeView.collapse)
|
|
199
|
+
};
|
|
200
|
+
//#endregion
|
|
201
|
+
export { f as TreeView, h as treeViewMessages };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import './tree-view.css';
|
|
4
|
+
var e = {
|
|
5
|
+
tree: "_tree_ufkml_2",
|
|
6
|
+
item: "_item_ufkml_12",
|
|
7
|
+
row: "_row_ufkml_16",
|
|
8
|
+
twisty: "_twisty_ufkml_47",
|
|
9
|
+
twistySpacer: "_twistySpacer_ufkml_61",
|
|
10
|
+
icon: "_icon_ufkml_67",
|
|
11
|
+
label: "_label_ufkml_75",
|
|
12
|
+
groupWrap: "_groupWrap_ufkml_83",
|
|
13
|
+
group: "_group_ufkml_83"
|
|
14
|
+
};
|
|
15
|
+
//#endregion
|
|
16
|
+
export { e as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer cascivo.component{._user_uuj1b_2{align-items:center;gap:var(--cascivo-space-3);min-inline-size:0;font-family:var(--cascivo-font-sans);display:inline-flex}._text_uuj1b_10{min-inline-size:0;line-height:var(--cascivo-leading-snug,1.3);flex-direction:column;display:flex}._name_uuj1b_17{color:var(--cascivo-color-text);font-size:var(--cascivo-text-sm);font-weight:var(--cascivo-font-medium);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._description_uuj1b_26{color:var(--cascivo-color-text-muted);font-size:var(--cascivo-text-xs);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._action_uuj1b_34{align-items:center;margin-inline-start:var(--cascivo-space-2);display:inline-flex}}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Avatar as e } from "../avatar/avatar.js";
|
|
4
|
+
import t from "./user.module.js";
|
|
5
|
+
import { cn as n } from "@cascivo/core";
|
|
6
|
+
import { jsx as r, jsxs as i } from "react/jsx-runtime";
|
|
7
|
+
//#region ../components/src/user/user.tsx
|
|
8
|
+
function a({ name: a, description: o, avatarProps: s, className: c, children: l, ...u }) {
|
|
9
|
+
return /* @__PURE__ */ i("div", {
|
|
10
|
+
role: "group",
|
|
11
|
+
className: n(t.user, c),
|
|
12
|
+
...u,
|
|
13
|
+
children: [
|
|
14
|
+
/* @__PURE__ */ r(e, { ...s }),
|
|
15
|
+
/* @__PURE__ */ i("span", {
|
|
16
|
+
className: t.text,
|
|
17
|
+
children: [/* @__PURE__ */ r("span", {
|
|
18
|
+
className: t.name,
|
|
19
|
+
children: a
|
|
20
|
+
}), o != null && /* @__PURE__ */ r("span", {
|
|
21
|
+
className: t.description,
|
|
22
|
+
children: o
|
|
23
|
+
})]
|
|
24
|
+
}),
|
|
25
|
+
l != null && /* @__PURE__ */ r("span", {
|
|
26
|
+
className: t.action,
|
|
27
|
+
children: l
|
|
28
|
+
})
|
|
29
|
+
]
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
//#endregion
|
|
33
|
+
export { a as User };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer cascivo.component{._visuallyHidden_1iva7_2{clip-path:inset(50%);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./visually-hidden.module.js";
|
|
4
|
+
import { cn as t } from "@cascivo/core";
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
//#region ../components/src/visually-hidden/visually-hidden.tsx
|
|
7
|
+
function r({ children: r, className: i, ...a }) {
|
|
8
|
+
return /* @__PURE__ */ n("span", {
|
|
9
|
+
className: t(e.visuallyHidden, i),
|
|
10
|
+
...a,
|
|
11
|
+
children: r
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { r as VisuallyHidden };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cascivo/react",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Prebuilt cascivo design system components — use without copying source",
|
|
6
6
|
"keywords": [
|
|
@@ -33,10 +33,10 @@
|
|
|
33
33
|
"exports": {
|
|
34
34
|
".": {
|
|
35
35
|
"types": "./dist/index.d.ts",
|
|
36
|
-
"import": "./dist/index.js",
|
|
37
|
-
"default": "./dist/index.js"
|
|
36
|
+
"import": "./dist/react/src/index.js",
|
|
37
|
+
"default": "./dist/react/src/index.js"
|
|
38
38
|
},
|
|
39
|
-
"./styles.css": "./dist/
|
|
39
|
+
"./styles.css": "./dist/styles.css",
|
|
40
40
|
"./package.json": "./package.json"
|
|
41
41
|
},
|
|
42
42
|
"publishConfig": {
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"provenance": true
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@cascivo/core": "^0.2.
|
|
48
|
-
"@cascivo/i18n": "^0.1.
|
|
47
|
+
"@cascivo/core": "^0.2.2",
|
|
48
|
+
"@cascivo/i18n": "^0.1.10"
|
|
49
49
|
},
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@testing-library/jest-dom": "^6.9.1",
|
package/readme.body.md
CHANGED
|
@@ -20,28 +20,32 @@ for `LineChart`, `AreaChart`, `BarChart`, `Sparkline`, and more.
|
|
|
20
20
|
|
|
21
21
|
### Framework setup (Next.js App Router)
|
|
22
22
|
|
|
23
|
-
In a Server Component file (e.g. `app/layout.tsx`), import the
|
|
23
|
+
In a Server Component file (e.g. `app/layout.tsx`), import the themes once:
|
|
24
24
|
|
|
25
25
|
```tsx
|
|
26
|
-
import '@cascivo/react/styles.css'
|
|
27
26
|
import '@cascivo/themes/all'
|
|
28
27
|
```
|
|
29
28
|
|
|
29
|
+
Component CSS ships **per component** and is pulled in automatically when you
|
|
30
|
+
import a component — a bundler (Vite, webpack/Next.js) includes the styles only
|
|
31
|
+
for the components you actually use and tree-shakes the rest. There is no
|
|
32
|
+
component-CSS import to add or maintain.
|
|
33
|
+
|
|
30
34
|
Components ship with `'use client'` preserved in the bundle, so they work inside
|
|
31
35
|
RSC without any extra wrapper.
|
|
32
36
|
|
|
33
|
-
> **
|
|
34
|
-
>
|
|
35
|
-
> import
|
|
37
|
+
> **No bundler? (CDN, import maps, plain `<link>`)** Import the aggregate sheet
|
|
38
|
+
> `@cascivo/react/styles.css` — it contains every component's CSS in one file.
|
|
39
|
+
> With a bundler you don't need it; import it only if you prefer one explicit
|
|
40
|
+
> stylesheet over per-component tree-shaking.
|
|
36
41
|
|
|
37
42
|
## Use
|
|
38
43
|
|
|
39
44
|
```tsx
|
|
40
|
-
// once, in your entry file —
|
|
41
|
-
import '@cascivo/react/styles.css' // component styles
|
|
45
|
+
// once, in your entry file — themes are the only global import
|
|
42
46
|
import '@cascivo/themes/all' // tokens (once) + base typography + light & dark
|
|
43
47
|
|
|
44
|
-
// anywhere
|
|
48
|
+
// anywhere — each component brings its own CSS along
|
|
45
49
|
import { Button, Card, CardContent, Toggle } from '@cascivo/react'
|
|
46
50
|
|
|
47
51
|
export function App() {
|
|
@@ -66,7 +70,6 @@ Prefer à-la-carte? Import only the themes you need — each self-imports the to
|
|
|
66
70
|
(deduped by URL, so light + dark load tokens once):
|
|
67
71
|
|
|
68
72
|
```tsx
|
|
69
|
-
import '@cascivo/react/styles.css'
|
|
70
73
|
import '@cascivo/themes/base' // base typography (font/line-height/color)
|
|
71
74
|
import '@cascivo/themes/light'
|
|
72
75
|
import '@cascivo/themes/dark'
|