@dnanpm/ui-components 0.1.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -2
- package/dist/components/Accordion/Accordion.cjs +9 -3
- package/dist/components/Accordion/Accordion.cjs.map +1 -1
- package/dist/components/Accordion/Accordion.css +1 -1
- package/dist/components/Accordion/Accordion.d.ts +1 -1
- package/dist/components/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/Accordion/Accordion.js +10 -4
- package/dist/components/Accordion/Accordion.js.map +1 -1
- package/dist/components/Accordion/Accordion.types.d.ts +2 -2
- package/dist/components/Accordion/Accordion.types.d.ts.map +1 -1
- package/dist/components/AccordionItem/AccordionItem.cjs +43 -43
- package/dist/components/AccordionItem/AccordionItem.cjs.map +1 -1
- package/dist/components/AccordionItem/AccordionItem.css +20 -20
- package/dist/components/AccordionItem/AccordionItem.d.ts +1 -1
- package/dist/components/AccordionItem/AccordionItem.d.ts.map +1 -1
- package/dist/components/AccordionItem/AccordionItem.js +43 -43
- package/dist/components/AccordionItem/AccordionItem.js.map +1 -1
- package/dist/components/AccordionItem/AccordionItem.module.css.cjs +11 -11
- package/dist/components/AccordionItem/AccordionItem.module.css.js +11 -11
- package/dist/components/AccordionItem/AccordionItem.types.d.ts +2 -2
- package/dist/components/AccordionItem/AccordionItem.types.d.ts.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.cjs +4 -5
- package/dist/components/Breadcrumb/Breadcrumb.cjs.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.css +16 -15
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.js +4 -5
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/components/Breadcrumb/Breadcrumb.module.css.cjs +6 -6
- package/dist/components/Breadcrumb/Breadcrumb.module.css.js +6 -6
- package/dist/components/Breadcrumb/Breadcrumb.types.d.ts +1 -5
- package/dist/components/Breadcrumb/Breadcrumb.types.d.ts.map +1 -1
- package/dist/components/Button/Button.cjs +104 -0
- package/dist/components/Button/Button.cjs.map +1 -0
- package/dist/components/Button/Button.css +188 -0
- package/dist/components/Button/Button.d.ts +3 -0
- package/dist/components/Button/Button.d.ts.map +1 -0
- package/dist/components/Button/Button.js +104 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/Button.module.css.cjs +24 -0
- package/dist/components/Button/Button.module.css.cjs.map +1 -0
- package/dist/components/Button/Button.module.css.js +24 -0
- package/dist/components/Button/Button.module.css.js.map +1 -0
- package/dist/components/Button/Button.types.d.ts +84 -0
- package/dist/components/Button/Button.types.d.ts.map +1 -0
- package/dist/components/Button/index.d.ts +3 -0
- package/dist/components/Button/index.d.ts.map +1 -0
- package/dist/components/ColorScheme/ColorScheme.cjs +9 -0
- package/dist/components/ColorScheme/ColorScheme.cjs.map +1 -0
- package/dist/components/ColorScheme/ColorScheme.d.ts +3 -0
- package/dist/components/ColorScheme/ColorScheme.d.ts.map +1 -0
- package/dist/components/ColorScheme/ColorScheme.js +9 -0
- package/dist/components/ColorScheme/ColorScheme.js.map +1 -0
- package/dist/components/ColorScheme/ColorScheme.types.d.ts +10 -0
- package/dist/components/ColorScheme/ColorScheme.types.d.ts.map +1 -0
- package/dist/components/ColorScheme/index.d.ts +3 -0
- package/dist/components/ColorScheme/index.d.ts.map +1 -0
- package/dist/components/Label/Label.cjs +2 -4
- package/dist/components/Label/Label.cjs.map +1 -1
- package/dist/components/Label/Label.css +15 -17
- package/dist/components/Label/Label.d.ts +1 -1
- package/dist/components/Label/Label.d.ts.map +1 -1
- package/dist/components/Label/Label.js +2 -4
- package/dist/components/Label/Label.js.map +1 -1
- package/dist/components/Label/Label.module.css.cjs +7 -7
- package/dist/components/Label/Label.module.css.js +7 -7
- package/dist/components/Label/Label.types.d.ts +1 -5
- package/dist/components/Label/Label.types.d.ts.map +1 -1
- package/dist/components/Notification/Notification.cjs +5 -6
- package/dist/components/Notification/Notification.cjs.map +1 -1
- package/dist/components/Notification/Notification.css +19 -20
- package/dist/components/Notification/Notification.d.ts +1 -1
- package/dist/components/Notification/Notification.d.ts.map +1 -1
- package/dist/components/Notification/Notification.js +5 -6
- package/dist/components/Notification/Notification.js.map +1 -1
- package/dist/components/Notification/Notification.module.css.cjs +9 -9
- package/dist/components/Notification/Notification.module.css.js +9 -9
- package/dist/components/Notification/Notification.types.d.ts +1 -1
- package/dist/components/Notification/Notification.types.d.ts.map +1 -1
- package/dist/components/Pictograph/Pictograph.cjs +33 -0
- package/dist/components/Pictograph/Pictograph.cjs.map +1 -0
- package/dist/components/Pictograph/Pictograph.css +190 -0
- package/dist/components/Pictograph/Pictograph.d.ts +3 -0
- package/dist/components/Pictograph/Pictograph.d.ts.map +1 -0
- package/dist/components/Pictograph/Pictograph.js +33 -0
- package/dist/components/Pictograph/Pictograph.js.map +1 -0
- package/dist/components/Pictograph/Pictograph.module.css.cjs +22 -0
- package/dist/components/Pictograph/Pictograph.module.css.cjs.map +1 -0
- package/dist/components/Pictograph/Pictograph.module.css.js +22 -0
- package/dist/components/Pictograph/Pictograph.module.css.js.map +1 -0
- package/dist/components/Pictograph/Pictograph.types.d.ts +46 -0
- package/dist/components/Pictograph/Pictograph.types.d.ts.map +1 -0
- package/dist/components/Pictograph/PictographItem.cjs +19 -0
- package/dist/components/Pictograph/PictographItem.cjs.map +1 -0
- package/dist/components/Pictograph/PictographItem.css +63 -0
- package/dist/components/Pictograph/PictographItem.d.ts +3 -0
- package/dist/components/Pictograph/PictographItem.d.ts.map +1 -0
- package/dist/components/Pictograph/PictographItem.js +19 -0
- package/dist/components/Pictograph/PictographItem.js.map +1 -0
- package/dist/components/Pictograph/PictographItem.module.css.cjs +9 -0
- package/dist/components/Pictograph/PictographItem.module.css.cjs.map +1 -0
- package/dist/components/Pictograph/PictographItem.module.css.js +10 -0
- package/dist/components/Pictograph/PictographItem.module.css.js.map +1 -0
- package/dist/components/Pictograph/index.d.ts +4 -0
- package/dist/components/Pictograph/index.d.ts.map +1 -0
- package/dist/components/Spinner/Spinner.cjs +62 -0
- package/dist/components/Spinner/Spinner.cjs.map +1 -0
- package/dist/components/Spinner/Spinner.css +116 -0
- package/dist/components/Spinner/Spinner.d.ts +3 -0
- package/dist/components/Spinner/Spinner.d.ts.map +1 -0
- package/dist/components/Spinner/Spinner.js +62 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Spinner/Spinner.module.css.cjs +26 -0
- package/dist/components/Spinner/Spinner.module.css.cjs.map +1 -0
- package/dist/components/Spinner/Spinner.module.css.js +26 -0
- package/dist/components/Spinner/Spinner.module.css.js.map +1 -0
- package/dist/components/Spinner/Spinner.types.d.ts +41 -0
- package/dist/components/Spinner/Spinner.types.d.ts.map +1 -0
- package/dist/components/Spinner/index.d.ts +3 -0
- package/dist/components/Spinner/index.d.ts.map +1 -0
- package/dist/index.cjs +10 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/utils/elevation.css +8 -8
- package/dist/styles/utils/elevation.module.css.cjs +1 -1
- package/dist/styles/utils/elevation.module.css.js +1 -1
- package/dist/styles/utils/focus.css +34 -13
- package/dist/styles/utils/focus.module.css.cjs +3 -3
- package/dist/styles/utils/focus.module.css.js +3 -3
- package/dist/styles/utils/text-decoration.css +1 -1
- package/dist/styles.css +349 -174
- package/package.json +3 -3
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import focusStyles from "../../styles/utils/focus.module.css.js";
|
|
3
|
+
import styles from "./Button.module.css.js";
|
|
4
|
+
import { cn } from "../../utils/cn/cn.js";
|
|
5
|
+
import { Spinner } from "../Spinner/Spinner.js";
|
|
6
|
+
const Button = ({
|
|
7
|
+
variant = "primary",
|
|
8
|
+
fullWidth = false,
|
|
9
|
+
size = "normal",
|
|
10
|
+
loading = false,
|
|
11
|
+
className,
|
|
12
|
+
children,
|
|
13
|
+
ref,
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
const isDisabled = "disabled" in props && props.disabled;
|
|
17
|
+
const isAnchor = "href" in props && props.href != null;
|
|
18
|
+
const classes = cn(
|
|
19
|
+
styles.button,
|
|
20
|
+
styles[`button--${variant}`],
|
|
21
|
+
{ [styles["button--full-width"]]: fullWidth },
|
|
22
|
+
styles[`button--${size}`],
|
|
23
|
+
focusStyles.focusable,
|
|
24
|
+
{ [styles["button--disabled"]]: isDisabled },
|
|
25
|
+
{ [styles["button--loading"]]: loading },
|
|
26
|
+
className
|
|
27
|
+
);
|
|
28
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
29
|
+
/* @__PURE__ */ jsx("span", { className: styles.button__content, children }),
|
|
30
|
+
loading && /* @__PURE__ */ jsx(
|
|
31
|
+
Spinner,
|
|
32
|
+
{
|
|
33
|
+
size: size === "small" ? "xs" : "s",
|
|
34
|
+
color: "inherit",
|
|
35
|
+
"aria-hidden": "true",
|
|
36
|
+
"aria-label": void 0,
|
|
37
|
+
role: "presentation",
|
|
38
|
+
className: styles.button__spinner
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
] });
|
|
42
|
+
if (isAnchor) {
|
|
43
|
+
const { href, renderLink, ...anchorProps } = props;
|
|
44
|
+
const {
|
|
45
|
+
disabled: _disabled,
|
|
46
|
+
type: _type,
|
|
47
|
+
name: _name,
|
|
48
|
+
...safeAnchorProps
|
|
49
|
+
} = anchorProps;
|
|
50
|
+
const target = safeAnchorProps.target;
|
|
51
|
+
const rel = safeAnchorProps.rel;
|
|
52
|
+
const shouldHardenRel = target === "_blank";
|
|
53
|
+
const relTokens = new Set((rel ?? "").split(/\s+/).filter(Boolean));
|
|
54
|
+
if (shouldHardenRel) {
|
|
55
|
+
relTokens.add("noopener");
|
|
56
|
+
relTokens.add("noreferrer");
|
|
57
|
+
}
|
|
58
|
+
const hardenedRel = relTokens.size > 0 ? Array.from(relTokens).join(" ") : void 0;
|
|
59
|
+
const linkProps = {
|
|
60
|
+
...safeAnchorProps,
|
|
61
|
+
ref,
|
|
62
|
+
href,
|
|
63
|
+
rel: hardenedRel,
|
|
64
|
+
className: classes,
|
|
65
|
+
"aria-busy": loading || void 0,
|
|
66
|
+
"aria-disabled": loading || void 0,
|
|
67
|
+
tabIndex: loading ? -1 : void 0,
|
|
68
|
+
onClick: loading ? (e) => {
|
|
69
|
+
e.preventDefault();
|
|
70
|
+
e.stopPropagation();
|
|
71
|
+
} : safeAnchorProps.onClick,
|
|
72
|
+
children: content
|
|
73
|
+
};
|
|
74
|
+
if (renderLink) {
|
|
75
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderLink(linkProps) });
|
|
76
|
+
}
|
|
77
|
+
return /* @__PURE__ */ jsx("a", { ...linkProps });
|
|
78
|
+
}
|
|
79
|
+
const {
|
|
80
|
+
type = "button",
|
|
81
|
+
disabled,
|
|
82
|
+
href: _href,
|
|
83
|
+
target: _target,
|
|
84
|
+
rel: _rel,
|
|
85
|
+
renderLink: _renderLink,
|
|
86
|
+
...buttonProps
|
|
87
|
+
} = props;
|
|
88
|
+
return /* @__PURE__ */ jsx(
|
|
89
|
+
"button",
|
|
90
|
+
{
|
|
91
|
+
ref,
|
|
92
|
+
type,
|
|
93
|
+
disabled: disabled || loading,
|
|
94
|
+
className: classes,
|
|
95
|
+
"aria-busy": loading || void 0,
|
|
96
|
+
...buttonProps,
|
|
97
|
+
children: content
|
|
98
|
+
}
|
|
99
|
+
);
|
|
100
|
+
};
|
|
101
|
+
export {
|
|
102
|
+
Button
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=Button.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.js","sources":["../../../src/components/Button/Button.tsx"],"sourcesContent":["import type { AnchorHTMLAttributes, MouseEvent, ReactNode, Ref } from 'react';\nimport { cn } from '../../utils/cn';\nimport focusStyles from '../../styles/utils/focus.module.css';\nimport styles from './Button.module.css';\nimport { Spinner } from '../Spinner';\nimport type { ButtonProps } from './Button.types';\n\nexport const Button = ({\n variant = 'primary',\n fullWidth = false,\n size = 'normal',\n loading = false,\n className,\n children,\n ref,\n ...props\n}: ButtonProps) => {\n const isDisabled = 'disabled' in props && props.disabled;\n const isAnchor = 'href' in props && props.href != null;\n\n const classes = cn(\n styles.button,\n styles[`button--${variant}`],\n { [styles['button--full-width']]: fullWidth },\n styles[`button--${size}`],\n focusStyles.focusable,\n { [styles['button--disabled']]: isDisabled },\n { [styles['button--loading']]: loading },\n className,\n );\n\n const content = (\n <>\n <span className={styles.button__content}>{children}</span>\n {loading && (\n <Spinner\n size={size === 'small' ? 'xs' : 's'}\n color=\"inherit\"\n aria-hidden=\"true\"\n aria-label={undefined}\n role=\"presentation\"\n className={styles.button__spinner}\n />\n )}\n </>\n );\n\n if (isAnchor) {\n const { href, renderLink, ...anchorProps } = props as Omit<\n typeof props,\n 'variant' | 'size' | 'loading'\n > & {\n href: string;\n renderLink?: (\n props: AnchorHTMLAttributes<HTMLAnchorElement> & {\n href: string;\n children: ReactNode;\n },\n ) => ReactNode;\n };\n\n const {\n disabled: _disabled,\n type: _type,\n name: _name,\n ...safeAnchorProps\n } = anchorProps as typeof anchorProps & {\n disabled?: boolean;\n type?: 'button' | 'submit' | 'reset';\n name?: string;\n };\n\n const target = safeAnchorProps.target;\n const rel = safeAnchorProps.rel;\n const shouldHardenRel = target === '_blank';\n const relTokens = new Set((rel ?? '').split(/\\s+/).filter(Boolean));\n\n if (shouldHardenRel) {\n relTokens.add('noopener');\n relTokens.add('noreferrer');\n }\n\n const hardenedRel = relTokens.size > 0 ? Array.from(relTokens).join(' ') : undefined;\n\n const linkProps = {\n ...safeAnchorProps,\n ref: ref as Ref<HTMLAnchorElement>,\n href,\n rel: hardenedRel,\n className: classes,\n 'aria-busy': loading || undefined,\n 'aria-disabled': loading || undefined,\n tabIndex: loading ? -1 : undefined,\n onClick: loading\n ? (e: MouseEvent<HTMLAnchorElement>) => {\n e.preventDefault();\n e.stopPropagation();\n }\n : safeAnchorProps.onClick,\n children: content,\n };\n\n if (renderLink) {\n return <>{renderLink(linkProps)}</>;\n }\n\n return <a {...linkProps} />;\n }\n\n const {\n type = 'button',\n disabled,\n href: _href,\n target: _target,\n rel: _rel,\n renderLink: _renderLink,\n ...buttonProps\n } = props as Omit<typeof props, 'variant' | 'size' | 'loading' | 'href'> & {\n type?: 'button' | 'submit' | 'reset';\n disabled?: boolean;\n href?: string;\n target?: string;\n rel?: string;\n renderLink?: unknown;\n };\n\n return (\n <button\n ref={ref as Ref<HTMLButtonElement>}\n type={type}\n disabled={disabled || loading}\n className={classes}\n aria-busy={loading || undefined}\n {...buttonProps}\n >\n {content}\n </button>\n );\n};\n"],"names":[],"mappings":";;;;;AAOO,MAAM,SAAS,CAAC;AAAA,EACnB,UAAU;AAAA,EACV,YAAY;AAAA,EACZ,OAAO;AAAA,EACP,UAAU;AAAA,EACV;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACP,MAAmB;AACf,QAAM,aAAa,cAAc,SAAS,MAAM;AAChD,QAAM,WAAW,UAAU,SAAS,MAAM,QAAQ;AAElD,QAAM,UAAU;AAAA,IACZ,OAAO;AAAA,IACP,OAAO,WAAW,OAAO,EAAE;AAAA,IAC3B,EAAE,CAAC,OAAO,oBAAoB,CAAC,GAAG,UAAA;AAAA,IAClC,OAAO,WAAW,IAAI,EAAE;AAAA,IACxB,YAAY;AAAA,IACZ,EAAE,CAAC,OAAO,kBAAkB,CAAC,GAAG,WAAA;AAAA,IAChC,EAAE,CAAC,OAAO,iBAAiB,CAAC,GAAG,QAAA;AAAA,IAC/B;AAAA,EAAA;AAGJ,QAAM,UACF,qBAAA,UAAA,EACI,UAAA;AAAA,IAAA,oBAAC,QAAA,EAAK,WAAW,OAAO,iBA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IACR,KAAK;AAAA,IACL,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,IACH;AASJ,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACG;AAAA,MACA;AAAA,MACA,UAAU,YAAY;AAAA,MACtB,WAAW;AAAA,MACX,aAAW,WAAW;AAAA,MACrB,GAAG;AAAA,MAEH,UAAA;AAAA,IAAA;AAAA,EAAA;AAGb;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require('./Button.css');
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
4
|
+
const button = "_button_1nsz1_1";
|
|
5
|
+
const button__content = "_button__content_1nsz1_177";
|
|
6
|
+
const button__spinner = "_button__spinner_1nsz1_185";
|
|
7
|
+
const styles = {
|
|
8
|
+
button,
|
|
9
|
+
"button--full-width": "_button--full-width_1nsz1_18",
|
|
10
|
+
"button--normal": "_button--normal_1nsz1_25",
|
|
11
|
+
"button--small": "_button--small_1nsz1_32",
|
|
12
|
+
"button--primary": "_button--primary_1nsz1_41",
|
|
13
|
+
"button--secondary": "_button--secondary_1nsz1_63",
|
|
14
|
+
"button--tertiary": "_button--tertiary_1nsz1_88",
|
|
15
|
+
"button--disabled": "_button--disabled_1nsz1_111",
|
|
16
|
+
"button--loading": "_button--loading_1nsz1_173",
|
|
17
|
+
button__content,
|
|
18
|
+
button__spinner
|
|
19
|
+
};
|
|
20
|
+
exports.button = button;
|
|
21
|
+
exports.button__content = button__content;
|
|
22
|
+
exports.button__spinner = button__spinner;
|
|
23
|
+
exports.default = styles;
|
|
24
|
+
//# sourceMappingURL=Button.module.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import './Button.css';
|
|
2
|
+
const button = "_button_1nsz1_1";
|
|
3
|
+
const button__content = "_button__content_1nsz1_177";
|
|
4
|
+
const button__spinner = "_button__spinner_1nsz1_185";
|
|
5
|
+
const styles = {
|
|
6
|
+
button,
|
|
7
|
+
"button--full-width": "_button--full-width_1nsz1_18",
|
|
8
|
+
"button--normal": "_button--normal_1nsz1_25",
|
|
9
|
+
"button--small": "_button--small_1nsz1_32",
|
|
10
|
+
"button--primary": "_button--primary_1nsz1_41",
|
|
11
|
+
"button--secondary": "_button--secondary_1nsz1_63",
|
|
12
|
+
"button--tertiary": "_button--tertiary_1nsz1_88",
|
|
13
|
+
"button--disabled": "_button--disabled_1nsz1_111",
|
|
14
|
+
"button--loading": "_button--loading_1nsz1_173",
|
|
15
|
+
button__content,
|
|
16
|
+
button__spinner
|
|
17
|
+
};
|
|
18
|
+
export {
|
|
19
|
+
button,
|
|
20
|
+
button__content,
|
|
21
|
+
button__spinner,
|
|
22
|
+
styles as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=Button.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Visual variant of the Button.
|
|
4
|
+
*
|
|
5
|
+
* - `primary` — Filled pink background. Main call-to-action.
|
|
6
|
+
* - `secondary` — Outlined with secondary (plum) border color.
|
|
7
|
+
* - `tertiary` — Filled neutral background with a neutral border.
|
|
8
|
+
*/
|
|
9
|
+
export type ButtonVariant = 'primary' | 'secondary' | 'tertiary';
|
|
10
|
+
/**
|
|
11
|
+
* Size variant of the Button.
|
|
12
|
+
*
|
|
13
|
+
* - `normal` — 40px height, 16px bold text.
|
|
14
|
+
* - `small` — 32px height, 14px bold text.
|
|
15
|
+
*/
|
|
16
|
+
export type ButtonSize = 'normal' | 'small';
|
|
17
|
+
export interface ButtonLinkProps extends ComponentPropsWithRef<'a'> {
|
|
18
|
+
readonly href: string;
|
|
19
|
+
readonly children: ReactNode;
|
|
20
|
+
}
|
|
21
|
+
interface ButtonBaseProps {
|
|
22
|
+
/**
|
|
23
|
+
* Visual variant determining colors and border style.
|
|
24
|
+
* @default 'primary'
|
|
25
|
+
*/
|
|
26
|
+
readonly variant?: ButtonVariant;
|
|
27
|
+
/**
|
|
28
|
+
* Whether the button should stretch to fill the available width.
|
|
29
|
+
* @default false
|
|
30
|
+
*/
|
|
31
|
+
readonly fullWidth?: boolean;
|
|
32
|
+
/**
|
|
33
|
+
* Size variant controlling height and font size.
|
|
34
|
+
* @default 'normal'
|
|
35
|
+
*/
|
|
36
|
+
readonly size?: ButtonSize;
|
|
37
|
+
/**
|
|
38
|
+
* Whether the button is in a loading state.
|
|
39
|
+
* When true, the button content remains visible and a spinner is shown.
|
|
40
|
+
* The button remains non-interactive during loading.
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
readonly loading?: boolean;
|
|
44
|
+
}
|
|
45
|
+
export type ButtonAsButton = ButtonBaseProps & Omit<ComponentPropsWithRef<'button'>, keyof ButtonBaseProps> & {
|
|
46
|
+
/** When omitted, the element renders as a `<button>`. */
|
|
47
|
+
readonly href?: never;
|
|
48
|
+
/** Anchor-only props are intentionally unsupported in button mode. */
|
|
49
|
+
readonly target?: never;
|
|
50
|
+
readonly rel?: never;
|
|
51
|
+
readonly renderLink?: never;
|
|
52
|
+
};
|
|
53
|
+
export type ButtonAsAnchor = ButtonBaseProps & Omit<ComponentPropsWithRef<'a'>, keyof ButtonBaseProps> & {
|
|
54
|
+
/** When `href` is provided, the element renders as an `<a>`. */
|
|
55
|
+
readonly href: string;
|
|
56
|
+
/** Button-only props are intentionally unsupported in anchor mode. */
|
|
57
|
+
readonly disabled?: never;
|
|
58
|
+
readonly type?: never;
|
|
59
|
+
readonly name?: never;
|
|
60
|
+
/**
|
|
61
|
+
* Custom render function for the link element. Use this to integrate with
|
|
62
|
+
* client-side routing libraries like Next.js or React Router.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* // Next.js
|
|
66
|
+
* import Link from 'next/link';
|
|
67
|
+
* <Button href="/page" renderLink={(props) => <Link {...props} />}>Navigate</Button>
|
|
68
|
+
*
|
|
69
|
+
* @example
|
|
70
|
+
* // React Router
|
|
71
|
+
* import { Link } from 'react-router-dom';
|
|
72
|
+
* <Button href="/page" renderLink={({ href, ...props }) => <Link to={href} {...props} />}>Navigate</Button>
|
|
73
|
+
*/
|
|
74
|
+
readonly renderLink?: (props: ButtonLinkProps) => ReactNode;
|
|
75
|
+
};
|
|
76
|
+
/**
|
|
77
|
+
* Props for the Button component.
|
|
78
|
+
*
|
|
79
|
+
* When `href` is provided the component renders as an `<a>` element;
|
|
80
|
+
* otherwise it renders as a `<button>`.
|
|
81
|
+
*/
|
|
82
|
+
export type ButtonProps = ButtonAsButton | ButtonAsAnchor;
|
|
83
|
+
export {};
|
|
84
|
+
//# sourceMappingURL=Button.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Button.types.d.ts","sourceRoot":"","sources":["../../../src/components/Button/Button.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D;;;;;;GAMG;AACH,MAAM,MAAM,aAAa,GAAG,SAAS,GAAG,WAAW,GAAG,UAAU,CAAC;AAEjE;;;;;GAKG;AACH,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE5C,MAAM,WAAW,eAAgB,SAAQ,qBAAqB,CAAC,GAAG,CAAC;IAC/D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAChC;AAED,UAAU,eAAe;IACrB;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,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,CAAC;AAClC,YAAY,EAAE,WAAW,EAAE,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const cn = require("../../utils/cn/cn.cjs");
|
|
5
|
+
const ColorScheme = ({ scheme, className, children, ref, ...props }) => {
|
|
6
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { ref, ...props, "data-color-scheme": scheme, className: cn.cn(className), children });
|
|
7
|
+
};
|
|
8
|
+
exports.ColorScheme = ColorScheme;
|
|
9
|
+
//# sourceMappingURL=ColorScheme.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorScheme.cjs","sources":["../../../src/components/ColorScheme/ColorScheme.tsx"],"sourcesContent":["import { cn } from '../../utils/cn';\nimport type { ColorSchemeProps } from './ColorScheme.types';\n\nexport const ColorScheme = ({ scheme, className, children, ref, ...props }: ColorSchemeProps) => {\n return (\n <div ref={ref} {...props} data-color-scheme={scheme} className={cn(className)}>\n {children}\n </div>\n );\n};\n"],"names":["jsx","cn"],"mappings":";;;;AAGO,MAAM,cAAc,CAAC,EAAE,QAAQ,WAAW,UAAU,KAAK,GAAG,YAA8B;AAC7F,SACIA,2BAAAA,IAAC,OAAA,EAAI,KAAW,GAAG,OAAO,qBAAmB,QAAQ,WAAWC,GAAAA,GAAG,SAAS,GACvE,SAAA,CACL;AAER;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorScheme.d.ts","sourceRoot":"","sources":["../../../src/components/ColorScheme/ColorScheme.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,eAAO,MAAM,WAAW,GAAI,gDAAgD,gBAAgB,4CAM3F,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../utils/cn/cn.js";
|
|
3
|
+
const ColorScheme = ({ scheme, className, children, ref, ...props }) => {
|
|
4
|
+
return /* @__PURE__ */ jsx("div", { ref, ...props, "data-color-scheme": scheme, className: cn(className), children });
|
|
5
|
+
};
|
|
6
|
+
export {
|
|
7
|
+
ColorScheme
|
|
8
|
+
};
|
|
9
|
+
//# sourceMappingURL=ColorScheme.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorScheme.js","sources":["../../../src/components/ColorScheme/ColorScheme.tsx"],"sourcesContent":["import { cn } from '../../utils/cn';\nimport type { ColorSchemeProps } from './ColorScheme.types';\n\nexport const ColorScheme = ({ scheme, className, children, ref, ...props }: ColorSchemeProps) => {\n return (\n <div ref={ref} {...props} data-color-scheme={scheme} className={cn(className)}>\n {children}\n </div>\n );\n};\n"],"names":[],"mappings":";;AAGO,MAAM,cAAc,CAAC,EAAE,QAAQ,WAAW,UAAU,KAAK,GAAG,YAA8B;AAC7F,SACI,oBAAC,OAAA,EAAI,KAAW,GAAG,OAAO,qBAAmB,QAAQ,WAAW,GAAG,SAAS,GACvE,SAAA,CACL;AAER;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ComponentPropsWithRef } from 'react';
|
|
2
|
+
export type ColorSchemeValue = 'light' | 'dark';
|
|
3
|
+
export interface ColorSchemeProps extends ComponentPropsWithRef<'div'> {
|
|
4
|
+
/**
|
|
5
|
+
* The color scheme to apply to children.
|
|
6
|
+
* Components within will adapt their colors accordingly.
|
|
7
|
+
*/
|
|
8
|
+
readonly scheme: ColorSchemeValue;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=ColorScheme.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ColorScheme.types.d.ts","sourceRoot":"","sources":["../../../src/components/ColorScheme/ColorScheme.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,OAAO,CAAC;AAEnD,MAAM,MAAM,gBAAgB,GAAG,OAAO,GAAG,MAAM,CAAC;AAEhD,MAAM,WAAW,gBAAiB,SAAQ,qBAAqB,CAAC,KAAK,CAAC;IAClE;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,gBAAgB,CAAC;CACrC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ColorScheme/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC"}
|
|
@@ -1,10 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const react = require("react");
|
|
5
4
|
const Label_module = require("./Label.module.css.cjs");
|
|
6
5
|
const cn = require("../../utils/cn/cn.cjs");
|
|
7
|
-
const Label =
|
|
6
|
+
const Label = ({ variant = "default", className, children, ref, ...props }) => {
|
|
8
7
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9
8
|
"span",
|
|
10
9
|
{
|
|
@@ -14,7 +13,6 @@ const Label = react.forwardRef(function Label2({ variant = "default", className,
|
|
|
14
13
|
children
|
|
15
14
|
}
|
|
16
15
|
);
|
|
17
|
-
}
|
|
18
|
-
Label.displayName = "Label";
|
|
16
|
+
};
|
|
19
17
|
exports.Label = Label;
|
|
20
18
|
//# sourceMappingURL=Label.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.cjs","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Label.cjs","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import { cn } from '../../utils/cn';\nimport styles from './Label.module.css';\nimport type { LabelProps } from './Label.types';\n\nexport const Label = ({ variant = 'default', className, children, ref, ...props }: LabelProps) => {\n return (\n <span\n ref={ref}\n className={cn(styles.label, styles[`label--${variant}`], className)}\n {...props}\n >\n {children}\n </span>\n );\n};\n"],"names":["jsx","cn","styles"],"mappings":";;;;;AAIO,MAAM,QAAQ,CAAC,EAAE,UAAU,WAAW,WAAW,UAAU,KAAK,GAAG,YAAwB;AAC9F,SACIA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACG;AAAA,MACA,WAAWC,GAAAA,GAAGC,aAAAA,QAAO,OAAOA,aAAAA,QAAO,UAAU,OAAO,EAAE,GAAG,SAAS;AAAA,MACjE,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGb;;"}
|
|
@@ -1,40 +1,38 @@
|
|
|
1
|
-
@layer
|
|
1
|
+
@layer dds-components {._label_1bsev_1 {
|
|
2
2
|
display: inline-block;
|
|
3
3
|
max-width: 100%;
|
|
4
4
|
padding: var(--spacing-ui-xxs) var(--spacing-ui-lg);
|
|
5
5
|
border-radius: var(--radius-semantic-full);
|
|
6
|
-
font
|
|
7
|
-
font-weight: 700;
|
|
8
|
-
line-height: 1;
|
|
6
|
+
font: var(--typography-label-md-bold);
|
|
9
7
|
text-align: center;
|
|
10
8
|
text-transform: uppercase;
|
|
11
9
|
white-space: nowrap;
|
|
12
10
|
overflow: hidden;
|
|
13
11
|
text-overflow: ellipsis;
|
|
14
|
-
color: var(--
|
|
12
|
+
color: var(--color-semantic-foreground-default);
|
|
15
13
|
}
|
|
16
14
|
|
|
17
|
-
._label--
|
|
18
|
-
background-color: var(--
|
|
15
|
+
._label--default_1bsev_15 {
|
|
16
|
+
background-color: var(--color-semantic-surface-base);
|
|
19
17
|
}
|
|
20
18
|
|
|
21
|
-
._label--
|
|
22
|
-
background-color: var(--
|
|
19
|
+
._label--campaign_1bsev_19 {
|
|
20
|
+
background-color: var(--color-semantic-surface-primary-mid);
|
|
23
21
|
}
|
|
24
22
|
|
|
25
|
-
._label--
|
|
26
|
-
background-color: var(--
|
|
23
|
+
._label--new_1bsev_23 {
|
|
24
|
+
background-color: var(--color-semantic-accent-lemon-strong);
|
|
27
25
|
}
|
|
28
26
|
|
|
29
|
-
._label--
|
|
30
|
-
background-color: var(--
|
|
27
|
+
._label--presale_1bsev_27 {
|
|
28
|
+
background-color: var(--color-semantic-accent-orange-strong);
|
|
31
29
|
}
|
|
32
30
|
|
|
33
|
-
._label--
|
|
34
|
-
background-color: var(--
|
|
31
|
+
._label--soldout_1bsev_31 {
|
|
32
|
+
background-color: var(--color-semantic-surface-neutral-strong);
|
|
35
33
|
}
|
|
36
34
|
|
|
37
|
-
._label--
|
|
38
|
-
background-color: var(--
|
|
35
|
+
._label--other_1bsev_35 {
|
|
36
|
+
background-color: var(--color-semantic-accent-sky-strong);
|
|
39
37
|
}
|
|
40
38
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { LabelProps } from './Label.types';
|
|
2
|
-
export declare const Label:
|
|
2
|
+
export declare const Label: ({ variant, className, children, ref, ...props }: LabelProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
3
|
//# sourceMappingURL=Label.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/components/Label/Label.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/components/Label/Label.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,eAAO,MAAM,KAAK,GAAI,iDAA6D,UAAU,4CAU5F,CAAC"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from "react";
|
|
3
2
|
import styles from "./Label.module.css.js";
|
|
4
3
|
import { cn } from "../../utils/cn/cn.js";
|
|
5
|
-
const Label =
|
|
4
|
+
const Label = ({ variant = "default", className, children, ref, ...props }) => {
|
|
6
5
|
return /* @__PURE__ */ jsx(
|
|
7
6
|
"span",
|
|
8
7
|
{
|
|
@@ -12,8 +11,7 @@ const Label = forwardRef(function Label2({ variant = "default", className, child
|
|
|
12
11
|
children
|
|
13
12
|
}
|
|
14
13
|
);
|
|
15
|
-
}
|
|
16
|
-
Label.displayName = "Label";
|
|
14
|
+
};
|
|
17
15
|
export {
|
|
18
16
|
Label
|
|
19
17
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.js","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Label.js","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import { cn } from '../../utils/cn';\nimport styles from './Label.module.css';\nimport type { LabelProps } from './Label.types';\n\nexport const Label = ({ variant = 'default', className, children, ref, ...props }: LabelProps) => {\n return (\n <span\n ref={ref}\n className={cn(styles.label, styles[`label--${variant}`], className)}\n {...props}\n >\n {children}\n </span>\n );\n};\n"],"names":[],"mappings":";;;AAIO,MAAM,QAAQ,CAAC,EAAE,UAAU,WAAW,WAAW,UAAU,KAAK,GAAG,YAAwB;AAC9F,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACG;AAAA,MACA,WAAW,GAAG,OAAO,OAAO,OAAO,UAAU,OAAO,EAAE,GAAG,SAAS;AAAA,MACjE,GAAG;AAAA,MAEH;AAAA,IAAA;AAAA,EAAA;AAGb;"}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
require('./Label.css');
|
|
2
2
|
"use strict";
|
|
3
3
|
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
4
|
-
const label = "
|
|
4
|
+
const label = "_label_1bsev_1";
|
|
5
5
|
const styles = {
|
|
6
6
|
label,
|
|
7
|
-
"label--default": "_label--
|
|
8
|
-
"label--campaign": "_label--
|
|
9
|
-
"label--new": "_label--
|
|
10
|
-
"label--presale": "_label--
|
|
11
|
-
"label--soldout": "_label--
|
|
12
|
-
"label--other": "_label--
|
|
7
|
+
"label--default": "_label--default_1bsev_15",
|
|
8
|
+
"label--campaign": "_label--campaign_1bsev_19",
|
|
9
|
+
"label--new": "_label--new_1bsev_23",
|
|
10
|
+
"label--presale": "_label--presale_1bsev_27",
|
|
11
|
+
"label--soldout": "_label--soldout_1bsev_31",
|
|
12
|
+
"label--other": "_label--other_1bsev_35"
|
|
13
13
|
};
|
|
14
14
|
exports.default = styles;
|
|
15
15
|
exports.label = label;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import './Label.css';
|
|
2
|
-
const label = "
|
|
2
|
+
const label = "_label_1bsev_1";
|
|
3
3
|
const styles = {
|
|
4
4
|
label,
|
|
5
|
-
"label--default": "_label--
|
|
6
|
-
"label--campaign": "_label--
|
|
7
|
-
"label--new": "_label--
|
|
8
|
-
"label--presale": "_label--
|
|
9
|
-
"label--soldout": "_label--
|
|
10
|
-
"label--other": "_label--
|
|
5
|
+
"label--default": "_label--default_1bsev_15",
|
|
6
|
+
"label--campaign": "_label--campaign_1bsev_19",
|
|
7
|
+
"label--new": "_label--new_1bsev_23",
|
|
8
|
+
"label--presale": "_label--presale_1bsev_27",
|
|
9
|
+
"label--soldout": "_label--soldout_1bsev_31",
|
|
10
|
+
"label--other": "_label--other_1bsev_35"
|
|
11
11
|
};
|
|
12
12
|
export {
|
|
13
13
|
styles as default,
|
|
@@ -10,7 +10,7 @@ import type * as React from 'react';
|
|
|
10
10
|
* - `other` — Blue. Indicates anything else, e.g. special technical properties.
|
|
11
11
|
*/
|
|
12
12
|
export type LabelVariant = 'default' | 'campaign' | 'new' | 'presale' | 'soldout' | 'other';
|
|
13
|
-
export interface LabelProps extends React.
|
|
13
|
+
export interface LabelProps extends React.ComponentPropsWithRef<'span'> {
|
|
14
14
|
/**
|
|
15
15
|
* The visible text content of the label.
|
|
16
16
|
*/
|
|
@@ -20,9 +20,5 @@ export interface LabelProps extends React.ComponentPropsWithoutRef<'span'> {
|
|
|
20
20
|
* @default 'default'
|
|
21
21
|
*/
|
|
22
22
|
readonly variant?: LabelVariant;
|
|
23
|
-
/**
|
|
24
|
-
* Custom className to apply to the root element.
|
|
25
|
-
*/
|
|
26
|
-
readonly className?: string;
|
|
27
23
|
}
|
|
28
24
|
//# sourceMappingURL=Label.types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Label.types.d.ts","sourceRoot":"","sources":["../../../src/components/Label/Label.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE5F,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,
|
|
1
|
+
{"version":3,"file":"Label.types.d.ts","sourceRoot":"","sources":["../../../src/components/Label/Label.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC;;;;;;;;;GASG;AACH,MAAM,MAAM,YAAY,GAAG,SAAS,GAAG,UAAU,GAAG,KAAK,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE5F,MAAM,WAAW,UAAW,SAAQ,KAAK,CAAC,qBAAqB,CAAC,MAAM,CAAC;IACnE;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;CACnC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const react = require("react");
|
|
5
4
|
const icons = require("@dnanpm/icons");
|
|
6
5
|
const focus_module = require("../../styles/utils/focus.module.css.cjs");
|
|
7
6
|
const Notification_module = require("./Notification.module.css.cjs");
|
|
@@ -18,24 +17,25 @@ const variantRoles = {
|
|
|
18
17
|
warning: "alert",
|
|
19
18
|
error: "alert"
|
|
20
19
|
};
|
|
21
|
-
const Notification =
|
|
20
|
+
const Notification = ({
|
|
22
21
|
variant,
|
|
23
22
|
children,
|
|
24
23
|
closable = false,
|
|
25
24
|
onClose,
|
|
26
25
|
closeLabel = "Sulje ilmoitus",
|
|
27
26
|
className,
|
|
27
|
+
ref,
|
|
28
28
|
...props
|
|
29
|
-
}
|
|
29
|
+
}) => {
|
|
30
30
|
const Icon = variantIcons[variant];
|
|
31
31
|
const role = variantRoles[variant];
|
|
32
32
|
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
33
33
|
"div",
|
|
34
34
|
{
|
|
35
|
+
...props,
|
|
35
36
|
ref,
|
|
36
37
|
role,
|
|
37
38
|
className: cn.cn(Notification_module.default.notification, Notification_module.default[`notification--${variant}`], className),
|
|
38
|
-
...props,
|
|
39
39
|
children: [
|
|
40
40
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: Notification_module.default["notification__icon-container"], children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { className: Notification_module.default.notification__icon, "aria-hidden": "true" }) }),
|
|
41
41
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: Notification_module.default.notification__content, children }),
|
|
@@ -52,7 +52,6 @@ const Notification = react.forwardRef(function Notification2({
|
|
|
52
52
|
]
|
|
53
53
|
}
|
|
54
54
|
);
|
|
55
|
-
}
|
|
56
|
-
Notification.displayName = "Notification";
|
|
55
|
+
};
|
|
57
56
|
exports.Notification = Notification;
|
|
58
57
|
//# sourceMappingURL=Notification.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Notification.cjs","sources":["../../../src/components/Notification/Notification.tsx"],"sourcesContent":["import {
|
|
1
|
+
{"version":3,"file":"Notification.cjs","sources":["../../../src/components/Notification/Notification.tsx"],"sourcesContent":["import type { ComponentType, SVGProps } from 'react';\nimport { Check, Close, Error as ErrorIcon, Info, Warning } from '@dnanpm/icons';\nimport { cn } from '../../utils/cn';\nimport focusStyles from '../../styles/utils/focus.module.css';\nimport styles from './Notification.module.css';\nimport type { NotificationProps, NotificationVariant } from './Notification.types';\n\nconst variantIcons: Record<NotificationVariant, ComponentType<SVGProps<SVGSVGElement>>> = {\n info: Info,\n success: Check,\n warning: Warning,\n error: ErrorIcon,\n};\n\nconst variantRoles: Record<NotificationVariant, 'status' | 'alert'> = {\n info: 'status',\n success: 'status',\n warning: 'alert',\n error: 'alert',\n};\n\nexport const Notification = ({\n variant,\n children,\n closable = false,\n onClose,\n closeLabel = 'Sulje ilmoitus',\n className,\n ref,\n ...props\n}: NotificationProps) => {\n const Icon = variantIcons[variant];\n const role = variantRoles[variant];\n\n return (\n <div\n {...props}\n ref={ref}\n role={role}\n className={cn(styles.notification, styles[`notification--${variant}`], className)}\n >\n <div className={styles['notification__icon-container']}>\n <Icon className={styles.notification__icon} aria-hidden=\"true\" />\n </div>\n <div className={styles.notification__content}>{children}</div>\n {closable && (\n <button\n type=\"button\"\n className={cn(styles.notification__close, focusStyles.focusable)}\n onClick={onClose}\n aria-label={closeLabel}\n >\n <Close aria-hidden=\"true\" />\n </button>\n )}\n </div>\n );\n};\n"],"names":["Info","Check","Warning","ErrorIcon","jsxs","cn","styles","jsx","focusStyles","Close"],"mappings":";;;;;;;AAOA,MAAM,eAAoF;AAAA,EACtF,MAAMA,MAAAA;AAAAA,EACN,SAASC,MAAAA;AAAAA,EACT,SAASC,MAAAA;AAAAA,EACT,OAAOC,MAAAA;AACX;AAEA,MAAM,eAAgE;AAAA,EAClE,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACX;AAEO,MAAM,eAAe,CAAC;AAAA,E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