@umami/react-zen 0.136.0 → 0.137.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.
package/dist/index.d.mts CHANGED
@@ -443,8 +443,11 @@ interface ListProps extends ListBoxProps<any> {
443
443
  separatorProperty?: string;
444
444
  highlightColor?: string;
445
445
  showCheckmark?: boolean;
446
+ label?: string;
447
+ value?: string[];
448
+ onChange?: (value: string[]) => void;
446
449
  }
447
- declare function List({ items, idProperty, labelProperty, separatorProperty, highlightColor, showCheckmark, className, style, children, ...props }: ListProps): react.JSX.Element;
450
+ declare function List({ items, idProperty, labelProperty, separatorProperty, highlightColor, showCheckmark, label, value, onChange, className, selectedKeys, defaultSelectedKeys, onSelectionChange, style, children, ...props }: ListProps): react.JSX.Element;
448
451
  interface ListItemProps extends ListBoxItemProps<any> {
449
452
  showCheckmark?: boolean;
450
453
  }
package/dist/index.d.ts CHANGED
@@ -443,8 +443,11 @@ interface ListProps extends ListBoxProps<any> {
443
443
  separatorProperty?: string;
444
444
  highlightColor?: string;
445
445
  showCheckmark?: boolean;
446
+ label?: string;
447
+ value?: string[];
448
+ onChange?: (value: string[]) => void;
446
449
  }
447
- declare function List({ items, idProperty, labelProperty, separatorProperty, highlightColor, showCheckmark, className, style, children, ...props }: ListProps): react.JSX.Element;
450
+ declare function List({ items, idProperty, labelProperty, separatorProperty, highlightColor, showCheckmark, label, value, onChange, className, selectedKeys, defaultSelectedKeys, onSelectionChange, style, children, ...props }: ListProps): react.JSX.Element;
448
451
  interface ListItemProps extends ListBoxItemProps<any> {
449
452
  showCheckmark?: boolean;
450
453
  }
package/dist/index.js CHANGED
@@ -31251,29 +31251,47 @@ function List({
31251
31251
  separatorProperty = "separatpr",
31252
31252
  highlightColor,
31253
31253
  showCheckmark = true,
31254
+ label,
31255
+ value,
31256
+ onChange,
31254
31257
  className,
31258
+ selectedKeys,
31259
+ defaultSelectedKeys,
31260
+ onSelectionChange,
31255
31261
  style,
31256
31262
  children,
31257
31263
  ...props
31258
31264
  }) {
31259
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
31260
- $eed445e0843c11d0$export$41f133550aa26f48,
31261
- {
31262
- "aria-label": "list",
31263
- ...props,
31264
- items,
31265
- className: (0, import_classnames33.default)(List_default.list, className, !showCheckmark && List_default.hideCheckmark),
31266
- style: { ...style, ...getHighlightColor(highlightColor) },
31267
- children: children || items?.map((item) => {
31268
- const id = item[idProperty] || item.toString();
31269
- const label = item[labelProperty] || item.toString();
31270
- return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react183.Fragment, { children: [
31271
- item[separatorProperty] && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)($431f98aba6844401$export$1ff3c3f08ae963c0, { className: List_default.separator }),
31272
- /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ListItem, { id, className: List_default.item, children: label })
31273
- ] }, id);
31274
- })
31265
+ const handleSelectionChange = (keys) => {
31266
+ onSelectionChange?.(keys);
31267
+ if (keys !== "all") {
31268
+ onChange?.([...keys].map(String));
31275
31269
  }
31276
- );
31270
+ };
31271
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_jsx_runtime48.Fragment, { children: [
31272
+ label && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(Label2, { children: label }),
31273
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(
31274
+ $eed445e0843c11d0$export$41f133550aa26f48,
31275
+ {
31276
+ "aria-label": "list",
31277
+ ...props,
31278
+ selectedKeys: value || selectedKeys,
31279
+ defaultSelectedKeys: value || defaultSelectedKeys,
31280
+ items,
31281
+ className: (0, import_classnames33.default)(List_default.list, className, !showCheckmark && List_default.hideCheckmark),
31282
+ onSelectionChange: handleSelectionChange,
31283
+ style: { ...style, ...getHighlightColor(highlightColor) },
31284
+ children: children || items?.map((item) => {
31285
+ const id = item[idProperty] || item.toString();
31286
+ const label2 = item[labelProperty] || item.toString();
31287
+ return /* @__PURE__ */ (0, import_jsx_runtime48.jsxs)(import_react183.Fragment, { children: [
31288
+ item[separatorProperty] && /* @__PURE__ */ (0, import_jsx_runtime48.jsx)($431f98aba6844401$export$1ff3c3f08ae963c0, { className: List_default.separator }),
31289
+ /* @__PURE__ */ (0, import_jsx_runtime48.jsx)(ListItem, { id, className: List_default.item, children: label2 })
31290
+ ] }, id);
31291
+ })
31292
+ }
31293
+ )
31294
+ ] });
31277
31295
  }
