@staffbase/design 19.1.0 → 20.0.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/main.cjs CHANGED
@@ -11,35 +11,15 @@ See the License for the specific language governing permissions and
11
11
  limitations under the License.
12
12
  */
13
13
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
14
- //#region \0rolldown/runtime.js
15
- var __create = Object.create;
16
- var __defProp = Object.defineProperty;
17
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
18
- var __getOwnPropNames = Object.getOwnPropertyNames;
19
- var __getProtoOf = Object.getPrototypeOf;
20
- var __hasOwnProp = Object.prototype.hasOwnProperty;
21
- var __copyProps = (to, from, except, desc) => {
22
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
23
- key = keys[i];
24
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
25
- get: ((k) => from[k]).bind(null, key),
26
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
27
- });
28
- }
29
- return to;
30
- };
31
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
32
- value: mod,
33
- enumerable: true
34
- }) : target, mod));
35
- //#endregion
14
+ const require_chunk = require("./chunk-CDHmpCQf.cjs");
36
15
  let _floating_ui_react = require("@floating-ui/react");
37
16
  let clsx = require("clsx");
38
- clsx = __toESM(clsx, 1);
17
+ clsx = require_chunk.__toESM(clsx, 1);
39
18
  let react = require("react");
40
- react = __toESM(react, 1);
19
+ react = require_chunk.__toESM(react, 1);
41
20
  let react_jsx_runtime = require("react/jsx-runtime");
42
21
  let _base_ui_react = require("@base-ui/react");
22
+ let _base_ui_react_avatar = require("@base-ui/react/avatar");
43
23
  let _base_ui_react_drawer = require("@base-ui/react/drawer");
44
24
  let _base_ui_react_field = require("@base-ui/react/field");
45
25
  let react_dropzone = require("react-dropzone");
@@ -48,14 +28,14 @@ let motion_react = require("motion/react");
48
28
  let _base_ui_react_menu = require("@base-ui/react/menu");
49
29
  let _base_ui_react_number_field = require("@base-ui/react/number-field");
50
30
  let _radix_ui_react_popover = require("@radix-ui/react-popover");
51
- _radix_ui_react_popover = __toESM(_radix_ui_react_popover, 1);
31
+ _radix_ui_react_popover = require_chunk.__toESM(_radix_ui_react_popover, 1);
52
32
  let _base_ui_react_combobox = require("@base-ui/react/combobox");
53
33
  let _base_ui_react_radio = require("@base-ui/react/radio");
54
34
  let _base_ui_react_radio_group = require("@base-ui/react/radio-group");
55
35
  let _base_ui_react_select = require("@base-ui/react/select");
56
36
  let _base_ui_react_switch = require("@base-ui/react/switch");
57
37
  let _radix_ui_react_tabs = require("@radix-ui/react-tabs");
58
- _radix_ui_react_tabs = __toESM(_radix_ui_react_tabs, 1);
38
+ _radix_ui_react_tabs = require_chunk.__toESM(_radix_ui_react_tabs, 1);
59
39
  let _base_ui_react_input = require("@base-ui/react/input");
60
40
  let _base_ui_react_tooltip = require("@base-ui/react/tooltip");
61
41
  //#region src/components/actionMenu/ActionMenuContext.tsx
@@ -273,11 +253,24 @@ ActionMenuItemIcon.displayName = "ActionMenuItemIcon";
273
253
  ActionMenuItemLabel.displayName = "ActionMenuItemLabel";
274
254
  //#endregion
275
255
  //#region src/components/button/Button.tsx
256
+ function buttonVariants({ variant = "solid", color = "primary", iconOnly, className } = {}) {
257
+ return {
258
+ className: (0, clsx.default)("ds-button", className),
259
+ "data-variant": variant,
260
+ "data-color": color,
261
+ "data-icon-only": iconOnly ? true : void 0
262
+ };
263
+ }
276
264
  var Button = (0, react.forwardRef)((props, ref) => {
277
- const { children, className, variant = "solid", color = "primary", iconOnly = false, ...rest } = props;
265
+ const { children, className, variant, color, iconOnly, ...rest } = props;
278
266
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
279
267
  "data-c13y-component": "button",
280
- className: (0, clsx.default)("ds-button", `ds-button--${variant}`, `ds-button--${color}`, { "ds-button--icon-only": iconOnly }, className),
268
+ ...buttonVariants({
269
+ variant,
270
+ color,
271
+ iconOnly,
272
+ className
273
+ }),
281
274
  ...rest,
282
275
  ref,
283
276
  children
@@ -336,7 +329,7 @@ var Popup$6 = (0, react.forwardRef)((props, ref) => {
336
329
  })]
337
330
  });
