@redvars/peacock 3.3.0 → 3.3.1

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 (105) hide show
  1. package/dist/assets/components.css +1 -1
  2. package/dist/assets/components.css.map +1 -1
  3. package/dist/assets/styles.css +1 -1
  4. package/dist/assets/styles.css.map +1 -1
  5. package/dist/button-group-DA7xoziD.js +292 -0
  6. package/dist/button-group-DA7xoziD.js.map +1 -0
  7. package/dist/button-group.js +6 -107
  8. package/dist/button-group.js.map +1 -1
  9. package/dist/{button-BGFJfbT2.js → button-trIfcqC7.js} +2 -3
  10. package/dist/{button-BGFJfbT2.js.map → button-trIfcqC7.js.map} +1 -1
  11. package/dist/button.js +2 -3
  12. package/dist/button.js.map +1 -1
  13. package/dist/{class-map-DpeNtqCn.js → class-map-hJdvjl-W.js} +9 -3
  14. package/dist/class-map-hJdvjl-W.js.map +1 -0
  15. package/dist/code-editor.js +5 -5
  16. package/dist/code-editor.js.map +1 -1
  17. package/dist/code-highlighter.js +5 -23
  18. package/dist/code-highlighter.js.map +1 -1
  19. package/dist/custom-elements-jsdocs.json +4706 -2471
  20. package/dist/custom-elements.json +3444 -1007
  21. package/dist/index.js +4 -5
  22. package/dist/index.js.map +1 -1
  23. package/dist/peacock-loader.js +26 -496
  24. package/dist/peacock-loader.js.map +1 -1
  25. package/dist/src/accordion/accordion-item.d.ts +1 -0
  26. package/dist/src/breadcrumb/breadcrumb/breadcrumb.d.ts +2 -0
  27. package/dist/src/breadcrumb/breadcrumb-item/breadcrumb-item.d.ts +1 -0
  28. package/dist/src/button/button-group/button-group.d.ts +4 -0
  29. package/dist/src/code-editor/code-editor.d.ts +4 -3
  30. package/dist/src/code-highlighter/code-highlighter.d.ts +4 -7
  31. package/dist/src/index.d.ts +4 -0
  32. package/dist/src/menu/index.d.ts +3 -0
  33. package/dist/src/menu/menu/MenuSurfaceController.d.ts +18 -0
  34. package/dist/src/menu/menu/menu.d.ts +54 -12
  35. package/dist/src/menu/menu-item/menu-item.d.ts +12 -5
  36. package/dist/src/menu/sub-menu/sub-menu.d.ts +36 -0
  37. package/dist/src/pagination/index.d.ts +1 -0
  38. package/dist/src/pagination/pagination.d.ts +38 -0
  39. package/dist/src/popover/PopoverController.d.ts +4 -1
  40. package/dist/src/table/index.d.ts +1 -0
  41. package/dist/src/table/table.d.ts +110 -0
  42. package/dist/src/tabs/tab-group.d.ts +4 -0
  43. package/dist/src/tabs/tab-panel.d.ts +1 -0
  44. package/dist/src/tabs/tab.d.ts +1 -0
  45. package/dist/src/tabs/tabs.d.ts +2 -0
  46. package/dist/src/tooltip/tooltip.d.ts +1 -3
  47. package/dist/src/tree-view/index.d.ts +2 -0
  48. package/dist/src/tree-view/tree-node.d.ts +69 -0
  49. package/dist/src/tree-view/tree-view.d.ts +40 -0
  50. package/dist/src/tree-view/wc-tree-view.d.ts +6 -0
  51. package/dist/test/icon.test.d.ts +1 -1
  52. package/dist/test/menu.test.d.ts +1 -0
  53. package/dist/test/sub-menu.test.d.ts +1 -0
  54. package/dist/test/tree-view.test.d.ts +1 -0
  55. package/dist/{slider-Dk9CFWTG.js → tree-view-CLolVlU0.js} +3317 -1180
  56. package/dist/tree-view-CLolVlU0.js.map +1 -0
  57. package/dist/tsconfig.tsbuildinfo +1 -1
  58. package/package.json +1 -1
  59. package/readme.md +40 -40
  60. package/src/accordion/accordion-item.ts +2 -1
  61. package/src/breadcrumb/breadcrumb/breadcrumb.ts +3 -0
  62. package/src/breadcrumb/breadcrumb-item/breadcrumb-item.ts +1 -0
  63. package/src/button/button-group/button-group.ts +6 -0
  64. package/src/code-editor/code-editor.ts +4 -3
  65. package/src/code-highlighter/code-highlighter.ts +4 -22
  66. package/src/divider/divider.scss +2 -2
  67. package/src/empty-state/empty-state.scss +1 -1
  68. package/src/empty-state/empty-state.ts +1 -1
  69. package/src/index.ts +6 -2
  70. package/src/menu/index.ts +3 -0
  71. package/src/menu/menu/MenuSurfaceController.ts +61 -0
  72. package/src/menu/{menu-list/menu-list.scss → menu/menu.scss} +19 -4
  73. package/src/menu/menu/menu.ts +389 -81
  74. package/src/menu/menu-item/menu-item.ts +115 -36
  75. package/src/menu/sub-menu/sub-menu.scss +7 -0
  76. package/src/menu/sub-menu/sub-menu.ts +243 -0
  77. package/src/pagination/index.ts +1 -0
  78. package/src/pagination/pagination.scss +59 -0
  79. package/src/pagination/pagination.ts +135 -0
  80. package/src/peacock-loader.ts +25 -11
  81. package/src/popover/PopoverController.ts +13 -7
  82. package/src/table/index.ts +1 -0
  83. package/src/table/table.scss +174 -0
  84. package/src/table/table.ts +475 -0
  85. package/src/tabs/tab-group.ts +12 -6
  86. package/src/tabs/tab-panel.ts +1 -0
  87. package/src/tabs/tab.ts +1 -0
  88. package/src/tabs/tabs.scss +6 -5
  89. package/src/tabs/tabs.ts +5 -3
  90. package/src/text/text.css-component.scss +6 -3
  91. package/src/tooltip/tooltip.scss +16 -13
  92. package/src/tooltip/tooltip.ts +7 -9
  93. package/src/tree-view/demo/index.html +57 -0
  94. package/src/tree-view/index.ts +2 -0
  95. package/src/tree-view/tree-node.scss +101 -0
  96. package/src/tree-view/tree-node.ts +268 -0
  97. package/src/tree-view/tree-view.scss +12 -0
  98. package/src/tree-view/tree-view.ts +182 -0
  99. package/src/tree-view/wc-tree-view.ts +9 -0
  100. package/dist/class-map-DpeNtqCn.js.map +0 -1
  101. package/dist/slider-Dk9CFWTG.js.map +0 -1
  102. package/dist/src/menu/menu-list/menu-list.d.ts +0 -22
  103. package/dist/state-8v48Exzh.js +0 -10
  104. package/dist/state-8v48Exzh.js.map +0 -1
  105. package/src/menu/menu-list/menu-list.ts +0 -48
