jvetrau-ds 0.1.45 → 0.2.2
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/components/button/button.cjs +41 -16
- package/components/button/button.cjs.map +1 -1
- package/components/button/button.css +226 -7
- package/components/button/button.d.ts +26 -3
- package/components/button/button.js +41 -16
- package/components/button/button.js.map +1 -1
- package/components/checkbox/checkbox.cjs +3 -1
- package/components/checkbox/checkbox.cjs.map +1 -1
- package/components/checkbox/checkbox.css +24 -1
- package/components/checkbox/checkbox.d.ts +1 -0
- package/components/checkbox/checkbox.js +3 -1
- package/components/checkbox/checkbox.js.map +1 -1
- package/components/field/field.cjs +37 -17
- package/components/field/field.cjs.map +1 -1
- package/components/field/field.css +17 -0
- package/components/field/field.d.ts +2 -2
- package/components/field/field.js +37 -17
- package/components/field/field.js.map +1 -1
- package/components/flip-list/flip-list.cjs +8 -2
- package/components/flip-list/flip-list.cjs.map +1 -1
- package/components/flip-list/flip-list.css +49 -3
- package/components/flip-list/flip-list.d.ts +1 -0
- package/components/flip-list/flip-list.js +8 -2
- package/components/flip-list/flip-list.js.map +1 -1
- package/components/index.cjs +0 -6
- package/components/index.d.ts +0 -2
- package/components/index.js +0 -1
- package/components/radio/radio.cjs +3 -1
- package/components/radio/radio.cjs.map +1 -1
- package/components/radio/radio.css +24 -1
- package/components/radio/radio.d.ts +1 -0
- package/components/radio/radio.js +3 -1
- package/components/radio/radio.js.map +1 -1
- package/components/tabs/tabs.cjs +25 -9
- package/components/tabs/tabs.cjs.map +1 -1
- package/components/tabs/tabs.css +63 -0
- package/components/tabs/tabs.d.ts +1 -0
- package/components/tabs/tabs.js +26 -10
- package/components/tabs/tabs.js.map +1 -1
- package/components/video/video.cjs +150 -60
- package/components/video/video.cjs.map +1 -1
- package/components/video/video.js +147 -58
- package/components/video/video.js.map +1 -1
- package/index.cjs +0 -6
- package/index.d.ts +0 -2
- package/index.js +0 -1
- package/package.json +1 -1
- package/styles.css +379 -57
- package/themes/base/desktop.css +1 -0
- package/themes/base/desktop.md +1 -0
- package/themes/base/desktop.scoped.css +1 -0
- package/themes/base/diagram.css +1 -0
- package/themes/base/diagram.md +1 -0
- package/themes/base/diagram.scoped.css +1 -0
- package/themes/base/mobile.css +1 -0
- package/themes/base/mobile.md +1 -0
- package/themes/base/mobile.scoped.css +1 -0
- package/themes/brandcopilot/desktop.css +1 -0
- package/themes/brandcopilot/desktop.md +1 -0
- package/themes/brandcopilot/desktop.scoped.css +1 -0
- package/themes/brandcopilot/diagram.css +1 -0
- package/themes/brandcopilot/diagram.md +1 -0
- package/themes/brandcopilot/diagram.scoped.css +1 -0
- package/themes/brandcopilot/mobile.css +1 -0
- package/themes/brandcopilot/mobile.md +1 -0
- package/themes/brandcopilot/mobile.scoped.css +1 -0
- package/themes/dmpatterns/desktop.css +1 -0
- package/themes/dmpatterns/desktop.md +1 -0
- package/themes/dmpatterns/desktop.scoped.css +1 -0
- package/themes/dmpatterns/diagram.css +1 -0
- package/themes/dmpatterns/diagram.md +1 -0
- package/themes/dmpatterns/diagram.scoped.css +1 -0
- package/themes/dmpatterns/mobile.css +1 -0
- package/themes/dmpatterns/mobile.md +1 -0
- package/themes/dmpatterns/mobile.scoped.css +1 -0
- package/themes/pdigest/desktop.css +1 -0
- package/themes/pdigest/desktop.md +1 -0
- package/themes/pdigest/desktop.scoped.css +1 -0
- package/themes/pdigest/diagram.css +1 -0
- package/themes/pdigest/diagram.md +1 -0
- package/themes/pdigest/diagram.scoped.css +1 -0
- package/themes/pdigest/mobile.css +1 -0
- package/themes/pdigest/mobile.md +1 -0
- package/themes/pdigest/mobile.scoped.css +1 -0
- package/themes/redesigntrack/desktop.css +1 -0
- package/themes/redesigntrack/desktop.md +1 -0
- package/themes/redesigntrack/desktop.scoped.css +1 -0
- package/themes/redesigntrack/diagram.css +1 -0
- package/themes/redesigntrack/diagram.md +1 -0
- package/themes/redesigntrack/diagram.scoped.css +1 -0
- package/themes/redesigntrack/mobile.css +1 -0
- package/themes/redesigntrack/mobile.md +1 -0
- package/themes/redesigntrack/mobile.scoped.css +1 -0
- package/tokens/runtime/tokens.base.desktop.runtime.cjs +1 -0
- package/tokens/runtime/tokens.base.desktop.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.base.desktop.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.base.desktop.runtime.js +1 -0
- package/tokens/runtime/tokens.base.desktop.runtime.js.map +1 -1
- package/tokens/runtime/tokens.base.diagram.runtime.cjs +1 -0
- package/tokens/runtime/tokens.base.diagram.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.base.diagram.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.base.diagram.runtime.js +1 -0
- package/tokens/runtime/tokens.base.diagram.runtime.js.map +1 -1
- package/tokens/runtime/tokens.base.mobile.runtime.cjs +1 -0
- package/tokens/runtime/tokens.base.mobile.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.base.mobile.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.base.mobile.runtime.js +1 -0
- package/tokens/runtime/tokens.base.mobile.runtime.js.map +1 -1
- package/tokens/runtime/tokens.brandcopilot.desktop.runtime.cjs +1 -0
- package/tokens/runtime/tokens.brandcopilot.desktop.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.brandcopilot.desktop.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.brandcopilot.desktop.runtime.js +1 -0
- package/tokens/runtime/tokens.brandcopilot.desktop.runtime.js.map +1 -1
- package/tokens/runtime/tokens.brandcopilot.diagram.runtime.cjs +1 -0
- package/tokens/runtime/tokens.brandcopilot.diagram.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.brandcopilot.diagram.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.brandcopilot.diagram.runtime.js +1 -0
- package/tokens/runtime/tokens.brandcopilot.diagram.runtime.js.map +1 -1
- package/tokens/runtime/tokens.brandcopilot.mobile.runtime.cjs +1 -0
- package/tokens/runtime/tokens.brandcopilot.mobile.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.brandcopilot.mobile.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.brandcopilot.mobile.runtime.js +1 -0
- package/tokens/runtime/tokens.brandcopilot.mobile.runtime.js.map +1 -1
- package/tokens/runtime/tokens.dmpatterns.desktop.runtime.cjs +1 -0
- package/tokens/runtime/tokens.dmpatterns.desktop.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.dmpatterns.desktop.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.dmpatterns.desktop.runtime.js +1 -0
- package/tokens/runtime/tokens.dmpatterns.desktop.runtime.js.map +1 -1
- package/tokens/runtime/tokens.dmpatterns.diagram.runtime.cjs +1 -0
- package/tokens/runtime/tokens.dmpatterns.diagram.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.dmpatterns.diagram.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.dmpatterns.diagram.runtime.js +1 -0
- package/tokens/runtime/tokens.dmpatterns.diagram.runtime.js.map +1 -1
- package/tokens/runtime/tokens.dmpatterns.mobile.runtime.cjs +1 -0
- package/tokens/runtime/tokens.dmpatterns.mobile.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.dmpatterns.mobile.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.dmpatterns.mobile.runtime.js +1 -0
- package/tokens/runtime/tokens.dmpatterns.mobile.runtime.js.map +1 -1
- package/tokens/runtime/tokens.pdigest.desktop.runtime.cjs +1 -0
- package/tokens/runtime/tokens.pdigest.desktop.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.pdigest.desktop.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.pdigest.desktop.runtime.js +1 -0
- package/tokens/runtime/tokens.pdigest.desktop.runtime.js.map +1 -1
- package/tokens/runtime/tokens.pdigest.diagram.runtime.cjs +1 -0
- package/tokens/runtime/tokens.pdigest.diagram.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.pdigest.diagram.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.pdigest.diagram.runtime.js +1 -0
- package/tokens/runtime/tokens.pdigest.diagram.runtime.js.map +1 -1
- package/tokens/runtime/tokens.pdigest.mobile.runtime.cjs +1 -0
- package/tokens/runtime/tokens.pdigest.mobile.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.pdigest.mobile.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.pdigest.mobile.runtime.js +1 -0
- package/tokens/runtime/tokens.pdigest.mobile.runtime.js.map +1 -1
- package/tokens/runtime/tokens.redesigntrack.desktop.runtime.cjs +1 -0
- package/tokens/runtime/tokens.redesigntrack.desktop.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.redesigntrack.desktop.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.redesigntrack.desktop.runtime.js +1 -0
- package/tokens/runtime/tokens.redesigntrack.desktop.runtime.js.map +1 -1
- package/tokens/runtime/tokens.redesigntrack.diagram.runtime.cjs +1 -0
- package/tokens/runtime/tokens.redesigntrack.diagram.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.redesigntrack.diagram.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.redesigntrack.diagram.runtime.js +1 -0
- package/tokens/runtime/tokens.redesigntrack.diagram.runtime.js.map +1 -1
- package/tokens/runtime/tokens.redesigntrack.mobile.runtime.cjs +1 -0
- package/tokens/runtime/tokens.redesigntrack.mobile.runtime.cjs.map +1 -1
- package/tokens/runtime/tokens.redesigntrack.mobile.runtime.d.ts +1 -0
- package/tokens/runtime/tokens.redesigntrack.mobile.runtime.js +1 -0
- package/tokens/runtime/tokens.redesigntrack.mobile.runtime.js.map +1 -1
- package/tokens/themes/base/dist/desktop.json +8 -0
- package/tokens/themes/base/dist/diagram.json +8 -0
- package/tokens/themes/base/dist/mobile.json +8 -0
- package/tokens/themes/brandcopilot/dist/desktop.json +8 -0
- package/tokens/themes/brandcopilot/dist/diagram.json +8 -0
- package/tokens/themes/brandcopilot/dist/mobile.json +8 -0
- package/tokens/themes/dmpatterns/dist/desktop.json +8 -0
- package/tokens/themes/dmpatterns/dist/diagram.json +8 -0
- package/tokens/themes/dmpatterns/dist/mobile.json +8 -0
- package/tokens/themes/pdigest/dist/desktop.json +8 -0
- package/tokens/themes/pdigest/dist/diagram.json +8 -0
- package/tokens/themes/pdigest/dist/mobile.json +8 -0
- package/tokens/themes/redesigntrack/dist/desktop.json +8 -0
- package/tokens/themes/redesigntrack/dist/diagram.json +8 -0
- package/tokens/themes/redesigntrack/dist/mobile.json +8 -0
- package/components/button-icon/button-icon.cjs +0 -48
- package/components/button-icon/button-icon.cjs.map +0 -1
- package/components/button-icon/button-icon.css +0 -67
- package/components/button-icon/button-icon.d.ts +0 -10
- package/components/button-icon/button-icon.js +0 -42
- package/components/button-icon/button-icon.js.map +0 -1
- package/components/button-icon/index.cjs +0 -13
- package/components/button-icon/index.cjs.map +0 -1
- package/components/button-icon/index.d.ts +0 -2
- package/components/button-icon/index.js +0 -3
- package/components/button-icon/index.js.map +0 -1
|
@@ -3,43 +3,68 @@
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var react = require('react');
|
|
5
5
|
require('./button.css');
|
|
6
|
-
var classnames = require('../helpers/classnames');
|
|
7
6
|
var Icon = require('../../icons/icon');
|
|
7
|
+
var classnames = require('../helpers/classnames');
|
|
8
8
|
|
|
9
9
|
function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
|
|
10
10
|
|
|
11
11
|
var Icon__default = /*#__PURE__*/_interopDefault(Icon);
|
|
12
12
|
|
|
13
|
+
function hasContent(value) {
|
|
14
|
+
return value !== null && value !== void 0;
|
|
15
|
+
}
|
|
13
16
|
const Button = ({
|
|
14
|
-
|
|
17
|
+
mode = "default",
|
|
18
|
+
rank = "default",
|
|
19
|
+
density = "default",
|
|
20
|
+
loading = false,
|
|
15
21
|
icon,
|
|
16
22
|
className = "",
|
|
17
23
|
disabled = false,
|
|
18
24
|
children,
|
|
19
25
|
...props
|
|
20
26
|
}) => {
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
+
const hasIcon = hasContent(icon);
|
|
28
|
+
const hasChildren = hasContent(children);
|
|
29
|
+
const isIconOnly = hasIcon && !hasChildren;
|
|
30
|
+
const isDisabled = disabled || loading;
|
|
31
|
+
const classes = classnames.classnames(
|
|
32
|
+
"button",
|
|
33
|
+
className,
|
|
34
|
+
{
|
|
35
|
+
"button--primary": rank === "primary",
|
|
36
|
+
"button--link": rank === "link",
|
|
37
|
+
"button--compact": density === "compact",
|
|
38
|
+
"button--toolbar": mode === "toolbar",
|
|
39
|
+
"button--disabled": isDisabled,
|
|
40
|
+
"button--loading": loading,
|
|
41
|
+
"button--icon-only": isIconOnly
|
|
42
|
+
}
|
|
43
|
+
);
|
|
27
44
|
let resolvedIcon = icon;
|
|
28
45
|
if (react.isValidElement(icon) && icon.type === Icon__default.default) {
|
|
29
46
|
const iconElement = icon;
|
|
30
|
-
resolvedIcon = react.cloneElement(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
47
|
+
resolvedIcon = react.cloneElement(
|
|
48
|
+
iconElement,
|
|
49
|
+
{
|
|
50
|
+
size: iconElement.props.size ?? "base",
|
|
51
|
+
className: classnames.classnames(
|
|
52
|
+
"button__icon",
|
|
53
|
+
iconElement.props.className
|
|
54
|
+
),
|
|
55
|
+
"aria-hidden": iconElement.props["aria-hidden"] ?? true,
|
|
56
|
+
focusable: iconElement.props.focusable ?? false
|
|
57
|
+
}
|
|
58
|
+
);
|
|
36
59
|
}
|
|
60
|
+
const resolvedAriaBusy = loading ? true : props["aria-busy"];
|
|
37
61
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
38
62
|
"button",
|
|
39
63
|
{
|
|
40
|
-
className: classes,
|
|
41
|
-
disabled,
|
|
42
64
|
...props,
|
|
65
|
+
className: classes,
|
|
66
|
+
disabled: isDisabled,
|
|
67
|
+
"aria-busy": resolvedAriaBusy,
|
|
43
68
|
children: [
|
|
44
69
|
resolvedIcon,
|
|
45
70
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/button/button.tsx"],"names":["classnames","isValidElement","Icon","cloneElement","jsxs"],"mappings":";;;;;;;;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/button/button.tsx"],"names":["classnames","isValidElement","Icon","cloneElement","jsxs"],"mappings":";;;;;;;;;;;;AA6DA,SAAS,WACP,KAAA,EAIA;AACA,EAAA,OAAO,KAAA,KAAU,QAAQ,KAAA,KAAU,MAAA;AACrC;AAEA,MAAM,SAAgC,CAAC;AAAA,EACrC,IAAA,GAAO,SAAA;AAAA,EACP,IAAA,GAAO,SAAA;AAAA,EACP,OAAA,GAAU,SAAA;AAAA,EACV,OAAA,GAAU,KAAA;AAAA,EACV,IAAA;AAAA,EACA,SAAA,GAAY,EAAA;AAAA,EACZ,QAAA,GAAW,KAAA;AAAA,EACX,QAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM,OAAA,GAAU,WAAW,IAAI,CAAA;AAC/B,EAAA,MAAM,WAAA,GAAc,WAAW,QAAQ,CAAA;AAEvC,EAAA,MAAM,UAAA,GACJ,WAAW,CAAC,WAAA;AAEd,EAAA,MAAM,aACJ,QAAA,IAAY,OAAA;AAEd,EAAA,MAAM,OAAA,GAAUA,qBAAA;AAAA,IACd,QAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,MACE,mBACE,IAAA,KAAS,SAAA;AAAA,MACX,gBACE,IAAA,KAAS,MAAA;AAAA,MACX,mBACE,OAAA,KAAY,SAAA;AAAA,MACd,mBACE,IAAA,KAAS,SAAA;AAAA,MACX,kBAAA,EACE,UAAA;AAAA,MACF,iBAAA,EACE,OAAA;AAAA,MACF,mBAAA,EACE;AAAA;AACJ,GACF;AAEA,EAAA,IAAI,YAAA,GAAe,IAAA;AAEnB,EAAA,IACEC,oBAAA,CAAe,IAAI,CAAA,IACnB,IAAA,CAAK,SAASC,qBAAA,EACd;AACA,IAAA,MAAM,WAAA,GACJ,IAAA;AAEF,IAAA,YAAA,GAAeC,kBAAA;AAAA,MACb,WAAA;AAAA,MACA;AAAA,QACE,IAAA,EACE,WAAA,CAAY,KAAA,CAAM,IAAA,IAClB,MAAA;AAAA,QACF,SAAA,EAAWH,qBAAA;AAAA,UACT,cAAA;AAAA,UACA,YAAY,KAAA,CAAM;AAAA,SACpB;AAAA,QACA,aAAA,EACE,WAAA,CAAY,KAAA,CACV,aACF,CAAA,IAAK,IAAA;AAAA,QACP,SAAA,EACE,WAAA,CAAY,KAAA,CACT,SAAA,IAAa;AAAA;AACpB,KACF;AAAA,EACF;AAEA,EAAA,MAAM,gBAAA,GACJ,OAAA,GACI,IAAA,GACA,KAAA,CAAM,WAAW,CAAA;AAEvB,EAAA,uBACEI,eAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,SAAA,EAAW,OAAA;AAAA,MACX,QAAA,EAAU,UAAA;AAAA,MACV,WAAA,EAAW,gBAAA;AAAA,MAEV,QAAA,EAAA;AAAA,QAAA,YAAA;AAAA,QACA;AAAA;AAAA;AAAA,GACH;AAEJ,CAAA;AAEA,IAAO,cAAA,GAAQ","file":"button.cjs","sourcesContent":["import React, {\n cloneElement,\n isValidElement,\n type ReactElement,\n} from 'react';\n\nimport './button.css';\nimport Icon, { type IconProps } from '../../icons/icon';\nimport { classnames } from '../helpers/classnames';\n\nexport type ButtonRank =\n | 'default'\n | 'primary'\n | 'link';\n\nexport type ButtonDensity =\n | 'default'\n | 'compact';\n\ntype ButtonNativeProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'children'\n>;\n\ninterface ButtonSharedProps\n extends ButtonNativeProps {\n density?: ButtonDensity;\n loading?: boolean;\n}\n\ntype RegularButtonContentProps =\n | {\n children: React.ReactNode;\n icon?: React.ReactNode;\n }\n | {\n children?: never;\n icon: React.ReactNode;\n 'aria-label': string;\n };\n\ntype RegularButtonProps =\n ButtonSharedProps &\n RegularButtonContentProps & {\n mode?: 'default';\n rank?: ButtonRank;\n };\n\ntype ToolbarButtonProps =\n ButtonSharedProps & {\n mode: 'toolbar';\n icon: React.ReactNode;\n children?: never;\n rank?: never;\n 'aria-label': string;\n };\n\nexport type ButtonProps =\n | RegularButtonProps\n | ToolbarButtonProps;\n\nfunction hasContent(\n value: React.ReactNode,\n): value is Exclude<\n React.ReactNode,\n null | undefined\n> {\n return value !== null && value !== undefined;\n}\n\nconst Button: React.FC<ButtonProps> = ({\n mode = 'default',\n rank = 'default',\n density = 'default',\n loading = false,\n icon,\n className = '',\n disabled = false,\n children,\n ...props\n}) => {\n const hasIcon = hasContent(icon);\n const hasChildren = hasContent(children);\n\n const isIconOnly =\n hasIcon && !hasChildren;\n\n const isDisabled =\n disabled || loading;\n\n const classes = classnames(\n 'button',\n className,\n {\n 'button--primary':\n rank === 'primary',\n 'button--link':\n rank === 'link',\n 'button--compact':\n density === 'compact',\n 'button--toolbar':\n mode === 'toolbar',\n 'button--disabled':\n isDisabled,\n 'button--loading':\n loading,\n 'button--icon-only':\n isIconOnly,\n },\n );\n\n let resolvedIcon = icon;\n\n if (\n isValidElement(icon) &&\n icon.type === Icon\n ) {\n const iconElement =\n icon as ReactElement<IconProps>;\n\n resolvedIcon = cloneElement(\n iconElement,\n {\n size:\n iconElement.props.size ??\n 'base',\n className: classnames(\n 'button__icon',\n iconElement.props.className,\n ),\n 'aria-hidden':\n iconElement.props[\n 'aria-hidden'\n ] ?? true,\n focusable:\n iconElement.props\n .focusable ?? false,\n },\n );\n }\n\n const resolvedAriaBusy =\n loading\n ? true\n : props['aria-busy'];\n\n return (\n <button\n {...props}\n className={classes}\n disabled={isDisabled}\n aria-busy={resolvedAriaBusy}\n >\n {resolvedIcon}\n {children}\n </button>\n );\n};\n\nexport default Button;\n"]}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
1
|
.button {
|
|
2
2
|
/* color */
|
|
3
|
-
--button-bg: var(--color-
|
|
4
|
-
--button-color: var(--color-text-
|
|
3
|
+
--button-bg: var(--color-control);
|
|
4
|
+
--button-color: var(--color-text-control);
|
|
5
5
|
--button-bg-disabled: var(--color-bg-disabled);
|
|
6
|
-
--button-color-disabled: var(
|
|
6
|
+
--button-color-disabled: var(
|
|
7
|
+
--color-text-disabled,
|
|
8
|
+
var(--color-text-control)
|
|
9
|
+
);
|
|
10
|
+
--button-focus-color: var(--button-bg);
|
|
7
11
|
|
|
8
12
|
background: var(--button-bg);
|
|
9
13
|
color: var(--button-color);
|
|
@@ -13,7 +17,9 @@
|
|
|
13
17
|
--button-font-weight: var(--font-control-weight);
|
|
14
18
|
--button-font-size: var(--font-control);
|
|
15
19
|
--button-line-height: var(--font-control-line);
|
|
16
|
-
--button-letter-spacing: var(
|
|
20
|
+
--button-letter-spacing: var(
|
|
21
|
+
--font-control-letter-spacing
|
|
22
|
+
);
|
|
17
23
|
|
|
18
24
|
font-family: var(--button-font-family);
|
|
19
25
|
font-size: var(--button-font-size);
|
|
@@ -25,7 +31,9 @@
|
|
|
25
31
|
--button-gap: var(--margin-icon);
|
|
26
32
|
--button-height: var(--size-control-height);
|
|
27
33
|
--button-padding-x: var(--padding-control-button-horz);
|
|
28
|
-
--button-padding-icon-only: var(
|
|
34
|
+
--button-padding-icon-only: var(
|
|
35
|
+
--padding-control-button-icon-horz
|
|
36
|
+
);
|
|
29
37
|
|
|
30
38
|
display: inline-flex;
|
|
31
39
|
align-items: center;
|
|
@@ -52,7 +60,8 @@
|
|
|
52
60
|
|
|
53
61
|
cursor: pointer;
|
|
54
62
|
user-select: none;
|
|
55
|
-
transition:
|
|
63
|
+
transition:
|
|
64
|
+
opacity var(--button-transition-duration) ease;
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
.button__icon {
|
|
@@ -74,31 +83,241 @@
|
|
|
74
83
|
}
|
|
75
84
|
|
|
76
85
|
.button:hover {
|
|
86
|
+
/* color */
|
|
87
|
+
|
|
88
|
+
/* typography */
|
|
89
|
+
|
|
90
|
+
/* size */
|
|
91
|
+
|
|
92
|
+
/* border */
|
|
93
|
+
|
|
94
|
+
/* depth */
|
|
95
|
+
|
|
96
|
+
/* motion */
|
|
77
97
|
opacity: var(--button-opacity-hover);
|
|
78
98
|
}
|
|
79
99
|
|
|
80
100
|
.button:focus-visible {
|
|
81
|
-
|
|
101
|
+
/* color */
|
|
102
|
+
|
|
103
|
+
/* typography */
|
|
104
|
+
|
|
105
|
+
/* size */
|
|
106
|
+
|
|
107
|
+
/* border */
|
|
108
|
+
outline:
|
|
109
|
+
var(--button-focus-width)
|
|
110
|
+
solid
|
|
111
|
+
var(--button-focus-color);
|
|
82
112
|
outline-offset: var(--button-focus-offset);
|
|
113
|
+
|
|
114
|
+
/* depth */
|
|
115
|
+
|
|
116
|
+
/* motion */
|
|
83
117
|
}
|
|
84
118
|
|
|
85
119
|
.button:active {
|
|
120
|
+
/* color */
|
|
121
|
+
|
|
122
|
+
/* typography */
|
|
123
|
+
|
|
124
|
+
/* size */
|
|
125
|
+
|
|
126
|
+
/* border */
|
|
127
|
+
|
|
128
|
+
/* depth */
|
|
129
|
+
|
|
130
|
+
/* motion */
|
|
86
131
|
opacity: var(--button-opacity-active);
|
|
87
132
|
}
|
|
88
133
|
|
|
89
134
|
.button:disabled,
|
|
90
135
|
.button--disabled {
|
|
136
|
+
/* color */
|
|
91
137
|
background: var(--button-bg-disabled);
|
|
92
138
|
color: var(--button-color-disabled);
|
|
139
|
+
|
|
140
|
+
/* typography */
|
|
141
|
+
|
|
142
|
+
/* size */
|
|
143
|
+
|
|
144
|
+
/* border */
|
|
145
|
+
|
|
146
|
+
/* depth */
|
|
147
|
+
|
|
148
|
+
/* motion */
|
|
93
149
|
opacity: var(--button-opacity-disabled);
|
|
94
150
|
cursor: not-allowed;
|
|
95
151
|
}
|
|
96
152
|
|
|
153
|
+
/* Rank */
|
|
154
|
+
|
|
97
155
|
.button--primary {
|
|
156
|
+
/* color */
|
|
98
157
|
--button-bg: var(--color-primary-2);
|
|
99
158
|
--button-color: var(--color-text-primary-2);
|
|
159
|
+
--button-focus-color: var(--color-primary-2);
|
|
160
|
+
|
|
161
|
+
/* typography */
|
|
162
|
+
|
|
163
|
+
/* size */
|
|
164
|
+
|
|
165
|
+
/* border */
|
|
166
|
+
|
|
167
|
+
/* depth */
|
|
168
|
+
|
|
169
|
+
/* motion */
|
|
100
170
|
}
|
|
101
171
|
|
|
172
|
+
.button--link {
|
|
173
|
+
/* color */
|
|
174
|
+
--button-bg: transparent;
|
|
175
|
+
--button-color: var(--color-link);
|
|
176
|
+
--button-focus-color: var(--color-link);
|
|
177
|
+
|
|
178
|
+
/* typography */
|
|
179
|
+
|
|
180
|
+
/* size */
|
|
181
|
+
height: auto;
|
|
182
|
+
min-height: 0;
|
|
183
|
+
padding: 0;
|
|
184
|
+
|
|
185
|
+
/* border */
|
|
186
|
+
|
|
187
|
+
/* depth */
|
|
188
|
+
|
|
189
|
+
/* motion */
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
.button--link:disabled,
|
|
193
|
+
.button--link.button--disabled {
|
|
194
|
+
/* color */
|
|
195
|
+
background: transparent;
|
|
196
|
+
|
|
197
|
+
/* typography */
|
|
198
|
+
|
|
199
|
+
/* size */
|
|
200
|
+
|
|
201
|
+
/* border */
|
|
202
|
+
|
|
203
|
+
/* depth */
|
|
204
|
+
|
|
205
|
+
/* motion */
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
/* Density */
|
|
209
|
+
|
|
210
|
+
.button--compact {
|
|
211
|
+
/* color */
|
|
212
|
+
|
|
213
|
+
/* typography */
|
|
214
|
+
|
|
215
|
+
/* size */
|
|
216
|
+
/*
|
|
217
|
+
* Compact presentation is intentionally left
|
|
218
|
+
* token-driven but visually unfinished.
|
|
219
|
+
*
|
|
220
|
+
* Add compact control dimensions when the
|
|
221
|
+
* corresponding semantic tokens are available.
|
|
222
|
+
*/
|
|
223
|
+
|
|
224
|
+
/* border */
|
|
225
|
+
|
|
226
|
+
/* depth */
|
|
227
|
+
|
|
228
|
+
/* motion */
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
/* Mode */
|
|
232
|
+
|
|
233
|
+
.button--toolbar {
|
|
234
|
+
/* color */
|
|
235
|
+
--button-bg: transparent;
|
|
236
|
+
--button-color: var(--color-text);
|
|
237
|
+
--button-focus-color: var(--color-text);
|
|
238
|
+
|
|
239
|
+
background: transparent;
|
|
240
|
+
|
|
241
|
+
/* typography */
|
|
242
|
+
|
|
243
|
+
/* size */
|
|
244
|
+
padding-inline: 0;
|
|
245
|
+
|
|
246
|
+
/* border */
|
|
247
|
+
|
|
248
|
+
/* depth */
|
|
249
|
+
|
|
250
|
+
/* motion */
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
.button--toolbar:disabled,
|
|
254
|
+
.button--toolbar.button--disabled {
|
|
255
|
+
/* color */
|
|
256
|
+
background: transparent;
|
|
257
|
+
|
|
258
|
+
/* typography */
|
|
259
|
+
|
|
260
|
+
/* size */
|
|
261
|
+
|
|
262
|
+
/* border */
|
|
263
|
+
|
|
264
|
+
/* depth */
|
|
265
|
+
|
|
266
|
+
/* motion */
|
|
267
|
+
}
|
|
268
|
+
|
|
269
|
+
/* State */
|
|
270
|
+
|
|
271
|
+
.button--loading {
|
|
272
|
+
/* color */
|
|
273
|
+
|
|
274
|
+
/* typography */
|
|
275
|
+
|
|
276
|
+
/* size */
|
|
277
|
+
|
|
278
|
+
/* border */
|
|
279
|
+
|
|
280
|
+
/* depth */
|
|
281
|
+
|
|
282
|
+
/* motion */
|
|
283
|
+
/*
|
|
284
|
+
* Loading behavior is already defined by the
|
|
285
|
+
* component contract:
|
|
286
|
+
* disabled + aria-busy.
|
|
287
|
+
*
|
|
288
|
+
* Spinner and visual treatment can be added
|
|
289
|
+
* later without changing the public API.
|
|
290
|
+
*/
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
/* Content */
|
|
294
|
+
|
|
102
295
|
.button--icon-only {
|
|
296
|
+
/* color */
|
|
297
|
+
|
|
298
|
+
/* typography */
|
|
299
|
+
|
|
300
|
+
/* size */
|
|
103
301
|
padding-inline: var(--button-padding-icon-only);
|
|
302
|
+
|
|
303
|
+
/* border */
|
|
304
|
+
|
|
305
|
+
/* depth */
|
|
306
|
+
|
|
307
|
+
/* motion */
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
.button--toolbar.button--icon-only {
|
|
311
|
+
/* color */
|
|
312
|
+
|
|
313
|
+
/* typography */
|
|
314
|
+
|
|
315
|
+
/* size */
|
|
316
|
+
padding-inline: 0;
|
|
317
|
+
|
|
318
|
+
/* border */
|
|
319
|
+
|
|
320
|
+
/* depth */
|
|
321
|
+
|
|
322
|
+
/* motion */
|
|
104
323
|
}
|
|
@@ -1,8 +1,31 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import './button.css';
|
|
3
|
-
export
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
export type ButtonRank = 'default' | 'primary' | 'link';
|
|
4
|
+
export type ButtonDensity = 'default' | 'compact';
|
|
5
|
+
type ButtonNativeProps = Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'children'>;
|
|
6
|
+
interface ButtonSharedProps extends ButtonNativeProps {
|
|
7
|
+
density?: ButtonDensity;
|
|
8
|
+
loading?: boolean;
|
|
6
9
|
}
|
|
10
|
+
type RegularButtonContentProps = {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
icon?: React.ReactNode;
|
|
13
|
+
} | {
|
|
14
|
+
children?: never;
|
|
15
|
+
icon: React.ReactNode;
|
|
16
|
+
'aria-label': string;
|
|
17
|
+
};
|
|
18
|
+
type RegularButtonProps = ButtonSharedProps & RegularButtonContentProps & {
|
|
19
|
+
mode?: 'default';
|
|
20
|
+
rank?: ButtonRank;
|
|
21
|
+
};
|
|
22
|
+
type ToolbarButtonProps = ButtonSharedProps & {
|
|
23
|
+
mode: 'toolbar';
|
|
24
|
+
icon: React.ReactNode;
|
|
25
|
+
children?: never;
|
|
26
|
+
rank?: never;
|
|
27
|
+
'aria-label': string;
|
|
28
|
+
};
|
|
29
|
+
export type ButtonProps = RegularButtonProps | ToolbarButtonProps;
|
|
7
30
|
declare const Button: React.FC<ButtonProps>;
|
|
8
31
|
export default Button;
|
|
@@ -1,39 +1,64 @@
|
|
|
1
1
|
import { jsxs } from 'react/jsx-runtime';
|
|
2
2
|
import { isValidElement, cloneElement } from 'react';
|
|
3
3
|
import './button.css';
|
|
4
|
-
import { classnames } from '../helpers/classnames';
|
|
5
4
|
import Icon from '../../icons/icon';
|
|
5
|
+
import { classnames } from '../helpers/classnames';
|
|
6
6
|
|
|
7
|
+
function hasContent(value) {
|
|
8
|
+
return value !== null && value !== void 0;
|
|
9
|
+
}
|
|
7
10
|
const Button = ({
|
|
8
|
-
|
|
11
|
+
mode = "default",
|
|
12
|
+
rank = "default",
|
|
13
|
+
density = "default",
|
|
14
|
+
loading = false,
|
|
9
15
|
icon,
|
|
10
16
|
className = "",
|
|
11
17
|
disabled = false,
|
|
12
18
|
children,
|
|
13
19
|
...props
|
|
14
20
|
}) => {
|
|
15
|
-
const
|
|
16
|
-
const
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
+
const hasIcon = hasContent(icon);
|
|
22
|
+
const hasChildren = hasContent(children);
|
|
23
|
+
const isIconOnly = hasIcon && !hasChildren;
|
|
24
|
+
const isDisabled = disabled || loading;
|
|
25
|
+
const classes = classnames(
|
|
26
|
+
"button",
|
|
27
|
+
className,
|
|
28
|
+
{
|
|
29
|
+
"button--primary": rank === "primary",
|
|
30
|
+
"button--link": rank === "link",
|
|
31
|
+
"button--compact": density === "compact",
|
|
32
|
+
"button--toolbar": mode === "toolbar",
|
|
33
|
+
"button--disabled": isDisabled,
|
|
34
|
+
"button--loading": loading,
|
|
35
|
+
"button--icon-only": isIconOnly
|
|
36
|
+
}
|
|
37
|
+
);
|
|
21
38
|
let resolvedIcon = icon;
|
|
22
39
|
if (isValidElement(icon) && icon.type === Icon) {
|
|
23
40
|
const iconElement = icon;
|
|
24
|
-
resolvedIcon = cloneElement(
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
41
|
+
resolvedIcon = cloneElement(
|
|
42
|
+
iconElement,
|
|
43
|
+
{
|
|
44
|
+
size: iconElement.props.size ?? "base",
|
|
45
|
+
className: classnames(
|
|
46
|
+
"button__icon",
|
|
47
|
+
iconElement.props.className
|
|
48
|
+
),
|
|
49
|
+
"aria-hidden": iconElement.props["aria-hidden"] ?? true,
|
|
50
|
+
focusable: iconElement.props.focusable ?? false
|
|
51
|
+
}
|
|
52
|
+
);
|
|
30
53
|
}
|
|
54
|
+
const resolvedAriaBusy = loading ? true : props["aria-busy"];
|
|
31
55
|
return /* @__PURE__ */ jsxs(
|
|
32
56
|
"button",
|
|
33
57
|
{
|
|
34
|
-
className: classes,
|
|
35
|
-
disabled,
|
|
36
58
|
...props,
|
|
59
|
+
className: classes,
|
|
60
|
+
disabled: isDisabled,
|
|
61
|
+
"aria-busy": resolvedAriaBusy,
|
|
37
62
|
children: [
|
|
38
63
|
resolvedIcon,
|
|
39
64
|
children
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"sources":["../../../src/components/button/button.tsx"],"names":[],"mappings":";;;;;;AA6DA,SAAS,WACP,KAAA,EAIA;AACA,EAAA,OAAO,KAAA,KAAU,QAAQ,KAAA,KAAU,MAAA;AACrC;AAEA,MAAM,SAAgC,CAAC;AAAA,EACrC,IAAA,GAAO,SAAA;AAAA,EACP,IAAA,GAAO,SAAA;AAAA,EACP,OAAA,GAAU,SAAA;AAAA,EACV,OAAA,GAAU,KAAA;AAAA,EACV,IAAA;AAAA,EACA,SAAA,GAAY,EAAA;AAAA,EACZ,QAAA,GAAW,KAAA;AAAA,EACX,QAAA;AAAA,EACA,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM,OAAA,GAAU,WAAW,IAAI,CAAA;AAC/B,EAAA,MAAM,WAAA,GAAc,WAAW,QAAQ,CAAA;AAEvC,EAAA,MAAM,UAAA,GACJ,WAAW,CAAC,WAAA;AAEd,EAAA,MAAM,aACJ,QAAA,IAAY,OAAA;AAEd,EAAA,MAAM,OAAA,GAAU,UAAA;AAAA,IACd,QAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,MACE,mBACE,IAAA,KAAS,SAAA;AAAA,MACX,gBACE,IAAA,KAAS,MAAA;AAAA,MACX,mBACE,OAAA,KAAY,SAAA;AAAA,MACd,mBACE,IAAA,KAAS,SAAA;AAAA,MACX,kBAAA,EACE,UAAA;AAAA,MACF,iBAAA,EACE,OAAA;AAAA,MACF,mBAAA,EACE;AAAA;AACJ,GACF;AAEA,EAAA,IAAI,YAAA,GAAe,IAAA;AAEnB,EAAA,IACE,cAAA,CAAe,IAAI,CAAA,IACnB,IAAA,CAAK,SAAS,IAAA,EACd;AACA,IAAA,MAAM,WAAA,GACJ,IAAA;AAEF,IAAA,YAAA,GAAe,YAAA;AAAA,MACb,WAAA;AAAA,MACA;AAAA,QACE,IAAA,EACE,WAAA,CAAY,KAAA,CAAM,IAAA,IAClB,MAAA;AAAA,QACF,SAAA,EAAW,UAAA;AAAA,UACT,cAAA;AAAA,UACA,YAAY,KAAA,CAAM;AAAA,SACpB;AAAA,QACA,aAAA,EACE,WAAA,CAAY,KAAA,CACV,aACF,CAAA,IAAK,IAAA;AAAA,QACP,SAAA,EACE,WAAA,CAAY,KAAA,CACT,SAAA,IAAa;AAAA;AACpB,KACF;AAAA,EACF;AAEA,EAAA,MAAM,gBAAA,GACJ,OAAA,GACI,IAAA,GACA,KAAA,CAAM,WAAW,CAAA;AAEvB,EAAA,uBACE,IAAA;AAAA,IAAC,QAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,SAAA,EAAW,OAAA;AAAA,MACX,QAAA,EAAU,UAAA;AAAA,MACV,WAAA,EAAW,gBAAA;AAAA,MAEV,QAAA,EAAA;AAAA,QAAA,YAAA;AAAA,QACA;AAAA;AAAA;AAAA,GACH;AAEJ,CAAA;AAEA,IAAO,cAAA,GAAQ","file":"button.js","sourcesContent":["import React, {\n cloneElement,\n isValidElement,\n type ReactElement,\n} from 'react';\n\nimport './button.css';\nimport Icon, { type IconProps } from '../../icons/icon';\nimport { classnames } from '../helpers/classnames';\n\nexport type ButtonRank =\n | 'default'\n | 'primary'\n | 'link';\n\nexport type ButtonDensity =\n | 'default'\n | 'compact';\n\ntype ButtonNativeProps = Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'children'\n>;\n\ninterface ButtonSharedProps\n extends ButtonNativeProps {\n density?: ButtonDensity;\n loading?: boolean;\n}\n\ntype RegularButtonContentProps =\n | {\n children: React.ReactNode;\n icon?: React.ReactNode;\n }\n | {\n children?: never;\n icon: React.ReactNode;\n 'aria-label': string;\n };\n\ntype RegularButtonProps =\n ButtonSharedProps &\n RegularButtonContentProps & {\n mode?: 'default';\n rank?: ButtonRank;\n };\n\ntype ToolbarButtonProps =\n ButtonSharedProps & {\n mode: 'toolbar';\n icon: React.ReactNode;\n children?: never;\n rank?: never;\n 'aria-label': string;\n };\n\nexport type ButtonProps =\n | RegularButtonProps\n | ToolbarButtonProps;\n\nfunction hasContent(\n value: React.ReactNode,\n): value is Exclude<\n React.ReactNode,\n null | undefined\n> {\n return value !== null && value !== undefined;\n}\n\nconst Button: React.FC<ButtonProps> = ({\n mode = 'default',\n rank = 'default',\n density = 'default',\n loading = false,\n icon,\n className = '',\n disabled = false,\n children,\n ...props\n}) => {\n const hasIcon = hasContent(icon);\n const hasChildren = hasContent(children);\n\n const isIconOnly =\n hasIcon && !hasChildren;\n\n const isDisabled =\n disabled || loading;\n\n const classes = classnames(\n 'button',\n className,\n {\n 'button--primary':\n rank === 'primary',\n 'button--link':\n rank === 'link',\n 'button--compact':\n density === 'compact',\n 'button--toolbar':\n mode === 'toolbar',\n 'button--disabled':\n isDisabled,\n 'button--loading':\n loading,\n 'button--icon-only':\n isIconOnly,\n },\n );\n\n let resolvedIcon = icon;\n\n if (\n isValidElement(icon) &&\n icon.type === Icon\n ) {\n const iconElement =\n icon as ReactElement<IconProps>;\n\n resolvedIcon = cloneElement(\n iconElement,\n {\n size:\n iconElement.props.size ??\n 'base',\n className: classnames(\n 'button__icon',\n iconElement.props.className,\n ),\n 'aria-hidden':\n iconElement.props[\n 'aria-hidden'\n ] ?? true,\n focusable:\n iconElement.props\n .focusable ?? false,\n },\n );\n }\n\n const resolvedAriaBusy =\n loading\n ? true\n : props['aria-busy'];\n\n return (\n <button\n {...props}\n className={classes}\n disabled={isDisabled}\n aria-busy={resolvedAriaBusy}\n >\n {resolvedIcon}\n {children}\n </button>\n );\n};\n\nexport default Button;\n"]}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
var jsxRuntime = require('react/jsx-runtime');
|
|
4
4
|
var classnames = require('../helpers/classnames');
|
|
5
|
+
require('./checkbox.css');
|
|
5
6
|
|
|
6
7
|
const Checkbox = ({
|
|
7
8
|
label,
|
|
@@ -16,6 +17,7 @@ const Checkbox = ({
|
|
|
16
17
|
"checkbox--disabled": disabled
|
|
17
18
|
}
|
|
18
19
|
);
|
|
20
|
+
const hasLabel = label !== null && label !== void 0;
|
|
19
21
|
return /* @__PURE__ */ jsxRuntime.jsxs("label", { className: classes, children: [
|
|
20
22
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
21
23
|
"input",
|
|
@@ -26,7 +28,7 @@ const Checkbox = ({
|
|
|
26
28
|
...props
|
|
27
29
|
}
|
|
28
30
|
),
|
|
29
|
-
|
|
31
|
+
hasLabel ? /* @__PURE__ */ jsxRuntime.jsx("span", { className: "checkbox__label", children: label }) : null
|
|
30
32
|
] });
|
|
31
33
|
};
|
|
32
34
|
var checkbox_default = Checkbox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/checkbox/checkbox.tsx"],"names":["classnames","jsxs","jsx"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/checkbox/checkbox.tsx"],"names":["classnames","jsxs","jsx"],"mappings":";;;;;;AAUA,MAAM,WAAoC,CAAC;AAAA,EACzC,KAAA;AAAA,EACA,SAAA,GAAY,EAAA;AAAA,EACZ,QAAA,GAAW,KAAA;AAAA,EACX,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM,OAAA,GAAUA,qBAAA;AAAA,IACd,UAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,MACE,oBAAA,EAAsB;AAAA;AACxB,GACF;AAEA,EAAA,MAAM,QAAA,GACJ,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,MAAA;AAE9B,EAAA,uBACEC,eAAA,CAAC,OAAA,EAAA,EAAM,SAAA,EAAW,OAAA,EAChB,QAAA,EAAA;AAAA,oBAAAC,cAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAU,iBAAA;AAAA,QACV,IAAA,EAAK,UAAA;AAAA,QACL,QAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA,IAEC,2BACCA,cAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,iBAAA,EACb,iBACH,CAAA,GACE;AAAA,GAAA,EACN,CAAA;AAEJ,CAAA;AAEA,IAAO,gBAAA,GAAQ","file":"checkbox.cjs","sourcesContent":["import React from 'react';\n\nimport { classnames } from '../helpers/classnames';\nimport './checkbox.css';\n\nexport interface CheckboxProps\n extends React.InputHTMLAttributes<HTMLInputElement> {\n label?: React.ReactNode;\n}\n\nconst Checkbox: React.FC<CheckboxProps> = ({\n label,\n className = '',\n disabled = false,\n ...props\n}) => {\n const classes = classnames(\n 'checkbox',\n className,\n {\n 'checkbox--disabled': disabled,\n },\n );\n\n const hasLabel =\n label !== null && label !== undefined;\n\n return (\n <label className={classes}>\n <input\n className=\"checkbox__input\"\n type=\"checkbox\"\n disabled={disabled}\n {...props}\n />\n\n {hasLabel ? (\n <span className=\"checkbox__label\">\n {label}\n </span>\n ) : null}\n </label>\n );\n};\n\nexport default Checkbox;\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
.checkbox {
|
|
2
2
|
/* color */
|
|
3
|
-
--checkbox-label-color:
|
|
3
|
+
--checkbox-label-color: inherit;
|
|
4
4
|
|
|
5
5
|
color: var(--checkbox-label-color);
|
|
6
6
|
|
|
@@ -34,6 +34,7 @@
|
|
|
34
34
|
|
|
35
35
|
.checkbox__input {
|
|
36
36
|
/* color */
|
|
37
|
+
accent-color: var(--color-primary-2);
|
|
37
38
|
|
|
38
39
|
/* typography */
|
|
39
40
|
|
|
@@ -71,10 +72,32 @@
|
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
.checkbox--disabled {
|
|
75
|
+
/* color */
|
|
76
|
+
|
|
77
|
+
/* typography */
|
|
78
|
+
|
|
79
|
+
/* size */
|
|
80
|
+
|
|
81
|
+
/* border */
|
|
82
|
+
|
|
83
|
+
/* depth */
|
|
84
|
+
|
|
85
|
+
/* motion */
|
|
74
86
|
opacity: var(--checkbox-opacity-disabled);
|
|
75
87
|
cursor: not-allowed;
|
|
76
88
|
}
|
|
77
89
|
|
|
78
90
|
.checkbox__input:disabled {
|
|
91
|
+
/* color */
|
|
92
|
+
|
|
93
|
+
/* typography */
|
|
94
|
+
|
|
95
|
+
/* size */
|
|
96
|
+
|
|
97
|
+
/* border */
|
|
98
|
+
|
|
99
|
+
/* depth */
|
|
100
|
+
|
|
101
|
+
/* motion */
|
|
79
102
|
cursor: not-allowed;
|
|
80
103
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
2
2
|
import { classnames } from '../helpers/classnames';
|
|
3
|
+
import './checkbox.css';
|
|
3
4
|
|
|
4
5
|
const Checkbox = ({
|
|
5
6
|
label,
|
|
@@ -14,6 +15,7 @@ const Checkbox = ({
|
|
|
14
15
|
"checkbox--disabled": disabled
|
|
15
16
|
}
|
|
16
17
|
);
|
|
18
|
+
const hasLabel = label !== null && label !== void 0;
|
|
17
19
|
return /* @__PURE__ */ jsxs("label", { className: classes, children: [
|
|
18
20
|
/* @__PURE__ */ jsx(
|
|
19
21
|
"input",
|
|
@@ -24,7 +26,7 @@ const Checkbox = ({
|
|
|
24
26
|
...props
|
|
25
27
|
}
|
|
26
28
|
),
|
|
27
|
-
|
|
29
|
+
hasLabel ? /* @__PURE__ */ jsx("span", { className: "checkbox__label", children: label }) : null
|
|
28
30
|
] });
|
|
29
31
|
};
|
|
30
32
|
var checkbox_default = Checkbox;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/components/checkbox/checkbox.tsx"],"names":[],"mappings":";;;;AAUA,MAAM,WAAoC,CAAC;AAAA,EACzC,KAAA;AAAA,EACA,SAAA,GAAY,EAAA;AAAA,EACZ,QAAA,GAAW,KAAA;AAAA,EACX,GAAG;AACL,CAAA,KAAM;AACJ,EAAA,MAAM,OAAA,GAAU,UAAA;AAAA,IACd,UAAA;AAAA,IACA,SAAA;AAAA,IACA;AAAA,MACE,oBAAA,EAAsB;AAAA;AACxB,GACF;AAEA,EAAA,MAAM,QAAA,GACJ,KAAA,KAAU,IAAA,IAAQ,KAAA,KAAU,MAAA;AAE9B,EAAA,uBACE,IAAA,CAAC,OAAA,EAAA,EAAM,SAAA,EAAW,OAAA,EAChB,QAAA,EAAA;AAAA,oBAAA,GAAA;AAAA,MAAC,OAAA;AAAA,MAAA;AAAA,QACC,SAAA,EAAU,iBAAA;AAAA,QACV,IAAA,EAAK,UAAA;AAAA,QACL,QAAA;AAAA,QACC,GAAG;AAAA;AAAA,KACN;AAAA,IAEC,2BACC,GAAA,CAAC,MAAA,EAAA,EAAK,SAAA,EAAU,iBAAA,EACb,iBACH,CAAA,GACE;AAAA,GAAA,EACN,CAAA;AAEJ,CAAA;AAEA,IAAO,gBAAA,GAAQ","file":"checkbox.js","sourcesContent":["import React from 'react';\n\nimport { classnames } from '../helpers/classnames';\nimport './checkbox.css';\n\nexport interface CheckboxProps\n extends React.InputHTMLAttributes<HTMLInputElement> {\n label?: React.ReactNode;\n}\n\nconst Checkbox: React.FC<CheckboxProps> = ({\n label,\n className = '',\n disabled = false,\n ...props\n}) => {\n const classes = classnames(\n 'checkbox',\n className,\n {\n 'checkbox--disabled': disabled,\n },\n );\n\n const hasLabel =\n label !== null && label !== undefined;\n\n return (\n <label className={classes}>\n <input\n className=\"checkbox__input\"\n type=\"checkbox\"\n disabled={disabled}\n {...props}\n />\n\n {hasLabel ? (\n <span className=\"checkbox__label\">\n {label}\n </span>\n ) : null}\n </label>\n );\n};\n\nexport default Checkbox;\n"]}
|