@traefik-labs/faency 13.4.0 → 13.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.
- package/dist/components/AriaTable/AriaTable.cjs +13 -5
- package/dist/components/AriaTable/AriaTable.cjs.map +1 -1
- package/dist/components/AriaTable/AriaTable.constants.cjs +5 -0
- package/dist/components/AriaTable/AriaTable.constants.cjs.map +1 -0
- package/dist/components/AriaTable/AriaTable.constants.js +5 -0
- package/dist/components/AriaTable/AriaTable.constants.js.map +1 -0
- package/dist/components/AriaTable/AriaTable.js +13 -5
- package/dist/components/AriaTable/AriaTable.js.map +1 -1
- package/dist/components/AriaTable/AriaTable.vanilla.cjs +194 -0
- package/dist/components/AriaTable/AriaTable.vanilla.cjs.map +1 -0
- package/dist/components/AriaTable/AriaTable.vanilla.css.cjs +28 -0
- package/dist/components/AriaTable/AriaTable.vanilla.css.cjs.map +1 -0
- package/dist/components/AriaTable/AriaTable.vanilla.css.js +17 -0
- package/dist/components/AriaTable/AriaTable.vanilla.css.js.map +1 -0
- package/dist/components/AriaTable/AriaTable.vanilla.js +185 -0
- package/dist/components/AriaTable/AriaTable.vanilla.js.map +1 -0
- package/dist/components/Badge/Badge.vanilla.cjs +2 -1
- package/dist/components/Badge/Badge.vanilla.cjs.map +1 -1
- package/dist/components/Badge/Badge.vanilla.js +2 -1
- package/dist/components/Badge/Badge.vanilla.js.map +1 -1
- package/dist/components/Blockquote/Blockquote.vanilla.cjs +2 -1
- package/dist/components/Blockquote/Blockquote.vanilla.cjs.map +1 -1
- package/dist/components/Blockquote/Blockquote.vanilla.js +2 -1
- package/dist/components/Blockquote/Blockquote.vanilla.js.map +1 -1
- package/dist/components/Box/Box.vanilla.cjs +2 -1
- package/dist/components/Box/Box.vanilla.cjs.map +1 -1
- package/dist/components/Box/Box.vanilla.js +2 -1
- package/dist/components/Box/Box.vanilla.js.map +1 -1
- package/dist/components/Bubble/Bubble.vanilla.cjs +2 -1
- package/dist/components/Bubble/Bubble.vanilla.cjs.map +1 -1
- package/dist/components/Bubble/Bubble.vanilla.js +2 -1
- package/dist/components/Bubble/Bubble.vanilla.js.map +1 -1
- package/dist/components/Button/Button.vanilla.cjs +2 -1
- package/dist/components/Button/Button.vanilla.cjs.map +1 -1
- package/dist/components/Button/Button.vanilla.js +2 -1
- package/dist/components/Button/Button.vanilla.js.map +1 -1
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.cjs +5 -4
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.cjs.map +1 -1
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.js +5 -4
- package/dist/components/ButtonSwitch/ButtonSwitch.vanilla.js.map +1 -1
- package/dist/components/Card/Card.vanilla.cjs +2 -1
- package/dist/components/Card/Card.vanilla.cjs.map +1 -1
- package/dist/components/Card/Card.vanilla.js +2 -1
- package/dist/components/Card/Card.vanilla.js.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.cjs +2 -2
- package/dist/components/CodeBlock/CodeBlock.js +2 -2
- package/dist/components/CodeBlock/CodeBlock.vanilla.cjs +6 -14
- package/dist/components/CodeBlock/CodeBlock.vanilla.cjs.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.vanilla.js +6 -14
- package/dist/components/CodeBlock/CodeBlock.vanilla.js.map +1 -1
- package/dist/components/Combobox/Combobox.vanilla.cjs +2 -2
- package/dist/components/Combobox/Combobox.vanilla.cjs.map +1 -1
- package/dist/components/Combobox/Combobox.vanilla.js +2 -2
- package/dist/components/Combobox/Combobox.vanilla.js.map +1 -1
- package/dist/components/Container/Container.vanilla.cjs +2 -1
- package/dist/components/Container/Container.vanilla.cjs.map +1 -1
- package/dist/components/Container/Container.vanilla.js +2 -1
- package/dist/components/Container/Container.vanilla.js.map +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.cjs +1 -1
- package/dist/components/DateTimePicker/DateTimePicker.js +1 -1
- package/dist/components/Dialog/Dialog.cjs +1 -1
- package/dist/components/Dialog/Dialog.js +1 -1
- package/dist/components/Elevation/Elevation.vanilla.cjs +2 -1
- package/dist/components/Elevation/Elevation.vanilla.cjs.map +1 -1
- package/dist/components/Elevation/Elevation.vanilla.css.cjs.map +1 -1
- package/dist/components/Elevation/Elevation.vanilla.css.js.map +1 -1
- package/dist/components/Elevation/Elevation.vanilla.js +2 -1
- package/dist/components/Elevation/Elevation.vanilla.js.map +1 -1
- package/dist/components/Field/Field.cjs +80 -33
- package/dist/components/Field/Field.cjs.map +1 -1
- package/dist/components/Field/Field.js +80 -33
- package/dist/components/Field/Field.js.map +1 -1
- package/dist/components/Field/Field.vanilla.cjs +62 -32
- package/dist/components/Field/Field.vanilla.cjs.map +1 -1
- package/dist/components/Field/Field.vanilla.css.cjs +6 -0
- package/dist/components/Field/Field.vanilla.css.cjs.map +1 -1
- package/dist/components/Field/Field.vanilla.css.js +4 -1
- package/dist/components/Field/Field.vanilla.css.js.map +1 -1
- package/dist/components/Field/Field.vanilla.js +63 -33
- package/dist/components/Field/Field.vanilla.js.map +1 -1
- package/dist/components/Field/FieldContext.cjs +48 -10
- package/dist/components/Field/FieldContext.cjs.map +1 -1
- package/dist/components/Field/FieldContext.js +48 -10
- package/dist/components/Field/FieldContext.js.map +1 -1
- package/dist/components/Flex/Flex.vanilla.cjs +2 -1
- package/dist/components/Flex/Flex.vanilla.cjs.map +1 -1
- package/dist/components/Flex/Flex.vanilla.js +2 -1
- package/dist/components/Flex/Flex.vanilla.js.map +1 -1
- package/dist/components/Grid/Grid.vanilla.cjs +2 -1
- package/dist/components/Grid/Grid.vanilla.cjs.map +1 -1
- package/dist/components/Grid/Grid.vanilla.js +2 -1
- package/dist/components/Grid/Grid.vanilla.js.map +1 -1
- package/dist/components/IconButton/IconButton.vanilla.cjs +2 -1
- package/dist/components/IconButton/IconButton.vanilla.cjs.map +1 -1
- package/dist/components/IconButton/IconButton.vanilla.js +2 -1
- package/dist/components/IconButton/IconButton.vanilla.js.map +1 -1
- package/dist/components/Image/Image.vanilla.cjs +2 -1
- package/dist/components/Image/Image.vanilla.cjs.map +1 -1
- package/dist/components/Image/Image.vanilla.js +2 -1
- package/dist/components/Image/Image.vanilla.js.map +1 -1
- package/dist/components/Input/Input.vanilla.cjs +2 -1
- package/dist/components/Input/Input.vanilla.cjs.map +1 -1
- package/dist/components/Input/Input.vanilla.js +2 -1
- package/dist/components/Input/Input.vanilla.js.map +1 -1
- package/dist/components/Label/Label.vanilla.cjs +2 -1
- package/dist/components/Label/Label.vanilla.cjs.map +1 -1
- package/dist/components/Label/Label.vanilla.js +2 -1
- package/dist/components/Label/Label.vanilla.js.map +1 -1
- package/dist/components/List/List.cjs +1 -1
- package/dist/components/List/List.js +1 -1
- package/dist/components/Meter/Meter.vanilla.cjs +3 -2
- package/dist/components/Meter/Meter.vanilla.cjs.map +1 -1
- package/dist/components/Meter/Meter.vanilla.js +3 -2
- package/dist/components/Meter/Meter.vanilla.js.map +1 -1
- package/dist/components/NavigationTree/NavigationTreeItem.cjs +2 -2
- package/dist/components/NavigationTree/NavigationTreeItem.js +2 -2
- package/dist/components/Panel/Panel.vanilla.cjs +2 -1
- package/dist/components/Panel/Panel.vanilla.cjs.map +1 -1
- package/dist/components/Panel/Panel.vanilla.js +2 -1
- package/dist/components/Panel/Panel.vanilla.js.map +1 -1
- package/dist/components/Paragraph/Paragraph.vanilla.cjs +2 -1
- package/dist/components/Paragraph/Paragraph.vanilla.cjs.map +1 -1
- package/dist/components/Paragraph/Paragraph.vanilla.js +2 -1
- package/dist/components/Paragraph/Paragraph.vanilla.js.map +1 -1
- package/dist/components/RowLink/RowLink.cjs +18 -46
- package/dist/components/RowLink/RowLink.cjs.map +1 -1
- package/dist/components/RowLink/RowLink.constants.cjs +7 -0
- package/dist/components/RowLink/RowLink.constants.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.constants.js +6 -0
- package/dist/components/RowLink/RowLink.constants.js.map +1 -0
- package/dist/components/RowLink/RowLink.js +15 -45
- package/dist/components/RowLink/RowLink.js.map +1 -1
- package/dist/components/RowLink/RowLink.utils.cjs +87 -0
- package/dist/components/RowLink/RowLink.utils.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.utils.js +83 -0
- package/dist/components/RowLink/RowLink.utils.js.map +1 -0
- package/dist/components/RowLink/RowLink.vanilla.cjs +21 -0
- package/dist/components/RowLink/RowLink.vanilla.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.vanilla.css.cjs +10 -0
- package/dist/components/RowLink/RowLink.vanilla.css.cjs.map +1 -0
- package/dist/components/RowLink/RowLink.vanilla.css.js +8 -0
- package/dist/components/RowLink/RowLink.vanilla.css.js.map +1 -0
- package/dist/components/RowLink/RowLink.vanilla.js +19 -0
- package/dist/components/RowLink/RowLink.vanilla.js.map +1 -0
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.cjs +3 -3
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.cjs.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.js +3 -3
- package/dist/components/SegmentedControl/SegmentedControl.vanilla.js.map +1 -1
- package/dist/components/Select/Select.cjs +1 -1
- package/dist/components/Select/Select.js +1 -1
- package/dist/components/Skeleton/Skeleton.vanilla.cjs +2 -1
- package/dist/components/Skeleton/Skeleton.vanilla.cjs.map +1 -1
- package/dist/components/Skeleton/Skeleton.vanilla.js +2 -1
- package/dist/components/Skeleton/Skeleton.vanilla.js.map +1 -1
- package/dist/components/Spinner/Spinner.vanilla.cjs +3 -2
- package/dist/components/Spinner/Spinner.vanilla.cjs.map +1 -1
- package/dist/components/Spinner/Spinner.vanilla.js +3 -2
- package/dist/components/Spinner/Spinner.vanilla.js.map +1 -1
- package/dist/components/SplitLayout/SplitLayout.vanilla.cjs +4 -3
- package/dist/components/SplitLayout/SplitLayout.vanilla.cjs.map +1 -1
- package/dist/components/SplitLayout/SplitLayout.vanilla.js +4 -3
- package/dist/components/SplitLayout/SplitLayout.vanilla.js.map +1 -1
- package/dist/components/Table/ExpandToggle.vanilla.cjs +30 -0
- package/dist/components/Table/ExpandToggle.vanilla.cjs.map +1 -0
- package/dist/components/Table/ExpandToggle.vanilla.js +27 -0
- package/dist/components/Table/ExpandToggle.vanilla.js.map +1 -0
- package/dist/components/Table/SortButton.vanilla.cjs +38 -0
- package/dist/components/Table/SortButton.vanilla.cjs.map +1 -0
- package/dist/components/Table/SortButton.vanilla.js +35 -0
- package/dist/components/Table/SortButton.vanilla.js.map +1 -0
- package/dist/components/Table/Table.cjs +11 -4
- package/dist/components/Table/Table.cjs.map +1 -1
- package/dist/components/Table/Table.js +11 -4
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/Table.vanilla.cjs +142 -0
- package/dist/components/Table/Table.vanilla.cjs.map +1 -0
- package/dist/components/Table/Table.vanilla.css.cjs +178 -0
- package/dist/components/Table/Table.vanilla.css.cjs.map +1 -0
- package/dist/components/Table/Table.vanilla.css.js +161 -0
- package/dist/components/Table/Table.vanilla.css.js.map +1 -0
- package/dist/components/Table/Table.vanilla.js +133 -0
- package/dist/components/Table/Table.vanilla.js.map +1 -0
- package/dist/components/Table/useTableSort.cjs +60 -0
- package/dist/components/Table/useTableSort.cjs.map +1 -0
- package/dist/components/Table/useTableSort.js +59 -0
- package/dist/components/Table/useTableSort.js.map +1 -0
- package/dist/components/Text/Text.vanilla.cjs +2 -1
- package/dist/components/Text/Text.vanilla.cjs.map +1 -1
- package/dist/components/Text/Text.vanilla.js +2 -1
- package/dist/components/Text/Text.vanilla.js.map +1 -1
- package/dist/components/TextField/TextField.cjs +1 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/TextField/TextField.vanilla.cjs +1 -1
- package/dist/components/TextField/TextField.vanilla.js +1 -1
- package/dist/components/Textarea/Textarea.cjs +2 -2
- package/dist/components/Textarea/Textarea.js +2 -2
- package/dist/components/Textarea/Textarea.vanilla.cjs +4 -3
- package/dist/components/Textarea/Textarea.vanilla.cjs.map +1 -1
- package/dist/components/Textarea/Textarea.vanilla.js +4 -3
- package/dist/components/Textarea/Textarea.vanilla.js.map +1 -1
- package/dist/components/Toast/Toast.vanilla.cjs +5 -5
- package/dist/components/Toast/Toast.vanilla.cjs.map +1 -1
- package/dist/components/Toast/Toast.vanilla.js +5 -5
- package/dist/components/Toast/Toast.vanilla.js.map +1 -1
- package/dist/components/Toast/ToastProvider.vanilla.cjs +1 -1
- package/dist/components/Toast/ToastProvider.vanilla.js +1 -1
- package/dist/faency.css +3001 -2303
- package/dist/index.cjs +50 -29
- package/dist/index.d.ts +570 -24
- package/dist/index.js +33 -30
- package/dist/styles/cx.cjs +5 -0
- package/dist/styles/cx.cjs.map +1 -0
- package/dist/styles/cx.js +5 -0
- package/dist/styles/cx.js.map +1 -0
- package/dist/styles/themes.css.cjs.map +1 -1
- package/dist/styles/themes.css.js.map +1 -1
- package/dist/styles/tokens.css.cjs +55 -44
- package/dist/styles/tokens.css.cjs.map +1 -1
- package/dist/styles/tokens.css.js +55 -44
- package/dist/styles/tokens.css.js.map +1 -1
- package/dist/styles/useInlineStyle.cjs +16 -0
- package/dist/styles/useInlineStyle.cjs.map +1 -0
- package/dist/styles/useInlineStyle.js +16 -0
- package/dist/styles/useInlineStyle.js.map +1 -0
- package/dist/utils/warnOnce.cjs +13 -0
- package/dist/utils/warnOnce.cjs.map +1 -0
- package/dist/utils/warnOnce.js +13 -0
- package/dist/utils/warnOnce.js.map +1 -0
- package/package.json +10 -17
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_warnOnce = require("../../utils/warnOnce.cjs");
|
|
3
|
+
const require_RowLink_constants = require("./RowLink.constants.cjs");
|
|
4
|
+
let react = require("react");
|
|
5
|
+
react = require_runtime.__toESM(react, 1);
|
|
6
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
7
|
+
// components/RowLink/RowLink.utils.tsx
|
|
8
|
+
var STITCHES_INTERNAL = Symbol.for("sxs.internal");
|
|
9
|
+
var isCellType = (type, cellType) => {
|
|
10
|
+
if (type === cellType) return true;
|
|
11
|
+
if (!type || typeof type !== "object" && typeof type !== "function") return false;
|
|
12
|
+
const { className, [STITCHES_INTERNAL]: internal } = type;
|
|
13
|
+
const cellClassName = cellType.className;
|
|
14
|
+
return internal?.type === cellType || !!cellClassName && className === cellClassName;
|
|
15
|
+
};
|
|
16
|
+
/** Puts the content of the `cellType` cell at `linkCell` in a `RowLinkComponent` to `href`. */
|
|
17
|
+
var mapRowLink = (children, { href, linkAs: LinkComponent = "a", linkCell = 0, linkProps, linkOverlay }, cellType, RowLinkComponent, names) => {
|
|
18
|
+
if (href === void 0) return children;
|
|
19
|
+
let cellIndex = -1;
|
|
20
|
+
let linked = false;
|
|
21
|
+
const mapped = react.Children.map(children, (child) => {
|
|
22
|
+
if (!(0, react.isValidElement)(child)) return child;
|
|
23
|
+
cellIndex += 1;
|
|
24
|
+
if (cellIndex !== linkCell || !isCellType(child.type, cellType)) return child;
|
|
25
|
+
linked = true;
|
|
26
|
+
return (0, react.cloneElement)(child, void 0, /* @__PURE__ */ (0, react_jsx_runtime.jsx)(RowLinkComponent, {
|
|
27
|
+
asChild: true,
|
|
28
|
+
overlay: linkOverlay,
|
|
29
|
+
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(LinkComponent, {
|
|
30
|
+
...linkProps,
|
|
31
|
+
href,
|
|
32
|
+
children: child.props.children
|
|
33
|
+
})
|
|
34
|
+
}));
|
|
35
|
+
});
|
|
36
|
+
if (!linked) {
|
|
37
|
+
const { row, cell } = names ?? {
|
|
38
|
+
row: "Tr",
|
|
39
|
+
cell: "Td"
|
|
40
|
+
};
|
|
41
|
+
const aCell = `${/^[aeiou]/i.test(cell) ? "an" : "a"} ${cell}`;
|
|
42
|
+
const fix = names ? `Use ${aCell} for that cell.` : `Use ${aCell} for that cell, or put a RowLink in it.`;
|
|
43
|
+
require_warnOnce.warnOnce(`${row}: the child at linkCell ${linkCell} is not ${aCell}, so the row has no link. ${fix}`);
|
|
44
|
+
}
|
|
45
|
+
return mapped;
|
|
46
|
+
};
|
|
47
|
+
var NEW_TAB_PROTOCOLS = ["http:", "https:"];
|
|
48
|
+
var ROW_CLICK_CONTROLS = "a, button, input, select, textarea, label, summary, [role=\"button\"], [role=\"link\"], [role=\"checkbox\"], [role=\"switch\"], [role=\"menuitem\"], [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]";
|
|
49
|
+
var replayedLink = null;
|
|
50
|
+
/** Opens the `RowLink` without overlay of the row on a click or a middle click outside its controls. */
|
|
51
|
+
var openRowLink = (event) => {
|
|
52
|
+
const isAuxClick = event.type === "auxclick";
|
|
53
|
+
if (event.defaultPrevented || isAuxClick && event.button !== 1) return;
|
|
54
|
+
const row = event.currentTarget;
|
|
55
|
+
const target = event.target;
|
|
56
|
+
if (!(target instanceof Element) || !row.contains(target)) return;
|
|
57
|
+
const control = target.closest(ROW_CLICK_CONTROLS);
|
|
58
|
+
if (control && row.contains(control)) return;
|
|
59
|
+
const link = row.querySelector(`[${require_RowLink_constants.ROW_LINK_ATTRIBUTE}="click"]`);
|
|
60
|
+
if (!link) return;
|
|
61
|
+
const selection = window.getSelection();
|
|
62
|
+
if (selection && !selection.isCollapsed && row.contains(selection.anchorNode)) return;
|
|
63
|
+
if ((isAuxClick || event.metaKey || event.ctrlKey || event.shiftKey) && NEW_TAB_PROTOCOLS.includes(new URL(link.href, window.location.href).protocol)) {
|
|
64
|
+
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
65
|
+
return;
|
|
66
|
+
}
|
|
67
|
+
replayedLink = link;
|
|
68
|
+
try {
|
|
69
|
+
link.click();
|
|
70
|
+
} finally {
|
|
71
|
+
replayedLink = null;
|
|
72
|
+
}
|
|
73
|
+
};
|
|
74
|
+
/**
|
|
75
|
+
* Calls the row's `onClick`, then opens its `RowLink` without overlay. It skips the click that
|
|
76
|
+
* `openRowLink` sends to the link, so `onClick` runs once per click on the row.
|
|
77
|
+
*/
|
|
78
|
+
var handleRowClick = (event, onClick) => {
|
|
79
|
+
if (replayedLink && event.target === replayedLink) return;
|
|
80
|
+
onClick?.(event);
|
|
81
|
+
openRowLink(event);
|
|
82
|
+
};
|
|
83
|
+
exports.handleRowClick = handleRowClick;
|
|
84
|
+
exports.mapRowLink = mapRowLink;
|
|
85
|
+
exports.openRowLink = openRowLink;
|
|
86
|
+
|
|
87
|
+
//# sourceMappingURL=RowLink.utils.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RowLink.utils.cjs","names":["Children","isValidElement","cloneElement","ROW_LINK_ATTRIBUTE"],"sources":["../../../components/RowLink/RowLink.utils.tsx"],"sourcesContent":["import React, { Children, cloneElement, ElementType, isValidElement, ReactNode } from 'react';\n\nimport { warnOnce } from '../../utils/warnOnce';\nimport { ROW_LINK_ATTRIBUTE } from './RowLink.constants';\n\nconst STITCHES_INTERNAL = Symbol.for('sxs.internal');\n\nexport type RowLinkShortcutProps = {\n href?: string;\n /**\n * The link component, for example a router link. It must pass its props and ref to its `<a>`,\n * and it must be defined outside render, or the link mounts again on each render.\n */\n linkAs?: ElementType;\n /** Other props for the link component, for example `{ returnTo }`. */\n linkProps?: Record<string, unknown>;\n /** The index of the cell that holds the link, among the direct children of the row. */\n linkCell?: number;\n /** With `false`, the link does not cover the row: see `overlay` on `RowLink`. */\n linkOverlay?: boolean;\n};\n\ntype StitchesType = { className?: string; [STITCHES_INTERNAL]?: { type?: unknown } };\n\n// A Stitches `styled(Td)` keeps the class name of a Stitches Td, or renders a component Td.\n// This reads Stitches 1.x internals; the styled Td tests catch a change in them.\nconst isCellType = (type: unknown, cellType: ElementType) => {\n if (type === cellType) {\n return true;\n }\n if (!type || (typeof type !== 'object' && typeof type !== 'function')) {\n return false;\n }\n const { className, [STITCHES_INTERNAL]: internal } = type as StitchesType;\n const cellClassName = (cellType as StitchesType).className;\n return internal?.type === cellType || (!!cellClassName && className === cellClassName);\n};\n\n/** The component names in the warning. Without them, it names the Stitches `Tr` and `Td`, and suggests `RowLink`. */\ntype RowLinkNames = { row: string; cell: string };\n\n/** Puts the content of the `cellType` cell at `linkCell` in a `RowLinkComponent` to `href`. */\nexport const mapRowLink = (\n children: ReactNode,\n { href, linkAs: LinkComponent = 'a', linkCell = 0, linkProps, linkOverlay }: RowLinkShortcutProps,\n cellType: ElementType,\n RowLinkComponent: ElementType,\n names?: RowLinkNames,\n) => {\n if (href === undefined) {\n return children;\n }\n\n let cellIndex = -1;\n let linked = false;\n // eslint-disable-next-line @eslint-react/no-children-map\n const mapped = Children.map(children, (child) => {\n if (!isValidElement<{ children?: ReactNode }>(child)) {\n return child;\n }\n cellIndex += 1;\n if (cellIndex !== linkCell || !isCellType(child.type, cellType)) {\n return child;\n }\n linked = true;\n // eslint-disable-next-line @eslint-react/no-clone-element\n return cloneElement(\n child,\n undefined,\n <RowLinkComponent asChild overlay={linkOverlay}>\n <LinkComponent {...linkProps} href={href}>\n {child.props.children}\n </LinkComponent>\n </RowLinkComponent>,\n );\n });\n\n if (!linked) {\n const { row, cell } = names ?? { row: 'Tr', cell: 'Td' };\n const aCell = `${/^[aeiou]/i.test(cell) ? 'an' : 'a'} ${cell}`;\n const fix = names\n ? `Use ${aCell} for that cell.`\n : `Use ${aCell} for that cell, or put a RowLink in it.`;\n warnOnce(\n `${row}: the child at linkCell ${linkCell} is not ${aCell}, so the row has no link. ${fix}`,\n );\n }\n\n return mapped;\n};\n\n// Only a web page opens in a new tab, never a script URL such as javascript: or data:.\n// Other links, such as tel: or mailto:, open as on a plain click.\nconst NEW_TAB_PROTOCOLS = ['http:', 'https:'];\n\nconst ROW_CLICK_CONTROLS =\n 'a, button, input, select, textarea, label, summary, [role=\"button\"], [role=\"link\"], [role=\"checkbox\"], [role=\"switch\"], [role=\"menuitem\"], [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]';\n\nlet replayedLink: HTMLAnchorElement | null = null;\n\n/** Opens the `RowLink` without overlay of the row on a click or a middle click outside its controls. */\nexport const openRowLink = <T extends HTMLElement>(event: React.MouseEvent<T>) => {\n const isAuxClick = event.type === 'auxclick';\n if (event.defaultPrevented || (isAuxClick && event.button !== 1)) {\n return;\n }\n const row = event.currentTarget;\n const target = event.target;\n // A portal, such as a row menu, sends its clicks to the row through React, but it is not in the row.\n if (!(target instanceof Element) || !row.contains(target)) {\n return;\n }\n const control = target.closest(ROW_CLICK_CONTROLS);\n if (control && row.contains(control)) {\n return;\n }\n const link = row.querySelector<HTMLAnchorElement>(`[${ROW_LINK_ATTRIBUTE}=\"click\"]`);\n if (!link) {\n return;\n }\n // A drag that selects text in the row is not a click on the row.\n const selection = window.getSelection();\n if (selection && !selection.isCollapsed && row.contains(selection.anchorNode)) {\n return;\n }\n const newTab = isAuxClick || event.metaKey || event.ctrlKey || event.shiftKey;\n if (newTab && NEW_TAB_PROTOCOLS.includes(new URL(link.href, window.location.href).protocol)) {\n window.open(link.href, '_blank', 'noopener,noreferrer');\n return;\n }\n // The click bubbles back to the row, which skips it in `handleRowClick`.\n replayedLink = link;\n try {\n link.click();\n } finally {\n replayedLink = null;\n }\n};\n\n/**\n * Calls the row's `onClick`, then opens its `RowLink` without overlay. It skips the click that\n * `openRowLink` sends to the link, so `onClick` runs once per click on the row.\n */\nexport const handleRowClick = <T extends HTMLElement>(\n event: React.MouseEvent<T>,\n onClick?: React.MouseEventHandler<T>,\n) => {\n if (replayedLink && event.target === replayedLink) {\n return;\n }\n onClick?.(event);\n openRowLink(event);\n};\n"],"mappings":";;;;;;;AAKA,IAAM,oBAAoB,OAAO,IAAI,cAAc;AAqBnD,IAAM,cAAc,MAAe,aAA0B;CAC3D,IAAI,SAAS,UACX,OAAO;CAET,IAAI,CAAC,QAAS,OAAO,SAAS,YAAY,OAAO,SAAS,YACxD,OAAO;CAET,MAAM,EAAE,YAAY,oBAAoB,aAAa;CACrD,MAAM,gBAAiB,SAA0B;CACjD,OAAO,UAAU,SAAS,YAAa,CAAC,CAAC,iBAAiB,cAAc;AAC1E;;AAMA,IAAa,cACX,UACA,EAAE,MAAM,QAAQ,gBAAgB,KAAK,WAAW,GAAG,WAAW,eAC9D,UACA,kBACA,UACG;CACH,IAAI,SAAS,KAAA,GACX,OAAO;CAGT,IAAI,YAAY;CAChB,IAAI,SAAS;CAEb,MAAM,SAASA,MAAAA,SAAS,IAAI,WAAW,UAAU;EAC/C,IAAI,EAAA,GAACC,MAAAA,eAAAA,CAAyC,KAAK,GACjD,OAAO;EAET,aAAa;EACb,IAAI,cAAc,YAAY,CAAC,WAAW,MAAM,MAAM,QAAQ,GAC5D,OAAO;EAET,SAAS;EAET,QAAA,GAAOC,MAAAA,aAAAA,CACL,OACA,KAAA,GACA,iBAAA,GAAA,kBAAA,IAAA,CAAC,kBAAD;GAAkB,SAAA;GAAQ,SAAS;GACjC,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,eAAD;IAAe,GAAI;IAAiB;IACjC,UAAA,MAAM,MAAM;GACA,CAAA;EACC,CAAA,CACpB;CACF,CAAC;CAED,IAAI,CAAC,QAAQ;EACX,MAAM,EAAE,KAAK,SAAS,SAAS;GAAE,KAAK;GAAM,MAAM;EAAK;EACvD,MAAM,QAAQ,GAAG,YAAY,KAAK,IAAI,IAAI,OAAO,IAAI,GAAG;EACxD,MAAM,MAAM,QACR,OAAO,MAAM,mBACb,OAAO,MAAM;EACjB,iBAAA,SACE,GAAG,IAAI,0BAA0B,SAAS,UAAU,MAAM,4BAA4B,KACxF;CACF;CAEA,OAAO;AACT;AAIA,IAAM,oBAAoB,CAAC,SAAS,QAAQ;AAE5C,IAAM,qBACJ;AAEF,IAAI,eAAyC;;AAG7C,IAAa,eAAsC,UAA+B;CAChF,MAAM,aAAa,MAAM,SAAS;CAClC,IAAI,MAAM,oBAAqB,cAAc,MAAM,WAAW,GAC5D;CAEF,MAAM,MAAM,MAAM;CAClB,MAAM,SAAS,MAAM;CAErB,IAAI,EAAE,kBAAkB,YAAY,CAAC,IAAI,SAAS,MAAM,GACtD;CAEF,MAAM,UAAU,OAAO,QAAQ,kBAAkB;CACjD,IAAI,WAAW,IAAI,SAAS,OAAO,GACjC;CAEF,MAAM,OAAO,IAAI,cAAiC,IAAIC,0BAAAA,mBAAmB,UAAU;CACnF,IAAI,CAAC,MACH;CAGF,MAAM,YAAY,OAAO,aAAa;CACtC,IAAI,aAAa,CAAC,UAAU,eAAe,IAAI,SAAS,UAAU,UAAU,GAC1E;CAGF,KADe,cAAc,MAAM,WAAW,MAAM,WAAW,MAAM,aACvD,kBAAkB,SAAS,IAAI,IAAI,KAAK,MAAM,OAAO,SAAS,IAAI,CAAC,CAAC,QAAQ,GAAG;EAC3F,OAAO,KAAK,KAAK,MAAM,UAAU,qBAAqB;EACtD;CACF;CAEA,eAAe;CACf,IAAI;EACF,KAAK,MAAM;CACb,UAAU;EACR,eAAe;CACjB;AACF;;;;;AAMA,IAAa,kBACX,OACA,YACG;CACH,IAAI,gBAAgB,MAAM,WAAW,cACnC;CAEF,UAAU,KAAK;CACf,YAAY,KAAK;AACnB"}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { warnOnce } from "../../utils/warnOnce.js";
|
|
2
|
+
import { ROW_LINK_ATTRIBUTE } from "./RowLink.constants.js";
|
|
3
|
+
import { Children, cloneElement, isValidElement } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
// components/RowLink/RowLink.utils.tsx
|
|
6
|
+
var STITCHES_INTERNAL = Symbol.for("sxs.internal");
|
|
7
|
+
var isCellType = (type, cellType) => {
|
|
8
|
+
if (type === cellType) return true;
|
|
9
|
+
if (!type || typeof type !== "object" && typeof type !== "function") return false;
|
|
10
|
+
const { className, [STITCHES_INTERNAL]: internal } = type;
|
|
11
|
+
const cellClassName = cellType.className;
|
|
12
|
+
return internal?.type === cellType || !!cellClassName && className === cellClassName;
|
|
13
|
+
};
|
|
14
|
+
/** Puts the content of the `cellType` cell at `linkCell` in a `RowLinkComponent` to `href`. */
|
|
15
|
+
var mapRowLink = (children, { href, linkAs: LinkComponent = "a", linkCell = 0, linkProps, linkOverlay }, cellType, RowLinkComponent, names) => {
|
|
16
|
+
if (href === void 0) return children;
|
|
17
|
+
let cellIndex = -1;
|
|
18
|
+
let linked = false;
|
|
19
|
+
const mapped = Children.map(children, (child) => {
|
|
20
|
+
if (!isValidElement(child)) return child;
|
|
21
|
+
cellIndex += 1;
|
|
22
|
+
if (cellIndex !== linkCell || !isCellType(child.type, cellType)) return child;
|
|
23
|
+
linked = true;
|
|
24
|
+
return cloneElement(child, void 0, /* @__PURE__ */ jsx(RowLinkComponent, {
|
|
25
|
+
asChild: true,
|
|
26
|
+
overlay: linkOverlay,
|
|
27
|
+
children: /* @__PURE__ */ jsx(LinkComponent, {
|
|
28
|
+
...linkProps,
|
|
29
|
+
href,
|
|
30
|
+
children: child.props.children
|
|
31
|
+
})
|
|
32
|
+
}));
|
|
33
|
+
});
|
|
34
|
+
if (!linked) {
|
|
35
|
+
const { row, cell } = names ?? {
|
|
36
|
+
row: "Tr",
|
|
37
|
+
cell: "Td"
|
|
38
|
+
};
|
|
39
|
+
const aCell = `${/^[aeiou]/i.test(cell) ? "an" : "a"} ${cell}`;
|
|
40
|
+
const fix = names ? `Use ${aCell} for that cell.` : `Use ${aCell} for that cell, or put a RowLink in it.`;
|
|
41
|
+
warnOnce(`${row}: the child at linkCell ${linkCell} is not ${aCell}, so the row has no link. ${fix}`);
|
|
42
|
+
}
|
|
43
|
+
return mapped;
|
|
44
|
+
};
|
|
45
|
+
var NEW_TAB_PROTOCOLS = ["http:", "https:"];
|
|
46
|
+
var ROW_CLICK_CONTROLS = "a, button, input, select, textarea, label, summary, [role=\"button\"], [role=\"link\"], [role=\"checkbox\"], [role=\"switch\"], [role=\"menuitem\"], [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]";
|
|
47
|
+
var replayedLink = null;
|
|
48
|
+
/** Opens the `RowLink` without overlay of the row on a click or a middle click outside its controls. */
|
|
49
|
+
var openRowLink = (event) => {
|
|
50
|
+
const isAuxClick = event.type === "auxclick";
|
|
51
|
+
if (event.defaultPrevented || isAuxClick && event.button !== 1) return;
|
|
52
|
+
const row = event.currentTarget;
|
|
53
|
+
const target = event.target;
|
|
54
|
+
if (!(target instanceof Element) || !row.contains(target)) return;
|
|
55
|
+
const control = target.closest(ROW_CLICK_CONTROLS);
|
|
56
|
+
if (control && row.contains(control)) return;
|
|
57
|
+
const link = row.querySelector(`[${ROW_LINK_ATTRIBUTE}="click"]`);
|
|
58
|
+
if (!link) return;
|
|
59
|
+
const selection = window.getSelection();
|
|
60
|
+
if (selection && !selection.isCollapsed && row.contains(selection.anchorNode)) return;
|
|
61
|
+
if ((isAuxClick || event.metaKey || event.ctrlKey || event.shiftKey) && NEW_TAB_PROTOCOLS.includes(new URL(link.href, window.location.href).protocol)) {
|
|
62
|
+
window.open(link.href, "_blank", "noopener,noreferrer");
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
replayedLink = link;
|
|
66
|
+
try {
|
|
67
|
+
link.click();
|
|
68
|
+
} finally {
|
|
69
|
+
replayedLink = null;
|
|
70
|
+
}
|
|
71
|
+
};
|
|
72
|
+
/**
|
|
73
|
+
* Calls the row's `onClick`, then opens its `RowLink` without overlay. It skips the click that
|
|
74
|
+
* `openRowLink` sends to the link, so `onClick` runs once per click on the row.
|
|
75
|
+
*/
|
|
76
|
+
var handleRowClick = (event, onClick) => {
|
|
77
|
+
if (replayedLink && event.target === replayedLink) return;
|
|
78
|
+
onClick?.(event);
|
|
79
|
+
openRowLink(event);
|
|
80
|
+
};
|
|
81
|
+
export { handleRowClick, mapRowLink, openRowLink };
|
|
82
|
+
|
|
83
|
+
//# sourceMappingURL=RowLink.utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RowLink.utils.js","names":[],"sources":["../../../components/RowLink/RowLink.utils.tsx"],"sourcesContent":["import React, { Children, cloneElement, ElementType, isValidElement, ReactNode } from 'react';\n\nimport { warnOnce } from '../../utils/warnOnce';\nimport { ROW_LINK_ATTRIBUTE } from './RowLink.constants';\n\nconst STITCHES_INTERNAL = Symbol.for('sxs.internal');\n\nexport type RowLinkShortcutProps = {\n href?: string;\n /**\n * The link component, for example a router link. It must pass its props and ref to its `<a>`,\n * and it must be defined outside render, or the link mounts again on each render.\n */\n linkAs?: ElementType;\n /** Other props for the link component, for example `{ returnTo }`. */\n linkProps?: Record<string, unknown>;\n /** The index of the cell that holds the link, among the direct children of the row. */\n linkCell?: number;\n /** With `false`, the link does not cover the row: see `overlay` on `RowLink`. */\n linkOverlay?: boolean;\n};\n\ntype StitchesType = { className?: string; [STITCHES_INTERNAL]?: { type?: unknown } };\n\n// A Stitches `styled(Td)` keeps the class name of a Stitches Td, or renders a component Td.\n// This reads Stitches 1.x internals; the styled Td tests catch a change in them.\nconst isCellType = (type: unknown, cellType: ElementType) => {\n if (type === cellType) {\n return true;\n }\n if (!type || (typeof type !== 'object' && typeof type !== 'function')) {\n return false;\n }\n const { className, [STITCHES_INTERNAL]: internal } = type as StitchesType;\n const cellClassName = (cellType as StitchesType).className;\n return internal?.type === cellType || (!!cellClassName && className === cellClassName);\n};\n\n/** The component names in the warning. Without them, it names the Stitches `Tr` and `Td`, and suggests `RowLink`. */\ntype RowLinkNames = { row: string; cell: string };\n\n/** Puts the content of the `cellType` cell at `linkCell` in a `RowLinkComponent` to `href`. */\nexport const mapRowLink = (\n children: ReactNode,\n { href, linkAs: LinkComponent = 'a', linkCell = 0, linkProps, linkOverlay }: RowLinkShortcutProps,\n cellType: ElementType,\n RowLinkComponent: ElementType,\n names?: RowLinkNames,\n) => {\n if (href === undefined) {\n return children;\n }\n\n let cellIndex = -1;\n let linked = false;\n // eslint-disable-next-line @eslint-react/no-children-map\n const mapped = Children.map(children, (child) => {\n if (!isValidElement<{ children?: ReactNode }>(child)) {\n return child;\n }\n cellIndex += 1;\n if (cellIndex !== linkCell || !isCellType(child.type, cellType)) {\n return child;\n }\n linked = true;\n // eslint-disable-next-line @eslint-react/no-clone-element\n return cloneElement(\n child,\n undefined,\n <RowLinkComponent asChild overlay={linkOverlay}>\n <LinkComponent {...linkProps} href={href}>\n {child.props.children}\n </LinkComponent>\n </RowLinkComponent>,\n );\n });\n\n if (!linked) {\n const { row, cell } = names ?? { row: 'Tr', cell: 'Td' };\n const aCell = `${/^[aeiou]/i.test(cell) ? 'an' : 'a'} ${cell}`;\n const fix = names\n ? `Use ${aCell} for that cell.`\n : `Use ${aCell} for that cell, or put a RowLink in it.`;\n warnOnce(\n `${row}: the child at linkCell ${linkCell} is not ${aCell}, so the row has no link. ${fix}`,\n );\n }\n\n return mapped;\n};\n\n// Only a web page opens in a new tab, never a script URL such as javascript: or data:.\n// Other links, such as tel: or mailto:, open as on a plain click.\nconst NEW_TAB_PROTOCOLS = ['http:', 'https:'];\n\nconst ROW_CLICK_CONTROLS =\n 'a, button, input, select, textarea, label, summary, [role=\"button\"], [role=\"link\"], [role=\"checkbox\"], [role=\"switch\"], [role=\"menuitem\"], [tabindex]:not([tabindex=\"-1\"]), [contenteditable=\"true\"]';\n\nlet replayedLink: HTMLAnchorElement | null = null;\n\n/** Opens the `RowLink` without overlay of the row on a click or a middle click outside its controls. */\nexport const openRowLink = <T extends HTMLElement>(event: React.MouseEvent<T>) => {\n const isAuxClick = event.type === 'auxclick';\n if (event.defaultPrevented || (isAuxClick && event.button !== 1)) {\n return;\n }\n const row = event.currentTarget;\n const target = event.target;\n // A portal, such as a row menu, sends its clicks to the row through React, but it is not in the row.\n if (!(target instanceof Element) || !row.contains(target)) {\n return;\n }\n const control = target.closest(ROW_CLICK_CONTROLS);\n if (control && row.contains(control)) {\n return;\n }\n const link = row.querySelector<HTMLAnchorElement>(`[${ROW_LINK_ATTRIBUTE}=\"click\"]`);\n if (!link) {\n return;\n }\n // A drag that selects text in the row is not a click on the row.\n const selection = window.getSelection();\n if (selection && !selection.isCollapsed && row.contains(selection.anchorNode)) {\n return;\n }\n const newTab = isAuxClick || event.metaKey || event.ctrlKey || event.shiftKey;\n if (newTab && NEW_TAB_PROTOCOLS.includes(new URL(link.href, window.location.href).protocol)) {\n window.open(link.href, '_blank', 'noopener,noreferrer');\n return;\n }\n // The click bubbles back to the row, which skips it in `handleRowClick`.\n replayedLink = link;\n try {\n link.click();\n } finally {\n replayedLink = null;\n }\n};\n\n/**\n * Calls the row's `onClick`, then opens its `RowLink` without overlay. It skips the click that\n * `openRowLink` sends to the link, so `onClick` runs once per click on the row.\n */\nexport const handleRowClick = <T extends HTMLElement>(\n event: React.MouseEvent<T>,\n onClick?: React.MouseEventHandler<T>,\n) => {\n if (replayedLink && event.target === replayedLink) {\n return;\n }\n onClick?.(event);\n openRowLink(event);\n};\n"],"mappings":";;;;;AAKA,IAAM,oBAAoB,OAAO,IAAI,cAAc;AAqBnD,IAAM,cAAc,MAAe,aAA0B;CAC3D,IAAI,SAAS,UACX,OAAO;CAET,IAAI,CAAC,QAAS,OAAO,SAAS,YAAY,OAAO,SAAS,YACxD,OAAO;CAET,MAAM,EAAE,YAAY,oBAAoB,aAAa;CACrD,MAAM,gBAAiB,SAA0B;CACjD,OAAO,UAAU,SAAS,YAAa,CAAC,CAAC,iBAAiB,cAAc;AAC1E;;AAMA,IAAa,cACX,UACA,EAAE,MAAM,QAAQ,gBAAgB,KAAK,WAAW,GAAG,WAAW,eAC9D,UACA,kBACA,UACG;CACH,IAAI,SAAS,KAAA,GACX,OAAO;CAGT,IAAI,YAAY;CAChB,IAAI,SAAS;CAEb,MAAM,SAAS,SAAS,IAAI,WAAW,UAAU;EAC/C,IAAI,CAAC,eAAyC,KAAK,GACjD,OAAO;EAET,aAAa;EACb,IAAI,cAAc,YAAY,CAAC,WAAW,MAAM,MAAM,QAAQ,GAC5D,OAAO;EAET,SAAS;EAET,OAAO,aACL,OACA,KAAA,GACA,oBAAC,kBAAD;GAAkB,SAAA;GAAQ,SAAS;GACjC,UAAA,oBAAC,eAAD;IAAe,GAAI;IAAiB;IACjC,UAAA,MAAM,MAAM;GACA,CAAA;EACC,CAAA,CACpB;CACF,CAAC;CAED,IAAI,CAAC,QAAQ;EACX,MAAM,EAAE,KAAK,SAAS,SAAS;GAAE,KAAK;GAAM,MAAM;EAAK;EACvD,MAAM,QAAQ,GAAG,YAAY,KAAK,IAAI,IAAI,OAAO,IAAI,GAAG;EACxD,MAAM,MAAM,QACR,OAAO,MAAM,mBACb,OAAO,MAAM;EACjB,SACE,GAAG,IAAI,0BAA0B,SAAS,UAAU,MAAM,4BAA4B,KACxF;CACF;CAEA,OAAO;AACT;AAIA,IAAM,oBAAoB,CAAC,SAAS,QAAQ;AAE5C,IAAM,qBACJ;AAEF,IAAI,eAAyC;;AAG7C,IAAa,eAAsC,UAA+B;CAChF,MAAM,aAAa,MAAM,SAAS;CAClC,IAAI,MAAM,oBAAqB,cAAc,MAAM,WAAW,GAC5D;CAEF,MAAM,MAAM,MAAM;CAClB,MAAM,SAAS,MAAM;CAErB,IAAI,EAAE,kBAAkB,YAAY,CAAC,IAAI,SAAS,MAAM,GACtD;CAEF,MAAM,UAAU,OAAO,QAAQ,kBAAkB;CACjD,IAAI,WAAW,IAAI,SAAS,OAAO,GACjC;CAEF,MAAM,OAAO,IAAI,cAAiC,IAAI,mBAAmB,UAAU;CACnF,IAAI,CAAC,MACH;CAGF,MAAM,YAAY,OAAO,aAAa;CACtC,IAAI,aAAa,CAAC,UAAU,eAAe,IAAI,SAAS,UAAU,UAAU,GAC1E;CAGF,KADe,cAAc,MAAM,WAAW,MAAM,WAAW,MAAM,aACvD,kBAAkB,SAAS,IAAI,IAAI,KAAK,MAAM,OAAO,SAAS,IAAI,CAAC,CAAC,QAAQ,GAAG;EAC3F,OAAO,KAAK,KAAK,MAAM,UAAU,qBAAqB;EACtD;CACF;CAEA,eAAe;CACf,IAAI;EACF,KAAK,MAAM;CACb,UAAU;EACR,eAAe;CACjB;AACF;;;;;AAMA,IAAa,kBACX,OACA,YACG;CACH,IAAI,gBAAgB,MAAM,WAAW,cACnC;CAEF,UAAU,KAAK;CACf,YAAY,KAAK;AACnB"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
+
const require_cx = require("../../styles/cx.cjs");
|
|
3
|
+
const require_RowLink_constants = require("./RowLink.constants.cjs");
|
|
4
|
+
const require_RowLink_vanilla_css = require("./RowLink.vanilla.css.cjs");
|
|
5
|
+
let react = require("react");
|
|
6
|
+
react = require_runtime.__toESM(react, 1);
|
|
7
|
+
let react_jsx_runtime = require("react/jsx-runtime");
|
|
8
|
+
let _radix_ui_react_slot = require("@radix-ui/react-slot");
|
|
9
|
+
// components/RowLink/RowLink.vanilla.tsx
|
|
10
|
+
var RowLinkVanilla = (0, react.forwardRef)(({ asChild, overlay = true, className, ...props }, ref) => {
|
|
11
|
+
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(asChild ? _radix_ui_react_slot.Slot : "a", {
|
|
12
|
+
ref,
|
|
13
|
+
[require_RowLink_constants.ROW_LINK_ATTRIBUTE]: overlay ? "" : "click",
|
|
14
|
+
className: require_cx.cx(require_RowLink_vanilla_css.rowLink, className),
|
|
15
|
+
...props
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
RowLinkVanilla.displayName = "RowLinkVanilla";
|
|
19
|
+
exports.RowLinkVanilla = RowLinkVanilla;
|
|
20
|
+
|
|
21
|
+
//# sourceMappingURL=RowLink.vanilla.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RowLink.vanilla.cjs","names":["forwardRef","Slot","ROW_LINK_ATTRIBUTE","cx","rowLink"],"sources":["../../../components/RowLink/RowLink.vanilla.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React, { forwardRef } from 'react';\n\nimport { cx } from '../../styles/cx';\nimport { ROW_LINK_ATTRIBUTE } from './RowLink.constants';\nimport { rowLink } from './RowLink.vanilla.css';\n\ntype RowLinkVanillaProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n asChild?: boolean;\n /** With `false`, the link does not cover the row, and the row opens it on a click instead. */\n overlay?: boolean;\n};\n\nexport const RowLinkVanilla = forwardRef<HTMLAnchorElement, RowLinkVanillaProps>(\n ({ asChild, overlay = true, className, ...props }, ref) => {\n const Component = asChild ? Slot : 'a';\n\n return (\n <Component\n ref={ref}\n {...{ [ROW_LINK_ATTRIBUTE]: overlay ? '' : 'click' }}\n className={cx(rowLink, className)}\n {...props}\n />\n );\n },\n);\n\nRowLinkVanilla.displayName = 'RowLinkVanilla';\n"],"mappings":";;;;;;;;;AAaA,IAAa,kBAAA,GAAiBA,MAAAA,WAAAA,EAC3B,EAAE,SAAS,UAAU,MAAM,WAAW,GAAG,SAAS,QAAQ;CAGzD,OACE,iBAAA,GAAA,kBAAA,IAAA,CAHgB,UAAUC,qBAAAA,OAAO,KAGjC;EACO;GACEC,0BAAAA,qBAAqB,UAAU,KAAK;EAC3C,WAAWC,WAAAA,GAAGC,4BAAAA,SAAS,SAAS;EAChC,GAAI;CACL,CAAA;AAEL,CACF;AAEA,eAAe,cAAc"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
;/* empty css */
|
|
2
|
+
// components/RowLink/RowLink.vanilla.css.ts
|
|
3
|
+
var rowLink = "_1j1xbzk0";
|
|
4
|
+
var rowLinkTable = "_1j1xbzk1";
|
|
5
|
+
var rowLinkRow = "_1j1xbzk2";
|
|
6
|
+
exports.rowLink = rowLink;
|
|
7
|
+
exports.rowLinkRow = rowLinkRow;
|
|
8
|
+
exports.rowLinkTable = rowLinkTable;
|
|
9
|
+
|
|
10
|
+
//# sourceMappingURL=RowLink.vanilla.css.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RowLink.vanilla.css.cjs","names":[],"sources":["../../../components/RowLink/RowLink.vanilla.css.ts"],"sourcesContent":["import { globalStyle, style } from '@vanilla-extract/css';\n\nimport { tokens } from '../../styles/tokens.css';\nimport {\n ROW_LINK_ATTRIBUTE,\n ROW_LINK_CONTROL_Z_INDEX,\n ROW_LINK_CONTROLS,\n ROW_LINK_Z_INDEX,\n} from './RowLink.constants';\n\nconst hasRowLink = `&:has([${ROW_LINK_ATTRIBUTE}])`;\n\nexport const rowLink = style({\n color: 'inherit',\n textDecoration: 'none',\n outline: 'none',\n\n '::after': {\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n zIndex: ROW_LINK_Z_INDEX,\n },\n\n selectors: {\n '&:focus-visible::after': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: tokens.colors.focusOutline,\n outlineOffset: '-2px',\n },\n [`&[${ROW_LINK_ATTRIBUTE}=\"click\"]::after`]: {\n content: 'none',\n },\n [`&[${ROW_LINK_ATTRIBUTE}=\"click\"]:focus-visible`]: {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: tokens.colors.focusOutline,\n outlineOffset: '2px',\n },\n },\n});\n\nexport const rowLinkTable = style({\n selectors: {\n [hasRowLink]: {\n isolation: 'isolate',\n },\n },\n});\n\nexport const rowLinkRow = style({\n selectors: {\n [hasRowLink]: {\n position: 'relative',\n },\n },\n});\n\nglobalStyle(`${rowLinkRow}:has([${ROW_LINK_ATTRIBUTE}]) ${ROW_LINK_CONTROLS}`, {\n position: 'relative',\n zIndex: ROW_LINK_CONTROL_Z_INDEX,\n});\n"],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RowLink.vanilla.css.js","names":[],"sources":["../../../components/RowLink/RowLink.vanilla.css.ts"],"sourcesContent":["import { globalStyle, style } from '@vanilla-extract/css';\n\nimport { tokens } from '../../styles/tokens.css';\nimport {\n ROW_LINK_ATTRIBUTE,\n ROW_LINK_CONTROL_Z_INDEX,\n ROW_LINK_CONTROLS,\n ROW_LINK_Z_INDEX,\n} from './RowLink.constants';\n\nconst hasRowLink = `&:has([${ROW_LINK_ATTRIBUTE}])`;\n\nexport const rowLink = style({\n color: 'inherit',\n textDecoration: 'none',\n outline: 'none',\n\n '::after': {\n content: '\"\"',\n position: 'absolute',\n inset: 0,\n zIndex: ROW_LINK_Z_INDEX,\n },\n\n selectors: {\n '&:focus-visible::after': {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: tokens.colors.focusOutline,\n outlineOffset: '-2px',\n },\n [`&[${ROW_LINK_ATTRIBUTE}=\"click\"]::after`]: {\n content: 'none',\n },\n [`&[${ROW_LINK_ATTRIBUTE}=\"click\"]:focus-visible`]: {\n outlineWidth: '2px',\n outlineStyle: 'solid',\n outlineColor: tokens.colors.focusOutline,\n outlineOffset: '2px',\n },\n },\n});\n\nexport const rowLinkTable = style({\n selectors: {\n [hasRowLink]: {\n isolation: 'isolate',\n },\n },\n});\n\nexport const rowLinkRow = style({\n selectors: {\n [hasRowLink]: {\n position: 'relative',\n },\n },\n});\n\nglobalStyle(`${rowLinkRow}:has([${ROW_LINK_ATTRIBUTE}]) ${ROW_LINK_CONTROLS}`, {\n position: 'relative',\n zIndex: ROW_LINK_CONTROL_Z_INDEX,\n});\n"],"mappings":""}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { cx } from "../../styles/cx.js";
|
|
2
|
+
import { ROW_LINK_ATTRIBUTE } from "./RowLink.constants.js";
|
|
3
|
+
import { rowLink } from "./RowLink.vanilla.css.js";
|
|
4
|
+
import { forwardRef } from "react";
|
|
5
|
+
import { jsx } from "react/jsx-runtime";
|
|
6
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
7
|
+
// components/RowLink/RowLink.vanilla.tsx
|
|
8
|
+
var RowLinkVanilla = forwardRef(({ asChild, overlay = true, className, ...props }, ref) => {
|
|
9
|
+
return /* @__PURE__ */ jsx(asChild ? Slot : "a", {
|
|
10
|
+
ref,
|
|
11
|
+
[ROW_LINK_ATTRIBUTE]: overlay ? "" : "click",
|
|
12
|
+
className: cx(rowLink, className),
|
|
13
|
+
...props
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
RowLinkVanilla.displayName = "RowLinkVanilla";
|
|
17
|
+
export { RowLinkVanilla };
|
|
18
|
+
|
|
19
|
+
//# sourceMappingURL=RowLink.vanilla.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RowLink.vanilla.js","names":[],"sources":["../../../components/RowLink/RowLink.vanilla.tsx"],"sourcesContent":["import { Slot } from '@radix-ui/react-slot';\nimport React, { forwardRef } from 'react';\n\nimport { cx } from '../../styles/cx';\nimport { ROW_LINK_ATTRIBUTE } from './RowLink.constants';\nimport { rowLink } from './RowLink.vanilla.css';\n\ntype RowLinkVanillaProps = React.AnchorHTMLAttributes<HTMLAnchorElement> & {\n asChild?: boolean;\n /** With `false`, the link does not cover the row, and the row opens it on a click instead. */\n overlay?: boolean;\n};\n\nexport const RowLinkVanilla = forwardRef<HTMLAnchorElement, RowLinkVanillaProps>(\n ({ asChild, overlay = true, className, ...props }, ref) => {\n const Component = asChild ? Slot : 'a';\n\n return (\n <Component\n ref={ref}\n {...{ [ROW_LINK_ATTRIBUTE]: overlay ? '' : 'click' }}\n className={cx(rowLink, className)}\n {...props}\n />\n );\n },\n);\n\nRowLinkVanilla.displayName = 'RowLinkVanilla';\n"],"mappings":";;;;;;;AAaA,IAAa,iBAAiB,YAC3B,EAAE,SAAS,UAAU,MAAM,WAAW,GAAG,SAAS,QAAQ;CAGzD,OACE,oBAHgB,UAAU,OAAO,KAGjC;EACO;GACE,qBAAqB,UAAU,KAAK;EAC3C,WAAW,GAAG,SAAS,SAAS;EAChC,GAAI;CACL,CAAA;AAEL,CACF;AAEA,eAAe,cAAc"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_cssProps = require("../../styles/cssProps.cjs");
|
|
3
|
+
const require_cx = require("../../styles/cx.cjs");
|
|
3
4
|
const require_themeContext = require("../../styles/themeContext.cjs");
|
|
4
5
|
const require_SegmentedControl_vanilla_css = require("./SegmentedControl.vanilla.css.cjs");
|
|
5
6
|
let react = require("react");
|
|
@@ -9,7 +10,6 @@ let react_jsx_runtime = require("react/jsx-runtime");
|
|
|
9
10
|
let _radix_ui_react_radio_group = require("@radix-ui/react-radio-group");
|
|
10
11
|
_radix_ui_react_radio_group = require_runtime.__toESM(_radix_ui_react_radio_group, 1);
|
|
11
12
|
// components/SegmentedControl/SegmentedControl.vanilla.tsx
|
|
12
|
-
var joinClassNames = (...classNames) => classNames.filter(Boolean).join(" ");
|
|
13
13
|
var useCssProp = (css, style) => {
|
|
14
14
|
const { colors } = require_themeContext.useVanillaExtractTheme();
|
|
15
15
|
const { style: cssStyles, vars } = require_cssProps.processCSSProp(css, colors);
|
|
@@ -31,7 +31,7 @@ var SegmentedControlVanilla = (0, react.forwardRef)(({ size = "medium", fullWidt
|
|
|
31
31
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_radio_group.Root, {
|
|
32
32
|
ref,
|
|
33
33
|
orientation: "horizontal",
|
|
34
|
-
className:
|
|
34
|
+
className: require_cx.cx(require_SegmentedControl_vanilla_css.segmentedControlRecipe({ fullWidth }), className),
|
|
35
35
|
style: useCssProp(css, style),
|
|
36
36
|
...props,
|
|
37
37
|
children
|
|
@@ -42,7 +42,7 @@ var SegmentedControlItemVanilla = (0, react.forwardRef)(({ className, css, style
|
|
|
42
42
|
const { size, fullWidth } = (0, react.useContext)(SegmentedControlContext);
|
|
43
43
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_radix_ui_react_radio_group.Item, {
|
|
44
44
|
ref,
|
|
45
|
-
className:
|
|
45
|
+
className: require_cx.cx(require_SegmentedControl_vanilla_css.segmentedControlItemRecipe({
|
|
46
46
|
size,
|
|
47
47
|
fullWidth
|
|
48
48
|
}), className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.vanilla.cjs","names":["useVanillaExtractTheme","processCSSProp","assignInlineVars","createContext","forwardRef","RadioGroupPrimitive","segmentedControlRecipe","useContext","segmentedControlItemRecipe"],"sources":["../../../components/SegmentedControl/SegmentedControl.vanilla.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, { ComponentPropsWithoutRef, createContext, forwardRef, useContext } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport {\n segmentedControlItemRecipe,\n segmentedControlRecipe,\n SegmentedControlSize,\n} from './SegmentedControl.vanilla.css';\n\nexport type { SegmentedControlSize };\n\nconst
|
|
1
|
+
{"version":3,"file":"SegmentedControl.vanilla.cjs","names":["useVanillaExtractTheme","processCSSProp","assignInlineVars","createContext","forwardRef","RadioGroupPrimitive","cx","segmentedControlRecipe","useContext","segmentedControlItemRecipe"],"sources":["../../../components/SegmentedControl/SegmentedControl.vanilla.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, { ComponentPropsWithoutRef, createContext, forwardRef, useContext } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport {\n segmentedControlItemRecipe,\n segmentedControlRecipe,\n SegmentedControlSize,\n} from './SegmentedControl.vanilla.css';\n\nexport type { SegmentedControlSize };\n\nconst useCssProp = (css: CSSProps['css'], style?: React.CSSProperties) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n return { ...cssStyles, ...style, ...assignInlineVars(vars) };\n};\n\nconst SegmentedControlContext = createContext<{\n size: SegmentedControlSize;\n fullWidth: boolean;\n}>({ size: 'medium', fullWidth: false });\n\nexport interface SegmentedControlVanillaProps\n extends Omit<ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>, 'asChild'>, CSSProps {\n size?: SegmentedControlSize;\n fullWidth?: boolean;\n}\n\nexport const SegmentedControlVanilla = forwardRef<HTMLDivElement, SegmentedControlVanillaProps>(\n ({ size = 'medium', fullWidth = false, className, css, style, children, ...props }, ref) => (\n <SegmentedControlContext.Provider value={{ size, fullWidth }}>\n <RadioGroupPrimitive.Root\n ref={ref}\n orientation=\"horizontal\"\n className={cx(segmentedControlRecipe({ fullWidth }), className)}\n style={useCssProp(css, style)}\n {...props}\n >\n {children}\n </RadioGroupPrimitive.Root>\n </SegmentedControlContext.Provider>\n ),\n);\n\nSegmentedControlVanilla.displayName = 'SegmentedControlVanilla';\n\nexport interface SegmentedControlItemVanillaProps\n extends Omit<ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>, 'asChild'>, CSSProps {}\n\nexport const SegmentedControlItemVanilla = forwardRef<\n HTMLButtonElement,\n SegmentedControlItemVanillaProps\n>(({ className, css, style, ...props }, ref) => {\n const { size, fullWidth } = useContext(SegmentedControlContext);\n\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cx(segmentedControlItemRecipe({ size, fullWidth }), className)}\n style={useCssProp(css, style)}\n {...props}\n />\n );\n});\n\nSegmentedControlItemVanilla.displayName = 'SegmentedControlItemVanilla';\n"],"mappings":";;;;;;;;;;;;AAeA,IAAM,cAAc,KAAsB,UAAgC;CACxE,MAAM,EAAE,WAAWA,qBAAAA,uBAAuB;CAC1C,MAAM,EAAE,OAAO,WAAW,SAASC,iBAAAA,eAAe,KAAK,MAAM;CAC7D,OAAO;EAAE,GAAG;EAAW,GAAG;EAAO,IAAA,GAAGC,yBAAAA,iBAAAA,CAAiB,IAAI;CAAE;AAC7D;AAEA,IAAM,2BAAA,GAA0BC,MAAAA,cAAAA,CAG7B;CAAE,MAAM;CAAU,WAAW;AAAM,CAAC;AAQvC,IAAa,2BAAA,GAA0BC,MAAAA,WAAAA,EACpC,EAAE,OAAO,UAAU,YAAY,OAAO,WAAW,KAAK,OAAO,UAAU,GAAG,SAAS,QAClF,iBAAA,GAAA,kBAAA,IAAA,CAAC,wBAAwB,UAAzB;CAAkC,OAAO;EAAE;EAAM;CAAU;CACzD,UAAA,iBAAA,GAAA,kBAAA,IAAA,CAACC,4BAAoB,MAArB;EACO;EACL,aAAY;EACZ,WAAWC,WAAAA,GAAGC,qCAAAA,uBAAuB,EAAE,UAAU,CAAC,GAAG,SAAS;EAC9D,OAAO,WAAW,KAAK,KAAK;EAC5B,GAAI;EAEH;CACuB,CAAA;AACM,CAAA,CAEtC;AAEA,wBAAwB,cAAc;AAKtC,IAAa,+BAAA,GAA8BH,MAAAA,WAAAA,EAGxC,EAAE,WAAW,KAAK,OAAO,GAAG,SAAS,QAAQ;CAC9C,MAAM,EAAE,MAAM,eAAA,GAAcI,MAAAA,WAAAA,CAAW,uBAAuB;CAE9D,OACE,iBAAA,GAAA,kBAAA,IAAA,CAACH,4BAAoB,MAArB;EACO;EACL,WAAWC,WAAAA,GAAGG,qCAAAA,2BAA2B;GAAE;GAAM;EAAU,CAAC,GAAG,SAAS;EACxE,OAAO,WAAW,KAAK,KAAK;EAC5B,GAAI;CACL,CAAA;AAEL,CAAC;AAED,4BAA4B,cAAc"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { processCSSProp } from "../../styles/cssProps.js";
|
|
2
|
+
import { cx } from "../../styles/cx.js";
|
|
2
3
|
import { useVanillaExtractTheme } from "../../styles/themeContext.js";
|
|
3
4
|
import { segmentedControlItemRecipe, segmentedControlRecipe } from "./SegmentedControl.vanilla.css.js";
|
|
4
5
|
import { createContext, forwardRef, useContext } from "react";
|
|
@@ -6,7 +7,6 @@ import { assignInlineVars } from "@vanilla-extract/dynamic";
|
|
|
6
7
|
import { jsx } from "react/jsx-runtime";
|
|
7
8
|
import * as RadioGroupPrimitive from "@radix-ui/react-radio-group";
|
|
8
9
|
// components/SegmentedControl/SegmentedControl.vanilla.tsx
|
|
9
|
-
var joinClassNames = (...classNames) => classNames.filter(Boolean).join(" ");
|
|
10
10
|
var useCssProp = (css, style) => {
|
|
11
11
|
const { colors } = useVanillaExtractTheme();
|
|
12
12
|
const { style: cssStyles, vars } = processCSSProp(css, colors);
|
|
@@ -28,7 +28,7 @@ var SegmentedControlVanilla = forwardRef(({ size = "medium", fullWidth = false,
|
|
|
28
28
|
children: /* @__PURE__ */ jsx(RadioGroupPrimitive.Root, {
|
|
29
29
|
ref,
|
|
30
30
|
orientation: "horizontal",
|
|
31
|
-
className:
|
|
31
|
+
className: cx(segmentedControlRecipe({ fullWidth }), className),
|
|
32
32
|
style: useCssProp(css, style),
|
|
33
33
|
...props,
|
|
34
34
|
children
|
|
@@ -39,7 +39,7 @@ var SegmentedControlItemVanilla = forwardRef(({ className, css, style, ...props
|
|
|
39
39
|
const { size, fullWidth } = useContext(SegmentedControlContext);
|
|
40
40
|
return /* @__PURE__ */ jsx(RadioGroupPrimitive.Item, {
|
|
41
41
|
ref,
|
|
42
|
-
className:
|
|
42
|
+
className: cx(segmentedControlItemRecipe({
|
|
43
43
|
size,
|
|
44
44
|
fullWidth
|
|
45
45
|
}), className),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SegmentedControl.vanilla.js","names":[],"sources":["../../../components/SegmentedControl/SegmentedControl.vanilla.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, { ComponentPropsWithoutRef, createContext, forwardRef, useContext } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport {\n segmentedControlItemRecipe,\n segmentedControlRecipe,\n SegmentedControlSize,\n} from './SegmentedControl.vanilla.css';\n\nexport type { SegmentedControlSize };\n\nconst
|
|
1
|
+
{"version":3,"file":"SegmentedControl.vanilla.js","names":[],"sources":["../../../components/SegmentedControl/SegmentedControl.vanilla.tsx"],"sourcesContent":["import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';\nimport { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, { ComponentPropsWithoutRef, createContext, forwardRef, useContext } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport {\n segmentedControlItemRecipe,\n segmentedControlRecipe,\n SegmentedControlSize,\n} from './SegmentedControl.vanilla.css';\n\nexport type { SegmentedControlSize };\n\nconst useCssProp = (css: CSSProps['css'], style?: React.CSSProperties) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n return { ...cssStyles, ...style, ...assignInlineVars(vars) };\n};\n\nconst SegmentedControlContext = createContext<{\n size: SegmentedControlSize;\n fullWidth: boolean;\n}>({ size: 'medium', fullWidth: false });\n\nexport interface SegmentedControlVanillaProps\n extends Omit<ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Root>, 'asChild'>, CSSProps {\n size?: SegmentedControlSize;\n fullWidth?: boolean;\n}\n\nexport const SegmentedControlVanilla = forwardRef<HTMLDivElement, SegmentedControlVanillaProps>(\n ({ size = 'medium', fullWidth = false, className, css, style, children, ...props }, ref) => (\n <SegmentedControlContext.Provider value={{ size, fullWidth }}>\n <RadioGroupPrimitive.Root\n ref={ref}\n orientation=\"horizontal\"\n className={cx(segmentedControlRecipe({ fullWidth }), className)}\n style={useCssProp(css, style)}\n {...props}\n >\n {children}\n </RadioGroupPrimitive.Root>\n </SegmentedControlContext.Provider>\n ),\n);\n\nSegmentedControlVanilla.displayName = 'SegmentedControlVanilla';\n\nexport interface SegmentedControlItemVanillaProps\n extends Omit<ComponentPropsWithoutRef<typeof RadioGroupPrimitive.Item>, 'asChild'>, CSSProps {}\n\nexport const SegmentedControlItemVanilla = forwardRef<\n HTMLButtonElement,\n SegmentedControlItemVanillaProps\n>(({ className, css, style, ...props }, ref) => {\n const { size, fullWidth } = useContext(SegmentedControlContext);\n\n return (\n <RadioGroupPrimitive.Item\n ref={ref}\n className={cx(segmentedControlItemRecipe({ size, fullWidth }), className)}\n style={useCssProp(css, style)}\n {...props}\n />\n );\n});\n\nSegmentedControlItemVanilla.displayName = 'SegmentedControlItemVanilla';\n"],"mappings":";;;;;;;;;AAeA,IAAM,cAAc,KAAsB,UAAgC;CACxE,MAAM,EAAE,WAAW,uBAAuB;CAC1C,MAAM,EAAE,OAAO,WAAW,SAAS,eAAe,KAAK,MAAM;CAC7D,OAAO;EAAE,GAAG;EAAW,GAAG;EAAO,GAAG,iBAAiB,IAAI;CAAE;AAC7D;AAEA,IAAM,0BAA0B,cAG7B;CAAE,MAAM;CAAU,WAAW;AAAM,CAAC;AAQvC,IAAa,0BAA0B,YACpC,EAAE,OAAO,UAAU,YAAY,OAAO,WAAW,KAAK,OAAO,UAAU,GAAG,SAAS,QAClF,oBAAC,wBAAwB,UAAzB;CAAkC,OAAO;EAAE;EAAM;CAAU;CACzD,UAAA,oBAAC,oBAAoB,MAArB;EACO;EACL,aAAY;EACZ,WAAW,GAAG,uBAAuB,EAAE,UAAU,CAAC,GAAG,SAAS;EAC9D,OAAO,WAAW,KAAK,KAAK;EAC5B,GAAI;EAEH;CACuB,CAAA;AACM,CAAA,CAEtC;AAEA,wBAAwB,cAAc;AAKtC,IAAa,8BAA8B,YAGxC,EAAE,WAAW,KAAK,OAAO,GAAG,SAAS,QAAQ;CAC9C,MAAM,EAAE,MAAM,cAAc,WAAW,uBAAuB;CAE9D,OACE,oBAAC,oBAAoB,MAArB;EACO;EACL,WAAW,GAAG,2BAA2B;GAAE;GAAM;EAAU,CAAC,GAAG,SAAS;EACxE,OAAO,WAAW,KAAK,KAAK;EAC5B,GAAI;CACL,CAAA;AAEL,CAAC;AAED,4BAA4B,cAAc"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_stitches_config = require("../../stitches.config.cjs");
|
|
3
|
+
const require_colorSchemeContext = require("../colorSchemeContext.cjs");
|
|
3
4
|
const require_Elevation = require("../Elevation/Elevation.cjs");
|
|
4
5
|
const require_FieldContext = require("../Field/FieldContext.cjs");
|
|
5
|
-
const require_colorSchemeContext = require("../colorSchemeContext.cjs");
|
|
6
6
|
let _radix_ui_react_icons = require("@radix-ui/react-icons");
|
|
7
7
|
let react = require("react");
|
|
8
8
|
react = require_runtime.__toESM(react, 1);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { styled } from "../../stitches.config.js";
|
|
2
|
+
import { useColorScheme } from "../colorSchemeContext.js";
|
|
2
3
|
import { elevationVariants } from "../Elevation/Elevation.js";
|
|
3
4
|
import { useFieldControl } from "../Field/FieldContext.js";
|
|
4
|
-
import { useColorScheme } from "../colorSchemeContext.js";
|
|
5
5
|
import { CaretSortIcon } from "@radix-ui/react-icons";
|
|
6
6
|
import React from "react";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_cssProps = require("../../styles/cssProps.cjs");
|
|
2
|
+
const require_cx = require("../../styles/cx.cjs");
|
|
2
3
|
const require_themeContext = require("../../styles/themeContext.cjs");
|
|
3
4
|
const require_Skeleton_vanilla_css = require("./Skeleton.vanilla.css.cjs");
|
|
4
5
|
let react = require("react");
|
|
@@ -17,7 +18,7 @@ var SkeletonVanillaImpl = (0, react.forwardRef)(({ as, className, css, style, va
|
|
|
17
18
|
const recipeClass = require_Skeleton_vanilla_css.skeletonRecipe({ variant });
|
|
18
19
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(Component, {
|
|
19
20
|
ref,
|
|
20
|
-
className:
|
|
21
|
+
className: require_cx.cx(recipeClass, className),
|
|
21
22
|
style: mergedStyles,
|
|
22
23
|
...props
|
|
23
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.vanilla.cjs","names":["forwardRef","useVanillaExtractTheme","processCSSProp","assignInlineVars","skeletonRecipe"],"sources":["../../../components/Skeleton/Skeleton.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport { ElementType, forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport {\n PolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n} from '../../styles/polymorphic';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { skeletonRecipe } from './Skeleton.vanilla.css';\n\ntype SkeletonRecipeVariants = NonNullable<RecipeVariants<typeof skeletonRecipe>>;\n\ninterface SkeletonVanillaOwnProps extends SkeletonRecipeVariants, CSSProps {}\n\nexport type SkeletonVanillaProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n SkeletonVanillaOwnProps\n>;\n\ntype SkeletonVanillaComponent = PolymorphicComponent<'div', SkeletonVanillaProps<ElementType>>;\n\nconst SkeletonVanillaImpl = forwardRef(\n <C extends ElementType = 'div'>(\n { as, className, css, style, variant, ...props }: SkeletonVanillaProps<C>,\n ref?: PolymorphicRef<C>,\n ) => {\n const Component = as || 'div';\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const mergedStyles = {\n ...cssStyles,\n ...style,\n ...assignInlineVars(vars),\n };\n\n const recipeClass = skeletonRecipe({ variant });\n\n return (\n <Component
|
|
1
|
+
{"version":3,"file":"Skeleton.vanilla.cjs","names":["forwardRef","useVanillaExtractTheme","processCSSProp","assignInlineVars","skeletonRecipe","cx"],"sources":["../../../components/Skeleton/Skeleton.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport { ElementType, forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport {\n PolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n} from '../../styles/polymorphic';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { skeletonRecipe } from './Skeleton.vanilla.css';\n\ntype SkeletonRecipeVariants = NonNullable<RecipeVariants<typeof skeletonRecipe>>;\n\ninterface SkeletonVanillaOwnProps extends SkeletonRecipeVariants, CSSProps {}\n\nexport type SkeletonVanillaProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n SkeletonVanillaOwnProps\n>;\n\ntype SkeletonVanillaComponent = PolymorphicComponent<'div', SkeletonVanillaProps<ElementType>>;\n\nconst SkeletonVanillaImpl = forwardRef(\n <C extends ElementType = 'div'>(\n { as, className, css, style, variant, ...props }: SkeletonVanillaProps<C>,\n ref?: PolymorphicRef<C>,\n ) => {\n const Component = as || 'div';\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const mergedStyles = {\n ...cssStyles,\n ...style,\n ...assignInlineVars(vars),\n };\n\n const recipeClass = skeletonRecipe({ variant });\n\n return (\n <Component ref={ref} className={cx(recipeClass, className)} style={mergedStyles} {...props} />\n );\n },\n);\n\nSkeletonVanillaImpl.displayName = 'SkeletonVanilla';\n\nexport const SkeletonVanilla = SkeletonVanillaImpl as SkeletonVanillaComponent;\n"],"mappings":";;;;;;;;AAyBA,IAAM,uBAAA,GAAsBA,MAAAA,WAAAA,EAExB,EAAE,IAAI,WAAW,KAAK,OAAO,SAAS,GAAG,SACzC,QACG;CACH,MAAM,YAAY,MAAM;CACxB,MAAM,EAAE,WAAWC,qBAAAA,uBAAuB;CAC1C,MAAM,EAAE,OAAO,WAAW,SAASC,iBAAAA,eAAe,KAAK,MAAM;CAE7D,MAAM,eAAe;EACnB,GAAG;EACH,GAAG;EACH,IAAA,GAAGC,yBAAAA,iBAAAA,CAAiB,IAAI;CAC1B;CAEA,MAAM,cAAcC,6BAAAA,eAAe,EAAE,QAAQ,CAAC;CAE9C,OACE,iBAAA,GAAA,kBAAA,IAAA,CAAC,WAAD;EAAgB;EAAK,WAAWC,WAAAA,GAAG,aAAa,SAAS;EAAG,OAAO;EAAc,GAAI;CAAQ,CAAA;AAEjG,CACF;AAEA,oBAAoB,cAAc;AAElC,IAAa,kBAAkB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { processCSSProp } from "../../styles/cssProps.js";
|
|
2
|
+
import { cx } from "../../styles/cx.js";
|
|
2
3
|
import { useVanillaExtractTheme } from "../../styles/themeContext.js";
|
|
3
4
|
import { skeletonRecipe } from "./Skeleton.vanilla.css.js";
|
|
4
5
|
import { forwardRef } from "react";
|
|
@@ -17,7 +18,7 @@ var SkeletonVanillaImpl = forwardRef(({ as, className, css, style, variant, ...p
|
|
|
17
18
|
const recipeClass = skeletonRecipe({ variant });
|
|
18
19
|
return /* @__PURE__ */ jsx(Component, {
|
|
19
20
|
ref,
|
|
20
|
-
className:
|
|
21
|
+
className: cx(recipeClass, className),
|
|
21
22
|
style: mergedStyles,
|
|
22
23
|
...props
|
|
23
24
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.vanilla.js","names":[],"sources":["../../../components/Skeleton/Skeleton.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport { ElementType, forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport {\n PolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n} from '../../styles/polymorphic';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { skeletonRecipe } from './Skeleton.vanilla.css';\n\ntype SkeletonRecipeVariants = NonNullable<RecipeVariants<typeof skeletonRecipe>>;\n\ninterface SkeletonVanillaOwnProps extends SkeletonRecipeVariants, CSSProps {}\n\nexport type SkeletonVanillaProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n SkeletonVanillaOwnProps\n>;\n\ntype SkeletonVanillaComponent = PolymorphicComponent<'div', SkeletonVanillaProps<ElementType>>;\n\nconst SkeletonVanillaImpl = forwardRef(\n <C extends ElementType = 'div'>(\n { as, className, css, style, variant, ...props }: SkeletonVanillaProps<C>,\n ref?: PolymorphicRef<C>,\n ) => {\n const Component = as || 'div';\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const mergedStyles = {\n ...cssStyles,\n ...style,\n ...assignInlineVars(vars),\n };\n\n const recipeClass = skeletonRecipe({ variant });\n\n return (\n <Component
|
|
1
|
+
{"version":3,"file":"Skeleton.vanilla.js","names":[],"sources":["../../../components/Skeleton/Skeleton.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport { RecipeVariants } from '@vanilla-extract/recipes';\nimport { ElementType, forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport {\n PolymorphicComponent,\n PolymorphicComponentProps,\n PolymorphicRef,\n} from '../../styles/polymorphic';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { skeletonRecipe } from './Skeleton.vanilla.css';\n\ntype SkeletonRecipeVariants = NonNullable<RecipeVariants<typeof skeletonRecipe>>;\n\ninterface SkeletonVanillaOwnProps extends SkeletonRecipeVariants, CSSProps {}\n\nexport type SkeletonVanillaProps<C extends ElementType = 'div'> = PolymorphicComponentProps<\n C,\n SkeletonVanillaOwnProps\n>;\n\ntype SkeletonVanillaComponent = PolymorphicComponent<'div', SkeletonVanillaProps<ElementType>>;\n\nconst SkeletonVanillaImpl = forwardRef(\n <C extends ElementType = 'div'>(\n { as, className, css, style, variant, ...props }: SkeletonVanillaProps<C>,\n ref?: PolymorphicRef<C>,\n ) => {\n const Component = as || 'div';\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n\n const mergedStyles = {\n ...cssStyles,\n ...style,\n ...assignInlineVars(vars),\n };\n\n const recipeClass = skeletonRecipe({ variant });\n\n return (\n <Component ref={ref} className={cx(recipeClass, className)} style={mergedStyles} {...props} />\n );\n },\n);\n\nSkeletonVanillaImpl.displayName = 'SkeletonVanilla';\n\nexport const SkeletonVanilla = SkeletonVanillaImpl as SkeletonVanillaComponent;\n"],"mappings":";;;;;;;;AAyBA,IAAM,sBAAsB,YAExB,EAAE,IAAI,WAAW,KAAK,OAAO,SAAS,GAAG,SACzC,QACG;CACH,MAAM,YAAY,MAAM;CACxB,MAAM,EAAE,WAAW,uBAAuB;CAC1C,MAAM,EAAE,OAAO,WAAW,SAAS,eAAe,KAAK,MAAM;CAE7D,MAAM,eAAe;EACnB,GAAG;EACH,GAAG;EACH,GAAG,iBAAiB,IAAI;CAC1B;CAEA,MAAM,cAAc,eAAe,EAAE,QAAQ,CAAC;CAE9C,OACE,oBAAC,WAAD;EAAgB;EAAK,WAAW,GAAG,aAAa,SAAS;EAAG,OAAO;EAAc,GAAI;CAAQ,CAAA;AAEjG,CACF;AAEA,oBAAoB,cAAc;AAElC,IAAa,kBAAkB"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
|
-
const require_resolveColor = require("../../styles/resolveColor.cjs");
|
|
3
2
|
const require_cssProps = require("../../styles/cssProps.cjs");
|
|
3
|
+
const require_cx = require("../../styles/cx.cjs");
|
|
4
|
+
const require_resolveColor = require("../../styles/resolveColor.cjs");
|
|
4
5
|
const require_themeContext = require("../../styles/themeContext.cjs");
|
|
5
6
|
const require_Spinner_vanilla_css = require("./Spinner.vanilla.css.cjs");
|
|
6
7
|
let react = require("react");
|
|
@@ -15,7 +16,7 @@ var SpinnerVanilla = (0, react.forwardRef)(({ size, color, label = "Loading", cl
|
|
|
15
16
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
|
|
16
17
|
ref,
|
|
17
18
|
role: "status",
|
|
18
|
-
className:
|
|
19
|
+
className: require_cx.cx(require_Spinner_vanilla_css.spinnerRecipe({ size }), className),
|
|
19
20
|
style: {
|
|
20
21
|
...colorStyle,
|
|
21
22
|
...cssStyles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.vanilla.cjs","names":["forwardRef","useVanillaExtractTheme","processCSSProp","resolveColor","spinnerRecipe","assignInlineVars","svg","track","hiddenLabel"],"sources":["../../../components/Spinner/Spinner.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, { forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { resolveColor } from '../../styles/resolveColor';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { hiddenLabel, spinnerRecipe, svg, track } from './Spinner.vanilla.css';\n\nexport type SpinnerVanillaProps = Omit<\n React.HTMLAttributes<HTMLSpanElement>,\n 'children' | 'color'\n> &\n CSSProps & {\n size?: 'small' | 'medium' | 'large';\n /** A color token such as `$toneSuccessSolid` or `$gray11`, any CSS color, or `currentColor`. Defaults to primary. */\n color?: string;\n /** Announced to screen readers. */\n label?: string;\n };\n\nexport const SpinnerVanilla = forwardRef<HTMLSpanElement, SpinnerVanillaProps>(\n ({ size, color, label = 'Loading', className, css, style, ...props }, ref) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n const colorStyle = color ? { color: resolveColor(color, colors) } : undefined;\n\n return (\n <span\n ref={ref}\n role=\"status\"\n className={
|
|
1
|
+
{"version":3,"file":"Spinner.vanilla.cjs","names":["forwardRef","useVanillaExtractTheme","processCSSProp","resolveColor","cx","spinnerRecipe","assignInlineVars","svg","track","hiddenLabel"],"sources":["../../../components/Spinner/Spinner.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, { forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { resolveColor } from '../../styles/resolveColor';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { hiddenLabel, spinnerRecipe, svg, track } from './Spinner.vanilla.css';\n\nexport type SpinnerVanillaProps = Omit<\n React.HTMLAttributes<HTMLSpanElement>,\n 'children' | 'color'\n> &\n CSSProps & {\n size?: 'small' | 'medium' | 'large';\n /** A color token such as `$toneSuccessSolid` or `$gray11`, any CSS color, or `currentColor`. Defaults to primary. */\n color?: string;\n /** Announced to screen readers. */\n label?: string;\n };\n\nexport const SpinnerVanilla = forwardRef<HTMLSpanElement, SpinnerVanillaProps>(\n ({ size, color, label = 'Loading', className, css, style, ...props }, ref) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n const colorStyle = color ? { color: resolveColor(color, colors) } : undefined;\n\n return (\n <span\n ref={ref}\n role=\"status\"\n className={cx(spinnerRecipe({ size }), className)}\n style={{ ...colorStyle, ...cssStyles, ...style, ...assignInlineVars(vars) }}\n {...props}\n >\n <svg\n className={svg}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2.5}\n strokeLinecap=\"round\"\n aria-hidden\n focusable=\"false\"\n >\n <circle className={track} cx=\"12\" cy=\"12\" r=\"9\" />\n <path d=\"M12 3a9 9 0 0 1 9 9\" />\n </svg>\n <span className={hiddenLabel}>{label}</span>\n </span>\n );\n },\n);\n\nSpinnerVanilla.displayName = 'SpinnerVanilla';\n"],"mappings":";;;;;;;;;;;AAqBA,IAAa,kBAAA,GAAiBA,MAAAA,WAAAA,EAC3B,EAAE,MAAM,OAAO,QAAQ,WAAW,WAAW,KAAK,OAAO,GAAG,SAAS,QAAQ;CAC5E,MAAM,EAAE,WAAWC,qBAAAA,uBAAuB;CAC1C,MAAM,EAAE,OAAO,WAAW,SAASC,iBAAAA,eAAe,KAAK,MAAM;CAC7D,MAAM,aAAa,QAAQ,EAAE,OAAOC,qBAAAA,aAAa,OAAO,MAAM,EAAE,IAAI,KAAA;CAEpE,OACE,iBAAA,GAAA,kBAAA,KAAA,CAAC,QAAD;EACO;EACL,MAAK;EACL,WAAWC,WAAAA,GAAGC,4BAAAA,cAAc,EAAE,KAAK,CAAC,GAAG,SAAS;EAChD,OAAO;GAAE,GAAG;GAAY,GAAG;GAAW,GAAG;GAAO,IAAA,GAAGC,yBAAAA,iBAAAA,CAAiB,IAAI;EAAE;EAC1E,GAAI;EALN,UAAA,CAOE,iBAAA,GAAA,kBAAA,KAAA,CAAC,OAAD;GACE,WAAWC,4BAAAA;GACX,SAAQ;GACR,MAAK;GACL,QAAO;GACP,aAAa;GACb,eAAc;GACd,eAAA;GACA,WAAU;GARZ,UAAA,CAUE,iBAAA,GAAA,kBAAA,IAAA,CAAC,UAAD;IAAQ,WAAWC,4BAAAA;IAAO,IAAG;IAAK,IAAG;IAAK,GAAE;GAAK,CAAA,GACjD,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD,EAAM,GAAE,sBAAuB,CAAA,CAC5B;EACL,CAAA,GAAA,iBAAA,GAAA,kBAAA,IAAA,CAAC,QAAD;GAAM,WAAWC,4BAAAA;GAAc,UAAA;EAAY,CAAA,CACvC;;AAEV,CACF;AAEA,eAAe,cAAc"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { resolveColor } from "../../styles/resolveColor.js";
|
|
2
1
|
import { processCSSProp } from "../../styles/cssProps.js";
|
|
2
|
+
import { cx } from "../../styles/cx.js";
|
|
3
|
+
import { resolveColor } from "../../styles/resolveColor.js";
|
|
3
4
|
import { useVanillaExtractTheme } from "../../styles/themeContext.js";
|
|
4
5
|
import { hiddenLabel, spinnerRecipe, svg, track } from "./Spinner.vanilla.css.js";
|
|
5
6
|
import { forwardRef } from "react";
|
|
@@ -13,7 +14,7 @@ var SpinnerVanilla = forwardRef(({ size, color, label = "Loading", className, cs
|
|
|
13
14
|
return /* @__PURE__ */ jsxs("span", {
|
|
14
15
|
ref,
|
|
15
16
|
role: "status",
|
|
16
|
-
className:
|
|
17
|
+
className: cx(spinnerRecipe({ size }), className),
|
|
17
18
|
style: {
|
|
18
19
|
...colorStyle,
|
|
19
20
|
...cssStyles,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.vanilla.js","names":[],"sources":["../../../components/Spinner/Spinner.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, { forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { resolveColor } from '../../styles/resolveColor';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { hiddenLabel, spinnerRecipe, svg, track } from './Spinner.vanilla.css';\n\nexport type SpinnerVanillaProps = Omit<\n React.HTMLAttributes<HTMLSpanElement>,\n 'children' | 'color'\n> &\n CSSProps & {\n size?: 'small' | 'medium' | 'large';\n /** A color token such as `$toneSuccessSolid` or `$gray11`, any CSS color, or `currentColor`. Defaults to primary. */\n color?: string;\n /** Announced to screen readers. */\n label?: string;\n };\n\nexport const SpinnerVanilla = forwardRef<HTMLSpanElement, SpinnerVanillaProps>(\n ({ size, color, label = 'Loading', className, css, style, ...props }, ref) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n const colorStyle = color ? { color: resolveColor(color, colors) } : undefined;\n\n return (\n <span\n ref={ref}\n role=\"status\"\n className={
|
|
1
|
+
{"version":3,"file":"Spinner.vanilla.js","names":[],"sources":["../../../components/Spinner/Spinner.vanilla.tsx"],"sourcesContent":["import { assignInlineVars } from '@vanilla-extract/dynamic';\nimport React, { forwardRef } from 'react';\n\nimport { CSSProps, processCSSProp } from '../../styles/cssProps';\nimport { cx } from '../../styles/cx';\nimport { resolveColor } from '../../styles/resolveColor';\nimport { useVanillaExtractTheme } from '../../styles/themeContext';\nimport { hiddenLabel, spinnerRecipe, svg, track } from './Spinner.vanilla.css';\n\nexport type SpinnerVanillaProps = Omit<\n React.HTMLAttributes<HTMLSpanElement>,\n 'children' | 'color'\n> &\n CSSProps & {\n size?: 'small' | 'medium' | 'large';\n /** A color token such as `$toneSuccessSolid` or `$gray11`, any CSS color, or `currentColor`. Defaults to primary. */\n color?: string;\n /** Announced to screen readers. */\n label?: string;\n };\n\nexport const SpinnerVanilla = forwardRef<HTMLSpanElement, SpinnerVanillaProps>(\n ({ size, color, label = 'Loading', className, css, style, ...props }, ref) => {\n const { colors } = useVanillaExtractTheme();\n const { style: cssStyles, vars } = processCSSProp(css, colors);\n const colorStyle = color ? { color: resolveColor(color, colors) } : undefined;\n\n return (\n <span\n ref={ref}\n role=\"status\"\n className={cx(spinnerRecipe({ size }), className)}\n style={{ ...colorStyle, ...cssStyles, ...style, ...assignInlineVars(vars) }}\n {...props}\n >\n <svg\n className={svg}\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n strokeWidth={2.5}\n strokeLinecap=\"round\"\n aria-hidden\n focusable=\"false\"\n >\n <circle className={track} cx=\"12\" cy=\"12\" r=\"9\" />\n <path d=\"M12 3a9 9 0 0 1 9 9\" />\n </svg>\n <span className={hiddenLabel}>{label}</span>\n </span>\n );\n },\n);\n\nSpinnerVanilla.displayName = 'SpinnerVanilla';\n"],"mappings":";;;;;;;;;AAqBA,IAAa,iBAAiB,YAC3B,EAAE,MAAM,OAAO,QAAQ,WAAW,WAAW,KAAK,OAAO,GAAG,SAAS,QAAQ;CAC5E,MAAM,EAAE,WAAW,uBAAuB;CAC1C,MAAM,EAAE,OAAO,WAAW,SAAS,eAAe,KAAK,MAAM;CAC7D,MAAM,aAAa,QAAQ,EAAE,OAAO,aAAa,OAAO,MAAM,EAAE,IAAI,KAAA;CAEpE,OACE,qBAAC,QAAD;EACO;EACL,MAAK;EACL,WAAW,GAAG,cAAc,EAAE,KAAK,CAAC,GAAG,SAAS;EAChD,OAAO;GAAE,GAAG;GAAY,GAAG;GAAW,GAAG;GAAO,GAAG,iBAAiB,IAAI;EAAE;EAC1E,GAAI;EALN,UAAA,CAOE,qBAAC,OAAD;GACE,WAAW;GACX,SAAQ;GACR,MAAK;GACL,QAAO;GACP,aAAa;GACb,eAAc;GACd,eAAA;GACA,WAAU;GARZ,UAAA,CAUE,oBAAC,UAAD;IAAQ,WAAW;IAAO,IAAG;IAAK,IAAG;IAAK,GAAE;GAAK,CAAA,GACjD,oBAAC,QAAD,EAAM,GAAE,sBAAuB,CAAA,CAC5B;EACL,CAAA,GAAA,oBAAC,QAAD;GAAM,WAAW;GAAc,UAAA;EAAY,CAAA,CACvC;;AAEV,CACF;AAEA,eAAe,cAAc"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
const require_runtime = require("../../_virtual/_rolldown/runtime.cjs");
|
|
2
2
|
const require_cssProps = require("../../styles/cssProps.cjs");
|
|
3
|
+
const require_cx = require("../../styles/cx.cjs");
|
|
3
4
|
const require_themeContext = require("../../styles/themeContext.cjs");
|
|
4
5
|
const require_Flex_vanilla = require("../Flex/Flex.vanilla.cjs");
|
|
5
6
|
const require_SplitLayout_vanilla_css = require("./SplitLayout.vanilla.css.cjs");
|
|
@@ -75,7 +76,7 @@ var SplitLayoutVanilla = (0, react.forwardRef)(({ breakpoint = 1024, className,
|
|
|
75
76
|
},
|
|
76
77
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
77
78
|
ref: setRefs,
|
|
78
|
-
className:
|
|
79
|
+
className: require_cx.cx(require_SplitLayout_vanilla_css.root, className),
|
|
79
80
|
"data-stacked": stacked ? "" : void 0,
|
|
80
81
|
style: {
|
|
81
82
|
...cssStyles,
|
|
@@ -97,7 +98,7 @@ var SplitLayoutMainVanilla = (0, react.forwardRef)(({ stickyTop, minWidth = DEFA
|
|
|
97
98
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Flex_vanilla.FlexVanilla, {
|
|
98
99
|
ref,
|
|
99
100
|
direction: "column",
|
|
100
|
-
className:
|
|
101
|
+
className: require_cx.cx(require_SplitLayout_vanilla_css.main, className),
|
|
101
102
|
css: {
|
|
102
103
|
...stickyCss(stacked, stickyTop),
|
|
103
104
|
...css
|
|
@@ -197,7 +198,7 @@ var SplitLayoutAsideVanilla = (0, react.forwardRef)(({ defaultWidth = 360, defau
|
|
|
197
198
|
ref,
|
|
198
199
|
id: paneId,
|
|
199
200
|
direction: "column",
|
|
200
|
-
className:
|
|
201
|
+
className: require_cx.cx(require_SplitLayout_vanilla_css.aside, className),
|
|
201
202
|
css: {
|
|
202
203
|
...stacked ? {} : { width },
|
|
203
204
|
...stickyCss(stacked, stickyTop),
|