@dnanpm/ui-components 0.7.0 → 0.9.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.
Files changed (159) hide show
  1. package/dist/components/Accordion/Accordion.css +6 -3
  2. package/dist/components/AccordionItem/AccordionItem.css +6 -3
  3. package/dist/components/Breadcrumb/Breadcrumb.css +15 -12
  4. package/dist/components/Breadcrumb/Breadcrumb.module.css.cjs +6 -6
  5. package/dist/components/Breadcrumb/Breadcrumb.module.css.js +6 -6
  6. package/dist/components/Button/Button.css +33 -32
  7. package/dist/components/Button/Button.module.css.cjs +11 -11
  8. package/dist/components/Button/Button.module.css.js +11 -11
  9. package/dist/components/ButtonCard/ButtonCard.cjs +105 -0
  10. package/dist/components/ButtonCard/ButtonCard.cjs.map +1 -0
  11. package/dist/components/ButtonCard/ButtonCard.css +166 -0
  12. package/dist/components/ButtonCard/ButtonCard.d.ts +3 -0
  13. package/dist/components/ButtonCard/ButtonCard.d.ts.map +1 -0
  14. package/dist/components/ButtonCard/ButtonCard.js +105 -0
  15. package/dist/components/ButtonCard/ButtonCard.js.map +1 -0
  16. package/dist/components/ButtonCard/ButtonCard.module.css.cjs +18 -0
  17. package/dist/components/ButtonCard/ButtonCard.module.css.cjs.map +1 -0
  18. package/dist/components/ButtonCard/ButtonCard.module.css.js +19 -0
  19. package/dist/components/ButtonCard/ButtonCard.module.css.js.map +1 -0
  20. package/dist/components/ButtonCard/ButtonCard.types.d.ts +103 -0
  21. package/dist/components/ButtonCard/ButtonCard.types.d.ts.map +1 -0
  22. package/dist/components/ButtonCard/index.d.ts +3 -0
  23. package/dist/components/ButtonCard/index.d.ts.map +1 -0
  24. package/dist/components/ContentCard/ContentCard.cjs +96 -0
  25. package/dist/components/ContentCard/ContentCard.cjs.map +1 -0
  26. package/dist/components/ContentCard/ContentCard.css +249 -0
  27. package/dist/components/ContentCard/ContentCard.d.ts +3 -0
  28. package/dist/components/ContentCard/ContentCard.d.ts.map +1 -0
  29. package/dist/components/ContentCard/ContentCard.js +96 -0
  30. package/dist/components/ContentCard/ContentCard.js.map +1 -0
  31. package/dist/components/ContentCard/ContentCard.module.css.cjs +24 -0
  32. package/dist/components/ContentCard/ContentCard.module.css.cjs.map +1 -0
  33. package/dist/components/ContentCard/ContentCard.module.css.js +25 -0
  34. package/dist/components/ContentCard/ContentCard.module.css.js.map +1 -0
  35. package/dist/components/ContentCard/ContentCard.types.d.ts +99 -0
  36. package/dist/components/ContentCard/ContentCard.types.d.ts.map +1 -0
  37. package/dist/components/ContentCard/index.d.ts +3 -0
  38. package/dist/components/ContentCard/index.d.ts.map +1 -0
  39. package/dist/components/Drawer/Drawer.cjs +101 -0
  40. package/dist/components/Drawer/Drawer.cjs.map +1 -0
  41. package/dist/components/Drawer/Drawer.css +218 -0
  42. package/dist/components/Drawer/Drawer.d.ts +3 -0
  43. package/dist/components/Drawer/Drawer.d.ts.map +1 -0
  44. package/dist/components/Drawer/Drawer.js +101 -0
  45. package/dist/components/Drawer/Drawer.js.map +1 -0
  46. package/dist/components/Drawer/Drawer.module.css.cjs +37 -0
  47. package/dist/components/Drawer/Drawer.module.css.cjs.map +1 -0
  48. package/dist/components/Drawer/Drawer.module.css.js +37 -0
  49. package/dist/components/Drawer/Drawer.module.css.js.map +1 -0
  50. package/dist/components/Drawer/Drawer.types.d.ts +63 -0
  51. package/dist/components/Drawer/Drawer.types.d.ts.map +1 -0
  52. package/dist/components/Drawer/index.d.ts +3 -0
  53. package/dist/components/Drawer/index.d.ts.map +1 -0
  54. package/dist/components/Footer/Footer.css +87 -77
  55. package/dist/components/Footer/Footer.module.css.cjs +39 -39
  56. package/dist/components/Footer/Footer.module.css.js +39 -39
  57. package/dist/components/FunctionButton/FunctionButton.cjs +34 -0
  58. package/dist/components/FunctionButton/FunctionButton.cjs.map +1 -0
  59. package/dist/components/FunctionButton/FunctionButton.css +124 -0
  60. package/dist/components/FunctionButton/FunctionButton.d.ts +3 -0
  61. package/dist/components/FunctionButton/FunctionButton.d.ts.map +1 -0
  62. package/dist/components/FunctionButton/FunctionButton.js +34 -0
  63. package/dist/components/FunctionButton/FunctionButton.js.map +1 -0
  64. package/dist/components/FunctionButton/FunctionButton.module.css.cjs +11 -0
  65. package/dist/components/FunctionButton/FunctionButton.module.css.cjs.map +1 -0
  66. package/dist/components/FunctionButton/FunctionButton.module.css.js +12 -0
  67. package/dist/components/FunctionButton/FunctionButton.module.css.js.map +1 -0
  68. package/dist/components/FunctionButton/FunctionButton.types.d.ts +21 -0
  69. package/dist/components/FunctionButton/FunctionButton.types.d.ts.map +1 -0
  70. package/dist/components/FunctionButton/index.d.ts +3 -0
  71. package/dist/components/FunctionButton/index.d.ts.map +1 -0
  72. package/dist/components/Hero/Hero.cjs +24 -26
  73. package/dist/components/Hero/Hero.cjs.map +1 -1
  74. package/dist/components/Hero/Hero.css +81 -74
  75. package/dist/components/Hero/Hero.js +24 -26
  76. package/dist/components/Hero/Hero.js.map +1 -1
  77. package/dist/components/Hero/Hero.module.css.cjs +20 -17
  78. package/dist/components/Hero/Hero.module.css.cjs.map +1 -1
  79. package/dist/components/Hero/Hero.module.css.js +20 -17
  80. package/dist/components/Hero/Hero.module.css.js.map +1 -1
  81. package/dist/components/IconButton/IconButton.css +32 -34
  82. package/dist/components/IconButton/IconButton.module.css.cjs +9 -9
  83. package/dist/components/IconButton/IconButton.module.css.js +9 -9
  84. package/dist/components/Label/Label.css +2 -3
  85. package/dist/components/MainNavigation/MainNavigation.cjs +415 -120
  86. package/dist/components/MainNavigation/MainNavigation.cjs.map +1 -1
  87. package/dist/components/MainNavigation/MainNavigation.css +265 -159
  88. package/dist/components/MainNavigation/MainNavigation.d.ts +1 -1
  89. package/dist/components/MainNavigation/MainNavigation.d.ts.map +1 -1
  90. package/dist/components/MainNavigation/MainNavigation.js +417 -122
  91. package/dist/components/MainNavigation/MainNavigation.js.map +1 -1
  92. package/dist/components/MainNavigation/MainNavigation.module.css.cjs +78 -68
  93. package/dist/components/MainNavigation/MainNavigation.module.css.cjs.map +1 -1
  94. package/dist/components/MainNavigation/MainNavigation.module.css.js +78 -68
  95. package/dist/components/MainNavigation/MainNavigation.module.css.js.map +1 -1
  96. package/dist/components/MainNavigation/MainNavigation.types.d.ts +64 -17
  97. package/dist/components/MainNavigation/MainNavigation.types.d.ts.map +1 -1
  98. package/dist/components/MainNavigation/MainNavigation.utils.cjs +20 -0
  99. package/dist/components/MainNavigation/MainNavigation.utils.cjs.map +1 -1
  100. package/dist/components/MainNavigation/MainNavigation.utils.d.ts +10 -1
  101. package/dist/components/MainNavigation/MainNavigation.utils.d.ts.map +1 -1
  102. package/dist/components/MainNavigation/MainNavigation.utils.js +20 -0
  103. package/dist/components/MainNavigation/MainNavigation.utils.js.map +1 -1
  104. package/dist/components/MainNavigation/index.d.ts +1 -1
  105. package/dist/components/MainNavigation/index.d.ts.map +1 -1
  106. package/dist/components/Modal/Modal.cjs +101 -0
  107. package/dist/components/Modal/Modal.cjs.map +1 -0
  108. package/dist/components/Modal/Modal.css +204 -0
  109. package/dist/components/Modal/Modal.d.ts +3 -0
  110. package/dist/components/Modal/Modal.d.ts.map +1 -0
  111. package/dist/components/Modal/Modal.js +101 -0
  112. package/dist/components/Modal/Modal.js.map +1 -0
  113. package/dist/components/Modal/Modal.module.css.cjs +39 -0
  114. package/dist/components/Modal/Modal.module.css.cjs.map +1 -0
  115. package/dist/components/Modal/Modal.module.css.js +39 -0
  116. package/dist/components/Modal/Modal.module.css.js.map +1 -0
  117. package/dist/components/Modal/Modal.types.d.ts +62 -0
  118. package/dist/components/Modal/Modal.types.d.ts.map +1 -0
  119. package/dist/components/Modal/index.d.ts +3 -0
  120. package/dist/components/Modal/index.d.ts.map +1 -0
  121. package/dist/components/Modal/useDialogDismissal.cjs +41 -0
  122. package/dist/components/Modal/useDialogDismissal.cjs.map +1 -0
  123. package/dist/components/Modal/useDialogDismissal.d.ts +17 -0
  124. package/dist/components/Modal/useDialogDismissal.d.ts.map +1 -0
  125. package/dist/components/Modal/useDialogDismissal.js +41 -0
  126. package/dist/components/Modal/useDialogDismissal.js.map +1 -0
  127. package/dist/components/Modal/useNativeDialog.cjs +126 -0
  128. package/dist/components/Modal/useNativeDialog.cjs.map +1 -0
  129. package/dist/components/Modal/useNativeDialog.d.ts +14 -0
  130. package/dist/components/Modal/useNativeDialog.d.ts.map +1 -0
  131. package/dist/components/Modal/useNativeDialog.js +126 -0
  132. package/dist/components/Modal/useNativeDialog.js.map +1 -0
  133. package/dist/components/Notification/Notification.css +6 -3
  134. package/dist/components/Pictograph/Pictograph.css +6 -3
  135. package/dist/components/Pictograph/PictographItem.css +6 -3
  136. package/dist/components/Quote/Quote.css +2 -3
  137. package/dist/components/Spinner/Spinner.css +6 -3
  138. package/dist/index.cjs +10 -0
  139. package/dist/index.cjs.map +1 -1
  140. package/dist/index.d.ts +11 -1
  141. package/dist/index.d.ts.map +1 -1
  142. package/dist/index.js +10 -0
  143. package/dist/index.js.map +1 -1
  144. package/dist/styles/utils/elevation.css +2 -3
  145. package/dist/styles/utils/elevation.module.css.cjs +3 -0
  146. package/dist/styles/utils/elevation.module.css.cjs.map +1 -1
  147. package/dist/styles/utils/elevation.module.css.js +4 -1
  148. package/dist/styles/utils/elevation.module.css.js.map +1 -1
  149. package/dist/styles/utils/focus.css +26 -24
  150. package/dist/styles/utils/focus.module.css.cjs +3 -6
  151. package/dist/styles/utils/focus.module.css.cjs.map +1 -1
  152. package/dist/styles/utils/focus.module.css.js +4 -7
  153. package/dist/styles/utils/focus.module.css.js.map +1 -1
  154. package/dist/styles/utils/overlay.css +2 -3
  155. package/dist/styles/utils/text-decoration.css +4 -4
  156. package/dist/styles/utils/text-decoration.module.css.cjs +2 -2
  157. package/dist/styles/utils/text-decoration.module.css.js +2 -2
  158. package/dist/styles.css +17 -7
  159. package/package.json +3 -3
