@a-type/ui 1.0.11 → 1.0.13
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/cjs/components/button/classes.js +5 -5
- package/dist/cjs/components/button/classes.js.map +1 -1
- package/dist/cjs/components/card/Card.d.ts +34 -0
- package/dist/cjs/components/card/Card.js +11 -1
- package/dist/cjs/components/card/Card.js.map +1 -1
- package/dist/cjs/components/checkbox/Checkbox.d.ts +6 -1
- package/dist/cjs/components/checkbox/Checkbox.js +4 -1
- package/dist/cjs/components/checkbox/Checkbox.js.map +1 -1
- package/dist/cjs/components/collapsible/Collapsible.d.ts +11 -0
- package/dist/cjs/components/collapsible/Collapsible.js +6 -1
- package/dist/cjs/components/collapsible/Collapsible.js.map +1 -1
- package/dist/cjs/components/contextMenu/contextMenu.d.ts +18 -6
- package/dist/cjs/components/contextMenu/contextMenu.js +13 -7
- package/dist/cjs/components/contextMenu/contextMenu.js.map +1 -1
- package/dist/cjs/components/dialog/Dialog.d.ts +27 -1
- package/dist/cjs/components/dialog/Dialog.js +19 -5
- package/dist/cjs/components/dialog/Dialog.js.map +1 -1
- package/dist/cjs/components/dialog/Dialog.stories.d.ts +28 -1
- package/dist/cjs/components/dropdownMenu/DropdownMenu.d.ts +32 -1
- package/dist/cjs/components/dropdownMenu/DropdownMenu.js +15 -2
- package/dist/cjs/components/dropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/cjs/components/dropdownMenu/DropdownMenu.stories.d.ts +31 -1
- package/dist/cjs/components/dropdownMenu/DropdownMenu.stories.js +1 -2
- package/dist/cjs/components/dropdownMenu/DropdownMenu.stories.js.map +1 -1
- package/dist/cjs/components/input/Input.js +1 -1
- package/dist/cjs/components/input/Input.js.map +1 -1
- package/dist/cjs/components/navBar/NavBar.d.ts +15 -0
- package/dist/cjs/components/navBar/NavBar.js +8 -1
- package/dist/cjs/components/navBar/NavBar.js.map +1 -1
- package/dist/cjs/components/popover/Popover.d.ts +18 -1
- package/dist/cjs/components/popover/Popover.js +9 -2
- package/dist/cjs/components/popover/Popover.js.map +1 -1
- package/dist/cjs/components/scrollArea/ScrollArea.d.ts +7 -1
- package/dist/cjs/components/scrollArea/ScrollArea.js +5 -1
- package/dist/cjs/components/scrollArea/ScrollArea.js.map +1 -1
- package/dist/cjs/components/select/Select.d.ts +23 -4
- package/dist/cjs/components/select/Select.js +12 -2
- package/dist/cjs/components/select/Select.js.map +1 -1
- package/dist/cjs/components/select/Select.stories.d.ts +24 -1
- package/dist/cjs/components/slider/Slider.d.ts +15 -3
- package/dist/cjs/components/slider/Slider.js +9 -4
- package/dist/cjs/components/slider/Slider.js.map +1 -1
- package/dist/cjs/components/slider/Slider.stories.d.ts +15 -1
- package/dist/cjs/components/switch/Switch.d.ts +8 -1
- package/dist/cjs/components/switch/Switch.js +4 -1
- package/dist/cjs/components/switch/Switch.js.map +1 -1
- package/dist/cjs/components/tabs/tabs.d.ts +18 -5
- package/dist/cjs/components/tabs/tabs.js +11 -6
- package/dist/cjs/components/tabs/tabs.js.map +1 -1
- package/dist/cjs/components/textArea/TextArea.js +1 -1
- package/dist/cjs/components/textArea/TextArea.js.map +1 -1
- package/dist/cjs/components/toggleGroup/toggleGroup.d.ts +13 -4
- package/dist/cjs/components/toggleGroup/toggleGroup.js +7 -4
- package/dist/cjs/components/toggleGroup/toggleGroup.js.map +1 -1
- package/dist/cjs/components/tooltip/Tooltip.d.ts +10 -3
- package/dist/cjs/components/tooltip/Tooltip.js +7 -4
- package/dist/cjs/components/tooltip/Tooltip.js.map +1 -1
- package/dist/cjs/components/tooltip/Tooltip.stories.d.ts +5 -1
- package/dist/cjs/themes.stories.d.ts +13 -0
- package/dist/cjs/themes.stories.js +31 -0
- package/dist/cjs/themes.stories.js.map +1 -0
- package/dist/cjs/uno.preset.js +11 -11
- package/dist/css/main.css +13 -13
- package/dist/esm/components/button/classes.js +5 -5
- package/dist/esm/components/button/classes.js.map +1 -1
- package/dist/esm/components/card/Card.d.ts +34 -0
- package/dist/esm/components/card/Card.js +10 -0
- package/dist/esm/components/card/Card.js.map +1 -1
- package/dist/esm/components/checkbox/Checkbox.d.ts +6 -1
- package/dist/esm/components/checkbox/Checkbox.js +4 -1
- package/dist/esm/components/checkbox/Checkbox.js.map +1 -1
- package/dist/esm/components/collapsible/Collapsible.d.ts +11 -0
- package/dist/esm/components/collapsible/Collapsible.js +5 -0
- package/dist/esm/components/collapsible/Collapsible.js.map +1 -1
- package/dist/esm/components/contextMenu/contextMenu.d.ts +18 -6
- package/dist/esm/components/contextMenu/contextMenu.js +12 -6
- package/dist/esm/components/contextMenu/contextMenu.js.map +1 -1
- package/dist/esm/components/dialog/Dialog.d.ts +27 -1
- package/dist/esm/components/dialog/Dialog.js +18 -3
- package/dist/esm/components/dialog/Dialog.js.map +1 -1
- package/dist/esm/components/dialog/Dialog.stories.d.ts +28 -1
- package/dist/esm/components/dropdownMenu/DropdownMenu.d.ts +32 -1
- package/dist/esm/components/dropdownMenu/DropdownMenu.js +14 -1
- package/dist/esm/components/dropdownMenu/DropdownMenu.js.map +1 -1
- package/dist/esm/components/dropdownMenu/DropdownMenu.stories.d.ts +31 -1
- package/dist/esm/components/dropdownMenu/DropdownMenu.stories.js +2 -3
- package/dist/esm/components/dropdownMenu/DropdownMenu.stories.js.map +1 -1
- package/dist/esm/components/input/Input.js +1 -1
- package/dist/esm/components/input/Input.js.map +1 -1
- package/dist/esm/components/navBar/NavBar.d.ts +15 -0
- package/dist/esm/components/navBar/NavBar.js +7 -0
- package/dist/esm/components/navBar/NavBar.js.map +1 -1
- package/dist/esm/components/popover/Popover.d.ts +18 -1
- package/dist/esm/components/popover/Popover.js +8 -1
- package/dist/esm/components/popover/Popover.js.map +1 -1
- package/dist/esm/components/scrollArea/ScrollArea.d.ts +7 -1
- package/dist/esm/components/scrollArea/ScrollArea.js +5 -1
- package/dist/esm/components/scrollArea/ScrollArea.js.map +1 -1
- package/dist/esm/components/select/Select.d.ts +23 -4
- package/dist/esm/components/select/Select.js +12 -1
- package/dist/esm/components/select/Select.js.map +1 -1
- package/dist/esm/components/select/Select.stories.d.ts +24 -1
- package/dist/esm/components/slider/Slider.d.ts +15 -3
- package/dist/esm/components/slider/Slider.js +9 -3
- package/dist/esm/components/slider/Slider.js.map +1 -1
- package/dist/esm/components/slider/Slider.stories.d.ts +15 -1
- package/dist/esm/components/switch/Switch.d.ts +8 -1
- package/dist/esm/components/switch/Switch.js +4 -1
- package/dist/esm/components/switch/Switch.js.map +1 -1
- package/dist/esm/components/tabs/tabs.d.ts +18 -5
- package/dist/esm/components/tabs/tabs.js +10 -5
- package/dist/esm/components/tabs/tabs.js.map +1 -1
- package/dist/esm/components/textArea/TextArea.js +1 -1
- package/dist/esm/components/textArea/TextArea.js.map +1 -1
- package/dist/esm/components/toggleGroup/toggleGroup.d.ts +13 -4
- package/dist/esm/components/toggleGroup/toggleGroup.js +6 -3
- package/dist/esm/components/toggleGroup/toggleGroup.js.map +1 -1
- package/dist/esm/components/tooltip/Tooltip.d.ts +10 -3
- package/dist/esm/components/tooltip/Tooltip.js +7 -3
- package/dist/esm/components/tooltip/Tooltip.js.map +1 -1
- package/dist/esm/components/tooltip/Tooltip.stories.d.ts +5 -1
- package/dist/esm/themes.stories.d.ts +13 -0
- package/dist/esm/themes.stories.js +25 -0
- package/dist/esm/themes.stories.js.map +1 -0
- package/dist/esm/uno.preset.js +11 -11
- package/package.json +1 -1
- package/src/components/button/classes.tsx +5 -5
- package/src/components/card/Card.tsx +11 -0
- package/src/components/checkbox/Checkbox.tsx +15 -10
- package/src/components/collapsible/Collapsible.tsx +6 -0
- package/src/components/contextMenu/contextMenu.tsx +22 -9
- package/src/components/dialog/Dialog.tsx +26 -3
- package/src/components/dropdownMenu/DropdownMenu.stories.tsx +14 -21
- package/src/components/dropdownMenu/DropdownMenu.tsx +15 -1
- package/src/components/input/Input.tsx +1 -1
- package/src/components/navBar/NavBar.tsx +8 -0
- package/src/components/popover/Popover.tsx +9 -1
- package/src/components/scrollArea/ScrollArea.tsx +21 -14
- package/src/components/select/Select.tsx +13 -1
- package/src/components/slider/Slider.tsx +23 -11
- package/src/components/switch/Switch.tsx +6 -2
- package/src/components/tabs/tabs.tsx +11 -5
- package/src/components/textArea/TextArea.tsx +1 -1
- package/src/components/toggleGroup/toggleGroup.tsx +7 -3
- package/src/components/tooltip/Tooltip.tsx +30 -22
- package/src/themes.stories.tsx +70 -0
- package/src/uno.preset.ts +11 -11
|
@@ -18,7 +18,7 @@ export function getButtonClassName({
|
|
|
18
18
|
'layer-components:focus:outline-off',
|
|
19
19
|
'layer-components:focus-visible:(outline-off ring-6 ring-[var(--focus,var(--hover))])',
|
|
20
20
|
'layer-components:active:(bg-[var(--active)] ring-8 ring-[var(--active)])',
|
|
21
|
-
'important:disabled:(opacity-50 cursor-default bg-[var(--bg)] shadow-none)',
|
|
21
|
+
'important:disabled:(opacity-50 cursor-default bg-[var(--bg)] shadow-none ring-none)',
|
|
22
22
|
'important:[&[data-disabled=true]]:(opacity-50 cursor-default bg-[var(--bg)] shadow-none)',
|
|
23
23
|
colors[color ?? 'default'],
|
|
24
24
|
`btn-color-${color ?? 'default'}`,
|
|
@@ -34,11 +34,11 @@ export function getButtonClassName({
|
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
const colors = {
|
|
37
|
-
primary: `layer-variants:[&.btn-color-primary]:([--bg:var(--color-primary-light)] [--hover:var(--color-primary)] [--focus:var(--color-primary)] [--active:var(--color-primary)] shadow-sm color-black border-
|
|
38
|
-
accent: `layer-variants:[&.btn-color-accent]:([--bg:var(--color-accent-wash)] [--hover:var(--color-accent-light)] [--focus:var(--color-accent-light)] [--active:var(--color-accent-light)] shadow-sm color-black border-
|
|
39
|
-
default: `layer-variants:[&.btn-color-default]:([--bg:var(--color-white)] [--hover:var(--color-gray-3)] [--focus:var(--color-white)] [--active:var(--color-gray-4)] shadow-sm color-black border-
|
|
37
|
+
primary: `layer-variants:[&.btn-color-primary]:([--bg:var(--color-primary-light)] [--hover:var(--color-primary)] [--focus:var(--color-primary)] [--active:var(--color-primary)] shadow-sm color-black border-primary-dark focus-visible:([--bg:var(--color-primary)]))`,
|
|
38
|
+
accent: `layer-variants:[&.btn-color-accent]:([--bg:var(--color-accent-wash)] [--hover:var(--color-accent-light)] [--focus:var(--color-accent-light)] [--active:var(--color-accent-light)] shadow-sm color-black border-accent-dark focus-visible:([--bg:var(--color-accent-light)]))`,
|
|
39
|
+
default: `layer-variants:[&.btn-color-default]:([--bg:var(--color-white)] [--hover:var(--color-gray-3)] [--focus:var(--color-white)] [--active:var(--color-gray-4)] shadow-sm color-black border-gray-7)`,
|
|
40
40
|
ghost: `layer-variants:[&.btn-color-ghost]:([--bg:transparent] [--hover:var(--color-gray-blend)] [--focus:var(--color-gray-5)] [--active:var(--color-gray-dark-blend)] color-dark-blend)`,
|
|
41
|
-
destructive: `layer-variants:[&.btn-color-destructive]:([--bg:var(--color-attention-light)] [--hover:var(--color-attention-light)] [--focus:var(--color-attention-light)] [--active:var(--color-attention-light)] shadow-sm border-
|
|
41
|
+
destructive: `layer-variants:[&.btn-color-destructive]:([--bg:var(--color-attention-light)] [--hover:var(--color-attention-light)] [--focus:var(--color-attention-light)] [--active:var(--color-attention-light)] shadow-sm border-attention-dark color-black hover:([--bg:var(--colors-attention)]))`,
|
|
42
42
|
ghostDestructive: `layer-variants:[&.btn-color-ghostDestructive]:([--bg:transparent] [--hover:rgb(from_var(--color-attention-light)_r_g_b/0.25)] [--focus:var(--color-attention-light)] [--active:var(--color-attention-light)] color-attention-dark)`,
|
|
43
43
|
ghostAccent: `layer-variants:[&.btn-color-ghostAccent]:([--bg:transparent] [--hover:rgb(from_var(--color-accent-light)_r_g_b/0.25)] [--focus:var(--color-accent-light)] [--active:var(--color-accent-light)] color-accent-dark)`,
|
|
44
44
|
contrast: `layer-variants:[&.btn-color-contrast]:([--bg:var(--color-black)] [--hover:var(--color-gray-7)] [--focus:var(--color-gray-7)] [--active:var(--color-gray-6)] color-white border-black)`,
|
|
@@ -79,3 +79,14 @@ export const CardGrid = withClassName(
|
|
|
79
79
|
'layer-components:(grid grid-cols-[1fr] [grid-auto-rows:auto] gap-4 p-0 m-0)',
|
|
80
80
|
'layer-components:md:(grid-cols-[repeat(2,1fr)] [grid-auto-rows:1fr] items-end)',
|
|
81
81
|
);
|
|
82
|
+
|
|
83
|
+
export const Card = Object.assign(CardRoot, {
|
|
84
|
+
Main: CardMain,
|
|
85
|
+
Title: CardTitle,
|
|
86
|
+
Content: CardContent,
|
|
87
|
+
Image: CardImage,
|
|
88
|
+
Footer: CardFooter,
|
|
89
|
+
Actions: CardActions,
|
|
90
|
+
Menu: CardMenu,
|
|
91
|
+
Grid: CardGrid,
|
|
92
|
+
});
|
|
@@ -35,13 +35,18 @@ export function CheckboxIndicator({
|
|
|
35
35
|
);
|
|
36
36
|
}
|
|
37
37
|
|
|
38
|
-
export const Checkbox =
|
|
39
|
-
HTMLButtonElement,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
38
|
+
export const Checkbox = Object.assign(
|
|
39
|
+
forwardRef<HTMLButtonElement, ComponentProps<typeof CheckboxRoot>>(
|
|
40
|
+
function Checkbox(props, ref) {
|
|
41
|
+
return (
|
|
42
|
+
<CheckboxRoot ref={ref} {...props}>
|
|
43
|
+
<CheckboxIndicator />
|
|
44
|
+
</CheckboxRoot>
|
|
45
|
+
);
|
|
46
|
+
},
|
|
47
|
+
),
|
|
48
|
+
{
|
|
49
|
+
Root: CheckboxRoot,
|
|
50
|
+
Indicator: CheckboxIndicator,
|
|
51
|
+
},
|
|
52
|
+
);
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as ContextMenuPrimitive from '@radix-ui/react-context-menu';
|
|
2
2
|
import { ComponentPropsWithoutRef, forwardRef } from 'react';
|
|
3
3
|
import { withClassName } from '../../hooks/withClassName.js';
|
|
4
4
|
import classNames from 'clsx';
|
|
5
5
|
|
|
6
|
-
export const ContextMenuRoot =
|
|
6
|
+
export const ContextMenuRoot = ContextMenuPrimitive.Root;
|
|
7
7
|
|
|
8
8
|
export const ContextMenuContent = forwardRef<
|
|
9
9
|
HTMLDivElement,
|
|
10
|
-
ComponentPropsWithoutRef<typeof
|
|
10
|
+
ComponentPropsWithoutRef<typeof ContextMenuPrimitive.Content>
|
|
11
11
|
>(function Content({ className, onClick, ...props }, ref) {
|
|
12
12
|
return (
|
|
13
|
-
<
|
|
14
|
-
<
|
|
13
|
+
<ContextMenuPrimitive.Portal>
|
|
14
|
+
<ContextMenuPrimitive.Content
|
|
15
15
|
className={classNames(
|
|
16
16
|
'layer-components:(min-w-120px bg-white rounded-md border-default overflow-hidden p-2 shadow-md z-menu)',
|
|
17
17
|
'layer-components:transform-origin-[var(--radix-context-menu-transform-origin)]',
|
|
@@ -28,16 +28,29 @@ export const ContextMenuContent = forwardRef<
|
|
|
28
28
|
ref={ref}
|
|
29
29
|
{...props}
|
|
30
30
|
/>
|
|
31
|
-
</
|
|
31
|
+
</ContextMenuPrimitive.Portal>
|
|
32
32
|
);
|
|
33
33
|
});
|
|
34
34
|
|
|
35
|
-
export const ContextMenuArrow = withClassName(
|
|
35
|
+
export const ContextMenuArrow = withClassName(
|
|
36
|
+
ContextMenuPrimitive.Arrow,
|
|
37
|
+
'fill-white',
|
|
38
|
+
);
|
|
36
39
|
|
|
37
40
|
export const ContextMenuItem = withClassName(
|
|
38
|
-
|
|
41
|
+
ContextMenuPrimitive.Item,
|
|
39
42
|
'flex items-center py-1 px-2 relative pl-25px select-none outline-none cursor-pointer',
|
|
40
43
|
'hover:bg-gray2 [&[data-highlighted=true]]:bg-gray2 [&[data-disabled=true]]:(opacity-50 cursor-default) disabled:(opacity-50 cursor-default)',
|
|
41
44
|
);
|
|
42
45
|
|
|
43
|
-
export const ContextMenuTrigger = withClassName(
|
|
46
|
+
export const ContextMenuTrigger = withClassName(
|
|
47
|
+
ContextMenuPrimitive.Trigger,
|
|
48
|
+
'',
|
|
49
|
+
);
|
|
50
|
+
|
|
51
|
+
export const ContextMenu = Object.assign(ContextMenuRoot, {
|
|
52
|
+
Content: ContextMenuContent,
|
|
53
|
+
Arrow: ContextMenuArrow,
|
|
54
|
+
Item: ContextMenuItem,
|
|
55
|
+
Trigger: ContextMenuTrigger,
|
|
56
|
+
});
|
|
@@ -18,6 +18,7 @@ import classNames from 'clsx';
|
|
|
18
18
|
import { CheckIcon, ChevronDownIcon } from '@radix-ui/react-icons';
|
|
19
19
|
import { selectTriggerClassName } from '../select.js';
|
|
20
20
|
import { useDrag } from '@use-gesture/react';
|
|
21
|
+
import { Button } from '../button.js';
|
|
21
22
|
|
|
22
23
|
const StyledOverlay = withClassName(
|
|
23
24
|
DialogPrimitive.Overlay,
|
|
@@ -28,7 +29,7 @@ const StyledOverlay = withClassName(
|
|
|
28
29
|
|
|
29
30
|
const StyledContent = withClassName(
|
|
30
31
|
DialogPrimitive.Content,
|
|
31
|
-
'layer-components:(z-dialog fixed shadow-xl-up bg-white overflow-y-auto flex flex-col)',
|
|
32
|
+
'layer-components:(z-dialog fixed shadow-xl-up bg-white overflow-y-auto flex flex-col border-top-1 border-top-solid border-top-gray-5)',
|
|
32
33
|
'layer-components:sm:(shadow-xl)',
|
|
33
34
|
'transform-gpu !motion-reduce:animate-none',
|
|
34
35
|
'layer-components:(left-50% top-50% translate-[-50%] w-90vw max-w-450px max-h-85vh p-6 pt-8 rounded-lg border-b-1 pt-6)',
|
|
@@ -193,7 +194,7 @@ const StyledDescription = withClassName(
|
|
|
193
194
|
);
|
|
194
195
|
|
|
195
196
|
// Exports
|
|
196
|
-
|
|
197
|
+
const DialogRoot = (props: DialogPrimitive.DialogProps) => {
|
|
197
198
|
const [innerOpen, innerOnOpenChange] = useState(props.defaultOpen);
|
|
198
199
|
const open = props.open ?? innerOpen;
|
|
199
200
|
const onOpenChange = useCallback(
|
|
@@ -218,11 +219,21 @@ export const Dialog = (props: DialogPrimitive.DialogProps) => {
|
|
|
218
219
|
</DialogCloseContext.Provider>
|
|
219
220
|
);
|
|
220
221
|
};
|
|
222
|
+
|
|
221
223
|
export const DialogTrigger = DialogPrimitive.Trigger;
|
|
222
224
|
export const DialogContent = Content;
|
|
223
225
|
export const DialogTitle = StyledTitle;
|
|
224
226
|
export const DialogDescription = StyledDescription;
|
|
225
|
-
export const DialogClose =
|
|
227
|
+
export const DialogClose = forwardRef<
|
|
228
|
+
HTMLButtonElement,
|
|
229
|
+
DialogPrimitive.DialogCloseProps
|
|
230
|
+
>(function DialogClose({ asChild = true, children, ...props }, ref) {
|
|
231
|
+
return (
|
|
232
|
+
<DialogPrimitive.DialogClose asChild ref={ref} {...props}>
|
|
233
|
+
{asChild ? children : <Button>{children ?? 'Close'}</Button>}
|
|
234
|
+
</DialogPrimitive.DialogClose>
|
|
235
|
+
);
|
|
236
|
+
});
|
|
226
237
|
|
|
227
238
|
export type { DialogProps } from '@radix-ui/react-dialog';
|
|
228
239
|
|
|
@@ -272,3 +283,15 @@ export const DialogSelectItem = forwardRef<
|
|
|
272
283
|
</DialogSelectItemRoot>
|
|
273
284
|
);
|
|
274
285
|
});
|
|
286
|
+
|
|
287
|
+
export const Dialog = Object.assign(DialogRoot, {
|
|
288
|
+
Trigger: DialogTrigger,
|
|
289
|
+
Content,
|
|
290
|
+
Title: StyledTitle,
|
|
291
|
+
Description: StyledDescription,
|
|
292
|
+
Close: DialogClose,
|
|
293
|
+
Actions: DialogActions,
|
|
294
|
+
SelectTrigger: DialogSelectTrigger,
|
|
295
|
+
SelectList: DialogSelectList,
|
|
296
|
+
SelectItem: DialogSelectItem,
|
|
297
|
+
});
|
|
@@ -1,13 +1,6 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
import {
|
|
3
|
-
DropdownMenu,
|
|
4
|
-
DropdownMenuContent,
|
|
5
|
-
DropdownMenuItem,
|
|
6
|
-
DropdownMenuItemRightSlot,
|
|
7
|
-
DropdownMenuTrigger,
|
|
8
|
-
} from './DropdownMenu.js';
|
|
2
|
+
import { DropdownMenu } from './DropdownMenu.js';
|
|
9
3
|
import { Icon } from '../icon.js';
|
|
10
|
-
import { DropdownMenuLabel } from '@radix-ui/react-dropdown-menu';
|
|
11
4
|
|
|
12
5
|
const meta = {
|
|
13
6
|
title: 'DropdownMenu',
|
|
@@ -26,21 +19,21 @@ export const Default: Story = {
|
|
|
26
19
|
args: {
|
|
27
20
|
children: (
|
|
28
21
|
<>
|
|
29
|
-
<
|
|
30
|
-
<
|
|
31
|
-
<
|
|
32
|
-
<
|
|
33
|
-
<
|
|
22
|
+
<DropdownMenu.Trigger>Open</DropdownMenu.Trigger>
|
|
23
|
+
<DropdownMenu.Content>
|
|
24
|
+
<DropdownMenu.Item color="destructive">
|
|
25
|
+
<DropdownMenu.Label>Item 1</DropdownMenu.Label>
|
|
26
|
+
<DropdownMenu.ItemRightSlot>
|
|
34
27
|
<Icon name="flag" />
|
|
35
|
-
</
|
|
36
|
-
</
|
|
37
|
-
<
|
|
38
|
-
<
|
|
39
|
-
<
|
|
28
|
+
</DropdownMenu.ItemRightSlot>
|
|
29
|
+
</DropdownMenu.Item>
|
|
30
|
+
<DropdownMenu.Item>
|
|
31
|
+
<DropdownMenu.Label>Item 2</DropdownMenu.Label>
|
|
32
|
+
<DropdownMenu.ItemRightSlot>
|
|
40
33
|
<Icon name="add_person" />
|
|
41
|
-
</
|
|
42
|
-
</
|
|
43
|
-
</
|
|
34
|
+
</DropdownMenu.ItemRightSlot>
|
|
35
|
+
</DropdownMenu.Item>
|
|
36
|
+
</DropdownMenu.Content>
|
|
44
37
|
</>
|
|
45
38
|
),
|
|
46
39
|
},
|
|
@@ -78,7 +78,7 @@ const StyledTrigger = withClassName(
|
|
|
78
78
|
const StyledPortal = DropdownMenuPrimitive.Portal;
|
|
79
79
|
|
|
80
80
|
// Exports
|
|
81
|
-
export const
|
|
81
|
+
export const DropdownMenuRoot = DropdownMenuPrimitive.Root;
|
|
82
82
|
export const DropdownMenuTrigger = StyledTrigger;
|
|
83
83
|
export const DropdownMenuItem = StyledItem;
|
|
84
84
|
export const DropdownMenuCheckboxItem = StyledCheckboxItem;
|
|
@@ -107,3 +107,17 @@ export const DropdownMenuContent = ({
|
|
|
107
107
|
};
|
|
108
108
|
|
|
109
109
|
export const DropdownMenuItemRightSlot = withClassName('div', 'ml-auto');
|
|
110
|
+
|
|
111
|
+
export const DropdownMenu = Object.assign(DropdownMenuRoot, {
|
|
112
|
+
Content: DropdownMenuContent,
|
|
113
|
+
Trigger: StyledTrigger,
|
|
114
|
+
Item: StyledItem,
|
|
115
|
+
CheckboxItem: StyledCheckboxItem,
|
|
116
|
+
RadioGroup: DropdownMenuPrimitive.RadioGroup,
|
|
117
|
+
RadioItem: StyledRadioItem,
|
|
118
|
+
ItemIndicator: StyledItemIndicator,
|
|
119
|
+
Label: StyledLabel,
|
|
120
|
+
Separator: StyledSeparator,
|
|
121
|
+
Arrow: StyledArrow,
|
|
122
|
+
ItemRightSlot: DropdownMenuItemRightSlot,
|
|
123
|
+
});
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
import { Slot } from '@radix-ui/react-slot';
|
|
10
10
|
|
|
11
11
|
export const inputClassName = classNames(
|
|
12
|
-
'layer-components:(px-5 py-[5px] text-md font-sans rounded-full bg-white select-auto min-w-60px color-black border-
|
|
12
|
+
'layer-components:(px-5 py-[5px] text-md font-sans rounded-full bg-white select-auto min-w-60px color-black border-solid border-1 border-gray-7 shadow-sm-inset)',
|
|
13
13
|
'layer-components:focus:(outline-none bg-gray-1 ring-4 ring-white)',
|
|
14
14
|
'layer-components:focus-visible:(outline-none ring-gray-dark-blend)',
|
|
15
15
|
'layer-components:md:(min-w-120px)',
|
|
@@ -86,3 +86,11 @@ export const NavBarRoot = withClassName(
|
|
|
86
86
|
'pb-[calc(0.25rem+env(safe-area-inset-bottom,0px))]',
|
|
87
87
|
'layer-components:sm:(bg-transparent flex flex-col rounded-0 border-none border-transparent shadow-none h-min-content overflow-y-auto overflow-x-hidden justify-start items-stretch gap-2 pb-10)',
|
|
88
88
|
);
|
|
89
|
+
|
|
90
|
+
export const NavBar = Object.assign(NavBarRoot, {
|
|
91
|
+
Item: NavBarItem,
|
|
92
|
+
ItemIcon: NavBarItemIcon,
|
|
93
|
+
ItemText: NavBarItemText,
|
|
94
|
+
ItemIconWrapper: NavBarItemIconWrapper,
|
|
95
|
+
ItemPip: NavBarItemPip,
|
|
96
|
+
});
|
|
@@ -30,7 +30,7 @@ const StyledClose = withClassName(
|
|
|
30
30
|
);
|
|
31
31
|
|
|
32
32
|
// Exports
|
|
33
|
-
export const
|
|
33
|
+
export const PopoverRoot = PopoverPrimitive.Root;
|
|
34
34
|
export const PopoverTrigger = PopoverPrimitive.Trigger;
|
|
35
35
|
export const PopoverArrow = StyledArrow;
|
|
36
36
|
export const PopoverClose = StyledClose;
|
|
@@ -77,3 +77,11 @@ export const PopoverContent = forwardRef<
|
|
|
77
77
|
</PopoverPrimitive.Portal>
|
|
78
78
|
);
|
|
79
79
|
});
|
|
80
|
+
|
|
81
|
+
export const Popover = Object.assign(PopoverRoot, {
|
|
82
|
+
Content: PopoverContent,
|
|
83
|
+
Arrow: PopoverArrow,
|
|
84
|
+
Close: PopoverClose,
|
|
85
|
+
Trigger: PopoverTrigger,
|
|
86
|
+
Anchor: PopoverAnchor,
|
|
87
|
+
});
|
|
@@ -63,20 +63,27 @@ export interface ScrollAreaProps extends Primitive.ScrollAreaProps {
|
|
|
63
63
|
orientation?: 'vertical' | 'both';
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
export const ScrollArea =
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
<
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
66
|
+
export const ScrollArea = Object.assign(
|
|
67
|
+
forwardRef<any, ScrollAreaProps>(function ScrollArea(
|
|
68
|
+
{ children, orientation, ...props },
|
|
69
|
+
ref,
|
|
70
|
+
) {
|
|
71
|
+
return (
|
|
72
|
+
<ScrollAreaRoot ref={ref} {...props}>
|
|
73
|
+
<ScrollAreaViewport>{children}</ScrollAreaViewport>
|
|
74
|
+
<ScrollAreaScrollbar />
|
|
75
|
+
{orientation === 'both' && (
|
|
76
|
+
<ScrollAreaScrollbar orientation="horizontal" />
|
|
77
|
+
)}
|
|
78
|
+
</ScrollAreaRoot>
|
|
79
|
+
);
|
|
80
|
+
}),
|
|
81
|
+
{
|
|
82
|
+
Root: ScrollAreaRoot,
|
|
83
|
+
Viewport: ScrollAreaViewport,
|
|
84
|
+
Scrollbar: ScrollAreaScrollbar,
|
|
85
|
+
},
|
|
86
|
+
);
|
|
80
87
|
|
|
81
88
|
const shadowMap = {
|
|
82
89
|
white: 'shadow-1',
|
|
@@ -201,7 +201,7 @@ export type SelectProps<T extends string = string> = {
|
|
|
201
201
|
/**
|
|
202
202
|
* A high-level Select which converts to native on mobile. Use with SelectItem.
|
|
203
203
|
*/
|
|
204
|
-
|
|
204
|
+
const SelectBase = <T extends string = string>({
|
|
205
205
|
children,
|
|
206
206
|
value,
|
|
207
207
|
onValueChange,
|
|
@@ -233,6 +233,18 @@ export const Select = <T extends string = string>({
|
|
|
233
233
|
);
|
|
234
234
|
};
|
|
235
235
|
|
|
236
|
+
export const Select = Object.assign(SelectBase, {
|
|
237
|
+
Root: SelectRoot,
|
|
238
|
+
Item: SelectItem,
|
|
239
|
+
Group: SelectGroup,
|
|
240
|
+
Trigger: SelectTrigger,
|
|
241
|
+
Value: SelectValue,
|
|
242
|
+
Label: SelectLabel,
|
|
243
|
+
Separator: SelectSeparator,
|
|
244
|
+
Icon: SelectIcon,
|
|
245
|
+
Content: SelectContent,
|
|
246
|
+
});
|
|
247
|
+
|
|
236
248
|
function isMobile() {
|
|
237
249
|
return /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(
|
|
238
250
|
navigator.userAgent,
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { forwardRef } from 'react';
|
|
1
2
|
import { withClassName } from '../../hooks.js';
|
|
2
3
|
import * as SliderPrimitive from '@radix-ui/react-slider';
|
|
3
4
|
|
|
@@ -26,18 +27,29 @@ export const SliderThumb = withClassName(
|
|
|
26
27
|
'layer-variants:[&[data-color=primary]]:focus-visible:(bg-primary-light ring-primary)',
|
|
27
28
|
);
|
|
28
29
|
|
|
29
|
-
interface SliderProps extends SliderPrimitive.SliderProps {
|
|
30
|
+
export interface SliderProps extends SliderPrimitive.SliderProps {
|
|
30
31
|
label?: string;
|
|
31
32
|
color?: 'default' | 'primary';
|
|
32
33
|
}
|
|
33
34
|
|
|
34
|
-
export
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
<
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
35
|
+
export const Slider = Object.assign(
|
|
36
|
+
forwardRef<HTMLDivElement, SliderProps>(function Slider(
|
|
37
|
+
{ label, color, ...props },
|
|
38
|
+
ref,
|
|
39
|
+
) {
|
|
40
|
+
return (
|
|
41
|
+
<SliderRoot ref={ref} {...props}>
|
|
42
|
+
<SliderTrack>
|
|
43
|
+
<SliderRange data-color={color} />
|
|
44
|
+
</SliderTrack>
|
|
45
|
+
<SliderThumb aria-label={label} data-color={color} />
|
|
46
|
+
</SliderRoot>
|
|
47
|
+
);
|
|
48
|
+
}),
|
|
49
|
+
{
|
|
50
|
+
Root: SliderRoot,
|
|
51
|
+
Track: SliderTrack,
|
|
52
|
+
Range: SliderRange,
|
|
53
|
+
Thumb: SliderThumb,
|
|
54
|
+
},
|
|
55
|
+
);
|
|
@@ -12,12 +12,16 @@ const SwitchThumb = withClassName(
|
|
|
12
12
|
'block w-21px h-21px bg-white rounded-full border-default transition-transform will-change-transform [&[data-state=checked]]:translate-x-19px',
|
|
13
13
|
);
|
|
14
14
|
|
|
15
|
-
export const Switch =
|
|
16
|
-
function Switch(props, ref) {
|
|
15
|
+
export const Switch = Object.assign(
|
|
16
|
+
forwardRef<HTMLButtonElement, SwitchProps>(function Switch(props, ref) {
|
|
17
17
|
return (
|
|
18
18
|
<SwitchRoot {...props} ref={ref}>
|
|
19
19
|
<SwitchThumb />
|
|
20
20
|
</SwitchRoot>
|
|
21
21
|
);
|
|
22
|
+
}),
|
|
23
|
+
{
|
|
24
|
+
Root: SwitchRoot,
|
|
25
|
+
Thumb: SwitchThumb,
|
|
22
26
|
},
|
|
23
27
|
);
|
|
@@ -1,17 +1,23 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as TabsPrimitive from '@radix-ui/react-tabs';
|
|
2
2
|
import { withClassName } from '../../hooks/withClassName.js';
|
|
3
3
|
|
|
4
|
-
export const TabsRoot = withClassName(
|
|
4
|
+
export const TabsRoot = withClassName(TabsPrimitive.Root, '');
|
|
5
5
|
|
|
6
6
|
export const TabsList = withClassName(
|
|
7
|
-
|
|
7
|
+
TabsPrimitive.List,
|
|
8
8
|
'flex flex-row py-2 px-2 justify-center items-start gap-2',
|
|
9
9
|
);
|
|
10
10
|
|
|
11
11
|
export const TabsTrigger = withClassName(
|
|
12
|
-
|
|
12
|
+
TabsPrimitive.Trigger,
|
|
13
13
|
'layer-components:(flex flex-row items-center justify-center gap-2 color-black py-1 px-4 bg-wash text-md min-w-100px rounded-full border border-1 font-semibold text-gray-7 border-gray-7 border-solid transition-colors cursor-pointer select-none font-sans)',
|
|
14
14
|
'hover:bg-primary-light focus-visible:(focus-ring focus-ring-primary-dark outline-off bg-primary-light border-primary-dark) [&[data-state=active]]:(font-semibold bg-primary-light border-primary-light text-black cursor-default hover:bg-primary-light relative z-1)',
|
|
15
15
|
);
|
|
16
16
|
|
|
17
|
-
export const TabsContent = withClassName(
|
|
17
|
+
export const TabsContent = withClassName(TabsPrimitive.Content, '');
|
|
18
|
+
|
|
19
|
+
export const Tabs = Object.assign(TabsRoot, {
|
|
20
|
+
List: TabsList,
|
|
21
|
+
Trigger: TabsTrigger,
|
|
22
|
+
Content: TabsContent,
|
|
23
|
+
});
|
|
@@ -83,7 +83,7 @@ export const TextArea = forwardRef<HTMLTextAreaElement, TextAreaProps>(
|
|
|
83
83
|
ref={finalRef}
|
|
84
84
|
className={classNames(
|
|
85
85
|
inputClassName,
|
|
86
|
-
'layer-components:([font-family:inherit] text-inherit overflow-hidden)',
|
|
86
|
+
'layer-components:([font-family:inherit] text-inherit overflow-hidden resize-none)',
|
|
87
87
|
'layer-variants:(rounded-20px)',
|
|
88
88
|
{
|
|
89
89
|
'layer-components:[resize:vertical]': !autoSize,
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as ToggleGroupPrimitive from '@radix-ui/react-toggle-group';
|
|
2
2
|
import { withClassName } from '../../hooks/withClassName.js';
|
|
3
3
|
|
|
4
4
|
export const ToggleGroupRoot = withClassName(
|
|
5
|
-
|
|
5
|
+
ToggleGroupPrimitive.Root,
|
|
6
6
|
'inline-flex bg-gray1 rounded-lg gap-1',
|
|
7
7
|
);
|
|
8
8
|
export const ToggleGroupItem = withClassName(
|
|
9
|
-
|
|
9
|
+
ToggleGroupPrimitive.Item,
|
|
10
10
|
'rounded-xl bg-gray2 py-1 px-2 flex items-center justify-center cursor-pointer hover:bg-gray3 active:bg-gray4 focus-visible:(shadow-focus outline-off) [&[data-state=on]]:(bg-primary-light border-black)',
|
|
11
11
|
);
|
|
12
|
+
|
|
13
|
+
export const ToggleGroup = Object.assign(ToggleGroupRoot, {
|
|
14
|
+
Item: ToggleGroupItem,
|
|
15
|
+
});
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
|
|
3
|
-
import { ComponentPropsWithoutRef } from 'react';
|
|
3
|
+
import { ComponentPropsWithoutRef, forwardRef } from 'react';
|
|
4
4
|
import * as TooltipPrimitive from '@radix-ui/react-tooltip';
|
|
5
5
|
import classNames from 'clsx';
|
|
6
6
|
|
|
@@ -31,25 +31,33 @@ function Content({
|
|
|
31
31
|
|
|
32
32
|
export const TooltipProvider = TooltipPrimitive.Provider;
|
|
33
33
|
|
|
34
|
-
export
|
|
35
|
-
content
|
|
36
|
-
|
|
37
|
-
open
|
|
38
|
-
disabled
|
|
39
|
-
...rest
|
|
40
|
-
}: { content: React.ReactNode; open?: boolean } & ComponentPropsWithoutRef<
|
|
41
|
-
typeof TooltipPrimitive.TooltipTrigger
|
|
42
|
-
>) {
|
|
43
|
-
return (
|
|
44
|
-
<TooltipPrimitive.Root open={open}>
|
|
45
|
-
{disabled ? (
|
|
46
|
-
children
|
|
47
|
-
) : (
|
|
48
|
-
<TooltipPrimitive.TooltipTrigger asChild {...rest}>
|
|
49
|
-
{children}
|
|
50
|
-
</TooltipPrimitive.TooltipTrigger>
|
|
51
|
-
)}
|
|
52
|
-
<Content sideOffset={12}>{content}</Content>
|
|
53
|
-
</TooltipPrimitive.Root>
|
|
54
|
-
);
|
|
34
|
+
export interface TooltipProps
|
|
35
|
+
extends Omit<TooltipPrimitive.TooltipTriggerProps, 'content'> {
|
|
36
|
+
content: React.ReactNode;
|
|
37
|
+
open?: boolean;
|
|
38
|
+
disabled?: boolean;
|
|
55
39
|
}
|
|
40
|
+
|
|
41
|
+
export const Tooltip = Object.assign(
|
|
42
|
+
forwardRef<HTMLButtonElement, TooltipProps>(function Tooltip(
|
|
43
|
+
{ content, children, open, disabled, ...rest },
|
|
44
|
+
ref,
|
|
45
|
+
) {
|
|
46
|
+
return (
|
|
47
|
+
<TooltipPrimitive.Root open={open}>
|
|
48
|
+
{disabled ? (
|
|
49
|
+
children
|
|
50
|
+
) : (
|
|
51
|
+
<TooltipPrimitive.TooltipTrigger asChild ref={ref} {...rest}>
|
|
52
|
+
{children}
|
|
53
|
+
</TooltipPrimitive.TooltipTrigger>
|
|
54
|
+
)}
|
|
55
|
+
<Content sideOffset={12}>{content}</Content>
|
|
56
|
+
</TooltipPrimitive.Root>
|
|
57
|
+
);
|
|
58
|
+
}),
|
|
59
|
+
{
|
|
60
|
+
Trigger: TooltipPrimitive.TooltipTrigger,
|
|
61
|
+
Content,
|
|
62
|
+
},
|
|
63
|
+
);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { Button } from './components/button.js';
|
|
4
|
+
import { Input } from './components/input.js';
|
|
5
|
+
import { TextArea } from './components/textArea.js';
|
|
6
|
+
import { Card } from './components/card.js';
|
|
7
|
+
import { Tabs } from './components/tabs.js';
|
|
8
|
+
|
|
9
|
+
const meta = {
|
|
10
|
+
title: 'themes',
|
|
11
|
+
argTypes: {},
|
|
12
|
+
parameters: {
|
|
13
|
+
controls: { expanded: true },
|
|
14
|
+
},
|
|
15
|
+
} satisfies Meta;
|
|
16
|
+
|
|
17
|
+
export default meta;
|
|
18
|
+
|
|
19
|
+
type Story = StoryObj;
|
|
20
|
+
|
|
21
|
+
function DemoUI({ className }: { className?: string }) {
|
|
22
|
+
return (
|
|
23
|
+
<div className={clsx('grid gap-2 grid-cols-3', className)}>
|
|
24
|
+
<div className="col">
|
|
25
|
+
<Button color="primary">Primary</Button>
|
|
26
|
+
<Button color="accent">Accent</Button>
|
|
27
|
+
<Button>Default</Button>
|
|
28
|
+
<Button size="small" color="destructive">
|
|
29
|
+
Destructive
|
|
30
|
+
</Button>
|
|
31
|
+
<Button size="small" color="ghostDestructive">
|
|
32
|
+
Ghost Destructive
|
|
33
|
+
</Button>
|
|
34
|
+
</div>
|
|
35
|
+
<div className="col">
|
|
36
|
+
<Input placeholder="Placeholder" />
|
|
37
|
+
<TextArea placeholder="Placeholder" />
|
|
38
|
+
</div>
|
|
39
|
+
<div>
|
|
40
|
+
<Card>
|
|
41
|
+
<Card.Main>
|
|
42
|
+
<Card.Title>Card Title</Card.Title>
|
|
43
|
+
<Card.Content>Card Content</Card.Content>
|
|
44
|
+
</Card.Main>
|
|
45
|
+
<Card.Footer>
|
|
46
|
+
<Card.Actions>
|
|
47
|
+
<Button size="small">Action 1</Button>
|
|
48
|
+
</Card.Actions>
|
|
49
|
+
</Card.Footer>
|
|
50
|
+
</Card>
|
|
51
|
+
</div>
|
|
52
|
+
<div>
|
|
53
|
+
<Tabs defaultValue="tab1">
|
|
54
|
+
<Tabs.List>
|
|
55
|
+
<Tabs.Trigger value="tab1">Tab 1</Tabs.Trigger>
|
|
56
|
+
<Tabs.Trigger value="tab2">Tab 2</Tabs.Trigger>
|
|
57
|
+
</Tabs.List>
|
|
58
|
+
<Tabs.Content value="tab1">Tab 1 Content</Tabs.Content>
|
|
59
|
+
<Tabs.Content value="tab2">Tab 2 Content</Tabs.Content>
|
|
60
|
+
</Tabs>
|
|
61
|
+
</div>
|
|
62
|
+
</div>
|
|
63
|
+
);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
export const Default: Story = {
|
|
67
|
+
render() {
|
|
68
|
+
return <DemoUI />;
|
|
69
|
+
},
|
|
70
|
+
};
|