@odx/foundation 1.0.0-beta.99 → 1.0.0-rc.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 (170) hide show
  1. package/CHANGELOG.md +335 -0
  2. package/README.md +61 -29
  3. package/dist/lib/breakpoints.d.ts +61 -0
  4. package/dist/lib/breakpoints.js +139 -0
  5. package/dist/lib/format.d.ts +58 -0
  6. package/dist/lib/format.js +63 -0
  7. package/dist/lib/localization.d.ts +12 -0
  8. package/dist/lib/localization.js +28 -0
  9. package/dist/lib/models.d.ts +39 -0
  10. package/dist/lib/models.js +34 -0
  11. package/dist/lib/signals.d.ts +20 -0
  12. package/dist/lib/signals.js +47 -0
  13. package/dist/lib/theming.d.ts +18 -0
  14. package/dist/lib/theming.js +38 -0
  15. package/dist/lib/utils/breakpoint.d.ts +38 -0
  16. package/dist/lib/utils/breakpoint.js +103 -0
  17. package/dist/lib/utils/shared-media-observer.d.ts +4 -0
  18. package/dist/lib/utils/shared-media-observer.js +43 -0
  19. package/dist/main.d.ts +7 -0
  20. package/dist/main.js +5 -1227
  21. package/dist/oss-licenses.json +1 -0
  22. package/dist/styles.css +1 -1
  23. package/package.json +27 -50
  24. package/dist/_virtual_class-decorator-runtime.js +0 -13
  25. package/dist/components/accordion/accordion.d.ts +0 -25
  26. package/dist/components/accordion-item/accordion-item.d.ts +0 -26
  27. package/dist/components/accordion-panel/accordion-panel.d.ts +0 -13
  28. package/dist/components/action-button/action-button.d.ts +0 -27
  29. package/dist/components/anchor-navigation/anchor-navigation.d.ts +0 -21
  30. package/dist/components/anchor-navigation/anchor-observer.d.ts +0 -11
  31. package/dist/components/anchor-navigation/index.d.ts +0 -3
  32. package/dist/components/area-header/area-header.d.ts +0 -21
  33. package/dist/components/avatar/avatar.d.ts +0 -36
  34. package/dist/components/avatar-group/avatar-group.d.ts +0 -15
  35. package/dist/components/badge/badge.d.ts +0 -24
  36. package/dist/components/breadcrumbs/breadcrumbs-item.d.ts +0 -17
  37. package/dist/components/breadcrumbs/breadcrumbs.d.ts +0 -21
  38. package/dist/components/breadcrumbs/index.d.ts +0 -3
  39. package/dist/components/button/button.d.ts +0 -54
  40. package/dist/components/button-group/button-group.d.ts +0 -20
  41. package/dist/components/card/card.d.ts +0 -15
  42. package/dist/components/checkbox/checkbox.d.ts +0 -14
  43. package/dist/components/checkbox-group/checkbox-group.d.ts +0 -19
  44. package/dist/components/chip/chip.d.ts +0 -31
  45. package/dist/components/circular-progress-bar/circular-progress-bar.d.ts +0 -49
  46. package/dist/components/combobox/autocomplete.d.ts +0 -23
  47. package/dist/components/content-box/content-box.d.ts +0 -11
  48. package/dist/components/dropdown/dropdown.d.ts +0 -25
  49. package/dist/components/form-field/form-field.d.ts +0 -16
  50. package/dist/components/format/base-format.d.ts +0 -13
  51. package/dist/components/format/format-bytes.d.ts +0 -13
  52. package/dist/components/format/format-date.d.ts +0 -14
  53. package/dist/components/format/format-number.d.ts +0 -20
  54. package/dist/components/format/index.d.ts +0 -6
  55. package/dist/components/format/relative-time.d.ts +0 -21
  56. package/dist/components/header/header-actions.d.ts +0 -10
  57. package/dist/components/header/header.d.ts +0 -14
  58. package/dist/components/header/index.d.ts +0 -3
  59. package/dist/components/headline/headline.d.ts +0 -22
  60. package/dist/components/highlight/highlight.d.ts +0 -23
  61. package/dist/components/icon-button/icon-button.d.ts +0 -14
  62. package/dist/components/image/image.d.ts +0 -34
  63. package/dist/components/inline-message/inline-message.d.ts +0 -28
  64. package/dist/components/input/input.d.ts +0 -27
  65. package/dist/components/kpi/kpi.d.ts +0 -36
  66. package/dist/components/line-clamp/line-clamp.d.ts +0 -12
  67. package/dist/components/link/link.d.ts +0 -11
  68. package/dist/components/list/list.d.ts +0 -15
  69. package/dist/components/list-item/list-item.d.ts +0 -26
  70. package/dist/components/loader.d.ts +0 -2
  71. package/dist/components/loading-overlay/loading-overlay.d.ts +0 -20
  72. package/dist/components/loading-spinner/loading-spinner.d.ts +0 -12
  73. package/dist/components/logo/logo.d.ts +0 -21
  74. package/dist/components/main-menu/index.d.ts +0 -6
  75. package/dist/components/main-menu/main-menu-button.d.ts +0 -12
  76. package/dist/components/main-menu/main-menu-link.d.ts +0 -9
  77. package/dist/components/main-menu/main-menu-subtitle.d.ts +0 -12
  78. package/dist/components/main-menu/main-menu-title.d.ts +0 -12
  79. package/dist/components/main-menu/main-menu.d.ts +0 -17
  80. package/dist/components/main.d.ts +0 -72
  81. package/dist/components/menu/index.d.ts +0 -3
  82. package/dist/components/menu/menu-label.d.ts +0 -9
  83. package/dist/components/menu/menu.d.ts +0 -21
  84. package/dist/components/menu-item/menu-item.d.ts +0 -14
  85. package/dist/components/modal/modal.d.ts +0 -37
  86. package/dist/components/navigation-item/navigation-item.d.ts +0 -22
  87. package/dist/components/option/option.d.ts +0 -11
  88. package/dist/components/page/page.d.ts +0 -27
  89. package/dist/components/page-layout/page-layout.d.ts +0 -11
  90. package/dist/components/pagination/pagination.d.ts +0 -32
  91. package/dist/components/popover/popover-host.d.ts +0 -35
  92. package/dist/components/popover/popover-observer.d.ts +0 -11
  93. package/dist/components/popover/popover.d.ts +0 -13
  94. package/dist/components/progress-bar/progress-bar.d.ts +0 -30
  95. package/dist/components/radio-button/radio-button.d.ts +0 -13
  96. package/dist/components/radio-group/radio-group.d.ts +0 -16
  97. package/dist/components/rail-navigation/rail-navigation.d.ts +0 -19
  98. package/dist/components/search-bar/index.d.ts +0 -3
  99. package/dist/components/search-bar/search-bar.d.ts +0 -33
  100. package/dist/components/search-bar/search-bar.events.d.ts +0 -7
  101. package/dist/components/select/select.d.ts +0 -26
  102. package/dist/components/separator/separator.d.ts +0 -21
  103. package/dist/components/skeleton/skeleton.d.ts +0 -31
  104. package/dist/components/slider/index.d.ts +0 -5
  105. package/dist/components/slider/slider-handle.d.ts +0 -28
  106. package/dist/components/slider/slider-marks.d.ts +0 -16
  107. package/dist/components/slider/slider.d.ts +0 -26
  108. package/dist/components/slider/slider.models.d.ts +0 -29
  109. package/dist/components/spacer/spacer.d.ts +0 -13
  110. package/dist/components/spinbox/spinbox.d.ts +0 -23
  111. package/dist/components/stack/stack.d.ts +0 -38
  112. package/dist/components/status/status.d.ts +0 -23
  113. package/dist/components/switch/switch.d.ts +0 -12
  114. package/dist/components/table/index.d.ts +0 -9
  115. package/dist/components/table/table-body.d.ts +0 -12
  116. package/dist/components/table/table-cell.d.ts +0 -12
  117. package/dist/components/table/table-checkbox-cell.d.ts +0 -19
  118. package/dist/components/table/table-header-cell.d.ts +0 -13
  119. package/dist/components/table/table-header.d.ts +0 -14
  120. package/dist/components/table/table-row.d.ts +0 -20
  121. package/dist/components/table/table.d.ts +0 -20
  122. package/dist/components/table/table.models.d.ts +0 -10
  123. package/dist/components/text/text.d.ts +0 -33
  124. package/dist/components/title/title.d.ts +0 -22
  125. package/dist/components/toast/toast.d.ts +0 -24
  126. package/dist/components/toggle-button/toggle-button.d.ts +0 -13
  127. package/dist/components/toggle-button-group/toggle-button-group.d.ts +0 -10
  128. package/dist/components/toggle-content/toggle-content.d.ts +0 -12
  129. package/dist/components/tooltip/tooltip.d.ts +0 -37
  130. package/dist/components/translate/translate.d.ts +0 -16
  131. package/dist/components/visually-hidden/visually-hidden.d.ts +0 -11
  132. package/dist/components.js +0 -4493
  133. package/dist/i18n/config.d.ts +0 -32
  134. package/dist/i18n/format.d.ts +0 -6
  135. package/dist/i18n/is-localized.d.ts +0 -15
  136. package/dist/i18n/localization.d.ts +0 -5
  137. package/dist/i18n/main.d.ts +0 -7
  138. package/dist/i18n/models.d.ts +0 -7
  139. package/dist/i18n/translate.d.ts +0 -11
  140. package/dist/i18n.js +0 -145
  141. package/dist/lib/control/checkbox-form-control.d.ts +0 -16
  142. package/dist/lib/control/checkbox-group-form-control.d.ts +0 -23
  143. package/dist/lib/control/form-control.d.ts +0 -30
  144. package/dist/lib/control/listbox-form-control.d.ts +0 -26
  145. package/dist/lib/control/number-form-control.d.ts +0 -13
  146. package/dist/lib/control/option-control.d.ts +0 -24
  147. package/dist/lib/control/radio-group-form-control.d.ts +0 -22
  148. package/dist/lib/controllers/active-descendants-controller.d.ts +0 -29
  149. package/dist/lib/controllers/drag.controller.d.ts +0 -19
  150. package/dist/lib/controllers/expandable-controller.d.ts +0 -17
  151. package/dist/lib/custom-element.d.ts +0 -16
  152. package/dist/lib/interactive/interactive-element.d.ts +0 -23
  153. package/dist/lib/interactive/interactive-link.d.ts +0 -21
  154. package/dist/lib/main.d.ts +0 -28
  155. package/dist/lib/mixins/can-be-disabled.d.ts +0 -7
  156. package/dist/lib/mixins/can-be-expanded.d.ts +0 -10
  157. package/dist/lib/mixins/is-draggable.d.ts +0 -16
  158. package/dist/lib/models/drag-event.d.ts +0 -9
  159. package/dist/lib/models/placement.d.ts +0 -17
  160. package/dist/lib/models/shape.d.ts +0 -7
  161. package/dist/lib/models/size.d.ts +0 -11
  162. package/dist/lib/models/variant.d.ts +0 -12
  163. package/dist/lib/utils/compute-popover-placement.d.ts +0 -14
  164. package/dist/lib/utils/dom.d.ts +0 -27
  165. package/dist/lib/utils/get-unique-id.d.ts +0 -19
  166. package/dist/lib/utils/lit.d.ts +0 -4
  167. package/dist/lib/utils/shared-resize-observer.d.ts +0 -11
  168. package/dist/lib/utils/types.d.ts +0 -60
  169. package/dist/loader.js +0 -7
  170. package/dist/vendor.js +0 -1982
