@mohirlab/react 0.4.0 → 0.6.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.
@@ -0,0 +1,19 @@
1
+ import { ComponentPropsWithRef, ReactNode } from "react";
2
+ export interface AccordionProps extends ComponentPropsWithRef<'div'> {
3
+ /** `single`: opening one item closes the others. `multiple` (default): independent. */
4
+ type?: 'single' | 'multiple';
5
+ children: ReactNode;
6
+ }
7
+ /**
8
+ * Collapsible sections on native `<details>`/`<summary>`: keyboard support, screen reader
9
+ * semantics and find-in-page (which opens the matching item) come from the browser.
10
+ */
11
+ export declare function Accordion({ type, className, ...rest }: AccordionProps): import("react").JSX.Element;
12
+ export interface AccordionItemProps extends Omit<ComponentPropsWithRef<'details'>, 'title'> {
13
+ /** The always-visible heading of the item. */
14
+ title: ReactNode;
15
+ defaultOpen?: boolean;
16
+ children: ReactNode;
17
+ }
18
+ export declare function AccordionItem({ title, defaultOpen, className, children, ...rest }: AccordionItemProps): import("react").JSX.Element;
19
+ //# sourceMappingURL=accordion.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accordion.d.ts","names":[],"sources":["../../../src/components/accordion/accordion.tsx"],"mappings":";iBAQiB,uBAAuB;;EAEtC;EACA,UAAU;;;;;;wBAOI,YAAY,MAAmB,cAAc,QAAQ,iCAAc,IAAA;iBASlE,2BAA2B,KAAK;;EAE/C,OAAO;EACP;EACA,UAAU;;wBAGI,gBAAgB,OAAO,aAAa,WAAW,aAAa,QAAQ,qCAAkB,IAAA"}
@@ -0,0 +1,44 @@
1
+ import { createContext, useContext, useId } from "react";
2
+ import { iconChevronDown } from "@mohirlab/icons";
3
+ import { cx } from "../../utils/cx.js";
4
+ import { Icon } from "../icon/icon.js";
5
+ import { accordion, chevron, content, item, summary } from "./accordion.styles.js";
6
+ import { jsx, jsxs } from "react/jsx-runtime";
7
+ // src/components/accordion/accordion.tsx
8
+ const AccordionContext = createContext({});
9
+ /**
10
+ * Collapsible sections on native `<details>`/`<summary>`: keyboard support, screen reader
11
+ * semantics and find-in-page (which opens the matching item) come from the browser.
12
+ */
13
+ function Accordion({ type = "multiple", className, ...rest }) {
14
+ const id = useId();
15
+ return /* @__PURE__ */ jsx(AccordionContext.Provider, {
16
+ value: { name: type === "single" ? `ml-accordion-${id}` : void 0 },
17
+ children: /* @__PURE__ */ jsx("div", {
18
+ ...rest,
19
+ className: cx(accordion, className)
20
+ })
21
+ });
22
+ }
23
+ function AccordionItem({ title, defaultOpen, className, children, ...rest }) {
24
+ const { name } = useContext(AccordionContext);
25
+ return /* @__PURE__ */ jsxs("details", {
26
+ ...rest,
27
+ name,
28
+ open: defaultOpen,
29
+ className: cx(item, className),
30
+ children: [/* @__PURE__ */ jsxs("summary", {
31
+ className: summary,
32
+ children: [title, /* @__PURE__ */ jsx(Icon, {
33
+ icon: iconChevronDown,
34
+ className: chevron
35
+ })]
36
+ }), /* @__PURE__ */ jsx("div", {
37
+ className: content,
38
+ children
39
+ })]
40
+ });
41
+ }
42
+ export { Accordion, AccordionItem };
43
+
44
+ //# sourceMappingURL=accordion.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accordion.js","names":["styles.accordion","styles.item","styles.summary","styles.chevron","styles.content"],"sources":["../../../src/components/accordion/accordion.tsx"],"sourcesContent":["import { createContext, useContext, useId, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { iconChevronDown } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { Icon } from '../icon';\nimport * as styles from './accordion.css';\n\nconst AccordionContext = createContext<{ name?: string }>({});\n\nexport interface AccordionProps extends ComponentPropsWithRef<'div'> {\n /** `single`: opening one item closes the others. `multiple` (default): independent. */\n type?: 'single' | 'multiple';\n children: ReactNode;\n}\n\n/**\n * Collapsible sections on native `<details>`/`<summary>`: keyboard support, screen reader\n * semantics and find-in-page (which opens the matching item) come from the browser.\n */\nexport function Accordion({ type = 'multiple', className, ...rest }: AccordionProps) {\n const id = useId();\n return (\n <AccordionContext.Provider value={{ name: type === 'single' ? `ml-accordion-${id}` : undefined }}>\n <div {...rest} className={cx(styles.accordion, className)} />\n </AccordionContext.Provider>\n );\n}\n\nexport interface AccordionItemProps extends Omit<ComponentPropsWithRef<'details'>, 'title'> {\n /** The always-visible heading of the item. */\n title: ReactNode;\n defaultOpen?: boolean;\n children: ReactNode;\n}\n\nexport function AccordionItem({ title, defaultOpen, className, children, ...rest }: AccordionItemProps) {\n const { name } = useContext(AccordionContext);\n return (\n <details {...rest} name={name} open={defaultOpen} className={cx(styles.item, className)}>\n <summary className={styles.summary}>\n {title}\n <Icon icon={iconChevronDown} className={styles.chevron} />\n </summary>\n <div className={styles.content}>{children}</div>\n </details>\n );\n}\n"],"mappings":";;;;;;;AAMA,MAAM,mBAAmB,cAAiC,CAAC,CAAC;;;;;AAY5D,SAAgB,UAAU,EAAE,OAAO,YAAY,WAAW,GAAG,QAAwB;CACnF,MAAM,KAAK,MAAM;CACjB,OACE,oBAAC,iBAAiB,UAAlB;EAA2B,OAAO,EAAE,MAAM,SAAS,WAAW,gBAAgB,OAAO,KAAA,EAAU;EAC7F,UAAA,oBAAC,OAAD;GAAK,GAAI;GAAM,WAAW,GAAGA,WAAkB,SAAS;EAAI,CAAA;CACnC,CAAA;AAE/B;AASA,SAAgB,cAAc,EAAE,OAAO,aAAa,WAAW,UAAU,GAAG,QAA4B;CACtG,MAAM,EAAE,SAAS,WAAW,gBAAgB;CAC5C,OACE,qBAAC,WAAD;EAAS,GAAI;EAAY;EAAM,MAAM;EAAa,WAAW,GAAGC,MAAa,SAAS;EAAtF,UAAA,CACE,qBAAC,WAAD;GAAS,WAAWC;GAApB,UAAA,CACG,OACD,oBAAC,MAAD;IAAM,MAAM;IAAiB,WAAWC;GAAiB,CAAA,CAClD;EACT,CAAA,GAAA,oBAAC,OAAD;GAAK,WAAWC;GAAiB;EAAc,CAAA,CACxC;;AAEb"}
@@ -0,0 +1,9 @@
1
+ // src/components/accordion/accordion.css.ts
2
+ var accordion = "ml_1mhi8cy0";
3
+ var chevron = "ml_1mhi8cy3";
4
+ var content = "ml_1mhi8cy4";
5
+ var item = "ml_1mhi8cy1";
6
+ var summary = "ml_1mhi8cy2";
7
+ export { accordion, chevron, content, item, summary };
8
+
9
+ //# sourceMappingURL=accordion.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"accordion.styles.js","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,2 @@
1
+ import { Accordion, AccordionItem, AccordionItemProps, AccordionProps } from "./accordion.js";
2
+ export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps };
@@ -0,0 +1,3 @@
1
+ import { Tab, TabList, TabListProps, TabPanel, TabPanelProps, TabProps, Tabs, TabsProps } from "./tabs.js";
2
+ import { BottomNav, BottomNavItem, BottomNavProps, BottomNavSpacer, Breadcrumbs, BreadcrumbsProps, Crumb, SegmentedControl, SegmentedControlProps, SegmentedOption } from "./nav.js";
3
+ export { BottomNav, BottomNavItem, type BottomNavProps, BottomNavSpacer, Breadcrumbs, type BreadcrumbsProps, type Crumb, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Tabs, type TabsProps };
@@ -0,0 +1,67 @@
1
+ import { ComponentPropsWithRef, ReactNode } from "react";
2
+ import { IconData } from "@mohirlab/icons";
3
+ export interface SegmentedOption {
4
+ value: string;
5
+ label: ReactNode;
6
+ icon?: IconData;
7
+ disabled?: boolean;
8
+ }
9
+ export interface SegmentedControlProps extends Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'onChange' | 'children'> {
10
+ /** Names the choice, e.g. "View". */
11
+ 'aria-label': string;
12
+ options: SegmentedOption[];
13
+ value?: string;
14
+ defaultValue?: string;
15
+ onValueChange?: (value: string) => void;
16
+ name?: string;
17
+ /** Stretch to the container width, segments sharing it equally. */
18
+ fullWidth?: boolean;
19
+ }
20
+ /**
21
+ * One choice from two to five short options, such as a view or a time range. Native
22
+ * radios underneath: arrow keys move the choice, and it submits with forms.
23
+ */
24
+ export declare function SegmentedControl({ options, value, defaultValue, onValueChange, name, fullWidth, className, ...rest }: SegmentedControlProps): import("react").JSX.Element;
25
+ export interface BottomNavProps extends ComponentPropsWithRef<'nav'> {
26
+ /** Names the navigation, e.g. "Main". */
27
+ 'aria-label': string;
28
+ /** Hide from this breakpoint up, where a sidebar or top bar takes over. Default tablet. */
29
+ hideFrom?: 'tablet' | 'desktop' | 'never';
30
+ }
31
+ /**
32
+ * The phone tab bar: three to five top-level destinations, fixed to the bottom and
33
+ * clear of the home indicator. Add a `BottomNavSpacer` at the end of the page so
34
+ * content can scroll past it.
35
+ */
36
+ export declare function BottomNav({ hideFrom, className, ...rest }: BottomNavProps): import("react").JSX.Element;
37
+ type BottomNavItemProps = {
38
+ icon: IconData;
39
+ label: string;
40
+ /** Marks the current destination (`aria-current="page"`). */
41
+ current?: boolean;
42
+ /** A count such as unread messages; announced with the label. */
43
+ badge?: number;
44
+ className?: string;
45
+ } & (({
46
+ href: string;
47
+ } & Omit<ComponentPropsWithRef<'a'>, 'children'>) | ({
48
+ href?: undefined;
49
+ } & Omit<ComponentPropsWithRef<'button'>, 'children'>));
50
+ export declare function BottomNavItem({ icon, label, current, badge, className, ...rest }: BottomNavItemProps): import("react").JSX.Element;
51
+ /** Reserves room under the page content for the bottom nav (on the same breakpoints). */
52
+ export declare function BottomNavSpacer({ hideFrom }: Pick<BottomNavProps, 'hideFrom'>): import("react").JSX.Element;
53
+ export interface Crumb {
54
+ label: ReactNode;
55
+ href?: string;
56
+ }
57
+ export interface BreadcrumbsProps extends Omit<ComponentPropsWithRef<'nav'>, 'children'> {
58
+ /** From the top level down to the current page (last, not linked). */
59
+ items: Crumb[];
60
+ }
61
+ /**
62
+ * Where the current page sits in the hierarchy. On phones it collapses to a single
63
+ * "← Parent" back link, the thing people actually use a trail for on a small screen.
64
+ */
65
+ export declare function Breadcrumbs({ items, className, 'aria-label': ariaLabel, ...rest }: BreadcrumbsProps): import("react").JSX.Element;
66
+ export {};
67
+ //# sourceMappingURL=nav.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nav.d.ts","names":[],"sources":["../../../src/components/navigation/nav.tsx"],"mappings":";;iBAQiB;EACf;EACA,OAAO;EACP,OAAO;EACP;;iBAGe,8BAA8B,KAC7C;;EAIA;EACA,SAAS;EACT;EACA;EACA,iBAAiB;EACjB;;EAEA;;;;;;wBAOc,mBACd,SACA,OACA,cACA,eACA,MACA,WACA,cACG,QACF,wCAAqB,IAAA;iBAqCP,uBAAuB;;EAEtC;;EAEA;;;;;;;wBAQc,YAAY,UAAqB,cAAc,QAAQ,iCAAc,IAAA;KAIhF;EACH,MAAM;EACN;;EAEA;;EAEA;EACA;;EAEK;IAAiB,KAAK;EACtB;IAAqB,KAAK;wBAGjB,gBAAgB,MAAM,OAAO,SAAS,OAAO,cAAc,QAAQ,qCAAkB,IAAA;;wBAiCrF,kBAAkB,YAAuB,KAAK,8CAA2B,IAAA;iBAMxE;EACf,OAAO;EACP;;iBAGe,yBAAyB,KAAK;;EAE7C,OAAO;;;;;;wBAOO,cACd,OACA,yBACc,cACX,QACF,mCAAgB,IAAA"}
@@ -0,0 +1,144 @@
1
+ import { useId, useState } from "react";
2
+ import { iconArrowLeft, iconChevronRight } from "@mohirlab/icons";
3
+ import { cx } from "../../utils/cx.js";
4
+ import { Icon } from "../icon/icon.js";
5
+ import { bottomBadge, bottomItem, bottomNav, bottomNavSpacer, crumb, crumbCurrent, crumbLink, crumbs, segment, segmentInput, segmentLabel, segmented } from "./navigation.styles.js";
6
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
7
+ // src/components/navigation/nav.tsx
8
+ /**
9
+ * One choice from two to five short options, such as a view or a time range. Native
10
+ * radios underneath: arrow keys move the choice, and it submits with forms.
11
+ */
12
+ function SegmentedControl({ options, value, defaultValue, onValueChange, name, fullWidth, className, ...rest }) {
13
+ const generated = useId();
14
+ const [internal, setInternal] = useState(defaultValue ?? options[0]?.value);
15
+ const current = value ?? internal;
16
+ return /* @__PURE__ */ jsx("div", {
17
+ ...rest,
18
+ role: "radiogroup",
19
+ "data-full-width": fullWidth || void 0,
20
+ className: cx(segmented, className),
21
+ children: options.map((option) => /* @__PURE__ */ jsxs("label", {
22
+ className: segment,
23
+ children: [/* @__PURE__ */ jsx("input", {
24
+ type: "radio",
25
+ className: segmentInput,
26
+ name: name ?? `ml-seg-${generated}`,
27
+ value: option.value,
28
+ checked: current === option.value,
29
+ disabled: option.disabled,
30
+ onChange: () => {
31
+ if (value === void 0) setInternal(option.value);
32
+ onValueChange?.(option.value);
33
+ }
34
+ }), /* @__PURE__ */ jsxs("span", {
35
+ className: segmentLabel,
36
+ children: [option.icon && /* @__PURE__ */ jsx(Icon, {
37
+ icon: option.icon,
38
+ size: 16
39
+ }), option.label]
40
+ })]
41
+ }, option.value))
42
+ });
43
+ }
44
+ /**
45
+ * The phone tab bar: three to five top-level destinations, fixed to the bottom and
46
+ * clear of the home indicator. Add a `BottomNavSpacer` at the end of the page so
47
+ * content can scroll past it.
48
+ */
49
+ function BottomNav({ hideFrom = "tablet", className, ...rest }) {
50
+ return /* @__PURE__ */ jsx("nav", {
51
+ ...rest,
52
+ "data-hide-from": hideFrom,
53
+ className: cx(bottomNav, className)
54
+ });
55
+ }
56
+ function BottomNavItem({ icon, label, current, badge, className, ...rest }) {
57
+ const content = /* @__PURE__ */ jsxs(Fragment, { children: [
58
+ /* @__PURE__ */ jsx(Icon, {
59
+ icon,
60
+ size: 22
61
+ }),
62
+ /* @__PURE__ */ jsx("span", { children: label }),
63
+ badge ? /* @__PURE__ */ jsx("span", {
64
+ className: bottomBadge,
65
+ "aria-hidden": "true",
66
+ children: badge > 99 ? "99+" : badge
67
+ }) : null
68
+ ] });
69
+ const shared = {
70
+ className: cx(bottomItem, className),
71
+ "aria-current": current ? "page" : void 0,
72
+ "aria-label": badge ? `${label}, ${badge}` : void 0
73
+ };
74
+ if (rest.href !== void 0) return /* @__PURE__ */ jsx("a", {
75
+ ...rest,
76
+ ...shared,
77
+ children: content
78
+ });
79
+ return /* @__PURE__ */ jsx("button", {
80
+ type: "button",
81
+ ...rest,
82
+ ...shared,
83
+ children: content
84
+ });
85
+ }
86
+ /** Reserves room under the page content for the bottom nav (on the same breakpoints). */
87
+ function BottomNavSpacer({ hideFrom = "tablet" }) {
88
+ return /* @__PURE__ */ jsx("div", {
89
+ "aria-hidden": "true",
90
+ "data-hide-from": hideFrom,
91
+ className: bottomNavSpacer
92
+ });
93
+ }
94
+ /**
95
+ * Where the current page sits in the hierarchy. On phones it collapses to a single
96
+ * "← Parent" back link, the thing people actually use a trail for on a small screen.
97
+ */
98
+ function Breadcrumbs({ items, className, "aria-label": ariaLabel = "Breadcrumb", ...rest }) {
99
+ const parent = items.length > 1 ? items[items.length - 2] : void 0;
100
+ return /* @__PURE__ */ jsx("nav", {
101
+ ...rest,
102
+ "aria-label": ariaLabel,
103
+ className,
104
+ children: /* @__PURE__ */ jsxs("ol", {
105
+ className: crumbs,
106
+ children: [parent?.href && /* @__PURE__ */ jsx("li", {
107
+ className: "ml_gp95tng",
108
+ children: /* @__PURE__ */ jsxs("a", {
109
+ className: "ml_gp95tnd",
110
+ href: parent.href,
111
+ children: [
112
+ /* @__PURE__ */ jsx(Icon, {
113
+ icon: iconArrowLeft,
114
+ size: 16
115
+ }),
116
+ " ",
117
+ parent.label
118
+ ]
119
+ })
120
+ }), items.map((item, index) => {
121
+ const last = index === items.length - 1;
122
+ return /* @__PURE__ */ jsxs("li", {
123
+ className: crumb,
124
+ children: [last || !item.href ? /* @__PURE__ */ jsx("span", {
125
+ className: crumbCurrent,
126
+ "aria-current": last ? "page" : void 0,
127
+ children: item.label
128
+ }) : /* @__PURE__ */ jsx("a", {
129
+ className: crumbLink,
130
+ href: item.href,
131
+ children: item.label
132
+ }), !last && /* @__PURE__ */ jsx(Icon, {
133
+ icon: iconChevronRight,
134
+ size: 14,
135
+ className: "ml_gp95tnf"
136
+ })]
137
+ }, index);
138
+ })]
139
+ })
140
+ });
141
+ }
142
+ export { BottomNav, BottomNavItem, BottomNavSpacer, Breadcrumbs, SegmentedControl };
143
+
144
+ //# sourceMappingURL=nav.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"nav.js","names":["styles.segmented","styles.segment","styles.segmentInput","styles.segmentLabel","styles.bottomNav","styles.bottomBadge","styles.bottomItem","styles.bottomNavSpacer","styles.crumbs","styles.crumb","styles.crumbCurrent","styles.crumbLink"],"sources":["../../../src/components/navigation/nav.tsx"],"sourcesContent":["import { useId, useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { iconArrowLeft, iconChevronRight, type IconData } from '@mohirlab/icons';\nimport { cx } from '../../utils/cx';\nimport { Icon } from '../icon';\nimport * as styles from './navigation.css';\n\n/* ---------------------------------------------------- Segmented control */\n\nexport interface SegmentedOption {\n value: string;\n label: ReactNode;\n icon?: IconData;\n disabled?: boolean;\n}\n\nexport interface SegmentedControlProps extends Omit<\n ComponentPropsWithRef<'div'>,\n 'defaultValue' | 'onChange' | 'children'\n> {\n /** Names the choice, e.g. \"View\". */\n 'aria-label': string;\n options: SegmentedOption[];\n value?: string;\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n name?: string;\n /** Stretch to the container width, segments sharing it equally. */\n fullWidth?: boolean;\n}\n\n/**\n * One choice from two to five short options, such as a view or a time range. Native\n * radios underneath: arrow keys move the choice, and it submits with forms.\n */\nexport function SegmentedControl({\n options,\n value,\n defaultValue,\n onValueChange,\n name,\n fullWidth,\n className,\n ...rest\n}: SegmentedControlProps) {\n const generated = useId();\n const [internal, setInternal] = useState(defaultValue ?? options[0]?.value);\n const current = value ?? internal;\n return (\n <div\n {...rest}\n role=\"radiogroup\"\n data-full-width={fullWidth || undefined}\n className={cx(styles.segmented, className)}\n >\n {options.map((option) => (\n <label key={option.value} className={styles.segment}>\n <input\n type=\"radio\"\n className={styles.segmentInput}\n name={name ?? `ml-seg-${generated}`}\n value={option.value}\n checked={current === option.value}\n disabled={option.disabled}\n onChange={() => {\n if (value === undefined) setInternal(option.value);\n onValueChange?.(option.value);\n }}\n />\n <span className={styles.segmentLabel}>\n {option.icon && <Icon icon={option.icon} size={16} />}\n {option.label}\n </span>\n </label>\n ))}\n </div>\n );\n}\n\n/* ---------------------------------------------------------- Bottom nav */\n\nexport interface BottomNavProps extends ComponentPropsWithRef<'nav'> {\n /** Names the navigation, e.g. \"Main\". */\n 'aria-label': string;\n /** Hide from this breakpoint up, where a sidebar or top bar takes over. Default tablet. */\n hideFrom?: 'tablet' | 'desktop' | 'never';\n}\n\n/**\n * The phone tab bar: three to five top-level destinations, fixed to the bottom and\n * clear of the home indicator. Add a `BottomNavSpacer` at the end of the page so\n * content can scroll past it.\n */\nexport function BottomNav({ hideFrom = 'tablet', className, ...rest }: BottomNavProps) {\n return <nav {...rest} data-hide-from={hideFrom} className={cx(styles.bottomNav, className)} />;\n}\n\ntype BottomNavItemProps = {\n icon: IconData;\n label: string;\n /** Marks the current destination (`aria-current=\"page\"`). */\n current?: boolean;\n /** A count such as unread messages; announced with the label. */\n badge?: number;\n className?: string;\n} & (\n | ({ href: string } & Omit<ComponentPropsWithRef<'a'>, 'children'>)\n | ({ href?: undefined } & Omit<ComponentPropsWithRef<'button'>, 'children'>)\n);\n\nexport function BottomNavItem({ icon, label, current, badge, className, ...rest }: BottomNavItemProps) {\n const content = (\n <>\n <Icon icon={icon} size={22} />\n <span>{label}</span>\n {badge ? (\n <span className={styles.bottomBadge} aria-hidden=\"true\">\n {badge > 99 ? '99+' : badge}\n </span>\n ) : null}\n </>\n );\n const shared = {\n className: cx(styles.bottomItem, className),\n 'aria-current': current ? ('page' as const) : undefined,\n // The visual badge is hidden; the count is part of the accessible name instead.\n 'aria-label': badge ? `${label}, ${badge}` : undefined,\n };\n if (rest.href !== undefined) {\n return (\n <a {...(rest as ComponentPropsWithRef<'a'>)} {...shared}>\n {content}\n </a>\n );\n }\n return (\n <button type=\"button\" {...(rest as ComponentPropsWithRef<'button'>)} {...shared}>\n {content}\n </button>\n );\n}\n\n/** Reserves room under the page content for the bottom nav (on the same breakpoints). */\nexport function BottomNavSpacer({ hideFrom = 'tablet' }: Pick<BottomNavProps, 'hideFrom'>) {\n return <div aria-hidden=\"true\" data-hide-from={hideFrom} className={styles.bottomNavSpacer} />;\n}\n\n/* --------------------------------------------------------- Breadcrumbs */\n\nexport interface Crumb {\n label: ReactNode;\n href?: string;\n}\n\nexport interface BreadcrumbsProps extends Omit<ComponentPropsWithRef<'nav'>, 'children'> {\n /** From the top level down to the current page (last, not linked). */\n items: Crumb[];\n}\n\n/**\n * Where the current page sits in the hierarchy. On phones it collapses to a single\n * \"← Parent\" back link, the thing people actually use a trail for on a small screen.\n */\nexport function Breadcrumbs({\n items,\n className,\n 'aria-label': ariaLabel = 'Breadcrumb',\n ...rest\n}: BreadcrumbsProps) {\n const parent = items.length > 1 ? items[items.length - 2] : undefined;\n return (\n <nav {...rest} aria-label={ariaLabel} className={className}>\n <ol className={styles.crumbs}>\n {parent?.href && (\n <li className={styles.crumbBack}>\n <a className={styles.crumbLink} href={parent.href}>\n <Icon icon={iconArrowLeft} size={16} /> {parent.label}\n </a>\n </li>\n )}\n {items.map((item, index) => {\n const last = index === items.length - 1;\n return (\n <li key={index} className={styles.crumb}>\n {last || !item.href ? (\n <span className={styles.crumbCurrent} aria-current={last ? 'page' : undefined}>\n {item.label}\n </span>\n ) : (\n <a className={styles.crumbLink} href={item.href}>\n {item.label}\n </a>\n )}\n {!last && <Icon icon={iconChevronRight} size={14} className={styles.crumbSeparator} />}\n </li>\n );\n })}\n </ol>\n </nav>\n );\n}\n"],"mappings":";;;;;;;;;;;AAkCA,SAAgB,iBAAiB,EAC/B,SACA,OACA,cACA,eACA,MACA,WACA,WACA,GAAG,QACqB;CACxB,MAAM,YAAY,MAAM;CACxB,MAAM,CAAC,UAAU,eAAe,SAAS,gBAAgB,QAAQ,EAAE,EAAE,KAAK;CAC1E,MAAM,UAAU,SAAS;CACzB,OACE,oBAAC,OAAD;EACE,GAAI;EACJ,MAAK;EACL,mBAAiB,aAAa,KAAA;EAC9B,WAAW,GAAGA,WAAkB,SAAS;EAExC,UAAA,QAAQ,KAAK,WACZ,qBAAC,SAAD;GAA0B,WAAWC;GAArC,UAAA,CACE,oBAAC,SAAD;IACE,MAAK;IACL,WAAWC;IACX,MAAM,QAAQ,UAAU;IACxB,OAAO,OAAO;IACd,SAAS,YAAY,OAAO;IAC5B,UAAU,OAAO;IACjB,gBAAgB;KACd,IAAI,UAAU,KAAA,GAAW,YAAY,OAAO,KAAK;KACjD,gBAAgB,OAAO,KAAK;IAC9B;GACD,CAAA,GACD,qBAAC,QAAD;IAAM,WAAWC;IAAjB,UAAA,CACG,OAAO,QAAQ,oBAAC,MAAD;KAAM,MAAM,OAAO;KAAM,MAAM;IAAK,CAAA,GACnD,OAAO,KACJ;GACD,CAAA,CAAA;EAjBK,GAAA,OAAO,KAiBZ,CACR;CACE,CAAA;AAET;;;;;;AAgBA,SAAgB,UAAU,EAAE,WAAW,UAAU,WAAW,GAAG,QAAwB;CACrF,OAAO,oBAAC,OAAD;EAAK,GAAI;EAAM,kBAAgB;EAAU,WAAW,GAAGC,WAAkB,SAAS;CAAI,CAAA;AAC/F;AAeA,SAAgB,cAAc,EAAE,MAAM,OAAO,SAAS,OAAO,WAAW,GAAG,QAA4B;CACrG,MAAM,UACJ,qBAAA,UAAA,EAAA,UAAA;EACE,oBAAC,MAAD;GAAY;GAAM,MAAM;EAAK,CAAA;EAC7B,oBAAC,QAAD,EAAA,UAAO,MAAY,CAAA;EAClB,QACC,oBAAC,QAAD;GAAM,WAAWC;GAAoB,eAAY;GAC9C,UAAA,QAAQ,KAAK,QAAQ;EAClB,CAAA,IACJ;CACJ,EAAA,CAAA;CAEJ,MAAM,SAAS;EACb,WAAW,GAAGC,YAAmB,SAAS;EAC1C,gBAAgB,UAAW,SAAmB,KAAA;EAE9C,cAAc,QAAQ,GAAG,MAAM,IAAI,UAAU,KAAA;CAC/C;CACA,IAAI,KAAK,SAAS,KAAA,GAChB,OACE,oBAAC,KAAD;EAAG,GAAK;EAAqC,GAAI;EAC9C,UAAA;CACA,CAAA;CAGP,OACE,oBAAC,UAAD;EAAQ,MAAK;EAAS,GAAK;EAA0C,GAAI;EACtE,UAAA;CACK,CAAA;AAEZ;;AAGA,SAAgB,gBAAgB,EAAE,WAAW,YAA8C;CACzF,OAAO,oBAAC,OAAD;EAAK,eAAY;EAAO,kBAAgB;EAAU,WAAWC;CAAyB,CAAA;AAC/F;;;;;AAkBA,SAAgB,YAAY,EAC1B,OACA,WACA,cAAc,YAAY,cAC1B,GAAG,QACgB;CACnB,MAAM,SAAS,MAAM,SAAS,IAAI,MAAM,MAAM,SAAS,KAAK,KAAA;CAC5D,OACE,oBAAC,OAAD;EAAK,GAAI;EAAM,cAAY;EAAsB;EAC/C,UAAA,qBAAC,MAAD;GAAI,WAAWC;GAAf,UAAA,CACG,QAAQ,QACP,oBAAC,MAAD;IAAI,WAAW;IACb,UAAA,qBAAC,KAAD;KAAG,WAAW;KAAkB,MAAM,OAAO;KAA7C,UAAA;MACE,oBAAC,MAAD;OAAM,MAAM;OAAe,MAAM;MAAK,CAAA;MAAC;MAAE,OAAO;KAC/C;;GACD,CAAA,GAEL,MAAM,KAAK,MAAM,UAAU;IAC1B,MAAM,OAAO,UAAU,MAAM,SAAS;IACtC,OACE,qBAAC,MAAD;KAAgB,WAAWC;KAA3B,UAAA,CACG,QAAQ,CAAC,KAAK,OACb,oBAAC,QAAD;MAAM,WAAWC;MAAqB,gBAAc,OAAO,SAAS,KAAA;MACjE,UAAA,KAAK;KACF,CAAA,IAEN,oBAAC,KAAD;MAAG,WAAWC;MAAkB,MAAM,KAAK;MACxC,UAAA,KAAK;KACL,CAAA,GAEJ,CAAC,QAAQ,oBAAC,MAAD;MAAM,MAAM;MAAkB,MAAM;MAAI,WAAW;KAAwB,CAAA,CACnF;IAXK,GAAA,KAWL;GAER,CAAC,CACC;;CACD,CAAA;AAET"}
@@ -0,0 +1,21 @@
1
+ // src/components/navigation/navigation.css.ts
2
+ var bottomBadge = "ml_gp95tn9";
3
+ var bottomItem = "ml_gp95tn8";
4
+ var bottomNav = "ml_gp95tn7";
5
+ var bottomNavSpacer = "ml_gp95tna";
6
+ var crumb = "ml_gp95tnc";
7
+ var crumbBack = "ml_gp95tng";
8
+ var crumbCurrent = "ml_gp95tne";
9
+ var crumbLink = "ml_gp95tnd";
10
+ var crumbSeparator = "ml_gp95tnf";
11
+ var crumbs = "ml_gp95tnb";
12
+ var segment = "ml_gp95tn4";
13
+ var segmentInput = "ml_gp95tn5";
14
+ var segmentLabel = "ml_gp95tn6";
15
+ var segmented = "ml_gp95tn3";
16
+ var tab = "ml_gp95tn1";
17
+ var tabList = "ml_gp95tn0";
18
+ var tabPanel = "ml_gp95tn2";
19
+ export { bottomBadge, bottomItem, bottomNav, bottomNavSpacer, crumb, crumbBack, crumbCurrent, crumbLink, crumbSeparator, crumbs, segment, segmentInput, segmentLabel, segmented, tab, tabList, tabPanel };
20
+
21
+ //# sourceMappingURL=navigation.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.styles.js","names":[],"sources":[],"mappings":""}
@@ -0,0 +1,30 @@
1
+ import { ComponentPropsWithRef, ReactNode } from "react";
2
+ export interface TabsProps extends Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'onChange'> {
3
+ /** The selected tab (controlled). */
4
+ value?: string;
5
+ /** The tab selected first (uncontrolled). One of `value` or `defaultValue` is required. */
6
+ defaultValue?: string;
7
+ onValueChange?: (value: string) => void;
8
+ children: ReactNode;
9
+ }
10
+ /**
11
+ * Tabs switch between panels of related content in place. For moving between pages,
12
+ * use links instead. Follows the WAI-ARIA tabs pattern with automatic activation.
13
+ */
14
+ export declare function Tabs({ value, defaultValue, onValueChange, children, ...rest }: TabsProps): import("react").JSX.Element;
15
+ export interface TabListProps extends ComponentPropsWithRef<'div'> {
16
+ /** Names the set of tabs, e.g. "Invoice views". */
17
+ 'aria-label': string;
18
+ }
19
+ /** The row of tabs. Arrow keys, Home and End move between tabs and select them. */
20
+ export declare function TabList({ className, onKeyDown, ...rest }: TabListProps): import("react").JSX.Element;
21
+ export interface TabProps extends Omit<ComponentPropsWithRef<'button'>, 'value'> {
22
+ value: string;
23
+ }
24
+ export declare function Tab({ value, className, onClick, ...rest }: TabProps): import("react").JSX.Element;
25
+ export interface TabPanelProps extends ComponentPropsWithRef<'div'> {
26
+ value: string;
27
+ }
28
+ /** Content for one tab. Hidden panels stay in the DOM (state is kept) but are not shown. */
29
+ export declare function TabPanel({ value, className, ...rest }: TabPanelProps): import("react").JSX.Element;
30
+ //# sourceMappingURL=tabs.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.d.ts","names":[],"sources":["../../../src/components/navigation/tabs.tsx"],"mappings":";iBAyBiB,kBAAkB,KAAK;;EAEtC;;EAEA;EACA,iBAAiB;EACjB,UAAU;;;;;;wBAOI,OAAO,OAAO,cAAmB,eAAe,aAAa,QAAQ,4BAAS,IAAA;iBAmB7E,qBAAqB;;EAEpC;;;wBAIc,UAAU,WAAW,cAAc,QAAQ,+BAAY,IAAA;iBAyBtD,iBAAiB,KAAK;EACrC;;wBAGc,MAAM,OAAO,WAAW,YAAY,QAAQ,2BAAQ,IAAA;iBAsBnD,sBAAsB;EACrC;;;wBAIc,WAAW,OAAO,cAAc,QAAQ,gCAAa,IAAA"}
@@ -0,0 +1,97 @@
1
+ import { createContext, useContext, useId, useState } from "react";
2
+ import { cx } from "../../utils/cx.js";
3
+ import { tab, tabList, tabPanel } from "./navigation.styles.js";
4
+ import { jsx } from "react/jsx-runtime";
5
+ // src/components/navigation/tabs.tsx
6
+ const TabsContext = createContext(null);
7
+ const useTabs = () => {
8
+ const context = useContext(TabsContext);
9
+ if (!context) throw new Error("Tab parts must be used inside <Tabs>.");
10
+ return context;
11
+ };
12
+ /**
13
+ * Tabs switch between panels of related content in place. For moving between pages,
14
+ * use links instead. Follows the WAI-ARIA tabs pattern with automatic activation.
15
+ */
16
+ function Tabs({ value, defaultValue = "", onValueChange, children, ...rest }) {
17
+ const base = useId();
18
+ const [internal, setInternal] = useState(defaultValue);
19
+ const context = {
20
+ value: value ?? internal,
21
+ select: (next) => {
22
+ if (value === void 0) setInternal(next);
23
+ onValueChange?.(next);
24
+ },
25
+ idFor: (kind, v) => `${base}-${kind}-${v.replace(/[^\w-]/g, "_")}`
26
+ };
27
+ return /* @__PURE__ */ jsx(TabsContext.Provider, {
28
+ value: context,
29
+ children: /* @__PURE__ */ jsx("div", {
30
+ ...rest,
31
+ children
32
+ })
33
+ });
34
+ }
35
+ /** The row of tabs. Arrow keys, Home and End move between tabs and select them. */
36
+ function TabList({ className, onKeyDown, ...rest }) {
37
+ const onKey = (event) => {
38
+ onKeyDown?.(event);
39
+ const tabs = [...event.currentTarget.querySelectorAll("[role=\"tab\"]:not(:disabled)")];
40
+ const index = tabs.indexOf(document.activeElement);
41
+ if (index === -1) return;
42
+ const rtl = getComputedStyle(event.currentTarget).direction === "rtl";
43
+ const step = {
44
+ ArrowRight: rtl ? -1 : 1,
45
+ ArrowLeft: rtl ? 1 : -1
46
+ }[event.key];
47
+ let next;
48
+ if (step) next = tabs[(index + step + tabs.length) % tabs.length];
49
+ else if (event.key === "Home") next = tabs[0];
50
+ else if (event.key === "End") next = tabs.at(-1);
51
+ if (!next) return;
52
+ event.preventDefault();
53
+ next.focus();
54
+ next.click();
55
+ };
56
+ return /* @__PURE__ */ jsx("div", {
57
+ ...rest,
58
+ role: "tablist",
59
+ className: cx(tabList, className),
60
+ onKeyDown: onKey
61
+ });
62
+ }
63
+ function Tab({ value, className, onClick, ...rest }) {
64
+ const tabs = useTabs();
65
+ const selected = tabs.value === value;
66
+ return /* @__PURE__ */ jsx("button", {
67
+ ...rest,
68
+ type: "button",
69
+ role: "tab",
70
+ id: tabs.idFor("tab", value),
71
+ "aria-controls": tabs.idFor("panel", value),
72
+ "aria-selected": selected,
73
+ tabIndex: selected ? 0 : -1,
74
+ className: cx(tab, className),
75
+ onClick: (event) => {
76
+ onClick?.(event);
77
+ tabs.select(value);
78
+ }
79
+ });
80
+ }
81
+ /** Content for one tab. Hidden panels stay in the DOM (state is kept) but are not shown. */
82
+ function TabPanel({ value, className, ...rest }) {
83
+ const tabs = useTabs();
84
+ const selected = tabs.value === value;
85
+ return /* @__PURE__ */ jsx("div", {
86
+ ...rest,
87
+ role: "tabpanel",
88
+ id: tabs.idFor("panel", value),
89
+ "aria-labelledby": tabs.idFor("tab", value),
90
+ tabIndex: 0,
91
+ hidden: !selected,
92
+ className: cx(tabPanel, className)
93
+ });
94
+ }
95
+ export { Tab, TabList, TabPanel, Tabs };
96
+
97
+ //# sourceMappingURL=tabs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tabs.js","names":["styles.tabList","styles.tab","styles.tabPanel"],"sources":["../../../src/components/navigation/tabs.tsx"],"sourcesContent":["import {\n createContext,\n useContext,\n useId,\n useState,\n type ComponentPropsWithRef,\n type KeyboardEvent,\n type ReactNode,\n} from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './navigation.css';\n\ninterface TabsContextValue {\n value: string;\n select: (value: string) => void;\n idFor: (kind: 'tab' | 'panel', value: string) => string;\n}\n\nconst TabsContext = createContext<TabsContextValue | null>(null);\nconst useTabs = () => {\n const context = useContext(TabsContext);\n if (!context) throw new Error('Tab parts must be used inside <Tabs>.');\n return context;\n};\n\nexport interface TabsProps extends Omit<ComponentPropsWithRef<'div'>, 'defaultValue' | 'onChange'> {\n /** The selected tab (controlled). */\n value?: string;\n /** The tab selected first (uncontrolled). One of `value` or `defaultValue` is required. */\n defaultValue?: string;\n onValueChange?: (value: string) => void;\n children: ReactNode;\n}\n\n/**\n * Tabs switch between panels of related content in place. For moving between pages,\n * use links instead. Follows the WAI-ARIA tabs pattern with automatic activation.\n */\nexport function Tabs({ value, defaultValue = '', onValueChange, children, ...rest }: TabsProps) {\n const base = useId();\n const [internal, setInternal] = useState(defaultValue);\n const current = value ?? internal;\n const context: TabsContextValue = {\n value: current,\n select: (next) => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n },\n idFor: (kind, v) => `${base}-${kind}-${v.replace(/[^\\w-]/g, '_')}`,\n };\n return (\n <TabsContext.Provider value={context}>\n <div {...rest}>{children}</div>\n </TabsContext.Provider>\n );\n}\n\nexport interface TabListProps extends ComponentPropsWithRef<'div'> {\n /** Names the set of tabs, e.g. \"Invoice views\". */\n 'aria-label': string;\n}\n\n/** The row of tabs. Arrow keys, Home and End move between tabs and select them. */\nexport function TabList({ className, onKeyDown, ...rest }: TabListProps) {\n const onKey = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event);\n const tabs = [...event.currentTarget.querySelectorAll<HTMLButtonElement>('[role=\"tab\"]:not(:disabled)')];\n const index = tabs.indexOf(document.activeElement as HTMLButtonElement);\n if (index === -1) return;\n const rtl = getComputedStyle(event.currentTarget).direction === 'rtl';\n const step = { ArrowRight: rtl ? -1 : 1, ArrowLeft: rtl ? 1 : -1 }[event.key];\n let next: HTMLButtonElement | undefined;\n if (step) next = tabs[(index + step + tabs.length) % tabs.length];\n else if (event.key === 'Home') next = tabs[0];\n else if (event.key === 'End') next = tabs.at(-1);\n if (!next) return;\n event.preventDefault();\n next.focus();\n next.click();\n };\n return (\n // WAI-ARIA tabs pattern: focus lives on the tabs (roving tabindex), not on the list.\n // The list only handles keys that bubble up from the focused tab.\n // oxlint-disable-next-line jsx-a11y/interactive-supports-focus\n <div {...rest} role=\"tablist\" className={cx(styles.tabList, className)} onKeyDown={onKey} />\n );\n}\n\nexport interface TabProps extends Omit<ComponentPropsWithRef<'button'>, 'value'> {\n value: string;\n}\n\nexport function Tab({ value, className, onClick, ...rest }: TabProps) {\n const tabs = useTabs();\n const selected = tabs.value === value;\n return (\n <button\n {...rest}\n type=\"button\"\n role=\"tab\"\n id={tabs.idFor('tab', value)}\n aria-controls={tabs.idFor('panel', value)}\n aria-selected={selected}\n // Roving tabindex: Tab moves into the list once, arrows move within it.\n tabIndex={selected ? 0 : -1}\n className={cx(styles.tab, className)}\n onClick={(event) => {\n onClick?.(event);\n tabs.select(value);\n }}\n />\n );\n}\n\nexport interface TabPanelProps extends ComponentPropsWithRef<'div'> {\n value: string;\n}\n\n/** Content for one tab. Hidden panels stay in the DOM (state is kept) but are not shown. */\nexport function TabPanel({ value, className, ...rest }: TabPanelProps) {\n const tabs = useTabs();\n const selected = tabs.value === value;\n return (\n <div\n {...rest}\n role=\"tabpanel\"\n id={tabs.idFor('panel', value)}\n aria-labelledby={tabs.idFor('tab', value)}\n tabIndex={0}\n hidden={!selected}\n className={cx(styles.tabPanel, className)}\n />\n );\n}\n"],"mappings":";;;;;AAkBA,MAAM,cAAc,cAAuC,IAAI;AAC/D,MAAM,gBAAgB;CACpB,MAAM,UAAU,WAAW,WAAW;CACtC,IAAI,CAAC,SAAS,MAAM,IAAI,MAAM,uCAAuC;CACrE,OAAO;AACT;;;;;AAeA,SAAgB,KAAK,EAAE,OAAO,eAAe,IAAI,eAAe,UAAU,GAAG,QAAmB;CAC9F,MAAM,OAAO,MAAM;CACnB,MAAM,CAAC,UAAU,eAAe,SAAS,YAAY;CAErD,MAAM,UAA4B;EAChC,OAFc,SAAS;EAGvB,SAAS,SAAS;GAChB,IAAI,UAAU,KAAA,GAAW,YAAY,IAAI;GACzC,gBAAgB,IAAI;EACtB;EACA,QAAQ,MAAM,MAAM,GAAG,KAAK,GAAG,KAAK,GAAG,EAAE,QAAQ,WAAW,GAAG;CACjE;CACA,OACE,oBAAC,YAAY,UAAb;EAAsB,OAAO;EAC3B,UAAA,oBAAC,OAAD;GAAK,GAAI;GAAO;EAAc,CAAA;CACV,CAAA;AAE1B;;AAQA,SAAgB,QAAQ,EAAE,WAAW,WAAW,GAAG,QAAsB;CACvE,MAAM,SAAS,UAAyC;EACtD,YAAY,KAAK;EACjB,MAAM,OAAO,CAAC,GAAG,MAAM,cAAc,iBAAoC,+BAA6B,CAAC;EACvG,MAAM,QAAQ,KAAK,QAAQ,SAAS,aAAkC;EACtE,IAAI,UAAU,IAAI;EAClB,MAAM,MAAM,iBAAiB,MAAM,aAAa,CAAC,CAAC,cAAc;EAChE,MAAM,OAAO;GAAE,YAAY,MAAM,KAAK;GAAG,WAAW,MAAM,IAAI;EAAG,EAAE,MAAM;EACzE,IAAI;EACJ,IAAI,MAAM,OAAO,MAAM,QAAQ,OAAO,KAAK,UAAU,KAAK;OACrD,IAAI,MAAM,QAAQ,QAAQ,OAAO,KAAK;OACtC,IAAI,MAAM,QAAQ,OAAO,OAAO,KAAK,GAAG,EAAE;EAC/C,IAAI,CAAC,MAAM;EACX,MAAM,eAAe;EACrB,KAAK,MAAM;EACX,KAAK,MAAM;CACb;CACA,OAIE,oBAAC,OAAD;EAAK,GAAI;EAAM,MAAK;EAAU,WAAW,GAAGA,SAAgB,SAAS;EAAG,WAAW;CAAQ,CAAA;AAE/F;AAMA,SAAgB,IAAI,EAAE,OAAO,WAAW,SAAS,GAAG,QAAkB;CACpE,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,KAAK,UAAU;CAChC,OACE,oBAAC,UAAD;EACE,GAAI;EACJ,MAAK;EACL,MAAK;EACL,IAAI,KAAK,MAAM,OAAO,KAAK;EAC3B,iBAAe,KAAK,MAAM,SAAS,KAAK;EACxC,iBAAe;EAEf,UAAU,WAAW,IAAI;EACzB,WAAW,GAAGC,KAAY,SAAS;EACnC,UAAU,UAAU;GAClB,UAAU,KAAK;GACf,KAAK,OAAO,KAAK;EACnB;CACD,CAAA;AAEL;;AAOA,SAAgB,SAAS,EAAE,OAAO,WAAW,GAAG,QAAuB;CACrE,MAAM,OAAO,QAAQ;CACrB,MAAM,WAAW,KAAK,UAAU;CAChC,OACE,oBAAC,OAAD;EACE,GAAI;EACJ,MAAK;EACL,IAAI,KAAK,MAAM,SAAS,KAAK;EAC7B,mBAAiB,KAAK,MAAM,OAAO,KAAK;EACxC,UAAU;EACV,QAAQ,CAAC;EACT,WAAW,GAAGC,UAAiB,SAAS;CACzC,CAAA;AAEL"}
@@ -0,0 +1,2 @@
1
+ import { CellProps, Table, TableProps, Td, Th } from "./table.js";
2
+ export { type CellProps, Table, type TableProps, Td, Th };
@@ -0,0 +1,25 @@
1
+ import { ComponentPropsWithRef, ReactNode } from "react";
2
+ export interface TableProps extends ComponentPropsWithRef<'table'> {
3
+ /** Names the table (and its scroll region). Shown above it unless `hideCaption`. */
4
+ caption: ReactNode;
5
+ hideCaption?: boolean;
6
+ density?: 'compact' | 'standard' | 'comfortable';
7
+ /** Keep the header row visible while scrolling; give the table a max height via `maxHeight`. */
8
+ stickyHeader?: boolean;
9
+ maxHeight?: string;
10
+ /** Keep the first column visible while scrolling sideways, e.g. names. */
11
+ stickyFirstColumn?: boolean;
12
+ }
13
+ /**
14
+ * A semantic `<table>` in a scroll container. When it is wider (or taller) than its
15
+ * space, the container becomes a named, focusable region so keyboard users can scroll it.
16
+ * Write the rows with plain `<thead>`, `<tbody>`, `<tr>`, and `Th`/`Td` for numbers.
17
+ */
18
+ export declare function Table({ caption, hideCaption, density, stickyHeader, maxHeight, stickyFirstColumn, className, children, ...rest }: TableProps): import("react").JSX.Element;
19
+ export interface CellProps {
20
+ /** Right-align with tabular figures, for amounts and counts. */
21
+ numeric?: boolean;
22
+ }
23
+ export declare function Th({ numeric, className, scope, ...rest }: ComponentPropsWithRef<'th'> & CellProps): import("react").JSX.Element;
24
+ export declare function Td({ numeric, className, ...rest }: ComponentPropsWithRef<'td'> & CellProps): import("react").JSX.Element;
25
+ //# sourceMappingURL=table.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.d.ts","names":[],"sources":["../../../src/components/table/table.tsx"],"mappings":";iBAIiB,mBAAmB;;EAElC,SAAS;EACT;EACA;;EAEA;EACA;;EAEA;;;;;;;wBAQc,QACd,SACA,aACA,SACA,cACA,WACA,mBACA,WACA,aACG,QACF,6BAAU,IAAA;iBAgCI;;EAEf;;wBAGc,KAAK,SAAS,WAAW,UAAkB,QAAQ,8BAA8B,4BAAS,IAAA;wBAI1F,KAAK,SAAS,cAAc,QAAQ,8BAA8B,4BAAS,IAAA"}
@@ -0,0 +1,58 @@
1
+ import { useEffect, useRef, useState } from "react";
2
+ import { cx } from "../../utils/cx.js";
3
+ import { captionHidden, table, wrap } from "./table.styles.js";
4
+ import { jsx, jsxs } from "react/jsx-runtime";
5
+ // src/components/table/table.tsx
6
+ /**
7
+ * A semantic `<table>` in a scroll container. When it is wider (or taller) than its
8
+ * space, the container becomes a named, focusable region so keyboard users can scroll it.
9
+ * Write the rows with plain `<thead>`, `<tbody>`, `<tr>`, and `Th`/`Td` for numbers.
10
+ */
11
+ function Table({ caption, hideCaption, density = "standard", stickyHeader, maxHeight, stickyFirstColumn, className, children, ...rest }) {
12
+ const wrap$1 = useRef(null);
13
+ const [scrollable, setScrollable] = useState(false);
14
+ useEffect(() => {
15
+ const el = wrap$1.current;
16
+ if (!el) return;
17
+ const check = () => setScrollable(el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight);
18
+ check();
19
+ const observer = new ResizeObserver(check);
20
+ observer.observe(el);
21
+ return () => observer.disconnect();
22
+ }, []);
23
+ return /* @__PURE__ */ jsx("div", {
24
+ ref: wrap$1,
25
+ className: wrap,
26
+ "data-sticky-header": stickyHeader || void 0,
27
+ "data-sticky-first": stickyFirstColumn || void 0,
28
+ style: maxHeight ? { maxHeight } : void 0,
29
+ role: scrollable ? "region" : void 0,
30
+ "aria-label": scrollable && typeof caption === "string" ? caption : void 0,
31
+ tabIndex: scrollable ? 0 : void 0,
32
+ children: /* @__PURE__ */ jsxs("table", {
33
+ ...rest,
34
+ "data-density": density,
35
+ className: cx(table, className),
36
+ children: [/* @__PURE__ */ jsx("caption", {
37
+ className: hideCaption ? captionHidden : void 0,
38
+ children: caption
39
+ }), children]
40
+ })
41
+ });
42
+ }
43
+ function Th({ numeric: numeric$2, className, scope = "col", ...rest }) {
44
+ return /* @__PURE__ */ jsx("th", {
45
+ ...rest,
46
+ scope,
47
+ className: cx(numeric$2 && "ml_1fd8r9h4", className)
48
+ });
49
+ }
50
+ function Td({ numeric: numeric$1, className, ...rest }) {
51
+ return /* @__PURE__ */ jsx("td", {
52
+ ...rest,
53
+ className: cx(numeric$1 && "ml_1fd8r9h4", className)
54
+ });
55
+ }
56
+ export { Table, Td, Th };
57
+
58
+ //# sourceMappingURL=table.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.js","names":["wrap","styles.wrap","styles.table","styles.captionHidden","numeric"],"sources":["../../../src/components/table/table.tsx"],"sourcesContent":["import { useEffect, useRef, useState, type ComponentPropsWithRef, type ReactNode } from 'react';\nimport { cx } from '../../utils/cx';\nimport * as styles from './table.css';\n\nexport interface TableProps extends ComponentPropsWithRef<'table'> {\n /** Names the table (and its scroll region). Shown above it unless `hideCaption`. */\n caption: ReactNode;\n hideCaption?: boolean;\n density?: 'compact' | 'standard' | 'comfortable';\n /** Keep the header row visible while scrolling; give the table a max height via `maxHeight`. */\n stickyHeader?: boolean;\n maxHeight?: string;\n /** Keep the first column visible while scrolling sideways, e.g. names. */\n stickyFirstColumn?: boolean;\n}\n\n/**\n * A semantic `<table>` in a scroll container. When it is wider (or taller) than its\n * space, the container becomes a named, focusable region so keyboard users can scroll it.\n * Write the rows with plain `<thead>`, `<tbody>`, `<tr>`, and `Th`/`Td` for numbers.\n */\nexport function Table({\n caption,\n hideCaption,\n density = 'standard',\n stickyHeader,\n maxHeight,\n stickyFirstColumn,\n className,\n children,\n ...rest\n}: TableProps) {\n const wrap = useRef<HTMLDivElement>(null);\n const [scrollable, setScrollable] = useState(false);\n useEffect(() => {\n const el = wrap.current;\n if (!el) return;\n const check = () => setScrollable(el.scrollWidth > el.clientWidth || el.scrollHeight > el.clientHeight);\n check();\n const observer = new ResizeObserver(check);\n observer.observe(el);\n return () => observer.disconnect();\n }, []);\n return (\n <div\n ref={wrap}\n className={styles.wrap}\n data-sticky-header={stickyHeader || undefined}\n data-sticky-first={stickyFirstColumn || undefined}\n style={maxHeight ? { maxHeight } : undefined}\n // Only a region (and a tab stop) when there is something to scroll.\n role={scrollable ? 'region' : undefined}\n aria-label={scrollable && typeof caption === 'string' ? caption : undefined}\n tabIndex={scrollable ? 0 : undefined}\n >\n <table {...rest} data-density={density} className={cx(styles.table, className)}>\n <caption className={hideCaption ? styles.captionHidden : undefined}>{caption}</caption>\n {children}\n </table>\n </div>\n );\n}\n\nexport interface CellProps {\n /** Right-align with tabular figures, for amounts and counts. */\n numeric?: boolean;\n}\n\nexport function Th({ numeric, className, scope = 'col', ...rest }: ComponentPropsWithRef<'th'> & CellProps) {\n return <th {...rest} scope={scope} className={cx(numeric && styles.numeric, className)} />;\n}\n\nexport function Td({ numeric, className, ...rest }: ComponentPropsWithRef<'td'> & CellProps) {\n return <td {...rest} className={cx(numeric && styles.numeric, className)} />;\n}\n"],"mappings":";;;;;;;;;;AAqBA,SAAgB,MAAM,EACpB,SACA,aACA,UAAU,YACV,cACA,WACA,mBACA,WACA,UACA,GAAG,QACU;CACb,MAAMA,SAAO,OAAuB,IAAI;CACxC,MAAM,CAAC,YAAY,iBAAiB,SAAS,KAAK;CAClD,gBAAgB;EACd,MAAM,KAAKA,OAAK;EAChB,IAAI,CAAC,IAAI;EACT,MAAM,cAAc,cAAc,GAAG,cAAc,GAAG,eAAe,GAAG,eAAe,GAAG,YAAY;EACtG,MAAM;EACN,MAAM,WAAW,IAAI,eAAe,KAAK;EACzC,SAAS,QAAQ,EAAE;EACnB,aAAa,SAAS,WAAW;CACnC,GAAG,CAAC,CAAC;CACL,OACE,oBAAC,OAAD;EACE,KAAKA;EACL,WAAWC;EACX,sBAAoB,gBAAgB,KAAA;EACpC,qBAAmB,qBAAqB,KAAA;EACxC,OAAO,YAAY,EAAE,UAAU,IAAI,KAAA;EAEnC,MAAM,aAAa,WAAW,KAAA;EAC9B,cAAY,cAAc,OAAO,YAAY,WAAW,UAAU,KAAA;EAClE,UAAU,aAAa,IAAI,KAAA;EAE3B,UAAA,qBAAC,SAAD;GAAO,GAAI;GAAM,gBAAc;GAAS,WAAW,GAAGC,OAAc,SAAS;GAA7E,UAAA,CACE,oBAAC,WAAD;IAAS,WAAW,cAAcC,gBAAuB,KAAA;IAAY,UAAA;GAAiB,CAAA,GACrF,QACI;;CACJ,CAAA;AAET;AAOA,SAAgB,GAAG,EAAEC,SAAAA,WAAS,WAAW,QAAQ,OAAO,GAAG,QAAiD;CAC1G,OAAO,oBAAC,MAAD;EAAI,GAAI;EAAa;EAAO,WAAW,GAAGA,aAAW,eAAgB,SAAS;CAAI,CAAA;AAC3F;AAEA,SAAgB,GAAG,EAAEA,SAAAA,WAAS,WAAW,GAAG,QAAiD;CAC3F,OAAO,oBAAC,MAAD;EAAI,GAAI;EAAM,WAAW,GAAGA,aAAW,eAAgB,SAAS;CAAI,CAAA;AAC7E"}
@@ -0,0 +1,8 @@
1
+ // src/components/table/table.css.ts
2
+ var captionHidden = "ml_1fd8r9h5";
3
+ var numeric = "ml_1fd8r9h4";
4
+ var table = "ml_1fd8r9h3";
5
+ var wrap = "ml_1fd8r9h2";
6
+ export { captionHidden, numeric, table, wrap };
7
+
8
+ //# sourceMappingURL=table.styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"table.styles.js","names":[],"sources":[],"mappings":""}
package/dist/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import { Accordion, AccordionItem, AccordionItemProps, AccordionProps } from "./components/accordion/accordion.js";
2
+ import "./components/accordion/index.js";
1
3
  import { Avatar, AvatarGroup, AvatarGroupProps, AvatarProps } from "./components/avatar/avatar.js";
