@conductor-by-89soone/react 0.3.0 → 0.4.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/README.md +231 -0
- package/dist/action.js +62 -3
- package/dist/cx.js +10 -1
- package/dist/data.js +65 -2
- package/dist/feedback.js +65 -2
- package/dist/form.js +115 -2
- package/dist/index.d.ts +7 -1
- package/dist/index.js +70 -15
- package/dist/interaction.d.ts +37 -0
- package/dist/interaction.js +47 -0
- package/dist/overlay.js +227 -2
- package/dist/relation.d.ts +56 -0
- package/dist/relation.js +215 -0
- package/dist/shell.d.ts +7 -1
- package/dist/shell.js +158 -2
- package/dist/status.js +35 -2
- package/dist/stylesheet-warning.d.ts +8 -0
- package/dist/{chunk-WEIMKRZV.js → stylesheet-warning.js} +5 -13
- package/dist/surface.js +45 -2
- package/dist/types.js +0 -1
- package/dist/workbench.d.ts +125 -0
- package/dist/workbench.js +200 -0
- package/package.json +13 -5
- package/dist/chunk-3YDK2JBK.js +0 -103
- package/dist/chunk-535YGQAR.js +0 -32
- package/dist/chunk-G7TRTZRR.js +0 -60
- package/dist/chunk-MR7FIZKV.js +0 -221
- package/dist/chunk-NF3ZHADJ.js +0 -60
- package/dist/chunk-R5BLKHR2.js +0 -81
- package/dist/chunk-RBD5Z2LR.js +0 -58
- package/dist/chunk-TUHWL5JC.js +0 -42
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, Ref, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface SearchOption {
|
|
5
|
+
readonly id: string;
|
|
6
|
+
readonly label: string;
|
|
7
|
+
readonly disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface ComboboxProps extends Omit<HTMLAttributes<HTMLDivElement>, "onChange"> {
|
|
10
|
+
readonly label: string;
|
|
11
|
+
readonly options: readonly SearchOption[];
|
|
12
|
+
readonly value: string | null;
|
|
13
|
+
readonly query: string;
|
|
14
|
+
readonly onQueryChange: (query: string) => void;
|
|
15
|
+
readonly onValueChange: (id: string | null) => void;
|
|
16
|
+
readonly state?: "ready" | "loading" | "error";
|
|
17
|
+
/** Results must belong to the current query; stale batches are hidden. */
|
|
18
|
+
readonly resultsQuery?: string;
|
|
19
|
+
readonly disabled?: boolean;
|
|
20
|
+
readonly inputRef?: Ref<HTMLInputElement>;
|
|
21
|
+
}
|
|
22
|
+
declare const Combobox: react.ForwardRefExoticComponent<ComboboxProps & react.RefAttributes<HTMLDivElement>>;
|
|
23
|
+
interface FilterChipProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
24
|
+
readonly children: ReactNode;
|
|
25
|
+
readonly onRemove: () => void;
|
|
26
|
+
readonly removeLabel: string;
|
|
27
|
+
readonly disabled?: boolean;
|
|
28
|
+
}
|
|
29
|
+
declare const FilterChip: react.ForwardRefExoticComponent<FilterChipProps & react.RefAttributes<HTMLSpanElement>>;
|
|
30
|
+
interface MultiSelectProps extends HTMLAttributes<HTMLFieldSetElement> {
|
|
31
|
+
readonly label: string;
|
|
32
|
+
readonly options: readonly SearchOption[];
|
|
33
|
+
readonly value: readonly string[];
|
|
34
|
+
readonly onValueChange: (ids: readonly string[]) => void;
|
|
35
|
+
readonly disabled?: boolean;
|
|
36
|
+
}
|
|
37
|
+
declare const MultiSelect: react.ForwardRefExoticComponent<MultiSelectProps & react.RefAttributes<HTMLFieldSetElement>>;
|
|
38
|
+
declare const FilterToolbar: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & react.RefAttributes<HTMLDivElement>>;
|
|
39
|
+
interface DataColumn<Row> {
|
|
40
|
+
readonly id: string;
|
|
41
|
+
readonly header: string;
|
|
42
|
+
readonly cell: (row: Row) => ReactNode;
|
|
43
|
+
readonly sortable?: boolean;
|
|
44
|
+
readonly numeric?: boolean;
|
|
45
|
+
}
|
|
46
|
+
interface DataSort {
|
|
47
|
+
readonly column: string;
|
|
48
|
+
readonly direction: "ascending" | "descending";
|
|
49
|
+
}
|
|
50
|
+
interface DataTableProps<Row> extends Omit<HTMLAttributes<HTMLDivElement>, "onSelect"> {
|
|
51
|
+
readonly label: string;
|
|
52
|
+
readonly rows: readonly Row[];
|
|
53
|
+
readonly columns: readonly DataColumn<Row>[];
|
|
54
|
+
readonly rowId: (row: Row) => string;
|
|
55
|
+
readonly rowLabel: (row: Row) => string;
|
|
56
|
+
readonly selectedId?: string | null;
|
|
57
|
+
readonly onSelect?: (id: string, trigger: HTMLButtonElement) => void;
|
|
58
|
+
/** Parent sorts the full source or requests server ordering; this component never sorts. */
|
|
59
|
+
readonly sort?: DataSort;
|
|
60
|
+
readonly onSortChange?: (sort: DataSort) => void;
|
|
61
|
+
readonly visibleColumns?: readonly string[];
|
|
62
|
+
readonly density?: "comfortable" | "compact";
|
|
63
|
+
readonly state?: "ready" | "loading" | "error" | "partial";
|
|
64
|
+
readonly message?: string;
|
|
65
|
+
readonly hasMore?: boolean;
|
|
66
|
+
readonly onLoadMore?: () => void;
|
|
67
|
+
readonly loadingMore?: boolean;
|
|
68
|
+
}
|
|
69
|
+
declare const DataTable: <Row>(props: DataTableProps<Row> & {
|
|
70
|
+
readonly ref?: Ref<HTMLDivElement>;
|
|
71
|
+
}) => ReactNode;
|
|
72
|
+
interface WorkbenchLayoutProps extends HTMLAttributes<HTMLDivElement> {
|
|
73
|
+
readonly inspector?: ReactNode;
|
|
74
|
+
readonly width?: number;
|
|
75
|
+
readonly onWidthChange?: (width: number) => void;
|
|
76
|
+
}
|
|
77
|
+
declare const WorkbenchLayout: react.ForwardRefExoticComponent<WorkbenchLayoutProps & react.RefAttributes<HTMLDivElement>>;
|
|
78
|
+
interface DetailInspectorProps extends HTMLAttributes<HTMLElement> {
|
|
79
|
+
readonly label: string;
|
|
80
|
+
readonly onClose: () => void;
|
|
81
|
+
readonly returnFocusRef?: {
|
|
82
|
+
readonly current: HTMLElement | null;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
declare const DetailInspector: react.ForwardRefExoticComponent<DetailInspectorProps & react.RefAttributes<HTMLElement>>;
|
|
86
|
+
declare const Skeleton: react.ForwardRefExoticComponent<HTMLAttributes<HTMLDivElement> & {
|
|
87
|
+
readonly label: string;
|
|
88
|
+
} & react.RefAttributes<HTMLDivElement>>;
|
|
89
|
+
declare const Breadcrumb: react.ForwardRefExoticComponent<HTMLAttributes<HTMLElement> & react.RefAttributes<HTMLElement>>;
|
|
90
|
+
interface PathItem {
|
|
91
|
+
readonly id: string;
|
|
92
|
+
readonly label: string;
|
|
93
|
+
readonly children?: readonly PathItem[];
|
|
94
|
+
readonly state?: "loading" | "error";
|
|
95
|
+
}
|
|
96
|
+
interface PathListProps extends HTMLAttributes<HTMLUListElement> {
|
|
97
|
+
readonly items: readonly PathItem[];
|
|
98
|
+
readonly selectedId?: string;
|
|
99
|
+
readonly onPathSelect?: (id: string) => void;
|
|
100
|
+
}
|
|
101
|
+
declare const PathList: react.ForwardRefExoticComponent<PathListProps & react.RefAttributes<HTMLUListElement>>;
|
|
102
|
+
interface CopyButtonProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
103
|
+
readonly value: string;
|
|
104
|
+
readonly label?: string;
|
|
105
|
+
}
|
|
106
|
+
declare const CopyButton: react.ForwardRefExoticComponent<CopyButtonProps & react.RefAttributes<HTMLSpanElement>>;
|
|
107
|
+
interface ProcessingStage {
|
|
108
|
+
readonly id: string;
|
|
109
|
+
readonly label: string;
|
|
110
|
+
readonly status: "complete" | "pending" | "delayed" | "failed" | "unknown";
|
|
111
|
+
readonly detail: string;
|
|
112
|
+
readonly action?: {
|
|
113
|
+
readonly label: string;
|
|
114
|
+
readonly onAction: () => void;
|
|
115
|
+
readonly disabledReason?: string;
|
|
116
|
+
readonly busy?: boolean;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
interface ProcessingStatusProps extends HTMLAttributes<HTMLDivElement> {
|
|
120
|
+
readonly stages: readonly ProcessingStage[];
|
|
121
|
+
readonly label: string;
|
|
122
|
+
}
|
|
123
|
+
declare const ProcessingStatus: react.ForwardRefExoticComponent<ProcessingStatusProps & react.RefAttributes<HTMLDivElement>>;
|
|
124
|
+
|
|
125
|
+
export { Breadcrumb, Combobox, type ComboboxProps, CopyButton, type CopyButtonProps, type DataColumn, type DataSort, DataTable, type DataTableProps, DetailInspector, type DetailInspectorProps, FilterChip, type FilterChipProps, FilterToolbar, MultiSelect, type MultiSelectProps, type PathItem, PathList, type PathListProps, type ProcessingStage, ProcessingStatus, type ProcessingStatusProps, type SearchOption, Skeleton, WorkbenchLayout, type WorkbenchLayoutProps };
|
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
"use client";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
4
|
+
import { createElement } from "react";
|
|
5
|
+
import { forwardRef, useEffect, useId, useRef, useState } from "react";
|
|
6
|
+
import { useCombobox } from "downshift";
|
|
7
|
+
import { Button } from "./action.js";
|
|
8
|
+
import { Checkbox, TextField } from "./form.js";
|
|
9
|
+
import { Table, Timeline } from "./data.js";
|
|
10
|
+
import { Banner, EmptyState } from "./feedback.js";
|
|
11
|
+
import { Badge } from "./status.js";
|
|
12
|
+
import { cx } from "./cx.js";
|
|
13
|
+
const Combobox = /* @__PURE__ */ forwardRef(function Combobox2({ label, options, value, query, onQueryChange, onValueChange, state = "ready", resultsQuery = query, disabled, inputRef, className, ...props }, ref) {
|
|
14
|
+
const uid = useId();
|
|
15
|
+
const composing = useRef(false);
|
|
16
|
+
const items = !disabled && state === "ready" && resultsQuery === query ? [...options] : [];
|
|
17
|
+
const combo = useCombobox({
|
|
18
|
+
id: uid,
|
|
19
|
+
items,
|
|
20
|
+
inputValue: query,
|
|
21
|
+
selectedItem: options.find((item) => item.id === value) ?? null,
|
|
22
|
+
itemToString: (item) => item?.label ?? "",
|
|
23
|
+
isItemDisabled: (item) => !!item.disabled,
|
|
24
|
+
onInputValueChange: (changes) => {
|
|
25
|
+
if (changes.type === useCombobox.stateChangeTypes.InputChange) onQueryChange(changes.inputValue);
|
|
26
|
+
},
|
|
27
|
+
onSelectedItemChange: (changes) => onValueChange(changes.selectedItem?.id ?? null)
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ jsxs("div", { ...props, ref, className: cx("cdt-combobox", className), children: [
|
|
30
|
+
/* @__PURE__ */ jsx("label", { ...combo.getLabelProps(), children: label }),
|
|
31
|
+
/* @__PURE__ */ jsx(TextField, { ...combo.getInputProps({ disabled, ref: inputRef, onCompositionStart: () => {
|
|
32
|
+
composing.current = true;
|
|
33
|
+
}, onCompositionEnd: () => {
|
|
34
|
+
composing.current = false;
|
|
35
|
+
}, onKeyDown: (event) => {
|
|
36
|
+
if (composing.current || event.nativeEvent.isComposing || event.keyCode === 229) {
|
|
37
|
+
event.nativeEvent.preventDownshiftDefault = true;
|
|
38
|
+
event.preventDownshiftDefault = true;
|
|
39
|
+
if (event.key === "Enter") event.preventDefault();
|
|
40
|
+
}
|
|
41
|
+
} }) }),
|
|
42
|
+
/* @__PURE__ */ jsx("ul", { ...combo.getMenuProps(), className: "cdt-combobox__options", hidden: !combo.isOpen || disabled, children: combo.isOpen && items.map((item, index) => /* @__PURE__ */ createElement("li", { ...combo.getItemProps({ item, index }), key: item.id, "data-highlighted": combo.highlightedIndex === index || void 0 }, item.label)) }),
|
|
43
|
+
/* @__PURE__ */ jsx("span", { role: "status", children: state === "loading" || resultsQuery !== query ? "\uC635\uC158 \uBD88\uB7EC\uC624\uB294 \uC911" : state === "error" ? "\uC635\uC158\uC744 \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4" : combo.isOpen && items.length === 0 ? "\uC635\uC158 \uC5C6\uC74C" : "" })
|
|
44
|
+
] });
|
|
45
|
+
});
|
|
46
|
+
const FilterChip = /* @__PURE__ */ forwardRef(function FilterChip2({ children, onRemove, removeLabel, disabled, className, ...props }, ref) {
|
|
47
|
+
return /* @__PURE__ */ jsxs("span", { ...props, ref, className: cx("cdt-filter-chip", className), children: [
|
|
48
|
+
children,
|
|
49
|
+
/* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", "aria-label": removeLabel, disabled, onClick: onRemove, children: "\xD7" })
|
|
50
|
+
] });
|
|
51
|
+
});
|
|
52
|
+
const MultiSelect = /* @__PURE__ */ forwardRef(function MultiSelect2({ label, options, value, onValueChange, disabled, className, ...props }, ref) {
|
|
53
|
+
const [query, setQuery] = useState("");
|
|
54
|
+
const searchId = useId();
|
|
55
|
+
return /* @__PURE__ */ jsxs("fieldset", { ...props, ref, disabled, className: cx("cdt-multi-select", className), children: [
|
|
56
|
+
/* @__PURE__ */ jsx("legend", { children: label }),
|
|
57
|
+
/* @__PURE__ */ jsx("label", { htmlFor: searchId, children: "\uC635\uC158 \uCC3E\uAE30" }),
|
|
58
|
+
/* @__PURE__ */ jsx(TextField, { id: searchId, "aria-label": `${label} \uC635\uC158 \uCC3E\uAE30`, value: query, disabled, onChange: (event) => setQuery(event.target.value) }),
|
|
59
|
+
/* @__PURE__ */ jsx("div", { className: "cdt-filter-toolbar", children: options.filter((option) => value.includes(option.id)).map((option) => /* @__PURE__ */ jsx(FilterChip, { disabled: disabled || option.disabled, removeLabel: `${option.label} \uC81C\uAC70`, onRemove: () => onValueChange(value.filter((id) => id !== option.id)), children: option.label }, option.id)) }),
|
|
60
|
+
/* @__PURE__ */ jsx("ul", { children: options.filter((option) => option.label.toLocaleLowerCase().includes(query.toLocaleLowerCase())).map((option) => /* @__PURE__ */ jsx("li", { children: /* @__PURE__ */ jsxs("label", { children: [
|
|
61
|
+
/* @__PURE__ */ jsx(Checkbox, { disabled: disabled || option.disabled, checked: value.includes(option.id), onCheckedChange: (checked) => onValueChange(checked ? [...value, option.id] : value.filter((id) => id !== option.id)) }),
|
|
62
|
+
option.label
|
|
63
|
+
] }) }, option.id)) })
|
|
64
|
+
] });
|
|
65
|
+
});
|
|
66
|
+
const FilterToolbar = /* @__PURE__ */ forwardRef(function FilterToolbar2({ className, ...props }, ref) {
|
|
67
|
+
return /* @__PURE__ */ jsx("div", { ...props, ref, className: cx("cdt-filter-toolbar", className) });
|
|
68
|
+
});
|
|
69
|
+
function DataTableRoot({ label, rows, columns, rowId, rowLabel, selectedId, onSelect, sort, onSortChange, visibleColumns, density = "comfortable", state = "ready", message, hasMore, onLoadMore, loadingMore, className, ...props }, ref) {
|
|
70
|
+
const shown = columns.filter((column) => visibleColumns === void 0 || visibleColumns.includes(column.id));
|
|
71
|
+
return /* @__PURE__ */ jsxs("div", { ...props, ref, className: cx("cdt-data-table", className), "data-density": density, "aria-busy": state === "loading" || loadingMore || void 0, children: [
|
|
72
|
+
state === "error" || state === "partial" ? /* @__PURE__ */ jsx(Banner, { tone: "warning", children: message ?? (state === "error" ? "\uACB0\uACFC\uB97C \uBD88\uB7EC\uC624\uC9C0 \uBABB\uD588\uC2B5\uB2C8\uB2E4" : "\uC77C\uBD80 \uACB0\uACFC\uB9CC \uD45C\uC2DC\uD569\uB2C8\uB2E4") }) : null,
|
|
73
|
+
/* @__PURE__ */ jsxs(Table, { caption: label, children: [
|
|
74
|
+
/* @__PURE__ */ jsx(Table.Head, { children: /* @__PURE__ */ jsxs(Table.Row, { children: [
|
|
75
|
+
onSelect && /* @__PURE__ */ jsx(Table.HeaderCell, { children: "\uBBF8\uB9AC\uBCF4\uAE30" }),
|
|
76
|
+
shown.map((column) => /* @__PURE__ */ jsx(Table.HeaderCell, { "aria-sort": sort?.column === column.id ? sort.direction : void 0, children: column.sortable && onSortChange ? /* @__PURE__ */ jsxs(Button, { variant: "ghost", size: "sm", onClick: () => onSortChange({ column: column.id, direction: sort?.column === column.id && sort.direction === "ascending" ? "descending" : "ascending" }), children: [
|
|
77
|
+
column.header,
|
|
78
|
+
sort?.column === column.id ? sort.direction === "ascending" ? " \u2191" : " \u2193" : " \u2195"
|
|
79
|
+
] }) : column.header }, column.id))
|
|
80
|
+
] }) }),
|
|
81
|
+
/* @__PURE__ */ jsxs(Table.Body, { children: [
|
|
82
|
+
state !== "loading" && rows.map((row) => /* @__PURE__ */ jsxs(Table.Row, { "data-selected": selectedId === rowId(row) || void 0, children: [
|
|
83
|
+
onSelect && /* @__PURE__ */ jsx(Table.Cell, { children: /* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", "aria-label": `${rowLabel(row)} \uBBF8\uB9AC\uBCF4\uAE30`, "aria-pressed": selectedId === rowId(row), onClick: (event) => onSelect(rowId(row), event.currentTarget), children: "\uC120\uD0DD" }) }),
|
|
84
|
+
shown.map((column) => /* @__PURE__ */ jsx(Table.Cell, { numeric: column.numeric, children: column.cell(row) }, column.id))
|
|
85
|
+
] }, rowId(row))),
|
|
86
|
+
(state === "loading" || rows.length === 0) && /* @__PURE__ */ jsx(Table.Row, { children: /* @__PURE__ */ jsx(Table.Cell, { colSpan: shown.length + (onSelect ? 1 : 0), children: state === "loading" ? /* @__PURE__ */ jsx(Skeleton, { label: "\uACB0\uACFC \uBD88\uB7EC\uC624\uB294 \uC911" }) : /* @__PURE__ */ jsx(EmptyState, { title: state === "error" ? "\uC870\uD68C \uC2E4\uD328" : "\uAC80\uC0C9 \uACB0\uACFC \uC5C6\uC74C" }) }) })
|
|
87
|
+
] })
|
|
88
|
+
] }),
|
|
89
|
+
/* @__PURE__ */ jsxs("div", { className: "cdt-filter-toolbar", children: [
|
|
90
|
+
/* @__PURE__ */ jsxs("span", { role: "status", children: [
|
|
91
|
+
"\uD604\uC7AC \uB85C\uB4DC\uB41C ",
|
|
92
|
+
state === "loading" ? 0 : rows.length,
|
|
93
|
+
"\uAC1C"
|
|
94
|
+
] }),
|
|
95
|
+
hasMore && onLoadMore ? /* @__PURE__ */ jsx(Button, { onClick: onLoadMore, loading: loadingMore, disabled: state === "loading", children: "\uC774\uC5B4 \uBCF4\uAE30" }) : null
|
|
96
|
+
] })
|
|
97
|
+
] });
|
|
98
|
+
}
|
|
99
|
+
const DataTable = /* @__PURE__ */ forwardRef(DataTableRoot);
|
|
100
|
+
const WorkbenchLayout = /* @__PURE__ */ forwardRef(function WorkbenchLayout2({ inspector, width = 40, onWidthChange, children, className, style, ...props }, ref) {
|
|
101
|
+
return /* @__PURE__ */ jsxs("div", { ...props, ref, style: { ...style, "--cdt-workbench-inspector-share": `${Math.max(25, Math.min(60, width))}%` }, className: cx("cdt-workbench", className), "data-inspecting": !!inspector || void 0, children: [
|
|
102
|
+
/* @__PURE__ */ jsx("div", { className: "cdt-workbench__results", children }),
|
|
103
|
+
inspector && /* @__PURE__ */ jsxs("div", { className: "cdt-workbench__inspector", children: [
|
|
104
|
+
onWidthChange && /* @__PURE__ */ jsxs("label", { className: "cdt-workbench__resize", children: [
|
|
105
|
+
"\uBBF8\uB9AC\uBCF4\uAE30 \uD3ED ",
|
|
106
|
+
/* @__PURE__ */ jsx("input", { type: "range", min: 25, max: 60, value: width, onChange: (event) => onWidthChange(Number(event.target.value)) })
|
|
107
|
+
] }),
|
|
108
|
+
inspector
|
|
109
|
+
] })
|
|
110
|
+
] });
|
|
111
|
+
});
|
|
112
|
+
const DetailInspector = /* @__PURE__ */ forwardRef(function DetailInspector2({ label, onClose, returnFocusRef, className, children, onKeyDown, ...props }, ref) {
|
|
113
|
+
const close = () => {
|
|
114
|
+
onClose();
|
|
115
|
+
returnFocusRef?.current?.focus({ preventScroll: true });
|
|
116
|
+
};
|
|
117
|
+
return /* @__PURE__ */ jsxs("section", { ...props, ref, "aria-label": props["aria-label"] ?? label, className: cx("cdt-detail-inspector", className), onKeyDown: (event) => {
|
|
118
|
+
onKeyDown?.(event);
|
|
119
|
+
if (!event.defaultPrevented && event.key === "Escape") {
|
|
120
|
+
event.preventDefault();
|
|
121
|
+
close();
|
|
122
|
+
}
|
|
123
|
+
}, children: [
|
|
124
|
+
/* @__PURE__ */ jsxs("header", { children: [
|
|
125
|
+
/* @__PURE__ */ jsx("h2", { children: label }),
|
|
126
|
+
/* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", onClick: close, children: "\uBBF8\uB9AC\uBCF4\uAE30 \uB2EB\uAE30" })
|
|
127
|
+
] }),
|
|
128
|
+
children
|
|
129
|
+
] });
|
|
130
|
+
});
|
|
131
|
+
const Skeleton = /* @__PURE__ */ forwardRef(function Skeleton2({ label, className, ...props }, ref) {
|
|
132
|
+
return /* @__PURE__ */ jsx("div", { ...props, ref, role: "status", className: cx("cdt-skeleton", className), children: label });
|
|
133
|
+
});
|
|
134
|
+
const Breadcrumb = /* @__PURE__ */ forwardRef(function Breadcrumb2({ className, "aria-label": label = "\uACBD\uB85C", ...props }, ref) {
|
|
135
|
+
return /* @__PURE__ */ jsx("nav", { ...props, ref, "aria-label": label, className: cx("cdt-breadcrumb", className) });
|
|
136
|
+
});
|
|
137
|
+
const PathList = /* @__PURE__ */ forwardRef(function PathListRoot({ items, selectedId, onPathSelect, className, ...props }, ref) {
|
|
138
|
+
return /* @__PURE__ */ jsx("ul", { ...props, ref, className: cx("cdt-path-list", className), children: items.map((item) => /* @__PURE__ */ jsxs("li", { children: [
|
|
139
|
+
item.children !== void 0 ? /* @__PURE__ */ jsxs("details", { children: [
|
|
140
|
+
/* @__PURE__ */ jsx("summary", { children: item.label }),
|
|
141
|
+
/* @__PURE__ */ jsx(PathList, { items: item.children, selectedId, onPathSelect })
|
|
142
|
+
] }) : /* @__PURE__ */ jsx(Button, { variant: "ghost", size: "sm", "aria-pressed": selectedId === item.id, onClick: () => onPathSelect?.(item.id), disabled: !onPathSelect, children: item.label }),
|
|
143
|
+
item.state && /* @__PURE__ */ jsx("span", { role: "status", children: item.state === "loading" ? "\uACBD\uB85C \uBD88\uB7EC\uC624\uB294 \uC911" : "\uACBD\uB85C \uC870\uD68C \uC2E4\uD328" })
|
|
144
|
+
] }, item.id)) });
|
|
145
|
+
});
|
|
146
|
+
const CopyButton = /* @__PURE__ */ forwardRef(function CopyButton2({ value, label = "\uBCF5\uC0AC", className, ...props }, ref) {
|
|
147
|
+
const [result, setResult] = useState(null);
|
|
148
|
+
const generation = useRef(0);
|
|
149
|
+
useEffect(() => {
|
|
150
|
+
++generation.current;
|
|
151
|
+
setResult(null);
|
|
152
|
+
return () => {
|
|
153
|
+
++generation.current;
|
|
154
|
+
};
|
|
155
|
+
}, [value]);
|
|
156
|
+
return /* @__PURE__ */ jsxs("span", { ...props, ref, className: cx("cdt-copy-feedback", className), children: [
|
|
157
|
+
/* @__PURE__ */ jsx(Button, { size: "sm", variant: "ghost", onClick: () => {
|
|
158
|
+
const mine = ++generation.current;
|
|
159
|
+
const write = typeof navigator !== "undefined" ? navigator.clipboard?.writeText(value) : void 0;
|
|
160
|
+
if (!write) {
|
|
161
|
+
setResult({ value, text: "\uBCF5\uC0AC \uBD88\uAC00 \xB7 \uD14D\uC2A4\uD2B8\uB97C \uC120\uD0DD\uD574 \uBCF5\uC0AC\uD558\uC138\uC694" });
|
|
162
|
+
return;
|
|
163
|
+
}
|
|
164
|
+
void write.then(() => {
|
|
165
|
+
if (mine === generation.current) setResult({ value, text: "\uBCF5\uC0AC\uD588\uC2B5\uB2C8\uB2E4" });
|
|
166
|
+
}, () => {
|
|
167
|
+
if (mine === generation.current) setResult({ value, text: "\uBCF5\uC0AC \uC2E4\uD328 \xB7 \uD14D\uC2A4\uD2B8\uB97C \uC120\uD0DD\uD574 \uBCF5\uC0AC\uD558\uC138\uC694" });
|
|
168
|
+
});
|
|
169
|
+
}, children: label }),
|
|
170
|
+
/* @__PURE__ */ jsx("span", { role: "status", children: result?.value === value ? result.text : "" })
|
|
171
|
+
] });
|
|
172
|
+
});
|
|
173
|
+
const ProcessingStatus = /* @__PURE__ */ forwardRef(function ProcessingStatus2({ stages, label, className, ...props }, ref) {
|
|
174
|
+
const labels = { complete: "\uD655\uC778\uB428", pending: "\uB300\uAE30", delayed: "\uC9C0\uC5F0", failed: "\uC2E4\uD328", unknown: "\uBBF8\uD655\uC778" };
|
|
175
|
+
return /* @__PURE__ */ jsx("div", { ...props, ref, className: cx("cdt-processing-status", className), children: /* @__PURE__ */ jsx(Timeline, { "aria-label": label, children: stages.map((stage) => /* @__PURE__ */ jsxs(Timeline.Step, { children: [
|
|
176
|
+
/* @__PURE__ */ jsxs("div", { className: "cdt-filter-toolbar", children: [
|
|
177
|
+
/* @__PURE__ */ jsx("strong", { children: stage.label }),
|
|
178
|
+
/* @__PURE__ */ jsx(Badge, { children: labels[stage.status] })
|
|
179
|
+
] }),
|
|
180
|
+
/* @__PURE__ */ jsx("p", { children: stage.detail }),
|
|
181
|
+
stage.action && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
182
|
+
/* @__PURE__ */ jsx(Button, { loading: stage.action.busy, blockedReason: stage.action.disabledReason, onClick: stage.action.onAction, children: stage.action.label }),
|
|
183
|
+
stage.action.disabledReason && /* @__PURE__ */ jsx("p", { children: stage.action.disabledReason })
|
|
184
|
+
] })
|
|
185
|
+
] }, stage.id)) }) });
|
|
186
|
+
});
|
|
187
|
+
export {
|
|
188
|
+
Breadcrumb,
|
|
189
|
+
Combobox,
|
|
190
|
+
CopyButton,
|
|
191
|
+
DataTable,
|
|
192
|
+
DetailInspector,
|
|
193
|
+
FilterChip,
|
|
194
|
+
FilterToolbar,
|
|
195
|
+
MultiSelect,
|
|
196
|
+
PathList,
|
|
197
|
+
ProcessingStatus,
|
|
198
|
+
Skeleton,
|
|
199
|
+
WorkbenchLayout
|
|
200
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@conductor-by-89soone/react",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.4.0",
|
|
4
4
|
"description": "Accessible React primitives for Conductor.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://89sooner.github.io/design-system/",
|
|
@@ -25,17 +25,25 @@
|
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
26
|
"import": "./dist/index.js"
|
|
27
27
|
},
|
|
28
|
-
"./package.json": "./package.json"
|
|
28
|
+
"./package.json": "./package.json",
|
|
29
|
+
"./relation": {
|
|
30
|
+
"types": "./dist/relation.d.ts",
|
|
31
|
+
"import": "./dist/relation.js"
|
|
32
|
+
}
|
|
29
33
|
},
|
|
30
34
|
"dependencies": {
|
|
31
|
-
"@radix-ui/react-dialog": "1.1.19",
|
|
32
35
|
"@radix-ui/react-checkbox": "1.3.2",
|
|
36
|
+
"@radix-ui/react-collapsible": "1.1.20",
|
|
37
|
+
"@radix-ui/react-dialog": "1.1.19",
|
|
33
38
|
"@radix-ui/react-dropdown-menu": "2.1.20",
|
|
39
|
+
"@radix-ui/react-popover": "1.1.23",
|
|
34
40
|
"@radix-ui/react-select": "2.2.5",
|
|
35
41
|
"@radix-ui/react-switch": "1.2.5",
|
|
42
|
+
"@radix-ui/react-tabs": "1.1.21",
|
|
36
43
|
"@radix-ui/react-tooltip": "1.2.12",
|
|
37
|
-
"
|
|
38
|
-
"@conductor-by-89soone/
|
|
44
|
+
"downshift": "9.4.0",
|
|
45
|
+
"@conductor-by-89soone/css": "0.4.0",
|
|
46
|
+
"@conductor-by-89soone/tokens": "0.4.0"
|
|
39
47
|
},
|
|
40
48
|
"peerDependencies": {
|
|
41
49
|
"lucide-react": ">=0.400.0 <2",
|
package/dist/chunk-3YDK2JBK.js
DELETED
|
@@ -1,103 +0,0 @@
|
|
|
1
|
-
import { cx } from './chunk-WEIMKRZV.js';
|
|
2
|
-
import * as RadixCheckbox from '@radix-ui/react-checkbox';
|
|
3
|
-
import * as RadixSelect from '@radix-ui/react-select';
|
|
4
|
-
import * as RadixSwitch from '@radix-ui/react-switch';
|
|
5
|
-
import { createContext, forwardRef, useId, useContext, useEffect } from 'react';
|
|
6
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
7
|
-
|
|
8
|
-
var FieldContext = createContext(null);
|
|
9
|
-
function joinDescribedBy(...ids) {
|
|
10
|
-
const result = ids.filter((id) => id !== void 0).join(" ");
|
|
11
|
-
return result === "" ? void 0 : result;
|
|
12
|
-
}
|
|
13
|
-
function useFieldControl(invalid, describedBy) {
|
|
14
|
-
const field = useContext(FieldContext);
|
|
15
|
-
return {
|
|
16
|
-
id: field?.id ?? "",
|
|
17
|
-
descriptionId: field?.descriptionId,
|
|
18
|
-
errorId: field?.errorId,
|
|
19
|
-
invalid: invalid ?? field?.invalid ?? false,
|
|
20
|
-
required: field?.required ?? false,
|
|
21
|
-
describedBy: joinDescribedBy(describedBy, field?.descriptionId, field?.errorId)
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
var Field = forwardRef(function Field2({ children, className, description, error, id: providedId, label, required = false, ...props }, ref) {
|
|
25
|
-
const generatedId = useId();
|
|
26
|
-
const id = providedId ?? generatedId;
|
|
27
|
-
const descriptionId = description === void 0 ? void 0 : `${id}-description`;
|
|
28
|
-
const errorId = error === void 0 ? void 0 : `${id}-error`;
|
|
29
|
-
const invalid = error !== void 0;
|
|
30
|
-
return /* @__PURE__ */ jsx(FieldContext.Provider, { value: { id, descriptionId, errorId, invalid, required }, children: /* @__PURE__ */ jsxs("div", { ...props, ref, className: cx("cdt-field", className), children: [
|
|
31
|
-
/* @__PURE__ */ jsxs("label", { className: "cdt-field__label", htmlFor: id, children: [
|
|
32
|
-
label,
|
|
33
|
-
required ? /* @__PURE__ */ jsx("span", { className: "cdt-field__required", "aria-hidden": "true", children: "*" }) : null
|
|
34
|
-
] }),
|
|
35
|
-
description === void 0 ? null : /* @__PURE__ */ jsx("div", { id: descriptionId, className: "cdt-field__description", children: description }),
|
|
36
|
-
children,
|
|
37
|
-
error === void 0 ? null : /* @__PURE__ */ jsx("div", { id: errorId, className: "cdt-field__error", children: error })
|
|
38
|
-
] }) });
|
|
39
|
-
});
|
|
40
|
-
Field.displayName = "Field";
|
|
41
|
-
function useMissingLabelWarning(name, hasField, ariaLabel, ariaLabelledBy) {
|
|
42
|
-
useEffect(() => {
|
|
43
|
-
if (process.env.NODE_ENV !== "production" && !hasField && ariaLabel === void 0 && ariaLabelledBy === void 0) {
|
|
44
|
-
console.warn(`[conductor] ${name} requires Field, aria-label, or aria-labelledby.`);
|
|
45
|
-
}
|
|
46
|
-
}, [ariaLabel, ariaLabelledBy, hasField, name]);
|
|
47
|
-
}
|
|
48
|
-
var TextField = forwardRef(function TextField2({ "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, iconStart, id: ownId, invalid, required, size = "md", variant = "solid", ...props }, ref) {
|
|
49
|
-
const field = useContext(FieldContext);
|
|
50
|
-
const control = useFieldControl(invalid, ariaDescribedBy);
|
|
51
|
-
useMissingLabelWarning("TextField", field !== null, ariaLabel, ariaLabelledBy);
|
|
52
|
-
const input = /* @__PURE__ */ jsx("input", { ...props, ref, id: ownId ?? (field === null ? void 0 : control.id), "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": control.describedBy, "aria-invalid": ariaInvalid ?? (control.invalid || void 0), required: required ?? control.required, className: cx("cdt-input", variant === "glass" && "cdt-input--glass", size === "sm" && "cdt-input--sm", control.invalid && "cdt-input--invalid", iconStart !== void 0 && "cdt-input--icon-start", className) });
|
|
53
|
-
return iconStart === void 0 ? input : /* @__PURE__ */ jsxs("span", { className: "cdt-input-wrap", children: [
|
|
54
|
-
/* @__PURE__ */ jsx("span", { className: "cdt-input__icon", "aria-hidden": "true", children: iconStart }),
|
|
55
|
-
input
|
|
56
|
-
] });
|
|
57
|
-
});
|
|
58
|
-
TextField.displayName = "TextField";
|
|
59
|
-
var TextArea = forwardRef(function TextArea2({ "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, className, id: ownId, invalid, required, rows = 3, variant = "solid", ...props }, ref) {
|
|
60
|
-
const field = useContext(FieldContext);
|
|
61
|
-
const control = useFieldControl(invalid, ariaDescribedBy);
|
|
62
|
-
useMissingLabelWarning("TextArea", field !== null, ariaLabel, ariaLabelledBy);
|
|
63
|
-
return /* @__PURE__ */ jsx("textarea", { ...props, ref, id: ownId ?? (field === null ? void 0 : control.id), rows, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": control.describedBy, "aria-invalid": ariaInvalid ?? (control.invalid || void 0), required: required ?? control.required, className: cx("cdt-textarea", variant === "glass" && "cdt-textarea--glass", control.invalid && "cdt-textarea--invalid", className) });
|
|
64
|
-
});
|
|
65
|
-
TextArea.displayName = "TextArea";
|
|
66
|
-
var SelectTrigger = forwardRef(function SelectTrigger2({ "aria-describedby": ariaDescribedBy, "aria-invalid": ariaInvalid, "aria-required": ariaRequired, className, id: ownId, invalid, size = "md", ...props }, ref) {
|
|
67
|
-
const field = useContext(FieldContext);
|
|
68
|
-
const control = useFieldControl(invalid, ariaDescribedBy);
|
|
69
|
-
const requiredAttribute = ariaRequired ?? (control.required ? true : void 0);
|
|
70
|
-
return /* @__PURE__ */ jsx(RadixSelect.Trigger, { ...props, ref, id: ownId ?? (field === null ? void 0 : control.id), "aria-describedby": control.describedBy, "aria-invalid": ariaInvalid ?? (control.invalid || void 0), ...requiredAttribute === void 0 ? {} : { "aria-required": requiredAttribute }, className: cx("cdt-select__trigger", size === "sm" && "cdt-select__trigger--sm", control.invalid && "cdt-select__trigger--invalid", className) });
|
|
71
|
-
});
|
|
72
|
-
SelectTrigger.displayName = "Select.Trigger";
|
|
73
|
-
var SelectContent = forwardRef(function SelectContent2({ children, className, ...props }, ref) {
|
|
74
|
-
return /* @__PURE__ */ jsx(RadixSelect.Portal, { children: /* @__PURE__ */ jsx(RadixSelect.Content, { ...props, ref, className: cx("cdt-select__content", className), children: /* @__PURE__ */ jsx(RadixSelect.Viewport, { children }) }) });
|
|
75
|
-
});
|
|
76
|
-
SelectContent.displayName = "Select.Content";
|
|
77
|
-
var SelectItem = forwardRef(function SelectItem2({ children, className, indicator = "\u2713", ...props }, ref) {
|
|
78
|
-
return /* @__PURE__ */ jsxs(RadixSelect.Item, { ...props, ref, className: cx("cdt-select__item", className), children: [
|
|
79
|
-
/* @__PURE__ */ jsx(RadixSelect.ItemText, { children }),
|
|
80
|
-
/* @__PURE__ */ jsx(RadixSelect.ItemIndicator, { className: "cdt-select__indicator", "aria-hidden": "true", children: indicator })
|
|
81
|
-
] });
|
|
82
|
-
});
|
|
83
|
-
SelectItem.displayName = "Select.Item";
|
|
84
|
-
function SelectRoot({ required, ...props }) {
|
|
85
|
-
const field = useContext(FieldContext);
|
|
86
|
-
return /* @__PURE__ */ jsx(RadixSelect.Root, { ...props, required: required ?? field?.required });
|
|
87
|
-
}
|
|
88
|
-
SelectRoot.displayName = "Select.Root";
|
|
89
|
-
var Select = { Root: SelectRoot, Trigger: SelectTrigger, Value: RadixSelect.Value, Content: SelectContent, Item: SelectItem, Group: RadixSelect.Group, Label: RadixSelect.Label };
|
|
90
|
-
var Switch = forwardRef(function Switch2({ className, ...props }, ref) {
|
|
91
|
-
const field = useContext(FieldContext);
|
|
92
|
-
const control = useFieldControl(void 0, props["aria-describedby"]);
|
|
93
|
-
return /* @__PURE__ */ jsx(RadixSwitch.Root, { ...props, ref, id: props.id ?? (field === null ? void 0 : control.id), "aria-describedby": control.describedBy, "aria-invalid": control.invalid || void 0, required: props.required ?? control.required, className: cx("cdt-switch", control.invalid && "cdt-switch--invalid", className), children: /* @__PURE__ */ jsx(RadixSwitch.Thumb, { className: "cdt-switch__thumb" }) });
|
|
94
|
-
});
|
|
95
|
-
Switch.displayName = "Switch";
|
|
96
|
-
var Checkbox = forwardRef(function Checkbox2({ className, indicator = "\u2713", ...props }, ref) {
|
|
97
|
-
const field = useContext(FieldContext);
|
|
98
|
-
const control = useFieldControl(void 0, props["aria-describedby"]);
|
|
99
|
-
return /* @__PURE__ */ jsx(RadixCheckbox.Root, { ...props, ref, id: props.id ?? (field === null ? void 0 : control.id), "aria-describedby": control.describedBy, "aria-invalid": control.invalid || void 0, required: props.required ?? control.required, className: cx("cdt-checkbox", control.invalid && "cdt-checkbox--invalid", className), children: /* @__PURE__ */ jsx(RadixCheckbox.Indicator, { className: "cdt-checkbox__indicator", "aria-hidden": "true", children: indicator }) });
|
|
100
|
-
});
|
|
101
|
-
Checkbox.displayName = "Checkbox";
|
|
102
|
-
|
|
103
|
-
export { Checkbox, Field, Select, Switch, TextArea, TextField };
|
package/dist/chunk-535YGQAR.js
DELETED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { cx } from './chunk-WEIMKRZV.js';
|
|
2
|
-
import { STATUS_ICONS, SEVERITY_ICONS } from '@conductor-by-89soone/tokens';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
var Badge = forwardRef(function Badge2({ children, className, icon, tone = "neutral", ...props }, ref) {
|
|
7
|
-
return /* @__PURE__ */ jsxs("span", { ...props, ref, className: cx("cdt-badge", `cdt-badge--${tone}`, className), children: [
|
|
8
|
-
icon === void 0 ? null : /* @__PURE__ */ jsx("span", { className: "cdt-badge__icon", "aria-hidden": "true", children: icon }),
|
|
9
|
-
children
|
|
10
|
-
] });
|
|
11
|
-
});
|
|
12
|
-
Badge.displayName = "Badge";
|
|
13
|
-
var markerStatuses = ["queued", "neutralEnd"];
|
|
14
|
-
var StatusBadge = forwardRef(function StatusBadge2({ className, icon, label, status, ...props }, ref) {
|
|
15
|
-
const isMarker = markerStatuses.includes(status);
|
|
16
|
-
const statusClass = status === "neutralEnd" ? "neutral-end" : status;
|
|
17
|
-
return /* @__PURE__ */ jsxs("span", { ...props, ref, className: cx("cdt-badge", "cdt-status-badge", `cdt-status-badge--${statusClass}`, className), children: [
|
|
18
|
-
isMarker ? /* @__PURE__ */ jsx("span", { className: cx("cdt-status-badge__marker", status === "neutralEnd" && "cdt-status-badge__marker--neutral-end"), "aria-hidden": "true" }) : null,
|
|
19
|
-
/* @__PURE__ */ jsx("span", { className: "cdt-badge__icon", "aria-hidden": "true", "data-cdt-icon": STATUS_ICONS[status], children: icon }),
|
|
20
|
-
label
|
|
21
|
-
] });
|
|
22
|
-
});
|
|
23
|
-
StatusBadge.displayName = "StatusBadge";
|
|
24
|
-
var SeverityTag = forwardRef(function SeverityTag2({ className, icon, label, severity, ...props }, ref) {
|
|
25
|
-
return /* @__PURE__ */ jsxs("span", { ...props, ref, className: cx("cdt-badge", "cdt-severity-tag", `cdt-severity-tag--${severity}`, className), children: [
|
|
26
|
-
/* @__PURE__ */ jsx("span", { className: "cdt-badge__icon", "aria-hidden": "true", "data-cdt-icon": SEVERITY_ICONS[severity], children: icon }),
|
|
27
|
-
label
|
|
28
|
-
] });
|
|
29
|
-
});
|
|
30
|
-
SeverityTag.displayName = "SeverityTag";
|
|
31
|
-
|
|
32
|
-
export { Badge, SeverityTag, StatusBadge };
|
package/dist/chunk-G7TRTZRR.js
DELETED
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
import { Spinner } from './chunk-NF3ZHADJ.js';
|
|
2
|
-
import { cx } from './chunk-WEIMKRZV.js';
|
|
3
|
-
import { forwardRef } from 'react';
|
|
4
|
-
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
function buttonClasses({ variant = "secondary", tone = "neutral", size = "md", blockedReason, className }) {
|
|
7
|
-
return cx(
|
|
8
|
-
"cdt-btn",
|
|
9
|
-
`cdt-btn--${variant}`,
|
|
10
|
-
`cdt-btn--tone-${tone}`,
|
|
11
|
-
size === "sm" && "cdt-btn--sm",
|
|
12
|
-
blockedReason !== void 0 && "cdt-btn--blocked",
|
|
13
|
-
className
|
|
14
|
-
);
|
|
15
|
-
}
|
|
16
|
-
var Button = forwardRef(function Button2({ blockedReason, className, disabled, iconEnd, iconStart, loading = false, onClick, title, variant, tone, size, children, ...props }, ref) {
|
|
17
|
-
const isBlocked = blockedReason !== void 0;
|
|
18
|
-
const isDisabled = disabled || isBlocked;
|
|
19
|
-
return /* @__PURE__ */ jsxs(
|
|
20
|
-
"button",
|
|
21
|
-
{
|
|
22
|
-
...props,
|
|
23
|
-
ref,
|
|
24
|
-
className: buttonClasses({ variant, tone, size, blockedReason, className}),
|
|
25
|
-
disabled: isDisabled,
|
|
26
|
-
"aria-busy": loading || void 0,
|
|
27
|
-
title: isBlocked ? blockedReason : title,
|
|
28
|
-
onClick: (event) => {
|
|
29
|
-
if (loading) {
|
|
30
|
-
event.preventDefault();
|
|
31
|
-
event.stopPropagation();
|
|
32
|
-
return;
|
|
33
|
-
}
|
|
34
|
-
onClick?.(event);
|
|
35
|
-
},
|
|
36
|
-
children: [
|
|
37
|
-
loading ? /* @__PURE__ */ jsx(Spinner, { size: "sm", label: "", "aria-hidden": "true" }) : iconStart === void 0 ? null : /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: iconStart }),
|
|
38
|
-
children,
|
|
39
|
-
iconEnd === void 0 ? null : /* @__PURE__ */ jsx("span", { "aria-hidden": "true", children: iconEnd })
|
|
40
|
-
]
|
|
41
|
-
}
|
|
42
|
-
);
|
|
43
|
-
});
|
|
44
|
-
Button.displayName = "Button";
|
|
45
|
-
var IconButton = forwardRef(function IconButton2({ icon, size, ...props }, ref) {
|
|
46
|
-
return /* @__PURE__ */ jsx(
|
|
47
|
-
Button,
|
|
48
|
-
{
|
|
49
|
-
...props,
|
|
50
|
-
ref,
|
|
51
|
-
size,
|
|
52
|
-
iconStart: icon,
|
|
53
|
-
className: cx("cdt-btn--icon", props.className),
|
|
54
|
-
children: null
|
|
55
|
-
}
|
|
56
|
-
);
|
|
57
|
-
});
|
|
58
|
-
IconButton.displayName = "IconButton";
|
|
59
|
-
|
|
60
|
-
export { Button, IconButton };
|