@marigold/components 6.10.0 → 6.11.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.js CHANGED
@@ -47,6 +47,7 @@ __export(src_exports, {
47
47
  Center: () => Center,
48
48
  Checkbox: () => _Checkbox,
49
49
  CheckboxGroup: () => _CheckboxGroup,
50
+ CloseButton: () => CloseButton2,
50
51
  Columns: () => Columns,
51
52
  ComboBox: () => ComboBox,
52
53
  Container: () => Container,
@@ -84,7 +85,7 @@ __export(src_exports, {
84
85
  Switch: () => _Switch,
85
86
  Table: () => Table,
86
87
  Tabs: () => _Tabs,
87
- Tag: () => Tag2,
88
+ Tag: () => _Tag,
88
89
  Text: () => Text2,
89
90
  TextArea: () => _TextArea,
90
91
  TextField: () => _TextField,
@@ -352,7 +353,6 @@ var Aside = ({
352
353
  sideWidth,
353
354
  space = 0,
354
355
  side = "left",
355
- stretch = true,
356
356
  wrap = "50%"
357
357
  }) => {
358
358
  const [left, right] = import_react5.Children.toArray(children);
@@ -360,34 +360,24 @@ var Aside = ({
360
360
  aside: (0, import_system4.createVar)({ sideWidth }),
361
361
  content: (0, import_system4.createVar)({ wrap })
362
362
  };
363
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(
364
- "div",
365
- {
366
- className: (0, import_system4.cn)(
367
- "flex flex-wrap",
368
- import_system4.gapSpace[space],
369
- !stretch && "items-start"
370
- ),
371
- children: [
372
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
373
- "div",
374
- {
375
- className: classNames[side === "left" ? "aside" : "content"],
376
- style: vars[side === "left" ? "aside" : "content"],
377
- children: left
378
- }
379
- ),
380
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
381
- "div",
382
- {
383
- className: classNames[side === "right" ? "aside" : "content"],
384
- style: vars[side === "right" ? "aside" : "content"],
385
- children: right
386
- }
387
- )
388
- ]
389
- }
390
- );
363
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: (0, import_system4.cn)("flex flex-wrap", import_system4.gapSpace[space]), children: [
364
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
365
+ "div",
366
+ {
367
+ className: classNames[side === "left" ? "aside" : "content"],
368
+ style: vars[side === "left" ? "aside" : "content"],
369
+ children: left
370
+ }
371
+ ),
372
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
373
+ "div",
374
+ {
375
+ className: classNames[side === "right" ? "aside" : "content"],
376
+ style: vars[side === "right" ? "aside" : "content"],
377
+ children: right
378
+ }
379
+ )
380
+ ] });
391
381
  };
392
382
 
393
383
  // src/Aspect/Aspect.tsx
@@ -613,7 +603,7 @@ var Input = (0, import_react7.forwardRef)(
613
603
  }
614
604
  );
615
605
 
616
- // src/ListBox/ListBox.tsx
606
+ // src/ListBox/_ListBox.tsx
617
607
  var import_react10 = require("react");
618
608
  var import_listbox3 = require("@react-aria/listbox");
619
609
  var import_utils6 = require("@react-aria/utils");
@@ -624,7 +614,7 @@ var import_react8 = require("react");
624
614
  var ListBoxContext = (0, import_react8.createContext)({});
625
615
  var useListBoxContext = () => (0, import_react8.useContext)(ListBoxContext);
626
616
 
627
- // src/ListBox/ListBoxOption.tsx
617
+ // src/ListBox/_ListBoxOption.tsx
628
618
  var import_react9 = require("react");
629
619
  var import_listbox = require("@react-aria/listbox");
630
620
  var import_utils5 = require("@react-aria/utils");
@@ -657,7 +647,7 @@ var ListBoxOption = ({ item, state }) => {
657
647
  );
658
648
  };
659
649
 
660
- // src/ListBox/ListBoxSection.tsx
650
+ // src/ListBox/_ListBoxSection.tsx
661
651
  var import_listbox2 = require("@react-aria/listbox");
662
652
  var import_jsx_runtime13 = require("react/jsx-runtime");
663
653
  var ListBoxSection = ({ section, state }) => {
@@ -672,25 +662,27 @@ var ListBoxSection = ({ section, state }) => {
672
662
  ] });