2
4
  import "./components/avatar/index.js";
3
5
  import { Badge, BadgeProps } from "./components/badge/badge.js";
@@ -21,6 +23,9 @@ import { Icon, IconProps } from "./components/icon/icon.js";
21
23
  import "./components/icon/index.js";
22
24
  import { Input, InputProps, Textarea, TextareaProps } from "./components/input/input.js";
23
25
  import "./components/input/index.js";
26
+ import { Tab, TabList, TabListProps, TabPanel, TabPanelProps, TabProps, Tabs, TabsProps } from "./components/navigation/tabs.js";
27
+ import { BottomNav, BottomNavItem, BottomNavProps, BottomNavSpacer, Breadcrumbs, BreadcrumbsProps, Crumb, SegmentedControl, SegmentedControlProps, SegmentedOption } from "./components/navigation/nav.js";
28
+ import "./components/navigation/index.js";
24
29
  import { Placement } from "./components/popover/popover.css.js";
25
30
  import { Popover, PopoverProps, Tooltip, TooltipProps } from "./components/popover/popover.js";
26
31
  import "./components/popover/index.js";
@@ -28,6 +33,8 @@ import { Select, SelectProps } from "./components/select/select.js";
28
33
  import "./components/select/index.js";
29
34
  import { Slider, SliderProps, SliderValue } from "./components/slider/slider.js";
