@stll/ui 0.65.1 → 0.67.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/dist/calendar/day-calendar.d.ts +8 -3
- package/dist/calendar/day-calendar.js +8 -11
- package/dist/calendar/day-calendar.logic.d.ts +0 -2
- package/dist/calendar/day-calendar.logic.js +1 -2
- package/dist/calendar/primitives.d.ts +1 -3
- package/dist/calendar/primitives.js +1 -2
- package/dist/calendar/resource-calendar.d.ts +0 -2
- package/dist/calendar/resource-calendar.js +1 -2
- package/dist/calendar/resource-calendar.logic.d.ts +1 -3
- package/dist/calendar/resource-calendar.logic.js +1 -2
- package/dist/components/accordion.d.ts +0 -2
- package/dist/components/accordion.js +1 -2
- package/dist/components/ai-label.d.ts +0 -2
- package/dist/components/ai-label.js +1 -2
- package/dist/components/alert-dialog.d.ts +0 -2
- package/dist/components/alert-dialog.js +2 -3
- package/dist/components/animated-count.d.ts +0 -2
- package/dist/components/animated-count.js +1 -2
- package/dist/components/animated-preview.css +152 -0
- package/dist/components/animated-preview.d.ts +75 -0
- package/dist/components/animated-preview.js +105 -0
- package/dist/components/application-rail.d.ts +1 -3
- package/dist/components/application-rail.js +2 -3
- package/dist/components/avatar.d.ts +0 -2
- package/dist/components/avatar.js +1 -2
- package/dist/components/badge.d.ts +0 -2
- package/dist/components/badge.js +1 -2
- package/dist/components/bidi-text.d.ts +0 -2
- package/dist/components/bidi-text.js +1 -2
- package/dist/components/brand-icons.d.ts +0 -2
- package/dist/components/brand-icons.js +1 -2
- package/dist/components/breadcrumb.d.ts +0 -2
- package/dist/components/breadcrumb.js +1 -2
- package/dist/components/button.d.ts +0 -2
- package/dist/components/button.js +37 -15
- package/dist/components/button.native-classes.d.ts +0 -2
- package/dist/components/button.native-classes.js +1 -2
- package/dist/components/button.native.d.ts +0 -2
- package/dist/components/button.native.js +1 -2
- package/dist/components/button.shared.d.ts +1 -3
- package/dist/components/button.shared.js +1 -2
- package/dist/components/checkbox.d.ts +0 -2
- package/dist/components/checkbox.js +3 -4
- package/dist/components/collapsible.d.ts +0 -2
- package/dist/components/collapsible.js +1 -2
- package/dist/components/color-picker.d.ts +12 -5
- package/dist/components/color-picker.js +8 -10
- package/dist/components/combobox.d.ts +0 -2
- package/dist/components/combobox.js +5 -6
- package/dist/components/command.d.ts +0 -2
- package/dist/components/command.js +4 -5
- package/dist/components/composer-tokens.d.ts +1 -3
- package/dist/components/composer-tokens.js +1 -2
- package/dist/components/composer.d.ts +0 -2
- package/dist/components/composer.js +2 -3
- package/dist/components/context-menu.d.ts +9 -2
- package/dist/components/context-menu.js +10 -4
- package/dist/components/copy-button.d.ts +0 -2
- package/dist/components/copy-button.js +1 -2
- package/dist/components/court-badge.d.ts +0 -2
- package/dist/components/court-badge.js +1 -2
- package/dist/components/court-filter.d.ts +0 -2
- package/dist/components/court-filter.js +3 -4
- package/dist/components/date-picker-popover.d.ts +0 -2
- package/dist/components/date-picker-popover.js +6 -70
- package/dist/components/date-picker-popover.logic.d.ts +1 -3
- package/dist/components/date-picker-popover.logic.js +1 -2
- package/dist/components/date-range-filter.d.ts +0 -2
- package/dist/components/date-range-filter.js +1 -2
- package/dist/components/destructive-action-confirmation.d.ts +0 -2
- package/dist/components/destructive-action-confirmation.js +2 -3
- package/dist/components/destructive-confirm-dialog.d.ts +0 -2
- package/dist/components/destructive-confirm-dialog.js +1 -2
- package/dist/components/details-grid.d.ts +13 -5
- package/dist/components/details-grid.js +69 -14
- package/dist/components/dialog-form-state.d.ts +1 -3
- package/dist/components/dialog-form-state.js +1 -2
- package/dist/components/dialog.d.ts +0 -2
- package/dist/components/dialog.js +4 -5
- package/dist/components/directional-icon.d.ts +0 -2
- package/dist/components/directional-icon.js +1 -2
- package/dist/components/document-identity-badge.d.ts +0 -2
- package/dist/components/document-identity-badge.js +2 -3
- package/dist/components/document-identity-badge.logic.d.ts +1 -3
- package/dist/components/document-identity-badge.logic.js +1 -2
- package/dist/components/document-mark.d.ts +9 -0
- package/dist/components/document-mark.js +29 -0
- package/dist/components/document-mark.native.d.ts +11 -0
- package/dist/components/document-mark.native.js +36 -0
- package/dist/components/document-mark.shared.d.ts +378 -0
- package/dist/components/document-mark.shared.js +756 -0
- package/dist/components/entity-actions.d.ts +34 -0
- package/dist/components/entity-actions.js +132 -0
- package/dist/components/field.d.ts +0 -2
- package/dist/components/field.js +1 -2
- package/dist/components/file-input.d.ts +0 -2
- package/dist/components/file-input.js +2 -3
- package/dist/components/form.d.ts +0 -2
- package/dist/components/form.js +1 -2
- package/dist/components/frame.d.ts +0 -2
- package/dist/components/frame.js +1 -2
- package/dist/components/hex-color-picker.d.ts +0 -2
- package/dist/components/hex-color-picker.js +2 -3
- package/dist/components/horizontal-scroller.d.ts +0 -2
- package/dist/components/horizontal-scroller.js +3 -4
- package/dist/components/identity-text.d.ts +0 -2
- package/dist/components/identity-text.js +2 -3
- package/dist/components/inline-drop-indicator.d.ts +1 -3
- package/dist/components/inline-drop-indicator.js +1 -2
- package/dist/components/inline-rename.d.ts +0 -2
- package/dist/components/inline-rename.js +2 -3
- package/dist/components/input-control.d.ts +1 -3
- package/dist/components/input-control.js +1 -2
- package/dist/components/input-group.d.ts +0 -2
- package/dist/components/input-group.js +4 -5
- package/dist/components/input-otp.d.ts +0 -2
- package/dist/components/input-otp.js +1 -2
- package/dist/components/input.d.ts +0 -2
- package/dist/components/input.js +3 -4
- package/dist/components/input.native.d.ts +0 -2
- package/dist/components/input.native.js +1 -2
- package/dist/components/input.shared.d.ts +1 -3
- package/dist/components/kbd.d.ts +58 -0
- package/dist/components/kbd.js +90 -0
- package/dist/components/label.d.ts +0 -2
- package/dist/components/label.js +1 -2
- package/dist/components/landing.d.ts +0 -2
- package/dist/components/landing.js +1 -2
- package/dist/components/list.d.ts +0 -2
- package/dist/components/list.js +1 -2
- package/dist/components/loader.d.ts +0 -2
- package/dist/components/loader.js +1 -2
- package/dist/components/loader.native.d.ts +0 -2
- package/dist/components/loader.native.js +1 -2
- package/dist/components/loader.shared.d.ts +1 -3
- package/dist/components/loader.shared.js +1 -2
- package/dist/components/matter-icon.d.ts +0 -2
- package/dist/components/matter-icon.js +2 -3
- package/dist/components/matter-icon.native.d.ts +0 -2
- package/dist/components/matter-icon.native.js +2 -3
- package/dist/components/matter-icon.shared.d.ts +1 -3
- package/dist/components/matter-icon.shared.js +1 -2
- package/dist/components/menu-section.d.ts +0 -2
- package/dist/components/menu-section.js +1 -2
- package/dist/components/menu.d.ts +18 -4
- package/dist/components/menu.js +29 -9
- package/dist/components/middle-truncate.d.ts +0 -2
- package/dist/components/middle-truncate.js +1 -2
- package/dist/components/middle-truncate.logic.d.ts +0 -2
- package/dist/components/middle-truncate.logic.js +1 -2
- package/dist/components/number-input.d.ts +0 -2
- package/dist/components/number-input.js +2 -3
- package/dist/components/outline-rail.d.ts +12 -3
- package/dist/components/outline-rail.js +64 -12
- package/dist/components/outline-rail.logic.d.ts +0 -2
- package/dist/components/outline-rail.logic.js +7 -3
- package/dist/components/pagination.d.ts +0 -2
- package/dist/components/pagination.js +1 -2
- package/dist/components/popover.d.ts +0 -2
- package/dist/components/popover.js +2 -3
- package/dist/components/preview-card.d.ts +0 -2
- package/dist/components/preview-card.js +1 -2
- package/dist/components/preview-pane.d.ts +0 -2
- package/dist/components/preview-pane.js +1 -2
- package/dist/components/prose.d.ts +0 -2
- package/dist/components/prose.js +1 -2
- package/dist/components/scroll-area.d.ts +0 -2
- package/dist/components/scroll-area.js +1 -2
- package/dist/components/scroll-to-top.d.ts +1 -3
- package/dist/components/scroll-to-top.js +1 -2
- package/dist/components/search-field.d.ts +0 -2
- package/dist/components/search-field.js +1 -2
- package/dist/components/secret-input.d.ts +0 -2
- package/dist/components/secret-input.js +1 -2
- package/dist/components/segmented-icon-toggle.d.ts +0 -2
- package/dist/components/segmented-icon-toggle.js +2 -3
- package/dist/components/select.d.ts +0 -2
- package/dist/components/select.js +4 -5
- package/dist/components/separator.d.ts +0 -2
- package/dist/components/separator.js +1 -2
- package/dist/components/separator.native.d.ts +1 -3
- package/dist/components/separator.native.js +1 -2
- package/dist/components/separator.shared.d.ts +1 -3
- package/dist/components/sheet.d.ts +0 -2
- package/dist/components/sheet.js +3 -4
- package/dist/components/sheet.native.d.ts +1 -3
- package/dist/components/sheet.native.js +2 -3
- package/dist/components/sheet.shared.d.ts +1 -3
- package/dist/components/sidebar.d.ts +0 -2
- package/dist/components/sidebar.js +5 -6
- package/dist/components/sidebar.logic.d.ts +1 -3
- package/dist/components/sidebar.logic.js +1 -2
- package/dist/components/skeleton.d.ts +0 -2
- package/dist/components/skeleton.js +1 -2
- package/dist/components/split-button.d.ts +0 -2
- package/dist/components/split-button.js +2 -3
- package/dist/components/status-mark.d.ts +0 -2
- package/dist/components/status-mark.js +1 -2
- package/dist/components/stella-mark.d.ts +1 -3
- package/dist/components/stella-mark.js +1 -2
- package/dist/components/stella-mark.native.d.ts +1 -3
- package/dist/components/stella-mark.native.js +1 -2
- package/dist/components/stella-mark.shared.d.ts +1 -3
- package/dist/components/stella-mark.shared.js +1 -2
- package/dist/components/stella-wordmark.d.ts +1 -3
- package/dist/components/stella-wordmark.js +1 -2
- package/dist/components/stella-wordmark.native.d.ts +1 -3
- package/dist/components/stella-wordmark.native.js +1 -2
- package/dist/components/stella-wordmark.shared.d.ts +1 -3
- package/dist/components/stella-wordmark.shared.js +1 -2
- package/dist/components/steps.d.ts +0 -2
- package/dist/components/steps.js +1 -2
- package/dist/components/swap-text.d.ts +0 -2
- package/dist/components/swap-text.js +1 -2
- package/dist/components/switch.d.ts +0 -2
- package/dist/components/switch.js +1 -2
- package/dist/components/switch.native.d.ts +0 -2
- package/dist/components/switch.native.js +1 -2
- package/dist/components/switch.shared.d.ts +1 -3
- package/dist/components/table-chart.d.ts +1 -3
- package/dist/components/table-chart.js +1 -2
- package/dist/components/table.d.ts +0 -2
- package/dist/components/table.js +1 -2
- package/dist/components/tabs.d.ts +0 -2
- package/dist/components/tabs.js +2 -3
- package/dist/components/text.d.ts +0 -2
- package/dist/components/text.js +1 -2
- package/dist/components/text.native.d.ts +0 -2
- package/dist/components/text.native.js +1 -2
- package/dist/components/text.shared.d.ts +1 -3
- package/dist/components/text.shared.js +1 -2
- package/dist/components/textarea.d.ts +11 -3
- package/dist/components/textarea.js +53 -15
- package/dist/components/textarea.native.d.ts +1 -3
- package/dist/components/textarea.native.js +1 -2
- package/dist/components/textarea.shared.d.ts +1 -3
- package/dist/components/time-field.d.ts +25 -0
- package/dist/components/time-field.js +108 -0
- package/dist/components/toast.d.ts +0 -2
- package/dist/components/toast.js +4 -5
- package/dist/components/toggle-group.d.ts +0 -2
- package/dist/components/toggle-group.js +1 -2
- package/dist/components/toggle.d.ts +0 -2
- package/dist/components/toggle.js +1 -2
- package/dist/components/toolbar-icon-action.d.ts +0 -2
- package/dist/components/toolbar-icon-action.js +1 -2
- package/dist/components/tooltip-trigger-helper.d.ts +0 -2
- package/dist/components/tooltip-trigger-helper.js +1 -2
- package/dist/components/tooltip.d.ts +7 -3
- package/dist/components/tooltip.js +10 -6
- package/dist/components/truncated-text.d.ts +0 -2
- package/dist/components/truncated-text.js +3 -4
- package/dist/components/view-toolbar.d.ts +0 -2
- package/dist/components/view-toolbar.js +1 -2
- package/dist/components/workspace-shell.d.ts +0 -2
- package/dist/components/workspace-shell.js +4 -5
- package/dist/css.d.ts +0 -1
- package/dist/data-table/schema.d.ts +1 -3
- package/dist/data-table/schema.js +1 -2
- package/dist/data-table/table.d.ts +0 -2
- package/dist/data-table/table.js +2 -3
- package/dist/hooks/use-contained-handler.d.ts +0 -2
- package/dist/hooks/use-contained-handler.js +1 -2
- package/dist/hooks/use-content-dir.d.ts +0 -2
- package/dist/hooks/use-content-dir.js +1 -2
- package/dist/hooks/use-latest.d.ts +1 -3
- package/dist/hooks/use-latest.js +1 -2
- package/dist/hooks/use-mobile.d.ts +1 -3
- package/dist/hooks/use-mobile.js +1 -2
- package/dist/hooks/use-prefers-reduced-motion.d.ts +6 -0
- package/dist/hooks/use-prefers-reduced-motion.js +17 -0
- package/dist/hooks/use-viewport-width.d.ts +1 -3
- package/dist/hooks/use-viewport-width.js +1 -2
- package/dist/index.d.ts +5 -4
- package/dist/index.js +35 -34
- package/dist/inspector/chrome.d.ts +1 -3
- package/dist/inspector/chrome.js +2 -3
- package/dist/inspector/dock.d.ts +0 -2
- package/dist/inspector/dock.js +2 -3
- package/dist/inspector/entity-tab.d.ts +0 -2
- package/dist/inspector/entity-tab.js +3 -4
- package/dist/inspector/entity-tab.logic.d.ts +1 -3
- package/dist/inspector/entity-tab.logic.js +1 -2
- package/dist/inspector/facet-bar.d.ts +1 -3
- package/dist/inspector/facet-bar.js +5 -6
- package/dist/inspector/facet-bar.logic.d.ts +1 -3
- package/dist/inspector/facet-bar.logic.js +1 -2
- package/dist/inspector/index.js +2 -2
- package/dist/inspector/layout-tokens.d.ts +1 -3
- package/dist/inspector/layout-tokens.js +1 -2
- package/dist/inspector/pane-width.d.ts +0 -2
- package/dist/inspector/pane-width.js +1 -2
- package/dist/inspector/use-pane-width.d.ts +0 -2
- package/dist/inspector/use-pane-width.js +1 -2
- package/dist/kanban/band-peek.d.ts +1 -3
- package/dist/kanban/band-peek.js +1 -2
- package/dist/kanban/card-properties.d.ts +1 -3
- package/dist/kanban/card-properties.js +1 -2
- package/dist/kanban/card-shell.d.ts +1 -3
- package/dist/kanban/card-shell.js +2 -3
- package/dist/kanban/cell-action.d.ts +1 -3
- package/dist/kanban/cell-action.js +2 -3
- package/dist/kanban/column-band-header.d.ts +1 -3
- package/dist/kanban/column-band-header.js +2 -3
- package/dist/kanban/column-bands.d.ts +1 -3
- package/dist/kanban/column-bands.js +1 -2
- package/dist/kanban/column-header.d.ts +1 -3
- package/dist/kanban/column-header.js +1 -2
- package/dist/kanban/drag-interactions.d.ts +0 -2
- package/dist/kanban/drag-interactions.js +1 -2
- package/dist/kanban/grouping.d.ts +1 -3
- package/dist/kanban/grouping.js +1 -2
- package/dist/kanban/index.js +5 -5
- package/dist/kanban/layout-tokens.d.ts +1 -3
- package/dist/kanban/layout-tokens.js +1 -2
- package/dist/kanban/matrix.d.ts +1 -3
- package/dist/kanban/matrix.js +1 -2
- package/dist/kanban/sortable-edge.d.ts +0 -2
- package/dist/kanban/sortable-edge.js +1 -2
- package/dist/kanban/sortable-interactions.d.ts +0 -2
- package/dist/kanban/sortable-interactions.js +3 -4
- package/dist/kanban/sortable-interactions.logic.d.ts +0 -2
- package/dist/kanban/sortable-interactions.logic.js +1 -2
- package/dist/kanban/sticky-lane.d.ts +0 -2
- package/dist/kanban/sticky-lane.js +1 -2
- package/dist/kanban/subgroup-board.d.ts +0 -2
- package/dist/kanban/subgroup-board.js +5 -6
- package/dist/kanban/touch-identity.d.ts +0 -2
- package/dist/kanban/touch-identity.js +1 -2
- package/dist/kanban/virtual-cell.d.ts +1 -3
- package/dist/kanban/virtual-cell.js +3 -4
- package/dist/lib/button-disposition.d.ts +0 -2
- package/dist/lib/button-disposition.js +1 -2
- package/dist/lib/control-size.d.ts +0 -2
- package/dist/lib/control-size.js +1 -2
- package/dist/lib/field-trigger.d.ts +1 -3
- package/dist/lib/field-trigger.js +1 -2
- package/dist/lib/file-picker.d.ts +0 -2
- package/dist/lib/file-picker.js +1 -2
- package/dist/lib/initials.d.ts +1 -3
- package/dist/lib/initials.js +1 -2
- package/dist/lib/inline-reorder.d.ts +0 -2
- package/dist/lib/inline-reorder.js +1 -2
- package/dist/lib/matter-colors.d.ts +0 -2
- package/dist/lib/matter-colors.js +1 -2
- package/dist/lib/menu-row.d.ts +1 -3
- package/dist/lib/menu-row.js +1 -2
- package/dist/lib/native-context-menu.d.ts +24 -0
- package/dist/lib/native-context-menu.js +85 -0
- package/dist/lib/option-color.d.ts +1 -3
- package/dist/lib/option-color.js +1 -2
- package/dist/lib/overlay-layer.d.ts +1 -3
- package/dist/lib/overlay-layer.js +1 -2
- package/dist/lib/panel-inset.d.ts +1 -3
- package/dist/lib/panel-inset.js +1 -2
- package/dist/lib/positioner-sizing.d.ts +1 -3
- package/dist/lib/positioner-sizing.js +1 -2
- package/dist/lib/renders-nothing.d.ts +8 -0
- package/dist/lib/renders-nothing.js +14 -0
- package/dist/lib/safe-area.d.ts +1 -3
- package/dist/lib/safe-area.js +1 -2
- package/dist/lib/scroll-edge-fade.d.ts +1 -3
- package/dist/lib/scroll-edge-fade.js +1 -2
- package/dist/lib/slot.d.ts +0 -2
- package/dist/lib/slot.js +1 -2
- package/dist/lib/tab-order.d.ts +0 -2
- package/dist/lib/tab-order.js +1 -2
- package/dist/lib/tooltip-content.d.ts +1 -3
- package/dist/lib/tooltip-content.js +1 -2
- package/dist/lib/typed-character.d.ts +1 -3
- package/dist/lib/typed-character.js +1 -2
- package/dist/lib/utils.d.ts +1 -3
- package/dist/lib/utils.js +1 -2
- package/dist/lib/week.d.ts +1 -3
- package/dist/lib/week.js +1 -2
- package/dist/review/review-author-avatar.d.ts +0 -2
- package/dist/review/review-author-avatar.js +2 -3
- package/dist/review/review-comment-card.d.ts +0 -2
- package/dist/review/review-comment-card.js +3 -4
- package/dist/review/review-decision-actions.d.ts +0 -2
- package/dist/review/review-decision-actions.js +2 -3
- package/dist/review/review-diff-text.d.ts +0 -2
- package/dist/review/review-diff-text.js +1 -2
- package/dist/review/review-out-of-date-notice.d.ts +0 -2
- package/dist/review/review-out-of-date-notice.js +2 -3
- package/dist/review/review-severity-dot.d.ts +0 -2
- package/dist/review/review-severity-dot.js +1 -2
- package/dist/review/review-status-badge.d.ts +0 -2
- package/dist/review/review-status-badge.js +1 -2
- package/dist/review/review-word-diff.d.ts +1 -3
- package/dist/review/review-word-diff.js +1 -2
- package/dist/review/text-mark.d.ts +0 -2
- package/dist/review/text-mark.js +1 -2
- package/dist/styles/theme.css +50 -23
- package/dist/testing/browser-clock.d.ts +1 -3
- package/dist/testing/browser-clock.js +1 -2
- package/package.json +50 -10
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { ContextMenuAction } from "./context-menu.js";
|
|
2
|
+
import { ReactNode, Ref } from "react";
|
|
3
|
+
/** One action of an object: the same shape `ContextMenu` renders. */
|
|
4
|
+
export type EntityAction = ContextMenuAction;
|
|
5
|
+
export type EntityActionsProps = {
|
|
6
|
+
/** The object's actions, in menu order. An empty list still owns the
|
|
7
|
+
* object's right-click: the native menu stays, never a parent's menu. */
|
|
8
|
+
actions: readonly EntityAction[];
|
|
9
|
+
/** The object, which becomes the right-click target. It may render an
|
|
10
|
+
* `EntityActionsButton` anywhere inside. */
|
|
11
|
+
children: ReactNode;
|
|
12
|
+
/** A line above the actions in both menus, such as when a message was
|
|
13
|
+
* sent. It is a label, not an action. */
|
|
14
|
+
heading?: ReactNode;
|
|
15
|
+
/** The accessible name of the "…" button, e.g. "Actions". */
|
|
16
|
+
label: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* An object's actions: the right-click menu over `children`, and the list
|
|
20
|
+
* an `EntityActionsButton` inside them opens.
|
|
21
|
+
*/
|
|
22
|
+
export declare const EntityActions: ({ actions, children, heading, label }: EntityActionsProps) => import("react").JSX.Element;
|
|
23
|
+
export type EntityActionsButtonProps = {
|
|
24
|
+
/** Popup alignment against the button. */
|
|
25
|
+
align?: "center" | "end" | "start";
|
|
26
|
+
ref?: Ref<HTMLButtonElement>;
|
|
27
|
+
/** Popup side against the button. */
|
|
28
|
+
side?: "bottom" | "left" | "right" | "top";
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* The "…" button of the `EntityActions` around it. It opens the same list
|
|
32
|
+
* right-click opens, and renders nothing when the object has no actions.
|
|
33
|
+
*/
|
|
34
|
+
export declare const EntityActionsButton: ({ align, ref, side }: EntityActionsButtonProps) => import("react").JSX.Element | null;
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { EllipsisIcon } from "../icons.js";
|
|
3
|
+
import { nativeContextMenuReason } from "../lib/native-context-menu.js";
|
|
4
|
+
import { Button } from "./button.js";
|
|
5
|
+
import { ContextMenuActionItems } from "./context-menu.js";
|
|
6
|
+
import { DropdownMenu as Menu, DropdownMenuContent as MenuPopup, DropdownMenuGroup as MenuGroup, DropdownMenuLabel as MenuGroupLabel, DropdownMenuSeparator as MenuSeparator, DropdownMenuTrigger as MenuTrigger, MenuAnchor } from "./menu.js";
|
|
7
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
8
|
+
import { createContext, use, useRef, useState } from "react";
|
|
9
|
+
import { panic } from "better-result";
|
|
10
|
+
// src/components/entity-actions.tsx
|
|
11
|
+
const EntityActionsContext = createContext(null);
|
|
12
|
+
const isContextMenuKey = (event) => event.key === "ContextMenu" || event.shiftKey && event.key === "F10";
|
|
13
|
+
const FOCUSABLE_SELECTOR = "a[href], button, input, select, textarea, [tabindex]:not([tabindex='-1'])";
|
|
14
|
+
/** The control focus returns to when the menu closes, inside the object. */
|
|
15
|
+
const focusReturnTarget = (container, target) => {
|
|
16
|
+
if (!(target instanceof Element)) return null;
|
|
17
|
+
const focusable = target.closest(FOCUSABLE_SELECTOR);
|
|
18
|
+
return focusable !== null && container.contains(focusable) ? focusable : null;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* Right-clicks (and context-menu keys) an object already answered for. The
|
|
22
|
+
* innermost object owns the event even when it has no actions and leaves it
|
|
23
|
+
* to the native menu, so the objects around it never open theirs. A marker
|
|
24
|
+
* rather than `stopPropagation`: the native menu, and listeners further up
|
|
25
|
+
* such as the desktop webview's policy, still see the event.
|
|
26
|
+
*/
|
|
27
|
+
const ownedEvents = /* @__PURE__ */ new WeakSet();
|
|
28
|
+
/** Claims the event for this object; false when an inner object owns it. */
|
|
29
|
+
const claimEvent = (event) => {
|
|
30
|
+
if (ownedEvents.has(event)) return false;
|
|
31
|
+
ownedEvents.add(event);
|
|
32
|
+
return true;
|
|
33
|
+
};
|
|
34
|
+
const EntityActionItems = ({ actions, heading }) => /* @__PURE__ */ jsxs(Fragment, { children: [heading !== void 0 && heading !== null && /* @__PURE__ */ jsxs(Fragment, { children: [/* @__PURE__ */ jsx(MenuGroup, { children: /* @__PURE__ */ jsx(MenuGroupLabel, {
|
|
35
|
+
className: "font-normal",
|
|
36
|
+
children: heading
|
|
37
|
+
}) }), /* @__PURE__ */ jsx(MenuSeparator, {})] }), /* @__PURE__ */ jsx(ContextMenuActionItems, { actions })] });
|
|
38
|
+
/**
|
|
39
|
+
* An object's actions: the right-click menu over `children`, and the list
|
|
40
|
+
* an `EntityActionsButton` inside them opens.
|
|
41
|
+
*/
|
|
42
|
+
const EntityActions = ({ actions, children, heading, label }) => {
|
|
43
|
+
const [open, setOpen] = useState(false);
|
|
44
|
+
const [anchor, setAnchor] = useState(null);
|
|
45
|
+
const returnFocus = useRef(null);
|
|
46
|
+
const context = {
|
|
47
|
+
actions,
|
|
48
|
+
heading,
|
|
49
|
+
label
|
|
50
|
+
};
|
|
51
|
+
const hasActions = actions.length > 0;
|
|
52
|
+
const openAt = (event, anchorRect) => {
|
|
53
|
+
event.preventDefault();
|
|
54
|
+
event.stopPropagation();
|
|
55
|
+
returnFocus.current = focusReturnTarget(event.currentTarget, event.target);
|
|
56
|
+
setAnchor(anchorRect);
|
|
57
|
+
setOpen(true);
|
|
58
|
+
};
|
|
59
|
+
const handleContextMenu = (event) => {
|
|
60
|
+
if (event.defaultPrevented || !(event.target instanceof Node) || !event.currentTarget.contains(event.target) || !claimEvent(event.nativeEvent)) return;
|
|
61
|
+
if (!hasActions || nativeContextMenuReason(event) !== null) return;
|
|
62
|
+
const { clientX: x, clientY: y } = event;
|
|
63
|
+
openAt(event, { getBoundingClientRect: () => new DOMRect(x, y, 0, 0) });
|
|
64
|
+
};
|
|
65
|
+
const handleKeyDown = (event) => {
|
|
66
|
+
const target = event.target;
|
|
67
|
+
if (event.defaultPrevented || !isContextMenuKey(event) || !(target instanceof Element) || !event.currentTarget.contains(target) || !claimEvent(event.nativeEvent)) return;
|
|
68
|
+
if (!hasActions || nativeContextMenuReason({
|
|
69
|
+
shiftKey: false,
|
|
70
|
+
target
|
|
71
|
+
}) !== null) return;
|
|
72
|
+
openAt(event, { getBoundingClientRect: () => target.getBoundingClientRect() });
|
|
73
|
+
};
|
|
74
|
+
return /* @__PURE__ */ jsxs(EntityActionsContext, {
|
|
75
|
+
value: context,
|
|
76
|
+
children: [/* @__PURE__ */ jsx("div", {
|
|
77
|
+
className: "contents",
|
|
78
|
+
"data-context-menu-target": "",
|
|
79
|
+
"data-slot": "entity-actions",
|
|
80
|
+
onContextMenu: handleContextMenu,
|
|
81
|
+
onKeyDown: handleKeyDown,
|
|
82
|
+
role: "presentation",
|
|
83
|
+
children
|
|
84
|
+
}), hasActions && /* @__PURE__ */ jsxs(Menu, {
|
|
85
|
+
onOpenChange: (nextOpen) => {
|
|
86
|
+
setOpen(nextOpen);
|
|
87
|
+
if (!nextOpen) setAnchor(null);
|
|
88
|
+
},
|
|
89
|
+
open,
|
|
90
|
+
children: [/* @__PURE__ */ jsx(MenuAnchor, {}), /* @__PURE__ */ jsx(MenuPopup, {
|
|
91
|
+
anchor: anchor ?? void 0,
|
|
92
|
+
"data-slot": "entity-actions-context-popup",
|
|
93
|
+
finalFocus: () => returnFocus.current ?? false,
|
|
94
|
+
children: /* @__PURE__ */ jsx(EntityActionItems, {
|
|
95
|
+
actions,
|
|
96
|
+
heading
|
|
97
|
+
})
|
|
98
|
+
})]
|
|
99
|
+
})]
|
|
100
|
+
});
|
|
101
|
+
};
|
|
102
|
+
/**
|
|
103
|
+
* The "…" button of the `EntityActions` around it. It opens the same list
|
|
104
|
+
* right-click opens, and renders nothing when the object has no actions.
|
|
105
|
+
*/
|
|
106
|
+
const EntityActionsButton = ({ align = "end", ref, side = "bottom" }) => {
|
|
107
|
+
const context = use(EntityActionsContext);
|
|
108
|
+
if (context === null) panic("EntityActionsButton renders inside EntityActions, which owns the list it opens");
|
|
109
|
+
if (context.actions.length === 0) return null;
|
|
110
|
+
return /* @__PURE__ */ jsxs(Menu, { children: [/* @__PURE__ */ jsx(MenuTrigger, {
|
|
111
|
+
ref,
|
|
112
|
+
render: /* @__PURE__ */ jsx(Button, {
|
|
113
|
+
"aria-label": context.label,
|
|
114
|
+
className: "size-6",
|
|
115
|
+
size: "icon-xs",
|
|
116
|
+
variant: "muted",
|
|
117
|
+
children: /* @__PURE__ */ jsx(EllipsisIcon, {
|
|
118
|
+
"aria-hidden": "true",
|
|
119
|
+
className: "size-3.5"
|
|
120
|
+
})
|
|
121
|
+
})
|
|
122
|
+
}), /* @__PURE__ */ jsx(MenuPopup, {
|
|
123
|
+
align,
|
|
124
|
+
"data-slot": "entity-actions-button-popup",
|
|
125
|
+
side,
|
|
126
|
+
children: /* @__PURE__ */ jsx(EntityActionItems, {
|
|
127
|
+
actions: context.actions,
|
|
128
|
+
heading: context.heading
|
|
129
|
+
})
|
|
130
|
+
})] });
|
|
131
|
+
};
|
|
132
|
+
export { EntityActions, EntityActionsButton };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Field as Field$1 } from "@base-ui/react/field";
|
|
2
|
-
//#region src/components/field.d.ts
|
|
3
2
|
declare const Field: ({ className, ...props }: Field$1.Root.Props) => import("react").JSX.Element;
|
|
4
3
|
declare const FieldLabel: ({ className, ...props }: Field$1.Label.Props) => import("react").JSX.Element;
|
|
5
4
|
declare const FieldItem: ({ className, ...props }: Field$1.Item.Props) => import("react").JSX.Element;
|
|
@@ -13,5 +12,4 @@ declare const FieldDescription: ({ className, ...props }: Field$1.Description.Pr
|
|
|
13
12
|
declare const FieldError: ({ className, ...props }: Field$1.Error.Props) => import("react").JSX.Element;
|
|
14
13
|
declare const FieldControl: import("react").ForwardRefExoticComponent<Omit<import("@base-ui/react").FieldControlProps, "ref"> & import("react").RefAttributes<HTMLElement>>;
|
|
15
14
|
declare const FieldValidity: import("react").FC<import("@base-ui/react").FieldValidityProps>;
|
|
16
|
-
//#endregion
|
|
17
15
|
export { Field, FieldControl, FieldDescription, FieldError, FieldItem, FieldLabel, FieldValidity };
|
package/dist/components/field.js
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
3
|
import { jsx } from "react/jsx-runtime";
|
|
4
4
|
import { Field as Field$1 } from "@base-ui/react/field";
|
|
5
|
-
|
|
5
|
+
// src/components/field.tsx
|
|
6
6
|
const Field = ({ className, ...props }) => /* @__PURE__ */ jsx(Field$1.Root, {
|
|
7
7
|
className: cn("flex flex-col items-start gap-2", className),
|
|
8
8
|
"data-slot": "field",
|
|
@@ -36,5 +36,4 @@ const FieldError = ({ className, ...props }) => /* @__PURE__ */ jsx(Field$1.Erro
|
|
|
36
36
|
});
|
|
37
37
|
const FieldControl = Field$1.Control;
|
|
38
38
|
const FieldValidity = Field$1.Validity;
|
|
39
|
-
//#endregion
|
|
40
39
|
export { Field, FieldControl, FieldDescription, FieldError, FieldItem, FieldLabel, FieldValidity };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/components/file-input.d.ts
|
|
2
1
|
type FileInputProps = {
|
|
3
2
|
accept?: string | undefined;
|
|
4
3
|
"aria-labelledby"?: string | undefined;
|
|
@@ -10,5 +9,4 @@ type FileInputProps = {
|
|
|
10
9
|
emptyLabel: string;
|
|
11
10
|
};
|
|
12
11
|
declare const FileInput: ({ accept, "aria-labelledby": labelledBy, className, disabled, file, onFileChange, chooseLabel, emptyLabel }: FileInputProps) => import("react").JSX.Element;
|
|
13
|
-
//#endregion
|
|
14
12
|
export { FileInput, type FileInputProps };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { UploadIcon } from "../icons.js";
|
|
3
|
+
import { openFilePicker } from "../lib/file-picker.js";
|
|
3
4
|
import { cn } from "../lib/utils.js";
|
|
4
5
|
import { Button } from "./button.js";
|
|
5
|
-
import { openFilePicker } from "../lib/file-picker.js";
|
|
6
6
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { useId } from "react";
|
|
8
|
-
|
|
8
|
+
// src/components/file-input.tsx
|
|
9
9
|
const FileInput = ({ accept, "aria-labelledby": labelledBy, className, disabled, file, onFileChange, chooseLabel, emptyLabel }) => {
|
|
10
10
|
const triggerId = useId();
|
|
11
11
|
return /* @__PURE__ */ jsxs("span", {
|
|
@@ -30,5 +30,4 @@ const FileInput = ({ accept, "aria-labelledby": labelledBy, className, disabled,
|
|
|
30
30
|
})]
|
|
31
31
|
});
|
|
32
32
|
};
|
|
33
|
-
//#endregion
|
|
34
33
|
export { FileInput };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Form as Form$1 } from "@base-ui/react/form";
|
|
2
2
|
import { VariantProps } from "class-variance-authority";
|
|
3
|
-
//#region src/components/form.d.ts
|
|
4
3
|
declare const formVariants: (props?: ({
|
|
5
4
|
density?: "compact" | "default" | "snug" | null | undefined;
|
|
6
5
|
layout?: "inline" | "stack" | null | undefined;
|
|
@@ -44,5 +43,4 @@ type FormProps = Form$1.Props & VariantProps<typeof formVariants> & {
|
|
|
44
43
|
* unsaved-changes guard.
|
|
45
44
|
*/
|
|
46
45
|
declare const Form: ({ className, density, layout, dirty, onDiscard, children, ...props }: FormProps) => import("react").JSX.Element;
|
|
47
|
-
//#endregion
|
|
48
46
|
export { Form, type FormErrors, type FormProps, formVariants };
|
package/dist/components/form.js
CHANGED
|
@@ -4,7 +4,7 @@ import { DialogFormState } from "./dialog-form-state.js";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { cva } from "class-variance-authority";
|
|
6
6
|
import { Form as Form$1 } from "@base-ui/react/form";
|
|
7
|
-
|
|
7
|
+
// src/components/form.tsx
|
|
8
8
|
const formVariants = cva("flex w-full", {
|
|
9
9
|
defaultVariants: {
|
|
10
10
|
density: "default",
|
|
@@ -63,5 +63,4 @@ const Form = ({ className, density, layout, dirty = false, onDiscard, children,
|
|
|
63
63
|
onDiscard
|
|
64
64
|
}), children]
|
|
65
65
|
});
|
|
66
|
-
//#endregion
|
|
67
66
|
export { Form, formVariants };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
|
-
//#region src/components/frame.d.ts
|
|
3
2
|
declare const Frame: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
|
|
4
3
|
declare const FramePanel: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
|
|
5
4
|
declare const FrameHeader: ({ className, ...props }: React$1.ComponentProps<"header">) => React$1.JSX.Element;
|
|
6
5
|
declare const FrameTitle: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
|
|
7
6
|
declare const FrameDescription: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
|
|
8
7
|
declare const FrameFooter: ({ className, ...props }: React$1.ComponentProps<"footer">) => React$1.JSX.Element;
|
|
9
|
-
//#endregion
|
|
10
8
|
export { Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle };
|
package/dist/components/frame.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn } from "../lib/utils.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/components/frame.tsx
|
|
4
4
|
const Frame = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
5
5
|
className: cn("bg-muted/72 relative flex flex-col rounded-2xl p-1", "*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-1", className),
|
|
6
6
|
"data-slot": "frame",
|
|
@@ -31,5 +31,4 @@ const FrameFooter = ({ className, ...props }) => /* @__PURE__ */ jsx("footer", {
|
|
|
31
31
|
"data-slot": "frame-panel-footer",
|
|
32
32
|
...props
|
|
33
33
|
});
|
|
34
|
-
//#endregion
|
|
35
34
|
export { Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel, FrameTitle };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
|
-
//#region src/components/hex-color-picker.d.ts
|
|
3
2
|
type HexColorPickerProps = {
|
|
4
3
|
/** Hex color with or without # (e.g. "#ff0000" or "FF0000") */
|
|
5
4
|
color?: string | undefined;
|
|
@@ -7,5 +6,4 @@ type HexColorPickerProps = {
|
|
|
7
6
|
className?: string;
|
|
8
7
|
};
|
|
9
8
|
declare const HexColorPicker: ({ color, onChange, className }: HexColorPickerProps) => React$1.JSX.Element;
|
|
10
|
-
//#endregion
|
|
11
9
|
export { HexColorPicker, type HexColorPickerProps };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { cn } from "../lib/utils.js";
|
|
3
2
|
import { containedHandler } from "../hooks/use-contained-handler.js";
|
|
4
3
|
import { useLatest } from "../hooks/use-latest.js";
|
|
4
|
+
import { cn } from "../lib/utils.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { useCallback, useEffect, useRef, useState } from "react";
|
|
7
|
-
|
|
7
|
+
// src/components/hex-color-picker.tsx
|
|
8
8
|
/**
|
|
9
9
|
* Hex color picker — saturation/brightness square + hue strip.
|
|
10
10
|
*
|
|
@@ -361,5 +361,4 @@ const HexColorPicker = ({ color = "000000", onChange, className }) => {
|
|
|
361
361
|
})]
|
|
362
362
|
});
|
|
363
363
|
};
|
|
364
|
-
//#endregion
|
|
365
364
|
export { HexColorPicker };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
//#region src/components/horizontal-scroller.d.ts
|
|
3
2
|
type ScrollDirection = "ltr" | "rtl";
|
|
4
3
|
type HorizontalScrollerProps = ComponentProps<"div"> & {
|
|
5
4
|
nextLabel: string;
|
|
@@ -16,5 +15,4 @@ export declare const HorizontalScroller: ({ children, className, nextLabel, prev
|
|
|
16
15
|
export declare const scrollState: (scrollLeft: number, scrollWidth: number, clientWidth: number, direction: ScrollDirection) => ScrollState;
|
|
17
16
|
/** Wheel deltas arrive in pixels, lines or pages; scrollBy takes pixels. */
|
|
18
17
|
export declare const wheelDeltaPixels: (event: Pick<WheelEvent, "deltaMode" | "deltaY">, node: Pick<HTMLElement, "clientWidth">) => number;
|
|
19
|
-
//#endregion
|
|
20
18
|
export {};
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { ChevronLeftIcon, ChevronRightIcon } from "../icons.js";
|
|
3
|
-
import { cn } from "../lib/utils.js";
|
|
4
2
|
import { containedEventHandler } from "../hooks/use-contained-handler.js";
|
|
3
|
+
import { ChevronLeftIcon, ChevronRightIcon } from "../icons.js";
|
|
5
4
|
import { SCROLL_EDGE_FADE_CLASS, writeScrollEdgeFade } from "../lib/scroll-edge-fade.js";
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
6
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
7
7
|
import { useCallback, useState } from "react";
|
|
8
|
-
|
|
8
|
+
// src/components/horizontal-scroller.tsx
|
|
9
9
|
const CONTROL_CLASS = "bg-background/90 text-foreground absolute top-1/2 -translate-y-1/2 rounded-full border p-1 shadow-sm";
|
|
10
10
|
const HorizontalScroller = ({ children, className, nextLabel, previousLabel, contentClassName, viewportClassName, ...props }) => {
|
|
11
11
|
const [viewport, setViewport] = useState(null);
|
|
@@ -105,5 +105,4 @@ const wheelDeltaPixels = (event, node) => {
|
|
|
105
105
|
default: return event.deltaY;
|
|
106
106
|
}
|
|
107
107
|
};
|
|
108
|
-
//#endregion
|
|
109
108
|
export { HorizontalScroller, scrollState, wheelDeltaPixels };
|
|
@@ -1,9 +1,7 @@
|
|
|
1
|
-
//#region src/components/identity-text.d.ts
|
|
2
1
|
type IdentityTextProps = {
|
|
3
2
|
children: string;
|
|
4
3
|
className?: string;
|
|
5
4
|
};
|
|
6
5
|
/** Discloses clipped names on hover and when their owning control receives focus. */
|
|
7
6
|
export declare const IdentityText: ({ children, className }: IdentityTextProps) => import("react").JSX.Element;
|
|
8
|
-
//#endregion
|
|
9
7
|
export {};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { cn } from "../lib/utils.js";
|
|
3
|
-
import { Tooltip, TooltipContent as TooltipPopup, TooltipTrigger } from "./tooltip.js";
|
|
4
3
|
import { withoutDirectionalControls } from "./bidi-text.js";
|
|
4
|
+
import { Tooltip, TooltipContent as TooltipPopup, TooltipTrigger } from "./tooltip.js";
|
|
5
5
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
import { useCallback, useId, useState } from "react";
|
|
7
|
-
|
|
7
|
+
// src/components/identity-text.tsx
|
|
8
8
|
/** Discloses clipped names on hover and when their owning control receives focus. */
|
|
9
9
|
const IdentityText = ({ children, className }) => {
|
|
10
10
|
const triggerId = useId();
|
|
@@ -70,5 +70,4 @@ const IdentityText = ({ children, className }) => {
|
|
|
70
70
|
})]
|
|
71
71
|
});
|
|
72
72
|
};
|
|
73
|
-
//#endregion
|
|
74
73
|
export { IdentityText };
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
import { InlineDropPosition } from "../lib/inline-reorder.js";
|
|
2
|
-
//#region src/components/inline-drop-indicator.d.ts
|
|
3
2
|
/**
|
|
4
3
|
* The bar beside a dragged-over item in a horizontal row. Render it inside
|
|
5
4
|
* the item's positioned wrapper; `before`/`after` follow the text direction.
|
|
6
5
|
*/
|
|
7
6
|
export declare const InlineDropIndicator: ({ position }: {
|
|
8
7
|
position: InlineDropPosition | null;
|
|
9
|
-
}) => import("react").JSX.Element | null;
|
|
10
|
-
//#endregion
|
|
8
|
+
}) => import("react").JSX.Element | null;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { cn } from "../lib/utils.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
|
-
|
|
3
|
+
// src/components/inline-drop-indicator.tsx
|
|
4
4
|
/**
|
|
5
5
|
* The bar beside a dragged-over item in a horizontal row. Render it inside
|
|
6
6
|
* the item's positioned wrapper; `before`/`after` follow the text direction.
|
|
@@ -9,5 +9,4 @@ const InlineDropIndicator = ({ position }) => position === null ? null : /* @__P
|
|
|
9
9
|
"aria-hidden": "true",
|
|
10
10
|
className: cn("bg-primary pointer-events-none absolute inset-y-1 z-20 w-0.5 rounded-full", position === "before" ? "start-0" : "end-0")
|
|
11
11
|
});
|
|
12
|
-
//#endregion
|
|
13
12
|
export { InlineDropIndicator };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ComponentProps } from "react";
|
|
2
|
-
//#region src/components/inline-rename.d.ts
|
|
3
2
|
type InlineRenameInputProps = Omit<ComponentProps<"input">, "value" | "onChange" | "onKeyDown" | "size"> & {
|
|
4
3
|
value: string;
|
|
5
4
|
onValueChange: (value: string) => void;
|
|
@@ -9,5 +8,4 @@ type InlineRenameInputProps = Omit<ComponentProps<"input">, "value" | "onChange"
|
|
|
9
8
|
fill?: boolean;
|
|
10
9
|
};
|
|
11
10
|
export declare const InlineRenameInput: ({ value, onValueChange, onCommit, onCancel, onBlur, className, ref, dir, fill, ...props }: InlineRenameInputProps) => import("react").JSX.Element;
|
|
12
|
-
//#endregion
|
|
13
11
|
export {};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { cn } from "../lib/utils.js";
|
|
2
1
|
import { contentDir, isStructuredInputType } from "../hooks/use-content-dir.js";
|
|
2
|
+
import { cn } from "../lib/utils.js";
|
|
3
3
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
import { useCallback, useImperativeHandle, useRef } from "react";
|
|
5
5
|
import { panic } from "better-result";
|
|
6
|
-
|
|
6
|
+
// src/components/inline-rename.tsx
|
|
7
7
|
/** Content-sized rename field; the title's parent owns its typography. */
|
|
8
8
|
const mirrorTextFor = (value, placeholder) => {
|
|
9
9
|
if (value !== "") return value;
|
|
@@ -72,5 +72,4 @@ const InlineRenameInput = ({ value, onValueChange, onCommit, onCancel, onBlur, c
|
|
|
72
72
|
})]
|
|
73
73
|
});
|
|
74
74
|
};
|
|
75
|
-
//#endregion
|
|
76
75
|
export { InlineRenameInput };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
//#region src/components/input-control.d.ts
|
|
2
1
|
/**
|
|
3
2
|
* A text control is two boxes: the bordered wrapper a caller styles and the
|
|
4
3
|
* element the text is typed into. The wrapper is what a height applies to and
|
|
@@ -24,5 +23,4 @@ export declare const INPUT_SIZE_CLASS_NAMES: {
|
|
|
24
23
|
* the caret room, and a matching negative margin keeps the text in line with
|
|
25
24
|
* its neighbours.
|
|
26
25
|
*/
|
|
27
|
-
export declare const INLINE_FIELD_CLASS_NAME = "placeholder:text-foreground-placeholder focus-visible:ring-ring/30 -mx-1 min-h-0 w-full min-w-0 rounded-sm bg-transparent px-1 py-0 font-[inherit] text-[length:inherit] leading-[inherit] text-inherit outline-none focus-visible:ring-2";
|
|
28
|
-
//#endregion
|
|
26
|
+
export declare const INLINE_FIELD_CLASS_NAME = "placeholder:text-foreground-placeholder focus-visible:ring-ring/30 -mx-1 min-h-0 w-full min-w-0 rounded-sm bg-transparent px-1 py-0 font-[inherit] text-[length:inherit] leading-[inherit] text-inherit outline-none focus-visible:ring-2";
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { CONTROL_SIZE } from "../lib/control-size.js";
|
|
2
|
-
|
|
2
|
+
// src/components/input-control.ts
|
|
3
3
|
/**
|
|
4
4
|
* A text control is two boxes: the bordered wrapper a caller styles and the
|
|
5
5
|
* element the text is typed into. The wrapper is what a height applies to and
|
|
@@ -26,5 +26,4 @@ const INPUT_SIZE_CLASS_NAMES = {
|
|
|
26
26
|
* its neighbours.
|
|
27
27
|
*/
|
|
28
28
|
const INLINE_FIELD_CLASS_NAME = "placeholder:text-foreground-placeholder focus-visible:ring-ring/30 -mx-1 min-h-0 w-full min-w-0 rounded-sm bg-transparent px-1 py-0 font-[inherit] text-[length:inherit] leading-[inherit] text-inherit outline-none focus-visible:ring-2";
|
|
29
|
-
//#endregion
|
|
30
29
|
export { INLINE_FIELD_CLASS_NAME, INPUT_CONTROL_CLASS_NAME, INPUT_ELEMENT_CLASS_NAME, INPUT_SIZE_CLASS_NAMES };
|
|
@@ -2,7 +2,6 @@ import * as React$1 from "react";
|
|
|
2
2
|
import { InputProps } from "./input.js";
|
|
3
3
|
import { TextareaProps } from "./textarea.js";
|
|
4
4
|
import { VariantProps } from "class-variance-authority";
|
|
5
|
-
//#region src/components/input-group.d.ts
|
|
6
5
|
declare const InputGroup: ({ className, ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
|
|
7
6
|
declare const inputGroupAddonVariants: (props?: ({
|
|
8
7
|
align?: "block-end" | "block-start" | "inline-end" | "inline-start" | null | undefined;
|
|
@@ -11,5 +10,4 @@ declare const InputGroupAddon: ({ className, align, ...props }: React$1.Componen
|
|
|
11
10
|
declare const InputGroupText: ({ className, ...props }: React$1.ComponentProps<"span">) => React$1.JSX.Element;
|
|
12
11
|
declare const InputGroupInput: ({ className, ...props }: InputProps) => React$1.JSX.Element;
|
|
13
12
|
declare const InputGroupTextarea: ({ className, ...props }: TextareaProps) => React$1.JSX.Element;
|
|
14
|
-
//#endregion
|
|
15
13
|
export { InputGroup, InputGroupAddon, InputGroupInput, InputGroupText, InputGroupTextarea };
|
|
@@ -4,14 +4,14 @@ import { Input } from "./input.js";
|
|
|
4
4
|
import { Textarea } from "./textarea.js";
|
|
5
5
|
import { jsx } from "react/jsx-runtime";
|
|
6
6
|
import { cva } from "class-variance-authority";
|
|
7
|
-
|
|
7
|
+
// src/components/input-group.tsx
|
|
8
8
|
const InputGroup = ({ className, ...props }) => /* @__PURE__ */ jsx("div", {
|
|
9
9
|
className: cn("border-input bg-background text-foreground ring-ring/24 has-autofill:bg-foreground/4 has-[input:focus-visible,textarea:focus-visible]:border-ring has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/36 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:border-destructive/64 has-[input:focus-visible,textarea:focus-visible]:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/16 dark:bg-input/32 dark:has-autofill:bg-foreground/8 dark:has-[input[aria-invalid],textarea[aria-invalid]]:ring-destructive/24 relative inline-flex w-full min-w-0 items-center rounded-lg border text-base shadow-xs/5 not-dark:bg-clip-padding before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_1px_--theme(--color-black/4%)] has-data-[align=block-end]:h-auto has-data-[align=block-end]:flex-col has-data-[align=block-start]:h-auto has-data-[align=block-start]:flex-col has-[input:disabled,textarea:disabled]:opacity-64 has-[input:disabled,textarea:disabled,input:focus-visible,textarea:focus-visible,input[aria-invalid],textarea[aria-invalid]]:shadow-none has-[input:focus-visible,textarea:focus-visible]:ring-[3px] has-[textarea]:h-auto sm:text-sm dark:not-has-[input:disabled,textarea:disabled]:not-has-[input:focus-visible,textarea:focus-visible]:not-has-[input[aria-invalid],textarea[aria-invalid]]:before:shadow-[0_-1px_--theme(--color-white/6%)] has-data-[align=inline-end]:**:[[data-size=sm]_input]:pe-1.5 has-data-[align=inline-start]:**:[[data-size=sm]_input]:ps-1.5 *:[[data-slot=input-control],[data-slot=textarea-control]]:contents *:[[data-slot=input-control],[data-slot=textarea-control]]:before:hidden has-data-[align=block-end]:**:[input]:pt-1.5 has-data-[align=block-start]:**:[input]:pb-1.5 has-data-[align=inline-end]:**:[input]:pe-2 has-data-[align=inline-start]:**:[input]:ps-2 has-[[data-align=block-start],[data-align=block-end]]:**:[input]:h-auto **:[textarea_button]:rounded-[calc(var(--radius-md)-1px)] **:[textarea]:min-h-20.5 **:[textarea]:resize-none **:[textarea]:py-[calc(--spacing(3)-1px)] **:[textarea]:max-sm:min-h-23.5", className),
|
|
10
10
|
"data-slot": "input-group",
|
|
11
11
|
role: "group",
|
|
12
12
|
...props
|
|
13
13
|
});
|
|
14
|
-
const inputGroupAddonVariants = cva("flex h-auto cursor-text items-center justify-center gap-2 leading-none select-none [&_svg]:-mx-0.5 in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 not-has-[button]:**:[svg:not([class*='opacity-'])]:opacity-80 [&>kbd]:rounded-
|
|
14
|
+
const inputGroupAddonVariants = cva("flex h-auto cursor-text items-center justify-center gap-2 leading-none select-none [&_svg]:-mx-0.5 in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4.5 sm:in-[[data-slot=input-group]:has([data-slot=input-control],[data-slot=textarea-control])]:[&_svg:not([class*='size-'])]:size-4 not-has-[button]:**:[svg:not([class*='opacity-'])]:opacity-80 [&>kbd]:rounded-sm", {
|
|
15
15
|
defaultVariants: { align: "inline-start" },
|
|
16
16
|
variants: { align: {
|
|
17
17
|
"block-end": "order-last w-full justify-start px-[calc(--spacing(3)-1px)] pb-[calc(--spacing(3)-1px)] [.border-t]:pt-[calc(--spacing(3)-1px)] [[data-size=sm]+&]:px-[calc(--spacing(2.5)-1px)]",
|
|
@@ -25,8 +25,8 @@ const InputGroupAddon = ({ className, align = "inline-start", ...props }) => /*
|
|
|
25
25
|
"data-align": align,
|
|
26
26
|
"data-slot": "input-group-addon",
|
|
27
27
|
onMouseDown: (e) => {
|
|
28
|
-
const { target } = e;
|
|
29
|
-
if (!(target instanceof Element)) return;
|
|
28
|
+
const { currentTarget, target } = e;
|
|
29
|
+
if (!(target instanceof Element) || !currentTarget.contains(target)) return;
|
|
30
30
|
if (target.closest("button, a, input, select, textarea, [role='button'], [role='combobox'], [role='listbox'], [data-slot='select-trigger']")) return;
|
|
31
31
|
e.preventDefault();
|
|
32
32
|
const parent = e.currentTarget.parentElement;
|
|
@@ -49,5 +49,4 @@ const InputGroupTextarea = ({ className, ...props }) => /* @__PURE__ */ jsx(Text
|
|
|
49
49
|
unstyled: true,
|
|
50
50
|
...props
|
|
51
51
|
});
|
|
52
|
-
//#endregion
|
|
53
52
|
export { InputGroup, InputGroupAddon, InputGroupInput, InputGroupText, InputGroupTextarea };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
2
|
import { OTPInput } from "input-otp";
|
|
3
|
-
//#region src/components/input-otp.d.ts
|
|
4
3
|
declare const InputOTP: ({ className, containerClassName, ...props }: React$1.ComponentProps<typeof OTPInput> & {
|
|
5
4
|
containerClassName?: string;
|
|
6
5
|
}) => React$1.JSX.Element;
|
|
@@ -9,5 +8,4 @@ declare const InputOTPSlot: ({ index, className, ...props }: React$1.ComponentPr
|
|
|
9
8
|
index: number;
|
|
10
9
|
}) => React$1.JSX.Element;
|
|
11
10
|
declare const InputOTPSeparator: ({ ...props }: React$1.ComponentProps<"div">) => React$1.JSX.Element;
|
|
12
|
-
//#endregion
|
|
13
11
|
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
|
|
@@ -4,7 +4,7 @@ import { cn } from "../lib/utils.js";
|
|
|
4
4
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import * as React$1 from "react";
|
|
6
6
|
import { OTPInput, OTPInputContext } from "input-otp";
|
|
7
|
-
|
|
7
|
+
// src/components/input-otp.tsx
|
|
8
8
|
const InputOTP = ({ className, containerClassName, ...props }) => /* @__PURE__ */ jsx(OTPInput, {
|
|
9
9
|
className: cn("disabled:cursor-not-allowed", className),
|
|
10
10
|
containerClassName: cn("flex items-center gap-2 has-disabled:opacity-50", containerClassName),
|
|
@@ -35,5 +35,4 @@ const InputOTPSeparator = ({ ...props }) => /* @__PURE__ */ jsx("div", {
|
|
|
35
35
|
...props,
|
|
36
36
|
children: /* @__PURE__ */ jsx(MinusIcon, {})
|
|
37
37
|
});
|
|
38
|
-
//#endregion
|
|
39
38
|
export { InputOTP, InputOTPGroup, InputOTPSeparator, InputOTPSlot };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import * as React$1 from "react";
|
|
2
2
|
import { ControlSize } from "../lib/control-size.js";
|
|
3
3
|
import { Input as Input$1 } from "@base-ui/react/input";
|
|
4
|
-
//#region src/components/input.d.ts
|
|
5
4
|
type InputProps = Omit<Input$1.Props & React$1.RefAttributes<HTMLInputElement>, "size" | "style" | "type"> & {
|
|
6
5
|
type?: Exclude<React$1.HTMLInputTypeAttribute, "file"> | undefined;
|
|
7
6
|
size?: ControlSize | number;
|
|
@@ -16,5 +15,4 @@ type InputProps = Omit<Input$1.Props & React$1.RefAttributes<HTMLInputElement>,
|
|
|
16
15
|
nativeInput?: boolean;
|
|
17
16
|
};
|
|
18
17
|
declare const Input: ({ className, size, unstyled, inline, nativeInput, dir, onChange, ...props }: InputProps) => React$1.JSX.Element;
|
|
19
|
-
//#endregion
|
|
20
18
|
export { Input, type InputProps };
|
package/dist/components/input.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
|
+
import { isStructuredInputType, useContentDir } from "../hooks/use-content-dir.js";
|
|
2
3
|
import { SearchIcon } from "../icons.js";
|
|
3
|
-
import { cn } from "../lib/utils.js";
|
|
4
4
|
import { CONTROL_SIZE } from "../lib/control-size.js";
|
|
5
|
-
import {
|
|
5
|
+
import { cn } from "../lib/utils.js";
|
|
6
6
|
import { INLINE_FIELD_CLASS_NAME, INPUT_ELEMENT_CLASS_NAME, INPUT_SIZE_CLASS_NAMES } from "./input-control.js";
|
|
7
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Input as Input$1 } from "@base-ui/react/input";
|
|
9
|
-
|
|
9
|
+
// src/components/input.tsx
|
|
10
10
|
const Input = ({ className, size = CONTROL_SIZE.default, unstyled = false, inline = false, nativeInput = false, dir, onChange, ...props }) => {
|
|
11
11
|
const controlSize = typeof size === "number" ? CONTROL_SIZE.default : size;
|
|
12
12
|
const contentDir = useContentDir({
|
|
@@ -45,5 +45,4 @@ const Input = ({ className, size = CONTROL_SIZE.default, unstyled = false, inlin
|
|
|
45
45
|
})]
|
|
46
46
|
});
|
|
47
47
|
};
|
|
48
|
-
//#endregion
|
|
49
48
|
export { Input };
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { InputContract, TextFieldContract } from "./input.shared.js";
|
|
2
2
|
import { TextInputProps } from "react-native";
|
|
3
|
-
//#region src/components/input.native.d.ts
|
|
4
3
|
type NativeFieldProps = Omit<TextInputProps, keyof TextFieldContract> & TextFieldContract & {
|
|
5
4
|
className?: string | undefined;
|
|
6
5
|
};
|
|
@@ -19,5 +18,4 @@ type InputProps = NativeFieldProps & {
|
|
|
19
18
|
* box, or iOS's filled search field for `type="search"`.
|
|
20
19
|
*/
|
|
21
20
|
export declare const Input: ({ type, unstyled, size, ...props }: InputProps) => import("react").JSX.Element;
|
|
22
|
-
//#endregion
|
|
23
21
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { textFontFamily } from "./text.native.js";
|
|
2
2
|
import { jsx } from "react/jsx-runtime";
|
|
3
3
|
import { TextInput } from "react-native";
|
|
4
|
-
|
|
4
|
+
// src/components/input.native.tsx
|
|
5
5
|
/** The field's text at each control size, as the web sets it on a phone. */
|
|
6
6
|
const TEXT_SIZE = {
|
|
7
7
|
sm: "text-sm",
|
|
@@ -62,5 +62,4 @@ const Input = ({ type = "text", unstyled = false, size = "default", ...props })
|
|
|
62
62
|
box: inputBox(type, size, unstyled),
|
|
63
63
|
size
|
|
64
64
|
});
|
|
65
|
-
//#endregion
|
|
66
65
|
export { Input, NativeField };
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { ControlSize } from "../lib/control-size.js";
|
|
2
|
-
//#region src/components/input.shared.d.ts
|
|
3
2
|
/** The props every text field renderer accepts, with one meaning. */
|
|
4
3
|
export type TextFieldContract = {
|
|
5
4
|
size?: ControlSize;
|
|
@@ -15,5 +14,4 @@ export type TextFieldContract = {
|
|
|
15
14
|
/** A single-line field also says what it holds; `search` draws a search field. */
|
|
16
15
|
export type InputContract = TextFieldContract & {
|
|
17
16
|
type?: "email" | "search" | "tel" | "text" | "url";
|
|
18
|
-
};
|
|
19
|
-
//#endregion
|
|
17
|
+
};
|