@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.
Files changed (198) hide show
  1. package/README.md +13 -0
  2. package/dist/index-5fef1a0d.esm.js +1 -0
  3. package/dist/index-8f38fae3.cjs.js +2 -0
  4. package/dist/index-8f38fae3.cjs.js.map +1 -0
  5. package/dist/index.cjs.js +1 -1
  6. package/dist/index.esm.js +1 -1
  7. package/dist/index.js +1527 -804
  8. package/dist/nile-chip/nile-chip.css.cjs.js +1 -1
  9. package/dist/nile-chip/nile-chip.css.cjs.js.map +1 -1
  10. package/dist/nile-chip/nile-chip.css.esm.js +8 -1
  11. package/dist/nile-code-editor/nile-code-editor.cjs.js +1 -1
  12. package/dist/nile-code-editor/nile-code-editor.cjs.js.map +1 -1
  13. package/dist/nile-code-editor/nile-code-editor.esm.js +3 -3
  14. package/dist/nile-combobox/index.cjs.js +1 -1
  15. package/dist/nile-combobox/index.esm.js +1 -1
  16. package/dist/nile-combobox/nile-combobox.cjs.js +1 -1
  17. package/dist/nile-combobox/nile-combobox.esm.js +1 -1
  18. package/dist/nile-command-menu/index.cjs.js +2 -0
  19. package/dist/nile-command-menu/index.cjs.js.map +1 -0
  20. package/dist/nile-command-menu/index.esm.js +1 -0
  21. package/dist/nile-command-menu/nile-command-menu.cjs.js +2 -0
  22. package/dist/nile-command-menu/nile-command-menu.cjs.js.map +1 -0
  23. package/dist/nile-command-menu/nile-command-menu.css.cjs.js +2 -0
  24. package/dist/nile-command-menu/nile-command-menu.css.cjs.js.map +1 -0
  25. package/dist/nile-command-menu/nile-command-menu.css.esm.js +182 -0
  26. package/dist/nile-command-menu/nile-command-menu.esm.js +97 -0
  27. package/dist/nile-command-menu-group/index.cjs.js +2 -0
  28. package/dist/nile-command-menu-group/index.cjs.js.map +1 -0
  29. package/dist/nile-command-menu-group/index.esm.js +1 -0
  30. package/dist/nile-command-menu-group/nile-command-menu-group.cjs.js +2 -0
  31. package/dist/nile-command-menu-group/nile-command-menu-group.cjs.js.map +1 -0
  32. package/dist/nile-command-menu-group/nile-command-menu-group.css.cjs.js +2 -0
  33. package/dist/nile-command-menu-group/nile-command-menu-group.css.cjs.js.map +1 -0
  34. package/dist/nile-command-menu-group/nile-command-menu-group.css.esm.js +33 -0
  35. package/dist/nile-command-menu-group/nile-command-menu-group.esm.js +11 -0
  36. package/dist/nile-command-menu-item/index.cjs.js +2 -0
  37. package/dist/nile-command-menu-item/index.cjs.js.map +1 -0
  38. package/dist/nile-command-menu-item/index.esm.js +1 -0
  39. package/dist/nile-command-menu-item/nile-command-menu-item.cjs.js +2 -0
  40. package/dist/nile-command-menu-item/nile-command-menu-item.cjs.js.map +1 -0
  41. package/dist/nile-command-menu-item/nile-command-menu-item.css.cjs.js +2 -0
  42. package/dist/nile-command-menu-item/nile-command-menu-item.css.cjs.js.map +1 -0
  43. package/dist/nile-command-menu-item/nile-command-menu-item.css.esm.js +115 -0
  44. package/dist/nile-command-menu-item/nile-command-menu-item.esm.js +21 -0
  45. package/dist/nile-detail/index.cjs.js +1 -1
  46. package/dist/nile-detail/index.esm.js +1 -1
  47. package/dist/nile-detail/nile-detail.cjs.js +1 -1
  48. package/dist/nile-detail/nile-detail.esm.js +1 -1
  49. package/dist/nile-dialog/nile-dialog.cjs.js +1 -1
  50. package/dist/nile-dialog/nile-dialog.cjs.js.map +1 -1
  51. package/dist/nile-dialog/nile-dialog.esm.js +1 -1
  52. package/dist/nile-dot-stepper/index.cjs.js +2 -0
  53. package/dist/nile-dot-stepper/index.cjs.js.map +1 -0
  54. package/dist/nile-dot-stepper/index.esm.js +1 -0
  55. package/dist/nile-dot-stepper/nile-dot-stepper.cjs.js +2 -0
  56. package/dist/nile-dot-stepper/nile-dot-stepper.cjs.js.map +1 -0
  57. package/dist/nile-dot-stepper/nile-dot-stepper.css.cjs.js +2 -0
  58. package/dist/nile-dot-stepper/nile-dot-stepper.css.cjs.js.map +1 -0
  59. package/dist/nile-dot-stepper/nile-dot-stepper.css.esm.js +77 -0
  60. package/dist/nile-dot-stepper/nile-dot-stepper.esm.js +24 -0
  61. package/dist/nile-hero/nile-hero.cjs.js +1 -1
  62. package/dist/nile-hero/nile-hero.cjs.js.map +1 -1
  63. package/dist/nile-hero/nile-hero.css.cjs.js +1 -1
  64. package/dist/nile-hero/nile-hero.css.cjs.js.map +1 -1
  65. package/dist/nile-hero/nile-hero.css.esm.js +14 -14
  66. package/dist/nile-hero/nile-hero.esm.js +1 -1
  67. package/dist/nile-hero-header/nile-hero-header.cjs.js +1 -1
  68. package/dist/nile-hero-header/nile-hero-header.cjs.js.map +1 -1
  69. package/dist/nile-hero-header/nile-hero-header.css.cjs.js +1 -1
  70. package/dist/nile-hero-header/nile-hero-header.css.cjs.js.map +1 -1
  71. package/dist/nile-hero-header/nile-hero-header.css.esm.js +11 -11
  72. package/dist/nile-hero-header/nile-hero-header.esm.js +3 -3
  73. package/dist/nile-rich-text-editor/index.cjs.js +1 -1
  74. package/dist/nile-rich-text-editor/index.esm.js +1 -1
  75. package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js +1 -1
  76. package/dist/nile-rich-text-editor/nile-rich-text-editor.cjs.js.map +1 -1
  77. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js +1 -1
  78. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.cjs.js.map +1 -1
  79. package/dist/nile-rich-text-editor/nile-rich-text-editor.css.esm.js +70 -0
  80. package/dist/nile-rich-text-editor/nile-rich-text-editor.esm.js +1 -1
  81. package/dist/nile-rich-text-editor/nile-rte-image.cjs.js +3 -0
  82. package/dist/nile-rich-text-editor/nile-rte-image.cjs.js.map +1 -0
  83. package/dist/nile-rich-text-editor/nile-rte-image.esm.js +96 -0
  84. package/dist/nile-section-message/nile-section-message.css.cjs.js +1 -1
  85. package/dist/nile-section-message/nile-section-message.css.cjs.js.map +1 -1
  86. package/dist/nile-section-message/nile-section-message.css.esm.js +7 -8
  87. package/dist/src/index.d.ts +4 -0
  88. package/dist/src/index.js +4 -0
  89. package/dist/src/index.js.map +1 -1
  90. package/dist/src/nile-chip/nile-chip.css.js +8 -1
  91. package/dist/src/nile-chip/nile-chip.css.js.map +1 -1
  92. package/dist/src/nile-code-editor/nile-code-editor.js +3 -3
  93. package/dist/src/nile-code-editor/nile-code-editor.js.map +1 -1
  94. package/dist/src/nile-command-menu/index.d.ts +1 -0
  95. package/dist/src/nile-command-menu/index.js +2 -0
  96. package/dist/src/nile-command-menu/index.js.map +1 -0
  97. package/dist/src/nile-command-menu/nile-command-menu.css.d.ts +12 -0
  98. package/dist/src/nile-command-menu/nile-command-menu.css.js +194 -0
  99. package/dist/src/nile-command-menu/nile-command-menu.css.js.map +1 -0
  100. package/dist/src/nile-command-menu/nile-command-menu.d.ts +137 -0
  101. package/dist/src/nile-command-menu/nile-command-menu.js +557 -0
  102. package/dist/src/nile-command-menu/nile-command-menu.js.map +1 -0
  103. package/dist/src/nile-command-menu/nile-command-menu.test.d.ts +3 -0
  104. package/dist/src/nile-command-menu/nile-command-menu.test.js +268 -0
  105. package/dist/src/nile-command-menu/nile-command-menu.test.js.map +1 -0
  106. package/dist/src/nile-command-menu-group/index.d.ts +1 -0
  107. package/dist/src/nile-command-menu-group/index.js +2 -0
  108. package/dist/src/nile-command-menu-group/index.js.map +1 -0
  109. package/dist/src/nile-command-menu-group/nile-command-menu-group.css.d.ts +12 -0
  110. package/dist/src/nile-command-menu-group/nile-command-menu-group.css.js +45 -0
  111. package/dist/src/nile-command-menu-group/nile-command-menu-group.css.js.map +1 -0
  112. package/dist/src/nile-command-menu-group/nile-command-menu-group.d.ts +38 -0
  113. package/dist/src/nile-command-menu-group/nile-command-menu-group.js +68 -0
  114. package/dist/src/nile-command-menu-group/nile-command-menu-group.js.map +1 -0
  115. package/dist/src/nile-command-menu-group/nile-command-menu-group.test.d.ts +2 -0
  116. package/dist/src/nile-command-menu-group/nile-command-menu-group.test.js +22 -0
  117. package/dist/src/nile-command-menu-group/nile-command-menu-group.test.js.map +1 -0
  118. package/dist/src/nile-command-menu-item/index.d.ts +1 -0
  119. package/dist/src/nile-command-menu-item/index.js +2 -0
  120. package/dist/src/nile-command-menu-item/index.js.map +1 -0
  121. package/dist/src/nile-command-menu-item/nile-command-menu-item.css.d.ts +12 -0
  122. package/dist/src/nile-command-menu-item/nile-command-menu-item.css.js +127 -0
  123. package/dist/src/nile-command-menu-item/nile-command-menu-item.css.js.map +1 -0
  124. package/dist/src/nile-command-menu-item/nile-command-menu-item.d.ts +73 -0
  125. package/dist/src/nile-command-menu-item/nile-command-menu-item.js +174 -0
  126. package/dist/src/nile-command-menu-item/nile-command-menu-item.js.map +1 -0
  127. package/dist/src/nile-command-menu-item/nile-command-menu-item.test.d.ts +1 -0
  128. package/dist/src/nile-command-menu-item/nile-command-menu-item.test.js +35 -0
  129. package/dist/src/nile-command-menu-item/nile-command-menu-item.test.js.map +1 -0
  130. package/dist/src/nile-dialog/nile-dialog.js +1 -1
  131. package/dist/src/nile-dialog/nile-dialog.js.map +1 -1
  132. package/dist/src/nile-dot-stepper/index.d.ts +1 -0
  133. package/dist/src/nile-dot-stepper/index.js +2 -0
  134. package/dist/src/nile-dot-stepper/index.js.map +1 -0
  135. package/dist/src/nile-dot-stepper/nile-dot-stepper.css.d.ts +12 -0
  136. package/dist/src/nile-dot-stepper/nile-dot-stepper.css.js +89 -0
  137. package/dist/src/nile-dot-stepper/nile-dot-stepper.css.js.map +1 -0
  138. package/dist/src/nile-dot-stepper/nile-dot-stepper.d.ts +48 -0
  139. package/dist/src/nile-dot-stepper/nile-dot-stepper.js +153 -0
  140. package/dist/src/nile-dot-stepper/nile-dot-stepper.js.map +1 -0
  141. package/dist/src/nile-dot-stepper/nile-dot-stepper.test.d.ts +1 -0
  142. package/dist/src/nile-dot-stepper/nile-dot-stepper.test.js +319 -0
  143. package/dist/src/nile-dot-stepper/nile-dot-stepper.test.js.map +1 -0
  144. package/dist/src/nile-hero/nile-hero.css.js +12 -12
  145. package/dist/src/nile-hero/nile-hero.css.js.map +1 -1
  146. package/dist/src/nile-hero/nile-hero.js +1 -1
  147. package/dist/src/nile-hero/nile-hero.js.map +1 -1
  148. package/dist/src/nile-hero-header/nile-hero-header.css.js +9 -9
  149. package/dist/src/nile-hero-header/nile-hero-header.css.js.map +1 -1
  150. package/dist/src/nile-hero-header/nile-hero-header.js +1 -1
  151. package/dist/src/nile-hero-header/nile-hero-header.js.map +1 -1
  152. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js +70 -0
  153. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.css.js.map +1 -1
  154. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.d.ts +3 -0
  155. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js +81 -3
  156. package/dist/src/nile-rich-text-editor/nile-rich-text-editor.js.map +1 -1
  157. package/dist/src/nile-rich-text-editor/nile-rte-image.d.ts +87 -0
  158. package/dist/src/nile-rich-text-editor/nile-rte-image.js +1073 -0
  159. package/dist/src/nile-rich-text-editor/nile-rte-image.js.map +1 -0
  160. package/dist/src/nile-section-message/nile-section-message.css.js +7 -8
  161. package/dist/src/nile-section-message/nile-section-message.css.js.map +1 -1
  162. package/dist/src/version.js +1 -1
  163. package/dist/src/version.js.map +1 -1
  164. package/dist/tsconfig.tsbuildinfo +1 -1
  165. package/package.json +2 -1
  166. package/src/index.ts +4 -0
  167. package/src/nile-chip/nile-chip.css.ts +8 -1
  168. package/src/nile-code-editor/nile-code-editor.ts +3 -3
  169. package/src/nile-command-menu/index.ts +1 -0
  170. package/src/nile-command-menu/nile-command-menu.css.ts +196 -0
  171. package/src/nile-command-menu/nile-command-menu.test.ts +289 -0
  172. package/src/nile-command-menu/nile-command-menu.ts +601 -0
  173. package/src/nile-command-menu-group/index.ts +1 -0
  174. package/src/nile-command-menu-group/nile-command-menu-group.css.ts +47 -0
  175. package/src/nile-command-menu-group/nile-command-menu-group.test.ts +23 -0
  176. package/src/nile-command-menu-group/nile-command-menu-group.ts +72 -0
  177. package/src/nile-command-menu-item/index.ts +1 -0
  178. package/src/nile-command-menu-item/nile-command-menu-item.css.ts +129 -0
  179. package/src/nile-command-menu-item/nile-command-menu-item.test.ts +36 -0
  180. package/src/nile-command-menu-item/nile-command-menu-item.ts +172 -0
  181. package/src/nile-dialog/nile-dialog.ts +1 -1
  182. package/src/nile-dot-stepper/index.ts +1 -0
  183. package/src/nile-dot-stepper/nile-dot-stepper.css.ts +90 -0
  184. package/src/nile-dot-stepper/nile-dot-stepper.test.ts +493 -0
  185. package/src/nile-dot-stepper/nile-dot-stepper.ts +159 -0
  186. package/src/nile-hero/nile-hero.css.ts +12 -12
  187. package/src/nile-hero/nile-hero.ts +1 -1
  188. package/src/nile-hero-header/nile-hero-header.css.ts +9 -9
  189. package/src/nile-hero-header/nile-hero-header.ts +1 -1
  190. package/src/nile-rich-text-editor/nile-rich-text-editor.css.ts +70 -0
  191. package/src/nile-rich-text-editor/nile-rich-text-editor.ts +89 -3
  192. package/src/nile-rich-text-editor/nile-rte-image.ts +1132 -0
  193. package/src/nile-section-message/nile-section-message.css.ts +7 -8
  194. package/stories/dot-stepper.stories.ts +67 -0
  195. package/vscode-html-custom-data.json +220 -1
  196. package/dist/index-c0b5232c.cjs.js +0 -2
  197. package/dist/index-c0b5232c.cjs.js.map +0 -1
  198. package/dist/index-e43a18eb.esm.js +0 -1
