@redvars/peacock 3.10.1 → 3.11.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/BaseInput-CV0pZgSb.js +58 -0
- package/dist/BaseInput-CV0pZgSb.js.map +1 -0
- package/dist/app-bar.js +16 -16
- package/dist/assets/styles.css +1 -1
- package/dist/assets/styles.css.map +1 -1
- package/dist/assets/theme.d.ts +66 -0
- package/dist/assets/theme.js +134 -0
- package/dist/assets/tokens.css +1 -1
- package/dist/assets/tokens.css.map +1 -1
- package/dist/base-progress-CLZTRveO.js +33 -0
- package/dist/base-progress-CLZTRveO.js.map +1 -0
- package/dist/bottom-sheet.js +1 -1
- package/dist/button-group.js +9 -7
- package/dist/button-group.js.map +1 -1
- package/dist/button.js +225 -187
- package/dist/button.js.map +1 -1
- package/dist/{chart-bar-CapLbc2e.js → chart-bar-D5dGFJfK.js} +2 -2
- package/dist/{chart-bar-CapLbc2e.js.map → chart-bar-D5dGFJfK.js.map} +1 -1
- package/dist/chart-bar.js +1 -1
- package/dist/chart-stacked-bar.js +1 -1
- package/dist/checkbox.js +78 -53
- package/dist/checkbox.js.map +1 -1
- package/dist/chip-set.js +52 -0
- package/dist/chip-set.js.map +1 -0
- package/dist/chip.js +8 -6
- package/dist/chip.js.map +1 -1
- package/dist/circular-progress.js +177 -0
- package/dist/circular-progress.js.map +1 -0
- package/dist/code-editor.js +129 -72
- package/dist/code-editor.js.map +1 -1
- package/dist/code-highlighter.js +2 -38
- package/dist/code-highlighter.js.map +1 -1
- package/dist/color-field.js +309 -0
- package/dist/color-field.js.map +1 -0
- package/dist/color-picker.js +26 -15
- package/dist/color-picker.js.map +1 -1
- package/dist/copy-to-clipboard-upGx-Ueo.js +39 -0
- package/dist/copy-to-clipboard-upGx-Ueo.js.map +1 -0
- package/dist/custom-elements-jsdocs.json +1044 -382
- package/dist/custom-elements.json +8615 -4726
- package/dist/date-picker.js +241 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/{element-internals-2CMts_0M.js → delegate-py-Ets8N.js} +2 -43
- package/dist/delegate-py-Ets8N.js.map +1 -0
- package/dist/element-internals-QME0yEz4.js +43 -0
- package/dist/element-internals-QME0yEz4.js.map +1 -0
- package/dist/fab.js +51 -49
- package/dist/fab.js.map +1 -1
- package/dist/field.js +25 -0
- package/dist/field.js.map +1 -1
- package/dist/flow.js +5 -5
- package/dist/form-associated-Bhwwr6dT.js +162 -0
- package/dist/form-associated-Bhwwr6dT.js.map +1 -0
- package/dist/{form-associated-BXADnjOB.js → form-submitter-DPI4L6gj.js} +3 -159
- package/dist/form-submitter-DPI4L6gj.js.map +1 -0
- package/dist/html-editor.js +3 -1
- package/dist/html-editor.js.map +1 -1
- package/dist/icon-button.js +195 -156
- package/dist/icon-button.js.map +1 -1
- package/dist/image.js +2 -2
- package/dist/index.js +32 -8
- package/dist/index.js.map +1 -1
- package/dist/input.js +259 -0
- package/dist/input.js.map +1 -0
- package/dist/item.js +2 -1
- package/dist/item.js.map +1 -1
- package/dist/linear-progress.js +192 -0
- package/dist/linear-progress.js.map +1 -0
- package/dist/{list-AdO-PUq_.js → list-item.js} +12 -222
- package/dist/list-item.js.map +1 -0
- package/dist/list.js +225 -6
- package/dist/list.js.map +1 -1
- package/dist/loader-full.js +31 -8
- package/dist/loader-full.js.map +1 -1
- package/dist/loader.js +52 -12
- package/dist/loader.js.map +1 -1
- package/dist/markdown-editor.js +5 -3
- package/dist/markdown-editor.js.map +1 -1
- package/dist/menu-item.js +30 -30
- package/dist/navigation-bar-item.js +41 -0
- package/dist/navigation-bar-item.js.map +1 -0
- package/dist/navigation-bar.js +128 -0
- package/dist/navigation-bar.js.map +1 -0
- package/dist/navigation-drawer-item.js +236 -0
- package/dist/navigation-drawer-item.js.map +1 -0
- package/dist/navigation-drawer.js +293 -0
- package/dist/navigation-drawer.js.map +1 -0
- package/dist/navigation-rail.js +1 -1
- package/dist/number-field.js +280 -0
- package/dist/number-field.js.map +1 -0
- package/dist/pagination.js +1 -1
- package/dist/radio-group.js +209 -0
- package/dist/radio-group.js.map +1 -0
- package/dist/radio.js +47 -37
- package/dist/radio.js.map +1 -1
- package/dist/segmented-button-group.js +12 -0
- package/dist/segmented-button-group.js.map +1 -1
- package/dist/segmented-button.js +10 -6
- package/dist/segmented-button.js.map +1 -1
- package/dist/select.js +653 -0
- package/dist/select.js.map +1 -0
- package/dist/side-sheet.js +1 -1
- package/dist/sidebar-menu-item.js +273 -0
- package/dist/sidebar-menu-item.js.map +1 -0
- package/dist/sidebar-menu.js +193 -0
- package/dist/sidebar-menu.js.map +1 -0
- package/dist/sidebar-sub-menu.js +301 -0
- package/dist/sidebar-sub-menu.js.map +1 -0
- package/dist/slider.js +76 -24
- package/dist/slider.js.map +1 -1
- package/dist/snackbar.js +3 -3
- package/dist/snackbar.js.map +1 -1
- package/dist/split-button.js +2 -2
- package/dist/src/__internal/utils/size.d.ts +9 -0
- package/dist/src/button/ButtonTypes.d.ts +1 -1
- package/dist/src/checkbox/checkbox.d.ts +28 -22
- package/dist/src/chip/chip/chip.d.ts +3 -0
- package/dist/src/chip/tag/tag.d.ts +5 -1
- package/dist/src/code-editor/code-editor.d.ts +37 -10
- package/dist/src/color-field/color-field.d.ts +55 -0
- package/dist/src/color-field/index.d.ts +1 -0
- package/dist/src/color-picker/color-picker.d.ts +1 -1
- package/dist/src/date-picker/date-picker.d.ts +0 -1
- package/dist/src/index.d.ts +4 -3
- package/dist/src/input/BaseInput.d.ts +21 -3
- package/dist/src/input/input.d.ts +15 -7
- package/dist/src/navigation-bar/index.d.ts +2 -0
- package/dist/src/navigation-bar/navigation-bar-item.d.ts +23 -0
- package/dist/src/navigation-bar/navigation-bar.d.ts +44 -0
- package/dist/src/navigation-drawer/index.d.ts +2 -0
- package/dist/src/navigation-drawer/navigation-drawer-item.d.ts +48 -0
- package/dist/src/navigation-drawer/navigation-drawer.d.ts +70 -0
- package/dist/src/number-field/number-field.d.ts +0 -1
- package/dist/src/radio/index.d.ts +1 -0
- package/dist/src/radio/radio-group.d.ts +50 -0
- package/dist/src/radio/radio.d.ts +18 -18
- package/dist/src/segmented-button/segmented-button-group.d.ts +5 -0
- package/dist/src/segmented-button/segmented-button.d.ts +2 -1
- package/dist/src/select/select.d.ts +6 -0
- package/dist/src/slider/slider.d.ts +14 -5
- package/dist/src/switch/switch.d.ts +22 -26
- package/dist/src/tabs/tabs.d.ts +3 -0
- package/dist/src/textarea/textarea.d.ts +0 -1
- package/dist/src/time-picker/time-picker.d.ts +0 -1
- package/dist/src/toolbar/toolbar.d.ts +7 -4
- package/dist/src/url-field/url-field.d.ts +0 -1
- package/dist/svg.js +5 -5
- package/dist/switch.js +413 -0
- package/dist/switch.js.map +1 -0
- package/dist/tab.js +2 -1
- package/dist/tab.js.map +1 -1
- package/dist/tabs.js +10 -8
- package/dist/tabs.js.map +1 -1
- package/dist/tag.js +349 -0
- package/dist/tag.js.map +1 -0
- package/dist/test/code-editor.test.d.ts +1 -0
- package/dist/test/color-field.test.d.ts +1 -0
- package/dist/test/color-picker.test.d.ts +1 -0
- package/dist/test/field.test.d.ts +1 -0
- package/dist/test/form-controls.test.d.ts +1 -0
- package/dist/test/icon.test.d.ts +1 -1
- package/dist/test/input.test.d.ts +1 -0
- package/dist/test/navigation.test.d.ts +1 -0
- package/dist/test/segmented-button.test.d.ts +1 -0
- package/dist/test/slider.test.d.ts +1 -0
- package/dist/textarea.js +237 -0
- package/dist/textarea.js.map +1 -0
- package/dist/time-picker.js +241 -0
- package/dist/time-picker.js.map +1 -0
- package/dist/toolbar.js +26 -9
- package/dist/toolbar.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/url-field.js +298 -0
- package/dist/url-field.js.map +1 -0
- package/package.json +29 -8
- package/readme.md +2 -2
- package/scss/tokens.css +175 -18
- package/src/__internal/utils/size.ts +23 -0
- package/src/app-bar/app-bar.scss +4 -16
- package/src/bottom-sheet/bottom-sheet.scss +1 -1
- package/src/button/ButtonTypes.ts +2 -0
- package/src/button/button/button-base.scss +84 -84
- package/src/button/button/button-colors.scss +14 -2
- package/src/button/button/button-layers.scss +71 -71
- package/src/button/button/button-shapes.scss +2 -2
- package/src/button/button/button-sizes.scss +35 -35
- package/src/button/button/button.scss +1 -1
- package/src/button/button/button.ts +1 -2
- package/src/button/button-group/button-group.scss +5 -5
- package/src/button/fab/fab-sizes.scss +15 -15
- package/src/button/fab/fab.scss +32 -32
- package/src/button/icon-button/icon-button-sizes.scss +7 -7
- package/src/chart-bar/chart-bar.scss +1 -1
- package/src/checkbox/checkbox.scss +7 -6
- package/src/checkbox/checkbox.ts +92 -40
- package/src/chip/chip/chip.ts +8 -5
- package/src/chip/chip-set/chip-set.ts +2 -0
- package/src/chip/tag/tag-colors.scss +1 -1
- package/src/chip/tag/tag-sizes.scss +9 -0
- package/src/chip/tag/tag.scss +1 -1
- package/src/chip/tag/tag.ts +20 -9
- package/src/code-editor/code-editor.scss +8 -3
- package/src/code-editor/code-editor.ts +148 -79
- package/src/code-highlighter/code-highlighter.scss +1 -1
- package/src/color-field/color-field.scss +48 -0
- package/src/color-field/color-field.ts +239 -0
- package/src/color-field/index.ts +1 -0
- package/src/color-picker/color-picker.scss +33 -15
- package/src/color-picker/color-picker.ts +2 -1
- package/src/date-picker/date-picker.ts +2 -3
- package/src/field/field.scss +31 -0
- package/src/flow/flow.scss +5 -5
- package/src/image/image.scss +2 -2
- package/src/index.ts +7 -3
- package/src/input/BaseInput.ts +54 -4
- package/src/input/input.ts +104 -79
- package/src/list/list-item.ts +2 -0
- package/src/loader.ts +28 -6
- package/src/markdown-editor/markdown-editor.scss +2 -2
- package/src/menu/menu-item/menu-item.scss +30 -30
- package/src/navigation-bar/index.ts +2 -0
- package/src/navigation-bar/navigation-bar-item.ts +25 -0
- package/src/navigation-bar/navigation-bar.scss +27 -0
- package/src/navigation-bar/navigation-bar.ts +96 -0
- package/src/navigation-drawer/index.ts +2 -0
- package/src/navigation-drawer/navigation-drawer-item.scss +82 -0
- package/src/navigation-drawer/navigation-drawer-item.ts +133 -0
- package/src/navigation-drawer/navigation-drawer.scss +99 -0
- package/src/navigation-drawer/navigation-drawer.ts +196 -0
- package/src/navigation-rail/navigation-rail.scss +1 -1
- package/src/number-field/number-field.ts +2 -3
- package/src/pagination/pagination.scss +1 -1
- package/src/progress/circular-progress/circular-progress.ts +2 -0
- package/src/progress/linear-progress/linear-progress.ts +2 -0
- package/src/radio/index.ts +1 -0
- package/src/radio/radio-group.scss +39 -0
- package/src/radio/radio-group.ts +167 -0
- package/src/radio/radio.ts +74 -31
- package/src/segmented-button/segmented-button-group.ts +12 -0
- package/src/segmented-button/segmented-button.ts +12 -6
- package/src/select/select.ts +21 -1
- package/src/side-sheet/side-sheet.scss +1 -1
- package/src/sidebar-menu/sidebar-menu-item.scss +1 -1
- package/src/sidebar-menu/sidebar-menu-item.ts +2 -0
- package/src/sidebar-menu/sidebar-menu.ts +2 -0
- package/src/sidebar-menu/sidebar-sub-menu.scss +1 -1
- package/src/sidebar-menu/sidebar-sub-menu.ts +2 -0
- package/src/slider/slider.scss +3 -3
- package/src/slider/slider.ts +119 -31
- package/src/snackbar/snackbar.ts +3 -3
- package/src/split-button/split-button-colors.scss +2 -2
- package/src/svg/svg.scss +5 -5
- package/src/switch/switch.scss +0 -1
- package/src/switch/switch.ts +82 -47
- package/src/tabs/tab.scss +2 -1
- package/src/tabs/tabs.ts +14 -8
- package/src/textarea/textarea.ts +2 -3
- package/src/time-picker/time-picker.ts +2 -3
- package/src/toolbar/toolbar.scss +4 -4
- package/src/toolbar/toolbar.ts +12 -5
- package/src/url-field/url-field.ts +2 -3
- package/dist/BaseInput-CU1zZYKc.js +0 -27
- package/dist/BaseInput-CU1zZYKc.js.map +0 -1
- package/dist/brand-loader.js +0 -358
- package/dist/brand-loader.js.map +0 -1
- package/dist/element-internals-2CMts_0M.js.map +0 -1
- package/dist/form-associated-BXADnjOB.js.map +0 -1
- package/dist/list-AdO-PUq_.js.map +0 -1
- package/dist/select-DkyRqUTI.js +0 -3955
- package/dist/select-DkyRqUTI.js.map +0 -1
- package/dist/src/brand-loader/brand-loader.d.ts +0 -33
- package/dist/src/brand-loader/index.d.ts +0 -2
- package/src/brand-loader/brand-loader.scss +0 -270
- package/src/brand-loader/brand-loader.ts +0 -115
- package/src/brand-loader/index.ts +0 -2
- /package/dist/test/{brand-loader.test.d.ts → button.test.d.ts} +0 -0
package/dist/tag.js
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
import { i, _ as __decorate, I as IndividualComponent, a as i$1, b } from './IndividualComponent-Bdwyrvd6.js';
|
|
2
|
+
import { n } from './property-B49QQ8pS.js';
|
|
3
|
+
import { e } from './class-map-DG7CA1et.js';
|
|
4
|
+
import './directive-ZPhl09Yt.js';
|
|
5
|
+
|
|
6
|
+
var css_248z$2 = i`* {
|
|
7
|
+
box-sizing: border-box;
|
|
8
|
+
-webkit-tap-highlight-color: transparent;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
.screen-reader-only {
|
|
12
|
+
display: none !important;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
[hidden] {
|
|
16
|
+
display: none !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
:host {
|
|
20
|
+
display: inline-block;
|
|
21
|
+
--tag-container-shape: inherit;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
.tag {
|
|
25
|
+
position: relative;
|
|
26
|
+
display: inline-flex;
|
|
27
|
+
flex-direction: column;
|
|
28
|
+
align-items: center;
|
|
29
|
+
justify-content: center;
|
|
30
|
+
height: var(--tag-height, var(--_chip-height, 2rem));
|
|
31
|
+
padding-inline: calc(var(--_container-padding) / 2);
|
|
32
|
+
width: 100%;
|
|
33
|
+
--_container-shape: var(--tag-container-shape, var(--shape-corner-medium));
|
|
34
|
+
--_container-corner-shape-variant: squircle;
|
|
35
|
+
}
|
|
36
|
+
.tag .tag-content {
|
|
37
|
+
position: relative;
|
|
38
|
+
z-index: 1;
|
|
39
|
+
overflow: hidden;
|
|
40
|
+
text-overflow: ellipsis;
|
|
41
|
+
white-space: nowrap;
|
|
42
|
+
max-width: 100%;
|
|
43
|
+
display: flex;
|
|
44
|
+
align-items: center;
|
|
45
|
+
justify-content: center;
|
|
46
|
+
color: var(--_input-text-color);
|
|
47
|
+
--icon-color: currentColor;
|
|
48
|
+
}
|
|
49
|
+
.tag .tag-content .slot-content {
|
|
50
|
+
padding-inline: calc(var(--_container-padding) / 2);
|
|
51
|
+
}
|
|
52
|
+
.tag .dismiss-button {
|
|
53
|
+
position: relative;
|
|
54
|
+
border-radius: var(--shape-corner-full);
|
|
55
|
+
padding: 0;
|
|
56
|
+
margin: 0;
|
|
57
|
+
border: none;
|
|
58
|
+
background: transparent;
|
|
59
|
+
line-height: 0;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
}
|
|
62
|
+
.tag .dismiss-button .dismiss-button-icon {
|
|
63
|
+
--icon-size: var(--tag-icon-size, var(--_tag-icon-size));
|
|
64
|
+
--icon-color: var(--_input-text-color);
|
|
65
|
+
}
|
|
66
|
+
.tag .dismiss-button .ripple {
|
|
67
|
+
--ripple-state-opacity: var(--_container-state-opacity, 0);
|
|
68
|
+
--ripple-pressed-color: var(--_container-state-color);
|
|
69
|
+
}
|
|
70
|
+
.tag {
|
|
71
|
+
/**
|
|
72
|
+
* Tag background layers
|
|
73
|
+
*/
|
|
74
|
+
}
|
|
75
|
+
.tag .background {
|
|
76
|
+
display: block;
|
|
77
|
+
position: absolute;
|
|
78
|
+
width: 100%;
|
|
79
|
+
height: 100%;
|
|
80
|
+
background: var(--_container-color);
|
|
81
|
+
border-radius: var(--_container-shape);
|
|
82
|
+
corner-shape: var(--_container-corner-shape-variant);
|
|
83
|
+
pointer-events: none;
|
|
84
|
+
}
|
|
85
|
+
.tag .outline {
|
|
86
|
+
display: block;
|
|
87
|
+
position: absolute;
|
|
88
|
+
width: 100%;
|
|
89
|
+
height: 100%;
|
|
90
|
+
border-radius: var(--_container-shape);
|
|
91
|
+
corner-shape: var(--_container-corner-shape-variant);
|
|
92
|
+
border: 1px solid var(--_outline-color);
|
|
93
|
+
}
|
|
94
|
+
.tag .elevation {
|
|
95
|
+
--elevation-level: 0;
|
|
96
|
+
transition-duration: 280ms;
|
|
97
|
+
border-radius: var(--_container-shape);
|
|
98
|
+
corner-shape: var(--_container-corner-shape-variant);
|
|
99
|
+
}
|
|
100
|
+
.tag.dismissible .tag-content {
|
|
101
|
+
padding-inline-end: 0.25rem;
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
slot::slotted(*) {
|
|
105
|
+
--icon-size: var(--tag-icon-size, var(--_tag-icon-size));
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
/**
|
|
109
|
+
* IconButton variant definitions
|
|
110
|
+
*/
|
|
111
|
+
.tag.variant-elevated {
|
|
112
|
+
--_container-color: var(--elevated-tag-container-color);
|
|
113
|
+
--_input-text-color: var(--elevated-tag-label-text-color);
|
|
114
|
+
--_container-elevation-level: 1;
|
|
115
|
+
--_container-state-color: var(--_input-text-color);
|
|
116
|
+
}
|
|
117
|
+
.tag.variant-elevated .dismiss-button:hover {
|
|
118
|
+
--_container-state-opacity: 0.08;
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
.tag.variant-filled {
|
|
122
|
+
--_container-color: var(--filled-tag-container-color);
|
|
123
|
+
--_input-text-color: var(--filled-tag-label-text-color);
|
|
124
|
+
--_container-state-color: var(--_input-text-color);
|
|
125
|
+
}
|
|
126
|
+
.tag.variant-filled .dismiss-button:hover {
|
|
127
|
+
--_container-state-opacity: 0.08;
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
.tag.variant-tonal {
|
|
131
|
+
--_container-color: var(--tonal-tag-container-color);
|
|
132
|
+
--_input-text-color: var(--tonal-tag-label-text-color);
|
|
133
|
+
--_container-state-color: var(--_input-text-color);
|
|
134
|
+
}
|
|
135
|
+
.tag.variant-tonal .dismiss-button:hover {
|
|
136
|
+
--_container-state-opacity: 0.08;
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
.tag.variant-outlined {
|
|
140
|
+
--_outline-color: var(--outlined-tag-outline-color);
|
|
141
|
+
--_input-text-color: var(--outlined-tag-label-text-color);
|
|
142
|
+
--_container-state-color: var(--_input-text-color);
|
|
143
|
+
}
|
|
144
|
+
.tag.variant-outlined .dismiss-button:hover {
|
|
145
|
+
--_container-state-opacity: 0.08;
|
|
146
|
+
}`;
|
|
147
|
+
|
|
148
|
+
var css_248z$1 = i`:host([color=default]) {
|
|
149
|
+
--filled-tag-container-color: var(--color-surface);
|
|
150
|
+
--filled-tag-label-text-color: var(--color-on-surface);
|
|
151
|
+
--tonal-tag-container-color: var(--color-surface-container);
|
|
152
|
+
--tonal-tag-label-text-color: var(--color-on-surface);
|
|
153
|
+
--elevated-tag-container-color: var(--color-surface-container-low);
|
|
154
|
+
--elevated-tag-label-text-color: var(--color-on-surface);
|
|
155
|
+
--outlined-tag-outline-color: var(--color-on-surface);
|
|
156
|
+
--outlined-tag-label-text-color: var(--color-on-surface);
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
:host([color=red]) {
|
|
160
|
+
--filled-tag-container-color: var(--color-red);
|
|
161
|
+
--filled-tag-label-text-color: var(--color-on-red);
|
|
162
|
+
--tonal-tag-container-color: var(--color-red-container);
|
|
163
|
+
--tonal-tag-label-text-color: var(--color-on-red-container);
|
|
164
|
+
--elevated-tag-container-color: var(--color-surface-container-low);
|
|
165
|
+
--elevated-tag-label-text-color: var(--color-red);
|
|
166
|
+
--outlined-tag-outline-color: var(--color-red);
|
|
167
|
+
--outlined-tag-label-text-color: var(--color-red);
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
:host([color=green]) {
|
|
171
|
+
--filled-tag-container-color: var(--color-green);
|
|
172
|
+
--filled-tag-label-text-color: var(--color-on-green);
|
|
173
|
+
--tonal-tag-container-color: var(--color-green-container);
|
|
174
|
+
--tonal-tag-label-text-color: var(--color-on-green-container);
|
|
175
|
+
--elevated-tag-container-color: var(--color-surface-container-low);
|
|
176
|
+
--elevated-tag-label-text-color: var(--color-green);
|
|
177
|
+
--outlined-tag-outline-color: var(--color-green);
|
|
178
|
+
--outlined-tag-label-text-color: var(--color-green);
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
:host([color=blue]) {
|
|
182
|
+
--filled-tag-container-color: var(--color-blue);
|
|
183
|
+
--filled-tag-label-text-color: var(--color-on-blue);
|
|
184
|
+
--tonal-tag-container-color: var(--color-blue-container);
|
|
185
|
+
--tonal-tag-label-text-color: var(--color-on-blue-container);
|
|
186
|
+
--elevated-tag-container-color: var(--color-surface-container-low);
|
|
187
|
+
--elevated-tag-label-text-color: var(--color-blue);
|
|
188
|
+
--outlined-tag-outline-color: var(--color-blue);
|
|
189
|
+
--outlined-tag-label-text-color: var(--color-blue);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
:host([color=yellow]) {
|
|
193
|
+
--filled-tag-container-color: var(--color-yellow);
|
|
194
|
+
--filled-tag-label-text-color: var(--color-on-yellow);
|
|
195
|
+
--tonal-tag-container-color: var(--color-yellow-container);
|
|
196
|
+
--tonal-tag-label-text-color: var(--color-on-yellow-container);
|
|
197
|
+
--elevated-tag-container-color: var(--color-surface-container-low);
|
|
198
|
+
--elevated-tag-label-text-color: var(--color-yellow);
|
|
199
|
+
--outlined-tag-outline-color: var(--color-yellow);
|
|
200
|
+
--outlined-tag-label-text-color: var(--color-yellow);
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
:host([color=purple]) {
|
|
204
|
+
--filled-tag-container-color: var(--color-purple);
|
|
205
|
+
--filled-tag-label-text-color: var(--color-on-purple);
|
|
206
|
+
--tonal-tag-container-color: var(--color-purple-container);
|
|
207
|
+
--tonal-tag-label-text-color: var(--color-on-purple-container);
|
|
208
|
+
--elevated-tag-container-color: var(--color-surface-container-low);
|
|
209
|
+
--elevated-tag-label-text-color: var(--color-purple);
|
|
210
|
+
--outlined-tag-outline-color: var(--color-purple);
|
|
211
|
+
--outlined-tag-label-text-color: var(--color-purple);
|
|
212
|
+
}`;
|
|
213
|
+
|
|
214
|
+
var css_248z = i`.tag {
|
|
215
|
+
font-family: var(--font-family-sans) !important;
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
.tag.size-sm,
|
|
219
|
+
.tag.size-small {
|
|
220
|
+
--_chip-height: 1.5rem;
|
|
221
|
+
--_tag-icon-size: 1rem;
|
|
222
|
+
--_container-padding: 0.75rem;
|
|
223
|
+
font-family: var(--typography-label-medium-font-family) !important;
|
|
224
|
+
font-size: var(--typography-label-medium-font-size) !important;
|
|
225
|
+
font-weight: var(--typography-label-medium-font-weight) !important;
|
|
226
|
+
line-height: var(--typography-label-medium-line-height) !important;
|
|
227
|
+
letter-spacing: var(--typography-label-medium-letter-spacing) !important;
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
.tag.size-md,
|
|
231
|
+
.tag.size-medium {
|
|
232
|
+
--_chip-height: 2rem;
|
|
233
|
+
--_tag-icon-size: 1.125rem;
|
|
234
|
+
--_container-padding: 1rem;
|
|
235
|
+
font-family: var(--typography-label-large-font-family) !important;
|
|
236
|
+
font-size: var(--typography-label-large-font-size) !important;
|
|
237
|
+
font-weight: var(--typography-label-large-font-weight) !important;
|
|
238
|
+
line-height: var(--typography-label-large-line-height) !important;
|
|
239
|
+
letter-spacing: var(--typography-label-large-letter-spacing) !important;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
.tag.size-lg,
|
|
243
|
+
.tag.size-large {
|
|
244
|
+
--_chip-height: 2.5rem;
|
|
245
|
+
--_tag-icon-size: 1.25rem;
|
|
246
|
+
--_container-padding: 1.25rem;
|
|
247
|
+
font-family: var(--typography-title-small-font-family) !important;
|
|
248
|
+
font-size: var(--typography-title-small-font-size) !important;
|
|
249
|
+
font-weight: var(--typography-title-small-font-weight) !important;
|
|
250
|
+
line-height: var(--typography-title-small-line-height) !important;
|
|
251
|
+
letter-spacing: var(--typography-title-small-letter-spacing) !important;
|
|
252
|
+
}`;
|
|
253
|
+
|
|
254
|
+
/**
|
|
255
|
+
* @label Tag
|
|
256
|
+
* @tag wc-tag
|
|
257
|
+
* @rawTag tag
|
|
258
|
+
* @summary Tag component for displaying labels or values with optional dismiss functionality.
|
|
259
|
+
* @tags display
|
|
260
|
+
*
|
|
261
|
+
* @fires {CustomEvent} dismiss - Dispatched when the dismiss button is clicked.
|
|
262
|
+
* @fires {CustomEvent} tag--dismiss - Deprecated alias of `dismiss`, fired alongside it.
|
|
263
|
+
*
|
|
264
|
+
* @example
|
|
265
|
+
* ```html
|
|
266
|
+
* <wc-tag color="red">Tag</wc-tag>
|
|
267
|
+
* ```
|
|
268
|
+
*/
|
|
269
|
+
let Tag = class Tag extends i$1 {
|
|
270
|
+
constructor() {
|
|
271
|
+
// ── Static ───────────────────────────────────────────────────────────────
|
|
272
|
+
super(...arguments);
|
|
273
|
+
// ── Properties ───────────────────────────────────────────────────────────
|
|
274
|
+
/** If true, the tag will have a close icon. */
|
|
275
|
+
this.dismissible = false;
|
|
276
|
+
this.variant = 'tonal';
|
|
277
|
+
/** Tag color. */
|
|
278
|
+
this.color = 'default';
|
|
279
|
+
/** Tag size. Possible values are `"sm"`, `"md"`, `"lg"`. Defaults to `"md"`. */
|
|
280
|
+
this.size = 'md';
|
|
281
|
+
}
|
|
282
|
+
// ── Private methods ──────────────────────────────────────────────────────
|
|
283
|
+
_dismissClickHandler(e) {
|
|
284
|
+
e.stopPropagation();
|
|
285
|
+
this.dispatchEvent(new CustomEvent('dismiss', { bubbles: true }));
|
|
286
|
+
// Deprecated: kept for listeners written before `dismiss`.
|
|
287
|
+
this.dispatchEvent(new CustomEvent('tag--dismiss', { bubbles: true }));
|
|
288
|
+
}
|
|
289
|
+
// ── Render helpers ───────────────────────────────────────────────────────
|
|
290
|
+
__renderDismissButton() {
|
|
291
|
+
if (!this.dismissible)
|
|
292
|
+
return null;
|
|
293
|
+
return b `
|
|
294
|
+
<button
|
|
295
|
+
class="dismiss-button"
|
|
296
|
+
@click=${this._dismissClickHandler}
|
|
297
|
+
aria-label="Dismiss"
|
|
298
|
+
>
|
|
299
|
+
<wc-ripple class="ripple"></wc-ripple>
|
|
300
|
+
<wc-icon class="dismiss-button-icon" name="close"></wc-icon>
|
|
301
|
+
</button>
|
|
302
|
+
`;
|
|
303
|
+
}
|
|
304
|
+
// ── Render ───────────────────────────────────────────────────────────────
|
|
305
|
+
render() {
|
|
306
|
+
const classes = {
|
|
307
|
+
tag: true,
|
|
308
|
+
dismissible: this.dismissible,
|
|
309
|
+
[`color-${this.color}`]: true,
|
|
310
|
+
[`variant-${this.variant}`]: true,
|
|
311
|
+
[`size-${this.size}`]: true,
|
|
312
|
+
};
|
|
313
|
+
return b `
|
|
314
|
+
<div class="${e(classes)}">
|
|
315
|
+
<wc-elevation class="elevation"></wc-elevation>
|
|
316
|
+
<div class="background"></div>
|
|
317
|
+
<div class="outline"></div>
|
|
318
|
+
|
|
319
|
+
<div class="tag-content">
|
|
320
|
+
<slot name="icon"></slot>
|
|
321
|
+
|
|
322
|
+
<div class="slot-content">
|
|
323
|
+
<slot></slot>
|
|
324
|
+
</div>
|
|
325
|
+
${this.__renderDismissButton()}
|
|
326
|
+
</div>
|
|
327
|
+
</div>
|
|
328
|
+
`;
|
|
329
|
+
}
|
|
330
|
+
};
|
|
331
|
+
Tag.styles = [css_248z$2, css_248z$1, css_248z];
|
|
332
|
+
__decorate([
|
|
333
|
+
n({ type: Boolean })
|
|
334
|
+
], Tag.prototype, "dismissible", void 0);
|
|
335
|
+
__decorate([
|
|
336
|
+
n()
|
|
337
|
+
], Tag.prototype, "variant", void 0);
|
|
338
|
+
__decorate([
|
|
339
|
+
n({ type: String, reflect: true })
|
|
340
|
+
], Tag.prototype, "color", void 0);
|
|
341
|
+
__decorate([
|
|
342
|
+
n({ reflect: true })
|
|
343
|
+
], Tag.prototype, "size", void 0);
|
|
344
|
+
Tag = __decorate([
|
|
345
|
+
IndividualComponent
|
|
346
|
+
], Tag);
|
|
347
|
+
|
|
348
|
+
export { Tag };
|
|
349
|
+
//# sourceMappingURL=tag.js.map
|
package/dist/tag.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tag.js","sources":["../../src/chip/tag/tag.ts"],"sourcesContent":["import { html, LitElement } from 'lit';\nimport { property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport IndividualComponent from '@/IndividualComponent.js';\nimport styles from './tag.scss';\nimport colorStyles from './tag-colors.scss';\nimport sizeStyles from './tag-sizes.scss';\n\n/**\n * @label Tag\n * @tag wc-tag\n * @rawTag tag\n * @summary Tag component for displaying labels or values with optional dismiss functionality.\n * @tags display\n *\n * @fires {CustomEvent} dismiss - Dispatched when the dismiss button is clicked.\n * @fires {CustomEvent} tag--dismiss - Deprecated alias of `dismiss`, fired alongside it.\n *\n * @example\n * ```html\n * <wc-tag color=\"red\">Tag</wc-tag>\n * ```\n */\n@IndividualComponent\nexport class Tag extends LitElement {\n // ── Static ───────────────────────────────────────────────────────────────\n\n static styles = [styles, colorStyles, sizeStyles];\n\n // ── Properties ───────────────────────────────────────────────────────────\n\n /** If true, the tag will have a close icon. */\n @property({ type: Boolean }) dismissible = false;\n\n @property() variant: 'elevated' | 'filled' | 'tonal' | 'outlined' = 'tonal';\n\n /** Tag color. */\n @property({ type: String, reflect: true }) color?:\n | 'default'\n | 'blue'\n | 'green'\n | 'red'\n | 'yellow' = 'default';\n\n /** Tag size. Possible values are `\"sm\"`, `\"md\"`, `\"lg\"`. Defaults to `\"md\"`. */\n @property({ reflect: true }) size?: 'sm' | 'md' | 'lg' = 'md';\n\n // ── Private methods ──────────────────────────────────────────────────────\n\n private _dismissClickHandler(e: MouseEvent) {\n e.stopPropagation();\n\n this.dispatchEvent(new CustomEvent('dismiss', { bubbles: true }));\n // Deprecated: kept for listeners written before `dismiss`.\n this.dispatchEvent(new CustomEvent('tag--dismiss', { bubbles: true }));\n }\n\n // ── Render helpers ───────────────────────────────────────────────────────\n\n private __renderDismissButton() {\n if (!this.dismissible) return null;\n\n return html`\n <button\n class=\"dismiss-button\"\n @click=${this._dismissClickHandler}\n aria-label=\"Dismiss\"\n >\n <wc-ripple class=\"ripple\"></wc-ripple>\n <wc-icon class=\"dismiss-button-icon\" name=\"close\"></wc-icon>\n </button>\n `;\n }\n\n // ── Render ───────────────────────────────────────────────────────────────\n\n render() {\n const classes = {\n tag: true,\n dismissible: this.dismissible,\n [`color-${this.color}`]: true,\n [`variant-${this.variant}`]: true,\n [`size-${this.size}`]: true,\n };\n\n return html`\n <div class=\"${classMap(classes)}\">\n <wc-elevation class=\"elevation\"></wc-elevation>\n <div class=\"background\"></div>\n <div class=\"outline\"></div>\n\n <div class=\"tag-content\">\n <slot name=\"icon\"></slot>\n\n <div class=\"slot-content\">\n <slot></slot>\n </div>\n ${this.__renderDismissButton()}\n </div>\n </div>\n `;\n }\n}\n"],"names":["LitElement","html","classMap","styles","colorStyles","sizeStyles","property"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAQA;;;;;;;;;;;;;;AAcG;AAEI,IAAM,GAAG,GAAT,MAAM,GAAI,SAAQA,GAAU,CAAA;AAA5B,IAAA,WAAA,GAAA;;;;;QAQwB,IAAA,CAAA,WAAW,GAAG,KAAK;QAEpC,IAAA,CAAA,OAAO,GAAiD,OAAO;;QAGhC,IAAA,CAAA,KAAK,GAKjC,SAAS;;QAGK,IAAA,CAAA,IAAI,GAAwB,IAAI;IAyD/D;;AArDU,IAAA,oBAAoB,CAAC,CAAa,EAAA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AA1CA,CAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,IAAI,EAAE;AAKhB,CAAA,EAAA,GAAA,CAAA,SAAA,EAAA,OAAA,EAAA,MAAA,CAAA;AAGI,UAAA,CAAA;AAA5B,IAAAA,CAAQ,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE;AAAmC,CAAA,EAAA,GAAA,CAAA,SAAA,EAAA,MAAA,EAAA,MAAA,CAAA;AArBnD,GAAG,GAAA,UAAA,CAAA;IADf;AACY,CAAA,EAAA,GAAG,CA8Ef;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/test/icon.test.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/dist/textarea.js
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
import { i, _ as __decorate, I as IndividualComponent, b } from './IndividualComponent-Bdwyrvd6.js';
|
|
2
|
+
import { n } from './property-B49QQ8pS.js';
|
|
3
|
+
import { r } from './state-DkTK9EGF.js';
|
|
4
|
+
import { e } from './query-CHb9Ft_d.js';
|
|
5
|
+
import { r as redispatchEvent } from './dispatch-event-utils-CuEqjlPT.js';
|
|
6
|
+
import { s as spread } from './spread-B5cgadZl.js';
|
|
7
|
+
import { B as BaseInput } from './BaseInput-CV0pZgSb.js';
|
|
8
|
+
import './base-Cl6v8-BZ.js';
|
|
9
|
+
import './directive-ZPhl09Yt.js';
|
|
10
|
+
import './element-internals-QME0yEz4.js';
|
|
11
|
+
import './form-associated-Bhwwr6dT.js';
|
|
12
|
+
|
|
13
|
+
var css_248z = i`* {
|
|
14
|
+
box-sizing: border-box;
|
|
15
|
+
-webkit-tap-highlight-color: transparent;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
.screen-reader-only {
|
|
19
|
+
display: none !important;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
[hidden] {
|
|
23
|
+
display: none !important;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
:host {
|
|
27
|
+
display: block;
|
|
28
|
+
width: 100%;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
.input-element {
|
|
32
|
+
border: none;
|
|
33
|
+
outline: none;
|
|
34
|
+
margin: 0;
|
|
35
|
+
padding: 0;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
.input-wrapper .input {
|
|
39
|
+
flex: 1;
|
|
40
|
+
width: 100%;
|
|
41
|
+
background: none;
|
|
42
|
+
cursor: inherit;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
.textarea {
|
|
46
|
+
height: 100%;
|
|
47
|
+
position: relative;
|
|
48
|
+
align-items: flex-start;
|
|
49
|
+
--field-height: auto;
|
|
50
|
+
--field-padding-block: var(--spacing-100);
|
|
51
|
+
}
|
|
52
|
+
.textarea .input {
|
|
53
|
+
height: 100%;
|
|
54
|
+
resize: vertical;
|
|
55
|
+
}`;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* @label Textarea
|
|
59
|
+
* @tag wc-textarea
|
|
60
|
+
* @rawTag textarea
|
|
61
|
+
* @summary The Textarea component is used to capture user input.
|
|
62
|
+
* @tags input
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```html
|
|
66
|
+
* <wc-textarea label="Description" placeholder="Enter text"></wc-textarea>
|
|
67
|
+
* ```
|
|
68
|
+
*/
|
|
69
|
+
let Textarea = class Textarea extends BaseInput {
|
|
70
|
+
constructor() {
|
|
71
|
+
super(...arguments);
|
|
72
|
+
this.value = '';
|
|
73
|
+
this.placeholder = '';
|
|
74
|
+
this.label = '';
|
|
75
|
+
this.inline = false;
|
|
76
|
+
this.size = 'md';
|
|
77
|
+
this.autocomplete = 'off';
|
|
78
|
+
this.configAria = {};
|
|
79
|
+
this.variant = 'default';
|
|
80
|
+
/**
|
|
81
|
+
* Helper text to display below the input.
|
|
82
|
+
*/
|
|
83
|
+
this.helperText = '';
|
|
84
|
+
this.error = false;
|
|
85
|
+
this.errorText = '';
|
|
86
|
+
this.warning = false;
|
|
87
|
+
this.warningText = '';
|
|
88
|
+
this.rows = '3';
|
|
89
|
+
this.focused = false;
|
|
90
|
+
this.passwordVisible = false;
|
|
91
|
+
/**
|
|
92
|
+
* Returns true when the text field has been interacted with. Native
|
|
93
|
+
* validation errors only display in response to user interactions.
|
|
94
|
+
*/
|
|
95
|
+
this.dirty = false;
|
|
96
|
+
}
|
|
97
|
+
connectedCallback() {
|
|
98
|
+
super.connectedCallback();
|
|
99
|
+
this.handleInitialAttributes();
|
|
100
|
+
}
|
|
101
|
+
handleInitialAttributes() {
|
|
102
|
+
if (this.hasAttribute('tabindex')) {
|
|
103
|
+
this.tabindex = this.getAttribute('tabindex') || undefined;
|
|
104
|
+
this.removeAttribute('tabindex');
|
|
105
|
+
}
|
|
106
|
+
Array.from(this.attributes).forEach(attr => {
|
|
107
|
+
if (attr.name.startsWith('aria-')) {
|
|
108
|
+
this.configAria[attr.name] = attr.value;
|
|
109
|
+
this.removeAttribute(attr.name);
|
|
110
|
+
}
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
__handleInput(event) {
|
|
114
|
+
this.dirty = true;
|
|
115
|
+
this.value = event.target.value;
|
|
116
|
+
}
|
|
117
|
+
focus() {
|
|
118
|
+
this.inputElement?.focus();
|
|
119
|
+
}
|
|
120
|
+
blur() {
|
|
121
|
+
this.inputElement?.blur();
|
|
122
|
+
}
|
|
123
|
+
__handleFocusChange() {
|
|
124
|
+
// When calling focus() or reportValidity() during change, it's possible
|
|
125
|
+
// for blur to be called after the new focus event. Rather than set
|
|
126
|
+
// `this.focused` to true/false on focus/blur, we always set it to whether
|
|
127
|
+
// or not the input itself is focused.
|
|
128
|
+
this.focused = this.inputElement?.matches(':focus') ?? false;
|
|
129
|
+
}
|
|
130
|
+
__redispatchEvent(event) {
|
|
131
|
+
redispatchEvent(this, event);
|
|
132
|
+
}
|
|
133
|
+
render() {
|
|
134
|
+
return b `
|
|
135
|
+
<wc-field
|
|
136
|
+
?required=${this.required}
|
|
137
|
+
?disabled=${this.disabled}
|
|
138
|
+
?readonly=${this.readonly}
|
|
139
|
+
?skeleton=${this.skeleton}
|
|
140
|
+
helper-text=${this.helperText}
|
|
141
|
+
?error=${this.error}
|
|
142
|
+
error-text=${this.errorText}
|
|
143
|
+
?warning=${this.warning}
|
|
144
|
+
variant=${this.variant}
|
|
145
|
+
?populated=${!!this.value}
|
|
146
|
+
warning-text=${this.warningText}
|
|
147
|
+
label=${this.label}
|
|
148
|
+
?focused=${this.focused}
|
|
149
|
+
.host=${this}
|
|
150
|
+
class="input-wrapper textarea"
|
|
151
|
+
>
|
|
152
|
+
<slot name="start" slot="field-start"></slot>
|
|
153
|
+
|
|
154
|
+
<textarea
|
|
155
|
+
class="input input-element"
|
|
156
|
+
rows=${this.rows}
|
|
157
|
+
name=${this.name}
|
|
158
|
+
placeholder=${this.placeholder}
|
|
159
|
+
autocomplete=${this.autocomplete}
|
|
160
|
+
.value=${this.value}
|
|
161
|
+
?tabindex=${this.tabindex}
|
|
162
|
+
?readonly=${this.readonly}
|
|
163
|
+
?required=${this.required}
|
|
164
|
+
?disabled=${this.disabled}
|
|
165
|
+
@input=${this.__handleInput}
|
|
166
|
+
@change=${this.__redispatchEvent}
|
|
167
|
+
@focus=${this.__handleFocusChange}
|
|
168
|
+
@blur=${this.__handleFocusChange}
|
|
169
|
+
${spread(this.configAria)}
|
|
170
|
+
></textarea>
|
|
171
|
+
|
|
172
|
+
<slot name="end" slot="field-end"></slot>
|
|
173
|
+
</wc-field>
|
|
174
|
+
`;
|
|
175
|
+
}
|
|
176
|
+
};
|
|
177
|
+
Textarea.styles = [css_248z];
|
|
178
|
+
__decorate([
|
|
179
|
+
n({ type: String })
|
|
180
|
+
], Textarea.prototype, "value", void 0);
|
|
181
|
+
__decorate([
|
|
182
|
+
n({ type: String })
|
|
183
|
+
], Textarea.prototype, "placeholder", void 0);
|
|
184
|
+
__decorate([
|
|
185
|
+
n({ type: String })
|
|
186
|
+
], Textarea.prototype, "label", void 0);
|
|
187
|
+
__decorate([
|
|
188
|
+
n({ type: Boolean, reflect: true })
|
|
189
|
+
], Textarea.prototype, "inline", void 0);
|
|
190
|
+
__decorate([
|
|
191
|
+
n({ type: String, reflect: true })
|
|
192
|
+
], Textarea.prototype, "size", void 0);
|
|
193
|
+
__decorate([
|
|
194
|
+
n({ type: String })
|
|
195
|
+
], Textarea.prototype, "autocomplete", void 0);
|
|
196
|
+
__decorate([
|
|
197
|
+
n({ type: Object })
|
|
198
|
+
], Textarea.prototype, "configAria", void 0);
|
|
199
|
+
__decorate([
|
|
200
|
+
n({ type: String })
|
|
201
|
+
], Textarea.prototype, "variant", void 0);
|
|
202
|
+
__decorate([
|
|
203
|
+
n({ type: String, attribute: 'helper-text' })
|
|
204
|
+
], Textarea.prototype, "helperText", void 0);
|
|
205
|
+
__decorate([
|
|
206
|
+
n({ type: Boolean })
|
|
207
|
+
], Textarea.prototype, "error", void 0);
|
|
208
|
+
__decorate([
|
|
209
|
+
n({ type: String, attribute: 'error-text' })
|
|
210
|
+
], Textarea.prototype, "errorText", void 0);
|
|
211
|
+
__decorate([
|
|
212
|
+
n({ type: Boolean })
|
|
213
|
+
], Textarea.prototype, "warning", void 0);
|
|
214
|
+
__decorate([
|
|
215
|
+
n({ type: String, attribute: 'warning-text' })
|
|
216
|
+
], Textarea.prototype, "warningText", void 0);
|
|
217
|
+
__decorate([
|
|
218
|
+
n({ type: String })
|
|
219
|
+
], Textarea.prototype, "rows", void 0);
|
|
220
|
+
__decorate([
|
|
221
|
+
r()
|
|
222
|
+
], Textarea.prototype, "focused", void 0);
|
|
223
|
+
__decorate([
|
|
224
|
+
r()
|
|
225
|
+
], Textarea.prototype, "passwordVisible", void 0);
|
|
226
|
+
__decorate([
|
|
227
|
+
r()
|
|
228
|
+
], Textarea.prototype, "dirty", void 0);
|
|
229
|
+
__decorate([
|
|
230
|
+
e('.input-element')
|
|
231
|
+
], Textarea.prototype, "inputElement", void 0);
|
|
232
|
+
Textarea = __decorate([
|
|
233
|
+
IndividualComponent
|
|
234
|
+
], Textarea);
|
|
235
|
+
|
|
236
|
+
export { Textarea };
|
|
237
|
+
//# sourceMappingURL=textarea.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"textarea.js","sources":["../../src/textarea/textarea.ts"],"sourcesContent":["import { html } from 'lit';\nimport { property, query, state } from 'lit/decorators.js';\n\nimport { redispatchEvent } from '@/__internal/utils/dispatch-event-utils.js';\nimport { spread } from '@/__internal/directive/spread.js';\n\nimport IndividualComponent from '@/IndividualComponent.js';\nimport BaseInput from '../input/BaseInput.js';\nimport styles from './textarea.scss';\n\n/**\n * @label Textarea\n * @tag wc-textarea\n * @rawTag textarea\n * @summary The Textarea component is used to capture user input.\n * @tags input\n *\n * @example\n * ```html\n * <wc-textarea label=\"Description\" placeholder=\"Enter text\"></wc-textarea>\n * ```\n */\n@IndividualComponent\nexport class Textarea extends BaseInput {\n static styles = [styles];\n\n @property({ type: String })\n value = '';\n\n @property({ type: String }) placeholder = '';\n\n @property({ type: String }) label = '';\n\n @property({ type: Boolean, reflect: true }) inline = false;\n\n @property({ type: String, reflect: true }) size: 'sm' | 'md' | 'lg' = 'md';\n\n @property({ type: String }) autocomplete: 'on' | 'off' = 'off';\n\n @property({ type: Object }) configAria: Record<string, string> = {};\n\n @property({ type: String })\n variant: 'filled' | 'outlined' | 'default' = 'default';\n\n /**\n * Helper text to display below the input.\n */\n @property({ type: String, attribute: 'helper-text' })\n helperText: string = '';\n\n @property({ type: Boolean })\n error: boolean = false;\n\n @property({ type: String, attribute: 'error-text' })\n errorText: string = '';\n\n @property({ type: Boolean })\n warning: boolean = false;\n\n @property({ type: String, attribute: 'warning-text' })\n warningText: string = '';\n\n @property({ type: String }) rows = '3';\n\n @state()\n private focused = false;\n\n @state()\n private passwordVisible = false;\n\n /**\n * Returns true when the text field has been interacted with. Native\n * validation errors only display in response to user interactions.\n */\n @state() private dirty = false;\n\n @query('.input-element')\n private inputElement?: HTMLInputElement;\n\n private tabindex?: string;\n\n connectedCallback() {\n super.connectedCallback();\n this.handleInitialAttributes();\n }\n\n private handleInitialAttributes() {\n if (this.hasAttribute('tabindex')) {\n this.tabindex = this.getAttribute('tabindex') || undefined;\n this.removeAttribute('tabindex');\n }\n\n Array.from(this.attributes).forEach(attr => {\n if (attr.name.startsWith('aria-')) {\n this.configAria[attr.name] = attr.value;\n this.removeAttribute(attr.name);\n }\n });\n }\n\n private __handleInput(event: InputEvent) {\n this.dirty = true;\n this.value = (event.target as HTMLInputElement).value;\n }\n\n override focus() {\n this.inputElement?.focus();\n }\n\n override blur() {\n this.inputElement?.blur();\n }\n\n private __handleFocusChange() {\n // When calling focus() or reportValidity() during change, it's possible\n // for blur to be called after the new focus event. Rather than set\n // `this.focused` to true/false on focus/blur, we always set it to whether\n // or not the input itself is focused.\n this.focused = this.inputElement?.matches(':focus') ?? false;\n }\n\n private __redispatchEvent(event: Event) {\n redispatchEvent(this, event);\n }\n\n render() {\n return html`\n <wc-field\n ?required=${this.required}\n ?disabled=${this.disabled}\n ?readonly=${this.readonly}\n ?skeleton=${this.skeleton}\n helper-text=${this.helperText}\n ?error=${this.error}\n error-text=${this.errorText}\n ?warning=${this.warning}\n variant=${this.variant}\n ?populated=${!!this.value}\n warning-text=${this.warningText}\n label=${this.label}\n ?focused=${this.focused}\n .host=${this}\n class=\"input-wrapper textarea\"\n >\n <slot name=\"start\" slot=\"field-start\"></slot>\n\n <textarea\n class=\"input input-element\"\n rows=${this.rows}\n name=${this.name}\n placeholder=${this.placeholder}\n autocomplete=${this.autocomplete}\n .value=${this.value}\n ?tabindex=${this.tabindex}\n ?readonly=${this.readonly}\n ?required=${this.required}\n ?disabled=${this.disabled}\n @input=${this.__handleInput}\n @change=${this.__redispatchEvent}\n @focus=${this.__handleFocusChange}\n @blur=${this.__handleFocusChange}\n ${spread(this.configAria)}\n ></textarea>\n\n <slot name=\"end\" slot=\"field-end\"></slot>\n </wc-field>\n `;\n }\n}\n"],"names":["html","styles","property","state","query"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAUA;;;;;;;;;;;AAWG;AAEI,IAAM,QAAQ,GAAd,MAAM,QAAS,SAAQ,SAAS,CAAA;AAAhC,IAAA,WAAA,GAAA;;QAIL,IAAA,CAAA,KAAK,GAAG,EAAE;QAEkB,IAAA,CAAA,WAAW,GAAG,EAAE;QAEhB,IAAA,CAAA,KAAK,GAAG,EAAE;QAEM,IAAA,CAAA,MAAM,GAAG,KAAK;QAEf,IAAA,CAAA,IAAI,GAAuB,IAAI;QAE9C,IAAA,CAAA,YAAY,GAAiB,KAAK;QAElC,IAAA,CAAA,UAAU,GAA2B,EAAE;QAGnE,IAAA,CAAA,OAAO,GAAsC,SAAS;AAEtD;;AAEG;QAEH,IAAA,CAAA,UAAU,GAAW,EAAE;QAGvB,IAAA,CAAA,KAAK,GAAY,KAAK;QAGtB,IAAA,CAAA,SAAS,GAAW,EAAE;QAGtB,IAAA,CAAA,OAAO,GAAY,KAAK;QAGxB,IAAA,CAAA,WAAW,GAAW,EAAE;QAEI,IAAA,CAAA,IAAI,GAAG,GAAG;QAG9B,IAAA,CAAA,OAAO,GAAG,KAAK;QAGf,IAAA,CAAA,eAAe,GAAG,KAAK;AAE/B;;;AAGG;QACc,IAAA,CAAA,KAAK,GAAG,KAAK;IA8FhC;IAvFE,i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