@sebgroup/green-core 1.20.0 → 1.20.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (115) hide show
  1. package/chunks/{chunk.DFYMYEGD.js → chunk.2X23R32H.js} +0 -1
  2. package/chunks/{chunk.ZLWSCK7R.js → chunk.4QOFEG6G.js} +17 -8
  3. package/chunks/{chunk.CGZNEIGV.js → chunk.4ZTSWZUY.js} +6 -7
  4. package/chunks/{chunk.3KJV6CHY.js → chunk.5EPIZQO6.js} +2 -2
  5. package/chunks/{chunk.6LA2CKUM.js → chunk.73TOOYEY.js} +1 -1
  6. package/chunks/{chunk.YDYO7HP5.js → chunk.ATEP56AI.js} +2 -2
  7. package/chunks/{chunk.NYOCHFZE.js → chunk.BJOJYTQV.js} +5 -5
  8. package/chunks/{chunk.Z5NACNXH.js → chunk.BLKXWE5L.js} +2 -2
  9. package/chunks/{chunk.BKSMVF4C.js → chunk.DFTJBJPB.js} +1 -1
  10. package/chunks/{chunk.Y42J4CV3.js → chunk.FQUH54AY.js} +2 -2
  11. package/chunks/{chunk.PE6MD3MB.js → chunk.GJ4HS4M4.js} +3 -3
  12. package/chunks/{chunk.NRYXPR4Z.js → chunk.HHH2BCUH.js} +3 -4
  13. package/chunks/{chunk.RSCI4LL2.js → chunk.IKRRGS7G.js} +7 -6
  14. package/chunks/{chunk.YEV6STTM.js → chunk.JG4R6KQ7.js} +1 -1
  15. package/chunks/{chunk.GOOHCUU6.js → chunk.KMGYMMFU.js} +39 -11
  16. package/chunks/{chunk.VHKGMBUL.js → chunk.KPNRNWRS.js} +3 -3
  17. package/chunks/{chunk.BJCCPLEO.js → chunk.LZXR7Q7Q.js} +2 -2
  18. package/chunks/{chunk.5PHLJFEX.js → chunk.METO6ZWZ.js} +2 -3
  19. package/chunks/{chunk.XOARVFGN.js → chunk.MZSK66DN.js} +4 -1
  20. package/chunks/{chunk.EC77QYRA.js → chunk.NI33W56L.js} +2 -2
  21. package/chunks/{chunk.2RF5VP6K.js → chunk.PKBOP746.js} +4 -4
  22. package/chunks/{chunk.A62LO4CP.js → chunk.UDH3TBG6.js} +1 -1
  23. package/chunks/chunk.VOYMQ322.js +1 -1
  24. package/chunks/{chunk.CH2GIVY6.js → chunk.VXAUXCMI.js} +31 -5
  25. package/chunks/{chunk.CUR4WRCG.js → chunk.Z43CP7DK.js} +4 -4
  26. package/chunks/{chunk.W2XAWNZY.js → chunk.ZE4NFOBK.js} +4 -4
  27. package/chunks/{chunk.EM7MZKG5.js → chunk.ZQ4D5K7J.js} +5 -1
  28. package/components/button/button.d.ts +5 -2
  29. package/components/button/button.js +7 -8
  30. package/components/button/button.trans.styles.js +1 -1
  31. package/components/button/index.js +7 -8
  32. package/components/context-menu/context-menu.d.ts +1 -1
  33. package/components/context-menu/context-menu.js +9 -9
  34. package/components/context-menu/context-menu.trans.styles.js +1 -1
  35. package/components/context-menu/index.js +12 -12
  36. package/components/datepicker/datepicker.js +12 -12
  37. package/components/datepicker/datepicker.trans.styles.js +1 -1
  38. package/components/datepicker/index.js +12 -12
  39. package/components/dropdown/dropdown.d.ts +0 -1
  40. package/components/dropdown/dropdown.js +9 -9
  41. package/components/dropdown/dropdown.trans.styles.js +1 -1
  42. package/components/dropdown/index.js +10 -10
  43. package/components/filter-chips/filter-chip/filter-chip.d.ts +3 -5
  44. package/components/filter-chips/filter-chip/filter-chip.js +9 -10
  45. package/components/filter-chips/filter-chip/filter-chip.trans.styles.js +1 -1
  46. package/components/filter-chips/filter-chip/index.js +9 -10
  47. package/components/filter-chips/filter-chips.d.ts +8 -0
  48. package/components/filter-chips/filter-chips.js +11 -12
  49. package/components/filter-chips/filter-chips.trans.styles.js +1 -1
  50. package/components/filter-chips/index.js +11 -12
  51. package/components/form-control.d.ts +3 -0
  52. package/components/form-control.js +2 -2
  53. package/components/grid/grid.d.ts +6 -6
  54. package/components/grid/grid.js +3 -3
  55. package/components/grid/index.js +3 -3
  56. package/components/grouped-list/grouped-list.js +5 -5
  57. package/components/grouped-list/grouped-list.trans.styles.js +1 -1
  58. package/components/grouped-list/index.js +5 -5
  59. package/components/grouped-list/list-item.js +2 -2
  60. package/components/icon/icon.js +2 -2
  61. package/components/icon/index.js +2 -2
  62. package/components/index.js +44 -45
  63. package/components/radio/radio-group.js +70 -5
  64. package/components/segmented-control/index.js +7 -5
  65. package/components/segmented-control/segment/index.js +4 -4
  66. package/components/segmented-control/segment/segment.js +4 -4
  67. package/components/segmented-control/segment/segment.trans.styles.js +1 -1
  68. package/components/segmented-control/segmented-control.d.ts +1 -0
  69. package/components/segmented-control/segmented-control.js +7 -5
  70. package/components/segmented-control/segmented-control.trans.styles.js +1 -1
  71. package/components/theme/index.js +3 -3
  72. package/components/theme/theme.js +3 -3
  73. package/components/theme/theme.trans.styles.js +1 -1
  74. package/gds-element.d.ts +8 -1
  75. package/index.js +44 -45
  76. package/mixins/focusable.d.ts +1 -1
  77. package/package.json +4 -4
  78. package/primitives/calendar/calendar.d.ts +26 -0
  79. package/primitives/calendar/calendar.js +3 -3
  80. package/primitives/calendar/functions.d.ts +1 -1
  81. package/primitives/calendar/index.js +3 -3
  82. package/primitives/listbox/index.js +5 -5
  83. package/primitives/listbox/listbox.d.ts +0 -1
  84. package/primitives/listbox/listbox.js +5 -5
  85. package/primitives/listbox/option.d.ts +0 -1
  86. package/primitives/listbox/option.js +3 -3
  87. package/primitives/menu/index.js +5 -5
  88. package/primitives/menu/menu-heading.js +3 -3
  89. package/primitives/menu/menu-item.js +3 -3
  90. package/primitives/menu/menu.js +5 -5
  91. package/primitives/popover/index.js +3 -3
  92. package/primitives/popover/popover.js +3 -3
  93. package/primitives/ripple/index.js +2 -2
  94. package/primitives/ripple/ripple.js +2 -2
  95. package/transitional-styles.js +1 -1
  96. package/utils/decorators/observe-light-dom.d.ts +1 -1
  97. package/utils/decorators/resize-observer.d.ts +1 -1
  98. package/utils/decorators/watch-media-query.d.ts +1 -1
  99. package/utils/decorators/watch.d.ts +1 -1
  100. package/utils/helpers/custom-element-scoping.d.ts +1 -3
  101. package/utils/localization/localization.d.ts +1 -1
  102. package/chunks/chunk.3RYYLMGT.js +0 -74
  103. package/chunks/chunk.YBOK7MI7.js +0 -31
  104. package/components/badge/badge.d.ts +0 -43
  105. package/components/badge/badge.js +0 -245
  106. package/components/checkbox/checkbox.d.ts +0 -12
  107. package/components/checkbox/checkbox.js +0 -219
  108. package/components/input/input.d.ts +0 -69
  109. package/components/input/input.js +0 -658
  110. package/components/radio/radio.d.ts +0 -14
  111. package/components/radio/radio.js +0 -240
  112. package/components/switch/switch.d.ts +0 -12
  113. package/components/switch/switch.js +0 -164
  114. package/components/tooltip/tooltip.d.ts +0 -14
  115. package/components/tooltip/tooltip.js +0 -252
