@inglorious/ui 8.3.1 → 8.4.1

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 (88) hide show
  1. package/package.json +9 -9
  2. package/src/controls/button/button.stories.js +1 -1
  3. package/src/controls/button/template.js +1 -1
  4. package/src/controls/button-group/button-group.stories.js +1 -1
  5. package/src/controls/button-group/template.js +1 -1
  6. package/src/controls/checkbox/checkbox.stories.js +1 -1
  7. package/src/controls/checkbox/style.css +1 -1
  8. package/src/controls/checkbox/template.js +7 -5
  9. package/src/controls/combobox/combobox.stories.js +1 -1
  10. package/src/controls/combobox/template.js +16 -11
  11. package/src/controls/fab/fab.stories.js +1 -1
  12. package/src/controls/file-upload/file-upload.stories.js +1 -1
  13. package/src/controls/file-upload/template.js +18 -7
  14. package/src/controls/icon-button/icon-button.stories.js +1 -1
  15. package/src/controls/image-cropper/image-cropper.stories.js +1 -1
  16. package/src/controls/input/input.stories.js +1 -1
  17. package/src/controls/input/template.js +16 -8
  18. package/src/controls/radio-group/radio-group.stories.js +1 -1
  19. package/src/controls/radio-group/template.js +8 -6
  20. package/src/controls/rating/rating.stories.js +1 -1
  21. package/src/controls/select/select.stories.js +1 -1
  22. package/src/controls/select/template.js +48 -46
  23. package/src/controls/slider/slider.stories.js +1 -1
  24. package/src/controls/slider/template.js +6 -4
  25. package/src/controls/switch/switch.stories.js +1 -1
  26. package/src/controls/switch/template.js +6 -4
  27. package/src/controls/textarea/template.js +17 -6
  28. package/src/controls/textarea/textarea.stories.js +1 -1
  29. package/src/data-display/avatar/avatar.stories.js +1 -1
  30. package/src/data-display/badge/badge.stories.js +1 -1
  31. package/src/data-display/before-after/before-after.stories.js +1 -1
  32. package/src/data-display/carousel/carousel.stories.js +10 -9
  33. package/src/data-display/chip/chip.stories.js +1 -1
  34. package/src/data-display/data-grid/data-grid.stories.js +11 -11
  35. package/src/data-display/divider/divider.stories.js +1 -1
  36. package/src/data-display/icon/icon-utf8.stories.js +1 -1
  37. package/src/data-display/icon/icon.stories.js +1 -1
  38. package/src/data-display/icon/template.js +1 -1
  39. package/src/data-display/list/list.stories.js +1 -1
  40. package/src/data-display/list/template.js +1 -1
  41. package/src/data-display/table/table.stories.js +1 -1
  42. package/src/data-display/table/template.js +1 -1
  43. package/src/data-display/tooltip/template.js +1 -1
  44. package/src/data-display/tooltip/tooltip.stories.js +1 -1
  45. package/src/data-display/typography/template.js +1 -1
  46. package/src/data-display/typography/typography.stories.js +1 -1
  47. package/src/data-display/virtual-list/template.js +21 -21
  48. package/src/examples/dashboard/before-after-data.js +17 -14
  49. package/src/examples/dashboard/dashboard.stories.js +1 -1
  50. package/src/examples/dashboard/primitive-content.js +32 -30
  51. package/src/examples/dashboard/theme-utils.js +5 -5
  52. package/src/feedback/alert/alert.stories.js +1 -1
  53. package/src/feedback/alert/template.js +1 -1
  54. package/src/feedback/backdrop/backdrop.stories.js +1 -1
  55. package/src/feedback/dialog/dialog.stories.js +1 -1
  56. package/src/feedback/progress/progress.stories.js +1 -1
  57. package/src/feedback/progress/template.js +4 -4
  58. package/src/feedback/skeleton/skeleton.stories.js +1 -1
  59. package/src/feedback/snackbar/snackbar.stories.js +1 -1
  60. package/src/layout/container/container.stories.js +1 -1
  61. package/src/layout/container/template.js +1 -1
  62. package/src/layout/flex/flex.stories.js +1 -1
  63. package/src/layout/flex/template.js +1 -1
  64. package/src/layout/grid/grid.stories.js +1 -1
  65. package/src/navigation/bottom-navigation/bottom-navigation.stories.js +1 -1
  66. package/src/navigation/bottom-navigation/template.js +1 -1
  67. package/src/navigation/breadcrumbs/breadcrumbs.stories.js +1 -1
  68. package/src/navigation/breadcrumbs/template.js +1 -1
  69. package/src/navigation/drawer/drawer.stories.js +1 -1
  70. package/src/navigation/link/link.stories.js +1 -1
  71. package/src/navigation/link/template.js +1 -1
  72. package/src/navigation/menu/menu.stories.js +1 -1
  73. package/src/navigation/menu/template.js +1 -1
  74. package/src/navigation/pagination/pagination.stories.js +1 -1
  75. package/src/navigation/speed-dial/speed-dial.stories.js +1 -1
  76. package/src/navigation/stepper/stepper.stories.js +1 -1
  77. package/src/navigation/tabs/tabs.stories.js +1 -1
  78. package/src/shared/fallback-label.js +18 -0
  79. package/src/surfaces/accordion/accordion.stories.js +1 -1
  80. package/src/surfaces/accordion/template.js +1 -1
  81. package/src/surfaces/app-bar/app-bar.stories.js +1 -1
  82. package/src/surfaces/app-bar/template.js +1 -1
  83. package/src/surfaces/card/card.stories.js +1 -1
  84. package/src/surfaces/card/template.js +1 -1
  85. package/src/surfaces/paper/paper.stories.js +1 -1
  86. package/src/surfaces/paper/template.js +1 -1
  87. package/src/shared/{applyElementProps.js → apply-element-props.js} +27 -27
  88. /package/src/stories/{notifyStory.js → notify-story.js} +0 -0
