@shipfox/react-ui 0.4.0 → 0.6.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/.storybook/main.ts +20 -10
- package/.storybook/preview.tsx +11 -0
- package/.storybook/vitest.setup.ts +4 -0
- package/.turbo/turbo-build.log +16 -3
- package/.turbo/turbo-check.log +2 -2
- package/.turbo/turbo-type.log +1 -1
- package/CHANGELOG.md +15 -0
- package/README.md +56 -1
- package/argos.config.ts +33 -0
- package/dist/build-css-entry.js +5 -0
- package/dist/build-css-entry.js.map +1 -0
- package/dist/components/button/button-link.d.ts +14 -0
- package/dist/components/button/button-link.d.ts.map +1 -0
- package/dist/components/button/button-link.js +63 -0
- package/dist/components/button/button-link.js.map +1 -0
- package/dist/components/button/button-link.stories.js +127 -0
- package/dist/components/button/button-link.stories.js.map +1 -0
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +7 -6
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/button/button.stories.js +1 -13
- package/dist/components/button/button.stories.js.map +1 -1
- package/dist/components/button/icon-button.d.ts +14 -0
- package/dist/components/button/icon-button.d.ts.map +1 -0
- package/dist/components/button/icon-button.js +53 -0
- package/dist/components/button/icon-button.js.map +1 -0
- package/dist/components/button/icon-button.stories.js +254 -0
- package/dist/components/button/icon-button.stories.js.map +1 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.d.ts.map +1 -1
- package/dist/components/button/index.js +2 -0
- package/dist/components/button/index.js.map +1 -1
- package/dist/components/code-block/code-block-footer.d.ts.map +1 -1
- package/dist/components/code-block/code-block-footer.js +29 -15
- package/dist/components/code-block/code-block-footer.js.map +1 -1
- package/dist/components/code-block/code-content.d.ts.map +1 -1
- package/dist/components/code-block/code-content.js +2 -2
- package/dist/components/code-block/code-content.js.map +1 -1
- package/dist/components/dynamic-item/dynamic-item.stories.js +1 -1
- package/dist/components/dynamic-item/dynamic-item.stories.js.map +1 -1
- package/dist/components/icon/icon.d.ts +3 -0
- package/dist/components/icon/icon.d.ts.map +1 -1
- package/dist/components/icon/icon.js +5 -2
- package/dist/components/icon/icon.js.map +1 -1
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.d.ts.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index.js.map +1 -1
- package/dist/components/modal/index.d.ts +3 -0
- package/dist/components/modal/index.d.ts.map +1 -0
- package/dist/components/modal/index.js +3 -0
- package/dist/components/modal/index.js.map +1 -0
- package/dist/components/modal/modal.d.ts +37 -0
- package/dist/components/modal/modal.d.ts.map +1 -0
- package/dist/components/modal/modal.js +262 -0
- package/dist/components/modal/modal.js.map +1 -0
- package/dist/components/modal/modal.stories.js +497 -0
- package/dist/components/modal/modal.stories.js.map +1 -0
- package/dist/components/moving-border/index.d.ts +2 -0
- package/dist/components/moving-border/index.d.ts.map +1 -0
- package/dist/components/moving-border/index.js +3 -0
- package/dist/components/moving-border/index.js.map +1 -0
- package/dist/components/typography/text.d.ts.map +1 -1
- package/dist/components/typography/text.js +1 -1
- package/dist/components/typography/text.js.map +1 -1
- package/dist/hooks/index.d.ts +1 -0
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/index.js +1 -0
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/useMediaQuery.d.ts +2 -0
- package/dist/hooks/useMediaQuery.d.ts.map +1 -0
- package/dist/hooks/useMediaQuery.js +74 -0
- package/dist/hooks/useMediaQuery.js.map +1 -0
- package/dist/onboarding/sign-in.stories.js +93 -0
- package/dist/onboarding/sign-in.stories.js.map +1 -0
- package/dist/styles.css +1 -0
- package/index.css +30 -4
- package/package.json +19 -7
- package/src/build-css-entry.ts +3 -0
- package/src/components/button/button-link.stories.tsx +86 -0
- package/src/components/button/button-link.tsx +76 -0
- package/src/components/button/button.stories.tsx +1 -7
- package/src/components/button/button.tsx +8 -6
- package/src/components/button/icon-button.stories.tsx +182 -0
- package/src/components/button/icon-button.tsx +69 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/code-block/code-block-footer.tsx +37 -30
- package/src/components/code-block/code-content.tsx +5 -2
- package/src/components/dynamic-item/dynamic-item.stories.tsx +1 -1
- package/src/components/icon/icon.tsx +6 -0
- package/src/components/index.ts +1 -0
- package/src/components/modal/index.ts +23 -0
- package/src/components/modal/modal.stories.tsx +384 -0
- package/src/components/modal/modal.tsx +309 -0
- package/src/components/moving-border/index.ts +1 -0
- package/src/components/typography/text.tsx +9 -1
- package/src/hooks/index.ts +1 -0
- package/src/hooks/useMediaQuery.ts +87 -0
- package/src/onboarding/sign-in.stories.tsx +73 -0
- package/tsconfig.build.json +7 -1
- package/vite.css.config.ts +30 -0
- package/vitest.config.ts +30 -3
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Slot } from '@radix-ui/react-slot';
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { Icon } from '../../components/icon/index.js';
|
|
5
|
+
import { cn } from '../../utils/cn.js';
|
|
6
|
+
export const iconButtonVariants = cva('inline-flex items-center justify-center whitespace-nowrap transition-colors disabled:pointer-events-none shrink-0 outline-none', {
|
|
7
|
+
variants: {
|
|
8
|
+
variant: {
|
|
9
|
+
primary: 'bg-background-button-inverted-default text-tag-neutral-icon shadow-button-inverted hover:bg-background-button-inverted-hover active:bg-background-button-inverted-pressed focus-visible:shadow-button-inverted-focus disabled:bg-background-neutral-disabled disabled:text-foreground-neutral-disabled disabled:shadow-none',
|
|
10
|
+
transparent: 'bg-background-button-transparent-default text-tag-neutral-icon hover:bg-background-button-transparent-hover active:bg-background-button-transparent-pressed focus-visible:shadow-button-neutral-focus disabled:text-foreground-neutral-disabled'
|
|
11
|
+
},
|
|
12
|
+
size: {
|
|
13
|
+
'2xs': 'w-20 h-20 text-xs',
|
|
14
|
+
xs: 'w-24 h-24 text-xs',
|
|
15
|
+
sm: 'w-28 h-28 text-sm',
|
|
16
|
+
md: 'w-32 h-32 text-md',
|
|
17
|
+
lg: 'w-36 h-36 text-lg',
|
|
18
|
+
xl: 'w-40 h-40 text-xl'
|
|
19
|
+
},
|
|
20
|
+
radius: {
|
|
21
|
+
rounded: 'rounded-6',
|
|
22
|
+
full: 'rounded-full'
|
|
23
|
+
},
|
|
24
|
+
muted: {
|
|
25
|
+
true: 'opacity-60',
|
|
26
|
+
false: ''
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
defaultVariants: {
|
|
30
|
+
variant: 'primary',
|
|
31
|
+
size: 'md',
|
|
32
|
+
radius: 'rounded',
|
|
33
|
+
muted: false
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
export function IconButton({ className, variant, size, radius, muted, asChild = false, children, icon, ...props }) {
|
|
37
|
+
const Comp = asChild ? Slot : 'button';
|
|
38
|
+
return /*#__PURE__*/ _jsx(Comp, {
|
|
39
|
+
"data-slot": "icon-button",
|
|
40
|
+
className: cn(iconButtonVariants({
|
|
41
|
+
variant,
|
|
42
|
+
size,
|
|
43
|
+
radius,
|
|
44
|
+
muted
|
|
45
|
+
}), className),
|
|
46
|
+
...props,
|
|
47
|
+
children: icon ? /*#__PURE__*/ _jsx(Icon, {
|
|
48
|
+
name: icon
|
|
49
|
+
}) : children
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
//# sourceMappingURL=icon-button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/button/icon-button.tsx"],"sourcesContent":["import {Slot} from '@radix-ui/react-slot';\nimport {cva, type VariantProps} from 'class-variance-authority';\nimport {Icon, type IconName} from 'components/icon';\nimport type {ComponentProps} from 'react';\nimport {cn} from 'utils/cn';\n\nexport const iconButtonVariants = cva(\n 'inline-flex items-center justify-center whitespace-nowrap transition-colors disabled:pointer-events-none shrink-0 outline-none',\n {\n variants: {\n variant: {\n primary:\n 'bg-background-button-inverted-default text-tag-neutral-icon shadow-button-inverted hover:bg-background-button-inverted-hover active:bg-background-button-inverted-pressed focus-visible:shadow-button-inverted-focus disabled:bg-background-neutral-disabled disabled:text-foreground-neutral-disabled disabled:shadow-none',\n transparent:\n 'bg-background-button-transparent-default text-tag-neutral-icon hover:bg-background-button-transparent-hover active:bg-background-button-transparent-pressed focus-visible:shadow-button-neutral-focus disabled:text-foreground-neutral-disabled',\n },\n size: {\n '2xs': 'w-20 h-20 text-xs',\n xs: 'w-24 h-24 text-xs',\n sm: 'w-28 h-28 text-sm',\n md: 'w-32 h-32 text-md',\n lg: 'w-36 h-36 text-lg',\n xl: 'w-40 h-40 text-xl',\n },\n radius: {\n rounded: 'rounded-6',\n full: 'rounded-full',\n },\n muted: {\n true: 'opacity-60',\n false: '',\n },\n },\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n radius: 'rounded',\n muted: false,\n },\n },\n);\n\nexport function IconButton({\n className,\n variant,\n size,\n radius,\n muted,\n asChild = false,\n children,\n icon,\n ...props\n}: ComponentProps<'button'> &\n VariantProps<typeof iconButtonVariants> & {\n asChild?: boolean;\n icon?: IconName;\n }) {\n const Comp = asChild ? Slot : 'button';\n\n return (\n <Comp\n data-slot=\"icon-button\"\n className={cn(iconButtonVariants({variant, size, radius, muted}), className)}\n {...props}\n >\n {icon ? <Icon name={icon} /> : children}\n </Comp>\n );\n}\n"],"names":["Slot","cva","Icon","cn","iconButtonVariants","variants","variant","primary","transparent","size","xs","sm","md","lg","xl","radius","rounded","full","muted","true","false","defaultVariants","IconButton","className","asChild","children","icon","props","Comp","data-slot","name"],"mappings":";AAAA,SAAQA,IAAI,QAAO,uBAAuB;AAC1C,SAAQC,GAAG,QAA0B,2BAA2B;AAChE,SAAQC,IAAI,QAAsB,kBAAkB;AAEpD,SAAQC,EAAE,QAAO,WAAW;AAE5B,OAAO,MAAMC,qBAAqBH,IAChC,kIACA;IACEI,UAAU;QACRC,SAAS;YACPC,SACE;YACFC,aACE;QACJ;QACAC,MAAM;YACJ,OAAO;YACPC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJC,IAAI;QACN;QACAC,QAAQ;YACNC,SAAS;YACTC,MAAM;QACR;QACAC,OAAO;YACLC,MAAM;YACNC,OAAO;QACT;IACF;IACAC,iBAAiB;QACff,SAAS;QACTG,MAAM;QACNM,QAAQ;QACRG,OAAO;IACT;AACF,GACA;AAEF,OAAO,SAASI,WAAW,EACzBC,SAAS,EACTjB,OAAO,EACPG,IAAI,EACJM,MAAM,EACNG,KAAK,EACLM,UAAU,KAAK,EACfC,QAAQ,EACRC,IAAI,EACJ,GAAGC,OAKF;IACD,MAAMC,OAAOJ,UAAUxB,OAAO;IAE9B,qBACE,KAAC4B;QACCC,aAAU;QACVN,WAAWpB,GAAGC,mBAAmB;YAACE;YAASG;YAAMM;YAAQG;QAAK,IAAIK;QACjE,GAAGI,KAAK;kBAERD,qBAAO,KAACxB;YAAK4B,MAAMJ;aAAWD;;AAGrC"}
|
|
@@ -0,0 +1,254 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createElement as _createElement } from "react";
|
|
3
|
+
import { Code } from '../../components/typography/index.js';
|
|
4
|
+
import { IconButton } from './icon-button.js';
|
|
5
|
+
const variantOptions = [
|
|
6
|
+
'primary',
|
|
7
|
+
'transparent'
|
|
8
|
+
];
|
|
9
|
+
const sizeOptions = [
|
|
10
|
+
'2xs',
|
|
11
|
+
'xs',
|
|
12
|
+
'sm',
|
|
13
|
+
'md',
|
|
14
|
+
'lg',
|
|
15
|
+
'xl'
|
|
16
|
+
];
|
|
17
|
+
const radiusOptions = [
|
|
18
|
+
'rounded',
|
|
19
|
+
'full'
|
|
20
|
+
];
|
|
21
|
+
const meta = {
|
|
22
|
+
title: 'Components/Button/IconButton',
|
|
23
|
+
component: IconButton,
|
|
24
|
+
tags: [
|
|
25
|
+
'autodocs'
|
|
26
|
+
],
|
|
27
|
+
argTypes: {
|
|
28
|
+
variant: {
|
|
29
|
+
control: 'select',
|
|
30
|
+
options: variantOptions
|
|
31
|
+
},
|
|
32
|
+
size: {
|
|
33
|
+
control: 'select',
|
|
34
|
+
options: sizeOptions
|
|
35
|
+
},
|
|
36
|
+
radius: {
|
|
37
|
+
control: 'select',
|
|
38
|
+
options: radiusOptions
|
|
39
|
+
},
|
|
40
|
+
muted: {
|
|
41
|
+
control: 'boolean'
|
|
42
|
+
},
|
|
43
|
+
asChild: {
|
|
44
|
+
control: 'boolean'
|
|
45
|
+
}
|
|
46
|
+
},
|
|
47
|
+
args: {
|
|
48
|
+
icon: 'addLine',
|
|
49
|
+
variant: 'primary',
|
|
50
|
+
size: 'md',
|
|
51
|
+
radius: 'rounded',
|
|
52
|
+
muted: false
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
export default meta;
|
|
56
|
+
export const Default = {};
|
|
57
|
+
export const Variants = {
|
|
58
|
+
render: (args)=>/*#__PURE__*/ _jsx("div", {
|
|
59
|
+
className: "flex flex-col gap-32",
|
|
60
|
+
children: sizeOptions.map((size)=>/*#__PURE__*/ _jsxs("div", {
|
|
61
|
+
className: "flex flex-col gap-16",
|
|
62
|
+
children: [
|
|
63
|
+
/*#__PURE__*/ _jsxs(Code, {
|
|
64
|
+
variant: "label",
|
|
65
|
+
className: "text-foreground-neutral-subtle",
|
|
66
|
+
children: [
|
|
67
|
+
"Size: ",
|
|
68
|
+
size
|
|
69
|
+
]
|
|
70
|
+
}),
|
|
71
|
+
radiusOptions.map((radius)=>/*#__PURE__*/ _jsxs("table", {
|
|
72
|
+
className: "w-fit border-separate border-spacing-x-32 border-spacing-y-16",
|
|
73
|
+
children: [
|
|
74
|
+
/*#__PURE__*/ _jsx("thead", {
|
|
75
|
+
children: /*#__PURE__*/ _jsxs("tr", {
|
|
76
|
+
children: [
|
|
77
|
+
/*#__PURE__*/ _jsx("th", {
|
|
78
|
+
children: radius
|
|
79
|
+
}),
|
|
80
|
+
/*#__PURE__*/ _jsx("th", {
|
|
81
|
+
children: "Default"
|
|
82
|
+
}),
|
|
83
|
+
/*#__PURE__*/ _jsx("th", {
|
|
84
|
+
children: "Hover"
|
|
85
|
+
}),
|
|
86
|
+
/*#__PURE__*/ _jsx("th", {
|
|
87
|
+
children: "Focus"
|
|
88
|
+
}),
|
|
89
|
+
/*#__PURE__*/ _jsx("th", {
|
|
90
|
+
children: "Disabled"
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
})
|
|
94
|
+
}),
|
|
95
|
+
/*#__PURE__*/ _jsx("tbody", {
|
|
96
|
+
children: variantOptions.map((variant)=>/*#__PURE__*/ _jsxs("tr", {
|
|
97
|
+
children: [
|
|
98
|
+
/*#__PURE__*/ _jsx("td", {
|
|
99
|
+
children: /*#__PURE__*/ _jsx(Code, {
|
|
100
|
+
variant: "label",
|
|
101
|
+
className: "text-foreground-neutral-subtle",
|
|
102
|
+
children: variant
|
|
103
|
+
})
|
|
104
|
+
}),
|
|
105
|
+
/*#__PURE__*/ _jsx("td", {
|
|
106
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
107
|
+
...args,
|
|
108
|
+
icon: "addLine",
|
|
109
|
+
"aria-label": "Add",
|
|
110
|
+
variant: variant,
|
|
111
|
+
size: size,
|
|
112
|
+
radius: radius
|
|
113
|
+
})
|
|
114
|
+
}),
|
|
115
|
+
/*#__PURE__*/ _jsx("td", {
|
|
116
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
117
|
+
...args,
|
|
118
|
+
icon: "addLine",
|
|
119
|
+
"aria-label": "Add",
|
|
120
|
+
variant: variant,
|
|
121
|
+
className: "hover",
|
|
122
|
+
size: size,
|
|
123
|
+
radius: radius
|
|
124
|
+
})
|
|
125
|
+
}),
|
|
126
|
+
/*#__PURE__*/ _jsx("td", {
|
|
127
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
128
|
+
...args,
|
|
129
|
+
icon: "addLine",
|
|
130
|
+
"aria-label": "Add",
|
|
131
|
+
variant: variant,
|
|
132
|
+
className: "focus",
|
|
133
|
+
size: size,
|
|
134
|
+
radius: radius
|
|
135
|
+
})
|
|
136
|
+
}),
|
|
137
|
+
/*#__PURE__*/ _jsx("td", {
|
|
138
|
+
children: /*#__PURE__*/ _jsx(IconButton, {
|
|
139
|
+
...args,
|
|
140
|
+
icon: "addLine",
|
|
141
|
+
"aria-label": "Add",
|
|
142
|
+
variant: variant,
|
|
143
|
+
disabled: true,
|
|
144
|
+
size: size,
|
|
145
|
+
radius: radius
|
|
146
|
+
})
|
|
147
|
+
})
|
|
148
|
+
]
|
|
149
|
+
}, variant))
|
|
150
|
+
})
|
|
151
|
+
]
|
|
152
|
+
}, radius))
|
|
153
|
+
]
|
|
154
|
+
}, size))
|
|
155
|
+
})
|
|
156
|
+
};
|
|
157
|
+
Variants.parameters = {
|
|
158
|
+
pseudo: {
|
|
159
|
+
hover: '.hover',
|
|
160
|
+
focusVisible: '.focus'
|
|
161
|
+
}
|
|
162
|
+
};
|
|
163
|
+
export const Muted = {
|
|
164
|
+
render: (args)=>/*#__PURE__*/ _jsxs("div", {
|
|
165
|
+
className: "flex flex-col gap-16",
|
|
166
|
+
children: [
|
|
167
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
168
|
+
className: "flex gap-16 items-center",
|
|
169
|
+
children: [
|
|
170
|
+
/*#__PURE__*/ _jsx(Code, {
|
|
171
|
+
variant: "label",
|
|
172
|
+
children: "Normal:"
|
|
173
|
+
}),
|
|
174
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
175
|
+
...args,
|
|
176
|
+
icon: "addLine",
|
|
177
|
+
"aria-label": "Add"
|
|
178
|
+
}),
|
|
179
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
180
|
+
...args,
|
|
181
|
+
icon: "addLine",
|
|
182
|
+
"aria-label": "Add",
|
|
183
|
+
variant: "transparent"
|
|
184
|
+
})
|
|
185
|
+
]
|
|
186
|
+
}),
|
|
187
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
188
|
+
className: "flex gap-16 items-center",
|
|
189
|
+
children: [
|
|
190
|
+
/*#__PURE__*/ _jsx(Code, {
|
|
191
|
+
variant: "label",
|
|
192
|
+
children: "Muted:"
|
|
193
|
+
}),
|
|
194
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
195
|
+
...args,
|
|
196
|
+
icon: "addLine",
|
|
197
|
+
"aria-label": "Add",
|
|
198
|
+
muted: true
|
|
199
|
+
}),
|
|
200
|
+
/*#__PURE__*/ _jsx(IconButton, {
|
|
201
|
+
...args,
|
|
202
|
+
icon: "addLine",
|
|
203
|
+
"aria-label": "Add",
|
|
204
|
+
variant: "transparent",
|
|
205
|
+
muted: true
|
|
206
|
+
})
|
|
207
|
+
]
|
|
208
|
+
})
|
|
209
|
+
]
|
|
210
|
+
})
|
|
211
|
+
};
|
|
212
|
+
export const Sizes = {
|
|
213
|
+
render: ({ children: _children, ...args })=>/*#__PURE__*/ _jsxs("div", {
|
|
214
|
+
className: "flex flex-col gap-16",
|
|
215
|
+
children: [
|
|
216
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
217
|
+
className: "flex gap-16 items-center",
|
|
218
|
+
children: [
|
|
219
|
+
/*#__PURE__*/ _jsx(Code, {
|
|
220
|
+
variant: "label",
|
|
221
|
+
children: "Rounded:"
|
|
222
|
+
}),
|
|
223
|
+
sizeOptions.map((size)=>/*#__PURE__*/ _createElement(IconButton, {
|
|
224
|
+
...args,
|
|
225
|
+
key: size,
|
|
226
|
+
icon: "addLine",
|
|
227
|
+
"aria-label": "Add",
|
|
228
|
+
size: size,
|
|
229
|
+
radius: "rounded"
|
|
230
|
+
}))
|
|
231
|
+
]
|
|
232
|
+
}),
|
|
233
|
+
/*#__PURE__*/ _jsxs("div", {
|
|
234
|
+
className: "flex gap-16 items-center",
|
|
235
|
+
children: [
|
|
236
|
+
/*#__PURE__*/ _jsx(Code, {
|
|
237
|
+
variant: "label",
|
|
238
|
+
children: "Full:"
|
|
239
|
+
}),
|
|
240
|
+
sizeOptions.map((size)=>/*#__PURE__*/ _createElement(IconButton, {
|
|
241
|
+
...args,
|
|
242
|
+
key: size,
|
|
243
|
+
icon: "addLine",
|
|
244
|
+
"aria-label": "Add",
|
|
245
|
+
size: size,
|
|
246
|
+
radius: "full"
|
|
247
|
+
}))
|
|
248
|
+
]
|
|
249
|
+
})
|
|
250
|
+
]
|
|
251
|
+
})
|
|
252
|
+
};
|
|
253
|
+
|
|
254
|
+
//# sourceMappingURL=icon-button.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/button/icon-button.stories.tsx"],"sourcesContent":["import type {Meta, StoryObj} from '@storybook/react';\nimport {Code} from 'components/typography';\nimport {IconButton} from './icon-button';\n\nconst variantOptions = ['primary', 'transparent'] as const;\nconst sizeOptions = ['2xs', 'xs', 'sm', 'md', 'lg', 'xl'] as const;\nconst radiusOptions = ['rounded', 'full'] as const;\n\nconst meta = {\n title: 'Components/Button/IconButton',\n component: IconButton,\n tags: ['autodocs'],\n argTypes: {\n variant: {\n control: 'select',\n options: variantOptions,\n },\n size: {\n control: 'select',\n options: sizeOptions,\n },\n radius: {\n control: 'select',\n options: radiusOptions,\n },\n muted: {control: 'boolean'},\n asChild: {control: 'boolean'},\n },\n args: {\n icon: 'addLine',\n variant: 'primary',\n size: 'md',\n radius: 'rounded',\n muted: false,\n },\n} satisfies Meta<typeof IconButton>;\n\nexport default meta;\ntype Story = StoryObj<typeof meta>;\n\nexport const Default: Story = {};\n\nexport const Variants: Story = {\n render: (args) => (\n <div className=\"flex flex-col gap-32\">\n {sizeOptions.map((size) => (\n <div key={size} className=\"flex flex-col gap-16\">\n <Code variant=\"label\" className=\"text-foreground-neutral-subtle\">\n Size: {size}\n </Code>\n {radiusOptions.map((radius) => (\n <table\n key={radius}\n className=\"w-fit border-separate border-spacing-x-32 border-spacing-y-16\"\n >\n <thead>\n <tr>\n <th>{radius}</th>\n <th>Default</th>\n <th>Hover</th>\n <th>Focus</th>\n <th>Disabled</th>\n </tr>\n </thead>\n <tbody>\n {variantOptions.map((variant) => (\n <tr key={variant}>\n <td>\n <Code variant=\"label\" className=\"text-foreground-neutral-subtle\">\n {variant}\n </Code>\n </td>\n <td>\n <IconButton\n {...args}\n icon=\"addLine\"\n aria-label=\"Add\"\n variant={variant}\n size={size}\n radius={radius}\n />\n </td>\n <td>\n <IconButton\n {...args}\n icon=\"addLine\"\n aria-label=\"Add\"\n variant={variant}\n className=\"hover\"\n size={size}\n radius={radius}\n />\n </td>\n <td>\n <IconButton\n {...args}\n icon=\"addLine\"\n aria-label=\"Add\"\n variant={variant}\n className=\"focus\"\n size={size}\n radius={radius}\n />\n </td>\n <td>\n <IconButton\n {...args}\n icon=\"addLine\"\n aria-label=\"Add\"\n variant={variant}\n disabled\n size={size}\n radius={radius}\n />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n ))}\n </div>\n ))}\n </div>\n ),\n};\n\nVariants.parameters = {\n pseudo: {\n hover: '.hover',\n focusVisible: '.focus',\n },\n};\n\nexport const Muted: Story = {\n render: (args) => (\n <div className=\"flex flex-col gap-16\">\n <div className=\"flex gap-16 items-center\">\n <Code variant=\"label\">Normal:</Code>\n <IconButton {...args} icon=\"addLine\" aria-label=\"Add\" />\n <IconButton {...args} icon=\"addLine\" aria-label=\"Add\" variant=\"transparent\" />\n </div>\n <div className=\"flex gap-16 items-center\">\n <Code variant=\"label\">Muted:</Code>\n <IconButton {...args} icon=\"addLine\" aria-label=\"Add\" muted />\n <IconButton {...args} icon=\"addLine\" aria-label=\"Add\" variant=\"transparent\" muted />\n </div>\n </div>\n ),\n};\n\nexport const Sizes: Story = {\n render: ({children: _children, ...args}) => (\n <div className=\"flex flex-col gap-16\">\n <div className=\"flex gap-16 items-center\">\n <Code variant=\"label\">Rounded:</Code>\n {sizeOptions.map((size) => (\n <IconButton\n {...args}\n key={size}\n icon=\"addLine\"\n aria-label=\"Add\"\n size={size}\n radius=\"rounded\"\n />\n ))}\n </div>\n <div className=\"flex gap-16 items-center\">\n <Code variant=\"label\">Full:</Code>\n {sizeOptions.map((size) => (\n <IconButton\n {...args}\n key={size}\n icon=\"addLine\"\n aria-label=\"Add\"\n size={size}\n radius=\"full\"\n />\n ))}\n </div>\n </div>\n ),\n};\n"],"names":["Code","IconButton","variantOptions","sizeOptions","radiusOptions","meta","title","component","tags","argTypes","variant","control","options","size","radius","muted","asChild","args","icon","Default","Variants","render","div","className","map","table","thead","tr","th","tbody","td","aria-label","disabled","parameters","pseudo","hover","focusVisible","Muted","Sizes","children","_children","key"],"mappings":"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"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/button/index.ts"],"sourcesContent":["export * from './button';\n"],"names":[],"mappings":"AAAA,cAAc,WAAW"}
|
|
1
|
+
{"version":3,"sources":["../../../src/components/button/index.ts"],"sourcesContent":["export * from './button';\nexport * from './button-link';\nexport * from './icon-button';\n"],"names":[],"mappings":"AAAA,cAAc,WAAW;AACzB,cAAc,gBAAgB;AAC9B,cAAc,gBAAgB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-block-footer.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/code-block-footer.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"code-block-footer.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/code-block-footer.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAC,cAAc,EAAE,cAAc,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAGrE,MAAM,MAAM,oBAAoB,GAAG,cAAc,CAAC,cAAc,CAAC,GAAG;IAClE,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,SAAS,GAAG,MAAM,CAAC;IAC3B,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,SAAS,CAAC;CAClB,CAAC;AAEF,wBAAgB,eAAe,CAAC,EAC9B,SAAS,EACT,OAAe,EACf,KAAiB,EACjB,OAAO,EACP,WAAW,EACX,IAAI,EACJ,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,oBAAoB,2CA0CtB;AAED,MAAM,MAAM,wBAAwB,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAC7D,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,mBAAmB,CAAC,EAClC,SAAS,EACT,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,wBAAwB,2CAY1B;AAED,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAChE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,2BAA2B,2CAY7B;AAED,MAAM,MAAM,2BAA2B,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IAChE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,sBAAsB,CAAC,EACrC,SAAS,EACT,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,2BAA2B,2CAuB7B;AAED,MAAM,MAAM,+BAA+B,GAAG,cAAc,CAAC,KAAK,CAAC,GAAG;IACpE,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,wBAAgB,0BAA0B,CAAC,EACzC,SAAS,EACT,OAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,EAAE,+BAA+B,2CAuBjC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Slot } from '@radix-ui/react-slot';
|
|
3
3
|
import { Icon } from '../../components/icon/icon.js';
|
|
4
|
+
import { Text } from '../../components/typography/index.js';
|
|
4
5
|
import { cn } from '../../utils/cn.js';
|
|
5
6
|
export function CodeBlockFooter({ className, asChild = false, state = 'running', message, description, icon, children, ...props }) {
|
|
6
7
|
const Comp = asChild ? Slot : 'div';
|
|
@@ -26,19 +27,16 @@ export function CodeBlockFooter({ className, asChild = false, state = 'running',
|
|
|
26
27
|
className: cn('flex w-full items-center justify-start gap-12 px-16 py-12', className),
|
|
27
28
|
...props,
|
|
28
29
|
children: [
|
|
29
|
-
/*#__PURE__*/ _jsx(
|
|
30
|
-
className: "
|
|
30
|
+
/*#__PURE__*/ _jsx(CodeBlockFooterIcon, {
|
|
31
|
+
className: "text-tag-success-icon",
|
|
31
32
|
children: defaultIcon
|
|
32
33
|
}),
|
|
33
|
-
(message || description) && /*#__PURE__*/ _jsxs(
|
|
34
|
-
className: "flex flex-col items-start justify-center gap-0",
|
|
34
|
+
(message || description) && /*#__PURE__*/ _jsxs(CodeBlockFooterContent, {
|
|
35
35
|
children: [
|
|
36
|
-
message && /*#__PURE__*/ _jsx(
|
|
37
|
-
className: "overflow-hidden text-ellipsis whitespace-nowrap text-xs leading-20 text-foreground-neutral-base",
|
|
36
|
+
message && /*#__PURE__*/ _jsx(CodeBlockFooterMessage, {
|
|
38
37
|
children: message
|
|
39
38
|
}),
|
|
40
|
-
description && /*#__PURE__*/ _jsx(
|
|
41
|
-
className: "overflow-hidden text-ellipsis whitespace-nowrap text-xs leading-20 text-foreground-neutral-subtle",
|
|
39
|
+
description && /*#__PURE__*/ _jsx(CodeBlockFooterDescription, {
|
|
42
40
|
children: description
|
|
43
41
|
})
|
|
44
42
|
]
|
|
@@ -59,25 +57,41 @@ export function CodeBlockFooterContent({ className, asChild = false, children, .
|
|
|
59
57
|
const Comp = asChild ? Slot : 'div';
|
|
60
58
|
return /*#__PURE__*/ _jsx(Comp, {
|
|
61
59
|
"data-slot": "code-block-footer-content",
|
|
62
|
-
className: cn('flex flex-col items-start justify-center gap-0', className),
|
|
60
|
+
className: cn('flex flex-col items-start justify-center gap-0 min-w-0 flex-1', className),
|
|
63
61
|
...props,
|
|
64
62
|
children: children
|
|
65
63
|
});
|
|
66
64
|
}
|
|
67
65
|
export function CodeBlockFooterMessage({ className, asChild = false, children, ...props }) {
|
|
68
|
-
|
|
69
|
-
|
|
66
|
+
if (asChild) {
|
|
67
|
+
return /*#__PURE__*/ _jsx(Slot, {
|
|
68
|
+
"data-slot": "code-block-footer-message",
|
|
69
|
+
className: cn('overflow-hidden text-ellipsis whitespace-nowrap text-xs', className),
|
|
70
|
+
...props,
|
|
71
|
+
children: children
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
return /*#__PURE__*/ _jsx(Text, {
|
|
70
75
|
"data-slot": "code-block-footer-message",
|
|
71
|
-
|
|
76
|
+
size: "xs",
|
|
77
|
+
className: cn('overflow-hidden text-ellipsis whitespace-nowrap', className),
|
|
72
78
|
...props,
|
|
73
79
|
children: children
|
|
74
80
|
});
|
|
75
81
|
}
|
|
76
82
|
export function CodeBlockFooterDescription({ className, asChild = false, children, ...props }) {
|
|
77
|
-
|
|
78
|
-
|
|
83
|
+
if (asChild) {
|
|
84
|
+
return /*#__PURE__*/ _jsx(Slot, {
|
|
85
|
+
"data-slot": "code-block-footer-description",
|
|
86
|
+
className: cn('text-xs text-foreground-neutral-subtle', className),
|
|
87
|
+
...props,
|
|
88
|
+
children: children
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
return /*#__PURE__*/ _jsx(Text, {
|
|
79
92
|
"data-slot": "code-block-footer-description",
|
|
80
|
-
|
|
93
|
+
size: "xs",
|
|
94
|
+
className: cn('text-foreground-neutral-subtle', className),
|
|
81
95
|
...props,
|
|
82
96
|
children: children
|
|
83
97
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/code-block/code-block-footer.tsx"],"sourcesContent":["import {Slot} from '@radix-ui/react-slot';\nimport {Icon} from 'components/icon/icon';\nimport type {ComponentProps, HTMLAttributes, ReactNode} from 'react';\nimport {cn} from 'utils/cn';\n\nexport type CodeBlockFooterProps = HTMLAttributes<HTMLDivElement> & {\n asChild?: boolean;\n state?: 'running' | 'done';\n message?: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n};\n\nexport function CodeBlockFooter({\n className,\n asChild = false,\n state = 'running',\n message,\n description,\n icon,\n children,\n ...props\n}: CodeBlockFooterProps) {\n const Comp = asChild ? Slot : 'div';\n\n const defaultIcon =\n icon ??\n (state === 'running' ? (\n <Icon name=\"shipfox\" className=\"size-20\" aria-hidden=\"true\" />\n ) : (\n <Icon\n name=\"checkCircleSolid\"\n className=\"size-20 text-foreground-neutral-base\"\n aria-hidden=\"true\"\n />\n ));\n\n if (asChild || children) {\n return (\n <Comp\n data-slot=\"code-block-footer\"\n className={cn('flex w-full items-center justify-start gap-12 px-16 py-12', className)}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n\n return (\n <Comp\n data-slot=\"code-block-footer\"\n className={cn('flex w-full items-center justify-start gap-12 px-16 py-12', className)}\n {...props}\n >\n <
|
|
1
|
+
{"version":3,"sources":["../../../src/components/code-block/code-block-footer.tsx"],"sourcesContent":["import {Slot} from '@radix-ui/react-slot';\nimport {Icon} from 'components/icon/icon';\nimport {Text} from 'components/typography';\nimport type {ComponentProps, HTMLAttributes, ReactNode} from 'react';\nimport {cn} from 'utils/cn';\n\nexport type CodeBlockFooterProps = HTMLAttributes<HTMLDivElement> & {\n asChild?: boolean;\n state?: 'running' | 'done';\n message?: ReactNode;\n description?: ReactNode;\n icon?: ReactNode;\n};\n\nexport function CodeBlockFooter({\n className,\n asChild = false,\n state = 'running',\n message,\n description,\n icon,\n children,\n ...props\n}: CodeBlockFooterProps) {\n const Comp = asChild ? Slot : 'div';\n\n const defaultIcon =\n icon ??\n (state === 'running' ? (\n <Icon name=\"shipfox\" className=\"size-20\" aria-hidden=\"true\" />\n ) : (\n <Icon\n name=\"checkCircleSolid\"\n className=\"size-20 text-foreground-neutral-base\"\n aria-hidden=\"true\"\n />\n ));\n\n if (asChild || children) {\n return (\n <Comp\n data-slot=\"code-block-footer\"\n className={cn('flex w-full items-center justify-start gap-12 px-16 py-12', className)}\n {...props}\n >\n {children}\n </Comp>\n );\n }\n\n return (\n <Comp\n data-slot=\"code-block-footer\"\n className={cn('flex w-full items-center justify-start gap-12 px-16 py-12', className)}\n {...props}\n >\n <CodeBlockFooterIcon className=\"text-tag-success-icon\">{defaultIcon}</CodeBlockFooterIcon>\n {(message || description) && (\n <CodeBlockFooterContent>\n {message && <CodeBlockFooterMessage>{message}</CodeBlockFooterMessage>}\n {description && <CodeBlockFooterDescription>{description}</CodeBlockFooterDescription>}\n </CodeBlockFooterContent>\n )}\n </Comp>\n );\n}\n\nexport type CodeBlockFooterIconProps = ComponentProps<'div'> & {\n asChild?: boolean;\n};\n\nexport function CodeBlockFooterIcon({\n className,\n asChild = false,\n children,\n ...props\n}: CodeBlockFooterIconProps) {\n const Comp = asChild ? Slot : 'div';\n\n return (\n <Comp\n data-slot=\"code-block-footer-icon\"\n className={cn('flex shrink-0 items-center justify-center size-20', className)}\n {...props}\n >\n {children}\n </Comp>\n );\n}\n\nexport type CodeBlockFooterContentProps = ComponentProps<'div'> & {\n asChild?: boolean;\n};\n\nexport function CodeBlockFooterContent({\n className,\n asChild = false,\n children,\n ...props\n}: CodeBlockFooterContentProps) {\n const Comp = asChild ? Slot : 'div';\n\n return (\n <Comp\n data-slot=\"code-block-footer-content\"\n className={cn('flex flex-col items-start justify-center gap-0 min-w-0 flex-1', className)}\n {...props}\n >\n {children}\n </Comp>\n );\n}\n\nexport type CodeBlockFooterMessageProps = ComponentProps<'div'> & {\n asChild?: boolean;\n};\n\nexport function CodeBlockFooterMessage({\n className,\n asChild = false,\n children,\n ...props\n}: CodeBlockFooterMessageProps) {\n if (asChild) {\n return (\n <Slot\n data-slot=\"code-block-footer-message\"\n className={cn('overflow-hidden text-ellipsis whitespace-nowrap text-xs', className)}\n {...props}\n >\n {children}\n </Slot>\n );\n }\n\n return (\n <Text\n data-slot=\"code-block-footer-message\"\n size=\"xs\"\n className={cn('overflow-hidden text-ellipsis whitespace-nowrap', className)}\n {...props}\n >\n {children}\n </Text>\n );\n}\n\nexport type CodeBlockFooterDescriptionProps = ComponentProps<'div'> & {\n asChild?: boolean;\n};\n\nexport function CodeBlockFooterDescription({\n className,\n asChild = false,\n children,\n ...props\n}: CodeBlockFooterDescriptionProps) {\n if (asChild) {\n return (\n <Slot\n data-slot=\"code-block-footer-description\"\n className={cn('text-xs text-foreground-neutral-subtle', className)}\n {...props}\n >\n {children}\n </Slot>\n );\n }\n\n return (\n <Text\n data-slot=\"code-block-footer-description\"\n size=\"xs\"\n className={cn('text-foreground-neutral-subtle', className)}\n {...props}\n >\n {children}\n </Text>\n );\n}\n"],"names":["Slot","Icon","Text","cn","CodeBlockFooter","className","asChild","state","message","description","icon","children","props","Comp","defaultIcon","name","aria-hidden","data-slot","CodeBlockFooterIcon","CodeBlockFooterContent","CodeBlockFooterMessage","CodeBlockFooterDescription","size"],"mappings":";AAAA,SAAQA,IAAI,QAAO,uBAAuB;AAC1C,SAAQC,IAAI,QAAO,uBAAuB;AAC1C,SAAQC,IAAI,QAAO,wBAAwB;AAE3C,SAAQC,EAAE,QAAO,WAAW;AAU5B,OAAO,SAASC,gBAAgB,EAC9BC,SAAS,EACTC,UAAU,KAAK,EACfC,QAAQ,SAAS,EACjBC,OAAO,EACPC,WAAW,EACXC,IAAI,EACJC,QAAQ,EACR,GAAGC,OACkB;IACrB,MAAMC,OAAOP,UAAUN,OAAO;IAE9B,MAAMc,cACJJ,QACCH,CAAAA,UAAU,0BACT,KAACN;QAAKc,MAAK;QAAUV,WAAU;QAAUW,eAAY;uBAErD,KAACf;QACCc,MAAK;QACLV,WAAU;QACVW,eAAY;MAEhB;IAEF,IAAIV,WAAWK,UAAU;QACvB,qBACE,KAACE;YACCI,aAAU;YACVZ,WAAWF,GAAG,6DAA6DE;YAC1E,GAAGO,KAAK;sBAERD;;IAGP;IAEA,qBACE,MAACE;QACCI,aAAU;QACVZ,WAAWF,GAAG,6DAA6DE;QAC1E,GAAGO,KAAK;;0BAET,KAACM;gBAAoBb,WAAU;0BAAyBS;;YACtDN,CAAAA,WAAWC,WAAU,mBACrB,MAACU;;oBACEX,yBAAW,KAACY;kCAAwBZ;;oBACpCC,6BAAe,KAACY;kCAA4BZ;;;;;;AAKvD;AAMA,OAAO,SAASS,oBAAoB,EAClCb,SAAS,EACTC,UAAU,KAAK,EACfK,QAAQ,EACR,GAAGC,OACsB;IACzB,MAAMC,OAAOP,UAAUN,OAAO;IAE9B,qBACE,KAACa;QACCI,aAAU;QACVZ,WAAWF,GAAG,qDAAqDE;QAClE,GAAGO,KAAK;kBAERD;;AAGP;AAMA,OAAO,SAASQ,uBAAuB,EACrCd,SAAS,EACTC,UAAU,KAAK,EACfK,QAAQ,EACR,GAAGC,OACyB;IAC5B,MAAMC,OAAOP,UAAUN,OAAO;IAE9B,qBACE,KAACa;QACCI,aAAU;QACVZ,WAAWF,GAAG,iEAAiEE;QAC9E,GAAGO,KAAK;kBAERD;;AAGP;AAMA,OAAO,SAASS,uBAAuB,EACrCf,SAAS,EACTC,UAAU,KAAK,EACfK,QAAQ,EACR,GAAGC,OACyB;IAC5B,IAAIN,SAAS;QACX,qBACE,KAACN;YACCiB,aAAU;YACVZ,WAAWF,GAAG,2DAA2DE;YACxE,GAAGO,KAAK;sBAERD;;IAGP;IAEA,qBACE,KAACT;QACCe,aAAU;QACVK,MAAK;QACLjB,WAAWF,GAAG,mDAAmDE;QAChE,GAAGO,KAAK;kBAERD;;AAGP;AAMA,OAAO,SAASU,2BAA2B,EACzChB,SAAS,EACTC,UAAU,KAAK,EACfK,QAAQ,EACR,GAAGC,OAC6B;IAChC,IAAIN,SAAS;QACX,qBACE,KAACN;YACCiB,aAAU;YACVZ,WAAWF,GAAG,0CAA0CE;YACvD,GAAGO,KAAK;sBAERD;;IAGP;IAEA,qBACE,KAACT;QACCe,aAAU;QACVK,MAAK;QACLjB,WAAWF,GAAG,kCAAkCE;QAC/C,GAAGO,KAAK;kBAERD;;AAGP"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"code-content.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/code-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,OAAO,CAAC;AAG1C,KAAK,gBAAgB,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,WAAmB,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"code-content.d.ts","sourceRoot":"","sources":["../../../src/components/code-block/code-content.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,OAAO,CAAC;AAG1C,KAAK,gBAAgB,GAAG,cAAc,CAAC,WAAW,CAAC,GAAG;IACpD,IAAI,EAAE,MAAM,CAAC;IACb,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,SAAS,EAAE,OAAO,CAAC;IACnB,kBAAkB,EAAE,OAAO,CAAC;IAC5B,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAC1B,IAAI,EACJ,eAAe,EACf,SAAS,EACT,kBAAkB,EAClB,WAAmB,EACnB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,gBAAgB,2CA2ClB"}
|
|
@@ -18,10 +18,10 @@ export function CodeContent({ code, highlightedCode, isLoading, syntaxHighlighti
|
|
|
18
18
|
...props,
|
|
19
19
|
children: /*#__PURE__*/ _jsx("code", {
|
|
20
20
|
className: cn('w-full overflow-x-auto bg-transparent font-code text-xs leading-20 text-foreground-neutral-base', 'grid', lineNumbers && '[counter-reset:line] [counter-increment:line_0] [&_.line]:before:content-[counter(line)] [&_.line]:before:inline-block [&_.line]:before:[counter-increment:line] [&_.line]:before:w-16 [&_.line]:before:mr-16 [&_.line]:before:text-xs [&_.line]:before:text-right [&_.line]:before:text-foreground-neutral-subtle [&_.line]:before:font-code [&_.line]:before:select-none'),
|
|
21
|
-
children: lines.map((line)=>/*#__PURE__*/ _jsx("span", {
|
|
21
|
+
children: lines.map((line, index)=>/*#__PURE__*/ _jsx("span", {
|
|
22
22
|
className: "line px-12 w-full relative font-code text-xs leading-20",
|
|
23
23
|
children: line
|
|
24
|
-
}, line))
|
|
24
|
+
}, `${index}-${line}`))
|
|
25
25
|
})
|
|
26
26
|
});
|
|
27
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/code-block/code-content.tsx"],"sourcesContent":["import type {HTMLAttributes} from 'react';\nimport {cn} from 'utils/cn';\n\ntype CodeContentProps = HTMLAttributes<HTMLElement> & {\n code: string;\n highlightedCode?: string;\n isLoading: boolean;\n syntaxHighlighting: boolean;\n lineNumbers?: boolean;\n};\n\nexport function CodeContent({\n code,\n highlightedCode,\n isLoading,\n syntaxHighlighting,\n lineNumbers = false,\n className,\n ...props\n}: CodeContentProps) {\n const shouldShowHighlighted = syntaxHighlighting && !isLoading && highlightedCode;\n\n if (shouldShowHighlighted) {\n return (\n <div\n className={cn(\n 'shiki-override w-full overflow-x-auto font-code [&_pre]:m-0 [&_pre]:p-0 [&_pre]:bg-transparent [&_pre]:font-code [&_code]:font-code [&_code]:bg-transparent [&_code]:text-xs [&_code]:leading-20 [&_code]:text-foreground-neutral-base [&_code]:grid',\n lineNumbers &&\n '[&_code]:[counter-reset:line] [&_code]:[counter-increment:line_0] [&_.line]:before:content-[counter(line)] [&_.line]:before:inline-block [&_.line]:before:[counter-increment:line] [&_.line]:before:w-16 [&_.line]:before:mr-16 [&_.line]:before:text-xs [&_.line]:before:text-right [&_.line]:before:text-foreground-neutral-subtle [&_.line]:before:font-code [&_.line]:before:select-none',\n '[&_.line]:block [&_.line]:px-12 [&_.line]:w-full [&_.line]:relative [&_.line]:font-code [&_.line]:text-xs [&_.line]:leading-20 [&_.line]:min-h-[1.25rem]',\n className,\n )}\n // biome-ignore lint/security/noDangerouslySetInnerHtml: Shiki outputs HTML for syntax highlighting\n dangerouslySetInnerHTML={{__html: highlightedCode}}\n {...props}\n />\n );\n }\n\n const lines = code.split('\\n');\n\n return (\n <pre className={cn('m-0 p-0 bg-transparent font-code', className)} {...props}>\n <code\n className={cn(\n 'w-full overflow-x-auto bg-transparent font-code text-xs leading-20 text-foreground-neutral-base',\n 'grid',\n lineNumbers &&\n '[counter-reset:line] [counter-increment:line_0] [&_.line]:before:content-[counter(line)] [&_.line]:before:inline-block [&_.line]:before:[counter-increment:line] [&_.line]:before:w-16 [&_.line]:before:mr-16 [&_.line]:before:text-xs [&_.line]:before:text-right [&_.line]:before:text-foreground-neutral-subtle [&_.line]:before:font-code [&_.line]:before:select-none',\n )}\n >\n {lines.map((line) => (\n <span
|
|
1
|
+
{"version":3,"sources":["../../../src/components/code-block/code-content.tsx"],"sourcesContent":["import type {HTMLAttributes} from 'react';\nimport {cn} from 'utils/cn';\n\ntype CodeContentProps = HTMLAttributes<HTMLElement> & {\n code: string;\n highlightedCode?: string;\n isLoading: boolean;\n syntaxHighlighting: boolean;\n lineNumbers?: boolean;\n};\n\nexport function CodeContent({\n code,\n highlightedCode,\n isLoading,\n syntaxHighlighting,\n lineNumbers = false,\n className,\n ...props\n}: CodeContentProps) {\n const shouldShowHighlighted = syntaxHighlighting && !isLoading && highlightedCode;\n\n if (shouldShowHighlighted) {\n return (\n <div\n className={cn(\n 'shiki-override w-full overflow-x-auto font-code [&_pre]:m-0 [&_pre]:p-0 [&_pre]:bg-transparent [&_pre]:font-code [&_code]:font-code [&_code]:bg-transparent [&_code]:text-xs [&_code]:leading-20 [&_code]:text-foreground-neutral-base [&_code]:grid',\n lineNumbers &&\n '[&_code]:[counter-reset:line] [&_code]:[counter-increment:line_0] [&_.line]:before:content-[counter(line)] [&_.line]:before:inline-block [&_.line]:before:[counter-increment:line] [&_.line]:before:w-16 [&_.line]:before:mr-16 [&_.line]:before:text-xs [&_.line]:before:text-right [&_.line]:before:text-foreground-neutral-subtle [&_.line]:before:font-code [&_.line]:before:select-none',\n '[&_.line]:block [&_.line]:px-12 [&_.line]:w-full [&_.line]:relative [&_.line]:font-code [&_.line]:text-xs [&_.line]:leading-20 [&_.line]:min-h-[1.25rem]',\n className,\n )}\n // biome-ignore lint/security/noDangerouslySetInnerHtml: Shiki outputs HTML for syntax highlighting\n dangerouslySetInnerHTML={{__html: highlightedCode}}\n {...props}\n />\n );\n }\n\n const lines = code.split('\\n');\n\n return (\n <pre className={cn('m-0 p-0 bg-transparent font-code', className)} {...props}>\n <code\n className={cn(\n 'w-full overflow-x-auto bg-transparent font-code text-xs leading-20 text-foreground-neutral-base',\n 'grid',\n lineNumbers &&\n '[counter-reset:line] [counter-increment:line_0] [&_.line]:before:content-[counter(line)] [&_.line]:before:inline-block [&_.line]:before:[counter-increment:line] [&_.line]:before:w-16 [&_.line]:before:mr-16 [&_.line]:before:text-xs [&_.line]:before:text-right [&_.line]:before:text-foreground-neutral-subtle [&_.line]:before:font-code [&_.line]:before:select-none',\n )}\n >\n {lines.map((line, index) => (\n <span\n className=\"line px-12 w-full relative font-code text-xs leading-20\"\n key={`${index}-${line}`}\n >\n {line}\n </span>\n ))}\n </code>\n </pre>\n );\n}\n"],"names":["cn","CodeContent","code","highlightedCode","isLoading","syntaxHighlighting","lineNumbers","className","props","shouldShowHighlighted","div","dangerouslySetInnerHTML","__html","lines","split","pre","map","line","index","span"],"mappings":";AACA,SAAQA,EAAE,QAAO,WAAW;AAU5B,OAAO,SAASC,YAAY,EAC1BC,IAAI,EACJC,eAAe,EACfC,SAAS,EACTC,kBAAkB,EAClBC,cAAc,KAAK,EACnBC,SAAS,EACT,GAAGC,OACc;IACjB,MAAMC,wBAAwBJ,sBAAsB,CAACD,aAAaD;IAElE,IAAIM,uBAAuB;QACzB,qBACE,KAACC;YACCH,WAAWP,GACT,wPACAM,eACE,gYACF,4JACAC;YAEF,mGAAmG;YACnGI,yBAAyB;gBAACC,QAAQT;YAAe;YAChD,GAAGK,KAAK;;IAGf;IAEA,MAAMK,QAAQX,KAAKY,KAAK,CAAC;IAEzB,qBACE,KAACC;QAAIR,WAAWP,GAAG,oCAAoCO;QAAa,GAAGC,KAAK;kBAC1E,cAAA,KAACN;YACCK,WAAWP,GACT,mGACA,QACAM,eACE;sBAGHO,MAAMG,GAAG,CAAC,CAACC,MAAMC,sBAChB,KAACC;oBACCZ,WAAU;8BAGTU;mBAFI,GAAGC,MAAM,CAAC,EAAED,MAAM;;;AAQnC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Button } from '../../components/button/button.js';
|
|
3
3
|
import { ItemTitle } from '../../components/item/index.js';
|
|
4
|
+
import { MovingBorder } from '../../components/moving-border/index.js';
|
|
4
5
|
import { cn } from '../../utils/cn.js';
|
|
5
6
|
import illustration1 from '../../assets/illustration-1.svg';
|
|
6
7
|
import illustration2 from '../../assets/illustration-2.svg';
|
|
@@ -8,7 +9,6 @@ import illustrationBg from '../../assets/illustration-gradient.svg';
|
|
|
8
9
|
import { Avatar } from '../avatar/avatar.js';
|
|
9
10
|
import { AvatarGroup, AvatarGroupTooltip } from '../avatar/avatar-group.js';
|
|
10
11
|
import { Icon } from '../icon/icon.js';
|
|
11
|
-
import { MovingBorder } from '../moving-border/moving-border.js';
|
|
12
12
|
import { DynamicItem } from './dynamic-item.js';
|
|
13
13
|
const meta = {
|
|
14
14
|
title: 'Components/DynamicItem',
|