@politiet/sheriff-web-components 0.1.3 → 0.6.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/README.md +2 -52
- package/dist/index.d.ts +15 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -1
- package/dist/react-wrappers/SDSButtonWrapper.d.ts +7 -0
- package/dist/react-wrappers/SDSButtonWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSButtonWrapper.js +14 -0
- package/dist/react-wrappers/SDSButtonWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSCheckboxGroupWrapper.d.ts +5 -0
- package/dist/react-wrappers/SDSCheckboxGroupWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSCheckboxGroupWrapper.js +12 -0
- package/dist/react-wrappers/SDSCheckboxGroupWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSCheckboxWrapper.d.ts +7 -0
- package/dist/react-wrappers/SDSCheckboxWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSCheckboxWrapper.js +14 -0
- package/dist/react-wrappers/SDSCheckboxWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSChipWrapper.d.ts +6 -0
- package/dist/react-wrappers/SDSChipWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSChipWrapper.js +13 -0
- package/dist/react-wrappers/SDSChipWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSDetailWrapper.d.ts +3 -0
- package/dist/react-wrappers/SDSDetailWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSDetailWrapper.js +10 -0
- package/dist/react-wrappers/SDSDetailWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSHeadingWrapper.d.ts +3 -0
- package/dist/react-wrappers/SDSHeadingWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSHeadingWrapper.js +10 -0
- package/dist/react-wrappers/SDSHeadingWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSIconWrapper.d.ts +3 -0
- package/dist/react-wrappers/SDSIconWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSIconWrapper.js +10 -0
- package/dist/react-wrappers/SDSIconWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSLabelWrapper.d.ts +3 -0
- package/dist/react-wrappers/SDSLabelWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSLabelWrapper.js +10 -0
- package/dist/react-wrappers/SDSLabelWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSLinkWrapper.d.ts +3 -0
- package/dist/react-wrappers/SDSLinkWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSLinkWrapper.js +10 -0
- package/dist/react-wrappers/SDSLinkWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSLoaderWrapper.d.ts +3 -0
- package/dist/react-wrappers/SDSLoaderWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSLoaderWrapper.js +10 -0
- package/dist/react-wrappers/SDSLoaderWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSNotificationWrapper.d.ts +5 -0
- package/dist/react-wrappers/SDSNotificationWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSNotificationWrapper.js +12 -0
- package/dist/react-wrappers/SDSNotificationWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSParagraphWrapper.d.ts +3 -0
- package/dist/react-wrappers/SDSParagraphWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSParagraphWrapper.js +10 -0
- package/dist/react-wrappers/SDSParagraphWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSRadioGroupWrapper.d.ts +5 -0
- package/dist/react-wrappers/SDSRadioGroupWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSRadioGroupWrapper.js +12 -0
- package/dist/react-wrappers/SDSRadioGroupWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSRadioWrapper.d.ts +7 -0
- package/dist/react-wrappers/SDSRadioWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSRadioWrapper.js +14 -0
- package/dist/react-wrappers/SDSRadioWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSSwitchWrapper.d.ts +7 -0
- package/dist/react-wrappers/SDSSwitchWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSSwitchWrapper.js +14 -0
- package/dist/react-wrappers/SDSSwitchWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSTextFieldWrapper.d.ts +9 -0
- package/dist/react-wrappers/SDSTextFieldWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSTextFieldWrapper.js +16 -0
- package/dist/react-wrappers/SDSTextFieldWrapper.js.map +1 -0
- package/dist/react-wrappers/SDSTextWrapper.d.ts +3 -0
- package/dist/react-wrappers/SDSTextWrapper.d.ts.map +1 -0
- package/dist/react-wrappers/SDSTextWrapper.js +10 -0
- package/dist/react-wrappers/SDSTextWrapper.js.map +1 -0
- package/dist/react-wrappers/index.d.ts +19 -0
- package/dist/react-wrappers/index.d.ts.map +1 -0
- package/dist/react-wrappers/index.js +19 -0
- package/dist/react-wrappers/index.js.map +1 -0
- package/dist/sds-button/sds-button.d.ts +11 -3
- package/dist/sds-button/sds-button.d.ts.map +1 -1
- package/dist/sds-button/sds-button.js +83 -13
- package/dist/sds-button/sds-button.js.map +1 -1
- package/dist/sds-button/sds-button.styles.d.ts.map +1 -1
- package/dist/sds-button/sds-button.styles.js +41 -10
- package/dist/sds-button/sds-button.styles.js.map +1 -1
- package/dist/sds-checkbox/sds-checkbox.d.ts +26 -0
- package/dist/sds-checkbox/sds-checkbox.d.ts.map +1 -0
- package/dist/sds-checkbox/sds-checkbox.js +116 -0
- package/dist/sds-checkbox/sds-checkbox.js.map +1 -0
- package/dist/sds-checkbox/sds-checkbox.styles.d.ts +2 -0
- package/dist/sds-checkbox/sds-checkbox.styles.d.ts.map +1 -0
- package/dist/sds-checkbox/sds-checkbox.styles.js +110 -0
- package/dist/sds-checkbox/sds-checkbox.styles.js.map +1 -0
- package/dist/sds-checkbox-group/sds-checkbox-group.d.ts +18 -0
- package/dist/sds-checkbox-group/sds-checkbox-group.d.ts.map +1 -0
- package/dist/sds-checkbox-group/sds-checkbox-group.js +75 -0
- package/dist/sds-checkbox-group/sds-checkbox-group.js.map +1 -0
- package/dist/sds-checkbox-group/sds-checkbox-group.styles.d.ts +2 -0
- package/dist/sds-checkbox-group/sds-checkbox-group.styles.d.ts.map +1 -0
- package/dist/sds-checkbox-group/sds-checkbox-group.styles.js +52 -0
- package/dist/sds-checkbox-group/sds-checkbox-group.styles.js.map +1 -0
- package/dist/sds-chip/sds-chip.d.ts +15 -10
- package/dist/sds-chip/sds-chip.d.ts.map +1 -1
- package/dist/sds-chip/sds-chip.js +60 -70
- package/dist/sds-chip/sds-chip.js.map +1 -1
- package/dist/sds-chip/sds-chip.styles.d.ts.map +1 -1
- package/dist/sds-chip/sds-chip.styles.js +42 -75
- package/dist/sds-chip/sds-chip.styles.js.map +1 -1
- package/dist/sds-detail/sds-detail.d.ts +14 -0
- package/dist/sds-detail/sds-detail.d.ts.map +1 -0
- package/dist/sds-detail/sds-detail.js +36 -0
- package/dist/sds-detail/sds-detail.js.map +1 -0
- package/dist/sds-detail/sds-detail.styles.d.ts +2 -0
- package/dist/sds-detail/sds-detail.styles.d.ts.map +1 -0
- package/dist/sds-detail/sds-detail.styles.js +25 -0
- package/dist/sds-detail/sds-detail.styles.js.map +1 -0
- package/dist/sds-heading/sds-heading.d.ts +16 -0
- package/dist/sds-heading/sds-heading.d.ts.map +1 -0
- package/dist/sds-heading/sds-heading.js +57 -0
- package/dist/sds-heading/sds-heading.js.map +1 -0
- package/dist/sds-heading/sds-heading.styles.d.ts +2 -0
- package/dist/sds-heading/sds-heading.styles.d.ts.map +1 -0
- package/dist/sds-heading/sds-heading.styles.js +105 -0
- package/dist/sds-heading/sds-heading.styles.js.map +1 -0
- package/dist/sds-icon/sds-icon-loader.d.ts +7 -0
- package/dist/sds-icon/sds-icon-loader.d.ts.map +1 -0
- package/dist/sds-icon/sds-icon-loader.js +26 -0
- package/dist/sds-icon/sds-icon-loader.js.map +1 -0
- package/dist/sds-icon/sds-icon.allowed-colors.d.ts +3 -0
- package/dist/sds-icon/sds-icon.allowed-colors.d.ts.map +1 -0
- package/dist/sds-icon/sds-icon.allowed-colors.js +17 -0
- package/dist/sds-icon/sds-icon.allowed-colors.js.map +1 -0
- package/dist/sds-icon/sds-icon.allowed-names.d.ts +3 -0
- package/dist/sds-icon/sds-icon.allowed-names.d.ts.map +1 -0
- package/dist/sds-icon/sds-icon.allowed-names.js +2 -0
- package/dist/sds-icon/sds-icon.allowed-names.js.map +1 -0
- package/dist/sds-icon/sds-icon.color-types.d.ts +2 -0
- package/dist/sds-icon/sds-icon.color-types.d.ts.map +1 -0
- package/dist/sds-icon/sds-icon.color-types.js +2 -0
- package/dist/sds-icon/sds-icon.color-types.js.map +1 -0
- package/dist/sds-icon/sds-icon.d.ts +27 -0
- package/dist/sds-icon/sds-icon.d.ts.map +1 -0
- package/dist/sds-icon/sds-icon.icon-types.d.ts +2 -0
- package/dist/sds-icon/sds-icon.icon-types.d.ts.map +1 -0
- package/dist/sds-icon/sds-icon.icon-types.js +2 -0
- package/dist/sds-icon/sds-icon.icon-types.js.map +1 -0
- package/dist/sds-icon/sds-icon.js +83 -0
- package/dist/sds-icon/sds-icon.js.map +1 -0
- package/dist/sds-icon/sds-icon.styles.d.ts +2 -0
- package/dist/sds-icon/sds-icon.styles.d.ts.map +1 -0
- package/dist/sds-icon/sds-icon.styles.js +15 -0
- package/dist/sds-icon/sds-icon.styles.js.map +1 -0
- package/dist/sds-label/sds-label.d.ts +15 -0
- package/dist/sds-label/sds-label.d.ts.map +1 -0
- package/dist/sds-label/sds-label.js +43 -0
- package/dist/sds-label/sds-label.js.map +1 -0
- package/dist/sds-label/sds-label.styles.d.ts +2 -0
- package/dist/sds-label/sds-label.styles.d.ts.map +1 -0
- package/dist/sds-label/sds-label.styles.js +31 -0
- package/dist/sds-label/sds-label.styles.js.map +1 -0
- package/dist/sds-link/sds-link.d.ts +17 -0
- package/dist/sds-link/sds-link.d.ts.map +1 -0
- package/dist/sds-link/sds-link.js +45 -0
- package/dist/sds-link/sds-link.js.map +1 -0
- package/dist/sds-link/sds-link.styles.d.ts +2 -0
- package/dist/sds-link/sds-link.styles.d.ts.map +1 -0
- package/dist/sds-link/sds-link.styles.js +74 -0
- package/dist/sds-link/sds-link.styles.js.map +1 -0
- package/dist/sds-loader/sds-loader.d.ts +16 -0
- package/dist/sds-loader/sds-loader.d.ts.map +1 -0
- package/dist/sds-loader/sds-loader.js +39 -0
- package/dist/sds-loader/sds-loader.js.map +1 -0
- package/dist/sds-loader/sds-loader.styles.d.ts +2 -0
- package/dist/sds-loader/sds-loader.styles.d.ts.map +1 -0
- package/dist/sds-loader/sds-loader.styles.js +39 -0
- package/dist/sds-loader/sds-loader.styles.js.map +1 -0
- package/dist/sds-nav-card/sds-nav-card.d.ts +1 -2
- package/dist/sds-nav-card/sds-nav-card.d.ts.map +1 -1
- package/dist/sds-nav-card/sds-nav-card.js +6 -11
- package/dist/sds-nav-card/sds-nav-card.js.map +1 -1
- package/dist/sds-nav-card/sds-nav-card.styles.d.ts.map +1 -1
- package/dist/sds-nav-card/sds-nav-card.styles.js +1 -2
- package/dist/sds-nav-card/sds-nav-card.styles.js.map +1 -1
- package/dist/sds-notification/sds-notification.d.ts +17 -0
- package/dist/sds-notification/sds-notification.d.ts.map +1 -0
- package/dist/sds-notification/sds-notification.js +70 -0
- package/dist/sds-notification/sds-notification.js.map +1 -0
- package/dist/sds-notification/sds-notification.styles.d.ts +2 -0
- package/dist/sds-notification/sds-notification.styles.d.ts.map +1 -0
- package/dist/sds-notification/sds-notification.styles.js +160 -0
- package/dist/sds-notification/sds-notification.styles.js.map +1 -0
- package/dist/sds-paragraph/sds-paragraph.d.ts +14 -0
- package/dist/sds-paragraph/sds-paragraph.d.ts.map +1 -0
- package/dist/sds-paragraph/sds-paragraph.js +37 -0
- package/dist/sds-paragraph/sds-paragraph.js.map +1 -0
- package/dist/sds-paragraph/sds-paragraph.styles.d.ts +2 -0
- package/dist/sds-paragraph/sds-paragraph.styles.d.ts.map +1 -0
- package/dist/sds-paragraph/sds-paragraph.styles.js +37 -0
- package/dist/sds-paragraph/sds-paragraph.styles.js.map +1 -0
- package/dist/sds-radio/sds-radio.d.ts +49 -0
- package/dist/sds-radio/sds-radio.d.ts.map +1 -0
- package/dist/sds-radio/sds-radio.js +241 -0
- package/dist/sds-radio/sds-radio.js.map +1 -0
- package/dist/sds-radio/sds-radio.styles.d.ts +2 -0
- package/dist/sds-radio/sds-radio.styles.d.ts.map +1 -0
- package/dist/sds-radio/sds-radio.styles.js +109 -0
- package/dist/sds-radio/sds-radio.styles.js.map +1 -0
- package/dist/sds-radio-group/sds-radio-group.d.ts +22 -0
- package/dist/sds-radio-group/sds-radio-group.d.ts.map +1 -0
- package/dist/sds-radio-group/sds-radio-group.js +75 -0
- package/dist/sds-radio-group/sds-radio-group.js.map +1 -0
- package/dist/sds-radio-group/sds-radio-group.styles.d.ts +2 -0
- package/dist/sds-radio-group/sds-radio-group.styles.d.ts.map +1 -0
- package/dist/sds-radio-group/sds-radio-group.styles.js +47 -0
- package/dist/sds-radio-group/sds-radio-group.styles.js.map +1 -0
- package/dist/sds-switch/sds-switch.d.ts +43 -0
- package/dist/sds-switch/sds-switch.d.ts.map +1 -0
- package/dist/sds-switch/sds-switch.js +189 -0
- package/dist/sds-switch/sds-switch.js.map +1 -0
- package/dist/sds-switch/sds-switch.styles.d.ts +2 -0
- package/dist/sds-switch/sds-switch.styles.d.ts.map +1 -0
- package/dist/sds-switch/sds-switch.styles.js +125 -0
- package/dist/sds-switch/sds-switch.styles.js.map +1 -0
- package/dist/sds-text/sds-text.d.ts +14 -0
- package/dist/sds-text/sds-text.d.ts.map +1 -0
- package/dist/sds-text/sds-text.js +37 -0
- package/dist/sds-text/sds-text.js.map +1 -0
- package/dist/sds-text/sds-text.styles.d.ts +2 -0
- package/dist/sds-text/sds-text.styles.d.ts.map +1 -0
- package/dist/sds-text/sds-text.styles.js +31 -0
- package/dist/sds-text/sds-text.styles.js.map +1 -0
- package/dist/sds-textfield/sds-textfield.d.ts +35 -0
- package/dist/sds-textfield/sds-textfield.d.ts.map +1 -0
- package/dist/sds-textfield/sds-textfield.js +179 -0
- package/dist/sds-textfield/sds-textfield.js.map +1 -0
- package/dist/sds-textfield/sds-textfield.styles.d.ts +2 -0
- package/dist/sds-textfield/sds-textfield.styles.d.ts.map +1 -0
- package/dist/sds-textfield/sds-textfield.styles.js +116 -0
- package/dist/sds-textfield/sds-textfield.styles.js.map +1 -0
- package/package.json +36 -17
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: inline-flex;
|
|
5
|
+
contain: layout style;
|
|
6
|
+
box-sizing: border-box;
|
|
7
|
+
align-items: center;
|
|
8
|
+
justify-content: space-between;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
:host([hidden]) {
|
|
12
|
+
display: none;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
:host(:disabled),
|
|
16
|
+
:host(:disabled) * {
|
|
17
|
+
pointer-events: none;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
:host(:disabled) .sds-switch__input:checked::before {
|
|
21
|
+
content: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' fill='%23C4C6C7' viewBox='0 0 24 24'><path d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'></path></svg>");
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
:host(:disabled) .sds-switch__input:not(:checked)::before {
|
|
25
|
+
display: none;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
:host(:disabled) .sds-switch__label {
|
|
29
|
+
color: var(--sds-color-semantic-text-disabled);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
.sds-switch {
|
|
33
|
+
--_switch-motion-duration: 200ms;
|
|
34
|
+
--_switch-height: 32px;
|
|
35
|
+
--_switch-width: 60px;
|
|
36
|
+
--_switch-padding: 8px;
|
|
37
|
+
--_switch-icon-size: calc(var(--_switch-height) - (2 * var(--_switch-padding)));
|
|
38
|
+
|
|
39
|
+
display: flex;
|
|
40
|
+
gap: 0.5rem;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.sds-switch--small {
|
|
44
|
+
--_switch-height: 24px;
|
|
45
|
+
--_switch-width: 48px;
|
|
46
|
+
--_switch-padding: 6px;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
.sds-switch:has(.sds-switch__input:checked) {
|
|
50
|
+
--_switch-padding: 6px;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
.sds-switch--small:has(.sds-switch__input:checked) {
|
|
54
|
+
--_switch-padding: 4px;
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.sds-switch__label {
|
|
58
|
+
display: flex;
|
|
59
|
+
align-items: center;
|
|
60
|
+
cursor: pointer;
|
|
61
|
+
user-select: none;
|
|
62
|
+
color: var(--sds-color-semantic-text-default);
|
|
63
|
+
font-family: var(--sds-typography-font-family);
|
|
64
|
+
font-size: 1rem;
|
|
65
|
+
font-weight: 400;
|
|
66
|
+
line-height: 1.25;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
.sds-switch__label--hidden:not(:focus):not(:active):not(:focus-within) {
|
|
70
|
+
clip-path: inset(50%);
|
|
71
|
+
height: 1px;
|
|
72
|
+
overflow: hidden;
|
|
73
|
+
position: absolute;
|
|
74
|
+
white-space: nowrap;
|
|
75
|
+
width: 1px;
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
.sds-switch__input {
|
|
79
|
+
--_switch-icon-position: var(--_switch-padding);
|
|
80
|
+
|
|
81
|
+
appearance: none;
|
|
82
|
+
cursor: pointer;
|
|
83
|
+
user-select: none;
|
|
84
|
+
|
|
85
|
+
inline-size: var(--_switch-width);
|
|
86
|
+
block-size: var(--_switch-height);
|
|
87
|
+
margin: 0;
|
|
88
|
+
|
|
89
|
+
flex-shrink: 0;
|
|
90
|
+
display: grid;
|
|
91
|
+
align-items: center;
|
|
92
|
+
grid: [track] 1fr / [track] 1fr;
|
|
93
|
+
|
|
94
|
+
transition: background-color var(--_switch-motion-duration);
|
|
95
|
+
border-radius: 1rem;
|
|
96
|
+
background-color: var(--sds-color-global-gray-300);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
.sds-switch__input::before {
|
|
100
|
+
content: '';
|
|
101
|
+
grid-area: track;
|
|
102
|
+
inline-size: var(--_switch-icon-size);
|
|
103
|
+
block-size: var(--_switch-icon-size);
|
|
104
|
+
|
|
105
|
+
background-color: var(--sds-color-semantic-border-default);
|
|
106
|
+
transition: transform var(--_switch-motion-duration);
|
|
107
|
+
border-radius: 50%;
|
|
108
|
+
transform: translateX(var(--_switch-icon-position));
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
.sds-switch__input:focus-visible {
|
|
112
|
+
outline: 2px solid var(--sds-color-semantic-border-focus);
|
|
113
|
+
outline-offset: 2px;
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
.sds-switch__input:checked {
|
|
117
|
+
--_switch-icon-position: calc(var(--_switch-width) - var(--_switch-icon-size) - var(--_switch-padding));
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
.sds-switch__input:checked::before {
|
|
121
|
+
content: url("data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' fill='%230072ce' viewBox='0 0 24 24'><path d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'></path></svg>");
|
|
122
|
+
background-color: var(--sds-color-semantic-surface-default);
|
|
123
|
+
}
|
|
124
|
+
`;
|
|
125
|
+
//# sourceMappingURL=sds-switch.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-switch.styles.js","sourceRoot":"","sources":["../../src/sds-switch/sds-switch.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA0HxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\tdisplay: inline-flex;\n\t\tcontain: layout style;\n\t\tbox-sizing: border-box;\n\t\talign-items: center;\n\t\tjustify-content: space-between;\n\t}\n\n\t:host([hidden]) {\n\t\tdisplay: none;\n\t}\n\n\t:host(:disabled),\n\t:host(:disabled) * {\n\t\tpointer-events: none;\n\t}\n\n\t:host(:disabled) .sds-switch__input:checked::before {\n\t\tcontent: url(\"data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' fill='%23C4C6C7' viewBox='0 0 24 24'><path d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'></path></svg>\");\n\t}\n\n\t:host(:disabled) .sds-switch__input:not(:checked)::before {\n\t\tdisplay: none;\n\t}\n\n\t:host(:disabled) .sds-switch__label {\n\t\tcolor: var(--sds-color-semantic-text-disabled);\n\t}\n\n\t.sds-switch {\n\t\t--_switch-motion-duration: 200ms;\n\t\t--_switch-height: 32px;\n\t\t--_switch-width: 60px;\n\t\t--_switch-padding: 8px;\n\t\t--_switch-icon-size: calc(var(--_switch-height) - (2 * var(--_switch-padding)));\n\n\t\tdisplay: flex;\n\t\tgap: 0.5rem;\n\t}\n\n\t.sds-switch--small {\n\t\t--_switch-height: 24px;\n\t\t--_switch-width: 48px;\n\t\t--_switch-padding: 6px;\n\t}\n\n\t.sds-switch:has(.sds-switch__input:checked) {\n\t\t--_switch-padding: 6px;\n\t}\n\n\t.sds-switch--small:has(.sds-switch__input:checked) {\n\t\t--_switch-padding: 4px;\n\t}\n\n\t.sds-switch__label {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tcursor: pointer;\n\t\tuser-select: none;\n\t\tcolor: var(--sds-color-semantic-text-default);\n\t\tfont-family: var(--sds-typography-font-family);\n\t\tfont-size: 1rem;\n\t\tfont-weight: 400;\n\t\tline-height: 1.25;\n\t}\n\n\t.sds-switch__label--hidden:not(:focus):not(:active):not(:focus-within) {\n\t\tclip-path: inset(50%);\n\t\theight: 1px;\n\t\toverflow: hidden;\n\t\tposition: absolute;\n\t\twhite-space: nowrap;\n\t\twidth: 1px;\n\t}\n\n\t.sds-switch__input {\n\t\t--_switch-icon-position: var(--_switch-padding);\n\n\t\tappearance: none;\n\t\tcursor: pointer;\n\t\tuser-select: none;\n\n\t\tinline-size: var(--_switch-width);\n\t\tblock-size: var(--_switch-height);\n\t\tmargin: 0;\n\n\t\tflex-shrink: 0;\n\t\tdisplay: grid;\n\t\talign-items: center;\n\t\tgrid: [track] 1fr / [track] 1fr;\n\n\t\ttransition: background-color var(--_switch-motion-duration);\n\t\tborder-radius: 1rem;\n\t\tbackground-color: var(--sds-color-global-gray-300);\n\t}\n\n\t.sds-switch__input::before {\n\t\tcontent: '';\n\t\tgrid-area: track;\n\t\tinline-size: var(--_switch-icon-size);\n\t\tblock-size: var(--_switch-icon-size);\n\n\t\tbackground-color: var(--sds-color-semantic-border-default);\n\t\ttransition: transform var(--_switch-motion-duration);\n\t\tborder-radius: 50%;\n\t\ttransform: translateX(var(--_switch-icon-position));\n\t}\n\n\t.sds-switch__input:focus-visible {\n\t\toutline: 2px solid var(--sds-color-semantic-border-focus);\n\t\toutline-offset: 2px;\n\t}\n\n\t.sds-switch__input:checked {\n\t\t--_switch-icon-position: calc(var(--_switch-width) - var(--_switch-icon-size) - var(--_switch-padding));\n\t}\n\n\t.sds-switch__input:checked::before {\n\t\tcontent: url(\"data:image/svg+xml;charset=UTF-8,<svg xmlns='http://www.w3.org/2000/svg' fill='%230072ce' viewBox='0 0 24 24'><path d='M9 16.17 4.83 12l-1.42 1.41L9 19 21 7l-1.41-1.41z'></path></svg>\");\n\t\tbackground-color: var(--sds-color-semantic-surface-default);\n\t}\n`;\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
type Size = 'l' | 'm' | 's';
|
|
3
|
+
export declare class SDSText extends LitElement {
|
|
4
|
+
static styles: import("lit").CSSResult[];
|
|
5
|
+
size: Size;
|
|
6
|
+
render(): import("lit").TemplateResult<1>;
|
|
7
|
+
}
|
|
8
|
+
declare global {
|
|
9
|
+
interface HTMLElementTagNameMap {
|
|
10
|
+
'sds-text': SDSText;
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=sds-text.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-text.d.ts","sourceRoot":"","sources":["../../src/sds-text/sds-text.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAQ,MAAM,KAAK,CAAC;AAKvC,KAAK,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,GAAG,CAAC;AAE5B,qBACa,OAAQ,SAAQ,UAAU;IAEtC,OAAgB,MAAM,4BAAY;IAIlC,IAAI,EAAE,IAAI,CAAO;IAER,MAAM;CAYf;AAED,OAAO,CAAC,MAAM,CAAC;IACd,UAAU,qBAAqB;QAC9B,UAAU,EAAE,OAAO,CAAC;KACpB;CACD"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html } from 'lit';
|
|
8
|
+
import { customElement, property } from 'lit/decorators.js';
|
|
9
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
10
|
+
import { styles } from './sds-text.styles';
|
|
11
|
+
let SDSText = class SDSText extends LitElement {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
// Reactive Props
|
|
15
|
+
this.size = 'l';
|
|
16
|
+
}
|
|
17
|
+
render() {
|
|
18
|
+
const styleClasses = {
|
|
19
|
+
'sds-text': true,
|
|
20
|
+
'sds-text--l': this.size === 'l',
|
|
21
|
+
'sds-text--m': this.size === 'm',
|
|
22
|
+
'sds-text--s': this.size === 's',
|
|
23
|
+
};
|
|
24
|
+
const classes = classMap(styleClasses);
|
|
25
|
+
return html `<p class=${classes}><slot></slot></p>`;
|
|
26
|
+
}
|
|
27
|
+
};
|
|
28
|
+
// Styling
|
|
29
|
+
SDSText.styles = [styles];
|
|
30
|
+
__decorate([
|
|
31
|
+
property({ type: String })
|
|
32
|
+
], SDSText.prototype, "size", void 0);
|
|
33
|
+
SDSText = __decorate([
|
|
34
|
+
customElement('sds-text')
|
|
35
|
+
], SDSText);
|
|
36
|
+
export { SDSText };
|
|
37
|
+
//# sourceMappingURL=sds-text.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-text.js","sourceRoot":"","sources":["../../src/sds-text/sds-text.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,MAAM,KAAK,CAAC;AACvC,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,mBAAmB,CAAC;AAKpC,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,UAAU;IAAhC;;QAIN,iBAAiB;QAEjB,SAAI,GAAS,GAAG,CAAC;IAclB,CAAC;IAZS,MAAM;QACd,MAAM,YAAY,GAAG;YACpB,UAAU,EAAE,IAAI;YAChB,aAAa,EAAE,IAAI,CAAC,IAAI,KAAK,GAAG;YAChC,aAAa,EAAE,IAAI,CAAC,IAAI,KAAK,GAAG;YAChC,aAAa,EAAE,IAAI,CAAC,IAAI,KAAK,GAAG;SAChC,CAAC;QAEF,MAAM,OAAO,GAAG,QAAQ,CAAC,YAAY,CAAC,CAAC;QAEvC,OAAO,IAAI,CAAA,YAAY,OAAO,oBAAoB,CAAC;IACpD,CAAC;;AAlBD,UAAU;AACM,cAAM,GAAG,CAAC,MAAM,CAAC,AAAX,CAAY;AAIlC;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;qCACV;AANL,OAAO;IADnB,aAAa,CAAC,UAAU,CAAC;GACb,OAAO,CAoBnB","sourcesContent":["import { LitElement, html } from 'lit';\nimport { customElement, property } from 'lit/decorators.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './sds-text.styles';\n\ntype Size = 'l' | 'm' | 's';\n\n@customElement('sds-text')\nexport class SDSText extends LitElement {\n\t// Styling\n\tstatic override styles = [styles];\n\n\t// Reactive Props\n\t@property({ type: String })\n\tsize: Size = 'l';\n\n\toverride render() {\n\t\tconst styleClasses = {\n\t\t\t'sds-text': true,\n\t\t\t'sds-text--l': this.size === 'l',\n\t\t\t'sds-text--m': this.size === 'm',\n\t\t\t'sds-text--s': this.size === 's',\n\t\t};\n\n\t\tconst classes = classMap(styleClasses);\n\n\t\treturn html`<p class=${classes}><slot></slot></p>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-text': SDSText;\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-text.styles.d.ts","sourceRoot":"","sources":["../../src/sds-text/sds-text.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBA4BlB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
display: block;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
.sds-text {
|
|
8
|
+
font-family: var(--sds-typography-font-family);
|
|
9
|
+
font-weight: 400;
|
|
10
|
+
color: var(--sds-color-semantic-text-default);
|
|
11
|
+
margin: 0;
|
|
12
|
+
max-width: var(--sds-typography-max-line-width);
|
|
13
|
+
padding: 0;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
.sds-text--l {
|
|
17
|
+
font-size: 1.125rem;
|
|
18
|
+
line-height: 1.222;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
.sds-text--m {
|
|
22
|
+
font-size: 1rem;
|
|
23
|
+
line-height: 1.25;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
.sds-text--s {
|
|
27
|
+
font-size: 0.875rem;
|
|
28
|
+
line-height: 1.285;
|
|
29
|
+
}
|
|
30
|
+
`;
|
|
31
|
+
//# sourceMappingURL=sds-text.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-text.styles.js","sourceRoot":"","sources":["../../src/sds-text/sds-text.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA4BxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\tdisplay: block;\n\t}\n\n\t.sds-text {\n\t\tfont-family: var(--sds-typography-font-family);\n\t\tfont-weight: 400;\n\t\tcolor: var(--sds-color-semantic-text-default);\n\t\tmargin: 0;\n\t\tmax-width: var(--sds-typography-max-line-width);\n\t\tpadding: 0;\n\t}\n\n\t.sds-text--l {\n\t\tfont-size: 1.125rem;\n\t\tline-height: 1.222;\n\t}\n\n\t.sds-text--m {\n\t\tfont-size: 1rem;\n\t\tline-height: 1.25;\n\t}\n\n\t.sds-text--s {\n\t\tfont-size: 0.875rem;\n\t\tline-height: 1.285;\n\t}\n`;\n"]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { LitElement } from 'lit';
|
|
2
|
+
import '../sds-icon/sds-icon';
|
|
3
|
+
type InputType = 'text' | 'email' | 'tel' | 'number' | 'password' | 'search' | 'url';
|
|
4
|
+
export declare class SDSTextField extends LitElement {
|
|
5
|
+
static styles: import("lit").CSSResult[];
|
|
6
|
+
type: InputType;
|
|
7
|
+
value?: string;
|
|
8
|
+
name?: string;
|
|
9
|
+
label?: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
helpText?: string;
|
|
12
|
+
errorMessage?: string;
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
readOnly?: boolean;
|
|
15
|
+
autocomplete?: boolean;
|
|
16
|
+
private hasIcon;
|
|
17
|
+
private readonly handleSlotChange;
|
|
18
|
+
private readonly _handleInput;
|
|
19
|
+
private readonly _handleChange;
|
|
20
|
+
private readonly _handleSelect;
|
|
21
|
+
private readonly _handleFocus;
|
|
22
|
+
private readonly _handleBlur;
|
|
23
|
+
select(): void;
|
|
24
|
+
focus(): void;
|
|
25
|
+
blur(): void;
|
|
26
|
+
click(): void;
|
|
27
|
+
render(): import("lit").TemplateResult<1>;
|
|
28
|
+
}
|
|
29
|
+
declare global {
|
|
30
|
+
interface HTMLElementTagNameMap {
|
|
31
|
+
'sds-textfield': SDSTextField;
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
export {};
|
|
35
|
+
//# sourceMappingURL=sds-textfield.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"s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+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
import { LitElement, html, nothing } from 'lit';
|
|
8
|
+
import { customElement, property, state } from 'lit/decorators.js';
|
|
9
|
+
import { ifDefined } from 'lit/directives/if-defined.js';
|
|
10
|
+
import { classMap } from 'lit/directives/class-map.js';
|
|
11
|
+
import { styles } from './sds-textfield.styles';
|
|
12
|
+
import '../sds-icon/sds-icon';
|
|
13
|
+
let SDSTextField = class SDSTextField extends LitElement {
|
|
14
|
+
constructor() {
|
|
15
|
+
super(...arguments);
|
|
16
|
+
// Props
|
|
17
|
+
this.type = 'text';
|
|
18
|
+
this.disabled = false;
|
|
19
|
+
this.readOnly = false;
|
|
20
|
+
this.autocomplete = false;
|
|
21
|
+
// State
|
|
22
|
+
this.hasIcon = false;
|
|
23
|
+
this.handleSlotChange = (e) => {
|
|
24
|
+
const slot = e.target;
|
|
25
|
+
this.hasIcon = slot.assignedNodes({ flatten: true }).length > 0;
|
|
26
|
+
};
|
|
27
|
+
// Event handling
|
|
28
|
+
this._handleInput = (event) => {
|
|
29
|
+
event.stopImmediatePropagation();
|
|
30
|
+
if (!this.disabled) {
|
|
31
|
+
this.dispatchEvent(new CustomEvent('input', {
|
|
32
|
+
detail: { value: event.target.value },
|
|
33
|
+
bubbles: true,
|
|
34
|
+
composed: true,
|
|
35
|
+
}));
|
|
36
|
+
}
|
|
37
|
+
};
|
|
38
|
+
this._handleChange = (event) => {
|
|
39
|
+
event.stopImmediatePropagation();
|
|
40
|
+
if (!this.disabled) {
|
|
41
|
+
this.dispatchEvent(new CustomEvent('change', {
|
|
42
|
+
detail: { value: event.target.value },
|
|
43
|
+
bubbles: true,
|
|
44
|
+
composed: true,
|
|
45
|
+
}));
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
this._handleSelect = (event) => {
|
|
49
|
+
event.stopImmediatePropagation();
|
|
50
|
+
if (!this.disabled) {
|
|
51
|
+
const target = event.target;
|
|
52
|
+
const selectedText = target.value.substring(target.selectionStart ?? 0, target.selectionEnd ?? 0);
|
|
53
|
+
this.dispatchEvent(new CustomEvent('select', {
|
|
54
|
+
detail: { selectedText },
|
|
55
|
+
bubbles: true,
|
|
56
|
+
composed: true,
|
|
57
|
+
}));
|
|
58
|
+
}
|
|
59
|
+
};
|
|
60
|
+
this._handleFocus = (event) => {
|
|
61
|
+
event.stopImmediatePropagation();
|
|
62
|
+
this.dispatchEvent(new CustomEvent('focus', {
|
|
63
|
+
detail: { value: event.target.value },
|
|
64
|
+
bubbles: true,
|
|
65
|
+
composed: true,
|
|
66
|
+
}));
|
|
67
|
+
};
|
|
68
|
+
this._handleBlur = (event) => {
|
|
69
|
+
event.stopImmediatePropagation();
|
|
70
|
+
this.dispatchEvent(new CustomEvent('blur', {
|
|
71
|
+
detail: { value: event.target.value },
|
|
72
|
+
bubbles: true,
|
|
73
|
+
composed: true,
|
|
74
|
+
}));
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
select() {
|
|
78
|
+
if (!this.disabled)
|
|
79
|
+
this.shadowRoot?.querySelector('input')?.select();
|
|
80
|
+
}
|
|
81
|
+
focus() {
|
|
82
|
+
if (!this.disabled)
|
|
83
|
+
this.shadowRoot?.querySelector('input')?.focus();
|
|
84
|
+
}
|
|
85
|
+
blur() {
|
|
86
|
+
if (!this.disabled)
|
|
87
|
+
this.shadowRoot?.querySelector('input')?.blur();
|
|
88
|
+
}
|
|
89
|
+
click() {
|
|
90
|
+
if (!this.disabled)
|
|
91
|
+
this.shadowRoot?.querySelector('input')?.click();
|
|
92
|
+
}
|
|
93
|
+
render() {
|
|
94
|
+
const textfieldClasses = {
|
|
95
|
+
'sds-textfield': true,
|
|
96
|
+
'sds-textfield--error': Boolean(this.errorMessage),
|
|
97
|
+
'sds-textfield--disabled': Boolean(this.disabled),
|
|
98
|
+
'sds-textfield--readonly': Boolean(this.readOnly),
|
|
99
|
+
'sds-textfield--has-icon': this.hasIcon,
|
|
100
|
+
};
|
|
101
|
+
return html ` <div class="${classMap(textfieldClasses)}">
|
|
102
|
+
${this.label
|
|
103
|
+
? html `<label for="sds-textfield" class="sds-textfield__label">${this.label}</label>`
|
|
104
|
+
: nothing}
|
|
105
|
+
${this.helpText ? html `<p class="sds-textfield__help-text">${this.helpText}</p>` : nothing}
|
|
106
|
+
<div class="sds-textfield__input-container">
|
|
107
|
+
<input
|
|
108
|
+
class="sds-textfield__input"
|
|
109
|
+
type="${this.type}"
|
|
110
|
+
id="sds-textfield"
|
|
111
|
+
?disabled="${this.disabled}"
|
|
112
|
+
?readonly="${this.readOnly}"
|
|
113
|
+
placeholder="${ifDefined(this.placeholder)}"
|
|
114
|
+
value="${ifDefined(this.value)}"
|
|
115
|
+
name="${ifDefined(this.name)}"
|
|
116
|
+
autocomplete="${this.autocomplete ? 'on' : 'off'}"
|
|
117
|
+
@input="${this._handleInput}"
|
|
118
|
+
@change="${this._handleChange}"
|
|
119
|
+
@select="${this._handleSelect}"
|
|
120
|
+
@focus="${this._handleFocus}"
|
|
121
|
+
@blur="${this._handleBlur}"
|
|
122
|
+
/>
|
|
123
|
+
<slot name="after" @slotchange="${this.handleSlotChange}" aria-hidden="true"></slot>
|
|
124
|
+
</div>
|
|
125
|
+
${this.errorMessage
|
|
126
|
+
? html `<p class="sds-textfield__error-message">
|
|
127
|
+
<sds-icon
|
|
128
|
+
name="warning-material-filled"
|
|
129
|
+
size="m"
|
|
130
|
+
color="${!this.disabled
|
|
131
|
+
? `var(--sds-color-semantic-icon-critical)`
|
|
132
|
+
: `var(--sds-color-semantic-icon-disabled)`}"
|
|
133
|
+
></sds-icon
|
|
134
|
+
>${this.errorMessage}
|
|
135
|
+
</p>`
|
|
136
|
+
: nothing}
|
|
137
|
+
</div>`;
|
|
138
|
+
}
|
|
139
|
+
};
|
|
140
|
+
// Styling
|
|
141
|
+
SDSTextField.styles = [styles];
|
|
142
|
+
__decorate([
|
|
143
|
+
property({ type: String })
|
|
144
|
+
], SDSTextField.prototype, "type", void 0);
|
|
145
|
+
__decorate([
|
|
146
|
+
property({ type: String })
|
|
147
|
+
], SDSTextField.prototype, "value", void 0);
|
|
148
|
+
__decorate([
|
|
149
|
+
property({ type: String })
|
|
150
|
+
], SDSTextField.prototype, "name", void 0);
|
|
151
|
+
__decorate([
|
|
152
|
+
property({ type: String })
|
|
153
|
+
], SDSTextField.prototype, "label", void 0);
|
|
154
|
+
__decorate([
|
|
155
|
+
property({ type: String })
|
|
156
|
+
], SDSTextField.prototype, "placeholder", void 0);
|
|
157
|
+
__decorate([
|
|
158
|
+
property({ type: String, attribute: 'help-text' })
|
|
159
|
+
], SDSTextField.prototype, "helpText", void 0);
|
|
160
|
+
__decorate([
|
|
161
|
+
property({ type: String, attribute: 'error-message' })
|
|
162
|
+
], SDSTextField.prototype, "errorMessage", void 0);
|
|
163
|
+
__decorate([
|
|
164
|
+
property({ type: Boolean })
|
|
165
|
+
], SDSTextField.prototype, "disabled", void 0);
|
|
166
|
+
__decorate([
|
|
167
|
+
property({ type: Boolean, attribute: 'readonly' })
|
|
168
|
+
], SDSTextField.prototype, "readOnly", void 0);
|
|
169
|
+
__decorate([
|
|
170
|
+
property({ type: Boolean })
|
|
171
|
+
], SDSTextField.prototype, "autocomplete", void 0);
|
|
172
|
+
__decorate([
|
|
173
|
+
state()
|
|
174
|
+
], SDSTextField.prototype, "hasIcon", void 0);
|
|
175
|
+
SDSTextField = __decorate([
|
|
176
|
+
customElement('sds-textfield')
|
|
177
|
+
], SDSTextField);
|
|
178
|
+
export { SDSTextField };
|
|
179
|
+
//# sourceMappingURL=sds-textfield.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-textfield.js","sourceRoot":"","sources":["../../src/sds-textfield/sds-textfield.ts"],"names":[],"mappings":";;;;;;AAAA,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,KAAK,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,6BAA6B,CAAC;AACvD,OAAO,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AAEhD,OAAO,sBAAsB,CAAC;AAKvB,IAAM,YAAY,GAAlB,MAAM,YAAa,SAAQ,UAAU;IAArC;;QAIN,QAAQ;QAER,SAAI,GAAc,MAAM,CAAC;QAqBzB,aAAQ,GAAa,KAAK,CAAC;QAG3B,aAAQ,GAAa,KAAK,CAAC;QAG3B,iBAAY,GAAa,KAAK,CAAC;QAE/B,QAAQ;QAEA,YAAO,GAAG,KAAK,CAAC;QAEP,qBAAgB,GAAG,CAAC,CAAQ,EAAE,EAAE;YAChD,MAAM,IAAI,GAAG,CAAC,CAAC,MAAyB,CAAC;YACzC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,aAAa,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;QACjE,CAAC,CAAC;QAEF,iBAAiB;QACA,iBAAY,GAAG,CAAC,KAAiB,EAAE,EAAE;YACrD,KAAK,CAAC,wBAAwB,EAAE,CAAC;YACjC,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;gBACpB,IAAI,CAAC,aAAa,CACjB,IAAI,WAAW,CAAC,OAAO,EAAE;oBACxB,MAAM,EAAE,EAAE,KAAK,EAAG,KAAK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E,CAAC;0CACb;AAGd;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;2CACZ;AAGf;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC;iDACN;AAGrB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,WAAW,EAAE,CAAC;8CACjC;AAGlB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,eAAe,EAAE,CAAC;kDACjC;AAGtB;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;8CACD;AAG3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,CAAC;8CACxB;AAG3B;IADC,QAAQ,CAAC,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;kDACG;AAIvB;IADP,KAAK,EAAE;6CACgB;AArCZ,YAAY;IADxB,aAAa,CAAC,eAAe,CAAC;GAClB,YAAY,CA4KxB","sourcesContent":["import { LitElement, html, nothing } from 'lit';\nimport { customElement, property, state } from 'lit/decorators.js';\nimport { ifDefined } from 'lit/directives/if-defined.js';\nimport { classMap } from 'lit/directives/class-map.js';\nimport { styles } from './sds-textfield.styles';\n\nimport '../sds-icon/sds-icon';\n\ntype InputType = 'text' | 'email' | 'tel' | 'number' | 'password' | 'search' | 'url';\n\n@customElement('sds-textfield')\nexport class SDSTextField extends LitElement {\n\t// Styling\n\tstatic override styles = [styles];\n\n\t// Props\n\t@property({ type: String })\n\ttype: InputType = 'text';\n\n\t@property({ type: String })\n\tvalue?: string;\n\n\t@property({ type: String })\n\tname?: string;\n\n\t@property({ type: String })\n\tlabel?: string;\n\n\t@property({ type: String })\n\tplaceholder?: string;\n\n\t@property({ type: String, attribute: 'help-text' })\n\thelpText?: string;\n\n\t@property({ type: String, attribute: 'error-message' })\n\terrorMessage?: string;\n\n\t@property({ type: Boolean })\n\tdisabled?: boolean = false;\n\n\t@property({ type: Boolean, attribute: 'readonly' })\n\treadOnly?: boolean = false;\n\n\t@property({ type: Boolean })\n\tautocomplete?: boolean = false;\n\n\t// State\n\t@state()\n\tprivate hasIcon = false;\n\n\tprivate readonly handleSlotChange = (e: Event) => {\n\t\tconst slot = e.target as HTMLSlotElement;\n\t\tthis.hasIcon = slot.assignedNodes({ flatten: true }).length > 0;\n\t};\n\n\t// Event handling\n\tprivate readonly _handleInput = (event: InputEvent) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (!this.disabled) {\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('input', {\n\t\t\t\t\tdetail: { value: (event.target as HTMLInputElement).value },\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t};\n\n\tprivate readonly _handleChange = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (!this.disabled) {\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('change', {\n\t\t\t\t\tdetail: { value: (event.target as HTMLInputElement).value },\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t};\n\n\tprivate readonly _handleSelect = (event: Event) => {\n\t\tevent.stopImmediatePropagation();\n\t\tif (!this.disabled) {\n\t\t\tconst target = event.target as HTMLInputElement;\n\t\t\tconst selectedText = target.value.substring(target.selectionStart ?? 0, target.selectionEnd ?? 0);\n\n\t\t\tthis.dispatchEvent(\n\t\t\t\tnew CustomEvent('select', {\n\t\t\t\t\tdetail: { selectedText },\n\t\t\t\t\tbubbles: true,\n\t\t\t\t\tcomposed: true,\n\t\t\t\t})\n\t\t\t);\n\t\t}\n\t};\n\n\tprivate readonly _handleFocus = (event: FocusEvent) => {\n\t\tevent.stopImmediatePropagation();\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('focus', {\n\t\t\t\tdetail: { value: (event.target as HTMLInputElement).value },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t})\n\t\t);\n\t};\n\n\tprivate readonly _handleBlur = (event: FocusEvent) => {\n\t\tevent.stopImmediatePropagation();\n\t\tthis.dispatchEvent(\n\t\t\tnew CustomEvent('blur', {\n\t\t\t\tdetail: { value: (event.target as HTMLInputElement).value },\n\t\t\t\tbubbles: true,\n\t\t\t\tcomposed: true,\n\t\t\t})\n\t\t);\n\t};\n\n\tselect(): void {\n\t\tif (!this.disabled) this.shadowRoot?.querySelector('input')?.select();\n\t}\n\n\toverride focus(): void {\n\t\tif (!this.disabled) this.shadowRoot?.querySelector('input')?.focus();\n\t}\n\n\toverride blur(): void {\n\t\tif (!this.disabled) this.shadowRoot?.querySelector('input')?.blur();\n\t}\n\n\toverride click(): void {\n\t\tif (!this.disabled) this.shadowRoot?.querySelector('input')?.click();\n\t}\n\n\toverride render() {\n\t\tconst textfieldClasses = {\n\t\t\t'sds-textfield': true,\n\t\t\t'sds-textfield--error': Boolean(this.errorMessage),\n\t\t\t'sds-textfield--disabled': Boolean(this.disabled),\n\t\t\t'sds-textfield--readonly': Boolean(this.readOnly),\n\t\t\t'sds-textfield--has-icon': this.hasIcon,\n\t\t};\n\n\t\treturn html` <div class=\"${classMap(textfieldClasses)}\">\n\t\t\t${this.label\n\t\t\t\t? html`<label for=\"sds-textfield\" class=\"sds-textfield__label\">${this.label}</label>`\n\t\t\t\t: nothing}\n\t\t\t${this.helpText ? html`<p class=\"sds-textfield__help-text\">${this.helpText}</p>` : nothing}\n\t\t\t<div class=\"sds-textfield__input-container\">\n\t\t\t\t<input\n\t\t\t\t\tclass=\"sds-textfield__input\"\n\t\t\t\t\ttype=\"${this.type}\"\n\t\t\t\t\tid=\"sds-textfield\"\n\t\t\t\t\t?disabled=\"${this.disabled}\"\n\t\t\t\t\t?readonly=\"${this.readOnly}\"\n\t\t\t\t\tplaceholder=\"${ifDefined(this.placeholder)}\"\n\t\t\t\t\tvalue=\"${ifDefined(this.value)}\"\n\t\t\t\t\tname=\"${ifDefined(this.name)}\"\n\t\t\t\t\tautocomplete=\"${this.autocomplete ? 'on' : 'off'}\"\n\t\t\t\t\t@input=\"${this._handleInput}\"\n\t\t\t\t\t@change=\"${this._handleChange}\"\n\t\t\t\t\t@select=\"${this._handleSelect}\"\n\t\t\t\t\t@focus=\"${this._handleFocus}\"\n\t\t\t\t\t@blur=\"${this._handleBlur}\"\n\t\t\t\t/>\n\t\t\t\t<slot name=\"after\" @slotchange=\"${this.handleSlotChange}\" aria-hidden=\"true\"></slot>\n\t\t\t</div>\n\t\t\t${this.errorMessage\n\t\t\t\t? html`<p class=\"sds-textfield__error-message\">\n\t\t\t\t\t\t<sds-icon\n\t\t\t\t\t\t\tname=\"warning-material-filled\"\n\t\t\t\t\t\t\tsize=\"m\"\n\t\t\t\t\t\t\tcolor=\"${!this.disabled\n\t\t\t\t\t\t\t\t? `var(--sds-color-semantic-icon-critical)`\n\t\t\t\t\t\t\t\t: `var(--sds-color-semantic-icon-disabled)`}\"\n\t\t\t\t\t\t></sds-icon\n\t\t\t\t\t\t>${this.errorMessage}\n\t\t\t\t\t</p>`\n\t\t\t\t: nothing}\n\t\t</div>`;\n\t}\n}\n\ndeclare global {\n\tinterface HTMLElementTagNameMap {\n\t\t'sds-textfield': SDSTextField;\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-textfield.styles.d.ts","sourceRoot":"","sources":["../../src/sds-textfield/sds-textfield.styles.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,MAAM,yBAiHlB,CAAC"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
import { css } from 'lit';
|
|
2
|
+
export const styles = css `
|
|
3
|
+
:host {
|
|
4
|
+
all: unset;
|
|
5
|
+
display: block;
|
|
6
|
+
text-align: start;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
.sds-textfield {
|
|
10
|
+
display: flex;
|
|
11
|
+
flex-direction: column;
|
|
12
|
+
gap: 0.25rem;
|
|
13
|
+
font-family: var(--sds-typography-font-family);
|
|
14
|
+
|
|
15
|
+
.sds-textfield__input-container {
|
|
16
|
+
max-width: var(--sds-typography-max-line-width);
|
|
17
|
+
position: relative;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
.sds-textfield__input {
|
|
21
|
+
box-sizing: border-box;
|
|
22
|
+
color: var(--sds-color-semantic-text-default);
|
|
23
|
+
padding: 0.75rem 1rem;
|
|
24
|
+
line-height: 1.25rem;
|
|
25
|
+
font-size: 1rem;
|
|
26
|
+
justify-content: flex-end;
|
|
27
|
+
border-radius: var(--sds-radius-4);
|
|
28
|
+
border: 1px solid var(--sds-color-semantic-border-default);
|
|
29
|
+
background: var(--sds-color-semantic-surface-default);
|
|
30
|
+
max-width: var(--sds-typography-max-line-width);
|
|
31
|
+
width: 100%;
|
|
32
|
+
|
|
33
|
+
&:hover {
|
|
34
|
+
border-color: var(--sds-color-semantic-border-strong);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
&:focus {
|
|
38
|
+
outline: 2px solid var(--sds-color-semantic-border-focus);
|
|
39
|
+
outline-offset: 1px;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&:active {
|
|
43
|
+
border-color: var(--sds-color-semantic-border-action);
|
|
44
|
+
outline: none;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
.sds-textfield__label {
|
|
49
|
+
color: var(--sds-color-semantic-text-default);
|
|
50
|
+
display: block;
|
|
51
|
+
font-size: 1rem;
|
|
52
|
+
font-weight: 500;
|
|
53
|
+
line-height: 1.5rem;
|
|
54
|
+
max-width: var(--sds-typography-max-line-width);
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
.sds-textfield__help-text {
|
|
58
|
+
color: var(--sds-color-semantic-text-subtle);
|
|
59
|
+
font-size: 1rem;
|
|
60
|
+
font-weight: 400;
|
|
61
|
+
line-height: 1.25rem;
|
|
62
|
+
margin: 0;
|
|
63
|
+
max-width: var(--sds-typography-max-line-width);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
.sds-textfield__error-message {
|
|
67
|
+
margin: 0;
|
|
68
|
+
max-width: var(--sds-typography-max-line-width);
|
|
69
|
+
align-items: flex-start;
|
|
70
|
+
color: var(--sds-color-semantic-text-default);
|
|
71
|
+
display: flex;
|
|
72
|
+
line-height: 1.5rem;
|
|
73
|
+
gap: 0.25rem;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
.sds-textfield--error {
|
|
78
|
+
color: var(--sds-color-semantic-text-default);
|
|
79
|
+
line-height: 1.5rem;
|
|
80
|
+
|
|
81
|
+
.sds-textfield__input,
|
|
82
|
+
.sds-textfield__input:hover {
|
|
83
|
+
border-color: var(--sds-color-semantic-border-critical);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
.sds-textfield--disabled {
|
|
88
|
+
pointer-events: none;
|
|
89
|
+
|
|
90
|
+
.sds-textfield__label,
|
|
91
|
+
.sds-textfield__help-text,
|
|
92
|
+
.sds-textfield__error-message,
|
|
93
|
+
.sds-textfield__input {
|
|
94
|
+
color: var(--sds-color-semantic-text-disabled);
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
.sds-textfield__input {
|
|
98
|
+
border: 1px solid var(--sds-color-semantic-border-disabled);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
|
|
102
|
+
.sds-textfield--has-icon {
|
|
103
|
+
.sds-textfield__input {
|
|
104
|
+
padding-right: 3.5rem;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
::slotted([slot='after']) {
|
|
109
|
+
position: absolute;
|
|
110
|
+
top: 50%;
|
|
111
|
+
right: 1rem;
|
|
112
|
+
transform: translateY(-50%);
|
|
113
|
+
pointer-events: none;
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
116
|
+
//# sourceMappingURL=sds-textfield.styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sds-textfield.styles.js","sourceRoot":"","sources":["../../src/sds-textfield/sds-textfield.styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,KAAK,CAAC;AAE1B,MAAM,CAAC,MAAM,MAAM,GAAG,GAAG,CAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiHxB,CAAC","sourcesContent":["import { css } from 'lit';\n\nexport const styles = css`\n\t:host {\n\t\tall: unset;\n\t\tdisplay: block;\n\t\ttext-align: start;\n\t}\n\n\t.sds-textfield {\n\t\tdisplay: flex;\n\t\tflex-direction: column;\n\t\tgap: 0.25rem;\n\t\tfont-family: var(--sds-typography-font-family);\n\n\t\t.sds-textfield__input-container {\n\t\t\tmax-width: var(--sds-typography-max-line-width);\n\t\t\tposition: relative;\n\t\t}\n\n\t\t.sds-textfield__input {\n\t\t\tbox-sizing: border-box;\n\t\t\tcolor: var(--sds-color-semantic-text-default);\n\t\t\tpadding: 0.75rem 1rem;\n\t\t\tline-height: 1.25rem;\n\t\t\tfont-size: 1rem;\n\t\t\tjustify-content: flex-end;\n\t\t\tborder-radius: var(--sds-radius-4);\n\t\t\tborder: 1px solid var(--sds-color-semantic-border-default);\n\t\t\tbackground: var(--sds-color-semantic-surface-default);\n\t\t\tmax-width: var(--sds-typography-max-line-width);\n\t\t\twidth: 100%;\n\n\t\t\t&:hover {\n\t\t\t\tborder-color: var(--sds-color-semantic-border-strong);\n\t\t\t}\n\n\t\t\t&:focus {\n\t\t\t\toutline: 2px solid var(--sds-color-semantic-border-focus);\n\t\t\t\toutline-offset: 1px;\n\t\t\t}\n\n\t\t\t&:active {\n\t\t\t\tborder-color: var(--sds-color-semantic-border-action);\n\t\t\t\toutline: none;\n\t\t\t}\n\t\t}\n\n\t\t.sds-textfield__label {\n\t\t\tcolor: var(--sds-color-semantic-text-default);\n\t\t\tdisplay: block;\n\t\t\tfont-size: 1rem;\n\t\t\tfont-weight: 500;\n\t\t\tline-height: 1.5rem;\n\t\t\tmax-width: var(--sds-typography-max-line-width);\n\t\t}\n\n\t\t.sds-textfield__help-text {\n\t\t\tcolor: var(--sds-color-semantic-text-subtle);\n\t\t\tfont-size: 1rem;\n\t\t\tfont-weight: 400;\n\t\t\tline-height: 1.25rem;\n\t\t\tmargin: 0;\n\t\t\tmax-width: var(--sds-typography-max-line-width);\n\t\t}\n\n\t\t.sds-textfield__error-message {\n\t\t\tmargin: 0;\n\t\t\tmax-width: var(--sds-typography-max-line-width);\n\t\t\talign-items: flex-start;\n\t\t\tcolor: var(--sds-color-semantic-text-default);\n\t\t\tdisplay: flex;\n\t\t\tline-height: 1.5rem;\n\t\t\tgap: 0.25rem;\n\t\t}\n\t}\n\n\t.sds-textfield--error {\n\t\tcolor: var(--sds-color-semantic-text-default);\n\t\tline-height: 1.5rem;\n\n\t\t.sds-textfield__input,\n\t\t.sds-textfield__input:hover {\n\t\t\tborder-color: var(--sds-color-semantic-border-critical);\n\t\t}\n\t}\n\n\t.sds-textfield--disabled {\n\t\tpointer-events: none;\n\n\t\t.sds-textfield__label,\n\t\t.sds-textfield__help-text,\n\t\t.sds-textfield__error-message,\n\t\t.sds-textfield__input {\n\t\t\tcolor: var(--sds-color-semantic-text-disabled);\n\t\t}\n\n\t\t.sds-textfield__input {\n\t\t\tborder: 1px solid var(--sds-color-semantic-border-disabled);\n\t\t}\n\t}\n\n\t.sds-textfield--has-icon {\n\t\t.sds-textfield__input {\n\t\t\tpadding-right: 3.5rem;\n\t\t}\n\t}\n\n\t::slotted([slot='after']) {\n\t\tposition: absolute;\n\t\ttop: 50%;\n\t\tright: 1rem;\n\t\ttransform: translateY(-50%);\n\t\tpointer-events: none;\n\t}\n`;\n"]}
|