package/CHANGELOG.md ADDED
@@ -0,0 +1,335 @@
1
+ ## 1.0.0-rc.0
2
+
3
+ ### Major Changes
4
+
5
+ - Move components into `@odx/web-components` library, please follow the setup instructions to ensure a smooth transition to the new package structure
6
+ - Remove spacing CSS utility classes for internal spacing tokens (12, 25, 37, etc...) to prevent usage of non-standard spacing values, use `odx-spacing-sm|md|lg` instead
7
+ - Remove `@odx/foundation/i18n` entry point, use `@odx/foundation` to import localization utilities instead
8
+ - Rename `setI18nOptions` to `setLocalizationOptions`
9
+ - Rename `getI18nOptions` to `getLocalizationOptions`
10
+ - Rename `I18nOptions` to `LocalizationOptions`
11
+ -
12
+ ### Minor Changes
13
+
14
+ - Add `odx-width-sm|md|lg|xl` CSS utility classes for common layout width
15
+ - Add `odx-text-*` CSS utility classes for common text colors
16
+ - Add `xxl` breakpoint for better support of large screens
17
+ - Improved `<a>` and `.odx-link` styling for better readability and accessibility
18
+
19
+ ## 1.0.0-beta.276
20
+
21
+ ### Major Changes
22
+
23
+ - Remove `odx-accordion-panel` component, use default slot of `odx-accordion-item` instead:
24
+
25
+ ```html
26
+ <odx-accordion-item label="Accordion Label">
27
+ Accordion Item Content
28
+ </odx-accordion-item>
29
+ ```
30
+
31
+ With custom label:
32
+
33
+ ```html
34
+ <odx-accordion-item >
35
+ <odx-title>Custom Accordion Label</odx-title>
36
+ Accordion Item Content
37
+ </odx-accordion-item>
38
+ ```
39
+
40
+ ### Bug Fixes
41
+
42
+ - Fix `aria-expanded` attribute not updating correctly on `odx-accordion-item` component
43
+ - Fix nested `odx-accordion` not collapsing when parent item is collapsed
44
+ - Fix cursor style when `odx-accordion-item` is in loading state
45
+ - Fix expandable controller not detecting nested controls correctly
46
+ - Fix dialog commands handling foreign dialog commands by mistake
47
+ - Fix `odx-dialog` dismiss behavior when clicking inside another dialog
48
+
49
+
50
+ ## 1.0.0-beta.275
51
+
52
+ ### Minor Changes
53
+
54
+ - Use `DraegerPangea` for headline `xl`, `xxl` and `display` sizes
55
+
56
+
57
+ ## 1.0.0-beta.274
58
+
59
+ ### Minor Changes
60
+
61
+ - Add `disabled` state colors for `warning` and `danger` variants of `odx-list-item`
62
+ - Remove `--size` CSS property from `odx-avatar`, use `width` instead
63
+
64
+ #### Experimental Features
65
+
66
+ - Add `confirmation` variant to `odx-button`, `odx-icon-button`, and `odx-action-button` and `odx-inline-message` components
67
+
68
+ ### Bug Fixes
69
+
70
+ - Hide labels when `odx-rail-navigation` is collapsed
71
+ - Use correct background color for content of `odx-dropdown` and `odx-menu` components
72
+ - Fix expandable controller nested control detection
73
+ - Fix list separator visibility in `odx-list` component
74
+ - Adjust prefix/suffix icon placement in control elements of size `lg` to align with nested controls
75
+
76
+
77
+ ## 1.0.0-beta.273
78
+
79
+ ### Major Changes
80
+
81
+ - Remove `layout` property from `odx-checkbox-group` and `odx-radio-group`, use CSS flexbox styles for layout customization instead
82
+ - Refactored `odx-key-value` in order to be responsive
83
+
84
+ ### Minor Changes
85
+
86
+ - Revert touch target implementation due to overflow issues in certain components
87
+ - Improve `odx-key-value` layout styles
88
+ - Add `striped` property to `odx-key-value-list` component to enable striped background for better readability
89
+ - Add `prefix` and `suffix` slots to horizontal `odx-tab-bar` component to allow adding elements before/after the tab items
90
+ - Add `top` placement option to `odx-drawer` component
91
+
92
+ ### Bug Fixes
93
+
94
+ - Fix `odx-scroll-container` focus outline
95
+ - Fix disabled background for `danger-ghost` variant of `odx-button` component
96
+ - Prevent `expand` event if nested control is clicked
97
+ - Add `[data-odx-control]` directive to `odx-button-group` to fix positioning in other controls
98
+
99
+ ## 1.0.0-beta.272
100
+
101
+ ### Major Changes
102
+
103
+ - Move component behavior utilities and controllers into `@odx/foundation/components` entry point
104
+ - Remove entry point `@odx/foundation/utils`, use root entry point `@odx/foundation` to import utilities instead
105
+ - Remove `type` property from `odx-loading-spinner`
106
+
107
+ ### Minor Changes
108
+
109
+ - Add `odx-loading-dots` component
110
+ - Remove obsolete backdrop element from `odx-loading-overlay`
111
+ - Add padding to `odx-loading-spinner` to align spinner size with icon sizes
112
+
113
+ ### Bug Fixes
114
+
115
+ - Align `odx-accordion-item` indicator size with design spec for size `lg`
116
+ - Align `odx-avatar` with design spec
117
+ - Remove `min-width` from `odx-area-header` side slots
118
+ - Use touch-target of `36px` due to overflow issues
119
+
120
+ ## 1.0.0-beta.271
121
+
122
+ ### Bug Fixes
123
+
124
+ - Fix `odx-area-header` base slot positioning and overflow issues
125
+ - Fix `odx-loading-overlay` not hiding correctly when `loading` is set to `false`
126
+
127
+
128
+ ## 1.0.0-beta.270
129
+
130
+ ### Major Changes
131
+
132
+ - Remove `odx-search-bar` component, use `odx-input` with `type="search"` instead
133
+ - Remove `alignment` from `odx-area-header`
134
+ - Remove `warning` variant from button-like components, affected components:
135
+ - `odx-button`
136
+ - `odx-icon-button`
137
+ - `odx-action-button`
138
+ - Align breakpoint names and values with Figma:
139
+ - Add `xl` (991px - 1281px)
140
+ - Change `mobile` to `sm` (0 - 480px)
141
+ - Change `tablet` to `md` (480 - 769px)
142
+ - Change `desktop` to `lg` (769px - 991px)
143
+
144
+ ### Minor Changes
145
+
146
+ - Always capitalize first letter of button-like components, affected components:
147
+ - `odx-button`
148
+ - `odx-icon-button`
149
+ - `odx-action-button`
150
+ - Add search icon to `odx-input` when `type="search"` and forward search event based on `behavior` and `debounce` properties
151
+ - Add `backdrop-inverse` property to `odx-loading-overlay` component to use inverse backdrop color
152
+ - Rename default slot of `odx-loading-overlay` to `spinner` to prevent empty slot bug
153
+ - Remove `size="sm"` from `odx-header`, use `size="md"` instead
154
+ - Make control labels available to customization via CSS parts API: `::part(label)`
155
+ - Inline `odx-logo` resources to reduce number of network requests
156
+ - Simplify `odx-key-value` styles for better customization
157
+ - Add `--safe-space` CSS custom property to `odx-area-header` to control minimum space taken by base slot
158
+ - Improve `odx-slider-handle` accessibility and UI feedback during drag interaction
159
+
160
+ ### Bug Fixes
161
+
162
+ - Update design token library
163
+ - Fix area header prefix/suffix alignment issue
164
+ - Fix `odx-area-header` layout issue when used in combination with `odx-action-group`
165
+ - Fix focus state inner outline for `odx-checkbox`, `odx-radio-button`, and `odx-switch` in checked state
166
+ - Fix `odx-toolbar` spacing and overflow issues
167
+ - Fix `odx-list-item` separator for `danger` and `warning` variants and `:hover` state
168
+ - Fix `odx-input` placeholder color
169
+ - Fix `odx-input` and `odx-select` overflow causing missing border-radius
170
+ - Fix inline-start spacing of `odx-logo` slotted into `odx-area-header`
171
+
172
+
173
+ ## 1.0.0-beta.269
174
+
175
+ ### Major Changes
176
+
177
+ - Enable `odx-tooltip` on touch devices by default, use `touch-disabled` to disable it
178
+ - Rename `indicator-placement` to `control-placement`, affected components:
179
+ - `odx-checkbox`
180
+ - `odx-radio-button`
181
+ - `odx-switch`
182
+
183
+ - Rename `hover-only` to `click-disabled`, affected components:
184
+ - `odx-tooltip`
185
+
186
+ ### Minor Changes
187
+
188
+ - Add touch targets of `40px` to interactive elements for better accessibility on touch devices
189
+ - Add `touch-disabled` to `odx-tooltip` to disable it on touch devices
190
+
191
+
192
+ ### Bug Fixes
193
+
194
+ - Fix `odx-rail-navigation` transition animation when expanding/collapsing
195
+ - Fix cursor styles for `odx-checkbox`, `odx-radio-button`, and `odx-switch` when disabled
196
+ - Add missing box-shadow to `odx-tile` interactive-selected state
197
+ - Prevent `:hover` styles to be applied on parent control if a child interactive element is hovered
198
+
199
+
200
+ ## 1.0.0-beta.268
201
+
202
+ ### Bug Fixes
203
+
204
+ - Only apply `:hover` styles on non-touch devices to prevent sticky hover states
205
+
206
+
207
+ ## 1.0.0-beta.267
208
+
209
+ ### Minor Changes
210
+
211
+ - Remove HTML `part` attribute if not needed to reduce shadow DOM complexity
212
+
213
+ ### Bug Fixes
214
+
215
+ - Disable native touch interaction feedback on elements which have an `:active` state
216
+ - Fix nested control spacing issue
217
+ - Fix tabindex issue when `odx-checkbox-group` and `odx-radio-group` become enabled
218
+ - Fix remove event not firing on `odx-chip` component
219
+
220
+ ### Misc
221
+
222
+ - Cleanup component templates and styles to reduce shadow DOM complexity
223
+
224
+
225
+ ## 1.0.0-beta.266
226
+
227
+ ### Major Changes
228
+
229
+ - Rename `indicator-position` to `indicator-placement`, affected components:
230
+ - `odx-accordion`
231
+ - `odx-checkbox`
232
+ - `odx-radio`
233
+ - `odx-switch`
234
+ -
235
+ - Rename `position` property to `placement` in dialog related components:
236
+ - `odx-dialog`
237
+ - `odx-drawer`
238
+ - Rename `badge-position` to `badge-placement` in button related component
239
+
240
+ ### Minor Changes
241
+
242
+ - Add `odx-sheet` component
243
+ - Add `bottom` placement option to `odx-drawer`
244
+
245
+
246
+ ### Bug Fixes
247
+
248
+ - Fix `odx-card` outer spacing
249
+ - Fix modal styles
250
+
251
+ ## 1.0.0-beta.265
252
+
253
+ ### Minor Changes
254
+
255
+ - Add `debounce` property to `odx-input` and `odx-search-bar` components to control input event debouncing
256
+
257
+ ### Bug Fixes
258
+
259
+ - Disable `:hover` styles on touch devices to prevent sticky hover states
260
+ - Dedupe mixins to prevent multiple instances of the same mixin being applied
261
+ - Make `odx-content` available in shadow DOM
262
+ - Ensuring consistent tap highlight styling across components
263
+ - Adds active state styling to slotted links within breadcrumbs
264
+ - Focus `odx-input` on password reveal
265
+
266
+ ## 1.0.0-beta.264
267
+
268
+ ### Bug Fixes
269
+
270
+ - Fix `odx-input-number` not emitting change event with updated value
271
+
272
+
273
+ ## 1.0.0-beta.263
274
+
275
+ ### Bug Fixes
276
+
277
+ - Fix `odx-input` resize issue
278
+ - Fix `odx-input-number` not updating value to boundaries on step up/down
279
+ - Fix value selection issue in `odx-input` component
280
+ - Inject correct `ResizeObserverEntry` into `ResizeObserver` callbacks of global observers
281
+
282
+
283
+ ## 1.0.0-beta.262
284
+
285
+ ### Minor Changes
286
+
287
+ - Update selected options label for multi selection in `odx-select` component to match design spec
288
+
289
+ ### Bug Fixes
290
+
291
+ - Fix modal dismiss event firing on text selection by accident
292
+ - Fix `odx-input` value not updating correctly
293
+
294
+
295
+ ## 1.0.0-beta.261
296
+
297
+ ### Bug Fixes
298
+
299
+ - Fix `odx-input` type attribute not updating correctly
300
+
301
+
302
+ ## 1.0.0-beta.260
303
+
304
+ ### Major Changes
305
+
306
+ - Remove generic from `FormAssociated` mixin due to issues with type inference in certain scenarios
307
+ - Remove `--_min-width` custom property from control elements, use `min-width` property instead
308
+
309
+ ### Minor Changes
310
+
311
+ - New `odx-input-number` component
312
+ - Improve `odx-input` component accessibility and flexibility
313
+ - Add input `loading` state
314
+ - Add auto sizing behavior for input controls
315
+ - Remove CSS parts from `odx-loading-overlay` component
316
+
317
+ ### Bug Fixes
318
+
319
+ - Fix positioning of clear action in `odx-input` and `odx-select` components
320
+ - Move `[loading]` styles into button control to prevent leakage to other components
321
+
322
+
323
+ ## 1.0.0-beta.259
324
+
325
+ ### Minor Changes
326
+
327
+ - Bump `@odx/design-tokens` dependency to `^3.1.0`
328
+ - Replace object and math utilities by `es-toolkit/*` equivalents
329
+ - Bump `@odx/icons` dependency to `^4.2.0`
330
+ - Use `font-size` property instead of `--size` custom property for icon sizing
331
+
332
+ ### Bug Fixes
333
+
334
+ - Fix checkbox control updated hook not calling parent hook
335
+ - Ensure context API is always used in a root context
package/README.md CHANGED
@@ -1,59 +1,91 @@
1
1
 
