@g4rcez/components 4.1.1 → 4.1.3
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/dist/components/core/button.d.ts +77 -0
- package/dist/components/core/button.d.ts.map +1 -0
- package/dist/components/core/button.jsx +79 -0
- package/dist/components/core/heading.d.ts +3 -0
- package/dist/components/core/heading.d.ts.map +1 -0
- package/dist/components/core/heading.jsx +4 -0
- package/dist/components/core/polymorph.d.ts +10 -0
- package/dist/components/core/polymorph.d.ts.map +1 -0
- package/dist/components/core/polymorph.jsx +5 -0
- package/dist/components/core/render-on-view.d.ts +7 -0
- package/dist/components/core/render-on-view.d.ts.map +1 -0
- package/dist/components/core/render-on-view.jsx +31 -0
- package/dist/components/core/resizable.d.ts +3 -0
- package/dist/components/core/resizable.d.ts.map +1 -0
- package/dist/components/core/resizable.jsx +51 -0
- package/dist/components/core/slot.d.ts +16 -0
- package/dist/components/core/slot.d.ts.map +1 -0
- package/dist/components/core/slot.jsx +156 -0
- package/dist/components/core/tag.d.ts +35 -0
- package/dist/components/core/tag.d.ts.map +1 -0
- package/dist/components/core/tag.jsx +51 -0
- package/dist/components/core/typography.d.ts +25 -0
- package/dist/components/core/typography.d.ts.map +1 -0
- package/dist/components/core/typography.jsx +18 -0
- package/dist/components/display/alert.d.ts +28 -0
- package/dist/components/display/alert.d.ts.map +1 -0
- package/dist/components/display/alert.jsx +61 -0
- package/dist/components/display/calendar.d.ts +42 -0
- package/dist/components/display/calendar.d.ts.map +1 -0
- package/dist/components/display/calendar.jsx +299 -0
- package/dist/components/display/card.d.ts +29 -0
- package/dist/components/display/card.d.ts.map +1 -0
- package/dist/components/display/card.jsx +43 -0
- package/dist/components/display/empty.d.ts +8 -0
- package/dist/components/display/empty.d.ts.map +1 -0
- package/dist/components/display/empty.jsx +11 -0
- package/dist/components/display/list.d.ts +16 -0
- package/dist/components/display/list.d.ts.map +1 -0
- package/dist/components/display/list.jsx +81 -0
- package/dist/components/display/notifications.d.ts +27 -0
- package/dist/components/display/notifications.d.ts.map +1 -0
- package/dist/components/display/notifications.jsx +126 -0
- package/dist/components/display/progress.d.ts +13 -0
- package/dist/components/display/progress.d.ts.map +1 -0
- package/dist/components/display/progress.jsx +11 -0
- package/dist/components/display/shortcut.d.ts +4 -0
- package/dist/components/display/shortcut.d.ts.map +1 -0
- package/dist/components/display/shortcut.jsx +23 -0
- package/dist/components/display/skeleton.d.ts +12 -0
- package/dist/components/display/skeleton.d.ts.map +1 -0
- package/dist/components/display/skeleton.jsx +19 -0
- package/dist/components/display/spinner.d.ts +5 -0
- package/dist/components/display/spinner.d.ts.map +1 -0
- package/dist/components/display/spinner.jsx +11 -0
- package/dist/components/display/stats.d.ts +12 -0
- package/dist/components/display/stats.d.ts.map +1 -0
- package/dist/components/display/stats.jsx +20 -0
- package/dist/components/display/step.d.ts +24 -0
- package/dist/components/display/step.d.ts.map +1 -0
- package/dist/components/display/step.jsx +131 -0
- package/dist/components/display/tabs.d.ts +24 -0
- package/dist/components/display/tabs.d.ts.map +1 -0
- package/dist/components/display/tabs.jsx +125 -0
- package/dist/components/display/timeline.d.ts +10 -0
- package/dist/components/display/timeline.d.ts.map +1 -0
- package/dist/components/display/timeline.jsx +25 -0
- package/dist/components/floating/command-palette.d.ts +49 -0
- package/dist/components/floating/command-palette.d.ts.map +1 -0
- package/dist/components/floating/command-palette.jsx +197 -0
- package/dist/components/floating/dropdown.d.ts +15 -0
- package/dist/components/floating/dropdown.d.ts.map +1 -0
- package/dist/components/floating/dropdown.jsx +56 -0
- package/dist/components/floating/expand.d.ts +11 -0
- package/dist/components/floating/expand.d.ts.map +1 -0
- package/dist/components/floating/expand.jsx +44 -0
- package/dist/components/floating/menu.d.ts +52 -0
- package/dist/components/floating/menu.d.ts.map +1 -0
- package/dist/components/floating/menu.jsx +147 -0
- package/dist/components/floating/modal.d.ts +60 -0
- package/dist/components/floating/modal.d.ts.map +1 -0
- package/dist/components/floating/modal.jsx +301 -0
- package/dist/components/floating/toolbar.d.ts +6 -0
- package/dist/components/floating/toolbar.d.ts.map +1 -0
- package/dist/components/floating/toolbar.jsx +5 -0
- package/dist/components/floating/tooltip.d.ts +17 -0
- package/dist/components/floating/tooltip.d.ts.map +1 -0
- package/dist/components/floating/tooltip.jsx +58 -0
- package/dist/components/floating/wizard.d.ts +26 -0
- package/dist/components/floating/wizard.d.ts.map +1 -0
- package/dist/components/floating/wizard.jsx +161 -0
- package/dist/components/form/autocomplete.d.ts +16 -0
- package/dist/components/form/autocomplete.d.ts.map +1 -0
- package/dist/components/form/autocomplete.jsx +278 -0
- package/dist/components/form/checkbox.d.ts +12 -0
- package/dist/components/form/checkbox.d.ts.map +1 -0
- package/dist/components/form/checkbox.jsx +12 -0
- package/dist/components/form/date-picker.d.ts +10 -0
- package/dist/components/form/date-picker.d.ts.map +1 -0
- package/dist/components/form/date-picker.jsx +115 -0
- package/dist/components/form/file-upload.d.ts +15 -0
- package/dist/components/form/file-upload.d.ts.map +1 -0
- package/dist/components/form/file-upload.jsx +134 -0
- package/dist/components/form/form.d.ts +3 -0
- package/dist/components/form/form.d.ts.map +1 -0
- package/dist/components/form/form.jsx +10 -0
- package/dist/components/form/formReset.d.ts +2 -0
- package/dist/components/form/formReset.d.ts.map +1 -0
- package/dist/components/form/formReset.jsx +17 -0
- package/dist/components/form/free-text.d.ts +11 -0
- package/dist/components/form/free-text.d.ts.map +1 -0
- package/dist/components/form/free-text.jsx +41 -0
- package/dist/components/form/input-field.d.ts +34 -0
- package/dist/components/form/input-field.d.ts.map +1 -0
- package/dist/components/form/input-field.jsx +58 -0
- package/dist/components/form/input.d.ts +52 -0
- package/dist/components/form/input.d.ts.map +1 -0
- package/dist/components/form/input.jsx +36 -0
- package/dist/components/form/multi-select.d.ts +19 -0
- package/dist/components/form/multi-select.d.ts.map +1 -0
- package/dist/components/form/multi-select.jsx +336 -0
- package/dist/components/form/radiobox.d.ts +7 -0
- package/dist/components/form/radiobox.d.ts.map +1 -0
- package/dist/components/form/radiobox.jsx +6 -0
- package/dist/components/form/select.d.ts +13 -0
- package/dist/components/form/select.d.ts.map +1 -0
- package/dist/components/form/select.jsx +42 -0
- package/dist/components/form/slider.d.ts +7 -0
- package/dist/components/form/slider.d.ts.map +1 -0
- package/dist/components/form/slider.jsx +45 -0
- package/dist/components/form/switch.d.ts +9 -0
- package/dist/components/form/switch.d.ts.map +1 -0
- package/dist/components/form/switch.jsx +46 -0
- package/dist/components/form/task-list.d.ts +3 -0
- package/dist/components/form/task-list.d.ts.map +1 -0
- package/dist/components/form/task-list.jsx +26 -0
- package/dist/components/form/textarea.d.ts +6 -0
- package/dist/components/form/textarea.d.ts.map +1 -0
- package/dist/components/form/textarea.jsx +12 -0
- package/dist/components/index.d.ts +45 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +44 -0
- package/dist/components/page-calendar/calendar-header.d.ts +16 -0
- package/dist/components/page-calendar/calendar-header.d.ts.map +1 -0
- package/dist/components/page-calendar/calendar-header.jsx +83 -0
- package/dist/components/page-calendar/day-view.d.ts +12 -0
- package/dist/components/page-calendar/day-view.d.ts.map +1 -0
- package/dist/components/page-calendar/day-view.jsx +94 -0
- package/dist/components/page-calendar/event-pill.d.ts +9 -0
- package/dist/components/page-calendar/event-pill.d.ts.map +1 -0
- package/dist/components/page-calendar/event-pill.jsx +25 -0
- package/dist/components/page-calendar/index.d.ts +4 -0
- package/dist/components/page-calendar/index.d.ts.map +1 -0
- package/dist/components/page-calendar/index.js +2 -0
- package/dist/components/page-calendar/month-view.d.ts +11 -0
- package/dist/components/page-calendar/month-view.d.ts.map +1 -0
- package/dist/components/page-calendar/month-view.jsx +46 -0
- package/dist/components/page-calendar/page-calendar.d.ts +18 -0
- package/dist/components/page-calendar/page-calendar.d.ts.map +1 -0
- package/dist/components/page-calendar/page-calendar.jsx +41 -0
- package/dist/components/page-calendar/page-calendar.types.d.ts +18 -0
- package/dist/components/page-calendar/page-calendar.types.d.ts.map +1 -0
- package/dist/components/page-calendar/page-calendar.types.js +1 -0
- package/dist/components/page-calendar/page-calendar.utils.d.ts +24 -0
- package/dist/components/page-calendar/page-calendar.utils.d.ts.map +1 -0
- package/dist/components/page-calendar/page-calendar.utils.js +93 -0
- package/dist/components/page-calendar/week-view.d.ts +11 -0
- package/dist/components/page-calendar/week-view.d.ts.map +1 -0
- package/dist/components/page-calendar/week-view.jsx +71 -0
- package/dist/components/table/filter.d.ts +42 -0
- package/dist/components/table/filter.d.ts.map +1 -0
- package/dist/components/table/filter.jsx +141 -0
- package/dist/components/table/group.d.ts +17 -0
- package/dist/components/table/group.d.ts.map +1 -0
- package/dist/components/table/group.jsx +68 -0
- package/dist/components/table/index.d.ts +19 -0
- package/dist/components/table/index.d.ts.map +1 -0
- package/dist/components/table/index.jsx +60 -0
- package/dist/components/table/inner-table.d.ts +29 -0
- package/dist/components/table/inner-table.d.ts.map +1 -0
- package/dist/components/table/inner-table.jsx +102 -0
- package/dist/components/table/metadata.d.ts +4 -0
- package/dist/components/table/metadata.d.ts.map +1 -0
- package/dist/components/table/metadata.jsx +36 -0
- package/dist/components/table/pagination.d.ts +5 -0
- package/dist/components/table/pagination.d.ts.map +1 -0
- package/dist/components/table/pagination.jsx +74 -0
- package/dist/components/table/row.d.ts +11 -0
- package/dist/components/table/row.d.ts.map +1 -0
- package/dist/components/table/row.jsx +49 -0
- package/dist/components/table/sort.d.ts +28 -0
- package/dist/components/table/sort.d.ts.map +1 -0
- package/dist/components/table/sort.jsx +109 -0
- package/dist/components/table/table-lib.d.ts +135 -0
- package/dist/components/table/table-lib.d.ts.map +1 -0
- package/dist/components/table/table-lib.js +83 -0
- package/dist/components/table/table.context.d.ts +10 -0
- package/dist/components/table/table.context.d.ts.map +1 -0
- package/dist/components/table/table.context.jsx +4 -0
- package/dist/components/table/thead.d.ts +9 -0
- package/dist/components/table/thead.d.ts.map +1 -0
- package/dist/components/table/thead.jsx +103 -0
- package/dist/config/context.d.ts +21 -0
- package/dist/config/context.d.ts.map +1 -0
- package/dist/config/context.js +12 -0
- package/dist/config/default-translations.d.ts +94 -0
- package/dist/config/default-translations.d.ts.map +1 -0
- package/dist/config/default-translations.jsx +87 -0
- package/dist/config/default-tweaks.d.ts +13 -0
- package/dist/config/default-tweaks.d.ts.map +1 -0
- package/dist/config/default-tweaks.js +4 -0
- package/dist/constants.d.ts +3 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +2 -0
- package/dist/hooks/use-click-outside.d.ts +3 -0
- package/dist/hooks/use-click-outside.d.ts.map +1 -0
- package/dist/hooks/use-click-outside.js +17 -0
- package/dist/hooks/use-color-parser.d.ts +2 -0
- package/dist/hooks/use-color-parser.d.ts.map +1 -0
- package/dist/hooks/use-color-parser.js +9 -0
- package/dist/hooks/use-components-provider.d.ts +15 -0
- package/dist/hooks/use-components-provider.d.ts.map +1 -0
- package/dist/hooks/use-components-provider.jsx +22 -0
- package/dist/hooks/use-debounce.d.ts +5 -0
- package/dist/hooks/use-debounce.d.ts.map +1 -0
- package/dist/hooks/use-debounce.js +12 -0
- package/dist/hooks/use-floating-ref.d.ts +2 -0
- package/dist/hooks/use-floating-ref.d.ts.map +1 -0
- package/dist/hooks/use-floating-ref.js +6 -0
- package/dist/hooks/use-form.d.ts +394 -0
- package/dist/hooks/use-form.d.ts.map +1 -0
- package/dist/hooks/use-form.js +563 -0
- package/dist/hooks/use-hover.d.ts +3 -0
- package/dist/hooks/use-hover.d.ts.map +1 -0
- package/dist/hooks/use-hover.js +18 -0
- package/dist/hooks/use-input-id.d.ts +4 -0
- package/dist/hooks/use-input-id.d.ts.map +1 -0
- package/dist/hooks/use-input-id.js +5 -0
- package/dist/hooks/use-is-coarse-device.d.ts +2 -0
- package/dist/hooks/use-is-coarse-device.d.ts.map +1 -0
- package/dist/hooks/use-is-coarse-device.js +12 -0
- package/dist/hooks/use-locale.d.ts +3 -0
- package/dist/hooks/use-locale.d.ts.map +1 -0
- package/dist/hooks/use-locale.js +10 -0
- package/dist/hooks/use-media-query.d.ts +2 -0
- package/dist/hooks/use-media-query.d.ts.map +1 -0
- package/dist/hooks/use-media-query.js +25 -0
- package/dist/hooks/use-on-event.d.ts +4 -0
- package/dist/hooks/use-on-event.d.ts.map +1 -0
- package/dist/hooks/use-on-event.js +7 -0
- package/dist/hooks/use-parent.d.ts +3 -0
- package/dist/hooks/use-parent.d.ts.map +1 -0
- package/dist/hooks/use-parent.js +21 -0
- package/dist/hooks/use-preferences.d.ts +2 -0
- package/dist/hooks/use-preferences.d.ts.map +1 -0
- package/dist/hooks/use-preferences.js +23 -0
- package/dist/hooks/use-previous.d.ts +2 -0
- package/dist/hooks/use-previous.d.ts.map +1 -0
- package/dist/hooks/use-previous.js +9 -0
- package/dist/hooks/use-reactive.d.ts +2 -0
- package/dist/hooks/use-reactive.d.ts.map +1 -0
- package/dist/hooks/use-reactive.js +9 -0
- package/dist/hooks/use-remove-scroll.d.ts +4 -0
- package/dist/hooks/use-remove-scroll.d.ts.map +1 -0
- package/dist/hooks/use-remove-scroll.js +48 -0
- package/dist/hooks/use-resize-observer.d.ts +2 -0
- package/dist/hooks/use-resize-observer.d.ts.map +1 -0
- package/dist/hooks/use-resize-observer.js +17 -0
- package/dist/hooks/use-stable-ref.d.ts +2 -0
- package/dist/hooks/use-stable-ref.d.ts.map +1 -0
- package/dist/hooks/use-stable-ref.js +9 -0
- package/dist/hooks/use-swipe.d.ts +8 -0
- package/dist/hooks/use-swipe.d.ts.map +1 -0
- package/dist/hooks/use-swipe.js +17 -0
- package/dist/hooks/use-translations.d.ts +92 -0
- package/dist/hooks/use-translations.d.ts.map +1 -0
- package/dist/hooks/use-translations.js +9 -0
- package/dist/hooks/use-tweaks.d.ts +3 -0
- package/dist/hooks/use-tweaks.d.ts.map +1 -0
- package/dist/hooks/use-tweaks.js +9 -0
- package/dist/hooks/use-window-size.d.ts +5 -0
- package/dist/hooks/use-window-size.d.ts.map +1 -0
- package/dist/hooks/use-window-size.js +14 -0
- package/dist/index-DDeQW0JW.js.map +1 -1
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +20 -8231
- package/dist/index.js.map +1 -1
- package/dist/lib/combi-keys.d.ts +15 -0
- package/dist/lib/combi-keys.d.ts.map +1 -0
- package/dist/lib/combi-keys.js +60 -0
- package/dist/lib/dict.d.ts +9 -0
- package/dist/lib/dict.d.ts.map +1 -0
- package/dist/lib/dict.js +28 -0
- package/dist/lib/dom.d.ts +20 -0
- package/dist/lib/dom.d.ts.map +1 -0
- package/dist/lib/dom.js +66 -0
- package/dist/lib/fns.d.ts +11 -0
- package/dist/lib/fns.d.ts.map +1 -0
- package/dist/lib/fns.js +46 -0
- package/dist/lib/fzf.d.ts +16 -0
- package/dist/lib/fzf.d.ts.map +1 -0
- package/dist/lib/fzf.js +115 -0
- package/dist/lib/keyboard-area.d.ts +16 -0
- package/dist/lib/keyboard-area.d.ts.map +1 -0
- package/dist/lib/keyboard-area.js +14 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/types.d.ts +26 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { CvaVariants, type Label } from "../../types";
|
|
3
|
+
import { PolymorphicProps } from "./polymorph";
|
|
4
|
+
declare const variants: {
|
|
5
|
+
size: {
|
|
6
|
+
icon: string;
|
|
7
|
+
big: string;
|
|
8
|
+
default: string;
|
|
9
|
+
min: string;
|
|
10
|
+
small: string;
|
|
11
|
+
tiny: string;
|
|
12
|
+
};
|
|
13
|
+
rounded: {
|
|
14
|
+
rough: string;
|
|
15
|
+
squared: string;
|
|
16
|
+
default: string;
|
|
17
|
+
circle: string;
|
|
18
|
+
};
|
|
19
|
+
theme: {
|
|
20
|
+
raw: string;
|
|
21
|
+
disabled: string;
|
|
22
|
+
loading: string;
|
|
23
|
+
main: string;
|
|
24
|
+
info: string;
|
|
25
|
+
warn: string;
|
|
26
|
+
muted: string;
|
|
27
|
+
danger: string;
|
|
28
|
+
neutral: string;
|
|
29
|
+
primary: string;
|
|
30
|
+
success: string;
|
|
31
|
+
secondary: string;
|
|
32
|
+
"ghost-info": string;
|
|
33
|
+
"ghost-warn": string;
|
|
34
|
+
"ghost-danger": string;
|
|
35
|
+
"ghost-primary": string;
|
|
36
|
+
"ghost-success": string;
|
|
37
|
+
"ghost-secondary": string;
|
|
38
|
+
"ghost-muted": string;
|
|
39
|
+
"ghost-neutral": string;
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
type Variants = CvaVariants<typeof variants>;
|
|
43
|
+
export type ButtonProps<T extends React.ElementType = "button"> = PropsWithChildren<PolymorphicProps<Variants & Partial<{
|
|
44
|
+
/** Icon to display in the button */
|
|
45
|
+
icon: Label;
|
|
46
|
+
/** Whether the button is in a loading state */
|
|
47
|
+
loading: boolean;
|
|
48
|
+
}>, T>>;
|
|
49
|
+
/**
|
|
50
|
+
* A versatile button component with multiple variants, sizes, and states.
|
|
51
|
+
*
|
|
52
|
+
* @example
|
|
53
|
+
* ```tsx
|
|
54
|
+
* // Basic usage
|
|
55
|
+
* <Button>Click me</Button>
|
|
56
|
+
*
|
|
57
|
+
* // With variants
|
|
58
|
+
* <Button theme="primary" size="big">Primary Button</Button>
|
|
59
|
+
*
|
|
60
|
+
* // Loading state
|
|
61
|
+
* <Button loading>Saving...</Button>
|
|
62
|
+
*
|
|
63
|
+
* // With icon
|
|
64
|
+
* <Button icon={<Icon name="plus" />}>Add Item</Button>
|
|
65
|
+
*
|
|
66
|
+
* // As different element
|
|
67
|
+
* <Button as="a" href="/link">Link Button</Button>
|
|
68
|
+
* ```
|
|
69
|
+
*
|
|
70
|
+
* @template T - The HTML element type to render as
|
|
71
|
+
* @param props - Button props including theme, size, loading state, etc.
|
|
72
|
+
* @param ref - Forwarded ref to the button element
|
|
73
|
+
* @returns A styled button component
|
|
74
|
+
*/
|
|
75
|
+
export declare const Button: <T extends React.ElementType = "button">(_: ButtonProps<T>) => React.ReactNode;
|
|
76
|
+
export {};
|
|
77
|
+
//# sourceMappingURL=button.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/core/button.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAc,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAE7D,OAAO,EAAE,WAAW,EAAE,KAAK,KAAK,EAAE,MAAM,aAAa,CAAC;AACtD,OAAO,EAAa,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE1D,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAsCb,CAAC;AAUF,KAAK,QAAQ,GAAG,WAAW,CAAC,OAAO,QAAQ,CAAC,CAAC;AAE7C,MAAM,MAAM,WAAW,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,IAAI,iBAAiB,CAC/E,gBAAgB,CACZ,QAAQ,GACJ,OAAO,CAAC;IACJ,oCAAoC;IACpC,IAAI,EAAE,KAAK,CAAC;IACZ,+CAA+C;IAC/C,OAAO,EAAE,OAAO,CAAC;CACpB,CAAC,EACN,CAAC,CACJ,CACJ,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,eAAO,MAAM,MAAM,EAAE,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,QAAQ,EAAE,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,KAAK,CAAC,SAwBK,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
|
+
});
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"heading.d.ts","sourceRoot":"","sources":["../../../src/components/core/heading.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAG1C,eAAO,MAAM,OAAO,GAAI,OAAO,iBAAiB,gCAE/C,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
type PropsOf<T extends React.ElementType> = React.ComponentPropsWithoutRef<T>;
|
|
3
|
+
export type PolymorphicProps<Props, T extends React.ElementType> = Props & {
|
|
4
|
+
as?: T;
|
|
5
|
+
} & Omit<PropsOf<T>, keyof Props | "as" | "ref"> & {
|
|
6
|
+
ref?: React.ComponentProps<T>["ref"];
|
|
7
|
+
};
|
|
8
|
+
export declare const Polymorph: React.ForwardRefExoticComponent<Omit<any, "ref"> & React.RefAttributes<React.ElementType<any, keyof React.JSX.IntrinsicElements>>>;
|
|
9
|
+
export {};
|
|
10
|
+
//# sourceMappingURL=polymorph.d.ts.map
|
|
@@ -0,0 +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,oIAGpB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from "react";
|
|
2
|
+
import { PolymorphicProps } from "./polymorph";
|
|
3
|
+
export type RenderOnViewProps<T extends React.ElementType = "div"> = PolymorphicProps<{
|
|
4
|
+
onIntersection?: () => void;
|
|
5
|
+
}, T>;
|
|
6
|
+
export declare const RenderOnView: ({ children, ...props }: PropsWithChildren<RenderOnViewProps>) => React.JSX.Element;
|
|
7
|
+
//# sourceMappingURL=render-on-view.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"render-on-view.d.ts","sourceRoot":"","sources":["../../../src/components/core/render-on-view.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,EAAE,iBAAiB,EAAqC,MAAM,OAAO,CAAC;AAEpF,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,MAAM,MAAM,iBAAiB,CAAC,CAAC,SAAS,KAAK,CAAC,WAAW,GAAG,KAAK,IAAI,gBAAgB,CACjF;IACI,cAAc,CAAC,EAAE,MAAM,IAAI,CAAC;CAC/B,EACD,CAAC,CACJ,CAAC;AAYF,eAAO,MAAM,YAAY,GAAI,wBAAwB,iBAAiB,CAAC,iBAAiB,CAAC,sBAsBxF,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 @@
|
|
|
1
|
+
{"version":3,"file":"resizable.d.ts","sourceRoot":"","sources":["../../../src/components/core/resizable.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAuC,MAAM,OAAO,CAAC;AAkD5D,eAAO,MAAM,SAAS,GAAI,cAAc,KAAK,CAAC,iBAAiB,sBAQ9D,CAAC"}
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export type Usable<T> = PromiseLike<T> | React.Context<T>;
|
|
3
|
+
interface SlotProps extends React.HTMLAttributes<HTMLElement> {
|
|
4
|
+
children?: React.ReactNode;
|
|
5
|
+
}
|
|
6
|
+
export declare function createSlot(ownerName: string): React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<HTMLElement>>;
|
|
7
|
+
export declare const Slot: React.ForwardRefExoticComponent<SlotProps & React.RefAttributes<HTMLElement>>;
|
|
8
|
+
interface SlottableProps {
|
|
9
|
+
children: React.ReactNode;
|
|
10
|
+
}
|
|
11
|
+
interface SlottableComponent extends React.FC<SlottableProps> {
|
|
12
|
+
__radixId: symbol;
|
|
13
|
+
}
|
|
14
|
+
export declare function createSlottable(ownerName: string): SlottableComponent;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=slot.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { CvaVariants, Label } from "../../types";
|
|
3
|
+
import { PolymorphicProps } from "./polymorph";
|
|
4
|
+
declare const variants: {
|
|
5
|
+
size: {
|
|
6
|
+
icon: string;
|
|
7
|
+
big: string;
|
|
8
|
+
default: string;
|
|
9
|
+
tiny: string;
|
|
10
|
+
small: string;
|
|
11
|
+
};
|
|
12
|
+
theme: {
|
|
13
|
+
custom: string;
|
|
14
|
+
info: string;
|
|
15
|
+
warn: string;
|
|
16
|
+
muted: string;
|
|
17
|
+
danger: string;
|
|
18
|
+
disabled: string;
|
|
19
|
+
primary: string;
|
|
20
|
+
success: string;
|
|
21
|
+
neutral: string;
|
|
22
|
+
secondary: string;
|
|
23
|
+
loading: string;
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
type Variants = CvaVariants<typeof variants>;
|
|
27
|
+
type Themes = NonNullable<Variants["theme"]>;
|
|
28
|
+
export type TagProps<T extends React.ElementType = "span"> = PolymorphicProps<CvaVariants<typeof variants> & Partial<{
|
|
29
|
+
icon: Label;
|
|
30
|
+
loading: boolean;
|
|
31
|
+
indicator: Themes | true;
|
|
32
|
+
}>, T>;
|
|
33
|
+
export declare const Tag: <T extends React.ElementType = "span">(_: TagProps<T>) => React.ReactNode;
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=tag.d.ts.map
|
|
@@ -0,0 +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,KAAK,CAAC,SAiBQ,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,25 @@
|
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
import React, { type ComponentProps } from "react";
|
|
3
|
+
import { Label } from "../../types";
|
|
4
|
+
export declare const Paragraph: (props: ComponentProps<"p">) => React.JSX.Element;
|
|
5
|
+
export declare const Description: (props: ComponentProps<"p">) => React.JSX.Element;
|
|
6
|
+
export type InfoProps = {
|
|
7
|
+
info?: Label;
|
|
8
|
+
label: Label;
|
|
9
|
+
row?: boolean;
|
|
10
|
+
disabled?: Label;
|
|
11
|
+
className?: string;
|
|
12
|
+
infoDescription?: string;
|
|
13
|
+
};
|
|
14
|
+
export declare const Info: (props: React.PropsWithChildren<InfoProps>) => React.JSX.Element;
|
|
15
|
+
export declare const PageTitle: (props: PropsWithChildren<{
|
|
16
|
+
title: string;
|
|
17
|
+
}>) => React.JSX.Element;
|
|
18
|
+
type PageHeaderProps = {
|
|
19
|
+
title: string;
|
|
20
|
+
description: Label;
|
|
21
|
+
containerProps?: React.ComponentProps<"header">;
|
|
22
|
+
};
|
|
23
|
+
export declare const PageHeader: (props: PropsWithChildren<PageHeaderProps>) => React.JSX.Element;
|
|
24
|
+
export {};
|
|
25
|
+
//# sourceMappingURL=typography.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"typography.d.ts","sourceRoot":"","sources":["../../../src/components/core/typography.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,OAAO,CAAC;AAC/C,OAAO,KAAK,EAAE,EAAE,KAAK,cAAc,EAAE,MAAM,OAAO,CAAC;AAEnD,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAEpC,eAAO,MAAM,SAAS,GAAI,OAAO,cAAc,CAAC,GAAG,CAAC,sBAAgF,CAAC;AAErI,eAAO,MAAM,WAAW,GAAI,OAAO,cAAc,CAAC,GAAG,CAAC,sBAAwF,CAAC;AAE/I,MAAM,MAAM,SAAS,GAAG;IACpB,IAAI,CAAC,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,KAAK,CAAC;IACb,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,eAAO,MAAM,IAAI,GAAI,OAAO,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,sBAK7D,CAAC;AAEF,eAAO,MAAM,SAAS,GAAI,OAAO,iBAAiB,CAAC;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC,sBAKpE,CAAC;AAEF,KAAK,eAAe,GAAG;IACnB,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,KAAK,CAAC;IACnB,cAAc,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;CACnD,CAAC;AAEF,eAAO,MAAM,UAAU,GAAI,OAAO,iBAAiB,CAAC,eAAe,CAAC,sBAUnE,CAAC"}
|
|
@@ -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
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { HTMLMotionProps } from "motion/react";
|
|
2
|
+
import React, { PropsWithChildren } from "react";
|
|
3
|
+
import { CvaVariants } from "../../types";
|
|
4
|
+
import { PolymorphicProps } from "../core/polymorph";
|
|
5
|
+
type CollapseProps = HTMLMotionProps<"section"> & {
|
|
6
|
+
open: boolean;
|
|
7
|
+
};
|
|
8
|
+
export declare const Collapse: (props: PropsWithChildren<CollapseProps>) => React.JSX.Element;
|
|
9
|
+
declare const themeVariants: {
|
|
10
|
+
theme: {
|
|
11
|
+
primary: string;
|
|
12
|
+
danger: string;
|
|
13
|
+
info: string;
|
|
14
|
+
success: string;
|
|
15
|
+
secondary: string;
|
|
16
|
+
warn: string;
|
|
17
|
+
neutral: string;
|
|
18
|
+
};
|
|
19
|
+
};
|
|
20
|
+
export type AlertProps<T extends React.ElementType = "div"> = PolymorphicProps<CvaVariants<typeof themeVariants> & Partial<{
|
|
21
|
+
open?: boolean;
|
|
22
|
+
container: string;
|
|
23
|
+
Icon: React.ReactElement;
|
|
24
|
+
onClose: (nextState: boolean) => void;
|
|
25
|
+
}>, T>;
|
|
26
|
+
export declare const Alert: <T extends React.ElementType = "div">(props: AlertProps<T>) => React.ReactNode;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=alert.d.ts.map
|