@mohirlab/react 0.5.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,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";
@@ -31,6 +33,8 @@ import { Select, SelectProps } from "./components/select/select.js";
31
33
  import "./components/select/index.js";
32
34
  import { Slider, SliderProps, SliderValue } from "./components/slider/slider.js";
33
35
  import "./components/slider/index.js";
36
+ import { CellProps, Table, TableProps, Td, Th } from "./components/table/table.js";
37
+ import "./components/table/index.js";
34
38
  import { Heading, HeadingProps, MarginProps, Text, TextProps } from "./components/text/text.js";
35
39
  import "./components/text/index.js";
36
40
  import { ToastOptions, ToastProvider, ToastProviderProps, ToastTone, useToast } from "./components/toast/toast.js";
@@ -40,4 +44,4 @@ import { PresenceState, usePresence } from "./hooks/use-presence.js";
40
44
  import { useDisclosure } from "./hooks/use-disclosure.js";
41
45
  import "./hooks/index.js";
42
46
  import { cx } from "./utils/cx.js";
43
- export { 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, 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, Tabs, type TabsProps, 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,7 +8,6 @@ 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";
@@ -18,8 +19,9 @@ import { BottomNav, BottomNavItem, BottomNavSpacer, Breadcrumbs, SegmentedContro
18
19
  import { Popover, Tooltip } from "./components/popover/popover.js";
19
20
  import { Select } from "./components/select/select.js";
20
21
  import { Slider, SliderValue } from "./components/slider/slider.js";
22
+ import { Table, Td, Th } from "./components/table/table.js";
21
23
  import { Heading, Text } from "./components/text/text.js";
22
24
  import { ToastProvider, useToast } from "./components/toast/toast.js";
23
25
  import { cx } from "./utils/cx.js";
24
26
  import { useDisclosure } from "./hooks/use-disclosure.js";
25
- export { 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, Tabs, 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;
@@ -1528,6 +1589,102 @@
1528
1589
  @layer ml-theme;
1529
1590
  @layer ml-components;
1530
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;
1531
1688
  @layer ml-components {
1532
1689
  .ml_1pplbdu0 {
1533
1690
  margin: 0;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mohirlab/react",
3
- "version": "0.5.0",
3
+ "version": "0.6.0",
4
4
  "description": "Mohirlab React components.",
5
5
  "keywords": [
6
6
  "design-system",