@g4rcez/components 4.0.2 → 4.1.2
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/ai/SKILL.md +120 -153
- package/ai/docs/Alert.md +47 -48
- package/ai/docs/AnimatedList.md +88 -87
- package/ai/docs/Autocomplete.md +102 -106
- package/ai/docs/Button.md +33 -33
- package/ai/docs/Calendar.md +67 -101
- package/ai/docs/Card.md +59 -55
- package/ai/docs/Checkbox.md +77 -82
- package/ai/docs/CommandPalette.md +154 -172
- package/ai/docs/DatePicker.md +45 -64
- package/ai/docs/Dropdown.md +98 -126
- package/ai/docs/Empty.md +41 -44
- package/ai/docs/Expand.md +40 -54
- package/ai/docs/FileUpload.md +102 -109
- package/ai/docs/Form.md +35 -29
- package/ai/docs/FormReset.md +37 -37
- package/ai/docs/Heading.md +4 -6
- package/ai/docs/Input.md +73 -98
- package/ai/docs/InputField.md +67 -67
- package/ai/docs/List.md +88 -85
- package/ai/docs/Menu.md +62 -60
- package/ai/docs/Modal.md +129 -136
- package/ai/docs/MultiSelect.md +65 -84
- package/ai/docs/Notifications.md +96 -96
- package/ai/docs/PageCalendar.md +88 -97
- package/ai/docs/Polymorph.md +25 -41
- package/ai/docs/Progress.md +55 -51
- package/ai/docs/Radiobox.md +49 -41
- package/ai/docs/RenderOnView.md +26 -32
- package/ai/docs/Resizable.md +60 -65
- package/ai/docs/Select.md +158 -158
- package/ai/docs/Shortcut.md +14 -14
- package/ai/docs/Skeleton.md +56 -60
- package/ai/docs/Slider.md +26 -49
- package/ai/docs/Slot.md +15 -17
- package/ai/docs/Spinner.md +17 -15
- package/ai/docs/Stats.md +44 -42
- package/ai/docs/Step.md +60 -60
- package/ai/docs/Switch.md +44 -54
- package/ai/docs/Table.md +124 -136
- package/ai/docs/Tabs.md +90 -90
- package/ai/docs/Tag.md +63 -65
- package/ai/docs/TaskList.md +40 -50
- package/ai/docs/Textarea.md +47 -70
- package/ai/docs/Timeline.md +98 -96
- package/ai/docs/Toolbar.md +46 -46
- package/ai/docs/Tooltip.md +103 -103
- package/ai/docs/Typography.md +55 -55
- package/ai/docs/Wizard.md +104 -109
- package/ai/docs/index.md +116 -116
- package/dist/autocomplete-DcTNOwyg.js +393 -0
- package/dist/autocomplete-DcTNOwyg.js.map +1 -0
- package/dist/{calendar-B5lSd0ID.js → calendar-BJMHRoy2.js} +104 -105
- package/dist/calendar-BJMHRoy2.js.map +1 -0
- package/dist/components/core/button.d.ts.map +1 -1
- package/dist/components/core/button.js +10 -10
- package/dist/components/core/button.js.map +1 -1
- package/dist/components/core/button.jsx +79 -0
- package/dist/components/core/heading.jsx +4 -0
- package/dist/components/core/polymorph.d.ts +1 -1
- package/dist/components/core/polymorph.d.ts.map +1 -1
- package/dist/components/core/polymorph.jsx +5 -0
- package/dist/components/core/render-on-view.jsx +31 -0
- package/dist/components/core/resizable.jsx +51 -0
- package/dist/components/core/slot.d.ts.map +1 -1
- package/dist/components/core/slot.jsx +156 -0
- package/dist/components/core/tag.d.ts +1 -1
- package/dist/components/core/tag.d.ts.map +1 -1
- package/dist/components/core/tag.js +4 -4
- package/dist/components/core/tag.js.map +1 -1
- package/dist/components/core/tag.jsx +51 -0
- package/dist/components/core/typography.jsx +18 -0
- package/dist/components/display/alert.d.ts +1 -1
- package/dist/components/display/alert.d.ts.map +1 -1
- package/dist/components/display/alert.js +48 -46
- package/dist/components/display/alert.js.map +1 -1
- package/dist/components/display/alert.jsx +61 -0
- package/dist/components/display/calendar.js +6 -6
- package/dist/components/display/calendar.jsx +299 -0
- package/dist/components/display/card.js +2 -2
- package/dist/components/display/card.js.map +1 -1
- package/dist/components/display/card.jsx +43 -0
- package/dist/components/display/empty.jsx +11 -0
- package/dist/components/display/list.js +1 -1
- package/dist/components/display/list.js.map +1 -1
- package/dist/components/display/list.jsx +81 -0
- package/dist/components/display/notifications.d.ts +1 -1
- package/dist/components/display/notifications.d.ts.map +1 -1
- package/dist/components/display/notifications.js +3 -3
- package/dist/components/display/notifications.jsx +126 -0
- package/dist/components/display/progress.jsx +11 -0
- package/dist/components/display/shortcut.jsx +23 -0
- package/dist/components/display/skeleton.d.ts.map +1 -1
- package/dist/components/display/skeleton.jsx +19 -0
- package/dist/components/display/spinner.d.ts.map +1 -1
- package/dist/components/display/spinner.jsx +11 -0
- package/dist/components/display/stats.js +1 -1
- package/dist/components/display/stats.jsx +20 -0
- package/dist/components/display/step.jsx +131 -0
- package/dist/components/display/tabs.d.ts +1 -1
- package/dist/components/display/tabs.d.ts.map +1 -1
- package/dist/components/display/tabs.js +2 -2
- package/dist/components/display/tabs.jsx +125 -0
- package/dist/components/display/timeline.js +1 -1
- package/dist/components/display/timeline.jsx +25 -0
- package/dist/components/floating/command-palette.d.ts.map +1 -1
- package/dist/components/floating/command-palette.jsx +197 -0
- package/dist/components/floating/dropdown.d.ts.map +1 -1
- package/dist/components/floating/dropdown.js +25 -17
- package/dist/components/floating/dropdown.js.map +1 -1
- package/dist/components/floating/dropdown.jsx +56 -0
- package/dist/components/floating/expand.js +7 -7
- package/dist/components/floating/expand.js.map +1 -1
- package/dist/components/floating/expand.jsx +44 -0
- package/dist/components/floating/menu.js +10 -10
- package/dist/components/floating/menu.js.map +1 -1
- package/dist/components/floating/menu.jsx +147 -0
- package/dist/components/floating/modal.d.ts +4 -4
- package/dist/components/floating/modal.d.ts.map +1 -1
- package/dist/components/floating/modal.js +106 -102
- package/dist/components/floating/modal.js.map +1 -1
- package/dist/components/floating/modal.jsx +301 -0
- package/dist/components/floating/toolbar.jsx +5 -0
- package/dist/components/floating/tooltip.d.ts.map +1 -1
- package/dist/components/floating/tooltip.js +14 -14
- package/dist/components/floating/tooltip.js.map +1 -1
- package/dist/components/floating/tooltip.jsx +58 -0
- package/dist/components/floating/wizard.jsx +161 -0
- package/dist/components/form/autocomplete.d.ts.map +1 -1
- package/dist/components/form/autocomplete.js +6 -6
- package/dist/components/form/autocomplete.jsx +278 -0
- package/dist/components/form/checkbox.js +1 -1
- package/dist/components/form/checkbox.jsx +12 -0
- package/dist/components/form/date-picker.d.ts.map +1 -1
- package/dist/components/form/date-picker.js +5 -5
- package/dist/components/form/date-picker.jsx +115 -0
- package/dist/components/form/file-upload.d.ts.map +1 -1
- package/dist/components/form/file-upload.js +2 -2
- package/dist/components/form/file-upload.jsx +134 -0
- package/dist/components/form/form.js.map +1 -1
- package/dist/components/form/form.jsx +10 -0
- package/dist/components/form/formReset.jsx +17 -0
- package/dist/components/form/free-text.d.ts.map +1 -1
- package/dist/components/form/free-text.jsx +41 -0
- package/dist/components/form/input-field.d.ts +11 -11
- package/dist/components/form/input-field.d.ts.map +1 -1
- package/dist/components/form/input-field.jsx +58 -0
- package/dist/components/form/input.js +1 -1
- package/dist/components/form/input.jsx +36 -0
- package/dist/components/form/multi-select.d.ts.map +1 -1
- package/dist/components/form/multi-select.jsx +336 -0
- package/dist/components/form/radiobox.js +1 -1
- package/dist/components/form/radiobox.jsx +6 -0
- package/dist/components/form/select.js +3 -3
- package/dist/components/form/select.jsx +42 -0
- package/dist/components/form/slider.jsx +45 -0
- package/dist/components/form/switch.js +2 -2
- package/dist/components/form/switch.js.map +1 -1
- package/dist/components/form/switch.jsx +46 -0
- package/dist/components/form/task-list.jsx +26 -0
- package/dist/components/form/textarea.jsx +12 -0
- package/dist/components/index.d.ts +0 -1
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +44 -0
- package/dist/components/page-calendar/calendar-header.jsx +83 -0
- package/dist/components/page-calendar/day-view.jsx +94 -0
- package/dist/components/page-calendar/event-pill.d.ts.map +1 -1
- package/dist/components/page-calendar/event-pill.jsx +25 -0
- package/dist/components/page-calendar/index.js +2 -0
- package/dist/components/page-calendar/month-view.jsx +46 -0
- package/dist/components/page-calendar/page-calendar.jsx +41 -0
- package/dist/components/page-calendar/page-calendar.types.js +1 -0
- package/dist/components/page-calendar/page-calendar.utils.js +93 -0
- package/dist/components/page-calendar/week-view.jsx +71 -0
- package/dist/components/table/filter.jsx +141 -0
- package/dist/components/table/group.jsx +68 -0
- package/dist/components/table/index.d.ts +2 -3
- package/dist/components/table/index.d.ts.map +1 -1
- package/dist/components/table/index.jsx +60 -0
- package/dist/components/table/inner-table.d.ts +2 -3
- package/dist/components/table/inner-table.d.ts.map +1 -1
- package/dist/components/table/inner-table.jsx +102 -0
- package/dist/components/table/metadata.jsx +36 -0
- package/dist/components/table/pagination.d.ts +3 -1
- package/dist/components/table/pagination.d.ts.map +1 -1
- package/dist/components/table/pagination.jsx +74 -0
- package/dist/components/table/row.d.ts +4 -5
- package/dist/components/table/row.d.ts.map +1 -1
- package/dist/components/table/row.jsx +49 -0
- package/dist/components/table/sort.d.ts.map +1 -1
- package/dist/components/table/sort.jsx +109 -0
- package/dist/components/table/table-lib.d.ts +1 -1
- package/dist/components/table/table-lib.d.ts.map +1 -1
- package/dist/components/table/table-lib.js +83 -0
- package/dist/components/table/table.context.jsx +4 -0
- package/dist/components/table/table.js +3 -3
- package/dist/components/table/thead.jsx +103 -0
- package/dist/config/context.js +12 -0
- package/dist/config/default-translations.d.ts +4 -0
- package/dist/config/default-translations.d.ts.map +1 -1
- package/dist/config/default-translations.jsx +87 -0
- package/dist/config/default-tweaks.js +4 -0
- package/dist/constants.js +2 -0
- package/dist/{date-picker-DwNo22lx.js → date-picker-Bnl07nd8.js} +8 -6
- package/dist/date-picker-Bnl07nd8.js.map +1 -0
- package/dist/{dom-Dl8XH0CK.js → dom-CyQHY7ID.js} +66 -61
- package/dist/dom-CyQHY7ID.js.map +1 -0
- package/dist/{file-upload-Brf2NkLr.js → file-upload-93d5DR4q.js} +139 -129
- package/dist/file-upload-93d5DR4q.js.map +1 -0
- package/dist/{floating-ui.react-QNHG9W4N.js → floating-ui.react-M2PGXLDp.js} +8 -8
- package/dist/floating-ui.react-M2PGXLDp.js.map +1 -0
- package/dist/{fns-D2eyJKd5.js → fns-C7Dt27Qd.js} +2 -2
- package/dist/fns-C7Dt27Qd.js.map +1 -0
- package/dist/hooks/use-click-outside.js +17 -0
- package/dist/hooks/use-color-parser.js +9 -0
- package/dist/hooks/use-components-provider.jsx +22 -0
- package/dist/hooks/use-debounce.d.ts +3 -3
- package/dist/hooks/use-debounce.d.ts.map +1 -1
- package/dist/hooks/use-debounce.js +12 -0
- package/dist/hooks/use-floating-ref.js +6 -0
- package/dist/hooks/use-form.d.ts +14 -13
- package/dist/hooks/use-form.d.ts.map +1 -1
- package/dist/hooks/use-form.js +563 -0
- package/dist/hooks/use-hover.js +18 -0
- package/dist/hooks/use-input-id.js +5 -0
- package/dist/hooks/use-is-coarse-device.js +12 -0
- package/dist/hooks/use-locale.js +10 -0
- package/dist/hooks/use-media-query.js +25 -0
- package/dist/hooks/use-on-event.js +7 -0
- package/dist/hooks/use-parent.js +21 -0
- package/dist/hooks/use-preferences.js +23 -0
- package/dist/hooks/use-previous.js +9 -0
- package/dist/hooks/use-reactive.js +9 -0
- package/dist/hooks/use-remove-scroll.d.ts.map +1 -1
- package/dist/hooks/use-remove-scroll.js +48 -0
- package/dist/hooks/use-resize-observer.js +17 -0
- package/dist/hooks/use-stable-ref.js +9 -0
- package/dist/hooks/use-swipe.js +17 -0
- package/dist/hooks/use-translations.d.ts +4 -0
- package/dist/hooks/use-translations.d.ts.map +1 -1
- package/dist/hooks/use-translations.js +9 -0
- package/dist/hooks/use-tweaks.js +9 -0
- package/dist/hooks/use-window-size.js +14 -0
- package/dist/index-BJ1ayTam.js +126 -0
- package/dist/index-BJ1ayTam.js.map +1 -0
- package/dist/index-C-PuFUZi.js.map +1 -1
- package/dist/{index-BelDtX5M.js → index-DDeQW0JW.js} +399 -404
- package/dist/index-DDeQW0JW.js.map +1 -0
- package/dist/index-DE4shK8D.js +215 -0
- package/dist/index-DE4shK8D.js.map +1 -0
- package/dist/{index-DJSMaZR4.js → index-DlJ_2RBL.js} +2 -2
- package/dist/index-DlJ_2RBL.js.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.esm-BaIwleSE.js.map +1 -1
- package/dist/index.js +20 -8177
- package/dist/index.js.map +1 -1
- package/dist/{input-CrGrSnUt.js → input-_MVxmIpu.js} +116 -114
- package/dist/input-_MVxmIpu.js.map +1 -0
- package/dist/{input-field-5vYcz5tT.js → input-field-CDCOODOl.js} +63 -47
- package/dist/input-field-CDCOODOl.js.map +1 -0
- package/dist/lib/combi-keys.js +60 -0
- package/dist/lib/dict.d.ts +1 -4
- package/dist/lib/dict.d.ts.map +1 -1
- package/dist/lib/dict.js +28 -0
- package/dist/lib/dom.d.ts +3 -2
- package/dist/lib/dom.d.ts.map +1 -1
- package/dist/lib/dom.js +66 -0
- package/dist/lib/fns.js +46 -0
- package/dist/lib/fzf.d.ts.map +1 -1
- package/dist/lib/fzf.js +115 -0
- package/dist/lib/keyboard-area.js +14 -0
- package/dist/notifications-Dp0ydKJS.js +2576 -0
- package/dist/notifications-Dp0ydKJS.js.map +1 -0
- package/dist/polymorph-B5n9fs_K.js.map +1 -1
- package/dist/preset/plugin.tailwind.d.ts.map +1 -1
- package/dist/preset/plugin.tailwind.js +20 -18
- package/dist/preset/preset.tailwind.js +24 -25
- package/dist/preset/src/styles/common.js +6 -3
- package/dist/preset/src/styles/dark.d.ts.map +1 -1
- package/dist/preset/src/styles/dark.js +9 -5
- package/dist/preset/src/styles/design-tokens.js +68 -89
- package/dist/preset/src/styles/light.d.ts.map +1 -1
- package/dist/preset/src/styles/light.js +9 -5
- package/dist/preset/src/styles/theme.js +7 -4
- package/dist/preset/src/styles/theme.types.d.ts +2 -1
- package/dist/preset/src/styles/theme.types.d.ts.map +1 -1
- package/dist/preset/src/styles/theme.types.js +2 -1
- package/dist/skeleton-BjJobYYf.js +24 -0
- package/dist/skeleton-BjJobYYf.js.map +1 -0
- package/dist/slot-CRyweuj0.js.map +1 -1
- package/dist/styles/common.js +6 -3
- package/dist/styles/dark.d.ts.map +1 -1
- package/dist/styles/dark.js +9 -5
- package/dist/styles/design-tokens.js +68 -89
- package/dist/styles/light.d.ts.map +1 -1
- package/dist/styles/light.js +9 -5
- package/dist/styles/theme.js +7 -4
- package/dist/styles/theme.types.d.ts +2 -1
- package/dist/styles/theme.types.d.ts.map +1 -1
- package/dist/styles/theme.types.js +2 -1
- package/dist/tabs-B0g7YtQv.js +123 -0
- package/dist/tabs-B0g7YtQv.js.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -0
- package/dist/types.d.ts +2 -2
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/dist/{context-BFXNJVn2.js → use-translations-DSltA7H_.js} +38 -30
- package/dist/use-translations-DSltA7H_.js.map +1 -0
- package/package.json +99 -86
- package/ai/docs/TransferList.md +0 -142
- package/dist/autocomplete-Cn9Z2hLq.js +0 -375
- package/dist/autocomplete-Cn9Z2hLq.js.map +0 -1
- package/dist/calendar-B5lSd0ID.js.map +0 -1
- package/dist/components/form/transfer-list.d.ts +0 -14
- package/dist/components/form/transfer-list.d.ts.map +0 -1
- package/dist/components/form/transfer-list.js +0 -55
- package/dist/components/form/transfer-list.js.map +0 -1
- package/dist/context-BFXNJVn2.js.map +0 -1
- package/dist/date-picker-DwNo22lx.js.map +0 -1
- package/dist/dom-Dl8XH0CK.js.map +0 -1
- package/dist/file-upload-Brf2NkLr.js.map +0 -1
- package/dist/floating-ui.react-QNHG9W4N.js.map +0 -1
- package/dist/fns-D2eyJKd5.js.map +0 -1
- package/dist/index-BelDtX5M.js.map +0 -1
- package/dist/index-DJSMaZR4.js.map +0 -1
- package/dist/index-Z-fZHxfJ.js +0 -335
- package/dist/index-Z-fZHxfJ.js.map +0 -1
- package/dist/input-CrGrSnUt.js.map +0 -1
- package/dist/input-field-5vYcz5tT.js.map +0 -1
- package/dist/notifications-cUdVPs-B.js +0 -2786
- package/dist/notifications-cUdVPs-B.js.map +0 -1
- package/dist/skeleton-D75GFBV6.js +0 -10
- package/dist/skeleton-D75GFBV6.js.map +0 -1
- package/dist/tabs-S00a8qq8.js +0 -106
- package/dist/tabs-S00a8qq8.js.map +0 -1
- package/dist/use-translations-BwLKTrZv.js +0 -10
- package/dist/use-translations-BwLKTrZv.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as u } from "react/jsx-runtime";
|
|
2
|
-
import { c as g } from "../../index-
|
|
2
|
+
import { c as g } from "../../index-DlJ_2RBL.js";
|
|
3
3
|
import { forwardRef as c } from "react";
|
|
4
|
-
import { c as p } from "../../dom-
|
|
4
|
+
import { c as p } from "../../dom-CyQHY7ID.js";
|
|
5
5
|
import { P as l } from "../../polymorph-B5n9fs_K.js";
|
|
6
6
|
const m = {
|
|
7
7
|
size: {
|
|
@@ -41,13 +41,13 @@ const m = {
|
|
|
41
41
|
"ghost-neutral": "bg-transparent border-0 border-card-border"
|
|
42
42
|
}
|
|
43
43
|
}, x = g(
|
|
44
|
-
"relative
|
|
44
|
+
"relative inline-flex cursor-pointer items-center justify-center gap-1.5 overflow-hidden whitespace-nowrap align-middle font-medium transition-colors duration-300 ease-linear focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring enabled:hover:bg-opacity-70 enabled:focus:bg-opacity-70 disabled:cursor-not-allowed disabled:bg-opacity-40 disabled:text-opacity-80 data-[loading=true]:animate-pulse data-[loading=true]:opacity-30",
|
|
45
45
|
{
|
|
46
46
|
variants: m,
|
|
47
47
|
defaultVariants: { theme: "main", size: "default", rounded: "default" }
|
|
48
48
|
}
|
|
49
|
-
), k = c(function({ className: a, icon: o, loading:
|
|
50
|
-
const
|
|
49
|
+
), k = c(function({ className: a, icon: o, loading: e, theme: n, type: s = "button", size: d, rounded: b, ...t }, i) {
|
|
50
|
+
const r = e || t.disabled;
|
|
51
51
|
return /* @__PURE__ */ u(
|
|
52
52
|
l,
|
|
53
53
|
{
|
|
@@ -55,13 +55,13 @@ const m = {
|
|
|
55
55
|
ref: i,
|
|
56
56
|
type: s,
|
|
57
57
|
"data-theme": n,
|
|
58
|
-
disabled:
|
|
59
|
-
"data-loading":
|
|
58
|
+
disabled: r,
|
|
59
|
+
"data-loading": e,
|
|
60
60
|
"data-component": "button",
|
|
61
|
-
"aria-disabled":
|
|
61
|
+
"aria-disabled": r,
|
|
62
62
|
as: t.as ?? "button",
|
|
63
|
-
"aria-busy": e
|
|
64
|
-
onClick:
|
|
63
|
+
"aria-busy": e,
|
|
64
|
+
onClick: r ? void 0 : t.onClick,
|
|
65
65
|
className: p(x({ size: d, rounded: b, theme: n }), a),
|
|
66
66
|
children: [
|
|
67
67
|
o,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.js","sources":["../../../src/components/core/button.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport React, { forwardRef, PropsWithChildren } from \"react\";\nimport { css } from \"../../lib/dom\";\nimport { CvaVariants, type Label } from \"../../types\";\nimport { Polymorph, PolymorphicProps } from \"./polymorph\";\n\nconst variants = {\n size: {\n icon: \"p-1\",\n big: \"h-12 px-6 py-4\",\n default: \"h-10 px-4 py-2\",\n min: \"h-7 px-3 py-1 text-sm\",\n small: \"h-8 px-4 py-2 text-sm\",\n tiny: \"h-6 px-2 py-1 text-sm\",\n },\n rounded: {\n rough: \"rounded-sm\",\n squared: \"rounded-none\",\n default: \"rounded-button\",\n circle: \"rounded-full aspect-square\",\n },\n theme: {\n raw: \"\",\n disabled: \"bg-disabled opacity-70\",\n loading: \"animate-pulse bg-disabled\",\n main: \"bg-button-primary-bg text-button-primary-text\",\n info: \"bg-button-info-bg text-button-info-text\",\n warn: \"bg-button-warn-bg text-button-warn-text\",\n muted: \"bg-button-muted-bg text-button-muted-text\",\n danger: \"bg-button-danger-bg text-button-danger-text\",\n neutral: \"bg-transparent border-1 border-card-border\",\n primary: \"bg-button-primary-bg text-button-primary-text\",\n success: \"bg-button-success-bg text-button-success-text\",\n secondary: \"bg-button-secondary-bg text-button-secondary-text\",\n\n \"ghost-info\": \"bg-transparent hover:bg-info/20 border-0 border-transparent text-info\",\n \"ghost-warn\": \"bg-transparent hover:bg-warn/20 border-0 border-transparent text-warn\",\n \"ghost-danger\": \"bg-transparent hover:bg-danger/20 border-0 border-transparent text-danger\",\n \"ghost-primary\": \"bg-transparent hover:bg-primary/20 border-0 border-transparent text-primary\",\n \"ghost-success\": \"bg-transparent hover:bg-success/20 border-0 border-transparent text-success\",\n \"ghost-secondary\": \"bg-transparent hover:bg-secondary/20 border-0 border-transparent text-secondary\",\n \"ghost-muted\": \"bg-transparent hover:bg-muted/20 border-0 border-transparent text-muted-foreground\",\n \"ghost-neutral\": \"bg-transparent border-0 border-card-border\",\n },\n};\n\nconst buttonVariants = cva(\n \"relative
|
|
1
|
+
{"version":3,"file":"button.js","sources":["../../../src/components/core/button.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport React, { forwardRef, PropsWithChildren } from \"react\";\nimport { css } from \"../../lib/dom\";\nimport { CvaVariants, type Label } from \"../../types\";\nimport { Polymorph, PolymorphicProps } from \"./polymorph\";\n\nconst variants = {\n size: {\n icon: \"p-1\",\n big: \"h-12 px-6 py-4\",\n default: \"h-10 px-4 py-2\",\n min: \"h-7 px-3 py-1 text-sm\",\n small: \"h-8 px-4 py-2 text-sm\",\n tiny: \"h-6 px-2 py-1 text-sm\",\n },\n rounded: {\n rough: \"rounded-sm\",\n squared: \"rounded-none\",\n default: \"rounded-button\",\n circle: \"rounded-full aspect-square\",\n },\n theme: {\n raw: \"\",\n disabled: \"bg-disabled opacity-70\",\n loading: \"animate-pulse bg-disabled\",\n main: \"bg-button-primary-bg text-button-primary-text\",\n info: \"bg-button-info-bg text-button-info-text\",\n warn: \"bg-button-warn-bg text-button-warn-text\",\n muted: \"bg-button-muted-bg text-button-muted-text\",\n danger: \"bg-button-danger-bg text-button-danger-text\",\n neutral: \"bg-transparent border-1 border-card-border\",\n primary: \"bg-button-primary-bg text-button-primary-text\",\n success: \"bg-button-success-bg text-button-success-text\",\n secondary: \"bg-button-secondary-bg text-button-secondary-text\",\n\n \"ghost-info\": \"bg-transparent hover:bg-info/20 border-0 border-transparent text-info\",\n \"ghost-warn\": \"bg-transparent hover:bg-warn/20 border-0 border-transparent text-warn\",\n \"ghost-danger\": \"bg-transparent hover:bg-danger/20 border-0 border-transparent text-danger\",\n \"ghost-primary\": \"bg-transparent hover:bg-primary/20 border-0 border-transparent text-primary\",\n \"ghost-success\": \"bg-transparent hover:bg-success/20 border-0 border-transparent text-success\",\n \"ghost-secondary\": \"bg-transparent hover:bg-secondary/20 border-0 border-transparent text-secondary\",\n \"ghost-muted\": \"bg-transparent hover:bg-muted/20 border-0 border-transparent text-muted-foreground\",\n \"ghost-neutral\": \"bg-transparent border-0 border-card-border\",\n },\n};\n\nconst buttonVariants = cva(\n \"relative inline-flex cursor-pointer items-center justify-center gap-1.5 overflow-hidden whitespace-nowrap align-middle font-medium transition-colors duration-300 ease-linear focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring enabled:hover:bg-opacity-70 enabled:focus:bg-opacity-70 disabled:cursor-not-allowed disabled:bg-opacity-40 disabled:text-opacity-80 data-[loading=true]:animate-pulse data-[loading=true]:opacity-30\",\n {\n variants,\n defaultVariants: { theme: \"main\", size: \"default\", rounded: \"default\" },\n }\n);\n\ntype Variants = CvaVariants<typeof variants>;\n\nexport type ButtonProps<T extends React.ElementType = \"button\"> = PropsWithChildren<\n PolymorphicProps<\n Variants &\n Partial<{\n /** Icon to display in the button */\n icon: Label;\n /** Whether the button is in a loading state */\n loading: boolean;\n }>,\n T\n >\n>;\n\n/**\n * A versatile button component with multiple variants, sizes, and states.\n *\n * @example\n * ```tsx\n * // Basic usage\n * <Button>Click me</Button>\n *\n * // With variants\n * <Button theme=\"primary\" size=\"big\">Primary Button</Button>\n *\n * // Loading state\n * <Button loading>Saving...</Button>\n *\n * // With icon\n * <Button icon={<Icon name=\"plus\" />}>Add Item</Button>\n *\n * // As different element\n * <Button as=\"a\" href=\"/link\">Link Button</Button>\n * ```\n *\n * @template T - The HTML element type to render as\n * @param props - Button props including theme, size, loading state, etc.\n * @param ref - Forwarded ref to the button element\n * @returns A styled button component\n */\nexport const Button: <T extends React.ElementType = \"button\">(_: ButtonProps<T>) => React.ReactNode = forwardRef(function Button(\n { className, icon, loading, theme, type = \"button\", size, rounded, ...props }: ButtonProps,\n ref: React.Ref<\"button\">\n) {\n const disabled = loading || props.disabled;\n return (\n <Polymorph\n {...props}\n ref={ref}\n type={type}\n data-theme={theme}\n disabled={disabled}\n data-loading={loading}\n data-component=\"button\"\n aria-disabled={disabled}\n as={props.as ?? \"button\"}\n aria-busy={loading}\n onClick={disabled ? undefined : props.onClick}\n className={css(buttonVariants({ size, rounded, theme }), className)}\n >\n {icon}\n {props.children}\n </Polymorph>\n );\n}) as unknown as <T extends React.ElementType = \"button\">(_: ButtonProps<T>) => React.ReactNode;\n"],"names":["variants","buttonVariants","cva","Button","forwardRef","className","icon","loading","theme","type","size","rounded","props","ref","disabled","jsxs","Polymorph","css"],"mappings":";;;;;AAMA,MAAMA,IAAW;AAAA,EACb,MAAM;AAAA,IACF,MAAM;AAAA,IACN,KAAK;AAAA,IACL,SAAS;AAAA,IACT,KAAK;AAAA,IACL,OAAO;AAAA,IACP,MAAM;AAAA,EAAA;AAAA,EAEV,SAAS;AAAA,IACL,OAAO;AAAA,IACP,SAAS;AAAA,IACT,SAAS;AAAA,IACT,QAAQ;AAAA,EAAA;AAAA,EAEZ,OAAO;AAAA,IACH,KAAK;AAAA,IACL,UAAU;AAAA,IACV,SAAS;AAAA,IACT,MAAM;AAAA,IACN,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,SAAS;AAAA,IACT,SAAS;AAAA,IACT,SAAS;AAAA,IACT,WAAW;AAAA,IAEX,cAAc;AAAA,IACd,cAAc;AAAA,IACd,gBAAgB;AAAA,IAChB,iBAAiB;AAAA,IACjB,iBAAiB;AAAA,IACjB,mBAAmB;AAAA,IACnB,eAAe;AAAA,IACf,iBAAiB;AAAA,EAAA;AAEzB,GAEMC,IAAiBC;AAAA,EACnB;AAAA,EACA;AAAA,IACI,UAAAF;AAAA,IACA,iBAAiB,EAAE,OAAO,QAAQ,MAAM,WAAW,SAAS,UAAA;AAAA,EAAU;AAE9E,GA2CaG,IAAyFC,EAAW,SAC7G,EAAE,WAAAC,GAAW,MAAAC,GAAM,SAAAC,GAAS,OAAAC,GAAO,MAAAC,IAAO,UAAU,MAAAC,GAAM,SAAAC,GAAS,GAAGC,EAAA,GACtEC,GACF;AACE,QAAMC,IAAWP,KAAWK,EAAM;AAClC,SACI,gBAAAG;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGJ;AAAA,MACJ,KAAAC;AAAA,MACA,MAAAJ;AAAA,MACA,cAAYD;AAAA,MACZ,UAAAM;AAAA,MACA,gBAAcP;AAAA,MACd,kBAAe;AAAA,MACf,iBAAeO;AAAA,MACf,IAAIF,EAAM,MAAM;AAAA,MAChB,aAAWL;AAAA,MACX,SAASO,IAAW,SAAYF,EAAM;AAAA,MACtC,WAAWK,EAAIhB,EAAe,EAAE,MAAAS,GAAM,SAAAC,GAAS,OAAAH,EAAA,CAAO,GAAGH,CAAS;AAAA,MAEjE,UAAA;AAAA,QAAAC;AAAA,QACAM,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGnB,CAAC;"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
|
+
import { css } from "../../lib/dom";
|
|
4
|
+
import { Polymorph } from "./polymorph";
|
|
5
|
+
const variants = {
|
|
6
|
+
size: {
|
|
7
|
+
icon: "p-1",
|
|
8
|
+
big: "h-12 px-6 py-4",
|
|
9
|
+
default: "h-10 px-4 py-2",
|
|
10
|
+
min: "h-7 px-3 py-1 text-sm",
|
|
11
|
+
small: "h-8 px-4 py-2 text-sm",
|
|
12
|
+
tiny: "h-6 px-2 py-1 text-sm",
|
|
13
|
+
},
|
|
14
|
+
rounded: {
|
|
15
|
+
rough: "rounded-sm",
|
|
16
|
+
squared: "rounded-none",
|
|
17
|
+
default: "rounded-button",
|
|
18
|
+
circle: "rounded-full aspect-square",
|
|
19
|
+
},
|
|
20
|
+
theme: {
|
|
21
|
+
raw: "",
|
|
22
|
+
disabled: "bg-disabled opacity-70",
|
|
23
|
+
loading: "animate-pulse bg-disabled",
|
|
24
|
+
main: "bg-button-primary-bg text-button-primary-text",
|
|
25
|
+
info: "bg-button-info-bg text-button-info-text",
|
|
26
|
+
warn: "bg-button-warn-bg text-button-warn-text",
|
|
27
|
+
muted: "bg-button-muted-bg text-button-muted-text",
|
|
28
|
+
danger: "bg-button-danger-bg text-button-danger-text",
|
|
29
|
+
neutral: "bg-transparent border-1 border-card-border",
|
|
30
|
+
primary: "bg-button-primary-bg text-button-primary-text",
|
|
31
|
+
success: "bg-button-success-bg text-button-success-text",
|
|
32
|
+
secondary: "bg-button-secondary-bg text-button-secondary-text",
|
|
33
|
+
"ghost-info": "bg-transparent hover:bg-info/20 border-0 border-transparent text-info",
|
|
34
|
+
"ghost-warn": "bg-transparent hover:bg-warn/20 border-0 border-transparent text-warn",
|
|
35
|
+
"ghost-danger": "bg-transparent hover:bg-danger/20 border-0 border-transparent text-danger",
|
|
36
|
+
"ghost-primary": "bg-transparent hover:bg-primary/20 border-0 border-transparent text-primary",
|
|
37
|
+
"ghost-success": "bg-transparent hover:bg-success/20 border-0 border-transparent text-success",
|
|
38
|
+
"ghost-secondary": "bg-transparent hover:bg-secondary/20 border-0 border-transparent text-secondary",
|
|
39
|
+
"ghost-muted": "bg-transparent hover:bg-muted/20 border-0 border-transparent text-muted-foreground",
|
|
40
|
+
"ghost-neutral": "bg-transparent border-0 border-card-border",
|
|
41
|
+
},
|
|
42
|
+
};
|
|
43
|
+
const buttonVariants = cva("relative inline-flex cursor-pointer items-center justify-center gap-1.5 overflow-hidden whitespace-nowrap align-middle font-medium transition-colors duration-300 ease-linear focus-visible:outline-none focus-visible:ring-4 focus-visible:ring-ring enabled:hover:bg-opacity-70 enabled:focus:bg-opacity-70 disabled:cursor-not-allowed disabled:bg-opacity-40 disabled:text-opacity-80 data-[loading=true]:animate-pulse data-[loading=true]:opacity-30", {
|
|
44
|
+
variants,
|
|
45
|
+
defaultVariants: { theme: "main", size: "default", rounded: "default" },
|
|
46
|
+
});
|
|
47
|
+
/**
|
|
48
|
+
* A versatile button component with multiple variants, sizes, and states.
|
|
49
|
+
*
|
|
50
|
+
* @example
|
|
51
|
+
* ```tsx
|
|
52
|
+
* // Basic usage
|
|
53
|
+
* <Button>Click me</Button>
|
|
54
|
+
*
|
|
55
|
+
* // With variants
|
|
56
|
+
* <Button theme="primary" size="big">Primary Button</Button>
|
|
57
|
+
*
|
|
58
|
+
* // Loading state
|
|
59
|
+
* <Button loading>Saving...</Button>
|
|
60
|
+
*
|
|
61
|
+
* // With icon
|
|
62
|
+
* <Button icon={<Icon name="plus" />}>Add Item</Button>
|
|
63
|
+
*
|
|
64
|
+
* // As different element
|
|
65
|
+
* <Button as="a" href="/link">Link Button</Button>
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* @template T - The HTML element type to render as
|
|
69
|
+
* @param props - Button props including theme, size, loading state, etc.
|
|
70
|
+
* @param ref - Forwarded ref to the button element
|
|
71
|
+
* @returns A styled button component
|
|
72
|
+
*/
|
|
73
|
+
export const Button = forwardRef(function Button({ className, icon, loading, theme, type = "button", size, rounded, ...props }, ref) {
|
|
74
|
+
const disabled = loading || props.disabled;
|
|
75
|
+
return (<Polymorph {...props} ref={ref} type={type} data-theme={theme} disabled={disabled} data-loading={loading} data-component="button" aria-disabled={disabled} as={props.as ?? "button"} aria-busy={loading} onClick={disabled ? undefined : props.onClick} className={css(buttonVariants({ size, rounded, theme }), className)}>
|
|
76
|
+
{icon}
|
|
77
|
+
{props.children}
|
|
78
|
+
</Polymorph>);
|
|
79
|
+
});
|
|
@@ -5,6 +5,6 @@ export type PolymorphicProps<Props, T extends React.ElementType> = Props & {
|
|
|
5
5
|
} & Omit<PropsOf<T>, keyof Props | "as" | "ref"> & {
|
|
6
6
|
ref?: React.ComponentProps<T>["ref"];
|
|
7
7
|
};
|
|
8
|
-
export declare const Polymorph: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<
|
|
8
|
+
export declare const Polymorph: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<React.ElementType<any, keyof React.JSX.IntrinsicElements>>>;
|
|
9
9
|
export {};
|
|
10
10
|
//# sourceMappingURL=polymorph.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"polymorph.d.ts","sourceRoot":"","sources":["../../../src/components/core/polymorph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,OAAO,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,MAAM,gBAAgB,CAAC,KAAK,EAAE,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,KAAK,GAAG;IACvE,EAAE,CAAC,EAAE,CAAC,CAAC;CACV,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG;IAC3C,GAAG,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;CACxC,CAAC;AAEN,eAAO,MAAM,SAAS,
|
|
1
|
+
{"version":3,"file":"polymorph.d.ts","sourceRoot":"","sources":["../../../src/components/core/polymorph.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAG/B,KAAK,OAAO,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,KAAK,CAAC,wBAAwB,CAAC,CAAC,CAAC,CAAC;AAE9E,MAAM,MAAM,gBAAgB,CAAC,KAAK,EAAE,CAAC,SAAS,KAAK,CAAC,WAAW,IAAI,KAAK,GAAG;IACvE,EAAE,CAAC,EAAE,CAAC,CAAC;CACV,GAAG,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,GAAG,IAAI,GAAG,KAAK,CAAC,GAAG;IAC3C,GAAG,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;CACxC,CAAC;AAEN,eAAO,MAAM,SAAS,oIAGpB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import React, { useLayoutEffect, useRef, useState } from "react";
|
|
3
|
+
import { useStableRef } from "../../hooks/use-stable-ref";
|
|
4
|
+
function isInViewport(el) {
|
|
5
|
+
const rect = el.getBoundingClientRect();
|
|
6
|
+
return (rect.top >= 0 &&
|
|
7
|
+
rect.left >= 0 &&
|
|
8
|
+
rect.bottom <= (window.innerHeight || document.documentElement.clientHeight) &&
|
|
9
|
+
rect.right <= (window.innerWidth || document.documentElement.clientWidth) /* or $(window).width() */);
|
|
10
|
+
}
|
|
11
|
+
export const RenderOnView = ({ children, ...props }) => {
|
|
12
|
+
const onIntersect = useStableRef(props.onIntersection);
|
|
13
|
+
const ref = useRef(null);
|
|
14
|
+
const [shouldRender, setShouldRender] = useState(() => (ref.current === null ? false : isInViewport(ref.current)));
|
|
15
|
+
useLayoutEffect(() => {
|
|
16
|
+
const div = ref.current;
|
|
17
|
+
if (div === null)
|
|
18
|
+
return;
|
|
19
|
+
const observer = new IntersectionObserver((args) => {
|
|
20
|
+
const first = args[0];
|
|
21
|
+
if (first.isIntersecting)
|
|
22
|
+
onIntersect.current?.();
|
|
23
|
+
return setShouldRender((prev) => (first.isIntersecting ? true : prev));
|
|
24
|
+
});
|
|
25
|
+
observer.observe(div);
|
|
26
|
+
return () => observer.disconnect();
|
|
27
|
+
}, []);
|
|
28
|
+
return (<div {...props} ref={ref}>
|
|
29
|
+
{shouldRender ? children : null}
|
|
30
|
+
</div>);
|
|
31
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { motion, useMotionValue } from "motion/react";
|
|
3
|
+
import React, { useEffect, useMemo, useState } from "react";
|
|
4
|
+
import { isSsr } from "../../lib/fns";
|
|
5
|
+
const defaultState = {
|
|
6
|
+
x: 0,
|
|
7
|
+
y: 0,
|
|
8
|
+
width: 0,
|
|
9
|
+
height: 0,
|
|
10
|
+
top: 0,
|
|
11
|
+
left: 0,
|
|
12
|
+
bottom: 0,
|
|
13
|
+
right: 0,
|
|
14
|
+
};
|
|
15
|
+
const useElementRect = () => {
|
|
16
|
+
const [element, ref] = useState(null);
|
|
17
|
+
const motion = useMotionValue(defaultState);
|
|
18
|
+
const observer = useMemo(() => isSsr()
|
|
19
|
+
? null
|
|
20
|
+
: new window.ResizeObserver((entries) => {
|
|
21
|
+
if (entries[0]) {
|
|
22
|
+
const rect = entries[0].contentRect;
|
|
23
|
+
motion.set({
|
|
24
|
+
x: rect.x,
|
|
25
|
+
y: rect.y,
|
|
26
|
+
width: rect.width,
|
|
27
|
+
height: rect.height,
|
|
28
|
+
top: rect.top,
|
|
29
|
+
left: rect.left,
|
|
30
|
+
bottom: rect.bottom,
|
|
31
|
+
right: rect.right,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}), []);
|
|
35
|
+
useEffect(() => {
|
|
36
|
+
if (!element)
|
|
37
|
+
return;
|
|
38
|
+
if (observer === null)
|
|
39
|
+
return;
|
|
40
|
+
observer.observe(element);
|
|
41
|
+
return () => observer.disconnect();
|
|
42
|
+
}, [element]);
|
|
43
|
+
return [ref, motion];
|
|
44
|
+
};
|
|
45
|
+
export const Resizable = ({ children }) => {
|
|
46
|
+
const [ref, bounds] = useElementRect();
|
|
47
|
+
const h = bounds.get().height;
|
|
48
|
+
return (<motion.div animate={{ height: h > 0 ? h : "auto" }}>
|
|
49
|
+
<div ref={ref}>{children}</div>
|
|
50
|
+
</motion.div>);
|
|
51
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../../src/components/core/slot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"slot.d.ts","sourceRoot":"","sources":["../../../src/components/core/slot.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AA4C/B,MAAM,MAAM,MAAM,CAAC,CAAC,IAAI,WAAW,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;AAI1D,UAAU,SAAU,SAAQ,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC;IACzD,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CAC9B;AAiBD,wBAAgB,UAAU,CAAC,SAAS,EAAE,MAAM,iFAyC3C;AAED,eAAO,MAAM,IAAI,+EAAqB,CAAC;AAgCvC,UAAU,cAAc;IACpB,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC7B;AAED,UAAU,kBAAmB,SAAQ,KAAK,CAAC,EAAE,CAAC,cAAc,CAAC;IACzD,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,wBAAgB,eAAe,CAAC,SAAS,EAAE,MAAM,sBAOhD"}
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
const REACT_LAZY_TYPE = Symbol.for("react.lazy");
|
|
3
|
+
function setRef(ref, value) {
|
|
4
|
+
if (typeof ref === "function") {
|
|
5
|
+
return ref(value);
|
|
6
|
+
}
|
|
7
|
+
else if (ref !== null && ref !== undefined) {
|
|
8
|
+
ref.current = value;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
function composeRefs(...refs) {
|
|
12
|
+
return (node) => {
|
|
13
|
+
let hasCleanup = false;
|
|
14
|
+
const cleanups = refs.map((ref) => {
|
|
15
|
+
const cleanup = setRef(ref, node);
|
|
16
|
+
if (!hasCleanup && typeof cleanup == "function") {
|
|
17
|
+
hasCleanup = true;
|
|
18
|
+
}
|
|
19
|
+
return cleanup;
|
|
20
|
+
});
|
|
21
|
+
if (hasCleanup) {
|
|
22
|
+
return () => {
|
|
23
|
+
for (let i = 0; i < cleanups.length; i++) {
|
|
24
|
+
const cleanup = cleanups[i];
|
|
25
|
+
if (typeof cleanup == "function") {
|
|
26
|
+
cleanup();
|
|
27
|
+
}
|
|
28
|
+
else {
|
|
29
|
+
setRef(refs[i], null);
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
const use = React[" use ".trim().toString()];
|
|
37
|
+
function isPromiseLike(value) {
|
|
38
|
+
return typeof value === "object" && value !== null && "then" in value;
|
|
39
|
+
}
|
|
40
|
+
function isLazyComponent(element) {
|
|
41
|
+
return (element != null &&
|
|
42
|
+
typeof element === "object" &&
|
|
43
|
+
"$$typeof" in element &&
|
|
44
|
+
element.$$typeof === REACT_LAZY_TYPE &&
|
|
45
|
+
"_payload" in element &&
|
|
46
|
+
isPromiseLike(element._payload));
|
|
47
|
+
}
|
|
48
|
+
export function createSlot(ownerName) {
|
|
49
|
+
const SlotClone = createSlotClone(ownerName);
|
|
50
|
+
const Slot = React.forwardRef((props, forwardedRef) => {
|
|
51
|
+
let { children, ...slotProps } = props;
|
|
52
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
53
|
+
children = use(children._payload);
|
|
54
|
+
}
|
|
55
|
+
const childrenArray = React.Children.toArray(children);
|
|
56
|
+
const slottable = childrenArray.find(isSlottable);
|
|
57
|
+
if (slottable) {
|
|
58
|
+
// the new element to render is the one passed as a child of `Slottable`
|
|
59
|
+
const newElement = slottable.props.children;
|
|
60
|
+
const newChildren = childrenArray.map((child) => {
|
|
61
|
+
if (child === slottable) {
|
|
62
|
+
// because the new element will be the one rendered, we are only interested
|
|
63
|
+
// in grabbing its children (`newElement.props.children`)
|
|
64
|
+
if (React.Children.count(newElement) > 1)
|
|
65
|
+
return React.Children.only(null);
|
|
66
|
+
return React.isValidElement(newElement) ? newElement.props.children : null;
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
return child;
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
return (<SlotClone {...slotProps} ref={forwardedRef}>
|
|
73
|
+
{React.isValidElement(newElement) ? React.cloneElement(newElement, undefined, newChildren) : null}
|
|
74
|
+
</SlotClone>);
|
|
75
|
+
}
|
|
76
|
+
return (<SlotClone {...slotProps} ref={forwardedRef}>
|
|
77
|
+
{children}
|
|
78
|
+
</SlotClone>);
|
|
79
|
+
});
|
|
80
|
+
Slot.displayName = `${ownerName}.Slot`;
|
|
81
|
+
return Slot;
|
|
82
|
+
}
|
|
83
|
+
export const Slot = createSlot("Slot");
|
|
84
|
+
function createSlotClone(ownerName) {
|
|
85
|
+
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
86
|
+
let { children, ...slotProps } = props;
|
|
87
|
+
if (isLazyComponent(children) && typeof use === "function") {
|
|
88
|
+
children = use(children._payload);
|
|
89
|
+
}
|
|
90
|
+
if (React.isValidElement(children)) {
|
|
91
|
+
const childrenRef = getElementRef(children);
|
|
92
|
+
const props = mergeProps(slotProps, children.props);
|
|
93
|
+
// do not pass ref to React.Fragment for React 19 compatibility
|
|
94
|
+
if (children.type !== React.Fragment) {
|
|
95
|
+
props.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
96
|
+
}
|
|
97
|
+
return React.cloneElement(children, props);
|
|
98
|
+
}
|
|
99
|
+
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
100
|
+
});
|
|
101
|
+
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
102
|
+
return SlotClone;
|
|
103
|
+
}
|
|
104
|
+
const SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
105
|
+
export function createSlottable(ownerName) {
|
|
106
|
+
const Slottable = ({ children }) => {
|
|
107
|
+
return <>{children}</>;
|
|
108
|
+
};
|
|
109
|
+
Slottable.displayName = `${ownerName}.Slottable`;
|
|
110
|
+
Slottable.__radixId = SLOTTABLE_IDENTIFIER;
|
|
111
|
+
return Slottable;
|
|
112
|
+
}
|
|
113
|
+
const Slottable = createSlottable("Slottable");
|
|
114
|
+
function isSlottable(child) {
|
|
115
|
+
return (React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER);
|
|
116
|
+
}
|
|
117
|
+
function mergeProps(slotProps, childProps) {
|
|
118
|
+
const overrideProps = { ...childProps };
|
|
119
|
+
for (const propName in childProps) {
|
|
120
|
+
const slotPropValue = slotProps[propName];
|
|
121
|
+
const childPropValue = childProps[propName];
|
|
122
|
+
const isHandler = /^on[A-Z]/.test(propName);
|
|
123
|
+
if (isHandler) {
|
|
124
|
+
if (slotPropValue && childPropValue) {
|
|
125
|
+
overrideProps[propName] = (...args) => {
|
|
126
|
+
const result = childPropValue(...args);
|
|
127
|
+
slotPropValue(...args);
|
|
128
|
+
return result;
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
else if (slotPropValue) {
|
|
132
|
+
overrideProps[propName] = slotPropValue;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
else if (propName === "style") {
|
|
136
|
+
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
137
|
+
}
|
|
138
|
+
else if (propName === "className") {
|
|
139
|
+
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
return { ...slotProps, ...overrideProps };
|
|
143
|
+
}
|
|
144
|
+
function getElementRef(element) {
|
|
145
|
+
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
146
|
+
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
147
|
+
if (mayWarn) {
|
|
148
|
+
return element.ref;
|
|
149
|
+
}
|
|
150
|
+
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
151
|
+
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
152
|
+
if (mayWarn) {
|
|
153
|
+
return element.props.ref;
|
|
154
|
+
}
|
|
155
|
+
return element.props.ref || element.ref;
|
|
156
|
+
}
|
|
@@ -30,6 +30,6 @@ export type TagProps<T extends React.ElementType = "span"> = PolymorphicProps<Cv
|
|
|
30
30
|
loading: boolean;
|
|
31
31
|
indicator: Themes | true;
|
|
32
32
|
}>, T>;
|
|
33
|
-
export declare const Tag: <T extends React.ElementType = "span">(_: TagProps<T>) =>
|
|
33
|
+
export declare const Tag: <T extends React.ElementType = "span">(_: TagProps<T>) => React.ReactNode;
|
|
34
34
|
export {};
|
|
35
35
|
//# sourceMappingURL=tag.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../src/components/core/tag.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAa,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;CAqBb,CAAC;AAEF,KAAK,QAAQ,GAAG,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE7C,KAAK,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AAyB7C,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,gBAAgB,CACzE,WAAW,CAAC,OAAO,QAAQ,CAAC,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,EACnG,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,
|
|
1
|
+
{"version":3,"file":"tag.d.ts","sourceRoot":"","sources":["../../../src/components/core/tag.tsx"],"names":[],"mappings":"AACA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,OAAO,EAAE,WAAW,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,EAAa,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;CAqBb,CAAC;AAEF,KAAK,QAAQ,GAAG,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE7C,KAAK,MAAM,GAAG,WAAW,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;AAyB7C,MAAM,MAAM,QAAQ,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,IAAI,gBAAgB,CACzE,WAAW,CAAC,OAAO,QAAQ,CAAC,GAAG,OAAO,CAAC;IAAE,IAAI,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,OAAO,CAAC;IAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAAC,EACnG,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,GAAG,EAAE,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,MAAM,EAAE,CAAC,EAAE,QAAQ,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAiBQ,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsxs as o, jsx as c } from "react/jsx-runtime";
|
|
2
|
-
import { c as r } from "../../index-
|
|
2
|
+
import { c as r } from "../../index-DlJ_2RBL.js";
|
|
3
3
|
import { forwardRef as m } from "react";
|
|
4
|
-
import { c as b } from "../../dom-
|
|
4
|
+
import { c as b } from "../../dom-CyQHY7ID.js";
|
|
5
5
|
import { P as l } from "../../polymorph-B5n9fs_K.js";
|
|
6
6
|
const u = {
|
|
7
7
|
size: {
|
|
@@ -24,7 +24,7 @@ const u = {
|
|
|
24
24
|
secondary: "bg-tag-secondary-bg text-tag-secondary-text",
|
|
25
25
|
loading: "animate-pulse bg-disabled duration-700 opacity-70"
|
|
26
26
|
}
|
|
27
|
-
}, p = r("size-2
|
|
27
|
+
}, p = r("aspect-square size-2 rounded-full border-0", {
|
|
28
28
|
variants: {
|
|
29
29
|
theme: {
|
|
30
30
|
info: "bg-info",
|
|
@@ -38,7 +38,7 @@ const u = {
|
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
}), x = r(
|
|
41
|
-
"inline-flex
|
|
41
|
+
"inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-pill border-0 align-middle transition-all duration-300 ease-linear",
|
|
42
42
|
{
|
|
43
43
|
variants: u,
|
|
44
44
|
defaultVariants: { theme: "primary", size: "default" }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"tag.js","sources":["../../../src/components/core/tag.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport React, { forwardRef } from \"react\";\nimport { css } from \"../../lib/dom\";\nimport { CvaVariants, Label } from \"../../types\";\nimport { Polymorph, PolymorphicProps } from \"./polymorph\";\n\nconst variants = {\n size: {\n icon: \"p-1\",\n big: \"h-12 px-6 py-4\",\n default: \"h-8 px-4 py-2\",\n tiny: \"h-5 p-1 px-2 text-xs\",\n small: \"h-6 p-2 px-3 text-sm\",\n },\n theme: {\n custom: \"\",\n info: \"bg-tag-info-bg text-tag-info-text\",\n warn: \"bg-tag-warn-bg text-tag-warn-text\",\n muted: \"bg-tag-muted-bg text-tag-muted-text\",\n danger: \"bg-tag-danger-bg text-tag-danger-text\",\n disabled: \"bg-disabled duration-700 opacity-70\",\n primary: \"bg-tag-primary-bg text-tag-primary-text\",\n success: \"bg-tag-success-bg text-tag-success-text\",\n neutral: \"bg-transparent border border-card-border\",\n secondary: \"bg-tag-secondary-bg text-tag-secondary-text\",\n loading: \"animate-pulse bg-disabled duration-700 opacity-70\",\n },\n};\n\ntype Variants = CvaVariants<typeof variants>;\n\ntype Themes = NonNullable<Variants[\"theme\"]>;\n\nconst indicatorVariant = cva(\"size-2
|
|
1
|
+
{"version":3,"file":"tag.js","sources":["../../../src/components/core/tag.tsx"],"sourcesContent":["import { cva } from \"class-variance-authority\";\nimport React, { forwardRef } from \"react\";\nimport { css } from \"../../lib/dom\";\nimport { CvaVariants, Label } from \"../../types\";\nimport { Polymorph, PolymorphicProps } from \"./polymorph\";\n\nconst variants = {\n size: {\n icon: \"p-1\",\n big: \"h-12 px-6 py-4\",\n default: \"h-8 px-4 py-2\",\n tiny: \"h-5 p-1 px-2 text-xs\",\n small: \"h-6 p-2 px-3 text-sm\",\n },\n theme: {\n custom: \"\",\n info: \"bg-tag-info-bg text-tag-info-text\",\n warn: \"bg-tag-warn-bg text-tag-warn-text\",\n muted: \"bg-tag-muted-bg text-tag-muted-text\",\n danger: \"bg-tag-danger-bg text-tag-danger-text\",\n disabled: \"bg-disabled duration-700 opacity-70\",\n primary: \"bg-tag-primary-bg text-tag-primary-text\",\n success: \"bg-tag-success-bg text-tag-success-text\",\n neutral: \"bg-transparent border border-card-border\",\n secondary: \"bg-tag-secondary-bg text-tag-secondary-text\",\n loading: \"animate-pulse bg-disabled duration-700 opacity-70\",\n },\n};\n\ntype Variants = CvaVariants<typeof variants>;\n\ntype Themes = NonNullable<Variants[\"theme\"]>;\n\nconst indicatorVariant = cva(\"aspect-square size-2 rounded-full border-0\", {\n variants: {\n theme: {\n info: \"bg-info\",\n warn: \"bg-warn\",\n muted: \"bg-muted\",\n danger: \"bg-danger\",\n neutral: \"bg-muted\",\n primary: \"bg-primary\",\n success: \"bg-success\",\n secondary: \"bg-secondary\",\n } as Record<Themes, string>,\n },\n});\n\nconst tagVariants = cva(\n \"inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-pill border-0 align-middle transition-all duration-300 ease-linear\",\n {\n variants,\n defaultVariants: { theme: \"primary\", size: \"default\" },\n }\n);\n\nexport type TagProps<T extends React.ElementType = \"span\"> = PolymorphicProps<\n CvaVariants<typeof variants> & Partial<{ icon: Label; loading: boolean; indicator: Themes | true }>,\n T\n>;\n\nexport const Tag: <T extends React.ElementType = \"span\">(_: TagProps<T>) => React.ReactNode = forwardRef(function Tag<\n T extends React.ElementType = \"span\",\n>({ className, indicator = undefined, icon, loading, theme, size, ...props }: TagProps<T>, ref: React.Ref<HTMLElement>) {\n return (\n <Polymorph\n {...props}\n ref={ref}\n data-theme={theme}\n data-component=\"tag\"\n as={props.as ?? \"span\"}\n className={css(tagVariants({ size, theme: loading ? \"loading\" : theme }), className)}\n >\n {indicator ? <span aria-hidden=\"true\" className={indicatorVariant({ theme: indicator === true ? theme : indicator })} /> : null}\n {icon}\n {props.children}\n </Polymorph>\n );\n}) as unknown as <T extends React.ElementType = \"span\">(_: TagProps<T>) => React.ReactNode;\n"],"names":["variants","indicatorVariant","cva","tagVariants","Tag","forwardRef","className","indicator","icon","loading","theme","size","props","ref","jsxs","Polymorph","css","jsx"],"mappings":";;;;;AAMA,MAAMA,IAAW;AAAA,EACb,MAAM;AAAA,IACF,MAAM;AAAA,IACN,KAAK;AAAA,IACL,SAAS;AAAA,IACT,MAAM;AAAA,IACN,OAAO;AAAA,EAAA;AAAA,EAEX,OAAO;AAAA,IACH,QAAQ;AAAA,IACR,MAAM;AAAA,IACN,MAAM;AAAA,IACN,OAAO;AAAA,IACP,QAAQ;AAAA,IACR,UAAU;AAAA,IACV,SAAS;AAAA,IACT,SAAS;AAAA,IACT,SAAS;AAAA,IACT,WAAW;AAAA,IACX,SAAS;AAAA,EAAA;AAEjB,GAMMC,IAAmBC,EAAI,8CAA8C;AAAA,EACvE,UAAU;AAAA,IACN,OAAO;AAAA,MACH,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,SAAS;AAAA,MACT,SAAS;AAAA,MACT,WAAW;AAAA,IAAA;AAAA,EACf;AAER,CAAC,GAEKC,IAAcD;AAAA,EAChB;AAAA,EACA;AAAA,IACI,UAAAF;AAAA,IACA,iBAAiB,EAAE,OAAO,WAAW,MAAM,UAAA;AAAA,EAAU;AAE7D,GAOaI,IAAiFC,EAAW,SAEvG,EAAE,WAAAC,GAAW,WAAAC,IAAY,QAAW,MAAAC,GAAM,SAAAC,GAAS,OAAAC,GAAO,MAAAC,GAAM,GAAGC,EAAA,GAAsBC,GAA6B;AACpH,SACI,gBAAAC;AAAA,IAACC;AAAA,IAAA;AAAA,MACI,GAAGH;AAAA,MACJ,KAAAC;AAAA,MACA,cAAYH;AAAA,MACZ,kBAAe;AAAA,MACf,IAAIE,EAAM,MAAM;AAAA,MAChB,WAAWI,EAAIb,EAAY,EAAE,MAAAQ,GAAM,OAAOF,IAAU,YAAYC,GAAO,GAAGJ,CAAS;AAAA,MAElF,UAAA;AAAA,QAAAC,IAAY,gBAAAU,EAAC,QAAA,EAAK,eAAY,QAAO,WAAWhB,EAAiB,EAAE,OAAOM,MAAc,KAAOG,IAAQH,EAAA,CAAW,GAAG,IAAK;AAAA,QAC1HC;AAAA,QACAI,EAAM;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGnB,CAAC;"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { cva } from "class-variance-authority";
|
|
2
|
+
import React, { forwardRef } from "react";
|
|
3
|
+
import { css } from "../../lib/dom";
|
|
4
|
+
import { Polymorph } from "./polymorph";
|
|
5
|
+
const variants = {
|
|
6
|
+
size: {
|
|
7
|
+
icon: "p-1",
|
|
8
|
+
big: "h-12 px-6 py-4",
|
|
9
|
+
default: "h-8 px-4 py-2",
|
|
10
|
+
tiny: "h-5 p-1 px-2 text-xs",
|
|
11
|
+
small: "h-6 p-2 px-3 text-sm",
|
|
12
|
+
},
|
|
13
|
+
theme: {
|
|
14
|
+
custom: "",
|
|
15
|
+
info: "bg-tag-info-bg text-tag-info-text",
|
|
16
|
+
warn: "bg-tag-warn-bg text-tag-warn-text",
|
|
17
|
+
muted: "bg-tag-muted-bg text-tag-muted-text",
|
|
18
|
+
danger: "bg-tag-danger-bg text-tag-danger-text",
|
|
19
|
+
disabled: "bg-disabled duration-700 opacity-70",
|
|
20
|
+
primary: "bg-tag-primary-bg text-tag-primary-text",
|
|
21
|
+
success: "bg-tag-success-bg text-tag-success-text",
|
|
22
|
+
neutral: "bg-transparent border border-card-border",
|
|
23
|
+
secondary: "bg-tag-secondary-bg text-tag-secondary-text",
|
|
24
|
+
loading: "animate-pulse bg-disabled duration-700 opacity-70",
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
const indicatorVariant = cva("aspect-square size-2 rounded-full border-0", {
|
|
28
|
+
variants: {
|
|
29
|
+
theme: {
|
|
30
|
+
info: "bg-info",
|
|
31
|
+
warn: "bg-warn",
|
|
32
|
+
muted: "bg-muted",
|
|
33
|
+
danger: "bg-danger",
|
|
34
|
+
neutral: "bg-muted",
|
|
35
|
+
primary: "bg-primary",
|
|
36
|
+
success: "bg-success",
|
|
37
|
+
secondary: "bg-secondary",
|
|
38
|
+
},
|
|
39
|
+
},
|
|
40
|
+
});
|
|
41
|
+
const tagVariants = cva("inline-flex items-center justify-center gap-1.5 whitespace-nowrap rounded-pill border-0 align-middle transition-all duration-300 ease-linear", {
|
|
42
|
+
variants,
|
|
43
|
+
defaultVariants: { theme: "primary", size: "default" },
|
|
44
|
+
});
|
|
45
|
+
export const Tag = forwardRef(function Tag({ className, indicator = undefined, icon, loading, theme, size, ...props }, ref) {
|
|
46
|
+
return (<Polymorph {...props} ref={ref} data-theme={theme} data-component="tag" as={props.as ?? "span"} className={css(tagVariants({ size, theme: loading ? "loading" : theme }), className)}>
|
|
47
|
+
{indicator ? <span aria-hidden="true" className={indicatorVariant({ theme: indicator === true ? theme : indicator })}/> : null}
|
|
48
|
+
{icon}
|
|
49
|
+
{props.children}
|
|
50
|
+
</Polymorph>);
|
|
51
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { css } from "../../lib/dom";
|
|
3
|
+
export const Paragraph = (props) => <p {...props} className={css("text-base leading-snug", props.className)}/>;
|
|
4
|
+
export const Description = (props) => <p {...props} className={css("mb-kilo text-sm text-secondary", props.className)}/>;
|
|
5
|
+
export const Info = (props) => (<div className={css(`flex ${props.row ? "flex-row items-center" : "flex-col"} gap-1`, props.className)}>
|
|
6
|
+
<span className="text-sm font-medium tracking-wide">{props.row ? `${props.label}:` : props.label}</span>
|
|
7
|
+
<span className={css(props.disabled ? "text-disabled" : "", props.row ? "w-fit text-base" : "w-full text-lg")}>{props.children}</span>
|
|
8
|
+
</div>);
|
|
9
|
+
export const PageTitle = (props) => (<div>
|
|
10
|
+
<h2 className="typography text-3xl font-bold tracking-wide">{props.title}</h2>
|
|
11
|
+
<p className="typography text-secondary">{props.children}</p>
|
|
12
|
+
</div>);
|
|
13
|
+
export const PageHeader = (props) => {
|
|
14
|
+
return (<header {...props.containerProps} className={css("gap-mega flex min-w-full flex-row flex-wrap items-center justify-between", props.containerProps?.className)}>
|
|
15
|
+
<PageTitle title={props.title}>{props.description}</PageTitle>
|
|
16
|
+
<div className="gap-kilo flex flex-wrap items-center">{props.children}</div>
|
|
17
|
+
</header>);
|
|
18
|
+
};
|
|
@@ -23,6 +23,6 @@ export type AlertProps<T extends React.ElementType = "div"> = PolymorphicProps<C
|
|
|
23
23
|
Icon: React.ReactElement;
|
|
24
24
|
onClose: (nextState: boolean) => void;
|
|
25
25
|
}>, T>;
|
|
26
|
-
export declare const Alert: <T extends React.ElementType = "div">(props: AlertProps<T>) =>
|
|
26
|
+
export declare const Alert: <T extends React.ElementType = "div">(props: AlertProps<T>) => React.ReactNode;
|
|
27
27
|
export {};
|
|
28
28
|
//# sourceMappingURL=alert.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/components/display/alert.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAmB,eAAe,
|
|
1
|
+
{"version":3,"file":"alert.d.ts","sourceRoot":"","sources":["../../../src/components/display/alert.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAmB,eAAe,EAA0C,MAAM,cAAc,CAAC;AAExG,OAAO,KAAK,EAAE,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG7D,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAa,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAahE,KAAK,aAAa,GAAG,eAAe,CAAC,SAAS,CAAC,GAAG;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEpE,eAAO,MAAM,QAAQ,GAAI,OAAO,iBAAiB,CAAC,aAAa,CAAC,sBAiB/D,CAAC;AAEF,QAAA,MAAM,aAAa;;;;;;;;;;CAUlB,CAAC;AAOF,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,IAAI,gBAAgB,CAC1E,WAAW,CAAC,OAAO,aAAa,CAAC,GAC7B,OAAO,CAAC;IACJ,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,KAAK,CAAC,YAAY,CAAC;IACzB,OAAO,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CACzC,CAAC,EACN,CAAC,CACJ,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,EAAE,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAoD9E,CAAC"}
|