@ai-matrx/design-system 0.61.10 → 0.61.12

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/controls.css CHANGED
@@ -140,6 +140,30 @@
140
140
  max-width: var(--matrx-control-size) !important;
141
141
  padding: 0 !important;
142
142
  }
143
+ /* COLLAPSE BY CONTAINER (Button collapse="container"): the box that decides
144
+ is the pane the control lives in, never the viewport — beside a chat panel
145
+ a 1024px screen holds a 540px list. Below 48rem of the nearest
146
+ `matrx-controls` container the button is its leading glyph alone, the
147
+ icon-only circle; the label is still in the DOM (its accessible name). */
148
+ .matrx-controls-container {
149
+ container: matrx-controls / inline-size;
150
+ }
151
+ @container matrx-controls (width < 48rem) {
152
+ .matrx-control-button[data-collapse="container"] {
153
+ width: var(--matrx-control-size) !important;
154
+ min-width: var(--matrx-control-size) !important;
155
+ max-width: var(--matrx-control-size) !important;
156
+ padding: 0 !important;
157
+ gap: 0 !important;
158
+ font-size: 0 !important;
159
+ }
160
+ .matrx-control-button[data-collapse="container"] :not(svg, svg *) {
161
+ font-size: 0 !important;
162
+ }
163
+ .matrx-control-button[data-collapse="container"][data-glyph="both"] > svg:last-child {
164
+ display: none !important;
165
+ }
166
+ }
143
167
  .matrx-control-button:active:not(:disabled):not([aria-disabled="true"]) {
144
168
  transform: scale(0.97);
145
169
  }
@@ -30,6 +30,17 @@ declare const ControlRow: React.ForwardRefExoticComponent<ControlRowProps & Reac
30
30
  * box. Wrap a page (or a region) that mixes tap buttons and controls.
31
31
  */
32
32
  declare const ControlScope: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
33
+ /**
34
+ * THE CONTAINER a collapsing control measures (`Button collapse="container"`).
35
+ * A host declares it on the box whose WIDTH decides — a list pane, a panel,
36
+ * never the viewport: beside a chat panel a 1024px screen holds a 540px list.
37
+ * `className={CONTROLS_CONTAINER_CLASS}`, or add the name to the box's own
38
+ * `container-name` when it already names a container (`list matrx-controls`).
39
+ */
40
+ declare const CONTROLS_CONTAINER_NAME = "matrx-controls";
41
+ declare const CONTROLS_CONTAINER_CLASS = "matrx-controls-container";
42
+ /** Below this container width a `collapse="container"` button is its icon alone (48rem). */
43
+ declare const CONTROLS_COLLAPSE_BELOW_REM = 48;
33
44
  type ControlVariant = "primary" | "quiet" | "outline" | "danger";
34
45
  interface ButtonBase extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
35
46
  /** Tone, never size. Default `outline`. */
@@ -43,6 +54,13 @@ interface ButtonBase extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>,
43
54
  iconEnd?: React.ReactNode;
44
55
  /** Render the one child element (a link) with the button's skin. */
45
56
  asChild?: boolean;
57
+ /**
58
+ * `"container"`: below 48rem of the nearest `matrx-controls` container
59
+ * (CONTROLS_CONTAINER_NAME) the button is its leading `icon` alone — a 28px
60
+ * circle; the label stays its accessible name and its tooltip. Needs `icon`;
61
+ * without one it never collapses. Outside such a container it never does.
62
+ */
63
+ collapse?: "container";
46
64
  }
