@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,249 @@
1
+ @layer dds-base, dds-components;
2
+
3
+ @layer dds-components { @layer fallback, components; }
4
+
5
+ @layer dds-components.components{/*
6
+ * Content Card
7
+ *
8
+ * Container-driven layout: horizontal when the card is >= 40rem wide, vertical below.
9
+ * Title size responds to the CONTENT AREA width (its own container). Content padding
10
+ * responds to both the content-area width and the layout mode. Body size and inner
11
+ * gaps stay constant across sizes.
12
+ */
13
+
14
+ ._content-card_1pa46_10 {
15
+ display: flex;
16
+ flex-direction: column;
17
+ width: 100%;
18
+ min-width: 0;
19
+ /* Reset the base list-item margin when the root renders as <li>. */
20
+ margin: 0;
21
+ background-color: var(--color-semantic-surface-base);
22
+ border-radius: var(--radius-semantic-md);
23
+ /* Clips media corners to the card radius; the card's own box-shadow is not clipped. */
24
+ overflow: clip;
25
+ container-name: content-card;
26
+ container-type: inline-size;
27
+ }
28
+
29
+ ._content-card--border_1pa46_25 {
30
+ border: var(--borderwidth-semantic-xs) solid var(--color-semantic-border-neutral-base);
31
+ }
32
+
33
+ /* Layout wrapper: a descendant of the container so its direction can respond to card width. */
34
+ ._content-card__layout_1pa46_30 {
35
+ display: flex;
36
+ flex: 1;
37
+ flex-direction: column;
38
+ width: 100%;
39
+ }
40
+
41
+ /* ─── Media ─── */
42
+
43
+ ._content-card__media_1pa46_39 {
44
+ position: relative;
45
+ width: 100%;
46
+ }
47
+
48
+ ._content-card__media--image_1pa46_44 {
49
+ aspect-ratio: 21 / 9;
50
+ }
51
+
52
+ ._content-card__media--logo_1pa46_48 {
53
+ aspect-ratio: 21 / 9;
54
+ background-color: var(--_cc-logo-bg, var(--color-semantic-surface-neutral-mid));
55
+ }
56
+
57
+ /* Absolute inner fills the media box so content can't stretch the aspect ratio. */
58
+ ._content-card__media-inner_1pa46_54 {
59
+ position: absolute;
60
+ inset: 0;
61
+
62
+ /* Descendant selector also reaches an <img> nested inside a <picture>. */
63
+ & :where(img, picture, video, svg, canvas) {
64
+ display: block;
65
+ width: 100%;
66
+ height: 100%;
67
+ object-fit: cover;
68
+ }
69
+ }
70
+
71
+ /* Logo sits in a centered 4:3 box and is contained within it. */
72
+ ._content-card__media--logo_1pa46_48 ._content-card__media-inner_1pa46_54 {
73
+ display: flex;
74
+ align-items: center;
75
+ justify-content: center;
76
+ padding: var(--spacing-space-24);
77
+
78
+ & :where(img, picture, video, svg, canvas) {
79
+ width: auto;
80
+ height: 100%;
81
+ max-width: 100%;
82
+ aspect-ratio: 4 / 3;
83
+ object-fit: contain;
84
+ }
85
+ }
86
+
87
+ /* ─── Content ─── */
88
+
89
+ ._content-card__content_1pa46_85 {
90
+ display: flex;
91
+ flex: 1 1 auto;
92
+ flex-direction: column;
93
+ min-width: 0;
94
+ container-name: content-card-content;
95
+ container-type: inline-size;
96
+ }
97
+
98
+ /* Padded stack: a descendant of the content container so padding can respond to content width. */
99
+ ._content-card__content-inner_1pa46_95 {
100
+ display: flex;
101
+ flex: 1;
102
+ flex-direction: column;
103
+ gap: var(--spacing-space-24);
104
+ /* Vertical layout, small content width. */
105
+ padding: var(--spacing-space-20) var(--spacing-space-20) var(--spacing-space-32);
106
+ }
107
+
108
+ ._content-card__body-region_1pa46_104 {
109
+ display: flex;
110
+ flex-direction: column;
111
+ gap: var(--spacing-space-20);
112
+ }
113
+
114
+ ._content-card__header_1pa46_110 {
115
+ display: flex;
116
+ flex-direction: column;
117
+ gap: var(--spacing-space-4);
118
+ }
119
+
120
+ ._content-card__prefix_1pa46_116 {
121
+ align-self: flex-start;
122
+ }
123
+
124
+ ._content-card__title_1pa46_120 {
125
+ margin: 0;
126
+ color: var(--color-semantic-foreground-default);
127
+ font: var(--typography-heading-sm);
128
+ text-wrap: balance;
129
+ overflow-wrap: break-word;
130
+ hyphens: auto;
131
+ /* Only hyphenate words of >= 12 chars (min 6 before / 3 after the break). */
132
+ hyphenate-limit-chars: 12 6 3;
133
+ }
134
+
135
+ ._content-card__body_1pa46_104 {
136
+ margin: 0;
137
+ color: var(--color-semantic-foreground-default);
138
+ font: var(--typography-body-md);
139
+ text-wrap: pretty;
140
+ overflow-wrap: break-word;
141
+ hyphens: auto;
142
+ /* Only hyphenate words of >= 12 chars (min 6 before / 3 after the break). */
143
+ hyphenate-limit-chars: 12 6 3;
144
+ }
145
+
146
+ ._content-card__body_1pa46_104 p {
147
+ margin: 0;
148
+ }
149
+
150
+ ._content-card__body_1pa46_104 p + p {
151
+ margin-top: var(--spacing-space-12);
152
+ }
153
+
154
+ ._content-card__actions_1pa46_150 {
155
+ display: flex;
156
+ flex-direction: row;
157
+ flex-wrap: wrap;
158
+ align-items: flex-start;
159
+ gap: var(--spacing-space-8);
160
+ /* Vertical mode only: keeps actions at the bottom when the card is taller than its content
161
+ (e.g. equal-height grid). Reset in the horizontal layout below. */
162
+ margin-top: auto;
163
+ }
164
+
165
+ /* ─── Content-area size steps (vertical paddings; based on content width) ─── */
166
+
167
+ @container content-card-content (min-width: 24rem) {
168
+ ._content-card__content-inner_1pa46_95 {
169
+ padding: var(--spacing-space-24) var(--spacing-space-40) var(--spacing-space-40);
170
+ }
171
+
172
+ ._content-card__title_1pa46_120 {
173
+ font: var(--typography-heading-md);
174
+ }
175
+ }
176
+
177
+ @container content-card-content (min-width: 36rem) {
178
+ ._content-card__content-inner_1pa46_95 {
179
+ padding: var(--spacing-space-32) var(--spacing-space-64) var(--spacing-space-48);
180
+ }
181
+ }
182
+
183
+ /* ─── Horizontal layout (card wide enough) ─── */
184
+
185
+ @container content-card (min-width: 40rem) {
186
+ ._content-card__layout_1pa46_30 {
187
+ flex-direction: row;
188
+ }
189
+
190
+ ._content-card--media-end_1pa46_186 ._content-card__layout_1pa46_30 {
191
+ flex-direction: row-reverse;
192
+ }
193
+
194
+ ._content-card__media_1pa46_39 {
195
+ align-self: stretch;
196
+ /* Non-shrinking basis so mediaWidth is honoured even next to long content. */
197
+ flex: 0 0 33.3333%;
198
+ aspect-ratio: auto;
199
+ }
200
+
201
+ ._content-card--media-half_1pa46_197 ._content-card__media_1pa46_39 {
202
+ flex-basis: 50%;
203
+ }
204
+
205
+ /* Content is vertically centered against the media in the horizontal layout. */
206
+ ._content-card__content_1pa46_85 {
207
+ align-self: center;
208
+ }
209
+
210
+ ._content-card__actions_1pa46_150 {
211
+ margin-top: 0;
212
+ }
213
+
214
+ /* Minimum media height follows a 4:3 shape of its own width. */
215
+ ._content-card__media--image_1pa46_44::before {
216
+ content: '';
217
+ display: block;
218
+ padding-top: 75%;
219
+ }
220
+
221
+ /* Horizontal paddings override the vertical ones, still stepping by content width. */
222
+ ._content-card__content-inner_1pa46_95 {
223
+ padding: var(--spacing-space-32) var(--spacing-space-20);
224
+ }
225
+
226
+ @container content-card-content (min-width: 24rem) {
227
+ ._content-card__content-inner_1pa46_95 {
228
+ padding: var(--spacing-space-40);
229
+ }
230
+ }
231
+
232
+ @container content-card-content (min-width: 36rem) {
233
+ ._content-card__content-inner_1pa46_95 {
234
+ padding: var(--spacing-space-48) var(--spacing-space-64);
235
+ }
236
+ }
237
+ }
238
+
239
+ /* ─── Forced colors ─── */
240
+
241
+ @media (forced-colors: active) {
242
+ ._content-card_1pa46_10 {
243
+ border: var(--borderwidth-semantic-xs) solid CanvasText;
244
+ }
245
+
246
+ ._content-card--elevated_1pa46_242 {
247
+ box-shadow: none;
248
+ }
249
+ } }
@@ -0,0 +1,3 @@
1
+ import { ContentCardProps } from './ContentCard.types';
2
+ export declare const ContentCard: ({ media, mediaKind, mediaBackground, mediaWidth, mediaPosition, titlePrefix, title, headingLevel, body, actions, appearance, as, className, ref, ...props }: ContentCardProps) => import("react/jsx-runtime").JSX.Element;
3
+ //# sourceMappingURL=ContentCard.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentCard.d.ts","sourceRoot":"","sources":["../../../src/components/ContentCard/ContentCard.tsx"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAA6B,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAkBvF,eAAO,MAAM,WAAW,GAAI,6JAgBzB,gBAAgB,4CA+ElB,CAAC"}
@@ -0,0 +1,96 @@
1
+ import { jsx, jsxs } from "react/jsx-runtime";
2
+ import { useId } from "react";
3
+ import elevationStyles from "../../styles/utils/elevation.module.css.js";
4
+ import styles from "./ContentCard.module.css.js";
5
+ import { cn } from "../../utils/cn/cn.js";
6
+ const logoBackgroundToken = {
7
+ white: "var(--color-semantic-surface-base)",
8
+ "sand-soft": "var(--color-semantic-surface-neutral-soft)",
9
+ "sand-mid": "var(--color-semantic-surface-neutral-mid)",
10
+ "sand-strong": "var(--color-semantic-surface-neutral-strong)",
11
+ "pink-soft": "var(--color-semantic-surface-primary-soft)",
12
+ "pink-mid": "var(--color-semantic-surface-primary-mid)",
13
+ "pink-strong": "var(--color-semantic-surface-primary-strong)",
14
+ "plum-soft": "var(--color-semantic-surface-secondary-soft)",
15
+ "plum-mid": "var(--color-semantic-surface-secondary-mid)",
16
+ "plum-strong": "var(--color-semantic-surface-secondary-strong)"
17
+ };
18
+ const isRenderable = (node) => node != null && typeof node !== "boolean";
19
+ const ContentCard = ({
20
+ media,
21
+ mediaKind = "image",
22
+ mediaBackground,
23
+ mediaWidth = "1/3",
24
+ mediaPosition = "start",
25
+ titlePrefix,
26
+ title,
27
+ headingLevel = "h3",
28
+ body,
29
+ actions,
30
+ appearance = "plain",
31
+ as = "article",
32
+ className,
33
+ ref,
34
+ ...props
35
+ }) => {
36
+ const titleId = useId();
37
+ const HeadingLevel = headingLevel;
38
+ const Root = as;
39
+ const hasMedia = isRenderable(media);
40
+ const ariaLabel = props["aria-label"];
41
+ const ariaLabelledBy = props["aria-labelledby"] ?? (ariaLabel || as === "div" ? void 0 : titleId);
42
+ return /* @__PURE__ */ jsx(
43
+ Root,
44
+ {
45
+ ref,
46
+ ...props,
47
+ className: cn(
48
+ styles["content-card"],
49
+ hasMedia && mediaWidth === "1/2" && styles["content-card--media-half"],
50
+ hasMedia && mediaPosition === "end" && styles["content-card--media-end"],
51
+ appearance === "border" && styles["content-card--border"],
52
+ appearance === "elevated" && styles["content-card--elevated"],
53
+ appearance === "elevated" && elevationStyles.elevationLow,
54
+ className
55
+ ),
56
+ "aria-label": ariaLabel,
57
+ "aria-labelledby": ariaLabelledBy,
58
+ children: /* @__PURE__ */ jsxs("div", { className: styles["content-card__layout"], children: [
59
+ hasMedia && /* @__PURE__ */ jsx(
60
+ "div",
61
+ {
62
+ className: cn(
63
+ styles["content-card__media"],
64
+ mediaKind === "logo" ? styles["content-card__media--logo"] : styles["content-card__media--image"]
65
+ ),
66
+ style: mediaKind === "logo" && mediaBackground != null ? {
67
+ "--_cc-logo-bg": logoBackgroundToken[mediaBackground]
68
+ } : void 0,
69
+ children: /* @__PURE__ */ jsx("div", { className: styles["content-card__media-inner"], children: media })
70
+ }
71
+ ),
72
+ /* @__PURE__ */ jsx("div", { className: styles["content-card__content"], children: /* @__PURE__ */ jsxs("div", { className: styles["content-card__content-inner"], children: [
73
+ /* @__PURE__ */ jsxs("div", { className: styles["content-card__body-region"], children: [
74
+ /* @__PURE__ */ jsxs("div", { className: styles["content-card__header"], children: [
75
+ isRenderable(titlePrefix) && /* @__PURE__ */ jsx("div", { className: styles["content-card__prefix"], children: titlePrefix }),
76
+ /* @__PURE__ */ jsx(
77
+ HeadingLevel,
78
+ {
79
+ id: titleId,
80
+ className: styles["content-card__title"],
81
+ children: title
82
+ }
83
+ )
84
+ ] }),
85
+ isRenderable(body) && /* @__PURE__ */ jsx("div", { className: cn(styles["content-card__body"], "dds-prose"), children: body })
86
+ ] }),
87
+ isRenderable(actions) && /* @__PURE__ */ jsx("div", { className: styles["content-card__actions"], children: actions })
88
+ ] }) })
89
+ ] })
90
+ }
91
+ );
92
+ };
93
+ export {
94
+ ContentCard
95
+ };
96
+ //# sourceMappingURL=ContentCard.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentCard.js","sources":["../../../src/components/ContentCard/ContentCard.tsx"],"sourcesContent":["import { useId } from 'react';\nimport type { CSSProperties, ElementType, ReactNode } from 'react';\nimport { cn } from '../../utils/cn';\nimport elevationStyles from '../../styles/utils/elevation.module.css';\nimport styles from './ContentCard.module.css';\nimport type { ContentCardLogoBackground, ContentCardProps } from './ContentCard.types';\n\nconst logoBackgroundToken: Record<ContentCardLogoBackground, string> = {\n white: 'var(--color-semantic-surface-base)',\n 'sand-soft': 'var(--color-semantic-surface-neutral-soft)',\n 'sand-mid': 'var(--color-semantic-surface-neutral-mid)',\n 'sand-strong': 'var(--color-semantic-surface-neutral-strong)',\n 'pink-soft': 'var(--color-semantic-surface-primary-soft)',\n 'pink-mid': 'var(--color-semantic-surface-primary-mid)',\n 'pink-strong': 'var(--color-semantic-surface-primary-strong)',\n 'plum-soft': 'var(--color-semantic-surface-secondary-soft)',\n 'plum-mid': 'var(--color-semantic-surface-secondary-mid)',\n 'plum-strong': 'var(--color-semantic-surface-secondary-strong)',\n};\n\n// A boolean ReactNode (e.g. from `condition && <X />`) renders nothing, so treat it as absent.\nconst isRenderable = (node: ReactNode): boolean => node != null && typeof node !== 'boolean';\n\nexport const ContentCard = ({\n media,\n mediaKind = 'image',\n mediaBackground,\n mediaWidth = '1/3',\n mediaPosition = 'start',\n titlePrefix,\n title,\n headingLevel = 'h3',\n body,\n actions,\n appearance = 'plain',\n as = 'article',\n className,\n ref,\n ...props\n}: ContentCardProps) => {\n const titleId = useId();\n const HeadingLevel = headingLevel;\n // Cast to ElementType so the constrained union of tags renders without ref/props conflicts.\n const Root = as as ElementType;\n const hasMedia = isRenderable(media);\n const ariaLabel = props['aria-label'];\n // Keep an explicit aria-labelledby; only the generated title fallback is suppressed for a\n // bare div or when an aria-label is provided.\n const ariaLabelledBy =\n props['aria-labelledby'] ?? (ariaLabel || as === 'div' ? undefined : titleId);\n\n return (\n <Root\n ref={ref}\n {...props}\n className={cn(\n styles['content-card'],\n hasMedia && mediaWidth === '1/2' && styles['content-card--media-half'],\n hasMedia && mediaPosition === 'end' && styles['content-card--media-end'],\n appearance === 'border' && styles['content-card--border'],\n appearance === 'elevated' && styles['content-card--elevated'],\n appearance === 'elevated' && elevationStyles.elevationLow,\n className,\n )}\n aria-label={ariaLabel}\n aria-labelledby={ariaLabelledBy}\n >\n <div className={styles['content-card__layout']}>\n {hasMedia && (\n <div\n className={cn(\n styles['content-card__media'],\n mediaKind === 'logo'\n ? styles['content-card__media--logo']\n : styles['content-card__media--image'],\n )}\n style={\n mediaKind === 'logo' && mediaBackground != null\n ? ({\n '--_cc-logo-bg': logoBackgroundToken[mediaBackground],\n } as CSSProperties)\n : undefined\n }\n >\n <div className={styles['content-card__media-inner']}>{media}</div>\n </div>\n )}\n\n <div className={styles['content-card__content']}>\n <div className={styles['content-card__content-inner']}>\n <div className={styles['content-card__body-region']}>\n <div className={styles['content-card__header']}>\n {isRenderable(titlePrefix) && (\n <div className={styles['content-card__prefix']}>\n {titlePrefix}\n </div>\n )}\n <HeadingLevel\n id={titleId}\n className={styles['content-card__title']}\n >\n {title}\n </HeadingLevel>\n </div>\n {isRenderable(body) && (\n <div className={cn(styles['content-card__body'], 'dds-prose')}>\n {body}\n </div>\n )}\n </div>\n {isRenderable(actions) && (\n <div className={styles['content-card__actions']}>{actions}</div>\n )}\n </div>\n </div>\n </div>\n </Root>\n );\n};\n"],"names":[],"mappings":";;;;;AAOA,MAAM,sBAAiE;AAAA,EACnE,OAAO;AAAA,EACP,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,eAAe;AACnB;AAGA,MAAM,eAAe,CAAC,SAA6B,QAAQ,QAAQ,OAAO,SAAS;AAE5E,MAAM,cAAc,CAAC;AAAA,EACxB;AAAA,EACA,YAAY;AAAA,EACZ;AAAA,EACA,aAAa;AAAA,EACb,gBAAgB;AAAA,EAChB;AAAA,EACA;AAAA,EACA,eAAe;AAAA,EACf;AAAA,EACA;AAAA,EACA,aAAa;AAAA,EACb,KAAK;AAAA,EACL;AAAA,EACA;AAAA,EACA,GAAG;AACP,MAAwB;AACpB,QAAM,UAAU,MAAA;AAChB,QAAM,eAAe;AAErB,QAAM,OAAO;AACb,QAAM,WAAW,aAAa,KAAK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A,cAEJ;AAAA,gBAAC;AAAA,gBAAA;AAAA,kBACG,IAAI;AAAA,kBACJ,WAAW,OAAO,qBAAqB;AAAA,kBAEtC,UAAA;AAAA,gBAAA;AAAA,cAAA;AAAA,YACL,GACJ;AAAA,YACC,aAAa,IAAI,KACd,oBAAC,OAAA,EAAI,WAAW,GAAG,OAAO,oBAAoB,GAAG,WAAW,GACvD,UAAA,KAAA,CACL;AAAA,UAAA,GAER;AAAA,UACC,aAAa,OAAO,KACjB,oBAAC,SAAI,WAAW,OAAO,uBAAuB,GAAI,UAAA,QAAA,CAAQ;AAAA,QAAA,EAAA,CAElE,EAAA,CACJ;AAAA,MAAA,EAAA,CACJ;AAAA,IAAA;AAAA,EAAA;AAGZ;"}
@@ -0,0 +1,24 @@
1
+ require('./ContentCard.css');
2
+ "use strict";
3
+ const styles = {
4
+ "content-card": "_content-card_1pa46_10",
5
+ "content-card--border": "_content-card--border_1pa46_25",
6
+ "content-card__layout": "_content-card__layout_1pa46_30",
7
+ "content-card__media": "_content-card__media_1pa46_39",
8
+ "content-card__media--image": "_content-card__media--image_1pa46_44",
9
+ "content-card__media--logo": "_content-card__media--logo_1pa46_48",
10
+ "content-card__media-inner": "_content-card__media-inner_1pa46_54",
11
+ "content-card__content": "_content-card__content_1pa46_85",
12
+ "content-card__content-inner": "_content-card__content-inner_1pa46_95",
13
+ "content-card__body-region": "_content-card__body-region_1pa46_104",
14
+ "content-card__header": "_content-card__header_1pa46_110",
15
+ "content-card__prefix": "_content-card__prefix_1pa46_116",
16
+ "content-card__title": "_content-card__title_1pa46_120",
17
+ "content-card__body": "_content-card__body_1pa46_104",
18
+ "content-card__actions": "_content-card__actions_1pa46_150",
19
+ "content-card--media-end": "_content-card--media-end_1pa46_186",
20
+ "content-card--media-half": "_content-card--media-half_1pa46_197",
21
+ "content-card--elevated": "_content-card--elevated_1pa46_242"
22
+ };
23
+ module.exports = styles;
24
+ //# sourceMappingURL=ContentCard.module.css.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentCard.module.css.cjs","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,25 @@
1
+ import './ContentCard.css';
2
+ const styles = {
3
+ "content-card": "_content-card_1pa46_10",
4
+ "content-card--border": "_content-card--border_1pa46_25",
5
+ "content-card__layout": "_content-card__layout_1pa46_30",
6
+ "content-card__media": "_content-card__media_1pa46_39",
7
+ "content-card__media--image": "_content-card__media--image_1pa46_44",
8
+ "content-card__media--logo": "_content-card__media--logo_1pa46_48",
9
+ "content-card__media-inner": "_content-card__media-inner_1pa46_54",
10
+ "content-card__content": "_content-card__content_1pa46_85",
11
+ "content-card__content-inner": "_content-card__content-inner_1pa46_95",
12
+ "content-card__body-region": "_content-card__body-region_1pa46_104",
13
+ "content-card__header": "_content-card__header_1pa46_110",
14
+ "content-card__prefix": "_content-card__prefix_1pa46_116",
15
+ "content-card__title": "_content-card__title_1pa46_120",
16
+ "content-card__body": "_content-card__body_1pa46_104",
17
+ "content-card__actions": "_content-card__actions_1pa46_150",
18
+ "content-card--media-end": "_content-card--media-end_1pa46_186",
19
+ "content-card--media-half": "_content-card--media-half_1pa46_197",
20
+ "content-card--elevated": "_content-card--elevated_1pa46_242"
21
+ };
22
+ export {
23
+ styles as default
24
+ };
25
+ //# sourceMappingURL=ContentCard.module.css.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentCard.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;"}
@@ -0,0 +1,99 @@
1
+ import { ComponentPropsWithRef, ReactNode } from 'react';
2
+ export type ContentCardHeadingLevel = 'h1' | 'h2' | 'h3' | 'h4' | 'h5' | 'h6';
3
+ export type ContentCardMediaKind = 'image' | 'logo';
4
+ export type ContentCardMediaWidth = '1/3' | '1/2';
5
+ export type ContentCardMediaPosition = 'start' | 'end';
6
+ export type ContentCardAppearance = 'plain' | 'border' | 'elevated';
7
+ /**
8
+ * Approved logo-area background colours. Maps to DNA surface tokens; CMS names in
9
+ * parentheses: `white` (White), `sand-*` (Sand / SandE01 / SandE02),
10
+ * `pink-*` (Pink / PinkE01 / PinkE02), `plum-*` (Plum / PlumE01 / PlumE02).
11
+ */
12
+ export type ContentCardLogoBackground = 'white' | 'sand-soft' | 'sand-mid' | 'sand-strong' | 'pink-soft' | 'pink-mid' | 'pink-strong' | 'plum-soft' | 'plum-mid' | 'plum-strong';
13
+ type ContentCardBaseProps = {
14
+ /**
15
+ * Optional media slot (image or logo). The client renders the element and owns
16
+ * `alt`, loading, and optimisation (for example `next/image`). Mark decorative
17
+ * images with an empty `alt`.
18
+ */
19
+ readonly media?: ReactNode;
20
+ /**
21
+ * How the media area is rendered. `logo` centres the media in a 4:3 box over a
22
+ * filled background; `image` fills the area. Ignored when `media` is omitted.
23
+ * @default 'image'
24
+ */
25
+ readonly mediaKind?: ContentCardMediaKind;
26
+ /**
27
+ * Logo-area background colour, limited to approved DNA surface tokens. Only used
28
+ * with `mediaKind="logo"`; defaults to `sand-mid` when omitted.
29
+ */
30
+ readonly mediaBackground?: ContentCardLogoBackground;
31
+ /**
32
+ * Media width in the horizontal layout (1/3 or 1/2 of the card). Ignored in the
33
+ * vertical layout, where media is always full width.
34
+ * @default '1/3'
35
+ */
36
+ readonly mediaWidth?: ContentCardMediaWidth;
37
+ /**
38
+ * Media side in the horizontal layout (logical, RTL-safe). In the vertical
39
+ * layout media is always placed above the content.
40
+ * @default 'start'
41
+ */
42
+ readonly mediaPosition?: ContentCardMediaPosition;
43
+ /**
44
+ * Optional slot above the title for a single small element (for example a
45
+ * `Label`; intended uses: Label, Timestamp, Pretitle).
46
+ */
47
+ readonly titlePrefix?: ReactNode;
48
+ /** Card title. Required. */
49
+ readonly title: ReactNode;
50
+ /**
51
+ * HTML heading level for the title. The consumer owns the document outline.
52
+ * @default 'h3'
53
+ */
54
+ readonly headingLevel?: ContentCardHeadingLevel;
55
+ /**
56
+ * Optional body content. Wrap rich text so it can adopt `dds-prose` styling;
57
+ * pass React nodes rather than HTML strings.
58
+ */
59
+ readonly body?: ReactNode;
60
+ /**
61
+ * Optional actions (0..n `Button`/`IconButton` elements). Laid out in a row that
62
+ * wraps to a column when there is not enough width.
63
+ */
64
+ readonly actions?: ReactNode;
65
+ /**
66
+ * Card surface treatment.
67
+ * @default 'plain'
68
+ */
69
+ readonly appearance?: ContentCardAppearance;
70
+ };
71
+ export interface ContentCardArticleProps extends ContentCardBaseProps, Omit<ComponentPropsWithRef<'article'>, 'title' | 'children'> {
72
+ /**
73
+ * Root element (and role) to render. Use `li` for cards inside a `ul`/`ol`
74
+ * collection, `section` for a standalone page region (becomes a landmark, use
75
+ * sparingly), or `div` when a surrounding element already provides the
76
+ * semantics. The title is still linked as the accessible name via
77
+ * `aria-labelledby` (when not rendering as a generic div).
78
+ * @default 'article'
79
+ */
80
+ readonly as?: 'article';
81
+ }
82
+ export interface ContentCardLiProps extends ContentCardBaseProps, Omit<ComponentPropsWithRef<'li'>, 'title' | 'children'> {
83
+ readonly as: 'li';
84
+ }
85
+ export interface ContentCardSectionProps extends ContentCardBaseProps, Omit<ComponentPropsWithRef<'section'>, 'title' | 'children'> {
86
+ readonly as: 'section';
87
+ }
88
+ export interface ContentCardDivProps extends ContentCardBaseProps, Omit<ComponentPropsWithRef<'div'>, 'title' | 'children'> {
89
+ readonly as: 'div';
90
+ }
91
+ /**
92
+ * Props for the Content card. The `as` prop selects the root element and narrows
93
+ * the element-specific HTML attributes accordingly.
94
+ */
95
+ export type ContentCardProps = ContentCardArticleProps | ContentCardLiProps | ContentCardSectionProps | ContentCardDivProps;
96
+ /** Allowed root elements, derived from the props union. */
97
+ export type ContentCardElement = NonNullable<ContentCardProps['as']>;
98
+ export {};
99
+ //# sourceMappingURL=ContentCard.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ContentCard.types.d.ts","sourceRoot":"","sources":["../../../src/components/ContentCard/ContentCard.types.ts"],"names":[],"mappings":"AAAA,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S,CAAC;IAC7B;;;OAGG;IACH,QAAQ,CAAC,UAAU,CAAC,EAAE,qBAAqB,CAAC;CAC/C,CAAC;AAEF,MAAM,WAAW,uBACb,SAAQ,oBAAoB,EAAE,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC1F;;;;;;;OAOG;IACH,QAAQ,CAAC,EAAE,CAAC,EAAE,SAAS,CAAC;CAC3B;AAED,MAAM,WAAW,kBACb,SAAQ,oBAAoB,EAAE,IAAI,CAAC,qBAAqB,CAAC,IAAI,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IACrF,QAAQ,CAAC,EAAE,EAAE,IAAI,CAAC;CACrB;AAED,MAAM,WAAW,uBACb,SAAQ,oBAAoB,EAAE,IAAI,CAAC,qBAAqB,CAAC,SAAS,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IAC1F,QAAQ,CAAC,EAAE,EAAE,SAAS,CAAC;CAC1B;AAED,MAAM,WAAW,mBACb,SAAQ,oBAAoB,EAAE,IAAI,CAAC,qBAAqB,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,UAAU,CAAC;IACtF,QAAQ,CAAC,EAAE,EAAE,KAAK,CAAC;CACtB;AAED;;;GAGG;AACH,MAAM,MAAM,gBAAgB,GACtB,uBAAuB,GACvB,kBAAkB,GAClB,uBAAuB,GACvB,mBAAmB,CAAC;AAE1B,2DAA2D;AAC3D,MAAM,MAAM,kBAAkB,GAAG,WAAW,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC"}
@@ -0,0 +1,3 @@
1
+ export { ContentCard } from './ContentCard';
2
+ export type { ContentCardAppearance, ContentCardArticleProps, ContentCardDivProps, ContentCardElement, ContentCardHeadingLevel, ContentCardLiProps, ContentCardLogoBackground, ContentCardMediaKind, ContentCardMediaPosition, ContentCardMediaWidth, ContentCardProps, ContentCardSectionProps, } from './ContentCard.types';
3
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/ContentCard/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,YAAY,EACR,qBAAqB,EACrB,uBAAuB,EACvB,mBAAmB,EACnB,kBAAkB,EAClB,uBAAuB,EACvB,kBAAkB,EAClB,yBAAyB,EACzB,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,gBAAgB,EAChB,uBAAuB,GAC1B,MAAM,qBAAqB,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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