@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,19 @@
|
|
|
1
|
+
import { type SizeType } from '../../../common/props/size/size.props.js';
|
|
2
|
+
/** One choice in a `dsgn-select`. */
|
|
3
|
+
export interface SelectOption {
|
|
4
|
+
/** Submitted with the form and reported in `dsgn-change`. */
|
|
5
|
+
value: string;
|
|
6
|
+
/** Visible text, also used for typeahead. */
|
|
7
|
+
label: string;
|
|
8
|
+
/** Shown but not selectable; skipped by the keyboard. */
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
/** Short trailing note, for example why the option is unavailable. */
|
|
11
|
+
tag?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare const selectSizeValues: {
|
|
14
|
+
readonly SM: "sm";
|
|
15
|
+
readonly MD: "md";
|
|
16
|
+
readonly LG: "lg";
|
|
17
|
+
};
|
|
18
|
+
export type SelectSizeType = SizeType;
|
|
19
|
+
export declare const selectSizeProps: import("lit").PropertyDeclaration<unknown, unknown>;
|
|
@@ -0,0 +1,40 @@
|
|
|
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/Select/src/Select.props.ts
|
|
35
|
+
var selectSizeValues = sizeValues;
|
|
36
|
+
var selectSizeProps = sizeProps;
|
|
37
|
+
export {
|
|
38
|
+
selectSizeProps,
|
|
39
|
+
selectSizeValues
|
|
40
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { OverlayPlacement } from '../../../common/controllers/OverlayPositionController.js';
|
|
2
|
+
import { type OverlayPanelState } from '../../../common/styles/overlay-panel.styles.js';
|
|
3
|
+
import { type SelectSizeType } from './Select.props.js';
|
|
4
|
+
/**
|
|
5
|
+
* Visual state of the trigger. Exactly one applies, so the border and
|
|
6
|
+
* background utilities never compete: disabled wins over open, which wins over
|
|
7
|
+
* invalid. The trigger matches `dsgn-input` state for state.
|
|
8
|
+
*/
|
|
9
|
+
export type SelectState = 'default' | 'open' | 'invalid' | 'disabled';
|
|
10
|
+
export declare const triggerClasses: (size: SelectSizeType, state: SelectState) => string;
|
|
11
|
+
export declare const valueClasses: (isPlaceholder: boolean) => string;
|
|
12
|
+
export declare const chevronClasses: (size: SelectSizeType, open: boolean) => string;
|
|
13
|
+
export declare const anchorClasses: () => string;
|
|
14
|
+
/**
|
|
15
|
+
* The listbox: the shared overlay panel (see `common/styles`), as wide as the
|
|
16
|
+
* trigger — never so narrow that labels truncate on a compact trigger, which
|
|
17
|
+
* is what the position shift is for — and scrolling past ten or so options.
|
|
18
|
+
*/
|
|
19
|
+
export declare const listboxClasses: (panel: OverlayPanelState, placement: OverlayPlacement) => string;
|
|
20
|
+
export declare const optionClasses: (size: SelectSizeType, { active, selected, disabled, }: Record<"active" | "selected" | "disabled", boolean>) => string;
|
|
21
|
+
export declare const checkClasses: () => string;
|
|
22
|
+
export declare const checkSlotClasses: () => string;
|
|
23
|
+
export declare const optionLabelClasses: () => string;
|
|
24
|
+
export declare const optionTagClasses: () => string;
|
|
25
|
+
export declare const wrapperClasses: () => string;
|
|
26
|
+
export declare const labelClasses: (size: SelectSizeType, disabled: boolean) => string;
|
|
27
|
+
export declare const requiredClasses: () => string;
|
|
28
|
+
export declare const hintClasses: (size: SelectSizeType) => string;
|
|
29
|
+
export declare const errorClasses: (size: SelectSizeType) => string;
|
|
30
|
+
export declare const errorIconClasses: () => string;
|
|
@@ -0,0 +1,93 @@
|
|
|
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
|
+
import { type SurfaceType } from '../../../common/props/surface/surface.props.js';
|
|
6
|
+
import { type TableColumn, type TableRow, type TableSort } from './Table.props.js';
|
|
7
|
+
/**
|
|
8
|
+
* A semantic data table with sortable columns.
|
|
9
|
+
*
|
|
10
|
+
* The table never sorts data itself. Clicking a sortable header fires
|
|
11
|
+
* `dsgn-sort`; the consumer reorders `rows` and passes the new state back as
|
|
12
|
+
* `sort`, which drives `aria-sort` and the header icons. A column that is not
|
|
13
|
+
* the current sort sorts ascending; the current ascending column sorts
|
|
14
|
+
* descending. There is no unsorted step.
|
|
15
|
+
*
|
|
16
|
+
* Every cell renders `row[column.key]` as text. To put markup in a cell — a
|
|
17
|
+
* badge, an avatar, a menu button — slot an element into
|
|
18
|
+
* `cell:<rowKey>:<columnKey>`, where `rowKey` is the row's `row-key` field.
|
|
19
|
+
* Slotted content stays in the light DOM, so consumer styles, handlers and
|
|
20
|
+
* framework components work as usual.
|
|
21
|
+
*
|
|
22
|
+
* The table scrolls sideways below its natural width. The first column stays
|
|
23
|
+
* pinned while it scrolls (see `TableColumn.pin`), and the side with more
|
|
24
|
+
* content shows an edge fade.
|
|
25
|
+
*
|
|
26
|
+
* @fires dsgn-sort - Fired when a sortable header is clicked; `detail` is `{ column, direction }`, the sort the consumer should apply.
|
|
27
|
+
*
|
|
28
|
+
* @slot empty - Shown in a single full-width cell when `rows` is empty. Headers stay visible.
|
|
29
|
+
* @slot cell:<rowKey>:<columnKey> - Replaces the text of one cell.
|
|
30
|
+
*
|
|
31
|
+
* @csspart container - The bordered outer box.
|
|
32
|
+
* @csspart caption - The title bar above the table.
|
|
33
|
+
* @csspart scroller - The horizontally scrolling region around the table.
|
|
34
|
+
* @csspart table - The `<table>` element.
|
|
35
|
+
* @csspart header-cell - Each column header `<th>`.
|
|
36
|
+
* @csspart sort-button - The button inside a sortable header.
|
|
37
|
+
* @csspart row - Each body `<tr>`.
|
|
38
|
+
* @csspart cell - Each body cell, including row headers.
|
|
39
|
+
* @csspart row-header - Each body `<th scope="row">`.
|
|
40
|
+
* @csspart empty - The full-width cell holding the `empty` slot.
|
|
41
|
+
*/
|
|
42
|
+
export declare class Table extends Base {
|
|
43
|
+
static styles: CSSResultGroup;
|
|
44
|
+
surface: SurfaceType;
|
|
45
|
+
size: SizeType;
|
|
46
|
+
/** Column definitions, in display order. */
|
|
47
|
+
columns: TableColumn[];
|
|
48
|
+
/** Row data, already in the order to display. */
|
|
49
|
+
rows: TableRow[];
|
|
50
|
+
/** Row field that identifies a row in cell slot names. Falls back to the row index. */
|
|
51
|
+
rowKey: string;
|
|
52
|
+
/** The current sort, as applied by the consumer. `null` when unsorted. */
|
|
53
|
+
sort: TableSort | null;
|
|
54
|
+
/** Visible title. Labels the table and its scroll region. */
|
|
55
|
+
caption: string;
|
|
56
|
+
/** Secondary text beside the caption, such as a row count. */
|
|
57
|
+
captionMeta: string;
|
|
58
|
+
/**
|
|
59
|
+
* Accessible name used when there is no visible `caption`, for a table
|
|
60
|
+
* titled by a heading outside the component.
|
|
61
|
+
*/
|
|
62
|
+
label: string;
|
|
63
|
+
private _overflow;
|
|
64
|
+
private _moreStart;
|
|
65
|
+
private _moreEnd;
|
|
66
|
+
private _scroller;
|
|
67
|
+
private _resizeObserver;
|
|
68
|
+
connectedCallback(): void;
|
|
69
|
+
disconnectedCallback(): void;
|
|
70
|
+
firstUpdated(): void;
|
|
71
|
+
private _observeSize;
|
|
72
|
+
updated(changedProperties: Map<string | number | symbol, unknown>): void;
|
|
73
|
+
/** Mirrors which sides have hidden content, for the pinned edge and fades. */
|
|
74
|
+
private _updateEdges;
|
|
75
|
+
private _handleSort;
|
|
76
|
+
private get _rowHeaderKey();
|
|
77
|
+
private _isPinned;
|
|
78
|
+
private _alignOf;
|
|
79
|
+
private _ariaSort;
|
|
80
|
+
private _keyOf;
|
|
81
|
+
private _renderSortIcon;
|
|
82
|
+
private _renderHeaderContent;
|
|
83
|
+
private _renderHeaderCell;
|
|
84
|
+
private _renderCell;
|
|
85
|
+
private _renderBody;
|
|
86
|
+
private _renderCaption;
|
|
87
|
+
render(): import("lit").TemplateResult<1>;
|
|
88
|
+
}
|
|
89
|
+
declare global {
|
|
90
|
+
interface HTMLElementTagNameMap {
|
|
91
|
+
'dsgn-table': Table;
|
|
92
|
+
}
|
|
93
|
+
}
|