@cascivo/react 0.9.0 → 0.10.1
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 +4 -3
- package/readme.body.md +5 -5
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./password-input.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
|
+
import { useId as c } from "react";
|
|
8
|
+
//#region ../components/src/password-input/password-input.tsx
|
|
9
|
+
function l(e) {
|
|
10
|
+
if (!e) return {
|
|
11
|
+
score: 0,
|
|
12
|
+
label: "weak"
|
|
13
|
+
};
|
|
14
|
+
let t = 0;
|
|
15
|
+
return /[a-z]/.test(e) && t++, /[A-Z]/.test(e) && t++, /[0-9]/.test(e) && t++, /[^a-zA-Z0-9]/.test(e) && t++, e.length >= 12 && (t = Math.min(4, t + 1)), t = Math.min(4, t), {
|
|
16
|
+
score: t,
|
|
17
|
+
label: [
|
|
18
|
+
"weak",
|
|
19
|
+
"weak",
|
|
20
|
+
"fair",
|
|
21
|
+
"good",
|
|
22
|
+
"strong"
|
|
23
|
+
][t]
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
function u({ showStrengthMeter: u = !1, size: d = "md", labels: f, className: p, id: m, value: h, defaultValue: g, onChange: _, ...v }) {
|
|
27
|
+
r();
|
|
28
|
+
let y = n(!1), b = n(typeof h == "string" ? h : typeof g == "string" ? g : "");
|
|
29
|
+
typeof h == "string" && (b.value = h);
|
|
30
|
+
let x = c(), S = m ?? `cascade-password-${x}`, C = u ? l(b.value) : null, w = y.value ? f?.hide ?? a(i.passwordInput.hide) : f?.reveal ?? a(i.passwordInput.reveal), T = C ? f?.strengthLabel ? f.strengthLabel(C.label) : a(i.passwordInput.strengthLabel, { level: C.label }) : void 0;
|
|
31
|
+
return /* @__PURE__ */ s("div", {
|
|
32
|
+
className: t(e.wrapper, p),
|
|
33
|
+
"data-size": d,
|
|
34
|
+
"data-revealed": y.value ? "" : void 0,
|
|
35
|
+
children: [/* @__PURE__ */ s("div", {
|
|
36
|
+
className: e["input-row"],
|
|
37
|
+
children: [/* @__PURE__ */ o("input", {
|
|
38
|
+
...v,
|
|
39
|
+
id: S,
|
|
40
|
+
type: y.value ? "text" : "password",
|
|
41
|
+
className: e.input,
|
|
42
|
+
value: h,
|
|
43
|
+
defaultValue: g,
|
|
44
|
+
onChange: (e) => {
|
|
45
|
+
typeof h != "string" && (b.value = e.currentTarget.value), _?.(e);
|
|
46
|
+
}
|
|
47
|
+
}), /* @__PURE__ */ o("button", {
|
|
48
|
+
type: "button",
|
|
49
|
+
className: e["reveal-btn"],
|
|
50
|
+
"aria-label": w,
|
|
51
|
+
onClick: () => {
|
|
52
|
+
y.value = !y.value;
|
|
53
|
+
},
|
|
54
|
+
children: /* @__PURE__ */ o("span", {
|
|
55
|
+
className: e["reveal-icon"],
|
|
56
|
+
"aria-hidden": "true"
|
|
57
|
+
})
|
|
58
|
+
})]
|
|
59
|
+
}), u && C && /* @__PURE__ */ o("div", {
|
|
60
|
+
className: e["strength-meter"],
|
|
61
|
+
role: "meter",
|
|
62
|
+
"aria-label": T,
|
|
63
|
+
"aria-valuenow": C.score,
|
|
64
|
+
"aria-valuemin": 0,
|
|
65
|
+
"aria-valuemax": 4,
|
|
66
|
+
"data-strength": C.label,
|
|
67
|
+
children: [
|
|
68
|
+
0,
|
|
69
|
+
1,
|
|
70
|
+
2,
|
|
71
|
+
3
|
|
72
|
+
].map((t) => /* @__PURE__ */ o("div", {
|
|
73
|
+
className: e["strength-segment"],
|
|
74
|
+
"data-filled": t < C.score ? "" : void 0
|
|
75
|
+
}, t))
|
|
76
|
+
})]
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
//#endregion
|
|
80
|
+
export { u as PasswordInput };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
var e = {
|
|
4
|
+
wrapper: "_wrapper_r2rcd_2",
|
|
5
|
+
"input-row": "_input-row_r2rcd_26",
|
|
6
|
+
input: "_input_r2rcd_26",
|
|
7
|
+
"reveal-btn": "_reveal-btn_r2rcd_68",
|
|
8
|
+
"reveal-icon": "_reveal-icon_r2rcd_94",
|
|
9
|
+
"strength-meter": "_strength-meter_r2rcd_114",
|
|
10
|
+
"strength-segment": "_strength-segment_r2rcd_135"
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as default };
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { usePopover as e } from "./use-popover.js";
|
|
4
|
+
import t from "./popover.module.js";
|
|
5
|
+
import { useSignals as n } from "@cascivo/core";
|
|
6
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
7
|
+
import { createContext as i } from "react";
|
|
8
|
+
//#region ../components/src/popover/popover.tsx
|
|
9
|
+
var a = i(null);
|
|
10
|
+
function o({ children: t, ...n }) {
|
|
11
|
+
let i = e(n);
|
|
12
|
+
return /* @__PURE__ */ r(a.Provider, {
|
|
13
|
+
value: i,
|
|
14
|
+
children: t
|
|
15
|
+
});
|
|
16
|
+
}
|
|
17
|
+
function s({ children: e }) {
|
|
18
|
+
return n(), /* @__PURE__ */ r(a.Consumer, { children: (n) => {
|
|
19
|
+
if (!n) throw Error("PopoverTrigger must be used inside <Popover>");
|
|
20
|
+
let { triggerRef: i, toggle: a, anchorName: o, isOpen: s } = n;
|
|
21
|
+
return /* @__PURE__ */ r("button", {
|
|
22
|
+
ref: i,
|
|
23
|
+
type: "button",
|
|
24
|
+
"aria-expanded": s.value,
|
|
25
|
+
"aria-haspopup": "dialog",
|
|
26
|
+
style: { anchorName: o },
|
|
27
|
+
onClick: a,
|
|
28
|
+
className: t.trigger,
|
|
29
|
+
children: e
|
|
30
|
+
});
|
|
31
|
+
} });
|
|
32
|
+
}
|
|
33
|
+
function c({ children: e, className: i }) {
|
|
34
|
+
return n(), /* @__PURE__ */ r(a.Consumer, { children: (n) => {
|
|
35
|
+
if (!n) throw Error("PopoverContent must be used inside <Popover>");
|
|
36
|
+
let { popoverRef: a, anchorName: o, isOpen: s } = n;
|
|
37
|
+
return /* @__PURE__ */ r("div", {
|
|
38
|
+
ref: a,
|
|
39
|
+
popover: "auto",
|
|
40
|
+
role: "dialog",
|
|
41
|
+
"data-state": s.value ? "open" : "closed",
|
|
42
|
+
style: { positionAnchor: o },
|
|
43
|
+
className: [t.content, i].filter(Boolean).join(" "),
|
|
44
|
+
children: e
|
|
45
|
+
});
|
|
46
|
+
} });
|
|
47
|
+
}
|
|
48
|
+
//#endregion
|
|
49
|
+
export { o as Popover, c as PopoverContent, s as PopoverTrigger };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { useSignal as e, useSignalEffect as t } from "@cascivo/core";
|
|
4
|
+
import { useRef as n } from "react";
|
|
5
|
+
//#region ../components/src/popover/use-popover.ts
|
|
6
|
+
var r = 0, i = typeof CSS < "u" && typeof CSS.supports == "function" && CSS.supports("anchor-name: --cascivo-a");
|
|
7
|
+
function a(a = {}) {
|
|
8
|
+
let o = n(`--cascivo-popover-${++r}`).current, s = n(null), c = n(null), l = e(a.open ?? !1);
|
|
9
|
+
a.open !== void 0 && (l.value = a.open);
|
|
10
|
+
let u = n(a.onOpenChange);
|
|
11
|
+
u.current = a.onOpenChange;
|
|
12
|
+
let d = n(a.placement);
|
|
13
|
+
d.current = a.placement;
|
|
14
|
+
let f = n(a.offset);
|
|
15
|
+
return f.current = a.offset, t(() => {
|
|
16
|
+
let e = l.value;
|
|
17
|
+
u.current?.(e);
|
|
18
|
+
let t = c.current;
|
|
19
|
+
if (t) {
|
|
20
|
+
if (e) try {
|
|
21
|
+
t.showPopover();
|
|
22
|
+
} catch {}
|
|
23
|
+
else try {
|
|
24
|
+
t.hidePopover();
|
|
25
|
+
} catch {}
|
|
26
|
+
if (!i && e) {
|
|
27
|
+
let e = s.current;
|
|
28
|
+
if (!e) return;
|
|
29
|
+
let n = e.getBoundingClientRect(), r = d.current ?? "bottom", i = f.current ?? 4;
|
|
30
|
+
r === "bottom" ? (t.style.top = `${n.bottom + i + window.scrollY}px`, t.style.left = `${n.left + window.scrollX}px`) : r === "top" ? (t.style.top = `${n.top - i + window.scrollY}px`, t.style.left = `${n.left + window.scrollX}px`, t.style.transform = "translateY(-100%)") : r === "left" ? (t.style.top = `${n.top + window.scrollY}px`, t.style.left = `${n.left - i + window.scrollX}px`, t.style.transform = "translateX(-100%)") : r === "right" && (t.style.top = `${n.top + window.scrollY}px`, t.style.left = `${n.right + i + window.scrollX}px`);
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}), t(() => {
|
|
34
|
+
let e = c.current;
|
|
35
|
+
if (!e) return;
|
|
36
|
+
let t = (e) => {
|
|
37
|
+
e.newState === "closed" && (l.value = !1);
|
|
38
|
+
};
|
|
39
|
+
return e.addEventListener("toggle", t), () => e.removeEventListener("toggle", t);
|
|
40
|
+
}), {
|
|
41
|
+
triggerRef: s,
|
|
42
|
+
popoverRef: c,
|
|
43
|
+
isOpen: l,
|
|
44
|
+
anchorName: o,
|
|
45
|
+
open: () => {
|
|
46
|
+
l.value = !0;
|
|
47
|
+
},
|
|
48
|
+
close: () => {
|
|
49
|
+
l.value = !1;
|
|
50
|
+
},
|
|
51
|
+
toggle: () => {
|
|
52
|
+
l.value = !l.value;
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
//#endregion
|
|
57
|
+
export { a as usePopover };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./progress.module.js";
|
|
4
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
5
|
+
//#region ../components/src/progress/progress.tsx
|
|
6
|
+
function n({ value: n, variant: r = "primary", size: i = "md", className: a, ...o }) {
|
|
7
|
+
return /* @__PURE__ */ t("progress", {
|
|
8
|
+
className: [e.progress, a].filter(Boolean).join(" "),
|
|
9
|
+
"data-variant": r,
|
|
10
|
+
"data-size": i,
|
|
11
|
+
value: n,
|
|
12
|
+
max: n === void 0 ? void 0 : 100,
|
|
13
|
+
...o
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
//#endregion
|
|
17
|
+
export { n as Progress };
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./progress-bar.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/progress-bar/progress-bar.tsx
|
|
7
|
+
function i({ value: i, max: a = 100, label: o, helperText: s, size: c = "md", status: l = "active", className: u }) {
|
|
8
|
+
let d = i === void 0, f = d ? 0 : Math.min(Math.max(i, 0), a), p = a > 0 ? f / a * 100 : 0, m = o ? `cascade-progress-${o.toLowerCase().replace(/\s+/g, "-")}` : void 0, h = l === "success" ? "✓" : l === "error" ? "✕" : null;
|
|
9
|
+
return /* @__PURE__ */ r("div", {
|
|
10
|
+
"data-status": l,
|
|
11
|
+
"data-size": c,
|
|
12
|
+
"data-state": d ? "indeterminate" : void 0,
|
|
13
|
+
className: t(e.progress, u),
|
|
14
|
+
children: [
|
|
15
|
+
o && /* @__PURE__ */ r("span", {
|
|
16
|
+
id: m,
|
|
17
|
+
className: e.label,
|
|
18
|
+
children: [o, h && /* @__PURE__ */ n("span", {
|
|
19
|
+
className: e.glyph,
|
|
20
|
+
"aria-hidden": "true",
|
|
21
|
+
children: h
|
|
22
|
+
})]
|
|
23
|
+
}),
|
|
24
|
+
/* @__PURE__ */ n("div", {
|
|
25
|
+
role: "progressbar",
|
|
26
|
+
"aria-valuemin": 0,
|
|
27
|
+
"aria-valuemax": a,
|
|
28
|
+
"aria-valuenow": d ? void 0 : f,
|
|
29
|
+
"aria-labelledby": m,
|
|
30
|
+
className: e.track,
|
|
31
|
+
children: /* @__PURE__ */ n("div", {
|
|
32
|
+
className: e.fill,
|
|
33
|
+
style: d ? void 0 : { "--cascivo-progress-value": `${p}%` }
|
|
34
|
+
})
|
|
35
|
+
}),
|
|
36
|
+
s && /* @__PURE__ */ n("span", {
|
|
37
|
+
className: e.helper,
|
|
38
|
+
children: s
|
|
39
|
+
})
|
|
40
|
+
]
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
//#endregion
|
|
44
|
+
export { i as ProgressBar };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
var e = {
|
|
4
|
+
progress: "_progress_16ha1_2",
|
|
5
|
+
"cascade-progress-sweep": "_cascade-progress-sweep_16ha1_1",
|
|
6
|
+
fill: "_fill_16ha1_9",
|
|
7
|
+
glyph: "_glyph_16ha1_13",
|
|
8
|
+
track: "_track_16ha1_28",
|
|
9
|
+
label: "_label_16ha1_44",
|
|
10
|
+
helper: "_helper_16ha1_77"
|
|
11
|
+
};
|
|
12
|
+
//#endregion
|
|
13
|
+
export { e as default };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./progress-circle.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/progress-circle/progress-circle.tsx
|
|
7
|
+
var i = 20, a = 2 * Math.PI * i;
|
|
8
|
+
function o({ value: o, max: s = 100, size: c = "md", showValue: l = !1, label: u, className: d, ...f }) {
|
|
9
|
+
let p = Math.min(Math.max(o, 0), s), m = s > 0 ? p / s * 100 : 0, h = a * (1 - m / 100);
|
|
10
|
+
return /* @__PURE__ */ r("div", {
|
|
11
|
+
role: "progressbar",
|
|
12
|
+
"aria-valuemin": 0,
|
|
13
|
+
"aria-valuemax": s,
|
|
14
|
+
"aria-valuenow": p,
|
|
15
|
+
"aria-label": u,
|
|
16
|
+
"data-size": c,
|
|
17
|
+
className: t(e.progressCircle, d),
|
|
18
|
+
...f,
|
|
19
|
+
children: [/* @__PURE__ */ r("svg", {
|
|
20
|
+
viewBox: "0 0 48 48",
|
|
21
|
+
"aria-hidden": "true",
|
|
22
|
+
className: e.svg,
|
|
23
|
+
children: [/* @__PURE__ */ n("circle", {
|
|
24
|
+
className: e.track,
|
|
25
|
+
cx: "24",
|
|
26
|
+
cy: "24",
|
|
27
|
+
r: i,
|
|
28
|
+
fill: "none",
|
|
29
|
+
strokeWidth: "4"
|
|
30
|
+
}), /* @__PURE__ */ n("circle", {
|
|
31
|
+
className: e.fill,
|
|
32
|
+
cx: "24",
|
|
33
|
+
cy: "24",
|
|
34
|
+
r: i,
|
|
35
|
+
fill: "none",
|
|
36
|
+
strokeWidth: "4",
|
|
37
|
+
strokeLinecap: "round",
|
|
38
|
+
strokeDasharray: a,
|
|
39
|
+
strokeDashoffset: h
|
|
40
|
+
})]
|
|
41
|
+
}), l && /* @__PURE__ */ r("span", {
|
|
42
|
+
className: e.value,
|
|
43
|
+
children: [Math.round(m), "%"]
|
|
44
|
+
})]
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
//#endregion
|
|
48
|
+
export { o as ProgressCircle };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./progress-indicator.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/progress-indicator/progress-indicator.tsx
|
|
7
|
+
function i({ steps: i, currentIndex: a, vertical: o = !1, className: s }) {
|
|
8
|
+
return /* @__PURE__ */ n("ol", {
|
|
9
|
+
className: t(e.indicator, s),
|
|
10
|
+
"data-orientation": o ? "vertical" : "horizontal",
|
|
11
|
+
children: i.map((t, i) => {
|
|
12
|
+
let o = i < a ? "complete" : i === a ? "current" : "incomplete";
|
|
13
|
+
return /* @__PURE__ */ r("li", {
|
|
14
|
+
className: e.step,
|
|
15
|
+
"data-status": o,
|
|
16
|
+
"aria-current": o === "current" ? "step" : void 0,
|
|
17
|
+
children: [/* @__PURE__ */ n("span", {
|
|
18
|
+
className: e.marker,
|
|
19
|
+
"aria-hidden": "true",
|
|
20
|
+
children: o === "complete" ? "✓" : i + 1
|
|
21
|
+
}), /* @__PURE__ */ r("span", {
|
|
22
|
+
className: e.text,
|
|
23
|
+
children: [/* @__PURE__ */ n("span", {
|
|
24
|
+
className: e.label,
|
|
25
|
+
children: t.label
|
|
26
|
+
}), t.description && /* @__PURE__ */ n("span", {
|
|
27
|
+
className: e.description,
|
|
28
|
+
children: t.description
|
|
29
|
+
})]
|
|
30
|
+
})]
|
|
31
|
+
}, i);
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
//#endregion
|
|
36
|
+
export { i as ProgressIndicator };
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
var e = {
|
|
4
|
+
indicator: "_indicator_jj7mg_2",
|
|
5
|
+
step: "_step_jj7mg_13",
|
|
6
|
+
marker: "_marker_jj7mg_39",
|
|
7
|
+
text: "_text_jj7mg_71",
|
|
8
|
+
label: "_label_jj7mg_77",
|
|
9
|
+
description: "_description_jj7mg_89"
|
|
10
|
+
};
|
|
11
|
+
//#endregion
|
|
12
|
+
export { e as default };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./prose.module.js";
|
|
4
|
+
import { cn as t } from "@cascivo/core";
|
|
5
|
+
import { jsx as n } from "react/jsx-runtime";
|
|
6
|
+
//#region ../components/src/prose/prose.tsx
|
|
7
|
+
function r({ className: r, children: i, ...a }) {
|
|
8
|
+
return /* @__PURE__ */ n("div", {
|
|
9
|
+
className: t(e.prose, r),
|
|
10
|
+
...a,
|
|
11
|
+
children: i
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
//#endregion
|
|
15
|
+
export { r as Prose };
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import { Spinner as e } from "../spinner/spinner.js";
|
|
4
|
+
import t from "./pull-to-refresh.module.js";
|
|
5
|
+
import { cn as n, useSignal as r, useSignalEffect as i, useSignals as a } from "@cascivo/core";
|
|
6
|
+
import { builtin as o, t as s } from "@cascivo/i18n";
|
|
7
|
+
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
8
|
+
import { useRef as u } from "react";
|
|
9
|
+
//#region ../components/src/pull-to-refresh/pull-to-refresh.tsx
|
|
10
|
+
var d = .5;
|
|
11
|
+
function f({ onRefresh: f, children: p, threshold: m = 64, disabled: h = !1, labels: g, className: _ }) {
|
|
12
|
+
a();
|
|
13
|
+
let v = u(null), y = r(0), b = r(!1), x = r(!1), S = u(f);
|
|
14
|
+
S.current = f;
|
|
15
|
+
let C = u(m);
|
|
16
|
+
C.current = m;
|
|
17
|
+
let w = u(h);
|
|
18
|
+
w.current = h, i(() => {
|
|
19
|
+
let e = v.current;
|
|
20
|
+
if (!e || typeof window > "u") return;
|
|
21
|
+
let t = 0, n = !1, r = (r) => {
|
|
22
|
+
w.current || b.value || e.scrollTop > 0 || (t = r.clientY, n = !0);
|
|
23
|
+
}, i = (r) => {
|
|
24
|
+
if (!n || b.value) return;
|
|
25
|
+
let i = r.clientY - t;
|
|
26
|
+
if (i <= 0 || e.scrollTop > 0) {
|
|
27
|
+
y.value = 0, x.value = !1;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
r.preventDefault(), x.value = !0, y.value = Math.min(i * d, C.current * 1.5);
|
|
31
|
+
}, a = () => {
|
|
32
|
+
n && (n = !1, x.value = !1, !b.value && (y.value >= C.current ? (b.value = !0, y.value = C.current, Promise.resolve(S.current()).then(() => {
|
|
33
|
+
b.value = !1, y.value = 0;
|
|
34
|
+
}, () => {
|
|
35
|
+
b.value = !1, y.value = 0;
|
|
36
|
+
})) : y.value = 0));
|
|
37
|
+
};
|
|
38
|
+
return e.addEventListener("pointerdown", r), window.addEventListener("pointermove", i, { passive: !1 }), window.addEventListener("pointerup", a), window.addEventListener("pointercancel", a), () => {
|
|
39
|
+
e.removeEventListener("pointerdown", r), window.removeEventListener("pointermove", i), window.removeEventListener("pointerup", a), window.removeEventListener("pointercancel", a);
|
|
40
|
+
};
|
|
41
|
+
});
|
|
42
|
+
let T = b.value ? m : y.value, E = Math.min(T / m, 1), D = E >= 1, O = b.value ? g?.refreshing ?? s(o.pullToRefresh.refreshing) : D ? g?.release ?? s(o.pullToRefresh.release) : T > 0 ? g?.pull ?? s(o.pullToRefresh.pull) : "", k = { "--_pull": `${T}px` };
|
|
43
|
+
return /* @__PURE__ */ l("div", {
|
|
44
|
+
className: n(t.root, _),
|
|
45
|
+
style: k,
|
|
46
|
+
children: [
|
|
47
|
+
/* @__PURE__ */ c("div", {
|
|
48
|
+
className: t.indicator,
|
|
49
|
+
"data-dragging": x.value ? "" : void 0,
|
|
50
|
+
children: b.value ? /* @__PURE__ */ c(e, { size: "sm" }) : /* @__PURE__ */ c("svg", {
|
|
51
|
+
"aria-hidden": "true",
|
|
52
|
+
viewBox: "0 0 16 16",
|
|
53
|
+
className: t.arrow,
|
|
54
|
+
"data-ready": D ? "" : void 0,
|
|
55
|
+
style: { opacity: E },
|
|
56
|
+
children: /* @__PURE__ */ c("path", {
|
|
57
|
+
d: "M8 13V3M4 7l4-4 4 4",
|
|
58
|
+
fill: "none",
|
|
59
|
+
stroke: "currentColor",
|
|
60
|
+
strokeWidth: "1.5",
|
|
61
|
+
strokeLinecap: "round",
|
|
62
|
+
strokeLinejoin: "round"
|
|
63
|
+
})
|
|
64
|
+
})
|
|
65
|
+
}),
|
|
66
|
+
/* @__PURE__ */ c("span", {
|
|
67
|
+
role: "status",
|
|
68
|
+
"aria-live": "polite",
|
|
69
|
+
className: t.srOnly,
|
|
70
|
+
children: O
|
|
71
|
+
}),
|
|
72
|
+
/* @__PURE__ */ c("div", {
|
|
73
|
+
ref: v,
|
|
74
|
+
className: t.viewport,
|
|
75
|
+
"data-dragging": x.value ? "" : void 0,
|
|
76
|
+
children: p
|
|
77
|
+
})
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
//#endregion
|
|
82
|
+
export { f as PullToRefresh };
|