@solostylist/ui-kit 1.0.13 → 1.0.15

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.
package/dist/main.d.ts CHANGED
@@ -19,6 +19,7 @@ export { default as SI18nProvider } from './s-i18n-provider';
19
19
  export { default as SIconButton } from './s-icon-button';
20
20
  export { default as SLabel } from './s-label';
21
21
  export { default as SMultiSelect } from './s-multi-select';
22
+ export type { SMultiSelectProps } from './s-multi-select';
22
23
  export { default as SNoSsr } from './s-no-ssr';
23
24
  export { default as STextField } from './s-text-field';
24
25
  export { default as SPagination } from './s-pagination';
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { AutocompleteProps } from '@mui/material';
3
- export interface SAutocompleteProps<T, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined = undefined> extends Omit<AutocompleteProps<T | any, Multiple, DisableClearable, FreeSolo>, 'renderInput'> {
4
- renderInput?: AutocompleteProps<T | string, Multiple, DisableClearable, FreeSolo>['renderInput'];
3
+ export interface SAutocompleteProps<T, Multiple extends boolean | undefined, DisableClearable extends boolean | undefined, FreeSolo extends boolean | undefined = undefined> extends Omit<AutocompleteProps<T, Multiple, DisableClearable, FreeSolo>, 'renderInput'> {
4
+ renderInput?: AutocompleteProps<T, Multiple, DisableClearable, FreeSolo>['renderInput'];
5
5
  label?: string | React.ReactNode;
6
6
  required?: boolean;
7
7
  error?: string;
@@ -10,7 +10,7 @@ interface SFileDropzoneProps extends DropzoneOptions {
10
10
  onRemove?: (file: CustomFile) => void;
11
11
  onRemoveAll?: () => void;
12
12
  onUpload?: () => void;
13
- label?: string;
13
+ label?: string | React.ReactNode;
14
14
  disabledUpload?: boolean;
15
15
  error?: string;
16
16
  required?: boolean;
@@ -1 +1,2 @@
1
1
  export { default } from './s-multi-select';
2
+ export type { SMultiSelectProps } from './s-multi-select';
@@ -1,43 +1,44 @@
1
- import { j as p } from "../jsx-runtime-C5mzlN2N.js";
1
+ import { j as c } from "../jsx-runtime-C5mzlN2N.js";
2
2
  import * as d from "react";
3
3
  import s, { forwardRef as B } from "react";
4
4
  import { Button as V } from "@mui/material";
5
5
  import { E as Z } from "../SSRBase-BSdFRe_j.js";
6
6
  import { usePopover as D } from "../hooks/use-popover.js";
7
- import { L as I, M as H } from "../Menu-B8rPlcSd.js";
8
- import { a as f, P as a } from "../createTheme-DDycScYN.js";
7
+ import H from "../s-chips/s-chips.js";
8
+ import { L as I, M as G } from "../Menu-B8rPlcSd.js";
9
+ import { a as f, P as o } from "../createTheme-DDycScYN.js";
9
10
  import { c as M } from "../identifier-CHPjnqaz.js";
10
- import { u as G, s as U, c as z, b as A, m as _ } from "../memoTheme-DX35GGEJ.js";
11
- import { g as W, d as E, m } from "../menuItemClasses-DLFqc90k.js";
12
- import { u as q } from "../useEnhancedEffect-CJGo-L3B.js";
13
- import { u as J, B as K } from "../useSlot-B682hoPx.js";
14
- import { g as h } from "../generateUtilityClasses-Z7VQRhBn.js";
15
- const $ = h("MuiListItemIcon", ["root", "alignItemsFlexStart"]), j = h("MuiListItemText", ["root", "multiline", "dense", "inset", "primary", "secondary"]), Q = (e, t) => {
11
+ import { u as U, s as z, c as A, b as _, m as W } from "../memoTheme-DX35GGEJ.js";
12
+ import { g as q, d as E, m } from "../menuItemClasses-DLFqc90k.js";
13
+ import { u as J } from "../useEnhancedEffect-CJGo-L3B.js";
14
+ import { u as K, B as Q } from "../useSlot-B682hoPx.js";
15
+ import { g as R } from "../generateUtilityClasses-Z7VQRhBn.js";
16
+ const $ = R("MuiListItemIcon", ["root", "alignItemsFlexStart"]), j = R("MuiListItemText", ["root", "multiline", "dense", "inset", "primary", "secondary"]), X = (e, t) => {
16
17
  const {
17
- ownerState: o
18
+ ownerState: a
18
19
  } = e;
19
- return [t.root, o.dense && t.dense, o.divider && t.divider, !o.disableGutters && t.gutters];
20
- }, X = (e) => {
20
+ return [t.root, a.dense && t.dense, a.divider && t.divider, !a.disableGutters && t.gutters];
21
+ }, Y = (e) => {
21
22
  const {
22
23
  disabled: t,
23
- dense: o,
24
+ dense: a,
24
25
  divider: n,
25
26
  disableGutters: l,
26
27
  selected: u,
27
28
  classes: r
28
- } = e, i = z({
29
- root: ["root", o && "dense", t && "disabled", !l && "gutters", n && "divider", u && "selected"]
30
- }, W, r);
29
+ } = e, i = A({
30
+ root: ["root", a && "dense", t && "disabled", !l && "gutters", n && "divider", u && "selected"]
31
+ }, q, r);
31
32
  return {
32
33
  ...r,
33
34
  ...i
34
35
  };
35
- }, Y = U(K, {
36
- shouldForwardProp: (e) => A(e) || e === "classes",
36
+ }, ee = z(Q, {
37
+ shouldForwardProp: (e) => _(e) || e === "classes",
37
38
  name: "MuiMenuItem",
38
39
  slot: "Root",
39
- overridesResolver: Q
40
- })(_(({
40
+ overridesResolver: X
41
+ })(W(({
41
42
  theme: e
42
43
  }) => ({
43
44
  ...e.typography.body1,
@@ -135,44 +136,44 @@ const $ = h("MuiListItemIcon", ["root", "alignItemsFlexStart"]), j = h("MuiListI
135
136
  }
136
137
  }
137
138
  }]
138
- }))), P = /* @__PURE__ */ d.forwardRef(function(t, o) {
139
- const n = G({
139
+ }))), P = /* @__PURE__ */ d.forwardRef(function(t, a) {
140
+ const n = U({
140
141
  props: t,
141
142
  name: "MuiMenuItem"
142
143
  }), {
143
144
  autoFocus: l = !1,
144
145
  component: u = "li",
145
146
  dense: r = !1,
146
- divider: c = !1,
147
+ divider: p = !1,
147
148
  disableGutters: i = !1,
148
149
  focusVisibleClassName: b,
149
- role: F = "menuitem",
150
+ role: k = "menuitem",
150
151
  tabIndex: y,
151
- className: S,
152
+ className: F,
152
153
  ...L
153
154
  } = n, x = d.useContext(I), C = d.useMemo(() => ({
154
155
  dense: r || x.dense || !1,
155
156
  disableGutters: i
156
157
  }), [x.dense, r, i]), g = d.useRef(null);
157
- q(() => {
158
+ J(() => {
158
159
  l && (g.current ? g.current.focus() : process.env.NODE_ENV !== "production" && console.error("MUI: Unable to set focus to a MenuItem whose component has not been rendered."));
159
160
  }, [l]);
160
161
  const T = {
161
162
  ...n,
162
163
  dense: C.dense,
163
- divider: c,
164
+ divider: p,
164
165
  disableGutters: i
165
- }, v = X(n), N = J(g, o);
166
+ }, v = Y(n), N = K(g, a);
166
167
  let O;
167
- return n.disabled || (O = y !== void 0 ? y : -1), /* @__PURE__ */ p.jsx(I.Provider, {
168
+ return n.disabled || (O = y !== void 0 ? y : -1), /* @__PURE__ */ c.jsx(I.Provider, {
168
169
  value: C,
169
- children: /* @__PURE__ */ p.jsx(Y, {
170
+ children: /* @__PURE__ */ c.jsx(ee, {
170
171
  ref: N,
171
- role: F,
172
+ role: k,
172
173
  tabIndex: O,
173
174
  component: u,
174
175
  focusVisibleClassName: M(v.focusVisible, b),
175
- className: M(v.root, S),
176
+ className: M(v.root, F),
176
177
  ...L,
177
178
  ownerState: T,
178
179
  classes: v
@@ -189,44 +190,44 @@ process.env.NODE_ENV !== "production" && (P.propTypes = {
189
190
  * Focus will also be triggered if the value changes from false to true.
190
191
  * @default false
191
192
  */
192
- autoFocus: a.bool,
193
+ autoFocus: o.bool,
193
194
  /**
194
195
  * The content of the component.
195
196
  */
196
- children: a.node,
197
+ children: o.node,
197
198
  /**
198
199
  * Override or extend the styles applied to the component.
199
200
  */
200
- classes: a.object,
201
+ classes: o.object,
201
202
  /**
202
203
  * @ignore
203
204
  */
204
- className: a.string,
205
+ className: o.string,
205
206
  /**
206
207
  * The component used for the root node.
207
208
  * Either a string to use a HTML element or a component.
208
209
  */
209
- component: a.elementType,
210
+ component: o.elementType,
210
211
  /**
211
212
  * If `true`, compact vertical padding designed for keyboard and mouse input is used.
212
213
  * The prop defaults to the value inherited from the parent Menu component.
213
214
  * @default false
214
215
  */
215
- dense: a.bool,
216
+ dense: o.bool,
216
217
  /**
217
218
  * @ignore
218
219
  */
219
- disabled: a.bool,
220
+ disabled: o.bool,
220
221
  /**
221
222
  * If `true`, the left and right padding is removed.
222
223
  * @default false
223
224
  */
224
- disableGutters: a.bool,
225
+ disableGutters: o.bool,
225
226
  /**
226
227
  * If `true`, a 1px light border is added to the bottom of the menu item.
227
228
  * @default false
228
229
  */
229
- divider: a.bool,
230
+ divider: o.bool,
230
231
  /**
231
232
  * This prop can help identify which element has keyboard focus.
232
233
  * The class name will be applied when the element gains the focus through keyboard interaction.
@@ -235,26 +236,26 @@ process.env.NODE_ENV !== "production" && (P.propTypes = {
235
236
  * A [polyfill can be used](https://github.com/WICG/focus-visible) to apply a `focus-visible` class to other components
236
237
  * if needed.
237
238
  */
238
- focusVisibleClassName: a.string,
239
+ focusVisibleClassName: o.string,
239
240
  /**
240
241
  * @ignore
241
242
  */
242
- role: a.string,
243
+ role: o.string,
243
244
  /**
244
245
  * If `true`, the component is selected.
245
246
  * @default false
246
247
  */
247
- selected: a.bool,
248
+ selected: o.bool,
248
249
  /**
249
250
  * The system prop that allows defining system overrides as well as additional CSS styles.
250
251
  */
251
- sx: a.oneOfType([a.arrayOf(a.oneOfType([a.func, a.object, a.bool])), a.func, a.object]),
252
+ sx: o.oneOfType([o.arrayOf(o.oneOfType([o.func, o.object, o.bool])), o.func, o.object]),
252
253
  /**
253
254
  * @default 0
254
255
  */
255
- tabIndex: a.number
256
+ tabIndex: o.number
256
257
  });
257
- const ee = /* @__PURE__ */ new Map([
258
+ const te = /* @__PURE__ */ new Map([
258
259
  [
259
260
  "bold",
260
261
  /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M216.49,104.49l-80,80a12,12,0,0,1-17,0l-80-80a12,12,0,0,1,17-17L128,159l71.51-71.52a12,12,0,0,1,17,17Z" }))
@@ -280,29 +281,29 @@ const ee = /* @__PURE__ */ new Map([
280
281
  /* @__PURE__ */ s.createElement(s.Fragment, null, /* @__PURE__ */ s.createElement("path", { d: "M210.83,98.83l-80,80a4,4,0,0,1-5.66,0l-80-80a4,4,0,0,1,5.66-5.66L128,170.34l77.17-77.17a4,4,0,1,1,5.66,5.66Z" }))
281
282
  ]
282
283
  ]);
283
- var te = Object.defineProperty, ae = Object.defineProperties, oe = Object.getOwnPropertyDescriptors, w = Object.getOwnPropertySymbols, se = Object.prototype.hasOwnProperty, re = Object.prototype.propertyIsEnumerable, R = (e, t, o) => t in e ? te(e, t, { enumerable: !0, configurable: !0, writable: !0, value: o }) : e[t] = o, ne = (e, t) => {
284
- for (var o in t || (t = {}))
285
- se.call(t, o) && R(e, o, t[o]);
284
+ var ae = Object.defineProperty, oe = Object.defineProperties, se = Object.getOwnPropertyDescriptors, w = Object.getOwnPropertySymbols, re = Object.prototype.hasOwnProperty, ne = Object.prototype.propertyIsEnumerable, h = (e, t, a) => t in e ? ae(e, t, { enumerable: !0, configurable: !0, writable: !0, value: a }) : e[t] = a, le = (e, t) => {
285
+ for (var a in t || (t = {}))
286
+ re.call(t, a) && h(e, a, t[a]);
286
287
  if (w)
287
- for (var o of w(t))
288
- re.call(t, o) && R(e, o, t[o]);
288
+ for (var a of w(t))
289
+ ne.call(t, a) && h(e, a, t[a]);
289
290
  return e;
290
- }, le = (e, t) => ae(e, oe(t));
291
- const k = B((e, t) => /* @__PURE__ */ s.createElement(Z, le(ne({ ref: t }, e), { weights: ee })));
292
- k.displayName = "CaretDown";
293
- function Oe({ label: e, onChange: t, options: o, value: n = [] }) {
291
+ }, ie = (e, t) => oe(e, se(t));
292
+ const S = B((e, t) => /* @__PURE__ */ s.createElement(Z, ie(le({ ref: t }, e), { weights: te })));
293
+ S.displayName = "CaretDown";
294
+ function Me({ label: e, onChange: t, options: a, value: n = [] }) {
294
295
  const l = D(), u = d.useCallback(
295
- (r, c) => {
296
+ (r, p) => {
296
297
  let i = [...n];
297
- c ? i.push(r) : i = i.filter((b) => b !== r), t == null || t(i);
298
+ p ? i.push(r) : i = i.filter((b) => b !== r), t == null || t(i);
298
299
  },
299
300
  [t, n]
300
301
  );
301
- return /* @__PURE__ */ p.jsxs(d.Fragment, { children: [
302
- /* @__PURE__ */ p.jsx(
302
+ return /* @__PURE__ */ c.jsxs(d.Fragment, { children: [
303
+ /* @__PURE__ */ c.jsx(
303
304
  V,
304
305
  {
305
- endIcon: /* @__PURE__ */ p.jsx(k, {}),
306
+ endIcon: /* @__PURE__ */ c.jsx(S, {}),
306
307
  onClick: l.handleOpen,
307
308
  ref: l.anchorRef,
308
309
  sx: {
@@ -311,31 +312,32 @@ function Oe({ label: e, onChange: t, options: o, value: n = [] }) {
311
312
  children: e
312
313
  }
313
314
  ),
314
- /* @__PURE__ */ p.jsx(
315
- H,
315
+ /* @__PURE__ */ c.jsx(
316
+ G,
316
317
  {
317
318
  anchorEl: l.anchorRef.current,
318
319
  onClose: l.handleClose,
319
320
  open: l.open,
320
321
  slotProps: { paper: { sx: { width: "250px" } } },
321
- children: o.map((r) => {
322
- const c = n.includes(r.value);
323
- return /* @__PURE__ */ p.jsx(
322
+ children: a.map((r) => {
323
+ const p = n.includes(r.value);
324
+ return /* @__PURE__ */ c.jsx(
324
325
  P,
325
326
  {
326
327
  onClick: () => {
327
- u(r.value, !c);
328
+ u(r.value, !p);
328
329
  },
329
- selected: c,
330
+ selected: p,
330
331
  children: r.label
331
332
  },
332
333
  r.label
333
334
  );
334
335
  })
335
336
  }
336
- )
337
+ ),
338
+ /* @__PURE__ */ c.jsx(H, { chips: a.filter((r) => n.includes(r.value)).map((r) => r.label) })
337
339
  ] });
338
340
  }
339
341
  export {
340
- Oe as default
342
+ Me as default
341
343
  };
@@ -1,15 +1,18 @@
1
1
  import { SelectProps } from '@mui/material';
2
- type SSelectProps = Omit<SelectProps, 'error' | 'variant'> & {
3
- options?: any[];
4
- optionLabel?: string;
5
- optionValue?: any;
2
+ type BaseOption = string | number | {
3
+ [key: string]: unknown;
4
+ };
5
+ type SSelectProps<T extends BaseOption = string> = Omit<SelectProps, 'error' | 'variant'> & {
6
+ options?: T[];
7
+ optionLabel?: T extends object ? keyof T : never;
8
+ optionValue?: T extends object ? keyof T : never;
6
9
  placeholder?: string;
7
10
  variant?: 'outlined' | 'filled' | 'standard';
8
- label?: string;
11
+ label?: string | React.ReactNode;
9
12
  error?: string;
10
13
  required?: boolean;
11
14
  simple?: boolean;
12
15
  htmlFor?: string;
13
16
  };
14
- declare const SSelect: import('react').ForwardRefExoticComponent<Omit<SSelectProps, "ref"> & import('react').RefAttributes<unknown>>;
17
+ declare const SSelect: import('react').ForwardRefExoticComponent<Omit<SSelectProps<BaseOption>, "ref"> & import('react').RefAttributes<HTMLDivElement>>;
15
18
  export default SSelect;
@@ -1,54 +1,61 @@
1
- import { j as n } from "../jsx-runtime-C5mzlN2N.js";
2
- import { forwardRef as E, useState as R, useEffect as g } from "react";
3
- import { Select as w, MenuItem as I } from "@mui/material";
4
- import M from "../s-form/s-form.js";
5
- const z = E(
1
+ import { j as d } from "../jsx-runtime-C5mzlN2N.js";
2
+ import { forwardRef as h, useState as m, useEffect as V } from "react";
3
+ import { Select as E, MenuItem as O } from "@mui/material";
4
+ import R from "../s-form/s-form.js";
5
+ const M = h(
6
6
  ({
7
- options: e = [],
8
- optionLabel: t = "name",
9
- optionValue: f = "id",
10
- placeholder: s,
11
- label: x = "",
12
- error: j,
13
- required: h = !1,
14
- variant: W = "outlined",
15
- simple: a = !1,
16
- htmlFor: c,
17
- ...u
18
- }, y) => {
19
- const [S, m] = R(u.value ?? null);
20
- return g(() => {
21
- m(u.value ?? null);
22
- }, [u.value]), /* @__PURE__ */ n.jsx(M, { error: j, label: x, required: h, htmlFor: c, children: /* @__PURE__ */ n.jsx(
23
- w,
7
+ options: l = [],
8
+ optionLabel: o = "name",
9
+ optionValue: c = "id",
10
+ placeholder: i,
11
+ label: v = "",
12
+ error: x,
13
+ required: y = !1,
14
+ variant: $ = "outlined",
15
+ simple: g = !1,
16
+ htmlFor: s,
17
+ ...t
18
+ }, j) => {
19
+ const [S, p] = m(t.value ?? null);
20
+ V(() => {
21
+ p(t.value ?? null);
22
+ }, [t.value]);
23
+ const u = (e) => String(typeof e == "string" || typeof e == "number" ? e : e[o]), n = (e) => typeof e == "string" || typeof e == "number" ? e : e[c];
24
+ return /* @__PURE__ */ d.jsx(R, { error: x, label: v, required: y, htmlFor: s, children: /* @__PURE__ */ d.jsx(
25
+ E,
24
26
  {
25
- id: c,
27
+ id: s,
26
28
  displayEmpty: !0,
27
29
  fullWidth: !0,
28
30
  defaultValue: "",
29
- ref: y,
30
- renderValue: u.multiple ? (r) => {
31
- var d;
32
- return (d = e.filter((l) => r == null ? void 0 : r.includes(l[f]))) == null ? void 0 : d.map((l) => l[t]).join(", ");
33
- } : (r) => {
34
- var d;
35
- return r !== null && typeof r < "u" && r !== "" ? a ? e.find((l) => l == r) : (d = e.find((l) => l[f] == r)) == null ? void 0 : d[t] : /* @__PURE__ */ n.jsx("span", { style: { color: "var(--mui-palette-text-secondary)" }, children: s });
31
+ ref: j,
32
+ renderValue: t.multiple ? (e) => e.map((a) => {
33
+ const f = l.find((b) => n(b) === n(a));
34
+ return f ? u(f) : "";
35
+ }).filter(Boolean).join(", ") : (e) => {
36
+ const r = e;
37
+ if (r == null || r === "")
38
+ return /* @__PURE__ */ d.jsx("span", { style: { color: "var(--mui-palette-text-secondary)" }, children: i });
39
+ if (g)
40
+ return u(r);
41
+ const a = l.find((f) => n(f) === n(r));
42
+ return a ? u(a) : "";
36
43
  },
37
- ...u,
38
- value: e.length ? S ?? "" : "",
39
- children: e == null ? void 0 : e.map((r, d) => /* @__PURE__ */ n.jsx(
40
- I,
44
+ ...t,
45
+ value: l.length ? S ?? "" : "",
46
+ children: l == null ? void 0 : l.map((e, r) => /* @__PURE__ */ d.jsx(
47
+ O,
41
48
  {
42
- disabled: (r == null ? void 0 : r.disabled) ?? !1,
43
- value: a ? r : r[f],
44
- children: a ? r : r[t]
49
+ disabled: (e == null ? void 0 : e.disabled) ?? !1,
50
+ value: n(e),
51
+ children: u(e)
45
52
  },
46
- (a ? r : r[f]) + d
53
+ `${n(e)}-${r}`
47
54
  ))
48
55
  }
49
56
  ) });
50
57
  }
51
58
  );
52
59
  export {
53
- z as default
60
+ M as default
54
61
  };
@@ -1,7 +1,7 @@
1
1
  import { default as React } from 'react';
2
2
  import { TextField } from '@mui/material';
3
3
  type STextFieldProps = Omit<React.ComponentProps<typeof TextField>, 'error'> & {
4
- label?: string;
4
+ label?: string | React.ReactNode;
5
5
  required?: boolean;
6
6
  error?: string;
7
7
  htmlFor?: string;
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org"
5
5
  },
6
- "version": "1.0.13",
6
+ "version": "1.0.15",
7
7
  "description": "advanced ui kit for solostylist",
8
8
  "private": false,
9
9
  "type": "module",