338
331
  });
339
- var Title$2 = (0, react.forwardRef)((props, ref) => {
332
+ var Title$3 = (0, react.forwardRef)((props, ref) => {
340
333
  const { className, ...rest } = props;
341
334
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.AlertDialog.Title, {
342
335
  "data-c13y-component": "alert-dialog-title",
@@ -345,7 +338,7 @@ var Title$2 = (0, react.forwardRef)((props, ref) => {
345
338
  ref
346
339
  });
347
340
  });
348
- var Description$3 = (0, react.forwardRef)((props, ref) => {
341
+ var Description$4 = (0, react.forwardRef)((props, ref) => {
349
342
  const { className, ...rest } = props;
350
343
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.AlertDialog.Description, {
351
344
  "data-c13y-component": "alert-dialog-description",
@@ -360,11 +353,70 @@ var AlertDialog = {
360
353
  Popup: Popup$6,
361
354
  Cancel,
362
355
  Action: Action$1,
363
- Title: Title$2,
364
- Description: Description$3,
356
+ Title: Title$3,
357
+ Description: Description$4,
365
358
  Icon: Icon$1
366
359
  };
367
360
  //#endregion
361
+ //#region src/components/avatar/Avatar.tsx
362
+ var Root$10 = (0, react.forwardRef)((props, ref) => {
363
+ const { size = 40, className, ...rest } = props;
364
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_avatar.Avatar.Root, {
365
+ ref,
366
+ "data-size": size,
367
+ className: (0, clsx.default)("ds-avatar", className),
368
+ ...rest
369
+ });
370
+ });
371
+ var Image = (0, react.forwardRef)((props, ref) => {
372
+ const { className, ...rest } = props;
373
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_avatar.Avatar.Image, {
374
+ "data-c13y-component": "avatar",
375
+ ref,
376
+ className: (0, clsx.default)("ds-avatar__image", className),
377
+ ...rest
378
+ });
379
+ });
380
+ var AVATAR_COLORS = [
381
+ "cyan",
382
+ "pink",
383
+ "purple",
384
+ "teal"
385
+ ];
386
+ function deriveColor(name) {
387
+ return AVATAR_COLORS[name.split("").reduce((acc, char) => acc + (char.codePointAt(0) ?? 0), 0) % AVATAR_COLORS.length] ?? "purple";
388
+ }
389
+ var Avatar = {
390
+ Root: Root$10,
391
+ Fallback: (0, react.forwardRef)((props, ref) => {
392
+ const { className, name, ...rest } = props;
393
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_avatar.Avatar.Fallback, {
394
+ "data-c13y-component": "avatar",
395
+ ref,
396
+ "data-color": name ? deriveColor(name) : void 0,
397
+ className: (0, clsx.default)("ds-avatar__fallback", className),
398
+ ...rest
399
+ });
400
+ }),
401
+ Group: (0, react.forwardRef)((props, ref) => {
402
+ const { className, ...rest } = props;
403
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
404
+ ref,
405
+ className: (0, clsx.default)("ds-avatar__group", className),
406
+ ...rest
407
+ });
408
+ }),
409
+ GroupCount: (0, react.forwardRef)((props, ref) => {
410
+ const { className, ...rest } = props;
411
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
412
+ ref,
413
+ className: (0, clsx.default)("ds-avatar__group-count", className),
414
+ ...rest
415
+ });
416
+ }),
417
+ Image
418
+ };
419
+ //#endregion
368
420
  //#region src/icons/AddCircleIcon.tsx
369
421
  /**
370
422
  * THIS IS A GENERATED FILE. PLEASE SEE `scripts/iconGenerator`.
@@ -8807,8 +8859,9 @@ var Icon = ({ name, ...props }) => {
8807
8859
  }) : null;
8808
8860
  };
8809
8861
  //#endregion
8810
- //#region src/components/avatar/Avatar.tsx
8811
- function Avatar(props) {
8862
+ //#region src/components/avatarDeprecated/AvatarDeprecated.tsx
8863
+ /** @deprecated Use `Avatar` from `@staffbase/design` instead */
8864
+ function AvatarDeprecated(props) {
8812
8865
  const { alt, children, className = "", color = "purple", size = "32", src } = props;
8813
8866
  const [hasImage, setHasImage] = (0, react.useState)(src !== void 0 && src !== "");
8814
8867
  const variant = typeof children === "string" && children !== "" ? color : "grey";
@@ -8818,20 +8871,18 @@ function Avatar(props) {
8818
8871
  const attrs = { title: alt };
8819
8872
  if (hasImage) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
8820
8873
  ...attrs,
8821
- "data-c13y-component": "avatar",
8822
- className: (0, clsx.default)("ds-avatar", "ds-avatar__image", `ds-avatar--size-${size}`, className),
8874
+ className: (0, clsx.default)("ds-avatar-deprecated", "ds-avatar-deprecated__image", `ds-avatar--size-${size}`, className),
8823
8875
  src,
8824
8876
  alt,
8825
8877
  onError: () => setHasImage(false)
8826
8878
  });
8827
8879
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
8828
8880
  ...attrs,
8829
- "data-c13y-component": "avatar",
8830
- className: (0, clsx.default)("ds-avatar", "ds-avatar--default", `ds-avatar--${variant}`, `ds-avatar--size-${size}`, className),
8881
+ className: (0, clsx.default)("ds-avatar-deprecated", "ds-avatar--default", `ds-avatar--${variant}`, `ds-avatar--size-${size}`, className),
8831
8882
  children: children ?? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(UserIcon_default, {})
8832
8883
  });