30
35
  import "./components/slider/index.js";
36
+ import { CellProps, Table, TableProps, Td, Th } from "./components/table/table.js";
37
+ import "./components/table/index.js";
31
38
  import { Heading, HeadingProps, MarginProps, Text, TextProps } from "./components/text/text.js";
32
39
  import "./components/text/index.js";
33
40
  import { ToastOptions, ToastProvider, ToastProviderProps, ToastTone, useToast } from "./components/toast/toast.js";
@@ -37,4 +44,4 @@ import { PresenceState, usePresence } from "./hooks/use-presence.js";
37
44
  import { useDisclosure } from "./hooks/use-disclosure.js";
38
45
  import "./hooks/index.js";
39
46
  import { cx } from "./utils/cx.js";
40
- export { Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, Box, type BoxProps, Button, type ButtonProps, Card, CardHeader, CardMedia, type CardMediaProps, type CardProps, Checkbox, type CheckboxProps, Dialog, DialogActions, DialogBody, type DialogProps, Field, type FieldContextValue, type FieldProps, Heading, type HeadingProps, Icon, type IconProps, Input, type InputProps, type MarginProps, type Placement, Popover, type PopoverProps, type PresenceState, Radio, RadioGroup, type RadioGroupProps, type RadioProps, Select, type SelectProps, Slider, type SliderProps, SliderValue, Stack, type StackProps, Switch, type SwitchProps, Text, type TextProps, Textarea, type TextareaProps, ThemeScope, type ThemeScopeProps, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, Tooltip, type TooltipProps, cx, splitSprinkles, useDisclosure, useField, usePresence, useToast };
47
+ export { Accordion, AccordionItem, type AccordionItemProps, type AccordionProps, Avatar, AvatarGroup, type AvatarGroupProps, type AvatarProps, Badge, type BadgeProps, BottomNav, BottomNavItem, type BottomNavProps, BottomNavSpacer, Box, type BoxProps, Breadcrumbs, type BreadcrumbsProps, Button, type ButtonProps, Card, CardHeader, CardMedia, type CardMediaProps, type CardProps, type CellProps, Checkbox, type CheckboxProps, type Crumb, Dialog, DialogActions, DialogBody, type DialogProps, Field, type FieldContextValue, type FieldProps, Heading, type HeadingProps, Icon, type IconProps, Input, type InputProps, type MarginProps, type Placement, Popover, type PopoverProps, type PresenceState, Radio, RadioGroup, type RadioGroupProps, type RadioProps, SegmentedControl, type SegmentedControlProps, type SegmentedOption, Select, type SelectProps, Slider, type SliderProps, SliderValue, Stack, type StackProps, Switch, type SwitchProps, Tab, TabList, type TabListProps, TabPanel, type TabPanelProps, type TabProps, Table, type TableProps, Tabs, type TabsProps, Td, Text, type TextProps, Textarea, type TextareaProps, Th, ThemeScope, type ThemeScopeProps, type ToastOptions, ToastProvider, type ToastProviderProps, type ToastTone, Tooltip, type TooltipProps, cx, splitSprinkles, useDisclosure, useField, usePresence, useToast };
package/dist/index.js CHANGED
@@ -1,4 +1,6 @@
1
1
  import { ThemeScope } from "./components/theme-scope/theme-scope.js";