@@ -8,7 +8,7 @@ import { classMap } from "@inglorious/web/directives/class-map"
8
8
  import { ref } from "@inglorious/web/directives/ref"
9
9
  import { styleMap } from "@inglorious/web/directives/style-map"
10
10
 
11
- import { applyElementProps } from "../../shared/applyElementProps.js"
11
+ import { applyElementProps } from "../../shared/apply-element-props.js"
12
12
 
13
13
  const SIZE_TO_MAX_WIDTH = {
14
14
  xs: "32rem",
@@ -1,6 +1,6 @@
1
1
  import { html } from "@inglorious/web"
2
2
 
3
- import { createRender } from "../../stories/notifyStory.js"
3
+ import { createRender } from "../../stories/notify-story.js"
4
4
  import { Flex } from "."
5
5
 
6
6
  export default {
@@ -7,7 +7,7 @@ import { classMap } from "@inglorious/web/directives/class-map"
7
7
  import { ref } from "@inglorious/web/directives/ref"
8
8
  import { staticHtml, unsafeStatic } from "@inglorious/web/static"
9
9
 
10
- import { applyElementProps } from "../../shared/applyElementProps.js"
10
+ import { applyElementProps } from "../../shared/apply-element-props.js"
11
11
 
12
12
  /**
13
13
  * Renders a flexible layout container with direction, alignment, spacing, and wrap control.
@@ -1,6 +1,6 @@
1
1
  import { html } from "@inglorious/web"
2
2
 
3
- import { createRender } from "../../stories/notifyStory.js"
3
+ import { createRender } from "../../stories/notify-story.js"
4
4
  import { Grid } from "."
5
5
 
6
6
  export default {
@@ -1,4 +1,4 @@
1
- import { createRender } from "../../stories/notifyStory.js"
1
+ import { createRender } from "../../stories/notify-story.js"
2
2
  import { BottomNavigation } from "."
3
3
 
4
4
  export default {
@@ -8,7 +8,7 @@ import { html } from "@inglorious/web"
8
8
  import { classMap } from "@inglorious/web/directives/class-map"
9
9
  import { ref } from "@inglorious/web/directives/ref"
10
10
 
11
- import { applyElementProps } from "../../shared/applyElementProps.js"
11
+ import { applyElementProps } from "../../shared/apply-element-props.js"
12
12
 
13
13
  export const BottomNavigation = {
14
14
  /**
@@ -1,4 +1,4 @@
1
- import { createRender } from "../../stories/notifyStory.js"
1
+ import { createRender } from "../../stories/notify-story.js"
2
2
  import { Breadcrumbs } from "."
3
3
 
4
4
  export default {
@@ -8,7 +8,7 @@ import { html } from "@inglorious/web"
8
8
  import { classMap } from "@inglorious/web/directives/class-map"
9
9
  import { ref } from "@inglorious/web/directives/ref"
10
10
 
11
- import { applyElementProps } from "../../shared/applyElementProps.js"
11
+ import { applyElementProps } from "../../shared/apply-element-props.js"
12
12
 
13
13
  export const Breadcrumbs = {
14
14
  /**
@@ -1,6 +1,6 @@
1
1
  import { html } from "@inglorious/web"
2
2
 
3
- import { createRender } from "../../stories/notifyStory.js"
3
+ import { createRender } from "../../stories/notify-story.js"
4
4
  import { Drawer } from "."
5
5
 
6
6
  export default {
@@ -1,4 +1,4 @@
1
- import { createRender } from "../../stories/notifyStory.js"
1
+ import { createRender } from "../../stories/notify-story.js"
2
2
  import { Link } from "."
3
3
 
4
4
  export default {
@@ -7,7 +7,7 @@ import { html } from "@inglorious/web"
7
7
  import { classMap } from "@inglorious/web/directives/class-map"
8
8
  import { ref } from "@inglorious/web/directives/ref"
9
9
 
10
- import { applyElementProps } from "../../shared/applyElementProps.js"
10
+ import { applyElementProps } from "../../shared/apply-element-props.js"
11
11
 
12
12
  /**
13
13
  * Renders a styled link element with optional underline and color variants.
@@ -1,4 +1,4 @@
1
- import { createRender } from "../../stories/notifyStory.js"
1
+ import { createRender } from "../../stories/notify-story.js"
2
2
  import { Menu } from "."
3
3
 
4
4
  export default {
@@ -8,7 +8,7 @@ import { html } from "@inglorious/web"
8
8
  import { classMap } from "@inglorious/web/directives/class-map"
9
9
  import { ref } from "@inglorious/web/directives/ref"
10
10
 
11
- import { applyElementProps } from "../../shared/applyElementProps.js"
11
+ import { applyElementProps } from "../../shared/apply-element-props.js"
12
12
 
13
13
  export const Menu = {
14
14
  /**
@@ -1,4 +1,4 @@
1
- import { createRender } from "../../stories/notifyStory.js"
1
+ import { createRender } from "../../stories/notify-story.js"
2
2
  import { Pagination } from "."
3
3
 
4
4
  export default {
@@ -1,4 +1,4 @@
1
- import { createRender } from "../../stories/notifyStory.js"
1
+ import { createRender } from "../../stories/notify-story.js"
2
2
  import { SpeedDial } from "."
3
3
 
4
4
  export default {
@@ -1,4 +1,4 @@
1
- import { createRender } from "../../stories/notifyStory.js"
1
+ import { createRender } from "../../stories/notify-story.js"
2
2
  import { Stepper } from "."
3
3
 
4
4
  export default {
@@ -1,4 +1,4 @@
1
- import { createRender } from "../../stories/notifyStory.js"
1
+ import { createRender } from "../../stories/notify-story.js"
2
2
  import { Tabs } from "."
3
3
 
4
4
  export default {
@@ -0,0 +1,18 @@
1
+ import { nothing } from "@inglorious/web"
2
+
3
+ /**
4
+ * A label beside its control is tied to it by id. Without an id there is nothing to
5
+ * tie it with, so the control names itself after the label instead: clicking the label
6
+ * no longer focuses the control, but a screen reader still announces what it is for.
7
+ *
8
+ * Only a plain-text label can be used this way; a template has no text to give.
9
+ *
10
+ * @param {string | undefined} controlId
11
+ * @param {unknown} label
12
+ * @returns {string | typeof nothing}
13
+ */
14
+ export function fallbackLabel(controlId, label) {
15
+ if (controlId || typeof label !== "string" || !label) return nothing
16
+
17
+ return label
18
+ }
@@ -1,6 +1,6 @@
1
1
  import { html } from "@inglorious/web"
2
2
 
3
- import { createRender } from "../../stories/notifyStory.js"
3
+ import { createRender } from "../../stories/notify-story.js"
4
4
  import { Accordion } from "."
5
5
 
6
6
  export default {
@@ -8,7 +8,7 @@ import { html } from "@inglorious/web"
8
8
  import { classMap } from "@inglorious/web/directives/class-map"
9
9
  import { ref } from "@inglorious/web/directives/ref"
10
10
 
11
- import { applyElementProps } from "../../shared/applyElementProps.js"
11
+ import { applyElementProps } from "../../shared/apply-element-props.js"
12
12
 
13
13
  export const Accordion = {
14
14
  /**
@@ -1,6 +1,6 @@
1
1
  import { html } from "@inglorious/web"
2
2
 
3
- import { createRender } from "../../stories/notifyStory.js"
3
+ import { createRender } from "../../stories/notify-story.js"
4
4
  import { AppBar } from "."
5
5
 
6
6
  export default {
@@ -8,7 +8,7 @@ import { classMap } from "@inglorious/web/directives/class-map"
8
8
  import { ref } from "@inglorious/web/directives/ref"
9
9
  import { when } from "@inglorious/web/directives/when"
10
10
 
11
- import { applyElementProps } from "../../shared/applyElementProps.js"
11
+ import { applyElementProps } from "../../shared/apply-element-props.js"
12
12
 
13
13
  /**
14
14
  * Renders a top app bar with optional leading/trailing content and title metadata.
@@ -1,6 +1,6 @@
1
1
  import { html } from "@inglorious/web"
2
2
 
3
- import { createRender } from "../../stories/notifyStory.js"
3
+ import { createRender } from "../../stories/notify-story.js"
4
4
  import { Card } from "."
5
5
 
6
6
  export default {
@@ -7,7 +7,7 @@ import { html } from "@inglorious/web"
7
7
  import { classMap } from "@inglorious/web/directives/class-map"
8
8
  import { ref } from "@inglorious/web/directives/ref"
9
9
 
10
- import { applyElementProps } from "../../shared/applyElementProps.js"
10
+ import { applyElementProps } from "../../shared/apply-element-props.js"
11
11
 
12
12
  export const Card = {
13
13
  /**
@@ -1,6 +1,6 @@
1
1
  import { html } from "@inglorious/web"
2
2
 
3
- import { createRender } from "../../stories/notifyStory.js"
3
+ import { createRender } from "../../stories/notify-story.js"
4
4
  import { Paper } from "."
5
5
 
6
6
  export default {
@@ -7,7 +7,7 @@ import { html } from "@inglorious/web"
7
7
  import { classMap } from "@inglorious/web/directives/class-map"
8
8
  import { ref } from "@inglorious/web/directives/ref"
9
9
 
10
- import { applyElementProps } from "../../shared/applyElementProps.js"
10
+ import { applyElementProps } from "../../shared/apply-element-props.js"
11
11
 
12
12
  /**
13
13
  * Renders a surface container with elevation, radius, and padding options.
@@ -1,5 +1,32 @@
1
1
  const previousKeysByElement = new WeakMap()
2
2
 
3
+ /**
4
+ * Apply arbitrary properties/attributes to an element.
5
+ * Useful when entities include extra DOM fields beyond the typed API.
6
+ *
7
+ * @param {Element | null} element
8
+ * @param {Record<string, unknown>} props
9
+ */
10
+ export function applyElementProps(element, props) {
11
+ if (!element) return
12
+
13
+ const previousKeys = previousKeysByElement.get(element) ?? new Set()
14
+ const nextKeys = new Set(Object.keys(props))
15
+
16
+ for (const key of previousKeys) {
17
+ if (!nextKeys.has(key)) {
18
+ clearProp(element, key)
19
+ }
20
+ }
21
+
22
+ for (const [key, value] of Object.entries(props)) {
23
+ if (key === "class" || key === "className") continue
24
+ setProp(element, key, value)
25
+ }
26
+
27
+ previousKeysByElement.set(element, nextKeys)
28
+ }
29
+
3
30
  function clearProp(element, key) {
4
31
  if (key in element && !key.includes("-")) {
5
32
  try {
@@ -50,30 +77,3 @@ function setProp(element, key, value) {
50
77
 
51
78
  element.setAttribute(key, String(value))
52
79
  }
53
-
54
- /**
55
- * Apply arbitrary properties/attributes to an element.
56
- * Useful when entities include extra DOM fields beyond the typed API.
57
- *
58
- * @param {Element | null} element
59
- * @param {Record<string, unknown>} props
60
- */
61
- export function applyElementProps(element, props) {
62
- if (!element) return
63
-
64
- const previousKeys = previousKeysByElement.get(element) ?? new Set()
65
- const nextKeys = new Set(Object.keys(props))
66
-
67
- for (const key of previousKeys) {
68
- if (!nextKeys.has(key)) {
69
- clearProp(element, key)
70
- }
71
- }
72
-
73
- for (const [key, value] of Object.entries(props)) {
74
- if (key === "class" || key === "className") continue
75
- setProp(element, key, value)
76
- }
77
-
78
- previousKeysByElement.set(element, nextKeys)
79
- }
File without changes