31278
31296
  function ListItem({
31279
31297
  id,
package/dist/index.mjs CHANGED
@@ -31128,7 +31128,7 @@ function getHighlightColor(color) {
31128
31128
  var List_default = { "list": "List_list__ZTQ5M", "separator": "List_separator__Zjk5Y", "section": "List_section__MDgwZ", "header": "List_header__MjUxO", "item": "List_item__NTg2Z", "checkmark": "List_checkmark__M2M5Y", "hideCheckmark": "List_hideCheckmark__YmNlM" };
31129
31129
 
31130
31130
  // src/components/List.tsx
31131
- import { jsx as jsx48, jsxs as jsxs25 } from "react/jsx-runtime";
31131
+ import { Fragment as Fragment8, jsx as jsx48, jsxs as jsxs25 } from "react/jsx-runtime";
31132
31132
  function List({
31133
31133
  items,
31134
31134
  idProperty = "id",
@@ -31136,29 +31136,47 @@ function List({
31136
31136
  separatorProperty = "separatpr",
31137
31137
  highlightColor,
31138
31138
  showCheckmark = true,
31139
+ label,
31140
+ value,
31141
+ onChange,
31139
31142
  className,
31143
+ selectedKeys,
31144
+ defaultSelectedKeys,
31145
+ onSelectionChange,
31140
31146
  style,
31141
31147
  children,
31142
31148
  ...props
31143
31149
  }) {
31144
- return /* @__PURE__ */ jsx48(
31145
- $eed445e0843c11d0$export$41f133550aa26f48,
31146
- {
31147
- "aria-label": "list",
31148
- ...props,
31149
- items,
31150
- className: (0, import_classnames33.default)(List_default.list, className, !showCheckmark && List_default.hideCheckmark),
31151
- style: { ...style, ...getHighlightColor(highlightColor) },
31152
- children: children || items?.map((item) => {
31153
- const id = item[idProperty] || item.toString();
31154
- const label = item[labelProperty] || item.toString();
31155
- return /* @__PURE__ */ jsxs25(Fragment7, { children: [
31156
- item[separatorProperty] && /* @__PURE__ */ jsx48($431f98aba6844401$export$1ff3c3f08ae963c0, { className: List_default.separator }),
31157
- /* @__PURE__ */ jsx48(ListItem, { id, className: List_default.item, children: label })
31158
- ] }, id);
31159
- })
31150
+ const handleSelectionChange = (keys) => {
31151
+ onSelectionChange?.(keys);
31152
+ if (keys !== "all") {
31153
+ onChange?.([...keys].map(String));
31160
31154
  }
31161
- );
31155
+ };
31156
+ return /* @__PURE__ */ jsxs25(Fragment8, { children: [
31157
+ label && /* @__PURE__ */ jsx48(Label2, { children: label }),
31158
+ /* @__PURE__ */ jsx48(
31159
+ $eed445e0843c11d0$export$41f133550aa26f48,
31160
+ {
31161
+ "aria-label": "list",
31162
+ ...props,
31163
+ selectedKeys: value || selectedKeys,
31164
+ defaultSelectedKeys: value || defaultSelectedKeys,
31165
+ items,
31166
+ className: (0, import_classnames33.default)(List_default.list, className, !showCheckmark && List_default.hideCheckmark),
31167
+ onSelectionChange: handleSelectionChange,
31168
+ style: { ...style, ...getHighlightColor(highlightColor) },
31169
+ children: children || items?.map((item) => {
31170
+ const id = item[idProperty] || item.toString();
31171
+ const label2 = item[labelProperty] || item.toString();
31172
+ return /* @__PURE__ */ jsxs25(Fragment7, { children: [
31173
+ item[separatorProperty] && /* @__PURE__ */ jsx48($431f98aba6844401$export$1ff3c3f08ae963c0, { className: List_default.separator }),
31174
+ /* @__PURE__ */ jsx48(ListItem, { id, className: List_default.item, children: label2 })
31175
+ ] }, id);
31176
+ })
31177
+ }
31178
+ )
31179
+ ] });
31162
31180
  }
31163
31181
  function ListItem({
31164
31182
  id,
@@ -31321,12 +31339,12 @@ function NavMenuItem({ isSelected, className, children, ...props }) {
31321
31339
  // src/components/PasswordField.tsx
31322
31340
  import { useState as useState15 } from "react";
31323
31341
  var import_classnames39 = __toESM(require_classnames());
31324
- import { Fragment as Fragment8, jsx as jsx54, jsxs as jsxs29 } from "react/jsx-runtime";
31342
+ import { Fragment as Fragment9, jsx as jsx54, jsxs as jsxs29 } from "react/jsx-runtime";
31325
31343
  function PasswordField({ label, className, ...props }) {
31326
31344
  const [show, setShow] = useState15(false);
31327
31345
  const type = show ? "text" : "password";
31328
31346
  const handleShowPassword = () => setShow((state) => !state);
31329
- return /* @__PURE__ */ jsxs29(Fragment8, { children: [
31347
+ return /* @__PURE__ */ jsxs29(Fragment9, { children: [
31330
31348
  label && /* @__PURE__ */ jsx54(Label2, { children: label }),
31331
31349
  /* @__PURE__ */ jsxs29($bcdf0525bf22703d$export$2c73285ae9390cec, { "aria-label": "Password", ...props, className: (0, import_classnames39.default)(TextField_default.field, className), children: [
31332
31350
  /* @__PURE__ */ jsx54($3985021b0ad6602f$export$f5b8910cec6cf069, { type }),
@@ -31354,10 +31372,10 @@ var import_classnames41 = __toESM(require_classnames());
31354
31372
  var ProgressBar_default = { "progressbar": "ProgressBar_progressbar__YzdlO", "track": "ProgressBar_track__YzgzY", "fill": "ProgressBar_fill__ZTJlM", "value": "ProgressBar_value__NDk1Z" };
31355
31373
 
31356
31374
  // src/components/ProgressBar.tsx
31357
- import { Fragment as Fragment9, jsx as jsx56, jsxs as jsxs30 } from "react/jsx-runtime";
31375
+ import { Fragment as Fragment10, jsx as jsx56, jsxs as jsxs30 } from "react/jsx-runtime";
31358
31376
  function ProgressBar2({ className, showPercentage, ...props }) {
31359
31377
  return /* @__PURE__ */ jsx56($0393f8ab869a0f1a$export$c17561cb55d4db30, { ...props, className: (0, import_classnames41.default)(ProgressBar_default.progressbar, className), children: ({ percentage = 0, valueText }) => {
31360
- return /* @__PURE__ */ jsxs30(Fragment9, { children: [
31378
+ return /* @__PURE__ */ jsxs30(Fragment10, { children: [
31361
31379
  /* @__PURE__ */ jsx56("div", { className: ProgressBar_default.track, children: /* @__PURE__ */ jsx56("div", { className: ProgressBar_default.fill, style: { width: `${percentage}%` } }) }),
31362
31380
  showPercentage && /* @__PURE__ */ jsx56("div", { className: ProgressBar_default.value, children: valueText })
31363
31381
  ] });
@@ -31371,13 +31389,13 @@ var import_classnames42 = __toESM(require_classnames());
31371
31389
  var ProgressCircle_default = { "progresscircle": "ProgressCircle_progresscircle__NGMyY", "track": "ProgressCircle_track__YzY2M", "fill": "ProgressCircle_fill__ZmMzM", "value": "ProgressCircle_value__YjM0Y" };
31372
31390
 
31373
31391
  // src/components/ProgressCircle.tsx
31374
- import { Fragment as Fragment10, jsx as jsx57, jsxs as jsxs31 } from "react/jsx-runtime";
31392
+ import { Fragment as Fragment11, jsx as jsx57, jsxs as jsxs31 } from "react/jsx-runtime";
31375
31393
  function ProgressCircle({ className, showPercentage, ...props }) {
31376
31394
  return /* @__PURE__ */ jsx57($0393f8ab869a0f1a$export$c17561cb55d4db30, { ...props, className: (0, import_classnames42.default)(ProgressCircle_default.progresscircle, className), children: ({ percentage = 0, valueText }) => {
31377
31395
  const radius = 45;
31378
31396
  const circumference = radius * 2 * Math.PI;
31379
31397
  const offset = circumference - percentage / 100 * circumference;
31380
- return /* @__PURE__ */ jsxs31(Fragment10, { children: [
31398
+ return /* @__PURE__ */ jsxs31(Fragment11, { children: [
31381
31399
  /* @__PURE__ */ jsxs31("svg", { viewBox: "0 0 100 100", xmlns: "http://www.w3.org/2000/svg", children: [
31382
31400
  /* @__PURE__ */ jsx57("circle", { className: ProgressCircle_default.track, cx: "50", cy: "50", r: "45" }),
31383
31401
  /* @__PURE__ */ jsx57(
@@ -31432,7 +31450,7 @@ function Radio2({ children, className, ...props }) {
31432
31450
  // src/components/SearchField.tsx
31433
31451
  import { useState as useState16, useEffect as useEffect12 } from "react";
31434
31452
  var import_classnames44 = __toESM(require_classnames());
31435
- import { Fragment as Fragment11, jsx as jsx59, jsxs as jsxs33 } from "react/jsx-runtime";
31453
+ import { Fragment as Fragment12, jsx as jsx59, jsxs as jsxs33 } from "react/jsx-runtime";
31436
31454
  function SearchField2({
31437
31455
  label,
31438
31456
  placeholder,
@@ -31463,7 +31481,7 @@ function SearchField2({
31463
31481
  onSearch?.(searchValue);
31464
31482
  }
31465
31483
  }, [searchValue, delay]);
31466
- return /* @__PURE__ */ jsxs33(Fragment11, { children: [
31484
+ return /* @__PURE__ */ jsxs33(Fragment12, { children: [
31467
31485
  label && /* @__PURE__ */ jsx59(Label2, { children: label }),
31468
31486
  /* @__PURE__ */ jsxs33(
31469
31487
  $440f4836bcb56932$export$b94867ecbd698f21,
@@ -31661,7 +31679,7 @@ var import_classnames47 = __toESM(require_classnames());
31661
31679
  var Slider_default = { "slider": "Slider_slider__MjBhO", "header": "Slider_header__ZTE2M", "track": "Slider_track__ODk5M", "fill": "Slider_fill__YzdhM", "thumb": "Slider_thumb__NGEzM" };
31662
31680
 
31663
31681
  // src/components/Slider.tsx
31664
- import { Fragment as Fragment12, jsx as jsx62, jsxs as jsxs36 } from "react/jsx-runtime";
31682
+ import { Fragment as Fragment13, jsx as jsx62, jsxs as jsxs36 } from "react/jsx-runtime";
31665
31683
  function Slider2({ className, showValue = true, label, ...props }) {
31666
31684
  return /* @__PURE__ */ jsxs36($6f909507e6374d18$export$472062a354075cee, { ...props, className: (0, import_classnames47.default)(Slider_default.slider, className), children: [
31667
31685
  /* @__PURE__ */ jsxs36("div", { className: Slider_default.header, children: [
@@ -31670,7 +31688,7 @@ function Slider2({ className, showValue = true, label, ...props }) {
31670
31688
  ] }),
31671
31689
  /* @__PURE__ */ jsx62($6f909507e6374d18$export$105594979f116971, { className: Slider_default.track, children: ({ state }) => {
31672
31690
  const isHorizontal = state.orientation === "horizontal";
31673
- return /* @__PURE__ */ jsxs36(Fragment12, { children: [
31691
+ return /* @__PURE__ */ jsxs36(Fragment13, { children: [
31674
31692
  /* @__PURE__ */ jsx62(
31675
31693
  "div",
31676
31694
  {
@@ -31715,10 +31733,10 @@ var import_classnames49 = __toESM(require_classnames());
31715
31733
  var Switch_default = { "switch": "Switch_switch__NzI0O", "track": "Switch_track__ZWU0O", "knob": "Switch_knob__YjFmZ" };
31716
31734
 
31717
31735
  // src/components/Switch.tsx
31718
- import { Fragment as Fragment13, jsx as jsx64, jsxs as jsxs38 } from "react/jsx-runtime";
31736
+ import { Fragment as Fragment14, jsx as jsx64, jsxs as jsxs38 } from "react/jsx-runtime";
31719
31737
  function Switch2({ label, children, className, ...props }) {
31720
31738
  const isSelected = typeof props.value !== "undefined" ? !!props.value : void 0;
31721
- return /* @__PURE__ */ jsxs38(Fragment13, { children: [
31739
+ return /* @__PURE__ */ jsxs38(Fragment14, { children: [
31722
31740
  label && /* @__PURE__ */ jsx64(Label2, { children: label }),
31723
31741
  /* @__PURE__ */ jsxs38(
31724
31742
  $8e59e948500a8fe1$export$b5d5cf8927ab7262,
@@ -31810,10 +31828,10 @@ var import_classnames51 = __toESM(require_classnames());
31810
31828
  var Toggle_default = { "toggle": "Toggle_toggle__OWVjZ" };
31811
31829
 
31812
31830
  // src/components/Toggle.tsx
31813
- import { Fragment as Fragment14, jsx as jsx67, jsxs as jsxs40 } from "react/jsx-runtime";
31831
+ import { Fragment as Fragment15, jsx as jsx67, jsxs as jsxs40 } from "react/jsx-runtime";
31814
31832
  function Toggle({ label, children, className, ...props }) {
31815
31833
  const isSelected = typeof props.value !== "undefined" ? !!props.value : void 0;
31816
- return /* @__PURE__ */ jsxs40(Fragment14, { children: [
31834
+ return /* @__PURE__ */ jsxs40(Fragment15, { children: [
31817
31835
  label && /* @__PURE__ */ jsx67(Label2, { children: label }),
31818
31836
  /* @__PURE__ */ jsx67(
31819
31837
  $efde0372d7a700fe$export$d2b052e7b4be1756,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@umami/react-zen",
3
- "version": "0.136.0",
3
+ "version": "0.137.0",
4
4
  "description": "Modern, minimalist React component library",
5
5
  "author": "Umami <hello@umami.is>",
6
6
  "license": "MIT",