673
663
  };
674
664
 
675
- // src/ListBox/ListBox.tsx
665
+ // src/ListBox/_ListBox.tsx
676
666
  var import_jsx_runtime14 = require("react/jsx-runtime");
677
667
  var ListBox = (0, import_react10.forwardRef)(
678
668
  ({ state, variant, size, ...props }, ref) => {
679
669
  const innerRef = (0, import_utils6.useObjectRef)(ref);
680
670
  const { listBoxProps } = (0, import_listbox3.useListBox)(props, state, innerRef);
681
671
  const classNames2 = (0, import_system11.useClassNames)({ component: "ListBox", variant, size });
682
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ListBoxContext.Provider, { value: { classNames: classNames2 }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
683
- "div",
672
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ListBoxContext.Provider, { value: { classNames: classNames2 }, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: classNames2.container, children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
673
+ "ul",
684
674
  {
685
675
  className: (0, import_system11.cn)(
686
- "overflow-y-auto overflow-x-hidden",
687
- classNames2.container
676
+ "overflow-y-auto sm:max-h-[75vh] lg:max-h-[45vh]",
677
+ classNames2.list
688
678
  ),
689
- children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("ul", { className: classNames2.list, ref: innerRef, ...listBoxProps, children: [...state.collection].map(
679
+ ref: innerRef,
680
+ ...listBoxProps,
681
+ children: [...state.collection].map(
690
682
  (item) => item.type === "section" ? /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ListBoxSection, { section: item, state }, item.key) : /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ListBoxOption, { item, state }, item.key)
691
- ) })
683
+ )
692
684
  }
693
- ) });
685
+ ) }) });
694
686
  }
695
687
  );
696
688
 
@@ -779,7 +771,7 @@ var Overlay = ({ children, container, open }) => {
779
771
  ) });
780
772
  };
781
773
 
782
- // src/Overlay/Popover.tsx
774
+ // src/Overlay/_Popover.tsx
783
775
  var import_react13 = require("react");
784
776
  var import_focus2 = require("@react-aria/focus");
785
777
  var import_overlays2 = require("@react-aria/overlays");
