@cascivo/react 0.3.4 → 0.3.8
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 +23 -10
- 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/index.d.ts +59 -1
- 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/log-viewer/log-viewer.css +1 -0
- package/dist/log-viewer/log-viewer.js +184 -0
- package/dist/log-viewer/log-viewer.module.js +19 -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 +131 -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 +250 -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 +23 -10
- package/dist/cascivo.css +0 -2
- package/dist/index.js +0 -9174
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
//#region ../components/src/code-snippet/highlight.ts
|
|
4
|
+
function e(e) {
|
|
5
|
+
return e.map(([e, t]) => ({
|
|
6
|
+
type: e,
|
|
7
|
+
re: RegExp(`^(?:${t})`)
|
|
8
|
+
}));
|
|
9
|
+
}
|
|
10
|
+
var t = "\"(?:[^\"\\\\]|\\\\.)*\"|'(?:[^'\\\\]|\\\\.)*'", n = "`(?:[^`\\\\]|\\\\.)*`", r = "const|let|var|function|return|if|else|for|while|do|switch|case|break|continue|new|class|extends|super|import|export|from|default|async|await|yield|typeof|instanceof|in|of|void|delete|this|null|true|false|undefined", i = `${r}|interface|type|as|readonly|enum|implements|public|private|protected|abstract|namespace|declare|satisfies|keyof|infer|is|string|number|boolean|unknown|never|any`, a = {
|
|
11
|
+
bash: e([
|
|
12
|
+
["comment", "#[^\\n]*"],
|
|
13
|
+
["string", t],
|
|
14
|
+
["prompt", "\\$(?= )"],
|
|
15
|
+
["keyword", "\\b(?:npx|npm|pnpm|yarn|bun|deno|node|git|cd|ls|cat|echo|export|sudo|mkdir|rm|cp|mv|curl|wget|chmod|source)\\b"],
|
|
16
|
+
["variable", "--?[A-Za-z][\\w-]*"],
|
|
17
|
+
["number", "\\b\\d+(?:\\.\\d+)?\\b"]
|
|
18
|
+
]),
|
|
19
|
+
css: e([
|
|
20
|
+
["comment", "/\\*[\\s\\S]*?\\*/"],
|
|
21
|
+
["string", t],
|
|
22
|
+
["keyword", "@[\\w-]+"],
|
|
23
|
+
["variable", "--[\\w-]+"],
|
|
24
|
+
["fn", "[\\w-]+(?=\\()"],
|
|
25
|
+
["number", "#[0-9a-fA-F]{3,8}\\b|-?\\d*\\.?\\d+(?:[a-z%]+)?"],
|
|
26
|
+
["punct", "[{}();:,]"]
|
|
27
|
+
]),
|
|
28
|
+
js: e([
|
|
29
|
+
["comment", "//[^\\n]*|/\\*[\\s\\S]*?\\*/"],
|
|
30
|
+
["string", `${t}|${n}`],
|
|
31
|
+
["keyword", `\\b(?:${r})\\b`],
|
|
32
|
+
["fn", "[A-Za-z_$][\\w$]*(?=\\()"],
|
|
33
|
+
["number", "-?\\d*\\.?\\d+"],
|
|
34
|
+
["punct", "[{}()\\[\\];:,.]|=>"]
|
|
35
|
+
]),
|
|
36
|
+
ts: e([
|
|
37
|
+
["comment", "//[^\\n]*|/\\*[\\s\\S]*?\\*/"],
|
|
38
|
+
["string", `${t}|${n}`],
|
|
39
|
+
["keyword", `\\b(?:${i})\\b`],
|
|
40
|
+
["fn", "[A-Za-z_$][\\w$]*(?=\\()"],
|
|
41
|
+
["number", "-?\\d*\\.?\\d+"],
|
|
42
|
+
["punct", "[{}()\\[\\];:,.]|=>"]
|
|
43
|
+
])
|
|
44
|
+
};
|
|
45
|
+
function o(e, t) {
|
|
46
|
+
let n = a[t], r = [], i = e, o = "", s = () => {
|
|
47
|
+
o &&= (r.push({
|
|
48
|
+
type: "text",
|
|
49
|
+
value: o
|
|
50
|
+
}), "");
|
|
51
|
+
};
|
|
52
|
+
for (; i.length > 0;) {
|
|
53
|
+
let e = !1;
|
|
54
|
+
for (let { type: t, re: a } of n) {
|
|
55
|
+
let n = a.exec(i);
|
|
56
|
+
if (n && n[0].length > 0) {
|
|
57
|
+
s(), r.push({
|
|
58
|
+
type: t,
|
|
59
|
+
value: n[0]
|
|
60
|
+
}), i = i.slice(n[0].length), e = !0;
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
e || (o += i[0], i = i.slice(1));
|
|
65
|
+
}
|
|
66
|
+
return s(), r;
|
|
67
|
+
}
|
|
68
|
+
//#endregion
|
|
69
|
+
export { o as tokenize };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer cascivo.component{._root_j549b_2{flex-direction:column;display:flex}._trigger_j549b_7{justify-content:space-between;align-items:center;gap:var(--cascivo-space-3);inline-size:100%;padding:var(--cascivo-space-3);font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-sm);font-weight:var(--cascivo-font-medium);text-align:start;color:var(--cascivo-color-text);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-control);cursor:pointer;background:0 0;display:flex}._trigger_j549b_7:hover:not(:disabled){background-color:var(--cascivo-color-bg-subtle)}._trigger_j549b_7:focus-visible{box-shadow:var(--cascivo-focus-ring);outline:none}._trigger_j549b_7:disabled{opacity:.5;cursor:not-allowed}._content_j549b_39{visibility:hidden;color:var(--cascivo-color-text);transition:grid-template-rows var(--cascivo-duration-200) var(--cascivo-ease-out), visibility var(--cascivo-duration-200) var(--cascivo-ease-out);grid-template-rows:0fr;display:grid}._content_j549b_39[data-state=open]{visibility:visible;grid-template-rows:1fr}@starting-style{._content_j549b_39[data-state=open]{grid-template-rows:0fr}}._contentInner_j549b_58{font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text-subtle);line-height:var(--cascivo-leading-relaxed);overflow:hidden}._content_j549b_39[data-state=open] ._contentInner_j549b_58{padding-block:var(--cascivo-space-3)}}@media (prefers-reduced-motion:reduce){._content_j549b_39{transition:none}}@media (forced-colors:active){._trigger_j549b_7:focus-visible{outline-offset:2px;outline:2px solid highlight}}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./collapsible.module.js";
|
|
4
|
+
import { cn as t, useControllableSignal as n, useSignals as r } from "@cascivo/core";
|
|
5
|
+
import { jsx as i, jsxs as a } from "react/jsx-runtime";
|
|
6
|
+
import { useId as o } from "react";
|
|
7
|
+
//#region ../components/src/collapsible/collapsible.tsx
|
|
8
|
+
function s({ open: s, defaultOpen: c = !1, onOpenChange: l, trigger: u, disabled: d = !1, className: f, children: p }) {
|
|
9
|
+
r();
|
|
10
|
+
let [m, h] = n({
|
|
11
|
+
...s === void 0 ? {} : { value: s },
|
|
12
|
+
defaultValue: c,
|
|
13
|
+
...l ? { onChange: l } : {}
|
|
14
|
+
}), g = o(), _ = `${g}-content`, v = `${g}-trigger`, y = m.value;
|
|
15
|
+
return /* @__PURE__ */ a("div", {
|
|
16
|
+
"data-state": y ? "open" : "closed",
|
|
17
|
+
className: t(e.root, f),
|
|
18
|
+
children: [/* @__PURE__ */ i("button", {
|
|
19
|
+
type: "button",
|
|
20
|
+
id: v,
|
|
21
|
+
"aria-expanded": y,
|
|
22
|
+
"aria-controls": _,
|
|
23
|
+
disabled: d,
|
|
24
|
+
"data-state": y ? "open" : "closed",
|
|
25
|
+
className: e.trigger,
|
|
26
|
+
onClick: () => h(!y),
|
|
27
|
+
children: u
|
|
28
|
+
}), /* @__PURE__ */ i("div", {
|
|
29
|
+
id: _,
|
|
30
|
+
role: "region",
|
|
31
|
+
"aria-labelledby": v,
|
|
32
|
+
"data-state": y ? "open" : "closed",
|
|
33
|
+
className: e.content,
|
|
34
|
+
children: /* @__PURE__ */ i("div", {
|
|
35
|
+
className: e.contentInner,
|
|
36
|
+
children: p
|
|
37
|
+
})
|
|
38
|
+
})]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//#endregion
|
|
42
|
+
export { s as Collapsible };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer cascivo.component{._picker_1ehlq_2{gap:var(--cascivo-space-3);inline-size:fit-content;font-family:var(--cascivo-font-sans);flex-direction:column;display:flex}._picker_1ehlq_2[data-disabled]{opacity:.5;pointer-events:none}._picker_1ehlq_2[data-size=sm]{--cascivo-color-picker-area-size:9rem}._picker_1ehlq_2[data-size=md]{--cascivo-color-picker-area-size:12rem}._picker_1ehlq_2[data-size=lg]{--cascivo-color-picker-area-size:16rem}._label_1ehlq_27{font-size:var(--cascivo-text-sm);font-weight:var(--cascivo-font-medium);color:var(--cascivo-color-text);line-height:var(--cascivo-leading-snug)}._srOnly_1ehlq_34{clip:rect(0, 0, 0, 0);white-space:nowrap;border:0;block-size:1px;inline-size:1px;margin:-1px;padding:0;position:absolute;overflow:hidden}._area_1ehlq_46{inline-size:var(--cascivo-color-picker-area-size,12rem);block-size:var(--cascivo-color-picker-area-size,12rem);border-radius:var(--cascivo-radius-md);cursor:crosshair;touch-action:none;background-image:linear-gradient(#0000,#000),linear-gradient(90deg,#fff,#0000);background-color:var(--cascivo-color-border);position:relative}._area_1ehlq_46:focus-visible{box-shadow:var(--cascivo-focus-ring);outline:none}._thumb_1ehlq_63{border-radius:var(--cascivo-radius-full);border:2px solid var(--cascivo-color-surface);block-size:.875rem;inline-size:.875rem;box-shadow:var(--cascivo-shadow-sm);pointer-events:none;position:absolute;transform:translate(-50%,-50%)}._sliders_1ehlq_74{gap:var(--cascivo-space-2);flex-direction:column;display:flex}._hue_1ehlq_80,._alpha_1ehlq_81{appearance:none;border-radius:var(--cascivo-radius-full);cursor:pointer;block-size:.75rem;inline-size:100%}:is(._hue_1ehlq_80,._alpha_1ehlq_81):focus-visible{box-shadow:var(--cascivo-focus-ring);outline:none}:is(._hue_1ehlq_80,._alpha_1ehlq_81)::-webkit-slider-thumb{appearance:none;border-radius:var(--cascivo-radius-full);background-color:var(--cascivo-color-surface);border:2px solid var(--cascivo-color-border-strong);block-size:1rem;inline-size:1rem;box-shadow:var(--cascivo-shadow-sm)}:is(._hue_1ehlq_80,._alpha_1ehlq_81)::-moz-range-thumb{border-radius:var(--cascivo-radius-full);background-color:var(--cascivo-color-surface);border:2px solid var(--cascivo-color-border-strong);block-size:1rem;inline-size:1rem;box-shadow:var(--cascivo-shadow-sm)}._hue_1ehlq_80{background-image:linear-gradient(90deg,red 0%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red 100%)}._alpha_1ehlq_81{background-color:#fff;background-image:linear-gradient(to right, transparent, var(--cascivo-color-picker-solid,#000)), conic-gradient(#0000 .25turn, #ccc 0 .5turn, #0000 0 .75turn, #ccc 0);background-size:100% 100%,.5rem .5rem}._presets_1ehlq_136{gap:var(--cascivo-space-2);flex-wrap:wrap;display:flex}._preset_1ehlq_136{border-radius:var(--cascivo-radius-sm);border:1px solid var(--cascivo-color-border);cursor:pointer;block-size:1.5rem;inline-size:1.5rem;padding:0}._preset_1ehlq_136:focus-visible{box-shadow:var(--cascivo-focus-ring);outline:none}._preset_1ehlq_136[aria-pressed=true]{outline:2px solid var(--cascivo-color-accent);outline-offset:2px}._row_1ehlq_161{align-items:center;gap:var(--cascivo-space-2);display:flex}._preview_1ehlq_167{border-radius:var(--cascivo-radius-sm);border:1px solid var(--cascivo-color-border);flex-shrink:0;block-size:1.75rem;inline-size:1.75rem}._text_1ehlq_175{min-inline-size:0;font-family:var(--cascivo-font-mono);font-size:var(--cascivo-text-sm);padding-block:var(--cascivo-space-1);padding-inline:var(--cascivo-space-2);color:var(--cascivo-color-text);background-color:var(--cascivo-color-surface);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-control);flex:1}._text_1ehlq_175:focus-visible{box-shadow:var(--cascivo-focus-ring);outline:none}._eyedropper_1ehlq_193{block-size:1.75rem;inline-size:1.75rem;color:var(--cascivo-color-text);background-color:var(--cascivo-color-surface);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-control);cursor:pointer;flex-shrink:0;justify-content:center;align-items:center;display:inline-flex}._eyedropper_1ehlq_193:hover{background-color:var(--cascivo-color-bg-subtle)}._eyedropper_1ehlq_193:focus-visible{box-shadow:var(--cascivo-focus-ring);outline:none}}@media (forced-colors:active){._area_1ehlq_46:focus-visible,._preset_1ehlq_136:focus-visible,._eyedropper_1ehlq_193:focus-visible{outline-offset:2px;outline:2px solid highlight}}
|
|
@@ -0,0 +1,268 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./color-picker.module.js";
|
|
4
|
+
import { cn as t, useControllableSignal as n, useSignal as r, useSignalEffect as i, useSignals as a } from "@cascivo/core";
|
|
5
|
+
import { builtin as o, t as s } from "@cascivo/i18n";
|
|
6
|
+
import { Fragment as c, jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
import { useId as d, useRef as f } from "react";
|
|
8
|
+
//#region ../components/src/color-picker/color-picker.tsx
|
|
9
|
+
function p(e, t, n) {
|
|
10
|
+
return Math.min(n, Math.max(t, e));
|
|
11
|
+
}
|
|
12
|
+
function m(e) {
|
|
13
|
+
let t = e.trim().replace(/^#/, "");
|
|
14
|
+
t.length === 3 && (t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2]), t.length === 4 && (t = t[0] + t[0] + t[1] + t[1] + t[2] + t[2] + t[3] + t[3]);
|
|
15
|
+
let n = parseInt(t.slice(0, 2), 16), r = parseInt(t.slice(2, 4), 16), i = parseInt(t.slice(4, 6), 16), a = t.length >= 8 ? parseInt(t.slice(6, 8), 16) / 255 : 1;
|
|
16
|
+
return Number.isNaN(n) || Number.isNaN(r) || Number.isNaN(i) ? {
|
|
17
|
+
r: 0,
|
|
18
|
+
g: 0,
|
|
19
|
+
b: 0,
|
|
20
|
+
a: 1
|
|
21
|
+
} : {
|
|
22
|
+
r: n,
|
|
23
|
+
g: r,
|
|
24
|
+
b: i,
|
|
25
|
+
a
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function h({ r: e, g: t, b: n, a: r }, i) {
|
|
29
|
+
let a = (e) => p(Math.round(e), 0, 255).toString(16).padStart(2, "0"), o = `#${a(e)}${a(t)}${a(n)}`;
|
|
30
|
+
return !i || r >= 1 ? o : o + a(r * 255);
|
|
31
|
+
}
|
|
32
|
+
function g({ r: e, g: t, b: n, a: r }) {
|
|
33
|
+
let i = e / 255, a = t / 255, o = n / 255, s = Math.max(i, a, o), c = Math.min(i, a, o), l = s - c, u = 0;
|
|
34
|
+
l !== 0 && (u = s === i ? (a - o) / l % 6 : s === a ? (o - i) / l + 2 : (i - a) / l + 4, u *= 60, u < 0 && (u += 360));
|
|
35
|
+
let d = (s + c) / 2, f = l === 0 ? 0 : l / (1 - Math.abs(2 * d - 1));
|
|
36
|
+
return {
|
|
37
|
+
h: u,
|
|
38
|
+
s: f * 100,
|
|
39
|
+
l: d * 100,
|
|
40
|
+
a: r
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
function _({ h: e, s: t, l: n, a: r }) {
|
|
44
|
+
let i = t / 100, a = n / 100, o = (1 - Math.abs(2 * a - 1)) * i, s = o * (1 - Math.abs(e / 60 % 2 - 1)), c = a - o / 2, l = 0, u = 0, d = 0;
|
|
45
|
+
return e < 60 ? [l, u, d] = [
|
|
46
|
+
o,
|
|
47
|
+
s,
|
|
48
|
+
0
|
|
49
|
+
] : e < 120 ? [l, u, d] = [
|
|
50
|
+
s,
|
|
51
|
+
o,
|
|
52
|
+
0
|
|
53
|
+
] : e < 180 ? [l, u, d] = [
|
|
54
|
+
0,
|
|
55
|
+
o,
|
|
56
|
+
s
|
|
57
|
+
] : e < 240 ? [l, u, d] = [
|
|
58
|
+
0,
|
|
59
|
+
s,
|
|
60
|
+
o
|
|
61
|
+
] : e < 300 ? [l, u, d] = [
|
|
62
|
+
s,
|
|
63
|
+
0,
|
|
64
|
+
o
|
|
65
|
+
] : [l, u, d] = [
|
|
66
|
+
o,
|
|
67
|
+
0,
|
|
68
|
+
s
|
|
69
|
+
], {
|
|
70
|
+
r: (l + c) * 255,
|
|
71
|
+
g: (u + c) * 255,
|
|
72
|
+
b: (d + c) * 255,
|
|
73
|
+
a: r
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
function v({ value: v, defaultValue: y, onValueChange: b, presets: x, alpha: S = !0, label: C, disabled: w, size: T = "md", className: E, labels: D }) {
|
|
77
|
+
a();
|
|
78
|
+
let O = d(), [k, A] = n({
|
|
79
|
+
value: v,
|
|
80
|
+
defaultValue: y ?? "#3b82f6",
|
|
81
|
+
onChange: b
|
|
82
|
+
}), j = f(null), M = r(!1), N = g(m(k.value)), P = (e) => {
|
|
83
|
+
A(h(_(e), S));
|
|
84
|
+
}, F = (e, t) => {
|
|
85
|
+
let n = j.current;
|
|
86
|
+
if (!n) return;
|
|
87
|
+
let r = n.getBoundingClientRect(), i = p((e - r.left) / r.width, 0, 1), a = p((t - r.top) / r.height, 0, 1);
|
|
88
|
+
P({
|
|
89
|
+
h: N.h,
|
|
90
|
+
s: i * 100,
|
|
91
|
+
l: (1 - a) * 100,
|
|
92
|
+
a: N.a
|
|
93
|
+
});
|
|
94
|
+
};
|
|
95
|
+
i(() => {
|
|
96
|
+
if (!M.value) return;
|
|
97
|
+
let e = (e) => F(e.clientX, e.clientY), t = () => {
|
|
98
|
+
M.value = !1;
|
|
99
|
+
};
|
|
100
|
+
return window.addEventListener("pointermove", e), window.addEventListener("pointerup", t), () => {
|
|
101
|
+
window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", t);
|
|
102
|
+
};
|
|
103
|
+
});
|
|
104
|
+
let I = (e) => {
|
|
105
|
+
let t = e.shiftKey ? 10 : 2, { s: n, l: r } = N;
|
|
106
|
+
if (e.key === "ArrowLeft") n -= t;
|
|
107
|
+
else if (e.key === "ArrowRight") n += t;
|
|
108
|
+
else if (e.key === "ArrowUp") r += t;
|
|
109
|
+
else if (e.key === "ArrowDown") r -= t;
|
|
110
|
+
else return;
|
|
111
|
+
e.preventDefault(), P({
|
|
112
|
+
h: N.h,
|
|
113
|
+
s: p(n, 0, 100),
|
|
114
|
+
l: p(r, 0, 100),
|
|
115
|
+
a: N.a
|
|
116
|
+
});
|
|
117
|
+
}, L = (e, t) => {
|
|
118
|
+
!x || x.length === 0 || A(x[(t + e + x.length) % x.length]);
|
|
119
|
+
}, R = typeof window < "u" ? window.EyeDropper : void 0, z = () => {
|
|
120
|
+
R && new R().open().then((e) => A(e.sRGBHex));
|
|
121
|
+
}, B = {
|
|
122
|
+
hue: D?.hue ?? s(o.colorPicker.hue),
|
|
123
|
+
alpha: D?.alpha ?? s(o.colorPicker.alpha),
|
|
124
|
+
colorArea: D?.colorArea ?? s(o.colorPicker.colorArea),
|
|
125
|
+
eyedropper: D?.eyedropper ?? s(o.colorPicker.eyedropper)
|
|
126
|
+
}, V = h(m(k.value), !1), H = `hsl(${N.h} 100% 50%)`;
|
|
127
|
+
return /* @__PURE__ */ u("div", {
|
|
128
|
+
className: t(e.picker, E),
|
|
129
|
+
"data-size": T,
|
|
130
|
+
"data-disabled": w || void 0,
|
|
131
|
+
children: [
|
|
132
|
+
C && /* @__PURE__ */ l("span", {
|
|
133
|
+
className: e.label,
|
|
134
|
+
id: `${O}-label`,
|
|
135
|
+
children: C
|
|
136
|
+
}),
|
|
137
|
+
/* @__PURE__ */ l("div", {
|
|
138
|
+
ref: j,
|
|
139
|
+
className: e.area,
|
|
140
|
+
role: "slider",
|
|
141
|
+
"aria-label": B.colorArea,
|
|
142
|
+
"aria-valuetext": V,
|
|
143
|
+
"aria-disabled": w || void 0,
|
|
144
|
+
tabIndex: w ? -1 : 0,
|
|
145
|
+
style: { background: H },
|
|
146
|
+
onPointerDown: (e) => {
|
|
147
|
+
w || (e.preventDefault(), M.value = !0, F(e.clientX, e.clientY));
|
|
148
|
+
},
|
|
149
|
+
onKeyDown: I,
|
|
150
|
+
children: /* @__PURE__ */ l("span", {
|
|
151
|
+
className: e.thumb,
|
|
152
|
+
style: {
|
|
153
|
+
insetInlineStart: `${N.s}%`,
|
|
154
|
+
insetBlockStart: `${100 - N.l}%`,
|
|
155
|
+
backgroundColor: V
|
|
156
|
+
}
|
|
157
|
+
})
|
|
158
|
+
}),
|
|
159
|
+
/* @__PURE__ */ u("div", {
|
|
160
|
+
className: e.sliders,
|
|
161
|
+
children: [
|
|
162
|
+
/* @__PURE__ */ l("label", {
|
|
163
|
+
className: e.srOnly,
|
|
164
|
+
htmlFor: `${O}-hue`,
|
|
165
|
+
children: B.hue
|
|
166
|
+
}),
|
|
167
|
+
/* @__PURE__ */ l("input", {
|
|
168
|
+
id: `${O}-hue`,
|
|
169
|
+
className: e.hue,
|
|
170
|
+
type: "range",
|
|
171
|
+
min: 0,
|
|
172
|
+
max: 360,
|
|
173
|
+
step: 1,
|
|
174
|
+
value: Math.round(N.h),
|
|
175
|
+
disabled: w,
|
|
176
|
+
"aria-label": B.hue,
|
|
177
|
+
onChange: (e) => P({
|
|
178
|
+
h: Number(e.target.value),
|
|
179
|
+
s: N.s,
|
|
180
|
+
l: N.l,
|
|
181
|
+
a: N.a
|
|
182
|
+
})
|
|
183
|
+
}),
|
|
184
|
+
S && /* @__PURE__ */ u(c, { children: [/* @__PURE__ */ l("label", {
|
|
185
|
+
className: e.srOnly,
|
|
186
|
+
htmlFor: `${O}-alpha`,
|
|
187
|
+
children: B.alpha
|
|
188
|
+
}), /* @__PURE__ */ l("input", {
|
|
189
|
+
id: `${O}-alpha`,
|
|
190
|
+
className: e.alpha,
|
|
191
|
+
type: "range",
|
|
192
|
+
min: 0,
|
|
193
|
+
max: 1,
|
|
194
|
+
step: .01,
|
|
195
|
+
value: N.a,
|
|
196
|
+
disabled: w,
|
|
197
|
+
"aria-label": B.alpha,
|
|
198
|
+
style: { "--cascivo-color-picker-solid": V },
|
|
199
|
+
onChange: (e) => P({
|
|
200
|
+
h: N.h,
|
|
201
|
+
s: N.s,
|
|
202
|
+
l: N.l,
|
|
203
|
+
a: Number(e.target.value)
|
|
204
|
+
})
|
|
205
|
+
})] })
|
|
206
|
+
]
|
|
207
|
+
}),
|
|
208
|
+
x && x.length > 0 && /* @__PURE__ */ l("div", {
|
|
209
|
+
className: e.presets,
|
|
210
|
+
role: "group",
|
|
211
|
+
"aria-label": B.colorArea,
|
|
212
|
+
children: x.map((t, n) => /* @__PURE__ */ l("button", {
|
|
213
|
+
type: "button",
|
|
214
|
+
className: e.preset,
|
|
215
|
+
style: { backgroundColor: t },
|
|
216
|
+
"aria-label": t,
|
|
217
|
+
"aria-pressed": t.toLowerCase() === k.value.toLowerCase(),
|
|
218
|
+
disabled: w,
|
|
219
|
+
onClick: () => A(t),
|
|
220
|
+
onKeyDown: (e) => {
|
|
221
|
+
e.key === "ArrowRight" ? (e.preventDefault(), L(1, n)) : e.key === "ArrowLeft" && (e.preventDefault(), L(-1, n));
|
|
222
|
+
}
|
|
223
|
+
}, t))
|
|
224
|
+
}),
|
|
225
|
+
/* @__PURE__ */ u("div", {
|
|
226
|
+
className: e.row,
|
|
227
|
+
children: [
|
|
228
|
+
/* @__PURE__ */ l("span", {
|
|
229
|
+
className: e.preview,
|
|
230
|
+
style: { backgroundColor: k.value },
|
|
231
|
+
"aria-hidden": "true"
|
|
232
|
+
}),
|
|
233
|
+
/* @__PURE__ */ l("input", {
|
|
234
|
+
className: e.text,
|
|
235
|
+
type: "text",
|
|
236
|
+
value: k.value,
|
|
237
|
+
disabled: w,
|
|
238
|
+
"aria-label": C ?? B.colorArea,
|
|
239
|
+
onChange: (e) => A(e.target.value)
|
|
240
|
+
}),
|
|
241
|
+
R && /* @__PURE__ */ l("button", {
|
|
242
|
+
type: "button",
|
|
243
|
+
className: e.eyedropper,
|
|
244
|
+
"aria-label": B.eyedropper,
|
|
245
|
+
disabled: w,
|
|
246
|
+
onClick: z,
|
|
247
|
+
children: /* @__PURE__ */ l("svg", {
|
|
248
|
+
width: "16",
|
|
249
|
+
height: "16",
|
|
250
|
+
viewBox: "0 0 24 24",
|
|
251
|
+
fill: "none",
|
|
252
|
+
"aria-hidden": "true",
|
|
253
|
+
children: /* @__PURE__ */ l("path", {
|
|
254
|
+
d: "m2 22 1-1h3l9-9M3 21v-3l9-9m1.5 1.5-2-2M19 2l3 3-9 9-3-3z",
|
|
255
|
+
stroke: "currentColor",
|
|
256
|
+
strokeWidth: "2",
|
|
257
|
+
strokeLinecap: "round",
|
|
258
|
+
strokeLinejoin: "round"
|
|
259
|
+
})
|
|
260
|
+
})
|
|
261
|
+
})
|
|
262
|
+
]
|
|
263
|
+
})
|
|
264
|
+
]
|
|
265
|
+
});
|
|
266
|
+
}
|
|
267
|
+
//#endregion
|
|
268
|
+
export { v as ColorPicker };
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import './color-picker.css';
|
|
4
|
+
var e = {
|
|
5
|
+
picker: "_picker_1ehlq_2",
|
|
6
|
+
label: "_label_1ehlq_27",
|
|
7
|
+
srOnly: "_srOnly_1ehlq_34",
|
|
8
|
+
area: "_area_1ehlq_46",
|
|
9
|
+
thumb: "_thumb_1ehlq_63",
|
|
10
|
+
sliders: "_sliders_1ehlq_74",
|
|
11
|
+
hue: "_hue_1ehlq_80",
|
|
12
|
+
alpha: "_alpha_1ehlq_81",
|
|
13
|
+
presets: "_presets_1ehlq_136",
|
|
14
|
+
preset: "_preset_1ehlq_136",
|
|
15
|
+
row: "_row_1ehlq_161",
|
|
16
|
+
preview: "_preview_1ehlq_167",
|
|
17
|
+
text: "_text_1ehlq_175",
|
|
18
|
+
eyedropper: "_eyedropper_1ehlq_193"
|
|
19
|
+
};
|
|
20
|
+
//#endregion
|
|
21
|
+
export { e as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer cascivo.component{._wrapper_1ago2_2{gap:var(--cascivo-space-1);font-family:var(--cascivo-font-sans);flex-direction:column;display:flex;position:relative}._label_1ago2_10{font-size:var(--cascivo-text-sm);font-weight:var(--cascivo-font-medium);color:var(--cascivo-color-text)}._field_1ago2_16{align-items:center;display:flex;position:relative}._trigger_1ago2_22{inline-size:100%;padding-inline:var(--cascivo-space-3);font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text);background-color:var(--cascivo-color-surface);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-field);cursor:pointer;text-align:start;transition:border-color var(--cascivo-duration-150) var(--cascivo-ease-out), box-shadow var(--cascivo-duration-150) var(--cascivo-ease-out);outline:none;justify-content:space-between;align-items:center;display:flex}._trigger_1ago2_22:hover:not(:disabled){border-color:var(--cascivo-color-border-strong)}._trigger_1ago2_22:focus-visible{border-color:var(--cascivo-color-accent);box-shadow:0 0 0 3px color-mix(in srgb, var(--cascivo-color-accent) 20%, transparent)}._trigger_1ago2_22:disabled{opacity:.5;cursor:not-allowed}._wrapper_1ago2_2[data-size=sm] ._trigger_1ago2_22{block-size:2rem}._wrapper_1ago2_2[data-size=md] ._trigger_1ago2_22{block-size:2.5rem}._wrapper_1ago2_2[data-size=lg] ._trigger_1ago2_22{block-size:3rem}._wrapper_1ago2_2[data-state=error] ._trigger_1ago2_22{border-color:var(--cascivo-color-danger)}._value_1ago2_70{text-overflow:ellipsis;white-space:nowrap;overflow:hidden}._placeholder_1ago2_76{color:var(--cascivo-color-text-subtle)}._chevron_1ago2_80{border-inline-end:2px solid var(--cascivo-color-text-muted);border-block-end:2px solid var(--cascivo-color-text-muted);block-size:.75rem;inline-size:.75rem;transition:transform var(--cascivo-duration-150) var(--cascivo-ease-out);flex-shrink:0;margin-inline-start:var(--cascivo-space-2);display:inline-block;transform:rotate(45deg)}._wrapper_1ago2_2[data-state=open] ._chevron_1ago2_80{transform:rotate(-135deg)}._clear_1ago2_96{cursor:pointer;color:var(--cascivo-color-text-muted);font-size:var(--cascivo-text-xs);padding:var(--cascivo-space-1);border-radius:var(--cascivo-radius-control);background:0 0;border:none;outline:none;position:absolute;inset-inline-end:var(--cascivo-space-8)}._clear_1ago2_96:hover{color:var(--cascivo-color-text)}._clear_1ago2_96:focus-visible{box-shadow:0 0 0 2px var(--cascivo-color-accent)}._listbox_1ago2_117{inline-size:100%;z-index:var(--cascivo-z-dropdown);background-color:var(--cascivo-color-surface-overlay);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-overlay);max-block-size:16rem;box-shadow:var(--cascivo-shadow-overlay);opacity:0;visibility:hidden;transition:opacity var(--cascivo-motion-enter), translate var(--cascivo-motion-enter), visibility var(--cascivo-motion-enter);position:absolute;inset-block-start:calc(100% + var(--cascivo-space-1));inset-inline-start:0;overflow-y:auto;translate:0 -.25rem}._listbox_1ago2_117[data-state=open]{opacity:1;visibility:visible;translate:0}@starting-style{._listbox_1ago2_117[data-state=open]{opacity:0;translate:0 -.25rem}}._searchWrapper_1ago2_151{padding:var(--cascivo-space-2);border-block-end:1px solid var(--cascivo-color-border)}._search_1ago2_151{inline-size:100%;padding-inline:var(--cascivo-space-2);padding-block:var(--cascivo-space-1);font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text);background-color:var(--cascivo-color-bg-subtle);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-field);outline:none}._search_1ago2_151:focus-visible{border-color:var(--cascivo-color-accent)}._option_1ago2_173{padding-inline:var(--cascivo-space-3);padding-block:var(--cascivo-space-2);font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text);cursor:pointer;border-radius:var(--cascivo-radius-item)}._option_1ago2_173[data-state=active]{background-color:var(--cascivo-color-bg-subtle)}._option_1ago2_173[aria-selected=true]{background-color:color-mix(in srgb, var(--cascivo-color-accent) 12%, transparent);color:var(--cascivo-color-accent)}._option_1ago2_173[data-disabled]{opacity:.4;cursor:not-allowed}._empty_1ago2_196{padding:var(--cascivo-space-4);text-align:center;font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text-muted)}._error_1ago2_203{font-size:var(--cascivo-text-xs);color:var(--cascivo-color-danger)}._hint_1ago2_208{font-size:var(--cascivo-text-xs);color:var(--cascivo-color-text-muted)}}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import e from "./combobox.module.js";
|
|
4
|
+
import { cn as t, createMachine as n, useMachine as r, useSignal as i, useSignalEffect as a, useSignals as o } from "@cascivo/core";
|
|
5
|
+
import { builtin as s, t as c } from "@cascivo/i18n";
|
|
6
|
+
import { jsx as l, jsxs as u } from "react/jsx-runtime";
|
|
7
|
+
import { useId as d, useRef as f } from "react";
|
|
8
|
+
//#region ../components/src/combobox/combobox.tsx
|
|
9
|
+
var p = n({
|
|
10
|
+
initial: "closed",
|
|
11
|
+
states: {
|
|
12
|
+
closed: { on: { OPEN: "open" } },
|
|
13
|
+
open: { on: { CLOSE: "closed" } }
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
function m({ options: n, value: m, defaultValue: h, onChange: g, clearable: _ = !1, searchable: v = !0, label: y, hint: b, error: x, size: S = "md", disabled: C = !1, labels: w, className: T, id: E }) {
|
|
17
|
+
o();
|
|
18
|
+
let [D, O] = r(p), k = d(), A = E ?? `cascade-combobox-${k}`, j = `${k}-listbox`, M = f(null), N = w?.placeholder ?? c(s.combobox.placeholder), P = w?.empty ?? c(s.combobox.empty), F = w?.clear ?? c(s.combobox.clear), I = i(m ?? h);
|
|
19
|
+
m !== void 0 && (I.value = m);
|
|
20
|
+
let L = i(""), R = i(0), z = D.value === "open", B = n.filter((e) => !v || !L.value ? !0 : e.label.toLowerCase().includes(L.value.toLowerCase())), V = n.find((e) => e.value === I.value);
|
|
21
|
+
a(() => {
|
|
22
|
+
if (!z) return;
|
|
23
|
+
let e = (e) => {
|
|
24
|
+
let t = document.getElementById(`${k}-root`);
|
|
25
|
+
t && !t.contains(e.target) && O("CLOSE");
|
|
26
|
+
};
|
|
27
|
+
return document.addEventListener("mousedown", e), () => document.removeEventListener("mousedown", e);
|
|
28
|
+
});
|
|
29
|
+
let H = () => {
|
|
30
|
+
C || (L.value = "", R.value = 0, O("OPEN"), setTimeout(() => M.current?.focus(), 0));
|
|
31
|
+
}, U = () => {
|
|
32
|
+
O("CLOSE"), L.value = "";
|
|
33
|
+
}, W = (e) => {
|
|
34
|
+
m === void 0 && (I.value = e), g?.(e), U();
|
|
35
|
+
}, G = () => {
|
|
36
|
+
m === void 0 && (I.value = void 0), g?.(void 0);
|
|
37
|
+
}, K = B.flatMap((e, t) => e.disabled ? [] : [t]), q = (e) => {
|
|
38
|
+
if (K.length === 0) return;
|
|
39
|
+
let t = K[(K.indexOf(R.value) + e + K.length) % K.length];
|
|
40
|
+
t !== void 0 && (R.value = t);
|
|
41
|
+
}, J = (e) => {
|
|
42
|
+
(e.key === "Enter" || e.key === " " || e.key === "ArrowDown") && (e.preventDefault(), H());
|
|
43
|
+
}, Y = (e) => {
|
|
44
|
+
switch (e.key) {
|
|
45
|
+
case "ArrowDown":
|
|
46
|
+
e.preventDefault(), q(1);
|
|
47
|
+
break;
|
|
48
|
+
case "ArrowUp":
|
|
49
|
+
e.preventDefault(), q(-1);
|
|
50
|
+
break;
|
|
51
|
+
case "Enter": {
|
|
52
|
+
e.preventDefault();
|
|
53
|
+
let t = B[R.value];
|
|
54
|
+
t && !t.disabled && W(t.value);
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
case "Escape":
|
|
58
|
+
e.preventDefault(), U();
|
|
59
|
+
break;
|
|
60
|
+
case "Tab":
|
|
61
|
+
U();
|
|
62
|
+
break;
|
|
63
|
+
}
|
|
64
|
+
}, X = (e) => `${k}-option-${e}`;
|
|
65
|
+
return /* @__PURE__ */ u("div", {
|
|
66
|
+
id: `${k}-root`,
|
|
67
|
+
className: t(e.wrapper, T),
|
|
68
|
+
"data-state": x ? "error" : D.value,
|
|
69
|
+
"data-size": S,
|
|
70
|
+
children: [
|
|
71
|
+
y && /* @__PURE__ */ l("label", {
|
|
72
|
+
className: e.label,
|
|
73
|
+
htmlFor: A,
|
|
74
|
+
children: y
|
|
75
|
+
}),
|
|
76
|
+
/* @__PURE__ */ u("div", {
|
|
77
|
+
className: e.field,
|
|
78
|
+
children: [/* @__PURE__ */ u("button", {
|
|
79
|
+
id: A,
|
|
80
|
+
type: "button",
|
|
81
|
+
role: "combobox",
|
|
82
|
+
"aria-expanded": z,
|
|
83
|
+
"aria-controls": j,
|
|
84
|
+
"aria-haspopup": "listbox",
|
|
85
|
+
"aria-activedescendant": z && R.value >= 0 ? X(R.value) : void 0,
|
|
86
|
+
"aria-invalid": x ? !0 : void 0,
|
|
87
|
+
"aria-describedby": x ? `${k}-error` : b ? `${k}-hint` : void 0,
|
|
88
|
+
className: e.trigger,
|
|
89
|
+
disabled: C,
|
|
90
|
+
onKeyDown: J,
|
|
91
|
+
onClick: z ? U : H,
|
|
92
|
+
children: [/* @__PURE__ */ l("span", {
|
|
93
|
+
className: t(e.value, V ? void 0 : e.placeholder),
|
|
94
|
+
children: V?.label ?? N
|
|
95
|
+
}), /* @__PURE__ */ l("span", {
|
|
96
|
+
className: e.chevron,
|
|
97
|
+
"aria-hidden": "true"
|
|
98
|
+
})]
|
|
99
|
+
}), _ && I.value !== void 0 && /* @__PURE__ */ l("button", {
|
|
100
|
+
type: "button",
|
|
101
|
+
className: e.clear,
|
|
102
|
+
"aria-label": F,
|
|
103
|
+
onClick: (e) => {
|
|
104
|
+
e.stopPropagation(), G();
|
|
105
|
+
},
|
|
106
|
+
children: "✕"
|
|
107
|
+
})]
|
|
108
|
+
}),
|
|
109
|
+
/* @__PURE__ */ u("div", {
|
|
110
|
+
role: "listbox",
|
|
111
|
+
id: j,
|
|
112
|
+
className: e.listbox,
|
|
113
|
+
"data-state": z ? "open" : "closed",
|
|
114
|
+
"aria-label": y,
|
|
115
|
+
children: [v && z && /* @__PURE__ */ l("div", {
|
|
116
|
+
className: e.searchWrapper,
|
|
117
|
+
children: /* @__PURE__ */ l("input", {
|
|
118
|
+
ref: M,
|
|
119
|
+
type: "text",
|
|
120
|
+
className: e.search,
|
|
121
|
+
value: L.value,
|
|
122
|
+
onChange: (e) => {
|
|
123
|
+
L.value = e.target.value, R.value = 0;
|
|
124
|
+
},
|
|
125
|
+
onKeyDown: Y,
|
|
126
|
+
"aria-label": "Search options",
|
|
127
|
+
autoComplete: "off"
|
|
128
|
+
})
|
|
129
|
+
}), B.length === 0 ? /* @__PURE__ */ l("div", {
|
|
130
|
+
className: e.empty,
|
|
131
|
+
children: P
|
|
132
|
+
}) : B.map((t, n) => /* @__PURE__ */ l("div", {
|
|
133
|
+
id: X(n),
|
|
134
|
+
role: "option",
|
|
135
|
+
"aria-selected": t.value === I.value,
|
|
136
|
+
"aria-disabled": t.disabled || void 0,
|
|
137
|
+
"data-state": n === R.value ? "active" : void 0,
|
|
138
|
+
"data-disabled": t.disabled || void 0,
|
|
139
|
+
className: e.option,
|
|
140
|
+
onMouseEnter: () => {
|
|
141
|
+
t.disabled || (R.value = n);
|
|
142
|
+
},
|
|
143
|
+
onClick: () => {
|
|
144
|
+
t.disabled || W(t.value);
|
|
145
|
+
},
|
|
146
|
+
children: t.label
|
|
147
|
+
}, t.value))]
|
|
148
|
+
}),
|
|
149
|
+
x && /* @__PURE__ */ l("span", {
|
|
150
|
+
id: `${k}-error`,
|
|
151
|
+
className: e.error,
|
|
152
|
+
role: "alert",
|
|
153
|
+
children: x
|
|
154
|
+
}),
|
|
155
|
+
!x && b && /* @__PURE__ */ l("span", {
|
|
156
|
+
id: `${k}-hint`,
|
|
157
|
+
className: e.hint,
|
|
158
|
+
children: b
|
|
159
|
+
})
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
}
|
|
163
|
+
//#endregion
|
|
164
|
+
export { m as Combobox };
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import './combobox.css';
|
|
4
|
+
var e = {
|
|
5
|
+
wrapper: "_wrapper_1ago2_2",
|
|
6
|
+
label: "_label_1ago2_10",
|
|
7
|
+
field: "_field_1ago2_16",
|
|
8
|
+
trigger: "_trigger_1ago2_22",
|
|
9
|
+
value: "_value_1ago2_70",
|
|
10
|
+
placeholder: "_placeholder_1ago2_76",
|
|
11
|
+
chevron: "_chevron_1ago2_80",
|
|
12
|
+
clear: "_clear_1ago2_96",
|
|
13
|
+
listbox: "_listbox_1ago2_117",
|
|
14
|
+
searchWrapper: "_searchWrapper_1ago2_151",
|
|
15
|
+
search: "_search_1ago2_151",
|
|
16
|
+
option: "_option_1ago2_173",
|
|
17
|
+
empty: "_empty_1ago2_196",
|
|
18
|
+
error: "_error_1ago2_203",
|
|
19
|
+
hint: "_hint_1ago2_208"
|
|
20
|
+
};
|
|
21
|
+
//#endregion
|
|
22
|
+
export { e as default };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer cascivo.component{._dialog_cpgn8_2{border-radius:var(--cascivo-radius-overlay);inline-size:min(40rem, calc(100vw - var(--cascivo-space-8)));max-block-size:calc(85vh - var(--cascivo-space-16));opacity:0;transition:opacity var(--cascivo-motion-exit), scale var(--cascivo-motion-exit), display var(--cascivo-duration-150) allow-discrete, overlay var(--cascivo-duration-150) allow-discrete;background:0 0;border:none;margin-block-start:15vh;margin-inline:auto;padding:0;overflow:visible;scale:.96}._dialog_cpgn8_2[open]{opacity:1;transition:opacity var(--cascivo-motion-enter), scale var(--cascivo-motion-enter), display var(--cascivo-duration-200) allow-discrete, overlay var(--cascivo-duration-200) allow-discrete;scale:1}@starting-style{._dialog_cpgn8_2[open]{opacity:0;scale:.96}}._dialog_cpgn8_2::backdrop{-webkit-backdrop-filter:blur(2px);backdrop-filter:blur(2px);opacity:0;transition:opacity var(--cascivo-motion-exit), display var(--cascivo-duration-150) allow-discrete, overlay var(--cascivo-duration-150) allow-discrete;background-color:#00000080}._dialog_cpgn8_2[open]::backdrop{opacity:1;transition:opacity var(--cascivo-motion-enter), display var(--cascivo-duration-200) allow-discrete, overlay var(--cascivo-duration-200) allow-discrete}@starting-style{._dialog_cpgn8_2[open]::backdrop{opacity:0}}._panel_cpgn8_62{background-color:var(--cascivo-color-surface-overlay);border:1px solid var(--cascivo-color-border);border-radius:var(--cascivo-radius-overlay);box-shadow:var(--cascivo-shadow-overlay);flex-direction:column;display:flex;overflow:hidden}._search_cpgn8_72{align-items:center;gap:var(--cascivo-space-3);padding-inline:var(--cascivo-space-4);border-block-end:1px solid var(--cascivo-color-border);display:flex}._searchIcon_cpgn8_80{color:var(--cascivo-color-text-muted);flex-shrink:0}._input_cpgn8_85{block-size:3rem;font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-base);color:var(--cascivo-color-text);background:0 0;border:none;flex:1;padding:0}._input_cpgn8_85:focus{outline:none}._input_cpgn8_85::placeholder{color:var(--cascivo-color-text-muted)}._list_cpgn8_104{max-block-size:20rem;padding:var(--cascivo-space-2);overflow-y:auto}._group_cpgn8_110+._group_cpgn8_110{margin-block-start:var(--cascivo-space-2)}._heading_cpgn8_114{padding-inline:var(--cascivo-space-2);padding-block:var(--cascivo-space-1);font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-xs);font-weight:var(--cascivo-font-medium);color:var(--cascivo-color-text-subtle)}._option_cpgn8_123{align-items:center;gap:var(--cascivo-space-3);padding-inline:var(--cascivo-space-2);padding-block:var(--cascivo-space-2);border-radius:var(--cascivo-radius-item);font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text);cursor:pointer;-webkit-user-select:none;user-select:none;display:flex}._option_cpgn8_123[data-state=active]{background-color:var(--cascivo-color-accent-muted)}._option_cpgn8_123[data-disabled]{opacity:.5;cursor:not-allowed}._icon_cpgn8_148{color:var(--cascivo-color-text-muted);flex-shrink:0;align-items:center;display:inline-flex}._label_cpgn8_155{text-overflow:ellipsis;white-space:nowrap;flex:1;overflow:hidden}._shortcut_cpgn8_162{gap:var(--cascivo-space-1);margin-inline-start:auto;display:inline-flex}._empty_cpgn8_168{padding-block:var(--cascivo-space-8);font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-sm);color:var(--cascivo-color-text-muted);text-align:center}._footer_cpgn8_176{gap:var(--cascivo-space-4);padding-inline:var(--cascivo-space-4);padding-block:var(--cascivo-space-2);border-block-start:1px solid var(--cascivo-color-border);font-family:var(--cascivo-font-sans);font-size:var(--cascivo-text-xs);color:var(--cascivo-color-text-subtle);display:flex}._hint_cpgn8_187{align-items:center;gap:var(--cascivo-space-1);display:inline-flex}}
|