@dnanpm/ui-components 0.7.0 → 0.8.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/dist/components/Breadcrumb/Breadcrumb.css +9 -9
- package/dist/components/Breadcrumb/Breadcrumb.module.css.cjs +6 -6
- package/dist/components/Breadcrumb/Breadcrumb.module.css.js +6 -6
- package/dist/components/Button/Button.css +32 -30
- package/dist/components/Button/Button.module.css.cjs +11 -11
- package/dist/components/Button/Button.module.css.js +11 -11
- package/dist/components/ButtonCard/ButtonCard.cjs +105 -0
- package/dist/components/ButtonCard/ButtonCard.cjs.map +1 -0
- package/dist/components/ButtonCard/ButtonCard.css +167 -0
- package/dist/components/ButtonCard/ButtonCard.d.ts +3 -0
- package/dist/components/ButtonCard/ButtonCard.d.ts.map +1 -0
- package/dist/components/ButtonCard/ButtonCard.js +105 -0
- package/dist/components/ButtonCard/ButtonCard.js.map +1 -0
- package/dist/components/ButtonCard/ButtonCard.module.css.cjs +18 -0
- package/dist/components/ButtonCard/ButtonCard.module.css.cjs.map +1 -0
- package/dist/components/ButtonCard/ButtonCard.module.css.js +19 -0
- package/dist/components/ButtonCard/ButtonCard.module.css.js.map +1 -0
- package/dist/components/ButtonCard/ButtonCard.types.d.ts +103 -0
- package/dist/components/ButtonCard/ButtonCard.types.d.ts.map +1 -0
- package/dist/components/ButtonCard/index.d.ts +3 -0
- package/dist/components/ButtonCard/index.d.ts.map +1 -0
- package/dist/components/Drawer/Drawer.cjs +101 -0
- package/dist/components/Drawer/Drawer.cjs.map +1 -0
- package/dist/components/Drawer/Drawer.css +219 -0
- package/dist/components/Drawer/Drawer.d.ts +3 -0
- package/dist/components/Drawer/Drawer.d.ts.map +1 -0
- package/dist/components/Drawer/Drawer.js +101 -0
- package/dist/components/Drawer/Drawer.js.map +1 -0
- package/dist/components/Drawer/Drawer.module.css.cjs +37 -0
- package/dist/components/Drawer/Drawer.module.css.cjs.map +1 -0
- package/dist/components/Drawer/Drawer.module.css.js +37 -0
- package/dist/components/Drawer/Drawer.module.css.js.map +1 -0
- package/dist/components/Drawer/Drawer.types.d.ts +63 -0
- package/dist/components/Drawer/Drawer.types.d.ts.map +1 -0
- package/dist/components/Drawer/index.d.ts +3 -0
- package/dist/components/Drawer/index.d.ts.map +1 -0
- package/dist/components/Footer/Footer.css +81 -74
- package/dist/components/Footer/Footer.module.css.cjs +39 -39
- package/dist/components/Footer/Footer.module.css.js +39 -39
- package/dist/components/FunctionButton/FunctionButton.cjs +34 -0
- package/dist/components/FunctionButton/FunctionButton.cjs.map +1 -0
- package/dist/components/FunctionButton/FunctionButton.css +125 -0
- package/dist/components/FunctionButton/FunctionButton.d.ts +3 -0
- package/dist/components/FunctionButton/FunctionButton.d.ts.map +1 -0
- package/dist/components/FunctionButton/FunctionButton.js +34 -0
- package/dist/components/FunctionButton/FunctionButton.js.map +1 -0
- package/dist/components/FunctionButton/FunctionButton.module.css.cjs +11 -0
- package/dist/components/FunctionButton/FunctionButton.module.css.cjs.map +1 -0
- package/dist/components/FunctionButton/FunctionButton.module.css.js +12 -0
- package/dist/components/FunctionButton/FunctionButton.module.css.js.map +1 -0
- package/dist/components/FunctionButton/FunctionButton.types.d.ts +21 -0
- package/dist/components/FunctionButton/FunctionButton.types.d.ts.map +1 -0
- package/dist/components/FunctionButton/index.d.ts +3 -0
- package/dist/components/FunctionButton/index.d.ts.map +1 -0
- package/dist/components/IconButton/IconButton.css +31 -32
- package/dist/components/IconButton/IconButton.module.css.cjs +9 -9
- package/dist/components/IconButton/IconButton.module.css.js +9 -9
- package/dist/components/MainNavigation/MainNavigation.cjs +10 -26
- package/dist/components/MainNavigation/MainNavigation.cjs.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.css +158 -156
- package/dist/components/MainNavigation/MainNavigation.d.ts.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.js +10 -26
- package/dist/components/MainNavigation/MainNavigation.js.map +1 -1
- package/dist/components/MainNavigation/MainNavigation.module.css.cjs +68 -68
- package/dist/components/MainNavigation/MainNavigation.module.css.js +68 -68
- package/dist/components/Modal/Modal.cjs +101 -0
- package/dist/components/Modal/Modal.cjs.map +1 -0
- package/dist/components/Modal/Modal.css +205 -0
- package/dist/components/Modal/Modal.d.ts +3 -0
- package/dist/components/Modal/Modal.d.ts.map +1 -0
- package/dist/components/Modal/Modal.js +101 -0
- package/dist/components/Modal/Modal.js.map +1 -0
- package/dist/components/Modal/Modal.module.css.cjs +39 -0
- package/dist/components/Modal/Modal.module.css.cjs.map +1 -0
- package/dist/components/Modal/Modal.module.css.js +39 -0
- package/dist/components/Modal/Modal.module.css.js.map +1 -0
- package/dist/components/Modal/Modal.types.d.ts +62 -0
- package/dist/components/Modal/Modal.types.d.ts.map +1 -0
- package/dist/components/Modal/index.d.ts +3 -0
- package/dist/components/Modal/index.d.ts.map +1 -0
- package/dist/components/Modal/useDialogDismissal.cjs +41 -0
- package/dist/components/Modal/useDialogDismissal.cjs.map +1 -0
- package/dist/components/Modal/useDialogDismissal.d.ts +17 -0
- package/dist/components/Modal/useDialogDismissal.d.ts.map +1 -0
- package/dist/components/Modal/useDialogDismissal.js +41 -0
- package/dist/components/Modal/useDialogDismissal.js.map +1 -0
- package/dist/components/Modal/useNativeDialog.cjs +126 -0
- package/dist/components/Modal/useNativeDialog.cjs.map +1 -0
- package/dist/components/Modal/useNativeDialog.d.ts +14 -0
- package/dist/components/Modal/useNativeDialog.d.ts.map +1 -0
- package/dist/components/Modal/useNativeDialog.js +126 -0
- package/dist/components/Modal/useNativeDialog.js.map +1 -0
- package/dist/index.cjs +8 -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 +8 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/utils/elevation.module.css.cjs +3 -0
- package/dist/styles/utils/elevation.module.css.cjs.map +1 -1
- package/dist/styles/utils/elevation.module.css.js +4 -1
- package/dist/styles/utils/elevation.module.css.js.map +1 -1
- package/dist/styles/utils/focus.css +21 -22
- package/dist/styles/utils/focus.module.css.cjs +3 -6
- package/dist/styles/utils/focus.module.css.cjs.map +1 -1
- package/dist/styles/utils/focus.module.css.js +4 -7
- package/dist/styles/utils/focus.module.css.js.map +1 -1
- package/dist/styles/utils/text-decoration.css +3 -2
- package/dist/styles/utils/text-decoration.module.css.cjs +2 -2
- package/dist/styles/utils/text-decoration.module.css.js +2 -2
- package/package.json +3 -3
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import { jsx, Fragment, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Open, ChevronRight } from "@dnanpm/icons";
|
|
3
|
+
import focusStyles from "../../styles/utils/focus.module.css.js";
|
|
4
|
+
import elevationStyles from "../../styles/utils/elevation.module.css.js";
|
|
5
|
+
import styles from "./ButtonCard.module.css.js";
|
|
6
|
+
import { cn } from "../../utils/cn/cn.js";
|
|
7
|
+
const ButtonCard = ({
|
|
8
|
+
title,
|
|
9
|
+
subtitle,
|
|
10
|
+
size = "medium",
|
|
11
|
+
icon,
|
|
12
|
+
image,
|
|
13
|
+
isExternal = false,
|
|
14
|
+
externalLinkAriaLabel = "avautuu uuteen välilehteen",
|
|
15
|
+
className,
|
|
16
|
+
ref,
|
|
17
|
+
...props
|
|
18
|
+
}) => {
|
|
19
|
+
const isAnchor = "href" in props && props.href != null;
|
|
20
|
+
const classes = cn(
|
|
21
|
+
styles["button-card"],
|
|
22
|
+
styles[`button-card--${size}`],
|
|
23
|
+
focusStyles.focusable,
|
|
24
|
+
elevationStyles.elevationLow,
|
|
25
|
+
className
|
|
26
|
+
);
|
|
27
|
+
const IconComponent = icon;
|
|
28
|
+
const media = IconComponent != null ? /* @__PURE__ */ jsx(
|
|
29
|
+
"span",
|
|
30
|
+
{
|
|
31
|
+
className: cn(styles["button-card__media"], styles["button-card__media--icon"]),
|
|
32
|
+
"aria-hidden": "true",
|
|
33
|
+
children: /* @__PURE__ */ jsx(IconComponent, { "aria-hidden": "true" })
|
|
34
|
+
}
|
|
35
|
+
) : image ? /* @__PURE__ */ jsx("span", { className: cn(styles["button-card__media"], styles["button-card__media--image"]), children: image }) : null;
|
|
36
|
+
const explicitTarget = isAnchor ? props.target?.toLowerCase() : void 0;
|
|
37
|
+
const opensInNewTab = isExternal || explicitTarget === "_blank";
|
|
38
|
+
const Indicator = opensInNewTab ? Open : ChevronRight;
|
|
39
|
+
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
40
|
+
media,
|
|
41
|
+
/* @__PURE__ */ jsxs("span", { className: styles["button-card__content"], children: [
|
|
42
|
+
/* @__PURE__ */ jsxs("span", { className: styles["button-card__text"], children: [
|
|
43
|
+
/* @__PURE__ */ jsx("span", { className: styles["button-card__title"], children: title }),
|
|
44
|
+
subtitle != null && /* @__PURE__ */ jsx("span", { className: styles["button-card__subtitle"], children: subtitle })
|
|
45
|
+
] }),
|
|
46
|
+
/* @__PURE__ */ jsx("span", { className: styles["button-card__indicator"], "aria-hidden": "true", children: /* @__PURE__ */ jsx(Indicator, { "aria-hidden": "true" }) })
|
|
47
|
+
] }),
|
|
48
|
+
opensInNewTab && externalLinkAriaLabel && /* @__PURE__ */ jsx("span", { className: styles["button-card__sr-only"], children: ` (${externalLinkAriaLabel})` })
|
|
49
|
+
] });
|
|
50
|
+
if (isAnchor) {
|
|
51
|
+
const {
|
|
52
|
+
href,
|
|
53
|
+
renderLink,
|
|
54
|
+
target: targetProp,
|
|
55
|
+
rel,
|
|
56
|
+
disabled: _disabled,
|
|
57
|
+
...safeAnchorProps
|
|
58
|
+
} = props;
|
|
59
|
+
const target = isExternal ? "_blank" : targetProp;
|
|
60
|
+
const shouldHardenRel = target?.toLowerCase() === "_blank";
|
|
61
|
+
const relTokens = new Set(
|
|
62
|
+
(rel ?? "").split(/\s+/).filter(Boolean).map((token) => token.toLowerCase())
|
|
63
|
+
);
|
|
64
|
+
if (shouldHardenRel) {
|
|
65
|
+
relTokens.add("noopener");
|
|
66
|
+
relTokens.add("noreferrer");
|
|
67
|
+
}
|
|
68
|
+
const hardenedRel = relTokens.size > 0 ? Array.from(relTokens).join(" ") : void 0;
|
|
69
|
+
const linkProps = {
|
|
70
|
+
...safeAnchorProps,
|
|
71
|
+
ref,
|
|
72
|
+
href,
|
|
73
|
+
target,
|
|
74
|
+
rel: hardenedRel,
|
|
75
|
+
className: classes,
|
|
76
|
+
children: content
|
|
77
|
+
};
|
|
78
|
+
if (renderLink) {
|
|
79
|
+
return /* @__PURE__ */ jsx(Fragment, { children: renderLink(linkProps) });
|
|
80
|
+
}
|
|
81
|
+
return /* @__PURE__ */ jsx("a", { ...linkProps });
|
|
82
|
+
}
|
|
83
|
+
const {
|
|
84
|
+
type = "button",
|
|
85
|
+
href: _href,
|
|
86
|
+
target: _target,
|
|
87
|
+
rel: _rel,
|
|
88
|
+
renderLink: _renderLink,
|
|
89
|
+
...buttonProps
|
|
90
|
+
} = props;
|
|
91
|
+
return /* @__PURE__ */ jsx(
|
|
92
|
+
"button",
|
|
93
|
+
{
|
|
94
|
+
ref,
|
|
95
|
+
type,
|
|
96
|
+
className: classes,
|
|
97
|
+
...buttonProps,
|
|
98
|
+
children: content
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
export {
|
|
103
|
+
ButtonCard
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=ButtonCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonCard.js","sources":["../../../src/components/ButtonCard/ButtonCard.tsx"],"sourcesContent":["import type { ComponentPropsWithRef, ReactNode, Ref } from 'react';\nimport { ChevronRight, Open } from '@dnanpm/icons';\nimport { cn } from '../../utils/cn';\nimport focusStyles from '../../styles/utils/focus.module.css';\nimport elevationStyles from '../../styles/utils/elevation.module.css';\nimport styles from './ButtonCard.module.css';\nimport type { ButtonCardLinkProps, ButtonCardProps } from './ButtonCard.types';\n\nexport const ButtonCard = ({\n title,\n subtitle,\n size = 'medium',\n icon,\n image,\n isExternal = false,\n externalLinkAriaLabel = 'avautuu uuteen välilehteen',\n className,\n ref,\n ...props\n}: ButtonCardProps) => {\n const isAnchor = 'href' in props && (props as { href?: string }).href != null;\n\n const classes = cn(\n styles['button-card'],\n styles[`button-card--${size}`],\n focusStyles.focusable,\n elevationStyles.elevationLow,\n className,\n );\n\n const IconComponent = icon;\n\n const media =\n IconComponent != null ? (\n <span\n className={cn(styles['button-card__media'], styles['button-card__media--icon'])}\n aria-hidden=\"true\"\n >\n <IconComponent aria-hidden=\"true\" />\n </span>\n ) : image ? (\n <span className={cn(styles['button-card__media'], styles['button-card__media--image'])}>\n {image}\n </span>\n ) : null;\n\n const explicitTarget = isAnchor\n ? (props as { target?: string }).target?.toLowerCase()\n : undefined;\n // The link opens a new tab when isExternal is set or the target is _blank.\n const opensInNewTab = isExternal || explicitTarget === '_blank';\n const Indicator = opensInNewTab ? Open : ChevronRight;\n\n const content = (\n <>\n {media}\n <span className={styles['button-card__content']}>\n <span className={styles['button-card__text']}>\n <span className={styles['button-card__title']}>{title}</span>\n {subtitle != null && (\n <span className={styles['button-card__subtitle']}>{subtitle}</span>\n )}\n </span>\n <span className={styles['button-card__indicator']} aria-hidden=\"true\">\n <Indicator aria-hidden=\"true\" />\n </span>\n </span>\n {opensInNewTab && externalLinkAriaLabel && (\n <span className={styles['button-card__sr-only']}>\n {` (${externalLinkAriaLabel})`}\n </span>\n )}\n </>\n );\n\n if (isAnchor) {\n const {\n href,\n renderLink,\n target: targetProp,\n rel,\n disabled: _disabled,\n ...safeAnchorProps\n } = props as unknown as ComponentPropsWithRef<'a'> & {\n href: string;\n renderLink?: (props: ButtonCardLinkProps) => ReactNode;\n disabled?: boolean;\n };\n\n // isExternal is authoritative and forces a new tab; an explicit _blank is preserved.\n const target = isExternal ? '_blank' : targetProp;\n const shouldHardenRel = target?.toLowerCase() === '_blank';\n const relTokens = new Set(\n (rel ?? '')\n .split(/\\s+/)\n .filter(Boolean)\n .map((token) => token.toLowerCase()),\n );\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 target,\n rel: hardenedRel,\n className: classes,\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 href: _href,\n target: _target,\n rel: _rel,\n renderLink: _renderLink,\n ...buttonProps\n } = props as unknown as ComponentPropsWithRef<'button'> & {\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 className={classes}\n {...buttonProps}\n >\n {content}\n </button>\n );\n};\n"],"names":[],"mappings":";;;;;;AAQO,MAAM,aAAa,CAAC;AAAA,EACvB;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,wBAAwB;AAAA,EACxB;AAAA,EACA;AAAA,EACA,GAAG;AACP,MAAuB;AACnB,QAAM,WAAW,UAAU,SAAU,MAA4B,QAAQ;AAEzE,QAAM,UAAU;AAAA,IACZ,OAAO,aAAa;AAAA,IACpB,OAAO,gBAAgB,IAAI,EAAE;AAAA,IAC7B,YAAY;AAAA,IACZ,gBAAgB;AAAA,IAChB;AAAA,EAAA;AAGJ,QAAM,gBAAgB;AAEtB,QAAM,QACF,iBAAiB,OACb;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAW,GAAG,OAAO,oBAAoB,GAAG,OAAO,0BAA0B,CAAC;AAAA,MAC9E,eAAY;AAAA,MAEZ,UAAA,oBAAC,eAAA,EAAc,eAAY,OAAA,CAAO;AAAA,IAAA;AAAA,EAAA,IAEtC,QACA,oBAAC,QAAA,EAAK,WAAW,GAAG,OAAO,oBAAoB,GAAG,OAAO,2BAA2B,CAAC,GAChF,iB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I;AAE3E,UAAM,YAAY;AAAA,MACd,GAAG;AAAA,MACH;AAAA,MACA;AAAA,MACA;AAAA,MACA,KAAK;AAAA,MACL,WAAW;AAAA,MACX,UAAU;AAAA,IAAA;AAGd,QAAI,YAAY;AACZ,aAAO,oBAAA,UAAA,EAAG,UAAA,WAAW,SAAS,GAAE;AAAA,IACpC;AAEA,WAAO,oBAAC,KAAA,EAAG,GAAG,UAAA,CAAW;AAAA,EAC7B;AAEA,QAAM;AAAA,IACF,OAAO;AAAA,IACP,MAAM;AAAA,IACN,QAAQ;AAAA,IACR,KAAK;AAAA,IACL,YAAY;AAAA,IACZ,GAAG;AAAA,EAAA,IACH;AAOJ,SACI;AAAA,IAAC;AAAA,IAAA;AAAA,MACG;AAAA,MACA;AAAA,MACA,WAAW;AAAA,MACV,GAAG;AAAA,MAEH,UAAA;AAAA,IAAA;AAAA,EAAA;AAGb;"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
require('./ButtonCard.css');
|
|
2
|
+
"use strict";
|
|
3
|
+
const styles = {
|
|
4
|
+
"button-card": "_button-card_14hpp_1",
|
|
5
|
+
"button-card--large": "_button-card--large_14hpp_37",
|
|
6
|
+
"button-card--small": "_button-card--small_14hpp_42",
|
|
7
|
+
"button-card__media": "_button-card__media_14hpp_59",
|
|
8
|
+
"button-card__media--icon": "_button-card__media--icon_14hpp_72",
|
|
9
|
+
"button-card__media--image": "_button-card__media--image_14hpp_85",
|
|
10
|
+
"button-card__content": "_button-card__content_14hpp_100",
|
|
11
|
+
"button-card__text": "_button-card__text_14hpp_108",
|
|
12
|
+
"button-card__title": "_button-card__title_14hpp_117",
|
|
13
|
+
"button-card__subtitle": "_button-card__subtitle_14hpp_118",
|
|
14
|
+
"button-card__indicator": "_button-card__indicator_14hpp_140",
|
|
15
|
+
"button-card__sr-only": "_button-card__sr-only_14hpp_156"
|
|
16
|
+
};
|
|
17
|
+
module.exports = styles;
|
|
18
|
+
//# sourceMappingURL=ButtonCard.module.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonCard.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import './ButtonCard.css';
|
|
2
|
+
const styles = {
|
|
3
|
+
"button-card": "_button-card_14hpp_1",
|
|
4
|
+
"button-card--large": "_button-card--large_14hpp_37",
|
|
5
|
+
"button-card--small": "_button-card--small_14hpp_42",
|
|
6
|
+
"button-card__media": "_button-card__media_14hpp_59",
|
|
7
|
+
"button-card__media--icon": "_button-card__media--icon_14hpp_72",
|
|
8
|
+
"button-card__media--image": "_button-card__media--image_14hpp_85",
|
|
9
|
+
"button-card__content": "_button-card__content_14hpp_100",
|
|
10
|
+
"button-card__text": "_button-card__text_14hpp_108",
|
|
11
|
+
"button-card__title": "_button-card__title_14hpp_117",
|
|
12
|
+
"button-card__subtitle": "_button-card__subtitle_14hpp_118",
|
|
13
|
+
"button-card__indicator": "_button-card__indicator_14hpp_140",
|
|
14
|
+
"button-card__sr-only": "_button-card__sr-only_14hpp_156"
|
|
15
|
+
};
|
|
16
|
+
export {
|
|
17
|
+
styles as default
|
|
18
|
+
};
|
|
19
|
+
//# sourceMappingURL=ButtonCard.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonCard.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { ComponentPropsWithRef, ComponentType, ReactNode, SVGProps } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* Size variant of the Button card.
|
|
4
|
+
*
|
|
5
|
+
* - `large` — Large text title (Heading XS).
|
|
6
|
+
* - `medium` — Default title (Label LG Bold).
|
|
7
|
+
* - `small` — Compact vertical layout (Label MD title).
|
|
8
|
+
*/
|
|
9
|
+
export type ButtonCardSize = 'large' | 'medium' | 'small';
|
|
10
|
+
/** SVG icon component, for example `ChevronRight` from `@dnanpm/icons`. */
|
|
11
|
+
export type ButtonCardIcon = ComponentType<SVGProps<SVGSVGElement>>;
|
|
12
|
+
export interface ButtonCardLinkProps extends ComponentPropsWithRef<'a'> {
|
|
13
|
+
readonly href: string;
|
|
14
|
+
readonly children: ReactNode;
|
|
15
|
+
}
|
|
16
|
+
interface ButtonCardBaseProps {
|
|
17
|
+
/**
|
|
18
|
+
* Primary title. Keep it short; the card clamps it as a layout fallback
|
|
19
|
+
* (two lines, or one line in the small size) and is not designed for long
|
|
20
|
+
* titles.
|
|
21
|
+
*/
|
|
22
|
+
readonly title: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* Optional subtitle. Keep it short; the card clamps it as a layout fallback
|
|
25
|
+
* (two lines, or one line in the small size) and is not designed for long
|
|
26
|
+
* subtitles.
|
|
27
|
+
*/
|
|
28
|
+
readonly subtitle?: ReactNode;
|
|
29
|
+
/**
|
|
30
|
+
* Size variant controlling layout and typography.
|
|
31
|
+
* @default 'medium'
|
|
32
|
+
*/
|
|
33
|
+
readonly size?: ButtonCardSize;
|
|
34
|
+
/**
|
|
35
|
+
* Marks the action as opening in a new tab/window: shows the external-link
|
|
36
|
+
* indicator icon and appends the hidden `externalLinkAriaLabel` hint. In link
|
|
37
|
+
* mode (`href`) it is authoritative and forces `target="_blank"` with a
|
|
38
|
+
* hardened `rel`, overriding any explicit `target`; in button mode the
|
|
39
|
+
* consumer opens the new window (for example `window.open`).
|
|
40
|
+
* @default false
|
|
41
|
+
*/
|
|
42
|
+
readonly isExternal?: boolean;
|
|
43
|
+
/**
|
|
44
|
+
* Visually hidden hint appended to the accessible name when `isExternal` is
|
|
45
|
+
* true. Defaults to Finnish per the design system aria-label policy.
|
|
46
|
+
* @default 'avautuu uuteen välilehteen'
|
|
47
|
+
*/
|
|
48
|
+
readonly externalLinkAriaLabel?: string;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Media is optional and mutually exclusive: provide either `icon` or `image`,
|
|
52
|
+
* never both. Omitting both renders the card without a media area.
|
|
53
|
+
*/
|
|
54
|
+
type ButtonCardMediaProps = {
|
|
55
|
+
/** Decorative SVG icon rendered in a neutral media box. */
|
|
56
|
+
readonly icon?: ButtonCardIcon;
|
|
57
|
+
readonly image?: never;
|
|
58
|
+
} | {
|
|
59
|
+
readonly icon?: never;
|
|
60
|
+
/**
|
|
61
|
+
* Image slot rendered inside the DS-sized, clipped media box. The
|
|
62
|
+
* client owns the rendering, so an optimized image component (for
|
|
63
|
+
* example `next/image` or an app's own `OptimizedImage`) can be dropped
|
|
64
|
+
* in. The box is `position: relative`, so `next/image` `fill` works.
|
|
65
|
+
* Mark decorative images with an empty `alt`.
|
|
66
|
+
*/
|
|
67
|
+
readonly image?: ReactNode;
|
|
68
|
+
};
|
|
69
|
+
export type ButtonCardAsButton = ButtonCardBaseProps & ButtonCardMediaProps & Omit<ComponentPropsWithRef<'button'>, keyof ButtonCardBaseProps | 'children' | 'disabled'> & {
|
|
70
|
+
/** When omitted, the card renders as a `<button>`. */
|
|
71
|
+
readonly href?: never;
|
|
72
|
+
readonly target?: never;
|
|
73
|
+
readonly rel?: never;
|
|
74
|
+
readonly renderLink?: never;
|
|
75
|
+
/** ButtonCard has no disabled state by design; render it conditionally instead. */
|
|
76
|
+
readonly disabled?: never;
|
|
77
|
+
};
|
|
78
|
+
export type ButtonCardAsAnchor = ButtonCardBaseProps & ButtonCardMediaProps & Omit<ComponentPropsWithRef<'a'>, keyof ButtonCardBaseProps | 'children'> & {
|
|
79
|
+
/** When provided, the card renders as an `<a>`. */
|
|
80
|
+
readonly href: string;
|
|
81
|
+
readonly disabled?: never;
|
|
82
|
+
readonly type?: never;
|
|
83
|
+
readonly name?: never;
|
|
84
|
+
/**
|
|
85
|
+
* Custom render function for the link element. Use this to integrate with
|
|
86
|
+
* client-side routing libraries like Next.js or React Router.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* // Next.js
|
|
90
|
+
* import Link from 'next/link';
|
|
91
|
+
* <ButtonCard href="/page" title="Open" renderLink={(props) => <Link {...props} />} />
|
|
92
|
+
*/
|
|
93
|
+
readonly renderLink?: (props: ButtonCardLinkProps) => ReactNode;
|
|
94
|
+
};
|
|
95
|
+
/**
|
|
96
|
+
* Props for the Button card component.
|
|
97
|
+
*
|
|
98
|
+
* When `href` is provided the component renders as an `<a>` element;
|
|
99
|
+
* otherwise it renders as a `<button>`.
|
|
100
|
+
*/
|
|
101
|
+
export type ButtonCardProps = ButtonCardAsButton | ButtonCardAsAnchor;
|
|
102
|
+
export {};
|
|
103
|
+
//# sourceMappingURL=ButtonCard.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ButtonCard.types.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonCard/ButtonCard.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAEvF;;;;;;GAMG;AACH,MAAM,MAAM,cAAc,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AAE1D,2EAA2E;AAC3E,MAAM,MAAM,cAAc,GAAG,aAAa,CAAC,QAAQ,CAAC,aAAa,CAAC,CAAC,CAAC;AAEpE,MAAM,WAAW,mBAAoB,SAAQ,qBAAqB,CAAC,GAAG,CAAC;IACnE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,QAAQ,EAAE,SAAS,CAAC;CAChC;AAED,UAAU,mBAAmB;IACzB;;;;OAIG;IACH,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B;;;;OAIG;IACH,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,IAAI,CAAC,EAAE,cAAc,CAAC;IAC/B;;;;;;;OAOG;IACH,QAAQ,CAAC,UAAU,CAAC,EA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,EAAE,CAAC,KAAK,EAAE,mBAAmB,KAAK,SAAS,CAAC;CACnE,CAAC;AAEN;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,kBAAkB,GAAG,kBAAkB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ButtonCard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,YAAY,EACR,cAAc,EACd,mBAAmB,EACnB,eAAe,EACf,cAAc,GACjB,MAAM,oBAAoB,CAAC"}
|
|
@@ -0,0 +1,101 @@
|
|
|
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 elevation_module = require("../../styles/utils/elevation.module.css.cjs");
|
|
7
|
+
const focus_module = require("../../styles/utils/focus.module.css.cjs");
|
|
8
|
+
const useDialogDismissal = require("../Modal/useDialogDismissal.cjs");
|
|
9
|
+
const useNativeDialog = require("../Modal/useNativeDialog.cjs");
|
|
10
|
+
const Drawer_module = require("./Drawer.module.css.cjs");
|
|
11
|
+
const cn = require("../../utils/cn/cn.cjs");
|
|
12
|
+
const Drawer = ({
|
|
13
|
+
open,
|
|
14
|
+
onOpenChange,
|
|
15
|
+
title,
|
|
16
|
+
description,
|
|
17
|
+
children,
|
|
18
|
+
footer,
|
|
19
|
+
size = "small",
|
|
20
|
+
headerStyle = "light",
|
|
21
|
+
side = "right",
|
|
22
|
+
fixedTitle = false,
|
|
23
|
+
disableCloseOptions = false,
|
|
24
|
+
closeLabel = "Sulje dialogi",
|
|
25
|
+
keepMounted = false,
|
|
26
|
+
className,
|
|
27
|
+
ref,
|
|
28
|
+
onKeyDown,
|
|
29
|
+
onClick,
|
|
30
|
+
onPointerDown,
|
|
31
|
+
"aria-label": ariaLabel,
|
|
32
|
+
"aria-labelledby": ariaLabelledBy,
|
|
33
|
+
"aria-describedby": ariaDescribedBy,
|
|
34
|
+
...props
|
|
35
|
+
}) => {
|
|
36
|
+
const titleId = react.useId();
|
|
37
|
+
const descriptionId = react.useId();
|
|
38
|
+
const { dialogRef, close, phase, isPresent } = useNativeDialog.useNativeDialog({
|
|
39
|
+
open: open ?? false,
|
|
40
|
+
keepMounted,
|
|
41
|
+
onOpenChange
|
|
42
|
+
});
|
|
43
|
+
const describedBy = [description ? descriptionId : void 0, ariaDescribedBy].filter(Boolean).join(" ") || void 0;
|
|
44
|
+
const dialogDismissalProps = useDialogDismissal.useDialogDismissal({
|
|
45
|
+
close,
|
|
46
|
+
disableCloseOptions,
|
|
47
|
+
onClick,
|
|
48
|
+
onKeyDown,
|
|
49
|
+
onPointerDown
|
|
50
|
+
});
|
|
51
|
+
if (!isPresent) return null;
|
|
52
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
53
|
+
"dialog",
|
|
54
|
+
{
|
|
55
|
+
...props,
|
|
56
|
+
ref: (node) => {
|
|
57
|
+
dialogRef.current = node;
|
|
58
|
+
if (typeof ref === "function") ref(node);
|
|
59
|
+
else if (ref) ref.current = node;
|
|
60
|
+
},
|
|
61
|
+
className: cn.cn(
|
|
62
|
+
Drawer_module.default.drawer,
|
|
63
|
+
elevation_module.default.elevationHigh,
|
|
64
|
+
Drawer_module.default[`drawer--${size}`],
|
|
65
|
+
Drawer_module.default[`drawer--${headerStyle}`],
|
|
66
|
+
Drawer_module.default[`drawer--${side}`],
|
|
67
|
+
{ [Drawer_module.default["drawer--fixed-title"]]: fixedTitle },
|
|
68
|
+
{ [Drawer_module.default["drawer--opening"]]: phase !== "closing" },
|
|
69
|
+
{ [Drawer_module.default["drawer--closing"]]: phase === "closing" },
|
|
70
|
+
className
|
|
71
|
+
),
|
|
72
|
+
"aria-label": ariaLabel,
|
|
73
|
+
"aria-labelledby": ariaLabelledBy ?? (!ariaLabel && title ? titleId : void 0),
|
|
74
|
+
"aria-describedby": describedBy,
|
|
75
|
+
...dialogDismissalProps,
|
|
76
|
+
children: [
|
|
77
|
+
/* @__PURE__ */ jsxRuntime.jsxs("div", { className: Drawer_module.default.drawer__container, children: [
|
|
78
|
+
!disableCloseOptions && /* @__PURE__ */ jsxRuntime.jsx(
|
|
79
|
+
"button",
|
|
80
|
+
{
|
|
81
|
+
type: "button",
|
|
82
|
+
className: cn.cn(Drawer_module.default.drawer__close, focus_module.default.focusable),
|
|
83
|
+
"aria-label": closeLabel,
|
|
84
|
+
"data-dialog-autofocus": "true",
|
|
85
|
+
onClick: close,
|
|
86
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Close, { "aria-hidden": "true" })
|
|
87
|
+
}
|
|
88
|
+
),
|
|
89
|
+
(title || description) && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: Drawer_module.default.drawer__title, children: [
|
|
90
|
+
title && /* @__PURE__ */ jsxRuntime.jsx("h2", { id: titleId, className: Drawer_module.default.drawer__heading, children: title }),
|
|
91
|
+
description && /* @__PURE__ */ jsxRuntime.jsx("div", { id: descriptionId, className: Drawer_module.default.drawer__description, children: description })
|
|
92
|
+
] }),
|
|
93
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { className: Drawer_module.default.drawer__content, children })
|
|
94
|
+
] }),
|
|
95
|
+
footer && /* @__PURE__ */ jsxRuntime.jsx("div", { className: cn.cn(Drawer_module.default["drawer__bottom-bar"], elevation_module.default.elevationMedium), children: footer })
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
};
|
|
100
|
+
exports.Drawer = Drawer;
|
|
101
|
+
//# sourceMappingURL=Drawer.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drawer.cjs","sources":["../../../src/components/Drawer/Drawer.tsx"],"sourcesContent":["import { useId } from 'react';\nimport { Close } from '@dnanpm/icons';\nimport { cn } from '../../utils/cn';\nimport elevationStyles from '../../styles/utils/elevation.module.css';\nimport focusStyles from '../../styles/utils/focus.module.css';\nimport { useDialogDismissal } from '../Modal/useDialogDismissal';\nimport { useNativeDialog } from '../Modal/useNativeDialog';\nimport styles from './Drawer.module.css';\nimport type { DrawerProps } from './Drawer.types';\n\nexport const Drawer = ({\n open,\n onOpenChange,\n title,\n description,\n children,\n footer,\n size = 'small',\n headerStyle = 'light',\n side = 'right',\n fixedTitle = false,\n disableCloseOptions = false,\n closeLabel = 'Sulje dialogi',\n keepMounted = false,\n className,\n ref,\n onKeyDown,\n onClick,\n onPointerDown,\n 'aria-label': ariaLabel,\n 'aria-labelledby': ariaLabelledBy,\n 'aria-describedby': ariaDescribedBy,\n ...props\n}: DrawerProps) => {\n const titleId = useId();\n const descriptionId = useId();\n const { dialogRef, close, phase, isPresent } = useNativeDialog({\n open: open ?? false,\n keepMounted,\n onOpenChange,\n });\n const describedBy =\n [description ? descriptionId : undefined, ariaDescribedBy].filter(Boolean).join(' ') ||\n undefined;\n const dialogDismissalProps = useDialogDismissal({\n close,\n disableCloseOptions,\n onClick,\n onKeyDown,\n onPointerDown,\n });\n\n if (!isPresent) return null;\n\n return (\n <dialog\n {...props}\n ref={(node) => {\n dialogRef.current = node;\n if (typeof ref === 'function') ref(node);\n else if (ref) ref.current = node;\n }}\n className={cn(\n styles.drawer,\n elevationStyles.elevationHigh,\n styles[`drawer--${size}`],\n styles[`drawer--${headerStyle}`],\n styles[`drawer--${side}`],\n { [styles['drawer--fixed-title']]: fixedTitle },\n { [styles['drawer--opening']]: phase !== 'closing' },\n { [styles['drawer--closing']]: phase === 'closing' },\n className,\n )}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy ?? (!ariaLabel && title ? titleId : undefined)}\n aria-describedby={describedBy}\n {...dialogDismissalProps}\n >\n <div className={styles.drawer__container}>\n {!disableCloseOptions && (\n <button\n type=\"button\"\n className={cn(styles.drawer__close, focusStyles.focusable)}\n aria-label={closeLabel}\n data-dialog-autofocus=\"true\"\n onClick={close}\n >\n <Close aria-hidden=\"true\" />\n </button>\n )}\n {(title || description) && (\n <div className={styles.drawer__title}>\n {title && (\n <h2 id={titleId} className={styles.drawer__heading}>\n {title}\n </h2>\n )}\n {description && (\n <div id={descriptionId} className={styles.drawer__description}>\n {description}\n </div>\n )}\n </div>\n )}\n <div className={styles.drawer__content}>{children}</div>\n </div>\n {footer && (\n <div className={cn(styles['drawer__bottom-bar'], elevationStyles.elevationMedium)}>\n {footer}\n </div>\n )}\n </dialog>\n );\n};\n"],"names":["useId","useNativeDialog","useDialogDismissal","jsxs","cn","styles","elevationStyles","jsx","focusStyles","Close"],"mappings":";;;;;;;;;;;AAUO,MAAM,SAAS,CAAC;AAAA,EACnB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,OAAO;AAAA,EACP,cAAc;AAAA,EACd,OAAO;AAAA,EACP,aAAa;AAAA,EACb,sBAAsB;AAAA,EACtB,aAAa;AAAA,EACb,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,cAAc;AAAA,EACd,mBAAmB;AAAA,EACnB,oBAAoB;AAAA,EACpB,GAAG;AACP,MAAmB;AACf,QAAM,UAAUA,MAAAA,MAAA;AAChB,QAAM,gBAAgBA,MAAAA,MAAA;AACtB,QAAM,EAAE,WAAW,OAAO,OAAO,UAAA,IAAcC,gBAAAA,gBAAgB;AAAA,IAC3D,MAAM,QAAQ;AAAA,IACd;AAAA,IACA;AAAA,EAAA,CACH;AACD,QAAM,cACF,CAAC,cAAc,gBAAgB,QAAW,eAAe,EAAE,OAAO,OAAO,EAAE,KAAK,GAAG,KACnF;AACJ,QAAM,uBAAuBC,mBAAAA,mBAAmB;AAAA,IAC5C;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EAAA,CACH;AAED,MAAI,CAAC,UAAW,QAAO;AAEvB,SACIC,2BAA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I,SAAS,WAAWA,sBAAO,iBAC9B,UAAA,MAAA,CACL;AAAA,YAEH,8CACI,OAAA,EAAI,IAAI,eAAe,WAAWA,sBAAO,qBACrC,UAAA,YAAA,CACL;AAAA,UAAA,GAER;AAAA,UAEJE,2BAAAA,IAAC,OAAA,EAAI,WAAWF,cAAAA,QAAO,iBAAkB,SAAA,CAAS;AAAA,QAAA,GACtD;AAAA,QACC,UACGE,2BAAAA,IAAC,OAAA,EAAI,WAAWH,GAAAA,GAAGC,cAAAA,QAAO,oBAAoB,GAAGC,iBAAAA,QAAgB,eAAe,GAC3E,UAAA,OAAA,CACL;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIhB;;"}
|
|
@@ -0,0 +1,219 @@
|
|
|
1
|
+
@layer dds-components {._drawer_zzxde_1 {
|
|
2
|
+
--_drawer-transition-duration-open: 400ms;
|
|
3
|
+
--_drawer-transition-duration-close: 200ms;
|
|
4
|
+
position: fixed;
|
|
5
|
+
inset-block: 0;
|
|
6
|
+
left: 100%;
|
|
7
|
+
z-index: 1;
|
|
8
|
+
display: flex;
|
|
9
|
+
flex-direction: column;
|
|
10
|
+
max-width: calc(100vw - var(--spacing-space-40));
|
|
11
|
+
height: 100dvh;
|
|
12
|
+
max-height: 100dvh;
|
|
13
|
+
margin: 0;
|
|
14
|
+
padding: 0;
|
|
15
|
+
border: none;
|
|
16
|
+
border-radius: 0;
|
|
17
|
+
background: var(--color-semantic-surface-base);
|
|
18
|
+
color: var(--color-semantic-foreground-default);
|
|
19
|
+
font: var(--typography-body-md);
|
|
20
|
+
transition-property: transform;
|
|
21
|
+
transition-duration: var(--_drawer-transition-duration-close);
|
|
22
|
+
transition-timing-function: ease;
|
|
23
|
+
transition-behavior: allow-discrete;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
._drawer_zzxde_1:not([open]) {
|
|
27
|
+
display: none;
|
|
28
|
+
}
|
|
29
|
+
._drawer--small_zzxde_29 {
|
|
30
|
+
width: 375px;
|
|
31
|
+
}
|
|
32
|
+
._drawer--medium_zzxde_32 {
|
|
33
|
+
width: 768px;
|
|
34
|
+
}
|
|
35
|
+
._drawer--large_zzxde_35 {
|
|
36
|
+
width: 1080px;
|
|
37
|
+
}
|
|
38
|
+
._drawer--opening_zzxde_38,
|
|
39
|
+
._drawer--closing_zzxde_39 {
|
|
40
|
+
display: flex;
|
|
41
|
+
flex-direction: column;
|
|
42
|
+
}
|
|
43
|
+
._drawer--opening_zzxde_38 {
|
|
44
|
+
transition-duration: var(--_drawer-transition-duration-open);
|
|
45
|
+
transform: translateX(-100%);
|
|
46
|
+
}
|
|
47
|
+
._drawer--closing_zzxde_39 {
|
|
48
|
+
transform: translateX(0);
|
|
49
|
+
}
|
|
50
|
+
._drawer--left_zzxde_50 {
|
|
51
|
+
right: auto;
|
|
52
|
+
left: 0;
|
|
53
|
+
transform: translateX(-100%);
|
|
54
|
+
}
|
|
55
|
+
._drawer--left_zzxde_50._drawer--opening_zzxde_38 {
|
|
56
|
+
transform: translateX(0);
|
|
57
|
+
}
|
|
58
|
+
._drawer--left_zzxde_50._drawer--closing_zzxde_39 {
|
|
59
|
+
transform: translateX(-100%);
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
._drawer_zzxde_1::backdrop {
|
|
63
|
+
background: var(--color-semantic-utility-overlay-strong);
|
|
64
|
+
opacity: 0;
|
|
65
|
+
transition-property: opacity, overlay;
|
|
66
|
+
transition-duration: var(--_drawer-transition-duration-close);
|
|
67
|
+
transition-timing-function: ease;
|
|
68
|
+
transition-behavior: allow-discrete;
|
|
69
|
+
}
|
|
70
|
+
._drawer--opening_zzxde_38::backdrop {
|
|
71
|
+
opacity: 1;
|
|
72
|
+
transition-duration: var(--_drawer-transition-duration-open);
|
|
73
|
+
}
|
|
74
|
+
._drawer--closing_zzxde_39::backdrop {
|
|
75
|
+
opacity: 0;
|
|
76
|
+
transition-duration: var(--_drawer-transition-duration-close);
|
|
77
|
+
}
|
|
78
|
+
._drawer__container_zzxde_78 {
|
|
79
|
+
display: flex;
|
|
80
|
+
min-height: 0;
|
|
81
|
+
flex: 1 1 auto;
|
|
82
|
+
flex-direction: column;
|
|
83
|
+
overflow: auto;
|
|
84
|
+
}
|
|
85
|
+
._drawer--fixed-title_zzxde_85 ._drawer__container_zzxde_78 {
|
|
86
|
+
overflow: hidden;
|
|
87
|
+
}
|
|
88
|
+
._drawer__title_zzxde_88 {
|
|
89
|
+
display: flex;
|
|
90
|
+
flex: 0 0 auto;
|
|
91
|
+
flex-direction: column;
|
|
92
|
+
gap: var(--spacing-space-4);
|
|
93
|
+
padding: var(--spacing-space-20) var(--spacing-space-40) var(--spacing-space-20)
|
|
94
|
+
var(--spacing-space-20);
|
|
95
|
+
border-bottom: var(--borderwidth-semantic-xs) solid var(--color-semantic-border-neutral-base);
|
|
96
|
+
background: var(--color-semantic-surface-base);
|
|
97
|
+
}
|
|
98
|
+
._drawer__heading_zzxde_98 {
|
|
99
|
+
margin: 0;
|
|
100
|
+
font: var(--typography-heading-md);
|
|
101
|
+
}
|
|
102
|
+
._drawer__description_zzxde_102 {
|
|
103
|
+
margin: 0;
|
|
104
|
+
}
|
|
105
|
+
._drawer__content_zzxde_105 {
|
|
106
|
+
flex: 1 1 auto;
|
|
107
|
+
padding: var(--spacing-space-20);
|
|
108
|
+
overflow-wrap: anywhere;
|
|
109
|
+
}
|
|
110
|
+
._drawer--fixed-title_zzxde_85 ._drawer__content_zzxde_105 {
|
|
111
|
+
overflow: auto;
|
|
112
|
+
}
|
|
113
|
+
._drawer__close_zzxde_113 {
|
|
114
|
+
position: absolute;
|
|
115
|
+
z-index: 1;
|
|
116
|
+
top: 0;
|
|
117
|
+
right: 0;
|
|
118
|
+
display: grid;
|
|
119
|
+
width: 40px;
|
|
120
|
+
height: 40px;
|
|
121
|
+
place-items: center;
|
|
122
|
+
padding: 0;
|
|
123
|
+
border: none;
|
|
124
|
+
border-bottom-left-radius: var(--radius-semantic-md);
|
|
125
|
+
background: var(--color-semantic-surface-neutral-mid);
|
|
126
|
+
color: var(--color-semantic-foreground-secondary-strong);
|
|
127
|
+
cursor: pointer;
|
|
128
|
+
}
|
|
129
|
+
._drawer__close_zzxde_113 svg {
|
|
130
|
+
width: 24px;
|
|
131
|
+
height: 24px;
|
|
132
|
+
}
|
|
133
|
+
._drawer__bottom-bar_zzxde_133 {
|
|
134
|
+
flex: 0 0 auto;
|
|
135
|
+
padding: var(--spacing-space-20) var(--spacing-space-20) var(--spacing-space-24);
|
|
136
|
+
border: none;
|
|
137
|
+
border-radius: 0;
|
|
138
|
+
border-top: var(--borderwidth-semantic-xs) solid var(--color-semantic-border-neutral-base);
|
|
139
|
+
}
|
|
140
|
+
._drawer--dark_zzxde_140 ._drawer__title_zzxde_88 {
|
|
141
|
+
border-bottom-color: var(--color-semantic-border-secondary);
|
|
142
|
+
background: var(--color-semantic-surface-secondary-strong);
|
|
143
|
+
color: var(--color-semantic-foreground-inverse);
|
|
144
|
+
}
|
|
145
|
+
._drawer--dark_zzxde_140 ._drawer__close_zzxde_113 {
|
|
146
|
+
background: var(--color-semantic-surface-secondary-mid);
|
|
147
|
+
color: var(--color-semantic-foreground-inverse);
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
@media (min-width: 768px) {
|
|
151
|
+
._drawer--medium_zzxde_32 {
|
|
152
|
+
--_drawer-transition-duration-open: 500ms;
|
|
153
|
+
--_drawer-transition-duration-close: 300ms;
|
|
154
|
+
}
|
|
155
|
+
._drawer--large_zzxde_35 {
|
|
156
|
+
--_drawer-transition-duration-open: 500ms;
|
|
157
|
+
--_drawer-transition-duration-close: 300ms;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
@media (min-width: 1024px) {
|
|
161
|
+
._drawer--large_zzxde_35 {
|
|
162
|
+
--_drawer-transition-duration-open: 600ms;
|
|
163
|
+
--_drawer-transition-duration-close: 400ms;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
@media (max-width: 359px) {
|
|
167
|
+
._drawer_zzxde_1 {
|
|
168
|
+
width: 100vw;
|
|
169
|
+
max-width: 100vw;
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
@media (prefers-reduced-motion: reduce) {
|
|
173
|
+
._drawer_zzxde_1,
|
|
174
|
+
._drawer_zzxde_1::backdrop {
|
|
175
|
+
transition: none;
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
@media (forced-colors: active) {
|
|
179
|
+
._drawer_zzxde_1 {
|
|
180
|
+
border: 2px solid CanvasText;
|
|
181
|
+
box-shadow: none;
|
|
182
|
+
}
|
|
183
|
+
._drawer_zzxde_1::backdrop {
|
|
184
|
+
background: Canvas;
|
|
185
|
+
opacity: 0.7;
|
|
186
|
+
}
|
|
187
|
+
._drawer__close_zzxde_113 {
|
|
188
|
+
border: 1px solid ButtonBorder;
|
|
189
|
+
background: ButtonFace;
|
|
190
|
+
color: ButtonText;
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
._drawer--opening_zzxde_38 {
|
|
195
|
+
@starting-style {
|
|
196
|
+
transform: translateX(0);
|
|
197
|
+
}
|
|
198
|
+
}
|
|
199
|
+
._drawer--opening_zzxde_38::backdrop {
|
|
200
|
+
@starting-style {
|
|
201
|
+
opacity: 0;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
._drawer--closing_zzxde_39 {
|
|
205
|
+
@starting-style {
|
|
206
|
+
transform: translateX(-100%);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
._drawer--left_zzxde_50._drawer--opening_zzxde_38 {
|
|
210
|
+
@starting-style {
|
|
211
|
+
transform: translateX(-100%);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
._drawer--left_zzxde_50._drawer--closing_zzxde_39 {
|
|
215
|
+
@starting-style {
|
|
216
|
+
transform: translateX(0);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DrawerProps } from './Drawer.types';
|
|
2
|
+
export declare const Drawer: ({ open, onOpenChange, title, description, children, footer, size, headerStyle, side, fixedTitle, disableCloseOptions, closeLabel, keepMounted, className, ref, onKeyDown, onClick, onPointerDown, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...props }: DrawerProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
3
|
+
//# sourceMappingURL=Drawer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAElD,eAAO,MAAM,MAAM,GAAI,+SAuBpB,WAAW,mDAgFb,CAAC"}
|