package/readme.md CHANGED
@@ -44,12 +44,12 @@ Visit [https://peacock.redvars.com](https://peacock.redvars.com) to view the doc
44
44
  <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
45
45
  <link href="https://fonts.googleapis.com/css2?family=Noto+Sans+Mono:wght@100..900&family=Noto+Sans:ital,wght@0,100..900;1,100..900&display=swap" rel="stylesheet">
46
46
 
47
- <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.3.0/dist/assets/styles.css"></link>
47
+ <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.3.1/dist/assets/styles.css"></link>
48
48
  <script type='module'
49
- src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.3.0/dist/peacock-loader.js'></script>
49
+ src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.3.1/dist/peacock-loader.js'></script>
50
50
  </head>
51
51
 
52
- <base-button>Button</base-button>
52
+ <wc-button>Button</wc-button>
53
53
  ```
54
54
 
55
55
  # Components
@@ -67,22 +67,22 @@ menus, checkboxes, and radio buttons.
67
67
 
68
68
  | Name | Component | State |
69
69
  |---------------------------------------------------------------------|-------------------|-------|
70
- | [Code editor](https://peacock.redvars.com/components/code-editor) | card-editor | 🟢 |
70
+ | [Code editor](https://peacock.redvars.com/components/code-editor) | wc-code-editor | 🟢 |
71
71
  | Color picker | color-picker | 🔴 |
72
- | [Checkbox](https://peacock.redvars.com/components/checkbox) | base-checkbox | 🟢 |
73
- | [Date picker](https://peacock.redvars.com/components/date-picker) | date-picker | 🟡 |
72
+ | [Checkbox](https://peacock.redvars.com/components/checkbox) | wc-checkbox | 🟢 |
73
+ | [Date picker](https://peacock.redvars.com/components/date-picker) | wc-date-picker | 🟡 |
74
74
  | Date Time picker | datetime-picker | 🔴 |
75
- | [Form control](https://peacock.redvars.com/components/form-control) | base-field | 🟡 |
75
+ | [Form control](https://peacock.redvars.com/components/form-control) | wc-field | 🟡 |
76
76
  | File picker | file-picker | 🔴 |
77
77
  | [HTML editor](https://peacock.redvars.com/components/html-editor) | html-editor | 🟢 |
78
- | [Input](https://peacock.redvars.com/components/input) | input-field | 🟢 |
78
+ | [Input](https://peacock.redvars.com/components/input) | wc-input | 🟢 |
79
79
  | [Input URL](https://peacock.redvars.com/components/input-url) | input-url | 🟢 |
80
80
  | Month picker | month-picker | 🔴 |
81
- | [Number](https://peacock.redvars.com/components/number) | number-field | 🟢 |
82
- | [Select](https://peacock.redvars.com/components/select) | base-select | 🟢 |
83
- | [Textarea](https://peacock.redvars.com/components/textarea) | textarea-field | 🟢 |
84
- | [Time picker](https://peacock.redvars.com/components/time-picker) | time-picker | 🟡 |
85
- | [URL input](https://peacock.redvars.com/components/url-input) | url-input. | 🔴 |
81
+ | [Number](https://peacock.redvars.com/components/number) | wc-number-field | 🟢 |
82
+ | [Select](https://peacock.redvars.com/components/select) | base-select | 🟢 |
83
+ | [Textarea](https://peacock.redvars.com/components/textarea) | wc-textarea | 🟢 |
84
+ | [Time picker](https://peacock.redvars.com/components/time-picker) | wc-time-picker | 🟡 |
85
+ | [URL input](https://peacock.redvars.com/components/url-input) | url-input | 🔴 |
86
86
  | Week picker | week-picker | 🔴 |
87
87
 
88
88
  ## Navigation
@@ -93,10 +93,10 @@ include menus, tabs, and breadcrumbs.
93
93
 
94
94
  | Name | Component | State |
95
95
  |--------------------------------------------------------|-----------------|-------|
96
- | [Breadcrumb](https://peacock.redvars.com/components/breadcrumb) | base-breadcrumb | 🟢 |
96
+ | [Breadcrumb](https://peacock.redvars.com/components/breadcrumb) | wc-breadcrumb | 🟢 |
97
97
  | [Dropdown](https://peacock.redvars.com/components/dropdown) | base-dropdown | 🟡 |
98
- | [Menu](https://peacock.redvars.com/components/menu) | base-menu | 🟡 |
99
- | [Tabs](https://peacock.redvars.com/components/tabs) | base-tabs | 🟢 |
98
+ | [Menu](https://peacock.redvars.com/components/menu) | wc-base-menu | 🟡 |
99
+ | [Tabs](https://peacock.redvars.com/components/tabs) | wc-tabs | 🟢 |
100
100
 
101
101
  ## Informational
102
102
 
@@ -106,11 +106,11 @@ include notifications, tooltips, and progress bars.
106
106
 
107
107
  | Name | Component | State |
108
108
  |-------------------------------------------------------------------------------------|------------------------|-------|
109
- | [Badge](https://peacock.redvars.com/components/badge) | base-badge | 🟢 |
110
- | [Linear Progress](https://peacock.redvars.com/components/linear-progress) | linear-progress | 🟢 |
111
- | [Circular Progress](https://peacock.redvars.com/components/circular-progress) | circular-progress | 🟢 |
112
- | [Spinner](https://peacock.redvars.com/components/spinner) | base-spinner | 🟢 |
113
- | [Tooltip](https://peacock.redvars.com/components/tooltip) | base-tooltip | 🟢 |
109
+ | [Badge](https://peacock.redvars.com/components/badge) | wc-badge | 🟢 |
110
+ | [Linear Progress](https://peacock.redvars.com/components/linear-progress) | wc-linear-progress | 🟢 |
111
+ | [Circular Progress](https://peacock.redvars.com/components/circular-progress) | wc-circular-progress | 🟢 |
112
+ | [Spinner](https://peacock.redvars.com/components/spinner) | wc-spinner | 🟢 |
113
+ | [Tooltip](https://peacock.redvars.com/components/tooltip) | wc-tooltip | 🟢 |
114
114
  | [Notification](https://peacock.redvars.com/components/notification) | base-notification | 🟢 |
115
115
  | [Notification Manager](https://peacock.redvars.com/components/notification-manager) | base-notification-manager | 🟢 |
116
116
 
@@ -123,8 +123,8 @@ organization to the content.
123
123
 
124
124
  | Name | Component | State |
125
125
  |---------------------------------------------------------------|----------------|-------|
126
- | [Accordion](https://peacock.redvars.com/components/accordion) | base-accordion | 🟢 |
127
- | Card | base-card | 🟡 |
126
+ | [Accordion](https://peacock.redvars.com/components/accordion) | wc-accordion | 🟢 |
127
+ | Card | base-card | 🟡 |
128
128
 
129
129
  ## General
130
130
 
@@ -132,34 +132,34 @@ These components are used for general purpose. They include
132
132
 
133
133
  | Name | Component | State |
134
134
  |-------------------------------------------------------------------------------------|---------------------------|-------|
135
- | [Avatar](https://peacock.redvars.com/components/avatar) | base-avatar | 🟢 |
136
- | [Button](https://peacock.redvars.com/components/button) | base-button | 🟢 |
137
- | [Button Group](https://peacock.redvars.com/components/button-group) | button-group | 🟢 |
135
+ | [Avatar](https://peacock.redvars.com/components/avatar) | wc-avatar | 🟢 |
136
+ | [Button](https://peacock.redvars.com/components/button) | wc-button | 🟢 |
137
+ | [Button Group](https://peacock.redvars.com/components/button-group) | wc-button-group | 🟢 |
138
138
  | [Calendar](https://peacock.redvars.com/components/calendar) | base-calendar | 🟢 |
139
139
  | Card Select | base-cardselect | 🔴 |
140
- | [Code Highlighter](https://peacock.redvars.com/components/code-highlighter) | code-highlighter | 🟢 |
140
+ | [Code Highlighter](https://peacock.redvars.com/components/code-highlighter) | wc-code-highlighter | 🟢 |
141
141
  | Column | base-col | 🔴 |
142
- | [Empty State](https://peacock.redvars.com/components/empty-state) | empty-state | 🟡 |
143
- | [Flow Designer ](https://peacock.redvars.com/components/flow-designer) | flow-designer | 🔵 |
142
+ | [Empty State](https://peacock.redvars.com/components/empty-state) | wc-empty-state | 🟡 |
143
+ | [Flow Designer ](https://peacock.redvars.com/components/flow-designer) | flow-designer | 🔵 |
144
144
  | Grid | base-grid | 🔴 |
145
145
  | Group | base-group | 🔴 |
146
146
  | [Header](https://peacock.redvars.com/components/header) | base-header | 🟢 |
147
- | [Icon](https://peacock.redvars.com/components/icon) | base-icon | 🟢 |
148
- | [Link](https://peacock.redvars.com/components/link) | base-link | 🟢 |
147
+ | [Icon](https://peacock.redvars.com/components/icon) | wc-icon | 🟢 |
148
+ | [Link](https://peacock.redvars.com/components/link) | wc-link | 🟢 |
149
149
  | [Modal](https://peacock.redvars.com/components/modal) | base-modal | 🟢 |
150
- | [Notification Manager](https://peacock.redvars.com/components/notification-manager) | notification-manager | 🟡 |
150
+ | [Notification Manager](https://peacock.redvars.com/components/notification-manager) | notification-manager | 🟡 |
151
151
  | Observer | base-observer | 🔴 |
152
- | Pagination | base-pagination | 🔴 |
152
+ | Pagination | wc-pagination | 🔴 |
153
153
  | Radio Group | base-radiogroup | 🔴 |
154
154
  | Row | base-row | 🔴 |
155
- | [Slider](https://peacock.redvars.com/components/slider) | base-slider | 🟡 |
155
+ | [Slider](https://peacock.redvars.com/components/slider) | wc-slider | 🟡 |
156
156
  | Spoiler | base-spoiler | 🔴 |
157
157
  | Stepper | base-stepper | 🔴 |
158
- | [Table](https://peacock.redvars.com/components/table) | base-table | 🟡 |
159
- | [Tag](https://peacock.redvars.com/components/tag) / Chip | base-tag | 🟢 |
158
+ | [Table](https://peacock.redvars.com/components/table) | wc-table | 🟡 |
159
+ | [Tag](https://peacock.redvars.com/components/tag) / Chip | wc-tag | 🟢 |
160
160
  | [Text](https://peacock.redvars.com/components/text) | base-text | 🟢 |
161
- | [Tree View](https://peacock.redvars.com/components/tree-view) | tree-view | 🟡 |
162
- | [Switch](https://peacock.redvars.com/components/switch) | base-switch | 🟢 |
161
+ | [Tree View](https://peacock.redvars.com/components/tree-view) | wc-tree-view | 🟡 |
162
+ | [Switch](https://peacock.redvars.com/components/switch) | wc-switch | 🟢 |
163
163
 
164
164
  ## Charts
165
165
 
@@ -167,8 +167,8 @@ These components are used to display data in a graphical format. They include
167
167
 
168
168
  | Name | Component | State |
169
169
  |----------------------------------------------------------------|---------------------|-------|
170
- | [Doughnut Chart](https://peacock.redvars.com/components/chart-doughnut) | chart-doughnut | 🟢 |
171
- | [Pie Chart ](https://peacock.redvars.com/components/chart-pie) | chart-pie | 🟢 |
170
+ | [Doughnut Chart](https://peacock.redvars.com/components/chart-doughnut) | wc-chart-doughnut | 🟢 |
171
+ | [Pie Chart ](https://peacock.redvars.com/components/chart-pie) | wc-chart-pie | 🟢 |
172
172
 
173
173
 
174
174
  ## 📄 License
@@ -8,7 +8,8 @@ import styles from './accordion-item.scss';
8
8
  * @tag wc-accordion-item
9
9
  * @rawTag accordion-item
10
10
  * @summary An accordion item is single item in an accordion list. It contains a header and a content section that can be expanded or collapsed by the user.
11
- *
11
+ * @parentRawTag accordion
12
+ *
12
13
  * @example
13
14
  * ```html
14
15
  * <wc-accordion-item>
@@ -1,6 +1,7 @@
1
1
  import { html, LitElement } from 'lit';
2
2
  import { property } from 'lit/decorators.js';
3
3
  import styles from './breadcrumb.scss';
4
+ import { BreadcrumbItem } from '../breadcrumb-item/breadcrumb-item.js';
4
5
 
5
6
  /**
6
7
  * @label Breadcrumb
@@ -25,6 +26,8 @@ import styles from './breadcrumb.scss';
25
26
  export class Breadcrumb extends LitElement {
26
27
  static styles = [styles];
27
28
 
29
+ static Item = BreadcrumbItem;
30
+
28
31
  /**
29
32
  * Accessible label for the breadcrumb navigation landmark.
30
33
  * @default "Breadcrumb"
@@ -8,6 +8,7 @@ import styles from './breadcrumb-item.scss';
8
8
  * @label Breadcrumb Item
9
9
  * @tag wc-breadcrumb-item
10
10
  * @rawTag breadcrumb-item
11
+ * @parentRawTag breadcrumb
11
12
  * @summary A breadcrumb item component that represents a single item in a breadcrumb navigation.
12
13
  * @tags navigation
13
14
  *
@@ -3,6 +3,8 @@ import { property } from 'lit/decorators.js';
3
3
  import { classMap } from 'lit/directives/class-map.js';
4
4
  import IndividualComponent from 'src/IndividualComponent.js';
5
5
  import styles from './button-group.scss';
6
+ import { Button } from '../button/button.js';
7
+ import { IconButton } from '../icon-button/icon-button.js';
6
8
 
7
9
  /**
8
10
  * @label Button Group
@@ -28,6 +30,10 @@ export class ButtonGroup extends LitElement {
28
30
  // that can import .scss files as lit-css.
29
31
  static styles = [styles];
30
32
 
33
+ static Button = Button;
34
+
35
+ static IconButton = IconButton;
36
+
31
37
  /**
32
38
  * Button size.
33
39
  * Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`.
@@ -44,7 +44,7 @@ import styles from './code-editor.scss';
44
44
 
45
45
  /**
46
46
  * @label Code Editor
47
- * @tag code-editor
47
+ * @tag wc-code-editor
48
48
  * @rawTag code-editor
49
49
  *
50
50
  * @summary A Monaco-based code editing component with syntax highlighting and theming.
@@ -55,12 +55,13 @@ import styles from './code-editor.scss';
55
55
  *
56
56
  * @example
57
57
  * ```html
58
- * <code-editor
58
+ * <wc-code-editor
59
59
  * language="javascript"
60
+ * style="width: 100%; --code-editor-height: 10rem;"
60
61
  * value="function hello() { console.log('Hello'); }"
61
62
  * lineNumbers="on"
62
63
  * minimap="false">
63
- * </code-editor>
64
+ * </wc-code-editor>
64
65
  * ```
65
66
  * @tags input, editor
66
67
  */
@@ -16,21 +16,6 @@ import IndividualComponent from 'src/IndividualComponent.js';
16
16
  import { copyToClipboard } from '../utils/copy-to-clipboard.js';
17
17
  import styles from './code-highlighter.scss';
18
18
 
19
- /**
20
- * @label Code Highlighter
21
- * @tag wc-code-highlighter
22
- * @rawTag code-highlighter
23
- * @summary A component that provides syntax highlighting for code snippets.
24
- * @tags display
25
- *
26
- * @example
27
- * ```html
28
- * <wc-code-highlighter language="javascript">
29
- * <pre><code>console.log('Hello');</code></pre>
30
- * </wc-code-highlighter>
31
- * ```
32
- */
33
-
34
19
  const locale = {
35
20
  loading: 'Loading code...',
36
21
  copyToClipboard: 'Copy to clipboard',
@@ -40,21 +25,18 @@ const locale = {
40
25
 
41
26
  /**
42
27
  * @label Code Highlighter
43
- * @tag code-highlighter
28
+ * @tag wc-code-highlighter
44
29
  * @rawTag code-highlighter
45
30
  *
46
- * @summary Highlights code snippets with syntax highlighting and line numbers.
47
- * @overview
48
- * - CodeHighlighter is a component that provides syntax highlighting for code snippets.
49
- * - It supports various programming languages and can display line numbers for better readability.
31
+ * @summary A component that provides syntax highlighting for code snippets.
50
32
  *
51
33
  * @example
52
34
  * ```html
53
- * <code-highlighter language="javascript" style="height: 9rem"><pre><code>
35
+ * <wc-code-highlighter language="javascript" style="height: 9rem"><pre><code>
54
36
  * function helloWorld() {
55
37
  * console.log('Hello, world!');
56
38
  * }</code></pre>
57
- * </code-highlighter>
39
+ * </wc-code-highlighter>
58
40
  * ```
59
41
  * @tags display
60
42
  */
@@ -7,7 +7,7 @@
7
7
 
8
8
  --divider-color: var(--color-outline-variant);
9
9
  --divider-spacing: var(--spacing-200);
10
- --divider-line-thinkness: 2px;
10
+ --divider-line-thickness: 1px;
11
11
  }
12
12
 
13
13
  .divider {
@@ -16,7 +16,7 @@
16
16
  @include mixin.get-typography(body-medium);
17
17
  color: var(--divider-color);
18
18
 
19
- --_line-border: var(--divider-line-thinkness) solid var(--divider-color);
19
+ --_line-border: var(--divider-line-thickness) solid var(--divider-color);
20
20
 
21
21
  &:not(.vertical) {
22
22
  width: 100%;
@@ -27,7 +27,7 @@
27
27
  height: 100%;
28
28
  display: flex;
29
29
 
30
- base-icon {
30
+ .illustration-svg {
31
31
  --icon-size: 100%;
32
32
  }
33
33
  }
@@ -76,7 +76,7 @@ export class EmptyState extends LitElement {
76
76
  <div class="${classMap(classes)}">
77
77
  <div class="empty-state-container">
78
78
  <div class="illustration">
79
- <wc-icon src="${illustrationPath}"></wc-icon>
79
+ <wc-icon class="illustration-svg" src="${illustrationPath}"></wc-icon>
80
80
  </div>
81
81
 
82
82
  <div class="content">
package/src/index.ts CHANGED
@@ -23,12 +23,13 @@ export { TimePicker } from './time-picker/index.js';
23
23
  export { Textarea } from './textarea/index.js';
24
24
  export { Switch } from './switch/index.js';
25
25
  export { Spinner } from './spinner/index.js';
26
- export { Container } from './container/index.js'
26
+ export { Container } from './container/index.js';
27
27
 
28
28
  export { NumberCounter } from './number-counter/index.js';
29
29
  export { EmptyState } from './empty-state/index.js';
30
30
  export { Tooltip } from './popover/index.js';
31
31
  export { Breadcrumb, BreadcrumbItem } from './breadcrumb/index.js';
32
+ export { Menu, MenuItem, SubMenu } from './menu/index.js';
32
33
 
33
34
  export { CodeHighlighter } from './code-highlighter/index.js';
34
35
  export { CodeEditor } from './code-editor/index.js';
@@ -36,4 +37,7 @@ export { Image } from './image/index.js';
36
37
  export { Tab, TabGroup, TabPanel, Tabs } from './tabs/index.js';
37
38
  export { Slider } from './slider/index.js';
38
39
  export { ChartDoughnut } from './chart-doughnut/index.js';
39
- export { ChartPie } from './chart-pie/index.js';
40
+ export { ChartPie } from './chart-pie/index.js';
41
+ export { Table } from './table/index.js';
42
+ export { Pagination } from './pagination/index.js';
43
+ export { TreeView, TreeNode } from './tree-view/index.js';
@@ -0,0 +1,3 @@
1
+ export { Menu } from './menu/menu.js';
2
+ export { MenuItem } from './menu-item/menu-item.js';
3
+ export { SubMenu } from './sub-menu/sub-menu.js';
@@ -0,0 +1,61 @@
1
+ import { ReactiveController, ReactiveControllerHost } from 'lit';
2
+ import {
3
+ autoUpdate,
4
+ computePosition,
5
+ flip,
6
+ offset,
7
+ shift,
8
+ type Placement,
9
+ type Strategy,
10
+ } from '@floating-ui/dom';
11
+
12
+ type PositionOptions = {
13
+ reference: HTMLElement;
14
+ floating: HTMLElement;
15
+ placement: Placement;
16
+ offset: number;
17
+ strategy?: Strategy;
18
+ };
19
+
20
+ async function updateSurfacePosition(options: PositionOptions & { strategy: Strategy }) {
21
+ const { x, y } = await computePosition(options.reference, options.floating, {
22
+ strategy: options.strategy,
23
+ placement: options.placement,
24
+ middleware: [offset(options.offset), flip(), shift({ padding: 8 })],
25
+ });
26
+
27
+ Object.assign(options.floating.style, {
28
+ position: options.strategy,
29
+ left: `${x}px`,
30
+ top: `${y}px`,
31
+ });
32
+ }
33
+
34
+ export class MenuSurfaceController implements ReactiveController {
35
+ private cleanup?: () => void;
36
+
37
+ constructor(private host: ReactiveControllerHost) {
38
+ this.host.addController(this);
39
+ }
40
+
41
+ start(options: PositionOptions) {
42
+ this.stop();
43
+
44
+ const strategy = options.strategy ?? 'fixed';
45
+
46
+ this.cleanup = autoUpdate(options.reference, options.floating, () => {
47
+ updateSurfacePosition({ ...options, strategy });
48
+ });
49
+
50
+ updateSurfacePosition({ ...options, strategy });
51
+ }
52
+
53
+ stop() {
54
+ this.cleanup?.();
55
+ this.cleanup = undefined;
56
+ }
57
+
58
+ hostDisconnected() {
59
+ this.stop();
60
+ }
61
+ }
@@ -2,13 +2,28 @@
2
2
 
3
3
  @include mixin.base-styles;
4
4
 
5
- .menu-list {
5
+ .menu {
6
6
  display: flex;
7
7
  position: relative;
8
+ z-index: var(--menu-z-index, 1000);
8
9
  min-width: 112px;
9
10
  padding-block: var(--spacing-050);
10
11
 
11
- .menu-list-content {
12
+ &.closed {
13
+ display: none;
14
+ opacity: 0;
15
+ visibility: hidden;
16
+ pointer-events: none;
17
+ }
18
+
19
+ &.open {
20
+ display: flex;
21
+ opacity: 1;
22
+ visibility: visible;
23
+ pointer-events: auto;
24
+ }
25
+
26
+ .menu-content {
12
27
  display: flex;
13
28
  flex-direction: column;
14
29
  gap: var(--spacing-050);
@@ -24,7 +39,7 @@
24
39
  --menu-item-container-shape-end-end: var(--shape-corner-medium);
25
40
  }
26
41
 
27
- ::slotted(base-divider) {
42
+ ::slotted(wc-divider) {
28
43
  --divider-spacing: var(--spacing-100);
29
44
  padding-inline: var(--spacing-050);
30
45
  }
@@ -58,7 +73,7 @@
58
73
  }
59
74
  }
60
75
 
61
- .menu-list {
76
+ .menu {
62
77
  --_container-shape-start-start: var(--shape-corner-large);
63
78
  --_container-shape-start-end: var(--shape-corner-large);
64
79
  --_container-shape-end-start: var(--shape-corner-large);