@sebgroup/green-core 1.18.1 → 1.20.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.
Files changed (128) hide show
  1. package/chunks/{chunk.IQE6F4ZC.js → chunk.2RF5VP6K.js} +10 -24
  2. package/chunks/{chunk.7ZCWP4FY.js → chunk.3KJV6CHY.js} +2 -2
  3. package/chunks/{chunk.TN6ZYAH3.js → chunk.3RYYLMGT.js} +1 -1
  4. package/chunks/{chunk.ZEJDA4NS.js → chunk.5PHLJFEX.js} +4 -8
  5. package/chunks/{chunk.IYCENQZG.js → chunk.6LA2CKUM.js} +1 -1
  6. package/chunks/{chunk.WDJWH2TN.js → chunk.A62LO4CP.js} +1 -1
  7. package/chunks/{chunk.CHEU4C5J.js → chunk.BJCCPLEO.js} +2 -2
  8. package/chunks/{chunk.2Y3BHFKO.js → chunk.BKSMVF4C.js} +9 -1
  9. package/chunks/chunk.C3ECHGX7.js +31 -0
  10. package/chunks/{chunk.WEE5C637.js → chunk.CGZNEIGV.js} +6 -10
  11. package/chunks/{chunk.XXIQLCV7.js → chunk.CH2GIVY6.js} +41 -45
  12. package/chunks/{chunk.Q6AEDXQF.js → chunk.CUR4WRCG.js} +20 -24
  13. package/chunks/{chunk.URP77GWW.js → chunk.EC77QYRA.js} +3 -8
  14. package/chunks/{chunk.2LQSDOD4.js → chunk.EM7MZKG5.js} +12 -5
  15. package/chunks/{chunk.6L4FAOI6.js → chunk.GOOHCUU6.js} +16 -11
  16. package/chunks/{chunk.6NM7ENKA.js → chunk.KBYQYDL3.js} +4 -1
  17. package/chunks/chunk.MURVRI5G.js +0 -0
  18. package/chunks/{chunk.XMPBXAGB.js → chunk.NBEFLQNK.js} +0 -1
  19. package/chunks/{chunk.MVCYVB3S.js → chunk.NRYXPR4Z.js} +4 -7
  20. package/chunks/{chunk.DBTRYFAB.js → chunk.NYOCHFZE.js} +5 -8
  21. package/chunks/{chunk.I2IU2N5F.js → chunk.PE6MD3MB.js} +3 -7
  22. package/chunks/{chunk.VDWYFSGX.js → chunk.RSCI4LL2.js} +5 -9
  23. package/chunks/chunk.TJA7LL3V.js +0 -0
  24. package/chunks/chunk.V7ZQ5N3U.js +0 -0
  25. package/chunks/{chunk.ETETI45J.js → chunk.VHKGMBUL.js} +3 -3
  26. package/chunks/chunk.VHN4JEZC.js +28 -0
  27. package/chunks/chunk.VOYMQ322.js +1 -1
  28. package/chunks/{chunk.3CAFC46K.js → chunk.W2XAWNZY.js} +4 -4
  29. package/chunks/chunk.W7CV3QYI.js +105 -0
  30. package/chunks/{chunk.YIQIH4RW.js → chunk.XOARVFGN.js} +1 -1
  31. package/chunks/chunk.Y42J4CV3.js +86 -0
  32. package/chunks/chunk.YBOK7MI7.js +31 -0
  33. package/chunks/chunk.YDYO7HP5.js +196 -0
  34. package/chunks/chunk.YEV6STTM.js +201 -0
  35. package/chunks/{chunk.H7YA5KO4.js → chunk.Z5NACNXH.js} +7 -23
  36. package/chunks/{chunk.XQ3SZZAO.js → chunk.ZLWSCK7R.js} +174 -119
  37. package/components/badge/badge.js +1 -1
  38. package/components/button/button.js +10 -9
  39. package/components/button/button.trans.styles.js +2 -1
  40. package/components/button/index.js +11 -9
  41. package/components/checkbox/checkbox.js +1 -1
  42. package/components/context-menu/context-menu.d.ts +0 -1
  43. package/components/context-menu/context-menu.js +9 -9
  44. package/components/context-menu/context-menu.trans.styles.js +2 -1
  45. package/components/context-menu/index.js +10 -10
  46. package/components/datepicker/date-part-spinner.js +1 -1
  47. package/components/datepicker/datepicker.d.ts +0 -1
  48. package/components/datepicker/datepicker.js +14 -13
  49. package/components/datepicker/datepicker.trans.styles.js +2 -1
  50. package/components/datepicker/index.js +14 -13
  51. package/components/dropdown/dropdown.d.ts +0 -1
  52. package/components/dropdown/dropdown.js +10 -10
  53. package/components/dropdown/dropdown.trans.styles.js +2 -1
  54. package/components/dropdown/index.js +11 -11
  55. package/components/filter-chips/filter-chip/filter-chip.d.ts +22 -0
  56. package/components/filter-chips/filter-chip/filter-chip.js +24 -0
  57. package/components/filter-chips/filter-chip/filter-chip.styles.d.ts +1 -0
  58. package/components/filter-chips/filter-chip/filter-chip.trans.styles.d.ts +2 -0
  59. package/components/filter-chips/filter-chip/filter-chip.trans.styles.js +11 -0
  60. package/components/filter-chips/filter-chip/index.d.ts +1 -0
  61. package/components/filter-chips/filter-chip/index.js +25 -0
  62. package/components/filter-chips/filter-chips.d.ts +36 -0
  63. package/components/filter-chips/filter-chips.js +28 -0
  64. package/components/filter-chips/filter-chips.styles.d.ts +1 -0
  65. package/components/filter-chips/filter-chips.trans.styles.d.ts +2 -0
  66. package/components/filter-chips/filter-chips.trans.styles.js +11 -0
  67. package/components/filter-chips/index.d.ts +2 -0
  68. package/components/filter-chips/index.js +32 -0
  69. package/components/form-control.js +4 -3
  70. package/components/grid/grid.d.ts +5 -12
  71. package/components/grid/grid.js +6 -3
  72. package/components/grid/grid.style.css.js +1 -1
  73. package/components/grid/index.js +6 -3
  74. package/components/grouped-list/grouped-list.d.ts +0 -1
  75. package/components/grouped-list/grouped-list.js +6 -6
  76. package/components/grouped-list/grouped-list.trans.styles.js +2 -1
  77. package/components/grouped-list/index.js +6 -6
  78. package/components/grouped-list/list-item.js +3 -2
  79. package/components/icon/icon.js +3 -2
  80. package/components/icon/index.js +4 -2
  81. package/components/index.d.ts +1 -0
  82. package/components/index.js +47 -32
  83. package/components/input/input.js +15 -39
  84. package/components/radio/radio-group.js +2 -2
  85. package/components/radio/radio.js +2 -2
  86. package/components/segmented-control/index.js +8 -7
  87. package/components/segmented-control/segment/index.js +5 -5
  88. package/components/segmented-control/segment/segment.js +5 -5
  89. package/components/segmented-control/segment/segment.trans.styles.js +2 -1
  90. package/components/segmented-control/segmented-control.d.ts +0 -2
  91. package/components/segmented-control/segmented-control.js +8 -7
  92. package/components/segmented-control/segmented-control.trans.styles.js +2 -1
  93. package/components/switch/switch.js +1 -1
  94. package/components/theme/index.js +4 -4
  95. package/components/theme/theme.js +4 -4
  96. package/components/theme/theme.trans.styles.js +3 -2
  97. package/controllers/dynamic-styles-controller.d.ts +23 -0
  98. package/dynamic-styles.d.ts +1 -0
  99. package/gds-element.d.ts +3 -0
  100. package/index.js +47 -32
  101. package/package.json +1 -1
  102. package/primitives/calendar/calendar.d.ts +0 -1
  103. package/primitives/calendar/calendar.js +5 -5
  104. package/primitives/calendar/index.js +5 -5
  105. package/primitives/listbox/index.js +6 -6
  106. package/primitives/listbox/listbox.d.ts +0 -1
  107. package/primitives/listbox/listbox.js +6 -6
  108. package/primitives/listbox/option.d.ts +0 -1
  109. package/primitives/listbox/option.js +5 -5
  110. package/primitives/menu/index.js +5 -5
  111. package/primitives/menu/menu-heading.js +4 -4
  112. package/primitives/menu/menu-item.d.ts +0 -1
  113. package/primitives/menu/menu-item.js +4 -4
  114. package/primitives/menu/menu.d.ts +0 -1
  115. package/primitives/menu/menu.js +5 -5
  116. package/primitives/popover/index.js +5 -5
  117. package/primitives/popover/popover.d.ts +0 -1
  118. package/primitives/popover/popover.js +5 -5
  119. package/primitives/ripple/index.js +2 -2
  120. package/primitives/ripple/ripple.js +2 -2
  121. package/transitional-styles.js +2 -2
  122. package/utils/decorators/resize-observer.d.ts +15 -0
  123. package/utils/directives/forward-attributes.d.ts +17 -0
  124. package/utils/helpers/attribute-converters.d.ts +14 -0
  125. package/utils/transitional-styles/transitional-styles.d.ts +4 -8
  126. package/chunks/chunk.X7MGCODG.js +0 -244
  127. /package/chunks/{chunk.HS7ICQNA.js → chunk.4ZADZSWE.js} +0 -0
  128. /package/chunks/{chunk.RSZ4ZUN3.js → chunk.JGTSJ4J6.js} +0 -0
