@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
|
@@ -11,49 +11,49 @@ var s = n({
|
|
|
11
11
|
focused: { on: { BLUR: "idle" } }
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
|
-
function c({ value: n, defaultValue: c,
|
|
14
|
+
function c({ value: n, defaultValue: c, onValueChange: l, onChange: u, min: d, max: f, step: p, label: m, hint: h, error: g, size: _ = "md", className: v, id: y, onFocus: b, onBlur: x, ...S }) {
|
|
15
15
|
i();
|
|
16
|
-
let [
|
|
16
|
+
let [C, w] = r(s), T = y ?? (m ? `cascade-time-picker-${m.toLowerCase().replace(/\s+/g, "-")}` : void 0);
|
|
17
17
|
return /* @__PURE__ */ o("div", {
|
|
18
|
-
className: t(e.wrapper,
|
|
19
|
-
"data-state":
|
|
20
|
-
"data-size":
|
|
18
|
+
className: t(e.wrapper, v),
|
|
19
|
+
"data-state": g ? "error" : C.value,
|
|
20
|
+
"data-size": _,
|
|
21
21
|
children: [
|
|
22
|
-
|
|
22
|
+
m && /* @__PURE__ */ a("label", {
|
|
23
23
|
className: e.label,
|
|
24
|
-
htmlFor:
|
|
25
|
-
children:
|
|
24
|
+
htmlFor: T,
|
|
25
|
+
children: m
|
|
26
26
|
}),
|
|
27
27
|
/* @__PURE__ */ a("input", {
|
|
28
|
-
id:
|
|
28
|
+
id: T,
|
|
29
29
|
type: "time",
|
|
30
30
|
className: e.input,
|
|
31
31
|
value: n,
|
|
32
32
|
defaultValue: c,
|
|
33
|
-
min:
|
|
34
|
-
max:
|
|
35
|
-
step:
|
|
36
|
-
"aria-invalid":
|
|
37
|
-
"aria-describedby":
|
|
38
|
-
onChange: (e) => l?.(e.target.value),
|
|
33
|
+
min: d,
|
|
34
|
+
max: f,
|
|
35
|
+
step: p,
|
|
36
|
+
"aria-invalid": g ? !0 : void 0,
|
|
37
|
+
"aria-describedby": g ? `${T}-error` : h ? `${T}-hint` : void 0,
|
|
38
|
+
onChange: (e) => (l ?? u)?.(e.target.value),
|
|
39
39
|
onFocus: (e) => {
|
|
40
|
-
|
|
40
|
+
w("FOCUS"), b?.(e);
|
|
41
41
|
},
|
|
42
42
|
onBlur: (e) => {
|
|
43
|
-
|
|
43
|
+
w("BLUR"), x?.(e);
|
|
44
44
|
},
|
|
45
|
-
...
|
|
45
|
+
...S
|
|
46
46
|
}),
|
|
47
|
-
|
|
48
|
-
id: `${
|
|
47
|
+
g && /* @__PURE__ */ a("span", {
|
|
48
|
+
id: `${T}-error`,
|
|
49
49
|
className: e.error,
|
|
50
50
|
role: "alert",
|
|
51
|
-
children:
|
|
51
|
+
children: g
|
|
52
52
|
}),
|
|
53
|
-
!
|
|
54
|
-
id: `${
|
|
53
|
+
!g && h && /* @__PURE__ */ a("span", {
|
|
54
|
+
id: `${T}-hint`,
|
|
55
55
|
className: e.hint,
|
|
56
|
-
children:
|
|
56
|
+
children: h
|
|
57
57
|
})
|
|
58
58
|
]
|
|
59
59
|
});
|
package/dist/toggle/toggle.js
CHANGED
|
@@ -4,34 +4,34 @@ import e from "./toggle.module.js";
|
|
|
4
4
|
import { cn as t, createMachine as n, useMachine as r, useSignals as i } from "@cascivo/core";
|
|
5
5
|
import { jsx as a, jsxs as o } from "react/jsx-runtime";
|
|
6
6
|
//#region ../components/src/toggle/toggle.tsx
|
|
7
|
-
function s({ checked: s, defaultChecked: c = !1,
|
|
7
|
+
function s({ checked: s, defaultChecked: c = !1, onValueChange: l, onChange: u, label: d, size: f = "md", className: p, disabled: m, ...h }) {
|
|
8
8
|
i();
|
|
9
|
-
let [
|
|
9
|
+
let [g, _] = r(n({
|
|
10
10
|
initial: c ? "on" : "off",
|
|
11
11
|
states: {
|
|
12
12
|
off: { on: { TOGGLE: "on" } },
|
|
13
13
|
on: { on: { TOGGLE: "off" } }
|
|
14
14
|
}
|
|
15
|
-
})),
|
|
15
|
+
})), v = s !== void 0, y = v ? s : g.value === "on";
|
|
16
16
|
return /* @__PURE__ */ o("button", {
|
|
17
17
|
type: "button",
|
|
18
18
|
role: "switch",
|
|
19
|
-
"aria-checked":
|
|
20
|
-
"data-state":
|
|
21
|
-
"data-size":
|
|
22
|
-
disabled:
|
|
23
|
-
className: t(e.toggle,
|
|
19
|
+
"aria-checked": y,
|
|
20
|
+
"data-state": y ? "on" : "off",
|
|
21
|
+
"data-size": f,
|
|
22
|
+
disabled: m,
|
|
23
|
+
className: t(e.toggle, p),
|
|
24
24
|
onClick: () => {
|
|
25
|
-
|
|
25
|
+
v || _("TOGGLE"), (l ?? u)?.(!y);
|
|
26
26
|
},
|
|
27
|
-
...
|
|
27
|
+
...h,
|
|
28
28
|
children: [/* @__PURE__ */ a("span", {
|
|
29
29
|
className: e.track,
|
|
30
30
|
"aria-hidden": "true",
|
|
31
31
|
children: /* @__PURE__ */ a("span", { className: e.thumb })
|
|
32
|
-
}),
|
|
32
|
+
}), d && /* @__PURE__ */ a("span", {
|
|
33
33
|
className: e.label,
|
|
34
|
-
children:
|
|
34
|
+
children: d
|
|
35
35
|
})]
|
|
36
36
|
});
|
|
37
37
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cascivo/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.10.0",
|
|
4
4
|
"private": false,
|
|
5
5
|
"description": "Prebuilt cascivo design system components — use without copying source",
|
|
6
6
|
"keywords": [
|
|
@@ -33,8 +33,9 @@
|
|
|
33
33
|
"exports": {
|
|
34
34
|
".": {
|
|
35
35
|
"types": "./dist/index.d.ts",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
36
|
+
"node": "./dist/node/index.js",
|
|
37
|
+
"import": "./dist/index.js",
|
|
38
|
+
"default": "./dist/index.js"
|
|
38
39
|
},
|
|
39
40
|
"./styles.css": "./dist/styles.css",
|
|
40
41
|
"./package.json": "./package.json"
|
|
@@ -44,8 +45,8 @@
|
|
|
44
45
|
"provenance": true
|
|
45
46
|
},
|
|
46
47
|
"dependencies": {
|
|
47
|
-
"@cascivo/core": "^0.
|
|
48
|
-
"@cascivo/i18n": "^0.2.
|
|
48
|
+
"@cascivo/core": "^0.5.1",
|
|
49
|
+
"@cascivo/i18n": "^0.2.9"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@testing-library/jest-dom": "^6.9.1",
|
|
@@ -61,7 +62,7 @@
|
|
|
61
62
|
"@cascivo/components": "0.0.0"
|
|
62
63
|
},
|
|
63
64
|
"peerDependencies": {
|
|
64
|
-
"@preact/signals-react": ">=
|
|
65
|
+
"@preact/signals-react": ">=3.0.0",
|
|
65
66
|
"react": ">=18.0.0",
|
|
66
67
|
"react-dom": ">=18.0.0"
|
|
67
68
|
},
|
package/readme.body.md
CHANGED
|
@@ -18,12 +18,17 @@ supplies the tokens and themes the components read.
|
|
|
18
18
|
Charts live in a separate package — add [`@cascivo/charts`](https://github.com/cascivo/cascivo/tree/main/packages/charts)
|
|
19
19
|
for `LineChart`, `AreaChart`, `BarChart`, `Sparkline`, and more.
|
|
20
20
|
|
|
21
|
+
> **Types are the reference.** The shipped `dist/index.d.ts` is a self-contained, flat
|
|
22
|
+
> rollup — every component's `…Props` interface is real, documentation-grade API. Reading
|
|
23
|
+
> it (or the per-component [`/llms/<name>.md`](https://cascivo.com/llms.txt)) is the fastest
|
|
24
|
+
> way to learn a component's props with no web access.
|
|
25
|
+
|
|
21
26
|
### Framework setup (Next.js App Router)
|
|
22
27
|
|
|
23
28
|
In a Server Component file (e.g. `app/layout.tsx`), import the themes once:
|
|
24
29
|
|
|
25
30
|
```tsx
|
|
26
|
-
import '@cascivo/themes/all'
|
|
31
|
+
import '@cascivo/themes/all.css'
|
|
27
32
|
```
|
|
28
33
|
|
|
29
34
|
Component CSS ships **per component** and is pulled in automatically when you
|
|
@@ -40,19 +45,27 @@ RSC without any extra wrapper.
|
|
|
40
45
|
> only if you prefer one explicit stylesheet over per-component tree-shaking, or
|
|
41
46
|
> for Vite SSR (below), where it is required.
|
|
42
47
|
|
|
43
|
-
> **Vite SSR / TanStack Start / Remix / workerd?**
|
|
44
|
-
>
|
|
45
|
-
>
|
|
46
|
-
>
|
|
47
|
-
> `@cascivo/
|
|
48
|
-
>
|
|
48
|
+
> **Vite SSR / TanStack Start / Remix / workerd?** The 4-line SSR checklist (full
|
|
49
|
+
> recipe: [USING-WITH-VITE-SSR.md](https://github.com/cascivo/cascivo/blob/main/docs/USING-WITH-VITE-SSR.md)):
|
|
50
|
+
>
|
|
51
|
+
> 1. **`ssr: { noExternal: [/^@cascivo\//] }`** in `vite.config` (or the
|
|
52
|
+
> `cascivoSsr()` plugin from `@cascivo/vite-plugin`). Without it a bare
|
|
53
|
+
> server-side ESM loader can't resolve the per-component `.css` side-effect
|
|
54
|
+
> imports and throws `Unknown file extension ".css"`.
|
|
55
|
+
> 2. **`@preact/signals-react` 3.x** — on React 19 the 2.x line fails to load. The
|
|
56
|
+
> peer range enforces `>=3`.
|
|
57
|
+
> 3. **Import the CSS once** in your root entry: `@cascivo/react/styles.css` +
|
|
58
|
+
> `@cascivo/themes/all` (+ `@cascivo/charts/styles.css` if you use charts).
|
|
59
|
+
> 4. **Theme without a mismatch:** inline `themePreloadScript()` in `<head>` and add
|
|
60
|
+
> `suppressHydrationWarning` to `<html>`, or hard-code `data-theme` for a fixed theme.
|
|
61
|
+
>
|
|
49
62
|
> Next.js App Router needs none of this.
|
|
50
63
|
|
|
51
64
|
## Use
|
|
52
65
|
|
|
53
66
|
```tsx
|
|
54
67
|
// once, in your entry file — themes are the only global import
|
|
55
|
-
import '@cascivo/themes/all' // tokens (once) + base typography + light & dark
|
|
68
|
+
import '@cascivo/themes/all.css' // tokens (once) + base typography + light & dark
|
|
56
69
|
|
|
57
70
|
// anywhere — each component brings its own CSS along
|
|
58
71
|
import { Button, Card, CardContent, Toggle } from '@cascivo/react'
|
|
@@ -79,9 +92,9 @@ Prefer à-la-carte? Import only the themes you need — each self-imports the to
|
|
|
79
92
|
(deduped by URL, so light + dark load tokens once):
|
|
80
93
|
|
|
81
94
|
```tsx
|
|
82
|
-
import '@cascivo/themes/base' // base typography (font/line-height/color)
|
|
83
|
-
import '@cascivo/themes/light'
|
|
84
|
-
import '@cascivo/themes/dark'
|
|
95
|
+
import '@cascivo/themes/base.css' // base typography (font/line-height/color)
|
|
96
|
+
import '@cascivo/themes/light.css'
|
|
97
|
+
import '@cascivo/themes/dark.css'
|
|
85
98
|
```
|
|
86
99
|
|
|
87
100
|
Scope a theme with `data-theme="light" | "dark" | "warm"` on any container. Brand
|