@dnanpm/ui-components 0.0.5 → 0.2.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 +11 -42
- package/dist/components/Accordion/Accordion.cjs +32 -0
- package/dist/components/Accordion/Accordion.cjs.map +1 -0
- package/dist/components/Accordion/Accordion.css +19 -0
- package/dist/components/Accordion/Accordion.d.ts +3 -0
- package/dist/components/Accordion/Accordion.d.ts.map +1 -0
- package/dist/components/Accordion/Accordion.js +32 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Accordion/Accordion.module.css.cjs +12 -0
- package/dist/components/Accordion/Accordion.module.css.cjs.map +1 -0
- package/dist/components/Accordion/Accordion.module.css.js +12 -0
- package/dist/components/Accordion/Accordion.module.css.js.map +1 -0
- package/dist/components/Accordion/Accordion.types.d.ts +21 -0
- package/dist/components/Accordion/Accordion.types.d.ts.map +1 -0
- package/dist/components/Accordion/Accordion.utils.cjs +8 -0
- package/dist/components/Accordion/Accordion.utils.cjs.map +1 -0
- package/dist/components/Accordion/Accordion.utils.d.ts +8 -0
- package/dist/components/Accordion/Accordion.utils.d.ts.map +1 -0
- package/dist/components/Accordion/Accordion.utils.js +8 -0
- package/dist/components/Accordion/Accordion.utils.js.map +1 -0
- package/dist/components/Accordion/index.d.ts +3 -0
- package/dist/components/Accordion/index.d.ts.map +1 -0
- package/dist/components/AccordionItem/AccordionItem.cjs +57 -0
- package/dist/components/AccordionItem/AccordionItem.cjs.map +1 -0
- package/dist/components/AccordionItem/AccordionItem.css +128 -0
- package/dist/components/AccordionItem/AccordionItem.d.ts +3 -0
- package/dist/components/AccordionItem/AccordionItem.d.ts.map +1 -0
- package/dist/components/AccordionItem/AccordionItem.js +57 -0
- package/dist/components/AccordionItem/AccordionItem.js.map +1 -0
- package/dist/components/AccordionItem/AccordionItem.module.css.cjs +17 -0
- package/dist/components/AccordionItem/AccordionItem.module.css.cjs.map +1 -0
- package/dist/components/AccordionItem/AccordionItem.module.css.js +18 -0
- package/dist/components/AccordionItem/AccordionItem.module.css.js.map +1 -0
- package/dist/components/AccordionItem/AccordionItem.types.d.ts +32 -0
- package/dist/components/AccordionItem/AccordionItem.types.d.ts.map +1 -0
- package/dist/components/AccordionItem/index.d.ts +3 -0
- package/dist/components/AccordionItem/index.d.ts.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.cjs +72 -0
- package/dist/components/Breadcrumb/Breadcrumb.cjs.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.css +73 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +3 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +72 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.css.cjs +25 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.css.cjs.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.css.js +25 -0
- package/dist/components/Breadcrumb/Breadcrumb.module.css.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.types.d.ts +42 -0
- package/dist/components/Breadcrumb/Breadcrumb.types.d.ts.map +1 -0
- package/dist/components/Breadcrumb/index.d.ts +3 -0
- package/dist/components/Breadcrumb/index.d.ts.map +1 -0
- package/dist/components/Button/Button.cjs +104 -0
- package/dist/components/Button/Button.cjs.map +1 -0
- package/dist/components/Button/Button.css +182 -0
- package/dist/components/Button/Button.d.ts +1 -1
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +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 +68 -35
- package/dist/components/Button/Button.types.d.ts.map +1 -1
- package/dist/components/Button/index.d.ts +1 -1
- package/dist/components/Button/index.d.ts.map +1 -1
- 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 +18 -0
- package/dist/components/Label/Label.cjs.map +1 -0
- package/dist/components/Label/Label.css +38 -0
- package/dist/components/Label/Label.d.ts +3 -0
- package/dist/components/Label/Label.d.ts.map +1 -0
- package/dist/components/Label/Label.js +18 -0
- package/dist/components/Label/Label.js.map +1 -0
- package/dist/components/Label/Label.module.css.cjs +16 -0
- package/dist/components/Label/Label.module.css.cjs.map +1 -0
- package/dist/components/Label/Label.module.css.js +16 -0
- package/dist/components/Label/Label.module.css.js.map +1 -0
- package/dist/components/Label/Label.types.d.ts +24 -0
- package/dist/components/Label/Label.types.d.ts.map +1 -0
- package/dist/components/Label/index.d.ts +3 -0
- package/dist/components/Label/index.d.ts.map +1 -0
- package/dist/components/Notification/Notification.cjs +57 -0
- package/dist/components/Notification/Notification.cjs.map +1 -0
- package/dist/components/Notification/Notification.css +90 -0
- package/dist/components/Notification/Notification.d.ts +3 -0
- package/dist/components/Notification/Notification.d.ts.map +1 -0
- package/dist/components/Notification/Notification.js +57 -0
- package/dist/components/Notification/Notification.js.map +1 -0
- package/dist/components/Notification/Notification.module.css.cjs +24 -0
- package/dist/components/Notification/Notification.module.css.cjs.map +1 -0
- package/dist/components/Notification/Notification.module.css.js +24 -0
- package/dist/components/Notification/Notification.module.css.js.map +1 -0
- package/dist/components/Notification/Notification.types.d.ts +40 -0
- package/dist/components/Notification/Notification.types.d.ts.map +1 -0
- package/dist/components/Notification/index.d.ts +3 -0
- package/dist/components/Notification/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/{Tooltip → Spinner}/index.d.ts.map +1 -1
- package/dist/font-definitions.css +61 -0
- package/dist/index.cjs +19 -10027
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +15 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -10008
- package/dist/index.js.map +1 -1
- package/dist/styles/utils/elevation.css +28 -0
- package/dist/styles/utils/elevation.module.css.cjs +10 -0
- package/dist/styles/utils/elevation.module.css.cjs.map +1 -0
- package/dist/styles/utils/elevation.module.css.js +10 -0
- package/dist/styles/utils/elevation.module.css.js.map +1 -0
- package/dist/styles/utils/focus.css +80 -0
- package/dist/styles/utils/focus.module.css.cjs +16 -0
- package/dist/styles/utils/focus.module.css.cjs.map +1 -0
- package/dist/styles/utils/focus.module.css.js +16 -0
- package/dist/styles/utils/focus.module.css.js.map +1 -0
- package/dist/styles/utils/text-decoration.css +7 -0
- package/dist/styles/utils/text-decoration.module.css.cjs +10 -0
- package/dist/styles/utils/text-decoration.module.css.cjs.map +1 -0
- package/dist/styles/utils/text-decoration.module.css.js +10 -0
- package/dist/styles/utils/text-decoration.module.css.js.map +1 -0
- package/dist/styles.css +327 -466
- package/dist/utils/cn/cn.cjs +8 -0
- package/dist/utils/cn/cn.cjs.map +1 -0
- package/dist/utils/cn/cn.js +8 -0
- package/dist/utils/cn/cn.js.map +1 -0
- package/package.json +11 -9
- package/dist/components/Box/Box.d.ts +0 -2
- package/dist/components/Box/Box.d.ts.map +0 -1
- package/dist/components/Box/Box.types.d.ts +0 -24
- package/dist/components/Box/Box.types.d.ts.map +0 -1
- package/dist/components/Box/index.d.ts +0 -3
- package/dist/components/Box/index.d.ts.map +0 -1
- package/dist/components/Dialog/Dialog.d.ts +0 -3
- package/dist/components/Dialog/Dialog.d.ts.map +0 -1
- package/dist/components/Dialog/Dialog.types.d.ts +0 -45
- package/dist/components/Dialog/Dialog.types.d.ts.map +0 -1
- package/dist/components/Dialog/index.d.ts +0 -3
- package/dist/components/Dialog/index.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.d.ts +0 -3
- package/dist/components/Tooltip/Tooltip.d.ts.map +0 -1
- package/dist/components/Tooltip/Tooltip.types.d.ts +0 -39
- package/dist/components/Tooltip/Tooltip.types.d.ts.map +0 -1
- package/dist/components/Tooltip/index.d.ts +0 -3
- package/dist/components/index.d.ts +0 -5
- package/dist/components/index.d.ts.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import styles from "./Label.module.css.js";
|
|
3
|
+
import { cn } from "../../utils/cn/cn.js";
|
|
4
|
+
const Label = ({ variant = "default", className, children, ref, ...props }) => {
|
|
5
|
+
return /* @__PURE__ */ jsx(
|
|
6
|
+
"span",
|
|
7
|
+
{
|
|
8
|
+
ref,
|
|
9
|
+
className: cn(styles.label, styles[`label--${variant}`], className),
|
|
10
|
+
...props,
|
|
11
|
+
children
|
|
12
|
+
}
|
|
13
|
+
);
|
|
14
|
+
};
|
|
15
|
+
export {
|
|
16
|
+
Label
|
|
17
|
+
};
|
|
18
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
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;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
require('./Label.css');
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
4
|
+
const label = "_label_1bsev_1";
|
|
5
|
+
const styles = {
|
|
6
|
+
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
|
+
};
|
|
14
|
+
exports.default = styles;
|
|
15
|
+
exports.label = label;
|
|
16
|
+
//# sourceMappingURL=Label.module.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import './Label.css';
|
|
2
|
+
const label = "_label_1bsev_1";
|
|
3
|
+
const styles = {
|
|
4
|
+
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
|
+
};
|
|
12
|
+
export {
|
|
13
|
+
styles as default,
|
|
14
|
+
label
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=Label.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Visual variant of the Label, determining its background color.
|
|
4
|
+
*
|
|
5
|
+
* - `default` — White. Default neutral label.
|
|
6
|
+
* - `campaign` — Pink. Indicates discounts, benefits, and special offers.
|
|
7
|
+
* - `new` — Yellow. Indicates a "new state", e.g. new product.
|
|
8
|
+
* - `presale` — Orange. Indicates a pre-sale campaign.
|
|
9
|
+
* - `soldout` — Sand. Indicates a sold-out state.
|
|
10
|
+
* - `other` — Blue. Indicates anything else, e.g. special technical properties.
|
|
11
|
+
*/
|
|
12
|
+
export type LabelVariant = 'default' | 'campaign' | 'new' | 'presale' | 'soldout' | 'other';
|
|
13
|
+
export interface LabelProps extends React.ComponentPropsWithRef<'span'> {
|
|
14
|
+
/**
|
|
15
|
+
* The visible text content of the label.
|
|
16
|
+
*/
|
|
17
|
+
readonly children: React.ReactNode;
|
|
18
|
+
/**
|
|
19
|
+
* The visual variant that determines background color.
|
|
20
|
+
* @default 'default'
|
|
21
|
+
*/
|
|
22
|
+
readonly variant?: LabelVariant;
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=Label.types.d.ts.map
|
|
@@ -0,0 +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,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"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Label/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,SAAS,CAAC;AAChC,YAAY,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const icons = require("@dnanpm/icons");
|
|
5
|
+
const focus_module = require("../../styles/utils/focus.module.css.cjs");
|
|
6
|
+
const Notification_module = require("./Notification.module.css.cjs");
|
|
7
|
+
const cn = require("../../utils/cn/cn.cjs");
|
|
8
|
+
const variantIcons = {
|
|
9
|
+
info: icons.Info,
|
|
10
|
+
success: icons.Check,
|
|
11
|
+
warning: icons.Warning,
|
|
12
|
+
error: icons.Error
|
|
13
|
+
};
|
|
14
|
+
const variantRoles = {
|
|
15
|
+
info: "status",
|
|
16
|
+
success: "status",
|
|
17
|
+
warning: "alert",
|
|
18
|
+
error: "alert"
|
|
19
|
+
};
|
|
20
|
+
const Notification = ({
|
|
21
|
+
variant,
|
|
22
|
+
children,
|
|
23
|
+
closable = false,
|
|
24
|
+
onClose,
|
|
25
|
+
closeLabel = "Sulje ilmoitus",
|
|
26
|
+
className,
|
|
27
|
+
ref,
|
|
28
|
+
...props
|
|
29
|
+
}) => {
|
|
30
|
+
const Icon = variantIcons[variant];
|
|
31
|
+
const role = variantRoles[variant];
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
...props,
|
|
36
|
+
ref,
|
|
37
|
+
role,
|
|
38
|
+
className: cn.cn(Notification_module.default.notification, Notification_module.default[`notification--${variant}`], className),
|
|
39
|
+
children: [
|
|
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
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: Notification_module.default.notification__content, children }),
|
|
42
|
+
closable && /* @__PURE__ */ jsxRuntime.jsx(
|
|
43
|
+
"button",
|
|
44
|
+
{
|
|
45
|
+
type: "button",
|
|
46
|
+
className: cn.cn(Notification_module.default.notification__close, focus_module.default.focusable),
|
|
47
|
+
onClick: onClose,
|
|
48
|
+
"aria-label": closeLabel,
|
|
49
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Close, { "aria-hidden": "true" })
|
|
50
|
+
}
|
|
51
|
+
)
|
|
52
|
+
]
|
|
53
|
+
}
|
|
54
|
+
);
|
|
55
|
+
};
|
|
56
|
+
exports.Notification = Notification;
|
|
57
|
+
//# sourceMappingURL=Notification.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
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,EACzB;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,GAAG;AACP,MAAyB;AACrB,QAAM,OAAO,aAAa,OAAO;AACjC,QAAM,OAAO,aAAa,OAAO;AAEjC,SACIC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA,WAAWC,GAAAA,GAAGC,oBAAAA,QAAO,cAAcA,oBAAAA,QAAO,iBAAiB,OAAO,EAAE,GAAG,SAAS;AAAA,MAEhF,UAAA;AAAA,QAAAC,2BAAAA,IAAC,OAAA,EAAI,WAAWD,oBAAAA,QAAO,8BAA8B,GACjD,UAAAC,2BAAAA,IAAC,MAAA,EAAK,WAAWD,4BAAO,oBAAoB,eAAY,OAAA,CAAO,GACnE;AAAA,QACAC,2BAAAA,IAAC,OAAA,EAAI,WAAWD,oBAAAA,QAAO,uBAAwB,UAAS;AAAA,QACvD,YACGC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACG,MAAK;AAAA,YACL,WAAWF,GAAAA,GAAGC,oBAAAA,QAAO,qBAAqBE,aAAAA,QAAY,SAAS;AAAA,YAC/D,SAAS;AAAA,YACT,cAAY;AAAA,YAEZ,UAAAD,2BAAAA,IAACE,MAAAA,OAAA,EAAM,eAAY,OAAA,CAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MAC9B;AAAA,IAAA;AAAA,EAAA;AAIhB;;"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
@layer dna-design-system {/**
|
|
2
|
+
* Notification Component Styles
|
|
3
|
+
*
|
|
4
|
+
* Design tokens are consumed via CSS custom properties (variables).
|
|
5
|
+
* These variables come from @dnanpm/design-tokens package.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
._notification_5h3rs_8 {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: var(--spacing-ui-md);
|
|
12
|
+
padding-right: var(--spacing-ui-lg);
|
|
13
|
+
border: 2px solid var(--notification-color);
|
|
14
|
+
border-radius: var(--radius-semantic-sm);
|
|
15
|
+
overflow: clip;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* Variant colors */
|
|
19
|
+
._notification--info_5h3rs_19 {
|
|
20
|
+
--notification-color: var(--color-semantic-status-info);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
._notification--success_5h3rs_23 {
|
|
24
|
+
--notification-color: var(--color-semantic-status-success);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
._notification--warning_5h3rs_27 {
|
|
28
|
+
--notification-color: var(--color-semantic-status-warning);
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
._notification--error_5h3rs_31 {
|
|
32
|
+
--notification-color: var(--color-semantic-status-error);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/* Icon container */
|
|
36
|
+
._notification__icon-container_5h3rs_36 {
|
|
37
|
+
/* The colored area size should be 48x48px on one line content, so we adjust padding based on whether the border is present or not */
|
|
38
|
+
--_icon-padding-with-border: 10px;
|
|
39
|
+
--_icon-padding-without-border: 12px;
|
|
40
|
+
|
|
41
|
+
flex: 0 0 auto;
|
|
42
|
+
display: flex;
|
|
43
|
+
align-items: center;
|
|
44
|
+
justify-content: center;
|
|
45
|
+
align-self: stretch;
|
|
46
|
+
padding: var(--_icon-padding-with-border) var(--_icon-padding-without-border)
|
|
47
|
+
var(--_icon-padding-with-border) var(--_icon-padding-with-border);
|
|
48
|
+
background-color: var(--notification-color);
|
|
49
|
+
color: var(--color-semantic-foreground-inverse);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
._notification__icon_5h3rs_36 {
|
|
53
|
+
width: 24px;
|
|
54
|
+
height: 24px;
|
|
55
|
+
flex: 0 0 auto;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/* Content */
|
|
59
|
+
._notification__content_5h3rs_59 {
|
|
60
|
+
flex: 1 1 auto;
|
|
61
|
+
min-width: 0;
|
|
62
|
+
padding: var(--spacing-ui-xs) 0;
|
|
63
|
+
font: var(--typography-body-md);
|
|
64
|
+
color: var(--color-semantic-foreground-default);
|
|
65
|
+
text-wrap: pretty;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
/* Close button */
|
|
69
|
+
._notification__close_5h3rs_69 {
|
|
70
|
+
flex: 0 0 auto;
|
|
71
|
+
display: flex;
|
|
72
|
+
align-items: center;
|
|
73
|
+
justify-content: center;
|
|
74
|
+
width: 32px;
|
|
75
|
+
height: 32px;
|
|
76
|
+
padding: 0;
|
|
77
|
+
/* Negative margin to offset the button's size and maintain consistent spacing with the content */
|
|
78
|
+
margin: 0 calc(var(--spacing-ui-xxs) * -1);
|
|
79
|
+
border: none;
|
|
80
|
+
border-radius: var(--radius-semantic-sm);
|
|
81
|
+
background: none;
|
|
82
|
+
color: var(--color-semantic-foreground-default);
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
._notification__close_5h3rs_69 svg {
|
|
87
|
+
width: 24px;
|
|
88
|
+
height: 24px;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { NotificationProps } from './Notification.types';
|
|
2
|
+
export declare const Notification: ({ variant, children, closable, onClose, closeLabel, className, ref, ...props }: NotificationProps) => import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=Notification.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notification.d.ts","sourceRoot":"","sources":["../../../src/components/Notification/Notification.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,iBAAiB,EAAuB,MAAM,sBAAsB,CAAC;AAgBnF,eAAO,MAAM,YAAY,GAAI,gFAS1B,iBAAiB,4CA2BnB,CAAC"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Error, Warning, Check, Info, Close } from "@dnanpm/icons";
|
|
3
|
+
import focusStyles from "../../styles/utils/focus.module.css.js";
|
|
4
|
+
import styles from "./Notification.module.css.js";
|
|
5
|
+
import { cn } from "../../utils/cn/cn.js";
|
|
6
|
+
const variantIcons = {
|
|
7
|
+
info: Info,
|
|
8
|
+
success: Check,
|
|
9
|
+
warning: Warning,
|
|
10
|
+
error: Error
|
|
11
|
+
};
|
|
12
|
+
const variantRoles = {
|
|
13
|
+
info: "status",
|
|
14
|
+
success: "status",
|
|
15
|
+
warning: "alert",
|
|
16
|
+
error: "alert"
|
|
17
|
+
};
|
|
18
|
+
const Notification = ({
|
|
19
|
+
variant,
|
|
20
|
+
children,
|
|
21
|
+
closable = false,
|
|
22
|
+
onClose,
|
|
23
|
+
closeLabel = "Sulje ilmoitus",
|
|
24
|
+
className,
|
|
25
|
+
ref,
|
|
26
|
+
...props
|
|
27
|
+
}) => {
|
|
28
|
+
const Icon = variantIcons[variant];
|
|
29
|
+
const role = variantRoles[variant];
|
|
30
|
+
return /* @__PURE__ */ jsxs(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
...props,
|
|
34
|
+
ref,
|
|
35
|
+
role,
|
|
36
|
+
className: cn(styles.notification, styles[`notification--${variant}`], className),
|
|
37
|
+
children: [
|
|
38
|
+
/* @__PURE__ */ jsx("div", { className: styles["notification__icon-container"], children: /* @__PURE__ */ jsx(Icon, { className: styles.notification__icon, "aria-hidden": "true" }) }),
|
|
39
|
+
/* @__PURE__ */ jsx("div", { className: styles.notification__content, children }),
|
|
40
|
+
closable && /* @__PURE__ */ jsx(
|
|
41
|
+
"button",
|
|
42
|
+
{
|
|
43
|
+
type: "button",
|
|
44
|
+
className: cn(styles.notification__close, focusStyles.focusable),
|
|
45
|
+
onClick: onClose,
|
|
46
|
+
"aria-label": closeLabel,
|
|
47
|
+
children: /* @__PURE__ */ jsx(Close, { "aria-hidden": "true" })
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
]
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
};
|
|
54
|
+
export {
|
|
55
|
+
Notification
|
|
56
|
+
};
|
|
57
|
+
//# sourceMappingURL=Notification.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notification.js","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":["ErrorIcon"],"mappings":";;;;;AAOA,MAAM,eAAoF;AAAA,EACtF,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAOA;AACX;AAEA,MAAM,eAAgE;AAAA,EAClE,MAAM;AAAA,EACN,SAAS;AAAA,EACT,SAAS;AAAA,EACT,OAAO;AACX;AAEO,MAAM,eAAe,CAAC;AAAA,EACzB;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,GAAG;AACP,MAAyB;AACrB,QAAM,OAAO,aAAa,OAAO;AACjC,QAAM,OAAO,aAAa,OAAO;AAEjC,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAG;AAAA,MACJ;AAAA,MACA;AAAA,MACA,WAAW,GAAG,OAAO,cAAc,OAAO,iBAAiB,OAAO,EAAE,GAAG,SAAS;AAAA,MAEhF,UAAA;AAAA,QAAA,oBAAC,OAAA,EAAI,WAAW,OAAO,8BAA8B,GACjD,UAAA,oBAAC,MAAA,EAAK,WAAW,OAAO,oBAAoB,eAAY,OAAA,CAAO,GACnE;AAAA,QACA,oBAAC,OAAA,EAAI,WAAW,OAAO,uBAAwB,UAAS;AAAA,QACvD,YACG;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,MAAK;AAAA,YACL,WAAW,GAAG,OAAO,qBAAqB,YAAY,SAAS;AAAA,YAC/D,SAAS;AAAA,YACT,cAAY;AAAA,YAEZ,UAAA,oBAAC,OAAA,EAAM,eAAY,OAAA,CAAO;AAAA,UAAA;AAAA,QAAA;AAAA,MAC9B;AAAA,IAAA;AAAA,EAAA;AAIhB;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
require('./Notification.css');
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
4
|
+
const notification = "_notification_5h3rs_8";
|
|
5
|
+
const notification__icon = "_notification__icon_5h3rs_36";
|
|
6
|
+
const notification__content = "_notification__content_5h3rs_59";
|
|
7
|
+
const notification__close = "_notification__close_5h3rs_69";
|
|
8
|
+
const styles = {
|
|
9
|
+
notification,
|
|
10
|
+
"notification--info": "_notification--info_5h3rs_19",
|
|
11
|
+
"notification--success": "_notification--success_5h3rs_23",
|
|
12
|
+
"notification--warning": "_notification--warning_5h3rs_27",
|
|
13
|
+
"notification--error": "_notification--error_5h3rs_31",
|
|
14
|
+
"notification__icon-container": "_notification__icon-container_5h3rs_36",
|
|
15
|
+
notification__icon,
|
|
16
|
+
notification__content,
|
|
17
|
+
notification__close
|
|
18
|
+
};
|
|
19
|
+
exports.default = styles;
|
|
20
|
+
exports.notification = notification;
|
|
21
|
+
exports.notification__close = notification__close;
|
|
22
|
+
exports.notification__content = notification__content;
|
|
23
|
+
exports.notification__icon = notification__icon;
|
|
24
|
+
//# sourceMappingURL=Notification.module.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notification.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import './Notification.css';
|
|
2
|
+
const notification = "_notification_5h3rs_8";
|
|
3
|
+
const notification__icon = "_notification__icon_5h3rs_36";
|
|
4
|
+
const notification__content = "_notification__content_5h3rs_59";
|
|
5
|
+
const notification__close = "_notification__close_5h3rs_69";
|
|
6
|
+
const styles = {
|
|
7
|
+
notification,
|
|
8
|
+
"notification--info": "_notification--info_5h3rs_19",
|
|
9
|
+
"notification--success": "_notification--success_5h3rs_23",
|
|
10
|
+
"notification--warning": "_notification--warning_5h3rs_27",
|
|
11
|
+
"notification--error": "_notification--error_5h3rs_31",
|
|
12
|
+
"notification__icon-container": "_notification__icon-container_5h3rs_36",
|
|
13
|
+
notification__icon,
|
|
14
|
+
notification__content,
|
|
15
|
+
notification__close
|
|
16
|
+
};
|
|
17
|
+
export {
|
|
18
|
+
styles as default,
|
|
19
|
+
notification,
|
|
20
|
+
notification__close,
|
|
21
|
+
notification__content,
|
|
22
|
+
notification__icon
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=Notification.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notification.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type * as React from 'react';
|
|
2
|
+
export type NotificationVariant = 'info' | 'success' | 'warning' | 'error';
|
|
3
|
+
interface NotificationBaseProps extends Omit<React.ComponentPropsWithRef<'div'>, 'children'> {
|
|
4
|
+
/**
|
|
5
|
+
* Visual variant determining the color and icon.
|
|
6
|
+
*/
|
|
7
|
+
readonly variant: NotificationVariant;
|
|
8
|
+
/**
|
|
9
|
+
* Notification message content.
|
|
10
|
+
*/
|
|
11
|
+
readonly children: React.ReactNode;
|
|
12
|
+
}
|
|
13
|
+
interface NotificationClosableProps extends NotificationBaseProps {
|
|
14
|
+
/**
|
|
15
|
+
* Whether to show the close button.
|
|
16
|
+
*/
|
|
17
|
+
readonly closable: true;
|
|
18
|
+
/**
|
|
19
|
+
* Callback fired when the close button is clicked.
|
|
20
|
+
* Required when `closable` is true.
|
|
21
|
+
* The consuming application is responsible for handling dismiss logic.
|
|
22
|
+
*/
|
|
23
|
+
readonly onClose: () => void;
|
|
24
|
+
/**
|
|
25
|
+
* Accessible label for the close button.
|
|
26
|
+
*/
|
|
27
|
+
readonly closeLabel?: string;
|
|
28
|
+
}
|
|
29
|
+
interface NotificationStaticProps extends NotificationBaseProps {
|
|
30
|
+
/**
|
|
31
|
+
* Whether to show the close button.
|
|
32
|
+
* @default false
|
|
33
|
+
*/
|
|
34
|
+
readonly closable?: false;
|
|
35
|
+
readonly onClose?: never;
|
|
36
|
+
readonly closeLabel?: never;
|
|
37
|
+
}
|
|
38
|
+
export type NotificationProps = NotificationClosableProps | NotificationStaticProps;
|
|
39
|
+
export {};
|
|
40
|
+
//# sourceMappingURL=Notification.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notification.types.d.ts","sourceRoot":"","sources":["../../../src/components/Notification/Notification.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,KAAK,MAAM,OAAO,CAAC;AAEpC,MAAM,MAAM,mBAAmB,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAE3E,UAAU,qBAAsB,SAAQ,IAAI,CAAC,KAAK,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IACxF;;OAEG;IACH,QAAQ,CAAC,OAAO,EAAE,mBAAmB,CAAC;IACtC;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CACtC;AAED,UAAU,yBAA0B,SAAQ,qBAAqB;IAC7D;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,IAAI,CAAC;IACxB;;;;OAIG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,IAAI,CAAC;IAC7B;;OAEG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAChC;AAED,UAAU,uBAAwB,SAAQ,qBAAqB;IAC3D;;;OAGG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,KAAK,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,KAAK,CAAC;IACzB,QAAQ,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC;CAC/B;AAED,MAAM,MAAM,iBAAiB,GAAG,yBAAyB,GAAG,uBAAuB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Notification/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAC9C,YAAY,EAAE,iBAAiB,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const Spinner_module = require("./Spinner.module.css.cjs");
|
|
5
|
+
const cn = require("../../utils/cn/cn.cjs");
|
|
6
|
+
const CAR_DASH = "71 212";
|
|
7
|
+
const Spinner = ({
|
|
8
|
+
color = "primary",
|
|
9
|
+
size = "m",
|
|
10
|
+
className,
|
|
11
|
+
ref,
|
|
12
|
+
role = "status",
|
|
13
|
+
"aria-label": ariaLabel = "Ladataan",
|
|
14
|
+
...props
|
|
15
|
+
}) => {
|
|
16
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
17
|
+
"svg",
|
|
18
|
+
{
|
|
19
|
+
...props,
|
|
20
|
+
ref,
|
|
21
|
+
viewBox: "0 0 100 100",
|
|
22
|
+
role,
|
|
23
|
+
"aria-label": ariaLabel,
|
|
24
|
+
className: cn.cn(
|
|
25
|
+
Spinner_module.default.spinner,
|
|
26
|
+
Spinner_module.default[`spinner--${color}`],
|
|
27
|
+
Spinner_module.default[`spinner--${size}`],
|
|
28
|
+
className
|
|
29
|
+
),
|
|
30
|
+
children: [
|
|
31
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
32
|
+
"circle",
|
|
33
|
+
{
|
|
34
|
+
className: Spinner_module.default.spinner__track,
|
|
35
|
+
cx: "50",
|
|
36
|
+
cy: "50",
|
|
37
|
+
r: "45",
|
|
38
|
+
fill: "none",
|
|
39
|
+
stroke: "currentColor",
|
|
40
|
+
strokeWidth: "10"
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
44
|
+
"circle",
|
|
45
|
+
{
|
|
46
|
+
className: Spinner_module.default.spinner__car,
|
|
47
|
+
cx: "50",
|
|
48
|
+
cy: "50",
|
|
49
|
+
r: "45",
|
|
50
|
+
fill: "none",
|
|
51
|
+
stroke: "currentColor",
|
|
52
|
+
strokeWidth: "10",
|
|
53
|
+
strokeDasharray: CAR_DASH,
|
|
54
|
+
strokeLinecap: "round"
|
|
55
|
+
}
|
|
56
|
+
)
|
|
57
|
+
]
|
|
58
|
+
}
|
|
59
|
+
);
|
|
60
|
+
};
|
|
61
|
+
exports.Spinner = Spinner;
|
|
62
|
+
//# sourceMappingURL=Spinner.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.cjs","sources":["../../../src/components/Spinner/Spinner.tsx"],"sourcesContent":["import { cn } from '../../utils/cn';\nimport styles from './Spinner.module.css';\nimport type { SpinnerProps } from './Spinner.types';\n\n/**\n * Circumference of a circle with r=45 in a 100×100 viewBox: 2π × 45 ≈ 282.74.\n * The \"car\" arc covers ~25 % of the circumference (~70.69); the gap fills the rest (~212.06).\n */\nconst CAR_DASH = '71 212';\n\nexport const Spinner = ({\n color = 'primary',\n size = 'm',\n className,\n ref,\n role = 'status',\n 'aria-label': ariaLabel = 'Ladataan',\n ...props\n}: SpinnerProps) => {\n return (\n <svg\n {...props}\n ref={ref}\n viewBox=\"0 0 100 100\"\n role={role}\n aria-label={ariaLabel}\n className={cn(\n styles.spinner,\n styles[`spinner--${color}`],\n styles[`spinner--${size}`],\n className,\n )}\n >\n {/* Track: full ring at 40 % opacity */}\n <circle\n className={styles.spinner__track}\n cx=\"50\"\n cy=\"50\"\n r=\"45\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"10\"\n />\n {/* Car: partial arc that rotates continuously */}\n <circle\n className={styles.spinner__car}\n cx=\"50\"\n cy=\"50\"\n r=\"45\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth=\"10\"\n strokeDasharray={CAR_DASH}\n strokeLinecap=\"round\"\n />\n </svg>\n );\n};\n"],"names":["jsxs","cn","styles","jsx"],"mappings":";;;;;AAQA,MAAM,WAAW;AAEV,MAAM,UAAU,CAAC;AAAA,EACpB,QAAQ;AAAA,EACR,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,cAAc,YAAY;AAAA,EAC1B,GAAG;AACP,MAAoB;AAChB,SACIA,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACI,GAAG;AAAA,MACJ;AAAA,MACA,SAAQ;AAAA,MACR;AAAA,MACA,cAAY;AAAA,MACZ,WAAWC,GAAAA;AAAAA,QACPC,eAAAA,QAAO;AAAA,QACPA,eAAAA,QAAO,YAAY,KAAK,EAAE;AAAA,QAC1BA,eAAAA,QAAO,YAAY,IAAI,EAAE;AAAA,QACzB;AAAA,MAAA;AAAA,MAIJ,UAAA;AAAA,QAAAC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACG,WAAWD,eAAAA,QAAO;AAAA,YAClB,IAAG;AAAA,YACH,IAAG;AAAA,YACH,GAAE;AAAA,YACF,MAAK;AAAA,YACL,QAAO;AAAA,YACP,aAAY;AAAA,UAAA;AAAA,QAAA;AAAA,QAGhBC,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACG,WAAWD,eAAAA,QAAO;AAAA,YAClB,IAAG;AAAA,YACH,IAAG;AAAA,YACH,GAAE;AAAA,YACF,MAAK;AAAA,YACL,QAAO;AAAA,YACP,aAAY;AAAA,YACZ,iBAAiB;AAAA,YACjB,eAAc;AAAA,UAAA;AAAA,QAAA;AAAA,MAClB;AAAA,IAAA;AAAA,EAAA;AAGZ;;"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
@layer dna-design-system {/* ─────────────────────────────────────────────────────────────
|
|
2
|
+
Spinner — base
|
|
3
|
+
───────────────────────────────────────────────────────────── */
|
|
4
|
+
|
|
5
|
+
._spinner_j28th_5 {
|
|
6
|
+
/*
|
|
7
|
+
* Internal custom property that carries the animation duration.
|
|
8
|
+
* Each size class below overrides it; the .car rule consumes it.
|
|
9
|
+
* The default matches the medium (m) size.
|
|
10
|
+
*/
|
|
11
|
+
--_spinner-duration: 0.8s;
|
|
12
|
+
|
|
13
|
+
display: inline-block;
|
|
14
|
+
flex-shrink: 0;
|
|
15
|
+
overflow: visible;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/* ─────────────────────────────────────────────────────────────
|
|
19
|
+
Color variants
|
|
20
|
+
Token: foreground color of both the track and the car.
|
|
21
|
+
The track uses the same color at 40 % opacity (see .track).
|
|
22
|
+
───────────────────────────────────────────────────────────── */
|
|
23
|
+
|
|
24
|
+
._spinner--primary_j28th_24 {
|
|
25
|
+
color: var(--color-semantic-foreground-primary-strong);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
._spinner--secondary_j28th_28 {
|
|
29
|
+
color: var(--color-semantic-foreground-secondary-strong);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
._spinner--inverse_j28th_32 {
|
|
33
|
+
color: var(--color-semantic-foreground-inverse);
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
._spinner--inherit_j28th_36 {
|
|
37
|
+
color: inherit;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
/* ─────────────────────────────────────────────────────────────
|
|
41
|
+
Size variants
|
|
42
|
+
XS → 0.6 s | S → 0.7 s | M → 0.8 s | L → 0.9 s | XL → 1.0 s
|
|
43
|
+
───────────────────────────────────────────────────────────── */
|
|
44
|
+
|
|
45
|
+
._spinner--xs_j28th_45 {
|
|
46
|
+
width: 20px;
|
|
47
|
+
height: 20px;
|
|
48
|
+
--_spinner-duration: 0.6s;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
._spinner--s_j28th_28 {
|
|
52
|
+
width: 24px;
|
|
53
|
+
height: 24px;
|
|
54
|
+
--_spinner-duration: 0.7s;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
._spinner--m_j28th_57 {
|
|
58
|
+
width: 40px;
|
|
59
|
+
height: 40px;
|
|
60
|
+
--_spinner-duration: 0.8s;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
._spinner--l_j28th_63 {
|
|
64
|
+
width: 64px;
|
|
65
|
+
height: 64px;
|
|
66
|
+
--_spinner-duration: 0.9s;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
._spinner--xl_j28th_69 {
|
|
70
|
+
width: 80px;
|
|
71
|
+
height: 80px;
|
|
72
|
+
--_spinner-duration: 1s;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* ─────────────────────────────────────────────────────────────
|
|
76
|
+
Track — the background ring
|
|
77
|
+
Rendered at 40 % opacity of currentColor.
|
|
78
|
+
───────────────────────────────────────────────────────────── */
|
|
79
|
+
|
|
80
|
+
._spinner__track_j28th_80 {
|
|
81
|
+
opacity: 0.4;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/* ─────────────────────────────────────────────────────────────
|
|
85
|
+
Car — the animated arc that travels around the track
|
|
86
|
+
───────────────────────────────────────────────────────────── */
|
|
87
|
+
|
|
88
|
+
._spinner__car_j28th_88 {
|
|
89
|
+
/*
|
|
90
|
+
* transform-box: fill-box makes transform-origin relative to the
|
|
91
|
+
* element's own bounding box, so "center" correctly refers to the
|
|
92
|
+
* centre of the circle rather than the SVG viewport.
|
|
93
|
+
*/
|
|
94
|
+
transform-box: fill-box;
|
|
95
|
+
transform-origin: center;
|
|
96
|
+
animation: _spinner-rotate_j28th_1 var(--_spinner-duration) linear infinite;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
@keyframes _spinner-rotate_j28th_1 {
|
|
100
|
+
to {
|
|
101
|
+
transform: rotate(360deg);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/* ─────────────────────────────────────────────────────────────
|
|
106
|
+
Reduced-motion preference
|
|
107
|
+
Slow the animation significantly instead of stopping it entirely,
|
|
108
|
+
so the loading state remains perceptible without causing discomfort.
|
|
109
|
+
───────────────────────────────────────────────────────────── */
|
|
110
|
+
|
|
111
|
+
@media (prefers-reduced-motion: reduce) {
|
|
112
|
+
._spinner__car_j28th_88 {
|
|
113
|
+
animation-duration: 3s;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../src/components/Spinner/Spinner.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAQpD,eAAO,MAAM,OAAO,GAAI,0EAQrB,YAAY,4CAuCd,CAAC"}
|