@drivy/cobalt 2.9.3 → 2.11.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.
@@ -5,7 +5,7 @@ import { ButtonLinkBase, ButtonBase } from './ButtonComponent.js';
5
5
  import '../../Icon/index.js';
6
6
  import ChevronRightIcon from '../../Icon/__generated__/ChevronRightIcon.js';
7
7
 
8
- const getComputedClassName = ({ className, variant, size, destructive, primary, text, isIconOnly, fullWidth, }) => {
8
+ const getComputedClassName = ({ className, variant, size, destructive, primary, text, isIconOnly, fullWidth, selected, }) => {
9
9
  return cx(className, "cobalt-button", {
10
10
  "cobalt-button--primary": primary,
11
11
  "cobalt-button--destructive": destructive,
@@ -19,11 +19,12 @@ const getComputedClassName = ({ className, variant, size, destructive, primary,
19
19
  "cobalt-button--business": variant === "business",
20
20
  "cobalt-button--success": variant === "success",
21
21
  "cobalt-button--neutral": variant === "neutral",
22
+ "cobalt-button--selected": selected,
22
23
  "c-w-full": fullWidth,
23
24
  });
24
25
  };
25
26
  const Button = forwardRef((props, ref) => {
26
- const { children, className, variant, size, destructive, primary, text, icon, fullWidth, ...restProps } = props;
27
+ const { children, className, variant, size, destructive, primary, text, icon, fullWidth, selected, ...restProps } = props;
27
28
  const computedClassName = getComputedClassName({
28
29
  className,
29
30
  variant,
@@ -32,11 +33,12 @@ const Button = forwardRef((props, ref) => {
32
33
  primary,
33
34
  text,
34
35
  fullWidth,
36
+ selected,
35
37
  isIconOnly: !!icon && !children,
36
38
  });
37
39
  const content = (React.createElement(React.Fragment, null,
38
40
  icon,
39
- children && React.createElement("span", null, children),
41
+ children,
40
42
  text && children ? React.createElement(ChevronRightIcon, null) : null));
41
43
  if (isLinkProps(restProps)) {
42
44
  return (React.createElement(ButtonLinkBase, { ...restProps, className: computedClassName, ref: ref }, content));
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../../src/components/Buttons/Button/index.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\"\nimport cx from \"classnames\"\nimport {\n ButtonComponentProps,\n ButtonLinkComponentProps,\n ButtonProps,\n isLinkProps,\n} from \"./type\"\nimport { ButtonLinkBase, ButtonBase } from \"./ButtonComponent\"\nimport { ChevronRightIcon } from \"../../Icon\"\n\nconst getComputedClassName = ({\n className,\n variant,\n size,\n destructive,\n primary,\n text,\n isIconOnly,\n fullWidth,\n}: {\n className?: ButtonProps[\"className\"]\n variant?: ButtonProps[\"variant\"]\n size?: ButtonProps[\"size\"]\n destructive?: ButtonProps[\"destructive\"]\n primary?: ButtonProps[\"primary\"]\n text?: ButtonProps[\"text\"]\n isIconOnly?: boolean\n fullWidth?: ButtonProps[\"fullWidth\"]\n}) => {\n return cx(className, \"cobalt-button\", {\n \"cobalt-button--primary\": primary,\n \"cobalt-button--destructive\": destructive,\n \"cobalt-button--text\": text,\n \"cobalt-button--icon-only\": isIconOnly,\n \"cobalt-button--small\": size === \"small\",\n \"cobalt-button--large\": size === \"large\",\n \"cobalt-button--warning\": variant === \"warning\",\n \"cobalt-button--secondary\": variant === \"secondary\",\n \"cobalt-button--tertiary\": variant === \"tertiary\",\n \"cobalt-button--business\": variant === \"business\",\n \"cobalt-button--success\": variant === \"success\",\n \"cobalt-button--neutral\": variant === \"neutral\",\n \"c-w-full\": fullWidth,\n })\n}\n\ninterface ButtonOverloads {\n (\n props: Exclude<ButtonProps, ButtonComponentProps> &\n React.RefAttributes<HTMLAnchorElement>\n ): React.ReactElement\n (\n props: Exclude<ButtonProps, ButtonLinkComponentProps> &\n React.RefAttributes<HTMLButtonElement>\n ): React.ReactElement\n displayName?: string\n}\n\nconst Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(\n (props, ref) => {\n const {\n children,\n className,\n variant,\n size,\n destructive,\n primary,\n text,\n icon,\n fullWidth,\n ...restProps\n } = props\n\n const computedClassName = getComputedClassName({\n className,\n variant,\n size,\n destructive,\n primary,\n text,\n fullWidth,\n isIconOnly: !!icon && !children,\n })\n\n const content = (\n <>\n {icon}\n {children && <span>{children}</span>}\n {text && children ? <ChevronRightIcon /> : null}\n </>\n )\n\n if (isLinkProps(restProps)) {\n return (\n <ButtonLinkBase\n {...(restProps as ButtonLinkComponentProps)}\n className={computedClassName}\n ref={ref as React.ForwardedRef<HTMLAnchorElement>}\n >\n {content}\n </ButtonLinkBase>\n )\n }\n\n return (\n <ButtonBase\n {...(restProps as ButtonComponentProps)}\n className={computedClassName}\n ref={ref as React.ForwardedRef<HTMLButtonElement>}\n >\n {content}\n </ButtonBase>\n )\n }\n) as ButtonOverloads\n\nButton.displayName = \"Button\"\n\nexport default Button\n"],"names":[],"mappings":";;;;;;;AAWA,MAAM,oBAAoB,GAAG,CAAC,EAC5B,SAAS,EACT,OAAO,EACP,IAAI,EACJ,WAAW,EACX,OAAO,EACP,IAAI,EACJ,UAAU,EACV,SAAS,GAUV,KAAI;AACH,IAAA,OAAO,EAAE,CAAC,SAAS,EAAE,eAAe,EAAE;AACpC,QAAA,wBAAwB,EAAE,OAAO;AACjC,QAAA,4BAA4B,EAAE,WAAW;AACzC,QAAA,qBAAqB,EAAE,IAAI;AAC3B,QAAA,0BAA0B,EAAE,UAAU;QACtC,sBAAsB,EAAE,IAAI,KAAK,OAAO;QACxC,sBAAsB,EAAE,IAAI,KAAK,OAAO;QACxC,wBAAwB,EAAE,OAAO,KAAK,SAAS;QAC/C,0BAA0B,EAAE,OAAO,KAAK,WAAW;QACnD,yBAAyB,EAAE,OAAO,KAAK,UAAU;QACjD,yBAAyB,EAAE,OAAO,KAAK,UAAU;QACjD,wBAAwB,EAAE,OAAO,KAAK,SAAS;QAC/C,wBAAwB,EAAE,OAAO,KAAK,SAAS;AAC/C,QAAA,UAAU,EAAE,SAAS;AACtB,KAAA,CAAC,CAAA;AACJ,CAAC,CAAA;AAcK,MAAA,MAAM,GAAG,UAAU,CACvB,CAAC,KAAK,EAAE,GAAG,KAAI;IACb,MAAM,EACJ,QAAQ,EACR,SAAS,EACT,OAAO,EACP,IAAI,EACJ,WAAW,EACX,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,GAAG,SAAS,EACb,GAAG,KAAK,CAAA;IAET,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;QAC7C,SAAS;QACT,OAAO;QACP,IAAI;QACJ,WAAW;QACX,OAAO;QACP,IAAI;QACJ,SAAS;AACT,QAAA,UAAU,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ;AAChC,KAAA,CAAC,CAAA;IAEF,MAAM,OAAO,IACX,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA;QACG,IAAI;QACJ,QAAQ,IAAI,KAAO,CAAA,aAAA,CAAA,MAAA,EAAA,IAAA,EAAA,QAAQ,CAAQ;AACnC,QAAA,IAAI,IAAI,QAAQ,GAAG,KAAC,CAAA,aAAA,CAAA,gBAAgB,EAAG,IAAA,CAAA,GAAG,IAAI,CAC9C,CACJ,CAAA;AAED,IAAA,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE;AAC1B,QAAA,QACE,KAAC,CAAA,aAAA,CAAA,cAAc,EACR,EAAA,GAAA,SAAsC,EAC3C,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAA4C,IAEhD,OAAO,CACO,EAClB;KACF;AAED,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,UAAU,EACJ,EAAA,GAAA,SAAkC,EACvC,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAA4C,IAEhD,OAAO,CACG,EACd;AACH,CAAC,EACiB;AAEpB,MAAM,CAAC,WAAW,GAAG,QAAQ;;;;"}
1
+ {"version":3,"file":"index.js","sources":["../../../../src/components/Buttons/Button/index.tsx"],"sourcesContent":["import React, { forwardRef } from \"react\"\nimport cx from \"classnames\"\nimport {\n ButtonComponentProps,\n ButtonLinkComponentProps,\n ButtonProps,\n isLinkProps,\n} from \"./type\"\nimport { ButtonLinkBase, ButtonBase } from \"./ButtonComponent\"\nimport { ChevronRightIcon } from \"../../Icon\"\n\nconst getComputedClassName = ({\n className,\n variant,\n size,\n destructive,\n primary,\n text,\n isIconOnly,\n fullWidth,\n selected,\n}: {\n className?: ButtonProps[\"className\"]\n variant?: ButtonProps[\"variant\"]\n size?: ButtonProps[\"size\"]\n destructive?: ButtonProps[\"destructive\"]\n primary?: ButtonProps[\"primary\"]\n text?: ButtonProps[\"text\"]\n isIconOnly?: boolean\n fullWidth?: ButtonProps[\"fullWidth\"]\n selected?: ButtonProps[\"selected\"]\n}) => {\n return cx(className, \"cobalt-button\", {\n \"cobalt-button--primary\": primary,\n \"cobalt-button--destructive\": destructive,\n \"cobalt-button--text\": text,\n \"cobalt-button--icon-only\": isIconOnly,\n \"cobalt-button--small\": size === \"small\",\n \"cobalt-button--large\": size === \"large\",\n \"cobalt-button--warning\": variant === \"warning\",\n \"cobalt-button--secondary\": variant === \"secondary\",\n \"cobalt-button--tertiary\": variant === \"tertiary\",\n \"cobalt-button--business\": variant === \"business\",\n \"cobalt-button--success\": variant === \"success\",\n \"cobalt-button--neutral\": variant === \"neutral\",\n \"cobalt-button--selected\": selected,\n \"c-w-full\": fullWidth,\n })\n}\n\ninterface ButtonOverloads {\n (\n props: Exclude<ButtonProps, ButtonComponentProps> &\n React.RefAttributes<HTMLAnchorElement>\n ): React.ReactElement\n (\n props: Exclude<ButtonProps, ButtonLinkComponentProps> &\n React.RefAttributes<HTMLButtonElement>\n ): React.ReactElement\n displayName?: string\n}\n\nconst Button = forwardRef<HTMLButtonElement | HTMLAnchorElement, ButtonProps>(\n (props, ref) => {\n const {\n children,\n className,\n variant,\n size,\n destructive,\n primary,\n text,\n icon,\n fullWidth,\n selected,\n ...restProps\n } = props\n\n const computedClassName = getComputedClassName({\n className,\n variant,\n size,\n destructive,\n primary,\n text,\n fullWidth,\n selected,\n isIconOnly: !!icon && !children,\n })\n\n const content = (\n <>\n {icon}\n {children}\n {text && children ? <ChevronRightIcon /> : null}\n </>\n )\n\n if (isLinkProps(restProps)) {\n return (\n <ButtonLinkBase\n {...(restProps as ButtonLinkComponentProps)}\n className={computedClassName}\n ref={ref as React.ForwardedRef<HTMLAnchorElement>}\n >\n {content}\n </ButtonLinkBase>\n )\n }\n\n return (\n <ButtonBase\n {...(restProps as ButtonComponentProps)}\n className={computedClassName}\n ref={ref as React.ForwardedRef<HTMLButtonElement>}\n >\n {content}\n </ButtonBase>\n )\n }\n) as ButtonOverloads\n\nButton.displayName = \"Button\"\n\nexport default Button\n"],"names":[],"mappings":";;;;;;;AAWA,MAAM,oBAAoB,GAAG,CAAC,EAC5B,SAAS,EACT,OAAO,EACP,IAAI,EACJ,WAAW,EACX,OAAO,EACP,IAAI,EACJ,UAAU,EACV,SAAS,EACT,QAAQ,GAWT,KAAI;AACH,IAAA,OAAO,EAAE,CAAC,SAAS,EAAE,eAAe,EAAE;AACpC,QAAA,wBAAwB,EAAE,OAAO;AACjC,QAAA,4BAA4B,EAAE,WAAW;AACzC,QAAA,qBAAqB,EAAE,IAAI;AAC3B,QAAA,0BAA0B,EAAE,UAAU;QACtC,sBAAsB,EAAE,IAAI,KAAK,OAAO;QACxC,sBAAsB,EAAE,IAAI,KAAK,OAAO;QACxC,wBAAwB,EAAE,OAAO,KAAK,SAAS;QAC/C,0BAA0B,EAAE,OAAO,KAAK,WAAW;QACnD,yBAAyB,EAAE,OAAO,KAAK,UAAU;QACjD,yBAAyB,EAAE,OAAO,KAAK,UAAU;QACjD,wBAAwB,EAAE,OAAO,KAAK,SAAS;QAC/C,wBAAwB,EAAE,OAAO,KAAK,SAAS;AAC/C,QAAA,yBAAyB,EAAE,QAAQ;AACnC,QAAA,UAAU,EAAE,SAAS;AACtB,KAAA,CAAC,CAAA;AACJ,CAAC,CAAA;AAcK,MAAA,MAAM,GAAG,UAAU,CACvB,CAAC,KAAK,EAAE,GAAG,KAAI;IACb,MAAM,EACJ,QAAQ,EACR,SAAS,EACT,OAAO,EACP,IAAI,EACJ,WAAW,EACX,OAAO,EACP,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,QAAQ,EACR,GAAG,SAAS,EACb,GAAG,KAAK,CAAA;IAET,MAAM,iBAAiB,GAAG,oBAAoB,CAAC;QAC7C,SAAS;QACT,OAAO;QACP,IAAI;QACJ,WAAW;QACX,OAAO;QACP,IAAI;QACJ,SAAS;QACT,QAAQ;AACR,QAAA,UAAU,EAAE,CAAC,CAAC,IAAI,IAAI,CAAC,QAAQ;AAChC,KAAA,CAAC,CAAA;IAEF,MAAM,OAAO,IACX,KAAA,CAAA,aAAA,CAAA,KAAA,CAAA,QAAA,EAAA,IAAA;QACG,IAAI;QACJ,QAAQ;AACR,QAAA,IAAI,IAAI,QAAQ,GAAG,KAAC,CAAA,aAAA,CAAA,gBAAgB,EAAG,IAAA,CAAA,GAAG,IAAI,CAC9C,CACJ,CAAA;AAED,IAAA,IAAI,WAAW,CAAC,SAAS,CAAC,EAAE;AAC1B,QAAA,QACE,KAAC,CAAA,aAAA,CAAA,cAAc,EACR,EAAA,GAAA,SAAsC,EAC3C,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAA4C,IAEhD,OAAO,CACO,EAClB;KACF;AAED,IAAA,QACE,KAAC,CAAA,aAAA,CAAA,UAAU,EACJ,EAAA,GAAA,SAAkC,EACvC,SAAS,EAAE,iBAAiB,EAC5B,GAAG,EAAE,GAA4C,IAEhD,OAAO,CACG,EACd;AACH,CAAC,EACiB;AAEpB,MAAM,CAAC,WAAW,GAAG,QAAQ;;;;"}
@@ -1 +1 @@
1
- {"version":3,"file":"type.js","sources":["../../../../src/components/Buttons/Button/type.ts"],"sourcesContent":["type SharedButtonApiProps = {\n loading?: boolean\n disabled?: boolean\n primary?: boolean\n destructive?: boolean\n icon?: React.ReactNode\n text?: boolean\n fullWidth?: boolean\n // React.HTMLAttributes allows color to be passed in, but we don't want to allow it\n color?: never\n}\n\ntype SharedConditionalTextProps =\n | {\n text: true\n icon: React.ReactNode\n children?: never | false | undefined | null\n fullWidth?: never | false\n }\n | {\n text: true\n icon?: never\n fullWidth?: never | false\n }\n | {\n text?: false\n }\n\ntype SharedConditionalVariantProps =\n | {\n size?: \"large\"\n variant?: never\n }\n | {\n size: \"small\"\n destructive?: false\n primary?: false\n // Those variants are only available for small buttons\n variant:\n | \"warning\"\n | \"secondary\"\n | \"tertiary\"\n | \"business\"\n | \"success\"\n | \"neutral\"\n }\n | {\n size: \"small\"\n variant?: never\n }\n\n// Button props\nexport type ButtonComponentProps =\n React.ButtonHTMLAttributes<HTMLButtonElement> & {\n loading?: SharedButtonApiProps[\"loading\"]\n disabled?: SharedButtonApiProps[\"disabled\"]\n href?: never\n }\n\n// Link props\nexport type ButtonLinkComponentProps =\n React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n loading?: SharedButtonApiProps[\"loading\"]\n disabled?: SharedButtonApiProps[\"disabled\"]\n href?: string\n }\n\nexport const isLinkProps = (\n props: ButtonComponentProps | ButtonLinkComponentProps\n): props is ButtonLinkComponentProps => \"href\" in props && !!props.href\n\nexport type ButtonProps = (ButtonComponentProps | ButtonLinkComponentProps) &\n SharedButtonApiProps &\n SharedConditionalVariantProps &\n SharedConditionalTextProps\n"],"names":[],"mappings":"AAmEa,MAAA,WAAW,GAAG,CACzB,KAAsD,KAChB,MAAM,IAAI,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC;;;;"}
1
+ {"version":3,"file":"type.js","sources":["../../../../src/components/Buttons/Button/type.ts"],"sourcesContent":["type SharedButtonApiProps = {\n loading?: boolean\n disabled?: boolean\n primary?: boolean\n destructive?: boolean\n icon?: React.ReactNode\n text?: boolean\n fullWidth?: boolean\n selected?: boolean\n // React.HTMLAttributes allows color to be passed in, but we don't want to allow it\n color?: never\n}\n\ntype SharedConditionalTextProps =\n | {\n text: true\n icon: React.ReactNode\n children?: never | false | undefined | null\n fullWidth?: never | false\n }\n | {\n text: true\n icon?: never\n fullWidth?: never | false\n }\n | {\n text?: false\n }\n\ntype SharedConditionalVariantProps =\n | {\n size?: \"large\"\n variant?: never\n }\n | {\n size: \"small\"\n destructive?: false\n primary?: false\n selected?: false\n // Those variants are only available for small buttons\n variant:\n | \"warning\"\n | \"secondary\"\n | \"tertiary\"\n | \"business\"\n | \"success\"\n | \"neutral\"\n }\n | {\n size: \"small\"\n variant?: never\n }\n\n// Button props\nexport type ButtonComponentProps =\n React.ButtonHTMLAttributes<HTMLButtonElement> & {\n loading?: SharedButtonApiProps[\"loading\"]\n disabled?: SharedButtonApiProps[\"disabled\"]\n href?: never\n }\n\n// Link props\nexport type ButtonLinkComponentProps =\n React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n loading?: SharedButtonApiProps[\"loading\"]\n disabled?: SharedButtonApiProps[\"disabled\"]\n href?: string\n }\n\nexport const isLinkProps = (\n props: ButtonComponentProps | ButtonLinkComponentProps\n): props is ButtonLinkComponentProps => \"href\" in props && !!props.href\n\nexport type ButtonProps = (ButtonComponentProps | ButtonLinkComponentProps) &\n SharedButtonApiProps &\n SharedConditionalVariantProps &\n SharedConditionalTextProps\n"],"names":[],"mappings":"AAqEa,MAAA,WAAW,GAAG,CACzB,KAAsD,KAChB,MAAM,IAAI,KAAK,IAAI,CAAC,CAAC,KAAK,CAAC;;;;"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@drivy/cobalt",
3
- "version": "2.9.3",
3
+ "version": "2.11.0",
4
4
  "description": "Opinionated design system for Drivy's projects.",
5
5
  "main": "src/index.js",
6
6
  "types": "types/src/index.d.ts",
@@ -19,7 +19,7 @@
19
19
  "url": "https://github.com/TimPetricola"
20
20
  },
21
21
  "dependencies": {
22
- "@ark-ui/react": "5.26.2",
22
+ "@ark-ui/react": "5.30.0",
23
23
  "@juggle/resize-observer": "3.4.0",
24
24
  "@lottiefiles/react-lottie-player": "3.6.0",
25
25
  "@tippyjs/react": "4.2.6",
@@ -42,17 +42,17 @@
42
42
  "@getaround-eu/prettier-config": "1.2.1",
43
43
  "@getaround-eu/stylelint-config": "3.0.1",
44
44
  "@getaround-eu/ts-config": "2.2.1",
45
- "@rollup/plugin-commonjs": "28.0.6",
45
+ "@rollup/plugin-commonjs": "28.0.9",
46
46
  "@rollup/plugin-json": "6.1.0",
47
47
  "@rushstack/eslint-patch": "1.12.0",
48
- "@storybook/addon-essentials": "7.6.20",
48
+ "@storybook/addon-essentials": "7.6.21",
49
49
  "@storybook/addons": "7.6.17",
50
- "@storybook/blocks": "7.6.20",
51
- "@storybook/react": "7.6.20",
52
- "@storybook/react-webpack5": "7.6.20",
50
+ "@storybook/blocks": "7.6.21",
51
+ "@storybook/react": "7.6.21",
52
+ "@storybook/react-webpack5": "7.6.21",
53
53
  "@svgr/cli": "7.0.0",
54
54
  "@testing-library/jest-dom": "6.9.1",
55
- "@testing-library/react": "16.3.0",
55
+ "@testing-library/react": "16.3.1",
56
56
  "@testing-library/react-hooks": "8.0.1",
57
57
  "@types/fs-extra": "11.0.4",
58
58
  "@types/jest": "29.5.14",
@@ -62,12 +62,12 @@
62
62
  "@types/react": "18.3.24",
63
63
  "@types/react-dom": "18.3.7",
64
64
  "autoprefixer": "10.4.23",
65
- "core-js": "3.47.0",
65
+ "core-js": "3.48.0",
66
66
  "css-loader": "7.1.2",
67
67
  "eslint": "8.57.1",
68
68
  "eslint-plugin-storybook": "^0.12.0",
69
69
  "file-loader": "6.2.0",
70
- "fs-extra": "11.3.2",
70
+ "fs-extra": "11.3.3",
71
71
  "html-entities": "2.6.0",
72
72
  "jest": "29.7.0",
73
73
  "jest-environment-jsdom": "29.7.0",
@@ -88,10 +88,10 @@
88
88
  "rollup-plugin-copy": "3.5.0",
89
89
  "rollup-plugin-svgo": "2.0.0",
90
90
  "rollup-plugin-typescript2": "0.36.0",
91
- "sass": "1.97.0",
91
+ "sass": "1.97.2",
92
92
  "sass-loader": "13.3.3",
93
93
  "sharp-cli": "5.2.0",
94
- "storybook": "7.6.20",
94
+ "storybook": "7.6.21",
95
95
  "style-loader": "4.0.0",
96
96
  "stylelint": "15.11.0",
97
97
  "svg2vectordrawable": "2.9.1",
@@ -30,122 +30,164 @@
30
30
  flex-shrink: 0;
31
31
  }
32
32
 
33
- &.cobalt-button--large {
34
- @apply c-px-md;
35
- min-height: 48px;
36
- min-width: 48px;
33
+ &[href][aria-disabled="true"] {
34
+ pointer-events: none;
37
35
  }
38
36
 
39
- &.cobalt-button--small {
40
- @apply c-px-[12px] hover:c-drop-shadow-md;
41
- min-width: 32px;
42
- min-height: 32px;
43
-
44
- font-size: 14px;
37
+ &[disabled]:not([aria-busy="true"]),
38
+ &[href][aria-disabled="true"]:not([aria-busy="true"]) {
39
+ @apply c-state-none c-text-onSurfaceDisabled c-drop-shadow-none hover:c-no-underline;
40
+ opacity: 1;
41
+ cursor: not-allowed;
45
42
 
46
- .cobalt-Icon {
47
- width: 20px;
48
- height: 20px;
43
+ &:not(.cobalt-button--text) {
44
+ @apply c-bg-disabled c-border-transparent;
49
45
  }
46
+ }
50
47
 
51
- &.cobalt-button--warning {
52
- @apply c-bg-warning c-border-warning c-text-onWarning;
53
- }
48
+ &[aria-busy="true"]:not(.cobalt-button--text) {
49
+ @apply c-state-none c-drop-shadow-none hover:c-no-underline;
50
+ --c-state-interactive-color: var(--c-press);
54
51
 
55
- &.cobalt-button--tertiary {
56
- @apply c-bg-tertiary c-border-tertiary c-text-onTertiary;
57
- }
52
+ &:focus,
53
+ &:hover,
54
+ &:active {
55
+ --c-state-interactive-color: var(--c-press);
58
56
 
59
- &.cobalt-button--secondary {
60
- @apply c-bg-secondary c-border-secondary c-text-onSecondary;
57
+ transform: scale(1);
61
58
  }
59
+ }
62
60
 
63
- &.cobalt-button--business {
64
- @apply c-bg-businessContainer c-border-businessContainer c-text-onBusinessContainer;
65
- }
61
+ .cobalt-button__loading-icon {
62
+ @apply c-text-onSurface;
63
+ position: absolute;
66
64
 
67
- &.cobalt-button--success {
68
- @apply c-bg-success c-border-success c-text-onSuccess;
69
- }
65
+ display: none;
70
66
 
71
- &.cobalt-button--neutral {
72
- @apply c-bg-neutral c-border-neutral c-text-onNeutral;
73
- }
67
+ margin: auto;
74
68
  }
75
69
 
76
- &.cobalt-button--primary {
77
- @apply c-bg-primary c-border-primary c-text-onPrimary;
70
+ &[aria-busy="true"] {
71
+ color: transparent !important;
78
72
 
79
- &.cobalt-button--destructive {
80
- @apply c-bg-error c-border-error c-text-onError;
81
- }
73
+ cursor: progress;
82
74
  }
83
75
 
84
- &.cobalt-button--icon-only {
85
- @apply c-p-none c-rounded-full;
76
+ &[aria-busy="true"] > .cobalt-button__loading-icon {
77
+ display: inline-block;
86
78
  }
79
+ }
87
80
 
88
- &.cobalt-button--text {
89
- @apply c-state-none c-transform-none hover:c-underline c-px-none c-bg-transparent c-border-transparent c-text-current c-drop-shadow-none c-gap-none;
90
- transition: text-underline-offset 0.25s ease;
81
+ .cobalt-button--large {
82
+ @apply c-px-md;
83
+ min-height: 48px;
84
+ min-width: 48px;
85
+ }
91
86
 
92
- text-underline-offset: 2px;
87
+ .cobalt-button--small {
88
+ @apply c-px-[12px] hover:c-drop-shadow-md;
89
+ min-width: 32px;
90
+ min-height: 32px;
93
91
 
94
- &:active {
95
- text-underline-offset: 1px;
96
- }
92
+ font-size: 14px;
93
+
94
+ .cobalt-Icon {
95
+ width: 20px;
96
+ height: 20px;
97
+ }
97
98
 
98
- &.cobalt-button--icon-only {
99
- @apply c-state-interactive;
99
+ &.cobalt-button--warning {
100
+ @apply c-bg-warning c-border-warning c-text-onWarning;
101
+
102
+ .cobalt-button__loading-icon {
103
+ @apply c-text-onWarning;
100
104
  }
101
105
  }
102
106
 
103
- &.cobalt-button--destructive {
104
- @apply c-text-error;
107
+ &.cobalt-button--tertiary {
108
+ @apply c-bg-tertiary c-border-tertiary c-text-onTertiary;
109
+
110
+ .cobalt-button__loading-icon {
111
+ @apply c-text-onTertiary;
112
+ }
105
113
  }
106
114
 
107
- &[href][aria-disabled="true"] {
108
- pointer-events: none;
115
+ &.cobalt-button--secondary {
116
+ @apply c-bg-secondary c-border-secondary c-text-onSecondary;
117
+
118
+ .cobalt-button__loading-icon {
119
+ @apply c-text-onSecondary;
120
+ }
109
121
  }
110
122
 
111
- &[disabled]:not([aria-busy="true"]),
112
- &[href][aria-disabled="true"]:not([aria-busy="true"]) {
113
- @apply c-state-none c-text-onSurfaceDisabled c-drop-shadow-none hover:c-no-underline;
114
- opacity: 1;
115
- cursor: not-allowed;
123
+ &.cobalt-button--business {
124
+ @apply c-bg-businessContainer c-border-businessContainer c-text-onBusinessContainer;
116
125
 
117
- &:not(.cobalt-button--text) {
118
- @apply c-bg-disabled c-border-transparent;
126
+ .cobalt-button__loading-icon {
127
+ @apply c-text-onBusinessContainer;
119
128
  }
120
129
  }
121
130
 
122
- &[aria-busy="true"] {
123
- @apply c-state-none c-drop-shadow-none hover:c-no-underline;
124
- --c-state-interactive-color: var(--c-press);
125
- cursor: not-allowed;
131
+ &.cobalt-button--success {
132
+ @apply c-bg-success c-border-success c-text-onSuccess;
126
133
 
127
- &:focus,
128
- &:hover,
129
- &:active {
130
- --c-state-interactive-color: var(--c-press);
134
+ .cobalt-button__loading-icon {
135
+ @apply c-text-onSuccess;
136
+ }
137
+ }
131
138
 
132
- transform: scale(1);
139
+ &.cobalt-button--neutral {
140
+ @apply c-bg-neutral c-border-neutral c-text-onNeutral;
141
+
142
+ .cobalt-button__loading-icon {
143
+ @apply c-text-onNeutral;
133
144
  }
134
145
  }
146
+ }
147
+
148
+ .cobalt-button--primary {
149
+ @apply c-bg-primary c-border-primary c-text-onPrimary;
135
150
 
136
151
  .cobalt-button__loading-icon {
137
- position: absolute;
152
+ @apply c-text-onPrimary;
153
+ }
138
154
 
139
- display: none;
155
+ &.cobalt-button--destructive {
156
+ @apply c-bg-error c-border-error c-text-onError;
140
157
 
141
- margin: auto;
158
+ .cobalt-button__loading-icon {
159
+ @apply c-text-onError;
160
+ }
142
161
  }
162
+ }
163
+
164
+ .cobalt-button--text {
165
+ @apply c-state-none c-transform-none hover:c-underline c-px-none c-bg-transparent c-border-transparent c-text-current c-gap-none;
166
+ transition: text-underline-offset 0.25s ease;
167
+
168
+ text-underline-offset: 2px;
143
169
 
144
- &[aria-busy="true"] > *:not(.cobalt-button__loading-icon) {
145
- color: transparent;
170
+ &:active {
171
+ text-underline-offset: 1px;
146
172
  }
147
173
 
148
- &[aria-busy="true"] > .cobalt-button__loading-icon {
149
- display: inline-block;
174
+ &:not(.cobalt-button--icon-only) {
175
+ @apply c-drop-shadow-none;
150
176
  }
177
+
178
+ &.cobalt-button--icon-only:not([aria-busy="true"]):not([disabled]) {
179
+ @apply c-state-interactive;
180
+ }
181
+ }
182
+
183
+ .cobalt-button--icon-only {
184
+ @apply c-p-none c-rounded-full;
185
+ }
186
+
187
+ .cobalt-button--destructive {
188
+ @apply c-text-error;
189
+ }
190
+
191
+ .cobalt-button--selected {
192
+ @apply c-bg-primaryContainer c-text-onPrimaryContainer c-border-onPrimaryContainer;
151
193
  }
@@ -7,6 +7,7 @@ type SharedButtonApiProps = {
7
7
  icon?: React.ReactNode;
8
8
  text?: boolean;
9
9
  fullWidth?: boolean;
10
+ selected?: boolean;
10
11
  color?: never;
11
12
  };
12
13
  type SharedConditionalTextProps = {
@@ -28,6 +29,7 @@ type SharedConditionalVariantProps = {
28
29
  size: "small";
29
30
  destructive?: false;
30
31
  primary?: false;
32
+ selected?: false;
31
33
  variant: "warning" | "secondary" | "tertiary" | "business" | "success" | "neutral";
32
34
  } | {
33
35
  size: "small";
package/utilities.css CHANGED
@@ -67,4 +67,36 @@
67
67
  inherits: false;
68
68
  initial-value: transparent;
69
69
  }
70
+
71
+ .c-state-interactive-halo {
72
+ position: relative;
73
+ z-index: 1;
74
+
75
+ cursor: pointer;
76
+ }
77
+
78
+ .c-state-interactive-halo:hover::after {
79
+ @apply c--m-xs c-rounded-xl c-state-interactive;
80
+
81
+ position: absolute;
82
+
83
+ top: 0;
84
+ right: 0;
85
+ bottom: 0;
86
+ left: 0;
87
+
88
+ z-index: -1;
89
+
90
+ display: inline-block;
91
+
92
+ content: "";
93
+ }
94
+
95
+ .c-state-interactive-with-images {
96
+ cursor: pointer;
97
+ }
98
+
99
+ .c-state-interactive-with-images:hover .c-state-interactive-image {
100
+ filter: brightness(90%);
101
+ }
70
102
  }
@@ -1 +1 @@
1
- {"version":3,"file":"getCobaltTailwindcssConfig.js","sources":["../../utils/getCobaltTailwindcssConfig.js?commonjs-entry"],"sourcesContent":["import { getDefaultExportFromCjs } from \"\u0000commonjsHelpers.js\";\nimport { __require as requireGetCobaltTailwindcssConfig } from \"/Users/thibaudesnouf/sources/cobalt/utils/getCobaltTailwindcssConfig.js\";\nvar getCobaltTailwindcssConfigExports = requireGetCobaltTailwindcssConfig();\nexport { getCobaltTailwindcssConfigExports as __moduleExports };\nexport default /*@__PURE__*/getDefaultExportFromCjs(getCobaltTailwindcssConfigExports);"],"names":[],"mappings":";;;AAEA,IAAI,iCAAiC,GAAG,iCAAiC,EAAE,CAAC;AAE5E,iCAAe,aAAa,uBAAuB,CAAC,iCAAiC,CAAC;;;;"}
1
+ {"version":3,"file":"getCobaltTailwindcssConfig.js","sources":["../../utils/getCobaltTailwindcssConfig.js?commonjs-entry"],"sourcesContent":["import { getDefaultExportFromCjs } from \"\u0000commonjsHelpers.js\";\nimport { __require as requireGetCobaltTailwindcssConfig } from \"/Users/cedric/Dev/drivy/cobalt/utils/getCobaltTailwindcssConfig.js\";\nvar getCobaltTailwindcssConfigExports = requireGetCobaltTailwindcssConfig();\nexport { getCobaltTailwindcssConfigExports as __moduleExports };\nexport default /*@__PURE__*/getDefaultExportFromCjs(getCobaltTailwindcssConfigExports);"],"names":[],"mappings":";;;AAEA,IAAI,iCAAiC,GAAG,iCAAiC,EAAE,CAAC;AAE5E,iCAAe,aAAa,uBAAuB,CAAC,iCAAiC,CAAC;;;;"}