47
65
  interface LabelledButton extends ButtonBase {
48
66
  children: React.ReactNode;
@@ -241,4 +259,4 @@ interface PromoBannerProps {
241
259
  */
242
260
  declare function PromoBanner({ icon, eyebrow, title, line, chips, action, tone, className, "aria-label": ariaLabel, }: PromoBannerProps): React.JSX.Element;
243
261
 
244
- export { Badge, type BadgeProps, type BadgeTone, Button, type ButtonProps, ConfirmDelete, type ConfirmDeleteProps, ControlRow, type ControlRowProps, ControlScope, type ControlVariant, DangerZone, DeleteButton, type DeleteButtonProps, EmptyState, type EmptyStateProps, Field, type FieldProps, PromoBanner, type PromoBannerProps, type PromoTone, RegionSkeleton, type RegionSkeletonProps, RowGroup, type RowGroupProps, SearchField, type SegmentOption, SegmentedControl, type SegmentedControlProps, Select, type SelectOption, type SelectProps, SettingRow, type SettingRowProps, SplitButton, Switch, type SwitchProps, Tabs, type TabsProps, Textarea };
262
+ export { Badge, type BadgeProps, type BadgeTone, Button, type ButtonProps, CONTROLS_COLLAPSE_BELOW_REM, CONTROLS_CONTAINER_CLASS, CONTROLS_CONTAINER_NAME, ConfirmDelete, type ConfirmDeleteProps, ControlRow, type ControlRowProps, ControlScope, type ControlVariant, DangerZone, DeleteButton, type DeleteButtonProps, EmptyState, type EmptyStateProps, Field, type FieldProps, PromoBanner, type PromoBannerProps, type PromoTone, RegionSkeleton, type RegionSkeletonProps, RowGroup, type RowGroupProps, SearchField, type SegmentOption, SegmentedControl, type SegmentedControlProps, Select, type SelectOption, type SelectProps, SettingRow, type SettingRowProps, SplitButton, Switch, type SwitchProps, Tabs, type TabsProps, Textarea };
@@ -30,6 +30,17 @@ declare const ControlRow: React.ForwardRefExoticComponent<ControlRowProps & Reac
30
30
  * box. Wrap a page (or a region) that mixes tap buttons and controls.
31
31
  */
32
32
  declare const ControlScope: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLDivElement> & React.RefAttributes<HTMLDivElement>>;
33
+ /**
34
+ * THE CONTAINER a collapsing control measures (`Button collapse="container"`).
35
+ * A host declares it on the box whose WIDTH decides — a list pane, a panel,
36
+ * never the viewport: beside a chat panel a 1024px screen holds a 540px list.
37
+ * `className={CONTROLS_CONTAINER_CLASS}`, or add the name to the box's own
38
+ * `container-name` when it already names a container (`list matrx-controls`).
39
+ */
40
+ declare const CONTROLS_CONTAINER_NAME = "matrx-controls";
41
+ declare const CONTROLS_CONTAINER_CLASS = "matrx-controls-container";
42
+ /** Below this container width a `collapse="container"` button is its icon alone (48rem). */
43
+ declare const CONTROLS_COLLAPSE_BELOW_REM = 48;
33
44
  type ControlVariant = "primary" | "quiet" | "outline" | "danger";
34
45
  interface ButtonBase extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, "children"> {
35
46
  /** Tone, never size. Default `outline`. */
@@ -43,6 +54,13 @@ interface ButtonBase extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>,
43
54
  iconEnd?: React.ReactNode;
44
55
  /** Render the one child element (a link) with the button's skin. */
45
56
  asChild?: boolean;
57
+ /**
58
+ * `"container"`: below 48rem of the nearest `matrx-controls` container
59
+ * (CONTROLS_CONTAINER_NAME) the button is its leading `icon` alone — a 28px
60
+ * circle; the label stays its accessible name and its tooltip. Needs `icon`;
61
+ * without one it never collapses. Outside such a container it never does.
62
+ */
63
+ collapse?: "container";
46
64
  }
47
65
  interface LabelledButton extends ButtonBase {
48
66
  children: React.ReactNode;
@@ -241,4 +259,4 @@ interface PromoBannerProps {
241
259
  */
242
260
  declare function PromoBanner({ icon, eyebrow, title, line, chips, action, tone, className, "aria-label": ariaLabel, }: PromoBannerProps): React.JSX.Element;
243
261
 
244
- export { Badge, type BadgeProps, type BadgeTone, Button, type ButtonProps, ConfirmDelete, type ConfirmDeleteProps, ControlRow, type ControlRowProps, ControlScope, type ControlVariant, DangerZone, DeleteButton, type DeleteButtonProps, EmptyState, type EmptyStateProps, Field, type FieldProps, PromoBanner, type PromoBannerProps, type PromoTone, RegionSkeleton, type RegionSkeletonProps, RowGroup, type RowGroupProps, SearchField, type SegmentOption, SegmentedControl, type SegmentedControlProps, Select, type SelectOption, type SelectProps, SettingRow, type SettingRowProps, SplitButton, Switch, type SwitchProps, Tabs, type TabsProps, Textarea };
262
+ export { Badge, type BadgeProps, type BadgeTone, Button, type ButtonProps, CONTROLS_COLLAPSE_BELOW_REM, CONTROLS_CONTAINER_CLASS, CONTROLS_CONTAINER_NAME, ConfirmDelete, type ConfirmDeleteProps, ControlRow, type ControlRowProps, ControlScope, type ControlVariant, DangerZone, DeleteButton, type DeleteButtonProps, EmptyState, type EmptyStateProps, Field, type FieldProps, PromoBanner, type PromoBannerProps, type PromoTone, RegionSkeleton, type RegionSkeletonProps, RowGroup, type RowGroupProps, SearchField, type SegmentOption, SegmentedControl, type SegmentedControlProps, Select, type SelectOption, type SelectProps, SettingRow, type SettingRowProps, SplitButton, Switch, type SwitchProps, Tabs, type TabsProps, Textarea };
package/dist/controls.js CHANGED
@@ -719,6 +719,9 @@ var ControlScope = React7.forwardRef(
719
719
  (props, ref) => /* @__PURE__ */ jsx7("div", { ref, "data-matrx-controls": "", ...props })
720
720
  );
721
721
  ControlScope.displayName = "ControlScope";
722
+ var CONTROLS_CONTAINER_NAME = "matrx-controls";
723
+ var CONTROLS_CONTAINER_CLASS = "matrx-controls-container";
724
+ var CONTROLS_COLLAPSE_BELOW_REM = 48;
722
725
  function glyphSlot(icon, iconEnd, label) {
723
726
  if (!label && (icon || iconEnd)) return "only";
724
727
  if (icon && iconEnd) return "both";
@@ -727,12 +730,13 @@ function glyphSlot(icon, iconEnd, label) {
727
730
  return void 0;
728
731
  }
729
732
  var Button2 = React7.forwardRef(
730
- ({ className, variant = "outline", tone, icon, iconEnd, asChild = false, children, onClick, type, ...props }, ref) => {
733
+ ({ className, variant = "outline", tone, icon, iconEnd, asChild = false, collapse, children, onClick, type, ...props }, ref) => {
731
734
  const Component = asChild ? Slot2 : "button";
732
735
  const ariaDisabled = props["aria-disabled"];
733
736
  const disabledChild = asChild && Boolean(props.disabled);
734
737
  const inert = disabledChild || ariaDisabled === true || ariaDisabled === "true";
735
738
  const label = asChild && React7.isValidElement(children) ? children.props.children : children;
739
+ const collapses = collapse === "container" && Boolean(icon) && Boolean(label);
736
740
  return /* @__PURE__ */ jsxs5(
737
741
  Component,
738
742
  {
@@ -742,7 +746,9 @@ var Button2 = React7.forwardRef(
742
746
  "data-variant": variant,
743
747
  "data-tone": tone && tone !== "neutral" ? tone : void 0,
744
748
  "data-glyph": glyphSlot(icon, iconEnd, label),
749
+ "data-collapse": collapses ? "container" : void 0,
745
750
  className: cn("matrx-control matrx-control-button matrx-glyph-trim", className),
751
+ title: collapses && typeof label === "string" && props.title === void 0 ? label : void 0,
746
752
  ...props,
747
753
  "aria-disabled": disabledChild ? true : ariaDisabled,
748
754
  tabIndex: disabledChild ? -1 : props.tabIndex,
@@ -1415,6 +1421,9 @@ function PromoBanner({
1415
1421
  export {
1416
1422
  Badge,
1417
1423
  Button2 as Button,
1424
+ CONTROLS_COLLAPSE_BELOW_REM,
1425
+ CONTROLS_CONTAINER_CLASS,
1426
+ CONTROLS_CONTAINER_NAME,
1418
1427
  ConfirmDelete,
1419
1428
  ControlRow,
1420
1429
  ControlScope,