@shipfox/react-ui 0.4.0 → 0.5.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.
Files changed (52) hide show
  1. package/.storybook/main.ts +20 -10
  2. package/.storybook/vitest.setup.ts +4 -0
  3. package/.turbo/turbo-build.log +2 -2
  4. package/.turbo/turbo-check.log +2 -2
  5. package/.turbo/turbo-type.log +1 -1
  6. package/CHANGELOG.md +7 -0
  7. package/README.md +40 -1
  8. package/argos.config.ts +33 -0
  9. package/dist/components/button/button-link.d.ts +14 -0
  10. package/dist/components/button/button-link.d.ts.map +1 -0
  11. package/dist/components/button/button-link.js +63 -0
  12. package/dist/components/button/button-link.js.map +1 -0
  13. package/dist/components/button/button-link.stories.js +127 -0
  14. package/dist/components/button/button-link.stories.js.map +1 -0
  15. package/dist/components/button/button.d.ts +1 -1
  16. package/dist/components/button/button.d.ts.map +1 -1
  17. package/dist/components/button/button.js +7 -6
  18. package/dist/components/button/button.js.map +1 -1
  19. package/dist/components/button/button.stories.js +1 -13
  20. package/dist/components/button/button.stories.js.map +1 -1
  21. package/dist/components/button/icon-button.d.ts +14 -0
  22. package/dist/components/button/icon-button.d.ts.map +1 -0
  23. package/dist/components/button/icon-button.js +53 -0
  24. package/dist/components/button/icon-button.js.map +1 -0
  25. package/dist/components/button/icon-button.stories.js +254 -0
  26. package/dist/components/button/icon-button.stories.js.map +1 -0
  27. package/dist/components/button/index.d.ts +2 -0
  28. package/dist/components/button/index.d.ts.map +1 -1
  29. package/dist/components/button/index.js +2 -0
  30. package/dist/components/button/index.js.map +1 -1
  31. package/dist/components/code-block/code-content.d.ts.map +1 -1
  32. package/dist/components/code-block/code-content.js +2 -2
  33. package/dist/components/code-block/code-content.js.map +1 -1
  34. package/dist/components/icon/icon.d.ts +2 -0
  35. package/dist/components/icon/icon.d.ts.map +1 -1
  36. package/dist/components/icon/icon.js +4 -2
  37. package/dist/components/icon/icon.js.map +1 -1
  38. package/dist/onboarding/sign-in.stories.js +93 -0
  39. package/dist/onboarding/sign-in.stories.js.map +1 -0
  40. package/index.css +29 -3
  41. package/package.json +9 -1
  42. package/src/components/button/button-link.stories.tsx +86 -0
  43. package/src/components/button/button-link.tsx +76 -0
  44. package/src/components/button/button.stories.tsx +1 -7
  45. package/src/components/button/button.tsx +8 -6
  46. package/src/components/button/icon-button.stories.tsx +182 -0
  47. package/src/components/button/icon-button.tsx +69 -0
  48. package/src/components/button/index.ts +2 -0
  49. package/src/components/code-block/code-content.tsx +5 -2
  50. package/src/components/icon/icon.tsx +4 -0
  51. package/src/onboarding/sign-in.stories.tsx +73 -0
  52. package/vitest.config.ts +30 -3
@@ -1,17 +1,27 @@
1
- import type {StorybookConfigVite} from '@storybook/builder-vite';
1
+ import {resolve} from 'node:path';
2
2
  import type {StorybookConfig} from '@storybook/react-vite';
3
+ import tailwindcss from '@tailwindcss/vite';
4
+ import react from '@vitejs/plugin-react';
3
5
 
