@adecore/ui 0.14.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/LICENSE +21 -0
- package/README.md +83 -0
- package/dist/AccentSwatches.d.ts +15 -0
- package/dist/AccentSwatches.js +21 -0
- package/dist/Banner.d.ts +12 -0
- package/dist/Banner.js +18 -0
- package/dist/Button.d.ts +9 -0
- package/dist/Button.js +28 -0
- package/dist/ButtonGroup.d.ts +3 -0
- package/dist/ButtonGroup.js +11 -0
- package/dist/Checkbox.d.ts +11 -0
- package/dist/Checkbox.js +9 -0
- package/dist/ChoiceCards.d.ts +23 -0
- package/dist/ChoiceCards.js +21 -0
- package/dist/CloseButton.d.ts +15 -0
- package/dist/CloseButton.js +11 -0
- package/dist/ColorSwatch.d.ts +14 -0
- package/dist/ColorSwatch.js +28 -0
- package/dist/ColumnResizeHandle.d.ts +9 -0
- package/dist/ColumnResizeHandle.js +12 -0
- package/dist/DisabledReason.d.ts +6 -0
- package/dist/DisabledReason.js +8 -0
- package/dist/DockShell.d.ts +9 -0
- package/dist/DockShell.js +49 -0
- package/dist/EmptyState.d.ts +16 -0
- package/dist/EmptyState.js +11 -0
- package/dist/ErrorBoundary.d.ts +24 -0
- package/dist/ErrorBoundary.js +47 -0
- package/dist/Field.d.ts +17 -0
- package/dist/Field.js +48 -0
- package/dist/FileIcon.d.ts +8 -0
- package/dist/FileIcon.js +15 -0
- package/dist/Icon.d.ts +9 -0
- package/dist/Icon.js +12 -0
- package/dist/IconButton.d.ts +23 -0
- package/dist/IconButton.js +25 -0
- package/dist/IconPicker.d.ts +17 -0
- package/dist/IconPicker.js +93 -0
- package/dist/Input.d.ts +14 -0
- package/dist/Input.js +25 -0
- package/dist/Kbd.d.ts +23 -0
- package/dist/Kbd.js +20 -0
- package/dist/ListRow.d.ts +10 -0
- package/dist/ListRow.js +20 -0
- package/dist/Meter.d.ts +12 -0
- package/dist/Meter.js +7 -0
- package/dist/PanelEmpty.d.ts +16 -0
- package/dist/PanelEmpty.js +7 -0
- package/dist/PanelHeader.d.ts +6 -0
- package/dist/PanelHeader.js +20 -0
- package/dist/Pill.d.ts +27 -0
- package/dist/Pill.js +25 -0
- package/dist/ProjectSwitcher.d.ts +30 -0
- package/dist/ProjectSwitcher.js +18 -0
- package/dist/PromptDialog.d.ts +40 -0
- package/dist/PromptDialog.js +47 -0
- package/dist/SectionLabel.d.ts +3 -0
- package/dist/SectionLabel.js +16 -0
- package/dist/SegmentBar.d.ts +18 -0
- package/dist/SegmentBar.js +44 -0
- package/dist/Segmented.d.ts +17 -0
- package/dist/Segmented.js +7 -0
- package/dist/Select.d.ts +27 -0
- package/dist/Select.js +34 -0
- package/dist/Separator.d.ts +7 -0
- package/dist/Separator.js +8 -0
- package/dist/ShortcutHints.d.ts +1 -0
- package/dist/ShortcutHints.js +94 -0
- package/dist/Skeleton.d.ts +6 -0
- package/dist/Skeleton.js +6 -0
- package/dist/SlidingColumn.d.ts +19 -0
- package/dist/SlidingColumn.js +41 -0
- package/dist/Spinner.d.ts +6 -0
- package/dist/Spinner.js +7 -0
- package/dist/Stepper.d.ts +14 -0
- package/dist/Stepper.js +18 -0
- package/dist/Surface.d.ts +3 -0
- package/dist/Surface.js +16 -0
- package/dist/Switch.d.ts +10 -0
- package/dist/Switch.js +7 -0
- package/dist/TextMenu.d.ts +5 -0
- package/dist/TextMenu.js +31 -0
- package/dist/Tile.d.ts +11 -0
- package/dist/Tile.js +10 -0
- package/dist/Toasts.d.ts +9 -0
- package/dist/Toasts.js +58 -0
- package/dist/Tooltip.d.ts +16 -0
- package/dist/Tooltip.js +21 -0
- package/dist/UIProvider.d.ts +9 -0
- package/dist/UIProvider.js +26 -0
- package/dist/Waveform.d.ts +16 -0
- package/dist/Waveform.js +123 -0
- package/dist/Wipe.d.ts +12 -0
- package/dist/Wipe.js +47 -0
- package/dist/ZoomControls.d.ts +30 -0
- package/dist/ZoomControls.js +16 -0
- package/dist/class-name.d.ts +2 -0
- package/dist/class-name.js +3 -0
- package/dist/clipboard.d.ts +2 -0
- package/dist/clipboard.js +16 -0
- package/dist/context-menu/index.parts.d.ts +1 -0
- package/dist/context-menu/index.parts.js +2 -0
- package/dist/dialog/index.parts.d.ts +1 -0
- package/dist/dialog/index.parts.js +1 -0
- package/dist/dialog/parts.d.ts +36 -0
- package/dist/dialog/parts.js +55 -0
- package/dist/dialog-layer.d.ts +1 -0
- package/dist/dialog-layer.js +27 -0
- package/dist/error-boundary.d.ts +4 -0
- package/dist/error-boundary.js +34 -0
- package/dist/error-message.d.ts +1 -0
- package/dist/error-message.js +4 -0
- package/dist/field-context.d.ts +7 -0
- package/dist/field-context.js +4 -0
- package/dist/file-icon.d.ts +4 -0
- package/dist/file-icon.js +46 -0
- package/dist/floating.d.ts +5 -0
- package/dist/floating.js +6 -0
- package/dist/format/datetime.d.ts +11 -0
- package/dist/format/datetime.js +50 -0
- package/dist/format/duration.d.ts +5 -0
- package/dist/format/duration.js +76 -0
- package/dist/format/index.d.ts +6 -0
- package/dist/format/index.js +7 -0
- package/dist/format/locale.d.ts +17 -0
- package/dist/format/locale.js +105 -0
- package/dist/format/number.d.ts +8 -0
- package/dist/format/number.js +72 -0
- package/dist/format/regions.d.ts +6 -0
- package/dist/format/regions.js +15 -0
- package/dist/format/time-zone.d.ts +1 -0
- package/dist/format/time-zone.js +2 -0
- package/dist/icon-button-size.d.ts +3 -0
- package/dist/icon-button-size.js +3 -0
- package/dist/icon-picker.d.ts +23 -0
- package/dist/icon-picker.js +80 -0
- package/dist/index.d.ts +74 -0
- package/dist/index.js +74 -0
- package/dist/lazy.d.ts +12 -0
- package/dist/lazy.js +104 -0
- package/dist/locales/en.json +59 -0
- package/dist/locales/nl.json +59 -0
- package/dist/locales.d.ts +4 -0
- package/dist/locales.js +17 -0
- package/dist/menu/index.parts.d.ts +1 -0
- package/dist/menu/index.parts.js +1 -0
- package/dist/menu/parts.d.ts +67 -0
- package/dist/menu/parts.js +113 -0
- package/dist/merge-refs.d.ts +2 -0
- package/dist/merge-refs.js +11 -0
- package/dist/modality.d.ts +1 -0
- package/dist/modality.js +29 -0
- package/dist/platform.d.ts +2 -0
- package/dist/platform.js +9 -0
- package/dist/popover/index.parts.d.ts +1 -0
- package/dist/popover/index.parts.js +1 -0
- package/dist/popover/parts.d.ts +26 -0
- package/dist/popover/parts.js +28 -0
- package/dist/prefetch.d.ts +21 -0
- package/dist/prefetch.js +99 -0
- package/dist/preview-card/index.parts.d.ts +1 -0
- package/dist/preview-card/index.parts.js +1 -0
- package/dist/project-switcher-row.d.ts +6 -0
- package/dist/project-switcher-row.js +16 -0
- package/dist/selection.d.ts +2 -0
- package/dist/selection.js +22 -0
- package/dist/seti-icons.d.ts +5 -0
- package/dist/seti-icons.js +445 -0
- package/dist/settings/ConfirmDialog.d.ts +9 -0
- package/dist/settings/ConfirmDialog.js +9 -0
- package/dist/settings/DetailHeader.d.ts +10 -0
- package/dist/settings/DetailHeader.js +6 -0
- package/dist/settings/MasterDetail.d.ts +24 -0
- package/dist/settings/MasterDetail.js +16 -0
- package/dist/settings/SettingsDialog.d.ts +46 -0
- package/dist/settings/SettingsDialog.js +96 -0
- package/dist/settings/SettingsRow.d.ts +22 -0
- package/dist/settings/SettingsRow.js +30 -0
- package/dist/settings/SettingsSection.d.ts +14 -0
- package/dist/settings/SettingsSection.js +8 -0
- package/dist/settings/index.d.ts +7 -0
- package/dist/settings/index.js +8 -0
- package/dist/settings/target.d.ts +7 -0
- package/dist/settings/target.js +3 -0
- package/dist/shortcut-hints.d.ts +38 -0
- package/dist/shortcut-hints.js +81 -0
- package/dist/shortcut.d.ts +32 -0
- package/dist/shortcut.js +137 -0
- package/dist/testing/dedupe.d.ts +1 -0
- package/dist/testing/dedupe.js +73 -0
- package/dist/testing/fake-source.d.ts +8 -0
- package/dist/testing/fake-source.js +15 -0
- package/dist/testing/index.d.ts +1 -0
- package/dist/testing/index.js +2 -0
- package/dist/theme.css +562 -0
- package/dist/toast-store.d.ts +38 -0
- package/dist/toast-store.js +61 -0
- package/dist/useAsyncAction.d.ts +8 -0
- package/dist/useAsyncAction.js +23 -0
- package/dist/useColumnResize.d.ts +14 -0
- package/dist/useColumnResize.js +49 -0
- package/dist/useContentSize.d.ts +5 -0
- package/dist/useContentSize.js +21 -0
- package/dist/useMeasuredWidth.d.ts +1 -0
- package/dist/useMeasuredWidth.js +6 -0
- package/dist/useNow.d.ts +3 -0
- package/dist/useNow.js +41 -0
- package/dist/wipe-split.d.ts +7 -0
- package/dist/wipe-split.js +20 -0
- package/dist/zoom.d.ts +3 -0
- package/dist/zoom.js +6 -0
- package/package.json +92 -0
- package/src/AccentSwatches.tsx +73 -0
- package/src/Banner.tsx +43 -0
- package/src/Button.tsx +55 -0
- package/src/ButtonGroup.tsx +14 -0
- package/src/Checkbox.tsx +44 -0
- package/src/ChoiceCards.tsx +108 -0
- package/src/CloseButton.tsx +21 -0
- package/src/ColorSwatch.tsx +41 -0
- package/src/ColumnResizeHandle.tsx +23 -0
- package/src/DisabledReason.tsx +23 -0
- package/src/DockShell.tsx +76 -0
- package/src/EmptyState.tsx +48 -0
- package/src/ErrorBoundary.tsx +116 -0
- package/src/Field.tsx +116 -0
- package/src/FileIcon.tsx +27 -0
- package/src/Icon.tsx +22 -0
- package/src/IconButton.tsx +84 -0
- package/src/IconPicker.tsx +257 -0
- package/src/Input.tsx +78 -0
- package/src/Kbd.tsx +67 -0
- package/src/ListRow.tsx +26 -0
- package/src/Meter.tsx +41 -0
- package/src/PanelEmpty.tsx +37 -0
- package/src/PanelHeader.tsx +31 -0
- package/src/Pill.tsx +61 -0
- package/src/ProjectSwitcher.tsx +127 -0
- package/src/PromptDialog.tsx +168 -0
- package/src/SectionLabel.tsx +20 -0
- package/src/SegmentBar.tsx +128 -0
- package/src/Segmented.tsx +51 -0
- package/src/Select.tsx +135 -0
- package/src/Separator.tsx +15 -0
- package/src/ShortcutHints.tsx +118 -0
- package/src/Skeleton.tsx +13 -0
- package/src/SlidingColumn.tsx +91 -0
- package/src/Spinner.tsx +32 -0
- package/src/Stepper.tsx +67 -0
- package/src/Surface.tsx +20 -0
- package/src/Switch.tsx +32 -0
- package/src/TextMenu.tsx +59 -0
- package/src/Tile.tsx +49 -0
- package/src/Toasts.tsx +151 -0
- package/src/Tooltip.tsx +70 -0
- package/src/UIProvider.tsx +41 -0
- package/src/Waveform.tsx +199 -0
- package/src/Wipe.tsx +99 -0
- package/src/ZoomControls.tsx +99 -0
- package/src/class-name.ts +8 -0
- package/src/clipboard.ts +17 -0
- package/src/context-menu/index.parts.ts +21 -0
- package/src/dialog/index.parts.ts +10 -0
- package/src/dialog/parts.tsx +112 -0
- package/src/dialog-layer.ts +31 -0
- package/src/error-boundary.ts +40 -0
- package/src/error-message.ts +5 -0
- package/src/field-context.ts +12 -0
- package/src/file-icon.ts +52 -0
- package/src/floating.ts +9 -0
- package/src/format/datetime.ts +63 -0
- package/src/format/duration.ts +83 -0
- package/src/format/index.ts +20 -0
- package/src/format/locale.ts +153 -0
- package/src/format/number.ts +87 -0
- package/src/format/regions.ts +20 -0
- package/src/format/time-zone.ts +2 -0
- package/src/icon-button-size.ts +6 -0
- package/src/icon-picker.ts +112 -0
- package/src/index.ts +103 -0
- package/src/lazy.tsx +124 -0
- package/src/locales/en.json +59 -0
- package/src/locales/nl.json +59 -0
- package/src/locales.ts +21 -0
- package/src/menu/index.parts.ts +20 -0
- package/src/menu/parts.tsx +296 -0
- package/src/merge-refs.ts +14 -0
- package/src/modality.ts +37 -0
- package/src/platform.ts +10 -0
- package/src/popover/index.parts.ts +8 -0
- package/src/popover/parts.tsx +119 -0
- package/src/prefetch.ts +113 -0
- package/src/preview-card/index.parts.ts +1 -0
- package/src/project-switcher-row.tsx +51 -0
- package/src/selection.ts +24 -0
- package/src/seti-icons.ts +451 -0
- package/src/settings/ConfirmDialog.tsx +30 -0
- package/src/settings/DetailHeader.tsx +25 -0
- package/src/settings/MasterDetail.tsx +67 -0
- package/src/settings/SettingsDialog.tsx +342 -0
- package/src/settings/SettingsRow.tsx +89 -0
- package/src/settings/SettingsSection.tsx +46 -0
- package/src/settings/index.ts +16 -0
- package/src/settings/target.ts +12 -0
- package/src/shortcut-hints.ts +117 -0
- package/src/shortcut.ts +170 -0
- package/src/testing/dedupe.ts +93 -0
- package/src/testing/fake-source.ts +21 -0
- package/src/testing/index.ts +3 -0
- package/src/theme.css +562 -0
- package/src/toast-store.ts +120 -0
- package/src/useAsyncAction.ts +32 -0
- package/src/useColumnResize.ts +75 -0
- package/src/useContentSize.ts +27 -0
- package/src/useMeasuredWidth.ts +7 -0
- package/src/useNow.ts +49 -0
- package/src/wipe-split.ts +24 -0
- package/src/zoom.ts +9 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
export * as ContextMenu from './context-menu/index.parts.ts';
|
|
2
|
+
export * as Dialog from './dialog/index.parts.ts';
|
|
3
|
+
export * as Menu from './menu/index.parts.ts';
|
|
4
|
+
export * as Popover from './popover/index.parts.ts';
|
|
5
|
+
export * as PreviewCard from './preview-card/index.parts.ts';
|
|
6
|
+
export type { DialogDescriptionProps, DialogFooterProps, DialogPopupProps, DialogTextProps, DialogTitleProps } from './dialog/parts.tsx';
|
|
7
|
+
export type { MenuCheckProps, MenuHintProps, MenuLabelProps, MenuPopupProps, MenuRowActionProps, MenuRowProps, MenuRowSubmenuTriggerProps } from './menu/parts.tsx';
|
|
8
|
+
export type { PopoverPopupProps, PopupVariant, PreviewCardPopupProps } from './popover/parts.tsx';
|
|
9
|
+
export { AccentSwatches, type AccentSwatchesProps } from './AccentSwatches.tsx';
|
|
10
|
+
export { Banner, type BannerProps, type BannerTone } from './Banner.tsx';
|
|
11
|
+
export { Button, type ButtonProps, type ButtonSize, type ButtonVariant } from './Button.tsx';
|
|
12
|
+
export { ButtonGroup, type ButtonGroupProps } from './ButtonGroup.tsx';
|
|
13
|
+
export { Checkbox, type CheckboxProps } from './Checkbox.tsx';
|
|
14
|
+
export { ChoiceCards, type Choice, type ChoiceCardsProps } from './ChoiceCards.tsx';
|
|
15
|
+
export { CloseButton, type CloseButtonProps } from './CloseButton.tsx';
|
|
16
|
+
export { ColorSwatch, type ColorSwatchProps } from './ColorSwatch.tsx';
|
|
17
|
+
export { ColumnResizeHandle, type ColumnResizeHandleProps } from './ColumnResizeHandle.tsx';
|
|
18
|
+
export { DisabledReason, type DisabledReasonProps } from './DisabledReason.tsx';
|
|
19
|
+
export { DockShell, type DockShellProps } from './DockShell.tsx';
|
|
20
|
+
export { EmptyState, type EmptyStateProps } from './EmptyState.tsx';
|
|
21
|
+
export { ErrorBoundary, type ErrorBoundaryProps } from './ErrorBoundary.tsx';
|
|
22
|
+
export { Field, FieldHint, FormError, type FieldHintProps, type FieldProps, type FormErrorProps } from './Field.tsx';
|
|
23
|
+
export { FileIcon, type FileIconProps } from './FileIcon.tsx';
|
|
24
|
+
export { Icon, type IconProps } from './Icon.tsx';
|
|
25
|
+
export { IconButton, type IconButtonProps, type IconButtonSize } from './IconButton.tsx';
|
|
26
|
+
export { IconPicker, type IconPickerGroup, type IconPickerProps } from './IconPicker.tsx';
|
|
27
|
+
export { Input, TextArea, type InputProps, type TextAreaProps } from './Input.tsx';
|
|
28
|
+
export { Kbd, KeyCap, Keys, type KbdProps, type KeyCapProps, type KeysProps } from './Kbd.tsx';
|
|
29
|
+
export { ListRow, type ListRowProps } from './ListRow.tsx';
|
|
30
|
+
export { Meter, type MeterProps } from './Meter.tsx';
|
|
31
|
+
export { PanelEmpty, type PanelEmptyProps } from './PanelEmpty.tsx';
|
|
32
|
+
export { PanelHeader, type PanelHeaderProps } from './PanelHeader.tsx';
|
|
33
|
+
export { Pill, type PillProps } from './Pill.tsx';
|
|
34
|
+
export { PromptDialog, type PromptDialogProps } from './PromptDialog.tsx';
|
|
35
|
+
export { ProjectSwitcher, type ProjectSwitcherItem, type ProjectSwitcherProps } from './ProjectSwitcher.tsx';
|
|
36
|
+
export { SectionLabel, type SectionLabelProps } from './SectionLabel.tsx';
|
|
37
|
+
export { SegmentBar, type SegmentBarPart, type SegmentBarProps } from './SegmentBar.tsx';
|
|
38
|
+
export { Segmented, type SegmentedOption, type SegmentedProps } from './Segmented.tsx';
|
|
39
|
+
export { Select, type SelectGroup, type SelectItem, type SelectProps } from './Select.tsx';
|
|
40
|
+
export { Separator, type SeparatorProps } from './Separator.tsx';
|
|
41
|
+
export { ShortcutHints } from './ShortcutHints.tsx';
|
|
42
|
+
export { Skeleton, type SkeletonProps } from './Skeleton.tsx';
|
|
43
|
+
export { SlidingColumn, type SlidingColumnProps } from './SlidingColumn.tsx';
|
|
44
|
+
export { Spinner, type SpinnerProps } from './Spinner.tsx';
|
|
45
|
+
export { Stepper, type StepperProps } from './Stepper.tsx';
|
|
46
|
+
export { Surface, type SurfaceProps } from './Surface.tsx';
|
|
47
|
+
export { Switch, type SwitchProps } from './Switch.tsx';
|
|
48
|
+
export { TextMenu, type TextMenuProps } from './TextMenu.tsx';
|
|
49
|
+
export { Tile, type TileProps } from './Tile.tsx';
|
|
50
|
+
export { Toasts, type ToastsProps } from './Toasts.tsx';
|
|
51
|
+
export { Tooltip, TooltipProvider, type TooltipProps, type TooltipSide } from './Tooltip.tsx';
|
|
52
|
+
export { UIProvider, type UIProviderProps } from './UIProvider.tsx';
|
|
53
|
+
export { Waveform, type WaveformProps } from './Waveform.tsx';
|
|
54
|
+
export { Wipe, type WipeProps } from './Wipe.tsx';
|
|
55
|
+
export { ZoomControls, type ZoomControlsProps, type ZoomLabels, type ZoomSelection } from './ZoomControls.tsx';
|
|
56
|
+
export { copyText, readClipboardText } from './clipboard.ts';
|
|
57
|
+
export { messageOf } from './error-message.ts';
|
|
58
|
+
export type { ResetKeys } from './error-boundary.ts';
|
|
59
|
+
export { FILE_TREE_ICONS } from './file-icon.ts';
|
|
60
|
+
export { cameThroughPortal, isInFloatingLayer } from './floating.ts';
|
|
61
|
+
export { LoadedComponent, lazyDialog, lazyNamed, onLazyOpenError } from './lazy.tsx';
|
|
62
|
+
export { UI_NAMESPACE, UI_RESOURCES, addUiResources } from './locales.ts';
|
|
63
|
+
export { startInputModality } from './modality.ts';
|
|
64
|
+
export { isApplePlatform } from './platform.ts';
|
|
65
|
+
export { Prefetcher, prefetcher, type Loader, type WhenIdle } from './prefetch.ts';
|
|
66
|
+
export { selectAllWithin, selectionWithin } from './selection.ts';
|
|
67
|
+
export { EDIT_SHORTCUTS, KEY_SHORTCUTS, formatShortcut, isModHeld, matchesShortcut, shortcut, shortcutParts, type KeyLike, type Shortcut } from './shortcut.ts';
|
|
68
|
+
export { SUCCESS_MS, UNDO_MS, createToastStore, elapsedOf, type Toast, type ToastAction, type ToastDeadline, type ToastInput, type ToastKind, type ToastPatch, type ToastStore, type ToastStoreHook } from './toast-store.ts';
|
|
69
|
+
export { useAsyncAction, type AsyncAction } from './useAsyncAction.ts';
|
|
70
|
+
export { clampColumnSize, useColumnResize, type ColumnEdge, type ColumnResize, type ColumnResizeOptions } from './useColumnResize.ts';
|
|
71
|
+
export { useContentSize, type ContentSize } from './useContentSize.ts';
|
|
72
|
+
export { useMeasuredWidth } from './useMeasuredWidth.ts';
|
|
73
|
+
export { useNow, useTickingText } from './useNow.ts';
|
|
74
|
+
export { ZOOM_PRESETS } from './zoom.ts';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* The components, hooks and helpers of the library. Every name here is public API; the snapshot in
|
|
3
|
+
* `exports.test.ts` turns any change to this list into a diff someone has to accept.
|
|
4
|
+
*/
|
|
5
|
+
export * as ContextMenu from './context-menu/index.parts.js';
|
|
6
|
+
export * as Dialog from './dialog/index.parts.js';
|
|
7
|
+
export * as Menu from './menu/index.parts.js';
|
|
8
|
+
export * as Popover from './popover/index.parts.js';
|
|
9
|
+
export * as PreviewCard from './preview-card/index.parts.js';
|
|
10
|
+
export { AccentSwatches } from './AccentSwatches.js';
|
|
11
|
+
export { Banner } from './Banner.js';
|
|
12
|
+
export { Button } from './Button.js';
|
|
13
|
+
export { ButtonGroup } from './ButtonGroup.js';
|
|
14
|
+
export { Checkbox } from './Checkbox.js';
|
|
15
|
+
export { ChoiceCards } from './ChoiceCards.js';
|
|
16
|
+
export { CloseButton } from './CloseButton.js';
|
|
17
|
+
export { ColorSwatch } from './ColorSwatch.js';
|
|
18
|
+
export { ColumnResizeHandle } from './ColumnResizeHandle.js';
|
|
19
|
+
export { DisabledReason } from './DisabledReason.js';
|
|
20
|
+
export { DockShell } from './DockShell.js';
|
|
21
|
+
export { EmptyState } from './EmptyState.js';
|
|
22
|
+
export { ErrorBoundary } from './ErrorBoundary.js';
|
|
23
|
+
export { Field, FieldHint, FormError } from './Field.js';
|
|
24
|
+
export { FileIcon } from './FileIcon.js';
|
|
25
|
+
export { Icon } from './Icon.js';
|
|
26
|
+
export { IconButton } from './IconButton.js';
|
|
27
|
+
export { IconPicker } from './IconPicker.js';
|
|
28
|
+
export { Input, TextArea } from './Input.js';
|
|
29
|
+
export { Kbd, KeyCap, Keys } from './Kbd.js';
|
|
30
|
+
export { ListRow } from './ListRow.js';
|
|
31
|
+
export { Meter } from './Meter.js';
|
|
32
|
+
export { PanelEmpty } from './PanelEmpty.js';
|
|
33
|
+
export { PanelHeader } from './PanelHeader.js';
|
|
34
|
+
export { Pill } from './Pill.js';
|
|
35
|
+
export { PromptDialog } from './PromptDialog.js';
|
|
36
|
+
export { ProjectSwitcher } from './ProjectSwitcher.js';
|
|
37
|
+
export { SectionLabel } from './SectionLabel.js';
|
|
38
|
+
export { SegmentBar } from './SegmentBar.js';
|
|
39
|
+
export { Segmented } from './Segmented.js';
|
|
40
|
+
export { Select } from './Select.js';
|
|
41
|
+
export { Separator } from './Separator.js';
|
|
42
|
+
export { ShortcutHints } from './ShortcutHints.js';
|
|
43
|
+
export { Skeleton } from './Skeleton.js';
|
|
44
|
+
export { SlidingColumn } from './SlidingColumn.js';
|
|
45
|
+
export { Spinner } from './Spinner.js';
|
|
46
|
+
export { Stepper } from './Stepper.js';
|
|
47
|
+
export { Surface } from './Surface.js';
|
|
48
|
+
export { Switch } from './Switch.js';
|
|
49
|
+
export { TextMenu } from './TextMenu.js';
|
|
50
|
+
export { Tile } from './Tile.js';
|
|
51
|
+
export { Toasts } from './Toasts.js';
|
|
52
|
+
export { Tooltip, TooltipProvider } from './Tooltip.js';
|
|
53
|
+
export { UIProvider } from './UIProvider.js';
|
|
54
|
+
export { Waveform } from './Waveform.js';
|
|
55
|
+
export { Wipe } from './Wipe.js';
|
|
56
|
+
export { ZoomControls } from './ZoomControls.js';
|
|
57
|
+
export { copyText, readClipboardText } from './clipboard.js';
|
|
58
|
+
export { messageOf } from './error-message.js';
|
|
59
|
+
export { FILE_TREE_ICONS } from './file-icon.js';
|
|
60
|
+
export { cameThroughPortal, isInFloatingLayer } from './floating.js';
|
|
61
|
+
export { LoadedComponent, lazyDialog, lazyNamed, onLazyOpenError } from './lazy.js';
|
|
62
|
+
export { UI_NAMESPACE, UI_RESOURCES, addUiResources } from './locales.js';
|
|
63
|
+
export { startInputModality } from './modality.js';
|
|
64
|
+
export { isApplePlatform } from './platform.js';
|
|
65
|
+
export { Prefetcher, prefetcher } from './prefetch.js';
|
|
66
|
+
export { selectAllWithin, selectionWithin } from './selection.js';
|
|
67
|
+
export { EDIT_SHORTCUTS, KEY_SHORTCUTS, formatShortcut, isModHeld, matchesShortcut, shortcut, shortcutParts } from './shortcut.js';
|
|
68
|
+
export { SUCCESS_MS, UNDO_MS, createToastStore, elapsedOf } from './toast-store.js';
|
|
69
|
+
export { useAsyncAction } from './useAsyncAction.js';
|
|
70
|
+
export { clampColumnSize, useColumnResize } from './useColumnResize.js';
|
|
71
|
+
export { useContentSize } from './useContentSize.js';
|
|
72
|
+
export { useMeasuredWidth } from './useMeasuredWidth.js';
|
|
73
|
+
export { useNow, useTickingText } from './useNow.js';
|
|
74
|
+
export { ZOOM_PRESETS } from './zoom.js';
|
package/dist/lazy.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { type ComponentProps, type ComponentType } from 'react';
|
|
2
|
+
export declare class LoadedComponent<Component> {
|
|
3
|
+
current: Component | null;
|
|
4
|
+
private readonly listeners;
|
|
5
|
+
private readonly loader;
|
|
6
|
+
constructor(loader: () => Promise<Component>);
|
|
7
|
+
load(): Promise<Component>;
|
|
8
|
+
subscribe(listener: () => void): () => void;
|
|
9
|
+
}
|
|
10
|
+
export declare function onLazyOpenError(listener: (error: unknown) => void): () => void;
|
|
11
|
+
export declare function lazyNamed<Module extends Record<Name, ComponentType<any>>, Name extends keyof Module>(load: () => Promise<Module>, name: Name): ComponentType<ComponentProps<Module[Name]>>;
|
|
12
|
+
export declare function lazyDialog<Module extends Record<Name, ComponentType>, Name extends keyof Module, State>(load: () => Promise<Module>, name: Name, useStore: (select: (state: State) => boolean) => boolean, isOpen: (state: State) => boolean): ComponentType;
|
package/dist/lazy.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense, lazy, useState, useSyncExternalStore } from 'react';
|
|
3
|
+
import { prefetcher } from './prefetch.js';
|
|
4
|
+
/*
|
|
5
|
+
* A module's component, loaded once and kept. `React.lazy` suspends for a tick even on a module the
|
|
6
|
+
* prefetcher already has, which shows the fallback and mounts a dialog already open; a component
|
|
7
|
+
* that is here is drawn straight away instead.
|
|
8
|
+
*/
|
|
9
|
+
export class LoadedComponent {
|
|
10
|
+
current = null;
|
|
11
|
+
listeners = new Set();
|
|
12
|
+
loader;
|
|
13
|
+
constructor(loader) {
|
|
14
|
+
this.loader = loader;
|
|
15
|
+
}
|
|
16
|
+
async load() {
|
|
17
|
+
const component = await this.loader();
|
|
18
|
+
if (this.current === null) {
|
|
19
|
+
this.current = component;
|
|
20
|
+
for (const listener of this.listeners) {
|
|
21
|
+
listener();
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
return component;
|
|
25
|
+
}
|
|
26
|
+
subscribe(listener) {
|
|
27
|
+
this.listeners.add(listener);
|
|
28
|
+
return () => {
|
|
29
|
+
this.listeners.delete(listener);
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
const openErrorListeners = new Set();
|
|
34
|
+
/*
|
|
35
|
+
* Tells `listener` when a module that `lazyNamed` or `lazyDialog` loads for a render fails to load,
|
|
36
|
+
* which is a load a person waits on. A failed prefetch never reaches it, not even one of the same
|
|
37
|
+
* module at the same moment, so an app can answer the one without being woken by the other.
|
|
38
|
+
*/
|
|
39
|
+
export function onLazyOpenError(listener) {
|
|
40
|
+
openErrorListeners.add(listener);
|
|
41
|
+
return () => {
|
|
42
|
+
openErrorListeners.delete(listener);
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
/* Only a render loads through here; the prefetcher calls `loaded.load()` itself, so its failures report nothing. */
|
|
46
|
+
async function open(loaded) {
|
|
47
|
+
try {
|
|
48
|
+
return { default: await loaded.load() };
|
|
49
|
+
}
|
|
50
|
+
catch (error) {
|
|
51
|
+
for (const listener of openErrorListeners) {
|
|
52
|
+
listener(error);
|
|
53
|
+
}
|
|
54
|
+
throw error;
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
/*
|
|
58
|
+
* `React.lazy` for a module that exports its component by name, `default` included. Every module
|
|
59
|
+
* loaded through here, or through `lazyDialog`, registers with `prefetcher`, which loads it ahead of
|
|
60
|
+
* its first opening once the app calls `prefetcher.prefetchEverything()`.
|
|
61
|
+
*/
|
|
62
|
+
export function lazyNamed(load, name) {
|
|
63
|
+
const loaded = new LoadedComponent(async () => (await load())[name]);
|
|
64
|
+
prefetcher.register(() => loaded.load());
|
|
65
|
+
const Lazy = lazy(() => open(loaded));
|
|
66
|
+
// Once `loaded` has it, `Lazy` never committed anything, so switching over remounts nothing.
|
|
67
|
+
const LazyNamed = (props) => {
|
|
68
|
+
const Component = loaded.current ?? Lazy;
|
|
69
|
+
return _jsx(Component, { ...props });
|
|
70
|
+
};
|
|
71
|
+
return LazyNamed;
|
|
72
|
+
}
|
|
73
|
+
/* Stays true after the first opening, so every close after it still has something mounted to animate. */
|
|
74
|
+
function useOpenedOnce(open) {
|
|
75
|
+
const [opened, setOpened] = useState(open);
|
|
76
|
+
if (open && !opened) {
|
|
77
|
+
setOpened(true);
|
|
78
|
+
}
|
|
79
|
+
return opened || open;
|
|
80
|
+
}
|
|
81
|
+
/*
|
|
82
|
+
* A dialog that keeps its own open state. Once its module is here, prefetched or opened, it stays
|
|
83
|
+
* mounted closed, so its first opening animates like every other; before that, opening loads it.
|
|
84
|
+
*/
|
|
85
|
+
export function lazyDialog(load, name, useStore, isOpen) {
|
|
86
|
+
const loaded = new LoadedComponent(async () => (await load())[name]);
|
|
87
|
+
prefetcher.register(() => loaded.load());
|
|
88
|
+
const Dialog = lazy(() => open(loaded));
|
|
89
|
+
const subscribe = (listener) => loaded.subscribe(listener);
|
|
90
|
+
const isLoaded = () => loaded.current !== null;
|
|
91
|
+
const LazyDialog = () => {
|
|
92
|
+
const opened = useOpenedOnce(useStore(isOpen));
|
|
93
|
+
useSyncExternalStore(subscribe, isLoaded);
|
|
94
|
+
const Loaded = loaded.current;
|
|
95
|
+
if (Loaded) {
|
|
96
|
+
return _jsx(Loaded, {});
|
|
97
|
+
}
|
|
98
|
+
if (!opened) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
return (_jsx(Suspense, { fallback: null, children: _jsx(Dialog, {}) }));
|
|
102
|
+
};
|
|
103
|
+
return LazyDialog;
|
|
104
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action": {
|
|
3
|
+
"cancel": "Cancel",
|
|
4
|
+
"copy": "Copy",
|
|
5
|
+
"copyError": "Copy error",
|
|
6
|
+
"dismiss": "Dismiss",
|
|
7
|
+
"reload": "Reload",
|
|
8
|
+
"retry": "Try again",
|
|
9
|
+
"select": "Select",
|
|
10
|
+
"selectAll": "Select all"
|
|
11
|
+
},
|
|
12
|
+
"accent": {
|
|
13
|
+
"more": "More colors"
|
|
14
|
+
},
|
|
15
|
+
"settings": {
|
|
16
|
+
"title": "Settings",
|
|
17
|
+
"section": "Settings section",
|
|
18
|
+
"sections": "Settings sections",
|
|
19
|
+
"close": "Close settings",
|
|
20
|
+
"failed": "This settings page failed to render",
|
|
21
|
+
"search": {
|
|
22
|
+
"placeholder": "Search settings",
|
|
23
|
+
"clear": "Clear search",
|
|
24
|
+
"none": "Nothing matches \"{{query}}\".",
|
|
25
|
+
"results": "Search results",
|
|
26
|
+
"pane": "Section"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"controls": {
|
|
30
|
+
"stepper": {
|
|
31
|
+
"smaller": "Smaller",
|
|
32
|
+
"larger": "Larger",
|
|
33
|
+
"smallerFor": "{{label}}: smaller",
|
|
34
|
+
"largerFor": "{{label}}: larger"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"iconPicker": {
|
|
38
|
+
"label": "Icon",
|
|
39
|
+
"none": "No icon",
|
|
40
|
+
"search": "Find an icon",
|
|
41
|
+
"clear": "Clear search",
|
|
42
|
+
"noMatch": "No icon matches “{{query}}”"
|
|
43
|
+
},
|
|
44
|
+
"zoom": {
|
|
45
|
+
"out": "Zoom out",
|
|
46
|
+
"in": "Zoom in",
|
|
47
|
+
"presets": "Zoom presets",
|
|
48
|
+
"fit": "Zoom to fit",
|
|
49
|
+
"fitEverything": "Fit everything"
|
|
50
|
+
},
|
|
51
|
+
"waveform": {
|
|
52
|
+
"position": "{{time}} of {{duration}}"
|
|
53
|
+
},
|
|
54
|
+
"projectSwitcher": {
|
|
55
|
+
"label": "Projects",
|
|
56
|
+
"recent": "Recent projects",
|
|
57
|
+
"actionsFor": "Actions for {{name}}"
|
|
58
|
+
}
|
|
59
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
{
|
|
2
|
+
"action": {
|
|
3
|
+
"cancel": "Annuleren",
|
|
4
|
+
"copy": "Kopiëren",
|
|
5
|
+
"copyError": "Fout kopiëren",
|
|
6
|
+
"dismiss": "Sluiten",
|
|
7
|
+
"reload": "Herladen",
|
|
8
|
+
"retry": "Opnieuw proberen",
|
|
9
|
+
"select": "Selecteren",
|
|
10
|
+
"selectAll": "Alles selecteren"
|
|
11
|
+
},
|
|
12
|
+
"accent": {
|
|
13
|
+
"more": "Meer kleuren"
|
|
14
|
+
},
|
|
15
|
+
"settings": {
|
|
16
|
+
"title": "Instellingen",
|
|
17
|
+
"section": "Onderdeel van de instellingen",
|
|
18
|
+
"sections": "Onderdelen van de instellingen",
|
|
19
|
+
"close": "Instellingen sluiten",
|
|
20
|
+
"failed": "Deze instellingenpagina kon niet worden getekend",
|
|
21
|
+
"search": {
|
|
22
|
+
"placeholder": "Instellingen zoeken",
|
|
23
|
+
"clear": "Zoekopdracht wissen",
|
|
24
|
+
"none": "Niets komt overeen met \"{{query}}\".",
|
|
25
|
+
"results": "Zoekresultaten",
|
|
26
|
+
"pane": "Onderdeel"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"controls": {
|
|
30
|
+
"stepper": {
|
|
31
|
+
"smaller": "Kleiner",
|
|
32
|
+
"larger": "Groter",
|
|
33
|
+
"smallerFor": "{{label}}: kleiner",
|
|
34
|
+
"largerFor": "{{label}}: groter"
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"iconPicker": {
|
|
38
|
+
"label": "Icoon",
|
|
39
|
+
"none": "Geen icoon",
|
|
40
|
+
"search": "Zoek een icoon",
|
|
41
|
+
"clear": "Zoekopdracht wissen",
|
|
42
|
+
"noMatch": "Geen icoon past bij “{{query}}”"
|
|
43
|
+
},
|
|
44
|
+
"zoom": {
|
|
45
|
+
"out": "Uitzoomen",
|
|
46
|
+
"in": "Inzoomen",
|
|
47
|
+
"presets": "Zoomstanden",
|
|
48
|
+
"fit": "Zoomen tot alles past",
|
|
49
|
+
"fitEverything": "Alles laten passen"
|
|
50
|
+
},
|
|
51
|
+
"waveform": {
|
|
52
|
+
"position": "{{time}} van {{duration}}"
|
|
53
|
+
},
|
|
54
|
+
"projectSwitcher": {
|
|
55
|
+
"label": "Projecten",
|
|
56
|
+
"recent": "Recente projecten",
|
|
57
|
+
"actionsFor": "Acties voor {{name}}"
|
|
58
|
+
}
|
|
59
|
+
}
|
package/dist/locales.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import en from './locales/en.json' with { type: 'json' };
|
|
2
|
+
import nl from './locales/nl.json' with { type: 'json' };
|
|
3
|
+
/* The words of this library live in a namespace of their own, which the app adds to its i18next beside its own namespaces. */
|
|
4
|
+
export const UI_NAMESPACE = 'ui';
|
|
5
|
+
/*
|
|
6
|
+
* Every language the library speaks, by language code. Small enough to ship whole, which is what lets
|
|
7
|
+
* `addUiResources` run synchronously before the first render, so no word ever shows as its key.
|
|
8
|
+
*/
|
|
9
|
+
export const UI_RESOURCES = { en, nl };
|
|
10
|
+
/* Adds the `ui` namespace in every language to an i18next instance. A language the app already filled keeps its words. */
|
|
11
|
+
export const addUiResources = (i18n) => {
|
|
12
|
+
for (const [language, words] of Object.entries(UI_RESOURCES)) {
|
|
13
|
+
if (!i18n.hasResourceBundle(language, UI_NAMESPACE)) {
|
|
14
|
+
i18n.addResourceBundle(language, UI_NAMESPACE, words, true, false);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MenuCheck as Check, MenuCheckboxItem as CheckboxItem, MenuGroup as Group, MenuGroupLabel as GroupLabel, MenuHint as Hint, MenuItem as Item, MenuLabel as Label, MenuPopup as Popup, MenuRadioGroup as RadioGroup, MenuRadioItem as RadioItem, MenuRoot as Root, MenuRow as Row, MenuRowAction as RowAction, MenuRowSubmenuTrigger as RowSubmenuTrigger, MenuSeparator as Separator, MenuSubmenuRoot as SubmenuRoot, MenuSubmenuTrigger as SubmenuTrigger, MenuTrigger as Trigger } from './parts.tsx';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { MenuCheck as Check, MenuCheckboxItem as CheckboxItem, MenuGroup as Group, MenuGroupLabel as GroupLabel, MenuHint as Hint, MenuItem as Item, MenuLabel as Label, MenuPopup as Popup, MenuRadioGroup as RadioGroup, MenuRadioItem as RadioItem, MenuRoot as Root, MenuRow as Row, MenuRowAction as RowAction, MenuRowSubmenuTrigger as RowSubmenuTrigger, MenuSeparator as Separator, MenuSubmenuRoot as SubmenuRoot, MenuSubmenuTrigger as SubmenuTrigger, MenuTrigger as Trigger } from './parts.js';
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { type ComponentProps, type ReactNode, type Ref } from 'react';
|
|
2
|
+
import { type LucideIcon } from 'lucide-react';
|
|
3
|
+
import { ContextMenu as BaseContextMenu } from '@base-ui-components/react/context-menu';
|
|
4
|
+
import { Menu as BaseMenu } from '@base-ui-components/react/menu';
|
|
5
|
+
import { Separator as BaseSeparator } from '@base-ui-components/react/separator';
|
|
6
|
+
import { useRender } from '@base-ui-components/react/use-render';
|
|
7
|
+
type PositionerProps = ComponentProps<typeof BaseMenu.Positioner>;
|
|
8
|
+
type Placement = Pick<PositionerProps, 'side' | 'align' | 'sideOffset' | 'alignOffset' | 'collisionPadding' | 'collisionBoundary' | 'collisionAvoidance' | 'anchor' | 'sticky' | 'positionMethod'>;
|
|
9
|
+
export declare const MENU_LABEL = "px-2.5 pt-1.5 pb-0.5 text-xs/[inherit] text-text-faint";
|
|
10
|
+
export declare function MenuRoot(props: ComponentProps<typeof BaseMenu.Root>): import("react").JSX.Element;
|
|
11
|
+
export declare function ContextMenuRoot(props: ComponentProps<typeof BaseContextMenu.Root>): import("react").JSX.Element;
|
|
12
|
+
export declare function MenuSubmenuRoot(props: ComponentProps<typeof BaseMenu.SubmenuRoot>): import("react").JSX.Element;
|
|
13
|
+
export declare const MenuTrigger: BaseMenu.Trigger;
|
|
14
|
+
export declare const ContextMenuTrigger: import("react").ForwardRefExoticComponent<import("@base-ui-components/react/context-menu").ContextMenuTriggerProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
15
|
+
export type MenuPopupProps = ComponentProps<typeof BaseMenu.Popup> & Placement;
|
|
16
|
+
export declare function MenuPopup({ side, align, sideOffset, alignOffset, collisionPadding, collisionBoundary, collisionAvoidance, anchor, sticky, positionMethod, className, ...props }: MenuPopupProps): import("react").JSX.Element;
|
|
17
|
+
type ItemLook = {
|
|
18
|
+
unstyled?: boolean;
|
|
19
|
+
};
|
|
20
|
+
type MenuItemProps = ComponentProps<typeof BaseMenu.Item> & ItemLook;
|
|
21
|
+
export declare function MenuItem({ unstyled, className, ...props }: MenuItemProps): import("react").JSX.Element;
|
|
22
|
+
export interface MenuCheckProps {
|
|
23
|
+
kind: 'radio' | 'checkbox';
|
|
24
|
+
checked?: boolean;
|
|
25
|
+
className?: string;
|
|
26
|
+
ref?: Ref<HTMLSpanElement>;
|
|
27
|
+
}
|
|
28
|
+
export declare function MenuCheck({ kind, checked, className, ref }: MenuCheckProps): import("react").JSX.Element;
|
|
29
|
+
type Indicator = {
|
|
30
|
+
indicator?: 'start' | 'end';
|
|
31
|
+
};
|
|
32
|
+
type MenuCheckboxItemProps = ComponentProps<typeof BaseMenu.CheckboxItem> & ItemLook & Indicator & {
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
};
|
|
35
|
+
export declare function MenuCheckboxItem({ unstyled, indicator, className, children, ...props }: MenuCheckboxItemProps): import("react").JSX.Element;
|
|
36
|
+
export declare const MenuRadioGroup: import("react").NamedExoticComponent<import("@base-ui-components/react/menu").MenuRadioGroupProps & import("react").RefAttributes<Element>>;
|
|
37
|
+
type MenuRadioItemProps = ComponentProps<typeof BaseMenu.RadioItem> & ItemLook & Indicator & {
|
|
38
|
+
children?: ReactNode;
|
|
39
|
+
};
|
|
40
|
+
export declare function MenuRadioItem({ unstyled, indicator, className, children, ...props }: MenuRadioItemProps): import("react").JSX.Element;
|
|
41
|
+
type SubmenuTriggerProps = ComponentProps<typeof BaseMenu.SubmenuTrigger> & {
|
|
42
|
+
children?: ReactNode;
|
|
43
|
+
chevron?: boolean;
|
|
44
|
+
};
|
|
45
|
+
export declare function MenuSubmenuTrigger({ className, children, chevron, ...props }: SubmenuTriggerProps): import("react").JSX.Element;
|
|
46
|
+
export type MenuRowProps = useRender.ComponentProps<'div'>;
|
|
47
|
+
export declare function MenuRow({ render, className, ref, ...props }: MenuRowProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
48
|
+
type RowButton = {
|
|
49
|
+
icon: LucideIcon;
|
|
50
|
+
label: string;
|
|
51
|
+
iconClassName?: string;
|
|
52
|
+
};
|
|
53
|
+
export type MenuRowActionProps = Omit<ComponentProps<typeof BaseMenu.Item>, 'children' | 'label'> & RowButton;
|
|
54
|
+
export declare function MenuRowAction({ icon, label, iconClassName, className, ...props }: MenuRowActionProps): import("react").JSX.Element;
|
|
55
|
+
export type MenuRowSubmenuTriggerProps = Omit<ComponentProps<typeof BaseMenu.SubmenuTrigger>, 'children' | 'label'> & RowButton;
|
|
56
|
+
export declare function MenuRowSubmenuTrigger({ icon, label, iconClassName, className, ...props }: MenuRowSubmenuTriggerProps): import("react").JSX.Element;
|
|
57
|
+
export declare function MenuSeparator({ className, ...props }: ComponentProps<typeof BaseSeparator>): import("react").JSX.Element;
|
|
58
|
+
export declare const MenuGroup: import("react").ForwardRefExoticComponent<import("@base-ui-components/react/menu").MenuGroupProps & import("react").RefAttributes<Element>>;
|
|
59
|
+
type MenuGroupLabelProps = ComponentProps<typeof BaseMenu.GroupLabel> & {
|
|
60
|
+
unstyled?: boolean;
|
|
61
|
+
};
|
|
62
|
+
export declare function MenuGroupLabel({ unstyled, className, ...props }: MenuGroupLabelProps): import("react").JSX.Element;
|
|
63
|
+
export type MenuLabelProps = useRender.ComponentProps<'div'>;
|
|
64
|
+
export declare function MenuLabel({ render, className, ref, ...props }: MenuLabelProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
65
|
+
export type MenuHintProps = useRender.ComponentProps<'span'>;
|
|
66
|
+
export declare function MenuHint({ render, className, ref, ...props }: MenuHintProps): import("react").ReactElement<unknown, string | import("react").JSXElementConstructor<any>>;
|
|
67
|
+
export {};
|
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { createContext, useContext } from 'react';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
import { Check, ChevronRight } from 'lucide-react';
|
|
5
|
+
import { ContextMenu as BaseContextMenu } from '@base-ui-components/react/context-menu';
|
|
6
|
+
import { Menu as BaseMenu } from '@base-ui-components/react/menu';
|
|
7
|
+
import { Separator as BaseSeparator } from '@base-ui-components/react/separator';
|
|
8
|
+
import { useRender } from '@base-ui-components/react/use-render';
|
|
9
|
+
import { withClass } from '../class-name.js';
|
|
10
|
+
import { Icon } from '../Icon.js';
|
|
11
|
+
import { Tooltip } from '../Tooltip.js';
|
|
12
|
+
const MenuKindContext = createContext('menu');
|
|
13
|
+
/*
|
|
14
|
+
* A menu hangs under its trigger, lined up with its start, unless there is no room. A context menu
|
|
15
|
+
* opens at the pointer, which its positioner already knows. A submenu sits beside its row, pulled
|
|
16
|
+
* up by the popup's own padding so its first row lines up with the row that opened it.
|
|
17
|
+
*/
|
|
18
|
+
const PLACEMENT = {
|
|
19
|
+
menu: { side: 'bottom', align: 'start', sideOffset: 6 },
|
|
20
|
+
context: {},
|
|
21
|
+
submenu: { sideOffset: 4, alignOffset: -4 }
|
|
22
|
+
};
|
|
23
|
+
/* The label above a group of rows. It takes the line height of the row it sits in. */
|
|
24
|
+
export const MENU_LABEL = 'px-2.5 pt-1.5 pb-0.5 text-xs/[inherit] text-text-faint';
|
|
25
|
+
/* A trailing hint in a row: what the item does to something else, never a shortcut. A shortcut stays a `Kbd`, which `.menu-item` already pushes to the right. */
|
|
26
|
+
const MENU_HINT = 'ml-auto pl-3 text-xs/[inherit] text-text-faint';
|
|
27
|
+
/* The hairline between two groups of rows. It runs the whole width of the popup, which is what the
|
|
28
|
+
negative margin buys back from its 4px of padding, and it is softer than a border a surface ends with. */
|
|
29
|
+
const MENU_SEPARATOR = '-mx-1 my-1 h-px bg-border-soft';
|
|
30
|
+
export function MenuRoot(props) {
|
|
31
|
+
return (_jsx(MenuKindContext, { value: "menu", children: _jsx(BaseMenu.Root, { ...props }) }));
|
|
32
|
+
}
|
|
33
|
+
export function ContextMenuRoot(props) {
|
|
34
|
+
return (_jsx(MenuKindContext, { value: "context", children: _jsx(BaseContextMenu.Root, { ...props }) }));
|
|
35
|
+
}
|
|
36
|
+
export function MenuSubmenuRoot(props) {
|
|
37
|
+
return (_jsx(MenuKindContext, { value: "submenu", children: _jsx(BaseMenu.SubmenuRoot, { ...props }) }));
|
|
38
|
+
}
|
|
39
|
+
export const MenuTrigger = BaseMenu.Trigger;
|
|
40
|
+
export const ContextMenuTrigger = BaseContextMenu.Trigger;
|
|
41
|
+
/*
|
|
42
|
+
* The shell every menu is drawn in: the portal, the layer it sits on and the gap to its trigger are
|
|
43
|
+
* decided once. The popup scrolls inside the room the window leaves it; `className` adds a minimum
|
|
44
|
+
* width or a layout of its own, such as a grid of swatches.
|
|
45
|
+
*/
|
|
46
|
+
export function MenuPopup({ side, align, sideOffset, alignOffset, collisionPadding, collisionBoundary, collisionAvoidance, anchor, sticky, positionMethod, className, ...props }) {
|
|
47
|
+
const defaults = PLACEMENT[useContext(MenuKindContext)];
|
|
48
|
+
return (_jsx(BaseMenu.Portal, { children: _jsx(BaseMenu.Positioner, { className: "popup-positioner", side: side ?? defaults.side, align: align ?? defaults.align, sideOffset: sideOffset ?? defaults.sideOffset, alignOffset: alignOffset ?? defaults.alignOffset, collisionPadding: collisionPadding, collisionBoundary: collisionBoundary, collisionAvoidance: collisionAvoidance, anchor: anchor, sticky: sticky, positionMethod: positionMethod, children: _jsx(BaseMenu.Popup, { className: withClass('menu-popup', className), ...props }) }) }));
|
|
49
|
+
}
|
|
50
|
+
export function MenuItem({ unstyled = false, className, ...props }) {
|
|
51
|
+
return _jsx(BaseMenu.Item, { className: unstyled ? className : withClass('menu-item', className), ...props });
|
|
52
|
+
}
|
|
53
|
+
/*
|
|
54
|
+
* The slot before the label of a row that can be checked, in a menu or a list that reads as one. It
|
|
55
|
+
* is one line of the row tall, so a row with a second line keeps the tick beside its first. Radio and
|
|
56
|
+
* checkbox items draw it themselves; a plain row that shows a state hands it `checked`.
|
|
57
|
+
*/
|
|
58
|
+
export function MenuCheck({ kind, checked, className, ref }) {
|
|
59
|
+
const tick = _jsx(Icon, { icon: Check, size: kind === 'radio' ? 14 : 12 });
|
|
60
|
+
const indicator = checked !== undefined ? (checked && tick) : kind === 'radio' ? (_jsx(BaseMenu.RadioItemIndicator, { className: "flex", children: tick })) : (_jsx(BaseMenu.CheckboxItemIndicator, { className: "flex", children: tick }));
|
|
61
|
+
return (_jsx("span", { ref: ref, className: clsx('grid h-lh w-4 shrink-0 place-items-center', className), children: kind === 'checkbox' ? _jsx("span", { className: "grid h-4 w-4 place-items-center rounded border border-border-strong", children: indicator }) : indicator }));
|
|
62
|
+
}
|
|
63
|
+
/* A row that is on or off. The box before its label is part of it. */
|
|
64
|
+
export function MenuCheckboxItem({ unstyled = false, indicator = 'start', className, children, ...props }) {
|
|
65
|
+
if (unstyled) {
|
|
66
|
+
return (_jsx(BaseMenu.CheckboxItem, { className: className, ...props, children: children }));
|
|
67
|
+
}
|
|
68
|
+
return (_jsxs(BaseMenu.CheckboxItem, { className: withClass('menu-item', className), ...props, children: [indicator === 'start' && _jsx(MenuCheck, { kind: "checkbox" }), children, indicator === 'end' && _jsx(MenuCheck, { kind: "checkbox", className: "ml-auto" })] }));
|
|
69
|
+
}
|
|
70
|
+
export const MenuRadioGroup = BaseMenu.RadioGroup;
|
|
71
|
+
/* One of several. The tick before its label is part of it. */
|
|
72
|
+
export function MenuRadioItem({ unstyled = false, indicator = 'start', className, children, ...props }) {
|
|
73
|
+
if (unstyled) {
|
|
74
|
+
return (_jsx(BaseMenu.RadioItem, { className: className, ...props, children: children }));
|
|
75
|
+
}
|
|
76
|
+
return (_jsxs(BaseMenu.RadioItem, { className: withClass('menu-item', className), ...props, children: [indicator === 'start' && _jsx(MenuCheck, { kind: "radio" }), children, indicator === 'end' && _jsx(MenuCheck, { kind: "radio", className: "ml-auto" })] }));
|
|
77
|
+
}
|
|
78
|
+
export function MenuSubmenuTrigger({ className, children, chevron = true, ...props }) {
|
|
79
|
+
return (_jsxs(BaseMenu.SubmenuTrigger, { className: withClass('menu-item', className), ...props, children: [children, chevron && _jsx(Icon, { icon: ChevronRight, size: 14, className: "ml-auto text-text-faint" })] }));
|
|
80
|
+
}
|
|
81
|
+
/*
|
|
82
|
+
* A row with buttons at its end that reads as one row. Its first item is the row, every `RowAction`
|
|
83
|
+
* and `RowSubmenuTrigger` after it an item of its own, so the arrow keys reach each.
|
|
84
|
+
*/
|
|
85
|
+
export function MenuRow({ render, className, ref, ...props }) {
|
|
86
|
+
return useRender({ render, ref, defaultTagName: 'div', props: { role: 'group', ...props, className: clsx('menu-row', className) } });
|
|
87
|
+
}
|
|
88
|
+
/* A button in a `Menu.Row` that acts at once, named by its tooltip. `closeOnClick={false}` keeps the menu open. */
|
|
89
|
+
export function MenuRowAction({ icon, label, iconClassName, className, ...props }) {
|
|
90
|
+
return (_jsx(Tooltip, { label: label, name: true, children: _jsx(BaseMenu.Item, { className: withClass('menu-item menu-row-action', className), ...props, children: _jsx(Icon, { icon: icon, size: 14, className: iconClassName }) }) }));
|
|
91
|
+
}
|
|
92
|
+
/*
|
|
93
|
+
* A button in a `Menu.Row` that opens a submenu, inside a `Menu.SubmenuRoot`. It has no tooltip: the
|
|
94
|
+
* submenu opens on the same hover and says what the button holds.
|
|
95
|
+
*/
|
|
96
|
+
export function MenuRowSubmenuTrigger({ icon, label, iconClassName, className, ...props }) {
|
|
97
|
+
return (_jsx(BaseMenu.SubmenuTrigger, { className: withClass('menu-item menu-row-action', className), "aria-label": label, ...props, children: _jsx(Icon, { icon: icon, size: 14, className: iconClassName }) }));
|
|
98
|
+
}
|
|
99
|
+
/* Also right between two groups of rows in a popover that reads as a menu. */
|
|
100
|
+
export function MenuSeparator({ className, ...props }) {
|
|
101
|
+
return _jsx(BaseSeparator, { className: withClass(MENU_SEPARATOR, className), ...props });
|
|
102
|
+
}
|
|
103
|
+
export const MenuGroup = BaseMenu.Group;
|
|
104
|
+
export function MenuGroupLabel({ unstyled = false, className, ...props }) {
|
|
105
|
+
return _jsx(BaseMenu.GroupLabel, { className: unstyled ? className : withClass(MENU_LABEL, className), ...props });
|
|
106
|
+
}
|
|
107
|
+
/* A label above rows that are not a `Menu.Group` of their own, such as a row of swatches. */
|
|
108
|
+
export function MenuLabel({ render, className, ref, ...props }) {
|
|
109
|
+
return useRender({ render, ref, defaultTagName: 'div', props: { ...props, className: clsx(MENU_LABEL, className) } });
|
|
110
|
+
}
|
|
111
|
+
export function MenuHint({ render, className, ref, ...props }) {
|
|
112
|
+
return useRender({ render, ref, defaultTagName: 'span', props: { ...props, className: clsx(MENU_HINT, className) } });
|
|
113
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/* One callback ref that fills a component's own ref and the one its caller handed in. */
|
|
2
|
+
export const mergeRefs = (...refs) => (node) => {
|
|
3
|
+
for (const ref of refs) {
|
|
4
|
+
if (typeof ref === 'function') {
|
|
5
|
+
ref(node);
|
|
6
|
+
}
|
|
7
|
+
else if (ref) {
|
|
8
|
+
ref.current = node;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function startInputModality(): void;
|