@redvars/peacock 3.5.0 → 3.5.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.
- package/dist/BaseButton-DuASuVth.js +219 -0
- package/dist/BaseButton-DuASuVth.js.map +1 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js +65 -0
- package/dist/BaseHyperlinkMixin-BNuwbiEf.js.map +1 -0
- package/dist/assets/components.css +1 -1
- package/dist/assets/components.css.map +1 -1
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/banner.js +12 -27
- package/dist/banner.js.map +1 -1
- package/dist/{button-DMN1dPAg.js → button-DouvOfEU.js} +77 -251
- package/dist/button-DouvOfEU.js.map +1 -0
- package/dist/{button-group-CX9CUUXk.js → button-group-CEdMwvJJ.js} +71 -42
- package/dist/button-group-CEdMwvJJ.js.map +1 -0
- package/dist/button-group.js +5 -5
- package/dist/button.js +3 -3
- package/dist/card.js +18 -73
- package/dist/card.js.map +1 -1
- package/dist/chart-bar.js.map +1 -1
- package/dist/chart-doughnut.js +2 -2
- package/dist/chart-doughnut.js.map +1 -1
- package/dist/chart-pie.js +2 -2
- package/dist/chart-pie.js.map +1 -1
- package/dist/chart-stacked-bar.js.map +1 -1
- package/dist/code-highlighter.js +2 -1
- package/dist/code-highlighter.js.map +1 -1
- package/dist/custom-elements-jsdocs.json +3105 -1494
- package/dist/custom-elements.json +9244 -7829
- package/dist/fab.js +421 -9
- package/dist/fab.js.map +1 -1
- package/dist/index.js +6 -6
- package/dist/{select-4pl4XBj7.js → navigation-rail-Lxetd5-Z.js} +2214 -1090
- package/dist/navigation-rail-Lxetd5-Z.js.map +1 -0
- package/dist/notification.js +3 -2
- package/dist/notification.js.map +1 -1
- package/dist/peacock-loader.js +22 -10
- package/dist/peacock-loader.js.map +1 -1
- package/dist/search.js +4 -0
- package/dist/search.js.map +1 -1
- package/dist/src/__mixins/BaseButtonMixin.d.ts +20 -0
- package/dist/src/__mixins/BaseHyperlinkMixin.d.ts +18 -0
- package/dist/src/__mixins/MixinConstructor.d.ts +1 -0
- package/dist/src/banner/banner.d.ts +0 -4
- package/dist/src/button/BaseButton.d.ts +4 -47
- package/dist/src/button/button/button.d.ts +32 -3
- package/dist/src/button/button-group/button-group.d.ts +2 -2
- package/dist/src/button/icon-button/icon-button.d.ts +33 -8
- package/dist/src/card/card.d.ts +4 -15
- package/dist/src/fab/fab.d.ts +4 -35
- package/dist/src/focus-ring/focus-ring.d.ts +11 -5
- package/dist/src/index.d.ts +3 -1
- package/dist/src/link/link.d.ts +1 -1
- package/dist/src/navigation-rail/index.d.ts +2 -0
- package/dist/src/navigation-rail/navigation-rail-item.d.ts +55 -0
- package/dist/src/navigation-rail/navigation-rail.d.ts +71 -0
- package/dist/src/sidebar-menu/index.d.ts +3 -0
- package/dist/src/sidebar-menu/sidebar-menu-item.d.ts +58 -0
- package/dist/src/sidebar-menu/sidebar-menu.d.ts +38 -0
- package/dist/src/sidebar-menu/sidebar-sub-menu.d.ts +35 -0
- package/dist/src/toolbar/toolbar.d.ts +10 -10
- package/dist/src/tooltip/tooltip.d.ts +3 -0
- package/dist/src/url-field/index.d.ts +1 -0
- package/dist/src/url-field/url-field.d.ts +48 -0
- package/dist/test/sidebar-menu.test.d.ts +1 -0
- package/dist/toolbar.js +10 -10
- package/dist/toolbar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/readme.md +73 -65
- package/scss/mixin.scss +16 -0
- package/src/__mixins/BaseButtonMixin.ts +83 -0
- package/src/__mixins/BaseHyperlinkMixin.ts +68 -0
- package/src/__mixins/MixinConstructor.ts +1 -0
- package/src/{__base_element → __mixins}/README.md +2 -2
- package/src/banner/banner.scss +18 -22
- package/src/banner/banner.ts +1 -7
- package/src/button/BaseButton.ts +11 -100
- package/src/button/button/button-sizes.scss +4 -2
- package/src/button/button/button.ts +76 -23
- package/src/button/button-group/button-group.ts +2 -2
- package/src/button/icon-button/icon-button.ts +75 -33
- package/src/card/card.ts +11 -71
- package/src/chart-bar/chart-bar.ts +9 -14
- package/src/chart-bar/chart-stacked-bar.ts +12 -18
- package/src/chart-doughnut/chart-doughnut.ts +23 -27
- package/src/chart-pie/chart-pie.ts +19 -23
- package/src/checkbox/checkbox.scss +17 -34
- package/src/checkbox/checkbox.ts +3 -1
- package/src/code-highlighter/code-highlighter.scss +1 -0
- package/src/code-highlighter/code-highlighter.ts +1 -1
- package/src/date-picker/date-picker.ts +1 -1
- package/src/elevation/elevation.scss +5 -5
- package/src/fab/fab.ts +29 -100
- package/src/focus-ring/focus-ring.ts +47 -40
- package/src/index.ts +3 -1
- package/src/input/input.ts +3 -1
- package/src/link/link.ts +2 -2
- package/src/menu/menu-item/menu-item.ts +3 -1
- package/src/navigation-rail/index.ts +2 -0
- package/src/navigation-rail/navigation-rail-item.scss +216 -0
- package/src/navigation-rail/navigation-rail-item.ts +223 -0
- package/src/navigation-rail/navigation-rail.scss +72 -0
- package/src/navigation-rail/navigation-rail.ts +149 -0
- package/src/notification/notification.ts +3 -2
- package/src/number-field/number-field.ts +6 -4
- package/src/pagination/pagination.ts +6 -4
- package/src/peacock-loader.ts +22 -5
- package/src/search/search.ts +4 -0
- package/src/sidebar-menu/demo/index.html +68 -0
- package/src/sidebar-menu/index.ts +3 -0
- package/src/sidebar-menu/sidebar-menu-item.scss +102 -0
- package/src/sidebar-menu/sidebar-menu-item.ts +151 -0
- package/src/{tree-view/tree-view.scss → sidebar-menu/sidebar-menu.scss} +1 -1
- package/src/sidebar-menu/sidebar-menu.ts +182 -0
- package/src/sidebar-menu/sidebar-sub-menu.scss +130 -0
- package/src/sidebar-menu/sidebar-sub-menu.ts +160 -0
- package/src/skeleton/skeleton.scss +18 -24
- package/src/snackbar/snackbar.ts +1 -1
- package/src/tabs/tab.ts +4 -3
- package/src/text/text.css-component.scss +7 -1
- package/src/time-picker/time-picker.ts +1 -1
- package/src/toolbar/toolbar.ts +10 -10
- package/src/tooltip/tooltip.ts +24 -0
- package/src/url-field/index.ts +1 -0
- package/src/url-field/url-field.scss +50 -0
- package/src/url-field/url-field.ts +239 -0
- package/dist/button-DMN1dPAg.js.map +0 -1
- package/dist/button-group-CX9CUUXk.js.map +0 -1
- package/dist/fab-C5Nzxk0E.js +0 -497
- package/dist/fab-C5Nzxk0E.js.map +0 -1
- package/dist/select-4pl4XBj7.js.map +0 -1
- package/dist/spread-B5cgadZl.js +0 -32
- package/dist/spread-B5cgadZl.js.map +0 -1
- package/dist/src/__base_element/BaseHyperlink.d.ts +0 -20
- package/dist/src/tree-view/index.d.ts +0 -2
- package/dist/src/tree-view/tree-node.d.ts +0 -69
- package/dist/src/tree-view/tree-view.d.ts +0 -40
- package/dist/src/tree-view/wc-tree-view.d.ts +0 -6
- package/dist/test/tree-view.test.d.ts +0 -1
- package/dist/throttle-C7ZAPqtu.js +0 -24
- package/dist/throttle-C7ZAPqtu.js.map +0 -1
- package/src/__base_element/BaseHyperlink.ts +0 -42
- package/src/tree-view/demo/index.html +0 -57
- package/src/tree-view/index.ts +0 -2
- package/src/tree-view/tree-node.scss +0 -101
- package/src/tree-view/tree-node.ts +0 -268
- package/src/tree-view/tree-view.ts +0 -182
- package/src/tree-view/wc-tree-view.ts +0 -9
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -44,9 +44,9 @@ 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.5.
|
|
47
|
+
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@redvars/peacock@3.5.1/dist/assets/styles.css"></link>
|
|
48
48
|
<script type='module'
|
|
49
|
-
src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.5.
|
|
49
|
+
src='https://cdn.jsdelivr.net/npm/@redvars/peacock@3.5.1/dist/peacock-loader.js'></script>
|
|
50
50
|
</head>
|
|
51
51
|
|
|
52
52
|
<wc-button>Button</wc-button>
|
|
@@ -65,24 +65,25 @@ Input controls are UI design elements that allow users to input information into
|
|
|
65
65
|
collecting data and enabling user interactions. Some common examples of input controls include text fields, dropdown
|
|
66
66
|
menus, checkboxes, and radio buttons.
|
|
67
67
|
|
|
68
|
-
| Name | Component
|
|
69
|
-
|
|
68
|
+
| Name | Component | State |
|
|
69
|
+
|---------------------------------------------------------------------|-----------------|-------|
|
|
70
|
+
| [Checkbox](https://peacock.redvars.com/components/checkbox) | wc-checkbox | 🟢 |
|
|
70
71
|
| [Code editor](https://peacock.redvars.com/components/code-editor) | wc-code-editor | 🟢 |
|
|
71
72
|
| Color picker | color-picker | 🔴 |
|
|
72
|
-
| [Checkbox](https://peacock.redvars.com/components/checkbox) | wc-checkbox | 🟢 |
|
|
73
73
|
| [Date picker](https://peacock.redvars.com/components/date-picker) | wc-date-picker | 🟡 |
|
|
74
|
-
| Date
|
|
75
|
-
| [Form control](https://peacock.redvars.com/components/
|
|
74
|
+
| Date time picker | datetime-picker | 🔴 |
|
|
75
|
+
| [Field / Form control](https://peacock.redvars.com/components/field) | wc-field | 🟡 |
|
|
76
76
|
| File picker | file-picker | 🔴 |
|
|
77
|
-
|
|
|
77
|
+
| HTML editor | html-editor | 🔴 |
|
|
78
78
|
| [Input](https://peacock.redvars.com/components/input) | wc-input | 🟢 |
|
|
79
|
-
|
|
|
79
|
+
| Input URL | input-url | 🔴 |
|
|
80
80
|
| Month picker | month-picker | 🔴 |
|
|
81
|
-
| [Number](https://peacock.redvars.com/components/number)
|
|
82
|
-
| [
|
|
81
|
+
| [Number field](https://peacock.redvars.com/components/number) | wc-number-field | 🟢 |
|
|
82
|
+
| [Radio](https://peacock.redvars.com/components/radio) | wc-radio | 🟢 |
|
|
83
|
+
| [Search](https://peacock.redvars.com/components/search) | wc-search | 🟡 |
|
|
84
|
+
| [Select](https://peacock.redvars.com/components/select) | wc-select | 🟢 |
|
|
83
85
|
| [Textarea](https://peacock.redvars.com/components/textarea) | wc-textarea | 🟢 |
|
|
84
86
|
| [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
87
|
| Week picker | week-picker | 🔴 |
|
|
87
88
|
|
|
88
89
|
## Navigation
|
|
@@ -91,12 +92,13 @@ Navigational components are UI elements that help users move around the app or w
|
|
|
91
92
|
and intuitive way to navigate through different sections and pages. Some common examples of navigational components
|
|
92
93
|
include menus, tabs, and breadcrumbs.
|
|
93
94
|
|
|
94
|
-
| Name
|
|
95
|
-
|
|
96
|
-
| [Breadcrumb](https://peacock.redvars.com/components/breadcrumb)
|
|
97
|
-
|
|
|
98
|
-
| [Menu](https://peacock.redvars.com/components/menu)
|
|
99
|
-
| [Tabs](https://peacock.redvars.com/components/tabs)
|
|
95
|
+
| Name | Component | State |
|
|
96
|
+
|-------------------------------------------------------------------------|---------------|-------|
|
|
97
|
+
| [Breadcrumb](https://peacock.redvars.com/components/breadcrumb) | wc-breadcrumb | 🟢 |
|
|
98
|
+
| Dropdown | wc-dropdown | 🔴 |
|
|
99
|
+
| [Menu](https://peacock.redvars.com/components/menu) | wc-menu | 🟡 |
|
|
100
|
+
| [Tabs](https://peacock.redvars.com/components/tabs) | wc-tabs | 🟢 |
|
|
101
|
+
| [Toolbar](https://peacock.redvars.com/components/toolbar) | wc-toolbar | 🟡 |
|
|
100
102
|
|
|
101
103
|
## Informational
|
|
102
104
|
|
|
@@ -104,15 +106,17 @@ Informational components are UI elements that provide information to users. They
|
|
|
104
106
|
updates, or instructions within the app or website. Some common examples of informational components
|
|
105
107
|
include notifications, tooltips, and progress bars.
|
|
106
108
|
|
|
107
|
-
| Name
|
|
108
|
-
|
|
109
|
-
| [Badge](https://peacock.redvars.com/components/badge)
|
|
110
|
-
| [
|
|
111
|
-
| [Circular Progress](https://peacock.redvars.com/components/circular-progress)
|
|
112
|
-
| [
|
|
113
|
-
| [
|
|
114
|
-
| [
|
|
115
|
-
| [
|
|
109
|
+
| Name | Component | State |
|
|
110
|
+
|-------------------------------------------------------------------------------|----------------------|-------|
|
|
111
|
+
| [Badge](https://peacock.redvars.com/components/badge) | wc-badge | 🟢 |
|
|
112
|
+
| [Banner](https://peacock.redvars.com/components/banner) | wc-banner | 🟡 |
|
|
113
|
+
| [Circular Progress](https://peacock.redvars.com/components/circular-progress) | wc-circular-progress | 🟢 |
|
|
114
|
+
| [Linear Progress](https://peacock.redvars.com/components/linear-progress) | wc-linear-progress | 🟢 |
|
|
115
|
+
| [Notification](https://peacock.redvars.com/components/notification) | wc-notification | 🟢 |
|
|
116
|
+
| [Skeleton](https://peacock.redvars.com/components/skeleton) | wc-skeleton | 🟢 |
|
|
117
|
+
| [Snackbar](https://peacock.redvars.com/components/snackbar) | wc-snackbar | 🟡 |
|
|
118
|
+
| [Spinner](https://peacock.redvars.com/components/spinner) | wc-spinner | 🟢 |
|
|
119
|
+
| [Tooltip](https://peacock.redvars.com/components/tooltip) | wc-tooltip | 🟢 |
|
|
116
120
|
|
|
117
121
|
|
|
118
122
|
## Containers
|
|
@@ -121,54 +125,58 @@ Containers are UI elements that group similar content together, making it easier
|
|
|
121
125
|
the interface. Examples of common containers include cards, carousels, and accordions, which provide structure and
|
|
122
126
|
organization to the content.
|
|
123
127
|
|
|
124
|
-
| Name
|
|
125
|
-
|
|
126
|
-
| [Accordion](https://peacock.redvars.com/components/accordion)
|
|
127
|
-
|
|
|
128
|
+
| Name | Component | State |
|
|
129
|
+
|-----------------------------------------------------------------------|------------------|-------|
|
|
130
|
+
| [Accordion](https://peacock.redvars.com/components/accordion) | wc-accordion | 🟢 |
|
|
131
|
+
| [Bottom Sheet](https://peacock.redvars.com/components/bottom-sheet) | wc-bottom-sheet | 🟡 |
|
|
132
|
+
| [Card](https://peacock.redvars.com/components/card) | wc-card | 🟢 |
|
|
133
|
+
| Container | wc-container | 🟡 |
|
|
134
|
+
| [Side Sheet](https://peacock.redvars.com/components/side-sheet) | wc-side-sheet | 🟡 |
|
|
128
135
|
|
|
129
136
|
## General
|
|
130
137
|
|
|
131
138
|
These components are used for general purpose. They include
|
|
132
139
|
|
|
133
|
-
| Name
|
|
134
|
-
|
|
135
|
-
| [Avatar](https://peacock.redvars.com/components/avatar)
|
|
136
|
-
| [Button](https://peacock.redvars.com/components/button)
|
|
137
|
-
| [Button Group](https://peacock.redvars.com/components/button-group)
|
|
138
|
-
|
|
|
139
|
-
| Card Select
|
|
140
|
-
| [
|
|
141
|
-
|
|
|
142
|
-
| [
|
|
143
|
-
| [
|
|
144
|
-
|
|
|
145
|
-
|
|
|
146
|
-
| [
|
|
147
|
-
|
|
|
148
|
-
| [
|
|
149
|
-
| [
|
|
150
|
-
| [
|
|
151
|
-
|
|
|
152
|
-
|
|
|
153
|
-
|
|
|
154
|
-
|
|
|
155
|
-
| [
|
|
156
|
-
|
|
|
157
|
-
|
|
|
158
|
-
| [Table](https://peacock.redvars.com/components/table)
|
|
159
|
-
| [Tag](https://peacock.redvars.com/components/tag)
|
|
160
|
-
|
|
|
161
|
-
| [
|
|
162
|
-
| [Switch](https://peacock.redvars.com/components/switch) | wc-switch | 🟢 |
|
|
140
|
+
| Name | Component | State |
|
|
141
|
+
|-----------------------------------------------------------------------------|-----------------------|-------|
|
|
142
|
+
| [Avatar](https://peacock.redvars.com/components/avatar) | wc-avatar | 🟢 |
|
|
143
|
+
| [Button](https://peacock.redvars.com/components/button) | wc-button | 🟢 |
|
|
144
|
+
| [Button Group](https://peacock.redvars.com/components/button-group) | wc-button-group | 🟢 |
|
|
145
|
+
| Calendar | calendar | 🔴 |
|
|
146
|
+
| Card Select | card-select | 🔴 |
|
|
147
|
+
| [Chip](https://peacock.redvars.com/components/chip) | wc-chip | 🟢 |
|
|
148
|
+
| [Clock](https://peacock.redvars.com/components/clock) | wc-clock | 🟡 |
|
|
149
|
+
| [Code Highlighter](https://peacock.redvars.com/components/code-highlighter) | wc-code-highlighter | 🟢 |
|
|
150
|
+
| [Divider](https://peacock.redvars.com/components/divider) | wc-divider | 🟢 |
|
|
151
|
+
| [Empty State](https://peacock.redvars.com/components/empty-state) | wc-empty-state | 🟡 |
|
|
152
|
+
| [FAB](https://peacock.redvars.com/components/fab) | wc-fab | 🟢 |
|
|
153
|
+
| [Flow Designer](https://peacock.redvars.com/components/flow-designer) | flow-designer | 🔵 |
|
|
154
|
+
| Header | header | 🔴 |
|
|
155
|
+
| [Icon](https://peacock.redvars.com/components/icon) | wc-icon | 🟢 |
|
|
156
|
+
| [Icon Button](https://peacock.redvars.com/components/icon-button) | wc-icon-button | 🟢 |
|
|
157
|
+
| [Image](https://peacock.redvars.com/components/image) | wc-image | 🟡 |
|
|
158
|
+
| [Link](https://peacock.redvars.com/components/link) | wc-link | 🟢 |
|
|
159
|
+
| Modal | modal | 🔴 |
|
|
160
|
+
| [Number Counter](https://peacock.redvars.com/components/number-counter) | wc-number-counter | 🟡 |
|
|
161
|
+
| [Pagination](https://peacock.redvars.com/components/pagination) | wc-pagination | 🟡 |
|
|
162
|
+
| [Segmented Button](https://peacock.redvars.com/components/segmented-button) | wc-segmented-button | 🟡 |
|
|
163
|
+
| [Slider](https://peacock.redvars.com/components/slider) | wc-slider | 🟡 |
|
|
164
|
+
| [Switch](https://peacock.redvars.com/components/switch) | wc-switch | 🟢 |
|
|
165
|
+
| [Table](https://peacock.redvars.com/components/table) | wc-table | 🟡 |
|
|
166
|
+
| [Tag](https://peacock.redvars.com/components/tag) | wc-tag | 🟢 |
|
|
167
|
+
| Text | text | 🔴 |
|
|
168
|
+
| [Sidebar Menu](https://peacock.redvars.com/components/sidebar-menu) | wc-sidebar-menu | 🟡 |
|
|
163
169
|
|
|
164
170
|
## Charts
|
|
165
171
|
|
|
166
172
|
These components are used to display data in a graphical format. They include
|
|
167
173
|
|
|
168
|
-
| Name
|
|
169
|
-
|
|
170
|
-
| [
|
|
171
|
-
| [
|
|
174
|
+
| Name | Component | State |
|
|
175
|
+
|---------------------------------------------------------------------------------|------------------------|-------|
|
|
176
|
+
| [Bar Chart](https://peacock.redvars.com/components/chart-bar) | wc-chart-bar | 🟢 |
|
|
177
|
+
| [Doughnut Chart](https://peacock.redvars.com/components/chart-doughnut) | wc-chart-doughnut | 🟢 |
|
|
178
|
+
| [Pie Chart](https://peacock.redvars.com/components/chart-pie) | wc-chart-pie | 🟢 |
|
|
179
|
+
| [Stacked Bar Chart](https://peacock.redvars.com/components/chart-bar) | wc-chart-stacked-bar | 🟢 |
|
|
172
180
|
|
|
173
181
|
|
|
174
182
|
## 📄 License
|
package/scss/mixin.scss
CHANGED
|
@@ -57,3 +57,19 @@
|
|
|
57
57
|
@content;
|
|
58
58
|
}
|
|
59
59
|
}
|
|
60
|
+
|
|
61
|
+
@mixin apply-container-shape($name) {
|
|
62
|
+
border-start-start-radius: var(--#{$name}-container-shape-start-start, var(--#{$name}-container-shape));
|
|
63
|
+
border-start-end-radius: var(--#{$name}-container-shape-start-end, var(--#{$name}-container-shape));
|
|
64
|
+
border-end-start-radius: var(--#{$name}-container-shape-end-start, var(--#{$name}-container-shape));
|
|
65
|
+
border-end-end-radius: var(--#{$name}-container-shape-end-end, var(--#{$name}-container-shape));
|
|
66
|
+
corner-shape: var(--#{$name}-container-shape-variant);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@mixin copy-container-shape($from, $to) {
|
|
70
|
+
--#{$to}-container-shape-start-start: var(--#{$from}-container-shape-start-start, var(--#{$from}-container-shape));
|
|
71
|
+
--#{$to}-container-shape-start-end: var(--#{$from}-container-shape-start-end, var(--#{$from}-container-shape));
|
|
72
|
+
--#{$to}-container-shape-end-start: var(--#{$from}-container-shape-end-start, var(--#{$from}-container-shape));
|
|
73
|
+
--#{$to}-container-shape-end-end: var(--#{$from}-container-shape-end-end, var(--#{$from}-container-shape));
|
|
74
|
+
--#{$to}-container-shape-variant: var(--#{$from}-container-shape-variant);
|
|
75
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import type { MixinConstructor } from './MixinConstructor.js';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 1. Define an interface for the members the mixin adds.
|
|
8
|
+
* This makes the type annotation much cleaner.
|
|
9
|
+
*/
|
|
10
|
+
export interface BaseButtonInterface {
|
|
11
|
+
htmlType: 'button' | 'submit' | 'reset';
|
|
12
|
+
disabled: boolean;
|
|
13
|
+
softDisabled: boolean;
|
|
14
|
+
disabledReason: string;
|
|
15
|
+
form: string;
|
|
16
|
+
name: string;
|
|
17
|
+
value: string;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* 2. Apply the type annotation to the variable.
|
|
22
|
+
*/
|
|
23
|
+
const BaseButtonMixin: <T extends MixinConstructor<LitElement>>(superclass: T) => T & MixinConstructor<BaseButtonInterface> = <T extends MixinConstructor<LitElement>>(superclass: T) => {
|
|
24
|
+
// Naming the class (BaseButtonElement) instead of using 'Mixin' or anonymous
|
|
25
|
+
// prevents the "__childPart" visibility error.
|
|
26
|
+
class BaseButtonElement extends superclass implements BaseButtonInterface {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* The type of the underlying `<button>` element. Maps to the native `type` attribute.
|
|
30
|
+
* Possible values are `"button"`, `"submit"`, `"reset"`. Defaults to `"button"`.
|
|
31
|
+
*/
|
|
32
|
+
@property({ type: String }) htmlType: 'button' | 'submit' | 'reset' =
|
|
33
|
+
'button';
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* When `true`, the button is disabled and cannot be interacted with. Reflects to the `disabled` attribute. Defaults to `false`.
|
|
37
|
+
*/
|
|
38
|
+
@property({ type: Boolean, reflect: true })
|
|
39
|
+
disabled: boolean = false;
|
|
40
|
+
|
|
41
|
+
/**
|
|
42
|
+
* When `true`, the button is visually styled as disabled and cannot be interacted with, but remains focusable.
|
|
43
|
+
* Use this in combination with `disabledReason` to communicate why the button is unavailable.
|
|
44
|
+
* Reflects to the `soft-disabled` attribute. Defaults to `false`.
|
|
45
|
+
*/
|
|
46
|
+
@property({ type: Boolean, reflect: true, attribute: 'soft-disabled' })
|
|
47
|
+
softDisabled: boolean = false;
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* A human-readable explanation of why the button is disabled or soft-disabled.
|
|
51
|
+
* Rendered as a visually hidden tooltip and linked via `aria-describedby` for accessibility.
|
|
52
|
+
* Maps to the `disabled-reason` attribute.
|
|
53
|
+
*/
|
|
54
|
+
@property({ attribute: 'disabled-reason' })
|
|
55
|
+
disabledReason: string = '';
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* The `id` of the `<form>` element to associate the button with.
|
|
59
|
+
* If omitted, the button is associated with its nearest ancestor form.
|
|
60
|
+
* Maps to the native `form` attribute.
|
|
61
|
+
*/
|
|
62
|
+
@property()
|
|
63
|
+
form: string = '';
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* The name of the button, submitted as part of a name/value pair when the associated form is submitted.
|
|
67
|
+
* Maps to the native `name` attribute.
|
|
68
|
+
*/
|
|
69
|
+
@property()
|
|
70
|
+
name: string = '';
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* The value of the button, submitted as part of a name/value pair when the associated form is submitted.
|
|
74
|
+
* Maps to the native `value` attribute.
|
|
75
|
+
*/
|
|
76
|
+
@property()
|
|
77
|
+
value: string = '';
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
return BaseButtonElement as T & MixinConstructor<BaseButtonInterface>;
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
export default BaseButtonMixin;
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import { property } from 'lit/decorators.js';
|
|
3
|
+
import type { MixinConstructor } from './MixinConstructor.js';
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* 1. Define an interface for the members the mixin adds.
|
|
8
|
+
* This makes the type annotation much cleaner.
|
|
9
|
+
*/
|
|
10
|
+
export interface BaseHyperlinkInterface {
|
|
11
|
+
href?: string;
|
|
12
|
+
target: '_self' | '_parent' | '_blank' | '_top' | string;
|
|
13
|
+
rel?: string;
|
|
14
|
+
download?: string;
|
|
15
|
+
__isLink(): boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* 2. Apply the type annotation to the variable.
|
|
20
|
+
*/
|
|
21
|
+
const BaseHyperlinkMixin: <T extends MixinConstructor<LitElement>>(superclass: T) => T & MixinConstructor<BaseHyperlinkInterface> = <T extends MixinConstructor<LitElement>>(superclass: T) => {
|
|
22
|
+
// Naming the class (BaseHyperlinkElement) instead of using 'Mixin' or anonymous
|
|
23
|
+
// prevents the "__childPart" visibility error.
|
|
24
|
+
class BaseHyperlinkElement extends superclass implements BaseHyperlinkInterface {
|
|
25
|
+
/**
|
|
26
|
+
* The URL that the hyperlink points to. When set, the component renders as an `<a>` element.
|
|
27
|
+
* Maps to the native `href` attribute.
|
|
28
|
+
*/
|
|
29
|
+
@property({ reflect: true })
|
|
30
|
+
href?: string;
|
|
31
|
+
|
|
32
|
+
/**
|
|
33
|
+
* Where to display the linked URL. Maps to the native `target` attribute.
|
|
34
|
+
* Possible values are `"_self"`, `"_blank"`, `"_parent"`, `"_top"`, or a custom frame name.
|
|
35
|
+
* When using `"_blank"`, consider setting `rel="noopener noreferrer"` for security. Defaults to `"_self"`.
|
|
36
|
+
*/
|
|
37
|
+
@property()
|
|
38
|
+
target: '_self' | '_parent' | '_blank' | '_top' | string = '_self';
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* The relationship between the current document and the linked URL.
|
|
42
|
+
* Maps to the native `rel` attribute on the rendered `<a>` element.
|
|
43
|
+
* When `target="_blank"`, use `"noopener noreferrer"` to prevent tab-napping attacks.
|
|
44
|
+
*/
|
|
45
|
+
@property()
|
|
46
|
+
rel?: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* Causes the browser to download the linked URL instead of navigating to it.
|
|
50
|
+
* If a string value is provided, it is used as the suggested filename.
|
|
51
|
+
* Omit or leave undefined to preserve normal navigation behaviour.
|
|
52
|
+
* Maps to the native `download` attribute. Only applies when `href` is set.
|
|
53
|
+
*/
|
|
54
|
+
@property()
|
|
55
|
+
download?: string;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Returns `true` when `href` is set, indicating the component should render as a link.
|
|
59
|
+
*/
|
|
60
|
+
__isLink(): boolean {
|
|
61
|
+
return !!this.href;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return BaseHyperlinkElement as T & MixinConstructor<BaseHyperlinkInterface>;
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export default BaseHyperlinkMixin;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type MixinConstructor<T = {}> = new (...args: any[]) => T;
|
package/src/banner/banner.scss
CHANGED
|
@@ -4,12 +4,6 @@
|
|
|
4
4
|
|
|
5
5
|
:host {
|
|
6
6
|
display: block;
|
|
7
|
-
|
|
8
|
-
--banner-container-color: var(--color-tertiary-container);
|
|
9
|
-
--banner-label-text-color: var(--color-on-tertiary-container);
|
|
10
|
-
--banner-description-text-color: var(--color-on-tertiary-container);
|
|
11
|
-
--banner-icon-color: var(--color-on-tertiary-container);
|
|
12
|
-
--banner-border-radius: var(--shape-corner-small);
|
|
13
7
|
}
|
|
14
8
|
|
|
15
9
|
.banner {
|
|
@@ -32,26 +26,28 @@
|
|
|
32
26
|
}
|
|
33
27
|
|
|
34
28
|
.banner-content {
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
29
|
+
.banner-label {
|
|
30
|
+
display: inline;
|
|
31
|
+
@include mixin.get-typography(label-large);
|
|
32
|
+
color: var(--banner-label-text-color);
|
|
33
|
+
margin-inline-end: var(--spacing-050);
|
|
34
|
+
}
|
|
39
35
|
|
|
40
|
-
.banner-
|
|
41
|
-
|
|
42
|
-
|
|
36
|
+
.banner-description {
|
|
37
|
+
display: inline;
|
|
38
|
+
@include mixin.get-typography(body-medium);
|
|
39
|
+
color: var(--banner-description-text-color);
|
|
40
|
+
}
|
|
43
41
|
}
|
|
44
42
|
|
|
45
|
-
.banner-description {
|
|
46
|
-
@include mixin.get-typography(body-medium);
|
|
47
|
-
color: var(--banner-description-text-color);
|
|
48
|
-
}
|
|
49
43
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
// Default styles for the banner and content. These will be overridden by the variant-specific styles below.
|
|
45
|
+
:host {
|
|
46
|
+
--banner-container-color: var(--color-tertiary-container);
|
|
47
|
+
--banner-label-text-color: var(--color-on-tertiary-container);
|
|
48
|
+
--banner-description-text-color: var(--color-on-tertiary-container);
|
|
49
|
+
--banner-icon-color: var(--color-on-tertiary-container);
|
|
50
|
+
--banner-border-radius: var(--shape-corner-small);
|
|
55
51
|
}
|
|
56
52
|
|
|
57
53
|
.banner.info,
|
package/src/banner/banner.ts
CHANGED
|
@@ -69,12 +69,6 @@ export class Banner extends LitElement {
|
|
|
69
69
|
@property({ type: String })
|
|
70
70
|
description = '';
|
|
71
71
|
|
|
72
|
-
/**
|
|
73
|
-
* When true, label and description are rendered on a single line.
|
|
74
|
-
*/
|
|
75
|
-
@property({ type: Boolean, reflect: true })
|
|
76
|
-
inline = false;
|
|
77
|
-
|
|
78
72
|
private get resolvedLabel() {
|
|
79
73
|
return this.label || VARIANT_LABELS[this.variant];
|
|
80
74
|
}
|
|
@@ -92,7 +86,7 @@ export class Banner extends LitElement {
|
|
|
92
86
|
</slot>
|
|
93
87
|
</div>
|
|
94
88
|
|
|
95
|
-
<div class=${classMap({ 'banner-content': true, [this.variant]: true
|
|
89
|
+
<div class=${classMap({ 'banner-content': true, [this.variant]: true })}>
|
|
96
90
|
<div class="banner-label">
|
|
97
91
|
<slot name="label">${this.resolvedLabel}:</slot>
|
|
98
92
|
</div>
|
package/src/button/BaseButton.ts
CHANGED
|
@@ -1,81 +1,21 @@
|
|
|
1
1
|
import { html, LitElement, nothing } from 'lit';
|
|
2
2
|
import { property, query, state } from 'lit/decorators.js';
|
|
3
3
|
import { dispatchActivationClick, isActivationClick } from '../__utils/dispatch-event-utils.js';
|
|
4
|
-
import
|
|
4
|
+
import BaseHyperlinkMixin from '@/__mixins/BaseHyperlinkMixin.js';
|
|
5
|
+
import BaseButtonMixin from '@/__mixins/BaseButtonMixin.js';
|
|
5
6
|
|
|
6
|
-
export class BaseButton extends BaseHyperlink(LitElement) {
|
|
7
|
-
protected static readonly DISABLED_REASON_ID = 'disabled-reason';
|
|
8
|
-
|
|
9
|
-
@property({ type: String }) htmlType: 'button' | 'submit' | 'reset' =
|
|
10
|
-
'button';
|
|
11
|
-
|
|
12
|
-
/**
|
|
13
|
-
* Type is preset of color and variant. Type will be only applied.
|
|
14
|
-
*
|
|
15
|
-
*/
|
|
16
|
-
@property({ type: String }) type?: 'primary' | 'secondary' | 'tertiary';
|
|
17
|
-
|
|
18
|
-
/**
|
|
19
|
-
* The visual style of the button.
|
|
20
|
-
*
|
|
21
|
-
* Possible variant values:
|
|
22
|
-
* `"filled"` is a filled button.
|
|
23
|
-
* `"outlined"` is an outlined button.
|
|
24
|
-
* `"text"` is a transparent button.
|
|
25
|
-
* `"tonal"` is a light color button.
|
|
26
|
-
* `"elevated"` is elevated button
|
|
27
|
-
*/
|
|
28
|
-
@property() variant:
|
|
29
|
-
| 'elevated'
|
|
30
|
-
| 'filled'
|
|
31
|
-
| 'tonal'
|
|
32
|
-
| 'outlined'
|
|
33
|
-
| 'text'
|
|
34
|
-
| 'neo' = 'filled';
|
|
35
|
-
|
|
36
|
-
/**
|
|
37
|
-
* Defines the primary color of the button. This can be set to predefined color names to apply specific color themes.
|
|
38
|
-
*/
|
|
39
|
-
@property({ reflect: true }) color:
|
|
40
|
-
| 'primary'
|
|
41
|
-
| 'success'
|
|
42
|
-
| 'danger'
|
|
43
|
-
| 'warning'
|
|
44
|
-
| 'surface'
|
|
45
|
-
| 'on-surface' = 'primary';
|
|
46
|
-
|
|
47
|
-
/**
|
|
48
|
-
* Button size.
|
|
49
|
-
* Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`.
|
|
50
|
-
*/
|
|
51
|
-
@property({ reflect: true }) size: 'xs' | 'sm' | 'md' | 'lg' | 'xl' = 'sm';
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* If true, the user cannot interact with the button. Defaults to `false`.
|
|
55
|
-
*/
|
|
56
|
-
@property({ type: Boolean, reflect: true })
|
|
57
|
-
disabled: boolean = false;
|
|
58
7
|
|
|
59
|
-
@property({ type: Boolean, reflect: true }) skeleton: boolean = false;
|
|
60
8
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
*/
|
|
64
|
-
@property({ type: Boolean, reflect: true, attribute: 'soft-disabled' })
|
|
65
|
-
softDisabled: boolean = false;
|
|
9
|
+
export class BaseButton extends BaseButtonMixin(BaseHyperlinkMixin(LitElement)) {
|
|
10
|
+
protected static readonly DISABLED_REASON_ID = 'disabled-reason';
|
|
66
11
|
|
|
67
|
-
/**
|
|
68
|
-
* If button is disabled, the reason why it is disabled.
|
|
69
|
-
*/
|
|
70
|
-
@property({ attribute: 'disabled-reason' })
|
|
71
|
-
disabledReason: string = '';
|
|
72
12
|
|
|
13
|
+
color?: string;
|
|
73
14
|
|
|
74
|
-
|
|
75
|
-
configAria?: { [key: string]: any };
|
|
15
|
+
variant?: string;
|
|
76
16
|
|
|
17
|
+
@property({ type: Boolean, reflect: true }) skeleton: boolean = false;
|
|
77
18
|
|
|
78
|
-
|
|
79
19
|
@property({ type: Boolean, reflect: true }) toggle: boolean = false;
|
|
80
20
|
|
|
81
21
|
@property({ type: Boolean, reflect: true }) selected: boolean = false;
|
|
@@ -95,14 +35,6 @@ export class BaseButton extends BaseHyperlink(LitElement) {
|
|
|
95
35
|
|
|
96
36
|
@query('.button') readonly buttonElement!: HTMLElement | null;
|
|
97
37
|
|
|
98
|
-
override focus() {
|
|
99
|
-
this.buttonElement?.focus();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
override blur() {
|
|
103
|
-
this.buttonElement?.blur();
|
|
104
|
-
}
|
|
105
|
-
|
|
106
38
|
override connectedCallback() {
|
|
107
39
|
super.connectedCallback();
|
|
108
40
|
this.addEventListener('click', this.__dispatchClickWithThrottle);
|
|
@@ -157,33 +89,12 @@ export class BaseButton extends BaseHyperlink(LitElement) {
|
|
|
157
89
|
dispatchActivationClick(this.buttonElement);
|
|
158
90
|
};
|
|
159
91
|
|
|
160
|
-
|
|
161
|
-
if (this.type === 'primary') {
|
|
162
|
-
this.color = 'primary';
|
|
163
|
-
this.variant = 'filled';
|
|
164
|
-
} else if (this.type === 'secondary') {
|
|
165
|
-
this.color = 'surface';
|
|
166
|
-
this.variant = 'filled';
|
|
167
|
-
} else if (this.type === 'tertiary') {
|
|
168
|
-
this.color = 'primary';
|
|
169
|
-
this.variant = 'text';
|
|
170
|
-
} else if (this.type === 'danger') {
|
|
171
|
-
this.color = 'danger';
|
|
172
|
-
this.variant = 'filled';
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
protected get __disabledReasonID(): string | undefined {
|
|
177
|
-
return this.disabled && this.disabledReason
|
|
178
|
-
? BaseButton.DISABLED_REASON_ID
|
|
179
|
-
: undefined;
|
|
180
|
-
}
|
|
92
|
+
|
|
181
93
|
|
|
182
|
-
__renderDisabledReason() {
|
|
183
|
-
|
|
184
|
-
if (disabledReasonID)
|
|
94
|
+
__renderDisabledReason(softDisabled: boolean) {
|
|
95
|
+
if (softDisabled)
|
|
185
96
|
return html`<div
|
|
186
|
-
id=${
|
|
97
|
+
id=${BaseButton.DISABLED_REASON_ID}
|
|
187
98
|
role="tooltip"
|
|
188
99
|
aria-label=${this.disabledReason}
|
|
189
100
|
class="screen-reader-only"
|
|
@@ -67,11 +67,13 @@
|
|
|
67
67
|
letter-spacing: 0 !important;
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
:host([size='xl'])
|
|
70
|
+
:host([size='xl']),
|
|
71
|
+
:host([size='extra-large']) {
|
|
71
72
|
--button-height: 8.5rem;
|
|
72
73
|
}
|
|
73
74
|
|
|
74
|
-
:host([size='xl']) .button
|
|
75
|
+
:host([size='xl']) .button,
|
|
76
|
+
:host([size='extra-large']) .button {
|
|
75
77
|
--_button-icon-size: 2.5rem;
|
|
76
78
|
--_button_container-padding: 4rem;
|
|
77
79
|
|