2
+ import { Icon } from "./components/icon/icon.js";
3
+ import { Accordion, AccordionItem } from "./components/accordion/accordion.js";
2
4
  import { Avatar, AvatarGroup } from "./components/avatar/avatar.js";
3
5
  import { Badge } from "./components/badge/badge.js";
4
6
  import { Box, splitSprinkles } from "./components/box/box.js";
@@ -6,18 +8,20 @@ import { Stack } from "./components/box/stack.js";
6
8
  import { Button } from "./components/button/button.js";
7
9
  import { Card, CardHeader } from "./components/card/card.js";
8
10
  import { CardMedia } from "./components/card/card-media.js";
9
- import { Icon } from "./components/icon/icon.js";
10
11
  import { Checkbox, Radio, RadioGroup, Switch } from "./components/choice/choice.js";
11
12
  import { usePresence } from "./hooks/use-presence.js";
12
13
  import { Dialog, DialogActions, DialogBody } from "./components/dialog/dialog.js";
13
14
  import { useField } from "./components/field/field-context.js";
14
15
  import { Field } from "./components/field/field.js";
15
16
  import { Input, Textarea } from "./components/input/input.js";
17
+ import { Tab, TabList, TabPanel, Tabs } from "./components/navigation/tabs.js";
18
+ import { BottomNav, BottomNavItem, BottomNavSpacer, Breadcrumbs, SegmentedControl } from "./components/navigation/nav.js";
16
19
  import { Popover, Tooltip } from "./components/popover/popover.js";