2
2
  # @odx/foundation
3
3
 
4
- The `@odx/foundation` package is a core part of the ODX Design System, providing essential building blocks for creating consistent and cohesive user interfaces. This package includes foundational components, styles, and utilities to ensure a unified design across all ODX projects.
4
+ The `@odx/foundation` package provides the foundational tokens and styles that are needed to build applications and websites consistent with the ODX Design System.
5
+ It includes a comprehensive CSS framework, global styles, and utility classes to help you create visually appealing and user-friendly interfaces.
5
6
 
6
7
  ### Features
7
8
 
8
- - **Components**: Reusable web components, including buttons, tables, headers, and more.
9
- - **i18n**: Internationalization utilities for building multilingual applications, with support for locale changes and translations.
10
- - **Global Styles**: Comprehensive global styles, including colors, spacing, and themes.
11
-
12
- ### Prerequisites
9
+ - **Foundational Styles**: Comprehensive global styles, including colors, spacing, and themes.
10
+ - **CSS Framework**: A comprehensive CSS framework that includes layout, typography, and utility classes to streamline styling and ensure consistency
11
+ - **Breakpoint System**: A responsive breakpoint system to create adaptable layouts across various devices.
12
+ - **Dark Mode Support**: Built-in dark mode support for better user experience in low-light environments.
13
+ - **Localization**: Localization utilities to manage localization and language preferences in your application.
14
+ - **Browser Support**: <a href="https://web-platform-dx.github.io/web-features/supported-browsers/?targetYear=2024" target="_blank">Baseline 2024</a>
13
15
 
