@cupra/ui-kit 2.0.0-canary.82 → 2.0.0-canary.84

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 (77) hide show
  1. package/dist/cjs/components/ds-calendar/ds-calendar.cjs +7 -15
  2. package/dist/cjs/components/ds-calendar-day/ds-calendar-day.cjs +3 -3
  3. package/dist/cjs/components/ds-date-picker/ds-date-picker.cjs +20 -0
  4. package/dist/cjs/components/ds-date-picker/styles/common.styles.cjs +5 -0
  5. package/dist/cjs/components/ds-sidebar-navigation/ds-sidebar-navigation.cjs +20 -20
  6. package/dist/cjs/components/ds-theme-provider/ds-theme-provider.cjs +1 -1
  7. package/dist/cjs/index.cjs +1 -1
  8. package/dist/cjs/utils/IconsManager.cjs +1 -1
  9. package/dist/cjs/utils/PubSub.cjs +1 -1
  10. package/dist/cjs/utils/StylesRegistry/StylesRegistry.cjs +1 -1
  11. package/dist/cjs/utils/componentFactory.cjs +24 -2
  12. package/dist/cjs/utils/cssWithTokens.cjs +1 -1
  13. package/dist/cjs/utils/htmlWithTokens.cjs +1 -1
  14. package/dist/esm/components/ds-calendar/ds-calendar.js +89 -83
  15. package/dist/esm/components/ds-calendar-day/ds-calendar-day.js +13 -9
  16. package/dist/esm/components/ds-date-picker/ds-date-picker.js +137 -0
  17. package/dist/esm/components/ds-date-picker/styles/common.styles.js +12 -0
  18. package/dist/esm/components/ds-sidebar-navigation/ds-sidebar-navigation.js +60 -50
  19. package/dist/esm/components/ds-theme-provider/ds-theme-provider.js +1 -1
  20. package/dist/esm/index.js +3 -2
  21. package/dist/esm/utils/IconsManager.js +1 -1
  22. package/dist/esm/utils/PubSub.js +1 -1
  23. package/dist/esm/utils/StylesRegistry/StylesRegistry.js +1 -1
  24. package/dist/esm/utils/componentFactory.js +26 -2
  25. package/dist/esm/utils/cssWithTokens.js +1 -1
  26. package/dist/esm/utils/htmlWithTokens.js +1 -1
  27. package/dist/types/components/ds-calendar/ds-calendar.d.ts +3 -1
  28. package/dist/types/components/ds-calendar/ds-calendar.types.d.ts +3 -0
  29. package/dist/types/components/ds-calendar-day/ds-calendar-day.d.ts +3 -1
  30. package/dist/types/components/ds-calendar-day/ds-calendar-day.types.d.ts +2 -0
  31. package/dist/types/components/ds-date-picker/ds-date-picker.d.ts +29 -0
  32. package/dist/types/components/ds-date-picker/ds-date-picker.test.d.ts +9 -0
  33. package/dist/types/components/ds-date-picker/ds-date-picker.types.d.ts +9 -0
  34. package/dist/types/components/ds-date-picker/styles/common.styles.d.ts +1 -0
  35. package/dist/types/components/ds-sidebar-navigation/ds-sidebar-navigation.d.ts +6 -1
  36. package/dist/types/components/ds-sidebar-navigation/ds-sidebar-navigation.types.d.ts +1 -0
  37. package/dist/types/components/index.d.ts +1 -0
  38. package/dist/types/utils/componentFactory.d.ts +2 -0
  39. package/dist-react/cjs/components/ds-calendar/ds-calendar.cjs +7 -15
  40. package/dist-react/cjs/components/ds-calendar-day/ds-calendar-day.cjs +3 -3
  41. package/dist-react/cjs/components/ds-date-picker/ds-date-picker.cjs +20 -0
  42. package/dist-react/cjs/components/ds-date-picker/styles/common.styles.cjs +5 -0
  43. package/dist-react/cjs/components/ds-sidebar-navigation/ds-sidebar-navigation.cjs +20 -20
  44. package/dist-react/cjs/components/ds-theme-provider/ds-theme-provider.cjs +1 -1
  45. package/dist-react/cjs/index.cjs +1 -1
  46. package/dist-react/cjs/utils/IconsManager.cjs +1 -1
  47. package/dist-react/cjs/utils/PubSub.cjs +1 -1
  48. package/dist-react/cjs/utils/StylesRegistry/StylesRegistry.cjs +1 -1
  49. package/dist-react/cjs/utils/componentFactory.cjs +13 -2
  50. package/dist-react/cjs/utils/cssWithTokens.cjs +1 -1
  51. package/dist-react/cjs/utils/htmlWithTokens.cjs +1 -1
  52. package/dist-react/esm/components/ds-calendar/ds-calendar.js +89 -83
  53. package/dist-react/esm/components/ds-calendar-day/ds-calendar-day.js +13 -9
  54. package/dist-react/esm/components/ds-date-picker/ds-date-picker.js +137 -0
  55. package/dist-react/esm/components/ds-date-picker/styles/common.styles.js +12 -0
  56. package/dist-react/esm/components/ds-sidebar-navigation/ds-sidebar-navigation.js +60 -50
  57. package/dist-react/esm/components/ds-theme-provider/ds-theme-provider.js +1 -1
  58. package/dist-react/esm/index.js +3 -2
  59. package/dist-react/esm/utils/IconsManager.js +1 -1
  60. package/dist-react/esm/utils/PubSub.js +1 -1
  61. package/dist-react/esm/utils/StylesRegistry/StylesRegistry.js +1 -1
  62. package/dist-react/esm/utils/componentFactory.js +14 -2
  63. package/dist-react/esm/utils/cssWithTokens.js +1 -1
  64. package/dist-react/esm/utils/htmlWithTokens.js +1 -1
  65. package/dist-react/types/components/ds-calendar/ds-calendar.d.ts +3 -1
  66. package/dist-react/types/components/ds-calendar/ds-calendar.types.d.ts +3 -0
  67. package/dist-react/types/components/ds-calendar-day/ds-calendar-day.d.ts +3 -1
  68. package/dist-react/types/components/ds-calendar-day/ds-calendar-day.types.d.ts +2 -0
  69. package/dist-react/types/components/ds-date-picker/ds-date-picker.d.ts +29 -0
  70. package/dist-react/types/components/ds-date-picker/ds-date-picker.test.d.ts +9 -0
  71. package/dist-react/types/components/ds-date-picker/ds-date-picker.types.d.ts +9 -0
  72. package/dist-react/types/components/ds-date-picker/styles/common.styles.d.ts +1 -0
  73. package/dist-react/types/components/ds-sidebar-navigation/ds-sidebar-navigation.d.ts +6 -1
  74. package/dist-react/types/components/ds-sidebar-navigation/ds-sidebar-navigation.types.d.ts +1 -0
  75. package/dist-react/types/components/index.d.ts +1 -0
  76. package/dist-react/types/utils/componentFactory.d.ts +2 -0
  77. package/package.json +1 -1