8833
8884
  }
8834
- Avatar.displayName = "Avatar";
8885
+ AvatarDeprecated.displayName = "Avatar";
8835
8886
  //#endregion
8836
8887
  //#region src/components/badge/Badge.tsx
8837
8888
  function Badge(props) {
@@ -8859,7 +8910,7 @@ var ICONS = {
8859
8910
  warning: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(WarningIcon_default, {}),
8860
8911
  critical: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(AlertIcon_default, {})
8861
8912
  };
8862
- var Root$8 = (0, react.forwardRef)((props, ref) => {
8913
+ var Root$9 = (0, react.forwardRef)((props, ref) => {
8863
8914
  const { children, className, variant = "info", size = "sm", layout = "standalone", ...restProps } = props;
8864
8915
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
8865
8916
  "data-c13y-component": "banner",
@@ -8876,8 +8927,8 @@ var Root$8 = (0, react.forwardRef)((props, ref) => {
8876
8927
  })]
8877
8928
  });
8878
8929
  });
8879
- Root$8.displayName = "Banner.Root";
8880
- var CloseButton = (0, react.forwardRef)((props, ref) => {
8930
+ Root$9.displayName = "Banner.Root";
8931
+ var Close$3 = (0, react.forwardRef)((props, ref) => {
8881
8932
  const { className, ...restProps } = props;
8882
8933
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("button", {
8883
8934
  ref,
@@ -8888,8 +8939,8 @@ var CloseButton = (0, react.forwardRef)((props, ref) => {
8888
8939
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(CloseIcon_default, {})
8889
8940
  });
8890
8941
  });
8891
- CloseButton.displayName = "Banner.CloseButton";
8892
- var Banner = Object.assign(Root$8, { CloseButton });
8942
+ Close$3.displayName = "Banner.Close";
8943
+ var Banner = Object.assign(Root$9, { Close: Close$3 });
8893
8944
  //#endregion
8894
8945
  //#region src/components/bottomSheet/BottomSheet.tsx
8895
8946
  var Trigger$6 = (props) => {
@@ -8900,7 +8951,7 @@ var Trigger$6 = (props) => {
8900
8951
  ref
8901
8952
  });
8902
8953
  };
8903
- var Title$1 = (0, react.forwardRef)((props, ref) => {
8954
+ var Title$2 = (0, react.forwardRef)((props, ref) => {
8904
8955
  const { className, ...rest } = props;
8905
8956
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_drawer.Drawer.Title, {
8906
8957
  "data-c13y-component": "bottom-sheet-title",
@@ -8909,7 +8960,7 @@ var Title$1 = (0, react.forwardRef)((props, ref) => {
8909
8960
  ref
8910
8961
  });
8911
8962
  });
8912
- var Description$2 = (0, react.forwardRef)((props, ref) => {
8963
+ var Description$3 = (0, react.forwardRef)((props, ref) => {
8913
8964
  const { className, ...rest } = props;
8914
8965
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_drawer.Drawer.Description, {
8915
8966
  "data-c13y-component": "bottom-sheet-description",
@@ -8983,8 +9034,8 @@ var BottomSheet = {
8983
9034
  Trigger: Trigger$6,
8984
9035
  Close: Close$2,
8985
9036
  Back,
8986
- Description: Description$2,
8987
- Title: Title$1,
9037
+ Description: Description$3,
9038
+ Title: Title$2,
8988
9039
  Action,
8989
9040
  Header: Header$1
8990
9041
  };
@@ -9154,7 +9205,7 @@ var Trigger$5 = (props) => {
9154
9205
  ref
9155
9206
  });
9156
9207
  };
9157
- var Title = (0, react.forwardRef)((props, ref) => {
9208
+ var Title$1 = (0, react.forwardRef)((props, ref) => {
9158
9209
  const { className, ...rest } = props;
9159
9210
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Dialog.Title, {
9160
9211
  "data-c13y-component": "dialog-title",
@@ -9163,7 +9214,7 @@ var Title = (0, react.forwardRef)((props, ref) => {
9163
9214
  ref
9164
9215
  });
9165
9216
  });
9166
- var Description$1 = (0, react.forwardRef)((props, ref) => {
9217
+ var Description$2 = (0, react.forwardRef)((props, ref) => {
9167
9218
  const { className, ...rest } = props;
9168
9219
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react.Dialog.Description, {
9169
9220
  "data-c13y-component": "dialog-description",
@@ -9228,8 +9279,8 @@ var Dialog = {
9228
9279
  Popup: Popup$4,
9229
9280
  Trigger: Trigger$5,
9230
9281
  Close: Close$1,
9231
- Description: Description$1,
9232
- Title,
9282
+ Description: Description$2,
9283
+ Title: Title$1,
9233
9284
  Header,
9234
9285
  Footer,
9235
9286
  Body
@@ -9263,13 +9314,63 @@ function Divider(props) {
9263
9314
  }
9264
9315
  Divider.displayName = "Divider";
9265
9316
  //#endregion
9317
+ //#region src/components/empty/Empty.tsx
9318
+ var Root$8 = (0, react.forwardRef)((props, ref) => {
9319
+ const { className, ...rest } = props;
9320
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9321
+ "data-c13y-component": "empty",
9322
+ className: (0, clsx.default)("ds-empty", className),
9323
+ ...rest,
9324
+ ref
9325
+ });
9326
+ });
9327
+ Root$8.displayName = "Empty.Root";
9328
+ var Media = (0, react.forwardRef)((props, ref) => {
9329
+ const { className, size = "md", ...rest } = props;
9330
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
9331
+ "data-c13y-component": "empty-media",
9332
+ "data-size": size,
9333
+ className: (0, clsx.default)("ds-empty__media", className),
9334
+ ...rest,
9335
+ ref
9336
+ });
9337
+ });
9338
+ Media.displayName = "Empty.Media";
9339
+ var Title = (0, react.forwardRef)((props, ref) => {
9340
+ const { className, children, as: Tag, ...rest } = props;
9341
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Tag, {
9342
+ "data-c13y-component": "empty-title",
9343
+ className: (0, clsx.default)("ds-empty__title", className),
9344
+ ...rest,
9345
+ ref,
9346
+ children
9347
+ });
9348
+ });
9349
+ Title.displayName = "Empty.Title";
9350
+ var Description$1 = (0, react.forwardRef)((props, ref) => {
9351
+ const { className, ...rest } = props;
9352
+ return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9353
+ "data-c13y-component": "empty-description",
9354
+ className: (0, clsx.default)("ds-empty__description", className),
9355
+ ...rest,
9356
+ ref
9357
+ });
9358
+ });
9359
+ Description$1.displayName = "Empty.Description";
9360
+ var Empty = {
9361
+ Root: Root$8,
9362
+ Media,
9363
+ Title,
9364
+ Description: Description$1
9365
+ };
9366
+ //#endregion
9266
9367
  //#region src/components/emptyState/EmptyState.tsx
9267
9368
  var getValidIconSize = (iconSize) => iconSize === "40px" || iconSize === "96px" ? iconSize : "40px";
9369
+ /** @deprecated Use Empty instead */
9268
9370
  function EmptyState(props) {
9269
9371
  const { title, icon, iconSize, body, className = "" } = props;
9270
9372
  const validIconSize = getValidIconSize(iconSize);
9271
9373
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
9272
- "data-c13y-component": "empty-state",
9273
9374
  className: (0, clsx.default)("ds-empty-state", className),
9274
9375
  children: [
9275
9376
  icon && (0, react.cloneElement)(icon, {
@@ -9282,12 +9383,10 @@ function EmptyState(props) {
9282
9383
  }),
9283
9384
  /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9284
9385
  className: "ds-empty-state__title",
9285
- "data-c13y-component": "empty-state-title",
9286
9386
  children: title
9287
9387
  }),
9288
9388
  body ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)("p", {
9289
9389
  className: "ds-empty-state__body",
9290
- "data-c13y-component": "empty-state-content",
9291
9390
  children: body
9292
9391
  }) : null
9293
9392
  ]
@@ -10804,7 +10903,7 @@ var Chip = (0, react.forwardRef)((props, ref) => {
10804
10903
  })]
10805
10904
  });
10806
10905
  });
10807
- var Empty$1 = (0, react.forwardRef)((props, ref) => {
10906
+ var Empty$2 = (0, react.forwardRef)((props, ref) => {
10808
10907
  const { className, ...rest } = props;
10809
10908
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.Empty, {
10810
10909
  "data-c13y-component": "searchable-multi-select-empty",
@@ -10840,7 +10939,7 @@ var SearchableMultiSelect = {
10840
10939
  Input: Input$1,
10841
10940
  Value: Value$1,
10842
10941
  Chip,
10843
- Empty: Empty$1,
10942
+ Empty: Empty$2,
10844
10943
  Collection: _base_ui_react_combobox.Combobox.Collection,
10845
10944
  Status: _base_ui_react_combobox.Combobox.Status
10846
10945
  };
@@ -10938,7 +11037,7 @@ var GroupLabel$1 = (0, react.forwardRef)((props, ref) => {
10938
11037
  ...rest
10939
11038
  });
10940
11039
  });
10941
- var Empty = (0, react.forwardRef)((props, ref) => {
11040
+ var Empty$1 = (0, react.forwardRef)((props, ref) => {
10942
11041
  const { className, ...rest } = props;
10943
11042
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_base_ui_react_combobox.Combobox.Empty, {
10944
11043
  "data-c13y-component": "searchable-single-select-empty",
@@ -10959,7 +11058,7 @@ var SearchableSingleSelect = {
10959
11058
  ItemIndicator: ItemIndicator$1,
10960
11059
  Separator: Separator$2,
10961
11060
  Input,
10962
- Empty
11061
+ Empty: Empty$1
10963
11062
  };
10964
11063
  //#endregion
10965
11064
  //#region src/components/segmentedControl/SegmentedControl.tsx
@@ -11835,6 +11934,7 @@ exports.ArrowUpIcon = ArrowUpIcon_default;
11835
11934
  exports.ArtboardIcon = ArtboardIcon_default;
11836
11935
  exports.AttachmentIcon = AttachmentIcon_default;
11837
11936
  exports.Avatar = Avatar;
11937
+ exports.AvatarDeprecated = AvatarDeprecated;
11838
11938
  exports.Badge = Badge;
11839
11939
  exports.Banner = Banner;
11840
11940
  exports.BarChartIcon = BarChartIcon_default;
@@ -11899,6 +11999,7 @@ exports.EmailFollowUpIcon = EmailFollowUpIcon_default;
11899
11999
  exports.EmailIcon = EmailIcon_default;
11900
12000
  exports.EmailOpenIcon = EmailOpenIcon_default;
11901
12001
  exports.EmailTeamsIcon = EmailTeamsIcon_default;
12002
+ exports.Empty = Empty;
11902
12003
  exports.EmptyState = EmptyState;
11903
12004
  exports.ExpandHorizontalIcon = ExpandHorizontalIcon_default;
11904
12005
  exports.ExpandIcon = ExpandIcon_default;
@@ -12139,6 +12240,7 @@ exports.ViewAltIcon = ViewAltIcon_default;
12139
12240
  exports.ViewIcon = ViewIcon_default;
12140
12241
  exports.WarningIcon = WarningIcon_default;
12141
12242
  exports.WatchIcon = WatchIcon_default;
12243
+ exports.buttonVariants = buttonVariants;
12142
12244
  exports.iconNames = iconNames;
12143
12245
 
12144
12246
  //# sourceMappingURL=main.cjs.map