14
16
  ### Install
15
17
 
16
18
  [<img alt="NPM Version (with dist tag)" src="https://img.shields.io/npm/v/%40odx%2Ffoundation/latest?style=flat-square">](https://npmjs.org/package/@odx/foundation)
17
19
 
18
-
19
- To install `@odx/foundation` and it's peer dependencies in your project, run the following command:
20
+ ##### PNPM
20
21
 
21
22
  ```bash
22
- npm install @odx/design-tokens @odx/foundation @odx/icons@next --save
23
+ pnpm add @odx/foundation @odx/design-tokens
23
24
  ```
25
+ ##### NPM
24
26
 
25
- > We depend on the <a href="https://lit.dev" target="_blank" rel="noopener">**Lit package**</a> for building web elements because it offers a lightweight, efficient framework with a simple syntax for creating fast, reusable elements. Its powerful templating system ensures high performance and seamless user experience. Lit is also highly interoperable, making it easy to integrate with other frameworks and libraries.
26
- >
27
- > [<img src="https://img.shields.io/npm/dependency-version/@odx/foundation/lit" />](https://npmjs.org/package/lit)
28
-
27
+ ```bash
28
+ npm i @odx/foundation @odx/design-tokens --save
29
+ ```
29
30
 
30
31
  ### Setup
31
32
 
32
- > Ensure that you have followed the installation and setup instructions for our [**design tokens**](https://npmjs.org/package/@odx/design-tokens) library.
33
+ Once installed, you can import the baseline styles into your project:
33
34
 
34
- Once installed, you can import the foundational components and styles into your project:
35
+ ##### JavaScript
35
36
 
36
37
  ```js
37
- // Load core icons
38
- import '@odx/icons';
39
- import '@odx/icons/core';
38
+ /* Load global fonts and styles (in JS) */
39
+ import '@odx/design-tokens/css';
40
+ import '@odx/design-tokens/fonts';
40
41
 
41
- // Load components
42
- import '@odx/foundation/loader';
42
+ import '@odx/foundation/styles';
43
+ ```
44
+
45
+ ##### CSS
43
46
 
44
- // Load styles (in JS)
45
- import '@odx/foundation/styles'; // JS
47
+ ```css
48
+ /* Load global fonts and styles (in CSS) */
49
+ @import "@odx/design-tokens/fonts"; /* @odx/design-tokens/assets/fonts.css */
50
+ @import "@odx/design-tokens/css"; /* @odx/design-tokens/dist/tokens.css */
46
51
 
52
+ @import "@odx/foundation/styles"; /* @odx/foundation/dist/styles.css */
47
53
  ```
48
54
 
49
- ```css
50
- // Load styles (in CSS)
51
- @import '@odx/foundation/dist/styles.css';
55
+ ##### HTML
56
+
57
+ In order for the baseline styles to apply, you have to add the `odx-root` to the `html` element of your application.
58
+
59
+ ```html
60
+ <html class="odx-root">
61
+ ...
62
+ </html>
63
+
64
+
65
+ <!--
66
+ If you are using ODX in a 3rd party context,
67
+ you have to add the `odx-root` class to the container element.
68
+ -->
69
+ <div class="odx-root">
70
+ ...
71
+ </div>
52
72
  ```
53
73
 
54
- ### Documentation
74
+ ### Theming
75
+
76
+ The `@odx/foundation` package provides built-in support for light and dark modes. You can easily switch between modes using the `setTheme` function:
55
77
 
56
- For detailed documentation on how to use the `@odx/foundation` package, including examples and best practices, please visit our <a href="https://odx.draeger.com" target="_blank" rel="noopener">**documentation**</a>.
78
+ ```js
79
+ import { setTheme } from '@odx/foundation';
80
+
81
+ setTheme({
82
+ // Set the color mode (light, dark, or auto)
83
+ mode: 'light' | 'dark' | 'auto',
84
+ // Enables/Disables European Accessibility Act compliant color contrasts
85
+ eaaConformity: 'on' | 'off',
86
+ });
87
+ ```
88
+
89
+ ### Documentation
57
90
 
58
- ### Contact
59
- For questions, feedback, or support, please reach out to us through our <a href="https://odx.draeger.com/contact" target="_blank" rel="noopener">**contact page**</a>.
91
+ For detailed documentation on how to use the `@odx/foundation` package, including examples and best practices, please visit our <a href="https://ca-odx-storybook-dev.yellowisland-7b13f2d7.westeurope.azurecontainerapps.io/" target="_blank" rel="noopener">storybook documentation</a>.
@@ -0,0 +1,61 @@
1
+ import { Signal } from './signals.js';
2
+ declare global {
3
+ namespace ODX.Breakpoints {
4
+ interface Config {
5
+ sm: true;
6
+ md: true;
7
+ lg: true;
8
+ xl: true;
9
+ xxl: true;
10
+ }
11
+ }
12
+ }
13
+ type FilteredKeys<T extends object> = {
14
+ [K in keyof T as T[K] extends true ? K : never]: T[K];
15
+ };
16
+ export type BreakpointOperator = '<' | '<=' | '>=' | '>';
17
+ export interface BreakpointConfig {
18
+ name: keyof FilteredKeys<ODX.Breakpoints.Config>;
19
+ min: number;
20
+ max: number;
21
+ customQuery?: string;
22
+ }
23
+ export interface Breakpoint extends BreakpointConfig {
24
+ id: BreakpointConfig['name'] | `${BreakpointOperator}${BreakpointConfig['name']}`;
25
+ query: string;
26
+ operator?: BreakpointOperator;
27
+ }
28
+ export declare const registeredBreakpoints: ReadonlyMap<Breakpoint['id'], Breakpoint>;
29
+ export declare const breakpointAttribute = "odx-breakpoint";
30
+ export declare const defaultBreakpoints: [{
31
+ readonly name: "sm";
32
+ readonly min: 0;
33
+ readonly max: 479.98;
34
+ }, {
35
+ readonly name: "md";
36
+ readonly min: 480;
37
+ readonly max: 768.98;
38
+ }, {
39
+ readonly name: "lg";
40
+ readonly min: 769;
41
+ readonly max: 990.98;
42
+ }, {
43
+ readonly name: "xl";
44
+ readonly min: 991;
45
+ readonly max: 1280.98;
46
+ }, {
47
+ readonly name: "xxl";
48
+ readonly min: 1352;
49
+ readonly max: number;
50
+ }];
51
+ export declare function buildBreakpoint(breakpoint: BreakpointConfig, operator?: BreakpointOperator): Breakpoint;
52
+ export declare function expandBreakpoints(...breakpoints: BreakpointConfig[]): Breakpoint[];
53
+ export declare function observeBreakpoint(id: Breakpoint['id'], initialValue?: boolean): Signal<Breakpoint & {
54
+ matches: boolean;
55
+ }>;
56
+ export declare function setupBreakpoints(breakpointsConfig?: BreakpointConfig[]): () => void;
57
+ export declare function createBreakpointUpdater(breakpoints: Breakpoint[], update?: (target: HTMLElement, change: Breakpoint & {
58
+ matches: boolean;
59
+ }) => void): () => void;
60
+ export {};
61
+ //# sourceMappingURL=breakpoints.d.ts.map
@@ -0,0 +1,139 @@
1
+ import { signal, effect } from './signals.js';
2
+ import { observeMedia } from './utils/shared-media-observer.js';
3
+
4
+ const operators = ["<", "<=", ">=", ">"];
5
+ const registeredBreakpoints = /* @__PURE__ */ new Map();
6
+ const breakpointAttribute = "odx-breakpoint";
7
+ const defaultBreakpoints = [
8
+ { name: "sm", min: 0, max: 479.98 },
9
+ { name: "md", min: 480, max: 768.98 },
10
+ { name: "lg", min: 769, max: 990.98 },
11
+ { name: "xl", min: 991, max: 1280.98 },
12
+ { name: "xxl", min: 1352, max: Number.MAX_SAFE_INTEGER }
13
+ ];
14
+ function buildBreakpoint(breakpoint, operator) {
15
+ const id = operator ? `${operator}${breakpoint.name}` : breakpoint.name;
16
+ let query = `(min-width: ${breakpoint.min}px) and (max-width: ${breakpoint.max}px)`;
17
+ switch (operator) {
18
+ case "<":
19
+ query = `(max-width: ${breakpoint.min - 0.02}px)`;
20
+ break;
21
+ case "<=":
22
+ query = `(max-width: ${breakpoint.max}px)`;
23
+ break;
24
+ case ">=":
25
+ query = `(min-width: ${breakpoint.min}px)`;
26
+ break;
27
+ case ">":
28
+ query = `(min-width: ${breakpoint.max + 0.02}px)`;
29
+ break;
30
+ }
31
+ return { ...breakpoint, id, operator, query: [query, breakpoint.customQuery].filter(Boolean).join(" and ") };
32
+ }
33
+ function expandBreakpoints(...breakpoints) {
34
+ return breakpoints.flatMap((breakpoint) => [void 0, ...operators].map((operator) => buildBreakpoint(breakpoint, operator)));
35
+ }
36
+ function observeBreakpoint(id, initialValue = false) {
37
+ const breakpoint = registeredBreakpoints.get(id);
38
+ let unobserveMedia;
39
+ const state = signal(
40
+ { ...breakpoint, matches: initialValue },
41
+ {
42
+ watched() {
43
+ if (!breakpoint) return;
44
+ unobserveMedia = observeMedia(breakpoint.query, ({ matches }) => {
45
+ state.set({ ...breakpoint, matches });
46
+ });
47
+ },
48
+ unwatched() {
49
+ unobserveMedia?.();
50
+ unobserveMedia = void 0;
51
+ }
52
+ }
53
+ );
54
+ return state;
55
+ }
56
+ function setupBreakpoints(breakpointsConfig = []) {
57
+ const breakpoints = expandBreakpoints(...defaultBreakpoints, ...breakpointsConfig);
58
+ const directiveUpdater = createBreakpointUpdater(breakpoints);
59
+ let mutationObserver;
60
+ let unobserveBreakpoints = () => {
61
+ };
62
+ function initBreakpoints() {
63
+ destroyBreakpoints();
64
+ mutationObserver = new MutationObserver(directiveUpdater);
65
+ mutationObserver.observe(document.documentElement, {
66
+ attributes: true,
67
+ subtree: true,
68
+ childList: true,
69
+ attributeFilter: [breakpointAttribute]
70
+ });
71
+ unobserveBreakpoints = effect(directiveUpdater);
72
+ }
73
+ function destroyBreakpoints() {
74
+ unobserveBreakpoints();
75
+ mutationObserver?.disconnect();
76
+ globalThis.removeEventListener("DOMContentLoaded", initBreakpoints);
77
+ }
78
+ if (document.readyState === "loading") {
79
+ globalThis.addEventListener("DOMContentLoaded", initBreakpoints, { once: true });
80
+ } else {
81
+ initBreakpoints();
82
+ }
83
+ return destroyBreakpoints;
84
+ }
85
+ function updateHostElement(host, active) {
86
+ const attributeName = "data-odx-breakpoint-slot";
87
+ const classNames = host.getAttribute("odx-breakpoint-class");
88
+ if (classNames) {
89
+ for (const className of classNames.split(" ")) {
90
+ host.classList.toggle(className, active);
91
+ }
92
+ return;
93
+ }
94
+ host.hidden = !active;
95
+ let initialSlot = host.getAttribute(attributeName);
96
+ if (initialSlot == null) {
97
+ initialSlot = host.slot;
98
+ host.setAttribute(attributeName, initialSlot);
99
+ }
100
+ if (active) {
101
+ host.removeAttribute(attributeName);
102
+ if (initialSlot === "") {
103
+ host.removeAttribute("slot");
104
+ return;
105
+ }
106
+ host.slot = "";
107
+ host.slot = initialSlot;
108
+ } else {
109
+ host.slot = "_odx_breakpoint_hidden";
110
+ }
111
+ }
112
+ function createBreakpointUpdater(breakpoints, update) {
113
+ for (const breakpoint of breakpoints) {
114
+ registeredBreakpoints.set(breakpoint.id, breakpoint);
115
+ }
116
+ const breakpointCache = /* @__PURE__ */ new WeakMap();
117
+ const breakpointObservers = breakpoints.map((breakpoint) => observeBreakpoint(breakpoint.id, false));
118
+ return () => {
119
+ const elements = document.querySelectorAll(`[${breakpointAttribute}]`);
120
+ const changes = breakpointObservers.reduce(
121
+ (breakpoints2, breakpoint) => {
122
+ breakpoints2[breakpoint.get().id] = breakpoint.get();
123
+ return breakpoints2;
124
+ },
125
+ {}
126
+ );
127
+ let i = elements.length;
128
+ while (i--) {
129
+ const element = elements[i];
130
+ const change = changes[element.getAttribute(breakpointAttribute) || ""];
131
+ if (!change || change.matches === breakpointCache.get(element)) continue;
132
+ breakpointCache.set(element, change.matches);
133
+ updateHostElement(element, change.matches);
134
+ update?.(element, change);
135
+ }
136
+ };
137
+ }
138
+
139
+ export { breakpointAttribute, buildBreakpoint, createBreakpointUpdater, defaultBreakpoints, expandBreakpoints, observeBreakpoint, registeredBreakpoints, setupBreakpoints };