@vkzstudio/muza-ui 1.8.0 → 1.9.1

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.
Files changed (66) hide show
  1. package/dist/components/Breadcrumb/Breadcrumb.d.ts +146 -4
  2. package/dist/components/Breadcrumb/Breadcrumb.d.ts.map +1 -1
  3. package/dist/components/Breadcrumb/Breadcrumb.js +241 -84
  4. package/dist/components/Breadcrumb/Breadcrumb.stories.d.ts +4 -0
  5. package/dist/components/Breadcrumb/Breadcrumb.stories.d.ts.map +1 -1
  6. package/dist/components/Breadcrumb/index.js +10 -7
  7. package/dist/components/Card/Card.d.ts +36 -27
  8. package/dist/components/Card/Card.d.ts.map +1 -1
  9. package/dist/components/Card/Card.js +41 -40
  10. package/dist/components/Carousel/Carousel.d.ts +16 -0
  11. package/dist/components/Carousel/Carousel.d.ts.map +1 -1
  12. package/dist/components/Carousel/Carousel.js +56 -55
  13. package/dist/components/CarouselSection/CarouselSection.examples.d.ts +15 -6
  14. package/dist/components/CarouselSection/CarouselSection.examples.d.ts.map +1 -1
  15. package/dist/components/CarouselSection/CarouselSection.stories.d.ts +2 -0
  16. package/dist/components/CarouselSection/CarouselSection.stories.d.ts.map +1 -1
  17. package/dist/components/CategoryIcon/CategoryIcon.d.ts.map +1 -1
  18. package/dist/components/CategoryIcon/CategoryIcon.js +25 -23
  19. package/dist/components/ExpandableTable/ExpandableTable.d.ts +1 -1
  20. package/dist/components/ExpandableTable/ExpandableTable.d.ts.map +1 -1
  21. package/dist/components/Flex/Flex.d.ts +42 -25
  22. package/dist/components/Flex/Flex.d.ts.map +1 -1
  23. package/dist/components/Flex/Flex.js +52 -53
  24. package/dist/components/FormField/FormField.js +16 -16
  25. package/dist/components/FormField/InputLabel.d.ts.map +1 -1
  26. package/dist/components/FormField/InputLabel.js +35 -25
  27. package/dist/components/Input/Input.stories.d.ts +1 -0
  28. package/dist/components/Input/Input.stories.d.ts.map +1 -1
  29. package/dist/components/OfferCard/OfferCard.d.ts +19 -5
  30. package/dist/components/OfferCard/OfferCard.d.ts.map +1 -1
  31. package/dist/components/OfferCard/OfferCard.js +181 -150
  32. package/dist/components/OfferCard/OfferCard.stories.d.ts +1 -0
  33. package/dist/components/OfferCard/OfferCard.stories.d.ts.map +1 -1
  34. package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.d.ts +1 -1
  35. package/dist/components/ResponsiveLayoutTable/ResponsiveLayoutTable.d.ts.map +1 -1
  36. package/dist/components/internal/CardCompactShell.d.ts +7 -1
  37. package/dist/components/internal/CardCompactShell.d.ts.map +1 -1
  38. package/dist/components/internal/CardCompactShell.js +57 -51
  39. package/dist/components/internal/CardImageSlot.d.ts.map +1 -1
  40. package/dist/components/internal/CardImageSlot.js +36 -37
  41. package/dist/hooks/use-is-breakpoint.d.ts +1 -4
  42. package/dist/hooks/use-is-breakpoint.d.ts.map +1 -1
  43. package/dist/index.js +448 -437
  44. package/dist/muza-ui.css +1 -1
  45. package/dist/styles/breakpoints.css +1 -0
  46. package/dist/translations/locales/cs.d.ts.map +1 -1
  47. package/dist/translations/locales/cs.js +3 -0
  48. package/dist/translations/locales/en.d.ts.map +1 -1
  49. package/dist/translations/locales/en.js +3 -0
  50. package/dist/translations/locales/sk.d.ts.map +1 -1
  51. package/dist/translations/locales/sk.js +3 -0
  52. package/dist/translations/types.d.ts +8 -0
  53. package/dist/translations/types.d.ts.map +1 -1
  54. package/dist/utils/breakpoints.d.ts +43 -0
  55. package/dist/utils/breakpoints.d.ts.map +1 -0
  56. package/dist/utils/breakpoints.js +65 -0
  57. package/dist/utils/index.d.ts +3 -0
  58. package/dist/utils/index.d.ts.map +1 -1
  59. package/dist/utils/index.js +19 -11
  60. package/dist/utils/polymorphic.d.ts +44 -0
  61. package/dist/utils/polymorphic.d.ts.map +1 -0
  62. package/dist/utils/polymorphic.js +7 -0
  63. package/dist/utils/warnOnce.d.ts +37 -0
  64. package/dist/utils/warnOnce.d.ts.map +1 -0
  65. package/dist/utils/warnOnce.js +6 -0
  66. package/package.json +1 -1
