@parallelworks/ui 0.40.1 → 0.42.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 +25 -0
- package/dist/ai/adapter/memoryStore.js +7 -0
- package/dist/ai/adapter/mock/mockAdapter.js +52 -17
- package/dist/ai/adapter/openai/createOpenAIStream.js +1 -1
- package/dist/ai/adapter/openai/index.d.ts +1 -1
- package/dist/ai/adapter/openai/sse.d.ts +8 -2
- package/dist/ai/adapter/openai/sse.js +40 -4
- package/dist/ai/adapter/openai/wire.d.ts +6 -0
- package/dist/ai/components/AllocationSelector.d.ts +3 -4
- package/dist/ai/components/AllocationSelector.js +37 -33
- package/dist/ai/components/AttachmentManager.js +7 -7
- package/dist/ai/components/AttachmentUpload.js +5 -5
- package/dist/ai/components/BranchNavigator.js +1 -1
- package/dist/ai/components/ChatEmptyState.js +2 -2
- package/dist/ai/components/ChatInput.js +10 -8
- package/dist/ai/components/ChatLayout.js +4 -5
- package/dist/ai/components/ChatMessage.js +12 -12
- package/dist/ai/components/ChatMessageList.js +9 -9
- package/dist/ai/components/ChatSidebar.js +8 -9
- package/dist/ai/components/ChatThread.js +4 -4
- package/dist/ai/components/ComposerChrome.d.ts +2 -2
- package/dist/ai/components/ComposerChrome.js +3 -6
- package/dist/ai/components/DragOverlay.js +2 -2
- package/dist/ai/components/ModelSelector.d.ts +5 -3
- package/dist/ai/components/ModelSelector.js +102 -339
- package/dist/ai/components/PastedText.js +11 -11
- package/dist/ai/components/ProviderIssueBanner.d.ts +2 -0
- package/dist/ai/components/ProviderIssueBanner.js +34 -16
- package/dist/ai/components/Reasoning.js +4 -4
- package/dist/ai/components/ShareDialog.js +43 -35
- package/dist/ai/components/SlashMenu.d.ts +12 -2
- package/dist/ai/components/SlashMenu.js +29 -13
- package/dist/ai/components/agent/ActivityLine.js +3 -3
- package/dist/ai/components/agent/AgentMessageParts.js +20 -20
- package/dist/ai/components/agent/PermissionPicker.js +13 -11
- package/dist/ai/components/conversationActions.d.ts +4 -6
- package/dist/ai/components/conversationActions.js +9 -13
- package/dist/ai/core/ChatProvider.js +4 -4
- package/dist/ai/core/config.js +1 -1
- package/dist/ai/core/parts.d.ts +5 -0
- package/dist/ai/core/parts.js +28 -1
- package/dist/ai/core/providerIssues.d.ts +7 -0
- package/dist/ai/core/providerIssues.js +9 -1
- package/dist/ai/core/useKeyboardShortcuts.d.ts +4 -0
- package/dist/ai/core/useKeyboardShortcuts.js +8 -2
- package/dist/ai/index.d.ts +0 -1
- package/dist/ai/index.js +1 -2
- package/dist/ai/strings.d.ts +19 -0
- package/dist/ai/strings.js +18 -1
- package/dist/ai/ui/Avatar.js +5 -5
- package/dist/ai/ui/ConversationSidebar.d.ts +0 -1
- package/dist/ai/ui/ConversationSidebar.js +6 -7
- package/dist/ai/ui/Markdown.js +3 -3
- package/dist/ai/ui/Notice.js +6 -6
- package/dist/ai/ui/chip.d.ts +4 -0
- package/dist/ai/ui/chip.js +8 -0
- package/dist/ai/ui/sidebar.d.ts +6 -5
- package/dist/ai/ui/sidebar.js +39 -43
- package/dist/components/ActionMenu.d.ts +13 -0
- package/dist/components/ActionMenu.js +30 -0
- package/dist/components/Avatar.js +6 -6
- package/dist/components/Breadcrumbs.js +1 -1
- package/dist/components/Button.js +10 -10
- package/dist/components/Callout.js +2 -2
- package/dist/components/Card.js +3 -3
- package/dist/components/Combobox.d.ts +66 -0
- package/dist/components/Combobox.js +393 -0
- package/dist/components/ConfirmModal.js +11 -11
- package/dist/components/ContextMenu.d.ts +23 -0
- package/dist/components/ContextMenu.js +89 -0
- package/dist/components/CopyToClipboard.js +2 -2
- package/dist/components/CreateModal.d.ts +17 -36
- package/dist/components/CreateModal.js +97 -259
- package/dist/components/DescriptionList.js +8 -8
- package/dist/components/Filter.js +2 -2
- package/dist/components/FilterPill.js +2 -2
- package/dist/components/HoverCard.d.ts +14 -0
- package/dist/components/HoverCard.js +33 -0
- package/dist/components/IconButton.d.ts +5 -5
- package/dist/components/IconButton.js +18 -22
- package/dist/components/InfoTip.d.ts +15 -0
- package/dist/components/InfoTip.js +60 -0
- package/dist/components/Input.js +5 -5
- package/dist/components/LetterBadge.js +2 -2
- package/dist/components/Loader.js +3 -3
- package/dist/components/Markdown.js +1 -1
- package/dist/components/MarkdownImpl.js +2 -2
- package/dist/components/Menu.d.ts +33 -0
- package/dist/components/Menu.js +86 -0
- package/dist/components/MenuEntries.d.ts +56 -0
- package/dist/components/MenuEntries.js +123 -0
- package/dist/components/Modal.d.ts +29 -0
- package/dist/components/Modal.js +47 -0
- package/dist/components/Overview.js +11 -10
- package/dist/components/PageHeader.d.ts +10 -16
- package/dist/components/PageHeader.js +69 -95
- package/dist/components/Pagination.js +5 -5
- package/dist/components/Provider.d.ts +5 -11
- package/dist/components/Provider.js +11 -14
- package/dist/components/Radio.d.ts +8 -0
- package/dist/components/Radio.js +16 -0
- package/dist/components/SectionHeader.js +2 -2
- package/dist/components/SegmentedControl.d.ts +6 -5
- package/dist/components/SegmentedControl.js +34 -30
- package/dist/components/Select.d.ts +27 -0
- package/dist/components/Select.js +78 -0
- package/dist/components/SettingModeOption.d.ts +5 -8
- package/dist/components/SettingModeOption.js +10 -12
- package/dist/components/SettingRow.js +4 -4
- package/dist/components/SettingsCard.js +4 -4
- package/dist/components/SettingsGroup.js +2 -2
- package/dist/components/Sort.js +1 -1
- package/dist/components/StatusBadge.js +7 -7
- package/dist/components/StatusIcons.js +4 -4
- package/dist/components/Switch.d.ts +22 -0
- package/dist/components/Switch.js +28 -0
- package/dist/components/Table.js +11 -11
- package/dist/components/Tooltip.d.ts +24 -20
- package/dist/components/Tooltip.js +58 -76
- package/dist/components/floating.d.ts +14 -0
- package/dist/components/floating.js +21 -0
- package/dist/components/search.d.ts +2 -0
- package/dist/components/search.js +14 -0
- package/dist/editor/Editor.js +1 -1
- package/dist/editor/EditorField.js +16 -21
- package/dist/editor/FormCodePanel.js +19 -19
- package/dist/editor/Monaco.js +3 -3
- package/dist/file-explorer/FileExplorer.js +77 -81
- package/dist/file-explorer/FileExplorerContext.js +2 -2
- package/dist/file-explorer/FilePreview/CodePreviewEditor.js +1 -1
- package/dist/file-explorer/FilePreview/Inline.js +1 -1
- package/dist/file-explorer/FilePreview/StreamedBadge.js +5 -6
- package/dist/file-explorer/FilePreview/Viewer.js +8 -8
- package/dist/file-explorer/FilePreview/index.d.ts +1 -1
- package/dist/file-explorer/FilePreview/index.js +49 -83
- package/dist/file-explorer/FileRow.d.ts +4 -3
- package/dist/file-explorer/FileRow.js +32 -38
- package/dist/file-explorer/FileRowsWindow.d.ts +3 -2
- package/dist/file-explorer/FileRowsWindow.js +4 -4
- package/dist/file-explorer/FileTable.d.ts +3 -2
- package/dist/file-explorer/FileTable.js +3 -3
- package/dist/file-explorer/LoadMoreRow.js +1 -1
- package/dist/file-explorer/TreeView.js +11 -16
- package/dist/file-explorer/helpers.js +11 -12
- package/dist/file-explorer/toasts.js +11 -11
- package/dist/form/FieldGroup.d.ts +11 -0
- package/dist/form/FieldGroup.js +36 -0
- package/dist/form/FieldWrapper.js +4 -4
- package/dist/form/Fields/BooleanField.js +23 -33
- package/dist/form/Fields/CheckboxGroupField.d.ts +1 -1
- package/dist/form/Fields/CheckboxGroupField.js +9 -13
- package/dist/form/Fields/ColorField.d.ts +1 -2
- package/dist/form/Fields/ColorField.js +6 -11
- package/dist/form/Fields/DropdownField.d.ts +3 -13
- package/dist/form/Fields/DropdownField.js +40 -27
- package/dist/form/Fields/DurationField.d.ts +1 -2
- package/dist/form/Fields/DurationField.js +25 -32
- package/dist/form/Fields/LabelField.js +2 -2
- package/dist/form/Fields/MultiDropdownField.d.ts +6 -12
- package/dist/form/Fields/MultiDropdownField.js +31 -22
- package/dist/form/Fields/NumberField.d.ts +1 -1
- package/dist/form/Fields/NumberField.js +65 -35
- package/dist/form/Fields/ObjectField.d.ts +1 -1
- package/dist/form/Fields/ObjectField.js +12 -43
- package/dist/form/Fields/RadioField.d.ts +1 -1
- package/dist/form/Fields/RadioField.js +30 -41
- package/dist/form/Fields/RangeField.d.ts +1 -2
- package/dist/form/Fields/RangeField.js +23 -16
- package/dist/form/Fields/StringField.d.ts +1 -2
- package/dist/form/Fields/StringField.js +58 -26
- package/dist/form/Fields/TextAreaField.js +12 -10
- package/dist/form/Form.d.ts +30 -48
- package/dist/form/Form.js +306 -412
- package/dist/form/FormLayout.js +9 -9
- package/dist/form/Wizard/WizardContainer.d.ts +1 -4
- package/dist/form/Wizard/WizardContainer.js +40 -56
- package/dist/form/Wizard/WizardNavigation.js +1 -1
- package/dist/form/Wizard/WizardStepContent.d.ts +1 -5
- package/dist/form/Wizard/WizardStepContent.js +11 -16
- package/dist/form/Wizard/WizardStepIndicator.js +6 -6
- package/dist/form/Wizard/types.d.ts +0 -14
- package/dist/form/fieldRegistry.d.ts +1 -1
- package/dist/form/fieldRegistry.js +6 -6
- package/dist/form/formEditing.js +1 -1
- package/dist/form/index.d.ts +5 -4
- package/dist/form/index.js +6 -7
- package/dist/form/types/fieldComponentTypes.d.ts +8 -10
- package/dist/form/useChoiceField.d.ts +20 -0
- package/dist/form/useChoiceField.js +49 -0
- package/dist/form/useFieldValue.d.ts +7 -0
- package/dist/form/useFieldValue.js +20 -0
- package/dist/form/useParsedOpts.d.ts +3 -1
- package/dist/form/useParsedOpts.js +12 -17
- package/dist/form/utils/dependentOptions.d.ts +8 -4
- package/dist/form/utils/dependentOptions.js +25 -17
- package/dist/form/utils/fieldItems.d.ts +10 -0
- package/dist/form/utils/fieldItems.js +11 -0
- package/dist/form/utils/fieldPath.d.ts +10 -0
- package/dist/form/utils/fieldPath.js +20 -0
- package/dist/form/utils/shareEqual.d.ts +6 -0
- package/dist/form/utils/shareEqual.js +38 -0
- package/dist/graph/AnnotationBanner.js +8 -8
- package/dist/graph/Collapse.d.ts +1 -0
- package/dist/graph/Collapse.js +6 -27
- package/dist/graph/Connectors.js +5 -5
- package/dist/graph/DependencyGraph.js +20 -19
- package/dist/graph/GraphEditor.js +30 -41
- package/dist/graph/GraphEditorDialogs.js +17 -17
- package/dist/graph/GraphNode.js +1 -1
- package/dist/graph/InputDialog.js +19 -22
- package/dist/graph/InputsEditor.js +58 -66
- package/dist/graph/JobSummary.js +42 -39
- package/dist/graph/MatrixGroup.js +1 -1
- package/dist/graph/ProblemsButton.js +18 -19
- package/dist/graph/Reveal.js +1 -1
- package/dist/graph/ShortcutsButton.js +15 -18
- package/dist/graph/SuggestionInput.d.ts +5 -10
- package/dist/graph/SuggestionInput.js +14 -18
- package/dist/graph/ToolbarPopover.d.ts +11 -6
- package/dist/graph/ToolbarPopover.js +35 -67
- package/dist/graph/TreeView.js +24 -37
- package/dist/graph/WorkflowSettingsDialog.js +4 -4
- package/dist/graph/editorChrome.js +13 -12
- package/dist/graph/editorFields.js +29 -29
- package/dist/graph/editorPrimitives.d.ts +1 -1
- package/dist/graph/editorPrimitives.js +10 -7
- package/dist/graph/editorRows.js +103 -97
- package/dist/graph/fieldProblems.js +2 -2
- package/dist/graph/graphEditorState.d.ts +4 -3
- package/dist/graph/inputRefs.js +9 -9
- package/dist/graph/settingsViews.js +6 -7
- package/dist/graph/stepWith.js +6 -6
- package/dist/index.d.ts +14 -15
- package/dist/index.js +15 -14
- package/dist/list/ActionToolbar.d.ts +6 -14
- package/dist/list/ActionToolbar.js +48 -96
- package/dist/list/ListPage.d.ts +6 -12
- package/dist/list/ListPage.js +46 -29
- package/dist/list/ListPager.js +4 -4
- package/dist/list/ListTable.js +5 -5
- package/dist/list/ListViewControls.d.ts +5 -4
- package/dist/list/ListViewControls.js +177 -267
- package/dist/list/UserHoverCard.d.ts +3 -17
- package/dist/list/UserHoverCard.js +21 -45
- package/dist/list/index.d.ts +3 -4
- package/dist/list/index.js +3 -4
- package/dist/list/listSearch.js +12 -11
- package/dist/list/rowMenu.d.ts +63 -0
- package/dist/list/rowMenu.js +134 -0
- package/dist/logviewer/LogViewer.js +26 -26
- package/dist/styles.css +1 -1
- package/package.json +7 -13
- package/dist/ai/ui/Dropdown.d.ts +0 -31
- package/dist/ai/ui/Dropdown.js +0 -110
- package/dist/components/AddMenu.d.ts +0 -18
- package/dist/components/AddMenu.js +0 -46
- package/dist/components/BareModal.d.ts +0 -17
- package/dist/components/BareModal.js +0 -77
- package/dist/components/CollapsiblePanel.d.ts +0 -27
- package/dist/components/CollapsiblePanel.js +0 -77
- package/dist/components/Dropdown.d.ts +0 -28
- package/dist/components/Dropdown.js +0 -355
- package/dist/components/Listbox.d.ts +0 -21
- package/dist/components/Listbox.js +0 -119
- package/dist/components/MultiSelect.d.ts +0 -22
- package/dist/components/MultiSelect.js +0 -168
- package/dist/components/SwitchToggle.d.ts +0 -15
- package/dist/components/SwitchToggle.js +0 -57
- package/dist/components/SwitchToggleSmall.d.ts +0 -6
- package/dist/components/SwitchToggleSmall.js +0 -14
- package/dist/components/Toggle.d.ts +0 -6
- package/dist/components/Toggle.js +0 -20
- package/dist/components/dropdownUtils.d.ts +0 -37
- package/dist/components/dropdownUtils.js +0 -99
- package/dist/form/SpecialTypes/DropdownWrapper.d.ts +0 -25
- package/dist/form/SpecialTypes/DropdownWrapper.js +0 -28
- package/dist/form/SpecialTypes/FormikCustomDropdown.d.ts +0 -51
- package/dist/form/SpecialTypes/FormikCustomDropdown.js +0 -119
- package/dist/form/SpecialTypes/FormikCustomInput.d.ts +0 -19
- package/dist/form/SpecialTypes/FormikCustomInput.js +0 -121
- package/dist/form/SpecialTypes/FormikMultiSelectDropdown.d.ts +0 -13
- package/dist/form/SpecialTypes/FormikMultiSelectDropdown.js +0 -31
- package/dist/form/SpecialTypes/FormikNumericInput.d.ts +0 -9
- package/dist/form/SpecialTypes/FormikNumericInput.js +0 -60
- package/dist/form/SpecialTypes/index.d.ts +0 -3
- package/dist/list/HoverCard.d.ts +0 -24
- package/dist/list/HoverCard.js +0 -73
- package/dist/list/RowContextMenu.d.ts +0 -127
- package/dist/list/RowContextMenu.js +0 -515
|
@@ -1,14 +1,12 @@
|
|
|
1
1
|
import { safeUrl } from "../safeUrl.js";
|
|
2
|
+
import { TooltipProvider } from "./Tooltip.js";
|
|
3
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
2
4
|
import { createContext, use, useCallback, useContext, useEffect, useMemo, useState } from "react";
|
|
3
5
|
import { useLocalStorage } from "usehooks-ts";
|
|
4
|
-
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
5
6
|
//#region src/components/Provider.tsx
|
|
6
|
-
var DefaultLink = ({
|
|
7
|
-
href: safeUrl(
|
|
8
|
-
|
|
9
|
-
className,
|
|
10
|
-
...rest,
|
|
11
|
-
children
|
|
7
|
+
var DefaultLink = ({ href, ...rest }) => /* @__PURE__ */ jsx("a", {
|
|
8
|
+
href: safeUrl(href),
|
|
9
|
+
...rest
|
|
12
10
|
});
|
|
13
11
|
/** The provider's link slot, with a plain anchor fallback. */
|
|
14
12
|
function useLink() {
|
|
@@ -46,8 +44,7 @@ var DEFAULTS = {
|
|
|
46
44
|
favorited: "Favorited",
|
|
47
45
|
favoriteHintOn: "Your item will be favorited when it's created",
|
|
48
46
|
favoriteHintOff: "Favorite your item when it's created",
|
|
49
|
-
filter: "Filter"
|
|
50
|
-
noOptions: "No options available"
|
|
47
|
+
filter: "Filter"
|
|
51
48
|
},
|
|
52
49
|
common: {
|
|
53
50
|
copy: "Copy",
|
|
@@ -60,7 +57,8 @@ var DEFAULTS = {
|
|
|
60
57
|
jsonHasErrors: "JSON has errors, please fix before saving",
|
|
61
58
|
remove: "Remove",
|
|
62
59
|
sort: "Sort",
|
|
63
|
-
userAvatar: "User avatar"
|
|
60
|
+
userAvatar: "User avatar",
|
|
61
|
+
moreInfo: "More information"
|
|
64
62
|
},
|
|
65
63
|
dropdown: {
|
|
66
64
|
select: (type) => `Select ${type}`,
|
|
@@ -350,7 +348,6 @@ var DEFAULTS = {
|
|
|
350
348
|
copied: (label) => `Copied ${label}`,
|
|
351
349
|
couldntCopy: (label) => `Couldn't copy ${label}`,
|
|
352
350
|
moreActions: "More actions",
|
|
353
|
-
toggleState: (label, on) => `${label}, ${on ? "on" : "off"}`,
|
|
354
351
|
labelName: "name",
|
|
355
352
|
labelEmail: "email",
|
|
356
353
|
labelUsername: "username",
|
|
@@ -383,7 +380,7 @@ var DEFAULTS = {
|
|
|
383
380
|
perPage: "Per page",
|
|
384
381
|
paginationPrevious: "Previous",
|
|
385
382
|
paginationNext: "Next",
|
|
386
|
-
paginationShowing: (name, start, end) => /* @__PURE__ */ jsxs(Fragment
|
|
383
|
+
paginationShowing: (name, start, end) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
387
384
|
"Showing ",
|
|
388
385
|
name,
|
|
389
386
|
" ",
|
|
@@ -398,7 +395,7 @@ var DEFAULTS = {
|
|
|
398
395
|
children: end
|
|
399
396
|
})
|
|
400
397
|
] }),
|
|
401
|
-
paginationShowingTimeRange: (name, startTime, endTime) => /* @__PURE__ */ jsxs(Fragment
|
|
398
|
+
paginationShowingTimeRange: (name, startTime, endTime) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
402
399
|
"Showing ",
|
|
403
400
|
name,
|
|
404
401
|
" from ",
|
|
@@ -613,7 +610,7 @@ function UIProvider({ notify, strings, navigation, data, slots, engine, children
|
|
|
613
610
|
]);
|
|
614
611
|
return /* @__PURE__ */ jsx(UIContext.Provider, {
|
|
615
612
|
value,
|
|
616
|
-
children
|
|
613
|
+
children: /* @__PURE__ */ jsx(TooltipProvider, { children })
|
|
617
614
|
});
|
|
618
615
|
}
|
|
619
616
|
//#endregion
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Radio as BaseRadio } from '@base-ui/react/radio';
|
|
2
|
+
export { RadioGroup } from '@base-ui/react/radio-group';
|
|
3
|
+
export interface RadioProps<Value> extends Omit<BaseRadio.Root.Props<Value>, 'className'> {
|
|
4
|
+
className?: string | undefined;
|
|
5
|
+
}
|
|
6
|
+
/** One choice in a `RadioGroup`, which holds the value. Name it with an
|
|
7
|
+
* enclosing `<label>`. */
|
|
8
|
+
export declare function Radio<Value>({ className, ...props }: RadioProps<Value>): import("react").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Radio } from "@base-ui/react/radio";
|
|
4
|
+
import { RadioGroup } from "@base-ui/react/radio-group";
|
|
5
|
+
//#region src/components/Radio.tsx
|
|
6
|
+
/** One choice in a `RadioGroup`, which holds the value. Name it with an
|
|
7
|
+
* enclosing `<label>`. */
|
|
8
|
+
function Radio$1({ className, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx(Radio.Root, {
|
|
10
|
+
...props,
|
|
11
|
+
className: clsx("flex size-4 shrink-0 items-center justify-center rounded-full border border-(--theme-border) bg-(--theme-input-bg) cursor-pointer outline-none transition-colors", "data-checked:border-(--theme-element) data-checked:bg-(--theme-element)", "focus-visible:ring-2 focus-visible:ring-(--theme-focus-ring) aria-invalid:border-(--theme-error)", "data-disabled:cursor-not-allowed data-disabled:opacity-50", className),
|
|
12
|
+
children: /* @__PURE__ */ jsx(Radio.Indicator, { className: "size-1.5 rounded-full bg-(--theme-element-text)" })
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
//#endregion
|
|
16
|
+
export { Radio$1 as Radio, RadioGroup };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/SectionHeader.tsx
|
|
4
4
|
function SectionHeader({ children, className = "", size = "md" }) {
|
|
5
5
|
return /* @__PURE__ */ jsx("div", {
|
|
6
|
-
className:
|
|
6
|
+
className: clsx("w-full font-semibold", size === "sm" ? "mb-2 text-sm theme-text" : "text-lg", className),
|
|
7
7
|
children
|
|
8
8
|
});
|
|
9
9
|
}
|
|
@@ -5,18 +5,19 @@ export interface SegmentedOption<T extends string> {
|
|
|
5
5
|
icon?: ReactNode;
|
|
6
6
|
/** Beside the label, or in the corner when only the icon shows. */
|
|
7
7
|
badge?: ReactNode;
|
|
8
|
-
/** Navigates instead of
|
|
9
|
-
|
|
8
|
+
/** Navigates instead of choosing, for segments that are pages. */
|
|
9
|
+
href?: string;
|
|
10
10
|
testId?: string;
|
|
11
11
|
}
|
|
12
12
|
/** A few mutually exclusive choices side by side, one always current. With
|
|
13
13
|
* `iconOnly` the segments stack as icons with their labels in tooltips, for
|
|
14
|
-
* a collapsed rail.
|
|
15
|
-
|
|
14
|
+
* a collapsed rail. Segments with `href` are pages, so the control becomes
|
|
15
|
+
* navigation. */
|
|
16
|
+
export declare function SegmentedControl<T extends string>({ label, options, value, onValueChange, fill, iconOnly, testId, }: {
|
|
16
17
|
label: string;
|
|
17
18
|
options: SegmentedOption<T>[];
|
|
18
19
|
value: T;
|
|
19
|
-
|
|
20
|
+
onValueChange?: (value: T) => void;
|
|
20
21
|
/** Segments share the container's width equally. */
|
|
21
22
|
fill?: boolean;
|
|
22
23
|
iconOnly?: boolean;
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
+
import { Tooltip } from "./Tooltip.js";
|
|
1
2
|
import { useLink } from "./Provider.js";
|
|
2
|
-
import {
|
|
3
|
-
import cx from "classnames";
|
|
3
|
+
import { clsx } from "clsx";
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
import { Toggle } from "@base-ui/react/toggle";
|
|
6
|
+
import { ToggleGroup } from "@base-ui/react/toggle-group";
|
|
5
7
|
//#region src/components/SegmentedControl.tsx
|
|
6
8
|
var itemBase = "relative flex min-w-0 items-center justify-center rounded-md font-medium transition-colors duration-150 focus-visible:outline-2 focus-visible:outline-offset-1 focus-visible:outline-(--theme-link)";
|
|
7
9
|
var itemCurrent = "bg-(--theme-panel-bg) theme-text shadow-sm ring-1 ring-(--theme-border)";
|
|
8
10
|
var itemIdle = "theme-muted-text hover:theme-text hover:bg-(--theme-hover)";
|
|
9
11
|
/** A few mutually exclusive choices side by side, one always current. With
|
|
10
12
|
* `iconOnly` the segments stack as icons with their labels in tooltips, for
|
|
11
|
-
* a collapsed rail.
|
|
12
|
-
|
|
13
|
+
* a collapsed rail. Segments with `href` are pages, so the control becomes
|
|
14
|
+
* navigation. */
|
|
15
|
+
function SegmentedControl({ label, options, value, onValueChange, fill = false, iconOnly = false, testId }) {
|
|
13
16
|
const Link = useLink();
|
|
14
|
-
const links = options.some((o) => o.
|
|
17
|
+
const links = options.some((o) => o.href);
|
|
15
18
|
const items = options.map((option) => {
|
|
16
19
|
const current = option.value === value;
|
|
17
|
-
const className =
|
|
20
|
+
const className = clsx(itemBase, current ? itemCurrent : itemIdle, iconOnly ? "h-8 w-8" : clsx("h-7 gap-1.5 text-[13px]", fill ? "px-1.5" : "px-2.5"));
|
|
18
21
|
const content = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
19
22
|
option.icon,
|
|
20
23
|
iconOnly ? /* @__PURE__ */ jsx("span", {
|
|
@@ -29,39 +32,40 @@ function SegmentedControl({ label, options, value, onChange, fill = false, iconO
|
|
|
29
32
|
children: option.badge
|
|
30
33
|
}) : option.badge)
|
|
31
34
|
] });
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
"
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
onClick: () => onChange?.(option.value),
|
|
49
|
-
className,
|
|
50
|
-
...tooltip,
|
|
51
|
-
children: content
|
|
35
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
36
|
+
content: option.label,
|
|
37
|
+
side: "right",
|
|
38
|
+
disabled: !iconOnly,
|
|
39
|
+
children: option.href ? /* @__PURE__ */ jsx(Link, {
|
|
40
|
+
href: option.href,
|
|
41
|
+
"aria-current": current ? "page" : void 0,
|
|
42
|
+
"data-testid": option.testId,
|
|
43
|
+
className,
|
|
44
|
+
children: content
|
|
45
|
+
}) : /* @__PURE__ */ jsx(Toggle, {
|
|
46
|
+
value: option.value,
|
|
47
|
+
"data-testid": option.testId,
|
|
48
|
+
className,
|
|
49
|
+
children: content
|
|
50
|
+
})
|
|
52
51
|
}, option.value);
|
|
53
52
|
});
|
|
54
|
-
const groupClassName =
|
|
55
|
-
|
|
53
|
+
const groupClassName = clsx("gap-0.5", iconOnly ? "flex flex-col items-center" : clsx("rounded-lg theme-muted-panel p-0.5", fill ? "grid auto-cols-fr grid-flow-col" : "inline-flex"));
|
|
54
|
+
if (links) return /* @__PURE__ */ jsx("nav", {
|
|
56
55
|
"aria-label": label,
|
|
57
56
|
"data-testid": testId,
|
|
58
57
|
className: groupClassName,
|
|
59
58
|
children: items
|
|
60
|
-
})
|
|
61
|
-
|
|
59
|
+
});
|
|
60
|
+
return /* @__PURE__ */ jsx(ToggleGroup, {
|
|
62
61
|
"aria-label": label,
|
|
63
62
|
"data-testid": testId,
|
|
64
63
|
className: groupClassName,
|
|
64
|
+
orientation: iconOnly ? "vertical" : "horizontal",
|
|
65
|
+
value: [value],
|
|
66
|
+
onValueChange: ([next]) => {
|
|
67
|
+
if (next !== void 0) onValueChange?.(next);
|
|
68
|
+
},
|
|
65
69
|
children: items
|
|
66
70
|
});
|
|
67
71
|
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { Select as BaseSelect } from '@base-ui/react/select';
|
|
2
|
+
import type { ReactElement, ReactNode } from 'react';
|
|
3
|
+
export interface SelectItem<Value> {
|
|
4
|
+
value: Value;
|
|
5
|
+
label: string;
|
|
6
|
+
/** A second line under the label, such as what an option does. */
|
|
7
|
+
description?: string | undefined;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
disabled?: boolean | undefined;
|
|
10
|
+
}
|
|
11
|
+
export type SelectProps<Value, Multiple extends boolean | undefined = false> = Omit<BaseSelect.Root.Props<Value, Multiple>, 'items' | 'children'> & {
|
|
12
|
+
items: readonly SelectItem<Value>[];
|
|
13
|
+
placeholder?: string | undefined;
|
|
14
|
+
/** Applied to the trigger. */
|
|
15
|
+
className?: string | undefined;
|
|
16
|
+
'aria-label'?: string | undefined;
|
|
17
|
+
'aria-describedby'?: string | undefined;
|
|
18
|
+
'aria-invalid'?: boolean | undefined;
|
|
19
|
+
/** Renders the field as this button, for compact pickers such as a toolbar pill. The
|
|
20
|
+
* button shows the selection itself; `placeholder` and `className` then go unused. */
|
|
21
|
+
trigger?: ReactElement | undefined;
|
|
22
|
+
/** A hint on the trigger button. */
|
|
23
|
+
triggerTooltip?: ReactNode;
|
|
24
|
+
};
|
|
25
|
+
/** Picks one value, or several with `multiple`, from a short list. Use
|
|
26
|
+
* Combobox when the list is long enough to need filtering. */
|
|
27
|
+
export declare function Select<Value, Multiple extends boolean | undefined = false>({ items, placeholder, className, 'aria-label': ariaLabel, 'aria-describedby': describedBy, 'aria-invalid': invalid, trigger, triggerTooltip, ...rootProps }: SelectProps<Value, Multiple>): import("react").JSX.Element;
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { FaAngleDown } from "../icons/fa/FaAngleDown.js";
|
|
2
|
+
import { FaCheck } from "../icons/fa/FaCheck.js";
|
|
3
|
+
import { panelClassName, panelItemClassName, portalContainer, positionerClassName } from "./floating.js";
|
|
4
|
+
import { Tooltip } from "./Tooltip.js";
|
|
5
|
+
import { clsx } from "clsx";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
import { Select } from "@base-ui/react/select";
|
|
8
|
+
//#region src/components/Select.tsx
|
|
9
|
+
var triggerClassName = clsx("flex w-full items-center justify-between gap-2 rounded-md border border-(--theme-border) bg-(--theme-input-bg) py-2 pl-3 pr-2 text-left text-sm text-(--theme-app) cursor-pointer outline-none", "focus-visible:border-(--theme-element) focus-visible:ring-1 focus-visible:ring-(--theme-element)", "aria-invalid:border-(--theme-error) data-disabled:cursor-not-allowed data-disabled:bg-(--theme-input-disabled-bg) data-disabled:text-(--theme-input-disabled-text)");
|
|
10
|
+
/** Picks one value, or several with `multiple`, from a short list. Use
|
|
11
|
+
* Combobox when the list is long enough to need filtering. */
|
|
12
|
+
function Select$1({ items, placeholder, className, "aria-label": ariaLabel, "aria-describedby": describedBy, "aria-invalid": invalid, trigger, triggerTooltip, ...rootProps }) {
|
|
13
|
+
const labelOf = (value) => items.find((item) => Object.is(item.value, value))?.label;
|
|
14
|
+
const triggerProps = {
|
|
15
|
+
"aria-label": ariaLabel,
|
|
16
|
+
"aria-describedby": describedBy,
|
|
17
|
+
"aria-invalid": invalid || void 0
|
|
18
|
+
};
|
|
19
|
+
return /* @__PURE__ */ jsxs(Select.Root, {
|
|
20
|
+
items,
|
|
21
|
+
...rootProps,
|
|
22
|
+
children: [trigger ? /* @__PURE__ */ jsx(Tooltip, {
|
|
23
|
+
content: triggerTooltip,
|
|
24
|
+
children: /* @__PURE__ */ jsx(Select.Trigger, {
|
|
25
|
+
...triggerProps,
|
|
26
|
+
render: trigger
|
|
27
|
+
})
|
|
28
|
+
}) : /* @__PURE__ */ jsxs(Select.Trigger, {
|
|
29
|
+
...triggerProps,
|
|
30
|
+
className: clsx(triggerClassName, className),
|
|
31
|
+
children: [/* @__PURE__ */ jsx(Select.Value, {
|
|
32
|
+
placeholder,
|
|
33
|
+
className: "truncate data-placeholder:text-(--theme-muted-text-color)",
|
|
34
|
+
children: rootProps.multiple ? (values) => values.length > 0 ? values.map(labelOf).join(", ") : placeholder : void 0
|
|
35
|
+
}), /* @__PURE__ */ jsx(Select.Icon, {
|
|
36
|
+
className: "shrink-0 text-(--theme-muted-text-color)",
|
|
37
|
+
children: /* @__PURE__ */ jsx(FaAngleDown, { "aria-hidden": "true" })
|
|
38
|
+
})]
|
|
39
|
+
}), /* @__PURE__ */ jsx(Select.Portal, {
|
|
40
|
+
container: portalContainer(),
|
|
41
|
+
children: /* @__PURE__ */ jsx(Select.Positioner, {
|
|
42
|
+
alignItemWithTrigger: false,
|
|
43
|
+
sideOffset: 4,
|
|
44
|
+
className: positionerClassName,
|
|
45
|
+
children: /* @__PURE__ */ jsx(Select.Popup, {
|
|
46
|
+
className: clsx("min-w-(--anchor-width) max-w-[min(20rem,var(--available-width))]", panelClassName),
|
|
47
|
+
children: /* @__PURE__ */ jsx(Select.List, {
|
|
48
|
+
className: "max-h-[min(15rem,var(--available-height))] overflow-y-auto py-1",
|
|
49
|
+
children: items.map((item) => /* @__PURE__ */ jsxs(Select.Item, {
|
|
50
|
+
value: item.value,
|
|
51
|
+
disabled: item.disabled,
|
|
52
|
+
className: clsx("grid grid-cols-[1rem_1fr]", panelItemClassName),
|
|
53
|
+
children: [
|
|
54
|
+
/* @__PURE__ */ jsx(Select.ItemIndicator, {
|
|
55
|
+
className: "col-start-1",
|
|
56
|
+
children: /* @__PURE__ */ jsx(FaCheck, { className: "size-3.5" })
|
|
57
|
+
}),
|
|
58
|
+
/* @__PURE__ */ jsxs("span", {
|
|
59
|
+
className: "col-start-2 flex min-w-0 items-center gap-2",
|
|
60
|
+
children: [item.icon, /* @__PURE__ */ jsx(Select.ItemText, {
|
|
61
|
+
className: "truncate",
|
|
62
|
+
children: item.label
|
|
63
|
+
})]
|
|
64
|
+
}),
|
|
65
|
+
item.description && /* @__PURE__ */ jsx("span", {
|
|
66
|
+
className: "col-start-2 text-xs text-(--theme-muted-text-color)",
|
|
67
|
+
children: item.description
|
|
68
|
+
})
|
|
69
|
+
]
|
|
70
|
+
}, String(item.value)))
|
|
71
|
+
})
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
})]
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//#endregion
|
|
78
|
+
export { Select$1 as Select };
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
/** A labeled + described
|
|
2
|
-
*
|
|
3
|
-
* dividers via `isFirst`. */
|
|
4
|
-
export declare function SettingModeOption({
|
|
5
|
-
|
|
6
|
-
name: string;
|
|
7
|
-
checked: boolean;
|
|
8
|
-
onSelect: () => void;
|
|
1
|
+
/** A labeled + described choice in a SettingsCard, picking between modes (e.g.
|
|
2
|
+
* default vs custom). Stack them in a `RadioGroup`, which holds the value;
|
|
3
|
+
* stacked rows share the card's dividers via `isFirst`. */
|
|
4
|
+
export declare function SettingModeOption({ value, label, description, isFirst, disabled, }: {
|
|
5
|
+
value: string;
|
|
9
6
|
label: string;
|
|
10
7
|
description: string;
|
|
11
8
|
isFirst?: boolean;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { Radio } from "./Radio.js";
|
|
2
|
+
import { clsx } from "clsx";
|
|
2
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
4
|
//#region src/components/SettingModeOption.tsx
|
|
4
|
-
/** A labeled + described
|
|
5
|
-
*
|
|
6
|
-
* dividers via `isFirst`. */
|
|
7
|
-
function SettingModeOption({
|
|
5
|
+
/** A labeled + described choice in a SettingsCard, picking between modes (e.g.
|
|
6
|
+
* default vs custom). Stack them in a `RadioGroup`, which holds the value;
|
|
7
|
+
* stacked rows share the card's dividers via `isFirst`. */
|
|
8
|
+
function SettingModeOption({ value, label, description, isFirst, disabled }) {
|
|
8
9
|
return /* @__PURE__ */ jsxs("label", {
|
|
9
|
-
className:
|
|
10
|
-
children: [/* @__PURE__ */ jsx(
|
|
11
|
-
|
|
12
|
-
name,
|
|
13
|
-
checked,
|
|
14
|
-
onChange: onSelect,
|
|
10
|
+
className: clsx("flex items-start gap-3 px-5 py-4", disabled ? "cursor-default opacity-60" : "cursor-pointer", !isFirst && "border-t theme-border"),
|
|
11
|
+
children: [/* @__PURE__ */ jsx(Radio, {
|
|
12
|
+
value,
|
|
15
13
|
disabled,
|
|
16
|
-
className: "mt-0.5
|
|
14
|
+
className: "mt-0.5"
|
|
17
15
|
}), /* @__PURE__ */ jsxs("div", {
|
|
18
16
|
className: "min-w-0",
|
|
19
17
|
children: [/* @__PURE__ */ jsx("div", {
|
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/SettingRow.tsx
|
|
4
4
|
function SettingRow({ label, htmlFor, helpText, children, isFirst, fill, onClick }) {
|
|
5
5
|
return /* @__PURE__ */ jsxs("div", {
|
|
6
6
|
role: "none",
|
|
7
7
|
onClick,
|
|
8
|
-
className:
|
|
8
|
+
className: clsx("px-5 py-5 grid grid-cols-1 gap-x-8 gap-y-2", fill ? "md:grid-cols-[200px_1fr]" : "md:grid-cols-[1fr_auto]", !isFirst && "border-t theme-border", onClick && "cursor-pointer select-none hover:theme-hover transition-colors"),
|
|
9
9
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
10
10
|
className: "flex flex-col gap-y-1",
|
|
11
11
|
children: [/* @__PURE__ */ jsx("label", {
|
|
@@ -17,14 +17,14 @@ function SettingRow({ label, htmlFor, helpText, children, isFirst, fill, onClick
|
|
|
17
17
|
children: helpText
|
|
18
18
|
})]
|
|
19
19
|
}), /* @__PURE__ */ jsx("div", {
|
|
20
|
-
className:
|
|
20
|
+
className: clsx("min-w-0", !fill && "flex items-center justify-end"),
|
|
21
21
|
children
|
|
22
22
|
})]
|
|
23
23
|
});
|
|
24
24
|
}
|
|
25
25
|
function SettingSection({ title, isFirst }) {
|
|
26
26
|
return /* @__PURE__ */ jsx("div", {
|
|
27
|
-
className:
|
|
27
|
+
className: clsx("px-5 py-3 theme-muted-panel", !isFirst && "border-t theme-border"),
|
|
28
28
|
children: /* @__PURE__ */ jsx("h2", {
|
|
29
29
|
className: "font-semibold text-sm uppercase tracking-wider theme-muted-text",
|
|
30
30
|
children: title
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/SettingsCard.tsx
|
|
4
4
|
/**
|
|
@@ -8,11 +8,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
8
8
|
*/
|
|
9
9
|
function SettingsCard({ title, description, action, actionAlign = "adjacent", overflowVisible, children, className }) {
|
|
10
10
|
return /* @__PURE__ */ jsxs("section", {
|
|
11
|
-
className:
|
|
11
|
+
className: clsx("mt-10 first:mt-0", className),
|
|
12
12
|
children: [(title || action) && /* @__PURE__ */ jsxs("div", {
|
|
13
13
|
className: "mb-3 px-0.5",
|
|
14
14
|
children: [/* @__PURE__ */ jsxs("div", {
|
|
15
|
-
className:
|
|
15
|
+
className: clsx("flex items-center gap-1.5", actionAlign === "right" && "justify-between"),
|
|
16
16
|
children: [title && /* @__PURE__ */ jsx("h2", {
|
|
17
17
|
className: "text-[15px] font-semibold theme-text leading-none",
|
|
18
18
|
children: title
|
|
@@ -22,7 +22,7 @@ function SettingsCard({ title, description, action, actionAlign = "adjacent", ov
|
|
|
22
22
|
children: description
|
|
23
23
|
})]
|
|
24
24
|
}), /* @__PURE__ */ jsx("div", {
|
|
25
|
-
className:
|
|
25
|
+
className: clsx("panel", overflowVisible ? "overflow-visible" : "overflow-hidden"),
|
|
26
26
|
children
|
|
27
27
|
})]
|
|
28
28
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/SettingsGroup.tsx
|
|
4
4
|
function SettingsGroup({ title, children, className }) {
|
|
5
5
|
return /* @__PURE__ */ jsxs("div", {
|
|
6
|
-
className:
|
|
6
|
+
className: clsx("mt-8 first:mt-0", className),
|
|
7
7
|
children: [title && /* @__PURE__ */ jsx("h2", {
|
|
8
8
|
className: "text-[11px] font-semibold uppercase tracking-wider theme-muted-text mb-2 px-1",
|
|
9
9
|
children: title
|
package/dist/components/Sort.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { useStrings } from "./Provider.js";
|
|
2
1
|
import { TiArrowSortedDown } from "../icons/ti/TiArrowSortedDown.js";
|
|
3
2
|
import { TiArrowSortedUp } from "../icons/ti/TiArrowSortedUp.js";
|
|
4
3
|
import { TiArrowUnsorted } from "../icons/ti/TiArrowUnsorted.js";
|
|
4
|
+
import { useStrings } from "./Provider.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/Sort.tsx
|
|
7
7
|
var SortIcon = ({ currentlySorted, currentDirection, name }) => {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
2
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
//#region src/components/StatusBadge.tsx
|
|
4
4
|
var variantStyles = {
|
|
@@ -32,26 +32,26 @@ function statusTextClass(variant) {
|
|
|
32
32
|
}
|
|
33
33
|
function StatusBadge({ children, variant = "default", pulse = false, dot = false, size = "sm", className }) {
|
|
34
34
|
return /* @__PURE__ */ jsxs("span", {
|
|
35
|
-
className:
|
|
35
|
+
className: clsx("inline-flex items-center gap-1.5 rounded-full border font-medium", size === "sm" && "px-2 py-0.5 text-[10px]", size === "md" && "px-2.5 py-1 text-xs", variantStyles[variant], className),
|
|
36
36
|
children: [
|
|
37
37
|
pulse && /* @__PURE__ */ jsxs("span", {
|
|
38
38
|
className: "relative flex h-2 w-2",
|
|
39
|
-
children: [/* @__PURE__ */ jsx("span", { className:
|
|
39
|
+
children: [/* @__PURE__ */ jsx("span", { className: clsx("absolute inline-flex h-full w-full animate-ping rounded-full opacity-75", pulseColors[variant]) }), /* @__PURE__ */ jsx("span", { className: clsx("relative inline-flex h-2 w-2 rounded-full", pulseColors[variant]) })]
|
|
40
40
|
}),
|
|
41
|
-
dot && !pulse && /* @__PURE__ */ jsx("span", { className:
|
|
41
|
+
dot && !pulse && /* @__PURE__ */ jsx("span", { className: clsx("inline-flex h-1.5 w-1.5 rounded-full", pulseColors[variant]) }),
|
|
42
42
|
children
|
|
43
43
|
]
|
|
44
44
|
});
|
|
45
45
|
}
|
|
46
46
|
function StatusDot({ variant = "default", pulse = false, size = 8, className }) {
|
|
47
47
|
return /* @__PURE__ */ jsxs("span", {
|
|
48
|
-
className:
|
|
48
|
+
className: clsx("relative inline-flex", className),
|
|
49
49
|
style: {
|
|
50
50
|
width: size,
|
|
51
51
|
height: size
|
|
52
52
|
},
|
|
53
|
-
children: [pulse && /* @__PURE__ */ jsx("span", { className:
|
|
54
|
-
className:
|
|
53
|
+
children: [pulse && /* @__PURE__ */ jsx("span", { className: clsx("absolute inline-flex h-full w-full animate-ping rounded-full opacity-75", pulseColors[variant]) }), /* @__PURE__ */ jsx("span", {
|
|
54
|
+
className: clsx("relative inline-flex rounded-full", pulseColors[variant]),
|
|
55
55
|
style: {
|
|
56
56
|
width: size,
|
|
57
57
|
height: size
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import { BiError } from "../icons/bi/BiError.js";
|
|
2
2
|
import { HiMiniCheckCircle } from "../icons/hi2/HiMiniCheckCircle.js";
|
|
3
3
|
import { FaCircleNotch } from "../icons/fa/FaCircleNotch.js";
|
|
4
|
-
import
|
|
4
|
+
import { clsx } from "clsx";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
//#region src/components/StatusIcons.tsx
|
|
7
7
|
function SuccessCheckmark({ className, colored = true }) {
|
|
8
|
-
return /* @__PURE__ */ jsx(HiMiniCheckCircle, { className:
|
|
8
|
+
return /* @__PURE__ */ jsx(HiMiniCheckCircle, { className: clsx(colored && "text-green-500", className) });
|
|
9
9
|
}
|
|
10
10
|
function ErrorCheckmark({ className, colored = true }) {
|
|
11
|
-
return /* @__PURE__ */ jsx(BiError, { className:
|
|
11
|
+
return /* @__PURE__ */ jsx(BiError, { className: clsx(colored && "text-red-400", className) });
|
|
12
12
|
}
|
|
13
13
|
function LoaderIcon({ className, ...props }) {
|
|
14
14
|
return /* @__PURE__ */ jsx(FaCircleNotch, {
|
|
15
|
-
className:
|
|
15
|
+
className: clsx("animate-spin", className),
|
|
16
16
|
...props
|
|
17
17
|
});
|
|
18
18
|
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Switch as BaseSwitch } from '@base-ui/react/switch';
|
|
2
|
+
declare const sizes: {
|
|
3
|
+
sm: {
|
|
4
|
+
root: string;
|
|
5
|
+
thumb: string;
|
|
6
|
+
};
|
|
7
|
+
md: {
|
|
8
|
+
root: string;
|
|
9
|
+
thumb: string;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export interface SwitchProps extends Omit<BaseSwitch.Root.Props, 'className' | 'children'> {
|
|
13
|
+
size?: keyof typeof sizes;
|
|
14
|
+
className?: string | undefined;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* An on/off control. Name it with an enclosing `<label>`, or `aria-label`. A
|
|
18
|
+
* sibling `<label htmlFor>` needs `nativeButton render={<button />}`, which
|
|
19
|
+
* puts the id on the button the label points at.
|
|
20
|
+
*/
|
|
21
|
+
export declare function Switch({ size, className, ...props }: SwitchProps): import("react").JSX.Element;
|
|
22
|
+
export {};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { clsx } from "clsx";
|
|
2
|
+
import { jsx } from "react/jsx-runtime";
|
|
3
|
+
import { Switch } from "@base-ui/react/switch";
|
|
4
|
+
//#region src/components/Switch.tsx
|
|
5
|
+
var sizes = {
|
|
6
|
+
sm: {
|
|
7
|
+
root: "h-5 w-9",
|
|
8
|
+
thumb: "size-4 data-checked:translate-x-4"
|
|
9
|
+
},
|
|
10
|
+
md: {
|
|
11
|
+
root: "h-6 w-11",
|
|
12
|
+
thumb: "size-5 data-checked:translate-x-5"
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* An on/off control. Name it with an enclosing `<label>`, or `aria-label`. A
|
|
17
|
+
* sibling `<label htmlFor>` needs `nativeButton render={<button />}`, which
|
|
18
|
+
* puts the id on the button the label points at.
|
|
19
|
+
*/
|
|
20
|
+
function Switch$1({ size = "md", className, ...props }) {
|
|
21
|
+
return /* @__PURE__ */ jsx(Switch.Root, {
|
|
22
|
+
...props,
|
|
23
|
+
className: clsx("inline-flex shrink-0 items-center rounded-full p-0.5 bg-(--theme-border) transition-colors duration-200 cursor-pointer outline-none", "data-checked:bg-(--theme-element)", "focus-visible:ring-2 focus-visible:ring-(--theme-focus-ring) aria-invalid:ring-2 aria-invalid:ring-(--theme-error)", "data-disabled:cursor-not-allowed data-disabled:opacity-50", sizes[size].root, className),
|
|
24
|
+
children: /* @__PURE__ */ jsx(Switch.Thumb, { className: clsx("rounded-full bg-white shadow-sm transition-transform duration-200", sizes[size].thumb) })
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
//#endregion
|
|
28
|
+
export { Switch$1 as Switch };
|