design-system-silkhaus 3.8.0-beta.ST-1134.3 → 3.8.0-beta.ST-1134.4

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.
@@ -1,164 +0,0 @@
1
- import { default as default_2 } from 'react';
2
- import { FC } from 'react';
3
- import { HTMLAttributes } from 'react';
4
- import { Placement } from '@floating-ui/react';
5
- import { PropsWithChildren } from 'react';
6
- import { ReactNode } from 'react';
7
-
8
- export declare const Button: default_2.ForwardRefExoticComponent<ButtonProps & default_2.RefAttributes<HTMLButtonElement>>;
9
-
10
- export declare interface ButtonProps extends default_2.ButtonHTMLAttributes<HTMLButtonElement> {
11
- color?: 'primary' | 'secondary';
12
- disabled?: true | false;
13
- startIcon?: default_2.ReactNode;
14
- endIcon?: default_2.ReactNode;
15
- trackingId?: string;
16
- selected?: boolean;
17
- helperText?: string;
18
- /**
19
- * classes to apply on the outer most container which contains
20
- * the button and the helper text
21
- */
22
- className?: string;
23
- /**
24
- * classes to apply on button element
25
- */
26
- buttonClassName?: string;
27
- /**
28
- * classes to apply on the helper text
29
- */
30
- helpterTextClassName?: string;
31
- }
32
-
33
- export declare const ButtonsGroupSelector: default_2.ForwardRefExoticComponent<ButtonsGroupSelectorProps & default_2.RefAttributes<HTMLDivElement>>;
34
-
35
- export declare interface ButtonsGroupSelectorProps extends HTMLAttributes<HTMLDivElement> {
36
- label?: string;
37
- value?: Array<{
38
- label: string;
39
- value: string;
40
- startIcon?: default_2.ReactNode;
41
- endIcon?: default_2.ReactNode;
42
- }>;
43
- options: Array<OptionType | Separator>;
44
- onSelectionChange?: (selected: Array<{
45
- label: string;
46
- value: string;
47
- }>) => void;
48
- placeholder?: string;
49
- selected?: boolean;
50
- isMultiSelect?: boolean;
51
- noDataError?: string;
52
- buttonMinWidth?: string;
53
- buttonWidth?: string;
54
- minSelectionError?: string;
55
- /**
56
- * className for the wrapping div on the buttons
57
- */
58
- buttonsContainerClassName?: string;
59
- /**
60
- * className to applied on each button
61
- */
62
- buttonClassName?: string;
63
- }
64
-
65
- export declare const DesktopDropdown: FC<PropsWithChildren<DropdownProps>>;
66
-
67
- /**
68
- * A dropdown component to be used in webapps that display a list of options.
69
- * It will display a default dropdown by default. You can pass the trigger element as a prop if you want customized trigger
70
- */
71
- export declare const Dropdown: FC<PropsWithChildren<DropdownProps>>;
72
-
73
- export declare type DropdownOption = {
74
- value: string;
75
- label: string;
76
- icon?: React.ReactNode;
77
- thumbnailUrl?: string;
78
- disabled?: boolean;
79
- };
80
-
81
- export declare interface DropdownProps {
82
- /**
83
- * The options of the dropdown
84
- */
85
- options: DropdownOption[];
86
- /**
87
- * The value of selected dropdown option
88
- */
89
- value?: string | string[];
90
- /**
91
- * The placeholder text for the dropdown, when no value is selected
92
- */
93
- placeholder?: string;
94
- /**
95
- * Callback when dropdown value is changed
96
- */
97
- onChange?: (selectedOption: DropdownOption | DropdownOption[]) => void;
98
- /**
99
- * Pass this callback function if you want to override the default selected value display text.
100
- * By default the dropdown will display the label from the selected option
101
- */
102
- getSelectedValueDisplayText?: (selectedOption: DropdownOption | DropdownOption[]) => string;
103
- /**
104
- * Callback when dropdown is opened or closed
105
- */
106
- onOpenChange?: (isOpen: boolean) => void;
107
- /**
108
- * The element that triggers the dropdown.
109
- * This parameter is optional. By default it is a button with selected option label and chevron icon.
110
- */
111
- trigger?: ReactNode;
112
- /**
113
- * The direction in which the dropdown will open
114
- * @default 'bottom-start'
115
- */
116
- placement?: Placement;
117
- /**
118
- * The trigger of the dropdown is wrapped in a container. This classname is added to that container
119
- */
120
- triggerContainerClassName?: string;
121
- /**
122
- * @default false
123
- */
124
- disabled?: boolean;
125
- /**
126
- * Adjust the height of the dropdown popover to fit the content in viewport
127
- * @default true
128
- */
129
- adjustHeight?: boolean | number;
130
- /**
131
- * Adjust the width of the dropdown popover to fit the content in viewport
132
- * @default true
133
- */
134
- adjustWidth?: boolean;
135
- /**
136
- * Indicates if the dropdown is multi-select
137
- * @default false
138
- */
139
- isMultiSelect?: boolean;
140
- /**
141
- * The label for the close button for mobile popup
142
- * @default 'Close'
143
- */
144
- closeButtonLabel?: string;
145
- }
146
-
147
- export declare const findOptionByValue: (value: string | string[] | undefined, options: DropdownOption[]) => DropdownOption | DropdownOption[] | undefined;
148
-
149
- export declare const MobileDropdown: FC<PropsWithChildren<DropdownProps>>;
150
-
151
- declare type OptionType = {
152
- type?: 'option';
153
- label: string;
154
- value: string;
155
- startIcon?: default_2.ReactNode;
156
- endIcon?: default_2.ReactNode;
157
- };
158
-
159
- declare type Separator = {
160
- type: 'separator';
161
- component?: default_2.ReactNode;
162
- };
163
-
164
- export { }
package/dist/app/index.js DELETED
@@ -1,279 +0,0 @@
1
- var J = Object.defineProperty, K = Object.defineProperties;
2
- var L = Object.getOwnPropertyDescriptors;
3
- var C = Object.getOwnPropertySymbols;
4
- var Q = Object.prototype.hasOwnProperty, X = Object.prototype.propertyIsEnumerable;
5
- var I = (s, e, a) => e in s ? J(s, e, { enumerable: !0, configurable: !0, writable: !0, value: a }) : s[e] = a, x = (s, e) => {
6
- for (var a in e || (e = {}))
7
- Q.call(e, a) && I(s, a, e[a]);
8
- if (C)
9
- for (var a of C(e))
10
- X.call(e, a) && I(s, a, e[a]);
11
- return s;
12
- }, k = (s, e) => K(s, L(e));
13
- import { j as d, p as Y, u as Z, o as _, i as O, s as ss, r as es, v as ds, d as as, e as ls, f as ts, g as rs, a as m, F as ns, A as is, h as os, D as cs, x as us, C as fs, l as xs, k as ms, n as ps } from "../ButtonsGroupSelector-Fwn9xZMc.js";
14
- import { w as ks } from "../ButtonsGroupSelector-Fwn9xZMc.js";
15
- import { useState as b } from "react";
16
- const hs = (s) => window.innerWidth < Y ? /* @__PURE__ */ d.jsx(R, x({}, s)) : /* @__PURE__ */ d.jsx(M, x({}, s));
17
- hs.displayName = "Dropdown";
18
- const M = ({
19
- placement: s = "bottom-start",
20
- trigger: e,
21
- triggerContainerClassName: a,
22
- disabled: l,
23
- onOpenChange: o,
24
- adjustHeight: n = !0,
25
- adjustWidth: t = !0,
26
- options: r,
27
- getSelectedValueDisplayText: i = P,
28
- placeholder: u,
29
- value: f,
30
- isMultiSelect: y,
31
- onChange: w
32
- }) => {
33
- const [p, N] = b(), h = typeof f == "undefined" ? p : f, c = typeof f == "undefined" ? N : () => {
34
- }, [A, F] = b(!1), { refs: g, floatingStyles: B, context: j } = Z({
35
- open: A,
36
- onOpenChange: (v) => {
37
- F(v), o && o(v);
38
- },
39
- middleware: [
40
- _(8),
41
- O({
42
- crossAxis: s.includes("-"),
43
- fallbackAxisSideDirection: "end"
44
- }),
45
- ss({ padding: 4 }),
46
- es({
47
- apply({ availableWidth: v, availableHeight: q, elements: z }) {
48
- n && (z.floating.style.maxHeight = `${q - 4}px`), t && (z.floating.style.maxWidth = `${v - 4}px`);
49
- }
50
- })
51
- ],
52
- whileElementsMounted: os,
53
- placement: s
54
- }), E = ds(j), W = as(j), $ = ls(j), G = ts(j), { getReferenceProps: T, getFloatingProps: H } = rs([E, W, $, G]);
55
- return e || (e = /* @__PURE__ */ d.jsx(
56
- U,
57
- {
58
- selectedOption: D(h, r),
59
- getSelectedValueDisplayText: i,
60
- placeholder: u
61
- }
62
- )), l ? /* @__PURE__ */ d.jsx("div", { className: a, children: e }) : /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
63
- /* @__PURE__ */ d.jsx(
64
- "div",
65
- k(x({
66
- className: m("ds-cursor-pointer", a),
67
- ref: g.setReference
68
- }, T()), {
69
- children: e
70
- })
71
- ),
72
- A && /* @__PURE__ */ d.jsx(ns, { children: /* @__PURE__ */ d.jsx(
73
- "div",
74
- k(x({
75
- ref: g.setFloating,
76
- style: B
77
- }, H()), {
78
- className: m(
79
- "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",
80
- n && "ds-overflow-y-auto",
81
- t && "ds-overflow-x-auto"
82
- ),
83
- children: /* @__PURE__ */ d.jsx(
84
- V,
85
- {
86
- isMultiSelect: y,
87
- options: r,
88
- value: h,
89
- setValue: c,
90
- setIsOpen: F,
91
- onChange: w
92
- }
93
- )
94
- })
95
- ) })
96
- ] });
97
- };
98
- M.displayName = "DesktopDropdown";
99
- const R = ({
100
- trigger: s,
101
- triggerContainerClassName: e,
102
- disabled: a,
103
- onOpenChange: l,
104
- getSelectedValueDisplayText: o = P,
105
- placeholder: n,
106
- value: t,
107
- options: r,
108
- isMultiSelect: i,
109
- onChange: u,
110
- closeButtonLabel: f = "Close"
111
- }) => {
112
- const [y, w] = b(), p = typeof t == "undefined" ? y : t, N = typeof t == "undefined" ? w : () => {
113
- }, [h, c] = b(!1);
114
- return s || (s = /* @__PURE__ */ d.jsx(
115
- U,
116
- {
117
- selectedOption: D(p, r),
118
- getSelectedValueDisplayText: o,
119
- placeholder: n
120
- }
121
- )), a ? /* @__PURE__ */ d.jsx("div", { className: e, children: s }) : /* @__PURE__ */ d.jsxs(d.Fragment, { children: [
122
- /* @__PURE__ */ d.jsx(
123
- "div",
124
- {
125
- className: e,
126
- onClick: () => {
127
- c(!0), l && l(!0);
128
- },
129
- children: s
130
- }
131
- ),
132
- /* @__PURE__ */ d.jsx(
133
- is,
134
- {
135
- animation: "slideUp",
136
- show: h,
137
- handleClose: () => {
138
- c(!1), l && l(!1);
139
- },
140
- contentClassName: m("ds-absolute ds-mb-0 ds-w-full"),
141
- className: "ds-z-[29999]",
142
- children: /* @__PURE__ */ d.jsx(
143
- S,
144
- {
145
- onClose: () => {
146
- c(!1), l && l(!1);
147
- },
148
- closeButtonLabel: f,
149
- children: /* @__PURE__ */ d.jsx(
150
- V,
151
- {
152
- isMultiSelect: i,
153
- options: r,
154
- value: p,
155
- setValue: N,
156
- setIsOpen: c,
157
- onChange: u
158
- }
159
- )
160
- }
161
- )
162
- }
163
- )
164
- ] });
165
- };
166
- R.displayName = "MobileDropdown";
167
- const S = ({ onClose: s, closeButtonLabel: e, children: a }) => /* @__PURE__ */ d.jsxs("div", { className: "ds-mb-0 ds-flex ds-max-h-dvh ds-w-full ds-flex-col ds-bg-white", children: [
168
- /* @__PURE__ */ d.jsxs("div", { className: "ds-flex ds-shrink-0 ds-items-center ds-justify-between ds-px-8 ds-py-4", children: [
169
- /* @__PURE__ */ d.jsx(
170
- "div",
171
- {
172
- onClick: s,
173
- className: "ds-flex ds-size-5 ds-cursor-pointer ds-items-center ds-justify-center",
174
- children: /* @__PURE__ */ d.jsx(fs, { className: "ds-size-4" })
175
- }
176
- ),
177
- /* @__PURE__ */ d.jsx("div", { className: "ds-size-5" })
178
- ] }),
179
- /* @__PURE__ */ d.jsx("div", { className: "ds-grow ds-overflow-y-auto ds-p-4 ds-text-xSmallCalloutRegular", children: a }),
180
- /* @__PURE__ */ d.jsx("div", { className: "ds-px-8 ds-py-4", children: /* @__PURE__ */ d.jsx(
181
- xs,
182
- {
183
- buttonClassName: "ds-py-3",
184
- onClick: s,
185
- children: e
186
- }
187
- ) })
188
- ] });
189
- S.displayName = "MobilePopoverContentWrapper";
190
- const U = ({
191
- selectedOption: s,
192
- getSelectedValueDisplayText: e,
193
- placeholder: a
194
- }) => {
195
- const l = !s || Array.isArray(s) && s.length === 0 ? a || "" : e(s);
196
- return /* @__PURE__ */ d.jsx(
197
- cs,
198
- {
199
- color: "secondary",
200
- endIcon: /* @__PURE__ */ d.jsx(us, { className: "ds-size-4" }),
201
- buttonClassName: "ds-justify-between",
202
- children: l
203
- }
204
- );
205
- }, V = ({
206
- options: s,
207
- isMultiSelect: e,
208
- value: a,
209
- setValue: l,
210
- setIsOpen: o,
211
- onChange: n
212
- }) => s && s.map((t) => /* @__PURE__ */ d.jsx(
213
- js,
214
- {
215
- onClick: () => {
216
- let r;
217
- if (e) {
218
- const i = a || [];
219
- i.includes(t.value) ? r = i.filter((u) => u !== t.value) : r = [...i, t.value];
220
- } else
221
- r = t.value, o(!1);
222
- l(r), n && n(D(r, s));
223
- },
224
- option: t,
225
- isSelected: Array.isArray(a) ? a.some((r) => r === t.value) : a === t.value,
226
- showCheckbox: e
227
- },
228
- t.value
229
- )), js = ({
230
- onClick: s,
231
- option: e,
232
- isSelected: a,
233
- showCheckbox: l
234
- }) => /* @__PURE__ */ d.jsxs(
235
- "div",
236
- {
237
- onClick: e.disabled ? void 0 : s,
238
- className: m(
239
- "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-mediumSubHeadEmphasized 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",
240
- !l && "ds-transition-[padding] ds-duration-300 hover:ds-px-4"
241
- ),
242
- children: [
243
- e.thumbnailUrl && /* @__PURE__ */ d.jsx(
244
- "img",
245
- {
246
- src: e.thumbnailUrl,
247
- className: "ds-h-14 ds-w-14 ds-shrink-0 ds-rounded ds-object-cover group-hover:ds-pr-0 ds-tablet:ds-h-6 ds-tablet:ds-w-9 ds-tablet:ds-rounded-sm"
248
- }
249
- ),
250
- e.icon,
251
- /* @__PURE__ */ d.jsx(
252
- "div",
253
- {
254
- className: m(
255
- "ds-flex-grow",
256
- !l && "ds-transition-[padding] ds-duration-300 group-hover:ds-pr-0 ds-tablet:ds-pr-4"
257
- ),
258
- children: e.label
259
- }
260
- ),
261
- a && !l && /* @__PURE__ */ d.jsx(ms, { className: "ds-size-4 ds-shrink-0" }),
262
- l && /* @__PURE__ */ d.jsx(
263
- ps,
264
- {
265
- isChecked: a,
266
- disabled: e.disabled
267
- }
268
- )
269
- ]
270
- }
271
- ), D = (s, e) => Array.isArray(s) ? e.filter((a) => s.includes(a.value)) : e.find((a) => a.value === s), P = (s) => Array.isArray(s) ? s.map((e) => e.label).join(", ") : s.label;
272
- export {
273
- cs as Button,
274
- ks as ButtonsGroupSelector,
275
- M as DesktopDropdown,
276
- hs as Dropdown,
277
- R as MobileDropdown,
278
- D as findOptionByValue
279
- };