@@ -1,8 +1,18 @@
1
+ import { ResponsiveBreakpoint } from '../../utils/index';
2
+ import { DropdownMenuContentProps, DropdownMenuProps } from '../DropdownMenu';
1
3
  import * as React from 'react';
2
4
  /** Props for the Breadcrumb root component. */
3
5
  export type BreadcrumbProps = React.ComponentProps<'nav'>;
4
6
  /** Props for the BreadcrumbList component. */
5
- export type BreadcrumbListProps = React.ComponentProps<'ol'>;
7
+ export interface BreadcrumbListProps extends React.ComponentProps<'ol'> {
8
+ /**
9
+ * Controls whether the trail wraps onto several lines. With `'nowrap'` it
10
+ * stays on a single line: every level keeps its full width and the current
11
+ * page (`BreadcrumbPage`) truncates with an ellipsis instead.
12
+ * @default 'wrap'
13
+ */
14
+ wrap?: 'wrap' | 'nowrap';
15
+ }
6
16
  /** Props for the BreadcrumbItem component. */
7
17
  export type BreadcrumbItemProps = React.ComponentProps<'li'>;
8
18
  /** Props for the BreadcrumbLink component. */
@@ -16,12 +26,144 @@ export type BreadcrumbPageProps = React.ComponentProps<'span'>;
16
26
  export type BreadcrumbSeparatorProps = React.ComponentProps<'li'>;
17
27
  /** Props for the BreadcrumbEllipsis component. */
18
28
  export type BreadcrumbEllipsisProps = React.ComponentProps<'span'>;
