@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.
- package/package.json +9 -9
- package/src/controls/button/button.stories.js +1 -1
- package/src/controls/button/template.js +1 -1
- package/src/controls/button-group/button-group.stories.js +1 -1
- package/src/controls/button-group/template.js +1 -1
- package/src/controls/checkbox/checkbox.stories.js +1 -1
- package/src/controls/checkbox/style.css +1 -1
- package/src/controls/checkbox/template.js +7 -5
- package/src/controls/combobox/combobox.stories.js +1 -1
- package/src/controls/combobox/template.js +16 -11
- package/src/controls/fab/fab.stories.js +1 -1
- package/src/controls/file-upload/file-upload.stories.js +1 -1
- package/src/controls/file-upload/template.js +18 -7
- package/src/controls/icon-button/icon-button.stories.js +1 -1
- package/src/controls/image-cropper/image-cropper.stories.js +1 -1
- package/src/controls/input/input.stories.js +1 -1
- package/src/controls/input/template.js +16 -8
- package/src/controls/radio-group/radio-group.stories.js +1 -1
- package/src/controls/radio-group/template.js +8 -6
- package/src/controls/rating/rating.stories.js +1 -1
- package/src/controls/select/select.stories.js +1 -1
- package/src/controls/select/template.js +48 -46
- package/src/controls/slider/slider.stories.js +1 -1
- package/src/controls/slider/template.js +6 -4
- package/src/controls/switch/switch.stories.js +1 -1
- package/src/controls/switch/template.js +6 -4
- package/src/controls/textarea/template.js +17 -6
- package/src/controls/textarea/textarea.stories.js +1 -1
- package/src/data-display/avatar/avatar.stories.js +1 -1
- package/src/data-display/badge/badge.stories.js +1 -1
- package/src/data-display/before-after/before-after.stories.js +1 -1
- package/src/data-display/carousel/carousel.stories.js +10 -9
- package/src/data-display/chip/chip.stories.js +1 -1
- package/src/data-display/data-grid/data-grid.stories.js +11 -11
- package/src/data-display/divider/divider.stories.js +1 -1
- package/src/data-display/icon/icon-utf8.stories.js +1 -1
- package/src/data-display/icon/icon.stories.js +1 -1
- package/src/data-display/icon/template.js +1 -1
- package/src/data-display/list/list.stories.js +1 -1
- package/src/data-display/list/template.js +1 -1
- package/src/data-display/table/table.stories.js +1 -1
- package/src/data-display/table/template.js +1 -1
- package/src/data-display/tooltip/template.js +1 -1
- package/src/data-display/tooltip/tooltip.stories.js +1 -1
- package/src/data-display/typography/template.js +1 -1
- package/src/data-display/typography/typography.stories.js +1 -1
- package/src/data-display/virtual-list/template.js +21 -21
- package/src/examples/dashboard/before-after-data.js +17 -14
- package/src/examples/dashboard/dashboard.stories.js +1 -1
- package/src/examples/dashboard/primitive-content.js +32 -30
- package/src/examples/dashboard/theme-utils.js +5 -5
- package/src/feedback/alert/alert.stories.js +1 -1
- package/src/feedback/alert/template.js +1 -1
- package/src/feedback/backdrop/backdrop.stories.js +1 -1
- package/src/feedback/dialog/dialog.stories.js +1 -1
- package/src/feedback/progress/progress.stories.js +1 -1
- package/src/feedback/progress/template.js +4 -4
- package/src/feedback/skeleton/skeleton.stories.js +1 -1
- package/src/feedback/snackbar/snackbar.stories.js +1 -1
- package/src/layout/container/container.stories.js +1 -1
- package/src/layout/container/template.js +1 -1
- package/src/layout/flex/flex.stories.js +1 -1
- package/src/layout/flex/template.js +1 -1
- package/src/layout/grid/grid.stories.js +1 -1
- package/src/navigation/bottom-navigation/bottom-navigation.stories.js +1 -1
- package/src/navigation/bottom-navigation/template.js +1 -1
- package/src/navigation/breadcrumbs/breadcrumbs.stories.js +1 -1
- package/src/navigation/breadcrumbs/template.js +1 -1
- package/src/navigation/drawer/drawer.stories.js +1 -1
- package/src/navigation/link/link.stories.js +1 -1
- package/src/navigation/link/template.js +1 -1
- package/src/navigation/menu/menu.stories.js +1 -1
- package/src/navigation/menu/template.js +1 -1
- package/src/navigation/pagination/pagination.stories.js +1 -1
- package/src/navigation/speed-dial/speed-dial.stories.js +1 -1
- package/src/navigation/stepper/stepper.stories.js +1 -1
- package/src/navigation/tabs/tabs.stories.js +1 -1
- package/src/shared/fallback-label.js +18 -0
- package/src/surfaces/accordion/accordion.stories.js +1 -1
- package/src/surfaces/accordion/template.js +1 -1
- package/src/surfaces/app-bar/app-bar.stories.js +1 -1
- package/src/surfaces/app-bar/template.js +1 -1
- package/src/surfaces/card/card.stories.js +1 -1
- package/src/surfaces/card/template.js +1 -1
- package/src/surfaces/paper/paper.stories.js +1 -1
- package/src/surfaces/paper/template.js +1 -1
- package/src/shared/{applyElementProps.js → apply-element-props.js} +27 -27
- /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/
|
|
11
|
+
import { applyElementProps } from "../../shared/apply-element-props.js"
|
|
12
12
|
|
|
13
13
|
const SIZE_TO_MAX_WIDTH = {
|
|
14
14
|
xs: "32rem",
|
|
@@ -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/
|
|
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.
|
|
@@ -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/
|
|
11
|
+
import { applyElementProps } from "../../shared/apply-element-props.js"
|
|
12
12
|
|
|
13
13
|
export const BottomNavigation = {
|
|
14
14
|
/**
|
|
@@ -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/
|
|
11
|
+
import { applyElementProps } from "../../shared/apply-element-props.js"
|
|
12
12
|
|
|
13
13
|
export const Breadcrumbs = {
|
|
14
14
|
/**
|
|
@@ -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/
|
|
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.
|
|
@@ -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/
|
|
11
|
+
import { applyElementProps } from "../../shared/apply-element-props.js"
|
|
12
12
|
|
|
13
13
|
export const Menu = {
|
|
14
14
|
/**
|
|
@@ -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
|
+
}
|
|
@@ -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/
|
|
11
|
+
import { applyElementProps } from "../../shared/apply-element-props.js"
|
|
12
12
|
|
|
13
13
|
export const Accordion = {
|
|
14
14
|
/**
|
|
@@ -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/
|
|
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.
|
|
@@ -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/
|
|
10
|
+
import { applyElementProps } from "../../shared/apply-element-props.js"
|
|
11
11
|
|
|
12
12
|
export const Card = {
|
|
13
13
|
/**
|
|
@@ -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/
|
|
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
|