@@ -1,240 +0,0 @@
1
- import {
2
- GdsRadioGroup
3
- } from "../../chunks/chunk.3RYYLMGT.js";
4
- import "../../chunks/chunk.7TCXY7BP.js";
5
- import {
6
- constrainSlots
7
- } from "../../chunks/chunk.KBYQYDL3.js";
8
- import {
9
- __decorateClass,
10
- __privateAdd,
11
- __privateSet
12
- } from "../../chunks/chunk.5VURDMKE.js";
13
-
14
- // libs/core/src/components/radio/radio.ts
15
- import { LitElement, html, unsafeCSS } from "lit";
16
- import { customElement } from "lit/decorators.js";
17
-
18
- // libs/core/src/components/radio/radio.css
19
- var radio_default = `:host {
20
- --gds-checkbox-bg-color: hsl(0, 0%, 100%);
21
- --gds-checkbox-border-color: hsla(60, 4%, 50%, 1);
22
- --gds-checkbox-border-width: 1px;
23
- --gds-checkbox-border-radius: 200px;
24
- --gds-checkbox-color-hover: hsla(60, 6%, 90%, 1);
25
- --gds-checkbox-color-active: hsla(60, 4%, 85%, 1);
26
- --gds-checkbox-checked-color: hsla(60, 4%, 20%, 1);
27
- --gds-checkbox-color-tick: hsl(0, 0%, 100%);
28
- --gds-radio-transition: all 248ms ease-in-out;
29
- --gds-radio-transition-input: all 248ms cubic-bezier(0.2, 0.85, 0.32, 1.2);
30
- }
31
-
32
- @media (prefers-color-scheme: dark) {
33
- :host {
34
- --gds-dark: none;
35
- }
36
- }
37
-
38
- @media (prefers-reduced-motion: reduce) {
39
- :host {
40
- --gds-radio-transition: none;
41
- --gds-radio-transition-input: none;
42
- }
43
- }
44
-
45
- @media (prefers-reduced-transparency: reduce) {
46
- :host {
47
- --gds-input-transparency: 1;
48
- }
49
- }
50
-
51
- @media (prefers-contrast: more) {
52
- :host {
53
- --gds-input-color-bg: hsla(60, 4%, 96%, 1);
54
- --gds-input-color-outline-alpha: 0%;
55
- }
56
- }
57
-
58
- .gds-radio {
59
- align-items: center;
60
- border-radius: var(--gds-checkbox-border-radius);
61
- cursor: pointer;
62
- display: flex;
63
- height: 32px;
64
- justify-content: center;
65
- position: relative;
66
- transition: var(--gds-radio-transition);
67
- width: 32px;
68
-
69
- input {
70
- -webkit-appearance: none;
71
- -moz-appearance: none;
72
- appearance: none;
73
- aspect-ratio: 1/1;
74
- background-color: var(--gds-checkbox-bg-color);
75
- border: var(--gds-checkbox-border-width) solid
76
- var(--gds-checkbox-border-color);
77
- border-radius: var(--gds-checkbox-border-radius);
78
- box-sizing: border-box;
79
- cursor: pointer;
80
- height: 16px;
81
- margin: unset;
82
- padding: unset;
83
- position: relative;
84
- transition: var(--gds-radio-transition-input);
85
- width: 16px;
86
-
87
- &:checked {
88
- border-color: var(--gds-checkbox-checked-color);
89
- border-width: 4px;
90
- }
91
-
92
- &[indeterminate],
93
- &:indeterminate {
94
- &::after {
95
- border-left: 0;
96
- border-radius: 0;
97
- border-top: 0;
98
- height: var(--gds-checkbox-border-width);
99
- inset: 5px 0 0 2px;
100
- opacity: 1;
101
- rotate: 0deg;
102
- scale: 1;
103
- width: 8px;
104
- }
105
- }
106
-
107
- &:disabled {
108
- cursor: not-allowed;
109
- opacity: 0.5;
110
- }
111
- }
112
-
113
- &:hover:has(input:not([disabled])) {
114
- background-color: var(--gds-checkbox-color-hover);
115
- }
116
-
117
- &:active:has(input:not([disabled])) {
118
- background-color: var(--gds-checkbox-color-active);
119
-
120
- .gds-checkbox-core {
121
- border-color: var(--gds-checkbox-checked-color);
122
- }
123
- }
124
-
125
- &:has(input:checked) {
126
- background-color: var(--gds-checkbox-color-hover);
127
- }
128
-
129
- &:has(input:disabled) {
130
- cursor: not-allowed;
131
- }
132
-
133
- /* Invalid state */
134
- &:has(input:invalid) {
135
- --gds-checkbox-bg-color: hsla(13, 75%, 95%, 1);
136
- --gds-checkbox-border-color: hsla(9, 75%, 38%, 1);
137
- --gds-checkbox-color-hover: hsla(12, 75%, 91%, 1);
138
- --gds-checkbox-color-active: hsla(12, 78%, 86%, 1);
139
- --gds-checkbox-checked-color: hsla(9, 75%, 38%, 1);
140
- --gds-checkbox-color-tick: hsla(0, 0%, 100%, 1);
141
-
142
- input {
143
- &::after {
144
- border-color: var(--gds-checkbox-color-tick);
145
- }
146
-
147
- &:checked {
148
- background-color: var(--gds-checkbox-checked-color);
149
- border-color: var(--gds-checkbox-checked-color);
150
- color: var(--gds-checkbox-checked-color-tick);
151
- }
152
- }
153
-
154
- &:hover:has(input:not([disabled])) {
155
- background-color: var(--gds-checkbox-color-hover);
156
- }
157
-
158
- &:active:has(input:not([disabled])) {
159
- background-color: var(--gds-checkbox-color-active);
160
-
161
- .gds-checkbox-core {
162
- border-color: var(--gds-checkbox-checked-color);
163
- }
164
- }
165
-
166
- &:has(input:checked) {
167
- background-color: var(--gds-checkbox-color-hover);
168
- }
169
- }
170
- }
171
-
172
- .gds-radio-group {
173
- -webkit-appearance: none;
174
- -moz-appearance: none;
175
- appearance: none;
176
- border: 0;
177
- padding: 0;
178
- }
179
- `;
180
-
181
- // libs/core/src/components/radio/radio.ts
182
- var _internals;
183
- var GdsRadio = class extends LitElement {
184
- constructor() {
185
- super();
186
- // Private members
187
- __privateAdd(this, _internals, void 0);
188
- this.inputElement = null;
189
- this.exludeAttr = ["id", "label"];
190
- __privateSet(this, _internals, this.attachInternals());
191
- constrainSlots(this);
192
- }
193
- reflectAttributesToInput() {
194
- if (this.inputElement) {
195
- const attributes = this.attributes;
196
- for (let i = 0; i < attributes.length; i++) {
197
- const attribute = attributes[i];
198
- if (!this.exludeAttr.includes(attribute.name)) {
199
- this.inputElement.setAttribute(attribute.name, attribute.value);
200
- }
201
- }
202
- }
203
- }
204
- update(changedProperties) {
205
- var _a;
206
- super.update(changedProperties);
207
- if (!this.inputElement) {
208
- this.inputElement = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById(
209
- "radio"
210
- );
211
- }
212
- this.reflectAttributesToInput();
213
- }
214
- handleClick() {
215
- const radioGroup = this.closest("gds-radio-group");
216
- if (radioGroup instanceof GdsRadioGroup) {
217
- radioGroup.selectedValue = this.value;
218
- }
219
- }
220
- render() {
221
- return html`
222
- <label class="gds-radio">
223
- <input id="radio" type="radio" />
224
- </label>
225
- <label for="radio">${this.textContent}</label>
226
- `;
227
- }
228
- };
229
- _internals = new WeakMap();
230
- GdsRadio.styles = unsafeCSS(radio_default);
231
- GdsRadio.shadowRootOptions = {
232
- mode: "open",
233
- delegatesFocus: true
234
- };
235
- GdsRadio = __decorateClass([
236
- customElement("gds-radio")
237
- ], GdsRadio);
238
- export {
239
- GdsRadio
240
- };
@@ -1,12 +0,0 @@
1
- import { LitElement } from 'lit';
2
- export declare class GdsSwitch extends LitElement {
3
- #private;
4
- static styles: import("lit").CSSResult;
5
- static shadowRootOptions: ShadowRootInit;
6
- constructor();
7
- private inputElement;
8
- private exludeAttr;
9
- private reflectAttributesToInput;
10
- update(changedProperties: Map<PropertyKey, unknown>): void;
11
- render(): import("lit").TemplateResult<1>;
12
- }
@@ -1,164 +0,0 @@
1
- import "../../chunks/chunk.7TCXY7BP.js";
2
- import {
3
- constrainSlots
4
- } from "../../chunks/chunk.KBYQYDL3.js";
5
- import {
6
- __decorateClass,
7
- __privateAdd,
8
- __privateSet
9
- } from "../../chunks/chunk.5VURDMKE.js";
10
-
11
- // libs/core/src/components/switch/switch.ts
12
- import { LitElement, html, unsafeCSS } from "lit";
13
- import { customElement } from "lit/decorators.js";
14
-
15
- // libs/core/src/components/switch/switch.css
16
- var switch_default = `:host {
17
- --gds-checkbox-bg-color: hsl(0, 0%, 100%);
18
- --gds-checkbox-border-color: hsla(60, 4%, 20%, 1);
19
- --gds-checkbox-border-width: 7.5px;
20
- --gds-checkbox-border-radius: 200px;
21
- --gds-checkbox-color-hover: hsla(60, 6%, 90%, 1);
22
- --gds-checkbox-color-active: hsla(60, 4%, 85%, 1);
23
- --gds-checkbox-checked-color: hsla(130, 40%, 30%, 1);
24
- --gds-checkbox-color-tick: hsl(0, 0%, 100%);
25
- --gds-switch-transition: all 548ms ease-in-out;
26
- --gds-switch-animaton-on: 248ms;
27
- --gds-switch-animaton-off: 248ms;
28
- --gds-switch-animaton-transition: all 248ms cubic-bezier(0.2, 0.85, 0.32, 1.2);
29
- }
30
-
31
- @media (prefers-reduced-motion: reduce) {
32
- :host {
33
- --gds-switch-transition: none;
34
- --gds-switch-animaton-on: 0ms;
35
- --gds-switch-animaton-off: 0ms;
36
- --gds-switch-animaton-transition: none;
37
- }
38
- }
39
-
40
- .gds-switch {
41
- align-items: center;
42
- background-color: var(--gds-checkbox-color-hover);
43
- border-radius: var(--gds-checkbox-border-radius);
44
- cursor: pointer;
45
- display: flex;
46
- height: 32px;
47
- justify-content: flex-start;
48
- position: relative;
49
- transition: var(--gds-switch-transition);
50
- width: 64px;
51
-
52
- input {
53
- -webkit-appearance: none;
54
- -moz-appearance: none;
55
- appearance: none;
56
- background-color: var(--gds-checkbox-bg-color);
57
- border: var(--gds-checkbox-border-width) solid
58
- var(--gds-checkbox-border-color);
59
- border-radius: var(--gds-checkbox-border-radius);
60
- box-sizing: border-box;
61
- cursor: pointer;
62
- height: 32px;
63
- margin: unset;
64
- padding: unset;
65
- position: relative;
66
- transition: var(--gds-switch-animaton-transition);
67
- width: 32px;
68
-
69
- &:checked {
70
- animation: switch-on var(--gds-switch-animaton-on) forwards;
71
- border-color: var(--gds-checkbox-checked-color);
72
- }
73
-
74
- &:not(:checked) {
75
- animation: switch-off var(--gds-switch-animaton-off) backwards;
76
- }
77
- }
78
-
79
- &:has(input:checked) {
80
- background-color: var(--gds-checkbox-checked-color);
81
- }
82
-
83
- &:has(input:disabled) {
84
- cursor: not-allowed;
85
- opacity: 0.5;
86
- }
87
- }
88
-
89
- @keyframes switch-on {
90
- to {
91
- border-width: 0;
92
- transform: translate3d(100%, 0, 0) scale(0.5);
93
- width: 32px;
94
- }
95
- }
96
-
97
- @keyframes switch-off {
98
- from {
99
- border-width: 0;
100
- transform: translate3d(100%, 0, 0) scale(0.5);
101
- width: 32px;
102
- }
103
-
104
- to {
105
- border-width: 7.5px;
106
- transform: translate3d(0%, 0, 0) scale(1);
107
- width: 32px;
108
- }
109
- }
110
- `;
111
-
112
- // libs/core/src/components/switch/switch.ts
113
- var _internals;
114
- var GdsSwitch = class extends LitElement {
115
- constructor() {
116
- super();
117
- // Private members
118
- __privateAdd(this, _internals, void 0);
119
- this.inputElement = null;
120
- this.exludeAttr = ["id", "label"];
121
- __privateSet(this, _internals, this.attachInternals());
122
- constrainSlots(this);
123
- }
124
- reflectAttributesToInput() {
125
- if (this.inputElement) {
126
- const attributes = this.attributes;
127
- for (let i = 0; i < attributes.length; i++) {
128
- const attribute = attributes[i];
129
- if (!this.exludeAttr.includes(attribute.name)) {
130
- this.inputElement.setAttribute(attribute.name, attribute.value);
131
- }
132
- }
133
- }
134
- }
135
- update(changedProperties) {
136
- var _a;
137
- super.update(changedProperties);
138
- if (!this.inputElement) {
139
- this.inputElement = (_a = this.shadowRoot) == null ? void 0 : _a.getElementById(
140
- "switch"
141
- );
142
- }
143
- this.reflectAttributesToInput();
144
- }
145
- render() {
146
- return html`
147
- <label class="gds-switch">
148
- <input id="switch" type="checkbox" />
149
- </label>
150
- `;
151
- }
152
- };
153
- _internals = new WeakMap();
154
- GdsSwitch.styles = unsafeCSS(switch_default);
155
- GdsSwitch.shadowRootOptions = {
156
- mode: "open",
157
- delegatesFocus: true
158
- };
159
- GdsSwitch = __decorateClass([
160
- customElement("gds-switch")
161
- ], GdsSwitch);
162
- export {
163
- GdsSwitch
164
- };
@@ -1,14 +0,0 @@
1
- import { LitElement } from 'lit';
2
- /**
3
- * @element gds-tooltip
4
- *
5
- * @status beta
6
- */
7
- export declare class GdsTooltip extends LitElement {
8
- static styles: import("lit").CSSResult;
9
- static shadowRootOptions: ShadowRootInit;
10
- open: boolean;
11
- content: null;
12
- position: null;
13
- render(): import("lit").TemplateResult<1>;
14
- }
@@ -1,252 +0,0 @@
1
- import {
2
- __decorateClass
3
- } from "../../chunks/chunk.5VURDMKE.js";
4
-
5
- // libs/core/src/components/tooltip/tooltip.ts
6
- import { LitElement, html, unsafeCSS } from "lit";
7
- import { customElement, property } from "lit/decorators.js";
8
-
9
- // libs/core/src/components/tooltip/style/tooltip.styles.css
10
- var tooltip_styles_default = `@layer gds-tooltip, tokens, a11y, parts, position, trigger, keyframes;
11
-
12
- @layer gds-tooltip {
13
- @layer tokens {
14
- :host {
15
- --gds-tooltip-bg-color: #000;
16
- --gds-tooltip-bg-alpha: 90%;
17
- --gds-tooltip-fs: 14px;
18
- --gds-tooltip-bg: color-mix(
19
- in srgb,
20
- var(--gds-tooltip-bg-color) var(--gds-tooltip-bg-alpha),
21
- transparent
22
- );
23
- --gds-tooltip-color: #fff;
24
- --gds-tooltip-offset: 8px;
25
- --gds-tooltip-arrow: 6px;
26
- --gds-tooltip-radii: 8px;
27
- --gds-tooltip-transition-easing: var(--gds-sys-transition-easing);
28
- display: contents;
29
- position: relative;
30
- }
31
-
32
- @media (prefers-color-scheme: dark) {
33
- :host {
34
- --gds-tooltip-color-bg: var(
35
- --gds-tooltip-color-bg-dark,
36
- var(--gds-color-grey-20)
37
- );
38
- }
39
- }
40
- }
41
-
42
- .gds-tooltip {
43
- display: inline-block;
44
- position: relative;
45
-
46
- @layer a11y {
47
- --gds-tooltip-contrast: var(--gds-sys-transition);
48
- --gds-tooltip-transition: var(--gds-sys-transition);
49
- cursor: help;
50
- }
51
-
52
- @layer parts {
53
- &::before,
54
- &::after {
55
- align-items: center;
56
- display: none;
57
- font-size: var(--gds-tooltip-fs);
58
- justify-content: center;
59
- line-height: 1;
60
- opacity: 0;
61
- pointer-events: none;
62
- position: absolute;
63
- -webkit-user-select: none;
64
- -moz-user-select: none;
65
- user-select: none;
66
- }
67
-
68
- &::before {
69
- border: var(--gds-tooltip-arrow, 6px) solid transparent;
70
- content: '';
71
- z-index: 1001;
72
- }
73
-
74
- &::after {
75
- background-color: var(--gds-tooltip-bg);
76
- border-radius: var(--gds-tooltip-radii);
77
- color: var(--gds-tooltip-color);
78
- content: attr(content);
79
- max-inline-size: 50ch;
80
- min-inline-size: -moz-max-content;
81
- min-inline-size: max-content;
82
- offset-anchor: center top;
83
- overflow: hidden;
84
- padding-block: 1.5ex;
85
- padding-inline: 2ch;
86
- text-overflow: ellipsis;
87
- white-space: nowrap;
88
- z-index: 1000;
89
- }
90
-
91
- &:hover::before,
92
- &:hover::after {
93
- display: flex;
94
- }
95
- }
96
-
97
- @layer position {
98
- &:not([position])::before,
99
- &[position^='up']::before {
100
- border-bottom-width: 0;
101
- border-top-color: var(--gds-tooltip-bg);
102
- bottom: calc(100% + 2px);
103
- }
104
-
105
- &:not([position])::after,
106
- &[position^='up']::after {
107
- bottom: calc(100% + var(--gds-tooltip-offset, 8px));
108
- }
109
-
110
- &:not([position])::before,
111
- &:not([position])::after,
112
- &[position^='up']::before,
113
- &[position^='up']::after {
114
- left: 50%;
115
- transform: translate(-50%, calc(var(--gds-tooltip-offset, 8px) * -1));
116
- }
117
-
118
- &[position^='down']::before {
119
- border-bottom-color: var(--gds-tooltip-bg);
120
- border-top-width: 0;
121
- top: calc(100% + 2px);
122
- }
123
-
124
- &[position^='down']::after {
125
- top: calc(100% + var(--gds-tooltip-offset, 8px));
126
- }
127
-
128
- &[position^='down']::before,
129
- &[position^='down']::after {
130
- left: 50%;
131
- transform: translate(-50%, var(--gds-tooltip-offset, 8px));
132
- }
133
-
134
- &[position^='left']::before {
135
- border-left-color: var(--gds-tooltip-bg);
136
- border-right-width: 0;
137
- left: calc(-1px - var(--gds-tooltip-offset, 8px));
138
- top: 50%;
139
- transform: translate(calc(var(--gds-tooltip-offset, 8px) * -2), -50%);
140
- }
141
-
142
- &[position^='left']::after {
143
- right: calc(100% + var(--gds-tooltip-offset, 8px));
144
- top: 50%;
145
- transform: translate(calc(var(--gds-tooltip-offset, 8px) * -1), -50%);
146
- }
147
-
148
- &[position^='right']::before {
149
- border-left-width: 0;
150
- border-right-color: var(--gds-tooltip-bg);
151
- right: calc(-1px - var(--gds-tooltip-offset, 8px));
152
- top: 50%;
153
- transform: translate(var(--gds-tooltip-offset, 8px), -50%);
154
- }
155
-
156
- &[position^='right']::after {
157
- left: calc(100% + var(--gds-tooltip-offset, 8px));
158
- top: 50%;
159
- transform: translate(var(--gds-tooltip-offset, 8px), -50%);
160
- }
161
- }
162
-
163
- @layer trigger {
164
- &:hover:is(
165
- :not([position]),
166
- [position^='up'],
167
- [position^='down']
168
- )::before,
169
- &:hover:is(
170
- :not([position]),
171
- [position^='up'],
172
- [position^='down']
173
- )::after {
174
- animation: gds-tooltip-animation-y 300ms
175
- var(--gds-tooltip-transition-easing) forwards;
176
- }
177
-
178
- &:hover:is(
179
- :not([position]),
180
- [position^='left'],
181
- [position^='right']
182
- )::before,
183
- &:hover:is(
184
- :not([position]),
185
- [position^='left'],
186
- [position^='right']
187
- )::after {
188
- animation: gds-tooltip-animation-h 300ms
189
- var(--gds-tooltip-transition-easing) forwards;
190
- }
191
- }
192
- }
193
-
194
- @layer keyframes {
195
- @keyframes gds-tooltip-animation-y {
196
- to {
197
- opacity: 0.9;
198
- transform: translate(-50%, 0);
199
- }
200
- }
201
-
202
- @keyframes gds-tooltip-animation-h {
203
- to {
204
- opacity: 0.9;
205
- transform: translate(0, -50%);
206
- }
207
- }
208
- }
209
- }
210
- `;
211
-
212
- // libs/core/src/components/tooltip/tooltip.ts
213
- var GdsTooltip = class extends LitElement {
214
- constructor() {
215
- super(...arguments);
216
- this.open = false;
217
- this.content = null;
218
- this.position = null;
219
- }
220
- render() {
221
- return html`
222
- <div
223
- class="gds-tooltip"
224
- content=${this.content}
225
- position=${this.position}
226
- role="tooltip"
227
- >
228
- <slot slot="anchor"></slot>
229
- </div>
230
- `;
231
- }
232
- };
233
- GdsTooltip.styles = unsafeCSS(tooltip_styles_default);
234
- GdsTooltip.shadowRootOptions = {
235
- mode: "open",
236
- delegatesFocus: true
237
- };
238
- __decorateClass([
239
- property({ type: Boolean, reflect: true })
240
- ], GdsTooltip.prototype, "open", 2);
241
- __decorateClass([
242
- property({ type: String, reflect: true, attribute: "content" })
243
- ], GdsTooltip.prototype, "content", 2);
244
- __decorateClass([
245
- property({ type: String, reflect: true, attribute: "position" })
246
- ], GdsTooltip.prototype, "position", 2);
247
- GdsTooltip = __decorateClass([
248
- customElement("gds-tooltip")
249
- ], GdsTooltip);
250
- export {
251
- GdsTooltip
252
- };