@@ -0,0 +1,72 @@
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
+ import { html } from 'lit';
9
+ import { customElement, property } from 'lit/decorators.js';
10
+ import { classMap } from 'lit/directives/class-map.js';
11
+ import { styles } from './nile-command-menu-group.css';
12
+ import { HasSlotController } from '../internal/slot';
13
+ import NileElement from '../internal/nile-element';
14
+ import type { CSSResultGroup } from 'lit';
15
+
16
+ /**
17
+ * Groups related commands under an optional heading inside a `nile-command-menu`.
18
+ *
19
+ * @tag nile-command-menu-group
20
+ *
21
+ * @summary A labelled section of command items within a command menu.
22
+ * @status stable
23
+ * @since 2.0
24
+ *
25
+ * @slot - The group's command items (`nile-command-menu-item`).
26
+ * @slot heading - The group heading. Takes precedence over the `heading` attribute when provided.
27
+ *
28
+ * @csspart base - The component's base wrapper.
29
+ * @csspart heading - The group heading.
30
+ * @csspart items - The wrapper around the slotted items.
31
+ */
32
+ @customElement('nile-command-menu-group')
33
+ export class NileCommandMenuGroup extends NileElement {
34
+ static styles: CSSResultGroup = styles;
35
+
36
+ private readonly hasSlotController = new HasSlotController(this, 'heading');
37
+
38
+ /** The text heading shown above the group's items. Use the `heading` slot for richer content. */
39
+ @property() heading = '';
40
+
41
+ connectedCallback() {
42
+ super.connectedCallback();
43
+ this.setAttribute('role', 'group');
44
+ }
45
+
46
+ render() {
47
+ const hasHeading = this.heading.length > 0 || this.hasSlotController.test('heading');
48
+
49
+ return html`
50
+ <div part="base" class="group">
51
+ <div
52
+ part="heading"
53
+ class=${classMap({
54
+ group__heading: true,
55
+ 'group__heading--empty': !hasHeading,
56
+ })}
57
+ >
58
+ <slot name="heading">${this.heading}</slot>
59
+ </div>
60
+ <slot part="items" class="group__items"></slot>
61
+ </div>
62
+ `;
63
+ }
64
+ }
65
+
66
+ export default NileCommandMenuGroup;
67
+
68
+ declare global {
69
+ interface HTMLElementTagNameMap {
70
+ 'nile-command-menu-group': NileCommandMenuGroup;
71
+ }
72
+ }
@@ -0,0 +1 @@
1
+ export { NileCommandMenuItem } from './nile-command-menu-item';
@@ -0,0 +1,129 @@
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
+ import { css } from 'lit';
9
+
10
+ /**
11
+ * CommandMenuItem CSS
12
+ */
13
+ export const styles = css`
14
+ :host {
15
+ box-sizing: border-box;
16
+ display: block;
17
+ -webkit-font-smoothing: var(--nile-webkit-font-smoothing, var(--ng-webkit-font-smoothing));
18
+ -moz-osx-font-smoothing: var(--nile-moz-osx-font-smoothing, var(--ng-moz-osx-font-smoothing));
19
+ text-rendering: var(--nile-text-rendering, var(--ng-text-rendering));
20
+ }
21
+
22
+ :host *,
23
+ :host *::before,
24
+ :host *::after {
25
+ box-sizing: inherit;
26
+ }
27
+
28
+ :host([hidden]) {
29
+ display: none !important;
30
+ }
31
+
32
+ .item {
33
+ position: relative;
34
+ display: flex;
35
+ align-items: center;
36
+ gap: var(--nile-spacing-md, var(--ng-spacing-md));
37
+ width: 100%;
38
+ margin-block: var(--nile-spacing-xxs, var(--ng-spacing-xxs));
39
+ padding: var(--nile-spacing-md, var(--ng-spacing-md)) var(--nile-spacing-lg, var(--ng-spacing-lg));
40
+ border-radius: var(--nile-radius-md, var(--ng-radius-md));
41
+ font-family: var(--nile-font-family-sans-serif, var(--ng-font-family-body));
42
+ font-size: var(--nile-type-scale-3, var(--ng-font-size-text-sm));
43
+ font-weight: var(--nile-font-weight-regular, var(--ng-font-weight-regular));
44
+ line-height: 1.4;
45
+ letter-spacing: normal;
46
+ color: var(--nile-color-dark-1, var(--ng-colors-text-secondary-700));
47
+ cursor: pointer;
48
+ user-select: none;
49
+ transition: background-color 200ms ease, color 200ms ease;
50
+ }
51
+
52
+ /* size variants — small (default) vs medium */
53
+ :host([size='medium']) .item {
54
+ padding-block: var(--nile-spacing-lg, var(--ng-spacing-lg));
55
+ }
56
+
57
+ /* Active / selected (keyboard or hover) */
58
+ :host([active]:not([disabled])) .item,
59
+ .item:hover {
60
+ background-color: var(--nile-colors-neutral-100, var(--ng-colors-bg-secondary-hover));
61
+ color: var(--nile-colors-dark-900, var(--ng-colors-text-secondary-hover));
62
+ }
63
+
64
+ :host([disabled]) .item {
65
+ cursor: not-allowed;
66
+ opacity: 0.4;
67
+ pointer-events: none;
68
+ }
69
+
70
+ .item__icon {
71
+ flex: 0 0 auto;
72
+ /* Reserve a fixed icon gutter so items with and without a leading icon
73
+ keep their labels aligned. */
74
+ width: 20px;
75
+ height: 20px;
76
+ display: inline-flex;
77
+ align-items: center;
78
+ justify-content: center;
79
+ color: var(--nile-colors-dark-500, var(--ng-colors-fg-quaternary-400));
80
+ }
81
+
82
+ .item__icon::slotted(*) {
83
+ width: 20px;
84
+ height: 20px;
85
+ }
86
+
87
+ .item__label {
88
+ flex: 1 1 auto;
89
+ min-width: 0;
90
+ display: inline-flex;
91
+ align-items: center;
92
+ gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
93
+ overflow: hidden;
94
+ text-overflow: ellipsis;
95
+ white-space: nowrap;
96
+ }
97
+
98
+ .item__suffix {
99
+ flex: 0 0 auto;
100
+ display: inline-flex;
101
+ align-items: center;
102
+ gap: var(--nile-spacing-sm, var(--ng-spacing-sm));
103
+ }
104
+
105
+ .item__shortcut {
106
+ display: inline-flex;
107
+ align-items: center;
108
+ gap: var(--nile-spacing-xs, var(--ng-spacing-xs));
109
+ }
110
+
111
+ .item__shortcut kbd {
112
+ display: inline-flex;
113
+ align-items: center;
114
+ justify-content: center;
115
+ min-width: 20px;
116
+ height: 20px;
117
+ padding: 0 5px;
118
+ border-radius: var(--nile-radius-radius-xs, var(--ng-radius-xs));
119
+ border: solid 1px var(--nile-colors-border-surface, var(--ng-colors-border-secondary-alt));
120
+ background: var(--nile-colors-white-base, var(--ng-colors-bg-primary));
121
+ font-family: inherit;
122
+ font-size: 11px;
123
+ font-weight: var(--nile-font-weight-medium, var(--ng-font-weight-medium));
124
+ line-height: 1;
125
+ color: var(--nile-colors-dark-500, var(--ng-colors-fg-quaternary-400));
126
+ }
127
+ `;
128
+
129
+ export default [styles];
@@ -0,0 +1,36 @@
1
+ import { expect, fixture, html } from '@open-wc/testing';
2
+ import './nile-command-menu-item';
3
+ import type { NileCommandMenuItem } from './nile-command-menu-item';
4
+
5
+ describe('NileCommandMenuItem', () => {
6
+ it('1. renders', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el).to.exist; });
7
+ it('2. shadow root', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.shadowRoot).to.not.be.null; });
8
+ it('3. tag name', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.tagName.toLowerCase()).to.equal('nile-command-menu-item'); });
9
+ it('4. size defaults small', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.size).to.equal('small'); });
10
+ it('5. value defaults empty', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.value).to.equal(''); });
11
+ it('6. disabled defaults false', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.disabled).to.be.false; });
12
+ it('7. active defaults false', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.active).to.be.false; });
13
+ it('8. keywords defaults empty', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.keywords).to.equal(''); });
14
+ it('9. shortcut defaults empty', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.shortcut).to.equal(''); });
15
+ it('10. set size medium', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item size="medium"></nile-command-menu-item>`); expect(el.size).to.equal('medium'); });
16
+ it('11. set value', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item value="open"></nile-command-menu-item>`); expect(el.value).to.equal('open'); });
17
+ it('12. set disabled', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item disabled></nile-command-menu-item>`); expect(el.disabled).to.be.true; });
18
+ it('13. role option', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.getAttribute('role')).to.equal('option'); });
19
+ it('14. base part', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.shadowRoot!.querySelector('[part="base"]')).to.exist; });
20
+ it('15. label part', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.shadowRoot!.querySelector('[part="label"]')).to.exist; });
21
+ it('16. icon slot', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.shadowRoot!.querySelector('slot[name="icon"]')).to.exist; });
22
+ it('17. suffix slot', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.shadowRoot!.querySelector('slot[name="suffix"]')).to.exist; });
23
+ it('18. default slot', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.shadowRoot!.querySelector('slot:not([name])')).to.exist; });
24
+ it('19. aria-disabled reflects', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item disabled></nile-command-menu-item>`); await el.updateComplete; expect(el.getAttribute('aria-disabled')).to.equal('true'); });
25
+ it('20. aria-selected reflects', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item active></nile-command-menu-item>`); await el.updateComplete; expect(el.getAttribute('aria-selected')).to.equal('true'); });
26
+ it('21. shortcut renders kbd', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item shortcut="⌘ K"></nile-command-menu-item>`); await el.updateComplete; expect(el.shadowRoot!.querySelectorAll('kbd').length).to.equal(2); });
27
+ it('22. no shortcut no kbd', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); expect(el.shadowRoot!.querySelector('kbd')).to.be.null; });
28
+ it('23. getTextLabel', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item>Open file</nile-command-menu-item>`); expect(el.getTextLabel().trim()).to.equal('Open file'); });
29
+ it('24. getFilterText includes label', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item>Open file</nile-command-menu-item>`); expect(el.getFilterText()).to.contain('open file'); });
30
+ it('25. getFilterText includes keywords', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item keywords="document">File</nile-command-menu-item>`); expect(el.getFilterText()).to.contain('document'); });
31
+ it('26. getFilterText includes value', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item value="cmd-open">File</nile-command-menu-item>`); expect(el.getFilterText()).to.contain('cmd-open'); });
32
+ it('27. disabled click swallowed', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item disabled>X</nile-command-menu-item>`); let fired = false; el.addEventListener('click', () => (fired = true)); el.click(); expect(fired).to.be.false; });
33
+ it('28. enabled click bubbles', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item>X</nile-command-menu-item>`); let fired = false; el.addEventListener('click', () => (fired = true)); el.click(); expect(fired).to.be.true; });
34
+ it('29. dynamic active', async () => { const el = await fixture<NileCommandMenuItem>(html`<nile-command-menu-item></nile-command-menu-item>`); el.active = true; await el.updateComplete; expect(el.getAttribute('aria-selected')).to.equal('true'); });
35
+ it('30. is defined', async () => { expect(customElements.get('nile-command-menu-item')).to.exist; });
36
+ });
@@ -0,0 +1,172 @@
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
+ import { html, nothing } from 'lit';
9
+ import { customElement, property, query } from 'lit/decorators.js';
10
+ import { classMap } from 'lit/directives/class-map.js';
11
+ import { styles } from './nile-command-menu-item.css';
12
+ import { getTextContent } from '../internal/slot';
13
+ import { watch } from '../internal/watch';
14
+ import NileElement from '../internal/nile-element';
15
+ import type { CSSResultGroup } from 'lit';
16
+
17
+ /**
18
+ * An individual selectable command inside a `nile-command-menu`.
19
+ *
20
+ * @tag nile-command-menu-item
21
+ *
22
+ * @summary Represents a single command/action entry within a command menu.
23
+ * @status stable
24
+ * @since 2.0
25
+ *
26
+ * @slot - The item's label.
27
+ * @slot icon - Used to prepend an icon (or similar element) before the label.
28
+ * @slot suffix - Used to append content (e.g. a hint) after the label, before the shortcut.
29
+ *
30
+ * @csspart base - The component's base wrapper.
31
+ * @csspart icon - The leading icon container.
32
+ * @csspart label - The item label.
33
+ * @csspart suffix - The trailing suffix container.
34
+ * @csspart shortcut - The keyboard-shortcut container.
35
+ */
36
+ @customElement('nile-command-menu-item')
37
+ export class NileCommandMenuItem extends NileElement {
38
+ static styles: CSSResultGroup = styles;
39
+
40
+ private cachedTextLabel: string;
41
+
42
+ @query('slot:not([name])') defaultSlot: HTMLSlotElement;
43
+
44
+ /** Controls vertical padding of the item. */
45
+ @property({ reflect: true }) size: 'small' | 'medium' = 'small';
46
+
47
+ /** A unique value used to identify the item when it is selected. */
48
+ @property() value = '';
49
+
50
+ /** Draws the item in a disabled state, preventing selection. */
51
+ @property({ type: Boolean, reflect: true }) disabled = false;
52
+
53
+ /** Draws the item in an active/highlighted state. Managed by the parent menu for keyboard navigation. */
54
+ @property({ type: Boolean, reflect: true }) active = false;
55
+
56
+ /**
57
+ * Extra keywords used by the parent menu when filtering, in addition to the visible label.
58
+ * Useful for matching synonyms or abbreviations.
59
+ */
60
+ @property() keywords = '';
61
+
62
+ /**
63
+ * The search scope this item belongs to. When the menu has active scopes (the "Searching for" row),
64
+ * an item is shown only if it has no scope or its scope is among the active ones.
65
+ */
66
+ @property() scope = '';
67
+
68
+ /**
69
+ * A keyboard shortcut hint shown on the trailing edge of the item. Separate keys with a
70
+ * space to render each one in its own key box (e.g. `"⌘ K"`).
71
+ */
72
+ @property() shortcut = '';
73
+
74
+ connectedCallback() {
75
+ super.connectedCallback();
76
+ this.setAttribute('role', 'option');
77
+ this.handleHostClick = this.handleHostClick.bind(this);
78
+ this.addEventListener('click', this.handleHostClick);
79
+ }
80
+
81
+ disconnectedCallback() {
82
+ super.disconnectedCallback();
83
+ this.removeEventListener('click', this.handleHostClick);
84
+ }
85
+
86
+ private handleHostClick(event: MouseEvent) {
87
+ // Swallow clicks while disabled so the menu never selects a disabled item.
88
+ if (this.disabled) {
89
+ event.preventDefault();
90
+ event.stopImmediatePropagation();
91
+ }
92
+ }
93
+
94
+ private handleDefaultSlotChange() {
95
+ const textLabel = this.getTextLabel();
96
+
97
+ if (typeof this.cachedTextLabel === 'undefined') {
98
+ this.cachedTextLabel = textLabel;
99
+ return;
100
+ }
101
+
102
+ if (textLabel !== this.cachedTextLabel) {
103
+ this.cachedTextLabel = textLabel;
104
+ this.emit('slotchange');
105
+ }
106
+ }
107
+
108
+ @watch('disabled')
109
+ handleDisabledChange() {
110
+ this.setAttribute('aria-disabled', this.disabled ? 'true' : 'false');
111
+ }
112
+
113
+ @watch('active')
114
+ handleActiveChange() {
115
+ this.setAttribute('aria-selected', this.active ? 'true' : 'false');
116
+ }
117
+
118
+ /** Returns the plain-text label based on the default slot's content. */
119
+ getTextLabel() {
120
+ return getTextContent(this.defaultSlot);
121
+ }
122
+
123
+ /** Returns the string the parent menu uses to match this item against a search query. */
124
+ getFilterText() {
125
+ return `${this.getTextLabel()} ${this.keywords} ${this.value}`.toLowerCase();
126
+ }
127
+
128
+ private renderShortcut() {
129
+ if (!this.shortcut) {
130
+ return nothing;
131
+ }
132
+
133
+ const keys = this.shortcut.trim().split(/\s+/);
134
+ return html`
135
+ <span part="shortcut" class="item__shortcut">
136
+ ${keys.map(key => html`<kbd>${key}</kbd>`)}
137
+ </span>
138
+ `;
139
+ }
140
+
141
+ render() {
142
+ return html`
143
+ <div
144
+ part="base"
145
+ class=${classMap({
146
+ item: true,
147
+ 'item--active': this.active,
148
+ 'item--disabled': this.disabled,
149
+ })}
150
+ >
151
+ <slot name="icon" part="icon" class="item__icon"></slot>
152
+
153
+ <span part="label" class="item__label">
154
+ <slot @slotchange=${this.handleDefaultSlotChange}></slot>
155
+ </span>
156
+
157
+ <span part="suffix" class="item__suffix">
158
+ <slot name="suffix"></slot>
159
+ ${this.renderShortcut()}
160
+ </span>
161
+ </div>
162
+ `;
163
+ }
164
+ }
165
+
166
+ export default NileCommandMenuItem;
167
+
168
+ declare global {
169
+ interface HTMLElementTagNameMap {
170
+ 'nile-command-menu-item': NileCommandMenuItem;
171
+ }
172
+ }
@@ -322,7 +322,7 @@ export class NileDialog extends NileElement {
322
322
  name="var(--nile-icon-close, var(--ng-icon-x-close))"
323
323
  method="var(--nile-svg-method-fill, var(--ng-svg-method-stroke))"
324
324
  label="close"
325
- color="var(--nile-dialog-remove-icon-color, var(--ng-colors-fg-quaternary-400))"
325
+ color="var(--nile-dialog-remove-icon-color, var(--ng-colors-fg-secondary-700))"
326
326
  @click="${() => this.requestClose('close-button')}"
327
327
  ></nile-icon>
328
328
  </div>
@@ -0,0 +1 @@
1
+ export { NileDotStepper } from './nile-dot-stepper';
@@ -0,0 +1,90 @@
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
+ import { css } from 'lit';
9
+
10
+ /**
11
+ * Dot Stepper CSS
12
+ */
13
+ export const styles = css`
14
+ :host {
15
+ display: inline-block;
16
+ -webkit-font-smoothing: var(
17
+ --nile-webkit-font-smoothing,
18
+ var(--ng-webkit-font-smoothing)
19
+ );
20
+ -moz-osx-font-smoothing: var(
21
+ --nile-moz-osx-font-smoothing,
22
+ var(--ng-moz-osx-font-smoothing)
23
+ );
24
+ text-rendering: var(--nile-text-rendering, var(--ng-text-rendering));
25
+ }
26
+
27
+ .dots {
28
+ display: flex;
29
+ flex-wrap: wrap;
30
+ gap: var(--nile-spacing-10px, var(--ng-spacing-2-5));
31
+ align-items: center;
32
+ }
33
+
34
+ .dot {
35
+ background: var(--nile-colors-neutral-400, var(--ng-colors-border-secondary));
36
+ border: none;
37
+ padding: 0;
38
+ margin: 0;
39
+ box-sizing: border-box;
40
+ cursor: pointer;
41
+ border-radius: 50%;
42
+ width: var(--nile-spacing-10px, var(--ng-spacing-2-5));
43
+ height: var(--nile-spacing-10px, var(--ng-spacing-2-5));
44
+ transition: background-color 0.2s ease-out, transform 0.2s ease-out;
45
+ }
46
+
47
+ .dot--active {
48
+ background: var(
49
+ --nile-colors-primary-600,
50
+ var(--ng-colors-text-brand-secondary-700)
51
+ );
52
+ }
53
+
54
+ /* Sizes */
55
+ .dot--sm {
56
+ width: var(--nile-spacing-4px, var(--ng-spacing-1));
57
+ height: var(--nile-spacing-4px, var(--ng-spacing-1));
58
+ }
59
+
60
+ .dot--md {
61
+ width: var(--nile-spacing-10px, var(--ng-spacing-2-5));
62
+ height: var(--nile-spacing-10px, var(--ng-spacing-2-5));
63
+ }
64
+
65
+ .dot--lg {
66
+ width: var(--nile-spacing-14px, var(--ng-spacing-3-5));
67
+ height: var(--nile-spacing-14px, var(--ng-spacing-3-5));
68
+ }
69
+
70
+ .dots:has(.dot--sm) {
71
+ gap: var(--nile-spacing-6px, var(--ng-spacing-1-5));
72
+ }
73
+
74
+ .dots:has(.dot--lg) {
75
+ gap: var(--nile-spacing-2-x, var(--ng-spacing-3));
76
+ }
77
+
78
+ .dot:focus-visible {
79
+ outline: var(--nile-spacing-2px, var(--ng-spacing-0-5)) solid
80
+ var(--nile-colors-stroke-strong-950, var(--ng-colors-border-secondary));
81
+ outline-offset: var(--nile-spacing-2px, var(--ng-spacing-0-5));
82
+ }
83
+
84
+ :host([disabled]) .dot,
85
+ .dot:disabled {
86
+ cursor: not-allowed;
87
+ opacity: 0.5;
88
+ }
89
+ `;
90
+ export default [styles];