@ceed/cds 0.0.125 → 0.0.126
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/Accordions/Accordions.js +66 -0
- package/dist/components/Accordions/index.js +3 -0
- package/dist/components/Autocomplete/Autocomplete.js +251 -0
- package/dist/components/Autocomplete/index.js +3 -0
- package/dist/components/Box/Box.js +6 -0
- package/dist/components/Box/index.js +3 -0
- package/dist/components/Breadcrumbs/Breadcrumbs.js +67 -0
- package/dist/components/Breadcrumbs/index.js +3 -0
- package/dist/components/Button/Button.js +28 -0
- package/dist/components/Button/index.js +3 -0
- package/dist/components/Calendar/Calendar.js +383 -0
- package/dist/components/Calendar/hooks/use-calendar-props.js +80 -0
- package/dist/components/Calendar/hooks/use-calendar.js +244 -0
- package/dist/components/Calendar/index.js +3 -0
- package/dist/components/Calendar/types.js +1 -0
- package/dist/components/Calendar/utils/index.js +72 -0
- package/dist/components/Card/Card.js +22 -0
- package/dist/components/Card/index.js +3 -0
- package/dist/components/Checkbox/Checkbox.js +28 -0
- package/dist/components/Checkbox/index.js +3 -0
- package/dist/components/Chip/Chip.js +6 -0
- package/dist/components/Chip/index.js +3 -0
- package/dist/components/Container/Container.js +65 -0
- package/dist/components/Container/index.js +3 -0
- package/dist/components/CurrencyInput/CurrencyInput.js +108 -0
- package/dist/components/CurrencyInput/hooks/use-currency-setting.js +165 -0
- package/dist/components/CurrencyInput/index.js +3 -0
- package/dist/components/DataTable/DataTable.js +437 -0
- package/dist/components/DataTable/index.js +3 -0
- package/dist/components/DataTable/types.js +1 -0
- package/dist/components/DatePicker/DatePicker.js +207 -0
- package/dist/components/DatePicker/index.js +3 -0
- package/dist/components/DateRangePicker/DateRangePicker.js +209 -0
- package/dist/components/DateRangePicker/index.js +3 -0
- package/dist/components/DialogActions/DialogActions.js +15 -0
- package/dist/components/DialogActions/index.js +3 -0
- package/dist/components/DialogContent/DialogContent.js +12 -0
- package/dist/components/DialogContent/index.js +3 -0
- package/dist/components/DialogFrame/DialogFrame.js +51 -0
- package/dist/components/DialogFrame/index.js +3 -0
- package/dist/components/DialogTitle/DialogTitle.js +12 -0
- package/dist/components/DialogTitle/index.js +3 -0
- package/dist/components/Divider/Divider.js +28 -0
- package/dist/components/Divider/index.js +3 -0
- package/dist/components/Dropdown/Dropdown.js +6 -0
- package/dist/components/Dropdown/index.js +3 -0
- package/dist/components/FormControl/FormControl.js +17 -0
- package/dist/components/FormControl/index.js +3 -0
- package/dist/components/FormHelperText/FormHelperText.js +6 -0
- package/dist/components/FormHelperText/index.js +3 -0
- package/dist/components/FormLabel/FormLabel.js +6 -0
- package/dist/components/FormLabel/index.js +3 -0
- package/dist/components/Grid/Grid.js +6 -0
- package/dist/components/Grid/index.js +3 -0
- package/dist/components/IconButton/IconButton.js +28 -0
- package/dist/components/IconButton/index.js +3 -0
- package/dist/components/Input/Input.js +51 -0
- package/dist/components/Input/index.js +3 -0
- package/dist/components/InsetDrawer/InsetDrawer.js +45 -0
- package/dist/components/InsetDrawer/index.js +3 -0
- package/dist/components/Markdown/Markdown.js +59 -0
- package/dist/components/Markdown/index.js +3 -0
- package/dist/components/Menu/Menu.js +56 -0
- package/dist/components/Menu/index.js +3 -0
- package/dist/components/Modal/Modal.js +63 -0
- package/dist/components/Modal/index.js +3 -0
- package/dist/components/MonthPicker/MonthPicker.js +203 -0
- package/dist/components/MonthPicker/index.js +3 -0
- package/dist/components/MonthRangePicker/MonthRangePicker.js +207 -0
- package/dist/components/MonthRangePicker/index.js +3 -0
- package/dist/components/Radio/Radio.js +10 -0
- package/dist/components/Radio/index.js +3 -0
- package/dist/components/RadioList/RadioList.js +38 -0
- package/dist/components/RadioList/index.js +3 -0
- package/dist/components/Select/Select.js +76 -0
- package/dist/components/Select/index.js +3 -0
- package/dist/components/Sheet/Sheet.js +6 -0
- package/dist/components/Sheet/index.js +3 -0
- package/dist/components/Stack/Stack.js +6 -0
- package/dist/components/Stack/index.js +3 -0
- package/dist/components/Switch/Switch.js +54 -0
- package/dist/components/Switch/index.js +3 -0
- package/dist/components/Table/Table.js +89 -0
- package/dist/components/Table/index.js +3 -0
- package/dist/components/Tabs/Tabs.js +18 -0
- package/dist/components/Tabs/index.js +3 -0
- package/dist/components/Textarea/Textarea.js +50 -0
- package/dist/components/Textarea/index.js +3 -0
- package/dist/components/ThemeProvider/ThemeProvider.js +159 -0
- package/dist/components/ThemeProvider/index.js +3 -0
- package/dist/components/Tooltip/Tooltip.js +28 -0
- package/dist/components/Tooltip/index.js +3 -0
- package/dist/components/Typography/Typography.js +28 -0
- package/dist/components/Typography/index.js +3 -0
- package/dist/components/Uploader/Uploader.js +353 -0
- package/dist/components/Uploader/index.js +3 -0
- package/dist/components/index.js +44 -0
- package/dist/index.js +6 -1
- package/dist/index.mjs +1 -0
- package/package.json +4 -4
- package/dist/index.cjs +0 -1
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from "react";
|
|
24
|
+
import { AccordionGroup as JoyAccordionGroup, Accordion as JoyAccordion, AccordionSummary as JoyAccordionSummary, AccordionDetails as JoyAccordionDetails, } from "@mui/joy";
|
|
25
|
+
import { motion } from "framer-motion";
|
|
26
|
+
var MotionAccordionSummary = motion(JoyAccordionSummary);
|
|
27
|
+
var AccordionSummary = MotionAccordionSummary;
|
|
28
|
+
export { AccordionSummary };
|
|
29
|
+
AccordionSummary.displayName = "AccordionSummary";
|
|
30
|
+
var MotionAccordionDetails = motion(JoyAccordionDetails);
|
|
31
|
+
var AccordionDetails = MotionAccordionDetails;
|
|
32
|
+
export { AccordionDetails };
|
|
33
|
+
AccordionDetails.displayName = "AccordionDetails";
|
|
34
|
+
var MotionAccordion = motion(JoyAccordion);
|
|
35
|
+
function Accordion(props) {
|
|
36
|
+
// prop destruction
|
|
37
|
+
var summary = props.summary, details = props.details, variant = props.variant, color = props.color, innerProps = __rest(props, ["summary", "details", "variant", "color"]);
|
|
38
|
+
// lib hooks
|
|
39
|
+
// state, ref, querystring hooks
|
|
40
|
+
// form hooks
|
|
41
|
+
// query hooks
|
|
42
|
+
// calculated values
|
|
43
|
+
var inheritedVariant = variant === "solid" ? "solid" : undefined;
|
|
44
|
+
// effects
|
|
45
|
+
// handlers
|
|
46
|
+
return (React.createElement(MotionAccordion, __assign({ variant: inheritedVariant, color: color }, innerProps),
|
|
47
|
+
React.createElement(AccordionSummary, { variant: inheritedVariant, color: color }, summary),
|
|
48
|
+
React.createElement(AccordionDetails, { variant: inheritedVariant, color: color }, details)));
|
|
49
|
+
}
|
|
50
|
+
export { Accordion };
|
|
51
|
+
Accordion.displayName = "Accordion";
|
|
52
|
+
var MotionAccordions = motion(JoyAccordionGroup);
|
|
53
|
+
function Accordions(props) {
|
|
54
|
+
// prop destruction
|
|
55
|
+
var variant = props.variant, color = props.color, items = props.items, innerProps = __rest(props, ["variant", "color", "items"]);
|
|
56
|
+
// lib hooks
|
|
57
|
+
// state, ref, querystring hooks
|
|
58
|
+
// form hooks
|
|
59
|
+
// query hooks
|
|
60
|
+
// calculated values
|
|
61
|
+
// effects
|
|
62
|
+
// handlers
|
|
63
|
+
return (React.createElement(MotionAccordions, __assign({ variant: variant, color: color }, innerProps), items.map(function (item, index) { return (React.createElement(Accordion, { summary: item.summary, details: item.details, index: index, variant: variant, color: color })); })));
|
|
64
|
+
}
|
|
65
|
+
export { Accordions };
|
|
66
|
+
Accordions.displayName = "Accordions";
|
|
@@ -0,0 +1,251 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
|
|
24
|
+
if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
|
|
25
|
+
if (ar || !(i in from)) {
|
|
26
|
+
if (!ar) ar = Array.prototype.slice.call(from, 0, i);
|
|
27
|
+
ar[i] = from[i];
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
return to.concat(ar || Array.prototype.slice.call(from));
|
|
31
|
+
};
|
|
32
|
+
import React, { useCallback, useEffect, useMemo, useRef, useState, } from "react";
|
|
33
|
+
import { Autocomplete as JoyAutocomplete, AutocompleteOption as JoyAutocompleteOption, ListSubheader as JoyListSubheader, AutocompleteListbox as JoyAutocompleteListbox, ListItemDecorator, CircularProgress, styled, } from "@mui/joy";
|
|
34
|
+
// @ts-ignore: ESM import 해야만 프레이머에서 정상적으로 동작한다. https://github.com/mui/material-ui/issues/35233
|
|
35
|
+
import CloseIcon from "@mui/icons-material/esm/Close.js";
|
|
36
|
+
import { useVirtualizer } from "@tanstack/react-virtual";
|
|
37
|
+
import { Popper } from "@mui/base";
|
|
38
|
+
import FormControl from "../FormControl";
|
|
39
|
+
import FormLabel from "../FormLabel";
|
|
40
|
+
import FormHelperText from "../FormHelperText";
|
|
41
|
+
import Chip from "../Chip";
|
|
42
|
+
import IconButton from "../IconButton";
|
|
43
|
+
import Stack from "../Stack";
|
|
44
|
+
var AutocompletePopper = styled(Popper, {
|
|
45
|
+
name: "Autocomplete",
|
|
46
|
+
slot: "Popper",
|
|
47
|
+
})(function (_a) {
|
|
48
|
+
var theme = _a.theme;
|
|
49
|
+
return ({
|
|
50
|
+
zIndex: theme.zIndex.tooltip,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
var AutocompleteListBox = React.forwardRef(function (props, ref) {
|
|
54
|
+
// prop destruction
|
|
55
|
+
var anchorEl = props.anchorEl, open = props.open, modifiers = props.modifiers, children = props.children, _a = props.ownerState, loading = _a.loading, _b = _a.size, fontSize = _b === void 0 ? "md" : _b, innerProps = __rest(props, ["anchorEl", "open", "modifiers", "children", "ownerState"]);
|
|
56
|
+
// state, ref, querystring hooks
|
|
57
|
+
var parentRef = useRef(null);
|
|
58
|
+
// lib hooks
|
|
59
|
+
// NOTE: 부분 grouping은 불가능하다.
|
|
60
|
+
var isGrouped = children[0].every(function (child) { return child.hasOwnProperty("group"); });
|
|
61
|
+
var renderTargets = (function () {
|
|
62
|
+
if (loading) {
|
|
63
|
+
return [children[1]];
|
|
64
|
+
}
|
|
65
|
+
if (children[0].length === 0) {
|
|
66
|
+
return [children[2]];
|
|
67
|
+
}
|
|
68
|
+
if (isGrouped) {
|
|
69
|
+
return children[0].flatMap(function (child) { return __spreadArray([
|
|
70
|
+
React.createElement(JoyListSubheader, { key: child.key, component: "li" }, child.group)
|
|
71
|
+
], child.children, true); });
|
|
72
|
+
}
|
|
73
|
+
return children[0];
|
|
74
|
+
})();
|
|
75
|
+
var virtualizer = useVirtualizer({
|
|
76
|
+
count: renderTargets.length,
|
|
77
|
+
// TODO: 하드코딩된 option height, autocomplete size에 대응하거나 동적 사이즈를 적용해야한다.
|
|
78
|
+
estimateSize: function () { return 36; },
|
|
79
|
+
getScrollElement: function () { return parentRef.current; },
|
|
80
|
+
overscan: 5,
|
|
81
|
+
});
|
|
82
|
+
// form hooks
|
|
83
|
+
// query hooks
|
|
84
|
+
// calculated values
|
|
85
|
+
var items = virtualizer.getVirtualItems();
|
|
86
|
+
// effects
|
|
87
|
+
useEffect(function () {
|
|
88
|
+
if (open) {
|
|
89
|
+
virtualizer.measure();
|
|
90
|
+
}
|
|
91
|
+
}, [open, virtualizer]);
|
|
92
|
+
// handlers
|
|
93
|
+
return (React.createElement(AutocompletePopper, { ref: ref, anchorEl: anchorEl, open: open, modifiers: modifiers },
|
|
94
|
+
React.createElement(JoyAutocompleteListbox, __assign({}, innerProps),
|
|
95
|
+
React.createElement("div", { ref: parentRef, style: { overflow: "auto" } },
|
|
96
|
+
React.createElement("div", { style: {
|
|
97
|
+
height: "".concat(virtualizer.getTotalSize(), "px"),
|
|
98
|
+
position: "relative",
|
|
99
|
+
} }, items.map(function (_a) {
|
|
100
|
+
var index = _a.index, size = _a.size, start = _a.start, key = _a.key;
|
|
101
|
+
return React.cloneElement(renderTargets[index], {
|
|
102
|
+
key: key,
|
|
103
|
+
style: {
|
|
104
|
+
position: "absolute",
|
|
105
|
+
top: 0,
|
|
106
|
+
left: 0,
|
|
107
|
+
width: "100%",
|
|
108
|
+
fontSize: "var(--ceed-fontSize-".concat(fontSize, ")"),
|
|
109
|
+
height: "".concat(size, "px"),
|
|
110
|
+
transform: "translateY(".concat(start, "px)"),
|
|
111
|
+
overflow: "visible",
|
|
112
|
+
},
|
|
113
|
+
children: (React.createElement("div", { style: {
|
|
114
|
+
textOverflow: "ellipsis",
|
|
115
|
+
textWrap: "nowrap",
|
|
116
|
+
overflow: "hidden",
|
|
117
|
+
width: "100%",
|
|
118
|
+
} }, renderTargets[index].props.children)),
|
|
119
|
+
});
|
|
120
|
+
}))))));
|
|
121
|
+
});
|
|
122
|
+
var AutocompleteDeleteSize = {
|
|
123
|
+
sm: "20px",
|
|
124
|
+
md: "24px",
|
|
125
|
+
lg: "28px",
|
|
126
|
+
};
|
|
127
|
+
var AutocompleteTagDelete = styled(IconButton, {
|
|
128
|
+
name: "Autocomplete",
|
|
129
|
+
slot: "tagDelete",
|
|
130
|
+
})(function (_a) {
|
|
131
|
+
var theme = _a.theme, _b = _a.size, size = _b === void 0 ? "md" : _b;
|
|
132
|
+
return ({
|
|
133
|
+
width: AutocompleteDeleteSize[size],
|
|
134
|
+
height: AutocompleteDeleteSize[size],
|
|
135
|
+
minWidth: AutocompleteDeleteSize[size],
|
|
136
|
+
minHeight: AutocompleteDeleteSize[size],
|
|
137
|
+
borderRadius: "50%",
|
|
138
|
+
});
|
|
139
|
+
});
|
|
140
|
+
function Autocomplete(props) {
|
|
141
|
+
// prop destruction
|
|
142
|
+
var label = props.label, error = props.error, helperText = props.helperText, color = props.color, size = props.size, disabled = props.disabled, required = props.required, onChange = props.onChange, onChangeComplete = props.onChangeComplete, innerProps = __rest(props, ["label", "error", "helperText", "color", "size", "disabled", "required", "onChange", "onChangeComplete"]);
|
|
143
|
+
// lib hooks
|
|
144
|
+
// state, ref, querystring hooks
|
|
145
|
+
var _a = useState(props.value || props.defaultValue), _value = _a[0], setValue = _a[1];
|
|
146
|
+
// form hooks
|
|
147
|
+
// query hooks
|
|
148
|
+
// calculated values
|
|
149
|
+
var options = useMemo(function () {
|
|
150
|
+
return props.options.map(function (option) {
|
|
151
|
+
if (typeof option !== "object") {
|
|
152
|
+
return {
|
|
153
|
+
value: option,
|
|
154
|
+
label: option,
|
|
155
|
+
};
|
|
156
|
+
}
|
|
157
|
+
return option;
|
|
158
|
+
});
|
|
159
|
+
}, [props.options]);
|
|
160
|
+
var optionMap = useMemo(function () {
|
|
161
|
+
var map = new Map();
|
|
162
|
+
options.forEach(function (option) {
|
|
163
|
+
map.set(option.value, option);
|
|
164
|
+
});
|
|
165
|
+
return map;
|
|
166
|
+
}, [options]);
|
|
167
|
+
var value = useMemo(function () {
|
|
168
|
+
if (props.loading) {
|
|
169
|
+
return {
|
|
170
|
+
value: "",
|
|
171
|
+
label: "",
|
|
172
|
+
startDecorator: (React.createElement(CircularProgress, { size: "sm", color: "neutral", variant: "plain", thickness: 3 })),
|
|
173
|
+
};
|
|
174
|
+
}
|
|
175
|
+
if (_value === null || _value === undefined) {
|
|
176
|
+
// NOTE: value가 undefined면 uncontrolled로 취급된다.
|
|
177
|
+
return null;
|
|
178
|
+
}
|
|
179
|
+
var convertValue = function (targetValue) {
|
|
180
|
+
var _a;
|
|
181
|
+
if (typeof targetValue !== "object") {
|
|
182
|
+
return (_a = optionMap.get(targetValue)) !== null && _a !== void 0 ? _a : targetValue;
|
|
183
|
+
}
|
|
184
|
+
// NOTE: value값이 같은 object가 넘어오면 선택된 option으로, Autocomplete에서 선택된 태그로 보여아한다.
|
|
185
|
+
return optionMap.get(targetValue.value);
|
|
186
|
+
};
|
|
187
|
+
if (Array.isArray(_value)) {
|
|
188
|
+
return _value.map(convertValue);
|
|
189
|
+
}
|
|
190
|
+
return convertValue(_value);
|
|
191
|
+
}, [_value, optionMap, props.loading]);
|
|
192
|
+
var applySize = useCallback(function (node) {
|
|
193
|
+
return React.isValidElement(node) && !props.loading
|
|
194
|
+
? React.cloneElement(node, __assign({ size: size }))
|
|
195
|
+
: node;
|
|
196
|
+
}, [size, props.loading]);
|
|
197
|
+
var startDecorator = useMemo(function () {
|
|
198
|
+
return applySize((value === null || value === void 0 ? void 0 : value.startDecorator) || props.startDecorator);
|
|
199
|
+
}, [value, applySize, props.startDecorator]);
|
|
200
|
+
var endDecorator = useMemo(function () {
|
|
201
|
+
return applySize((value === null || value === void 0 ? void 0 : value.endDecorator) || props.endDecorator);
|
|
202
|
+
}, [value, applySize, props.endDecorator]);
|
|
203
|
+
// effects
|
|
204
|
+
// handlers
|
|
205
|
+
var handleChange = function (event, value) {
|
|
206
|
+
setValue(value);
|
|
207
|
+
var newValue = value;
|
|
208
|
+
var _value = Array.isArray(newValue)
|
|
209
|
+
? newValue.map(function (value) { return value.value; })
|
|
210
|
+
: newValue === null || newValue === void 0 ? void 0 : newValue.value;
|
|
211
|
+
onChange === null || onChange === void 0 ? void 0 : onChange(__assign(__assign({}, event), { target: __assign(__assign({}, event.target), {
|
|
212
|
+
// @ts-expect-error NOTE: multiple이 true일 때, value는 배열이다.
|
|
213
|
+
value: _value }) }));
|
|
214
|
+
if ((Array.isArray(newValue) &&
|
|
215
|
+
newValue.map(function (value) { return optionMap.get(value.value); })) ||
|
|
216
|
+
optionMap.get(newValue === null || newValue === void 0 ? void 0 : newValue.value)) {
|
|
217
|
+
onChangeComplete === null || onChangeComplete === void 0 ? void 0 : onChangeComplete(__assign(__assign({}, event), { target: __assign(__assign({}, event.target), {
|
|
218
|
+
// @ts-expect-error NOTE: multiple이 true일 때, value는 배열이다.
|
|
219
|
+
value: _value }) }));
|
|
220
|
+
}
|
|
221
|
+
};
|
|
222
|
+
var autocomplete = (React.createElement(JoyAutocomplete, __assign({}, innerProps, { required: required, onChange: handleChange, color: error ? "danger" : color, value: value, options: options, size: size, disabled: disabled, startDecorator: startDecorator, endDecorator: endDecorator, getOptionLabel: function (option) { var _a; return "".concat((_a = option.value) !== null && _a !== void 0 ? _a : ""); }, renderTags: function (tags, getTagProps) {
|
|
223
|
+
return tags.map(function (tag, index) {
|
|
224
|
+
var _a = getTagProps({ index: index }), onClick = _a.onClick, rest = __rest(_a, ["onClick"]);
|
|
225
|
+
return applySize(React.createElement(Chip, __assign({ color: "primary" }, rest),
|
|
226
|
+
React.createElement(Stack, { direction: "row", alignItems: "center", gap: 2, py: 0.5 },
|
|
227
|
+
tag.value,
|
|
228
|
+
applySize(React.createElement(AutocompleteTagDelete, { color: "primary", variant: "soft", onClick: onClick },
|
|
229
|
+
React.createElement(CloseIcon, null))))));
|
|
230
|
+
});
|
|
231
|
+
}, slots: {
|
|
232
|
+
listbox: AutocompleteListBox,
|
|
233
|
+
}, renderOption: function (props, option) { return (React.createElement(JoyAutocompleteOption, __assign({}, props),
|
|
234
|
+
option.startDecorator && (React.createElement(ListItemDecorator, { sx: function (theme) { return ({
|
|
235
|
+
marginInlineEnd: "var(--Input-gap, ".concat(theme.spacing(1), ")"),
|
|
236
|
+
}); } }, applySize(option.startDecorator))),
|
|
237
|
+
applySize(option.label),
|
|
238
|
+
option.endDecorator && (React.createElement(ListItemDecorator, { sx: function (theme) { return ({
|
|
239
|
+
marginInlineStart: "var(--Input-gap, ".concat(theme.spacing(1), ")"),
|
|
240
|
+
}); } }, applySize(option.endDecorator))))); },
|
|
241
|
+
// TODO: Post React 18 update - validate this conversion, look like a hidden bug
|
|
242
|
+
renderGroup: function (params) { return params; } })));
|
|
243
|
+
if (label) {
|
|
244
|
+
return (React.createElement(FormControl, { required: required, color: color, size: size, error: error, disabled: disabled },
|
|
245
|
+
React.createElement(FormLabel, null, label),
|
|
246
|
+
autocomplete,
|
|
247
|
+
helperText && React.createElement(FormHelperText, null, helperText)));
|
|
248
|
+
}
|
|
249
|
+
return autocomplete;
|
|
250
|
+
}
|
|
251
|
+
export { Autocomplete };
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
13
|
+
var t = {};
|
|
14
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
15
|
+
t[p] = s[p];
|
|
16
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
17
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
18
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
19
|
+
t[p[i]] = s[p[i]];
|
|
20
|
+
}
|
|
21
|
+
return t;
|
|
22
|
+
};
|
|
23
|
+
import React from "react";
|
|
24
|
+
import { Breadcrumbs as JoyBreadcrumbs, Link as JoyLink, } from "@mui/joy";
|
|
25
|
+
import Menu, { MenuButton, MenuItem } from "../Menu";
|
|
26
|
+
import Dropdown from "../Dropdown";
|
|
27
|
+
import Typography from "../Typography";
|
|
28
|
+
function Breadcrumbs(props) {
|
|
29
|
+
// prop destruction
|
|
30
|
+
var crumbs = props.crumbs, size = props.size, _a = props.startCrumbCount, startCrumbCount = _a === void 0 ? 1 : _a, _b = props.endCrumbCount, endCrumbCount = _b === void 0 ? 3 : _b, _c = props.slots, _d = _c === void 0 ? { link: JoyLink } : _c, Link = _d.link, restSlots = __rest(_d, ["link"]), _e = props.slotProps, _f = _e === void 0 ? {
|
|
31
|
+
link: { color: "neutral" },
|
|
32
|
+
} : _e, linkProps = _f.link, restSlotProps = __rest(_f, ["link"]), innerProps = __rest(props, ["crumbs", "size", "startCrumbCount", "endCrumbCount", "slots", "slotProps"]);
|
|
33
|
+
// lib hooks
|
|
34
|
+
// state, ref, querystring hooks
|
|
35
|
+
// form hooks
|
|
36
|
+
// query hooks
|
|
37
|
+
// calculated values
|
|
38
|
+
var _endCrumbCount = Math.max(1, endCrumbCount);
|
|
39
|
+
var Crumb = function (props) {
|
|
40
|
+
if (props.type === "link" && Link) {
|
|
41
|
+
return (React.createElement(Link, __assign({ to: props.linkHref, href: props.linkHref }, linkProps), props.label));
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return React.createElement(Typography, null, props.label);
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
var frontCrumbs = crumbs
|
|
48
|
+
.slice(0, startCrumbCount)
|
|
49
|
+
.map(function (crumb) { return React.createElement(Crumb, __assign({}, crumb)); });
|
|
50
|
+
var backCrumbs = (startCrumbCount + _endCrumbCount > crumbs.length
|
|
51
|
+
? crumbs.slice(startCrumbCount)
|
|
52
|
+
: crumbs.slice(-_endCrumbCount)).map(function (crumb) { return React.createElement(Crumb, __assign({}, crumb)); });
|
|
53
|
+
var collapsedCrumbs = crumbs
|
|
54
|
+
.slice(startCrumbCount, -_endCrumbCount)
|
|
55
|
+
.map(function (crumb) { return (React.createElement(MenuItem, null,
|
|
56
|
+
React.createElement(Crumb, __assign({}, crumb)))); });
|
|
57
|
+
// effects
|
|
58
|
+
// handlers
|
|
59
|
+
return (React.createElement(JoyBreadcrumbs, __assign({ size: size, slots: restSlots, slotProps: restSlotProps }, innerProps),
|
|
60
|
+
frontCrumbs,
|
|
61
|
+
collapsedCrumbs.length && (React.createElement(Dropdown, null,
|
|
62
|
+
React.createElement(MenuButton, { size: size, variant: "plain" }, "..."),
|
|
63
|
+
React.createElement(Menu, { size: size }, collapsedCrumbs))),
|
|
64
|
+
backCrumbs));
|
|
65
|
+
}
|
|
66
|
+
export { Breadcrumbs };
|
|
67
|
+
Breadcrumbs.displayName = "Breadcrumbs";
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
var __assign = (this && this.__assign) || function () {
|
|
2
|
+
__assign = Object.assign || function(t) {
|
|
3
|
+
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
|
4
|
+
s = arguments[i];
|
|
5
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
|
|
6
|
+
t[p] = s[p];
|
|
7
|
+
}
|
|
8
|
+
return t;
|
|
9
|
+
};
|
|
10
|
+
return __assign.apply(this, arguments);
|
|
11
|
+
};
|
|
12
|
+
import React, { forwardRef } from "react";
|
|
13
|
+
import { Button as JoyButton } from "@mui/joy";
|
|
14
|
+
import { motion } from "framer-motion";
|
|
15
|
+
var MotionButton = motion(JoyButton);
|
|
16
|
+
var Button = forwardRef(function (props, ref) {
|
|
17
|
+
// prop destruction
|
|
18
|
+
// lib hooks
|
|
19
|
+
// state, ref, querystring hooks
|
|
20
|
+
// form hooks
|
|
21
|
+
// query hooks
|
|
22
|
+
// calculated values
|
|
23
|
+
// effects
|
|
24
|
+
// handlers
|
|
25
|
+
return (React.createElement(MotionButton, __assign({ ref: ref }, props)));
|
|
26
|
+
});
|
|
27
|
+
export { Button };
|
|
28
|
+
Button.displayName = "Button";
|