@@ -0,0 +1,218 @@
1
+ @layer dds-base, dds-components;@layer dds-components { @layer fallback, components; }@layer dds-components.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
+ } }
@@ -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"}
@@ -0,0 +1,101 @@
1
+ import { jsxs, jsx } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import { Close } from "@dnanpm/icons";
4
+ import elevationStyles from "../../styles/utils/elevation.module.css.js";
5
+ import focusStyles from "../../styles/utils/focus.module.css.js";
6
+ import { useDialogDismissal } from "../Modal/useDialogDismissal.js";
7
+ import { useNativeDialog } from "../Modal/useNativeDialog.js";
8
+ import styles from "./Drawer.module.css.js";
9
+ import { cn } from "../../utils/cn/cn.js";
10
+ const Drawer = ({
11
+ open,
12
+ onOpenChange,
13
+ title,
14
+ description,
15
+ children,
16
+ footer,
17
+ size = "small",
18
+ headerStyle = "light",
19
+ side = "right",
20
+ fixedTitle = false,
21
+ disableCloseOptions = false,
22
+ closeLabel = "Sulje dialogi",
23
+ keepMounted = false,
24
+ className,
25
+ ref,
26
+ onKeyDown,
27
+ onClick,
28
+ onPointerDown,
29
+ "aria-label": ariaLabel,
30
+ "aria-labelledby": ariaLabelledBy,
31
+ "aria-describedby": ariaDescribedBy,
32
+ ...props
33
+ }) => {
34
+ const titleId = useId();
35
+ const descriptionId = useId();
36
+ const { dialogRef, close, phase, isPresent } = useNativeDialog({
37
+ open: open ?? false,
38
+ keepMounted,
39
+ onOpenChange
40
+ });
41
+ const describedBy = [description ? descriptionId : void 0, ariaDescribedBy].filter(Boolean).join(" ") || void 0;
42
+ const dialogDismissalProps = useDialogDismissal({
43
+ close,
44
+ disableCloseOptions,
45
+ onClick,
46
+ onKeyDown,
47
+ onPointerDown
48
+ });
49
+ if (!isPresent) return null;
50
+ return /* @__PURE__ */ jsxs(
51
+ "dialog",
52
+ {
53
+ ...props,
54
+ ref: (node) => {
55
+ dialogRef.current = node;
56
+ if (typeof ref === "function") ref(node);
57
+ else if (ref) ref.current = node;
58
+ },
59
+ className: cn(
60
+ styles.drawer,
61
+ elevationStyles.elevationHigh,
62
+ styles[`drawer--${size}`],
63
+ styles[`drawer--${headerStyle}`],
64
+ styles[`drawer--${side}`],
65
+ { [styles["drawer--fixed-title"]]: fixedTitle },
66
+ { [styles["drawer--opening"]]: phase !== "closing" },
67
+ { [styles["drawer--closing"]]: phase === "closing" },
68
+ className
69
+ ),
70
+ "aria-label": ariaLabel,
71
+ "aria-labelledby": ariaLabelledBy ?? (!ariaLabel && title ? titleId : void 0),
72
+ "aria-describedby": describedBy,
73
+ ...dialogDismissalProps,
74
+ children: [
75
+ /* @__PURE__ */ jsxs("div", { className: styles.drawer__container, children: [
76
+ !disableCloseOptions && /* @__PURE__ */ jsx(
77
+ "button",
78
+ {
79
+ type: "button",
80
+ className: cn(styles.drawer__close, focusStyles.focusable),
81
+ "aria-label": closeLabel,
82
+ "data-dialog-autofocus": "true",
83
+ onClick: close,
84
+ children: /* @__PURE__ */ jsx(Close, { "aria-hidden": "true" })
85
+ }
86
+ ),
87
+ (title || description) && /* @__PURE__ */ jsxs("div", { className: styles.drawer__title, children: [
88
+ title && /* @__PURE__ */ jsx("h2", { id: titleId, className: styles.drawer__heading, children: title }),
89
+ description && /* @__PURE__ */ jsx("div", { id: descriptionId, className: styles.drawer__description, children: description })
90
+ ] }),
91
+ /* @__PURE__ */ jsx("div", { className: styles.drawer__content, children })
92
+ ] }),
93
+ footer && /* @__PURE__ */ jsx("div", { className: cn(styles["drawer__bottom-bar"], elevationStyles.elevationMedium), children: footer })
94
+ ]
95
+ }
96
+ );
97
+ };
98
+ export {
99
+ Drawer
100
+ };
101
+ //# sourceMappingURL=Drawer.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.js","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":[],"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,E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EJ,UAAA;AAAA,QAAA,qBAAC,OAAA,EAAI,WAAW,OAAO,mBAClB,UAAA;AAAA,UAAA,CAAC,uBACE;AAAA,YAAC;AAAA,YAAA;AAAA,cACG,MAAK;AAAA,cACL,WAAW,GAAG,OAAO,eAAe,YAAY,SAAS;AAAA,cACzD,cAAY;AAAA,cACZ,yBAAsB;AAAA,cACtB,SAAS;AAAA,cAET,UAAA,oBAAC,OAAA,EAAM,eAAY,OAAA,CAAO;AAAA,YAAA;AAAA,UAAA;AAAA,WAGhC,SAAS,gBACP,qBAAC,OAAA,EAAI,WAAW,OAAO,eAClB,UAAA;AAAA,YAAA,6BACI,MAAA,EAAG,IAAI,SAAS,WAAW,OAAO,iBAC9B,UAAA,MAAA,CACL;AAAA,YAEH,mCACI,OAAA,EAAI,IAAI,eAAe,WAAW,OAAO,qBACrC,UAAA,YAAA,CACL;AAAA,UAAA,GAER;AAAA,UAEJ,oBAAC,OAAA,EAAI,WAAW,OAAO,iBAAkB,SAAA,CAAS;AAAA,QAAA,GACtD;AAAA,QACC,UACG,oBAAC,OAAA,EAAI,WAAW,GAAG,OAAO,oBAAoB,GAAG,gBAAgB,eAAe,GAC3E,UAAA,OAAA,CACL;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAIhB;"}
@@ -0,0 +1,37 @@
1
+ require('./Drawer.css');
2
+ "use strict";
3
+ Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
4
+ const drawer = "_drawer_zzxde_1";
5
+ const drawer__container = "_drawer__container_zzxde_78";
6
+ const drawer__title = "_drawer__title_zzxde_88";
7
+ const drawer__heading = "_drawer__heading_zzxde_98";
8
+ const drawer__description = "_drawer__description_zzxde_102";
9
+ const drawer__content = "_drawer__content_zzxde_105";
10
+ const drawer__close = "_drawer__close_zzxde_113";
11
+ const styles = {
12
+ drawer,
13
+ "drawer--small": "_drawer--small_zzxde_29",
14
+ "drawer--medium": "_drawer--medium_zzxde_32",
15
+ "drawer--large": "_drawer--large_zzxde_35",
16
+ "drawer--opening": "_drawer--opening_zzxde_38",
17
+ "drawer--closing": "_drawer--closing_zzxde_39",
18
+ "drawer--left": "_drawer--left_zzxde_50",
19
+ drawer__container,
20
+ "drawer--fixed-title": "_drawer--fixed-title_zzxde_85",
21
+ drawer__title,
22
+ drawer__heading,
23
+ drawer__description,
24
+ drawer__content,
25
+ drawer__close,
26
+ "drawer__bottom-bar": "_drawer__bottom-bar_zzxde_133",
27
+ "drawer--dark": "_drawer--dark_zzxde_140"
28
+ };
29
+ exports.default = styles;
30
+ exports.drawer = drawer;
31
+ exports.drawer__close = drawer__close;
32
+ exports.drawer__container = drawer__container;
33
+ exports.drawer__content = drawer__content;
34
+ exports.drawer__description = drawer__description;
35
+ exports.drawer__heading = drawer__heading;
36
+ exports.drawer__title = drawer__title;
37
+ //# sourceMappingURL=Drawer.module.css.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,37 @@
1
+ import './Drawer.css';
2
+ const drawer = "_drawer_zzxde_1";
3
+ const drawer__container = "_drawer__container_zzxde_78";
4
+ const drawer__title = "_drawer__title_zzxde_88";
5
+ const drawer__heading = "_drawer__heading_zzxde_98";
6
+ const drawer__description = "_drawer__description_zzxde_102";
7
+ const drawer__content = "_drawer__content_zzxde_105";
8
+ const drawer__close = "_drawer__close_zzxde_113";
9
+ const styles = {
10
+ drawer,
11
+ "drawer--small": "_drawer--small_zzxde_29",
12
+ "drawer--medium": "_drawer--medium_zzxde_32",
13
+ "drawer--large": "_drawer--large_zzxde_35",
14
+ "drawer--opening": "_drawer--opening_zzxde_38",
15
+ "drawer--closing": "_drawer--closing_zzxde_39",
16
+ "drawer--left": "_drawer--left_zzxde_50",
17
+ drawer__container,
18
+ "drawer--fixed-title": "_drawer--fixed-title_zzxde_85",
19
+ drawer__title,
20
+ drawer__heading,
21
+ drawer__description,
22
+ drawer__content,
23
+ drawer__close,
24
+ "drawer__bottom-bar": "_drawer__bottom-bar_zzxde_133",
25
+ "drawer--dark": "_drawer--dark_zzxde_140"
26
+ };
27
+ export {
28
+ styles as default,
29
+ drawer,
30
+ drawer__close,
31
+ drawer__container,
32
+ drawer__content,
33
+ drawer__description,
34
+ drawer__heading,
35
+ drawer__title
36
+ };
37
+ //# sourceMappingURL=Drawer.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,63 @@
1
+ import { ComponentPropsWithRef, ReactNode } from 'react';
2
+ export type DrawerSize = 'small' | 'medium' | 'large';
3
+ export type DrawerHeaderStyle = 'light' | 'dark';
4
+ export type DrawerSide = 'left' | 'right';
5
+ type DrawerAccessibleName = {
6
+ readonly title: ReactNode;
7
+ readonly 'aria-label'?: string;
8
+ readonly 'aria-labelledby'?: never;
9
+ } | {
10
+ readonly title: ReactNode;
11
+ readonly 'aria-label'?: never;
12
+ readonly 'aria-labelledby': string;
13
+ } | {
14
+ readonly title: ReactNode;
15
+ readonly 'aria-label'?: never;
16
+ readonly 'aria-labelledby'?: never;
17
+ } | {
18
+ readonly title?: never;
19
+ readonly 'aria-label': string;
20
+ readonly 'aria-labelledby'?: never;
21
+ } | {
22
+ readonly title?: never;
23
+ readonly 'aria-label'?: never;
24
+ readonly 'aria-labelledby': string;
25
+ };
26
+ export type DrawerProps = Omit<ComponentPropsWithRef<'dialog'>, 'children' | 'open' | 'onClose' | 'onCancel' | 'aria-label' | 'aria-labelledby' | 'title'> & DrawerAccessibleName & {
27
+ /**
28
+ * Controls whether the drawer is open. The drawer unmounts after its close animation unless
29
+ * `keepMounted` is true.
30
+ * `undefined` is treated as closed. @default false
31
+ */
32
+ readonly open?: boolean;
33
+ /**
34
+ * Keeps the closed drawer and its descendants mounted, preserving their React state and effects.
35
+ * @default false
36
+ */
37
+ readonly keepMounted?: boolean;
38
+ /** Called with false when the user requests closing. Opening and closing are controlled by `open`. */
39
+ readonly onOpenChange?: (open: boolean) => void;
40
+ /** Supporting text displayed below the heading. */
41
+ readonly description?: ReactNode;
42
+ /** Content displayed in the drawer body. */
43
+ readonly children: ReactNode;
44
+ /** Optional content displayed in the bottom action bar. */
45
+ readonly footer?: ReactNode;
46
+ /** Drawer width. */
47
+ readonly size?: DrawerSize;
48
+ /** Visual style of the header and close button. */
49
+ readonly headerStyle?: DrawerHeaderStyle;
50
+ /** Side from which the drawer enters. @default 'right' */
51
+ readonly side?: DrawerSide;
52
+ /** Keeps the header fixed while the body scrolls. @default false */
53
+ readonly fixedTitle?: boolean;
54
+ /**
55
+ * Disables the close button, backdrop click, and Escape key. Provide an action that sets
56
+ * `open` to false when this is enabled. @default false
57
+ */
58
+ readonly disableCloseOptions?: boolean;
59
+ /** Accessible label for the close button. @default 'Sulje dialogi' */
60
+ readonly closeLabel?: string;
61
+ };
62
+ export {};
63
+ //# sourceMappingURL=Drawer.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Drawer.types.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,qBAAqB,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAE9D,MAAM,MAAM,UAAU,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;AACtD,MAAM,MAAM,iBAAiB,GAAG,OAAO,GAAG,MAAM,CAAC;AACjD,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,OAAO,CAAC;AAE1C,KAAK,oBAAoB,GACnB;IACI,QAAQ,CAAC,KAAK,EAAE,SAAS,CAAC;IAC1B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAC/B,QAAQ,CAAC,iBAAiB,CAAC,EAAE,KAAK,CAAC;CACtC,GACD;IACI,QAAQ,CAAC,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AAI,CAAC,EAAE,UAAU,CAAC;IAC3B,mDAAmD;IACnD,QAAQ,CAAC,WAAW,CAAC,EAAE,iBAAiB,CAAC;IACzC,0DAA0D;IAC1D,QAAQ,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC;IAC3B,oEAAoE;IACpE,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B;;;OAGG;IACH,QAAQ,CAAC,mBAAmB,CAAC,EAAE,OAAO,CAAC;IACvC,sEAAsE;IACtE,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;CAChC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { Drawer } from './Drawer';
2
+ export type { DrawerHeaderStyle, DrawerProps, DrawerSide, DrawerSize } from './Drawer.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAClC,YAAY,EAAE,iBAAiB,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC"}