@aquera/nile-elements 1.9.4 → 1.9.6
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 +13 -0
- package/dist/index-5fef1a0d.esm.js +1 -0
- package/dist/index-8f38fae3.cjs.js +2 -0
- package/dist/index-8f38fae3.cjs.js.map +1 -0
- package/dist/index.cjs.js +1 -1
- package/dist/index.esm.js +1 -1
- package/dist/index.js +1527 -804
- package/dist/nile-chip/nile-chip.css.cjs.js +1 -1
- package/dist/nile-chip/nile-chip.css.cjs.js.map +1 -1
- package/dist/nile-chip/nile-chip.css.esm.js +8 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js +1 -1
- package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
- package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
- package/dist/nile-combobox/index.cjs.js +1 -1
- package/dist/nile-combobox/index.esm.js +1 -1
- package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
- package/dist/nile-combobox/nile-combobox.esm.js +1 -1
- package/dist/nile-command-menu/index.cjs.js +2 -0
- package/dist/nile-command-menu/index.cjs.js.map +1 -0
- package/dist/nile-command-menu/index.esm.js +1 -0
- package/dist/nile-command-menu/nile-command-menu.cjs.js +2 -0
- package/dist/nile-command-menu/nile-command-menu.cjs.js.map +1 -0
- package/dist/nile-command-menu/nile-command-menu.css.cjs.js +2 -0
- package/dist/nile-command-menu/nile-command-menu.css.cjs.js.map +1 -0
- package/dist/nile-command-menu/nile-command-menu.css.esm.js +182 -0
- package/dist/nile-command-menu/nile-command-menu.esm.js +97 -0
- package/dist/nile-command-menu-group/index.cjs.js +2 -0
- package/dist/nile-command-menu-group/index.cjs.js.map +1 -0
- package/dist/nile-command-menu-group/index.esm.js +1 -0
- package/dist/nile-command-menu-group/nile-command-menu-group.cjs.js +2 -0
- package/dist/nile-command-menu-group/nile-command-menu-group.cjs.js.map +1 -0
- package/dist/nile-command-menu-group/nile-command-menu-group.css.cjs.js +2 -0
- package/dist/nile-command-menu-group/nile-command-menu-group.css.cjs.js.map +1 -0
- package/dist/nile-command-menu-group/nile-command-menu-group.css.esm.js +33 -0
- package/dist/nile-command-menu-group/nile-command-menu-group.esm.js +11 -0
- package/dist/nile-command-menu-item/index.cjs.js +2 -0
- package/dist/nile-command-menu-item/index.cjs.js.map +1 -0
- package/dist/nile-command-menu-item/index.esm.js +1 -0
- package/dist/nile-command-menu-item/nile-command-menu-item.cjs.js +2 -0
- package/dist/nile-command-menu-item/nile-command-menu-item.cjs.js.map +1 -0
- package/dist/nile-command-menu-item/nile-command-menu-item.css.cjs.js +2 -0
- package/dist/nile-command-menu-item/nile-command-menu-item.css.cjs.js.map +1 -0
- package/dist/nile-command-menu-item/nile-command-menu-item.css.esm.js +115 -0
- package/dist/nile-command-menu-item/nile-command-menu-item.esm.js +21 -0
- package/dist/nile-detail/index.cjs.js +1 -1
- package/dist/nile-detail/index.esm.js +1 -1
- package/dist/nile-detail/nile-detail.cjs.js +1 -1
- package/dist/nile-detail/nile-detail.esm.js +1 -1
- package/dist/nile-dialog/nile-dialog.cjs.js +1 -1
- package/dist/nile-dialog/nile-dialog.cjs.js.map +1 -1
- package/dist/nile-dialog/nile-dialog.esm.js +1 -1
- package/dist/nile-dot-stepper/index.cjs.js +2 -0
- package/dist/nile-dot-stepper/index.cjs.js.map +1 -0
- package/dist/nile-dot-stepper/index.esm.js +1 -0
- package/dist/nile-dot-stepper/nile-dot-stepper.cjs.js +2 -0
- package/dist/nile-dot-stepper/nile-dot-stepper.cjs.js.map +1 -0
- package/dist/nile-dot-stepper/nile-dot-stepper.css.cjs.js +2 -0
- package/dist/nile-dot-stepper/nile-dot-stepper.css.cjs.js.map +1 -0
- package/dist/nile-dot-stepper/nile-dot-stepper.css.esm.js +77 -0
- package/dist/nile-dot-stepper/nile-dot-stepper.esm.js +24 -0
- package/dist/nile-hero/nile-hero.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.cjs.js.map +1 -1
- package/dist/nile-hero/nile-hero.css.cjs.js +1 -1
- package/dist/nile-hero/nile-hero.css.cjs.js.map +1 -1
- package/dist/nile-hero/nile-hero.css.esm.js +14 -14
- package/dist/nile-hero/nile-hero.esm.js +1 -1
- package/dist/nile-hero-header/nile-hero-header.cjs.js +1 -1
- package/dist/nile-hero-header/nile-hero-header.cjs.js.map +1 -1
- package/dist/nile-hero-header/nile-hero-header.css.cjs.js +1 -1
- package/dist/nile-hero-header/nile-hero-header.css.cjs.js.map +1 -1
- package/dist/nile-hero-header/nile-hero-header.css.esm.js +11 -11
- package/dist/nile-hero-header/nile-hero-header.esm.js +3 -3
- package/dist/nile-rich-text-editor/index.cjs.js +1 -1
- package/dist/nile-rich-text-editor/index.esm.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js.map +1 -1
- package/dist/nile-rich-text-editor/nile-rich-text-editor.css.esm.js +70 -0
- package/dist/nile-rich-text-editor/nile-rich-text-editor.esm.js +1 -1
- package/dist/nile-rich-text-editor/nile-rte-image.cjs.js +3 -0
- package/dist/nile-rich-text-editor/nile-rte-image.cjs.js.map +1 -0
- package/dist/nile-rich-text-editor/nile-rte-image.esm.js +96 -0
- package/dist/nile-section-message/nile-section-message.css.cjs.js +1 -1
- package/dist/nile-section-message/nile-section-message.css.cjs.js.map +1 -1
- package/dist/nile-section-message/nile-section-message.css.esm.js +7 -8
- package/dist/src/index.d.ts +4 -0
- package/dist/src/index.js +4 -0
- package/dist/src/index.js.map +1 -1
- package/dist/src/nile-chip/nile-chip.css.js +8 -1
- package/dist/src/nile-chip/nile-chip.css.js.map +1 -1
- package/dist/src/nile-code-editor/nile-code-editor.js +3 -3
- package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
- package/dist/src/nile-command-menu/index.d.ts +1 -0
- package/dist/src/nile-command-menu/index.js +2 -0
- package/dist/src/nile-command-menu/index.js.map +1 -0
- package/dist/src/nile-command-menu/nile-command-menu.css.d.ts +12 -0
- package/dist/src/nile-command-menu/nile-command-menu.css.js +194 -0
- package/dist/src/nile-command-menu/nile-command-menu.css.js.map +1 -0
- package/dist/src/nile-command-menu/nile-command-menu.d.ts +137 -0
- package/dist/src/nile-command-menu/nile-command-menu.js +557 -0
- package/dist/src/nile-command-menu/nile-command-menu.js.map +1 -0
- package/dist/src/nile-command-menu/nile-command-menu.test.d.ts +3 -0
- package/dist/src/nile-command-menu/nile-command-menu.test.js +268 -0
- package/dist/src/nile-command-menu/nile-command-menu.test.js.map +1 -0
- package/dist/src/nile-command-menu-group/index.d.ts +1 -0
- package/dist/src/nile-command-menu-group/index.js +2 -0
- package/dist/src/nile-command-menu-group/index.js.map +1 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.css.d.ts +12 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.css.js +45 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.css.js.map +1 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.d.ts +38 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.js +68 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.js.map +1 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.test.d.ts +2 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.test.js +22 -0
- package/dist/src/nile-command-menu-group/nile-command-menu-group.test.js.map +1 -0
- package/dist/src/nile-command-menu-item/index.d.ts +1 -0
- package/dist/src/nile-command-menu-item/index.js +2 -0
- package/dist/src/nile-command-menu-item/index.js.map +1 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.css.d.ts +12 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.css.js +127 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.css.js.map +1 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.d.ts +73 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.js +174 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.js.map +1 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.test.d.ts +1 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.test.js +35 -0
- package/dist/src/nile-command-menu-item/nile-command-menu-item.test.js.map +1 -0
- package/dist/src/nile-dialog/nile-dialog.js +1 -1
- package/dist/src/nile-dialog/nile-dialog.js.map +1 -1
- package/dist/src/nile-dot-stepper/index.d.ts +1 -0
- package/dist/src/nile-dot-stepper/index.js +2 -0
- package/dist/src/nile-dot-stepper/index.js.map +1 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.css.d.ts +12 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.css.js +89 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.css.js.map +1 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.d.ts +48 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.js +153 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.js.map +1 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.test.d.ts +1 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.test.js +319 -0
- package/dist/src/nile-dot-stepper/nile-dot-stepper.test.js.map +1 -0
- package/dist/src/nile-hero/nile-hero.css.js +12 -12
- package/dist/src/nile-hero/nile-hero.css.js.map +1 -1
- package/dist/src/nile-hero/nile-hero.js +1 -1
- package/dist/src/nile-hero/nile-hero.js.map +1 -1
- package/dist/src/nile-hero-header/nile-hero-header.css.js +9 -9
- package/dist/src/nile-hero-header/nile-hero-header.css.js.map +1 -1
- package/dist/src/nile-hero-header/nile-hero-header.js +1 -1
- package/dist/src/nile-hero-header/nile-hero-header.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js +70 -0
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.d.ts +3 -0
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js +81 -3
- package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js.map +1 -1
- package/dist/src/nile-rich-text-editor/nile-rte-image.d.ts +87 -0
- package/dist/src/nile-rich-text-editor/nile-rte-image.js +1073 -0
- package/dist/src/nile-rich-text-editor/nile-rte-image.js.map +1 -0
- package/dist/src/nile-section-message/nile-section-message.css.js +7 -8
- package/dist/src/nile-section-message/nile-section-message.css.js.map +1 -1
- package/dist/src/version.js +1 -1
- package/dist/src/version.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +2 -1
- package/src/index.ts +4 -0
- package/src/nile-chip/nile-chip.css.ts +8 -1
- package/src/nile-code-editor/nile-code-editor.ts +3 -3
- package/src/nile-command-menu/index.ts +1 -0
- package/src/nile-command-menu/nile-command-menu.css.ts +196 -0
- package/src/nile-command-menu/nile-command-menu.test.ts +289 -0
- package/src/nile-command-menu/nile-command-menu.ts +601 -0
- package/src/nile-command-menu-group/index.ts +1 -0
- package/src/nile-command-menu-group/nile-command-menu-group.css.ts +47 -0
- package/src/nile-command-menu-group/nile-command-menu-group.test.ts +23 -0
- package/src/nile-command-menu-group/nile-command-menu-group.ts +72 -0
- package/src/nile-command-menu-item/index.ts +1 -0
- package/src/nile-command-menu-item/nile-command-menu-item.css.ts +129 -0
- package/src/nile-command-menu-item/nile-command-menu-item.test.ts +36 -0
- package/src/nile-command-menu-item/nile-command-menu-item.ts +172 -0
- package/src/nile-dialog/nile-dialog.ts +1 -1
- package/src/nile-dot-stepper/index.ts +1 -0
- package/src/nile-dot-stepper/nile-dot-stepper.css.ts +90 -0
- package/src/nile-dot-stepper/nile-dot-stepper.test.ts +493 -0
- package/src/nile-dot-stepper/nile-dot-stepper.ts +159 -0
- package/src/nile-hero/nile-hero.css.ts +12 -12
- package/src/nile-hero/nile-hero.ts +1 -1
- package/src/nile-hero-header/nile-hero-header.css.ts +9 -9
- package/src/nile-hero-header/nile-hero-header.ts +1 -1
- package/src/nile-rich-text-editor/nile-rich-text-editor.css.ts +70 -0
- package/src/nile-rich-text-editor/nile-rich-text-editor.ts +89 -3
- package/src/nile-rich-text-editor/nile-rte-image.ts +1132 -0
- package/src/nile-section-message/nile-section-message.css.ts +7 -8
- package/stories/dot-stepper.stories.ts +67 -0
- package/vscode-html-custom-data.json +220 -1
- package/dist/index-c0b5232c.cjs.js +0 -2
- package/dist/index-c0b5232c.cjs.js.map +0 -1
- package/dist/index-e43a18eb.esm.js +0 -1
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Aquera Inc 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Dot Stepper CSS
|
|
9
|
+
*/
|
|
10
|
+
export declare const styles: import("lit").CSSResult;
|
|
11
|
+
declare const _default: import("lit").CSSResult[];
|
|
12
|
+
export default _default;
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Aquera Inc 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { css } from 'lit';
|
|
8
|
+
/**
|
|
9
|
+
* Dot Stepper CSS
|
|
10
|
+
*/
|
|
11
|
+
export const styles = css `
|
|
12
|
+
:host {
|
|
13
|
+
display: inline-block;
|
|
14
|
+
-webkit-font-smoothing: var(
|
|
15
|
+
--nile-webkit-font-smoothing,
|
|
16
|
+
var(--ng-webkit-font-smoothing)
|
|
17
|
+
);
|
|
18
|
+
-moz-osx-font-smoothing: var(
|
|
19
|
+
--nile-moz-osx-font-smoothing,
|
|
20
|
+
var(--ng-moz-osx-font-smoothing)
|
|
21
|
+
);
|
|
22
|
+
text-rendering: var(--nile-text-rendering, var(--ng-text-rendering));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
.dots {
|
|
26
|
+
display: flex;
|
|
27
|
+
flex-wrap: wrap;
|
|
28
|
+
gap: var(--nile-spacing-10px, var(--ng-spacing-2-5));
|
|
29
|
+
align-items: center;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.dot {
|
|
33
|
+
background: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
|
|
34
|
+
border: none;
|
|
35
|
+
padding: 0;
|
|
36
|
+
margin: 0;
|
|
37
|
+
box-sizing: border-box;
|
|
38
|
+
cursor: pointer;
|
|
39
|
+
border-radius: 50%;
|
|
40
|
+
width: var(--nile-spacing-10px, var(--ng-spacing-2-5));
|
|
41
|
+
height: var(--nile-spacing-10px, var(--ng-spacing-2-5));
|
|
42
|
+
transition: background-color 0.2s ease-out, transform 0.2s ease-out;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.dot--active {
|
|
46
|
+
background: var(
|
|
47
|
+
--nile-colors-primary-600,
|
|
48
|
+
var(--ng-colors-text-brand-secondary-700)
|
|
49
|
+
);
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/* Sizes */
|
|
53
|
+
.dot--sm {
|
|
54
|
+
width: var(--nile-spacing-4px, var(--ng-spacing-1));
|
|
55
|
+
height: var(--nile-spacing-4px, var(--ng-spacing-1));
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
.dot--md {
|
|
59
|
+
width: var(--nile-spacing-10px, var(--ng-spacing-2-5));
|
|
60
|
+
height: var(--nile-spacing-10px, var(--ng-spacing-2-5));
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.dot--lg {
|
|
64
|
+
width: var(--nile-spacing-14px, var(--ng-spacing-3-5));
|
|
65
|
+
height: var(--nile-spacing-14px, var(--ng-spacing-3-5));
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.dots:has(.dot--sm) {
|
|
69
|
+
gap: var(--nile-spacing-6px, var(--ng-spacing-1-5));
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
.dots:has(.dot--lg) {
|
|
73
|
+
gap: var(--nile-spacing-2-x, var(--ng-spacing-3));
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.dot:focus-visible {
|
|
77
|
+
outline: var(--nile-spacing-2px, var(--ng-spacing-0-5)) solid
|
|
78
|
+
var(--nile-colors-stroke-strong-950, var(--ng-colors-border-secondary));
|
|
79
|
+
outline-offset: var(--nile-spacing-2px, var(--ng-spacing-0-5));
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
:host([disabled]) .dot,
|
|
83
|
+
.dot:disabled {
|
|
84
|
+
cursor: not-allowed;
|
|
85
|
+
opacity: 0.5;
|
|
86
|
+
}
|
|
87
|
+
`;
|
|
88
|
+
export default [styles];
|
|
89
|
+
//# sourceMappingURL=nile-dot-stepper.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nile-dot-stepper.css.js","sourceRoot":"","sources":["../../../src/nile-dot-stepper/nile-dot-stepper.css.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4ExB,CAAC;AACF,eAAe,CAAC,MAAM,CAAC,CAAC","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { css } from 'lit';\n\n/**\n * Dot Stepper CSS\n */\nexport const styles = css`\n :host {\n display: inline-block;\n -webkit-font-smoothing: var(\n --nile-webkit-font-smoothing,\n var(--ng-webkit-font-smoothing)\n );\n -moz-osx-font-smoothing: var(\n --nile-moz-osx-font-smoothing,\n var(--ng-moz-osx-font-smoothing)\n );\n text-rendering: var(--nile-text-rendering, var(--ng-text-rendering));\n }\n\n .dots {\n display: flex;\n flex-wrap: wrap;\n gap: var(--nile-spacing-10px, var(--ng-spacing-2-5));\n align-items: center;\n }\n\n .dot {\n background: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));\n border: none;\n padding: 0;\n margin: 0;\n box-sizing: border-box;\n cursor: pointer;\n border-radius: 50%;\n width: var(--nile-spacing-10px, var(--ng-spacing-2-5));\n height: var(--nile-spacing-10px, var(--ng-spacing-2-5));\n transition: background-color 0.2s ease-out, transform 0.2s ease-out;\n }\n\n .dot--active {\n background: var(\n --nile-colors-primary-600,\n var(--ng-colors-text-brand-secondary-700)\n );\n }\n\n /* Sizes */\n .dot--sm {\n width: var(--nile-spacing-4px, var(--ng-spacing-1));\n height: var(--nile-spacing-4px, var(--ng-spacing-1));\n }\n\n .dot--md {\n width: var(--nile-spacing-10px, var(--ng-spacing-2-5));\n height: var(--nile-spacing-10px, var(--ng-spacing-2-5));\n }\n\n .dot--lg {\n width: var(--nile-spacing-14px, var(--ng-spacing-3-5));\n height: var(--nile-spacing-14px, var(--ng-spacing-3-5));\n }\n\n .dots:has(.dot--sm) {\n gap: var(--nile-spacing-6px, var(--ng-spacing-1-5));\n }\n\n .dots:has(.dot--lg) {\n gap: var(--nile-spacing-2-x, var(--ng-spacing-3));\n }\n\n .dot:focus-visible {\n outline: var(--nile-spacing-2px, var(--ng-spacing-0-5)) solid\n var(--nile-colors-stroke-strong-950, var(--ng-colors-border-secondary));\n outline-offset: var(--nile-spacing-2px, var(--ng-spacing-0-5));\n }\n\n :host([disabled]) .dot,\n .dot:disabled {\n cursor: not-allowed;\n opacity: 0.5;\n }\n`;\nexport default [styles];\n"]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Aquera Inc 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import NileElement from '../internal/nile-element';
|
|
8
|
+
import type { CSSResultGroup, TemplateResult } from 'lit';
|
|
9
|
+
/**
|
|
10
|
+
* Nile dot stepper component.
|
|
11
|
+
*
|
|
12
|
+
* @tag nile-dot-stepper
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
/**
|
|
16
|
+
* @summary Dot steppers display a horizontal row of small dots indicating progress or position, with one active dot and the rest inactive.
|
|
17
|
+
* @status stable
|
|
18
|
+
*
|
|
19
|
+
* @event nile-step-change - Emitted when a dot is selected via click or keyboard. The `detail` contains the 1-based `value` of the selected dot.
|
|
20
|
+
*
|
|
21
|
+
* @csspart base - The component's base wrapper (the dots container).
|
|
22
|
+
* @csspart dot - An individual dot button.
|
|
23
|
+
*/
|
|
24
|
+
export declare class NileDotStepper extends NileElement {
|
|
25
|
+
static styles: CSSResultGroup;
|
|
26
|
+
connectedCallback(): void;
|
|
27
|
+
/** The total number of dots. */
|
|
28
|
+
total: number;
|
|
29
|
+
/** The 1-based index of the active dot. */
|
|
30
|
+
current: number;
|
|
31
|
+
/** The size of each dot. */
|
|
32
|
+
size: 'sm' | 'md' | 'lg';
|
|
33
|
+
/** Disables click and keyboard interaction. */
|
|
34
|
+
disabled: boolean;
|
|
35
|
+
/** Clamps the active value to the valid `[1, total]` range. */
|
|
36
|
+
private clamp;
|
|
37
|
+
private selectStep;
|
|
38
|
+
private handleDotClick;
|
|
39
|
+
private focusDot;
|
|
40
|
+
private handleKeyDown;
|
|
41
|
+
render(): TemplateResult;
|
|
42
|
+
}
|
|
43
|
+
export default NileDotStepper;
|
|
44
|
+
declare global {
|
|
45
|
+
interface HTMLElementTagNameMap {
|
|
46
|
+
'nile-dot-stepper': NileDotStepper;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright Aquera Inc 2023
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the BSD-3-Clause license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
import { __decorate } from "tslib";
|
|
8
|
+
import { html } from 'lit';
|
|
9
|
+
import { styles } from './nile-dot-stepper.css';
|
|
10
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
11
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
12
|
+
import NileElement, { setupA11yMetadata } from '../internal/nile-element';
|
|
13
|
+
import { A11yProperty } from '../internal/accessibility/a11y.property.enum';
|
|
14
|
+
import { A11yRole } from '../internal/accessibility/a11y.role.enum';
|
|
15
|
+
import { Role } from '../internal/accessibility/role.enum';
|
|
16
|
+
/**
|
|
17
|
+
* Nile dot stepper component.
|
|
18
|
+
*
|
|
19
|
+
* @tag nile-dot-stepper
|
|
20
|
+
*
|
|
21
|
+
*/
|
|
22
|
+
/**
|
|
23
|
+
* @summary Dot steppers display a horizontal row of small dots indicating progress or position, with one active dot and the rest inactive.
|
|
24
|
+
* @status stable
|
|
25
|
+
*
|
|
26
|
+
* @event nile-step-change - Emitted when a dot is selected via click or keyboard. The `detail` contains the 1-based `value` of the selected dot.
|
|
27
|
+
*
|
|
28
|
+
* @csspart base - The component's base wrapper (the dots container).
|
|
29
|
+
* @csspart dot - An individual dot button.
|
|
30
|
+
*/
|
|
31
|
+
let NileDotStepper = class NileDotStepper extends NileElement {
|
|
32
|
+
constructor() {
|
|
33
|
+
super(...arguments);
|
|
34
|
+
/** The total number of dots. */
|
|
35
|
+
this.total = 0;
|
|
36
|
+
/** The 1-based index of the active dot. */
|
|
37
|
+
this.current = 1;
|
|
38
|
+
/** The size of each dot. */
|
|
39
|
+
this.size = 'md';
|
|
40
|
+
/** Disables click and keyboard interaction. */
|
|
41
|
+
this.disabled = false;
|
|
42
|
+
}
|
|
43
|
+
connectedCallback() {
|
|
44
|
+
super.connectedCallback();
|
|
45
|
+
setupA11yMetadata(this, {
|
|
46
|
+
[Role.Role]: A11yRole.Tablist,
|
|
47
|
+
[A11yProperty.AriaLabel]: 'Progress',
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
/** Clamps the active value to the valid `[1, total]` range. */
|
|
51
|
+
clamp(value) {
|
|
52
|
+
if (this.total < 1)
|
|
53
|
+
return 1;
|
|
54
|
+
return Math.min(Math.max(value, 1), this.total);
|
|
55
|
+
}
|
|
56
|
+
selectStep(value) {
|
|
57
|
+
if (this.disabled)
|
|
58
|
+
return;
|
|
59
|
+
const next = this.clamp(value);
|
|
60
|
+
this.current = next;
|
|
61
|
+
this.emit('nile-step-change', { value: next });
|
|
62
|
+
}
|
|
63
|
+
handleDotClick(value) {
|
|
64
|
+
this.selectStep(value);
|
|
65
|
+
}
|
|
66
|
+
focusDot(value) {
|
|
67
|
+
const dot = this.shadowRoot?.querySelector(`[part="dot"][data-index="${value}"]`);
|
|
68
|
+
dot?.focus();
|
|
69
|
+
}
|
|
70
|
+
handleKeyDown(event) {
|
|
71
|
+
if (this.disabled || this.total < 1)
|
|
72
|
+
return;
|
|
73
|
+
const active = this.clamp(this.current);
|
|
74
|
+
let next = null;
|
|
75
|
+
switch (event.key) {
|
|
76
|
+
case 'ArrowRight':
|
|
77
|
+
next = this.clamp(active + 1);
|
|
78
|
+
break;
|
|
79
|
+
case 'ArrowLeft':
|
|
80
|
+
next = this.clamp(active - 1);
|
|
81
|
+
break;
|
|
82
|
+
case 'Home':
|
|
83
|
+
next = 1;
|
|
84
|
+
break;
|
|
85
|
+
case 'End':
|
|
86
|
+
next = this.total;
|
|
87
|
+
break;
|
|
88
|
+
default:
|
|
89
|
+
return;
|
|
90
|
+
}
|
|
91
|
+
event.preventDefault();
|
|
92
|
+
if (next !== null) {
|
|
93
|
+
this.selectStep(next);
|
|
94
|
+
this.focusDot(next);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
render() {
|
|
98
|
+
const active = this.clamp(this.current);
|
|
99
|
+
return html `
|
|
100
|
+
<div
|
|
101
|
+
part="base"
|
|
102
|
+
class="dots"
|
|
103
|
+
role="tablist"
|
|
104
|
+
aria-label="Progress"
|
|
105
|
+
@keydown=${this.handleKeyDown}
|
|
106
|
+
>
|
|
107
|
+
${Array.from({ length: this.total }).map((_, index) => {
|
|
108
|
+
const value = index + 1;
|
|
109
|
+
const isActive = value === active;
|
|
110
|
+
return html `
|
|
111
|
+
<button
|
|
112
|
+
part="dot"
|
|
113
|
+
role="tab"
|
|
114
|
+
type="button"
|
|
115
|
+
data-index=${value}
|
|
116
|
+
class=${classMap({
|
|
117
|
+
dot: true,
|
|
118
|
+
'dot--active': isActive,
|
|
119
|
+
'dot--sm': this.size === 'sm',
|
|
120
|
+
'dot--md': this.size === 'md',
|
|
121
|
+
'dot--lg': this.size === 'lg',
|
|
122
|
+
})}
|
|
123
|
+
aria-selected=${isActive ? 'true' : 'false'}
|
|
124
|
+
aria-label="Step ${value} of ${this.total}"
|
|
125
|
+
tabindex=${isActive ? 0 : -1}
|
|
126
|
+
?disabled=${this.disabled}
|
|
127
|
+
@click=${() => this.handleDotClick(value)}
|
|
128
|
+
></button>
|
|
129
|
+
`;
|
|
130
|
+
})}
|
|
131
|
+
</div>
|
|
132
|
+
`;
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
NileDotStepper.styles = styles;
|
|
136
|
+
__decorate([
|
|
137
|
+
property({ type: Number, reflect: true })
|
|
138
|
+
], NileDotStepper.prototype, "total", void 0);
|
|
139
|
+
__decorate([
|
|
140
|
+
property({ type: Number, reflect: true })
|
|
141
|
+
], NileDotStepper.prototype, "current", void 0);
|
|
142
|
+
__decorate([
|
|
143
|
+
property({ reflect: true })
|
|
144
|
+
], NileDotStepper.prototype, "size", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
property({ type: Boolean, reflect: true })
|
|
147
|
+
], NileDotStepper.prototype, "disabled", void 0);
|
|
148
|
+
NileDotStepper = __decorate([
|
|
149
|
+
customElement('nile-dot-stepper')
|
|
150
|
+
], NileDotStepper);
|
|
151
|
+
export { NileDotStepper };
|
|
152
|
+
export default NileDotStepper;
|
|
153
|
+
//# sourceMappingURL=nile-dot-stepper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nile-dot-stepper.js","sourceRoot":"","sources":["../../../src/nile-dot-stepper/nile-dot-stepper.ts"],"names":[],"mappings":"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","sourcesContent":["/**\n * Copyright Aquera Inc 2023\n *\n * This source code is licensed under the BSD-3-Clause license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { html } from 'lit';\nimport { styles } from './nile-dot-stepper.css';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { customElement, property } from 'lit/decorators.js';\nimport NileElement, { setupA11yMetadata } from '../internal/nile-element';\nimport type { CSSResultGroup, TemplateResult } from 'lit';\nimport { A11yProperty } from '../internal/accessibility/a11y.property.enum';\nimport { A11yRole } from '../internal/accessibility/a11y.role.enum';\nimport { Role } from '../internal/accessibility/role.enum';\n\n/**\n * Nile dot stepper component.\n *\n * @tag nile-dot-stepper\n *\n */\n\n/**\n * @summary Dot steppers display a horizontal row of small dots indicating progress or position, with one active dot and the rest inactive.\n * @status stable\n *\n * @event nile-step-change - Emitted when a dot is selected via click or keyboard. The `detail` contains the 1-based `value` of the selected dot.\n *\n * @csspart base - The component's base wrapper (the dots container).\n * @csspart dot - An individual dot button.\n */\n\n@customElement('nile-dot-stepper')\nexport class NileDotStepper extends NileElement {\n static styles: CSSResultGroup = styles;\n\n connectedCallback(): void {\n super.connectedCallback();\n setupA11yMetadata(this, {\n [Role.Role]: A11yRole.Tablist,\n [A11yProperty.AriaLabel]: 'Progress',\n });\n }\n\n /** The total number of dots. */\n @property({ type: Number, reflect: true }) total = 0;\n\n /** The 1-based index of the active dot. */\n @property({ type: Number, reflect: true }) current = 1;\n\n /** The size of each dot. */\n @property({ reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';\n\n /** Disables click and keyboard interaction. */\n @property({ type: Boolean, reflect: true }) disabled = false;\n\n /** Clamps the active value to the valid `[1, total]` range. */\n private clamp(value: number): number {\n if (this.total < 1) return 1;\n return Math.min(Math.max(value, 1), this.total);\n }\n\n private selectStep(value: number): void {\n if (this.disabled) return;\n const next = this.clamp(value);\n this.current = next;\n this.emit('nile-step-change', { value: next });\n }\n\n private handleDotClick(value: number): void {\n this.selectStep(value);\n }\n\n private focusDot(value: number): void {\n const dot = this.shadowRoot?.querySelector<HTMLButtonElement>(\n `[part=\"dot\"][data-index=\"${value}\"]`\n );\n dot?.focus();\n }\n\n private handleKeyDown(event: KeyboardEvent): void {\n if (this.disabled || this.total < 1) return;\n\n const active = this.clamp(this.current);\n let next: number | null = null;\n\n switch (event.key) {\n case 'ArrowRight':\n next = this.clamp(active + 1);\n break;\n case 'ArrowLeft':\n next = this.clamp(active - 1);\n break;\n case 'Home':\n next = 1;\n break;\n case 'End':\n next = this.total;\n break;\n default:\n return;\n }\n\n event.preventDefault();\n if (next !== null) {\n this.selectStep(next);\n this.focusDot(next);\n }\n }\n\n render(): TemplateResult {\n const active = this.clamp(this.current);\n\n return html`\n <div\n part=\"base\"\n class=\"dots\"\n role=\"tablist\"\n aria-label=\"Progress\"\n @keydown=${this.handleKeyDown}\n >\n ${Array.from({ length: this.total }).map((_, index) => {\n const value = index + 1;\n const isActive = value === active;\n return html`\n <button\n part=\"dot\"\n role=\"tab\"\n type=\"button\"\n data-index=${value}\n class=${classMap({\n dot: true,\n 'dot--active': isActive,\n 'dot--sm': this.size === 'sm',\n 'dot--md': this.size === 'md',\n 'dot--lg': this.size === 'lg',\n })}\n aria-selected=${isActive ? 'true' : 'false'}\n aria-label=\"Step ${value} of ${this.total}\"\n tabindex=${isActive ? 0 : -1}\n ?disabled=${this.disabled}\n @click=${() => this.handleDotClick(value)}\n ></button>\n `;\n })}\n </div>\n `;\n }\n}\n\nexport default NileDotStepper;\n\ndeclare global {\n interface HTMLElementTagNameMap {\n 'nile-dot-stepper': NileDotStepper;\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import './nile-dot-stepper';
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
import { expect, fixture, html, oneEvent } from '@open-wc/testing';
|
|
2
|
+
import './nile-dot-stepper';
|
|
3
|
+
const dots = (el) => Array.from(el.shadowRoot.querySelectorAll('[part="dot"]'));
|
|
4
|
+
describe('NileDotStepper', () => {
|
|
5
|
+
// --- Basic rendering ---
|
|
6
|
+
it('1. renders', async () => {
|
|
7
|
+
const el = await fixture(html `<nile-dot-stepper></nile-dot-stepper>`);
|
|
8
|
+
expect(el).to.exist;
|
|
9
|
+
});
|
|
10
|
+
it('2. shadow root', async () => {
|
|
11
|
+
const el = await fixture(html `<nile-dot-stepper></nile-dot-stepper>`);
|
|
12
|
+
expect(el.shadowRoot).to.not.be.null;
|
|
13
|
+
});
|
|
14
|
+
it('3. tag name', async () => {
|
|
15
|
+
const el = await fixture(html `<nile-dot-stepper></nile-dot-stepper>`);
|
|
16
|
+
expect(el.tagName.toLowerCase()).to.equal('nile-dot-stepper');
|
|
17
|
+
});
|
|
18
|
+
it('4. is defined', async () => {
|
|
19
|
+
expect(customElements.get('nile-dot-stepper')).to.exist;
|
|
20
|
+
});
|
|
21
|
+
it('5. has styles', async () => {
|
|
22
|
+
expect((await import('./nile-dot-stepper')).NileDotStepper.styles).to.exist;
|
|
23
|
+
});
|
|
24
|
+
// --- Default property values ---
|
|
25
|
+
it('6. total defaults 0', async () => {
|
|
26
|
+
const el = await fixture(html `<nile-dot-stepper></nile-dot-stepper>`);
|
|
27
|
+
expect(el.total).to.equal(0);
|
|
28
|
+
});
|
|
29
|
+
it('7. current defaults 1', async () => {
|
|
30
|
+
const el = await fixture(html `<nile-dot-stepper></nile-dot-stepper>`);
|
|
31
|
+
expect(el.current).to.equal(1);
|
|
32
|
+
});
|
|
33
|
+
it('8. size defaults md', async () => {
|
|
34
|
+
const el = await fixture(html `<nile-dot-stepper></nile-dot-stepper>`);
|
|
35
|
+
expect(el.size).to.equal('md');
|
|
36
|
+
});
|
|
37
|
+
it('9. disabled defaults false', async () => {
|
|
38
|
+
const el = await fixture(html `<nile-dot-stepper></nile-dot-stepper>`);
|
|
39
|
+
expect(el.disabled).to.be.false;
|
|
40
|
+
});
|
|
41
|
+
it('10. no dots when total is 0', async () => {
|
|
42
|
+
const el = await fixture(html `<nile-dot-stepper></nile-dot-stepper>`);
|
|
43
|
+
expect(dots(el).length).to.equal(0);
|
|
44
|
+
});
|
|
45
|
+
// --- Reflected attributes ---
|
|
46
|
+
it('11. total reflects', async () => {
|
|
47
|
+
const el = await fixture(html `<nile-dot-stepper total="5"></nile-dot-stepper>`);
|
|
48
|
+
expect(el.getAttribute('total')).to.equal('5');
|
|
49
|
+
});
|
|
50
|
+
it('12. current reflects', async () => {
|
|
51
|
+
const el = await fixture(html `<nile-dot-stepper total="5" current="3"></nile-dot-stepper>`);
|
|
52
|
+
expect(el.getAttribute('current')).to.equal('3');
|
|
53
|
+
});
|
|
54
|
+
it('13. size reflects', async () => {
|
|
55
|
+
const el = await fixture(html `<nile-dot-stepper size="lg"></nile-dot-stepper>`);
|
|
56
|
+
expect(el.getAttribute('size')).to.equal('lg');
|
|
57
|
+
});
|
|
58
|
+
it('14. disabled reflects', async () => {
|
|
59
|
+
const el = await fixture(html `<nile-dot-stepper disabled></nile-dot-stepper>`);
|
|
60
|
+
expect(el.hasAttribute('disabled')).to.be.true;
|
|
61
|
+
});
|
|
62
|
+
// --- total renders N dots ---
|
|
63
|
+
it('15. total renders exactly N dots', async () => {
|
|
64
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5}></nile-dot-stepper>`);
|
|
65
|
+
expect(dots(el).length).to.equal(5);
|
|
66
|
+
});
|
|
67
|
+
it('16. total renders single dot', async () => {
|
|
68
|
+
const el = await fixture(html `<nile-dot-stepper .total=${1}></nile-dot-stepper>`);
|
|
69
|
+
expect(dots(el).length).to.equal(1);
|
|
70
|
+
});
|
|
71
|
+
it('17. dynamically updating total re-renders dots', async () => {
|
|
72
|
+
const el = await fixture(html `<nile-dot-stepper .total=${3}></nile-dot-stepper>`);
|
|
73
|
+
expect(dots(el).length).to.equal(3);
|
|
74
|
+
el.total = 7;
|
|
75
|
+
await el.updateComplete;
|
|
76
|
+
expect(dots(el).length).to.equal(7);
|
|
77
|
+
});
|
|
78
|
+
// --- current marks correct active dot ---
|
|
79
|
+
it('18. current marks correct dot active', async () => {
|
|
80
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${3}></nile-dot-stepper>`);
|
|
81
|
+
const active = dots(el).filter((d) => d.classList.contains('dot--active'));
|
|
82
|
+
expect(active.length).to.equal(1);
|
|
83
|
+
expect(active[0].getAttribute('data-index')).to.equal('3');
|
|
84
|
+
});
|
|
85
|
+
it('19. active dot aria-selected true, others false', async () => {
|
|
86
|
+
const el = await fixture(html `<nile-dot-stepper .total=${4} .current=${2}></nile-dot-stepper>`);
|
|
87
|
+
const list = dots(el);
|
|
88
|
+
expect(list[1].getAttribute('aria-selected')).to.equal('true');
|
|
89
|
+
expect(list[0].getAttribute('aria-selected')).to.equal('false');
|
|
90
|
+
expect(list[2].getAttribute('aria-selected')).to.equal('false');
|
|
91
|
+
expect(list[3].getAttribute('aria-selected')).to.equal('false');
|
|
92
|
+
});
|
|
93
|
+
it('20. first dot active by default current=1', async () => {
|
|
94
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5}></nile-dot-stepper>`);
|
|
95
|
+
expect(dots(el)[0].classList.contains('dot--active')).to.be.true;
|
|
96
|
+
});
|
|
97
|
+
it('21. out-of-range current (too high) clamps active to last dot', async () => {
|
|
98
|
+
const el = await fixture(html `<nile-dot-stepper .total=${4} .current=${10}></nile-dot-stepper>`);
|
|
99
|
+
const active = dots(el).filter((d) => d.classList.contains('dot--active'));
|
|
100
|
+
expect(active.length).to.equal(1);
|
|
101
|
+
expect(active[0].getAttribute('data-index')).to.equal('4');
|
|
102
|
+
});
|
|
103
|
+
it('22. out-of-range current (too low) clamps active to first dot', async () => {
|
|
104
|
+
const el = await fixture(html `<nile-dot-stepper .total=${4} .current=${0}></nile-dot-stepper>`);
|
|
105
|
+
const active = dots(el).filter((d) => d.classList.contains('dot--active'));
|
|
106
|
+
expect(active.length).to.equal(1);
|
|
107
|
+
expect(active[0].getAttribute('data-index')).to.equal('1');
|
|
108
|
+
});
|
|
109
|
+
it('23. dynamic current updates active dot', async () => {
|
|
110
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${1}></nile-dot-stepper>`);
|
|
111
|
+
el.current = 4;
|
|
112
|
+
await el.updateComplete;
|
|
113
|
+
const active = dots(el).filter((d) => d.classList.contains('dot--active'));
|
|
114
|
+
expect(active[0].getAttribute('data-index')).to.equal('4');
|
|
115
|
+
});
|
|
116
|
+
// --- Click interaction ---
|
|
117
|
+
it('24. clicking a dot sets current', async () => {
|
|
118
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${1}></nile-dot-stepper>`);
|
|
119
|
+
dots(el)[2].click();
|
|
120
|
+
await el.updateComplete;
|
|
121
|
+
expect(el.current).to.equal(3);
|
|
122
|
+
});
|
|
123
|
+
it('25. clicking a dot emits nile-step-change with 1-based value', async () => {
|
|
124
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${1}></nile-dot-stepper>`);
|
|
125
|
+
setTimeout(() => dots(el)[3].click());
|
|
126
|
+
const ev = await oneEvent(el, 'nile-step-change');
|
|
127
|
+
expect(ev.detail.value).to.equal(4);
|
|
128
|
+
});
|
|
129
|
+
it('26. clicking the first dot emits value 1', async () => {
|
|
130
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${3}></nile-dot-stepper>`);
|
|
131
|
+
setTimeout(() => dots(el)[0].click());
|
|
132
|
+
const ev = await oneEvent(el, 'nile-step-change');
|
|
133
|
+
expect(ev.detail.value).to.equal(1);
|
|
134
|
+
});
|
|
135
|
+
it('27. nile-step-change bubbles and is composed', async () => {
|
|
136
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5}></nile-dot-stepper>`);
|
|
137
|
+
setTimeout(() => dots(el)[1].click());
|
|
138
|
+
const ev = await oneEvent(el, 'nile-step-change');
|
|
139
|
+
expect(ev.bubbles).to.be.true;
|
|
140
|
+
expect(ev.composed).to.be.true;
|
|
141
|
+
});
|
|
142
|
+
// --- Disabled behaviour ---
|
|
143
|
+
it('28. disabled blocks click (no current change)', async () => {
|
|
144
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${1} disabled></nile-dot-stepper>`);
|
|
145
|
+
dots(el)[2].click();
|
|
146
|
+
await el.updateComplete;
|
|
147
|
+
expect(el.current).to.equal(1);
|
|
148
|
+
});
|
|
149
|
+
it('29. disabled blocks click (no event)', async () => {
|
|
150
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} disabled></nile-dot-stepper>`);
|
|
151
|
+
let fired = false;
|
|
152
|
+
el.addEventListener('nile-step-change', () => (fired = true));
|
|
153
|
+
dots(el)[2].click();
|
|
154
|
+
await el.updateComplete;
|
|
155
|
+
expect(fired).to.be.false;
|
|
156
|
+
});
|
|
157
|
+
it('30. disabled sets disabled attribute on each dot', async () => {
|
|
158
|
+
const el = await fixture(html `<nile-dot-stepper .total=${3} disabled></nile-dot-stepper>`);
|
|
159
|
+
expect(dots(el).every((d) => d.disabled)).to.be.true;
|
|
160
|
+
});
|
|
161
|
+
it('31. disabled blocks keyboard interaction', async () => {
|
|
162
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${2} disabled></nile-dot-stepper>`);
|
|
163
|
+
let fired = false;
|
|
164
|
+
el.addEventListener('nile-step-change', () => (fired = true));
|
|
165
|
+
const base = el.shadowRoot.querySelector('[part="base"]');
|
|
166
|
+
base.dispatchEvent(new KeyboardEvent('keydown', { key: 'ArrowRight', bubbles: true }));
|
|
167
|
+
await el.updateComplete;
|
|
168
|
+
expect(el.current).to.equal(2);
|
|
169
|
+
expect(fired).to.be.false;
|
|
170
|
+
});
|
|
171
|
+
// --- Keyboard navigation ---
|
|
172
|
+
const dispatchKey = (el, key) => {
|
|
173
|
+
const base = el.shadowRoot.querySelector('[part="base"]');
|
|
174
|
+
base.dispatchEvent(new KeyboardEvent('keydown', { key, bubbles: true }));
|
|
175
|
+
};
|
|
176
|
+
it('32. ArrowRight increments current and emits value', async () => {
|
|
177
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${2}></nile-dot-stepper>`);
|
|
178
|
+
setTimeout(() => dispatchKey(el, 'ArrowRight'));
|
|
179
|
+
const ev = await oneEvent(el, 'nile-step-change');
|
|
180
|
+
expect(ev.detail.value).to.equal(3);
|
|
181
|
+
expect(el.current).to.equal(3);
|
|
182
|
+
});
|
|
183
|
+
it('33. ArrowLeft decrements current and emits value', async () => {
|
|
184
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${3}></nile-dot-stepper>`);
|
|
185
|
+
setTimeout(() => dispatchKey(el, 'ArrowLeft'));
|
|
186
|
+
const ev = await oneEvent(el, 'nile-step-change');
|
|
187
|
+
expect(ev.detail.value).to.equal(2);
|
|
188
|
+
expect(el.current).to.equal(2);
|
|
189
|
+
});
|
|
190
|
+
it('34. ArrowRight clamps at total', async () => {
|
|
191
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${5}></nile-dot-stepper>`);
|
|
192
|
+
setTimeout(() => dispatchKey(el, 'ArrowRight'));
|
|
193
|
+
const ev = await oneEvent(el, 'nile-step-change');
|
|
194
|
+
expect(ev.detail.value).to.equal(5);
|
|
195
|
+
expect(el.current).to.equal(5);
|
|
196
|
+
});
|
|
197
|
+
it('35. ArrowLeft clamps at 1', async () => {
|
|
198
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${1}></nile-dot-stepper>`);
|
|
199
|
+
setTimeout(() => dispatchKey(el, 'ArrowLeft'));
|
|
200
|
+
const ev = await oneEvent(el, 'nile-step-change');
|
|
201
|
+
expect(ev.detail.value).to.equal(1);
|
|
202
|
+
expect(el.current).to.equal(1);
|
|
203
|
+
});
|
|
204
|
+
it('36. Home jumps to first dot', async () => {
|
|
205
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${4}></nile-dot-stepper>`);
|
|
206
|
+
setTimeout(() => dispatchKey(el, 'Home'));
|
|
207
|
+
const ev = await oneEvent(el, 'nile-step-change');
|
|
208
|
+
expect(ev.detail.value).to.equal(1);
|
|
209
|
+
expect(el.current).to.equal(1);
|
|
210
|
+
});
|
|
211
|
+
it('37. End jumps to last dot', async () => {
|
|
212
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${2}></nile-dot-stepper>`);
|
|
213
|
+
setTimeout(() => dispatchKey(el, 'End'));
|
|
214
|
+
const ev = await oneEvent(el, 'nile-step-change');
|
|
215
|
+
expect(ev.detail.value).to.equal(5);
|
|
216
|
+
expect(el.current).to.equal(5);
|
|
217
|
+
});
|
|
218
|
+
it('38. unhandled key does not change current', async () => {
|
|
219
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${2}></nile-dot-stepper>`);
|
|
220
|
+
let fired = false;
|
|
221
|
+
el.addEventListener('nile-step-change', () => (fired = true));
|
|
222
|
+
dispatchKey(el, 'Enter');
|
|
223
|
+
await el.updateComplete;
|
|
224
|
+
expect(el.current).to.equal(2);
|
|
225
|
+
expect(fired).to.be.false;
|
|
226
|
+
});
|
|
227
|
+
it('39. keyboard nav moves focus to the new active dot', async () => {
|
|
228
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${2}></nile-dot-stepper>`);
|
|
229
|
+
dispatchKey(el, 'ArrowRight');
|
|
230
|
+
await el.updateComplete;
|
|
231
|
+
const focused = el.shadowRoot.activeElement;
|
|
232
|
+
expect(focused).to.exist;
|
|
233
|
+
expect(focused.getAttribute('data-index')).to.equal('3');
|
|
234
|
+
});
|
|
235
|
+
// --- Size variants ---
|
|
236
|
+
it('40. size sm applies dot--sm', async () => {
|
|
237
|
+
const el = await fixture(html `<nile-dot-stepper .total=${3} size="sm"></nile-dot-stepper>`);
|
|
238
|
+
expect(dots(el).every((d) => d.classList.contains('dot--sm'))).to.be.true;
|
|
239
|
+
});
|
|
240
|
+
it('41. size md applies dot--md', async () => {
|
|
241
|
+
const el = await fixture(html `<nile-dot-stepper .total=${3} size="md"></nile-dot-stepper>`);
|
|
242
|
+
expect(dots(el).every((d) => d.classList.contains('dot--md'))).to.be.true;
|
|
243
|
+
});
|
|
244
|
+
it('42. size lg applies dot--lg', async () => {
|
|
245
|
+
const el = await fixture(html `<nile-dot-stepper .total=${3} size="lg"></nile-dot-stepper>`);
|
|
246
|
+
expect(dots(el).every((d) => d.classList.contains('dot--lg'))).to.be.true;
|
|
247
|
+
});
|
|
248
|
+
it('43. dynamic size update changes dot class', async () => {
|
|
249
|
+
const el = await fixture(html `<nile-dot-stepper .total=${3} size="md"></nile-dot-stepper>`);
|
|
250
|
+
el.size = 'lg';
|
|
251
|
+
await el.updateComplete;
|
|
252
|
+
expect(dots(el).every((d) => d.classList.contains('dot--lg'))).to.be.true;
|
|
253
|
+
expect(dots(el).some((d) => d.classList.contains('dot--md'))).to.be.false;
|
|
254
|
+
});
|
|
255
|
+
// --- Accessibility / parts ---
|
|
256
|
+
it('44. base part present', async () => {
|
|
257
|
+
const el = await fixture(html `<nile-dot-stepper .total=${3}></nile-dot-stepper>`);
|
|
258
|
+
expect(el.shadowRoot.querySelector('[part="base"]')).to.exist;
|
|
259
|
+
});
|
|
260
|
+
it('45. base has role tablist', async () => {
|
|
261
|
+
const el = await fixture(html `<nile-dot-stepper .total=${3}></nile-dot-stepper>`);
|
|
262
|
+
expect(el.shadowRoot.querySelector('[part="base"]').getAttribute('role')).to.equal('tablist');
|
|
263
|
+
});
|
|
264
|
+
it('46. base has aria-label Progress', async () => {
|
|
265
|
+
const el = await fixture(html `<nile-dot-stepper .total=${3}></nile-dot-stepper>`);
|
|
266
|
+
expect(el.shadowRoot.querySelector('[part="base"]').getAttribute('aria-label')).to.equal('Progress');
|
|
267
|
+
});
|
|
268
|
+
it('47. dot part present', async () => {
|
|
269
|
+
const el = await fixture(html `<nile-dot-stepper .total=${3}></nile-dot-stepper>`);
|
|
270
|
+
expect(el.shadowRoot.querySelector('[part="dot"]')).to.exist;
|
|
271
|
+
});
|
|
272
|
+
it('48. each dot has role tab', async () => {
|
|
273
|
+
const el = await fixture(html `<nile-dot-stepper .total=${4}></nile-dot-stepper>`);
|
|
274
|
+
expect(dots(el).every((d) => d.getAttribute('role') === 'tab')).to.be.true;
|
|
275
|
+
});
|
|
276
|
+
it('49. dot aria-label is "Step N of M"', async () => {
|
|
277
|
+
const el = await fixture(html `<nile-dot-stepper .total=${5} .current=${2}></nile-dot-stepper>`);
|
|
278
|
+
const list = dots(el);
|
|
279
|
+
expect(list[0].getAttribute('aria-label')).to.equal('Step 1 of 5');
|
|
280
|
+
expect(list[4].getAttribute('aria-label')).to.equal('Step 5 of 5');
|
|
281
|
+
});
|
|
282
|
+
it('50. roving tabindex: active 0, others -1', async () => {
|
|
283
|
+
const el = await fixture(html `<nile-dot-stepper .total=${4} .current=${3}></nile-dot-stepper>`);
|
|
284
|
+
const list = dots(el);
|
|
285
|
+
expect(list[2].getAttribute('tabindex')).to.equal('0');
|
|
286
|
+
expect(list[0].getAttribute('tabindex')).to.equal('-1');
|
|
287
|
+
expect(list[1].getAttribute('tabindex')).to.equal('-1');
|
|
288
|
+
expect(list[3].getAttribute('tabindex')).to.equal('-1');
|
|
289
|
+
});
|
|
290
|
+
it('51. roving tabindex updates after navigation', async () => {
|
|
291
|
+
const el = await fixture(html `<nile-dot-stepper .total=${4} .current=${1}></nile-dot-stepper>`);
|
|
292
|
+
el.current = 3;
|
|
293
|
+
await el.updateComplete;
|
|
294
|
+
const list = dots(el);
|
|
295
|
+
expect(list[2].getAttribute('tabindex')).to.equal('0');
|
|
296
|
+
expect(list[0].getAttribute('tabindex')).to.equal('-1');
|
|
297
|
+
});
|
|
298
|
+
it('52. dots are button elements of type button', async () => {
|
|
299
|
+
const el = await fixture(html `<nile-dot-stepper .total=${3}></nile-dot-stepper>`);
|
|
300
|
+
expect(dots(el).every((d) => d.tagName === 'BUTTON' && d.getAttribute('type') === 'button')).to.be.true;
|
|
301
|
+
});
|
|
302
|
+
it('53. full integration', async () => {
|
|
303
|
+
const el = await fixture(html `<nile-dot-stepper
|
|
304
|
+
.total=${6}
|
|
305
|
+
.current=${4}
|
|
306
|
+
size="lg"
|
|
307
|
+
></nile-dot-stepper>`);
|
|
308
|
+
expect(dots(el).length).to.equal(6);
|
|
309
|
+
expect(el.size).to.equal('lg');
|
|
310
|
+
const active = dots(el).filter((d) => d.classList.contains('dot--active'));
|
|
311
|
+
expect(active.length).to.equal(1);
|
|
312
|
+
expect(active[0].getAttribute('data-index')).to.equal('4');
|
|
313
|
+
setTimeout(() => dispatchKey(el, 'End'));
|
|
314
|
+
const ev = await oneEvent(el, 'nile-step-change');
|
|
315
|
+
expect(ev.detail.value).to.equal(6);
|
|
316
|
+
expect(el.current).to.equal(6);
|
|
317
|
+
});
|
|
318
|
+
});
|
|
319
|
+
//# sourceMappingURL=nile-dot-stepper.test.js.map
|