4
- const config: StorybookConfig & StorybookConfigVite = {
6
+ const config: StorybookConfig = {
5
7
  framework: '@storybook/react-vite',
6
8
  stories: ['../src/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
7
- addons: ['storybook-addon-pseudo-states'],
8
- core: {
9
- builder: {
10
- name: '@storybook/builder-vite',
11
- options: {
12
- viteConfigPath: 'vitest.config.ts',
13
- },
14
- },
9
+ addons: ['storybook-addon-pseudo-states', '@storybook/addon-vitest'],
10
+ viteFinal: (config) => {
11
+ config.plugins = config.plugins ?? [];
12
+
13
+ config.plugins.push(react(), tailwindcss());
14
+
15
+ config.resolve = config.resolve ?? {};
16
+ config.resolve.alias = {
17
+ ...config.resolve.alias,
18
+ components: resolve(__dirname, '../src/components'),
19
+ hooks: resolve(__dirname, '../src/hooks'),
20
+ utils: resolve(__dirname, '../src/utils'),
21
+ state: resolve(__dirname, '../src/state'),
22
+ };
23
+
24
+ return config;
15
25
  },
16
26
  };
17
27
 
@@ -0,0 +1,4 @@
1
+ import {setProjectAnnotations} from '@storybook/react-vite';
2
+ import * as projectAnnotations from './preview';
3
+
4
+ setProjectAnnotations([projectAnnotations]);
@@ -1,6 +1,6 @@
1
1
   WARN  Issue while reading "/runnertmp/_work/tooling/tooling/.npmrc". Failed to replace env in config: ${NPM_ACCESS_TOKEN}
2
2
 
3
- > @shipfox/react-ui@0.4.0 build /runnertmp/_work/tooling/tooling/libs/react/ui
3
+ > @shipfox/react-ui@0.5.0 build /runnertmp/_work/tooling/tooling/libs/react/ui
4
4
  > swc
5
5
 
6
- Successfully compiled: 103 files with swc (58.6ms)
6
+ Successfully compiled: 108 files with swc (681.63ms)
@@ -1,6 +1,6 @@
1
1
   WARN  Issue while reading "/runnertmp/_work/tooling/tooling/.npmrc". Failed to replace env in config: ${NPM_ACCESS_TOKEN}
2
2
 
3
- > @shipfox/react-ui@0.4.0 check /runnertmp/_work/tooling/tooling/libs/react/ui
3
+ > @shipfox/react-ui@0.5.0 check /runnertmp/_work/tooling/tooling/libs/react/ui
4
4
  > biome-check --fix
5
5
 
6
- Checked 119 files in 309ms. No fixes applied.
6
+ Checked 126 files in 232ms. No fixes applied.
@@ -1,5 +1,5 @@
1
1
   WARN  Issue while reading "/runnertmp/_work/tooling/tooling/.npmrc". Failed to replace env in config: ${NPM_ACCESS_TOKEN}
2
2
 
3
- > @shipfox/react-ui@0.4.0 type /runnertmp/_work/tooling/tooling/libs/react/ui
3
+ > @shipfox/react-ui@0.5.0 type /runnertmp/_work/tooling/tooling/libs/react/ui
4
4
  > tsc-emit
5
5
 
package/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  # @shipfox/react-ui
2
2
 
3
+ ## 0.5.0
4
+
5
+ ### Minor Changes
6
+
7
+ - ec0b437: Add Button Link and Icon Button components
8
+ - 7b73bd6: Integrate Argos CI
9
+
3
10
  ## 0.4.0
4
11
 
5
12
  ### Minor Changes
package/README.md CHANGED
@@ -16,6 +16,45 @@ npm install @shipfox/react-ui
16
16
 
17
17
  ## Storybook
18
18
 
19
- The storybook is [publicly accessible online](react-ui.shipfox.vercel.app).
19
+ The storybook is [publicly accessible online](https://react-ui.shipfox.vercel.app).
20
20
 
21
21
  You can also launch it locally by running `pnpm storybook` from within this package's directory.
22
+
23
+ ## Visual Testing with Argos
24
+
25
+ This library uses [Argos](https://argos-ci.com/) for automated visual regression testing. Argos captures screenshots of all Storybook stories and compares them across pull requests to detect unintended visual changes.
26
+
27
+ ### How it works
28
+
29
+ 1. On every pull request, GitHub Actions builds Storybook and uploads screenshots to Argos
30
+ 2. Argos compares the screenshots with the baseline from the main branch
31
+ 3. If visual differences are detected, they are highlighted in the Argos dashboard
32
+ 4. Reviewers can approve or reject changes directly from the PR
33
+
34
+ ### Running Argos locally
35
+
36
+ To upload screenshots to Argos from your local machine:
37
+
38
+ ```bash
39
+ # Build Storybook
40
+ pnpm storybook:build
41
+
42
+ # Upload to Argos (requires ARGOS_TOKEN environment variable)
43
+ pnpm argos
44
+ ```
45
+
46
+ ### Configuration
47
+
48
+ Argos configuration is located in `argos.config.ts`. You can customize:
49
+
50
+ - Screenshot capture settings
51
+ - Ignored patterns
52
+ - Comparison threshold
53
+ - Reference branch
54
+
55
+ ### Setting up Argos
56
+
57
+ 1. Create an account on [Argos](https://argos-ci.com/)
58
+ 2. Connect your GitHub repository
59
+ 3. Add the `ARGOS_TOKEN` secret to your GitHub repository settings
60
+ 4. Argos will automatically run on all pull requests
@@ -0,0 +1,33 @@
1
+ const config = {
2
+ // Upload Storybook build output
3
+ buildDir: 'storybook-static',
4
+
5
+ // Project token (can also be set via ARGOS_TOKEN env var)
6
+ // token: process.env.ARGOS_TOKEN,
7
+
8
+ // Repository information (optional, auto-detected from git)
9
+ // repository: 'shipfox/tooling',
10
+
11
+ // Branch information (optional, auto-detected from git)
12
+ // branch: process.env.GITHUB_REF_NAME,
13
+
14
+ // Commit information (optional, auto-detected from git)
15
+ // commit: process.env.GITHUB_SHA,
16
+
17
+ // Parallel upload settings for faster uploads
18
+ parallel: {
19
+ total: -1, // Auto-detect based on available resources
20
+ nonce: process.env.GITHUB_RUN_ID || Date.now().toString(),
21
+ },
22
+
23
+ // Ignore certain screenshots or patterns
24
+ // ignore: ['**/private/**'],
25
+
26
+ // Reference branch for comparisons (usually main)
27
+ reference: 'main',
28
+
29
+ // Threshold for visual changes (0 = any change, 1 = no changes)
30
+ threshold: 0,
31
+ };
32
+
33
+ export default config;
@@ -0,0 +1,14 @@
1
+ import { type VariantProps } from 'class-variance-authority';
2
+ import { type IconName } from '../../components/icon';
3
+ import type { ComponentProps } from 'react';
4
+ export declare const buttonLinkVariants: (props?: ({
5
+ variant?: "base" | "muted" | "interactive" | "subtle" | null | undefined;
6
+ size?: "xs" | "sm" | "md" | "xl" | null | undefined;
7
+ underline?: boolean | null | undefined;
8
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
9
+ export declare function ButtonLink({ className, variant, size, underline, asChild, children, iconLeft, iconRight, ...props }: ComponentProps<'a'> & VariantProps<typeof buttonLinkVariants> & {
10
+ asChild?: boolean;
11
+ iconLeft?: IconName;
12
+ iconRight?: IconName;
13
+ }): import("react/jsx-runtime").JSX.Element;
14
+ //# sourceMappingURL=button-link.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"button-link.d.ts","sourceRoot":"","sources":["../../../src/components/button/button-link.tsx"],"names":[],"mappings":"AACA,OAAO,EAAM,KAAK,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAO,KAAK,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,OAAO,CAAC;AAG1C,eAAO,MAAM,kBAAkB;;;;8EA8B9B,CAAC;AASF,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,OAAO,EACP,IAAW,EACX,SAAS,EACT,OAAe,EACf,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,GAAG,CAAC,GACpB,YAAY,CAAC,OAAO,kBAAkB,CAAC,GAAG;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,QAAQ,CAAC;CACtB,2CAeF"}
@@ -0,0 +1,63 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } 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 buttonLinkVariants = cva('inline-flex items-center justify-center gap-4 whitespace-nowrap transition-colors disabled:pointer-events-none outline-none font-medium', {
7
+ variants: {
8
+ variant: {
9
+ base: 'text-foreground-neutral-base hover:text-foreground-neutral-base focus-visible:text-foreground-neutral-base disabled:text-foreground-neutral-disabled',
10
+ interactive: 'text-foreground-highlight-interactive hover:text-foreground-highlight-interactive-hover focus-visible:text-foreground-highlight-interactive disabled:text-foreground-neutral-disabled',
11
+ muted: 'text-foreground-neutral-muted hover:text-foreground-neutral-base focus-visible:text-foreground-neutral-base disabled:text-foreground-neutral-disabled',
12
+ subtle: 'text-foreground-neutral-subtle hover:text-foreground-neutral-base focus-visible:text-foreground-neutral-base disabled:text-foreground-neutral-disabled'
13
+ },
14
+ size: {
15
+ xs: 'text-xs',
16
+ sm: 'text-sm',
17
+ md: 'text-md',
18
+ xl: 'text-xl'
19
+ },
20
+ underline: {
21
+ true: 'underline decoration-solid [text-underline-position:from-font]',
22
+ false: ''
23
+ }
24
+ },
25
+ defaultVariants: {
26
+ variant: 'base',
27
+ size: 'sm',
28
+ underline: false
29
+ }
30
+ });
31
+ const iconSizeMap = {
32
+ xs: 14,
33
+ sm: 14,
34
+ md: 16,
35
+ xl: 20
36
+ };
37
+ export function ButtonLink({ className, variant, size = 'sm', underline, asChild = false, children, iconLeft, iconRight, ...props }) {
38
+ const Comp = asChild ? Slot : 'a';
39
+ const iconSize = iconSizeMap[size];
40
+ return /*#__PURE__*/ _jsxs(Comp, {
41
+ "data-slot": "button-link",
42
+ className: cn(buttonLinkVariants({
43
+ variant,
44
+ size,
45
+ underline,
46
+ className
47
+ })),
48
+ ...props,
49
+ children: [
50
+ iconLeft && /*#__PURE__*/ _jsx(Icon, {
51
+ name: iconLeft,
52
+ size: iconSize
53
+ }),
54
+ children,
55
+ iconRight && /*#__PURE__*/ _jsx(Icon, {
56
+ name: iconRight,
57
+ size: iconSize
58
+ })
59
+ ]
60
+ });
61
+ }
62
+
63
+ //# sourceMappingURL=button-link.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/button/button-link.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 buttonLinkVariants = cva(\n 'inline-flex items-center justify-center gap-4 whitespace-nowrap transition-colors disabled:pointer-events-none outline-none font-medium',\n {\n variants: {\n variant: {\n base: 'text-foreground-neutral-base hover:text-foreground-neutral-base focus-visible:text-foreground-neutral-base disabled:text-foreground-neutral-disabled',\n interactive:\n 'text-foreground-highlight-interactive hover:text-foreground-highlight-interactive-hover focus-visible:text-foreground-highlight-interactive disabled:text-foreground-neutral-disabled',\n muted:\n 'text-foreground-neutral-muted hover:text-foreground-neutral-base focus-visible:text-foreground-neutral-base disabled:text-foreground-neutral-disabled',\n subtle:\n 'text-foreground-neutral-subtle hover:text-foreground-neutral-base focus-visible:text-foreground-neutral-base disabled:text-foreground-neutral-disabled',\n },\n size: {\n xs: 'text-xs',\n sm: 'text-sm',\n md: 'text-md',\n xl: 'text-xl',\n },\n underline: {\n true: 'underline decoration-solid [text-underline-position:from-font]',\n false: '',\n },\n },\n defaultVariants: {\n variant: 'base',\n size: 'sm',\n underline: false,\n },\n },\n);\n\nconst iconSizeMap = {\n xs: 14,\n sm: 14,\n md: 16,\n xl: 20,\n} as const;\n\nexport function ButtonLink({\n className,\n variant,\n size = 'sm',\n underline,\n asChild = false,\n children,\n iconLeft,\n iconRight,\n ...props\n}: ComponentProps<'a'> &\n VariantProps<typeof buttonLinkVariants> & {\n asChild?: boolean;\n iconLeft?: IconName;\n iconRight?: IconName;\n }) {\n const Comp = asChild ? Slot : 'a';\n const iconSize = iconSizeMap[size as keyof typeof iconSizeMap];\n\n return (\n <Comp\n data-slot=\"button-link\"\n className={cn(buttonLinkVariants({variant, size, underline, className}))}\n {...props}\n >\n {iconLeft && <Icon name={iconLeft} size={iconSize} />}\n {children}\n {iconRight && <Icon name={iconRight} size={iconSize} />}\n </Comp>\n );\n}\n"],"names":["Slot","cva","Icon","cn","buttonLinkVariants","variants","variant","base","interactive","muted","subtle","size","xs","sm","md","xl","underline","true","false","defaultVariants","iconSizeMap","ButtonLink","className","asChild","children","iconLeft","iconRight","props","Comp","iconSize","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,2IACA;IACEI,UAAU;QACRC,SAAS;YACPC,MAAM;YACNC,aACE;YACFC,OACE;YACFC,QACE;QACJ;QACAC,MAAM;YACJC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJC,IAAI;QACN;QACAC,WAAW;YACTC,MAAM;YACNC,OAAO;QACT;IACF;IACAC,iBAAiB;QACfb,SAAS;QACTK,MAAM;QACNK,WAAW;IACb;AACF,GACA;AAEF,MAAMI,cAAc;IAClBR,IAAI;IACJC,IAAI;IACJC,IAAI;IACJC,IAAI;AACN;AAEA,OAAO,SAASM,WAAW,EACzBC,SAAS,EACThB,OAAO,EACPK,OAAO,IAAI,EACXK,SAAS,EACTO,UAAU,KAAK,EACfC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACT,GAAGC,OAMF;IACD,MAAMC,OAAOL,UAAUvB,OAAO;IAC9B,MAAM6B,WAAWT,WAAW,CAACT,KAAiC;IAE9D,qBACE,MAACiB;QACCE,aAAU;QACVR,WAAWnB,GAAGC,mBAAmB;YAACE;YAASK;YAAMK;YAAWM;QAAS;QACpE,GAAGK,KAAK;;YAERF,0BAAY,KAACvB;gBAAK6B,MAAMN;gBAAUd,MAAMkB;;YACxCL;YACAE,2BAAa,KAACxB;gBAAK6B,MAAML;gBAAWf,MAAMkB;;;;AAGjD"}
@@ -0,0 +1,127 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ButtonLink } from './button-link.js';
3
+ const meta = {
4
+ title: 'Components/Button/ButtonLink',
5
+ component: ButtonLink,
6
+ tags: [
7
+ 'autodocs'
8
+ ],
9
+ argTypes: {
10
+ variant: {
11
+ control: 'select',
12
+ options: [
13
+ 'base',
14
+ 'interactive',
15
+ 'muted',
16
+ 'subtle'
17
+ ]
18
+ },
19
+ size: {
20
+ control: 'select',
21
+ options: [
22
+ 'xs',
23
+ 'sm',
24
+ 'md',
25
+ 'xl'
26
+ ]
27
+ },
28
+ underline: {
29
+ control: 'boolean'
30
+ },
31
+ asChild: {
32
+ control: 'boolean'
33
+ }
34
+ },
35
+ args: {
36
+ children: 'Label',
37
+ variant: 'base',
38
+ size: 'sm',
39
+ underline: false,
40
+ href: '#'
41
+ }
42
+ };
43
+ export default meta;
44
+ export const Default = {};
45
+ export const Variants = {
46
+ render: (args)=>/*#__PURE__*/ _jsxs("div", {
47
+ className: "flex gap-16 items-center",
48
+ children: [
49
+ /*#__PURE__*/ _jsx(ButtonLink, {
50
+ ...args,
51
+ variant: "base",
52
+ children: "Base"
53
+ }),
54
+ /*#__PURE__*/ _jsx(ButtonLink, {
55
+ ...args,
56
+ variant: "interactive",
57
+ children: "Interactive"
58
+ }),
59
+ /*#__PURE__*/ _jsx(ButtonLink, {
60
+ ...args,
61
+ variant: "muted",
62
+ children: "Muted"
63
+ }),
64
+ /*#__PURE__*/ _jsx(ButtonLink, {
65
+ ...args,
66
+ variant: "subtle",
67
+ children: "Subtle"
68
+ })
69
+ ]
70
+ })
71
+ };
72
+ export const WithUnderline = {
73
+ render: (args)=>/*#__PURE__*/ _jsxs("div", {
74
+ className: "flex gap-16 items-center",
75
+ children: [
76
+ /*#__PURE__*/ _jsx(ButtonLink, {
77
+ ...args,
78
+ variant: "base",
79
+ underline: true,
80
+ children: "Base"
81
+ }),
82
+ /*#__PURE__*/ _jsx(ButtonLink, {
83
+ ...args,
84
+ variant: "interactive",
85
+ underline: true,
86
+ children: "Interactive"
87
+ }),
88
+ /*#__PURE__*/ _jsx(ButtonLink, {
89
+ ...args,
90
+ variant: "muted",
91
+ underline: true,
92
+ children: "Muted"
93
+ }),
94
+ /*#__PURE__*/ _jsx(ButtonLink, {
95
+ ...args,
96
+ variant: "subtle",
97
+ underline: true,
98
+ children: "Subtle"
99
+ })
100
+ ]
101
+ })
102
+ };
103
+ export const WithIcons = {
104
+ render: (args)=>/*#__PURE__*/ _jsxs("div", {
105
+ className: "flex gap-16 items-center",
106
+ children: [
107
+ /*#__PURE__*/ _jsx(ButtonLink, {
108
+ ...args,
109
+ iconLeft: "addLine",
110
+ children: "Icon Left"
111
+ }),
112
+ /*#__PURE__*/ _jsx(ButtonLink, {
113
+ ...args,
114
+ iconRight: "chevronRight",
115
+ children: "Icon Right"
116
+ }),
117
+ /*#__PURE__*/ _jsx(ButtonLink, {
118
+ ...args,
119
+ iconLeft: "addLine",
120
+ iconRight: "chevronRight",
121
+ children: "Both Icons"
122
+ })
123
+ ]
124
+ })
125
+ };
126
+
127
+ //# sourceMappingURL=button-link.stories.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/components/button/button-link.stories.tsx"],"sourcesContent":["import type {Meta, StoryObj} from '@storybook/react';\nimport {ButtonLink} from './button-link';\n\nconst meta = {\n title: 'Components/Button/ButtonLink',\n component: ButtonLink,\n tags: ['autodocs'],\n argTypes: {\n variant: {\n control: 'select',\n options: ['base', 'interactive', 'muted', 'subtle'],\n },\n size: {\n control: 'select',\n options: ['xs', 'sm', 'md', 'xl'],\n },\n underline: {control: 'boolean'},\n asChild: {control: 'boolean'},\n },\n args: {\n children: 'Label',\n variant: 'base',\n size: 'sm',\n underline: false,\n href: '#',\n },\n} satisfies Meta<typeof ButtonLink>;\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 gap-16 items-center\">\n <ButtonLink {...args} variant=\"base\">\n Base\n </ButtonLink>\n <ButtonLink {...args} variant=\"interactive\">\n Interactive\n </ButtonLink>\n <ButtonLink {...args} variant=\"muted\">\n Muted\n </ButtonLink>\n <ButtonLink {...args} variant=\"subtle\">\n Subtle\n </ButtonLink>\n </div>\n ),\n};\n\nexport const WithUnderline: Story = {\n render: (args) => (\n <div className=\"flex gap-16 items-center\">\n <ButtonLink {...args} variant=\"base\" underline>\n Base\n </ButtonLink>\n <ButtonLink {...args} variant=\"interactive\" underline>\n Interactive\n </ButtonLink>\n <ButtonLink {...args} variant=\"muted\" underline>\n Muted\n </ButtonLink>\n <ButtonLink {...args} variant=\"subtle\" underline>\n Subtle\n </ButtonLink>\n </div>\n ),\n};\n\nexport const WithIcons: Story = {\n render: (args) => (\n <div className=\"flex gap-16 items-center\">\n <ButtonLink {...args} iconLeft=\"addLine\">\n Icon Left\n </ButtonLink>\n <ButtonLink {...args} iconRight=\"chevronRight\">\n Icon Right\n </ButtonLink>\n <ButtonLink {...args} iconLeft=\"addLine\" iconRight=\"chevronRight\">\n Both Icons\n </ButtonLink>\n </div>\n ),\n};\n"],"names":["ButtonLink","meta","title","component","tags","argTypes","variant","control","options","size","underline","asChild","args","children","href","Default","Variants","render","div","className","WithUnderline","WithIcons","iconLeft","iconRight"],"mappings":";AACA,SAAQA,UAAU,QAAO,gBAAgB;AAEzC,MAAMC,OAAO;IACXC,OAAO;IACPC,WAAWH;IACXI,MAAM;QAAC;KAAW;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ACtB;oBAAY,GAAGY,IAAI;oBAAEW,WAAU;8BAAe;;8BAG/C,KAACvB;oBAAY,GAAGY,IAAI;oBAAEU,UAAS;oBAAUC,WAAU;8BAAe;;;;AAKxE,EAAE"}
@@ -2,7 +2,7 @@ import { type VariantProps } from 'class-variance-authority';
2
2
  import { type IconName } from '../../components/icon';
3
3
  import type { ComponentProps } from 'react';
4
4
  export declare const buttonVariants: (props?: ({
5
- variant?: "transparent" | "primary" | "secondary" | "danger" | "transparentMuted" | null | undefined;
5
+ variant?: "transparent" | "success" | "primary" | "secondary" | "danger" | "transparentMuted" | null | undefined;
6
6
  size?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
7
7
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
8
8
  export declare function Button({ className, variant, size, asChild, children, iconLeft, iconRight, ...props }: ComponentProps<'button'> & VariantProps<typeof buttonVariants> & {
@@ -1 +1 @@
1
- {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAM,KAAK,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAO,KAAK,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,OAAO,CAAC;AAG1C,eAAO,MAAM,cAAc;;;8EA8B1B,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAe,EACf,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,GACzB,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,QAAQ,CAAC;CACtB,2CAUF"}
1
+ {"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAM,KAAK,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAO,KAAK,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,OAAO,CAAC;AAG1C,eAAO,MAAM,cAAc;;;8EAgC1B,CAAC;AAEF,wBAAgB,MAAM,CAAC,EACrB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAe,EACf,QAAQ,EACR,QAAQ,EACR,SAAS,EACT,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,GACzB,YAAY,CAAC,OAAO,cAAc,CAAC,GAAG;IACpC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,QAAQ,CAAC;IACpB,SAAS,CAAC,EAAE,QAAQ,CAAC;CACtB,2CAUF"}
@@ -9,16 +9,17 @@ export const buttonVariants = cva('rounded-6 inline-flex items-center justify-ce
9
9
  primary: 'bg-background-button-inverted-default text-foreground-contrast-primary 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
10
  secondary: 'bg-background-button-neutral-default text-foreground-neutral-base shadow-button-neutral hover:bg-background-button-neutral-hover active:bg-background-button-neutral-pressed disabled:bg-background-neutral-disabled focus-visible:shadow-button-neutral-focus disabled:text-foreground-neutral-disabled disabled:shadow-none',
11
11
  danger: 'bg-background-button-danger-default text-foreground-neutral-on-color shadow-button-danger hover:bg-background-button-danger-hover active:bg-background-button-danger-pressed focus-visible:shadow-button-danger-focus disabled:bg-background-neutral-disabled disabled:text-foreground-neutral-disabled disabled:shadow-none',
12
+ success: 'bg-background-button-success-default text-foreground-neutral-on-color shadow-button-success hover:bg-background-button-success-hover active:bg-background-button-success-pressed focus-visible:shadow-button-success-focus disabled:bg-background-neutral-disabled disabled:text-foreground-neutral-disabled disabled:shadow-none',
12
13
  transparent: 'bg-background-button-transparent-default text-foreground-neutral-base hover:bg-background-button-transparent-hover active:bg-background-button-transparent-pressed focus-visible:shadow-button-neutral-focus disabled:text-foreground-neutral-disabled',
13
14
  transparentMuted: 'bg-background-button-transparent-default text-foreground-neutral-muted hover:bg-background-button-transparent-hover active:bg-background-button-transparent-pressed focus-visible:shadow-button-neutral-focus disabled:text-foreground-neutral-disabled'
14
15
  },
15
16
  size: {
16
- '2xs': 'px-6 text-xs gap-4',
17
- xs: 'px-6 py-2 text-xs gap-4',
18
- sm: 'px-8 py-4 text-sm gap-6',
19
- md: 'px-10 py-6 text-md gap-8',
20
- lg: 'px-12 py-8 text-lg gap-8',
21
- xl: 'px-12 py-10 text-xl gap-10'
17
+ '2xs': 'h-20 px-6 text-xs gap-4',
18
+ xs: 'h-24 px-6 text-xs gap-4',
19
+ sm: 'h-28 px-8 text-sm gap-6',
20
+ md: 'h-32 px-10 text-md gap-8',
21
+ lg: 'h-36 px-12 text-lg gap-8',
22
+ xl: 'h-40 px-12 text-xl gap-10'
22
23
  }
23
24
  },
24
25
  defaultVariants: {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/button/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 buttonVariants = cva(\n 'rounded-6 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-foreground-contrast-primary 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 secondary:\n 'bg-background-button-neutral-default text-foreground-neutral-base shadow-button-neutral hover:bg-background-button-neutral-hover active:bg-background-button-neutral-pressed disabled:bg-background-neutral-disabled focus-visible:shadow-button-neutral-focus disabled:text-foreground-neutral-disabled disabled:shadow-none',\n danger:\n 'bg-background-button-danger-default text-foreground-neutral-on-color shadow-button-danger hover:bg-background-button-danger-hover active:bg-background-button-danger-pressed focus-visible:shadow-button-danger-focus disabled:bg-background-neutral-disabled disabled:text-foreground-neutral-disabled disabled:shadow-none',\n transparent:\n 'bg-background-button-transparent-default text-foreground-neutral-base hover:bg-background-button-transparent-hover active:bg-background-button-transparent-pressed focus-visible:shadow-button-neutral-focus disabled:text-foreground-neutral-disabled',\n transparentMuted:\n 'bg-background-button-transparent-default text-foreground-neutral-muted 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': 'px-6 text-xs gap-4',\n xs: 'px-6 py-2 text-xs gap-4',\n sm: 'px-8 py-4 text-sm gap-6',\n md: 'px-10 py-6 text-md gap-8',\n lg: 'px-12 py-8 text-lg gap-8',\n xl: 'px-12 py-10 text-xl gap-10',\n },\n },\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n },\n },\n);\n\nexport function Button({\n className,\n variant,\n size,\n asChild = false,\n children,\n iconLeft,\n iconRight,\n ...props\n}: ComponentProps<'button'> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n iconLeft?: IconName;\n iconRight?: IconName;\n }) {\n const Comp = asChild ? Slot : 'button';\n\n return (\n <Comp data-slot=\"button\" className={cn(buttonVariants({variant, size, className}))} {...props}>\n {iconLeft && <Icon name={iconLeft} />}\n {children}\n {iconRight && <Icon name={iconRight} />}\n </Comp>\n );\n}\n"],"names":["Slot","cva","Icon","cn","buttonVariants","variants","variant","primary","secondary","danger","transparent","transparentMuted","size","xs","sm","md","lg","xl","defaultVariants","Button","className","asChild","children","iconLeft","iconRight","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,iBAAiBH,IAC5B,4IACA;IACEI,UAAU;QACRC,SAAS;YACPC,SACE;YACFC,WACE;YACFC,QACE;YACFC,aACE;YACFC,kBACE;QACJ;QACAC,MAAM;YACJ,OAAO;YACPC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJC,IAAI;QACN;IACF;IACAC,iBAAiB;QACfZ,SAAS;QACTM,MAAM;IACR;AACF,GACA;AAEF,OAAO,SAASO,OAAO,EACrBC,SAAS,EACTd,OAAO,EACPM,IAAI,EACJS,UAAU,KAAK,EACfC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACT,GAAGC,OAMF;IACD,MAAMC,OAAOL,UAAUrB,OAAO;IAE9B,qBACE,MAAC0B;QAAKC,aAAU;QAASP,WAAWjB,GAAGC,eAAe;YAACE;YAASM;YAAMQ;QAAS;QAAM,GAAGK,KAAK;;YAC1FF,0BAAY,KAACrB;gBAAK0B,MAAML;;YACxBD;YACAE,2BAAa,KAACtB;gBAAK0B,MAAMJ;;;;AAGhC"}
1
+ {"version":3,"sources":["../../../src/components/button/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 buttonVariants = cva(\n 'rounded-6 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-foreground-contrast-primary 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 secondary:\n 'bg-background-button-neutral-default text-foreground-neutral-base shadow-button-neutral hover:bg-background-button-neutral-hover active:bg-background-button-neutral-pressed disabled:bg-background-neutral-disabled focus-visible:shadow-button-neutral-focus disabled:text-foreground-neutral-disabled disabled:shadow-none',\n danger:\n 'bg-background-button-danger-default text-foreground-neutral-on-color shadow-button-danger hover:bg-background-button-danger-hover active:bg-background-button-danger-pressed focus-visible:shadow-button-danger-focus disabled:bg-background-neutral-disabled disabled:text-foreground-neutral-disabled disabled:shadow-none',\n success:\n 'bg-background-button-success-default text-foreground-neutral-on-color shadow-button-success hover:bg-background-button-success-hover active:bg-background-button-success-pressed focus-visible:shadow-button-success-focus disabled:bg-background-neutral-disabled disabled:text-foreground-neutral-disabled disabled:shadow-none',\n transparent:\n 'bg-background-button-transparent-default text-foreground-neutral-base hover:bg-background-button-transparent-hover active:bg-background-button-transparent-pressed focus-visible:shadow-button-neutral-focus disabled:text-foreground-neutral-disabled',\n transparentMuted:\n 'bg-background-button-transparent-default text-foreground-neutral-muted 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': 'h-20 px-6 text-xs gap-4',\n xs: 'h-24 px-6 text-xs gap-4',\n sm: 'h-28 px-8 text-sm gap-6',\n md: 'h-32 px-10 text-md gap-8',\n lg: 'h-36 px-12 text-lg gap-8',\n xl: 'h-40 px-12 text-xl gap-10',\n },\n },\n defaultVariants: {\n variant: 'primary',\n size: 'md',\n },\n },\n);\n\nexport function Button({\n className,\n variant,\n size,\n asChild = false,\n children,\n iconLeft,\n iconRight,\n ...props\n}: ComponentProps<'button'> &\n VariantProps<typeof buttonVariants> & {\n asChild?: boolean;\n iconLeft?: IconName;\n iconRight?: IconName;\n }) {\n const Comp = asChild ? Slot : 'button';\n\n return (\n <Comp data-slot=\"button\" className={cn(buttonVariants({variant, size, className}))} {...props}>\n {iconLeft && <Icon name={iconLeft} />}\n {children}\n {iconRight && <Icon name={iconRight} />}\n </Comp>\n );\n}\n"],"names":["Slot","cva","Icon","cn","buttonVariants","variants","variant","primary","secondary","danger","success","transparent","transparentMuted","size","xs","sm","md","lg","xl","defaultVariants","Button","className","asChild","children","iconLeft","iconRight","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,iBAAiBH,IAC5B,4IACA;IACEI,UAAU;QACRC,SAAS;YACPC,SACE;YACFC,WACE;YACFC,QACE;YACFC,SACE;YACFC,aACE;YACFC,kBACE;QACJ;QACAC,MAAM;YACJ,OAAO;YACPC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJC,IAAI;YACJC,IAAI;QACN;IACF;IACAC,iBAAiB;QACfb,SAAS;QACTO,MAAM;IACR;AACF,GACA;AAEF,OAAO,SAASO,OAAO,EACrBC,SAAS,EACTf,OAAO,EACPO,IAAI,EACJS,UAAU,KAAK,EACfC,QAAQ,EACRC,QAAQ,EACRC,SAAS,EACT,GAAGC,OAMF;IACD,MAAMC,OAAOL,UAAUtB,OAAO;IAE9B,qBACE,MAAC2B;QAAKC,aAAU;QAASP,WAAWlB,GAAGC,eAAe;YAACE;YAASO;YAAMQ;QAAS;QAAM,GAAGK,KAAK;;YAC1FF,0BAAY,KAACtB;gBAAK2B,MAAML;;YACxBD;YACAE,2BAAa,KAACvB;gBAAK2B,MAAMJ;;;;AAGhC"}
@@ -5,6 +5,7 @@ const variantOptions = [
5
5
  'primary',
6
6
  'secondary',
7
7
  'danger',
8
+ 'success',
8
9
  'transparent',
9
10
  'transparentMuted'
10
11
  ];
@@ -61,9 +62,6 @@ export const Variants = {
61
62
  /*#__PURE__*/ _jsx("th", {
62
63
  children: "Hover"
63
64
  }),
64
- /*#__PURE__*/ _jsx("th", {
65
- children: "Active"
66
- }),
67
65
  /*#__PURE__*/ _jsx("th", {
68
66
  children: "Focus"
69
67
  }),
@@ -100,15 +98,6 @@ export const Variants = {
100
98
  children: "Click me"
101
99
  })
102
100
  }),
103
- /*#__PURE__*/ _jsx("td", {
104
- children: /*#__PURE__*/ _jsx(Button, {
105
- ...args,
106
- variant: variant,
107
- className: "active",
108
- size: size,
109
- children: "Click me"
110
- })
111
- }),
112
101
  /*#__PURE__*/ _jsx("td", {
113
102
  children: /*#__PURE__*/ _jsx(Button, {
114
103
  ...args,
@@ -137,7 +126,6 @@ export const Variants = {
137
126
  Variants.parameters = {
138
127
  pseudo: {
139
128
  hover: '.hover',
140
- active: '.active',
141
129
  focusVisible: '.focus'
142
130
  }
143
131
  };
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/components/button/button.stories.tsx"],"sourcesContent":["import type {Meta, StoryObj} from '@storybook/react';\nimport {Code} from 'components/typography';\nimport {Button} from './button';\n\nconst variantOptions = [\n 'primary',\n 'secondary',\n 'danger',\n 'transparent',\n 'transparentMuted',\n] as const;\nconst sizeOptions = ['2xs', 'xs', 'sm', 'md', 'lg', 'xl'] as const;\n\nconst meta = {\n title: 'Components/Button',\n component: Button,\n tags: ['autodocs'],\n argTypes: {\n variant: {\n control: 'select',\n options: variantOptions,\n },\n size: {\n control: 'select',\n options: sizeOptions,\n },\n asChild: {control: 'boolean'},\n },\n args: {\n children: 'Click me',\n variant: 'primary',\n size: 'md',\n },\n} satisfies Meta<typeof Button>;\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 <table key={size} className=\"w-fit border-separate border-spacing-x-32 border-spacing-y-16\">\n <thead>\n <tr>\n <th>{size}</th>\n <th>Default</th>\n <th>Hover</th>\n <th>Active</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 <Button {...args} variant={variant} size={size}>\n Click me\n </Button>\n </td>\n <td>\n <Button {...args} variant={variant} className=\"hover\" size={size}>\n Click me\n </Button>\n </td>\n <td>\n <Button {...args} variant={variant} className=\"active\" size={size}>\n Click me\n </Button>\n </td>\n <td>\n <Button {...args} variant={variant} className=\"focus\" size={size}>\n Click me\n </Button>\n </td>\n <td>\n <Button {...args} variant={variant} disabled size={size}>\n Click me\n </Button>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n ))}\n </div>\n ),\n};\n\nVariants.parameters = {\n pseudo: {\n hover: '.hover',\n active: '.active',\n focusVisible: '.focus',\n },\n};\n\nexport const Icons: Story = {\n render: (args) => (\n <div className=\"flex flex-col gap-16\">\n <div>\n <Button {...args} iconLeft=\"google\">\n Click me\n </Button>\n </div>\n <div>\n <Button {...args} iconRight=\"microsoft\">\n Click me\n </Button>\n </div>\n <div>\n <Button {...args} iconLeft=\"google\" iconRight=\"microsoft\">\n Click me\n </Button>\n </div>\n </div>\n ),\n};\n"],"names":["Code","Button","variantOptions","sizeOptions","meta","title","component","tags","argTypes","variant","control","options","size","asChild","args","children","Default","Variants","render","div","className","map","table","thead","tr","th","tbody","td","disabled","parameters","pseudo","hover","active","focusVisible","Icons","iconLeft","iconRight"],"mappings":";AACA,SAAQA,IAAI,QAAO,wBAAwB;AAC3C,SAAQC,MAAM,QAAO,WAAW;AAEhC,MAAMC,iBAAiB;IACrB;IACA;IACA;IACA;IACA;CACD;AACD,MAAMC,cAAc;IAAC;IAAO;IAAM;IAAM;IAAM;IAAM;CAAK;AAEzD,MAAMC,OAAO;IACXC,OAAO;IACPC,WAAWL;IACXM,MAAM;QAAC;KAAW;IAClBC,UAAU;QACRC,SAAS;YACPC,SAAS;YACTC,SAAST;QACX;QACAU,MAAM;YACJF,SAAS;YACTC,SAASR;QACX;QACAU,SAAS;YAACH,SAAS;QAAS;IAC9B;IACAI,MAAM;QAC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AC1BhB,QAAQ,CAACJ,qBACP,MAACK;YAAIC,WAAU;;8BACb,KAACD;8BACC,cAAA,KAAClB;wBAAQ,GAAGa,IAAI;wBAAEqB,UAAS;kCAAS;;;8BAItC,KAAChB;8BACC,cAAA,KAAClB;wBAAQ,GAAGa,IAAI;wBAAEsB,WAAU;kCAAY;;;8BAI1C,KAACjB;8BACC,cAAA,KAAClB;wBAAQ,GAAGa,IAAI;wBAAEqB,UAAS;wBAASC,WAAU;kCAAY;;;;;AAMlE,EAAE"}
1
+ {"version":3,"sources":["../../../src/components/button/button.stories.tsx"],"sourcesContent":["import type {Meta, StoryObj} from '@storybook/react';\nimport {Code} from 'components/typography';\nimport {Button} from './button';\n\nconst variantOptions = [\n 'primary',\n 'secondary',\n 'danger',\n 'success',\n 'transparent',\n 'transparentMuted',\n] as const;\nconst sizeOptions = ['2xs', 'xs', 'sm', 'md', 'lg', 'xl'] as const;\n\nconst meta = {\n title: 'Components/Button',\n component: Button,\n tags: ['autodocs'],\n argTypes: {\n variant: {\n control: 'select',\n options: variantOptions,\n },\n size: {\n control: 'select',\n options: sizeOptions,\n },\n asChild: {control: 'boolean'},\n },\n args: {\n children: 'Click me',\n variant: 'primary',\n size: 'md',\n },\n} satisfies Meta<typeof Button>;\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 <table key={size} className=\"w-fit border-separate border-spacing-x-32 border-spacing-y-16\">\n <thead>\n <tr>\n <th>{size}</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 <Button {...args} variant={variant} size={size}>\n Click me\n </Button>\n </td>\n <td>\n <Button {...args} variant={variant} className=\"hover\" size={size}>\n Click me\n </Button>\n </td>\n <td>\n <Button {...args} variant={variant} className=\"focus\" size={size}>\n Click me\n </Button>\n </td>\n <td>\n <Button {...args} variant={variant} disabled size={size}>\n Click me\n </Button>\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n ))}\n </div>\n ),\n};\n\nVariants.parameters = {\n pseudo: {\n hover: '.hover',\n focusVisible: '.focus',\n },\n};\n\nexport const Icons: Story = {\n render: (args) => (\n <div className=\"flex flex-col gap-16\">\n <div>\n <Button {...args} iconLeft=\"google\">\n Click me\n </Button>\n </div>\n <div>\n <Button {...args} iconRight=\"microsoft\">\n Click me\n </Button>\n </div>\n <div>\n <Button {...args} iconLeft=\"google\" iconRight=\"microsoft\">\n Click me\n </Button>\n </div>\n </div>\n ),\n};\n"],"names":["Code","Button","variantOptions","sizeOptions","meta","title","component","tags","argTypes","variant","control","options","size","asChild","args","children","Default","Variants","render","div","className","map","table","thead","tr","th","tbody","td","disabled","parameters","pseudo","hover","focusVisible","Icons","iconLeft","iconRight"],"mappings":";AACA,SAAQA,IAAI,QAAO,wBAAwB;AAC3C,SAAQC,MAAM,QAAO,WAAW;AAEhC,MAAMC,iBAAiB;IACrB;IACA;IACA;IACA;IACA;IACA;CACD;AACD,MAAMC,cAAc;IAAC;IAAO;IAAM;IAAM;IAAM;IAAM;CAAK;AAEzD,MAAMC,OAAO;IACXC,OAAO;IACPC,WAAWL;IACXM,MAAM;QAAC;KAAW;IAClBC,UAAU;QACRC,SAAS;YACPC,SAAS;YACTC,SAAST;QACX;QACAU,MAAM;YACJF,SAAS;YACTC,SAASR;QACX;QACAU,SAAS;YAACH,SAAS;QAAS;IAC9B;IACAI,MAAM;QACJC,UAAU;QACVN,SAAS;QACTG,MAAM;IACR;AACF;AAEA,eAAeR,KAAK;AAGpB,OAAO,MAAMY,UAAiB,CAAC,EAAE;AAEjC,OAAO,MAAMC,WAAkB;IAC7BC,QAAQ,CAACJ,qBACP,KAACK;YAAIC,WAAU;sBACZjB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 +1,14 @@
1
+ import { type VariantProps } from 'class-variance-authority';
2
+ import { type IconName } from '../../components/icon';
3
+ import type { ComponentProps } from 'react';
4
+ export declare const iconButtonVariants: (props?: ({
5
+ variant?: "transparent" | "primary" | null | undefined;
6
+ size?: "2xs" | "xs" | "sm" | "md" | "lg" | "xl" | null | undefined;
7
+ radius?: "full" | "rounded" | null | undefined;
8
+ muted?: boolean | null | undefined;
9
+ } & import("class-variance-authority/types").ClassProp) | undefined) => string;
10
+ export declare function IconButton({ className, variant, size, radius, muted, asChild, children, icon, ...props }: ComponentProps<'button'> & VariantProps<typeof iconButtonVariants> & {
11
+ asChild?: boolean;
12
+ icon?: IconName;
13
+ }): import("react/jsx-runtime").JSX.Element;
14
+ //# sourceMappingURL=icon-button.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"icon-button.d.ts","sourceRoot":"","sources":["../../../src/components/button/icon-button.tsx"],"names":[],"mappings":"AACA,OAAO,EAAM,KAAK,YAAY,EAAC,MAAM,0BAA0B,CAAC;AAChE,OAAO,EAAO,KAAK,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AACpD,OAAO,KAAK,EAAC,cAAc,EAAC,MAAM,OAAO,CAAC;AAG1C,eAAO,MAAM,kBAAkB;;;;;8EAkC9B,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACzB,SAAS,EACT,OAAO,EACP,IAAI,EACJ,MAAM,EACN,KAAK,EACL,OAAe,EACf,QAAQ,EACR,IAAI,EACJ,GAAG,KAAK,EACT,EAAE,cAAc,CAAC,QAAQ,CAAC,GACzB,YAAY,CAAC,OAAO,kBAAkB,CAAC,GAAG;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,IAAI,CAAC,EAAE,QAAQ,CAAC;CACjB,2CAYF"}
@@ -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"}