@@ -0,0 +1,201 @@
1
+ import {
2
+ resizeObserver
3
+ } from "./chunk.VHN4JEZC.js";
4
+ import {
5
+ stringArrayConverter
6
+ } from "./chunk.C3ECHGX7.js";
7
+ import {
8
+ GdsFormControlElement
9
+ } from "./chunk.XOARVFGN.js";
10
+ import {
11
+ watch
12
+ } from "./chunk.2WO4NHJ2.js";
13
+ import {
14
+ gdsCustomElement,
15
+ html
16
+ } from "./chunk.VOYMQ322.js";
17
+ import {
18
+ __decorateClass,
19
+ __privateAdd,
20
+ __privateGet,
21
+ __privateMethod,
22
+ __privateSet
23
+ } from "./chunk.5VURDMKE.js";
24
+
25
+ // libs/core/src/components/filter-chips/filter-chips.ts
26
+ import { property, query, state } from "lit/decorators.js";
27
+ import { classMap } from "lit/directives/class-map.js";
28
+
29
+ // libs/core/src/components/filter-chips/filter-chips.styles.ts
30
+ import { css } from "lit";
31
+ var styles = css`
32
+ @layer base, reset, transitional-styles;
33
+ @layer base {
34
+ :host {
35
+ display: inline-block;
36
+ max-width: 100%;
37
+ }
38
+
39
+ .chips {
40
+ display: flex;
41
+ flex-wrap: wrap;
42
+ gap: 0.5rem;
43
+ }
44
+
45
+ .collapse {
46
+ overflow: auto;
47
+ scroll-snap-type: both mandatory;
48
+ overscroll-behavior-x: contain;
49
+ flex-wrap: nowrap;
50
+ padding-bottom: 0.5rem;
51
+ scrollbar-color: rgba(0, 0, 0, 0.5) transparent;
52
+ scrollbar-width: thin;
53
+ }
54
+
55
+ ::slotted(*) {
56
+ scroll-snap-align: start;
57
+ scroll-snap-stop: always;
58
+ }
59
+ }
60
+ `;
61
+
62
+ // libs/core/src/components/filter-chips/filter-chips.ts
63
+ var _handleChipClick, _collapseThreshold, _collapsedAt, _getChipHeight, getChipHeight_fn, _handleSlotChange, handleSlotChange_fn;
64
+ var GdsFilterChips = class extends GdsFormControlElement {
65
+ constructor() {
66
+ super(...arguments);
67
+ __privateAdd(this, _getChipHeight);
68
+ __privateAdd(this, _handleSlotChange);
69
+ this.multiple = false;
70
+ this.label = "";
71
+ this.rowCollapse = false;
72
+ this._collapsed = false;
73
+ __privateAdd(this, _handleChipClick, (event) => {
74
+ const clickedChip = this.chips.find(
75
+ (s) => s === event.target || s.contains(event.target)
76
+ );
77
+ if (clickedChip) {
78
+ if (this.multiple && Array.isArray(this.value)) {
79
+ if (clickedChip.selected) {
80
+ this.value = this.value.filter((v) => v !== clickedChip.value);
81
+ } else {
82
+ this.value = [...this.value, clickedChip.value];
83
+ }
84
+ } else {
85
+ this.value = clickedChip.value;
86
+ }
87
+ this.dispatchEvent(
88
+ new CustomEvent("change", {
89
+ detail: { clickedChip, value: this.value },
90
+ bubbles: true,
91
+ composed: true
92
+ })
93
+ );
94
+ }
95
+ });
96
+ __privateAdd(this, _collapseThreshold, 3);
97
+ __privateAdd(this, _collapsedAt, 0);
98
+ }
99
+ /**
100
+ * Returns the chips in the control
101
+ * @readonly
102
+ */
103
+ get chips() {
104
+ return this._elSlot ? this._elSlot.assignedElements() : [];
105
+ }
106
+ render() {
107
+ const layoutClasses = {
108
+ collapse: this._collapsed
109
+ };
110
+ return html`<div
111
+ class="chips ${classMap(layoutClasses)}"
112
+ role="listbox"
113
+ aria-label=${this.label}
114
+ aria-multiselectable=${this.multiple}
115
+ >
116
+ <slot
117
+ gds-allow="gds-filter-chip"
118
+ @click=${__privateGet(this, _handleChipClick)}
119
+ @slotchange=${__privateMethod(this, _handleSlotChange, handleSlotChange_fn)}
120
+ role="none"
121
+ ></slot>
122
+ </div>`;
123
+ }
124
+ _handleResize() {
125
+ if (!this.rowCollapse)
126
+ return;
127
+ const chipHeight = __privateMethod(this, _getChipHeight, getChipHeight_fn).call(this);
128
+ const selfHeight = this.offsetHeight;
129
+ const selfWidth = this.offsetWidth;
130
+ if (selfHeight >= chipHeight * __privateGet(this, _collapseThreshold)) {
131
+ this._collapsed = true;
132
+ __privateSet(this, _collapsedAt, selfWidth);
133
+ }
134
+ if (selfWidth > __privateGet(this, _collapsedAt)) {
135
+ this._collapsed = false;
136
+ }
137
+ }
138
+ _updateSelectedFromValue() {
139
+ if (!this.value)
140
+ return;
141
+ if (this.multiple && !Array.isArray(this.value)) {
142
+ this.value = [this.value];
143
+ }
144
+ if (!this.multiple && Array.isArray(this.value)) {
145
+ this.value = this.value[0];
146
+ }
147
+ this.updateComplete.then(() => {
148
+ this.chips.forEach((chip) => {
149
+ chip.selected = this.multiple ? this.value.includes(chip.value) : this.value === chip.value;
150
+ });
151
+ });
152
+ }
153
+ };
154
+ _handleChipClick = new WeakMap();
155
+ _collapseThreshold = new WeakMap();
156
+ _collapsedAt = new WeakMap();
157
+ _getChipHeight = new WeakSet();
158
+ getChipHeight_fn = function() {
159
+ var _a;
160
+ return ((_a = this.chips[0]) == null ? void 0 : _a.offsetHeight) || 0;
161
+ };
162
+ _handleSlotChange = new WeakSet();
163
+ handleSlotChange_fn = function() {
164
+ var _a;
165
+ const selChipValue = (_a = this.chips.find((s) => s.selected)) == null ? void 0 : _a.value;
166
+ if (selChipValue) {
167
+ this.value = selChipValue;
168
+ }
169
+ };
170
+ GdsFilterChips.styles = [styles];
171
+ __decorateClass([
172
+ property({ converter: stringArrayConverter })
173
+ ], GdsFilterChips.prototype, "value", 2);
174
+ __decorateClass([
175
+ property({ type: Boolean })
176
+ ], GdsFilterChips.prototype, "multiple", 2);
177
+ __decorateClass([
178
+ property()
179
+ ], GdsFilterChips.prototype, "label", 2);
180
+ __decorateClass([
181
+ property({ type: Boolean, attribute: "row-collapse" })
182
+ ], GdsFilterChips.prototype, "rowCollapse", 2);
183
+ __decorateClass([
184
+ state()
185
+ ], GdsFilterChips.prototype, "_collapsed", 2);
186
+ __decorateClass([
187
+ query("slot")
188
+ ], GdsFilterChips.prototype, "_elSlot", 2);
189
+ __decorateClass([
190
+ resizeObserver()
191
+ ], GdsFilterChips.prototype, "_handleResize", 1);
192
+ __decorateClass([
193
+ watch("value")
194
+ ], GdsFilterChips.prototype, "_updateSelectedFromValue", 1);
195
+ GdsFilterChips = __decorateClass([
196
+ gdsCustomElement("gds-filter-chips")
197
+ ], GdsFilterChips);
198
+
199
+ export {
200
+ GdsFilterChips
201
+ };
@@ -1,9 +1,13 @@
1
+ import {
2
+ dateArrayConverter,
3
+ dateConverter
4
+ } from "./chunk.C3ECHGX7.js";
1
5
  import {
2
6
  GdsFormControlElement
3
- } from "./chunk.YIQIH4RW.js";
7
+ } from "./chunk.XOARVFGN.js";
4
8
  import {
5
9
  TransitionalStyles
6
- } from "./chunk.XQ3SZZAO.js";
10
+ } from "./chunk.ZLWSCK7R.js";
7
11
  import {
8
12
  watch
9
13
  } from "./chunk.2WO4NHJ2.js";