17
20
  import { Select } from "./components/select/select.js";
18
21
  import { Slider, SliderValue } from "./components/slider/slider.js";
22
+ import { Table, Td, Th } from "./components/table/table.js";
19
23
  import { Heading, Text } from "./components/text/text.js";
20
24
  import { ToastProvider, useToast } from "./components/toast/toast.js";
21
25
  import { cx } from "./utils/cx.js";
22
26
  import { useDisclosure } from "./hooks/use-disclosure.js";
23
- export { Avatar, AvatarGroup, Badge, Box, Button, Card, CardHeader, CardMedia, Checkbox, Dialog, DialogActions, DialogBody, Field, Heading, Icon, Input, Popover, Radio, RadioGroup, Select, Slider, SliderValue, Stack, Switch, Text, Textarea, ThemeScope, ToastProvider, Tooltip, cx, splitSprinkles, useDisclosure, useField, usePresence, useToast };
27
+ export { Accordion, AccordionItem, Avatar, AvatarGroup, Badge, BottomNav, BottomNavItem, BottomNavSpacer, Box, Breadcrumbs, Button, Card, CardHeader, CardMedia, Checkbox, Dialog, DialogActions, DialogBody, Field, Heading, Icon, Input, Popover, Radio, RadioGroup, SegmentedControl, Select, Slider, SliderValue, Stack, Switch, Tab, TabList, TabPanel, Table, Tabs, Td, Text, Textarea, Th, ThemeScope, ToastProvider, Tooltip, cx, splitSprinkles, useDisclosure, useField, usePresence, useToast };
package/dist/styles.css CHANGED
@@ -2,6 +2,67 @@
2
2
  @layer ml-theme;