@@ -2,20 +2,20 @@ import { UiKitElement as b } from "../base/UiKitElement.js";
2
2
  import "../ds-calendar-day/ds-calendar-day.js";
3
3
  import { customUiKitElement as _ } from "../../decorators/customUiKitElement.js";
4
4
  import "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
5
- import { html as y } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
5
+ import { html as m } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
6
6
  import "../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
7
7
  import { property as h } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
8
- import { state as m } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
8
+ import { state as v } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
9
9
  import { classMap as M } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
10
- import { commonStyles as k } from "./styles/common.styles.js";
11
- var S = Object.defineProperty, $ = Object.getOwnPropertyDescriptor, l = (t, e, s, i) => {
12
- for (var r = i > 1 ? void 0 : i ? $(e, s) : e, a = t.length - 1, o; a >= 0; a--)
13
- (o = t[a]) && (r = (i ? o(e, s, r) : o(r)) || r);
14
- return i && r && S(e, s, r), r;
10
+ import { commonStyles as S } from "./styles/common.styles.js";
11
+ var k = Object.defineProperty, x = Object.getOwnPropertyDescriptor, l = (t, e, a, r) => {
12
+ for (var s = r > 1 ? void 0 : r ? x(e, a) : e, n = t.length - 1, i; n >= 0; n--)
13
+ (i = t[n]) && (s = (r ? i(e, a, s) : i(s)) || s);
14
+ return r && s && k(e, a, s), s;
15
15
  };
16
- let n = class extends b {
16
+ let o = class extends b {
17
17
  constructor() {
18
- super(...arguments), this.variant = "plane", this.locale = "en-US", this.firstDayOfWeek = 1, this.disabledDates = [], this.disabledWeekdays = [], this._viewDate = /* @__PURE__ */ new Date(), this._value = null, this._initialValueApplied = !1;
18
+ super(...arguments), this.variant = "plane", this.size = "large", this.locale = "en-US", this.firstDayOfWeek = 1, this.disabledDates = [], this.disabledWeekdays = [], this._viewDate = /* @__PURE__ */ new Date(), this._value = null, this._initialValueApplied = !1;
19
19
  }
20
20
  get selectedDate() {
21
21
  if (this.value) {
@@ -51,27 +51,28 @@ let n = class extends b {
51
51
  parseDate(t) {
52
52
  const e = t.split("-");
53
53
  if (e.length >= 2) {
54
- const s = Number.parseInt(e[0], 10), i = Number.parseInt(e[1], 10) - 1, r = e.length >= 3 ? Number.parseInt(e[2], 10) : 1, a = new Date(s, i, r);
55
- if (!Number.isNaN(a.getTime()))
56
- return a;
54
+ const a = Number.parseInt(e[0], 10), r = Number.parseInt(e[1], 10) - 1, s = e.length >= 3 ? Number.parseInt(e[2], 10) : 1, n = new Date(a, r, s);
55
+ if (!Number.isNaN(n.getTime()))
56
+ return n;
57
57
  }
58
58
  return null;
59
59
  }
60
60
  get calendarClasses() {
61
61
  return {
62
62
  calendar: !0,
63
- [this.variant]: !0
63
+ [this.variant]: !0,
64
+ [this.size]: !0
64
65
  };
65
66
  }
66
67
  get weekdayNames() {
67
- const t = new Intl.DateTimeFormat(this.locale, { weekday: "short" }), e = [], s = new Date(2024, 0, 1);
68
- for (; s.getDay() !== this.firstDayOfWeek; )
69
- s.setDate(s.getDate() + 1);
70
- for (let i = 0; i < 7; i++) {
71
- const r = new Date(s);
72
- r.setDate(s.getDate() + i);
73
- const a = t.format(r);
74
- e.push(a.slice(0, 2));
68
+ const t = new Intl.DateTimeFormat(this.locale, { weekday: "short" }), e = [], a = new Date(2024, 0, 1);
69
+ for (; a.getDay() !== this.firstDayOfWeek; )
70
+ a.setDate(a.getDate() + 1);
71
+ for (let r = 0; r < 7; r++) {
72
+ const s = new Date(a);
73
+ s.setDate(a.getDate() + r);
74
+ const n = t.format(s);
75
+ e.push(n.slice(0, 2));
75
76
  }
76
77
  return e;
77
78
  }
@@ -88,37 +89,37 @@ let n = class extends b {
88
89
  return new Date(t, e, 1).getDay();
89
90
  }
90
91
  get calendarDays() {
91
- const t = this._viewDate.getFullYear(), e = this._viewDate.getMonth(), s = /* @__PURE__ */ new Date();
92
- s.setHours(0, 0, 0, 0);
93
- const i = this.getDaysInMonth(t, e);
94
- let a = this.getFirstDayOfMonth(t, e) - this.firstDayOfWeek;
95
- a < 0 && (a += 7);
96
- const o = [], c = e === 0 ? 11 : e - 1, u = e === 0 ? t - 1 : t, p = this.getDaysInMonth(u, c);
97
- for (let d = a - 1; d >= 0; d--) {
92
+ const t = this._viewDate.getFullYear(), e = this._viewDate.getMonth(), a = /* @__PURE__ */ new Date();
93
+ a.setHours(0, 0, 0, 0);
94
+ const r = this.getDaysInMonth(t, e);
95
+ let n = this.getFirstDayOfMonth(t, e) - this.firstDayOfWeek;
96
+ n < 0 && (n += 7);
97
+ const i = [], c = e === 0 ? 11 : e - 1, u = e === 0 ? t - 1 : t, p = this.getDaysInMonth(u, c);
98
+ for (let d = n - 1; d >= 0; d--) {
98
99
  const D = p - d, w = new Date(u, c, D);
99
- o.push(this.createCalendarDay(w, !1, s));
100
+ i.push(this.createCalendarDay(w, !1, a));
100
101
  }
101
- for (let d = 1; d <= i; d++) {
102
+ for (let d = 1; d <= r; d++) {
102
103
  const D = new Date(t, e, d);
103
- o.push(this.createCalendarDay(D, !0, s));
104
+ i.push(this.createCalendarDay(D, !0, a));
104
105
  }
105
- const f = 42 - o.length, v = e === 11 ? 0 : e + 1, g = e === 11 ? t + 1 : t;
106
+ const f = 42 - i.length, y = e === 11 ? 0 : e + 1, g = e === 11 ? t + 1 : t;
106
107
  for (let d = 1; d <= f; d++) {
107
- const D = new Date(g, v, d);
108
- o.push(this.createCalendarDay(D, !1, s));
108
+ const D = new Date(g, y, d);
109
+ i.push(this.createCalendarDay(D, !1, a));
109
110
  }
110
- return o;
111
+ return i;
111
112
  }
112
- createCalendarDay(t, e, s) {
113
+ createCalendarDay(t, e, a) {
113
114
  t.setHours(0, 0, 0, 0);
114
- const i = t.getDate(), r = t.getMonth(), a = t.getFullYear(), o = i === s.getDate() && r === s.getMonth() && a === s.getFullYear(), c = this.selectedDate, u = c ? i === c.getDate() && r === c.getMonth() && a === c.getFullYear() : !1, p = !e || this.isDateDisabled(t);
115
+ const r = t.getDate(), s = t.getMonth(), n = t.getFullYear(), i = r === a.getDate() && s === a.getMonth() && n === a.getFullYear(), c = this.selectedDate, u = c ? r === c.getDate() && s === c.getMonth() && n === c.getFullYear() : !1, p = !e || this.isDateDisabled(t);
115
116
  return {
116
- day: i,
117
- month: r,
118
- year: a,
117
+ day: r,
118
+ month: s,
119
+ year: n,
119
120
  date: t,
120
121
  isCurrentMonth: e,
121
- isToday: o,
122
+ isToday: i,
122
123
  isSelected: u,
123
124
  isDisabled: p
124
125
  };
@@ -151,27 +152,30 @@ let n = class extends b {
151
152
  t.setMonth(t.getMonth() + 1), this._viewDate = t;
152
153
  }
153
154
  handleDayChange(t) {
154
- var f;
155
+ var y;
155
156
  t.stopPropagation();
156
157
  const e = t.target;
157
158
  if (!e || !e.tagName.toLowerCase().startsWith("ds-calendar-day")) return;
158
- const i = Array.from(((f = this.shadowRoot) == null ? void 0 : f.querySelectorAll("ds-calendar-day")) || []).indexOf(e);
159
- if (i === -1) return;
160
- const a = this.calendarDays[i];
161
- if (!a || a.isDisabled) return;
162
- this._value = a.date, this._viewDate = new Date(a.date);
163
- const o = a.date.getFullYear(), c = String(a.date.getMonth() + 1).padStart(2, "0"), u = String(a.date.getDate()).padStart(2, "0"), p = `${o}-${c}-${u}`;
159
+ const a = e.tagName.toLowerCase(), s = Array.from(((y = this.shadowRoot) == null ? void 0 : y.querySelectorAll(a)) || []).indexOf(e);
160
+ if (s === -1) return;
161
+ const i = this.calendarDays[s];
162
+ if (!i || i.isDisabled) return;
163
+ this._value = i.date, this._viewDate = new Date(i.date);
164
+ const c = i.date.getFullYear(), u = String(i.date.getMonth() + 1).padStart(2, "0"), p = String(i.date.getDate()).padStart(2, "0"), f = `${c}-${u}-${p}`;
164
165
  this.dispatchEvent(
165
166
  new CustomEvent("ds-calendar-change", {
166
167
  bubbles: !0,
167
168
  composed: !0,
168
169
  detail: {
169
- value: p,
170
- date: a.date
170
+ value: f,
171
+ date: i.date
171
172
  }
172
173
  })
173
174
  );
174
175
  }
176
+ get navButtonSize() {
177
+ return this.size === "medium" ? "small" : "medium";
178
+ }
175
179
  get prevButtonTemplate() {
176
180
  return this.componentFactory.createIconButton({
177
181
  class: "nav-button",
@@ -179,7 +183,7 @@ let n = class extends b {
179
183
  "data-aria-label": "Previous month",
180
184
  "@click": this.handlePrevMonth,
181
185
  variant: "naked",
182
- size: "medium",
186
+ size: this.navButtonSize,
183
187
  color: "var(--ds-icon-button-icon-color-standard-default, #fafafa)"
184
188
  });
185
189
  }
@@ -190,36 +194,35 @@ let n = class extends b {
190
194
  "data-aria-label": "Next month",
191
195
  "@click": this.handleNextMonth,
192
196
  variant: "naked",
193
- size: "medium",
197
+ size: this.navButtonSize,
194
198
  color: "var(--ds-icon-button-icon-color-standard-default, #fafafa)"
195
199
  });
196
200
  }
197
201
  get weekdaysTemplate() {
198
- return y`
202
+ return m`
199
203
  <div class="weekdays">
200
- ${this.weekdayNames.map((t) => y`<div class="weekday">${t}</div>`)}
204
+ ${this.weekdayNames.map((t) => m`<div class="weekday">${t}</div>`)}
201
205
  </div>
202
206
  `;
203
207
  }
204
208
  get daysTemplate() {
205
- return y`
209
+ return m`
206
210
  <div class="days-grid" @ds-calendar-day-change=${this.handleDayChange}>
207
211
  ${this.calendarDays.map(
208
- (t) => y`
209
- <ds-calendar-day
210
- day=${t.day}
211
- ?disabled=${t.isDisabled}
212
- ?selected=${t.isSelected}
213
- ?today=${t.isToday}
214
- ?outside-month=${!t.isCurrentMonth}
215
- ></ds-calendar-day>
216
- `
212
+ (t) => this.componentFactory.createCalendarDay({
213
+ day: t.day,
214
+ size: this.size,
215
+ disabled: t.isDisabled,
216
+ selected: t.isSelected,
217
+ today: t.isToday,
218
+ "outside-month": !t.isCurrentMonth
219
+ })
217
220
  )}
218
221
  </div>
219
222
  `;
220
223
  }
221
224
  render() {
222
- return y`
225
+ return m`
223
226
  <div class=${M(this.calendarClasses)} role="application" aria-label="Calendar">
224
227
  <div class="header">
225
228
  ${this.prevButtonTemplate}
@@ -231,46 +234,49 @@ let n = class extends b {
231
234
  `;
232
235
  }
233
236
  };
234
- n.styles = [k];
237
+ o.styles = [S];
238
+ l([
239
+ h({ type: String, reflect: !0 })
240
+ ], o.prototype, "value", 2);
235
241
  l([
236
242
  h({ type: String, reflect: !0 })
237
- ], n.prototype, "value", 2);
243
+ ], o.prototype, "variant", 2);
238
244
  l([
239
245
  h({ type: String, reflect: !0 })
240
- ], n.prototype, "variant", 2);
246
+ ], o.prototype, "size", 2);
241
247
  l([
242
248
  h({ type: String, reflect: !0 })
243
- ], n.prototype, "locale", 2);
249
+ ], o.prototype, "locale", 2);
244
250
  l([
245
251
  h({ type: Number, reflect: !0, attribute: "first-day-of-week" })
246
- ], n.prototype, "firstDayOfWeek", 2);
252
+ ], o.prototype, "firstDayOfWeek", 2);
247
253
  l([
248
254
  h({ type: String, reflect: !0, attribute: "min-date" })
249
- ], n.prototype, "minDate", 2);
255
+ ], o.prototype, "minDate", 2);
250
256
  l([
251
257
  h({ type: String, reflect: !0, attribute: "max-date" })
252
- ], n.prototype, "maxDate", 2);
258
+ ], o.prototype, "maxDate", 2);
253
259
  l([
254
260
  h({ type: Array, attribute: "disabled-dates" })
255
- ], n.prototype, "disabledDates", 2);
261
+ ], o.prototype, "disabledDates", 2);
256
262
  l([
257
263
  h({ type: Array, attribute: "disabled-weekdays" })
258
- ], n.prototype, "disabledWeekdays", 2);
264
+ ], o.prototype, "disabledWeekdays", 2);
259
265
  l([
260
266
  h({ type: String, reflect: !0, attribute: "view-date" })
261
- ], n.prototype, "viewDateAttr", 2);
267
+ ], o.prototype, "viewDateAttr", 2);
262
268
  l([
263
269
  h({ type: String, attribute: "initial-value" })
264
- ], n.prototype, "initialValue", 2);
270
+ ], o.prototype, "initialValue", 2);
265
271
  l([
266
- m()
267
- ], n.prototype, "_viewDate", 2);
272
+ v()
273
+ ], o.prototype, "_viewDate", 2);
268
274
  l([
269
- m()
270
- ], n.prototype, "_value", 2);
271
- n = l([
275
+ v()
276
+ ], o.prototype, "_value", 2);
277
+ o = l([
272
278
  _("ds-calendar")
273
- ], n);
279
+ ], o);
274
280
  export {
275
- n as DsCalendar
281
+ o as DsCalendar
276
282
  };
@@ -1,24 +1,25 @@
1
- import { UiKitElement as c } from "../base/UiKitElement.js";
2
- import { customUiKitElement as h } from "../../decorators/customUiKitElement.js";
1
+ import { UiKitElement as h } from "../base/UiKitElement.js";
2
+ import { customUiKitElement as c } from "../../decorators/customUiKitElement.js";
3
3
  import { booleanConverter as l } from "../../utils/booleanConverter.js";
4
4
  import "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
5
5
  import { html as y } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
6
6
  import "../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
7
7
  import { property as o } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
8
8
  import { classMap as u } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
9
- import { commonStyles as m } from "./styles/common.styles.js";
10
- var f = Object.defineProperty, b = Object.getOwnPropertyDescriptor, s = (e, a, d, i) => {
9
+ import { commonStyles as f } from "./styles/common.styles.js";
10
+ var m = Object.defineProperty, b = Object.getOwnPropertyDescriptor, s = (e, a, d, i) => {
11
11
  for (var r = i > 1 ? void 0 : i ? b(a, d) : a, n = e.length - 1, p; n >= 0; n--)
12
12
  (p = e[n]) && (r = (i ? p(a, d, r) : p(r)) || r);
13
- return i && r && f(a, d, r), r;
13
+ return i && r && m(a, d, r), r;
14
14
  };
15
- let t = class extends c {
15
+ let t = class extends h {
16
16
  constructor() {
17
- super(...arguments), this.disabled = !1, this.selected = !1, this.today = !1, this.outsideMonth = !1;
17
+ super(...arguments), this.size = "large", this.disabled = !1, this.selected = !1, this.today = !1, this.outsideMonth = !1;
18
18
  }
19
19
  get classes() {
20
20
  return {
21
21
  day: !0,
22
+ [this.size]: !0,
22
23
  disabled: this.disabled,
23
24
  selected: this.selected,
24
25
  today: this.today,
@@ -60,10 +61,13 @@ let t = class extends c {
60
61
  `;
61
62
  }
62
63
  };
63
- t.styles = [m];
64
+ t.styles = [f];
64
65
  s([
65
66
  o({ type: Number, reflect: !0 })
66
67
  ], t.prototype, "day", 2);
68
+ s([
69
+ o({ type: String, reflect: !0 })
70
+ ], t.prototype, "size", 2);
67
71
  s([
68
72
  o({ type: Boolean, converter: l, reflect: !0 })
69
73
  ], t.prototype, "disabled", 2);
@@ -77,7 +81,7 @@ s([
77
81
  o({ type: Boolean, converter: l, reflect: !0, attribute: "outside-month" })
78
82
  ], t.prototype, "outsideMonth", 2);
79
83
  t = s([
80
- h("ds-calendar-day")
84
+ c("ds-calendar-day")
81
85
  ], t);
82
86
  export {
83
87
  t as DsCalendarDay
@@ -0,0 +1,137 @@
1
+ import { UiKitElement as h } from "../base/UiKitElement.js";
2
+ import { customUiKitElement as u } from "../../decorators/customUiKitElement.js";
3
+ import { inputStatesMixin as m } from "../../mixins/inputStatesMixin.js";
4
+ import "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
5
+ import { html as n, nothing as o } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
6
+ import "../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
7
+ import { property as s } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
8
+ import { state as v } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
9
+ import { classMap as y } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
10
+ import { commonStyles as f } from "./styles/common.styles.js";
11
+ var x = Object.defineProperty, E = Object.getOwnPropertyDescriptor, r = (t, a, l, d) => {
12
+ for (var i = d > 1 ? void 0 : d ? E(a, l) : a, p = t.length - 1, c; p >= 0; p--)
13
+ (c = t[p]) && (i = (d ? c(a, l, i) : c(i)) || i);
14
+ return d && i && x(a, l, i), i;
15
+ };
16
+ let e = class extends m(h) {
17
+ constructor() {
18
+ super(...arguments), this.size = "large", this.helperText = "", this.forcedError = "", this.invalidError = "", this.readonlyText = "", this.dataAriaLabelCalendarButton = "", this.isExpanded = !1, this.handleCalendarButtonClick = () => {
19
+ this.inputStates.disabled || this.inputStates.readonly || (this.isExpanded = !this.isExpanded);
20
+ }, this.handleCalendarChange = (t) => {
21
+ t.stopPropagation();
22
+ const a = t.detail.value;
23
+ this.nativeInput && (this.nativeInput.value = a, this.nativeInput.dispatchEvent(new Event("input", { bubbles: !0 }))), this.isExpanded = !1;
24
+ }, this.handleDocumentClick = (t) => {
25
+ this.isExpanded && !this.contains(t.target) && (this.isExpanded = !1);
26
+ };
27
+ }
28
+ connectedCallback() {
29
+ super.connectedCallback(), document.addEventListener("click", this.handleDocumentClick), this.addEventListener("ds-calendar-change", this.handleCalendarChange), e.injectNativeInputStyles();
30
+ }
31
+ static injectNativeInputStyles() {
32
+ if (e.nativeStylesInjected) return;
33
+ e.nativeStylesInjected = !0;
34
+ const t = document.createElement("style");
35
+ t.setAttribute("data-ds-date-picker", ""), t.textContent = [
36
+ 'ds-date-picker input[type="date"]::-webkit-calendar-picker-indicator { display: none !important; }',
37
+ 'ds-date-picker input[type="date"]::-webkit-inner-spin-button { display: none !important; }',
38
+ 'ds-date-picker-react input[type="date"]::-webkit-calendar-picker-indicator { display: none !important; }',
39
+ 'ds-date-picker-react input[type="date"]::-webkit-inner-spin-button { display: none !important; }'
40
+ ].join(`
41
+ `), document.head.appendChild(t);
42
+ }
43
+ disconnectedCallback() {
44
+ super.disconnectedCallback(), document.removeEventListener("click", this.handleDocumentClick), this.removeEventListener("ds-calendar-change", this.handleCalendarChange);
45
+ }
46
+ get classes() {
47
+ return {
48
+ container: !0,
49
+ error: !!this.forcedError,
50
+ [this.size]: !!this.size,
51
+ disabled: this.inputStates.disabled,
52
+ readonly: this.inputStates.readonly,
53
+ filled: this.inputStates.filled,
54
+ invalid: this.inputStates.invalid,
55
+ focus: this.inputStates.focus,
56
+ "focus-visible": this.inputStates.focusVisible,
57
+ expanded: this.isExpanded
58
+ };
59
+ }
60
+ render() {
61
+ return n`
62
+ <div class=${y(this.classes)}>
63
+ <div class="input-container">
64
+ <div><slot></slot></div>
65
+ ${this.calendarButtonTemplate}
66
+ </div>
67
+ ${this.calendarDropdownTemplate}
68
+ <div class="footer">
69
+ ${this.readonlyTextTemplate}
70
+ ${this.helperTextTemplate}
71
+ ${this.forcedErrorTemplate}
72
+ ${this.invalidErrorTemplate}
73
+ </div>
74
+ </div>
75
+ `;
76
+ }
77
+ get calendarDropdownTemplate() {
78
+ return n`
79
+ <div class="calendar-dropdown" ?hidden=${!this.isExpanded}>
80
+ <slot name="calendar"></slot>
81
+ </div>
82
+ `;
83
+ }
84
+ get calendarButtonTemplate() {
85
+ var t;
86
+ return this.componentFactory.createIconButton({
87
+ class: "calendar-button",
88
+ "icon-name": "calendar",
89
+ size: this.size,
90
+ disabled: !!((t = this.nativeInput) != null && t.disabled),
91
+ variant: "naked",
92
+ "@click": this.handleCalendarButtonClick,
93
+ "data-aria-label": this.dataAriaLabelCalendarButton || "open calendar"
94
+ });
95
+ }
96
+ get helperTextTemplate() {
97
+ return this.inputStates.readonly || this.forcedError || this.inputStates.invalid && this.invalidError ? o : n`<span class="support-text helper-text">${this.helperText}</span>`;
98
+ }
99
+ get forcedErrorTemplate() {
100
+ return this.inputStates.readonly || !this.forcedError ? o : n`<span class="support-text error-text forced-error">${this.forcedError}</span>`;
101
+ }
102
+ get readonlyTextTemplate() {
103
+ return !this.inputStates.readonly || !this.readonlyText ? o : n`<span class="support-text readonly-text">${this.readonlyText}</span>`;
104
+ }
105
+ get invalidErrorTemplate() {
106
+ return this.inputStates.readonly || this.forcedError || !this.inputStates.invalid || !this.invalidError ? o : n`<span class="support-text error-text invalid-error">${this.invalidError}</span>`;
107
+ }
108
+ };
109
+ e.styles = [f];
110
+ e.nativeStylesInjected = !1;
111
+ r([
112
+ s({ type: String })
113
+ ], e.prototype, "size", 2);
114
+ r([
115
+ s({ type: String, attribute: "helper-text" })
116
+ ], e.prototype, "helperText", 2);
117
+ r([
118
+ s({ type: String, attribute: "forced-error" })
119
+ ], e.prototype, "forcedError", 2);
120
+ r([
121
+ s({ type: String, attribute: "invalid-error" })
122
+ ], e.prototype, "invalidError", 2);
123
+ r([
124
+ s({ type: String, attribute: "readonly-text" })
125
+ ], e.prototype, "readonlyText", 2);
126
+ r([
127
+ s({ type: String, attribute: "data-aria-label-calendar-button" })
128
+ ], e.prototype, "dataAriaLabelCalendarButton", 2);
129
+ r([
130
+ v()
131
+ ], e.prototype, "isExpanded", 2);
132
+ e = r([
133
+ u("ds-date-picker")
134
+ ], e);
135
+ export {
136
+ e as DsDatePicker
137
+ };
@@ -0,0 +1,12 @@
1
+ import "../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
2
+ import "../../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
3
+ import "../../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
4
+ import { css as o } from "../../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/css-tag.js";
5
+ const p = o`
6
+ :host {
7
+ display: contents;
8
+ }
9
+ `;
10
+ export {
11
+ p as commonStyles
12
+ };
@@ -1,24 +1,27 @@
1
- import { UiKitElement as m } from "../base/UiKitElement.js";
2
- import { customUiKitElement as p } from "../../decorators/customUiKitElement.js";
1
+ import { UiKitElement as d } from "../base/UiKitElement.js";
2
+ import { customUiKitElement as c } from "../../decorators/customUiKitElement.js";
3
+ import { booleanConverter as m } from "../../utils/booleanConverter.js";
3
4
  import "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/reactive-element.js";
4
- import { html as c } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
5
+ import { html as p } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/lit-html.js";
5
6
  import "../../node_modules/.pnpm/lit-element@4.2.1/node_modules/lit-element/lit-element.js";
6
- import { state as d } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/state.js";
7
- import { queryAssignedElements as h } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js";
8
- import { classMap as u } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
9
- import { commonStyles as f } from "./styles/common.styles.js";
10
- var g = Object.defineProperty, v = Object.getOwnPropertyDescriptor, r = (t, e, a, o) => {
11
- for (var s = o > 1 ? void 0 : o ? v(e, a) : e, l = t.length - 1, n; l >= 0; l--)
12
- (n = t[l]) && (s = (o ? n(e, a, s) : n(s)) || s);
13
- return o && s && g(e, a, s), s;
7
+ import { property as h } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/property.js";
8
+ import { queryAssignedElements as u } from "../../node_modules/.pnpm/@lit_reactive-element@2.1.1/node_modules/@lit/reactive-element/decorators/query-assigned-elements.js";
9
+ import { classMap as f } from "../../node_modules/.pnpm/lit-html@3.3.1/node_modules/lit-html/directives/class-map.js";
10
+ import { commonStyles as v } from "./styles/common.styles.js";
11
+ var b = Object.defineProperty, g = Object.getOwnPropertyDescriptor, n = (t, s, o, a) => {
12
+ for (var e = a > 1 ? void 0 : a ? g(s, o) : s, i = t.length - 1, r; i >= 0; i--)
13
+ (r = t[i]) && (e = (a ? r(s, o, e) : r(e)) || e);
14
+ return a && e && b(s, o, e), e;
14
15
  };
15
- let i = class extends m {
16
+ let l = class extends d {
16
17
  constructor() {
17
- super(...arguments), this.open = !1, this.toggleModal = () => {
18
- this.open = !this.open;
18
+ super(...arguments), this.open = !1, this.scrollLocked = !1, this.savedBodyOverflow = "", this.toggleModal = () => {
19
+ this.open = !this.open, this.open ? this.dispatchEvent(new Event("ds-sidebar-navigation:open", { bubbles: !0, composed: !0 })) : this.dispatchEvent(new Event("ds-sidebar-navigation:close", { bubbles: !0, composed: !0 }));
20
+ }, this.handleModalClick = (t) => {
21
+ t.target === t.currentTarget && this.toggleModal();
19
22
  }, this.handleSlotChange = (t) => {
20
- const o = t.target.assignedElements().find((s) => s.tagName === "DS-BUTTON");
21
- this.setMainCtaSize(o);
23
+ const a = t.target.assignedElements().find((e) => e.tagName === "DS-BUTTON");
24
+ this.setMainCtaSize(a);
22
25
  }, this.setMainCtaSize = (t) => {
23
26
  t && t.setAttribute(
24
27
  "size",
@@ -35,10 +38,16 @@ let i = class extends m {
35
38
  };
36
39
  }
37
40
  firstUpdated(t) {
38
- var a;
41
+ var o;
39
42
  super.firstUpdated(t);
40
- const e = (a = this.mainCtas) == null ? void 0 : a[0];
41
- e && this.setMainCtaSize(e);
43
+ const s = (o = this.mainCtas) == null ? void 0 : o[0];
44
+ s && this.setMainCtaSize(s);
45
+ }
46
+ updated(t) {
47
+ super.updated(t), t.has("open") && (this.open ? (this.savedBodyOverflow = document.body.style.overflow, document.body.style.overflow = "hidden", this.scrollLocked = !0) : this.scrollLocked && (document.body.style.overflow = this.savedBodyOverflow, this.scrollLocked = !1));
48
+ }
49
+ disconnectedCallback() {
50
+ super.disconnectedCallback(), this.scrollLocked && (document.body.style.overflow = this.savedBodyOverflow, this.scrollLocked = !1);
42
51
  }
43
52
  modalButtonTemplate() {
44
53
  return this.componentFactory.createIconButton({
@@ -47,6 +56,7 @@ let i = class extends m {
47
56
  "@click": this.toggleModal,
48
57
  "data-testid": "modal-button",
49
58
  "data-aria-label": "more actions",
59
+ variant: "tertiary",
50
60
  size: JSON.stringify({
51
61
  xxl: "large",
52
62
  xl: "large",
@@ -65,38 +75,38 @@ let i = class extends m {
65
75
  };
66
76
  }
67
77
  render() {
68
- return c`
69
- <div class=${u(this.classes())}>
70
- <nav class="nav" part="bar">
71
- <div class="aside" part="aside">
72
- <slot name="aside-text"></slot>
73
- <span class="helper-text-container">
74
- <slot name="aside-icon"></slot>
75
- <slot name="aside-helper-text"></slot>
76
- </span>
77
- </div>
78
- <div class="actions-container" part="actions-container">
79
- <slot name="main-cta" @slotchange=${this.handleSlotChange}></slot>
80
- ${this.modalButtonTemplate()}
81
- </div>
82
- </nav>
83
- <div part="modal" class="modal">
84
- <slot name="ctas"></slot>
85
- </div>
86
- </div>
87
- `;
78
+ return p`
79
+ <div class=${f(this.classes())}>
80
+ <nav class="nav" part="bar">
81
+ <div class="aside" part="aside">
82
+ <slot name="aside-text"></slot>
83
+ <span class="helper-text-container">
84
+ <slot name="aside-icon"></slot>
85
+ <slot name="aside-helper-text"></slot>
86
+ </span>
87
+ </div>
88
+ <div class="actions-container" part="actions-container">
89
+ <slot name="main-cta" @slotchange=${this.handleSlotChange}></slot>
90
+ ${this.modalButtonTemplate()}
91
+ </div>
92
+ </nav>
93
+ <div part="modal" class="modal" @click=${this.handleModalClick}>
94
+ <slot name="ctas"></slot>
95
+ </div>
96
+ </div>
97
+ `;
88
98
  }
89
99
  };
90
- i.styles = [f];
91
- r([
92
- d()
93
- ], i.prototype, "open", 2);
94
- r([
95
- h({ slot: "main-cta", selector: "ds-button", flatten: !0 })
96
- ], i.prototype, "mainCtas", 2);
97
- i = r([
98
- p("ds-sidebar-navigation")
99
- ], i);
100
+ l.styles = [v];
101
+ n([
102
+ h({ type: Boolean, converter: m, reflect: !0 })
103
+ ], l.prototype, "open", 2);
104
+ n([
105
+ u({ slot: "main-cta", selector: "ds-button", flatten: !0 })
106
+ ], l.prototype, "mainCtas", 2);
107
+ l = n([
108
+ c("ds-sidebar-navigation")
109
+ ], l);
100
110
  export {
101
- i as DsSidebarNavigation
111
+ l as DsSidebarNavigation
102
112
  };