29
+ /**
30
+ * Props for the BreadcrumbCollapsed component. Remaining props go to the
31
+ * ellipsis `<button>`.
32
+ *
33
+ * @example
34
+ * <BreadcrumbItem>
35
+ * <BreadcrumbCollapsed>
36
+ * <BreadcrumbCollapsedItem asChild>
37
+ * <Link href="/courses">Courses</Link>
38
+ * </BreadcrumbCollapsedItem>
39
+ * </BreadcrumbCollapsed>
40
+ * </BreadcrumbItem>
41
+ */
42
+ export interface BreadcrumbCollapsedProps extends Omit<React.ComponentPropsWithoutRef<'button'>, 'children'> {
43
+ /** Lists the collapsed levels as `BreadcrumbCollapsedItem`s, in trail order. */
44
+ children: React.ReactNode;
45
+ /** Accessible label for the ellipsis button. Defaults to translation `breadcrumb.collapsedAriaLabel`. */
46
+ label?: string;
47
+ /** Controlled open state of the menu. */
48
+ open?: DropdownMenuProps['open'];
49
+ /** Initial open state for uncontrolled usage. @default false */
50
+ defaultOpen?: DropdownMenuProps['defaultOpen'];
51
+ /** Fires when the menu opens or closes. Receives the new open value. */
52
+ onOpenChange?: DropdownMenuProps['onOpenChange'];
53
+ /** Controls modal behaviour of the menu (focus trap, outside pointer events). @default true */
54
+ modal?: DropdownMenuProps['modal'];
55
+ /**
56
+ * Props forwarded to the `DropdownMenuContent`.
57
+ * @see DropdownMenuContentProps
58
+ */
59
+ contentProps?: Omit<DropdownMenuContentProps, 'children'>;
60
+ }
61
+ /** Props for the BreadcrumbCollapsedItem component. */
62
+ export interface BreadcrumbCollapsedItemProps {
63
+ /** Label of the level. With `asChild`, the link element to render instead. */
64
+ children: React.ReactNode;
65
+ /** Target of the level. Ignored with `asChild`, where the child carries its own target. */
66
+ href?: string;
67
+ /**
68
+ * Renders the single child as the item, e.g. a router `Link`, so the app
69
+ * keeps control of navigation.
70
+ * @default false
71
+ */
72
+ asChild?: boolean;
73
+ /** Additional CSS classes for the item. */
74
+ className?: string;
75
+ }
76
+ /** A single level of a `BreadcrumbTrail`. */
77
+ export interface BreadcrumbTrailItem {
78
+ /** Stable React key. Falls back to the level's index. */
79
+ key?: React.Key;
80
+ /** Visible label of the level. */
81
+ label: React.ReactNode;
82
+ /** Target of the level. Levels without it render as plain text and are left out of the collapsed menu. Ignored on the last level. */
83
+ href?: string;
84
+ }
85
+ /**
86
+ * How a `BreadcrumbTrail` collapses while this rule is active. Rules are
87
+ * listed from the largest breakpoint to the smallest, and the first one that
88
+ * matches wins, as in `ResponsiveLayoutTable`.
89
+ *
90
+ * @example
91
+ * collapse={[
92
+ * { responsive: 'lg', expanded: true },
93
+ * { responsive: 'md', keepStart: 1, keepEnd: 2 },
94
+ * { keepStart: 1, keepEnd: 1 },
95
+ * ]}
96
+ */
97
+ export interface BreadcrumbCollapseRule {
98
+ /**
99
+ * Controls when this rule is active.
100
+ * - Named breakpoint (`'xs'..'3xl'`): active at and above that breakpoint.
101
+ * Resolved with CSS, so server rendering matches the first client render.
102
+ * - Boolean: caller supplies the result, e.g. from `useMediaQuery()`.
103
+ * - Omitted: fallback that matches every remaining width.
104
+ *
105
+ * @see {@link ResponsiveBreakpoint}
106
+ */
107
+ responsive?: ResponsiveBreakpoint | boolean;
108
+ /** Shows the full trail while this rule is active. @default false */
109
+ expanded?: boolean;
110
+ /** Number of leading levels that stay visible. @default 1 */
111
+ keepStart?: number;
112
+ /** Number of trailing levels that stay visible, including the current page. Never less than 1. @default 1 */
113
+ keepEnd?: number;
114
+ }
115
+ /** Props for the BreadcrumbTrail component. */
116
+ export interface BreadcrumbTrailProps {
117
+ /** Levels in trail order. The last one renders as the current page. */
118
+ items: BreadcrumbTrailItem[];
119
+ /**
120
+ * Hides the middle levels behind a `BreadcrumbCollapsed` menu. Pass one rule
121
+ * to collapse at every width, or a list ordered from the largest breakpoint
122
+ * to the smallest to collapse differently per breakpoint. When no rule
123
+ * matches, the last one applies. Omit to always show the full trail.
124
+ *
125
+ * @example
126
+ * collapse={{ keepStart: 1, keepEnd: 1 }}
127
+ * collapse={[{ responsive: 'md', expanded: true }, { keepEnd: 2 }]}
128
+ * @see BreadcrumbCollapseRule
129
+ */
130
+ collapse?: BreadcrumbCollapseRule | BreadcrumbCollapseRule[];
131
+ /**
132
+ * Renders the link element for a level that has an `href`. The result is
133
+ * used through `asChild`, so return a single element such as a router
134
+ * `Link`. Defaults to a plain `<a>`.
135
+ *
136
+ * @example
137
+ * renderLink={(item) => <Link href={item.href!}>{item.label}</Link>}
138
+ */
139
+ renderLink?: (item: BreadcrumbTrailItem) => React.ReactElement;
140
+ /** Accessible label for the ellipsis button. Defaults to translation `breadcrumb.collapsedAriaLabel`. */
141
+ collapsedLabel?: string;
142
+ }
19
143
  declare const Breadcrumb: ({ ...props }: BreadcrumbProps) => import("react/jsx-runtime").JSX.Element;
20
- declare const BreadcrumbList: ({ className, ...props }: BreadcrumbListProps) => import("react/jsx-runtime").JSX.Element;
144
+ declare const BreadcrumbList: ({ className, wrap, ...props }: BreadcrumbListProps) => import("react/jsx-runtime").JSX.Element;
21
145
  declare const BreadcrumbItem: ({ className, ...props }: BreadcrumbItemProps) => import("react/jsx-runtime").JSX.Element;
