@xds/react 0.0.0-stage → 0.2.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.
- package/LICENSE +21 -0
- package/README.md +19 -2
- package/dist/Accordion.d.ts +20 -0
- package/dist/Accordion.js +197 -0
- package/dist/Avatar.d.ts +9 -0
- package/dist/Avatar.js +69 -0
- package/dist/AvatarStack.d.ts +8 -0
- package/dist/AvatarStack.js +105 -0
- package/dist/Badge.d.ts +13 -0
- package/dist/Badge.js +66 -0
- package/dist/Banner.d.ts +23 -0
- package/dist/Banner.js +166 -0
- package/dist/Button.d.ts +14 -0
- package/dist/Button.js +159 -0
- package/dist/Card.d.ts +18 -0
- package/dist/Card.js +173 -0
- package/dist/Checkbox.d.ts +10 -0
- package/dist/Checkbox.js +140 -0
- package/dist/Chip.d.ts +12 -0
- package/dist/Chip.js +74 -0
- package/dist/ChipBar.d.ts +12 -0
- package/dist/ChipBar.js +38 -0
- package/dist/CountBadge.d.ts +12 -0
- package/dist/CountBadge.js +64 -0
- package/dist/DatePicker.d.ts +20 -0
- package/dist/DatePicker.js +429 -0
- package/dist/DateRangePicker.d.ts +24 -0
- package/dist/DateRangePicker.js +370 -0
- package/dist/Defaults.d.ts +17 -0
- package/dist/Defaults.js +48 -0
- package/dist/Dialog.d.ts +20 -0
- package/dist/Dialog.js +137 -0
- package/dist/Divider.d.ts +4 -0
- package/dist/Divider.js +31 -0
- package/dist/EmptyState.d.ts +12 -0
- package/dist/EmptyState.js +86 -0
- package/dist/Icon.d.ts +9 -0
- package/dist/Icon.js +79 -0
- package/dist/IconButton.d.ts +12 -0
- package/dist/IconButton.js +119 -0
- package/dist/ListRow.d.ts +21 -0
- package/dist/ListRow.js +185 -0
- package/dist/MediaCard.d.ts +20 -0
- package/dist/MediaCard.js +279 -0
- package/dist/Menu.d.ts +18 -0
- package/dist/Menu.js +244 -0
- package/dist/ProgressBar.d.ts +8 -0
- package/dist/ProgressBar.js +65 -0
- package/dist/RadioGroup.d.ts +15 -0
- package/dist/RadioGroup.js +176 -0
- package/dist/SearchField.d.ts +15 -0
- package/dist/SearchField.js +152 -0
- package/dist/SectionHeader.d.ts +14 -0
- package/dist/SectionHeader.js +124 -0
- package/dist/SegmentedControl.d.ts +12 -0
- package/dist/SegmentedControl.js +106 -0
- package/dist/Select.d.ts +18 -0
- package/dist/Select.js +318 -0
- package/dist/Sidebar.d.ts +21 -0
- package/dist/Sidebar.js +220 -0
- package/dist/Skeleton.d.ts +11 -0
- package/dist/Skeleton.js +64 -0
- package/dist/Slider.d.ts +13 -0
- package/dist/Slider.js +151 -0
- package/dist/Spinner.d.ts +9 -0
- package/dist/Spinner.js +97 -0
- package/dist/Switch.d.ts +13 -0
- package/dist/Switch.js +116 -0
- package/dist/Tabs.d.ts +14 -0
- package/dist/Tabs.js +137 -0
- package/dist/Text.d.ts +10 -0
- package/dist/Text.js +46 -0
- package/dist/TextField.d.ts +22 -0
- package/dist/TextField.js +213 -0
- package/dist/Thumbnail.d.ts +9 -0
- package/dist/Thumbnail.js +152 -0
- package/dist/Toast.d.ts +14 -0
- package/dist/Toast.js +121 -0
- package/dist/Tooltip.d.ts +26 -0
- package/dist/Tooltip.js +166 -0
- package/dist/base.d.ts +11 -0
- package/dist/base.js +10 -0
- package/dist/index.d.ts +39 -0
- package/dist/index.js +39 -0
- package/dist/modal-popover.d.ts +7 -0
- package/dist/modal-popover.js +37 -0
- package/dist/picture.d.ts +13 -0
- package/dist/picture.js +76 -0
- package/dist/portal.d.ts +9 -0
- package/dist/portal.js +27 -0
- package/dist/presence.d.ts +6 -0
- package/dist/presence.js +34 -0
- package/dist/preview.d.ts +17 -0
- package/dist/preview.js +126 -0
- package/dist/root.d.ts +12 -0
- package/dist/root.js +1 -0
- package/dist/trigger.d.ts +24 -0
- package/dist/trigger.js +47 -0
- package/eject/files/Accordion.tsx +157 -0
- package/eject/files/Avatar.tsx +41 -0
- package/eject/files/AvatarStack.tsx +47 -0
- package/eject/files/Badge.tsx +33 -0
- package/eject/files/Banner.tsx +70 -0
- package/eject/files/Button.tsx +88 -0
- package/eject/files/Card.tsx +85 -0
- package/eject/files/Checkbox.tsx +59 -0
- package/eject/files/Chip.tsx +43 -0
- package/eject/files/ChipBar.tsx +31 -0
- package/eject/files/CountBadge.tsx +50 -0
- package/eject/files/DatePicker.tsx +192 -0
- package/eject/files/DateRangePicker.tsx +271 -0
- package/eject/files/Dialog.tsx +108 -0
- package/eject/files/Divider.tsx +13 -0
- package/eject/files/EmptyState.tsx +39 -0
- package/eject/files/Icon.tsx +38 -0
- package/eject/files/IconButton.tsx +62 -0
- package/eject/files/ListRow.tsx +86 -0
- package/eject/files/MediaCard.tsx +111 -0
- package/eject/files/Menu.tsx +168 -0
- package/eject/files/ProgressBar.tsx +34 -0
- package/eject/files/RadioGroup.tsx +112 -0
- package/eject/files/SearchField.tsx +88 -0
- package/eject/files/SectionHeader.tsx +56 -0
- package/eject/files/SegmentedControl.tsx +57 -0
- package/eject/files/Select.tsx +228 -0
- package/eject/files/Sidebar.tsx +149 -0
- package/eject/files/Skeleton.tsx +28 -0
- package/eject/files/Slider.tsx +109 -0
- package/eject/files/Spinner.tsx +36 -0
- package/eject/files/Switch.tsx +53 -0
- package/eject/files/Tabs.tsx +71 -0
- package/eject/files/Text.tsx +31 -0
- package/eject/files/TextField.tsx +122 -0
- package/eject/files/Thumbnail.tsx +66 -0
- package/eject/files/Toast.tsx +88 -0
- package/eject/files/Tooltip.tsx +120 -0
- package/eject/files/accordion.css +89 -0
- package/eject/files/accordion.ts +67 -0
- package/eject/files/avatar-stack.ts +57 -0
- package/eject/files/avatar.ts +42 -0
- package/eject/files/badge.ts +30 -0
- package/eject/files/banner.ts +68 -0
- package/eject/files/base.css +38 -0
- package/eject/files/button.css +241 -0
- package/eject/files/button.ts +106 -0
- package/eject/files/card.ts +58 -0
- package/eject/files/checkbox.ts +32 -0
- package/eject/files/chip-bar.ts +16 -0
- package/eject/files/chip.ts +35 -0
- package/eject/files/count-badge.ts +32 -0
- package/eject/files/date-picker.css +352 -0
- package/eject/files/date-picker.ts +250 -0
- package/eject/files/date-range-picker.ts +323 -0
- package/eject/files/dialog.css +139 -0
- package/eject/files/dialog.ts +15 -0
- package/eject/files/divider.ts +5 -0
- package/eject/files/empty-state.ts +22 -0
- package/eject/files/icon.ts +36 -0
- package/eject/files/list-row.ts +66 -0
- package/eject/files/media-card.ts +66 -0
- package/eject/files/menu.css +176 -0
- package/eject/files/menu.ts +84 -0
- package/eject/files/parts.ts +17 -0
- package/eject/files/progress-bar.ts +23 -0
- package/eject/files/radio-group.css +160 -0
- package/eject/files/radio-group.ts +24 -0
- package/eject/files/section-header.ts +32 -0
- package/eject/files/segmented-control.ts +30 -0
- package/eject/files/select.css +285 -0
- package/eject/files/select.ts +36 -0
- package/eject/files/sidebar.ts +75 -0
- package/eject/files/skeleton.ts +51 -0
- package/eject/files/slider.css +136 -0
- package/eject/files/slider.ts +65 -0
- package/eject/files/spinner.ts +22 -0
- package/eject/files/switch.ts +34 -0
- package/eject/files/tabs.css +112 -0
- package/eject/files/tabs.ts +35 -0
- package/eject/files/text-field.css +229 -0
- package/eject/files/text-field.ts +48 -0
- package/eject/files/text.ts +38 -0
- package/eject/files/thumbnail.ts +51 -0
- package/eject/files/toast.ts +31 -0
- package/eject/files/tooltip.css +104 -0
- package/eject/files/tooltip.ts +21 -0
- package/eject/manifest.json +814 -0
- package/package.json +66 -4
- package/page.css +20 -0
- package/styles.css +3252 -0
- package/tailwind.css +2665 -0
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { classes, EMPTY_STATE_PARTS, rootPart } from "@xds/core";
|
|
3
|
+
import { Icon } from "./Icon.js";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
5
|
+
export function EmptyState(t0) {
|
|
6
|
+
const $ = _c(17);
|
|
7
|
+
const {
|
|
8
|
+
icon,
|
|
9
|
+
title,
|
|
10
|
+
description,
|
|
11
|
+
action,
|
|
12
|
+
className,
|
|
13
|
+
style
|
|
14
|
+
} = t0;
|
|
15
|
+
let t1;
|
|
16
|
+
if ($[0] !== className) {
|
|
17
|
+
t1 = classes(rootPart("EmptyState"), EMPTY_STATE_PARTS.root, className);
|
|
18
|
+
$[0] = className;
|
|
19
|
+
$[1] = t1;
|
|
20
|
+
} else {
|
|
21
|
+
t1 = $[1];
|
|
22
|
+
}
|
|
23
|
+
let t2;
|
|
24
|
+
if ($[2] !== icon) {
|
|
25
|
+
t2 = /*#__PURE__*/_jsx(Icon, {
|
|
26
|
+
name: icon,
|
|
27
|
+
size: "xl",
|
|
28
|
+
className: EMPTY_STATE_PARTS.icon
|
|
29
|
+
});
|
|
30
|
+
$[2] = icon;
|
|
31
|
+
$[3] = t2;
|
|
32
|
+
} else {
|
|
33
|
+
t2 = $[3];
|
|
34
|
+
}
|
|
35
|
+
let t3;
|
|
36
|
+
if ($[4] !== title) {
|
|
37
|
+
t3 = /*#__PURE__*/_jsx("p", {
|
|
38
|
+
className: EMPTY_STATE_PARTS.title,
|
|
39
|
+
children: title
|
|
40
|
+
});
|
|
41
|
+
$[4] = title;
|
|
42
|
+
$[5] = t3;
|
|
43
|
+
} else {
|
|
44
|
+
t3 = $[5];
|
|
45
|
+
}
|
|
46
|
+
let t4;
|
|
47
|
+
if ($[6] !== description) {
|
|
48
|
+
t4 = description && /*#__PURE__*/_jsx("p", {
|
|
49
|
+
className: EMPTY_STATE_PARTS.description,
|
|
50
|
+
children: description
|
|
51
|
+
});
|
|
52
|
+
$[6] = description;
|
|
53
|
+
$[7] = t4;
|
|
54
|
+
} else {
|
|
55
|
+
t4 = $[7];
|
|
56
|
+
}
|
|
57
|
+
let t5;
|
|
58
|
+
if ($[8] !== action) {
|
|
59
|
+
t5 = action != null && /*#__PURE__*/_jsx("div", {
|
|
60
|
+
className: EMPTY_STATE_PARTS.action,
|
|
61
|
+
children: action
|
|
62
|
+
});
|
|
63
|
+
$[8] = action;
|
|
64
|
+
$[9] = t5;
|
|
65
|
+
} else {
|
|
66
|
+
t5 = $[9];
|
|
67
|
+
}
|
|
68
|
+
let t6;
|
|
69
|
+
if ($[10] !== style || $[11] !== t1 || $[12] !== t2 || $[13] !== t3 || $[14] !== t4 || $[15] !== t5) {
|
|
70
|
+
t6 = /*#__PURE__*/_jsxs("div", {
|
|
71
|
+
className: t1,
|
|
72
|
+
style: style,
|
|
73
|
+
children: [t2, t3, t4, t5]
|
|
74
|
+
});
|
|
75
|
+
$[10] = style;
|
|
76
|
+
$[11] = t1;
|
|
77
|
+
$[12] = t2;
|
|
78
|
+
$[13] = t3;
|
|
79
|
+
$[14] = t4;
|
|
80
|
+
$[15] = t5;
|
|
81
|
+
$[16] = t6;
|
|
82
|
+
} else {
|
|
83
|
+
t6 = $[16];
|
|
84
|
+
}
|
|
85
|
+
return t6;
|
|
86
|
+
}
|
package/dist/Icon.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type IconBaseProps } from "@xds/core";
|
|
2
|
+
import type { RootProps } from "./root.ts";
|
|
3
|
+
export type { IconName, IconSize } from "@xds/core";
|
|
4
|
+
export type IconProps = IconBaseProps & RootProps;
|
|
5
|
+
/**
|
|
6
|
+
* An icon from design/icons. It takes the color of the text around it. An arrow or a chevron
|
|
7
|
+
* mirrors itself in a right-to-left layout when given `rtl:-scale-x-100` in `className`.
|
|
8
|
+
*/
|
|
9
|
+
export declare function Icon(props: IconProps): import("react").JSX.Element;
|
package/dist/Icon.js
ADDED
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { icons } from "@xds/tokens";
|
|
3
|
+
import { classes, iconClass, rootPart } from "@xds/core";
|
|
4
|
+
import { useDefaults } from "./Defaults.js";
|
|
5
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
6
|
+
export function Icon(props) {
|
|
7
|
+
const $ = _c(13);
|
|
8
|
+
const defaults = useDefaults("Icon");
|
|
9
|
+
const {
|
|
10
|
+
name,
|
|
11
|
+
filled: t0,
|
|
12
|
+
label,
|
|
13
|
+
className,
|
|
14
|
+
style
|
|
15
|
+
} = props;
|
|
16
|
+
const filled = t0 === undefined ? false : t0;
|
|
17
|
+
const size = props.size ?? defaults.size;
|
|
18
|
+
const t1 = filled ? "currentColor" : "none";
|
|
19
|
+
let t2;
|
|
20
|
+
if ($[0] !== className || $[1] !== size) {
|
|
21
|
+
t2 = classes(rootPart("Icon"), iconClass(size), className);
|
|
22
|
+
$[0] = className;
|
|
23
|
+
$[1] = size;
|
|
24
|
+
$[2] = t2;
|
|
25
|
+
} else {
|
|
26
|
+
t2 = $[2];
|
|
27
|
+
}
|
|
28
|
+
let t3;
|
|
29
|
+
if ($[3] !== label) {
|
|
30
|
+
t3 = label ? {
|
|
31
|
+
role: "img",
|
|
32
|
+
"aria-label": label
|
|
33
|
+
} : {
|
|
34
|
+
"aria-hidden": true
|
|
35
|
+
};
|
|
36
|
+
$[3] = label;
|
|
37
|
+
$[4] = t3;
|
|
38
|
+
} else {
|
|
39
|
+
t3 = $[4];
|
|
40
|
+
}
|
|
41
|
+
const t4 = icons[name];
|
|
42
|
+
let t5;
|
|
43
|
+
if ($[5] !== t4) {
|
|
44
|
+
t5 = t4.map(_temp);
|
|
45
|
+
$[5] = t4;
|
|
46
|
+
$[6] = t5;
|
|
47
|
+
} else {
|
|
48
|
+
t5 = $[6];
|
|
49
|
+
}
|
|
50
|
+
let t6;
|
|
51
|
+
if ($[7] !== style || $[8] !== t1 || $[9] !== t2 || $[10] !== t3 || $[11] !== t5) {
|
|
52
|
+
t6 = /*#__PURE__*/_jsx("svg", {
|
|
53
|
+
viewBox: "0 0 24 24",
|
|
54
|
+
fill: t1,
|
|
55
|
+
stroke: "currentColor",
|
|
56
|
+
strokeWidth: "2",
|
|
57
|
+
strokeLinecap: "round",
|
|
58
|
+
strokeLinejoin: "round",
|
|
59
|
+
className: t2,
|
|
60
|
+
style: style,
|
|
61
|
+
...t3,
|
|
62
|
+
children: t5
|
|
63
|
+
});
|
|
64
|
+
$[7] = style;
|
|
65
|
+
$[8] = t1;
|
|
66
|
+
$[9] = t2;
|
|
67
|
+
$[10] = t3;
|
|
68
|
+
$[11] = t5;
|
|
69
|
+
$[12] = t6;
|
|
70
|
+
} else {
|
|
71
|
+
t6 = $[12];
|
|
72
|
+
}
|
|
73
|
+
return t6;
|
|
74
|
+
}
|
|
75
|
+
function _temp(path) {
|
|
76
|
+
return /*#__PURE__*/_jsx("path", {
|
|
77
|
+
d: path
|
|
78
|
+
}, path);
|
|
79
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type IconButtonBaseProps } from "@xds/core";
|
|
2
|
+
import type { RootProps } from "./root.ts";
|
|
3
|
+
export type IconButtonProps = IconButtonBaseProps & RootProps & {
|
|
4
|
+
onPress?: () => void;
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* A button that holds only an icon, in Button's variants, sizes and states. It is a square as
|
|
8
|
+
* tall as a Button of its size, and its pressable area is never smaller than the minimum
|
|
9
|
+
* target, even when the square is. Like Button, it opens a Menu or a Tooltip it is the trigger
|
|
10
|
+
* of.
|
|
11
|
+
*/
|
|
12
|
+
export declare function IconButton(props: IconButtonProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { buttonClass, classes, ICON_BUTTON_BOX, isHeld } from "@xds/core";
|
|
3
|
+
import { useDefaults } from "./Defaults.js";
|
|
4
|
+
import { Icon } from "./Icon.js";
|
|
5
|
+
import { Spinner } from "./Spinner.js";
|
|
6
|
+
import { useTrigger } from "./trigger.js";
|
|
7
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
8
|
+
export function IconButton(props) {
|
|
9
|
+
const $ = _c(26);
|
|
10
|
+
const defaults = useDefaults("IconButton");
|
|
11
|
+
const {
|
|
12
|
+
icon,
|
|
13
|
+
label,
|
|
14
|
+
selected,
|
|
15
|
+
disabled: t0,
|
|
16
|
+
loading: t1,
|
|
17
|
+
onPress,
|
|
18
|
+
className,
|
|
19
|
+
style
|
|
20
|
+
} = props;
|
|
21
|
+
const disabled = t0 === undefined ? false : t0;
|
|
22
|
+
const loading = t1 === undefined ? false : t1;
|
|
23
|
+
const variant = props.variant ?? defaults.variant ?? "ghost";
|
|
24
|
+
const size = props.size ?? defaults.size ?? "md";
|
|
25
|
+
let t2;
|
|
26
|
+
if ($[0] !== className || $[1] !== size || $[2] !== variant) {
|
|
27
|
+
t2 = classes(buttonClass({
|
|
28
|
+
variant,
|
|
29
|
+
size,
|
|
30
|
+
iconButton: true
|
|
31
|
+
}), className);
|
|
32
|
+
$[0] = className;
|
|
33
|
+
$[1] = size;
|
|
34
|
+
$[2] = variant;
|
|
35
|
+
$[3] = t2;
|
|
36
|
+
} else {
|
|
37
|
+
t2 = $[3];
|
|
38
|
+
}
|
|
39
|
+
const t3 = loading || undefined;
|
|
40
|
+
const t4 = loading ? "" : undefined;
|
|
41
|
+
let t5;
|
|
42
|
+
if ($[4] !== loading || $[5] !== onPress) {
|
|
43
|
+
t5 = () => {
|
|
44
|
+
if (!loading) {
|
|
45
|
+
onPress?.();
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
$[4] = loading;
|
|
49
|
+
$[5] = onPress;
|
|
50
|
+
$[6] = t5;
|
|
51
|
+
} else {
|
|
52
|
+
t5 = $[6];
|
|
53
|
+
}
|
|
54
|
+
let t6;
|
|
55
|
+
if ($[7] !== disabled || $[8] !== label || $[9] !== selected || $[10] !== style || $[11] !== t2 || $[12] !== t3 || $[13] !== t4 || $[14] !== t5) {
|
|
56
|
+
t6 = {
|
|
57
|
+
className: t2,
|
|
58
|
+
style,
|
|
59
|
+
disabled,
|
|
60
|
+
"aria-disabled": t3,
|
|
61
|
+
"data-pending": t4,
|
|
62
|
+
"aria-pressed": selected,
|
|
63
|
+
"aria-label": label,
|
|
64
|
+
onClick: t5
|
|
65
|
+
};
|
|
66
|
+
$[7] = disabled;
|
|
67
|
+
$[8] = label;
|
|
68
|
+
$[9] = selected;
|
|
69
|
+
$[10] = style;
|
|
70
|
+
$[11] = t2;
|
|
71
|
+
$[12] = t3;
|
|
72
|
+
$[13] = t4;
|
|
73
|
+
$[14] = t5;
|
|
74
|
+
$[15] = t6;
|
|
75
|
+
} else {
|
|
76
|
+
t6 = $[15];
|
|
77
|
+
}
|
|
78
|
+
const attributes = useTrigger(t6, loading);
|
|
79
|
+
let t7;
|
|
80
|
+
if ($[16] !== disabled || $[17] !== icon || $[18] !== loading || $[19] !== selected || $[20] !== size || $[21] !== variant) {
|
|
81
|
+
t7 = loading ? /*#__PURE__*/_jsx("span", {
|
|
82
|
+
className: ICON_BUTTON_BOX[size],
|
|
83
|
+
children: /*#__PURE__*/_jsx(Spinner, {
|
|
84
|
+
size: "sm"
|
|
85
|
+
})
|
|
86
|
+
}) : /*#__PURE__*/_jsx(Icon, {
|
|
87
|
+
name: icon,
|
|
88
|
+
size: size,
|
|
89
|
+
filled: isHeld({
|
|
90
|
+
variant,
|
|
91
|
+
selected,
|
|
92
|
+
disabled
|
|
93
|
+
})
|
|
94
|
+
});
|
|
95
|
+
$[16] = disabled;
|
|
96
|
+
$[17] = icon;
|
|
97
|
+
$[18] = loading;
|
|
98
|
+
$[19] = selected;
|
|
99
|
+
$[20] = size;
|
|
100
|
+
$[21] = variant;
|
|
101
|
+
$[22] = t7;
|
|
102
|
+
} else {
|
|
103
|
+
t7 = $[22];
|
|
104
|
+
}
|
|
105
|
+
let t8;
|
|
106
|
+
if ($[23] !== attributes || $[24] !== t7) {
|
|
107
|
+
t8 = /*#__PURE__*/_jsx("button", {
|
|
108
|
+
...attributes,
|
|
109
|
+
type: "button",
|
|
110
|
+
children: t7
|
|
111
|
+
});
|
|
112
|
+
$[23] = attributes;
|
|
113
|
+
$[24] = t7;
|
|
114
|
+
$[25] = t8;
|
|
115
|
+
} else {
|
|
116
|
+
t8 = $[25];
|
|
117
|
+
}
|
|
118
|
+
return t8;
|
|
119
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { type ListRowBaseProps } from "@xds/core";
|
|
2
|
+
import type { ReactNode } from "react";
|
|
3
|
+
import type { RootProps } from "./root.ts";
|
|
4
|
+
export type ListRowProps = ListRowBaseProps & RootProps & {
|
|
5
|
+
/** In front of the title: an avatar or an icon. */
|
|
6
|
+
leading?: ReactNode;
|
|
7
|
+
/** At the far end: a value, a badge or a switch. */
|
|
8
|
+
trailing?: ReactNode;
|
|
9
|
+
/** Makes the whole row a button. Do not put another control in `trailing` then. */
|
|
10
|
+
onPress?: () => void;
|
|
11
|
+
};
|
|
12
|
+
/** One line of a list or a settings screen. Separate rows with a Divider. */
|
|
13
|
+
export declare function ListRow(props: ListRowProps): import("react").JSX.Element;
|
|
14
|
+
/**
|
|
15
|
+
* A ListRow that says what kind of current item its selected state is. A Sidebar's rows are the
|
|
16
|
+
* places of an app, so its selected row is the current page. Only for this package's own
|
|
17
|
+
* components: the index does not export it.
|
|
18
|
+
*/
|
|
19
|
+
export declare function PlaceRow({ title, description, leading, trailing, chevron, selected, compact, onPress, disabled, current, className, style, }: ListRowProps & {
|
|
20
|
+
current: "true" | "page";
|
|
21
|
+
}): import("react").JSX.Element;
|
package/dist/ListRow.js
ADDED
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import { c as _c } from "react/compiler-runtime";
|
|
2
|
+
import { LIST_ROW_PARTS, classes, listRowClass, listRowDescriptionClass, listRowTitleClass, rootPart } from "@xds/core";
|
|
3
|
+
import { Icon } from "./Icon.js";
|
|
4
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
|
+
export function ListRow(props) {
|
|
6
|
+
const $ = _c(2);
|
|
7
|
+
let t0;
|
|
8
|
+
if ($[0] !== props) {
|
|
9
|
+
t0 = /*#__PURE__*/_jsx(PlaceRow, {
|
|
10
|
+
...props,
|
|
11
|
+
current: "true"
|
|
12
|
+
});
|
|
13
|
+
$[0] = props;
|
|
14
|
+
$[1] = t0;
|
|
15
|
+
} else {
|
|
16
|
+
t0 = $[1];
|
|
17
|
+
}
|
|
18
|
+
return t0;
|
|
19
|
+
}
|
|
20
|
+
export function PlaceRow(t0) {
|
|
21
|
+
const $ = _c(40);
|
|
22
|
+
const {
|
|
23
|
+
title,
|
|
24
|
+
description,
|
|
25
|
+
leading,
|
|
26
|
+
trailing,
|
|
27
|
+
chevron: t1,
|
|
28
|
+
selected: t2,
|
|
29
|
+
compact: t3,
|
|
30
|
+
onPress,
|
|
31
|
+
disabled: t4,
|
|
32
|
+
current,
|
|
33
|
+
className,
|
|
34
|
+
style
|
|
35
|
+
} = t0;
|
|
36
|
+
const chevron = t1 === undefined ? false : t1;
|
|
37
|
+
const selected = t2 === undefined ? false : t2;
|
|
38
|
+
const compact = t3 === undefined ? false : t3;
|
|
39
|
+
const disabled = t4 === undefined ? false : t4;
|
|
40
|
+
let t5;
|
|
41
|
+
if ($[0] !== className || $[1] !== compact || $[2] !== onPress || $[3] !== selected) {
|
|
42
|
+
t5 = classes(rootPart("ListRow"), listRowClass({
|
|
43
|
+
compact,
|
|
44
|
+
selected,
|
|
45
|
+
pressable: onPress !== undefined
|
|
46
|
+
}), className);
|
|
47
|
+
$[0] = className;
|
|
48
|
+
$[1] = compact;
|
|
49
|
+
$[2] = onPress;
|
|
50
|
+
$[3] = selected;
|
|
51
|
+
$[4] = t5;
|
|
52
|
+
} else {
|
|
53
|
+
t5 = $[4];
|
|
54
|
+
}
|
|
55
|
+
const row = t5;
|
|
56
|
+
let t6;
|
|
57
|
+
if ($[5] !== current || $[6] !== selected) {
|
|
58
|
+
t6 = selected ? {
|
|
59
|
+
"aria-current": current
|
|
60
|
+
} : {};
|
|
61
|
+
$[5] = current;
|
|
62
|
+
$[6] = selected;
|
|
63
|
+
$[7] = t6;
|
|
64
|
+
} else {
|
|
65
|
+
t6 = $[7];
|
|
66
|
+
}
|
|
67
|
+
const currentProps = t6;
|
|
68
|
+
let t7;
|
|
69
|
+
if ($[8] !== compact || $[9] !== disabled || $[10] !== selected) {
|
|
70
|
+
t7 = listRowTitleClass({
|
|
71
|
+
compact,
|
|
72
|
+
selected,
|
|
73
|
+
disabled
|
|
74
|
+
});
|
|
75
|
+
$[8] = compact;
|
|
76
|
+
$[9] = disabled;
|
|
77
|
+
$[10] = selected;
|
|
78
|
+
$[11] = t7;
|
|
79
|
+
} else {
|
|
80
|
+
t7 = $[11];
|
|
81
|
+
}
|
|
82
|
+
let t8;
|
|
83
|
+
if ($[12] !== t7 || $[13] !== title) {
|
|
84
|
+
t8 = /*#__PURE__*/_jsx("span", {
|
|
85
|
+
className: t7,
|
|
86
|
+
children: title
|
|
87
|
+
});
|
|
88
|
+
$[12] = t7;
|
|
89
|
+
$[13] = title;
|
|
90
|
+
$[14] = t8;
|
|
91
|
+
} else {
|
|
92
|
+
t8 = $[14];
|
|
93
|
+
}
|
|
94
|
+
let t9;
|
|
95
|
+
if ($[15] !== compact || $[16] !== description) {
|
|
96
|
+
t9 = description && /*#__PURE__*/_jsx("span", {
|
|
97
|
+
className: listRowDescriptionClass(compact),
|
|
98
|
+
children: description
|
|
99
|
+
});
|
|
100
|
+
$[15] = compact;
|
|
101
|
+
$[16] = description;
|
|
102
|
+
$[17] = t9;
|
|
103
|
+
} else {
|
|
104
|
+
t9 = $[17];
|
|
105
|
+
}
|
|
106
|
+
let t10;
|
|
107
|
+
if ($[18] !== t8 || $[19] !== t9) {
|
|
108
|
+
t10 = /*#__PURE__*/_jsxs("span", {
|
|
109
|
+
className: LIST_ROW_PARTS.text,
|
|
110
|
+
children: [t8, t9]
|
|
111
|
+
});
|
|
112
|
+
$[18] = t8;
|
|
113
|
+
$[19] = t9;
|
|
114
|
+
$[20] = t10;
|
|
115
|
+
} else {
|
|
116
|
+
t10 = $[20];
|
|
117
|
+
}
|
|
118
|
+
let t11;
|
|
119
|
+
if ($[21] !== chevron) {
|
|
120
|
+
t11 = chevron && /*#__PURE__*/_jsx(Icon, {
|
|
121
|
+
name: "chevron-right",
|
|
122
|
+
size: "sm",
|
|
123
|
+
className: LIST_ROW_PARTS.chevron
|
|
124
|
+
});
|
|
125
|
+
$[21] = chevron;
|
|
126
|
+
$[22] = t11;
|
|
127
|
+
} else {
|
|
128
|
+
t11 = $[22];
|
|
129
|
+
}
|
|
130
|
+
let t12;
|
|
131
|
+
if ($[23] !== leading || $[24] !== t10 || $[25] !== t11 || $[26] !== trailing) {
|
|
132
|
+
t12 = /*#__PURE__*/_jsxs(_Fragment, {
|
|
133
|
+
children: [leading, t10, trailing, t11]
|
|
134
|
+
});
|
|
135
|
+
$[23] = leading;
|
|
136
|
+
$[24] = t10;
|
|
137
|
+
$[25] = t11;
|
|
138
|
+
$[26] = trailing;
|
|
139
|
+
$[27] = t12;
|
|
140
|
+
} else {
|
|
141
|
+
t12 = $[27];
|
|
142
|
+
}
|
|
143
|
+
const content = t12;
|
|
144
|
+
if (!onPress) {
|
|
145
|
+
let t13;
|
|
146
|
+
if ($[28] !== content || $[29] !== currentProps || $[30] !== row || $[31] !== style) {
|
|
147
|
+
t13 = /*#__PURE__*/_jsx("div", {
|
|
148
|
+
...currentProps,
|
|
149
|
+
className: row,
|
|
150
|
+
style: style,
|
|
151
|
+
children: content
|
|
152
|
+
});
|
|
153
|
+
$[28] = content;
|
|
154
|
+
$[29] = currentProps;
|
|
155
|
+
$[30] = row;
|
|
156
|
+
$[31] = style;
|
|
157
|
+
$[32] = t13;
|
|
158
|
+
} else {
|
|
159
|
+
t13 = $[32];
|
|
160
|
+
}
|
|
161
|
+
return t13;
|
|
162
|
+
}
|
|
163
|
+
let t13;
|
|
164
|
+
if ($[33] !== content || $[34] !== currentProps || $[35] !== disabled || $[36] !== onPress || $[37] !== row || $[38] !== style) {
|
|
165
|
+
t13 = /*#__PURE__*/_jsx("button", {
|
|
166
|
+
...currentProps,
|
|
167
|
+
type: "button",
|
|
168
|
+
disabled: disabled,
|
|
169
|
+
onClick: onPress,
|
|
170
|
+
className: row,
|
|
171
|
+
style: style,
|
|
172
|
+
children: content
|
|
173
|
+
});
|
|
174
|
+
$[33] = content;
|
|
175
|
+
$[34] = currentProps;
|
|
176
|
+
$[35] = disabled;
|
|
177
|
+
$[36] = onPress;
|
|
178
|
+
$[37] = row;
|
|
179
|
+
$[38] = style;
|
|
180
|
+
$[39] = t13;
|
|
181
|
+
} else {
|
|
182
|
+
t13 = $[39];
|
|
183
|
+
}
|
|
184
|
+
return t13;
|
|
185
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { type MediaCardBaseProps } from "@xds/core";
|
|
2
|
+
import { type ReactNode } from "react";
|
|
3
|
+
import type { RootProps } from "./root.ts";
|
|
4
|
+
export type MediaCardProps = MediaCardBaseProps & RootProps & {
|
|
5
|
+
/** Before the text in the vertical layout, such as an Avatar. */
|
|
6
|
+
leading?: ReactNode;
|
|
7
|
+
/** At the end of the text: an IconButton or a Menu. It stays a control of its own. */
|
|
8
|
+
action?: ReactNode;
|
|
9
|
+
/** Makes the whole card one button. */
|
|
10
|
+
onPress?: () => void;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* A thumbnail with its title and details: a video in a feed, an article in a list.
|
|
14
|
+
*
|
|
15
|
+
* With `onPress` the whole card is one button with no surface at rest: under a pointer and
|
|
16
|
+
* while pressed it takes the card's fills, and it has a focus ring. The button is named by the
|
|
17
|
+
* title followed by the details. `action` is a separate control beside it, so pressing it does
|
|
18
|
+
* not press the card.
|
|
19
|
+
*/
|
|
20
|
+
export declare function MediaCard(props: MediaCardProps): import("react").JSX.Element;
|