@@ -42,22 +46,6 @@ var styles = css`
42
46
  `;
43
47
 
44
48
  // libs/core/src/components/datepicker/datepicker.ts
45
- var dateConverter = {
46
- fromAttribute(value) {
47
- return new Date(value);
48
- },
49
- toAttribute(value) {
50
- return value.toISOString();
51
- }
52
- };
53
- var dateArrayConverter = {
54
- fromAttribute(value) {
55
- return value.split(",").map((d) => new Date(d.trim()));
56
- },
57
- toAttribute(value) {
58
- return JSON.stringify(value.map((d) => d.toISOString()));
59
- }
60
- };
61
49
  var _valueOnOpen, _renderBackToValidRangeButton, renderBackToValidRangeButton_fn, _focusDate, focusDate_fn, _getSpinnerLabel, getSpinnerLabel_fn, _getMinSpinnerValue, getMinSpinnerValue_fn, _getMaxSpinnerValue, getMaxSpinnerValue_fn, _dispatchChangeEvent, dispatchChangeEvent_fn, _dispatchInputEvent, dispatchInputEvent_fn, _handleFieldFocusOut, _handleSpinnerFocus, _handleClipboardCopy, _handleClipboardPaste, _handleFieldClick, _handleCalendarChange, _handleMonthChange, _handleYearChange, _handleIncrementFocusedMonth, _handleDecrementFocusedMonth, _handleCalendarFocusChange, _handlePopoverStateChange, _handleSpinnerKeydown, _parseDateFormat, parseDateFormat_fn, _handleSpinnerChange, _spinnerState, _years, years_get, _isValueOutsideRange, isValueOutsideRange_get;
62
50
  var GdsDatepicker = class extends GdsFormControlElement {
63
51
  constructor() {
@@ -263,8 +251,7 @@ var GdsDatepicker = class extends GdsFormControlElement {
263
251
  TransitionalStyles.instance.apply(this, "gds-datepicker");
264
252
  }
265
253
  render() {
266
- return html`${this._tStyles}
267
- ${when(
254
+ return html`${when(
268
255
  this.label && !this.hideLabel,
269
256
  () => html`<label for="spinner-0" id="label">${this.label}</label>`
270
257
  )}
@@ -637,9 +624,6 @@ __decorateClass([
637
624
  __decorateClass([
638
625
  query(".input")
639
626
  ], GdsDatepicker.prototype, "_elInput", 2);
640
- __decorateClass([
641
- state()
642
- ], GdsDatepicker.prototype, "_tStyles", 2);
643
627
  __decorateClass([
644
628
  watch("value")
645
629
  ], GdsDatepicker.prototype, "_handleValueChange", 1);