3
3
  @layer ml-components;
4
4
  @layer ml-utilities;
5
+ @layer ml-components {
6
+ .ml_1mhi8cy0 {
7
+ display: flex;
8
+ flex-direction: column;
9
+ border-top: 1px solid var(--ml_color-hairline_uyc1fj8);
10
+ }
11
+ .ml_1mhi8cy1 {
12
+ border-bottom: 1px solid var(--ml_color-hairline_uyc1fj8);
13
+ }
14
+ .ml_1mhi8cy2 {
15
+ outline: none;
16
+ display: flex;
17
+ align-items: center;
18
+ justify-content: space-between;
19
+ gap: var(--ml_space-4_uyc1fj13);
20
+ min-height: 3rem;
21
+ padding-block: var(--ml_space-3_uyc1fj12);
22
+ list-style: none;
23
+ cursor: pointer;
24
+ font-size: var(--ml_font-size-md_uyc1fj1p);
25
+ font-weight: var(--ml_font-weight-strong_uyc1fj1x);
26
+ color: var(--ml_color-text_uyc1fj4);
27
+ border-radius: var(--ml_radius-sm_uyc1fj1g);
28
+ }
29
+ .ml_1mhi8cy2:focus-visible {
30
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
31
+ }
32
+ .ml_1mhi8cy2::-webkit-details-marker {
33
+ display: none;
34
+ }
35
+ .ml_1mhi8cy2::marker {
36
+ content: "";
37
+ }
38
+ .ml_1mhi8cy2:hover {
39
+ color: var(--ml_color-accentText_uyc1fjf);
40
+ }
41
+ .ml_1mhi8cy3 {
42
+ flex-shrink: 0;
43
+ color: var(--ml_color-textSubtle_uyc1fj6);
44
+ transition: transform var(--ml_motion-duration-settle_uyc1fj27) var(--ml_motion-easing-standard_uyc1fj29);
45
+ }
46
+ .ml_1mhi8cy1[open] .ml_1mhi8cy3 {
47
+ transform: rotate(180deg);
48
+ }
49
+ .ml_1mhi8cy4 {
50
+ padding-bottom: var(--ml_space-4_uyc1fj13);
51
+ padding-right: var(--ml_space-8_uyc1fj16);
52
+ font-size: var(--ml_font-size-md_uyc1fj1p);
53
+ line-height: var(--ml_font-leading-normal_uyc1fj21);
54
+ color: var(--ml_color-textMuted_uyc1fj5);
55
+ }
56
+ @media (prefers-reduced-motion: reduce) {
57
+ .ml_1mhi8cy3 {
58
+ transition: none;
59
+ }
60
+ }
61
+ }
62
+ @layer ml-reset;
63
+ @layer ml-theme;
64
+ @layer ml-components;
65
+ @layer ml-utilities;
5
66
  @layer ml-components {
6
67
  .ml_7aeaaw1 {
7
68
  position: relative;
@@ -695,7 +756,7 @@
695
756
  max-width: 100%;
696
757
  max-height: 92dvh;
697
758
  border-radius: var(--ml_radius-xl_uyc1fj1j) var(--ml_radius-xl_uyc1fj1j) 0 0;
698
- padding-bottom: env(safe-area-inset-bottom);
759
+ padding-bottom: env(safe-area-inset-bottom, 0px);
699
760
  }
700
761
  .ml_placement_sheet_iy25f53[data-state="open"] {
701
762
  animation: ml_sheet-in_ato5m6 var(--ml_motion-duration-slow_uyc1fj28) var(--ml_motion-easing-enter_uyc1fj2a) both;
@@ -715,7 +776,7 @@
715
776
  max-width: 100%;
716
777
  max-height: 92dvh;
717
778
  border-radius: var(--ml_radius-xl_uyc1fj1j) var(--ml_radius-xl_uyc1fj1j) 0 0;
718
- padding-bottom: env(safe-area-inset-bottom);
779
+ padding-bottom: env(safe-area-inset-bottom, 0px);
719
780
  }
720
781
  .ml_placement_auto_iy25f54[data-state="open"] {
721
782
  animation: ml_sheet-in_ato5m6 var(--ml_motion-duration-slow_uyc1fj28) var(--ml_motion-easing-enter_uyc1fj2a) both;
@@ -944,6 +1005,294 @@
944
1005
  @layer ml-theme;
945
1006
  @layer ml-components;
946
1007
  @layer ml-utilities;
1008
+ @layer ml-components {
1009
+ .ml_gp95tn0 {
1010
+ display: flex;
1011
+ gap: var(--ml_space-1_uyc1fj10);
1012
+ border-bottom: 1px solid var(--ml_color-hairline_uyc1fj8);
1013
+ overflow-x: auto;
1014
+ scrollbar-width: none;
1015
+ scroll-snap-type: x proximity;
1016
+ }
1017
+ .ml_gp95tn0::-webkit-scrollbar {
1018
+ display: none;
1019
+ }
1020
+ .ml_gp95tn1 {
1021
+ outline: none;
1022
+ transition-property: color, background-color;
1023
+ transition-duration: var(--ml_motion-duration-quick_uyc1fj26);
1024
+ transition-timing-function: var(--ml_motion-easing-standard_uyc1fj29);
1025
+ position: relative;
1026
+ flex-shrink: 0;
1027
+ scroll-snap-align: start;
1028
+ appearance: none;
1029
+ border: 0;
1030
+ margin: 0;
1031
+ padding-inline: var(--ml_space-3_uyc1fj12);
1032
+ padding-block: 0.625rem;
1033
+ min-height: 2.75rem;
1034
+ background: none;
1035
+ font: inherit;
1036
+ font-size: var(--ml_font-size-sm_uyc1fj1o);
1037
+ font-weight: var(--ml_font-weight-medium_uyc1fj1w);
1038
+ color: var(--ml_color-textMuted_uyc1fj5);
1039
+ cursor: pointer;
1040
+ border-radius: var(--ml_radius-sm_uyc1fj1g) var(--ml_radius-sm_uyc1fj1g) 0 0;
1041
+ }
1042
+ .ml_gp95tn1:focus-visible {
1043
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
1044
+ }
1045
+ .ml_gp95tn1:hover {
1046
+ color: var(--ml_color-text_uyc1fj4);
1047
+ }
1048
+ .ml_gp95tn1[aria-selected="true"] {
1049
+ color: var(--ml_color-text_uyc1fj4);
1050
+ }
1051
+ .ml_gp95tn1::after {
1052
+ content: "";
1053
+ position: absolute;
1054
+ inset-inline: var(--ml_space-3_uyc1fj12);
1055
+ bottom: -1px;
1056
+ height: 2px;
1057
+ border-radius: var(--ml_radius-round_uyc1fj1k);
1058
+ background-color: var(--ml_color-accent_uyc1fjb);
1059
+ transform: scaleX(0);
1060
+ transition: transform var(--ml_motion-duration-settle_uyc1fj27) var(--ml_motion-easing-standard_uyc1fj29);
1061
+ }
1062
+ .ml_gp95tn1[aria-selected="true"]::after {
1063
+ transform: scaleX(1);
1064
+ }
1065
+ .ml_gp95tn1:disabled {
1066
+ cursor: not-allowed;
1067
+ opacity: 0.45;
1068
+ }
1069
+ .ml_gp95tn2 {
1070
+ outline: none;
1071
+ padding-top: var(--ml_space-4_uyc1fj13);
1072
+ border-radius: var(--ml_radius-sm_uyc1fj1g);
1073
+ }
1074
+ .ml_gp95tn2:focus-visible {
1075
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
1076
+ }
1077
+ .ml_gp95tn3 {
1078
+ display: inline-flex;
1079
+ gap: 0.125rem;
1080
+ padding: 0.1875rem;
1081
+ border: 0;
1082
+ margin: 0;
1083
+ min-width: 0;
1084
+ border-radius: var(--ml_radius-md_uyc1fj1h);
1085
+ background-color: var(--ml_color-surfaceSunken_uyc1fj2);
1086
+ }
1087
+ .ml_gp95tn3[data-full-width] {
1088
+ display: flex;
1089
+ }
1090
+ .ml_gp95tn4 {
1091
+ position: relative;
1092
+ flex: 1 1 0;
1093
+ display: flex;
1094
+ }
1095
+ .ml_gp95tn3[data-full-width] .ml_gp95tn4 {
1096
+ min-width: 0;
1097
+ }
1098
+ .ml_gp95tn5 {
1099
+ position: absolute;
1100
+ inset: 0;
1101
+ margin: 0;
1102
+ opacity: 0;
1103
+ cursor: pointer;
1104
+ }
1105
+ .ml_gp95tn5:disabled {
1106
+ cursor: not-allowed;
1107
+ }
1108
+ .ml_gp95tn6 {
1109
+ transition-property: background-color, color, box-shadow;
1110
+ transition-duration: var(--ml_motion-duration-quick_uyc1fj26);
1111
+ transition-timing-function: var(--ml_motion-easing-standard_uyc1fj29);
1112
+ flex: 1;
1113
+ display: inline-flex;
1114
+ align-items: center;
1115
+ justify-content: center;
1116
+ gap: var(--ml_space-1_5_uyc1fj1d);
1117
+ min-height: 2rem;
1118
+ padding-inline: var(--ml_space-3_uyc1fj12);
1119
+ border-radius: calc(var(--ml_radius-md_uyc1fj1h) - 3px);
1120
+ font-size: var(--ml_font-size-sm_uyc1fj1o);
1121
+ font-weight: var(--ml_font-weight-medium_uyc1fj1w);
1122
+ color: var(--ml_color-textMuted_uyc1fj5);
1123
+ white-space: nowrap;
1124
+ pointer-events: none;
1125
+ }
1126
+ .ml_gp95tn5:hover ~ .ml_gp95tn6 {
1127
+ color: var(--ml_color-text_uyc1fj4);
1128
+ }
1129
+ .ml_gp95tn5:checked ~ .ml_gp95tn6 {
1130
+ color: var(--ml_color-text_uyc1fj4);
1131
+ background-color: var(--ml_color-surface_uyc1fj1);
1132
+ box-shadow: var(--ml_shadow-hairline_uyc1fjv), var(--ml_shadow-control_uyc1fjy);
1133
+ }
1134
+ .ml_gp95tn5:focus-visible ~ .ml_gp95tn6 {
1135
+ box-shadow: 0 0 0 2px var(--ml_color-focus_uyc1fjs);
1136
+ }
1137
+ .ml_gp95tn5:disabled ~ .ml_gp95tn6 {
1138
+ opacity: 0.45;
1139
+ }
1140
+ .ml_gp95tn7 {
1141
+ position: fixed;
1142
+ inset-inline: 0;
1143
+ bottom: 0;
1144
+ z-index: 100;
1145
+ display: grid;
1146
+ grid-auto-columns: 1fr;
1147
+ grid-auto-flow: column;
1148
+ padding-bottom: env(safe-area-inset-bottom, 0px);
1149
+ padding-inline: max(var(--ml_space-1_uyc1fj10), env(safe-area-inset-left, 0px)) max(var(--ml_space-1_uyc1fj10), env(safe-area-inset-right, 0px));
1150
+ background-color: color-mix(in oklch, var(--ml_color-surface_uyc1fj1) 88%, transparent);
1151
+ backdrop-filter: saturate(1.4) blur(14px);
1152
+ border-top: 1px solid var(--ml_color-hairline_uyc1fj8);
1153
+ }
1154
+ .ml_gp95tn8 {
1155
+ outline: none;
1156
+ position: relative;
1157
+ display: flex;
1158
+ flex-direction: column;
1159
+ align-items: center;
1160
+ justify-content: center;
1161
+ gap: 0.1875rem;
1162
+ min-height: 3.5rem;
1163
+ padding-block: var(--ml_space-1_5_uyc1fj1d);
1164
+ border: 0;
1165
+ background: none;
1166
+ font-family: inherit;
1167
+ font-size: 0.6875rem;
1168
+ font-weight: var(--ml_font-weight-medium_uyc1fj1w);
1169
+ color: var(--ml_color-textSubtle_uyc1fj6);
1170
+ text-decoration: none;
1171
+ cursor: pointer;
1172
+ border-radius: var(--ml_radius-md_uyc1fj1h);
1173
+ -webkit-tap-highlight-color: transparent;
1174
+ }
1175
+ .ml_gp95tn8:focus-visible {
1176
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
1177
+ }
1178
+ .ml_gp95tn8[aria-current="page"] {
1179
+ color: var(--ml_color-accentText_uyc1fjf);
1180
+ }
1181
+ .ml_gp95tn8:active {
1182
+ background-color: var(--ml_color-surfaceSunken_uyc1fj2);
1183
+ }
1184
+ .ml_gp95tn9 {
1185
+ position: absolute;
1186
+ top: var(--ml_space-1_uyc1fj10);
1187
+ left: calc(50% + 0.5rem);
1188
+ min-width: 1.125rem;
1189
+ height: 1.125rem;
1190
+ padding-inline: 0.3125rem;
1191
+ border-radius: var(--ml_radius-round_uyc1fj1k);
1192
+ background-color: var(--ml_color-danger_uyc1fjh);
1193
+ color: var(--ml_color-onDanger_uyc1fjl);
1194
+ font-size: 0.625rem;
1195
+ font-weight: var(--ml_font-weight-strong_uyc1fj1x);
1196
+ line-height: 1.125rem;
1197
+ text-align: center;
1198
+ font-variant-numeric: tabular-nums;
1199
+ box-shadow: 0 0 0 2px var(--ml_color-surface_uyc1fj1);
1200
+ }
1201
+ .ml_gp95tna {
1202
+ height: calc(3.5rem + var(--ml_space-3_uyc1fj12) + env(safe-area-inset-bottom, 0px));
1203
+ }
1204
+ .ml_gp95tnb {
1205
+ display: flex;
1206
+ align-items: center;
1207
+ flex-wrap: wrap;
1208
+ gap: var(--ml_space-1_uyc1fj10);
1209
+ margin: 0;
1210
+ padding: 0;
1211
+ list-style: none;
1212
+ font-size: var(--ml_font-size-sm_uyc1fj1o);
1213
+ color: var(--ml_color-textMuted_uyc1fj5);
1214
+ }
1215
+ .ml_gp95tnc {
1216
+ display: inline-flex;
1217
+ align-items: center;
1218
+ gap: var(--ml_space-1_uyc1fj10);
1219
+ min-width: 0;
1220
+ }
1221
+ .ml_gp95tnd {
1222
+ outline: none;
1223
+ color: inherit;
1224
+ text-decoration: none;
1225
+ border-radius: var(--ml_radius-xs_uyc1fj1f);
1226
+ }
1227
+ .ml_gp95tnd:focus-visible {
1228
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
1229
+ }
1230
+ .ml_gp95tnd:hover {
1231
+ color: var(--ml_color-text_uyc1fj4);
1232
+ text-decoration: underline;
1233
+ text-underline-offset: 0.2em;
1234
+ }
1235
+ .ml_gp95tne {
1236
+ color: var(--ml_color-text_uyc1fj4);
1237
+ font-weight: var(--ml_font-weight-medium_uyc1fj1w);
1238
+ overflow: hidden;
1239
+ text-overflow: ellipsis;
1240
+ white-space: nowrap;
1241
+ }
1242
+ .ml_gp95tnf {
1243
+ color: var(--ml_color-textSubtle_uyc1fj6);
1244
+ flex-shrink: 0;
1245
+ }
1246
+ .ml_gp95tng {
1247
+ display: none;
1248
+ }
1249
+ @media (prefers-reduced-motion: reduce) {
1250
+ .ml_gp95tn1 {
1251
+ transition-duration: 1ms;
1252
+ }
1253
+ .ml_gp95tn1::after {
1254
+ transition: none;
1255
+ }
1256
+ .ml_gp95tn6 {
1257
+ transition-duration: 1ms;
1258
+ }
1259
+ }
1260
+ @media (pointer: coarse) {
1261
+ .ml_gp95tn6 {
1262
+ min-height: 2.5rem;
1263
+ }
1264
+ }
1265
+ @media screen and (min-width: 768px) {
1266
+ .ml_gp95tn7[data-hide-from="tablet"] {
1267
+ display: none;
1268
+ }
1269
+ .ml_gp95tna[data-hide-from="tablet"] {
1270
+ display: none;
1271
+ }
1272
+ }
1273
+ @media screen and (min-width: 1024px) {
1274
+ .ml_gp95tn7[data-hide-from="desktop"] {
1275
+ display: none;
1276
+ }
1277
+ .ml_gp95tna[data-hide-from="desktop"] {
1278
+ display: none;
1279
+ }
1280
+ }
1281
+ @media not screen and (min-width: 768px) {
1282
+ .ml_gp95tnc {
1283
+ display: none;
1284
+ }
1285
+ .ml_gp95tng {
1286
+ display: inline-flex;
1287
+ align-items: center;
1288
+ gap: var(--ml_space-1_uyc1fj10);
1289
+ }
1290
+ }
1291
+ }
1292
+ @layer ml-reset;
1293
+ @layer ml-theme;
1294
+ @layer ml-components;
1295
+ @layer ml-utilities;
947
1296
  @layer ml-components {
948
1297
  .ml_12557yp0 {
949
1298
  position: fixed;
@@ -1240,6 +1589,102 @@
1240
1589
  @layer ml-theme;
1241
1590
  @layer ml-components;
1242
1591
  @layer ml-utilities;
1592
+ @layer ml-components {
1593
+ .ml_1fd8r9h2 {
1594
+ outline: none;
1595
+ position: relative;
1596
+ overflow-x: auto;
1597
+ max-width: 100%;
1598
+ border-radius: var(--ml_radius-lg_uyc1fj1i);
1599
+ background-color: var(--ml_color-surface_uyc1fj1);
1600
+ box-shadow: var(--ml_shadow-hairline_uyc1fjv);
1601
+ }
1602
+ .ml_1fd8r9h2:focus-visible {
1603
+ box-shadow: 0 0 0 2px var(--ml_color-canvas_uyc1fj0), 0 0 0 4px var(--ml_color-focus_uyc1fjs);
1604
+ }
1605
+ .ml_1fd8r9h2[data-sticky-header] {
1606
+ overflow-y: auto;
1607
+ }
1608
+ .ml_1fd8r9h3 {
1609
+ --ml_1fd8r9h0: var(--ml_space-3_uyc1fj12);
1610
+ --ml_1fd8r9h1: var(--ml_space-4_uyc1fj13);
1611
+ width: 100%;
1612
+ border-collapse: separate;
1613
+ border-spacing: 0;
1614
+ font-size: var(--ml_font-size-sm_uyc1fj1o);
1615
+ color: var(--ml_color-text_uyc1fj4);
1616
+ }
1617
+ .ml_1fd8r9h3[data-density="compact"] {
1618
+ --ml_1fd8r9h0: var(--ml_space-2_uyc1fj11);
1619
+ --ml_1fd8r9h1: var(--ml_space-3_uyc1fj12);
1620
+ }
1621
+ .ml_1fd8r9h3[data-density="comfortable"] {
1622
+ --ml_1fd8r9h0: var(--ml_space-4_uyc1fj13);
1623
+ --ml_1fd8r9h1: var(--ml_space-5_uyc1fj14);
1624
+ }
1625
+ .ml_1fd8r9h3 caption {
1626
+ caption-side: top;
1627
+ text-align: start;
1628
+ padding: var(--ml_space-4_uyc1fj13) var(--ml_space-4_uyc1fj13) var(--ml_space-2_uyc1fj11);
1629
+ font-weight: var(--ml_font-weight-strong_uyc1fj1x);
1630
+ font-size: var(--ml_font-size-md_uyc1fj1p);
1631
+ }
1632
+ .ml_1fd8r9h3 th, .ml_1fd8r9h3 td {
1633
+ padding: var(--ml_1fd8r9h0) var(--ml_1fd8r9h1);
1634
+ text-align: start;
1635
+ vertical-align: middle;
1636
+ border-bottom: 1px solid var(--ml_color-hairline_uyc1fj8);
1637
+ white-space: nowrap;
1638
+ }
1639
+ .ml_1fd8r9h3 thead th {
1640
+ font-size: var(--ml_font-size-xs_uyc1fj1n);
1641
+ font-weight: var(--ml_font-weight-strong_uyc1fj1x);
1642
+ letter-spacing: var(--ml_font-tracking-label_uyc1fj24);
1643
+ text-transform: uppercase;
1644
+ color: var(--ml_color-textSubtle_uyc1fj6);
1645
+ background-color: var(--ml_color-surface_uyc1fj1);
1646
+ }
1647
+ .ml_1fd8r9h3 tbody tr:last-child > * {
1648
+ border-bottom: 0;
1649
+ }
1650
+ .ml_1fd8r9h3 tbody tr:hover > * {
1651
+ background-color: color-mix(in oklch, var(--ml_color-surface_uyc1fj1), var(--ml_color-text_uyc1fj4) 3%);
1652
+ }
1653
+ .ml_1fd8r9h2[data-sticky-header] thead th {
1654
+ position: sticky;
1655
+ top: 0;
1656
+ z-index: 1;
1657
+ }
1658
+ .ml_1fd8r9h2[data-sticky-first] tr > :first-child {
1659
+ position: sticky;
1660
+ inset-inline-start: 0;
1661
+ z-index: 1;
1662
+ background-color: var(--ml_color-surface_uyc1fj1);
1663
+ box-shadow: 1px 0 0 var(--ml_color-hairline_uyc1fj8);
1664
+ }
1665
+ .ml_1fd8r9h4 {
1666
+ text-align: end;
1667
+ font-variant-numeric: tabular-nums;
1668
+ }
1669
+ .ml_1fd8r9h3 th.ml_1fd8r9h4, .ml_1fd8r9h3 td.ml_1fd8r9h4 {
1670
+ text-align: end;
1671
+ }
1672
+ .ml_1fd8r9h5 {
1673
+ position: absolute;
1674
+ width: 1px;
1675
+ height: 1px;
1676
+ padding: 0;
1677
+ margin: -1px;
1678
+ overflow: hidden;
1679
+ clip: rect(0, 0, 0, 0);
1680
+ white-space: nowrap;
1681
+ border: 0;
1682
+ }
1683
+ }
1684
+ @layer ml-reset;
1685
+ @layer ml-theme;
1686
+ @layer ml-components;
1687
+ @layer ml-utilities;
1243
1688
  @layer ml-components {
1244
1689
  .ml_1pplbdu0 {
1245
1690
  margin: 0;
@@ -1323,7 +1768,7 @@
1323
1768
  position: fixed;
1324
1769
  z-index: 2147483000;
1325
1770
  inset-inline: var(--ml_space-4_uyc1fj13);
1326
- bottom: max(var(--ml_space-4_uyc1fj13), env(safe-area-inset-bottom));
1771
+ bottom: max(var(--ml_space-4_uyc1fj13), env(safe-area-inset-bottom, 0px));
1327
1772
  display: flex;
1328
1773
  flex-direction: column;
1329
1774
  align-items: center;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohirlab/react",
3
- "version": "0.4.0",
3
+ "version": "0.6.0",
4
4
  "description": "Mohirlab React components.",
5
5
  "keywords": [
6
6
  "design-system",
@@ -35,15 +35,15 @@
35
35
  "dependencies": {
36
36
  "@mohirlab/assets": "^0.2.0",
37
37
  "@mohirlab/icons": "^0.1.1",
38
- "@mohirlab/motion": "^0.1.2",
39
- "@mohirlab/sprinkles": "^0.1.3",
40
- "@mohirlab/themes": "^0.3.0",
38
+ "@mohirlab/motion": "^0.1.3",
39
+ "@mohirlab/sprinkles": "^0.1.4",
40
+ "@mohirlab/themes": "^0.4.0",
41
41
  "@vanilla-extract/dynamic": "^2.1.5",
42
42
  "@vanilla-extract/recipes": "^0.5.7",
43
43
  "@vanilla-extract/sprinkles": "^1.7.0"
44
44
  },
45
45
  "devDependencies": {
46
- "@mohirlab/recipes": "^0.2.0",
46
+ "@mohirlab/recipes": "^0.2.1",
47
47
  "@testing-library/react": "^16.3.0",
48
48
  "@types/react": "^19.2.0",
49
49
  "@types/react-dom": "^19.2.0",