22
146
  declare const BreadcrumbLink: ({ asChild, className, ...props }: BreadcrumbLinkProps) => import("react/jsx-runtime").JSX.Element;
23
- declare const BreadcrumbPage: ({ className, ...props }: BreadcrumbPageProps) => import("react/jsx-runtime").JSX.Element;
147
+ declare const BreadcrumbPage: ({ className, children, title, ...props }: BreadcrumbPageProps) => import("react/jsx-runtime").JSX.Element;
24
148
  declare const BreadcrumbSeparator: ({ children, className, ...props }: BreadcrumbSeparatorProps) => import("react/jsx-runtime").JSX.Element;
149
+ /**
150
+ * Purely visual "…" marker. For collapsed levels users can open, use
151
+ * `BreadcrumbCollapsed`, which renders this inside a menu button.
152
+ */
25
153
  declare const BreadcrumbEllipsis: ({ className, ...props }: BreadcrumbEllipsisProps) => import("react/jsx-runtime").JSX.Element;
26
- export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, };
154
+ declare const BreadcrumbCollapsed: React.ForwardRefExoticComponent<BreadcrumbCollapsedProps & React.RefAttributes<HTMLButtonElement>>;
155
+ /**
156
+ * A collapsed level inside `BreadcrumbCollapsed`. Always renders a link,
157
+ * either a plain `<a>` or the child passed with `asChild`.
158
+ */
159
+ declare const BreadcrumbCollapsedItem: ({ children, href, asChild, className, }: BreadcrumbCollapsedItemProps) => import("react/jsx-runtime").JSX.Element;
160
+ /**
161
+ * Renders a whole trail from data, collapsing the middle levels into a
162
+ * `BreadcrumbCollapsed` menu. Place it inside `BreadcrumbList`.
163
+ */
164
+ declare const BreadcrumbTrail: {
165
+ ({ items, collapse, renderLink, collapsedLabel, }: BreadcrumbTrailProps): import("react/jsx-runtime").JSX.Element;
166
+ displayName: string;
167
+ };
168
+ export { Breadcrumb, BreadcrumbList, BreadcrumbItem, BreadcrumbLink, BreadcrumbPage, BreadcrumbSeparator, BreadcrumbEllipsis, BreadcrumbCollapsed, BreadcrumbCollapsedItem, BreadcrumbTrail, };
27
169
  //# sourceMappingURL=Breadcrumb.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumb.d.ts","sourceRoot":"","sources":["../../../src/components/Breadcrumb/Breadcrumb.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAM9B,+CAA+C;AAC/C,MAAM,MAAM,eAAe,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAA;AAEzD,8CAA8C;AAC9C,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;AAE5D,8CAA8C;AAC9C,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;AAE5D,8CAA8C;AAC9C,MAAM,WAAW,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC;IACpE,kGAAkG;IAClG,OAAO,CAAC,EAAE,OAAO,CAAA;CAClB;AAED,8CAA8C;AAC9C,MAAM,MAAM,mBAAmB,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;AAE9D,mDAAmD;AACnD,MAAM,MAAM,wBAAwB,GAAG,KAAK,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;AAEjE,kDAAkD;AAClD,MAAM,MAAM,uBAAuB,GAAG,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,CAAA;AAElE,QAAA,MAAM,UAAU,GAAI,cAAc,eAAe,4CAEhD,CAAA;AAED,QAAA,MAAM,cAAc,GAAI,yBAAyB,mBAAmB,4CAWnE,CAAA;AAED,QAAA,MAAM,cAAc,GAAI,yBAAyB,mBAAmB,4CAQnE,CAAA;AAED,QAAA,MAAM,cAAc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ACL,UAAU,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,uBAAuB,EACvB,eAAe,GAChB,CAAA"}
