@dnanpm/ui-components 0.0.5 → 0.1.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 +10 -41
- package/dist/components/Accordion/Accordion.cjs +26 -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 +26 -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 +73 -0
- package/dist/components/Breadcrumb/Breadcrumb.cjs.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.css +72 -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 +73 -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 +46 -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/Label/Label.cjs +20 -0
- package/dist/components/Label/Label.cjs.map +1 -0
- package/dist/components/Label/Label.css +40 -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 +20 -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 +28 -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 +58 -0
- package/dist/components/Notification/Notification.cjs.map +1 -0
- package/dist/components/Notification/Notification.css +91 -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 +58 -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/font-definitions.css +61 -0
- package/dist/index.cjs +13 -10027
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +10 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -10009
- 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 +59 -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 +49 -347
- 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 +9 -7
- 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/Button/Button.d.ts +0 -3
- package/dist/components/Button/Button.d.ts.map +0 -1
- package/dist/components/Button/Button.types.d.ts +0 -51
- package/dist/components/Button/Button.types.d.ts.map +0 -1
- package/dist/components/Button/index.d.ts +0 -3
- package/dist/components/Button/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/Tooltip/index.d.ts.map +0 -1
- package/dist/components/index.d.ts +0 -5
- package/dist/components/index.d.ts.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/AccordionItem/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAChD,YAAY,EAAE,kBAAkB,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
const icons = require("@dnanpm/icons");
|
|
6
|
+
const focus_module = require("../../styles/utils/focus.module.css.cjs");
|
|
7
|
+
const textDecoration_module = require("../../styles/utils/text-decoration.module.css.cjs");
|
|
8
|
+
const Breadcrumb_module = require("./Breadcrumb.module.css.cjs");
|
|
9
|
+
const cn = require("../../utils/cn/cn.cjs");
|
|
10
|
+
const defaultRenderLink = (props) => /* @__PURE__ */ jsxRuntime.jsx("a", { ...props });
|
|
11
|
+
const Breadcrumb = react.forwardRef(function Breadcrumb2({
|
|
12
|
+
items,
|
|
13
|
+
lastItemAsLink = false,
|
|
14
|
+
renderLink = defaultRenderLink,
|
|
15
|
+
className,
|
|
16
|
+
"aria-label": ariaLabel = "Murupolku",
|
|
17
|
+
...props
|
|
18
|
+
}, ref) {
|
|
19
|
+
if (items.length === 0) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
const lastIndex = items.length - 1;
|
|
23
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
24
|
+
"nav",
|
|
25
|
+
{
|
|
26
|
+
ref,
|
|
27
|
+
"aria-label": ariaLabel,
|
|
28
|
+
className: cn.cn(Breadcrumb_module.default.breadcrumb, focus_module.default.focusClipGuard, className),
|
|
29
|
+
...props,
|
|
30
|
+
children: /* @__PURE__ */ jsxRuntime.jsx("ol", { className: Breadcrumb_module.default.breadcrumb__list, children: items.map((item, index) => {
|
|
31
|
+
const isLast = index === lastIndex;
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsx("li", { className: Breadcrumb_module.default.breadcrumb__item, children: isLast ? lastItemAsLink ? renderLink({
|
|
33
|
+
href: item.href,
|
|
34
|
+
className: cn.cn(
|
|
35
|
+
focus_module.default.focusable,
|
|
36
|
+
textDecoration_module.default.underlineLink,
|
|
37
|
+
Breadcrumb_module.default.breadcrumb__link,
|
|
38
|
+
Breadcrumb_module.default.breadcrumb__current
|
|
39
|
+
),
|
|
40
|
+
"aria-current": "page",
|
|
41
|
+
children: item.label
|
|
42
|
+
}) : /* @__PURE__ */ jsxRuntime.jsx(
|
|
43
|
+
"span",
|
|
44
|
+
{
|
|
45
|
+
className: Breadcrumb_module.default.breadcrumb__current,
|
|
46
|
+
"aria-current": "page",
|
|
47
|
+
children: item.label
|
|
48
|
+
}
|
|
49
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
50
|
+
renderLink({
|
|
51
|
+
href: item.href,
|
|
52
|
+
className: cn.cn(
|
|
53
|
+
focus_module.default.focusable,
|
|
54
|
+
textDecoration_module.default.underlineLink,
|
|
55
|
+
Breadcrumb_module.default.breadcrumb__link
|
|
56
|
+
),
|
|
57
|
+
children: item.label
|
|
58
|
+
}),
|
|
59
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
60
|
+
icons.ChevronRight,
|
|
61
|
+
{
|
|
62
|
+
className: Breadcrumb_module.default.breadcrumb__separator,
|
|
63
|
+
"aria-hidden": "true"
|
|
64
|
+
}
|
|
65
|
+
)
|
|
66
|
+
] }) }, index);
|
|
67
|
+
}) })
|
|
68
|
+
}
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
72
|
+
exports.Breadcrumb = Breadcrumb;
|
|
73
|
+
//# sourceMappingURL=Breadcrumb.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumb.cjs","sources":["../../../src/components/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { ChevronRight } from '@dnanpm/icons';\nimport { cn } from '../../utils/cn';\nimport focusStyles from '../../styles/utils/focus.module.css';\nimport textDecorationStyles from '../../styles/utils/text-decoration.module.css';\nimport styles from './Breadcrumb.module.css';\nimport type { BreadcrumbLinkProps, BreadcrumbProps } from './Breadcrumb.types';\n\nconst defaultRenderLink = (props: BreadcrumbLinkProps) => <a {...props} />;\n\nexport const Breadcrumb = forwardRef<HTMLElement, BreadcrumbProps>(function Breadcrumb(\n {\n items,\n lastItemAsLink = false,\n renderLink = defaultRenderLink,\n className,\n 'aria-label': ariaLabel = 'Murupolku',\n ...props\n },\n ref,\n) {\n if (items.length === 0) {\n return null;\n }\n\n const lastIndex = items.length - 1;\n\n return (\n <nav\n ref={ref}\n aria-label={ariaLabel}\n className={cn(styles.breadcrumb, focusStyles.focusClipGuard, className)}\n {...props}\n >\n <ol className={styles.breadcrumb__list}>\n {items.map((item, index) => {\n const isLast = index === lastIndex;\n\n return (\n <li key={index} className={styles.breadcrumb__item}>\n {isLast ? (\n lastItemAsLink ? (\n renderLink({\n href: item.href,\n className: cn(\n focusStyles.focusable,\n textDecorationStyles.underlineLink,\n styles.breadcrumb__link,\n styles.breadcrumb__current,\n ),\n 'aria-current': 'page',\n children: item.label,\n })\n ) : (\n <span\n className={styles.breadcrumb__current}\n aria-current=\"page\"\n >\n {item.label}\n </span>\n )\n ) : (\n <>\n {renderLink({\n href: item.href,\n className: cn(\n focusStyles.focusable,\n textDecorationStyles.underlineLink,\n styles.breadcrumb__link,\n ),\n children: item.label,\n })}\n <ChevronRight\n className={styles.breadcrumb__separator}\n aria-hidden=\"true\"\n />\n </>\n )}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n});\n\nBreadcrumb.displayName = 'Breadcrumb';\n"],"names":["jsx","forwardRef","Breadcrumb","cn","styles","focusStyles","textDecorationStyles","jsxs","Fragment","ChevronRight"],"mappings":";;;;;;;;;AAQA,MAAM,oBAAoB,CAAC,UAA+BA,2BAAAA,IAAC,KAAA,EAAG,GAAG,OAAO;AAEjE,MAAM,aAAaC,MAAAA,WAAyC,SAASC,YACxE;AAAA,EACI;AAAA,EACA,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb;AAAA,EACA,cAAc,YAAY;AAAA,EAC1B,GAAG;AACP,GACA,KACF;AACE,MAAI,MAAM,WAAW,GAAG;AACpB,WAAO;AAAA,EACX;AAEA,QAAM,YAAY,MAAM,SAAS;AAEjC,SACIF,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACG;AAAA,MACA,cAAY;AAAA,MACZ,WAAWG,GAAAA,GAAGC,kBAAAA,QAAO,YAAYC,aAAAA,QAAY,gBAAgB,SAAS;AAAA,MACrE,GAAG;AAAA,MAEJ,UAAAL,2BAAAA,IAAC,QAAG,WAAWI,kBAAAA,QAAO,kBACjB,UAAA,MAAM,IAAI,CAAC,MAAM,UAAU;AACxB,cAAM,SAAS,UAAU;AAEzB,8CACK,MAAA,EAAe,WAAWA,kBAAAA,QAAO,kBAC7B,UAAA,SACG,iBACI,WAAW;AAAA,UACP,MAAM,KAAK;AAAA,UACX,WAAWD,GAAAA;AAAAA,YACPE,aAAAA,QAAY;AAAA,YACZC,sBAAAA,QAAqB;AAAA,YACrBF,kBAAAA,QAAO;AAAA,YACPA,0BAAO;AAAA,UAAA;AAAA,UAEX,gBAAgB;AAAA,UAChB,UAAU,KAAK;AAAA,QAAA,CAClB,IAEDJ,2BAAAA;AAAAA,UAAC;AAAA,UAAA;AAAA,YACG,WAAWI,kBAAAA,QAAO;AAAA,YAClB,gBAAa;AAAA,YAEZ,UAAA,KAAK;AAAA,UAAA;AAAA,QAAA,IAIdG,2BAAAA,KAAAC,qBAAA,EACK,UAAA;AAAA,UAAA,WAAW;AAAA,YACR,MAAM,KAAK;AAAA,YACX,WAAWL,GAAAA;AAAAA,cACPE,aAAAA,QAAY;AAAA,cACZC,sBAAAA,QAAqB;AAAA,cACrBF,0BAAO;AAAA,YAAA;AAAA,YAEX,UAAU,KAAK;AAAA,UAAA,CAClB;AAAA,UACDJ,2BAAAA;AAAAA,YAACS,MAAAA;AAAAA,YAAA;AAAA,cACG,WAAWL,kBAAAA,QAAO;AAAA,cAClB,eAAY;AAAA,YAAA;AAAA,UAAA;AAAA,QAChB,EAAA,CACJ,KArCC,KAuCT;AAAA,MAER,CAAC,EAAA,CACL;AAAA,IAAA;AAAA,EAAA;AAGZ,CAAC;AAED,WAAW,cAAc;;"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
@layer dna-design-system {/**
|
|
2
|
+
* Breadcrumb Component Styles
|
|
3
|
+
*
|
|
4
|
+
* Design tokens are consumed via CSS custom properties (variables).
|
|
5
|
+
* These variables come from @dnanpm/design-tokens package.
|
|
6
|
+
*
|
|
7
|
+
* Uses a container query (ch units) to switch between default and collapsed mode.
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
._breadcrumb_iubo4_10 {
|
|
11
|
+
container-name: breadcrumb;
|
|
12
|
+
container-type: inline-size;
|
|
13
|
+
width: 100%;
|
|
14
|
+
overflow: hidden;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
._breadcrumb__list_iubo4_17 {
|
|
18
|
+
display: flex;
|
|
19
|
+
align-items: center;
|
|
20
|
+
gap: var(--spacing-ui-xxs);
|
|
21
|
+
margin: var(--spacing-ui-lg) 0;
|
|
22
|
+
padding: 0;
|
|
23
|
+
list-style: none;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
._breadcrumb__item_iubo4_26 {
|
|
27
|
+
flex: 0 0 auto;
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
gap: var(--spacing-ui-xxs);
|
|
31
|
+
font-size: 0.875rem;
|
|
32
|
+
font-weight: 500;
|
|
33
|
+
line-height: 1.125rem;
|
|
34
|
+
|
|
35
|
+
&:last-child {
|
|
36
|
+
min-width: 0;
|
|
37
|
+
flex-shrink: 1;
|
|
38
|
+
}
|
|
39
|
+
a,
|
|
40
|
+
span {
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
._breadcrumb__link_iubo4_45 {
|
|
46
|
+
color: var(--colors-semantic-interactive-primary-default);
|
|
47
|
+
border-radius: var(--radius-semantic-sm);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
._breadcrumb__link_iubo4_45:hover {
|
|
51
|
+
color: var(--colors-semantic-interactive-primary-hover);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
._breadcrumb__current_iubo4_54 {
|
|
55
|
+
overflow: hidden;
|
|
56
|
+
text-overflow: ellipsis;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
._breadcrumb__separator_iubo4_59 {
|
|
60
|
+
flex: 0 0 auto;
|
|
61
|
+
width: 0.875rem;
|
|
62
|
+
height: 0.875rem;
|
|
63
|
+
color: var(--colors-semantic-interactive-primary-default);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/* Collapsed mode: hide all items except the last two */
|
|
67
|
+
@container breadcrumb (max-width: 75ch) {
|
|
68
|
+
._breadcrumb__item_iubo4_26:not(:nth-last-child(-n + 2)) {
|
|
69
|
+
display: none;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumb.d.ts","sourceRoot":"","sources":["../../../src/components/Breadcrumb/Breadcrumb.tsx"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAuB,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAI/E,eAAO,MAAM,UAAU,yGA0ErB,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { ChevronRight } from "@dnanpm/icons";
|
|
4
|
+
import focusStyles from "../../styles/utils/focus.module.css.js";
|
|
5
|
+
import textDecorationStyles from "../../styles/utils/text-decoration.module.css.js";
|
|
6
|
+
import styles from "./Breadcrumb.module.css.js";
|
|
7
|
+
import { cn } from "../../utils/cn/cn.js";
|
|
8
|
+
const defaultRenderLink = (props) => /* @__PURE__ */ jsx("a", { ...props });
|
|
9
|
+
const Breadcrumb = forwardRef(function Breadcrumb2({
|
|
10
|
+
items,
|
|
11
|
+
lastItemAsLink = false,
|
|
12
|
+
renderLink = defaultRenderLink,
|
|
13
|
+
className,
|
|
14
|
+
"aria-label": ariaLabel = "Murupolku",
|
|
15
|
+
...props
|
|
16
|
+
}, ref) {
|
|
17
|
+
if (items.length === 0) {
|
|
18
|
+
return null;
|
|
19
|
+
}
|
|
20
|
+
const lastIndex = items.length - 1;
|
|
21
|
+
return /* @__PURE__ */ jsx(
|
|
22
|
+
"nav",
|
|
23
|
+
{
|
|
24
|
+
ref,
|
|
25
|
+
"aria-label": ariaLabel,
|
|
26
|
+
className: cn(styles.breadcrumb, focusStyles.focusClipGuard, className),
|
|
27
|
+
...props,
|
|
28
|
+
children: /* @__PURE__ */ jsx("ol", { className: styles.breadcrumb__list, children: items.map((item, index) => {
|
|
29
|
+
const isLast = index === lastIndex;
|
|
30
|
+
return /* @__PURE__ */ jsx("li", { className: styles.breadcrumb__item, children: isLast ? lastItemAsLink ? renderLink({
|
|
31
|
+
href: item.href,
|
|
32
|
+
className: cn(
|
|
33
|
+
focusStyles.focusable,
|
|
34
|
+
textDecorationStyles.underlineLink,
|
|
35
|
+
styles.breadcrumb__link,
|
|
36
|
+
styles.breadcrumb__current
|
|
37
|
+
),
|
|
38
|
+
"aria-current": "page",
|
|
39
|
+
children: item.label
|
|
40
|
+
}) : /* @__PURE__ */ jsx(
|
|
41
|
+
"span",
|
|
42
|
+
{
|
|
43
|
+
className: styles.breadcrumb__current,
|
|
44
|
+
"aria-current": "page",
|
|
45
|
+
children: item.label
|
|
46
|
+
}
|
|
47
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
48
|
+
renderLink({
|
|
49
|
+
href: item.href,
|
|
50
|
+
className: cn(
|
|
51
|
+
focusStyles.focusable,
|
|
52
|
+
textDecorationStyles.underlineLink,
|
|
53
|
+
styles.breadcrumb__link
|
|
54
|
+
),
|
|
55
|
+
children: item.label
|
|
56
|
+
}),
|
|
57
|
+
/* @__PURE__ */ jsx(
|
|
58
|
+
ChevronRight,
|
|
59
|
+
{
|
|
60
|
+
className: styles.breadcrumb__separator,
|
|
61
|
+
"aria-hidden": "true"
|
|
62
|
+
}
|
|
63
|
+
)
|
|
64
|
+
] }) }, index);
|
|
65
|
+
}) })
|
|
66
|
+
}
|
|
67
|
+
);
|
|
68
|
+
});
|
|
69
|
+
Breadcrumb.displayName = "Breadcrumb";
|
|
70
|
+
export {
|
|
71
|
+
Breadcrumb
|
|
72
|
+
};
|
|
73
|
+
//# sourceMappingURL=Breadcrumb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumb.js","sources":["../../../src/components/Breadcrumb/Breadcrumb.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { ChevronRight } from '@dnanpm/icons';\nimport { cn } from '../../utils/cn';\nimport focusStyles from '../../styles/utils/focus.module.css';\nimport textDecorationStyles from '../../styles/utils/text-decoration.module.css';\nimport styles from './Breadcrumb.module.css';\nimport type { BreadcrumbLinkProps, BreadcrumbProps } from './Breadcrumb.types';\n\nconst defaultRenderLink = (props: BreadcrumbLinkProps) => <a {...props} />;\n\nexport const Breadcrumb = forwardRef<HTMLElement, BreadcrumbProps>(function Breadcrumb(\n {\n items,\n lastItemAsLink = false,\n renderLink = defaultRenderLink,\n className,\n 'aria-label': ariaLabel = 'Murupolku',\n ...props\n },\n ref,\n) {\n if (items.length === 0) {\n return null;\n }\n\n const lastIndex = items.length - 1;\n\n return (\n <nav\n ref={ref}\n aria-label={ariaLabel}\n className={cn(styles.breadcrumb, focusStyles.focusClipGuard, className)}\n {...props}\n >\n <ol className={styles.breadcrumb__list}>\n {items.map((item, index) => {\n const isLast = index === lastIndex;\n\n return (\n <li key={index} className={styles.breadcrumb__item}>\n {isLast ? (\n lastItemAsLink ? (\n renderLink({\n href: item.href,\n className: cn(\n focusStyles.focusable,\n textDecorationStyles.underlineLink,\n styles.breadcrumb__link,\n styles.breadcrumb__current,\n ),\n 'aria-current': 'page',\n children: item.label,\n })\n ) : (\n <span\n className={styles.breadcrumb__current}\n aria-current=\"page\"\n >\n {item.label}\n </span>\n )\n ) : (\n <>\n {renderLink({\n href: item.href,\n className: cn(\n focusStyles.focusable,\n textDecorationStyles.underlineLink,\n styles.breadcrumb__link,\n ),\n children: item.label,\n })}\n <ChevronRight\n className={styles.breadcrumb__separator}\n aria-hidden=\"true\"\n />\n </>\n )}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n});\n\nBreadcrumb.displayName = 'Breadcrumb';\n"],"names":["Breadcrumb"],"mappings":";;;;;;;AAQA,MAAM,oBAAoB,CAAC,UAA+B,oBAAC,KAAA,EAAG,GAAG,OAAO;AAEjE,MAAM,aAAa,WAAyC,SAASA,YACxE;AAAA,EACI;AAAA,EACA,iBAAiB;AAAA,EACjB,aAAa;AAAA,EACb;AAAA,EACA,cAAc,YAAY;AAAA,EAC1B,GAAG;AACP,GACA,KACF;AACE,MAAI,MAAM,WAAW,GAAG;AACpB,WAAO;AAAA,EACX;AAEA,QAAM,YAAY,MAAM,SAAS;AAEjC,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACG;AAAA,MACA,cAAY;AAAA,MACZ,WAAW,GAAG,OAAO,YAAY,YAAY,gBAAgB,SAAS;AAAA,MACrE,GAAG;AAAA,MAEJ,UAAA,oBAAC,QAAG,WAAW,OAAO,kBACjB,UAAA,MAAM,IAAI,CAAC,MAAM,UAAU;AACxB,cAAM,SAAS,UAAU;AAEzB,mCACK,MAAA,EAAe,WAAW,OAAO,kBAC7B,UAAA,SACG,iBACI,WAAW;AAAA,UACP,MAAM,KAAK;AAAA,UACX,WAAW;AAAA,YACP,YAAY;AAAA,YACZ,qBAAqB;AAAA,YACrB,OAAO;AAAA,YACP,OAAO;AAAA,UAAA;AAAA,UAEX,gBAAgB;AAAA,UAChB,UAAU,KAAK;AAAA,QAAA,CAClB,IAED;AAAA,UAAC;AAAA,UAAA;AAAA,YACG,WAAW,OAAO;AAAA,YAClB,gBAAa;AAAA,YAEZ,UAAA,KAAK;AAAA,UAAA;AAAA,QAAA,IAId,qBAAA,UAAA,EACK,UAAA;AAAA,UAAA,WAAW;AAAA,YACR,MAAM,KAAK;AAAA,YACX,WAAW;AAAA,cACP,YAAY;AAAA,cACZ,qBAAqB;AAAA,cACrB,OAAO;AAAA,YAAA;AAAA,YAEX,UAAU,KAAK;AAAA,UAAA,CAClB;AAAA,UACD;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,WAAW,OAAO;AAAA,cAClB,eAAY;AAAA,YAAA;AAAA,UAAA;AAAA,QAChB,EAAA,CACJ,KArCC,KAuCT;AAAA,MAER,CAAC,EAAA,CACL;AAAA,IAAA;AAAA,EAAA;AAGZ,CAAC;AAED,WAAW,cAAc;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
require('./Breadcrumb.css');
|
|
2
|
+
"use strict";
|
|
3
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
|
|
4
|
+
const breadcrumb = "_breadcrumb_iubo4_10";
|
|
5
|
+
const breadcrumb__list = "_breadcrumb__list_iubo4_17";
|
|
6
|
+
const breadcrumb__item = "_breadcrumb__item_iubo4_26";
|
|
7
|
+
const breadcrumb__link = "_breadcrumb__link_iubo4_45";
|
|
8
|
+
const breadcrumb__current = "_breadcrumb__current_iubo4_54";
|
|
9
|
+
const breadcrumb__separator = "_breadcrumb__separator_iubo4_59";
|
|
10
|
+
const styles = {
|
|
11
|
+
breadcrumb,
|
|
12
|
+
breadcrumb__list,
|
|
13
|
+
breadcrumb__item,
|
|
14
|
+
breadcrumb__link,
|
|
15
|
+
breadcrumb__current,
|
|
16
|
+
breadcrumb__separator
|
|
17
|
+
};
|
|
18
|
+
exports.breadcrumb = breadcrumb;
|
|
19
|
+
exports.breadcrumb__current = breadcrumb__current;
|
|
20
|
+
exports.breadcrumb__item = breadcrumb__item;
|
|
21
|
+
exports.breadcrumb__link = breadcrumb__link;
|
|
22
|
+
exports.breadcrumb__list = breadcrumb__list;
|
|
23
|
+
exports.breadcrumb__separator = breadcrumb__separator;
|
|
24
|
+
exports.default = styles;
|
|
25
|
+
//# sourceMappingURL=Breadcrumb.module.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumb.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import './Breadcrumb.css';
|
|
2
|
+
const breadcrumb = "_breadcrumb_iubo4_10";
|
|
3
|
+
const breadcrumb__list = "_breadcrumb__list_iubo4_17";
|
|
4
|
+
const breadcrumb__item = "_breadcrumb__item_iubo4_26";
|
|
5
|
+
const breadcrumb__link = "_breadcrumb__link_iubo4_45";
|
|
6
|
+
const breadcrumb__current = "_breadcrumb__current_iubo4_54";
|
|
7
|
+
const breadcrumb__separator = "_breadcrumb__separator_iubo4_59";
|
|
8
|
+
const styles = {
|
|
9
|
+
breadcrumb,
|
|
10
|
+
breadcrumb__list,
|
|
11
|
+
breadcrumb__item,
|
|
12
|
+
breadcrumb__link,
|
|
13
|
+
breadcrumb__current,
|
|
14
|
+
breadcrumb__separator
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
breadcrumb,
|
|
18
|
+
breadcrumb__current,
|
|
19
|
+
breadcrumb__item,
|
|
20
|
+
breadcrumb__link,
|
|
21
|
+
breadcrumb__list,
|
|
22
|
+
breadcrumb__separator,
|
|
23
|
+
styles as default
|
|
24
|
+
};
|
|
25
|
+
//# sourceMappingURL=Breadcrumb.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumb.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export interface BreadcrumbItem {
|
|
3
|
+
/**
|
|
4
|
+
* The visible label for the breadcrumb item
|
|
5
|
+
*/
|
|
6
|
+
readonly label: string;
|
|
7
|
+
/**
|
|
8
|
+
* The URL for the breadcrumb link
|
|
9
|
+
*/
|
|
10
|
+
readonly href: string;
|
|
11
|
+
}
|
|
12
|
+
export interface BreadcrumbLinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement> {
|
|
13
|
+
readonly href: string;
|
|
14
|
+
readonly children: React.ReactNode;
|
|
15
|
+
}
|
|
16
|
+
export interface BreadcrumbProps extends Omit<React.ComponentPropsWithoutRef<'nav'>, 'children'> {
|
|
17
|
+
/**
|
|
18
|
+
* Ordered list of breadcrumb items. The last item represents the current page.
|
|
19
|
+
*/
|
|
20
|
+
readonly items: readonly BreadcrumbItem[];
|
|
21
|
+
/**
|
|
22
|
+
* Whether the last item (current page) should render as a link.
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
readonly lastItemAsLink?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Custom render function for link elements. Use this to integrate with
|
|
28
|
+
* client-side routing libraries like Next.js or React Router.
|
|
29
|
+
*
|
|
30
|
+
* @example
|
|
31
|
+
* // Next.js
|
|
32
|
+
* import Link from 'next/link';
|
|
33
|
+
* <Breadcrumb items={items} renderLink={(props) => <Link {...props} />} />
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* // React Router
|
|
37
|
+
* import { Link } from 'react-router-dom';
|
|
38
|
+
* <Breadcrumb items={items} renderLink={({ href, ...props }) => <Link to={href} {...props} />} />
|
|
39
|
+
*/
|
|
40
|
+
readonly renderLink?: (props: BreadcrumbLinkProps) => React.ReactNode;
|
|
41
|
+
/**
|
|
42
|
+
* Custom className to apply to the nav element
|
|
43
|
+
*/
|
|
44
|
+
readonly className?: string;
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=Breadcrumb.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Breadcrumb.types.d.ts","sourceRoot":"","sources":["../../../src/components/Breadcrumb/Breadcrumb.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB;;OAEG;IACH,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC;IACtF,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CACtC;AAED,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,KAAK,CAAC,wBAAwB,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC;IAC5F;;OAEG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,cAAc,EAAE,CAAC;IAC1C;;;OAGG;IACH,QAAQ,CAAC,cAAc,CAAC,EAAE,OAAO,CAAC;IAClC;;;;;;;;;;;;;OAaG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,KAAK,CAAC,SAAS,CAAC;IACtE;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Breadcrumb/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EAAE,cAAc,EAAE,mBAAmB,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
const Label_module = require("./Label.module.css.cjs");
|
|
6
|
+
const cn = require("../../utils/cn/cn.cjs");
|
|
7
|
+
const Label = react.forwardRef(function Label2({ variant = "default", className, children, ...props }, ref) {
|
|
8
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
9
|
+
"span",
|
|
10
|
+
{
|
|
11
|
+
ref,
|
|
12
|
+
className: cn.cn(Label_module.default.label, Label_module.default[`label--${variant}`], className),
|
|
13
|
+
...props,
|
|
14
|
+
children
|
|
15
|
+
}
|
|
16
|
+
);
|
|
17
|
+
});
|
|
18
|
+
Label.displayName = "Label";
|
|
19
|
+
exports.Label = Label;
|
|
20
|
+
//# sourceMappingURL=Label.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.cjs","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { cn } from '../../utils/cn';\nimport styles from './Label.module.css';\nimport type { LabelProps } from './Label.types';\n\nexport const Label = forwardRef<HTMLSpanElement, LabelProps>(function Label(\n { variant = 'default', className, children, ...props },\n ref,\n) {\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\nLabel.displayName = 'Label';\n"],"names":["forwardRef","Label","jsx","cn","styles"],"mappings":";;;;;;AAKO,MAAM,QAAQA,MAAAA,WAAwC,SAASC,OAClE,EAAE,UAAU,WAAW,WAAW,UAAU,GAAG,MAAA,GAC/C,KACF;AACE,SACIC,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,CAAC;AAED,MAAM,cAAc;;"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
@layer dna-design-system {._label_sogft_1 {
|
|
2
|
+
display: inline-block;
|
|
3
|
+
max-width: 100%;
|
|
4
|
+
padding: var(--spacing-ui-xxs) var(--spacing-ui-lg);
|
|
5
|
+
border-radius: var(--radius-semantic-full);
|
|
6
|
+
font-size: 0.875rem;
|
|
7
|
+
font-weight: 700;
|
|
8
|
+
line-height: 1;
|
|
9
|
+
text-align: center;
|
|
10
|
+
text-transform: uppercase;
|
|
11
|
+
white-space: nowrap;
|
|
12
|
+
overflow: hidden;
|
|
13
|
+
text-overflow: ellipsis;
|
|
14
|
+
color: var(--colors-semantic-foreground-default);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
._label--default_sogft_17 {
|
|
18
|
+
background-color: var(--colors-semantic-surface-base);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
._label--campaign_sogft_21 {
|
|
22
|
+
background-color: var(--colors-semantic-surface-primary-mid);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
._label--new_sogft_25 {
|
|
26
|
+
background-color: var(--colors-semantic-accent-lemon-500);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
._label--presale_sogft_29 {
|
|
30
|
+
background-color: var(--colors-semantic-accent-orange-500);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
._label--soldout_sogft_33 {
|
|
34
|
+
background-color: var(--colors-semantic-surface-neutral-strong);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
._label--other_sogft_37 {
|
|
38
|
+
background-color: var(--colors-semantic-accent-sky-500);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.d.ts","sourceRoot":"","sources":["../../../src/components/Label/Label.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAEhD,eAAO,MAAM,KAAK,wGAahB,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import styles from "./Label.module.css.js";
|
|
4
|
+
import { cn } from "../../utils/cn/cn.js";
|
|
5
|
+
const Label = forwardRef(function Label2({ variant = "default", className, children, ...props }, ref) {
|
|
6
|
+
return /* @__PURE__ */ jsx(
|
|
7
|
+
"span",
|
|
8
|
+
{
|
|
9
|
+
ref,
|
|
10
|
+
className: cn(styles.label, styles[`label--${variant}`], className),
|
|
11
|
+
...props,
|
|
12
|
+
children
|
|
13
|
+
}
|
|
14
|
+
);
|
|
15
|
+
});
|
|
16
|
+
Label.displayName = "Label";
|
|
17
|
+
export {
|
|
18
|
+
Label
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=Label.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Label.js","sources":["../../../src/components/Label/Label.tsx"],"sourcesContent":["import { forwardRef } from 'react';\nimport { cn } from '../../utils/cn';\nimport styles from './Label.module.css';\nimport type { LabelProps } from './Label.types';\n\nexport const Label = forwardRef<HTMLSpanElement, LabelProps>(function Label(\n { variant = 'default', className, children, ...props },\n ref,\n) {\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\nLabel.displayName = 'Label';\n"],"names":["Label"],"mappings":";;;;AAKO,MAAM,QAAQ,WAAwC,SAASA,OAClE,EAAE,UAAU,WAAW,WAAW,UAAU,GAAG,MAAA,GAC/C,KACF;AACE,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,CAAC;AAED,MAAM,cAAc;"}
|
|
@@ -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_sogft_1";
|
|
5
|
+
const styles = {
|
|
6
|
+
label,
|
|
7
|
+
"label--default": "_label--default_sogft_17",
|
|
8
|
+
"label--campaign": "_label--campaign_sogft_21",
|
|
9
|
+
"label--new": "_label--new_sogft_25",
|
|
10
|
+
"label--presale": "_label--presale_sogft_29",
|
|
11
|
+
"label--soldout": "_label--soldout_sogft_33",
|
|
12
|
+
"label--other": "_label--other_sogft_37"
|
|
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_sogft_1";
|
|
3
|
+
const styles = {
|
|
4
|
+
label,
|
|
5
|
+
"label--default": "_label--default_sogft_17",
|
|
6
|
+
"label--campaign": "_label--campaign_sogft_21",
|
|
7
|
+
"label--new": "_label--new_sogft_25",
|
|
8
|
+
"label--presale": "_label--presale_sogft_29",
|
|
9
|
+
"label--soldout": "_label--soldout_sogft_33",
|
|
10
|
+
"label--other": "_label--other_sogft_37"
|
|
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,28 @@
|
|
|
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.ComponentPropsWithoutRef<'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
|
+
* Custom className to apply to the root element.
|
|
25
|
+
*/
|
|
26
|
+
readonly className?: string;
|
|
27
|
+
}
|
|
28
|
+
//# 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,wBAAwB,CAAC,MAAM,CAAC;IACtE;;OAEG;IACH,QAAQ,CAAC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IACnC;;;OAGG;IACH,QAAQ,CAAC,OAAO,CAAC,EAAE,YAAY,CAAC;IAChC;;OAEG;IACH,QAAQ,CAAC,SAAS,CAAC,EAAE,MAAM,CAAC;CAC/B"}
|
|
@@ -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,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
+
const react = require("react");
|
|
5
|
+
const icons = require("@dnanpm/icons");
|
|
6
|
+
const focus_module = require("../../styles/utils/focus.module.css.cjs");
|
|
7
|
+
const Notification_module = require("./Notification.module.css.cjs");
|
|
8
|
+
const cn = require("../../utils/cn/cn.cjs");
|
|
9
|
+
const variantIcons = {
|
|
10
|
+
info: icons.Info,
|
|
11
|
+
success: icons.Check,
|
|
12
|
+
warning: icons.Warning,
|
|
13
|
+
error: icons.Error
|
|
14
|
+
};
|
|
15
|
+
const variantRoles = {
|
|
16
|
+
info: "status",
|
|
17
|
+
success: "status",
|
|
18
|
+
warning: "alert",
|
|
19
|
+
error: "alert"
|
|
20
|
+
};
|
|
21
|
+
const Notification = react.forwardRef(function Notification2({
|
|
22
|
+
variant,
|
|
23
|
+
children,
|
|
24
|
+
closable = false,
|
|
25
|
+
onClose,
|
|
26
|
+
closeLabel = "Sulje ilmoitus",
|
|
27
|
+
className,
|
|
28
|
+
...props
|
|
29
|
+
}, ref) {
|
|
30
|
+
const Icon = variantIcons[variant];
|
|
31
|
+
const role = variantRoles[variant];
|
|
32
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
33
|
+
"div",
|
|
34
|
+
{
|
|
35
|
+
ref,
|
|
36
|
+
role,
|
|
37
|
+
className: cn.cn(Notification_module.default.notification, Notification_module.default[`notification--${variant}`], className),
|
|
38
|
+
...props,
|
|
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
|
+
Notification.displayName = "Notification";
|
|
57
|
+
exports.Notification = Notification;
|
|
58
|
+
//# sourceMappingURL=Notification.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Notification.cjs","sources":["../../../src/components/Notification/Notification.tsx"],"sourcesContent":["import { forwardRef, type ComponentType, type 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 = forwardRef<HTMLDivElement, NotificationProps>(function Notification(\n {\n variant,\n children,\n closable = false,\n onClose,\n closeLabel = 'Sulje ilmoitus',\n className,\n ...props\n },\n ref,\n) {\n const Icon = variantIcons[variant];\n const role = variantRoles[variant];\n\n return (\n <div\n ref={ref}\n role={role}\n className={cn(styles.notification, styles[`notification--${variant}`], className)}\n {...props}\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\nNotification.displayName = 'Notification';\n"],"names":["Info","Check","Warning","ErrorIcon","forwardRef","Notification","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,eAAeC,MAAAA,WAA8C,SAASC,cAC/E;AAAA,EACI;AAAA,EACA;AAAA,EACA,WAAW;AAAA,EACX;AAAA,EACA,aAAa;AAAA,EACb;AAAA,EACA,GAAG;AACP,GACA,KACF;AACE,QAAM,OAAO,aAAa,OAAO;AACjC,QAAM,OAAO,aAAa,OAAO;AAEjC,SACIC,2BAAAA;AAAAA,IAAC;AAAA,IAAA;AAAA,MACG;AAAA,MACA;AAAA,MACA,WAAWC,GAAAA,GAAGC,oBAAAA,QAAO,cAAcA,oBAAAA,QAAO,iBAAiB,OAAO,EAAE,GAAG,SAAS;AAAA,MAC/E,GAAG;AAAA,MAEJ,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,CAAC;AAED,aAAa,cAAc;;"}
|