@ds-gn/ui 0.9.0 → 0.11.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/README.md +4 -4
- package/custom-elements.json +5527 -2136
- package/dist/common/controllers/OverlayDismissController.d.ts +52 -0
- package/dist/common/controllers/OverlayPositionController.d.ts +168 -0
- package/dist/common/controllers/RovingFocusController.d.ts +99 -0
- package/dist/common/controllers/SectionEntranceController.d.ts +37 -0
- package/dist/common/helpers/field-control.d.ts +35 -0
- package/dist/common/helpers/listbox-navigation.d.ts +50 -0
- package/dist/common/props/size/size.props.d.ts +11 -0
- package/dist/common/styles/overlay-panel.styles.d.ts +55 -0
- package/dist/components/Button/src/Button.d.ts +20 -0
- package/dist/components/Button/src/Button.js +28 -0
- package/dist/components/Container/src/Container.d.ts +10 -0
- package/dist/components/Container/src/Container.js +148 -23
- package/dist/components/DropdownMenu/src/DropdownMenu.d.ts +150 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.js +1550 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.playground.d.ts +2 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.props.d.ts +47 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.props.js +54 -0
- package/dist/components/DropdownMenu/src/DropdownMenu.styles.d.ts +20 -0
- package/dist/components/Field/src/Field.d.ts +39 -0
- package/dist/components/Field/src/Field.js +203 -0
- package/dist/components/Field/src/Field.playground.d.ts +2 -0
- package/dist/components/Field/src/Field.styles.d.ts +6 -0
- package/dist/components/Icon/src/Icon.d.ts +5 -0
- package/dist/components/Icon/src/Icon.js +3 -0
- package/dist/components/Icon/src/icons/arrow-down.d.ts +1 -0
- package/dist/components/Icon/src/icons/arrow-down.js +6 -0
- package/dist/components/Icon/src/icons/arrow-up.d.ts +1 -0
- package/dist/components/Icon/src/icons/arrow-up.js +6 -0
- package/dist/components/Icon/src/icons/chevrons-up-down.d.ts +1 -0
- package/dist/components/Icon/src/icons/chevrons-up-down.js +6 -0
- package/dist/components/Icon/src/icons/cookie.d.ts +1 -0
- package/dist/components/Icon/src/icons/cookie.js +6 -0
- package/dist/components/Icon/src/icons/icon-names.d.ts +1 -1
- package/dist/components/Icon/src/icons/icon-names.js +4 -0
- package/dist/components/Icon/src/icons/index.d.ts +4 -0
- package/dist/components/Icon/src/icons/index.js +4 -0
- package/dist/components/Input/src/Input.d.ts +37 -0
- package/dist/components/Input/src/Input.js +300 -143
- package/dist/components/Input/src/Input.props.d.ts +2 -1
- package/dist/components/Input/src/Input.props.js +12 -6
- package/dist/components/Input/src/Input.styles.d.ts +12 -4
- package/dist/components/Modal/src/Modal.d.ts +1 -0
- package/dist/components/Modal/src/Modal.js +1 -0
- package/dist/components/Nav/src/Nav.js +2 -1
- package/dist/components/NavLink/src/NavLink.d.ts +14 -30
- package/dist/components/NavLink/src/NavLink.js +201 -65
- package/dist/components/Select/src/Select.d.ts +157 -0
- package/dist/components/Select/src/Select.js +1766 -0
- package/dist/components/Select/src/Select.playground.d.ts +2 -0
- package/dist/components/Select/src/Select.props.d.ts +19 -0
- package/dist/components/Select/src/Select.props.js +40 -0
- package/dist/components/Select/src/Select.styles.d.ts +30 -0
- package/dist/components/Table/src/Table.d.ts +93 -0
- package/dist/components/Table/src/Table.js +1105 -0
- package/dist/components/Table/src/Table.playground.d.ts +2 -0
- package/dist/components/Table/src/Table.props.d.ts +53 -0
- package/dist/components/Table/src/Table.props.js +18 -0
- package/dist/components/Table/src/Table.styles.d.ts +33 -0
- package/dist/components/Toaster/src/Toaster.d.ts +174 -0
- package/dist/components/Toaster/src/Toaster.js +1489 -0
- package/dist/components/Toaster/src/Toaster.playground.d.ts +2 -0
- package/dist/components/Toaster/src/Toaster.props.d.ts +14 -0
- package/dist/components/Toaster/src/Toaster.props.js +81 -0
- package/dist/components/Toaster/src/Toaster.styles.d.ts +52 -0
- package/dist/components/Toaster/src/toast.d.ts +115 -0
- package/dist/components/Toaster/src/toast.js +74 -0
- package/dist/playground/types.d.ts +27 -0
- package/dist/playground-manifest.d.ts +3 -2
- package/dist/playground-manifest.js +507 -7
- package/dist/react/DropdownMenu.d.ts +8 -0
- package/dist/react/DropdownMenu.js +13 -0
- package/dist/react/Field.d.ts +6 -0
- package/dist/react/Field.js +13 -0
- package/dist/react/Select.d.ts +8 -0
- package/dist/react/Select.js +13 -0
- package/dist/react/Table.d.ts +8 -0
- package/dist/react/Table.js +13 -0
- package/dist/react/Toaster.d.ts +8 -0
- package/dist/react/Toaster.js +13 -0
- package/dist/react/index.d.ts +6 -0
- package/dist/react/index.js +6 -0
- package/package.json +52 -2
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { type SizeType } from '../../../common/props/size/size.props.js';
|
|
2
|
+
import type { IconName } from '../../Icon/src/icons/icon-names.js';
|
|
3
|
+
export declare const dropdownMenuItemVariantValues: {
|
|
4
|
+
readonly DEFAULT: "default";
|
|
5
|
+
readonly DANGER: "danger";
|
|
6
|
+
};
|
|
7
|
+
export type DropdownMenuItemVariantType = (typeof dropdownMenuItemVariantValues)[keyof typeof dropdownMenuItemVariantValues];
|
|
8
|
+
/** One action in a `dsgn-dropdown-menu`. */
|
|
9
|
+
export interface DropdownMenuItem {
|
|
10
|
+
/** Reported in `dsgn-select` when the item is activated. */
|
|
11
|
+
value: string;
|
|
12
|
+
/** Visible text, also the accessible name and the typeahead target. */
|
|
13
|
+
label: string;
|
|
14
|
+
/**
|
|
15
|
+
* Leading icon, by registered name (see `Icon.registerIcons`). Drawn at the
|
|
16
|
+
* menu's icon size; unregistered names render no icon.
|
|
17
|
+
*/
|
|
18
|
+
icon?: IconName;
|
|
19
|
+
/**
|
|
20
|
+
* Trailing shortcut hint, such as `⌘C`. Display only: the menu does not bind
|
|
21
|
+
* the keys.
|
|
22
|
+
*/
|
|
23
|
+
shortcut?: string;
|
|
24
|
+
/** Focusable but not activatable; marked `aria-disabled`. */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** `danger` for destructive actions. Defaults to `default`. */
|
|
27
|
+
variant?: DropdownMenuItemVariantType;
|
|
28
|
+
}
|
|
29
|
+
/** A divider between groups of items. */
|
|
30
|
+
export interface DropdownMenuSeparator {
|
|
31
|
+
separator: true;
|
|
32
|
+
}
|
|
33
|
+
export type DropdownMenuEntry = DropdownMenuItem | DropdownMenuSeparator;
|
|
34
|
+
export declare const isDropdownMenuSeparator: (entry: DropdownMenuEntry) => entry is DropdownMenuSeparator;
|
|
35
|
+
export declare const dropdownMenuAlignValues: {
|
|
36
|
+
readonly START: "start";
|
|
37
|
+
readonly END: "end";
|
|
38
|
+
};
|
|
39
|
+
export type DropdownMenuAlignType = (typeof dropdownMenuAlignValues)[keyof typeof dropdownMenuAlignValues];
|
|
40
|
+
export declare const dropdownMenuAlignProps: import("lit").PropertyDeclaration<unknown, unknown>;
|
|
41
|
+
export declare const dropdownMenuSizeValues: {
|
|
42
|
+
readonly SM: "sm";
|
|
43
|
+
readonly MD: "md";
|
|
44
|
+
readonly LG: "lg";
|
|
45
|
+
};
|
|
46
|
+
export type DropdownMenuSizeType = SizeType;
|
|
47
|
+
export declare const dropdownMenuSizeProps: import("lit").PropertyDeclaration<unknown, unknown>;
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
// common/helpers/enum-validator.ts
|
|
2
|
+
var enumValidator = (propName, enumSet, candidateValue) => {
|
|
3
|
+
if (!enumSet.has(candidateValue)) {
|
|
4
|
+
throw new Error(`Invalid prop ${propName} of value ${candidateValue}. Expected one of: ${Array.from(enumSet).join(", ")}`);
|
|
5
|
+
}
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// common/helpers/enum-creator.ts
|
|
9
|
+
var enumCreator = (acceptableValues, propName, type, other = {}) => {
|
|
10
|
+
const acceptableValuesSet = new Set(acceptableValues);
|
|
11
|
+
return {
|
|
12
|
+
type,
|
|
13
|
+
hasChanged(newValue, oldValue) {
|
|
14
|
+
if (newValue !== oldValue) {
|
|
15
|
+
enumValidator(propName, acceptableValuesSet, newValue);
|
|
16
|
+
return true;
|
|
17
|
+
}
|
|
18
|
+
return false;
|
|
19
|
+
},
|
|
20
|
+
...other
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
// common/props/size/size.props.ts
|
|
25
|
+
var sizeValues = {
|
|
26
|
+
SM: "sm",
|
|
27
|
+
MD: "md",
|
|
28
|
+
LG: "lg"
|
|
29
|
+
};
|
|
30
|
+
var sizeProps = enumCreator(Object.values(sizeValues), "size", String, {
|
|
31
|
+
reflect: true
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
// components/DropdownMenu/src/DropdownMenu.props.ts
|
|
35
|
+
var dropdownMenuItemVariantValues = {
|
|
36
|
+
DEFAULT: "default",
|
|
37
|
+
DANGER: "danger"
|
|
38
|
+
};
|
|
39
|
+
var isDropdownMenuSeparator = (entry) => ("separator" in entry) && entry.separator === true;
|
|
40
|
+
var dropdownMenuAlignValues = {
|
|
41
|
+
START: "start",
|
|
42
|
+
END: "end"
|
|
43
|
+
};
|
|
44
|
+
var dropdownMenuAlignProps = enumCreator(Object.values(dropdownMenuAlignValues), "align", String, { reflect: true });
|
|
45
|
+
var dropdownMenuSizeValues = sizeValues;
|
|
46
|
+
var dropdownMenuSizeProps = sizeProps;
|
|
47
|
+
export {
|
|
48
|
+
dropdownMenuAlignProps,
|
|
49
|
+
dropdownMenuAlignValues,
|
|
50
|
+
dropdownMenuItemVariantValues,
|
|
51
|
+
dropdownMenuSizeProps,
|
|
52
|
+
dropdownMenuSizeValues,
|
|
53
|
+
isDropdownMenuSeparator
|
|
54
|
+
};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { OverlayPlacement } from '../../../common/controllers/OverlayPositionController.js';
|
|
2
|
+
import { type OverlayPanelState } from '../../../common/styles/overlay-panel.styles.js';
|
|
3
|
+
import { type DropdownMenuSizeType } from './DropdownMenu.props.js';
|
|
4
|
+
/** Anchors the menu's no-Popover-API fallback to the trigger. */
|
|
5
|
+
export declare const anchorClasses: () => string;
|
|
6
|
+
/**
|
|
7
|
+
* The menu: the panel shared with `dsgn-select`'s listbox, at least 232px wide
|
|
8
|
+
* and free to grow wider than its trigger, never past the viewport gutters.
|
|
9
|
+
*/
|
|
10
|
+
export declare const menuClasses: (panel: OverlayPanelState, placement: OverlayPlacement) => string;
|
|
11
|
+
export declare const itemClasses: (size: DropdownMenuSizeType, { active, disabled, danger, }: Record<"active" | "disabled" | "danger", boolean>) => string;
|
|
12
|
+
/**
|
|
13
|
+
* Leading icon. Secondary text colour on a default item; a disabled or
|
|
14
|
+
* destructive item's icon follows its text.
|
|
15
|
+
*/
|
|
16
|
+
export declare const itemIconClasses: (size: DropdownMenuSizeType, plain: boolean) => string;
|
|
17
|
+
export declare const itemLabelClasses: () => string;
|
|
18
|
+
/** Trailing shortcut hint, coloured like the icon. */
|
|
19
|
+
export declare const itemShortcutClasses: (plain: boolean) => string;
|
|
20
|
+
export declare const separatorClasses: () => string;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import '../../../types/global.d.ts';
|
|
2
|
+
import { type CSSResultGroup } from 'lit';
|
|
3
|
+
import { Base } from '../../../common/Base/Base.js';
|
|
4
|
+
import { type SizeType } from '../../../common/props/size/size.props.js';
|
|
5
|
+
/**
|
|
6
|
+
* Pairs one form control with its label, hint and error message.
|
|
7
|
+
*
|
|
8
|
+
* Field is not form-associated and renders nothing visible itself. Because
|
|
9
|
+
* `aria-labelledby`/`aria-describedby` cannot cross shadow roots, it writes
|
|
10
|
+
* `label`, `hint`, `error`, `required`, `invalid` (from a non-empty `error`)
|
|
11
|
+
* and `size` onto the slotted control, which renders them and wires the ARIA
|
|
12
|
+
* inside its own shadow root. Field is the source of truth for those
|
|
13
|
+
* properties: values set directly on the control are overwritten.
|
|
14
|
+
*
|
|
15
|
+
* Validation timing is the consumer's: Field shows whatever `error` it is given.
|
|
16
|
+
*
|
|
17
|
+
* @slot - One form control that implements the Field contract, such as `<dsgn-input>`.
|
|
18
|
+
*/
|
|
19
|
+
export declare class Field extends Base {
|
|
20
|
+
static styles: CSSResultGroup;
|
|
21
|
+
label: string;
|
|
22
|
+
/** Supporting text. Stays visible alongside an error. */
|
|
23
|
+
hint: string;
|
|
24
|
+
/** Error message. A non-empty value marks the control invalid. */
|
|
25
|
+
error: string;
|
|
26
|
+
required: boolean;
|
|
27
|
+
size: SizeType;
|
|
28
|
+
private _assigned;
|
|
29
|
+
private _control;
|
|
30
|
+
private _handleSlotChange;
|
|
31
|
+
private _syncControl;
|
|
32
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
33
|
+
render(): import("lit").TemplateResult<1>;
|
|
34
|
+
}
|
|
35
|
+
declare global {
|
|
36
|
+
interface HTMLElementTagNameMap {
|
|
37
|
+
'dsgn-field': Field;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1,203 @@
|
|
|
1
|
+
var __legacyDecorateClassTS = function(decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function")
|
|
4
|
+
r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
else
|
|
6
|
+
for (var i = decorators.length - 1;i >= 0; i--)
|
|
7
|
+
if (d = decorators[i])
|
|
8
|
+
r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
9
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
// components/Field/src/Field.ts
|
|
13
|
+
import { html as html2 } from "lit";
|
|
14
|
+
import { property, queryAssignedElements } from "lit/decorators.js";
|
|
15
|
+
|
|
16
|
+
// common/Base/Base.ts
|
|
17
|
+
import { html, LitElement } from "lit";
|
|
18
|
+
|
|
19
|
+
// common/helpers/define-element.ts
|
|
20
|
+
var defineElement = (tag, ctor) => {
|
|
21
|
+
if (typeof customElements === "undefined")
|
|
22
|
+
return;
|
|
23
|
+
if (!customElements.get(tag))
|
|
24
|
+
customElements.define(tag, ctor);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// common/Base/Base.css
|
|
28
|
+
import { css } from "lit";
|
|
29
|
+
var styles = css`/* Base reset in @layer base ensures it comes before utilities in Tailwind v4 cascade
|
|
30
|
+
This prevents the reset from overriding component utility classes */
|
|
31
|
+
@layer base {
|
|
32
|
+
:host {
|
|
33
|
+
display: block;
|
|
34
|
+
box-sizing: border-box;
|
|
35
|
+
line-height: 1.5;
|
|
36
|
+
-webkit-text-size-adjust: 100%;
|
|
37
|
+
tab-size: 4;
|
|
38
|
+
font-family: var(
|
|
39
|
+
--default-font-family,
|
|
40
|
+
var(--font-sans, ui-sans-serif, system-ui, sans-serif)
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
*,
|
|
45
|
+
*::before,
|
|
46
|
+
*::after {
|
|
47
|
+
box-sizing: inherit;
|
|
48
|
+
margin: 0;
|
|
49
|
+
padding: 0;
|
|
50
|
+
border: 0 solid;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
:host h1,
|
|
54
|
+
:host h2,
|
|
55
|
+
:host h3,
|
|
56
|
+
:host h4,
|
|
57
|
+
:host h5,
|
|
58
|
+
:host h6 {
|
|
59
|
+
font-size: inherit;
|
|
60
|
+
font-weight: inherit;
|
|
61
|
+
margin: 0;
|
|
62
|
+
padding: 0;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
`;
|
|
66
|
+
var Base_default = styles;
|
|
67
|
+
|
|
68
|
+
// common/Base/Base.ts
|
|
69
|
+
class Base extends LitElement {
|
|
70
|
+
static styles = Base_default;
|
|
71
|
+
updateTheme(changedProperties, surface) {
|
|
72
|
+
if (changedProperties.has("surface")) {
|
|
73
|
+
if (surface) {
|
|
74
|
+
this.setAttribute("data-theme", surface);
|
|
75
|
+
} else {
|
|
76
|
+
this.removeAttribute("data-theme");
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
emit(name, detail, options = {}) {
|
|
81
|
+
return this.dispatchEvent(new CustomEvent(name, {
|
|
82
|
+
detail,
|
|
83
|
+
bubbles: true,
|
|
84
|
+
composed: true,
|
|
85
|
+
cancelable: options.cancelable ?? false
|
|
86
|
+
}));
|
|
87
|
+
}
|
|
88
|
+
render() {
|
|
89
|
+
return html`<slot></slot>`;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
defineElement("dsgn-base", Base);
|
|
93
|
+
|
|
94
|
+
// common/helpers/field-control.ts
|
|
95
|
+
var FIELD_CONTROL = Symbol.for("dsgn.field-control");
|
|
96
|
+
var isFieldControl = (element) => element.constructor[FIELD_CONTROL] === true;
|
|
97
|
+
|
|
98
|
+
// common/helpers/enum-validator.ts
|
|
99
|
+
var enumValidator = (propName, enumSet, candidateValue) => {
|
|
100
|
+
if (!enumSet.has(candidateValue)) {
|
|
101
|
+
throw new Error(`Invalid prop ${propName} of value ${candidateValue}. Expected one of: ${Array.from(enumSet).join(", ")}`);
|
|
102
|
+
}
|
|
103
|
+
};
|
|
104
|
+
|
|
105
|
+
// common/helpers/enum-creator.ts
|
|
106
|
+
var enumCreator = (acceptableValues, propName, type, other = {}) => {
|
|
107
|
+
const acceptableValuesSet = new Set(acceptableValues);
|
|
108
|
+
return {
|
|
109
|
+
type,
|
|
110
|
+
hasChanged(newValue, oldValue) {
|
|
111
|
+
if (newValue !== oldValue) {
|
|
112
|
+
enumValidator(propName, acceptableValuesSet, newValue);
|
|
113
|
+
return true;
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
},
|
|
117
|
+
...other
|
|
118
|
+
};
|
|
119
|
+
};
|
|
120
|
+
|
|
121
|
+
// common/props/size/size.props.ts
|
|
122
|
+
var sizeValues = {
|
|
123
|
+
SM: "sm",
|
|
124
|
+
MD: "md",
|
|
125
|
+
LG: "lg"
|
|
126
|
+
};
|
|
127
|
+
var sizeProps = enumCreator(Object.values(sizeValues), "size", String, {
|
|
128
|
+
reflect: true
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
// components/Field/src/Field.styles.ts
|
|
132
|
+
import { css as css2 } from "lit";
|
|
133
|
+
var hostStyles = css2`
|
|
134
|
+
:host {
|
|
135
|
+
display: block;
|
|
136
|
+
}
|
|
137
|
+
`;
|
|
138
|
+
|
|
139
|
+
// components/Field/src/Field.ts
|
|
140
|
+
class Field extends Base {
|
|
141
|
+
constructor() {
|
|
142
|
+
super(...arguments);
|
|
143
|
+
this.label = "";
|
|
144
|
+
this.hint = "";
|
|
145
|
+
this.error = "";
|
|
146
|
+
this.required = false;
|
|
147
|
+
this.size = sizeValues.MD;
|
|
148
|
+
this._control = null;
|
|
149
|
+
}
|
|
150
|
+
static styles = [Base.styles, hostStyles];
|
|
151
|
+
_handleSlotChange() {
|
|
152
|
+
this._control = this._assigned.find(isFieldControl) ?? null;
|
|
153
|
+
this._syncControl();
|
|
154
|
+
if (this._control)
|
|
155
|
+
return;
|
|
156
|
+
for (const element of this._assigned) {
|
|
157
|
+
const tag = element.localName;
|
|
158
|
+
if (tag.includes("-") && !customElements.get(tag)) {
|
|
159
|
+
customElements.whenDefined(tag).then(() => this._handleSlotChange());
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
_syncControl() {
|
|
164
|
+
const control = this._control;
|
|
165
|
+
if (!control)
|
|
166
|
+
return;
|
|
167
|
+
control.label = this.label;
|
|
168
|
+
control.hint = this.hint;
|
|
169
|
+
control.error = this.error;
|
|
170
|
+
control.required = this.required;
|
|
171
|
+
control.invalid = !!this.error;
|
|
172
|
+
control.size = this.size;
|
|
173
|
+
}
|
|
174
|
+
updated(changedProperties) {
|
|
175
|
+
super.updated(changedProperties);
|
|
176
|
+
this._syncControl();
|
|
177
|
+
}
|
|
178
|
+
render() {
|
|
179
|
+
return html2`<slot @slotchange=${this._handleSlotChange}></slot>`;
|
|
180
|
+
}
|
|
181
|
+
}
|
|
182
|
+
__legacyDecorateClassTS([
|
|
183
|
+
property({ type: String })
|
|
184
|
+
], Field.prototype, "label", undefined);
|
|
185
|
+
__legacyDecorateClassTS([
|
|
186
|
+
property({ type: String })
|
|
187
|
+
], Field.prototype, "hint", undefined);
|
|
188
|
+
__legacyDecorateClassTS([
|
|
189
|
+
property({ type: String })
|
|
190
|
+
], Field.prototype, "error", undefined);
|
|
191
|
+
__legacyDecorateClassTS([
|
|
192
|
+
property({ type: Boolean, reflect: true })
|
|
193
|
+
], Field.prototype, "required", undefined);
|
|
194
|
+
__legacyDecorateClassTS([
|
|
195
|
+
property({ ...sizeProps })
|
|
196
|
+
], Field.prototype, "size", undefined);
|
|
197
|
+
__legacyDecorateClassTS([
|
|
198
|
+
queryAssignedElements()
|
|
199
|
+
], Field.prototype, "_assigned", undefined);
|
|
200
|
+
defineElement("dsgn-field", Field);
|
|
201
|
+
export {
|
|
202
|
+
Field
|
|
203
|
+
};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field has no visuals of its own: the control renders the label, hint and
|
|
3
|
+
* error next to the element they describe (see `field-control.ts`). The host
|
|
4
|
+
* is only a block-level slot for one control.
|
|
5
|
+
*/
|
|
6
|
+
export declare const hostStyles: import("lit").CSSResult;
|
|
@@ -21,6 +21,11 @@ export declare class Icon extends Base {
|
|
|
21
21
|
* Icon.registerIcons({ myIcon: svg`<path d="..."/>` });
|
|
22
22
|
*/
|
|
23
23
|
static registerIcons(registry: Record<string, SVGTemplateResult>): void;
|
|
24
|
+
/**
|
|
25
|
+
* The registered icon for `name`, or `undefined`. For components that take
|
|
26
|
+
* icons by name as data (a menu's items) but draw the `<svg>` themselves.
|
|
27
|
+
*/
|
|
28
|
+
static resolve(name: string): SVGTemplateResult | undefined;
|
|
24
29
|
/**
|
|
25
30
|
* Surface theme variant (light or dark)
|
|
26
31
|
*/
|
|
@@ -250,6 +250,9 @@ class Icon extends Base {
|
|
|
250
250
|
static registerIcons(registry) {
|
|
251
251
|
Icon._registry = { ...Icon._registry, ...registry };
|
|
252
252
|
}
|
|
253
|
+
static resolve(name) {
|
|
254
|
+
return Icon._registry[name];
|
|
255
|
+
}
|
|
253
256
|
willUpdate(changedProperties) {
|
|
254
257
|
if (changedProperties.has("iconName") && !changedProperties.has("icon")) {
|
|
255
258
|
this.icon = this.iconName ? Icon._registry[this.iconName] : undefined;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const arrowDown: import("lit").TemplateResult<2>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const arrowUp: import("lit").TemplateResult<2>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const chevronsUpDown: import("lit").TemplateResult<2>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const cookie: import("lit").TemplateResult<2>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
// cookie.ts
|
|
2
|
+
import { svg } from "lit";
|
|
3
|
+
var cookie = svg`<path d="M12 2a10 10 0 1 0 10 10 4 4 0 0 1-5-5 4 4 0 0 1-5-5" /><path d="M8.5 8.5v.01" /><path d="M16 15.5v.01" /><path d="M12 12v.01" /><path d="M11 17v.01" /><path d="M7 14v.01" />`;
|
|
4
|
+
export {
|
|
5
|
+
cookie
|
|
6
|
+
};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export type IconName = 'arrowLeft' | 'arrowRight' | 'calendar' | 'check' | 'chevronDown' | 'chevronLeft' | 'chevronRight' | 'chevronUp' | 'circleAlert' | 'circleCheck' | 'circleX' | 'copy' | 'download' | 'ellipsis' | 'ellipsisVertical' | 'externalLink' | 'eye' | 'eyeOff' | 'info' | 'loader' | 'mail' | 'menu' | 'minus' | 'pencil' | 'plus' | 'search' | 'settings' | 'trash2' | 'triangleAlert' | 'upload' | 'user' | 'x';
|
|
1
|
+
export type IconName = 'arrowDown' | 'arrowLeft' | 'arrowRight' | 'arrowUp' | 'calendar' | 'check' | 'chevronDown' | 'chevronLeft' | 'chevronRight' | 'chevronUp' | 'chevronsUpDown' | 'circleAlert' | 'circleCheck' | 'circleX' | 'cookie' | 'copy' | 'download' | 'ellipsis' | 'ellipsisVertical' | 'externalLink' | 'eye' | 'eyeOff' | 'info' | 'loader' | 'mail' | 'menu' | 'minus' | 'pencil' | 'plus' | 'search' | 'settings' | 'trash2' | 'triangleAlert' | 'upload' | 'user' | 'x';
|
|
2
2
|
export declare const iconNames: IconName[];
|
|
@@ -1,17 +1,21 @@
|
|
|
1
1
|
// Auto-generated by build/generate-icons.ts — do not edit manually
|
|
2
2
|
|
|
3
3
|
export const iconNames = [
|
|
4
|
+
'arrowDown',
|
|
4
5
|
'arrowLeft',
|
|
5
6
|
'arrowRight',
|
|
7
|
+
'arrowUp',
|
|
6
8
|
'calendar',
|
|
7
9
|
'check',
|
|
8
10
|
'chevronDown',
|
|
9
11
|
'chevronLeft',
|
|
10
12
|
'chevronRight',
|
|
11
13
|
'chevronUp',
|
|
14
|
+
'chevronsUpDown',
|
|
12
15
|
'circleAlert',
|
|
13
16
|
'circleCheck',
|
|
14
17
|
'circleX',
|
|
18
|
+
'cookie',
|
|
15
19
|
'copy',
|
|
16
20
|
'download',
|
|
17
21
|
'ellipsis',
|
|
@@ -1,14 +1,18 @@
|
|
|
1
|
+
export { arrowDown } from './arrow-down';
|
|
1
2
|
export { arrowLeft } from './arrow-left';
|
|
2
3
|
export { arrowRight } from './arrow-right';
|
|
4
|
+
export { arrowUp } from './arrow-up';
|
|
3
5
|
export { calendar } from './calendar';
|
|
4
6
|
export { check } from './check';
|
|
5
7
|
export { chevronDown } from './chevron-down';
|
|
6
8
|
export { chevronLeft } from './chevron-left';
|
|
7
9
|
export { chevronRight } from './chevron-right';
|
|
8
10
|
export { chevronUp } from './chevron-up';
|
|
11
|
+
export { chevronsUpDown } from './chevrons-up-down';
|
|
9
12
|
export { circleAlert } from './circle-alert';
|
|
10
13
|
export { circleCheck } from './circle-check';
|
|
11
14
|
export { circleX } from './circle-x';
|
|
15
|
+
export { cookie } from './cookie';
|
|
12
16
|
export { copy } from './copy';
|
|
13
17
|
export { download } from './download';
|
|
14
18
|
export { ellipsis } from './ellipsis';
|
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
// Auto-generated by build/generate-icons.ts — do not edit manually
|
|
2
2
|
|
|
3
|
+
export { arrowDown } from './arrow-down.js';
|
|
3
4
|
export { arrowLeft } from './arrow-left.js';
|
|
4
5
|
export { arrowRight } from './arrow-right.js';
|
|
6
|
+
export { arrowUp } from './arrow-up.js';
|
|
5
7
|
export { calendar } from './calendar.js';
|
|
6
8
|
export { check } from './check.js';
|
|
7
9
|
export { chevronDown } from './chevron-down.js';
|
|
8
10
|
export { chevronLeft } from './chevron-left.js';
|
|
9
11
|
export { chevronRight } from './chevron-right.js';
|
|
10
12
|
export { chevronUp } from './chevron-up.js';
|
|
13
|
+
export { chevronsUpDown } from './chevrons-up-down.js';
|
|
11
14
|
export { circleAlert } from './circle-alert.js';
|
|
12
15
|
export { circleCheck } from './circle-check.js';
|
|
13
16
|
export { circleX } from './circle-x.js';
|
|
17
|
+
export { cookie } from './cookie.js';
|
|
14
18
|
export { copy } from './copy.js';
|
|
15
19
|
export { download } from './download.js';
|
|
16
20
|
export { ellipsis } from './ellipsis.js';
|
|
@@ -4,19 +4,49 @@ import { Base } from '../../../common/Base/Base.js';
|
|
|
4
4
|
import { type SurfaceType } from '../../../common/props/surface/surface.props.js';
|
|
5
5
|
import { type InputSizeType, type InputTypeType } from './Input.props.js';
|
|
6
6
|
/**
|
|
7
|
+
* Form-associated text field. Renders its own label, hint and error inside the
|
|
8
|
+
* shadow root, next to the native `<input>` they describe, so the label is
|
|
9
|
+
* associated with `for` and the messages with `aria-describedby` (error first,
|
|
10
|
+
* then hint). Inside a `<dsgn-field>`, Field supplies `label`, `hint`, `error`,
|
|
11
|
+
* `required`, `invalid` and `size`; see `common/helpers/field-control.ts`.
|
|
12
|
+
*
|
|
7
13
|
* @fires dsgn-input - Fired when the value changes; `detail` is `{ value, name }`.
|
|
14
|
+
*
|
|
15
|
+
* @csspart label - The visible `<label>`.
|
|
16
|
+
* @csspart required-indicator - The `*` appended to the label when `required`. Hidden from assistive technology; `required` on the input is what is announced.
|
|
17
|
+
* @csspart input - The native `<input>`.
|
|
18
|
+
* @csspart hint - Persistent hint text below the input.
|
|
19
|
+
* @csspart error - Error message, icon and text, below the hint.
|
|
8
20
|
*/
|
|
9
21
|
export declare class Input extends Base {
|
|
10
22
|
#private;
|
|
11
23
|
static styles: CSSResultGroup;
|
|
12
24
|
static formAssociated: boolean;
|
|
25
|
+
/**
|
|
26
|
+
* `focus()` on the host (and a click on a `<label>` pointing at it) moves
|
|
27
|
+
* focus to the inner `<input>`, so consumers can focus the field after
|
|
28
|
+
* setting an error and have it announced.
|
|
29
|
+
*/
|
|
30
|
+
static shadowRootOptions: ShadowRootInit;
|
|
13
31
|
constructor();
|
|
14
32
|
surface: SurfaceType;
|
|
15
33
|
type: InputTypeType;
|
|
16
34
|
placeholder: string;
|
|
17
35
|
label: string;
|
|
36
|
+
/**
|
|
37
|
+
* Accessible name for a field with no visible `label`. Ignored when `label`
|
|
38
|
+
* is set, so the visible text and the announced name cannot disagree.
|
|
39
|
+
*/
|
|
18
40
|
ariaLabel: string;
|
|
41
|
+
/** Supporting text below the input. Stays visible alongside an error. */
|
|
42
|
+
hint: string;
|
|
43
|
+
/** Error message. A non-empty value also marks the field invalid. */
|
|
19
44
|
error: string;
|
|
45
|
+
/**
|
|
46
|
+
* Marks the field invalid (`aria-invalid` and error styling) without a
|
|
47
|
+
* message, for example when the error is reported elsewhere on the page.
|
|
48
|
+
*/
|
|
49
|
+
invalid: boolean;
|
|
20
50
|
size: InputSizeType;
|
|
21
51
|
/**
|
|
22
52
|
* Current value. Deliberately not reflected: a native `<input>`'s `value`
|
|
@@ -34,6 +64,8 @@ export declare class Input extends Base {
|
|
|
34
64
|
name: string;
|
|
35
65
|
disabled: boolean;
|
|
36
66
|
required: boolean;
|
|
67
|
+
/** Focusable and copyable, but not editable. */
|
|
68
|
+
readOnly: boolean;
|
|
37
69
|
/**
|
|
38
70
|
* Disabled state inherited from an ancestor `<fieldset>`/form owner, kept
|
|
39
71
|
* separate from the authored `disabled` property. Writing the inherited state
|
|
@@ -46,11 +78,16 @@ export declare class Input extends Base {
|
|
|
46
78
|
private _formDisabled;
|
|
47
79
|
/** Authored `disabled` combined with any state inherited from the form. */
|
|
48
80
|
private get isDisabled();
|
|
81
|
+
private get isInvalid();
|
|
82
|
+
private get state();
|
|
49
83
|
private _syncValidity;
|
|
50
84
|
private _handleInput;
|
|
51
85
|
formResetCallback(): void;
|
|
52
86
|
formDisabledCallback(disabled: boolean): void;
|
|
53
87
|
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
88
|
+
private _renderLabel;
|
|
89
|
+
private _renderHint;
|
|
90
|
+
private _renderError;
|
|
54
91
|
render(): import("lit").TemplateResult<1>;
|
|
55
92
|
}
|
|
56
93
|
declare global {
|