@orcestr/ui 0.0.1 → 0.1.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 +4 -0
- package/README.ru.md +4 -0
- package/dist/components/Alert/Alert.d.ts +5 -4
- package/dist/components/Alert/Alert.d.ts.map +1 -1
- package/dist/components/Alert/Alert.js +5 -2
- package/dist/components/AppShell/AppShell.d.ts +2 -0
- package/dist/components/AppShell/AppShell.d.ts.map +1 -1
- package/dist/components/AppShell/AppShell.js +9 -6
- package/dist/components/AppSidebar/AppSidebar.d.ts +36 -0
- package/dist/components/AppSidebar/AppSidebar.d.ts.map +1 -0
- package/dist/components/AppSidebar/AppSidebar.js +53 -0
- package/dist/components/Badge/Badge.d.ts +8 -6
- package/dist/components/Badge/Badge.d.ts.map +1 -1
- package/dist/components/Badge/Badge.js +4 -4
- package/dist/components/BadgeSelectMenu/BadgeSelectMenu.d.ts +22 -0
- package/dist/components/BadgeSelectMenu/BadgeSelectMenu.d.ts.map +1 -0
- package/dist/components/BadgeSelectMenu/BadgeSelectMenu.js +50 -0
- package/dist/components/Box/Box.d.ts +2 -0
- package/dist/components/Box/Box.d.ts.map +1 -1
- package/dist/components/Box/Box.js +15 -2
- package/dist/components/Button/Button.d.ts +7 -3
- package/dist/components/Button/Button.d.ts.map +1 -1
- package/dist/components/Button/Button.js +23 -3
- package/dist/components/Card/Card.d.ts +26 -0
- package/dist/components/Card/Card.d.ts.map +1 -0
- package/dist/components/Card/Card.js +25 -0
- package/dist/components/Checkbox/Checkbox.d.ts +6 -2
- package/dist/components/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/Checkbox/Checkbox.js +13 -4
- package/dist/components/CommandPalette/CommandPalette.d.ts.map +1 -1
- package/dist/components/CommandPalette/CommandPalette.js +10 -9
- package/dist/components/ConfirmDialog/ConfirmDialog.d.ts.map +1 -1
- package/dist/components/ConfirmDialog/ConfirmDialog.js +5 -2
- package/dist/components/ContextMenu/ContextMenu.d.ts.map +1 -1
- package/dist/components/ContextMenu/ContextMenu.js +2 -2
- package/dist/components/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/DatePicker/DatePicker.js +9 -1
- package/dist/components/Dialog/Dialog.d.ts +69 -1
- package/dist/components/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/Dialog/Dialog.js +48 -1
- package/dist/components/Drawer/Drawer.d.ts.map +1 -1
- package/dist/components/Drawer/Drawer.js +2 -2
- package/dist/components/EntityPicker/EntityPicker.d.ts +2 -1
- package/dist/components/EntityPicker/EntityPicker.d.ts.map +1 -1
- package/dist/components/EntityPicker/EntityPicker.js +2 -2
- package/dist/components/Flex/Flex.d.ts +5 -1
- package/dist/components/Flex/Flex.d.ts.map +1 -1
- package/dist/components/Flex/Flex.js +16 -3
- package/dist/components/Grid/Grid.d.ts +9 -2
- package/dist/components/Grid/Grid.d.ts.map +1 -1
- package/dist/components/Grid/Grid.js +22 -1
- package/dist/components/IconButton/IconButton.d.ts +19 -7
- package/dist/components/IconButton/IconButton.d.ts.map +1 -1
- package/dist/components/IconButton/IconButton.js +40 -5
- package/dist/components/IconTextButton/IconTextButton.d.ts +20 -0
- package/dist/components/IconTextButton/IconTextButton.d.ts.map +1 -0
- package/dist/components/IconTextButton/IconTextButton.js +24 -0
- package/dist/components/InlineEdit/InlineEdit.d.ts +63 -0
- package/dist/components/InlineEdit/InlineEdit.d.ts.map +1 -0
- package/dist/components/InlineEdit/InlineEdit.js +98 -0
- package/dist/components/LinkButton/LinkButton.d.ts +25 -0
- package/dist/components/LinkButton/LinkButton.d.ts.map +1 -0
- package/dist/components/LinkButton/LinkButton.js +12 -0
- package/dist/components/Modal/Modal.d.ts +29 -6
- package/dist/components/Modal/Modal.d.ts.map +1 -1
- package/dist/components/Modal/Modal.js +37 -13
- package/dist/components/Overlay/OverlayProvider.d.ts +1 -0
- package/dist/components/Overlay/OverlayProvider.d.ts.map +1 -1
- package/dist/components/Overlay/OverlayProvider.js +18 -1
- package/dist/components/PaginatedCombobox/PaginatedCombobox.d.ts +2 -1
- package/dist/components/PaginatedCombobox/PaginatedCombobox.d.ts.map +1 -1
- package/dist/components/PaginatedCombobox/PaginatedCombobox.js +3 -3
- package/dist/components/Popover/Popover.d.ts +37 -3
- package/dist/components/Popover/Popover.d.ts.map +1 -1
- package/dist/components/Popover/Popover.js +56 -9
- package/dist/components/ScrollArea/ScrollArea.d.ts +4 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +30 -4
- package/dist/components/Section/Section.d.ts +2 -0
- package/dist/components/Section/Section.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts +24 -1
- package/dist/components/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/components/SegmentedControl/SegmentedControl.js +28 -2
- package/dist/components/Select/Select.d.ts +36 -4
- package/dist/components/Select/Select.d.ts.map +1 -1
- package/dist/components/Select/Select.js +70 -3
- package/dist/components/Separator/Separator.d.ts +3 -1
- package/dist/components/Separator/Separator.d.ts.map +1 -1
- package/dist/components/Separator/Separator.js +4 -2
- package/dist/components/SpecialModal/SpecialModal.d.ts +43 -0
- package/dist/components/SpecialModal/SpecialModal.d.ts.map +1 -0
- package/dist/components/SpecialModal/SpecialModal.js +34 -0
- package/dist/components/Spinner/Spinner.d.ts +3 -1
- package/dist/components/Spinner/Spinner.d.ts.map +1 -1
- package/dist/components/Spinner/Spinner.js +2 -2
- package/dist/components/State/State.d.ts +8 -1
- package/dist/components/State/State.d.ts.map +1 -1
- package/dist/components/State/State.js +2 -2
- package/dist/components/Switch/Switch.d.ts +2 -0
- package/dist/components/Switch/Switch.d.ts.map +1 -1
- package/dist/components/Switch/Switch.js +2 -1
- package/dist/components/Table/Table.d.ts +64 -0
- package/dist/components/Table/Table.d.ts.map +1 -0
- package/dist/components/Table/Table.js +38 -0
- package/dist/components/Tabs/Tabs.d.ts +33 -2
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +189 -4
- package/dist/components/Text/Text.d.ts +13 -3
- package/dist/components/Text/Text.d.ts.map +1 -1
- package/dist/components/Text/Text.js +16 -3
- package/dist/components/TextArea/TextArea.d.ts.map +1 -1
- package/dist/components/TextArea/TextArea.js +1 -1
- package/dist/components/TextField/TextField.d.ts.map +1 -1
- package/dist/components/TextField/TextField.js +1 -1
- package/dist/components/Toast/Toast.d.ts +1 -0
- package/dist/components/Toast/Toast.d.ts.map +1 -1
- package/dist/components/Toast/Toast.js +19 -8
- package/dist/components/Tooltip/Tooltip.d.ts +11 -3
- package/dist/components/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/Tooltip/Tooltip.js +58 -9
- package/dist/example/CodePreview.d.ts.map +1 -1
- package/dist/example/CodePreview.js +3 -3
- package/dist/example/ExampleActionsSection.d.ts.map +1 -1
- package/dist/example/ExampleActionsSection.js +3 -3
- package/dist/example/ExampleApplicationSection.d.ts +7 -0
- package/dist/example/ExampleApplicationSection.d.ts.map +1 -0
- package/dist/example/ExampleApplicationSection.js +68 -0
- package/dist/example/ExampleBasicsSections.d.ts.map +1 -1
- package/dist/example/ExampleBasicsSections.js +5 -9
- package/dist/example/ExampleDataSection.d.ts.map +1 -1
- package/dist/example/ExampleDataSection.js +31 -30
- package/dist/example/ExampleFieldsSection.d.ts.map +1 -1
- package/dist/example/ExampleFieldsSection.js +51 -3
- package/dist/example/ExampleFoundationsSection.js +1 -1
- package/dist/example/ExampleOverlays.d.ts.map +1 -1
- package/dist/example/ExampleOverlays.js +7 -2
- package/dist/example/ExampleOverlaysSection.d.ts.map +1 -1
- package/dist/example/ExampleOverlaysSection.js +5 -2
- package/dist/example/ExampleSelectionSection.d.ts +3 -1
- package/dist/example/ExampleSelectionSection.d.ts.map +1 -1
- package/dist/example/ExampleSelectionSection.js +10 -3
- package/dist/example/ExampleStateSection.d.ts +3 -0
- package/dist/example/ExampleStateSection.d.ts.map +1 -1
- package/dist/example/ExampleStateSection.js +58 -3
- package/dist/example/ExampleThemePlayground.d.ts +101 -71
- package/dist/example/ExampleThemePlayground.d.ts.map +1 -1
- package/dist/example/ExampleThemePlayground.js +137 -74
- package/dist/example/UiExamplePage.d.ts +7 -1
- package/dist/example/UiExamplePage.d.ts.map +1 -1
- package/dist/example/UiExamplePage.js +72 -27
- package/dist/example/codeSamples.d.ts +7 -0
- package/dist/example/codeSamples.d.ts.map +1 -1
- package/dist/example/codeSamples.js +429 -60
- package/dist/example/exampleData.d.ts.map +1 -1
- package/dist/example/exampleData.js +16 -2
- package/dist/example/styles.css +245 -74
- package/dist/hooks/useFloatingPosition.js +1 -1
- package/dist/hooks/usePresence.d.ts.map +1 -1
- package/dist/hooks/usePresence.js +9 -7
- package/dist/index.d.ts +8 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -1
- package/dist/styles/orcestr-ui.css +2545 -672
- package/dist/theme/ThemeProvider.d.ts.map +1 -1
- package/dist/theme/ThemeProvider.js +90 -36
- package/dist/theme/defaultTheme.d.ts.map +1 -1
- package/dist/theme/defaultTheme.js +322 -194
- package/dist/theme/systemProps.d.ts +48 -28
- package/dist/theme/systemProps.d.ts.map +1 -1
- package/dist/theme/systemProps.js +103 -1
- package/dist/theme/themeTypes.d.ts +21 -17
- package/dist/theme/themeTypes.d.ts.map +1 -1
- package/dist/utils/slot.d.ts +11 -0
- package/dist/utils/slot.d.ts.map +1 -0
- package/dist/utils/slot.js +18 -0
- package/package.json +2 -2
- package/dist/components/Workflow/Workflow.d.ts +0 -82
- package/dist/components/Workflow/Workflow.d.ts.map +0 -1
- package/dist/components/Workflow/Workflow.js +0 -73
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPalette.tsx"],"names":[],"mappings":"AAEA,OAAO,EAQH,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAIf,OAAO,EAGH,KAAK,iBAAiB,EACzB,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"CommandPalette.d.ts","sourceRoot":"","sources":["../../../src/components/CommandPalette/CommandPalette.tsx"],"names":[],"mappings":"AAEA,OAAO,EAQH,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAIf,OAAO,EAGH,KAAK,iBAAiB,EACzB,MAAM,uBAAuB,CAAC;AAQ/B,MAAM,MAAM,kBAAkB,GAAG,iBAAiB,GAAG;IACjD,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,EAAE,CAAC;CACvB,CAAC;AAQF,wBAAgB,cAAc,CAAC,EAC3B,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,WAAgB,EAChB,QAAQ,EACR,KAAK,EACL,WAAW,EACX,WAAW,EACX,SAAS,EACT,WAAW,EACX,gBAAqB,EACrB,MAAM,GACT,EAAE;IACC,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IACzC,WAAW,CAAC,EAAE,aAAa,CAAC,kBAAkB,CAAC,CAAC;IAChD,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,gBAAgB,CAAC,EAAE,aAAa,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,2CAuRA"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
3
|
import { useCallback, useEffect, useId, useMemo, useRef, useState, } from 'react';
|
|
4
|
-
import { LuSearch } from 'react-icons/lu';
|
|
4
|
+
import { LuSearch, LuX } from 'react-icons/lu';
|
|
5
5
|
import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
|
|
6
6
|
import { actionItemSearchText, isActionItemDisabled, } from '../Action/ActionTypes';
|
|
7
7
|
import { ActionConfirmModal } from '../Action/ActionConfirmModal';
|
|
8
8
|
import { Collapse } from '../Collapse/Collapse';
|
|
9
9
|
import { Modal } from '../Modal/Modal';
|
|
10
|
+
import { IconButton } from '../IconButton/IconButton';
|
|
10
11
|
import { Spinner } from '../Spinner/Spinner';
|
|
11
12
|
import { TextField } from '../TextField/TextField';
|
|
12
13
|
export function CommandPalette({ open, onOpenChange, items, recentItems = [], onSelect, title, description, placeholder, emptyText, recentTitle, globalOpenEvents = [], testId, }) {
|
|
@@ -145,18 +146,18 @@ export function CommandPalette({ open, onOpenChange, items, recentItems = [], on
|
|
|
145
146
|
setQuery('');
|
|
146
147
|
}
|
|
147
148
|
};
|
|
148
|
-
return (_jsxs(_Fragment, { children: [
|
|
149
|
+
return (_jsxs(_Fragment, { children: [_jsxs(Modal, { open: open, onOpenChange: (next) => {
|
|
149
150
|
if (next)
|
|
150
151
|
onOpenChange(true);
|
|
151
152
|
else
|
|
152
153
|
close();
|
|
153
|
-
}, title: actualTitle, description: actualDescription,
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
154
|
+
}, maxWidth: 520, testId: testId, children: [_jsxs(Modal.Header, { children: [_jsxs("div", { className: 'oui-modal-title-wrap', children: [_jsx("h2", { className: 'oui-modal-title', children: actualTitle }), _jsx("p", { className: 'oui-modal-description', children: actualDescription })] }), _jsx(IconButton, { v: 'ghost', icon: _jsx(LuX, { size: 18 }), "aria-label": copy.common.close, onClick: close })] }), _jsx(Modal.Body, { children: _jsxs("div", { className: 'oui-command-palette', "data-testid": testId ? `${testId}-panel` : undefined, onKeyDown: handleKeyDown, children: [_jsx(TextField, { autoFocus: true, className: 'oui-command-palette-search', leftSlot: _jsx(LuSearch, { size: 16 }), placeholder: actualPlaceholder, value: query, role: 'combobox', "aria-autocomplete": 'list', "aria-controls": listboxId, "aria-expanded": open, "aria-activedescendant": selectedItem
|
|
155
|
+
? commandOptionId(listboxId, actualSelectedIndex)
|
|
156
|
+
: undefined, onChange: (event) => setQuery(event.target.value) }), _jsx("div", { ref: optionsRef, id: listboxId, className: 'oui-command-palette-results', role: 'listbox', "aria-label": copy.common.commandPaletteResults, children: _jsx(Collapse, { open: true, className: 'oui-command-palette-collapse', children: groups.length > 0 ? (groups.map((groupData) => (_jsxs("div", { className: 'oui-command-palette-group', children: [_jsx("div", { className: 'oui-command-palette-group-title', "data-recent": groupData.recent ? 'true' : undefined, children: groupData.group }), _jsx("div", { className: 'oui-command-palette-items', children: groupData.items.map((item) => {
|
|
157
|
+
const index = options.indexOf(item);
|
|
158
|
+
const selected = index === actualSelectedIndex;
|
|
159
|
+
return (_jsxs("button", { id: commandOptionId(listboxId, index), type: 'button', role: 'option', "aria-selected": selected, className: 'oui-command-palette-item', "data-selected": selected ? 'true' : undefined, "data-loading": item.loading ? 'true' : undefined, "data-tone": item.tone, "data-oui-command-index": index, "aria-busy": item.loading ? 'true' : undefined, disabled: isActionItemDisabled(item), onMouseEnter: () => setSelectedIndex(index), onClick: () => selectItem(item), children: [item.icon || item.loading ? (_jsx("span", { className: 'oui-command-palette-item-icon', children: item.loading ? _jsx(Spinner, { size: 1 }) : item.icon })) : null, _jsxs("span", { className: 'oui-command-palette-item-main', children: [_jsx("span", { className: 'oui-command-palette-item-label', children: item.label }), item.description ? (_jsx("span", { className: 'oui-command-palette-item-description', children: item.description })) : null] }), item.shortcut ? (_jsx("span", { className: 'oui-command-palette-shortcut', children: item.shortcut })) : null] }, `${groupData.group}-${item.key}`));
|
|
160
|
+
}) })] }, groupData.group)))) : (_jsx("div", { className: 'oui-command-palette-empty', children: actualEmptyText })) }) })] }) })] }), _jsx(ActionConfirmModal, { item: confirmItem, open: confirmItem !== null, onCancel: () => setConfirmItem(null), onConfirm: () => {
|
|
160
161
|
confirmItem?.onSelect?.();
|
|
161
162
|
if (confirmItem)
|
|
162
163
|
onSelect(confirmItem.key);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../../src/components/ConfirmDialog/ConfirmDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"ConfirmDialog.d.ts","sourceRoot":"","sources":["../../../src/components/ConfirmDialog/ConfirmDialog.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAIrC,OAAO,KAAK,EAAC,IAAI,EAAC,MAAM,yBAAyB,CAAC;AAIlD,OAAO,EAAQ,KAAK,UAAU,EAAC,MAAM,gBAAgB,CAAC;AAGtD,MAAM,MAAM,iBAAiB,GAAG,OAAO,CACnC,IAAI,EACJ,QAAQ,GAAG,MAAM,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,CACxD,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,WAAW,CAAC,EAAE,SAAS,CAAC;IACxB,IAAI,CAAC,EAAE,iBAAiB,CAAC;IACzB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,EAAE,UAAU,CAAC,UAAU,CAAC,CAAC;IAClC,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,IAAI,CAAC;CACzB,CAAC;AAEF,wBAAgB,aAAa,CAAC,EAC1B,IAAI,EACJ,YAAY,EACZ,KAAK,EACL,WAAW,EACX,OAAO,EACP,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,IAAgB,EAChB,OAAe,EACf,eAAuB,EACvB,cAAsB,EACtB,mBAAmB,EACnB,QAAc,EACd,MAAM,EACN,SAAS,EACT,QAAQ,GACX,EAAE,kBAAkB,2CA0EpB"}
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx,
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { LuX } from 'react-icons/lu';
|
|
3
4
|
import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
|
|
4
5
|
import { Button } from '../Button/Button';
|
|
6
|
+
import { Flex } from '../Flex/Flex';
|
|
7
|
+
import { IconButton } from '../IconButton/IconButton';
|
|
5
8
|
import { Modal } from '../Modal/Modal';
|
|
6
9
|
import { Text } from '../Text/Text';
|
|
7
10
|
export function ConfirmDialog({ open, onOpenChange, title, description, message, children, confirmLabel, cancelLabel, tone = 'neutral', loading = false, confirmDisabled = false, cancelDisabled = false, closeOnOverlayClick, maxWidth = 420, testId, onConfirm, onCancel, }) {
|
|
@@ -21,5 +24,5 @@ export function ConfirmDialog({ open, onOpenChange, title, description, message,
|
|
|
21
24
|
return;
|
|
22
25
|
}
|
|
23
26
|
cancel();
|
|
24
|
-
},
|
|
27
|
+
}, maxWidth: maxWidth, closeOnOverlayClick: closeOnOverlayClick ?? canClose, testId: testId, children: [title || description ? (_jsxs(Modal.Header, { children: [_jsxs("div", { className: 'oui-modal-title-wrap', children: [title ? _jsx("h2", { className: 'oui-modal-title', children: title }) : null, description ? (_jsx("p", { className: 'oui-modal-description', children: description })) : null] }), _jsx(IconButton, { v: 'ghost', icon: _jsx(LuX, { size: 18 }), "aria-label": copy.common.close, disabled: !canClose, onClick: cancel })] })) : null, _jsxs(Modal.Body, { children: [message ? (_jsx(Text, { as: 'p', tone: 'muted', lh: 1.5, children: message })) : null, children] }), _jsx(Modal.Footer, { children: _jsxs(Flex, { g: 2, j: 'e', w: '100%', children: [_jsx(Button, { v: 'surface', onClick: cancel, disabled: !canClose, testId: testId ? `${testId}-cancel` : undefined, children: actualCancelLabel }), _jsx(Button, { tone: tone, loading: loading, disabled: confirmDisabled, onClick: onConfirm, testId: testId ? `${testId}-confirm` : undefined, children: actualConfirmLabel })] }) })] }));
|
|
25
28
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/components/ContextMenu/ContextMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,UAAU,EACf,KAAK,YAAY,EACpB,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"ContextMenu.d.ts","sourceRoot":"","sources":["../../../src/components/ContextMenu/ContextMenu.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,UAAU,EACf,KAAK,YAAY,EACpB,MAAM,OAAO,CAAC;AAKf,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,cAAc,CAAC;AAS3C,wBAAgB,WAAW,CAAC,EACxB,QAAQ,EACR,KAAK,EACL,SAAS,EACT,MAAM,GACT,EAAE;IACC,QAAQ,EAAE,YAAY,CAAC;QAAC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,UAAU,KAAK,IAAI,CAAA;KAAC,CAAC,CAAC;IACtE,KAAK,EAAE,aAAa,CAAC,QAAQ,CAAC,CAAC;IAC/B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,2CAiFA"}
|
|
@@ -4,7 +4,7 @@ import { cloneElement, useCallback, useEffect, useRef, useState, } from 'react';
|
|
|
4
4
|
import { cn } from '../../utils/cn';
|
|
5
5
|
import { ActionConfirmModal } from '../Action/ActionConfirmModal';
|
|
6
6
|
import { isActionItemDisabled } from '../Action/ActionTypes';
|
|
7
|
-
import { useOverlayContext, useOverlayLayerIndex } from '../Overlay/OverlayProvider';
|
|
7
|
+
import { overlayLayerZIndex, useOverlayContext, useOverlayLayerIndex, } from '../Overlay/OverlayProvider';
|
|
8
8
|
import { Portal } from '../Portal/Portal';
|
|
9
9
|
import { Spinner } from '../Spinner/Spinner';
|
|
10
10
|
export function ContextMenu({ children, items, className, testId, }) {
|
|
@@ -47,7 +47,7 @@ export function ContextMenu({ children, items, className, testId, }) {
|
|
|
47
47
|
return (_jsxs(_Fragment, { children: [trigger, point ? (_jsx(Portal, { children: _jsx("div", { ref: layerRef, className: cn('oui-popover-content oui-menu oui-action-menu-content oui-context-menu-content', className), "data-state": 'opening', "data-layer": 'dropdown', "data-testid": testId, style: {
|
|
48
48
|
left: point.x,
|
|
49
49
|
top: point.y,
|
|
50
|
-
zIndex: overlay.zIndex
|
|
50
|
+
zIndex: overlayLayerZIndex(overlay.zIndex, 'dropdown', layerIndex),
|
|
51
51
|
}, onClick: (event) => event.stopPropagation(), children: _jsx(ContextMenuContent, { items: items, close: close, requestConfirmation: setConfirmItem, testId: testId ? `${testId}-list` : undefined }) }) })) : null, _jsx(ActionConfirmModal, { item: confirmItem, open: confirmItem !== null, onCancel: () => setConfirmItem(null), onConfirm: () => {
|
|
52
52
|
confirmItem?.onSelect?.();
|
|
53
53
|
setConfirmItem(null);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"DatePicker.d.ts","sourceRoot":"","sources":["../../../src/components/DatePicker/DatePicker.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAqC,KAAK,SAAS,EAAC,MAAM,OAAO,CAAC;AAQzE,OAAO,EAQH,KAAK,sBAAsB,EAC9B,MAAM,mBAAmB,CAAC;AAE3B,MAAM,MAAM,eAAe,GAAG;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,YAAY,CAAC,EAAE,sBAAsB,CAAC;IACtC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,UAAU,CAAC,EAAE,SAAS,CAAC;IACvB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACvB,KAAK,EACL,aAAa,EACb,GAAG,EACH,GAAG,EACH,YAAY,EACZ,WAAW,EACX,SAAgB,EAChB,QAAgB,EAChB,QAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,cAAc,EACd,UAAU,EACV,MAAM,EACN,MAAM,GACT,EAAE,eAAe,2CA2IjB"}
|
|
@@ -26,13 +26,21 @@ export function DatePicker({ value, onValueChange, min, max, disabledDate, place
|
|
|
26
26
|
onValueChange(clampDate(nextValue, min, max));
|
|
27
27
|
setOpen(false);
|
|
28
28
|
};
|
|
29
|
+
const openCalendar = (event) => {
|
|
30
|
+
event.preventDefault();
|
|
31
|
+
event.stopPropagation();
|
|
32
|
+
if (disabled || readOnly)
|
|
33
|
+
return;
|
|
34
|
+
setCursorMonth(monthCursorForDate(value));
|
|
35
|
+
setOpen(true);
|
|
36
|
+
};
|
|
29
37
|
return (_jsx(Popover, { open: open, onOpenChange: (nextOpen) => {
|
|
30
38
|
if (readOnly && nextOpen)
|
|
31
39
|
return;
|
|
32
40
|
if (nextOpen)
|
|
33
41
|
setCursorMonth(monthCursorForDate(value));
|
|
34
42
|
setOpen(nextOpen);
|
|
35
|
-
}, disabled: disabled || readOnly, matchTriggerWidth: false, sideOffset: 6, testId: testId ? `${testId}-popover` : undefined, trigger: _jsx(TextField, { value: displayValue, placeholder: placeholder, readOnly: true, disabled: disabled, clearable: clearable && Boolean(value) && !readOnly, testId: testId, "aria-label": openCalendarLabel ?? copy.common.openCalendar, onClear: () => onValueChange(''), rightSlot: _jsx("
|
|
43
|
+
}, disabled: disabled || readOnly, matchTriggerWidth: false, sideOffset: 6, testId: testId ? `${testId}-popover` : undefined, trigger: _jsx(TextField, { value: displayValue, placeholder: placeholder, readOnly: true, disabled: disabled, clearable: clearable && Boolean(value) && !readOnly, testId: testId, "aria-label": openCalendarLabel ?? copy.common.openCalendar, onClear: () => onValueChange(''), rightSlot: _jsx("button", { type: 'button', className: 'oui-date-picker-trigger', "aria-label": openCalendarLabel ?? copy.common.openCalendar, disabled: disabled || readOnly, onClick: openCalendar, children: _jsx(LuCalendarDays, { size: 16 }) }) }), className: 'oui-date-picker-popover', children: _jsxs("div", { className: 'oui-date-picker-panel', children: [_jsxs("div", { className: 'oui-date-picker-head', children: [_jsx(IconButton, { size: 1, v: 'ghost', type: 'button', icon: _jsx(LuChevronLeft, { size: 16 }), "aria-label": previousMonthLabel ?? copy.common.previous, onClick: () => setCursorMonth((current) => shiftMonth(current, -1)) }), _jsx("strong", { children: formatMonthLabel(cursorMonth, actualLocale) }), _jsx(IconButton, { size: 1, v: 'ghost', type: 'button', icon: _jsx(LuChevronRight, { size: 16 }), "aria-label": nextMonthLabel ?? copy.common.next, onClick: () => setCursorMonth((current) => shiftMonth(current, 1)) })] }), _jsx("div", { className: 'oui-date-picker-weekdays', children: weekdays.map((weekday) => (_jsx("span", { children: weekday }, weekday))) }), _jsx("div", { className: 'oui-date-picker-grid', children: monthState.weeks.flatMap((week) => week.map((day) => (_jsx("button", { type: 'button', className: 'oui-date-picker-day', "data-outside": day.outsideMonth ? 'true' : undefined, "data-selected": day.selected ? 'true' : undefined, "data-today": day.today ? 'true' : undefined, disabled: day.disabled, "aria-pressed": day.selected, onClick: () => selectDate(day.date), children: day.day }, day.date)))) }), _jsxs("div", { className: 'oui-date-picker-foot', children: [_jsx(Button, { size: 1, v: 'ghost', type: 'button', onClick: () => selectDate(clampDate(new Date().toISOString().slice(0, 10), min, max)), children: todayLabel ?? copy.dates.today }), clearable ? (_jsx(Button, { size: 1, v: 'ghost', type: 'button', disabled: !value, onClick: () => {
|
|
36
44
|
onValueChange('');
|
|
37
45
|
setOpen(false);
|
|
38
46
|
}, children: copy.common.clear })) : null] })] }) }));
|
|
@@ -1,2 +1,70 @@
|
|
|
1
|
-
|
|
1
|
+
import { type CSSProperties, type KeyboardEventHandler, type ReactNode } from 'react';
|
|
2
|
+
import { type ModalProps } from '../Modal/Modal';
|
|
3
|
+
import { type SystemProps } from '../../theme/systemProps';
|
|
4
|
+
export type DialogProps = ModalProps;
|
|
5
|
+
export declare const Dialog: (({ open, onOpenChange, children, maxWidth, minHeight, overlayColor, overlayOpacity, overlayBlur, borderColor, radius, shadow, animationDuration, animation, overlayClassName, overlayStyle, className, contentClassName, contentStyle, onKeyDown, onOpenAutoFocus, closeOnOverlayClick, ariaLabel, ariaLabelledBy, ariaDescribedBy, testId, }: ModalProps) => import("react/jsx-runtime").JSX.Element | null) & {
|
|
6
|
+
Header: ({ children, className, style }: {
|
|
7
|
+
children: ReactNode;
|
|
8
|
+
className?: string;
|
|
9
|
+
style?: CSSProperties;
|
|
10
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
Body: ({ children, className, style }: {
|
|
12
|
+
children: ReactNode;
|
|
13
|
+
className?: string;
|
|
14
|
+
style?: CSSProperties;
|
|
15
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
Footer: ({ children, className, style }: {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
className?: string;
|
|
19
|
+
style?: CSSProperties;
|
|
20
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
Close: ({ onClick, ...props }: import("react").ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
22
|
+
asChild?: false;
|
|
23
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
24
|
+
} & {
|
|
25
|
+
Root: typeof DialogRoot;
|
|
26
|
+
Content: typeof DialogContent;
|
|
27
|
+
Title: typeof DialogTitle;
|
|
28
|
+
Description: typeof DialogDescription;
|
|
29
|
+
Close: typeof DialogClose;
|
|
30
|
+
};
|
|
31
|
+
type DialogRootProps = {
|
|
32
|
+
open: boolean;
|
|
33
|
+
onOpenChange: (open: boolean) => void;
|
|
34
|
+
children: ReactNode;
|
|
35
|
+
};
|
|
36
|
+
declare function DialogRoot({ open, onOpenChange, children }: DialogRootProps): import("react/jsx-runtime").JSX.Element;
|
|
37
|
+
type DialogContentProps = Omit<ModalProps, 'open' | 'onOpenChange' | 'children' | 'ariaLabelledBy' | 'ariaDescribedBy'> & {
|
|
38
|
+
children: ReactNode;
|
|
39
|
+
className?: string;
|
|
40
|
+
style?: CSSProperties;
|
|
41
|
+
onKeyDown?: KeyboardEventHandler<HTMLDivElement>;
|
|
42
|
+
onOpenAutoFocus?: (event: {
|
|
43
|
+
preventDefault: () => void;
|
|
44
|
+
}) => void;
|
|
45
|
+
onEscapeKeyDown?: (event: {
|
|
46
|
+
preventDefault: () => void;
|
|
47
|
+
}) => void;
|
|
48
|
+
};
|
|
49
|
+
declare function DialogContent({ children, className, style, ...props }: DialogContentProps): import("react/jsx-runtime").JSX.Element | null;
|
|
50
|
+
type DialogTitleProps = {
|
|
51
|
+
children: ReactNode;
|
|
52
|
+
} & SystemProps & {
|
|
53
|
+
className?: string;
|
|
54
|
+
style?: CSSProperties;
|
|
55
|
+
};
|
|
56
|
+
declare function DialogTitle({ children, className, style, ...props }: DialogTitleProps): import("react/jsx-runtime").JSX.Element;
|
|
57
|
+
type DialogDescriptionProps = {
|
|
58
|
+
children: ReactNode;
|
|
59
|
+
size?: number | string;
|
|
60
|
+
} & SystemProps & {
|
|
61
|
+
className?: string;
|
|
62
|
+
style?: CSSProperties;
|
|
63
|
+
};
|
|
64
|
+
declare function DialogDescription({ children, className, style, size: _size, ...props }: DialogDescriptionProps): import("react/jsx-runtime").JSX.Element;
|
|
65
|
+
type DialogCloseProps = {
|
|
66
|
+
children: ReactNode;
|
|
67
|
+
};
|
|
68
|
+
declare function DialogClose({ children }: DialogCloseProps): import("react/jsx-runtime").JSX.Element;
|
|
69
|
+
export {};
|
|
2
70
|
//# sourceMappingURL=Dialog.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Dialog.d.ts","sourceRoot":"","sources":["../../../src/components/Dialog/Dialog.tsx"],"names":[],"mappings":"AAEA,OAAO,EAIH,KAAK,aAAa,EAClB,KAAK,oBAAoB,EACzB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAEf,OAAO,EAAQ,KAAK,UAAU,EAAC,MAAM,gBAAgB,CAAC;AACtD,OAAO,EAAmB,KAAK,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAG3E,MAAM,MAAM,WAAW,GAAG,UAAU,CAAC;AAErC,eAAO,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;CAMjB,CAAC;AAWH,KAAK,eAAe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W,GAAG;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,aAAa,CAAC;CACzB,CAAC;AAEF,iBAAS,iBAAiB,CAAC,EACvB,QAAQ,EACR,SAAS,EACT,KAAK,EACL,IAAI,EAAE,KAAK,EACX,GAAG,KAAK,EACX,EAAE,sBAAsB,2CAaxB;AAED,KAAK,gBAAgB,GAAG;IACpB,QAAQ,EAAE,SAAS,CAAC;CACvB,CAAC;AAEF,iBAAS,WAAW,CAAC,EAAC,QAAQ,EAAC,EAAE,gBAAgB,2CAehD"}
|
|
@@ -1 +1,48 @@
|
|
|
1
|
-
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext, useId, } from 'react';
|
|
4
|
+
import { Modal } from '../Modal/Modal';
|
|
5
|
+
import { splitSystemProps } from '../../theme/systemProps';
|
|
6
|
+
import { cn } from '../../utils/cn';
|
|
7
|
+
export const Dialog = Object.assign(Modal, {
|
|
8
|
+
Root: DialogRoot,
|
|
9
|
+
Content: DialogContent,
|
|
10
|
+
Title: DialogTitle,
|
|
11
|
+
Description: DialogDescription,
|
|
12
|
+
Close: DialogClose,
|
|
13
|
+
});
|
|
14
|
+
const DialogContext = createContext(null);
|
|
15
|
+
function DialogRoot({ open, onOpenChange, children }) {
|
|
16
|
+
return (_jsx(DialogContext.Provider, { value: { open, onOpenChange }, children: children }));
|
|
17
|
+
}
|
|
18
|
+
function DialogContent({ children, className, style, ...props }) {
|
|
19
|
+
const context = useContext(DialogContext);
|
|
20
|
+
const titleId = useId();
|
|
21
|
+
const descriptionId = useId();
|
|
22
|
+
if (!context)
|
|
23
|
+
return null;
|
|
24
|
+
return (_jsx(DialogContext.Provider, { value: {
|
|
25
|
+
...context,
|
|
26
|
+
titleId,
|
|
27
|
+
descriptionId,
|
|
28
|
+
}, children: _jsx(Modal, { ...props, open: context.open, onOpenChange: context.onOpenChange, ariaLabelledBy: titleId, ariaDescribedBy: descriptionId, contentClassName: className, contentStyle: style, children: children }) }));
|
|
29
|
+
}
|
|
30
|
+
function DialogTitle({ children, className, style, ...props }) {
|
|
31
|
+
const context = useContext(DialogContext);
|
|
32
|
+
const { systemStyle, restProps } = splitSystemProps(props);
|
|
33
|
+
return (_jsx("h2", { id: context?.titleId, className: cn('oui-modal-title', className), style: { ...systemStyle, ...style }, ...restProps, children: children }));
|
|
34
|
+
}
|
|
35
|
+
function DialogDescription({ children, className, style, size: _size, ...props }) {
|
|
36
|
+
const context = useContext(DialogContext);
|
|
37
|
+
const { systemStyle, restProps } = splitSystemProps(props);
|
|
38
|
+
return (_jsx("p", { id: context?.descriptionId, className: cn('oui-modal-description', className), style: { ...systemStyle, ...style }, ...restProps, children: children }));
|
|
39
|
+
}
|
|
40
|
+
function DialogClose({ children }) {
|
|
41
|
+
const context = useContext(DialogContext);
|
|
42
|
+
return (_jsx("span", { onClick: () => context?.onOpenChange(false), onKeyDown: (event) => {
|
|
43
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
44
|
+
event.preventDefault();
|
|
45
|
+
context?.onOpenChange(false);
|
|
46
|
+
}
|
|
47
|
+
}, children: children }));
|
|
48
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,aAAa,EAClB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Drawer.d.ts","sourceRoot":"","sources":["../../../src/components/Drawer/Drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,EAMH,KAAK,aAAa,EAClB,KAAK,SAAS,EACjB,MAAM,OAAO,CAAC;AAkBf,MAAM,MAAM,UAAU,GAAG,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,CAAC;AAE7D,MAAM,MAAM,WAAW,GAAG;IACtB,IAAI,CAAC,EAAE,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kDAqHb"}
|
|
@@ -9,7 +9,7 @@ import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
|
|
|
9
9
|
import { OrcestrThemeContext } from '../../theme/useTheme';
|
|
10
10
|
import { cn } from '../../utils/cn';
|
|
11
11
|
import { IconButton } from '../IconButton/IconButton';
|
|
12
|
-
import { lockOverlayScroll, useOverlayContext, useOverlayLayerIndex, } from '../Overlay/OverlayProvider';
|
|
12
|
+
import { lockOverlayScroll, overlayLayerZIndex, useOverlayContext, useOverlayLayerIndex, } from '../Overlay/OverlayProvider';
|
|
13
13
|
import { Portal } from '../Portal/Portal';
|
|
14
14
|
export function Drawer({ open, defaultOpen, onOpenChange, side = 'right', size, title, description, children, footer, modal = true, trapFocus = modal, lockScroll = modal, closeOnBackdropClick = true, closeOnEscape = true, showBackdrop = modal, showCloseButton = true, className, panelClassName, bodyClassName, backdropClassName, style, panelStyle, backdropStyle, testId, }) {
|
|
15
15
|
const { copy } = useOrcestrUiLocale();
|
|
@@ -22,7 +22,7 @@ export function Drawer({ open, defaultOpen, onOpenChange, side = 'right', size,
|
|
|
22
22
|
const ease = themeContext?.theme.motion.ease ?? 'cubic-bezier(0.22, 1, 0.36, 1)';
|
|
23
23
|
const { present, state } = usePresence(isOpen, durationMs);
|
|
24
24
|
const layerIndex = useOverlayLayerIndex(present);
|
|
25
|
-
const zIndex = overlay.zIndex
|
|
25
|
+
const zIndex = overlayLayerZIndex(overlay.zIndex, 'modal', layerIndex);
|
|
26
26
|
const panelRef = useRef(null);
|
|
27
27
|
const titleId = useId();
|
|
28
28
|
const descriptionId = useId();
|
|
@@ -27,6 +27,7 @@ export type EntityPickerProps<T> = {
|
|
|
27
27
|
disabled?: boolean;
|
|
28
28
|
clearable?: boolean;
|
|
29
29
|
showChevron?: boolean;
|
|
30
|
+
trigger?: ReactNode;
|
|
30
31
|
size?: UiSize;
|
|
31
32
|
maxHeight?: number;
|
|
32
33
|
closeOnSelect?: boolean;
|
|
@@ -37,5 +38,5 @@ export type EntityPickerProps<T> = {
|
|
|
37
38
|
debounceMs?: number;
|
|
38
39
|
testId?: string;
|
|
39
40
|
};
|
|
40
|
-
export declare function EntityPicker<T>({ loadPage, getEntityId, renderEntity, renderValue, value, onValueChange, placeholder, emptyText, loadingText, errorText, retryLabel, disabled, clearable, showChevron, size, maxHeight, closeOnSelect, isEntitySelected, createAction, optionAction, resetKey, debounceMs, testId, }: EntityPickerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
41
|
+
export declare function EntityPicker<T>({ loadPage, getEntityId, renderEntity, renderValue, value, onValueChange, placeholder, emptyText, loadingText, errorText, retryLabel, disabled, clearable, showChevron, trigger, size, maxHeight, closeOnSelect, isEntitySelected, createAction, optionAction, resetKey, debounceMs, testId, }: EntityPickerProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
41
42
|
//# sourceMappingURL=EntityPicker.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EntityPicker.d.ts","sourceRoot":"","sources":["../../../src/components/EntityPicker/EntityPicker.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,OAAO,CAAC;AAErC,OAAO,KAAK,EAAC,MAAM,EAAC,MAAM,yBAAyB,CAAC;AAEpD,OAAO,EAGH,KAAK,eAAe,EACvB,MAAM,wCAAwC,CAAC;AAEhD,MAAM,MAAM,wBAAwB,GAAG;IACnC,KAAK,CAAC,EAAE,MAAM,GAAG,CAAC,CAAC,MAAM,EAAE,MAAM,KAAK,MAAM,CAAC,CAAC;IAC9C,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,QAAQ,CAAC,EAAE,OAAO,CAAC;CACtB,CAAC;AAEF,MAAM,MAAM,wBAAwB,CAAC,CAAC,IAAI;IACtC,KAAK,EAAE,CAAC,IAAI,EAAE,CAAC,KAAK,MAAM,CAAC;IAC3B,IAAI,EAAE,SAAS,CAAC;IAChB,OAAO,EAAE,CAAC,IAAI,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,CAAC,CAAC,EAAE,EAC5B,QAAQ,EACR,WAAW,EACX,YAAY,EACZ,WAAW,EACX,KAAK,EACL,aAAa,EACb,WAAW,EACX,SAAS,EACT,WAAW,EACX,SAAS,EACT,UAAU,EACV,QAAgB,EAChB,SAAgB,EAChB,WAAkB,EAClB,OAAO,EACP,IAAQ,EACR,SAAe,EACf,aAAoB,EACpB,gBAAgB,EAChB,YAAY,EACZ,YAAY,EACZ,QAAQ,EACR,UAAU,EACV,MAAM,GACT,EAAE,iBAAiB,CAAC,CAAC,CAAC,2CA+CtB"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
3
|
import { useOrcestrUiLocale } from '../../locale/LocaleProvider';
|
|
4
4
|
import { PaginatedCombobox, } from '../PaginatedCombobox/PaginatedCombobox';
|
|
5
|
-
export function EntityPicker({ loadPage, getEntityId, renderEntity, renderValue, value, onValueChange, placeholder, emptyText, loadingText, errorText, retryLabel, disabled = false, clearable = true, showChevron = true, size = 3, maxHeight = 280, closeOnSelect = true, isEntitySelected, createAction, optionAction, resetKey, debounceMs, testId, }) {
|
|
5
|
+
export function EntityPicker({ loadPage, getEntityId, renderEntity, renderValue, value, onValueChange, placeholder, emptyText, loadingText, errorText, retryLabel, disabled = false, clearable = true, showChevron = true, trigger, size = 3, maxHeight = 280, closeOnSelect = true, isEntitySelected, createAction, optionAction, resetKey, debounceMs, testId, }) {
|
|
6
6
|
const { copy } = useOrcestrUiLocale();
|
|
7
7
|
const searchAction = createAction
|
|
8
8
|
? {
|
|
@@ -13,5 +13,5 @@ export function EntityPicker({ loadPage, getEntityId, renderEntity, renderValue,
|
|
|
13
13
|
onClick: (search) => createAction.onCreate(search),
|
|
14
14
|
}
|
|
15
15
|
: undefined;
|
|
16
|
-
return (_jsx(PaginatedCombobox, { loadPage: loadPage, getItemId: getEntityId, renderOption: (item) => (_jsx("div", { className: 'oui-entity-picker-option', children: renderEntity(item) })), renderSelectedLabel: (item) => (_jsx("span", { className: 'oui-entity-picker-value', children: renderValue?.(item) ?? renderEntity(item) })), value: value, onChange: onValueChange, placeholder: placeholder ?? copy.common.selectEntity, emptyText: emptyText ?? copy.common.noOptions, loadingText: loadingText, errorText: errorText, retryLabel: retryLabel, disabled: disabled, clearable: clearable, showChevron: showChevron, size: size, maxHeight: maxHeight, closeOnSelect: closeOnSelect, isItemSelected: isEntitySelected, searchAction: searchAction, optionAction: optionAction, resetKey: resetKey, debounceMs: debounceMs, testId: testId }));
|
|
16
|
+
return (_jsx(PaginatedCombobox, { loadPage: loadPage, getItemId: getEntityId, renderOption: (item) => (_jsx("div", { className: 'oui-entity-picker-option', children: renderEntity(item) })), renderSelectedLabel: (item) => (_jsx("span", { className: 'oui-entity-picker-value', children: renderValue?.(item) ?? renderEntity(item) })), value: value, onChange: onValueChange, placeholder: placeholder ?? copy.common.selectEntity, emptyText: emptyText ?? copy.common.noOptions, loadingText: loadingText, errorText: errorText, retryLabel: retryLabel, disabled: disabled, clearable: clearable, showChevron: showChevron, trigger: trigger, size: size, maxHeight: maxHeight, closeOnSelect: closeOnSelect, isItemSelected: isEntitySelected, searchAction: searchAction, optionAction: optionAction, resetKey: resetKey, debounceMs: debounceMs, testId: testId }));
|
|
17
17
|
}
|
|
@@ -1,9 +1,13 @@
|
|
|
1
|
-
import { type ComponentPropsWithoutRef } from 'react';
|
|
1
|
+
import { type ComponentPropsWithoutRef, type ElementType } from 'react';
|
|
2
2
|
import { type SystemProps } from '../../theme/systemProps';
|
|
3
3
|
export type FlexProps = ComponentPropsWithoutRef<'div'> & SystemProps & {
|
|
4
|
+
as?: ElementType;
|
|
5
|
+
asChild?: boolean;
|
|
4
6
|
testId?: string;
|
|
5
7
|
};
|
|
6
8
|
export declare const Flex: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SystemProps & {
|
|
9
|
+
as?: ElementType;
|
|
10
|
+
asChild?: boolean;
|
|
7
11
|
testId?: string;
|
|
8
12
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
9
13
|
//# sourceMappingURL=Flex.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Flex.d.ts","sourceRoot":"","sources":["../../../src/components/Flex/Flex.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Flex.d.ts","sourceRoot":"","sources":["../../../src/components/Flex/Flex.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEH,KAAK,wBAAwB,EAC7B,KAAK,WAAW,EAEnB,MAAM,OAAO,CAAC;AAGf,OAAO,EAAmB,KAAK,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAG3E,MAAM,MAAM,SAAS,GAAG,wBAAwB,CAAC,KAAK,CAAC,GACnD,WAAW,GAAG;IACV,EAAE,CAAC,EAAE,WAAW,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,eAAO,MAAM,IAAI;SALJ,WAAW;cACN,OAAO;aACR,MAAM;kDA8BrB,CAAC"}
|
|
@@ -1,8 +1,21 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { forwardRef } from 'react';
|
|
2
|
+
import { forwardRef, } from 'react';
|
|
3
3
|
import { cn } from '../../utils/cn';
|
|
4
4
|
import { splitSystemProps } from '../../theme/systemProps';
|
|
5
|
-
|
|
5
|
+
import { renderSlot } from '../../utils/slot';
|
|
6
|
+
export const Flex = forwardRef(function Flex({ as: Component = 'div', asChild = false, className, style, testId, children, ...props }, ref) {
|
|
6
7
|
const { systemStyle, restProps } = splitSystemProps(props);
|
|
7
|
-
|
|
8
|
+
const commonProps = {
|
|
9
|
+
className: cn('oui-flex', className),
|
|
10
|
+
'data-testid': testId,
|
|
11
|
+
style: { ...systemStyle, ...style },
|
|
12
|
+
...restProps,
|
|
13
|
+
};
|
|
14
|
+
if (asChild) {
|
|
15
|
+
return renderSlot(children, {
|
|
16
|
+
...commonProps,
|
|
17
|
+
ref: ref,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
return (_jsx(Component, { ref: ref, ...commonProps, children: children }));
|
|
8
21
|
});
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { type ComponentPropsWithoutRef } from 'react';
|
|
2
2
|
import { type SystemProps } from '../../theme/systemProps';
|
|
3
3
|
export type GridProps = ComponentPropsWithoutRef<'div'> & SystemProps & {
|
|
4
|
-
columns?:
|
|
4
|
+
columns?: GridColumns;
|
|
5
5
|
testId?: string;
|
|
6
6
|
};
|
|
7
|
+
export type GridColumns = number | string | {
|
|
8
|
+
initial?: number | string;
|
|
9
|
+
sm?: number | string;
|
|
10
|
+
md?: number | string;
|
|
11
|
+
lg?: number | string;
|
|
12
|
+
xl?: number | string;
|
|
13
|
+
};
|
|
7
14
|
export declare const Grid: import("react").ForwardRefExoticComponent<Omit<import("react").DetailedHTMLProps<import("react").HTMLAttributes<HTMLDivElement>, HTMLDivElement>, "ref"> & SystemProps & {
|
|
8
|
-
columns?:
|
|
15
|
+
columns?: GridColumns;
|
|
9
16
|
testId?: string;
|
|
10
17
|
} & import("react").RefAttributes<HTMLDivElement>>;
|
|
11
18
|
//# sourceMappingURL=Grid.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../src/components/Grid/Grid.tsx"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"Grid.d.ts","sourceRoot":"","sources":["../../../src/components/Grid/Grid.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiC,KAAK,wBAAwB,EAAC,MAAM,OAAO,CAAC;AAGpF,OAAO,EAAmB,KAAK,WAAW,EAAC,MAAM,yBAAyB,CAAC;AAE3E,MAAM,MAAM,SAAS,GAAG,wBAAwB,CAAC,KAAK,CAAC,GACnD,WAAW,GAAG;IACV,OAAO,CAAC,EAAE,WAAW,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAEN,MAAM,MAAM,WAAW,GACjB,MAAM,GACN,MAAM,GACN;IACE,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACrB,EAAE,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,CAAC;AAEN,eAAO,MAAM,IAAI;cAfC,WAAW;aACZ,MAAM;kDAiCrB,CAAC"}
|
|
@@ -4,9 +4,30 @@ import { cn } from '../../utils/cn';
|
|
|
4
4
|
import { splitSystemProps } from '../../theme/systemProps';
|
|
5
5
|
export const Grid = forwardRef(function Grid({ className, style, columns, testId, ...props }, ref) {
|
|
6
6
|
const { systemStyle, restProps } = splitSystemProps(props);
|
|
7
|
+
const columnStyle = gridColumnStyle(columns);
|
|
7
8
|
return (_jsx("div", { ref: ref, className: cn('oui-grid', className), "data-testid": testId, style: {
|
|
8
|
-
|
|
9
|
+
...columnStyle,
|
|
9
10
|
...systemStyle,
|
|
10
11
|
...style,
|
|
11
12
|
}, ...restProps }));
|
|
12
13
|
});
|
|
14
|
+
function gridColumnStyle(columns) {
|
|
15
|
+
if (columns === undefined)
|
|
16
|
+
return {};
|
|
17
|
+
if (typeof columns === 'number' || typeof columns === 'string') {
|
|
18
|
+
return { '--oui-grid-columns': columnValue(columns) };
|
|
19
|
+
}
|
|
20
|
+
return {
|
|
21
|
+
'--oui-grid-columns': columnValue(columns.initial ?? 1),
|
|
22
|
+
'--oui-grid-columns-sm': columns.sm ? columnValue(columns.sm) : undefined,
|
|
23
|
+
'--oui-grid-columns-md': columns.md ? columnValue(columns.md) : undefined,
|
|
24
|
+
'--oui-grid-columns-lg': columns.lg ? columnValue(columns.lg) : undefined,
|
|
25
|
+
'--oui-grid-columns-xl': columns.xl ? columnValue(columns.xl) : undefined,
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
function columnValue(value) {
|
|
29
|
+
const normalized = String(value).trim();
|
|
30
|
+
if (/^\d+$/.test(normalized))
|
|
31
|
+
return `repeat(${normalized}, minmax(0, 1fr))`;
|
|
32
|
+
return normalized;
|
|
33
|
+
}
|
|
@@ -1,25 +1,37 @@
|
|
|
1
1
|
import { type ButtonHTMLAttributes, type ReactNode } from 'react';
|
|
2
|
-
import { type SystemProps, type
|
|
2
|
+
import { type SystemProps, type ToneInput, type UiSize } from '../../theme/systemProps';
|
|
3
3
|
import type { ButtonPressAnimation } from '../../theme/themeTypes';
|
|
4
4
|
import type { ButtonVariant } from '../Button/Button';
|
|
5
|
-
export type IconButtonProps =
|
|
5
|
+
export type IconButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & SystemProps & {
|
|
6
6
|
size?: UiSize;
|
|
7
7
|
v?: ButtonVariant;
|
|
8
|
-
tone?:
|
|
9
|
-
icon
|
|
8
|
+
tone?: ToneInput;
|
|
9
|
+
icon?: ReactNode;
|
|
10
10
|
loading?: boolean;
|
|
11
11
|
round?: boolean;
|
|
12
|
+
badge?: ReactNode;
|
|
13
|
+
badgeTone?: ToneInput;
|
|
14
|
+
badgeMax?: number;
|
|
15
|
+
badgeTestId?: string;
|
|
12
16
|
pressAnimation?: ButtonPressAnimation;
|
|
17
|
+
asChild?: boolean;
|
|
18
|
+
children?: ReactNode;
|
|
13
19
|
testId?: string;
|
|
14
20
|
};
|
|
15
|
-
export declare const IconButton: import("react").ForwardRefExoticComponent<
|
|
21
|
+
export declare const IconButton: import("react").ForwardRefExoticComponent<ButtonHTMLAttributes<HTMLButtonElement> & SystemProps & {
|
|
16
22
|
size?: UiSize;
|
|
17
23
|
v?: ButtonVariant;
|
|
18
|
-
tone?:
|
|
19
|
-
icon
|
|
24
|
+
tone?: ToneInput;
|
|
25
|
+
icon?: ReactNode;
|
|
20
26
|
loading?: boolean;
|
|
21
27
|
round?: boolean;
|
|
28
|
+
badge?: ReactNode;
|
|
29
|
+
badgeTone?: ToneInput;
|
|
30
|
+
badgeMax?: number;
|
|
31
|
+
badgeTestId?: string;
|
|
22
32
|
pressAnimation?: ButtonPressAnimation;
|
|
33
|
+
asChild?: boolean;
|
|
34
|
+
children?: ReactNode;
|
|
23
35
|
testId?: string;
|
|
24
36
|
} & import("react").RefAttributes<HTMLButtonElement>>;
|
|
25
37
|
//# sourceMappingURL=IconButton.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../src/components/IconButton/IconButton.tsx"],"names":[],"mappings":"AAEA,OAAO,
|
|
1
|
+
{"version":3,"file":"IconButton.d.ts","sourceRoot":"","sources":["../../../src/components/IconButton/IconButton.tsx"],"names":[],"mappings":"AAEA,OAAO,EAKH,KAAK,oBAAoB,EAEzB,KAAK,SAAS,EAEjB,MAAM,OAAO,CAAC;AAGf,OAAO,EAEH,KAAK,WAAW,EAChB,KAAK,SAAS,EACd,KAAK,MAAM,EAEd,MAAM,yBAAyB,CAAC;AAEjC,OAAO,KAAK,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAEjE,OAAO,KAAK,EAAC,aAAa,EAAC,MAAM,kBAAkB,CAAC;AAGpD,MAAM,MAAM,eAAe,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,GACjE,WAAW,GAAG;IACV,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,CAAC,CAAC,EAAE,aAAa,CAAC;IAClB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,cAAc,CAAC,EAAE,oBAAoB,CAAC;IACtC,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,SAAS,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC;AAqBN,eAAO,MAAM,UAAU;WAnCR,MAAM;QACT,aAAa;WACV,SAAS;WACT,SAAS;cACN,OAAO;YACT,OAAO;YACP,SAAS;gBACL,SAAS;eACV,MAAM;kBACH,MAAM;qBACH,oBAAoB;cAC3B,OAAO;eACN,SAAS;aACX,MAAM;qDAoGtB,CAAC"}
|
|
@@ -1,13 +1,48 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
-
import { forwardRef, useContext } from 'react';
|
|
2
|
+
import { Fragment as _Fragment, jsxs as _jsxs, jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { cloneElement, forwardRef, isValidElement, useContext, } from 'react';
|
|
4
4
|
import { cn } from '../../utils/cn';
|
|
5
|
-
import { splitSystemProps, } from '../../theme/systemProps';
|
|
5
|
+
import { splitSystemProps, normalizeTone, } from '../../theme/systemProps';
|
|
6
6
|
import { OrcestrThemeContext } from '../../theme/useTheme';
|
|
7
|
+
import { renderSlot } from '../../utils/slot';
|
|
7
8
|
import { Spinner } from '../Spinner/Spinner';
|
|
8
|
-
|
|
9
|
+
function formatBadge(value, max) {
|
|
10
|
+
if (typeof value !== 'number')
|
|
11
|
+
return value;
|
|
12
|
+
return value > max ? `${max}+` : value;
|
|
13
|
+
}
|
|
14
|
+
function withBadge(children, badge) {
|
|
15
|
+
if (badge === null || badge === undefined || !isValidElement(children)) {
|
|
16
|
+
return children;
|
|
17
|
+
}
|
|
18
|
+
const child = children;
|
|
19
|
+
return cloneElement(child, undefined, (_jsxs(_Fragment, { children: [child.props.children, badge] })));
|
|
20
|
+
}
|
|
21
|
+
export const IconButton = forwardRef(function IconButton({ className, style, size = 3, v = 'soft', tone = 'neutral', loading = false, round = true, badge, badgeTone = 'danger', badgeMax = 99, badgeTestId, pressAnimation, asChild = false, testId, icon, children, disabled, type = 'button', ...props }, ref) {
|
|
9
22
|
const themeContext = useContext(OrcestrThemeContext);
|
|
10
23
|
const actualPressAnimation = pressAnimation ?? themeContext?.theme.motion.pressAnimation ?? 'soft';
|
|
11
24
|
const { systemStyle, restProps } = splitSystemProps(props);
|
|
12
|
-
|
|
25
|
+
const commonProps = {
|
|
26
|
+
className: cn('oui-icon-button', className),
|
|
27
|
+
'data-size': size,
|
|
28
|
+
'data-variant': v,
|
|
29
|
+
'data-tone': normalizeTone(tone),
|
|
30
|
+
'data-round': round ? 'true' : undefined,
|
|
31
|
+
'data-press-animation': actualPressAnimation,
|
|
32
|
+
'data-loading': loading ? 'true' : undefined,
|
|
33
|
+
'data-testid': testId,
|
|
34
|
+
'aria-busy': loading || undefined,
|
|
35
|
+
style: { ...systemStyle, ...style },
|
|
36
|
+
...restProps,
|
|
37
|
+
};
|
|
38
|
+
const badgeNode = badge === null || badge === undefined ? null : (_jsx("span", { className: 'oui-icon-button-badge', "data-tone": normalizeTone(badgeTone), "data-testid": badgeTestId, children: formatBadge(badge, badgeMax) }));
|
|
39
|
+
const content = (_jsxs(_Fragment, { children: [loading ? _jsx(Spinner, { size: 1 }) : icon ?? children, badgeNode] }));
|
|
40
|
+
if (asChild) {
|
|
41
|
+
return renderSlot(withBadge(children, badgeNode), {
|
|
42
|
+
...commonProps,
|
|
43
|
+
ref: ref,
|
|
44
|
+
'aria-disabled': disabled || loading ? true : undefined,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
return (_jsx("button", { ref: ref, type: type, ...commonProps, disabled: disabled || loading, children: content }));
|
|
13
48
|
});
|