@@ -1,36 +1,58 @@
1
- import { jsx as t } from "react/jsx-runtime";
2
- import "react";
3
- import { Slot as i } from "@radix-ui/react-slot";
4
- import { cn as a } from "../../utils/cn.js";
5
- import { AltArrowRightOutline as n } from "@solar-icons/react-perf";
6
- import { typographyVariants as o, Typography as m } from "../Typography/Typography.js";
7
- const f = ({ ...r }) => /* @__PURE__ */ t("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...r }), g = ({ className: r, ...e }) => /* @__PURE__ */ t(
8
- "ol",
9
- {
10
- "data-slot": "breadcrumb-list",
11
- className: a(
12
- "flex flex-wrap items-center gap-comp-breadcrumb-gap text-sm break-words",
13
- r
14
- ),
15
- ...e
16
- }
17
- ), h = ({ className: r, ...e }) => /* @__PURE__ */ t(
18
- "li",
19
- {
20
- "data-slot": "breadcrumb-item",
21
- className: a("inline-flex items-center", r),
22
- ...e
23
- }
24
- ), y = ({
1
+ import { jsx as t, jsxs as x, Fragment as v } from "react/jsx-runtime";
2
+ import * as m from "react";
3
+ import { Slot as D } from "@radix-ui/react-slot";
4
+ import { useMuzaTranslationContext as I } from "../../translations/TranslationContext.js";
5
+ import { hiddenInRangesClassName as k, responsiveBreakpoints as w } from "../../utils/breakpoints.js";
6
+ import { cn as f } from "../../utils/cn.js";
7
+ import { DropdownMenu as L, DropdownMenuTrigger as F, DropdownMenuContent as R, DropdownMenuItem as $ } from "../DropdownMenu/DropdownMenu.js";
8
+ import { Flex as j } from "../Flex/Flex.js";
9
+ import { AltArrowRightOutline as A } from "@solar-icons/react-perf";
10
+ import { typographyVariants as M, Typography as E } from "../Typography/Typography.js";
11
+ const g = m.createContext({ wrap: !0 }), Z = ({ ...r }) => /* @__PURE__ */ t("nav", { "aria-label": "breadcrumb", "data-slot": "breadcrumb", ...r }), _ = ({
12
+ className: r,
13
+ wrap: a = "wrap",
14
+ ...s
15
+ }) => {
16
+ const n = a === "wrap", o = m.useMemo(() => ({ wrap: n }), [n]);
17
+ return /* @__PURE__ */ t(g.Provider, { value: o, children: /* @__PURE__ */ t(
18
+ j,
19
+ {
20
+ component: "ol",
21
+ "data-slot": "breadcrumb-list",
22
+ wrap: a,
23
+ align: "center",
24
+ className: f(
25
+ "gap-comp-breadcrumb-gap text-sm",
26
+ n ? "break-words" : "min-w-0",
27
+ r
28
+ ),
29
+ ...s
30
+ }
31
+ ) });
32
+ }, y = ({ className: r, ...a }) => {
33
+ const { wrap: s } = m.useContext(g);
34
+ return /* @__PURE__ */ t(
35
+ "li",
36
+ {
37
+ "data-slot": "breadcrumb-item",
38
+ className: f(
39
+ "inline-flex items-center",
40
+ !s && "shrink-0 whitespace-nowrap has-[[data-slot=breadcrumb-page]]:min-w-0 has-[[data-slot=breadcrumb-page]]:shrink",
41
+ r
42
+ ),
43
+ ...a
44
+ }
45
+ );
46
+ }, C = ({
25
47
  asChild: r,
26
- className: e,
48
+ className: a,
27
49
  ...s
28
50
  }) => /* @__PURE__ */ t(
29
- r ? i : "a",
51
+ r ? D : "a",
30
52
  {
31
53
  "data-slot": "breadcrumb-link",
32
- className: a(
33
- o({
54
+ className: f(
55
+ M({
34
56
  variant: "body",
35
57
  weight: "regular",
36
58
  size: "sm",
@@ -39,79 +61,214 @@ const f = ({ ...r }) => /* @__PURE__ */ t("nav", { "aria-label": "breadcrumb", "
39
61
  "font-text text-text-dark-secondary",
40
62
  "hover:text-text-brand-def",
41
63
  "focus-visible-default",
42
- e
64
+ a
43
65
  ),
44
66
  ...s
45
67
  }
46
- ), k = ({ className: r, ...e }) => /* @__PURE__ */ t(
47
- "span",
48
- {
49
- "data-slot": "breadcrumb-page",
50
- role: "link",
51
- "aria-disabled": "true",
52
- "aria-current": "page",
53
- className: a(
54
- o({
55
- variant: "body",
56
- weight: "medium",
57
- size: "sm",
58
- fixY: !0
59
- }),
60
- "font-text text-text-dark-primary-def",
61
- r
62
- ),
63
- ...e
64
- }
65
- ), v = ({
68
+ ), O = ({
69
+ className: r,
70
+ children: a,
71
+ title: s,
72
+ ...n
73
+ }) => {
74
+ const { wrap: o } = m.useContext(g);
75
+ return /* @__PURE__ */ t(
76
+ "span",
77
+ {
78
+ "data-slot": "breadcrumb-page",
79
+ role: "link",
80
+ "aria-disabled": "true",
81
+ "aria-current": "page",
82
+ title: s ?? (!o && typeof a == "string" ? a : void 0),
83
+ className: f(
84
+ M({
85
+ variant: "body",
86
+ weight: "medium",
87
+ size: "sm",
88
+ fixY: !0
89
+ }),
90
+ "font-text text-text-dark-primary-def",
91
+ !o && "truncate",
92
+ r
93
+ ),
94
+ ...n,
95
+ children: a
96
+ }
97
+ );
98
+ }, B = ({
66
99
  children: r,
67
- className: e,
100
+ className: a,
68
101
  ...s
69
- }) => /* @__PURE__ */ t(
70
- "li",
71
- {
72
- "data-slot": "breadcrumb-separator",
73
- role: "presentation",
74
- "aria-hidden": "true",
75
- className: a(
76
- "text-icon-dark-secondary-def [&>svg]:size-comp-breadcrumb-ico-size-sm",
77
- e
78
- ),
79
- ...s,
80
- children: r ?? /* @__PURE__ */ t(n, {})
81
- }
82
- ), B = ({
102
+ }) => {
103
+ const { wrap: n } = m.useContext(g);
104
+ return /* @__PURE__ */ t(
105
+ "li",
106
+ {
107
+ "data-slot": "breadcrumb-separator",
108
+ role: "presentation",
109
+ "aria-hidden": "true",
110
+ className: f(
111
+ "text-icon-dark-secondary-def [&>svg]:size-comp-breadcrumb-ico-size-sm",
112
+ !n && "shrink-0",
113
+ a
114
+ ),
115
+ ...s,
116
+ children: r ?? /* @__PURE__ */ t(A, {})
117
+ }
118
+ );
119
+ }, T = ({
83
120
  className: r,
84
- ...e
121
+ ...a
85
122
  }) => /* @__PURE__ */ t(
86
123
  "span",
87
124
  {
88
125
  "data-slot": "breadcrumb-ellipsis",
89
126
  role: "presentation",
90
127
  "aria-hidden": "true",
91
- className: a(
92
- "flex cursor-pointer items-center justify-center text-text-dark-secondary hover:text-text-brand-def",
128
+ className: f(
129
+ "flex items-center justify-center text-text-dark-secondary",
93
130
  r
94
131
  ),
95
- ...e,
96
- children: /* @__PURE__ */ t(
97
- m,
132
+ ...a,
133
+ children: /* @__PURE__ */ t(E, { component: "span", variant: "body", weight: "regular", size: "sm", children: "..." })
134
+ }
135
+ ), z = m.forwardRef(
136
+ ({
137
+ children: r,
138
+ label: a,
139
+ open: s,
140
+ defaultOpen: n,
141
+ onOpenChange: o,
142
+ modal: p,
143
+ contentProps: b,
144
+ className: u,
145
+ ...e
146
+ }, l) => {
147
+ const { translations: c } = I();
148
+ return /* @__PURE__ */ x(
149
+ L,
98
150
  {
99
- component: "span",
100
- variant: "body",
101
- weight: "regular",
102
- size: "sm",
103
- className: "transition-color",
104
- children: "..."
151
+ open: s,
152
+ defaultOpen: n,
153
+ onOpenChange: o,
154
+ modal: p,
155
+ children: [
156
+ /* @__PURE__ */ t(F, { asChild: !0, children: /* @__PURE__ */ t(
157
+ "button",
158
+ {
159
+ ref: l,
160
+ type: "button",
161
+ "data-slot": "breadcrumb-collapsed",
162
+ "aria-label": a ?? c.breadcrumb.collapsedAriaLabel,
163
+ className: f(
164
+ "relative inline-flex cursor-pointer items-center rounded-xs text-text-dark-secondary transition-colors",
165
+ // Widens the tiny "…" hit area into the gaps around it.
166
+ "after:absolute after:-inset-x-sm after:-inset-y-xs",
167
+ "hover:text-text-brand-def data-[state=open]:text-text-brand-def",
168
+ "active:text-text-brand-pressed",
169
+ "disabled:pointer-events-none disabled:text-text-dark-disabled",
170
+ "focus-visible-default",
171
+ u
172
+ ),
173
+ ...e,
174
+ children: /* @__PURE__ */ t(T, { className: "text-inherit" })
175
+ }
176
+ ) }),
177
+ /* @__PURE__ */ t(R, { align: "start", ...b, children: r })
178
+ ]
105
179
  }
106
- )
180
+ );
107
181
  }
108
182
  );
183
+ z.displayName = "BreadcrumbCollapsed";
184
+ const S = ({
185
+ children: r,
186
+ href: a,
187
+ asChild: s = !1,
188
+ className: n
189
+ }) => /* @__PURE__ */ t(
190
+ $,
191
+ {
192
+ asChild: !0,
193
+ "data-slot": "breadcrumb-collapsed-item",
194
+ className: n,
195
+ children: s ? r : /* @__PURE__ */ t("a", { href: a, children: r })
196
+ }
197
+ ), P = (r, a) => {
198
+ const s = r ? [r].flat() : [], n = [];
199
+ let o;
200
+ const p = (e) => o === void 0 || o !== null && w.indexOf(e) < w.indexOf(o);
201
+ for (const e of s)
202
+ if (e.responsive !== !1)
203
+ if (typeof e.responsive == "string") {
204
+ if (!p(e.responsive)) continue;
205
+ n.push({ rule: e, from: e.responsive, to: o ?? void 0 }), o = e.responsive;
206
+ } else {
207
+ n.push({ rule: e, to: o ?? void 0 }), o = null;
208
+ break;
209
+ }
210
+ const b = s[s.length - 1], u = n[n.length - 1];
211
+ return o !== null && b && ((u == null ? void 0 : u.rule) === b ? u.from = void 0 : n.push({ rule: b, to: o })), n.map(({ rule: e, from: l, to: c }) => {
212
+ const i = Math.max(0, e.keepStart ?? 1), d = a - Math.max(1, e.keepEnd ?? 1);
213
+ return {
214
+ from: l,
215
+ to: c,
216
+ hidden: !e.expanded && d > i ? { start: i, end: d } : null
217
+ };
218
+ });
219
+ }, Y = (r) => /* @__PURE__ */ t("a", { href: r.href, children: r.label }), N = (r, a) => r.key ?? a, K = ({
220
+ items: r,
221
+ collapse: a,
222
+ renderLink: s = Y,
223
+ collapsedLabel: n
224
+ }) => {
225
+ const o = P(a, r.length), p = /* @__PURE__ */ new Map();
226
+ for (const { hidden: e } of o)
227
+ e && p.set(`${e.start}-${e.end}`, e);
228
+ const b = (e, l) => l === r.length - 1 ? /* @__PURE__ */ t(O, { children: e.label }) : e.href ? /* @__PURE__ */ t(C, { asChild: !0, children: s(e) }) : /* @__PURE__ */ t(C, { asChild: !0, className: "hover:text-text-dark-secondary", children: /* @__PURE__ */ t("span", { children: e.label }) }), u = (e, l) => {
229
+ const c = k(
230
+ o.filter((d) => {
231
+ var h;
232
+ return ((h = d.hidden) == null ? void 0 : h.start) !== e || d.hidden.end !== l;
233
+ })
234
+ ) ?? void 0, i = r.slice(e, l).filter((d) => d.href);
235
+ return /* @__PURE__ */ x(m.Fragment, { children: [
236
+ e > 0 && /* @__PURE__ */ t(B, { className: c }),
237
+ /* @__PURE__ */ t(y, { className: c, children: i.length > 0 ? /* @__PURE__ */ t(z, { label: n, children: i.map((d, h) => /* @__PURE__ */ t(
238
+ S,
239
+ {
240
+ asChild: !0,
241
+ children: s(d)
242
+ },
243
+ N(d, e + h)
244
+ )) }) : /* @__PURE__ */ t(T, {}) })
245
+ ] }, `breadcrumb-collapsed-${e}-${l}`);
246
+ };
247
+ return /* @__PURE__ */ t(v, { children: r.map((e, l) => {
248
+ const c = k(
249
+ o.filter(
250
+ ({ hidden: i }) => i && l >= i.start && l < i.end
251
+ )
252
+ );
253
+ return /* @__PURE__ */ x(m.Fragment, { children: [
254
+ [...p.values()].filter(({ start: i }) => i === l).map(({ start: i, end: d }) => u(i, d)),
255
+ c !== null && /* @__PURE__ */ x(v, { children: [
256
+ l > 0 && /* @__PURE__ */ t(B, { className: c }),
257
+ /* @__PURE__ */ t(y, { className: c, children: b(e, l) })
258
+ ] })
259
+ ] }, N(e, l));
260
+ }) });
261
+ };
262
+ K.displayName = "BreadcrumbTrail";
109
263
  export {
110
- f as Breadcrumb,
111
- B as BreadcrumbEllipsis,
112
- h as BreadcrumbItem,
113
- y as BreadcrumbLink,
114
- g as BreadcrumbList,
115
- k as BreadcrumbPage,
116
- v as BreadcrumbSeparator
264
+ Z as Breadcrumb,
265
+ z as BreadcrumbCollapsed,
266
+ S as BreadcrumbCollapsedItem,
267
+ T as BreadcrumbEllipsis,
268
+ y as BreadcrumbItem,
269
+ C as BreadcrumbLink,
270
+ _ as BreadcrumbList,
271
+ O as BreadcrumbPage,
272
+ B as BreadcrumbSeparator,
273
+ K as BreadcrumbTrail
117
274
  };
@@ -4,4 +4,8 @@ declare const meta: Meta<typeof Breadcrumb>;
4
4
  export default meta;
5
5
  type Story = StoryObj<typeof Breadcrumb>;
6
6
  export declare const Default: Story;
7
+ export declare const CollapsedOpen: Story;
8
+ export declare const SingleLine: Story;
9
+ export declare const Trail: Story;
10
+ export declare const ResponsiveTrail: Story;
7
11
  //# sourceMappingURL=Breadcrumb.stories.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Breadcrumb.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Breadcrumb/Breadcrumb.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EACL,UAAU,EAOX,MAAM,cAAc,CAAA;AAErB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CA2CjC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAA;AAExC,eAAO,MAAM,OAAO,EAAE,KA+BrB,CAAA"}
1
+ {"version":3,"file":"Breadcrumb.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Breadcrumb/Breadcrumb.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,EACL,UAAU,EAWX,MAAM,cAAc,CAAA;AAErB,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,UAAU,CAiDjC,CAAA;AAED,eAAe,IAAI,CAAA;AACnB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,UAAU,CAAC,CAAA;AAUxC,eAAO,MAAM,OAAO,EAAE,KAsCrB,CAAA;AAED,eAAO,MAAM,aAAa,EAAE,KAqC3B,CAAA;AAED,eAAO,MAAM,UAAU,EAAE,KAgCxB,CAAA;AAED,eAAO,MAAM,KAAK,EAAE,KAmBnB,CAAA;AAED,eAAO,MAAM,eAAe,EAAE,KAwB7B,CAAA"}
@@ -1,10 +1,13 @@
1
- import { Breadcrumb as a, BreadcrumbEllipsis as m, BreadcrumbItem as b, BreadcrumbLink as c, BreadcrumbList as d, BreadcrumbPage as u, BreadcrumbSeparator as B } from "./Breadcrumb.js";
1
+ import { Breadcrumb as a, BreadcrumbCollapsed as m, BreadcrumbCollapsedItem as d, BreadcrumbEllipsis as b, BreadcrumbItem as c, BreadcrumbLink as u, BreadcrumbList as B, BreadcrumbPage as l, BreadcrumbSeparator as i, BreadcrumbTrail as o } from "./Breadcrumb.js";
2
2
  export {
3
3
  a as Breadcrumb,
4
- m as BreadcrumbEllipsis,
5
- b as BreadcrumbItem,
6
- c as BreadcrumbLink,
7
- d as BreadcrumbList,
8
- u as BreadcrumbPage,
9
- B as BreadcrumbSeparator
4
+ m as BreadcrumbCollapsed,
5
+ d as BreadcrumbCollapsedItem,
6
+ b as BreadcrumbEllipsis,
7
+ c as BreadcrumbItem,
8
+ u as BreadcrumbLink,
9
+ B as BreadcrumbList,
10
+ l as BreadcrumbPage,
11
+ i as BreadcrumbSeparator,
12
+ o as BreadcrumbTrail
10
13
  };