@inglorious/ui 8.3.0 → 8.4.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.
- package/package.json +6 -6
- 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 +14 -12
- 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 +1 -1
- package/src/data-display/chip/chip.stories.js +1 -1
- package/src/data-display/data-grid/data-grid.stories.js +1 -1
- 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/examples/dashboard/dashboard.stories.js +1 -1
- 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/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} +0 -0
- /package/src/stories/{notifyStory.js → notify-story.js} +0 -0
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { html } from "@inglorious/web"
|
|
6
|
+
import { html, nothing } 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 toggle switch backed by a checkbox input.
|
|
@@ -29,6 +29,8 @@ export function render(props) {
|
|
|
29
29
|
...rest
|
|
30
30
|
} = props
|
|
31
31
|
|
|
32
|
+
// The label wraps the input, which is what ties the two together: it needs no
|
|
33
|
+
// `for`, and an empty one would point at nothing and break the click-through.
|
|
32
34
|
const inputId = id || name
|
|
33
35
|
|
|
34
36
|
const classes = {
|
|
@@ -39,9 +41,9 @@ export function render(props) {
|
|
|
39
41
|
}
|
|
40
42
|
|
|
41
43
|
return html`
|
|
42
|
-
<label class=${classMap(classes)}
|
|
44
|
+
<label class=${classMap(classes)}>
|
|
43
45
|
<input
|
|
44
|
-
id=${inputId}
|
|
46
|
+
id=${inputId || nothing}
|
|
45
47
|
class="iw-switch-input"
|
|
46
48
|
type="checkbox"
|
|
47
49
|
name=${name}
|
|
@@ -3,11 +3,12 @@
|
|
|
3
3
|
* @typedef {import('@inglorious/web').TemplateResult} TemplateResult
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
-
import { html } from "@inglorious/web"
|
|
6
|
+
import { html, nothing } 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
|
+
import { fallbackLabel } from "../../shared/fallback-label.js"
|
|
11
12
|
|
|
12
13
|
/**
|
|
13
14
|
* Renders a labeled textarea field with optional hint and error messaging.
|
|
@@ -39,6 +40,7 @@ export function render(props) {
|
|
|
39
40
|
} = props
|
|
40
41
|
|
|
41
42
|
const textareaId = id || name
|
|
43
|
+
const messageId = (error || hint) && id ? `${id}-message` : ""
|
|
42
44
|
|
|
43
45
|
const wrapperClasses = {
|
|
44
46
|
"iw-textarea-field": true,
|
|
@@ -60,7 +62,7 @@ export function render(props) {
|
|
|
60
62
|
${
|
|
61
63
|
label
|
|
62
64
|
? html`
|
|
63
|
-
<label for=${textareaId} class="iw-textarea-label">
|
|
65
|
+
<label for=${textareaId || nothing} class="iw-textarea-label">
|
|
64
66
|
${label}
|
|
65
67
|
${
|
|
66
68
|
isRequired
|
|
@@ -73,8 +75,11 @@ export function render(props) {
|
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
<textarea
|
|
76
|
-
id=${textareaId}
|
|
78
|
+
id=${textareaId || nothing}
|
|
77
79
|
name=${name}
|
|
80
|
+
aria-label=${fallbackLabel(textareaId, label)}
|
|
81
|
+
aria-describedby=${messageId || nothing}
|
|
82
|
+
aria-invalid=${error ? "true" : "false"}
|
|
78
83
|
rows=${rows}
|
|
79
84
|
.value=${value}
|
|
80
85
|
placeholder=${placeholder}
|
|
@@ -90,9 +95,15 @@ export function render(props) {
|
|
|
90
95
|
|
|
91
96
|
${
|
|
92
97
|
error
|
|
93
|
-
? html`<span
|
|
98
|
+
? html`<span
|
|
99
|
+
id=${messageId || nothing}
|
|
100
|
+
class="iw-textarea-error-message"
|
|
101
|
+
>${error}</span
|
|
102
|
+
>`
|
|
94
103
|
: hint
|
|
95
|
-
? html`<span class="iw-textarea-hint"
|
|
104
|
+
? html`<span id=${messageId || nothing} class="iw-textarea-hint"
|
|
105
|
+
>${hint}</span
|
|
106
|
+
>`
|
|
96
107
|
: null
|
|
97
108
|
}
|
|
98
109
|
</div>
|
|
@@ -3,7 +3,7 @@ import { html } from "@inglorious/web"
|
|
|
3
3
|
import {
|
|
4
4
|
createEntityRender,
|
|
5
5
|
notifyActionArgType,
|
|
6
|
-
} from "../../stories/
|
|
6
|
+
} from "../../stories/notify-story.js"
|
|
7
7
|
import { Carousel } from "./index.js"
|
|
8
8
|
|
|
9
9
|
const COLORS = ["#22d3ee", "#4f46e5", "#f59e0b", "#10b981", "#ef4444"]
|
|
@@ -4,7 +4,7 @@ import arrowBack from "@iconify-icons/material-symbols/arrow-back"
|
|
|
4
4
|
import settingsFilled from "@iconify-icons/material-symbols/settings"
|
|
5
5
|
import settingsOutline from "@iconify-icons/material-symbols/settings-outline"
|
|
6
6
|
|
|
7
|
-
import { createRender } from "../../stories/
|
|
7
|
+
import { createRender } from "../../stories/notify-story.js"
|
|
8
8
|
import { Icon } from "."
|
|
9
9
|
|
|
10
10
|
export default {
|
|
@@ -9,7 +9,7 @@ import { classMap } from "@inglorious/web/directives/class-map"
|
|
|
9
9
|
import { ref } from "@inglorious/web/directives/ref"
|
|
10
10
|
import { unsafeSVG } from "@inglorious/web/directives/unsafe-svg"
|
|
11
11
|
|
|
12
|
-
import { applyElementProps } from "../../shared/
|
|
12
|
+
import { applyElementProps } from "../../shared/apply-element-props.js"
|
|
13
13
|
|
|
14
14
|
/**
|
|
15
15
|
* Renders an inline icon with size and color control.
|
|
@@ -28,7 +28,7 @@ import { when } from "@inglorious/web/directives/when"
|
|
|
28
28
|
import { IconButton } from "../../controls/icon-button"
|
|
29
29
|
import { Icon } from "../../data-display/icon"
|
|
30
30
|
import { Flex } from "../../layout/flex"
|
|
31
|
-
import { applyElementProps } from "../../shared/
|
|
31
|
+
import { applyElementProps } from "../../shared/apply-element-props.js"
|
|
32
32
|
|
|
33
33
|
const PRETTY_INDEX = 1
|
|
34
34
|
|
|
@@ -9,7 +9,7 @@ import { classMap } from "@inglorious/web/directives/class-map"
|
|
|
9
9
|
import { ref } from "@inglorious/web/directives/ref"
|
|
10
10
|
import { repeat } from "@inglorious/web/directives/repeat"
|
|
11
11
|
|
|
12
|
-
import { applyElementProps } from "../../shared/
|
|
12
|
+
import { applyElementProps } from "../../shared/apply-element-props.js"
|
|
13
13
|
|
|
14
14
|
const EVEN_ROW_DIVISOR = 2
|
|
15
15
|
const STRIPED_OFFSET = 1
|
|
@@ -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 tooltip trigger and bubble with positional styling.
|
|
@@ -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 styled text with semantic variants such as headings, body, and caption.
|
|
@@ -5,7 +5,7 @@ import { Chart } from "@inglorious/charts"
|
|
|
5
5
|
import {
|
|
6
6
|
createEntityRender,
|
|
7
7
|
notifyActionArgType,
|
|
8
|
-
} from "../../stories/
|
|
8
|
+
} from "../../stories/notify-story.js"
|
|
9
9
|
import { AppDrawer } from "./app-drawer.js"
|
|
10
10
|
import { AppHeader } from "./app-header.js"
|
|
11
11
|
import { Dashboard } from "./dashboard.js"
|
|
@@ -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 an alert message with optional title, description, icon, and actions.
|
|
@@ -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.
|
|
File without changes
|
|
File without changes
|