@@ -821,10 +813,7 @@ var PopoverWrapper = (0, import_react13.forwardRef)(
821
813
  "div",
822
814
  {
823
815
  ...popoverProps,
824
- className: (0, import_system15.cn)(
825
- "flex flex-col sm:max-h-[75vh] lg:max-h-[45vh]",
826
- classNames2
827
- ),
816
+ className: classNames2,
828
817
  style: {
829
818
  ...popoverProps.style,
830
819
  minWidth: props.triggerRef.current ? props.triggerRef.current.offsetWidth : void 0
@@ -1414,7 +1403,6 @@ var HelpText2 = ({
1414
1403
  description,
1415
1404
  error,
1416
1405
  errorMessage,
1417
- isInvalid,
1418
1406
  ...props
1419
1407
  }) => {
1420
1408
  const hasErrorMessage = errorMessage && error;
@@ -1660,6 +1648,7 @@ var _DialogTrigger = ({
1660
1648
  open,
1661
1649
  dismissable,
1662
1650
  keyboardDismissable,
1651
+ isNonModal,
1663
1652
  ...rest
1664
1653
  }) => {
1665
1654
  const props = {
@@ -1670,6 +1659,8 @@ var _DialogTrigger = ({
1670
1659
  const [dialogTrigger, dialog] = children;
1671
1660
  const hasDialogTrigger = dialogTrigger.type !== _Dialog;
1672
1661
  const currentDialog = children.length < 2 ? !hasDialogTrigger && dialogTrigger : dialog;
1662
+ if (isNonModal)
1663
+ return /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(import_react_aria_components9.DialogTrigger, { ...props, children: props.children });
1673
1664
  return /* @__PURE__ */ (0, import_jsx_runtime37.jsxs)(import_react_aria_components9.DialogTrigger, { ...props, children: [
1674
1665
  hasDialogTrigger && dialogTrigger,
1675
1666
  /* @__PURE__ */ (0, import_jsx_runtime37.jsx)(
@@ -3908,135 +3899,54 @@ var _Tooltip = ({ children, variant, size, open, ...rest }) => {
3908
3899
  };
3909
3900
  _Tooltip.Trigger = _TooltipTrigger;
3910
3901
 
3911
- // src/TagGroup/index.ts
3912
- var import_collections6 = require("@react-stately/collections");
3913
-
3914
- // src/TagGroup/TagGroup.tsx
3915
- var import_react56 = require("react");
3916
- var import_tag2 = require("@react-aria/tag");
3917
- var import_list = require("@react-stately/list");
3902
+ // src/TagGroup/Tag.tsx
3903
+ var import_react_aria_components27 = require("react-aria-components");
3918
3904
  var import_system74 = require("@marigold/system");
3919
3905
 
3920
- // src/TagGroup/Tag.tsx
3921
- var import_react55 = __toESM(require("react"));
3922
- var import_button4 = require("@react-aria/button");
3923
- var import_focus14 = require("@react-aria/focus");
3924
- var import_tag = require("@react-aria/tag");
3925
- var import_utils24 = require("@react-aria/utils");
3906
+ // src/TagGroup/TagGroup.tsx
3907
+ var import_react_aria_components26 = require("react-aria-components");
3926
3908
  var import_system73 = require("@marigold/system");
3927
3909
  var import_jsx_runtime89 = require("react/jsx-runtime");
3928
- var CloseButton2 = ({ className, ...props }) => {
3929
- const ref = (0, import_react55.useRef)(null);
3930
- const { buttonProps } = (0, import_button4.useButton)({ ...props }, ref);
3931
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("button", { className, ...buttonProps, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("svg", { viewBox: "0 0 20 20", fill: "currentColor", width: 20, height: 20, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("path", { d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" }) }) });
3932
- };
3933
- var Tag = ({ variant, size, item, state, ...rest }) => {
3934
- const props = {
3935
- item,
3936
- ...rest
3937
- };
3938
- let ref = import_react55.default.useRef(null);
3939
- let { focusProps } = (0, import_focus14.useFocusRing)({ within: true });
3940
- const { rowProps, gridCellProps, allowsRemoving, removeButtonProps } = (0, import_tag.useTag)(
3941
- {
3942
- ...props,
3943
- item
3944
- },
3945
- state,
3946
- ref
3947
- );
3948
- const classNames2 = (0, import_system73.useClassNames)({ component: "Tag", variant, size });
3949
- return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
3950
- "span",
3951
- {
3952
- ref,
3953
- ...(0, import_utils24.mergeProps)(rowProps, focusProps),
3954
- className: classNames2.tag,
3955
- children: /* @__PURE__ */ (0, import_jsx_runtime89.jsxs)("div", { ...gridCellProps, className: classNames2.gridCell, children: [
3956
- /* @__PURE__ */ (0, import_jsx_runtime89.jsx)("span", { children: item.rendered }),
3957
- allowsRemoving && /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(
3958
- CloseButton2,
3959
- {
3960
- ...removeButtonProps,
3961
- className: (0, import_system73.cn)("flex items-center", classNames2.closeButton)
3962
- }
3963
- )
3964
- ] })
3965
- }
3966
- );
3967
- };
3968
-
3969
- // src/TagGroup/TagGroup.tsx
3970
- var import_jsx_runtime90 = require("react/jsx-runtime");
3971
- var import_react57 = require("react");
3972
- var TagGroup = ({
3910
+ var _TagGroup = ({
3973
3911
  width,
3974
- required,
3975
- error,
3976
- allowsRemoving,
3912
+ items,
3913
+ children,
3914
+ variant,
3915
+ size,
3977
3916
  ...rest
3978
3917
  }) => {
3979
- const props = {
3980
- isRequired: required,
3981
- validationState: error ? "invalid" : "valid",
3982
- ...rest
3983
- };
3984
- const inputRef = (0, import_react56.useRef)(null);
3985
- const state = (0, import_list.useListState)(props);
3986
- const { gridProps, labelProps, descriptionProps, errorMessageProps } = (0, import_tag2.useTagGroup)(props, state, inputRef);
3987
- const stateProps = (0, import_system74.useStateProps)({
3988
- error,
3989
- required
3990
- });
3991
- return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
3992
- FieldBase,
3993
- {
3994
- width,
3995
- label: props.label,
3996
- labelProps,
3997
- description: props.description,
3998
- descriptionProps,
3999
- error,
4000
- errorMessage: props.errorMessage,
4001
- errorMessageProps,
4002
- stateProps,
4003
- ...gridProps,
4004
- children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
4005
- "div",
4006
- {
4007
- role: "presentation",
4008
- ref: inputRef,
4009
- className: "flex flex-wrap items-start gap-1",
4010
- children: [...state.collection].map((item) => /* @__PURE__ */ (0, import_react57.createElement)(
4011
- Tag,
4012
- {
4013
- ...item.props,
4014
- key: item.key,
4015
- item,
4016
- state,
4017
- allowsRemoving,
4018
- onRemove: props.onRemove
4019
- },
4020
- item.rendered
4021
- ))
4022
- }
4023
- )
4024
- }
4025
- );
3918
+ const classNames2 = (0, import_system73.useClassNames)({ component: "Tag", variant, size });
3919
+ return /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(FieldBase2, { as: import_react_aria_components26.TagGroup, ...rest, children: /* @__PURE__ */ (0, import_jsx_runtime89.jsx)(import_react_aria_components26.TagList, { items, className: classNames2.listItems, children }) });
4026
3920
  };
4027
3921
 
4028
- // src/TagGroup/index.ts
4029
- var Tag2 = import_collections6.Item;
4030
- Tag2.Group = TagGroup;
3922
+ // src/TagGroup/Tag.tsx
3923
+ var import_jsx_runtime90 = require("react/jsx-runtime");
3924
+ var CloseButton2 = ({ className }) => {
3925
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_aria_components27.Button, { slot: "remove", className, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("svg", { viewBox: "0 0 20 20", fill: "currentColor", width: 20, height: 20, children: /* @__PURE__ */ (0, import_jsx_runtime90.jsx)("path", { d: "M4.293 4.293a1 1 0 011.414 0L10 8.586l4.293-4.293a1 1 0 111.414 1.414L11.414 10l4.293 4.293a1 1 0 01-1.414 1.414L10 11.414l-4.293 4.293a1 1 0 01-1.414-1.414L8.586 10 4.293 5.707a1 1 0 010-1.414z" }) }) });
3926
+ };
3927
+ var _Tag = ({ variant, size, children, ...props }) => {
3928
+ let textValue = typeof children === "string" ? children : void 0;
3929
+ const classNames2 = (0, import_system74.useClassNames)({ component: "Tag", variant, size });
3930
+ return /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(import_react_aria_components27.Tag, { textValue, ...props, className: classNames2.tag, children: ({ allowsRemoving }) => /* @__PURE__ */ (0, import_jsx_runtime90.jsxs)(import_jsx_runtime90.Fragment, { children: [
3931
+ children,
3932
+ allowsRemoving && /* @__PURE__ */ (0, import_jsx_runtime90.jsx)(
3933
+ CloseButton2,
3934
+ {
3935
+ className: (0, import_system74.cn)("flex items-center", classNames2.closeButton)
3936
+ }
3937
+ )
3938
+ ] }) });
3939
+ };
3940
+ _Tag.Group = _TagGroup;
4031
3941
 
4032
3942
  // src/VisuallyHidden/VisuallyHidden.tsx
4033
3943
  var import_visually_hidden = require("@react-aria/visually-hidden");
4034
3944
 
4035
3945
  // src/XLoader/XLoader.tsx
4036
- var import_react58 = require("react");
3946
+ var import_react55 = require("react");
4037
3947
  var import_system75 = require("@marigold/system");
4038
3948
  var import_jsx_runtime91 = require("react/jsx-runtime");
4039
- var XLoader = (0, import_react58.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
3949
+ var XLoader = (0, import_react55.forwardRef)((props, ref) => /* @__PURE__ */ (0, import_jsx_runtime91.jsxs)(
4040
3950
  import_system75.SVG,
4041
3951
  {
4042
3952
  id: "XLoader",
@@ -4250,22 +4160,22 @@ var XLoader = (0, import_react58.forwardRef)((props, ref) => /* @__PURE__ */ (0,
4250
4160
  ));
4251
4161
 
4252
4162
  // src/Tabs/Tabs.tsx
4253
- var import_react_aria_components29 = require("react-aria-components");
4163
+ var import_react_aria_components31 = require("react-aria-components");
4254
4164
  var import_system78 = require("@marigold/system");
4255
4165
 
4256
4166
  // src/Tabs/Context.ts
4257
- var import_react59 = require("react");
4258
- var TabContext = (0, import_react59.createContext)({});
4259
- var useTabContext = () => (0, import_react59.useContext)(TabContext);
4167
+ var import_react56 = require("react");
4168
+ var TabContext = (0, import_react56.createContext)({});
4169
+ var useTabContext = () => (0, import_react56.useContext)(TabContext);
4260
4170
 
4261
4171
  // src/Tabs/Tab.tsx
4262
- var import_react_aria_components26 = require("react-aria-components");
4172
+ var import_react_aria_components28 = require("react-aria-components");
4263
4173
  var import_system76 = require("@marigold/system");
4264
4174
  var import_jsx_runtime92 = require("react/jsx-runtime");
4265
4175
  var _Tab = (props) => {
4266
4176
  const { classNames: classNames2 } = useTabContext();
4267
4177
  return /* @__PURE__ */ (0, import_jsx_runtime92.jsx)(
4268
- import_react_aria_components26.Tab,
4178
+ import_react_aria_components28.Tab,
4269
4179
  {
4270
4180
  ...props,
4271
4181
  className: (0, import_system76.cn)(
@@ -4278,13 +4188,13 @@ var _Tab = (props) => {
4278
4188
  };
4279
4189
 
4280
4190
  // src/Tabs/TabList.tsx
4281
- var import_react_aria_components27 = require("react-aria-components");
4191
+ var import_react_aria_components29 = require("react-aria-components");
4282
4192
  var import_system77 = require("@marigold/system");
4283
4193
  var import_jsx_runtime93 = require("react/jsx-runtime");
4284
4194
  var _TabList = ({ space = 2, ...props }) => {
4285
4195
  const { classNames: classNames2 } = useTabContext();
4286
4196
  return /* @__PURE__ */ (0, import_jsx_runtime93.jsx)(
4287
- import_react_aria_components27.TabList,
4197
+ import_react_aria_components29.TabList,
4288
4198
  {
4289
4199
  ...props,
4290
4200
  className: (0, import_system77.cn)("flex", import_system77.gapSpace[space], classNames2.tabsList),
@@ -4294,11 +4204,11 @@ var _TabList = ({ space = 2, ...props }) => {
4294
4204
  };
4295
4205
 
4296
4206
  // src/Tabs/TabPanel.tsx
4297
- var import_react_aria_components28 = require("react-aria-components");
4207
+ var import_react_aria_components30 = require("react-aria-components");
4298
4208
  var import_jsx_runtime94 = require("react/jsx-runtime");
4299
4209
  var _TabPanel = (props) => {
4300
4210
  const { classNames: classNames2 } = useTabContext();
4301
- return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_aria_components28.TabPanel, { ...props, className: classNames2.tabpanel, children: props.children });
4211
+ return /* @__PURE__ */ (0, import_jsx_runtime94.jsx)(import_react_aria_components30.TabPanel, { ...props, className: classNames2.tabpanel, children: props.children });
4302
4212
  };
4303
4213
 
4304
4214
  // src/Tabs/Tabs.tsx
@@ -4313,7 +4223,7 @@ var _Tabs = ({ disabled, variant, size = "medium", ...rest }) => {
4313
4223
  size,
4314
4224
  variant
4315
4225
  });
4316
- return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(TabContext.Provider, { value: { classNames: classNames2 }, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react_aria_components29.Tabs, { ...props, className: classNames2.container, children: props.children }) });
4226
+ return /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(TabContext.Provider, { value: { classNames: classNames2 }, children: /* @__PURE__ */ (0, import_jsx_runtime95.jsx)(import_react_aria_components31.Tabs, { ...props, className: classNames2.container, children: props.children }) });
4317
4227
  };
4318
4228
  _Tabs.List = _TabList;
4319
4229
  _Tabs.TabPanel = _TabPanel;
@@ -4337,6 +4247,7 @@ _Tabs.Item = _Tab;
4337
4247
  Center,
4338
4248
  Checkbox,
4339
4249
  CheckboxGroup,
4250
+ CloseButton,
4340
4251
  Columns,
4341
4252
  ComboBox,
4342
4253
  Container,