@phreshos/react-ui 0.1.36 → 0.1.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +147 -167
- package/dist/accordion.d.ts +7 -6
- package/dist/accordion.js +5 -5
- package/dist/alert-dialog.js +3 -1
- package/dist/alert.d.ts +17 -0
- package/dist/alert.js +30 -0
- package/dist/app-layout.d.ts +13 -0
- package/dist/app-layout.js +84 -0
- package/dist/button.d.ts +12 -24
- package/dist/button.js +34 -39
- package/dist/calendar-layout.d.ts +9 -5
- package/dist/calendar-layout.js +67 -78
- package/dist/calendar-trigger.d.ts +4 -4
- package/dist/calendar-trigger.js +7 -29
- package/dist/calendar.d.ts +2 -2
- package/dist/calendar.js +6 -5
- package/dist/checkbox.d.ts +4 -4
- package/dist/checkbox.js +16 -6
- package/dist/color-area.d.ts +20 -0
- package/dist/color-area.js +30 -0
- package/dist/color-field.d.ts +17 -0
- package/dist/color-field.js +17 -0
- package/dist/color-picker.d.ts +24 -0
- package/dist/color-picker.js +30 -0
- package/dist/color-slider.d.ts +19 -0
- package/dist/color-slider.js +29 -0
- package/dist/color-swatch-picker.d.ts +23 -0
- package/dist/color-swatch-picker.js +36 -0
- package/dist/color-swatch.d.ts +18 -0
- package/dist/color-swatch.js +20 -0
- package/dist/combo-box.d.ts +18 -10
- package/dist/combo-box.js +43 -58
- package/dist/context-menu.d.ts +14 -10
- package/dist/context-menu.js +7 -6
- package/dist/control/color-thumb.d.ts +13 -0
- package/dist/control/color-thumb.js +33 -0
- package/dist/control/color-value.d.ts +6 -0
- package/dist/control/color-value.js +7 -0
- package/dist/control/control.d.ts +60 -0
- package/dist/control/control.js +71 -0
- package/dist/control/field-button.d.ts +13 -0
- package/dist/control/field-button.js +28 -0
- package/dist/control/field.d.ts +20 -0
- package/dist/control/field.js +34 -0
- package/dist/control/icon.d.ts +11 -0
- package/dist/control/icon.js +8 -0
- package/dist/control/item.d.ts +34 -0
- package/dist/control/item.js +53 -0
- package/dist/control/open-state.d.ts +25 -0
- package/dist/control/open-state.js +8 -0
- package/dist/control/selection-track.d.ts +39 -0
- package/dist/control/selection-track.js +122 -0
- package/dist/control/selection.d.ts +44 -0
- package/dist/{selection.js → control/selection.js} +16 -0
- package/dist/control/surface-render.d.ts +10 -0
- package/dist/control/surface-render.js +12 -0
- package/dist/control/text-control.d.ts +32 -0
- package/dist/control/text-control.js +31 -0
- package/dist/control/toggle.d.ts +32 -0
- package/dist/control/toggle.js +80 -0
- package/dist/date-control.d.ts +9 -9
- package/dist/date-control.js +31 -34
- package/dist/date-field.d.ts +7 -6
- package/dist/date-field.js +8 -6
- package/dist/date-picker.d.ts +13 -6
- package/dist/date-picker.js +9 -6
- package/dist/date-range-picker.d.ts +15 -6
- package/dist/date-range-picker.js +12 -9
- package/dist/dialog.d.ts +22 -8
- package/dist/dialog.js +37 -28
- package/dist/disclosure.d.ts +8 -7
- package/dist/disclosure.js +31 -52
- package/dist/drop-zone.d.ts +18 -0
- package/dist/drop-zone.js +32 -0
- package/dist/dropdown-menu.d.ts +7 -4
- package/dist/dropdown-menu.js +5 -4
- package/dist/fieldset.d.ts +13 -0
- package/dist/fieldset.js +26 -0
- package/dist/file-trigger.d.ts +13 -0
- package/dist/file-trigger.js +6 -0
- package/dist/flex.d.ts +1 -1
- package/dist/flex.js +5 -4
- package/dist/foundation/appearance.d.ts +83 -0
- package/dist/foundation/appearance.js +38 -0
- package/dist/{aria-direction.js → foundation/aria-direction.js} +3 -1
- package/dist/foundation/color.d.ts +61 -0
- package/dist/foundation/color.js +247 -0
- package/dist/{layout.d.ts → foundation/layout.d.ts} +6 -4
- package/dist/{layout.js → foundation/layout.js} +7 -5
- package/dist/foundation/motion-style.d.ts +9 -0
- package/dist/foundation/motion-style.js +50 -0
- package/dist/foundation/preferences.d.ts +15 -0
- package/dist/{ui-provider.d.ts → foundation/provider.d.ts} +3 -5
- package/dist/{ui-provider.js → foundation/provider.js} +14 -26
- package/dist/{radius.d.ts → foundation/radius.d.ts} +6 -3
- package/dist/foundation/radius.js +11 -0
- package/dist/foundation/spacing.d.ts +11 -0
- package/dist/foundation/spacing.js +4 -0
- package/dist/foundation/visual.d.ts +42 -0
- package/dist/{appearance-context.js → foundation/visual.js} +41 -27
- package/dist/grid.d.ts +1 -1
- package/dist/grid.js +5 -4
- package/dist/icons/main.d.ts +5 -3
- package/dist/icons/main.js +5 -3
- package/dist/input.d.ts +2 -2
- package/dist/input.js +9 -7
- package/dist/list-box.d.ts +24 -19
- package/dist/list-box.js +52 -109
- package/dist/main.d.ts +27 -16
- package/dist/main.js +22 -9
- package/dist/menu.d.ts +28 -32
- package/dist/menu.js +47 -93
- package/dist/number-field.d.ts +17 -0
- package/dist/number-field.js +28 -0
- package/dist/panel.d.ts +10 -5
- package/dist/panel.js +33 -12
- package/dist/popover.d.ts +19 -5
- package/dist/popover.js +22 -15
- package/dist/progress-bar.d.ts +8 -10
- package/dist/progress-bar.js +18 -34
- package/dist/radio.d.ts +15 -12
- package/dist/radio.js +27 -37
- package/dist/range-calendar.d.ts +5 -3
- package/dist/range-calendar.js +8 -7
- package/dist/scroll-area.d.ts +2 -2
- package/dist/scroll-area.js +10 -9
- package/dist/segmented-control.d.ts +23 -0
- package/dist/segmented-control.js +38 -0
- package/dist/select.d.ts +40 -13
- package/dist/select.js +63 -18
- package/dist/slider.d.ts +7 -3
- package/dist/slider.js +51 -50
- package/dist/spinner.d.ts +5 -8
- package/dist/spinner.js +12 -27
- package/dist/surface/grain.d.ts +12 -0
- package/dist/surface/grain.js +65 -0
- package/dist/{material-options.d.ts → surface/material-options.d.ts} +1 -2
- package/dist/{material-options.js → surface/material-options.js} +2 -2
- package/dist/surface/paint-class.d.ts +6 -0
- package/dist/surface/paint-class.js +36 -0
- package/dist/{shadow-options.d.ts → surface/shadow-options.d.ts} +13 -1
- package/dist/{shadow-options.js → surface/shadow-options.js} +17 -2
- package/dist/surface/surface.d.ts +73 -0
- package/dist/surface/surface.js +230 -0
- package/dist/switch.d.ts +4 -5
- package/dist/switch.js +17 -8
- package/dist/table.d.ts +29 -32
- package/dist/table.js +68 -106
- package/dist/tabs.d.ts +16 -15
- package/dist/tabs.js +44 -86
- package/dist/textarea.d.ts +2 -2
- package/dist/textarea.js +10 -14
- package/dist/time-field.d.ts +6 -6
- package/dist/time-field.js +8 -6
- package/dist/toolbar.d.ts +6 -4
- package/dist/toolbar.js +16 -15
- package/dist/tooltip.d.ts +13 -4
- package/dist/tooltip.js +17 -15
- package/dist/tree.d.ts +22 -27
- package/dist/tree.js +54 -99
- package/dist/window.d.ts +2 -2
- package/dist/window.js +18 -20
- package/package.json +3 -3
- package/dist/appearance-context.d.ts +0 -54
- package/dist/appearance.d.ts +0 -11
- package/dist/appearance.js +0 -11
- package/dist/color.d.ts +0 -69
- package/dist/color.js +0 -192
- package/dist/control-surface.d.ts +0 -20
- package/dist/control-surface.js +0 -11
- package/dist/control.d.ts +0 -70
- package/dist/control.js +0 -105
- package/dist/field-style.d.ts +0 -3
- package/dist/field-style.js +0 -12
- package/dist/material-paint.d.ts +0 -13
- package/dist/material-paint.js +0 -119
- package/dist/motion-style.d.ts +0 -13
- package/dist/motion-style.js +0 -75
- package/dist/preferences.d.ts +0 -12
- package/dist/radius.js +0 -11
- package/dist/readiness.d.ts +0 -37
- package/dist/readiness.js +0 -134
- package/dist/selection.d.ts +0 -18
- package/dist/spacing.d.ts +0 -8
- package/dist/spacing.js +0 -8
- package/dist/surface-edge.d.ts +0 -11
- package/dist/surface-edge.js +0 -55
- package/dist/surface.d.ts +0 -27
- package/dist/surface.js +0 -92
- package/dist/text-control.d.ts +0 -10
- package/dist/text-control.js +0 -0
- package/dist/toggle-indicator.d.ts +0 -18
- package/dist/toggle-indicator.js +0 -49
- /package/dist/{aria-direction.d.ts → foundation/aria-direction.d.ts} +0 -0
- /package/dist/{direction.d.ts → foundation/direction.d.ts} +0 -0
- /package/dist/{direction.js → foundation/direction.js} +0 -0
- /package/dist/{overlay-placement.d.ts → foundation/overlay-placement.d.ts} +0 -0
- /package/dist/{overlay-placement.js → foundation/overlay-placement.js} +0 -0
- /package/dist/{preferences.js → foundation/preferences.js} +0 -0
- /package/dist/{scale.d.ts → foundation/scale.d.ts} +0 -0
- /package/dist/{scale.js → foundation/scale.js} +0 -0
package/dist/table.d.ts
CHANGED
|
@@ -1,71 +1,68 @@
|
|
|
1
1
|
import type { CSSProperties, ReactElement, RefAttributes } from "react";
|
|
2
2
|
import type { CellProps as AriaCellProps, ColumnProps as AriaColumnProps, RowProps as AriaRowProps, TableBodyProps as AriaTableBodyProps, TableHeaderProps as AriaTableHeaderProps, TableProps as AriaTableProps } from "react-aria-components";
|
|
3
|
-
import type
|
|
4
|
-
import type
|
|
5
|
-
import type {
|
|
6
|
-
import
|
|
3
|
+
import { type MultipleSelectionProps, type MultipleStringSelection, type NoSelectionProps, type SingleSelectionProps } from "./control/selection.js";
|
|
4
|
+
import { type Color } from "./foundation/color.js";
|
|
5
|
+
import type { RadiusProps } from "./foundation/radius.js";
|
|
6
|
+
import type { ScaleLevel } from "./foundation/scale.js";
|
|
7
7
|
export type TableSortDirection = "ascending" | "descending";
|
|
8
8
|
export interface TableSort {
|
|
9
9
|
readonly column: string;
|
|
10
10
|
readonly direction: TableSortDirection;
|
|
11
11
|
}
|
|
12
|
-
type TableRootBaseProps = Omit<AriaTableProps, "className" | "defaultSelectedKeys" | "disabledKeys" | "onRowAction" | "onSelectionChange" | "onSortChange" | "selectedKeys" | "selectionMode" | "sortDescriptor" | "style"> & RadiusProps & Readonly<{
|
|
12
|
+
type TableRootBaseProps = Omit<AriaTableProps, "className" | "defaultSelectedKeys" | "disabledKeys" | "onRowAction" | "onSelectionChange" | "onSortChange" | "selectedKeys" | "selectionMode" | "sortDescriptor" | "style" | "expandedKeys" | "defaultExpandedKeys" | "onExpandedChange" | "treeColumn" | "shouldSelectOnPressUp"> & RadiusProps & Readonly<{
|
|
13
13
|
className?: string;
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
/** Color laid beneath selected Rows. */
|
|
15
|
+
color?: Color;
|
|
16
|
+
/** Runs with the value of the Row that was activated. */
|
|
17
|
+
onAction?: (value: string) => void;
|
|
17
18
|
onSortChange?: (sort: TableSort) => void;
|
|
19
|
+
/** Whether a Row is selected when the press ends instead of when it starts. */
|
|
20
|
+
selectOnPressUp?: boolean;
|
|
18
21
|
size?: ScaleLevel;
|
|
19
22
|
sort?: TableSort;
|
|
20
23
|
style?: CSSProperties;
|
|
21
24
|
}>;
|
|
22
|
-
export type TableNoSelectionProps =
|
|
23
|
-
|
|
24
|
-
value?: never;
|
|
25
|
-
defaultValue?: never;
|
|
26
|
-
onChange?: never;
|
|
27
|
-
}>;
|
|
28
|
-
export type TableSingleSelectionProps = SingleStringSelectionProps & Readonly<{
|
|
29
|
-
selectionMode: "single";
|
|
30
|
-
}>;
|
|
25
|
+
export type TableNoSelectionProps = NoSelectionProps;
|
|
26
|
+
export type TableSingleSelectionProps = SingleSelectionProps;
|
|
31
27
|
export type TableMultipleValue = MultipleStringSelection;
|
|
32
|
-
export type TableMultipleSelectionProps =
|
|
33
|
-
selectionMode: "multiple";
|
|
34
|
-
}>;
|
|
28
|
+
export type TableMultipleSelectionProps = MultipleSelectionProps;
|
|
35
29
|
export type TableRootProps = TableRootBaseProps & (TableNoSelectionProps | TableSingleSelectionProps | TableMultipleSelectionProps);
|
|
36
|
-
export declare const TableRoot: import("react").ForwardRefExoticComponent<TableRootProps & RefAttributes<HTMLDivElement | HTMLTableElement>>;
|
|
37
30
|
export interface TableHeaderProps<T extends object = object> extends Omit<AriaTableHeaderProps<T>, "className" | "style"> {
|
|
38
31
|
readonly className?: string;
|
|
39
|
-
readonly color?: ControlColor;
|
|
40
32
|
readonly style?: CSSProperties;
|
|
41
33
|
}
|
|
42
34
|
export type TableHeaderComponent = <T extends object = object>(properties: TableHeaderProps<T> & RefAttributes<HTMLTableSectionElement | HTMLDivElement>) => ReactElement | null;
|
|
43
|
-
export
|
|
44
|
-
|
|
45
|
-
readonly
|
|
35
|
+
export interface TableColumnProps extends Omit<AriaColumnProps, "allowsSorting" | "allowsArrowNavigation" | "className" | "id" | "isRowHeader" | "style"> {
|
|
36
|
+
/** Whether arrow keys move between cells while focus is inside this one. */
|
|
37
|
+
readonly arrowNavigation?: boolean;
|
|
38
|
+
/** Identity of this Column, reported in sort changes. */
|
|
46
39
|
readonly id: string;
|
|
40
|
+
/** Whether cells in this Column label their Row. */
|
|
41
|
+
readonly rowHeader?: boolean;
|
|
42
|
+
/** Whether pressing this Column requests a sort. */
|
|
43
|
+
readonly sortable?: boolean;
|
|
44
|
+
readonly className?: string;
|
|
47
45
|
readonly style?: CSSProperties;
|
|
48
46
|
}
|
|
49
|
-
export declare const TableColumn: import("react").ForwardRefExoticComponent<TableColumnProps & RefAttributes<HTMLDivElement | HTMLTableCellElement>>;
|
|
50
47
|
export interface TableBodyProps<T extends object = object> extends Omit<AriaTableBodyProps<T>, "className" | "style"> {
|
|
51
48
|
readonly className?: string;
|
|
52
49
|
readonly style?: CSSProperties;
|
|
53
50
|
}
|
|
54
51
|
export type TableBodyComponent = <T extends object = object>(properties: TableBodyProps<T> & RefAttributes<HTMLTableSectionElement | HTMLDivElement>) => ReactElement | null;
|
|
55
|
-
export
|
|
56
|
-
|
|
52
|
+
export interface TableRowProps<T extends object = object> extends Omit<AriaRowProps<T>, "className" | "id" | "isDisabled" | "style" | "hasChildItems"> {
|
|
53
|
+
/** Identity of this Row within its Table. */
|
|
54
|
+
readonly id: string;
|
|
57
55
|
readonly className?: string;
|
|
58
56
|
readonly disabled?: boolean;
|
|
59
|
-
readonly id: string;
|
|
60
57
|
readonly style?: CSSProperties;
|
|
61
58
|
}
|
|
62
59
|
export type TableRowComponent = <T extends object = object>(properties: TableRowProps<T> & RefAttributes<HTMLTableRowElement | HTMLDivElement>) => ReactElement | null;
|
|
63
|
-
export
|
|
64
|
-
|
|
60
|
+
export interface TableCellProps extends Omit<AriaCellProps, "className" | "style" | "allowsArrowNavigation"> {
|
|
61
|
+
/** Whether arrow keys move between cells while focus is inside this one. */
|
|
62
|
+
readonly arrowNavigation?: boolean;
|
|
65
63
|
readonly className?: string;
|
|
66
64
|
readonly style?: CSSProperties;
|
|
67
65
|
}
|
|
68
|
-
export declare const TableCell: import("react").ForwardRefExoticComponent<TableCellProps & RefAttributes<HTMLDivElement | HTMLTableCellElement>>;
|
|
69
66
|
/** Structured rows and columns with optional selection and consumer-owned sorting. */
|
|
70
67
|
export declare const Table: import("react").ForwardRefExoticComponent<TableRootProps & RefAttributes<HTMLDivElement | HTMLTableElement>> & {
|
|
71
68
|
Header: TableHeaderComponent;
|
package/dist/table.js
CHANGED
|
@@ -1,148 +1,110 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
3
3
|
import { Cell as AriaCell, Column as AriaColumn, Row as AriaRow, Table as AriaTable, TableBody as AriaTableBody, TableHeader as AriaTableHeader } from "react-aria-components";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { AriaDirectionBoundary } from "./aria-direction.js";
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
4
|
+
import { controlFontWeight, controlOpacity, transition, useControlMetrics } from "./control/control.js";
|
|
5
|
+
import { separatorColor } from "./control/field.js";
|
|
6
|
+
import { itemPaint } from "./control/item.js";
|
|
7
|
+
import { ariaSelection, stringKey } from "./control/selection.js";
|
|
8
|
+
import { AriaDirectionBoundary } from "./foundation/aria-direction.js";
|
|
9
|
+
import { colorOpacity } from "./foundation/color.js";
|
|
10
|
+
import { resolveDirection, useDirection } from "./foundation/direction.js";
|
|
11
|
+
import { dimmedClass } from "./surface/surface.js";
|
|
12
|
+
import { ChevronUp } from "lucide-react";
|
|
13
|
+
import { iconProps } from "./control/icon.js";
|
|
14
|
+
const TableStyleContext = createContext(null);
|
|
15
|
+
/** Structured rows and columns with optional selection and consumer-owned sorting. */
|
|
16
|
+
const TableRoot = forwardRef(function Table(properties, ref) {
|
|
17
|
+
const { className, color = "primary", defaultValue: _defaultValue, onAction, onChange: _onChange, onSortChange, radius, selectOnPressUp, selectionMode = "none", size, sort, style, value: _value, ...native } = properties;
|
|
18
|
+
const metrics = useControlMetrics(size, radius);
|
|
19
|
+
const context = useMemo(() => ({ color, interactive: selectionMode !== "none" || onAction != null, metrics }), [color, metrics, onAction, selectionMode]);
|
|
14
20
|
const direction = resolveDirection(native.dir, useDirection());
|
|
15
|
-
return _jsx(
|
|
21
|
+
return _jsx(TableStyleContext.Provider, { value: context, children: _jsx(AriaDirectionBoundary, { direction: direction, children: _jsx(AriaTable, { ...native, shouldSelectOnPressUp: selectOnPressUp, ...ariaSelection(properties, "none"), ...(sort === undefined ? {} : { sortDescriptor: sort }), ref: ref, dir: direction, className: className, onRowAction: onAction == null ? undefined : key => onAction(stringKey(key)), onSortChange: onSortChange == null ? undefined : descriptor => onSortChange(tableSort(descriptor)), style: {
|
|
16
22
|
width: "100%",
|
|
17
23
|
minWidth: "max-content",
|
|
18
24
|
borderCollapse: "separate",
|
|
19
25
|
borderSpacing: 0,
|
|
20
26
|
boxSizing: "border-box",
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
// them rather than relying on a surrounding surface for its radius.
|
|
27
|
+
// Row paints belong to the table, so the table clips them to its own radius.
|
|
28
|
+
borderRadius: metrics.radius,
|
|
24
29
|
overflow: "hidden",
|
|
25
30
|
fontFamily: "inherit",
|
|
26
|
-
fontSize:
|
|
31
|
+
fontSize: metrics.fontSize,
|
|
27
32
|
...style
|
|
28
33
|
} }) }) });
|
|
29
34
|
});
|
|
30
|
-
function selectionProperties(properties) {
|
|
31
|
-
const selectedKeys = toAriaSelection(properties.value);
|
|
32
|
-
const defaultSelectedKeys = toAriaSelection(properties.defaultValue);
|
|
33
|
-
const onSelectionChange = properties.onChange == null
|
|
34
|
-
? undefined
|
|
35
|
-
: (selection) => {
|
|
36
|
-
if (properties.selectionMode === "multiple") {
|
|
37
|
-
properties.onChange?.(multipleSelection(selection));
|
|
38
|
-
return;
|
|
39
|
-
}
|
|
40
|
-
if (properties.selectionMode === "single")
|
|
41
|
-
properties.onChange?.(singleSelection(selection));
|
|
42
|
-
};
|
|
43
|
-
return {
|
|
44
|
-
...(selectedKeys !== undefined ? { selectedKeys } : {}),
|
|
45
|
-
...(defaultSelectedKeys !== undefined ? { defaultSelectedKeys } : {}),
|
|
46
|
-
...(onSelectionChange !== undefined ? { onSelectionChange } : {})
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
35
|
function tableSort(descriptor) {
|
|
50
36
|
return { column: stringKey(descriptor.column), direction: descriptor.direction };
|
|
51
37
|
}
|
|
52
|
-
const TableHeaderImplementation = forwardRef(function TableHeader({ className,
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
const theme = useControlTheme({ color: resolvedColor, radius: inherited.radius, size: inherited.size });
|
|
56
|
-
const context = useMemo(() => ({ ...inherited, color: resolvedColor, theme }), [inherited, resolvedColor, theme]);
|
|
57
|
-
return _jsx(TableThemeContext.Provider, { value: context, children: _jsx(AriaTableHeader, { ...properties, ref: ref, className: className, style: { ...style } }) });
|
|
38
|
+
const TableHeaderImplementation = forwardRef(function TableHeader({ className, style, ...properties }, ref) {
|
|
39
|
+
useTableStyle();
|
|
40
|
+
return _jsx(AriaTableHeader, { ...properties, ref: ref, className: className, style: style });
|
|
58
41
|
});
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
const
|
|
62
|
-
return _jsx(AriaColumn, { ...properties, ref: ref, allowsSorting:
|
|
63
|
-
...
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
paddingBlock: theme.gap,
|
|
67
|
-
paddingInline: Math.max(8, theme.spacing),
|
|
42
|
+
const TableColumn = forwardRef(function TableColumn({ sortable = false, rowHeader, arrowNavigation, children, className, style, textValue, ...properties }, ref) {
|
|
43
|
+
const { metrics } = useTableStyle();
|
|
44
|
+
const { colors } = metrics.visual;
|
|
45
|
+
return _jsx(AriaColumn, { ...properties, allowsArrowNavigation: arrowNavigation, ref: ref, isRowHeader: rowHeader, allowsSorting: sortable, className: className, textValue: textValue ?? (typeof children === "string" ? children : undefined), style: state => ({
|
|
46
|
+
...transition(metrics.visual, "color, outline-color"),
|
|
47
|
+
height: metrics.height,
|
|
48
|
+
paddingInline: metrics.inset,
|
|
68
49
|
boxSizing: "border-box",
|
|
69
|
-
outline: state.isFocusVisible ?
|
|
70
|
-
outlineOffset: -
|
|
71
|
-
|
|
72
|
-
|
|
50
|
+
outline: `3px solid ${state.isFocusVisible ? colorOpacity(colors.primary, 0.34) : "transparent"}`,
|
|
51
|
+
outlineOffset: -3,
|
|
52
|
+
cursor: sortable ? "pointer" : "default",
|
|
53
|
+
fontSize: "0.92em",
|
|
73
54
|
fontWeight: controlFontWeight,
|
|
74
55
|
textAlign: "start",
|
|
75
56
|
userSelect: "none",
|
|
57
|
+
opacity: state.isHovered && sortable ? 1 : controlOpacity.secondary,
|
|
76
58
|
...style
|
|
77
|
-
}), children: state => _jsxs("span", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap:
|
|
59
|
+
}), children: state => _jsxs("span", { style: { display: "flex", alignItems: "center", justifyContent: "space-between", gap: metrics.gap, minWidth: 0 }, children: [_jsx("span", { style: { minWidth: 0 }, children: typeof children === "function" ? children(state) : children }), sortable && state.sortDirection != null && _jsx(ChevronUp, { ...iconProps(14), style: { ...transition(metrics.visual, "rotate"), flexShrink: 0, rotate: state.sortDirection === "descending" ? "180deg" : "0deg" } })] }) });
|
|
78
60
|
});
|
|
79
|
-
function SortIndicator({ direction, theme }) {
|
|
80
|
-
return _jsx("svg", { "aria-hidden": "true", width: "12", height: "12", viewBox: "0 0 12 12", fill: "none", stroke: "currentColor", strokeWidth: "1.5", style: {
|
|
81
|
-
...theme.transition,
|
|
82
|
-
flexShrink: 0,
|
|
83
|
-
transitionProperty: "transform",
|
|
84
|
-
transform: `rotate(${direction === "descending" ? 180 : 0}deg)`
|
|
85
|
-
}, children: _jsx("path", { d: "m2 8 4-4 4 4" }) });
|
|
86
|
-
}
|
|
87
61
|
const TableBodyImplementation = forwardRef(function TableBody({ className, style, ...properties }, ref) {
|
|
88
|
-
return _jsx(AriaTableBody, { ...properties, ref: ref, className: className, style:
|
|
62
|
+
return _jsx(AriaTableBody, { ...properties, ref: ref, className: className, style: style });
|
|
89
63
|
});
|
|
90
|
-
|
|
64
|
+
/** Rows use the collection Item treatment as their own paint. */
|
|
91
65
|
const TableRowImplementation = forwardRef(function TableRow({ className, disabled = false, onAction, style, ...properties }, ref) {
|
|
92
|
-
const { interactive,
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
? theme.paints.subtle.hover
|
|
107
|
-
: { background: "transparent", color: "inherit" }),
|
|
66
|
+
const { color, interactive, metrics } = useTableStyle();
|
|
67
|
+
const responds = interactive || onAction != null;
|
|
68
|
+
return _jsx(AriaRow, { ...properties, ref: ref, className: state => dimmedClass(state.isDisabled, className ?? state.defaultClassName) ?? "", isDisabled: disabled, onAction: onAction, style: state => ({
|
|
69
|
+
...transition(metrics.visual, "background-color, color, outline-color"),
|
|
70
|
+
...itemPaint(metrics.visual, color, {
|
|
71
|
+
selected: state.isSelected,
|
|
72
|
+
hovered: responds && state.isHovered,
|
|
73
|
+
pressed: responds && state.isPressed,
|
|
74
|
+
focusVisible: false,
|
|
75
|
+
disabled: state.isDisabled
|
|
76
|
+
}),
|
|
77
|
+
outline: `3px solid ${state.isFocusVisible ? colorOpacity(metrics.visual.colors.primary, 0.34) : "transparent"}`,
|
|
78
|
+
outlineOffset: -3,
|
|
79
|
+
cursor: state.isDisabled ? "not-allowed" : responds ? "pointer" : "default",
|
|
108
80
|
...style
|
|
109
81
|
}) });
|
|
110
82
|
});
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
minWidth: 0,
|
|
117
|
-
height: theme.height,
|
|
118
|
-
paddingBlock: theme.gap,
|
|
119
|
-
paddingInline: Math.max(8, theme.spacing),
|
|
83
|
+
const TableCell = forwardRef(function TableCell({ arrowNavigation, className, style, ...properties }, ref) {
|
|
84
|
+
const { metrics } = useTableStyle();
|
|
85
|
+
return _jsx(AriaCell, { ...properties, allowsArrowNavigation: arrowNavigation, ref: ref, className: className, style: state => ({
|
|
86
|
+
height: metrics.height,
|
|
87
|
+
paddingInline: metrics.inset,
|
|
120
88
|
boxSizing: "border-box",
|
|
121
|
-
// Separators belong to the row that follows them
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
outlineOffset: -1,
|
|
126
|
-
background: "transparent",
|
|
127
|
-
color: "inherit",
|
|
89
|
+
// Separators belong to the row that follows them, so the last row has no bottom edge.
|
|
90
|
+
borderBlockStart: `1px solid ${separatorColor(metrics)}`,
|
|
91
|
+
outline: `3px solid ${state.isFocusVisible ? colorOpacity(metrics.visual.colors.primary, 0.34) : "transparent"}`,
|
|
92
|
+
outlineOffset: -3,
|
|
128
93
|
textAlign: "start",
|
|
129
94
|
...style
|
|
130
95
|
}) });
|
|
131
96
|
});
|
|
132
|
-
function
|
|
133
|
-
const
|
|
134
|
-
if (
|
|
97
|
+
function useTableStyle() {
|
|
98
|
+
const context = useContext(TableStyleContext);
|
|
99
|
+
if (context == null)
|
|
135
100
|
throw new Error("Table parts must be used inside Table");
|
|
136
|
-
return
|
|
137
|
-
}
|
|
138
|
-
function useTableTheme() {
|
|
139
|
-
return useTableContext().theme;
|
|
101
|
+
return context;
|
|
140
102
|
}
|
|
141
103
|
/** Structured rows and columns with optional selection and consumer-owned sorting. */
|
|
142
104
|
export const Table = Object.assign(TableRoot, {
|
|
143
|
-
Header:
|
|
105
|
+
Header: TableHeaderImplementation,
|
|
144
106
|
Column: TableColumn,
|
|
145
|
-
Body:
|
|
146
|
-
Row:
|
|
107
|
+
Body: TableBodyImplementation,
|
|
108
|
+
Row: TableRowImplementation,
|
|
147
109
|
Cell: TableCell
|
|
148
110
|
});
|
package/dist/tabs.d.ts
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { CSSProperties, ReactElement, RefAttributes } from "react";
|
|
2
2
|
import type { TabListProps as AriaTabListProps, TabPanelProps as AriaTabPanelProps, TabPanelsProps as AriaTabPanelsProps, TabProps as AriaTabProps, TabsProps as AriaTabsProps } from "react-aria-components";
|
|
3
|
-
import type
|
|
4
|
-
import type { RadiusProps } from "./radius.js";
|
|
5
|
-
import type { ScaleLevel } from "./scale.js";
|
|
6
|
-
|
|
3
|
+
import { type Color } from "./foundation/color.js";
|
|
4
|
+
import type { RadiusProps } from "./foundation/radius.js";
|
|
5
|
+
import type { ScaleLevel } from "./foundation/scale.js";
|
|
6
|
+
import type { MaterialOverrides } from "./surface/material-options.js";
|
|
7
|
+
export interface TabsRootProps extends Omit<AriaTabsProps, "className" | "defaultSelectedKey" | "disabledKeys" | "isDisabled" | "onSelectionChange" | "selectedKey" | "style">, RadiusProps, MaterialOverrides {
|
|
7
8
|
readonly className?: string;
|
|
8
|
-
|
|
9
|
+
/** Paint of the raised selection. */
|
|
10
|
+
readonly color?: Color;
|
|
9
11
|
readonly defaultValue?: string;
|
|
10
12
|
readonly disabled?: boolean;
|
|
11
13
|
readonly onChange?: (value: string) => void;
|
|
@@ -13,29 +15,28 @@ export interface TabsRootProps extends Omit<AriaTabsProps, "className" | "defaul
|
|
|
13
15
|
readonly style?: CSSProperties;
|
|
14
16
|
readonly value?: string;
|
|
15
17
|
}
|
|
16
|
-
export declare const TabsRoot: import("react").ForwardRefExoticComponent<TabsRootProps & RefAttributes<HTMLDivElement>>;
|
|
17
18
|
export interface TabsListProps<T extends object = object> extends Omit<AriaTabListProps<T>, "className" | "style"> {
|
|
18
19
|
readonly className?: string;
|
|
19
20
|
readonly style?: CSSProperties;
|
|
20
21
|
}
|
|
21
22
|
export type TabsListComponent = <T extends object = object>(properties: TabsListProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null;
|
|
22
|
-
export
|
|
23
|
-
|
|
23
|
+
export interface TabsTabProps extends Omit<AriaTabProps, "className" | "id" | "isDisabled" | "render" | "style"> {
|
|
24
|
+
/** Identity shared with the corresponding Panel. */
|
|
25
|
+
readonly id: string;
|
|
24
26
|
readonly className?: string;
|
|
25
27
|
readonly disabled?: boolean;
|
|
26
|
-
readonly id: string;
|
|
27
28
|
readonly style?: CSSProperties;
|
|
28
29
|
}
|
|
29
|
-
export declare const TabsTab: import("react").ForwardRefExoticComponent<TabsTabProps & RefAttributes<HTMLDivElement>>;
|
|
30
30
|
export type TabsPanelsProps<T extends object = object> = AriaTabPanelsProps<T>;
|
|
31
|
-
export
|
|
32
|
-
|
|
33
|
-
readonly className?: string;
|
|
31
|
+
export interface TabsPanelProps extends Omit<AriaTabPanelProps, "className" | "id" | "style" | "shouldForceMount"> {
|
|
32
|
+
/** Identity shared with the corresponding Tab. */
|
|
34
33
|
readonly id: string;
|
|
34
|
+
readonly className?: string;
|
|
35
|
+
/** Whether the Panel stays mounted while another Tab is selected. */
|
|
36
|
+
readonly forceMount?: boolean;
|
|
35
37
|
readonly style?: CSSProperties;
|
|
36
38
|
}
|
|
37
|
-
|
|
38
|
-
/** Peer views with one selected tab and one corresponding panel. */
|
|
39
|
+
/** Peer views with one selected Tab and one corresponding Panel. */
|
|
39
40
|
export declare const Tabs: import("react").ForwardRefExoticComponent<TabsRootProps & RefAttributes<HTMLDivElement>> & {
|
|
40
41
|
List: TabsListComponent;
|
|
41
42
|
Tab: import("react").ForwardRefExoticComponent<TabsTabProps & RefAttributes<HTMLDivElement>>;
|
package/dist/tabs.js
CHANGED
|
@@ -1,103 +1,61 @@
|
|
|
1
|
-
import { jsx as _jsx
|
|
2
|
-
import { createContext, forwardRef, useContext,
|
|
3
|
-
import { Tab as AriaTab, TabList as AriaTabList, TabPanel as AriaTabPanel, TabPanels as AriaTabPanels, Tabs as AriaTabs } from "react-aria-components";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
const
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, forwardRef, useContext, useMemo } from "react";
|
|
3
|
+
import { Tab as AriaTab, TabList as AriaTabList, TabPanel as AriaTabPanel, TabPanels as AriaTabPanels, Tabs as AriaTabs, TabListStateContext } from "react-aria-components";
|
|
4
|
+
import { useControlMetrics } from "./control/control.js";
|
|
5
|
+
import { SelectionItemLabel, selectionItemStyle, selectionListStyle, SelectionTrack } from "./control/selection-track.js";
|
|
6
|
+
import { stringKey } from "./control/selection.js";
|
|
7
|
+
import { AriaDirectionBoundary } from "./foundation/aria-direction.js";
|
|
8
|
+
import { colorOpacity } from "./foundation/color.js";
|
|
9
|
+
import { resolveDirection, useDirection } from "./foundation/direction.js";
|
|
10
|
+
import { dimmedClass } from "./surface/surface.js";
|
|
11
|
+
const TabsStyleContext = createContext(null);
|
|
12
|
+
/** Peer views with one selected Tab and its corresponding Panel. */
|
|
13
|
+
const TabsRoot = forwardRef(function Tabs({ className, color = "default", defaultValue, disabled = false, onChange, orientation = "horizontal", material, radius, size, style, value, ...properties }, ref) {
|
|
14
|
+
const metrics = useControlMetrics(size, radius);
|
|
15
|
+
const context = useMemo(() => ({ color, material, metrics, orientation }), [color, material, metrics, orientation]);
|
|
15
16
|
const direction = resolveDirection(properties.dir, useDirection());
|
|
16
|
-
return _jsx(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
17
|
+
return _jsx(TabsStyleContext.Provider, { value: context, children: _jsx(AriaDirectionBoundary, { direction: direction, children: _jsx(AriaTabs, { ...properties, ...(value !== undefined ? { selectedKey: value } : {}), ...(defaultValue !== undefined ? { defaultSelectedKey: defaultValue } : {}), ref: ref, dir: direction, className: className, isDisabled: disabled, orientation: orientation, onSelectionChange: key => onChange?.(stringKey(key)), style: {
|
|
18
|
+
display: "flex",
|
|
19
|
+
flexDirection: orientation === "horizontal" ? "column" : "row",
|
|
20
|
+
alignItems: "stretch",
|
|
21
|
+
gap: metrics.gap,
|
|
22
|
+
minWidth: 0,
|
|
23
|
+
fontFamily: "inherit",
|
|
24
|
+
fontSize: metrics.fontSize,
|
|
25
|
+
...style
|
|
26
|
+
} }) }) });
|
|
26
27
|
});
|
|
28
|
+
/** The Tabs sit in a SelectionTrack; the selection slides to the selected Tab. */
|
|
27
29
|
const TabsListImplementation = forwardRef(function TabsList({ className, style, ...properties }, ref) {
|
|
28
|
-
const {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
gridAutoFlow: orientation === "horizontal" ? "column" : "row",
|
|
32
|
-
gridAutoColumns: orientation === "horizontal" ? "minmax(0, 1fr)" : undefined,
|
|
33
|
-
alignContent: "start",
|
|
34
|
-
alignItems: "stretch",
|
|
35
|
-
gap: Math.max(2, theme.gap / 2),
|
|
36
|
-
minWidth: 0,
|
|
37
|
-
width: orientation === "horizontal" ? "100%" : undefined,
|
|
38
|
-
boxSizing: "border-box",
|
|
39
|
-
padding: Math.max(2, theme.gap / 2),
|
|
40
|
-
borderRadius: theme.radius,
|
|
41
|
-
background: theme.paints.palette.rest.background,
|
|
42
|
-
...style
|
|
43
|
-
} });
|
|
30
|
+
const { color, material, metrics, orientation } = useTabsStyle();
|
|
31
|
+
const selectedKey = useContext(TabListStateContext)?.selectedKey;
|
|
32
|
+
return _jsx(SelectionTrack, { metrics: metrics, color: color, material: material, orientation: orientation, selectedKey: selectedKey, className: className, style: style, children: _jsx(AriaTabList, { ...properties, ref: ref, "data-selection-list": "", style: selectionListStyle(orientation) }) });
|
|
44
33
|
});
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
return _jsx(AriaTab, { ...properties, ref: ref, className: className, isDisabled: disabled, style: state => ({
|
|
49
|
-
...theme.transition,
|
|
50
|
-
position: "relative",
|
|
51
|
-
zIndex: 0,
|
|
52
|
-
display: "flex",
|
|
53
|
-
alignItems: "center",
|
|
54
|
-
justifyContent: "center",
|
|
55
|
-
width: "100%",
|
|
56
|
-
minWidth: 0,
|
|
57
|
-
minHeight: theme.height,
|
|
58
|
-
paddingBlock: 0,
|
|
59
|
-
paddingInline: Math.max(8, theme.spacing),
|
|
60
|
-
boxSizing: "border-box",
|
|
61
|
-
borderRadius: theme.radius,
|
|
62
|
-
outline: state.isFocusVisible ? `1px solid ${theme.focusColor}` : "none",
|
|
63
|
-
outlineOffset: 1,
|
|
64
|
-
cursor: disabled ? "not-allowed" : "pointer",
|
|
65
|
-
opacity: disabled ? controlOpacity.disabled : 1,
|
|
66
|
-
userSelect: "none",
|
|
67
|
-
background: "transparent",
|
|
68
|
-
color: theme.paints.palette.rest.color,
|
|
69
|
-
...(orientation === "vertical" ? { justifyContent: "start" } : {}),
|
|
70
|
-
...style
|
|
71
|
-
}), children: state => _jsxs(_Fragment, { children: [state.isSelected && _jsx(Surface, { as: motion.span, "data-tabs-indicator": "", "aria-hidden": "true", initial: false, layoutId: "selection", color: theme.paints.palette.hover.background, transition: theme.motionTransition, style: {
|
|
72
|
-
position: "absolute",
|
|
73
|
-
zIndex: -1,
|
|
74
|
-
inset: 0,
|
|
75
|
-
boxSizing: "border-box",
|
|
76
|
-
borderRadius: theme.radius,
|
|
77
|
-
pointerEvents: "none"
|
|
78
|
-
} }), _jsx("span", { style: { minWidth: 0, overflow: "hidden", textOverflow: "ellipsis", whiteSpace: "nowrap" }, children: typeof children === "function" ? children(state) : children })] }) });
|
|
34
|
+
const TabsTab = forwardRef(function TabsTab({ children, className, disabled = false, style, ...properties }, ref) {
|
|
35
|
+
const { color, metrics, orientation } = useTabsStyle();
|
|
36
|
+
return _jsx(AriaTab, { ...properties, ref: ref, className: state => dimmedClass(state.isDisabled, className ?? state.defaultClassName) ?? "", isDisabled: disabled, style: state => ({ ...selectionItemStyle(metrics, color, orientation, state), ...style }), children: state => _jsx(SelectionItemLabel, { metrics: metrics, emphasized: state.isSelected || state.isHovered, children: typeof children === "function" ? children(state) : children }) });
|
|
79
37
|
});
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
return _jsx(AriaTabPanel, { ...properties, ref: ref, className: className, style: state => ({
|
|
38
|
+
const TabsPanel = forwardRef(function TabsPanel({ className, forceMount, style, ...properties }, ref) {
|
|
39
|
+
const { metrics, orientation } = useTabsStyle();
|
|
40
|
+
return _jsx(AriaTabPanel, { ...properties, shouldForceMount: forceMount, ref: ref, className: className, style: state => ({
|
|
84
41
|
flex: orientation === "vertical" ? "1 1 auto" : undefined,
|
|
85
42
|
minWidth: 0,
|
|
86
|
-
|
|
43
|
+
borderRadius: metrics.radius,
|
|
44
|
+
outline: `3px solid ${state.isFocusVisible ? colorOpacity(metrics.visual.colors.primary, 0.34) : "transparent"}`,
|
|
87
45
|
outlineOffset: 1,
|
|
88
46
|
...style
|
|
89
47
|
}) });
|
|
90
48
|
});
|
|
91
|
-
function
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
49
|
+
function useTabsStyle() {
|
|
50
|
+
const context = useContext(TabsStyleContext);
|
|
51
|
+
if (context == null)
|
|
94
52
|
throw new Error("Tabs parts must be used inside Tabs");
|
|
95
|
-
return
|
|
53
|
+
return context;
|
|
96
54
|
}
|
|
97
|
-
/** Peer views with one selected
|
|
55
|
+
/** Peer views with one selected Tab and one corresponding Panel. */
|
|
98
56
|
export const Tabs = Object.assign(TabsRoot, {
|
|
99
|
-
List:
|
|
57
|
+
List: TabsListImplementation,
|
|
100
58
|
Tab: TabsTab,
|
|
101
|
-
Panels:
|
|
59
|
+
Panels: AriaTabPanels,
|
|
102
60
|
Panel: TabsPanel
|
|
103
61
|
});
|
package/dist/textarea.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import type
|
|
1
|
+
import { type TextControlProps } from "./control/text-control.js";
|
|
2
2
|
export interface TextareaProps extends Omit<TextControlProps, "type" | "pattern"> {
|
|
3
3
|
readonly rows?: number;
|
|
4
4
|
}
|
|
5
|
-
/** A labeled multiline text
|
|
5
|
+
/** A labeled multiline text field, vertically resizable without escaping its width. */
|
|
6
6
|
export declare const Textarea: import("react").ForwardRefExoticComponent<TextareaProps & import("react").RefAttributes<HTMLTextAreaElement>>;
|
package/dist/textarea.js
CHANGED
|
@@ -1,17 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { forwardRef } from "react";
|
|
3
|
-
import { TextArea as
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
minHeight: theme.height,
|
|
14
|
-
paddingBlock: Math.max(6, theme.spacing / 2),
|
|
15
|
-
resize: "vertical"
|
|
16
|
-
}) }), _jsx(FieldFeedback, { theme: theme, description: description, errorMessage: errorMessage })] });
|
|
3
|
+
import { TextArea as AriaTextArea, TextField } from "react-aria-components";
|
|
4
|
+
import { useControlMetrics } from "./control/control.js";
|
|
5
|
+
import { FieldFeedback, FieldLabel, fieldStyle } from "./control/field.js";
|
|
6
|
+
import { nativeTextStyle, TextWell } from "./control/text-control.js";
|
|
7
|
+
import MotionStyle, { textControlClass } from "./foundation/motion-style.js";
|
|
8
|
+
import { dimmedClass } from "./surface/surface.js";
|
|
9
|
+
/** A labeled multiline text field, vertically resizable without escaping its width. */
|
|
10
|
+
export const Textarea = forwardRef(function Textarea({ label, description, errorMessage, disabled, readOnly, required, invalid, size, color = "background", radius, style, className, placeholder, rows = 4, material, ...properties }, ref) {
|
|
11
|
+
const metrics = useControlMetrics(size, radius);
|
|
12
|
+
return _jsxs(TextField, { ...properties, className: dimmedClass(disabled ?? false, className), isDisabled: disabled, isReadOnly: readOnly, isRequired: required, isInvalid: invalid, style: fieldStyle(metrics, style), children: [_jsx(MotionStyle, {}), _jsx(FieldLabel, { label: label }), _jsx(AriaTextArea, { ref: ref, placeholder: placeholder, rows: rows, className: textControlClass, render: (native, state) => _jsx(TextWell, { color: color, material: material, metrics: metrics, state: state, children: _jsx("textarea", { ...native }) }), style: nativeTextStyle(metrics, true) }), _jsx(FieldFeedback, { metrics: metrics, description: description, errorMessage: errorMessage })] });
|
|
17
13
|
});
|
package/dist/time-field.d.ts
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import type { Time } from "@internationalized/date";
|
|
2
2
|
import type { TimeFieldProps as AriaTimeFieldProps } from "react-aria-components";
|
|
3
|
-
import type
|
|
4
|
-
import type { MaterialOverrides } from "./material-options.js";
|
|
5
|
-
import type { RadiusProps } from "./radius.js";
|
|
6
|
-
import type { ShadowOverrides } from "./shadow-options.js";
|
|
3
|
+
import { type ControlOverrides, type ControlProps, type FieldProps } from "./control/control.js";
|
|
4
|
+
import type { MaterialOverrides } from "./surface/material-options.js";
|
|
5
|
+
import type { RadiusProps } from "./foundation/radius.js";
|
|
7
6
|
type TimeFieldOverrides = ControlOverrides | "isReadOnly" | "value" | "defaultValue" | "onChange" | "minValue" | "maxValue" | "placeholderValue" | "granularity" | "hourCycle" | "hideTimeZone" | "shouldForceLeadingZeros";
|
|
8
|
-
export interface TimeFieldProps extends Omit<AriaTimeFieldProps<Time>, TimeFieldOverrides>, ControlProps, FieldProps, RadiusProps, MaterialOverrides
|
|
7
|
+
export interface TimeFieldProps extends Omit<AriaTimeFieldProps<Time>, TimeFieldOverrides>, ControlProps, FieldProps, RadiusProps, MaterialOverrides {
|
|
9
8
|
readonly value?: Time | null;
|
|
10
9
|
readonly defaultValue?: Time | null;
|
|
11
10
|
readonly onChange?: (value: Time | null) => void;
|
|
@@ -14,7 +13,8 @@ export interface TimeFieldProps extends Omit<AriaTimeFieldProps<Time>, TimeField
|
|
|
14
13
|
readonly placeholderValue?: Time;
|
|
15
14
|
readonly granularity?: "hour" | "minute" | "second";
|
|
16
15
|
readonly hourCycle?: 12 | 24;
|
|
17
|
-
|
|
16
|
+
/** Whether hours, days, and months always show two digits. */
|
|
17
|
+
readonly leadingZeros?: boolean;
|
|
18
18
|
readonly readOnly?: boolean;
|
|
19
19
|
}
|
|
20
20
|
/** A locale-aware time-only field whose visible clock units are independent editable segments. */
|