@crystallize/design-system 0.0.2 → 0.2.0
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/CHANGELOG.md +23 -0
- package/dist/index.css +242 -5
- package/dist/index.d.ts +111 -20
- package/dist/index.js +495 -165
- package/dist/index.mjs +482 -163
- package/package.json +15 -12
- package/src/action-menu/action-item.tsx +2 -2
- package/src/action-menu/action-menu.tsx +2 -2
- package/src/checkbox/checkbox.stories.tsx +62 -0
- package/src/checkbox/checkbox.tsx +36 -0
- package/src/checkbox/index.ts +1 -0
- package/src/dialog/dialog.tsx +6 -6
- package/src/dropdown-menu/DropdownMenu.stories.tsx +1 -2
- package/src/dropdown-menu/dropdown-menu-item.tsx +3 -3
- package/src/dropdown-menu/dropdown-menu-label.tsx +3 -3
- package/src/icons/error.tsx +22 -29
- package/src/icons/info.tsx +25 -32
- package/src/icons/warning.tsx +34 -41
- package/src/index.ts +13 -1
- package/src/inline-radio/index.ts +1 -0
- package/src/inline-radio/inline-radio.stories.tsx +62 -0
- package/src/inline-radio/inline-radio.tsx +36 -0
- package/src/input/Input.stories.tsx +19 -0
- package/src/input/index.ts +1 -0
- package/src/input/input.tsx +33 -0
- package/src/label/index.ts +1 -0
- package/src/label/label.stories.tsx +19 -0
- package/src/label/label.tsx +11 -0
- package/src/progress/Progress.stories.tsx +26 -0
- package/src/progress/index.ts +1 -0
- package/src/progress/progress.tsx +16 -0
- package/src/radio/index.ts +1 -0
- package/src/radio/radio.stories.tsx +142 -0
- package/src/radio/radio.tsx +26 -0
- package/src/select/index.ts +1 -0
- package/src/select/select-item.tsx +27 -0
- package/src/select/select-root.tsx +41 -0
- package/src/select/select.stories.tsx +62 -0
- package/src/select/select.ts +7 -0
- package/src/text-field/TextField.stories.tsx +20 -0
- package/src/text-field/index.ts +1 -0
- package/src/text-field/text-field.tsx +60 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crystallize/design-system",
|
|
3
|
-
"version": "0.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"types": "./dist/index.d.ts",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -15,10 +15,13 @@
|
|
|
15
15
|
}
|
|
16
16
|
},
|
|
17
17
|
"dependencies": {
|
|
18
|
+
"@radix-ui/react-checkbox": "1.0.1",
|
|
18
19
|
"@radix-ui/react-dialog": "1.0.2",
|
|
19
20
|
"@radix-ui/react-dropdown-menu": "2.0.1",
|
|
20
|
-
"
|
|
21
|
-
"
|
|
21
|
+
"@radix-ui/react-progress": "^1.0.1",
|
|
22
|
+
"@radix-ui/react-radio-group": "1.1.0",
|
|
23
|
+
"@radix-ui/react-select": "1.1.2",
|
|
24
|
+
"class-variance-authority": "^0.4.0",
|
|
22
25
|
"react": "17.0.1",
|
|
23
26
|
"react-dom": "17.0.1"
|
|
24
27
|
},
|
|
@@ -26,26 +29,26 @@
|
|
|
26
29
|
"@mdx-js/react": "^2.1.5",
|
|
27
30
|
"@storybook/addon-actions": "7.0.0-alpha.47",
|
|
28
31
|
"@storybook/addon-backgrounds": "7.0.0-alpha.47",
|
|
29
|
-
"@storybook/addon-docs": "^7.0.0-
|
|
30
|
-
"@storybook/addon-essentials": "^7.0.0-
|
|
32
|
+
"@storybook/addon-docs": "^7.0.0-beta.4",
|
|
33
|
+
"@storybook/addon-essentials": "^7.0.0-beta.4",
|
|
31
34
|
"@storybook/addon-highlight": "7.0.0-alpha.47",
|
|
32
|
-
"@storybook/addon-interactions": "^7.0.0-
|
|
33
|
-
"@storybook/addon-links": "^7.0.0-
|
|
35
|
+
"@storybook/addon-interactions": "^7.0.0-beta.4",
|
|
36
|
+
"@storybook/addon-links": "^7.0.0-beta.4",
|
|
34
37
|
"@storybook/addon-measure": "7.0.0-alpha.47",
|
|
35
38
|
"@storybook/addon-outline": "7.0.0-alpha.47",
|
|
36
|
-
"@storybook/react": "^7.0.0-
|
|
39
|
+
"@storybook/react": "^7.0.0-beta.4",
|
|
37
40
|
"@storybook/react-vite": "^7.0.0-alpha.47",
|
|
38
41
|
"@storybook/testing-library": "^0.0.13",
|
|
39
42
|
"@types/react": "17.0.1",
|
|
40
43
|
"@types/react-dom": "17.0.1",
|
|
41
44
|
"@vitejs/plugin-react": "^2.2.0",
|
|
42
45
|
"postcss": "^8.4.18",
|
|
43
|
-
"storybook": "^7.0.0-
|
|
46
|
+
"storybook": "^7.0.0-beta.4",
|
|
44
47
|
"tailwindcss": "^3.2.1",
|
|
45
48
|
"tsconfig": "0.0.0",
|
|
46
|
-
"tsup": "^6.
|
|
47
|
-
"typescript": "^4.
|
|
48
|
-
"vite": "^3.2.
|
|
49
|
+
"tsup": "^6.5.0",
|
|
50
|
+
"typescript": "^4.9.4",
|
|
51
|
+
"vite": "^3.2.5"
|
|
49
52
|
},
|
|
50
53
|
"keywords": [
|
|
51
54
|
"react",
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { cx } from 'class-variance-authority';
|
|
2
2
|
import type { HTMLAttributes } from 'react';
|
|
3
3
|
|
|
4
4
|
import { DropdownMenu } from '../dropdown-menu';
|
|
@@ -11,7 +11,7 @@ export function Item({ children, className, onSelect }: ItemProps) {
|
|
|
11
11
|
return (
|
|
12
12
|
<DropdownMenu.Item
|
|
13
13
|
onClick={onSelect}
|
|
14
|
-
className={
|
|
14
|
+
className={cx(
|
|
15
15
|
'items-center text-density cursor-pointer flex font-sans font-medium text-sm gap-2 py-2.5 px-5',
|
|
16
16
|
'hover:bg-[#f4f4f4]',
|
|
17
17
|
'[&.danger]:text-error',
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { cx } from 'class-variance-authority';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
3
|
|
|
4
4
|
import { DropdownMenu } from '../dropdown-menu';
|
|
@@ -17,7 +17,7 @@ export function ActionMenu({ children, tabIndex }: ActionMenuProps) {
|
|
|
17
17
|
<button
|
|
18
18
|
tabIndex={tabIndex}
|
|
19
19
|
type="button"
|
|
20
|
-
className={
|
|
20
|
+
className={cx(
|
|
21
21
|
'items-center bg-transparent rounded-full border-none cursor-pointer flex justify-center p-1',
|
|
22
22
|
'hover:bg-gray-6 focus:bg-gray-6 focus:outline-offset-2 focus:outline focus:outline-1 focus:outline-glacier focus-visible:outline-offset-2 focus-visible:outline focus-visible:outline-1 focus-visible:outline-glacier',
|
|
23
23
|
'active:scale-95',
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
|
|
4
|
+
import { Label } from '../label';
|
|
5
|
+
import { Checkbox } from './checkbox';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof Checkbox> = {
|
|
8
|
+
title: 'Components/Checkbox',
|
|
9
|
+
component: Checkbox,
|
|
10
|
+
argTypes: {},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof Checkbox>;
|
|
16
|
+
|
|
17
|
+
export const Example: Story = {
|
|
18
|
+
render: () => {
|
|
19
|
+
return <Checkbox defaultChecked={true} />;
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export const Uncontrolled: Story = {
|
|
24
|
+
render: () => {
|
|
25
|
+
return <Checkbox defaultChecked={true} />;
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
export const Controlled: Story = {
|
|
30
|
+
render: () => {
|
|
31
|
+
const [checked, setChecked] = useState(false);
|
|
32
|
+
return <Checkbox checked={checked} onCheckedChange={c => setChecked(Boolean(c))} />;
|
|
33
|
+
},
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const WithLabel: Story = {
|
|
37
|
+
render: () => {
|
|
38
|
+
return (
|
|
39
|
+
<div className="flex items-center space-x-2">
|
|
40
|
+
<Checkbox id="with-label-c1" defaultChecked={true} />
|
|
41
|
+
<Label htmlFor="with-label-c1">Accept terms and conditions.</Label>
|
|
42
|
+
</div>
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const Disabled: Story = {
|
|
48
|
+
render: () => {
|
|
49
|
+
return (
|
|
50
|
+
<div className="space-y-4">
|
|
51
|
+
<div className="flex items-center space-x-2">
|
|
52
|
+
<Checkbox id="disabled-c1" defaultChecked={true} disabled />
|
|
53
|
+
<Label htmlFor="disabled-c1">Accept terms and conditions.</Label>
|
|
54
|
+
</div>
|
|
55
|
+
<div className="flex items-center space-x-2">
|
|
56
|
+
<Checkbox id="disabled-c2" defaultChecked={false} disabled />
|
|
57
|
+
<Label htmlFor="disabled-c2">Accept terms and conditions.</Label>
|
|
58
|
+
</div>
|
|
59
|
+
</div>
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as CheckboxPrimitive from '@radix-ui/react-checkbox';
|
|
2
|
+
import { cx } from 'class-variance-authority';
|
|
3
|
+
import { ComponentProps, forwardRef } from 'react';
|
|
4
|
+
|
|
5
|
+
export type CheckboxRef = HTMLButtonElement;
|
|
6
|
+
export type CheckboxProps = ComponentProps<typeof CheckboxPrimitive.Root>;
|
|
7
|
+
|
|
8
|
+
export const Checkbox = forwardRef<CheckboxRef, CheckboxProps>((props, ref) => {
|
|
9
|
+
return (
|
|
10
|
+
<CheckboxPrimitive.Root
|
|
11
|
+
{...props}
|
|
12
|
+
ref={ref}
|
|
13
|
+
className={cx(
|
|
14
|
+
'flex h-3.5 w-3.5 items-center justify-center rounded-sm border border-solid border-[#ddd] bg-white',
|
|
15
|
+
'focus:outline-none focus:ring-1 focus:ring-[#528693] focus:ring-offset-1',
|
|
16
|
+
'radix-state-checked:border-[#528693] radix-state-checked:bg-neptune',
|
|
17
|
+
'radix-state-checked:disabled:opacity-40 radix-state-unchecked:disabled:!bg-[#ddd]/20',
|
|
18
|
+
)}
|
|
19
|
+
>
|
|
20
|
+
<CheckboxPrimitive.Indicator>
|
|
21
|
+
<svg viewBox="0 0 9 9" fill="none" className="h-2 w-2">
|
|
22
|
+
<path
|
|
23
|
+
d="M1.12 5.51a.559.559 0 01.832-.101l2.201 1.953-.427.624a.326.326 0 01-.486.06L1.21 6.245a.559.559 0 01-.09-.734z"
|
|
24
|
+
fill="#528693"
|
|
25
|
+
/>
|
|
26
|
+
<path
|
|
27
|
+
d="M7.883 1.087c.043.03.053.09.023.132L3.669 7.132l-.154-.105L7.754 1.11a.093.093 0 01.129-.023z"
|
|
28
|
+
stroke="#528693"
|
|
29
|
+
/>
|
|
30
|
+
</svg>
|
|
31
|
+
</CheckboxPrimitive.Indicator>
|
|
32
|
+
</CheckboxPrimitive.Root>
|
|
33
|
+
);
|
|
34
|
+
});
|
|
35
|
+
|
|
36
|
+
Checkbox.displayName = 'Checkbox';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './checkbox';
|
package/src/dialog/dialog.tsx
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import type { ReactNode, RefAttributes } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
2
|
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
-
import { cva, VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { cva, cx, VariantProps } from 'class-variance-authority';
|
|
5
4
|
|
|
6
5
|
import { Button } from '../button';
|
|
7
6
|
import { Icon } from '../icons';
|
|
@@ -31,15 +30,16 @@ type DialogContentProps = DialogContentStylesProps & {
|
|
|
31
30
|
DialogFuncProps,
|
|
32
31
|
'onEscapeKeyDown' | 'onInteractOutside' | 'onPointerDownOutside' | 'closable' | 'type' | 'className'
|
|
33
32
|
> &
|
|
34
|
-
DialogPrimitive.DialogContentProps
|
|
33
|
+
DialogPrimitive.DialogContentProps &
|
|
34
|
+
Pick<DialogPrimitive.PortalProps, 'container'>;
|
|
35
35
|
|
|
36
|
-
function DialogContent({ children, closable = true, type, className, ...delegated }: DialogContentProps) {
|
|
36
|
+
function DialogContent({ children, closable = true, type, className, container, ...delegated }: DialogContentProps) {
|
|
37
37
|
const withIcon = typeof type !== 'undefined';
|
|
38
38
|
|
|
39
39
|
const IconComponent = type && IconMap[type];
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
|
-
<DialogPrimitive.Portal>
|
|
42
|
+
<DialogPrimitive.Portal container={container}>
|
|
43
43
|
<DialogPrimitive.Overlay className="bg-black/30 fixed inset-0" />
|
|
44
44
|
<DialogPrimitive.Content className={dialogContentStyles({ withIcon, class: className })} {...delegated}>
|
|
45
45
|
{IconComponent && <IconComponent className="my-1 shrink-0" width={32} height={32} />}
|
|
@@ -61,7 +61,7 @@ type DialogTitleProps = JSX.IntrinsicAttributes & DialogPrimitive.DialogTitlePro
|
|
|
61
61
|
function DialogTitle({ className, ...delegated }: DialogTitleProps) {
|
|
62
62
|
return (
|
|
63
63
|
<DialogPrimitive.Title
|
|
64
|
-
className={
|
|
64
|
+
className={cx('m-0 font-medium text-xl font-sans text-black-text', className)}
|
|
65
65
|
{...delegated}
|
|
66
66
|
/>
|
|
67
67
|
);
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import type { Meta } from '@storybook/react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
2
|
import { useState } from 'react';
|
|
4
3
|
|
|
5
4
|
import { DropdownMenu } from '.';
|
|
@@ -39,7 +38,7 @@ export const WithOpenState = () => {
|
|
|
39
38
|
<Button>
|
|
40
39
|
<div className="flex items-center">
|
|
41
40
|
<Icon.NailPolish width={20} height={20} /> <span className="pl-4 pr-8">Pretty</span>
|
|
42
|
-
<Icon.Arrow className={
|
|
41
|
+
<Icon.Arrow className={isOpen ? 'rotate-180' : ''} />
|
|
43
42
|
</div>
|
|
44
43
|
</Button>
|
|
45
44
|
</DropdownMenu.Root>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
1
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
3
|
-
import
|
|
2
|
+
import { cx } from 'class-variance-authority';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
type DropdownMenuItemProps = DropdownMenuPrimitive.MenuItemProps & {
|
|
6
6
|
children: ReactNode;
|
|
@@ -10,7 +10,7 @@ export function DropdownMenuItem({ children, className, ...delegated }: Dropdown
|
|
|
10
10
|
return (
|
|
11
11
|
<DropdownMenuPrimitive.Item
|
|
12
12
|
{...delegated}
|
|
13
|
-
className={
|
|
13
|
+
className={cx(
|
|
14
14
|
'text-xs font-medium text-black-text',
|
|
15
15
|
'flex h-10 cursor-pointer items-center bg-white px-4 outline-asteroid',
|
|
16
16
|
'hover:bg-[#F8F8F9] hover:outline-none hover:focus-visible:outline-none',
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import clsx from 'clsx';
|
|
3
1
|
import * as DropdownMenuPrimitive from '@radix-ui/react-dropdown-menu';
|
|
2
|
+
import { cx } from 'class-variance-authority';
|
|
3
|
+
import type { ReactNode } from 'react';
|
|
4
4
|
|
|
5
5
|
type DropdownMenuLabelProps = {
|
|
6
6
|
children: ReactNode;
|
|
@@ -9,7 +9,7 @@ type DropdownMenuLabelProps = {
|
|
|
9
9
|
export function DropdownMenuLabel({ children }: DropdownMenuLabelProps) {
|
|
10
10
|
return (
|
|
11
11
|
<DropdownMenuPrimitive.Label
|
|
12
|
-
className={
|
|
12
|
+
className={cx('bg-white px-4 py-2 text-xs text-label', 'first:rounded-tl first:rounded-tr')}
|
|
13
13
|
>
|
|
14
14
|
{children}
|
|
15
15
|
</DropdownMenuPrimitive.Label>
|
package/src/icons/error.tsx
CHANGED
|
@@ -14,35 +14,28 @@ export const Error = forwardRef<ErrorRef, ErrorProps>((delegated, ref) => {
|
|
|
14
14
|
viewBox="0 0 22 22"
|
|
15
15
|
{...delegated}
|
|
16
16
|
>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
/>
|
|
40
|
-
</g>
|
|
41
|
-
<defs>
|
|
42
|
-
<clipPath id="a">
|
|
43
|
-
<path fill="#fff" d="M0 0h22v22H0z" />
|
|
44
|
-
</clipPath>
|
|
45
|
-
</defs>
|
|
17
|
+
<path
|
|
18
|
+
fill="#DD1367"
|
|
19
|
+
d="M20.83 11c0 5.43-4.4 9.83-9.83 9.83S1.17 16.43 1.17 11 5.57 1.17 11 1.17s9.83 4.4 9.83 9.83Z"
|
|
20
|
+
/>
|
|
21
|
+
<path
|
|
22
|
+
fill="#528693"
|
|
23
|
+
fillRule="evenodd"
|
|
24
|
+
d="M21.431 11c0 5.76-4.67 10.43-10.43 10.43C5.238 21.43.568 16.76.568 11S5.24.57 11 .57C16.76.57 21.431 5.24 21.431 11Zm-10.43 9.83c5.429 0 9.83-4.4 9.83-9.83s-4.401-9.83-9.83-9.83c-5.43 0-9.832 4.4-9.832 9.83S5.571 20.83 11 20.83Z"
|
|
25
|
+
clipRule="evenodd"
|
|
26
|
+
/>
|
|
27
|
+
<path
|
|
28
|
+
fill="#fff"
|
|
29
|
+
fillRule="evenodd"
|
|
30
|
+
d="m7.364 13.479 1.157 1.157L11 12.158l2.479 2.478 1.157-1.157L12.158 11l2.478-2.479-1.157-1.157-2.48 2.478-2.478-2.478L7.364 8.52 9.842 11l-2.478 2.479Z"
|
|
31
|
+
clipRule="evenodd"
|
|
32
|
+
/>
|
|
33
|
+
<path
|
|
34
|
+
fill="#528693"
|
|
35
|
+
fillRule="evenodd"
|
|
36
|
+
d="M6.94 13.903a.6.6 0 0 1 0-.849L8.994 11 6.94 8.946a.6.6 0 0 1 0-.849L8.097 6.94a.6.6 0 0 1 .849 0L11 8.994l2.054-2.054a.6.6 0 0 1 .849 0l1.157 1.157a.6.6 0 0 1 0 .849L13.006 11l2.054 2.054a.6.6 0 0 1 0 .849l-1.157 1.157a.6.6 0 0 1-.849 0L11 13.006 8.946 15.06a.6.6 0 0 1-.849 0L6.94 13.903ZM11 12.158l2.479 2.478 1.157-1.157L12.158 11l2.478-2.479-1.157-1.157L11 9.842 8.521 7.364 7.364 8.52 9.842 11l-2.478 2.479 1.157 1.157L11 12.158Z"
|
|
37
|
+
clipRule="evenodd"
|
|
38
|
+
/>
|
|
46
39
|
</svg>
|
|
47
40
|
);
|
|
48
41
|
});
|
package/src/icons/info.tsx
CHANGED
|
@@ -14,38 +14,31 @@ export const Info = forwardRef<InfoRef, InfoProps>((delegated, ref) => {
|
|
|
14
14
|
viewBox="0 0 22 22"
|
|
15
15
|
{...delegated}
|
|
16
16
|
>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/>
|
|
43
|
-
</g>
|
|
44
|
-
<defs>
|
|
45
|
-
<clipPath id="a">
|
|
46
|
-
<path fill="#fff" d="M0 0h22v22H0z" />
|
|
47
|
-
</clipPath>
|
|
48
|
-
</defs>
|
|
17
|
+
<path
|
|
18
|
+
fill="#BFF6F8"
|
|
19
|
+
d="M20.83 11c0 5.43-4.4 9.83-9.83 9.83S1.17 16.43 1.17 11 5.57 1.17 11 1.17s9.83 4.4 9.83 9.83Z"
|
|
20
|
+
/>
|
|
21
|
+
<path
|
|
22
|
+
fill="#528693"
|
|
23
|
+
fillRule="evenodd"
|
|
24
|
+
d="M21.431 11c0 5.76-4.67 10.43-10.43 10.43C5.238 21.43.568 16.76.568 11S5.24.57 11 .57C16.76.57 21.431 5.24 21.431 11Zm-10.43 9.83c5.429 0 9.83-4.4 9.83-9.83s-4.401-9.83-9.83-9.83c-5.43 0-9.832 4.4-9.832 9.83S5.571 20.83 11 20.83Z"
|
|
25
|
+
clipRule="evenodd"
|
|
26
|
+
/>
|
|
27
|
+
<path fill="#fff" d="M14.814 6.317a.991.991 0 1 1-1.983 0 .991.991 0 0 1 1.983 0Z" />
|
|
28
|
+
<path
|
|
29
|
+
fill="#528693"
|
|
30
|
+
fillRule="evenodd"
|
|
31
|
+
d="M15.415 6.317a1.592 1.592 0 1 1-3.184 0 1.592 1.592 0 0 1 3.184 0Zm-1.592.991a.991.991 0 1 0 0-1.982.991.991 0 0 0 0 1.982Z"
|
|
32
|
+
clipRule="evenodd"
|
|
33
|
+
/>
|
|
34
|
+
<path
|
|
35
|
+
fill="#fff"
|
|
36
|
+
d="m9.37 16.049 1.8.26-.22-.7-.78-.621.56-1.14 2.261-3.382-.34-1.381-1.92-1-1.261.14-.28.32 1.08.54.14.54-2.22 2.862-.821 2.36 2 1.202Z"
|
|
37
|
+
/>
|
|
38
|
+
<path
|
|
39
|
+
fill="#528693"
|
|
40
|
+
d="M10.476 16.666a4.93 4.93 0 0 1-2.096-.599c-1.114-.605-1.482-1.63-.961-2.673a9.606 9.606 0 0 1 1.437-1.963l.067-.077c.252-.293.513-.595.742-.897.288-.38.538-.745.443-1.031-.056-.164-.215-.282-.485-.362a1.58 1.58 0 0 0-.247-.033l-.055-.004a.984.984 0 0 1-.481-.096c-.169-.132-.098-.51-.013-.676a.915.915 0 0 1 .701-.473c.139-.025.28-.037.42-.035.656.034 1.301.176 1.91.42 1.104.424 1.631 1.263 1.41 2.244a4.193 4.193 0 0 1-.908 1.714c-.128.161-.26.315-.392.471l-.07.083c-.282.32-.544.654-.788 1.003l-.144.206c-.161.209-.291.44-.385.687a.582.582 0 0 0 .32.743.91.91 0 0 0 .32.08c.175.021.356.044.428.21a.575.575 0 0 1-.035.477 1.144 1.144 0 0 1-1.138.581Zm-.877-8.193c.128.079.268.136.414.17.18.04.35.12.494.236.58.552.14 1.272-.318 1.903-.214.292-.47.58-.74.884l-.068.077c-.624.692-1.27 1.408-1.497 2.232a1.148 1.148 0 0 0 .163 1.06c.493.658 1.78.907 2.819.921l.035-.05-.025-.035a1.248 1.248 0 0 1-.865-.594 1.04 1.04 0 0 1 .006-.894 8.071 8.071 0 0 1 1.309-1.977l.127-.155c.171-.21.356-.437.525-.665.371-.501.844-1.245.664-1.915-.315-1.173-2.15-1.209-3.03-1.226h-.057l.044.028Z"
|
|
41
|
+
/>
|
|
49
42
|
</svg>
|
|
50
43
|
);
|
|
51
44
|
});
|
package/src/icons/warning.tsx
CHANGED
|
@@ -14,47 +14,40 @@ export const Warning = forwardRef<WarningRef, WarningProps>((delegated, ref) =>
|
|
|
14
14
|
viewBox="0 0 22 22"
|
|
15
15
|
{...delegated}
|
|
16
16
|
>
|
|
17
|
-
<
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
/>
|
|
52
|
-
</g>
|
|
53
|
-
<defs>
|
|
54
|
-
<clipPath id="a">
|
|
55
|
-
<path fill="#fff" d="M0 0h22v22H0z" />
|
|
56
|
-
</clipPath>
|
|
57
|
-
</defs>
|
|
17
|
+
<path
|
|
18
|
+
fill="#FFDE99"
|
|
19
|
+
d="M20.83 11c0 5.43-4.4 9.83-9.83 9.83S1.17 16.43 1.17 11 5.57 1.17 11 1.17s9.83 4.4 9.83 9.83Z"
|
|
20
|
+
/>
|
|
21
|
+
<path
|
|
22
|
+
fill="#528693"
|
|
23
|
+
fillRule="evenodd"
|
|
24
|
+
d="M21.43 11c0 5.76-4.67 10.43-10.43 10.43S.57 16.76.57 11 5.24.57 11 .57 21.43 5.24 21.43 11ZM11 20.83c5.43 0 9.83-4.4 9.83-9.83S16.43 1.17 11 1.17 1.17 5.57 1.17 11s4.4 9.83 9.83 9.83Z"
|
|
25
|
+
clipRule="evenodd"
|
|
26
|
+
/>
|
|
27
|
+
<path
|
|
28
|
+
fill="#fff"
|
|
29
|
+
d="M10.077 5.232c.41-.71 1.436-.71 1.846 0L17 14.025c.41.71-.103 1.599-.924 1.599H5.923c-.82 0-1.333-.889-.923-1.6l5.077-8.792Z"
|
|
30
|
+
/>
|
|
31
|
+
<path
|
|
32
|
+
fill="#528693"
|
|
33
|
+
fillRule="evenodd"
|
|
34
|
+
d="m16.48 14.325-5.077-8.793a.466.466 0 0 0-.806 0L5.52 14.325c-.18.31.045.699.403.699h10.153a.466.466 0 0 0 .404-.7Zm-4.557-9.093a1.066 1.066 0 0 0-1.846 0L5 14.025c-.41.71.103 1.599.923 1.599h10.153c.821 0 1.334-.889.924-1.6l-5.077-8.792Z"
|
|
35
|
+
clipRule="evenodd"
|
|
36
|
+
/>
|
|
37
|
+
<path fill="#FFDE99" d="M10.588 8.628a.5.5 0 1 1 1 0v2.475a.5.5 0 0 1-1 0V8.628Z" />
|
|
38
|
+
<path
|
|
39
|
+
fill="#528693"
|
|
40
|
+
fillRule="evenodd"
|
|
41
|
+
d="M12.188 8.628v2.475a1.1 1.1 0 0 1-2.2 0V8.628a1.1 1.1 0 1 1 2.2 0Zm-1.1-.5a.5.5 0 0 0-.5.5v2.475a.5.5 0 1 0 1 0V8.628a.5.5 0 0 0-.5-.5Z"
|
|
42
|
+
clipRule="evenodd"
|
|
43
|
+
/>
|
|
44
|
+
<path fill="#FFDE99" d="M11.588 13.403a.5.5 0 1 1-1 0 .5.5 0 0 1 1 0Z" />
|
|
45
|
+
<path
|
|
46
|
+
fill="#528693"
|
|
47
|
+
fillRule="evenodd"
|
|
48
|
+
d="M12.188 13.403a1.1 1.1 0 1 1-2.2 0 1.1 1.1 0 0 1 2.2 0Zm-1.1.5a.5.5 0 1 0 0-1 .5.5 0 0 0 0 1Z"
|
|
49
|
+
clipRule="evenodd"
|
|
50
|
+
/>
|
|
58
51
|
</svg>
|
|
59
52
|
);
|
|
60
53
|
});
|
package/src/index.ts
CHANGED
|
@@ -1,8 +1,20 @@
|
|
|
1
1
|
import './index.css';
|
|
2
2
|
|
|
3
3
|
// Components ---
|
|
4
|
-
|
|
5
4
|
export * from './action-menu';
|
|
6
5
|
export * from './button';
|
|
6
|
+
export * from './card';
|
|
7
|
+
export * from './checkbox';
|
|
7
8
|
export * from './dialog';
|
|
8
9
|
export * from './dropdown-menu';
|
|
10
|
+
export * from './icon-button';
|
|
11
|
+
export * from './inline-radio';
|
|
12
|
+
export * from './input';
|
|
13
|
+
export * from './label';
|
|
14
|
+
export * from './progress';
|
|
15
|
+
export * from './radio';
|
|
16
|
+
export * from './select';
|
|
17
|
+
export * from './text-field';
|
|
18
|
+
|
|
19
|
+
// Icons ---
|
|
20
|
+
export * from './icons';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './inline-radio';
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useState } from 'react';
|
|
2
|
+
import { InlineRadio } from './inline-radio';
|
|
3
|
+
import { Icon } from '../icons';
|
|
4
|
+
|
|
5
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
6
|
+
|
|
7
|
+
const meta: Meta<typeof InlineRadio.Group> = {
|
|
8
|
+
title: 'Components/InlineRadio',
|
|
9
|
+
component: InlineRadio.Group,
|
|
10
|
+
argTypes: {},
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
export default meta;
|
|
14
|
+
|
|
15
|
+
type Story = StoryObj<typeof InlineRadio.Group>;
|
|
16
|
+
|
|
17
|
+
export const Example: Story = {
|
|
18
|
+
render: () => {
|
|
19
|
+
return (
|
|
20
|
+
<InlineRadio.Group defaultValue="plus">
|
|
21
|
+
<InlineRadio.Item value="plus" id="example-r1">
|
|
22
|
+
+
|
|
23
|
+
</InlineRadio.Item>
|
|
24
|
+
<InlineRadio.Item value="minus" id="example-r2">
|
|
25
|
+
-
|
|
26
|
+
</InlineRadio.Item>
|
|
27
|
+
</InlineRadio.Group>
|
|
28
|
+
);
|
|
29
|
+
},
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export const ProductView: Story = {
|
|
33
|
+
render: () => {
|
|
34
|
+
return (
|
|
35
|
+
<InlineRadio.Group defaultValue="pretty">
|
|
36
|
+
<InlineRadio.Item value="pretty" id="productview-r1">
|
|
37
|
+
<Icon.NailPolish />
|
|
38
|
+
</InlineRadio.Item>
|
|
39
|
+
<InlineRadio.Item value="nerdy" id="productview-r2">
|
|
40
|
+
<Icon.Glasses />
|
|
41
|
+
</InlineRadio.Item>
|
|
42
|
+
</InlineRadio.Group>
|
|
43
|
+
);
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export const Controlled: Story = {
|
|
48
|
+
render: () => {
|
|
49
|
+
const [view, setView] = useState('pretty');
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<InlineRadio.Group value={view} onValueChange={v => setView(v)}>
|
|
53
|
+
<InlineRadio.Item value="pretty" id="controlled-r1">
|
|
54
|
+
<Icon.NailPolish />
|
|
55
|
+
</InlineRadio.Item>
|
|
56
|
+
<InlineRadio.Item value="nerdy" id="controlled-r2">
|
|
57
|
+
<Icon.Glasses />
|
|
58
|
+
</InlineRadio.Item>
|
|
59
|
+
</InlineRadio.Group>
|
|
60
|
+
);
|
|
61
|
+
},
|
|
62
|
+
};
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
2
|
+
import { cx } from 'class-variance-authority';
|
|
3
|
+
import type { ComponentProps } from 'react';
|
|
4
|
+
|
|
5
|
+
type InlineRadioGroupProps = ComponentProps<typeof RadioGroupPrimitive.Root>;
|
|
6
|
+
|
|
7
|
+
function InlineRadioGroup(delegated: InlineRadioGroupProps) {
|
|
8
|
+
return (
|
|
9
|
+
<RadioGroupPrimitive.Root {...delegated} className="inline-flex space-x-1 rounded-sm bg-[#9095a81a] p-[3px]" />
|
|
10
|
+
);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
type InlineRadioItemProps = ComponentProps<typeof RadioGroupPrimitive.Item>;
|
|
14
|
+
|
|
15
|
+
function InlineRadioItem({ children, className, ...delegated }: InlineRadioItemProps) {
|
|
16
|
+
return (
|
|
17
|
+
<RadioGroupPrimitive.Item
|
|
18
|
+
{...delegated}
|
|
19
|
+
className={cx(
|
|
20
|
+
'm-0 p-0',
|
|
21
|
+
'flex cursor-pointer items-center justify-center rounded border-none bg-transparent text-sm leading-none text-zinc-800',
|
|
22
|
+
'disabled:cursor-not-allowed',
|
|
23
|
+
'radix-state-checked:bg-white radix-state-checked:shadow-sm',
|
|
24
|
+
'focus:outline-neptune',
|
|
25
|
+
className,
|
|
26
|
+
)}
|
|
27
|
+
>
|
|
28
|
+
<RadioGroupPrimitive.Indicator forceMount>{children}</RadioGroupPrimitive.Indicator>
|
|
29
|
+
</RadioGroupPrimitive.Item>
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export const InlineRadio = {
|
|
34
|
+
Group: InlineRadioGroup,
|
|
35
|
+
Item: InlineRadioItem,
|
|
36
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
+
|
|
3
|
+
import { Input } from '.';
|
|
4
|
+
|
|
5
|
+
const meta: Meta<typeof Input> = {
|
|
6
|
+
title: 'Components/Input',
|
|
7
|
+
component: Input,
|
|
8
|
+
argTypes: {},
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export default meta;
|
|
12
|
+
|
|
13
|
+
type Story = StoryObj<typeof Input>;
|
|
14
|
+
|
|
15
|
+
export const Default: Story = {
|
|
16
|
+
args: {
|
|
17
|
+
placeholder: 'type something',
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { Input } from './input';
|