design-system-silkhaus 3.5.1 → 3.7.0-beta.localeSelector.1

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.
@@ -137,6 +137,11 @@ export declare interface DropdownProps {
137
137
  * @default false
138
138
  */
139
139
  isMultiSelect?: boolean;
140
+ /**
141
+ * The label for the close button for mobile popup
142
+ * @default 'Close'
143
+ */
144
+ closeButtonLabel?: string;
140
145
  }
141
146
 
142
147
  export declare const findOptionByValue: (value: string | string[] | undefined, options: DropdownOption[]) => DropdownOption | DropdownOption[] | undefined;
package/dist/app/index.js CHANGED
@@ -2,7 +2,7 @@ var Y = Object.defineProperty, Z = Object.defineProperties;
2
2
  var O = Object.getOwnPropertyDescriptors;
3
3
  var S = Object.getOwnPropertySymbols;
4
4
  var P = Object.prototype.hasOwnProperty, V = Object.prototype.propertyIsEnumerable;
5
- var W = (s, d, a) => d in s ? Y(s, d, { enumerable: !0, configurable: !0, writable: !0, value: a }) : s[d] = a, j = (s, d) => {
5
+ var W = (s, d, a) => d in s ? Y(s, d, { enumerable: !0, configurable: !0, writable: !0, value: a }) : s[d] = a, w = (s, d) => {
6
6
  for (var a in d || (d = {}))
7
7
  P.call(d, a) && W(s, a, d[a]);
8
8
  if (S)
@@ -10,7 +10,7 @@ var W = (s, d, a) => d in s ? Y(s, d, { enumerable: !0, configurable: !0, writab
10
10
  V.call(d, a) && W(s, a, d[a]);
11
11
  return s;
12
12
  }, _ = (s, d) => Z(s, O(d));
13
- var I = (s, d) => {
13
+ var B = (s, d) => {
14
14
  var a = {};
15
15
  for (var t in s)
16
16
  P.call(s, t) && d.indexOf(t) < 0 && (a[t] = s[t]);
@@ -19,8 +19,8 @@ var I = (s, d) => {
19
19
  d.indexOf(t) < 0 && V.call(s, t) && (a[t] = s[t]);
20
20
  return a;
21
21
  };
22
- import { j as e, a as y, t as ss, c as es, p as ds, u as as, o as ts, h as ls, s as rs, r as ns, i as cs, v as is, d as os, e as us, f as xs, g as ms, F as ps, A as fs, C as hs, l as bs, w as gs, k as vs, n as ys } from "../Checkbox-DzLgSwgu.js";
23
- import A, { forwardRef as js, useState as w, useEffect as ws } from "react";
22
+ import { j as e, a as v, t as ss, c as es, p as ds, u as as, o as ts, i as rs, s as ls, r as ns, v as cs, d as os, e as is, f as us, g as xs, F as ms, A as ps, h as fs, w as hs, C as bs, l as gs, k as vs, n as ys } from "../Checkbox-Bhoxdirv.js";
23
+ import A, { forwardRef as js, useState as N, useEffect as ws } from "react";
24
24
  const T = ({ children: s, size: d = "small" }) => /* @__PURE__ */ e.jsx(
25
25
  "div",
26
26
  {
@@ -33,9 +33,9 @@ const T = ({ children: s, size: d = "small" }) => /* @__PURE__ */ e.jsx(
33
33
  }, Fs = {
34
34
  primary: "ds-rounded-sm ds-border ds-text-black ds-border-Fills-terciary ds-bg-[#F6F8FC] ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] ds-text-mediumFootnoteEmphasized",
35
35
  secondary: "ds-rounded-sm ds-bg-Background-accentEggplant-100 ds-text-Text-textPrimaryDark ds-shadow-[0px_1px_4px_0px_rgba(0,0,0,0.16)] ds-text-mediumFootnoteEmphasized"
36
- }, z = A.forwardRef(
37
- (v, g) => {
38
- var x = v, {
36
+ }, I = A.forwardRef(
37
+ (b, y) => {
38
+ var x = b, {
39
39
  color: s = "primary",
40
40
  disabled: d = !1,
41
41
  className: a,
@@ -47,7 +47,7 @@ const T = ({ children: s, size: d = "small" }) => /* @__PURE__ */ e.jsx(
47
47
  helperText: o,
48
48
  helpterTextClassName: f,
49
49
  buttonClassName: h
50
- } = x, b = I(x, [
50
+ } = x, g = B(x, [
51
51
  "color",
52
52
  "disabled",
53
53
  "className",
@@ -60,25 +60,25 @@ const T = ({ children: s, size: d = "small" }) => /* @__PURE__ */ e.jsx(
60
60
  "helpterTextClassName",
61
61
  "buttonClassName"
62
62
  ]);
63
- return /* @__PURE__ */ e.jsxs("div", { className: y("ds-flex ds-flex-col ds-gap-1", a), children: [
63
+ return /* @__PURE__ */ e.jsxs("div", { className: v("ds-flex ds-flex-col ds-gap-1", a), children: [
64
64
  /* @__PURE__ */ e.jsxs(
65
65
  "button",
66
- _(j({
66
+ _(w({
67
67
  "data-tracking-id": c,
68
- ref: g,
68
+ ref: y,
69
69
  disabled: d,
70
70
  className: ss(
71
71
  es(
72
72
  { [Fs[s]]: u, [Ns[s]]: !u },
73
73
  "ds-px-2 ds-py-1",
74
- "ds-flex ds-w-full ds-flex-1 ds-items-center ds-justify-center",
74
+ "ds-flex ds-w-full ds-flex-1 ds-items-center ds-justify-center ds-gap-1",
75
75
  h
76
76
  )
77
77
  )
78
- }, b), {
78
+ }, g), {
79
79
  children: [
80
80
  i && /* @__PURE__ */ e.jsx(T, { children: i }),
81
- t && /* @__PURE__ */ e.jsx("div", { className: `${i ? "ds-ml-1" : ""} ${l ? "ds-mr-1" : ""}`, children: t }),
81
+ t && /* @__PURE__ */ e.jsx("div", { children: t }),
82
82
  l && /* @__PURE__ */ e.jsx(T, { children: l })
83
83
  ]
84
84
  })
@@ -86,7 +86,7 @@ const T = ({ children: s, size: d = "small" }) => /* @__PURE__ */ e.jsx(
86
86
  o && /* @__PURE__ */ e.jsx(
87
87
  "div",
88
88
  {
89
- className: y(
89
+ className: v(
90
90
  "ds-w-full ds-text-right ds-text-mediumFootnoteRegular",
91
91
  f
92
92
  ),
@@ -96,7 +96,7 @@ const T = ({ children: s, size: d = "small" }) => /* @__PURE__ */ e.jsx(
96
96
  ] });
97
97
  }
98
98
  );
99
- z.displayName = "Button";
99
+ I.displayName = "Button";
100
100
  const _s = js(
101
101
  (s, d) => {
102
102
  const F = s, {
@@ -110,8 +110,8 @@ const _s = js(
110
110
  buttonWidth: o,
111
111
  minSelectionError: f,
112
112
  buttonsContainerClassName: h,
113
- buttonClassName: b
114
- } = F, g = I(F, [
113
+ buttonClassName: g
114
+ } = F, y = B(F, [
115
115
  "value",
116
116
  "options",
117
117
  "onSelectionChange",
@@ -122,14 +122,14 @@ const _s = js(
122
122
  "minSelectionError",
123
123
  "buttonsContainerClassName",
124
124
  "buttonClassName"
125
- ]), [v, x] = w([]), [m, N] = w("");
125
+ ]), [b, x] = N([]), [j, m] = N("");
126
126
  ws(() => {
127
127
  a && a.length ? x(a) : x([]);
128
128
  }, [a]);
129
129
  const k = (r, p) => {
130
130
  p.currentTarget.blur();
131
- const n = [...v], C = n.findIndex((B) => B.value === r.value);
132
- C !== -1 ? n.length > 1 ? (n.splice(C, 1), N("")) : N(f) : (n.push(r), N("")), x(n), i(n);
131
+ const n = [...b], C = n.findIndex((z) => z.value === r.value);
132
+ C !== -1 ? n.length > 1 ? (n.splice(C, 1), m("")) : m(f) : (n.push(r), m("")), x(n), i(n);
133
133
  }, D = (r, p) => {
134
134
  p.currentTarget.blur();
135
135
  const n = [r];
@@ -137,34 +137,34 @@ const _s = js(
137
137
  };
138
138
  return /* @__PURE__ */ e.jsxs(
139
139
  "div",
140
- _(j({
140
+ _(w({
141
141
  ref: d
142
- }, g), {
142
+ }, y), {
143
143
  children: [
144
144
  /* @__PURE__ */ e.jsx(
145
145
  "div",
146
146
  {
147
- className: y("ds-flex ds-flex-wrap ds-items-center ds-gap-2", h),
147
+ className: v("ds-flex ds-flex-wrap ds-items-center ds-gap-2", h),
148
148
  children: t.length > 0 ? t.map((r, p) => r.type === "separator" ? /* @__PURE__ */ e.jsx(A.Fragment, { children: r.component ? r.component : /* @__PURE__ */ e.jsx("div", { className: "ds-h-full ds-min-h-[30px] ds-w-[1px] ds-bg-Fills-terciary" }) }, `separator-${p}`) : /* @__PURE__ */ e.jsx(A.Fragment, { children: u ? /* @__PURE__ */ e.jsx(
149
- z,
149
+ I,
150
150
  {
151
- selected: v.some((n) => n.value === r.value),
151
+ selected: b.some((n) => n.value === r.value),
152
152
  onClick: (n) => k(r, n),
153
153
  color: "secondary",
154
154
  style: { minWidth: c, width: o },
155
- className: b,
155
+ className: g,
156
156
  startIcon: r.startIcon,
157
157
  endIcon: r.endIcon,
158
158
  children: r.label
159
159
  }
160
160
  ) : /* @__PURE__ */ e.jsx(
161
- z,
161
+ I,
162
162
  {
163
- selected: v.some((n) => n.value === r.value),
163
+ selected: b.some((n) => n.value === r.value),
164
164
  onClick: (n) => D(r, n),
165
165
  color: "secondary",
166
166
  style: { minWidth: c, width: o },
167
- className: b,
167
+ className: g,
168
168
  startIcon: r.startIcon,
169
169
  endIcon: r.endIcon,
170
170
  children: r.label
@@ -172,16 +172,16 @@ const _s = js(
172
172
  ) }, r.value)) : /* @__PURE__ */ e.jsx("div", { className: "ds_xSmallSubheadRegular ds-p-2 ds-text-System-red", children: l })
173
173
  }
174
174
  ),
175
- m && /* @__PURE__ */ e.jsx("div", { className: "ds_xSmallSubheadRegular ds-p-2 ds-text-System-red", children: m })
175
+ j && /* @__PURE__ */ e.jsx("div", { className: "ds_xSmallSubheadRegular ds-p-2 ds-text-System-red", children: j })
176
176
  ]
177
177
  })
178
178
  );
179
179
  }
180
180
  );
181
181
  _s.displayName = "ButtonsGroupSelector";
182
- const ks = (s) => window.innerWidth < ds ? /* @__PURE__ */ e.jsx(U, j({}, s)) : /* @__PURE__ */ e.jsx($, j({}, s));
182
+ const ks = (s) => window.innerWidth < ds ? /* @__PURE__ */ e.jsx($, w({}, s)) : /* @__PURE__ */ e.jsx(U, w({}, s));
183
183
  ks.displayName = "Dropdown";
184
- const $ = ({
184
+ const U = ({
185
185
  placement: s = "bottom-start",
186
186
  trigger: d,
187
187
  triggerContainerClassName: a,
@@ -193,55 +193,55 @@ const $ = ({
193
193
  getSelectedValueDisplayText: o = J,
194
194
  placeholder: f,
195
195
  value: h,
196
- isMultiSelect: b,
197
- onChange: g
196
+ isMultiSelect: g,
197
+ onChange: y
198
198
  }) => {
199
- const [v, x] = w(), m = typeof h == "undefined" ? v : h, N = typeof h == "undefined" ? x : () => {
200
- }, [k, D] = w(!1), { refs: F, floatingStyles: r, context: p } = as({
199
+ const [b, x] = N(), j = typeof h == "undefined" ? b : h, m = typeof h == "undefined" ? x : () => {
200
+ }, [k, D] = N(!1), { refs: F, floatingStyles: r, context: p } = as({
201
201
  open: k,
202
202
  onOpenChange: (E) => {
203
203
  D(E), i && i(E);
204
204
  },
205
205
  middleware: [
206
206
  ts(8),
207
- ls({
207
+ rs({
208
208
  crossAxis: s.includes("-"),
209
209
  fallbackAxisSideDirection: "end"
210
210
  }),
211
- rs({ padding: 4 }),
211
+ ls({ padding: 4 }),
212
212
  ns({
213
213
  apply({ availableWidth: E, availableHeight: X, elements: M }) {
214
214
  u && (M.floating.style.maxHeight = `${X - 4}px`), l && (M.floating.style.maxWidth = `${E - 4}px`);
215
215
  }
216
216
  })
217
217
  ],
218
- whileElementsMounted: cs,
218
+ whileElementsMounted: fs,
219
219
  placement: s
220
- }), n = is(p), C = os(p), B = us(p), K = xs(p), { getReferenceProps: L, getFloatingProps: Q } = ms([n, C, B, K]);
220
+ }), n = cs(p), C = os(p), z = is(p), K = us(p), { getReferenceProps: L, getFloatingProps: Q } = xs([n, C, z, K]);
221
221
  return d || (d = /* @__PURE__ */ e.jsx(
222
222
  q,
223
223
  {
224
- selectedOption: R(m, c),
224
+ selectedOption: R(j, c),
225
225
  getSelectedValueDisplayText: o,
226
226
  placeholder: f
227
227
  }
228
228
  )), t ? /* @__PURE__ */ e.jsx("div", { className: a, children: d }) : /* @__PURE__ */ e.jsxs(e.Fragment, { children: [
229
229
  /* @__PURE__ */ e.jsx(
230
230
  "div",
231
- _(j({
232
- className: y("ds-cursor-pointer", a),
231
+ _(w({
232
+ className: v("ds-cursor-pointer", a),
233
233
  ref: F.setReference
234
234
  }, L()), {
235
235
  children: d
236
236
  })
237
237
  ),
238
- k && /* @__PURE__ */ e.jsx(ps, { children: /* @__PURE__ */ e.jsx(
238
+ k && /* @__PURE__ */ e.jsx(ms, { children: /* @__PURE__ */ e.jsx(
239
239
  "div",
240
- _(j({
240
+ _(w({
241
241
  ref: F.setFloating,
242
242
  style: r
243
243
  }, Q()), {
244
- className: y(
244
+ className: v(
245
245
  "ds-z-[29999] ds-flex ds-min-w-[200px] ds-flex-col ds-gap-1 ds-rounded ds-bg-white ds-p-2 ds-shadow-md",
246
246
  u && "ds-overflow-y-auto",
247
247
  l && "ds-overflow-x-auto"
@@ -249,20 +249,20 @@ const $ = ({
249
249
  children: /* @__PURE__ */ e.jsx(
250
250
  H,
251
251
  {
252
- isMultiSelect: b,
252
+ isMultiSelect: g,
253
253
  options: c,
254
- value: m,
255
- setValue: N,
254
+ value: j,
255
+ setValue: m,
256
256
  setIsOpen: D,
257
- onChange: g
257
+ onChange: y
258
258
  }
259
259
  )
260
260
  })
261
261
  ) })
262
262
  ] });
263
263
  };
264
- $.displayName = "DesktopDropdown";
265
- const U = ({
264
+ U.displayName = "DesktopDropdown";
265
+ const $ = ({
266
266
  trigger: s,
267
267
  triggerContainerClassName: d,
268
268
  disabled: a,
@@ -272,14 +272,15 @@ const U = ({
272
272
  value: l,
273
273
  options: c,
274
274
  isMultiSelect: o,
275
- onChange: f
275
+ onChange: f,
276
+ closeButtonLabel: h = "Close"
276
277
  }) => {
277
- const [h, b] = w(), g = typeof l == "undefined" ? h : l, v = typeof l == "undefined" ? b : () => {
278
- }, [x, m] = w(!1);
278
+ const [g, y] = N(), b = typeof l == "undefined" ? g : l, x = typeof l == "undefined" ? y : () => {
279
+ }, [j, m] = N(!1);
279
280
  return s || (s = /* @__PURE__ */ e.jsx(
280
281
  q,
281
282
  {
282
- selectedOption: R(g, c),
283
+ selectedOption: R(b, c),
283
284
  getSelectedValueDisplayText: i,
284
285
  placeholder: u
285
286
  }
@@ -295,14 +296,14 @@ const U = ({
295
296
  }
296
297
  ),
297
298
  /* @__PURE__ */ e.jsx(
298
- fs,
299
+ ps,
299
300
  {
300
301
  animation: "slideUp",
301
- show: x,
302
+ show: j,
302
303
  handleClose: () => {
303
304
  m(!1), t && t(!1);
304
305
  },
305
- contentClassName: y("ds-absolute ds-mb-0 ds-w-full"),
306
+ contentClassName: v("ds-absolute ds-mb-0 ds-w-full"),
306
307
  className: "ds-z-[29999]",
307
308
  children: /* @__PURE__ */ e.jsx(
308
309
  G,
@@ -310,13 +311,14 @@ const U = ({
310
311
  onClose: () => {
311
312
  m(!1), t && t(!1);
312
313
  },
314
+ closeButtonLabel: h,
313
315
  children: /* @__PURE__ */ e.jsx(
314
316
  H,
315
317
  {
316
318
  isMultiSelect: o,
317
319
  options: c,
318
- value: g,
319
- setValue: v,
320
+ value: b,
321
+ setValue: x,
320
322
  setIsOpen: m,
321
323
  onChange: f
322
324
  }
@@ -327,29 +329,26 @@ const U = ({
327
329
  )
328
330
  ] });
329
331
  };
330
- U.displayName = "MobileDropdown";
331
- const G = ({
332
- onClose: s,
333
- children: d
334
- }) => /* @__PURE__ */ e.jsxs("div", { className: "ds-mb-0 ds-flex ds-max-h-dvh ds-w-full ds-flex-col ds-bg-white", children: [
332
+ $.displayName = "MobileDropdown";
333
+ const G = ({ onClose: s, closeButtonLabel: d, children: a }) => /* @__PURE__ */ e.jsxs("div", { className: "ds-mb-0 ds-flex ds-max-h-dvh ds-w-full ds-flex-col ds-bg-white", children: [
335
334
  /* @__PURE__ */ e.jsxs("div", { className: "ds-flex ds-shrink-0 ds-items-center ds-justify-between ds-px-8 ds-py-4", children: [
336
335
  /* @__PURE__ */ e.jsx(
337
336
  "div",
338
337
  {
339
338
  onClick: s,
340
339
  className: "ds-flex ds-size-5 ds-cursor-pointer ds-items-center ds-justify-center",
341
- children: /* @__PURE__ */ e.jsx(hs, { className: "ds-size-4" })
340
+ children: /* @__PURE__ */ e.jsx(bs, { className: "ds-size-4" })
342
341
  }
343
342
  ),
344
343
  /* @__PURE__ */ e.jsx("div", { className: "ds-size-5" })
345
344
  ] }),
346
- /* @__PURE__ */ e.jsx("div", { className: "ds-grow ds-overflow-y-auto ds-p-4 ds-text-xSmallCalloutRegular", children: d }),
345
+ /* @__PURE__ */ e.jsx("div", { className: "ds-grow ds-overflow-y-auto ds-p-4 ds-text-xSmallCalloutRegular", children: a }),
347
346
  /* @__PURE__ */ e.jsx("div", { className: "ds-px-8 ds-py-4", children: /* @__PURE__ */ e.jsx(
348
- bs,
347
+ gs,
349
348
  {
350
349
  buttonClassName: "ds-py-3",
351
350
  onClick: s,
352
- children: "Close"
351
+ children: d
353
352
  }
354
353
  ) })
355
354
  ] });
@@ -361,10 +360,10 @@ const q = ({
361
360
  }) => {
362
361
  const t = !s || Array.isArray(s) && s.length === 0 ? a || "" : d(s);
363
362
  return /* @__PURE__ */ e.jsx(
364
- z,
363
+ I,
365
364
  {
366
365
  color: "secondary",
367
- endIcon: /* @__PURE__ */ e.jsx(gs, { className: "ds-size-4" }),
366
+ endIcon: /* @__PURE__ */ e.jsx(hs, { className: "ds-size-4" }),
368
367
  buttonClassName: "ds-justify-between",
369
368
  children: t
370
369
  }
@@ -402,7 +401,7 @@ const q = ({
402
401
  "div",
403
402
  {
404
403
  onClick: d.disabled ? void 0 : s,
405
- className: y(
404
+ className: v(
406
405
  "ds-group ds-flex ds-min-h-[72px] ds-cursor-pointer ds-items-center ds-gap-4 ds-rounded ds-px-4 ds-py-2 ds-text-smallFootnoteEmphasized hover:ds-bg-[#F6F8FC] ds-tablet:ds-min-h-[auto] ds-tablet:ds-gap-2 ds-tablet:ds-px-2 ds-desktop:ds-text-mediumFootnoteEmphasized",
407
406
  !t && "ds-transition-[padding] ds-duration-300 hover:ds-px-4"
408
407
  ),
@@ -418,7 +417,7 @@ const q = ({
418
417
  /* @__PURE__ */ e.jsx(
419
418
  "div",
420
419
  {
421
- className: y(
420
+ className: v(
422
421
  "ds-flex-grow",
423
422
  !t && "ds-transition-[padding] ds-duration-300 group-hover:ds-pr-0 ds-tablet:ds-pr-4"
424
423
  ),
@@ -437,10 +436,10 @@ const q = ({
437
436
  }
438
437
  ), R = (s, d) => Array.isArray(s) ? d.filter((a) => s.includes(a.value)) : d.find((a) => a.value === s), J = (s) => Array.isArray(s) ? s.map((d) => d.label).join(", ") : s.label;
439
438
  export {
440
- z as Button,
439
+ I as Button,
441
440
  _s as ButtonsGroupSelector,
442
- $ as DesktopDropdown,
441
+ U as DesktopDropdown,
443
442
  ks as Dropdown,
444
- U as MobileDropdown,
443
+ $ as MobileDropdown,
445
444
  R as findOptionByValue
446
445
  };
package/dist/index.d.ts CHANGED
@@ -761,6 +761,19 @@ export declare const LoadingIcon: FC<{
761
761
  className?: string;
762
762
  }>;
763
763
 
764
+ export declare interface LocaleSettingsModalProps {
765
+ languages?: Option_3[];
766
+ currencies?: Option_3[];
767
+ selectedLanguage?: Option_3;
768
+ selectedCurrency?: Option_3;
769
+ show: boolean;
770
+ onSave: (settings: {
771
+ language: Option_3;
772
+ currency: Option_3;
773
+ }) => void;
774
+ onClose: () => void;
775
+ }
776
+
764
777
  export declare const LocationIcon: FC<{
765
778
  className?: string;
766
779
  }>;
@@ -885,6 +898,11 @@ declare interface Option_2 {
885
898
  }
886
899
  export { Option_2 as Option }
887
900
 
901
+ declare type Option_3 = {
902
+ value: string;
903
+ label: string;
904
+ };
905
+
888
906
  export declare const PartnerIcon: FC<{
889
907
  className?: string;
890
908
  }>;