@nadicodeai/ui 12.1.165 → 12.1.167
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/AGENTS.md +8 -9
- package/README.md +2 -17
- package/dist/components/accordion.d.ts.map +1 -1
- package/dist/components/accordion.js +2 -1
- package/dist/components/account-menu.d.ts.map +1 -1
- package/dist/components/account-menu.js +5 -3
- package/dist/components/activity-calendar.d.ts.map +1 -1
- package/dist/components/activity-calendar.js +3 -2
- package/dist/components/agent-card.js +1 -1
- package/dist/components/agent-orb.d.ts.map +1 -1
- package/dist/components/agent-orb.js +1 -0
- package/dist/components/agent-profile.d.ts.map +1 -1
- package/dist/components/agent-profile.js +7 -4
- package/dist/components/alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog.d.ts.map +1 -1
- package/dist/components/alert-dialog.js +3 -3
- package/dist/components/app-mark.js +1 -1
- package/dist/components/avatar.js +8 -8
- package/dist/components/badge.d.ts +11 -16
- package/dist/components/badge.d.ts.map +1 -1
- package/dist/components/badge.js +7 -43
- package/dist/components/breadcrumb.d.ts.map +1 -1
- package/dist/components/breadcrumb.js +3 -2
- package/dist/components/button.d.ts +5 -21
- package/dist/components/button.d.ts.map +1 -1
- package/dist/components/button.js +6 -76
- package/dist/components/calendar.d.ts +1 -1
- package/dist/components/calendar.d.ts.map +1 -1
- package/dist/components/calendar.js +3 -3
- package/dist/components/card-row.js +1 -1
- package/dist/components/card.d.ts +4 -1
- package/dist/components/card.d.ts.map +1 -1
- package/dist/components/card.js +3 -2
- package/dist/components/catalog-drawer.d.ts.map +1 -1
- package/dist/components/catalog-drawer.js +3 -2
- package/dist/components/chart-axis.d.ts.map +1 -1
- package/dist/components/chart-axis.js +0 -2
- package/dist/components/chart-bar-horizontal.d.ts.map +1 -1
- package/dist/components/chart-bar-horizontal.js +16 -14
- package/dist/components/chart-card.d.ts.map +1 -1
- package/dist/components/chart-card.js +0 -1
- package/dist/components/chart.d.ts.map +1 -1
- package/dist/components/chart.js +18 -32
- package/dist/components/checkbox.d.ts +3 -2
- package/dist/components/checkbox.d.ts.map +1 -1
- package/dist/components/checkbox.js +4 -3
- package/dist/components/choicebox.d.ts +5 -5
- package/dist/components/choicebox.d.ts.map +1 -1
- package/dist/components/choicebox.js +6 -5
- package/dist/components/clearable-input.d.ts.map +1 -1
- package/dist/components/clearable-input.js +2 -2
- package/dist/components/code-block.d.ts.map +1 -1
- package/dist/components/code-block.js +4 -2
- package/dist/components/collapsible.js +1 -1
- package/dist/components/collection-filters.d.ts.map +1 -1
- package/dist/components/collection-filters.js +1 -0
- package/dist/components/collection-page.js +1 -1
- package/dist/components/collection-sort.d.ts.map +1 -1
- package/dist/components/collection-sort.js +1 -4
- package/dist/components/collection-toolbar.js +1 -1
- package/dist/components/combobox.js +4 -4
- package/dist/components/command.d.ts.map +1 -1
- package/dist/components/command.js +1 -1
- package/dist/components/confirm-dialog.js +2 -2
- package/dist/components/context-menu.d.ts +1 -1
- package/dist/components/context-menu.d.ts.map +1 -1
- package/dist/components/copy-button.js +1 -1
- package/dist/components/data-table.d.ts +14 -7
- package/dist/components/data-table.d.ts.map +1 -1
- package/dist/components/data-table.js +24 -15
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/dialog.d.ts.map +1 -1
- package/dist/components/dialog.js +2 -2
- package/dist/components/drawer.d.ts +4 -4
- package/dist/components/drawer.d.ts.map +1 -1
- package/dist/components/drawer.js +14 -15
- package/dist/components/dropdown-menu.d.ts +1 -1
- package/dist/components/dropdown-menu.d.ts.map +1 -1
- package/dist/components/dropdown-menu.js +9 -5
- package/dist/components/empty-art.js +1 -1
- package/dist/components/empty-state.js +2 -2
- package/dist/components/entry-scene.d.ts.map +1 -1
- package/dist/components/entry-scene.js +2 -3
- package/dist/components/field.js +3 -3
- package/dist/components/file-diff.d.ts.map +1 -1
- package/dist/components/file-diff.js +5 -2
- package/dist/components/footer.d.ts +1 -1
- package/dist/components/footer.d.ts.map +1 -1
- package/dist/components/footer.js +3 -3
- package/dist/components/form-dialog.d.ts.map +1 -1
- package/dist/components/form-dialog.js +2 -1
- package/dist/components/form-drawer.d.ts +7 -9
- package/dist/components/form-drawer.d.ts.map +1 -1
- package/dist/components/form-drawer.js +5 -5
- package/dist/components/form.d.ts +26 -0
- package/dist/components/form.d.ts.map +1 -0
- package/dist/components/form.js +29 -0
- package/dist/components/gauge.js +2 -2
- package/dist/components/heatmap/calendar-heatmap.d.ts.map +1 -1
- package/dist/components/heatmap/calendar-heatmap.js +15 -13
- package/dist/components/hive-scene.d.ts.map +1 -1
- package/dist/components/hive-scene.js +3 -1
- package/dist/components/hover-card.d.ts +1 -1
- package/dist/components/hover-card.d.ts.map +1 -1
- package/dist/components/hover-card.js +1 -1
- package/dist/components/input-group.d.ts +5 -6
- package/dist/components/input-group.d.ts.map +1 -1
- package/dist/components/input-group.js +8 -11
- package/dist/components/input-otp.d.ts.map +1 -1
- package/dist/components/input-otp.js +2 -2
- package/dist/components/item.d.ts +1 -1
- package/dist/components/item.js +2 -2
- package/dist/components/kbd.d.ts +6 -9
- package/dist/components/kbd.d.ts.map +1 -1
- package/dist/components/kbd.js +7 -3
- package/dist/components/message-notice.js +1 -1
- package/dist/components/middle-truncate.d.ts.map +1 -1
- package/dist/components/middle-truncate.js +1 -0
- package/dist/components/model-identity.d.ts +4 -4
- package/dist/components/model-identity.d.ts.map +1 -1
- package/dist/components/model-identity.js +2 -2
- package/dist/components/model-mark.d.ts.map +1 -1
- package/dist/components/model-mark.js +4 -2
- package/dist/components/multi-select.js +2 -2
- package/dist/components/native-select.d.ts.map +1 -1
- package/dist/components/native-select.js +2 -6
- package/dist/components/notice-banner.js +1 -1
- package/dist/components/object-page.js +2 -2
- package/dist/components/object-workspace.d.ts.map +1 -1
- package/dist/components/object-workspace.js +1 -3
- package/dist/components/overview-page.d.ts +1 -1
- package/dist/components/overview-page.d.ts.map +1 -1
- package/dist/components/overview-page.js +2 -1
- package/dist/components/page-actions.d.ts.map +1 -1
- package/dist/components/page-actions.js +9 -4
- package/dist/components/pairing-code.js +1 -1
- package/dist/components/pending-label.d.ts.map +1 -1
- package/dist/components/pending-label.js +0 -1
- package/dist/components/popover.d.ts +1 -1
- package/dist/components/popover.d.ts.map +1 -1
- package/dist/components/portal-sidebar-frame.d.ts.map +1 -1
- package/dist/components/portal-sidebar-frame.js +1 -1
- package/dist/components/product-message.d.ts.map +1 -1
- package/dist/components/product-message.js +1 -0
- package/dist/components/progress-checklist.d.ts.map +1 -1
- package/dist/components/progress-checklist.js +2 -2
- package/dist/components/progress.d.ts.map +1 -1
- package/dist/components/progress.js +5 -4
- package/dist/components/radio-group.js +2 -2
- package/dist/components/reading-column.js +1 -1
- package/dist/components/record-identity.d.ts.map +1 -1
- package/dist/components/record-identity.js +2 -5
- package/dist/components/record-list.d.ts +5 -4
- package/dist/components/record-list.d.ts.map +1 -1
- package/dist/components/record-list.js +31 -17
- package/dist/components/record-sheet.js +1 -1
- package/dist/components/record-time.d.ts.map +1 -1
- package/dist/components/record-time.js +2 -1
- package/dist/components/resizable.d.ts.map +1 -1
- package/dist/components/resizable.js +1 -1
- package/dist/components/row-edit-form.d.ts +2 -1
- package/dist/components/row-edit-form.d.ts.map +1 -1
- package/dist/components/row-edit-form.js +2 -1
- package/dist/components/run-timeline.js +1 -1
- package/dist/components/scope-switcher.js +1 -1
- package/dist/components/segmented-control.js +1 -1
- package/dist/components/select.js +1 -1
- package/dist/components/settings-facts.js +1 -1
- package/dist/components/settings-section.js +1 -1
- package/dist/components/sheet.d.ts +1 -1
- package/dist/components/sheet.d.ts.map +1 -1
- package/dist/components/sheet.js +1 -1
- package/dist/components/sidebar.d.ts +2 -2
- package/dist/components/sidebar.d.ts.map +1 -1
- package/dist/components/sidebar.js +16 -18
- package/dist/components/site-menu.d.ts +28 -0
- package/dist/components/site-menu.d.ts.map +1 -0
- package/dist/components/site-menu.js +23 -0
- package/dist/components/slider.d.ts.map +1 -1
- package/dist/components/slider.js +2 -1
- package/dist/components/snippet.d.ts +2 -0
- package/dist/components/snippet.d.ts.map +1 -1
- package/dist/components/snippet.js +13 -6
- package/dist/components/sonner.d.ts.map +1 -1
- package/dist/components/sonner.js +3 -4
- package/dist/components/status-badge.d.ts +1 -1
- package/dist/components/status-badge.d.ts.map +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/table-card.js +1 -1
- package/dist/components/table-layouts.d.ts +24 -9
- package/dist/components/table-layouts.d.ts.map +1 -1
- package/dist/components/table-layouts.js +27 -10
- package/dist/components/table.js +4 -4
- package/dist/components/tabs-nav.d.ts +52 -0
- package/dist/components/tabs-nav.d.ts.map +1 -0
- package/dist/components/tabs-nav.js +95 -0
- package/dist/components/tabs.d.ts +2 -56
- package/dist/components/tabs.d.ts.map +1 -1
- package/dist/components/tabs.js +2 -91
- package/dist/components/text-link.d.ts +1 -2
- package/dist/components/text-link.d.ts.map +1 -1
- package/dist/components/text-link.js +1 -2
- package/dist/components/textarea.d.ts +5 -2
- package/dist/components/textarea.d.ts.map +1 -1
- package/dist/components/textarea.js +12 -4
- package/dist/components/toast.d.ts +2 -0
- package/dist/components/toast.d.ts.map +1 -1
- package/dist/components/toast.js +4 -0
- package/dist/components/toggle-group.d.ts +3 -1
- package/dist/components/toggle-group.d.ts.map +1 -1
- package/dist/components/toggle-group.js +3 -6
- package/dist/components/toggle.js +1 -1
- package/dist/components/tooltip.d.ts +12 -12
- package/dist/components/tooltip.d.ts.map +1 -1
- package/dist/components/tooltip.js +9 -9
- package/dist/components/trend-badge.js +2 -2
- package/dist/components/update-card.js +1 -1
- package/dist/components/usage-meter.d.ts +1 -1
- package/dist/components/usage-meter.d.ts.map +1 -1
- package/dist/components/usage-meter.js +9 -7
- package/dist/components/waiting-line.js +1 -1
- package/dist/index.d.ts +3 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -7
- package/dist/internal/agent-orb-motion.d.ts +4 -1
- package/dist/internal/agent-orb-motion.d.ts.map +1 -1
- package/dist/internal/agent-orb-motion.js +9 -7
- package/dist/internal/agent-orb.d.ts +4 -1
- package/dist/internal/agent-orb.d.ts.map +1 -1
- package/dist/internal/agent-orb.js +7 -1
- package/dist/internal/assistant-ui/attachment.d.ts.map +1 -1
- package/dist/internal/assistant-ui/attachment.js +15 -15
- package/dist/internal/assistant-ui/follow-up-suggestions.js +1 -1
- package/dist/internal/assistant-ui/markdown-text.js +26 -25
- package/dist/internal/assistant-ui/reasoning.d.ts.map +1 -1
- package/dist/internal/assistant-ui/reasoning.js +13 -16
- package/dist/internal/assistant-ui/thread.d.ts.map +1 -1
- package/dist/internal/assistant-ui/thread.js +22 -16
- package/dist/internal/assistant-ui/tool-fallback.d.ts.map +1 -1
- package/dist/internal/assistant-ui/tool-fallback.js +29 -21
- package/dist/internal/assistant-ui/tool-group.d.ts.map +1 -1
- package/dist/internal/assistant-ui/tool-group.js +6 -7
- package/dist/internal/assistant-ui/tooltip-icon-button.js +1 -1
- package/dist/internal/badge-frame.d.ts +15 -0
- package/dist/internal/badge-frame.d.ts.map +1 -0
- package/dist/internal/badge-frame.js +44 -0
- package/dist/internal/button-classes.d.ts +20 -0
- package/dist/internal/button-classes.d.ts.map +1 -0
- package/dist/internal/button-classes.js +74 -0
- package/dist/internal/catalog-list.d.ts.map +1 -1
- package/dist/internal/catalog-list.js +8 -4
- package/dist/internal/collection-rail.js +3 -3
- package/dist/internal/form-drawer-frame.d.ts +10 -0
- package/dist/internal/form-drawer-frame.d.ts.map +1 -0
- package/dist/internal/form-drawer-frame.js +9 -0
- package/dist/internal/form-submit.d.ts +2 -1
- package/dist/internal/form-submit.d.ts.map +1 -1
- package/dist/internal/settings-save.d.ts.map +1 -1
- package/dist/internal/settings-save.js +4 -2
- package/dist/internal/status-mark.d.ts.map +1 -1
- package/dist/internal/status-mark.js +4 -1
- package/dist/internal/tab-row.d.ts +10 -0
- package/dist/internal/tab-row.d.ts.map +1 -0
- package/dist/internal/tab-row.js +2 -0
- package/dist/internal/table-compact-line.d.ts +1 -1
- package/dist/internal/table-compact-line.d.ts.map +1 -1
- package/dist/internal/table-compact-line.js +1 -1
- package/dist/internal/tooltip-content-frame.d.ts +14 -0
- package/dist/internal/tooltip-content-frame.d.ts.map +1 -0
- package/dist/internal/tooltip-content-frame.js +11 -0
- package/dist/lib/css-variables.d.ts +8 -0
- package/dist/lib/css-variables.d.ts.map +1 -0
- package/dist/lib/css-variables.js +4 -0
- package/dist/lib/merge-tokens.generated.js +1 -1
- package/dist/lib/use-copy-to-clipboard.d.ts.map +1 -1
- package/dist/lib/use-copy-to-clipboard.js +1 -2
- package/dist/showcase/samples.js +1 -1
- package/dist/showcase/specimens/choices.d.ts.map +1 -1
- package/dist/showcase/specimens/choices.js +3 -2
- package/dist/showcase/specimens/compositions.d.ts.map +1 -1
- package/dist/showcase/specimens/compositions.js +7 -5
- package/dist/showcase/specimens/data.d.ts.map +1 -1
- package/dist/showcase/specimens/data.js +1 -1
- package/dist/showcase/specimens/feedback.d.ts.map +1 -1
- package/dist/showcase/specimens/feedback.js +1 -2
- package/dist/showcase/specimens/index.d.ts +2 -0
- package/dist/showcase/specimens/index.d.ts.map +1 -1
- package/dist/showcase/specimens/inputs.d.ts +1 -0
- package/dist/showcase/specimens/inputs.d.ts.map +1 -1
- package/dist/showcase/specimens/inputs.js +5 -2
- package/dist/showcase/specimens/menus.d.ts +1 -0
- package/dist/showcase/specimens/menus.d.ts.map +1 -1
- package/dist/showcase/specimens/menus.js +7 -2
- package/dist/showcase/specimens/navigation.d.ts.map +1 -1
- package/dist/showcase/specimens/navigation.js +6 -5
- package/dist/showcase/specimens/status.d.ts.map +1 -1
- package/dist/showcase/specimens/status.js +4 -4
- package/dist/showcase/usage.generated.d.ts +1 -1
- package/dist/showcase/usage.generated.d.ts.map +1 -1
- package/dist/showcase/usage.generated.js +40 -18
- package/dist/standalone/index.js +2 -2
- package/dist/standalone/orb-page.js +10 -8
- package/dist/styles/components.css +14 -1
- package/package.json +32 -33
- package/dist/eslint/index.js +0 -224
- package/dist/eslint/rules/badge-is-static-label.js +0 -93
- package/dist/eslint/rules/button-icon-slot.js +0 -102
- package/dist/eslint/rules/button-link-for-navigation.js +0 -146
- package/dist/eslint/rules/button-no-aria-label-with-text.js +0 -75
- package/dist/eslint/rules/button-type-roles-only-in-buttons.js +0 -83
- package/dist/eslint/rules/choice-control-has-a-name.js +0 -98
- package/dist/eslint/rules/choice-group-in-fieldset.js +0 -86
- package/dist/eslint/rules/command-shortcut-single-owner.js +0 -118
- package/dist/eslint/rules/confirm-dialog-words.js +0 -63
- package/dist/eslint/rules/data-table-one-unsized-column.js +0 -96
- package/dist/eslint/rules/destructive-action-placement.js +0 -69
- package/dist/eslint/rules/disabled-choice-says-why.js +0 -71
- package/dist/eslint/rules/disabled-control-appearance.js +0 -75
- package/dist/eslint/rules/ellipsis-opens-a-dialog.js +0 -110
- package/dist/eslint/rules/empty-state-owner.js +0 -145
- package/dist/eslint/rules/input-group-owners.js +0 -155
- package/dist/eslint/rules/jsx-class-utility.js +0 -200
- package/dist/eslint/rules/kbd-children-no-modifier-text.js +0 -128
- package/dist/eslint/rules/literal-text.js +0 -41
- package/dist/eslint/rules/menu-owner.js +0 -75
- package/dist/eslint/rules/middle-truncate-placement.js +0 -69
- package/dist/eslint/rules/no-app-feature-component.js +0 -100
- package/dist/eslint/rules/no-bare-button-label.js +0 -55
- package/dist/eslint/rules/no-choice-control-wrapper.js +0 -97
- package/dist/eslint/rules/no-comment.js +0 -77
- package/dist/eslint/rules/no-control-in-read-only-surface.js +0 -106
- package/dist/eslint/rules/no-decorative-icon.js +0 -164
- package/dist/eslint/rules/no-deprecated-zod-api.js +0 -215
- package/dist/eslint/rules/no-global-patch.js +0 -115
- package/dist/eslint/rules/no-hand-built-busy.js +0 -104
- package/dist/eslint/rules/no-hand-built-theme-picker.js +0 -144
- package/dist/eslint/rules/no-hand-built-tile.js +0 -41
- package/dist/eslint/rules/no-hand-formatted-date.js +0 -87
- package/dist/eslint/rules/no-hand-stacked-avatars.js +0 -67
- package/dist/eslint/rules/no-nested-collapse.js +0 -60
- package/dist/eslint/rules/no-package-component-redefinition.js +0 -175
- package/dist/eslint/rules/no-search-in-form.js +0 -47
- package/dist/eslint/rules/no-shadcn-appearance-override.js +0 -305
- package/dist/eslint/rules/no-shell-prompt-in-snippet.js +0 -74
- package/dist/eslint/rules/no-stock-error-words.js +0 -56
- package/dist/eslint/rules/no-subject-derived-expectation.js +0 -183
- package/dist/eslint/rules/no-tooltip-around-labelled-field.js +0 -72
- package/dist/eslint/rules/no-weight-class-on-strong-in-type-role.js +0 -57
- package/dist/eslint/rules/no-write-in-subscription.js +0 -140
- package/dist/eslint/rules/one-submenu-level.js +0 -43
- package/dist/eslint/rules/one-toast-per-flow.js +0 -91
- package/dist/eslint/rules/option-count.js +0 -167
- package/dist/eslint/rules/page-command-link-not-render.js +0 -43
- package/dist/eslint/rules/page-composition.js +0 -232
- package/dist/eslint/rules/progress-needs-name.js +0 -57
- package/dist/eslint/rules/rendered-import.js +0 -121
- package/dist/eslint/rules/server-action-discipline.js +0 -233
- package/dist/eslint/rules/settings-limit-in-footer.js +0 -94
- package/dist/eslint/rules/skeleton-in-region.js +0 -80
- package/dist/eslint/rules/sortable-heading-uses-sort.js +0 -79
- package/dist/eslint/rules/table-cell-inset-owner.js +0 -107
- package/dist/eslint/rules/tabs-selection-is-controlled.js +0 -47
- package/dist/eslint/rules/test-files-from-one-definition.js +0 -67
- package/dist/eslint/rules/tooltip-only-arrow.js +0 -38
- package/dist/eslint/rules/tooltip-trigger-accessible-name.js +0 -114
- package/dist/eslint/rules/workspace-declares-imports.js +0 -163
- package/dist/eslint/strict-design-system.js +0 -250
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
4
|
import { Dialog, DialogBody, DialogClose, DialogContent, DialogDescription, DialogFooter, DialogHeader, DialogTitle, } from "./dialog.js";
|
|
5
|
+
import { Form } from "./form.js";
|
|
5
6
|
import { WaitingLine } from "./waiting-line.js";
|
|
6
7
|
import { FormSubmitButton } from "../internal/form-submit.js";
|
|
7
8
|
import { guardUnsaved } from "../internal/unsaved-guard.js";
|
|
@@ -24,5 +25,5 @@ export function FormDialog({ open, onOpenChange, onOpenChangeComplete, title, de
|
|
|
24
25
|
}
|
|
25
26
|
export function FormDialogForm({ cancelLabel, submit, notice, destructive = false, children, ...form }) {
|
|
26
27
|
const pending = submit.pending === true;
|
|
27
|
-
return (_jsxs(
|
|
28
|
+
return (_jsxs(Form, { className: "flex min-h-0 flex-col gap-(--dialog-gap)", "aria-busy": pending || undefined, "data-slot": "form-dialog-form", ...form, children: [_jsx(DialogBody, { children: children }), notice, _jsxs(DialogFooter, { className: "relative", children: [_jsx(DialogClose, { disabled: pending, render: _jsx(Button, { type: "button", variant: "outline" }), children: cancelLabel }), _jsx(FormSubmitButton, { destructive: destructive, submit: submit }), _jsx(WaitingLine, { className: "absolute inset-x-nadicode-sm bottom-1 w-auto", decorative: true, waiting: pending })] })] }));
|
|
28
29
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ComponentProps, ReactNode } from "react";
|
|
2
2
|
import { SheetContent } from "./sheet.js";
|
|
3
3
|
import { type FormProps } from "../internal/form-submit.js";
|
|
4
|
-
import {
|
|
4
|
+
import type { UnsavedGuard } from "../internal/unsaved-guard.js";
|
|
5
5
|
export type { FormProps, FormSubmit } from "../internal/form-submit.js";
|
|
6
6
|
/** What a form surface is told by its caller, whether it draws a drawer or a dialog. */
|
|
7
7
|
export type FormSurfaceProps = {
|
|
@@ -24,18 +24,16 @@ export type FormSurfaceProps = {
|
|
|
24
24
|
unsaved?: UnsavedGuard;
|
|
25
25
|
};
|
|
26
26
|
/**
|
|
27
|
-
* Why this is a drawer and not a dialog:
|
|
28
|
-
* for a dialog
|
|
29
|
-
*
|
|
30
|
-
*
|
|
27
|
+
* Why this is a drawer and not a dialog: it sets something up over several
|
|
28
|
+
* steps, with a wait; a list too long for a dialog is a `CatalogDrawer`. A form
|
|
29
|
+
* of a few fields is a `FormDialog`, and a record already on screen edits
|
|
30
|
+
* inside its row.
|
|
31
31
|
*/
|
|
32
|
-
export type FormDrawerProps = FormSurfaceProps &
|
|
33
|
-
job: "catalog";
|
|
34
|
-
} | {
|
|
32
|
+
export type FormDrawerProps = FormSurfaceProps & {
|
|
35
33
|
job: "steps";
|
|
36
34
|
/** "Step 2 of 3", worded by the product, drawn over the title, which stays the job's name. */
|
|
37
35
|
progress: string;
|
|
38
|
-
}
|
|
36
|
+
};
|
|
39
37
|
/**
|
|
40
38
|
* The right-side sheet for a catalogue or a setup in steps, at one width.
|
|
41
39
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"form-drawer.d.ts","sourceRoot":"","sources":["../../src/components/form-drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"form-drawer.d.ts","sourceRoot":"","sources":["../../src/components/form-drawer.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvD,OAAO,EAAc,YAAY,EAAe,MAAM,oBAAoB,CAAC;AAG3E,OAAO,EAAE,KAAK,SAAS,EAAoB,MAAM,wBAAwB,CAAC;AAC1E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAG7D,YAAY,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AAEpE,wFAAwF;AACxF,MAAM,MAAM,gBAAgB,GAAG;IAC7B,IAAI,EAAE,OAAO,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACtC,qFAAqF;IACrF,oBAAoB,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IAC/C,6FAA6F;IAC7F,KAAK,EAA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2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { Button } from "./button.js";
|
|
4
|
-
import {
|
|
4
|
+
import { Form } from "./form.js";
|
|
5
|
+
import { SheetClose, SheetFooter } from "./sheet.js";
|
|
5
6
|
import { WaitingLine } from "./waiting-line.js";
|
|
7
|
+
import { FormDrawerFrame } from "../internal/form-drawer-frame.js";
|
|
6
8
|
import { FormSubmitButton } from "../internal/form-submit.js";
|
|
7
|
-
import { guardUnsaved } from "../internal/unsaved-guard.js";
|
|
8
9
|
import { cn } from "../lib/utils.js";
|
|
9
10
|
/**
|
|
10
11
|
* The right-side sheet for a catalogue or a setup in steps, at one width.
|
|
@@ -17,8 +18,7 @@ import { cn } from "../lib/utils.js";
|
|
|
17
18
|
* @access "Trap focus inside the sheet while it’s open and return focus to the trigger row on close so keyboard users keep their place in the list." (https://vercel.com/geist/sheet) "Provide a visible close button labeled `Close` (or an icon button with `aria-label="Close"`) since clicking outside doesn’t dismiss." (https://vercel.com/geist/sheet) "Announce the sheet with `aria-labelledby` pointing at the title; pair it with `aria-describedby` only when the body is short and load-bearing." (https://vercel.com/geist/sheet) Ours: a modal dialog named by its title; focus returns to the opener on close, or to `finalFocus` when the opener is gone. The step is read before the title.
|
|
18
19
|
*/
|
|
19
20
|
export function FormDrawer(props) {
|
|
20
|
-
|
|
21
|
-
return (_jsx(Sheet, { modal: true, open: open, onOpenChange: guardUnsaved(onOpenChange, unsaved), onOpenChangeComplete: onOpenChangeComplete, children: _jsxs(SheetContent, { closeLabel: closeLabel, finalFocus: finalFocus, initialFocus: initialFocus, side: "right", children: [_jsxs(SheetHeader, { className: "pr-12", children: [props.job === "steps" ? (_jsx("p", { className: "font-label-mono text-label-mono text-muted-foreground", "data-slot": "form-drawer-progress", children: props.progress })) : null, _jsx(SheetTitle, { className: "break-words", children: title }), description ? _jsx(SheetDescription, { children: description }) : null] }), children] }) }));
|
|
21
|
+
return _jsx(FormDrawerFrame, { ...props });
|
|
22
22
|
}
|
|
23
23
|
/** The part of the drawer that scrolls between its title and its footer. */
|
|
24
24
|
export function FormDrawerBody({ className, ...props }) {
|
|
@@ -35,5 +35,5 @@ export function FormDrawerFooter({ cancel, children }) {
|
|
|
35
35
|
*/
|
|
36
36
|
export function FormDrawerForm({ cancelLabel, submit, notice, children, ...form }) {
|
|
37
37
|
const pending = submit.pending === true;
|
|
38
|
-
return (_jsxs(
|
|
38
|
+
return (_jsxs(Form, { "aria-busy": pending || undefined, className: "flex min-h-0 flex-1 flex-col", "data-slot": "form-drawer-form", ...form, children: [_jsx(FormDrawerBody, { children: children }), notice ? (_jsx("div", { className: "px-nadicode-lg pt-nadicode-md", "data-slot": "form-drawer-notice", children: notice })) : null, _jsxs(FormDrawerFooter, { cancel: { label: cancelLabel, disabled: pending }, children: [_jsx(FormSubmitButton, { submit: submit }), _jsx(WaitingLine, { className: "absolute inset-x-0 top-0", decorative: true, waiting: pending })] })] }));
|
|
39
39
|
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { ComponentProps, ReactElement } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* A form that never puts its fields in the address.
|
|
4
|
+
*
|
|
5
|
+
* @family Inputs
|
|
6
|
+
* @when Ours: every form in a product. A form submitted by `onSubmit`, by a URL `action` or by a
|
|
7
|
+
* server action is a `Form`, so the browser's own submit before hydration posts its fields.
|
|
8
|
+
* @instead Ours: a save with a footer is `FormDialogForm`, `FormDrawerForm`, `RowEditForm` or a
|
|
9
|
+
* `SettingsSection`, each of which renders a `Form`. A search or a filter that belongs in the
|
|
10
|
+
* address is a link or a router push, never a form that submits by GET.
|
|
11
|
+
* @behaviour Ours: a native `form` with every prop it is given, except `method`, which it sets
|
|
12
|
+
* itself: `post`, or none when `action` is a function, since React submits a function action
|
|
13
|
+
* itself and refuses a `method` beside it. Until React attaches `onSubmit`, a press of the
|
|
14
|
+
* submit button posts the form to its `action` or to the page; without `post` the browser would
|
|
15
|
+
* write every named field, a password included, into the URL.
|
|
16
|
+
* @words Ours: the form has no words of its own; its fields and its submit button carry them.
|
|
17
|
+
* @access Ours: a native `form`. The caller names it with `aria-labelledby` when it is a landmark,
|
|
18
|
+
* and the submit button is a real `type="submit"` button.
|
|
19
|
+
*/
|
|
20
|
+
export declare function Form({ action, ...props }: Omit<ComponentProps<"form">, "method">): import("react").JSX.Element;
|
|
21
|
+
/**
|
|
22
|
+
* The submit button of the form whose `id` is `form`, for a command that sits
|
|
23
|
+
* outside that form, such as a `NoticeBanner` action: the command draws it.
|
|
24
|
+
*/
|
|
25
|
+
export declare function submitsForm(form: string): ReactElement;
|
|
26
|
+
//# sourceMappingURL=form.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form.d.ts","sourceRoot":"","sources":["../../src/components/form.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,OAAO,CAAC;AAE1D;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAAC,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,+BAIhF;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,YAAY,CAEtD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
/**
|
|
3
|
+
* A form that never puts its fields in the address.
|
|
4
|
+
*
|
|
5
|
+
* @family Inputs
|
|
6
|
+
* @when Ours: every form in a product. A form submitted by `onSubmit`, by a URL `action` or by a
|
|
7
|
+
* server action is a `Form`, so the browser's own submit before hydration posts its fields.
|
|
8
|
+
* @instead Ours: a save with a footer is `FormDialogForm`, `FormDrawerForm`, `RowEditForm` or a
|
|
9
|
+
* `SettingsSection`, each of which renders a `Form`. A search or a filter that belongs in the
|
|
10
|
+
* address is a link or a router push, never a form that submits by GET.
|
|
11
|
+
* @behaviour Ours: a native `form` with every prop it is given, except `method`, which it sets
|
|
12
|
+
* itself: `post`, or none when `action` is a function, since React submits a function action
|
|
13
|
+
* itself and refuses a `method` beside it. Until React attaches `onSubmit`, a press of the
|
|
14
|
+
* submit button posts the form to its `action` or to the page; without `post` the browser would
|
|
15
|
+
* write every named field, a password included, into the URL.
|
|
16
|
+
* @words Ours: the form has no words of its own; its fields and its submit button carry them.
|
|
17
|
+
* @access Ours: a native `form`. The caller names it with `aria-labelledby` when it is a landmark,
|
|
18
|
+
* and the submit button is a real `type="submit"` button.
|
|
19
|
+
*/
|
|
20
|
+
export function Form({ action, ...props }) {
|
|
21
|
+
return (_jsx("form", { ...props, action: action, method: typeof action === "function" ? undefined : "post" }));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The submit button of the form whose `id` is `form`, for a command that sits
|
|
25
|
+
* outside that form, such as a `NoticeBanner` action: the command draws it.
|
|
26
|
+
*/
|
|
27
|
+
export function submitsForm(form) {
|
|
28
|
+
return _jsx("button", { form: form, type: "submit" });
|
|
29
|
+
}
|
package/dist/components/gauge.js
CHANGED
|
@@ -9,9 +9,9 @@ const GAUGE_BOX_CLASS = {
|
|
|
9
9
|
lg: "size-32",
|
|
10
10
|
};
|
|
11
11
|
const GAUGE_VALUE_CLASS = {
|
|
12
|
-
sm: "text-[11px]
|
|
12
|
+
sm: "text-[11px]/5 font-medium",
|
|
13
13
|
md: "nc-type-label-lg font-medium",
|
|
14
|
-
lg: "text-[32px]
|
|
14
|
+
lg: "text-[32px]/5 font-semibold",
|
|
15
15
|
};
|
|
16
16
|
const GAUGE_ARC_CLASS = {
|
|
17
17
|
default: "stroke-primary",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"calendar-heatmap.d.ts","sourceRoot":"","sources":["../../../src/components/heatmap/calendar-heatmap.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,GAAG,IAAI,OAAO,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AAC;AAEF,eAAO,MAAM,qBAAqB,GAAI,uDAKnC,0BAA0B,gCA+C5B,CAAC"}
|
|
@@ -9,7 +9,7 @@ import { getYear } from "date-fns/getYear";
|
|
|
9
9
|
import { nextDay } from "date-fns/nextDay";
|
|
10
10
|
import { parseISO } from "date-fns/parseISO";
|
|
11
11
|
import { subWeeks } from "date-fns/subWeeks";
|
|
12
|
-
import { createContext, Fragment, use, useMemo } from "react";
|
|
12
|
+
import { createContext, Fragment, use, useMemo, useState } from "react";
|
|
13
13
|
import { cn } from "../../lib/utils.js";
|
|
14
14
|
// Non-normalized: 1 empty + (levels-1) colored steps. Normalized: levels colored steps, no empty.
|
|
15
15
|
const colorStepCount = (levels, isNormalized) => Math.max(1, isNormalized ? levels : levels - 1);
|
|
@@ -131,14 +131,14 @@ const groupByYearAndMonth = (activities, weekStart = 0, hasEmptyColumn = false)
|
|
|
131
131
|
const yearOffset = Math.floor((currentMonth + monthOffset) / 12);
|
|
132
132
|
const year = currentYear + yearOffset;
|
|
133
133
|
const key = `${year}-${String(monthIndex).padStart(2, "0")}`;
|
|
134
|
-
const monthActivities = activitiesByYearMonth.get(key)
|
|
134
|
+
const monthActivities = activitiesByYearMonth.get(key) ?? [];
|
|
135
135
|
const firstActivity = monthActivities[0];
|
|
136
136
|
if (firstActivity) {
|
|
137
137
|
hasData = true;
|
|
138
138
|
const firstDate = parseISO(firstActivity.date);
|
|
139
139
|
const firstCalendarDate = getDay(firstDate) === weekStart ? firstDate : subWeeks(nextDay(firstDate, weekStart), 1);
|
|
140
140
|
const paddedActivities = [
|
|
141
|
-
...
|
|
141
|
+
...Array.from({ length: differenceInCalendarDays(firstDate, firstCalendarDate) }, () => undefined),
|
|
142
142
|
...monthActivities,
|
|
143
143
|
];
|
|
144
144
|
const numberOfWeeks = Math.ceil(paddedActivities.length / 7);
|
|
@@ -178,7 +178,7 @@ const groupContinuous = (activities, weekStart = 0, singleRow = false) => {
|
|
|
178
178
|
const firstCalendarDate = getDay(firstDate) === weekStart ? firstDate : subWeeks(nextDay(firstDate, weekStart), 1);
|
|
179
179
|
const leadingPad = differenceInCalendarDays(firstDate, firstCalendarDate);
|
|
180
180
|
const padded = [
|
|
181
|
-
...
|
|
181
|
+
...Array.from({ length: leadingPad }, () => undefined),
|
|
182
182
|
...normalizedActivities,
|
|
183
183
|
];
|
|
184
184
|
const numberOfWeeks = Math.ceil(padded.length / 7);
|
|
@@ -313,10 +313,9 @@ export const CalendarHeatmap = ({ data, weekStart = 0, continuousMonths = true,
|
|
|
313
313
|
}), [locale, labelsProp]);
|
|
314
314
|
const labelHeight = fontSize + LABEL_MARGIN;
|
|
315
315
|
const firstDatum = data[0];
|
|
316
|
-
const
|
|
317
|
-
const
|
|
318
|
-
|
|
319
|
-
: dataWithLevels.reduce((sum, activity) => sum + (activity.value ?? 0), 0);
|
|
316
|
+
const [thisYear] = useState(() => new Date().getFullYear());
|
|
317
|
+
const year = firstDatum ? getYear(parseISO(firstDatum.date)) : thisYear;
|
|
318
|
+
const totalCount = totalCountProp ?? dataWithLevels.reduce((sum, activity) => sum + (activity.value ?? 0), 0);
|
|
320
319
|
const blockWidth = blockSize * blockAspectRatio;
|
|
321
320
|
const width = weeks.length * (blockWidth + blockMargin) - blockMargin;
|
|
322
321
|
const height = labelHeight + (blockSize + blockMargin) * 7 - blockMargin;
|
|
@@ -368,7 +367,9 @@ export const CalendarHeatmap = ({ data, weekStart = 0, continuousMonths = true,
|
|
|
368
367
|
colors,
|
|
369
368
|
]);
|
|
370
369
|
if (data.length === 0) {
|
|
371
|
-
|
|
370
|
+
if (!emptyState)
|
|
371
|
+
return null;
|
|
372
|
+
return emptyState;
|
|
372
373
|
}
|
|
373
374
|
return (_jsx(CalendarHeatmapContext, { value: contextValue, children: _jsx("div", { "data-slot": "calendar-heatmap", className: cn("flex w-max max-w-full flex-col gap-2 p-4", className), style: { fontSize, ...style }, ...props, children: children }) }));
|
|
374
375
|
};
|
|
@@ -376,9 +377,7 @@ export const CalendarHeatmapBlock = ({ ref, activity, dayIndex, weekIndex, highl
|
|
|
376
377
|
const { blockSize, blockWidth, blockMargin, blockRadius, labelHeight, labels, levels, isNormalized, colors, } = useCalendarHeatmap();
|
|
377
378
|
const level = Math.max(0, Math.min(colorStepCount(levels, isNormalized), activity.level));
|
|
378
379
|
const cellLabel = labels.cellLabel ?? "{{date}}: {{value}} contributions";
|
|
379
|
-
const ariaLabel =
|
|
380
|
-
// oxlint-disable-next-line anti-slop/no-runtime-typeof -- cellLabel is our own string | (activity => string) union, told apart only by typeof.
|
|
381
|
-
typeof cellLabel === "function"
|
|
380
|
+
const ariaLabel = typeof cellLabel === "function"
|
|
382
381
|
? cellLabel(activity)
|
|
383
382
|
: cellLabel
|
|
384
383
|
.replace("{{date}}", activity.date)
|
|
@@ -429,7 +428,10 @@ export const CalendarHeatmapBody = ({ hideMonthLabels = false, hideWeekdayLabels
|
|
|
429
428
|
const totalWidth = weekdayLabelWidth + maxWidth + strokePadding * 2;
|
|
430
429
|
return (_jsx("div", { "data-slot": "calendar-heatmap-body", className: cn("flex max-w-full flex-col gap-6 overflow-x-auto overflow-y-hidden py-4", className), ...props, children: rowData.map(({ yearRow, height, monthLabels, yearTotalCount }) => (_jsxs("div", { children: [!hideYearLabels && (_jsx("div", { className: cn("mb-2 text-muted-foreground", yearClassName), children: yearRow.year })), _jsx("svg", { role: "img", "aria-label": (labels.heatmapLabel ?? "Contribution heatmap for {{year}}").replace("{{year}}", String(yearRow.year)), className: "block overflow-visible rounded-sm focus-visible:nc-focus-outline focus-visible:outline-ring", height: height + strokePadding * 2, viewBox: `0 0 ${totalWidth} ${height + strokePadding * 2}`, width: totalWidth, children: _jsxs("g", { transform: `translate(0, ${strokePadding})`, children: [!hideMonthLabels && (_jsx("g", { className: cn("fill-current font-mono", labelClassName), children: monthLabels.map(({ label, weekIndex }) => (_jsx("text", { dominantBaseline: "hanging", x: weekdayLabelWidth + strokePadding + (blockWidth + blockMargin) * weekIndex, style: { fontSize: `${fontSize * 0.75}px` }, children: label }, `${yearRow.year}-${weekIndex}`))) })), !hideWeekdayLabels && (_jsx("g", { className: cn("fill-current font-mono text-xs", labelClassName), children: labels.weekdays?.map((label, dayIndex) => {
|
|
431
430
|
const adjustedIndex = (dayIndex + weekStart) % 7;
|
|
432
|
-
const
|
|
431
|
+
const configuredLabel = labels.weekdays?.[adjustedIndex];
|
|
432
|
+
const adjustedLabel = configuredLabel === undefined || configuredLabel === ""
|
|
433
|
+
? label
|
|
434
|
+
: configuredLabel;
|
|
433
435
|
return (_jsx("text", { x: 0, y: labelHeight + (blockSize + blockMargin) * dayIndex + blockSize / 2, dominantBaseline: "middle", textAnchor: "start", style: { fontSize: `${fontSize * 0.75}px` }, children: adjustedLabel }, `weekday-${yearRow.year}-${label}`));
|
|
434
436
|
}) })), _jsx("g", { transform: `translate(${weekdayLabelWidth + strokePadding}, 0)`, children: yearRow.weeks.map((week, weekIndex) => week.map((activity, dayIndex) => {
|
|
435
437
|
if (!activity) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hive-scene.d.ts","sourceRoot":"","sources":["../../src/components/hive-scene.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAK/B;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,MAAM,MAAM,SAAS,GAAG;IAAE,CAAC,EAAE,MAAM,CAAC;IAAC,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC;AAEjD,6DAA6D;AAC7D,MAAM,MAAM,OAAO,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnF,mFAAmF;AACnF,MAAM,MAAM,QAAQ,GAAG;IACrB,OAAO,EAAE,SAAS,SAAS,EAAE,CAAC;IAC9B,SAAS,EAAE,SAAS,SAAS,EAAE,CAAC;CACjC,CAAC;AAEF,MAAM,M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DAA2D;AAC3D,iBAAS,SAAS,CAAC,EAAE,QAAQ,EAAE,EAAE,EAAE,EAAE;IAAE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,EAAE,CAAC,EAAE,MAAM,CAAA;CAAE,qBAM9E;AAED,iEAAiE;AACjE,iBAAS,QAAQ,CAAC,EAChB,QAAQ,EACR,EAAE,EACF,IAAa,GACd,EAAE;IACD,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;CACzB,qBAMA;AAED,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,CAAC"}
|
|
@@ -183,7 +183,9 @@ function HiveScene({ mode, column = "default", logo, picture, work, chrome, labe
|
|
|
183
183
|
// The words' box, kept as state so the scene places the orbs again when it appears.
|
|
184
184
|
const [wordsColumn, setWordsColumn] = React.useState(null);
|
|
185
185
|
const workRef = React.useRef(work);
|
|
186
|
-
|
|
186
|
+
React.useLayoutEffect(() => {
|
|
187
|
+
workRef.current = work;
|
|
188
|
+
});
|
|
187
189
|
const still = mode === "still";
|
|
188
190
|
React.useEffect(() => {
|
|
189
191
|
if (still)
|
|
@@ -42,7 +42,7 @@ import type { PresentContent } from "../internal/present-content.js";
|
|
|
42
42
|
* Ours: the trigger is a real element (a `time` with its `datetime` for a moment), so the facts
|
|
43
43
|
* never depend on hover. Keyboard opening is tested, not assumed.
|
|
44
44
|
*/
|
|
45
|
-
declare function HoverCard({ ...props }: PreviewCardPrimitive.Root.Props): import("react").JSX.Element;
|
|
45
|
+
declare function HoverCard({ ...props }: Omit<PreviewCardPrimitive.Root.Props, "defaultOpen">): import("react").JSX.Element;
|
|
46
46
|
declare function HoverCardTrigger({ delay, ...props }: PreviewCardPrimitive.Trigger.Props): import("react").JSX.Element;
|
|
47
47
|
declare function HoverCardContent({ className, side, sideOffset, align, alignOffset, children, ...props }: PreviewCardPrimitive.Popup.Props & Pick<PreviewCardPrimitive.Positioner.Props, "align" | "alignOffset" | "side" | "sideOffset"> & {
|
|
48
48
|
/** The facts of the card; a card without any does not compile. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover-card.d.ts","sourceRoot":"","sources":["../../src/components/hover-card.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGlF,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAMjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,iBAAS,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,oBAAoB,CAAC,IAAI,CAAC,KAAK,+
|
|
1
|
+
{"version":3,"file":"hover-card.d.ts","sourceRoot":"","sources":["../../src/components/hover-card.tsx"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,IAAI,oBAAoB,EAAE,MAAM,6BAA6B,CAAC;AAGlF,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,qBAAqB,CAAC;AAEvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,4BAA4B,CAAC;AAMjE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwCG;AACH,iBAAS,SAAS,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,IAAI,CAAC,oBAAoB,CAAC,IAAI,CAAC,KAAK,EAAE,aAAa,CAAC,+BAEpF;AAED,iBAAS,gBAAgB,CAAC,EACxB,KAAwB,EACxB,GAAG,KAAK,EACT,EAAE,oBAAoB,CAAC,OAAO,CAAC,KAAK,+BAEpC;AAED,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,IAAY,EACZ,UAAe,EACf,KAAgB,EAChB,WAAe,EACf,QAAQ,EACR,GAAG,KAAK,EACT,E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,6 +62,6 @@ function HoverCardContent({ className, side = "top", sideOffset = 14, align = "c
|
|
|
62
62
|
* it, two to four facts and at most one link.
|
|
63
63
|
*/
|
|
64
64
|
function HoverCardSummary({ name, detail, facts, missingLabel, action, className, ...props }) {
|
|
65
|
-
return (_jsxs("div", { "data-slot": "hover-card-summary", className: cn("grid gap-3", className), ...props, children: [_jsxs("div", { className: "grid gap-0.5", children: [_jsx("p", { className: "text-heading-compact", children: name }), _jsx("p", { className: "text-body-sm text-muted-foreground", children: detail })] }), _jsx("dl", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-body-sm", children: facts.map((fact) => (_jsxs(Fragment, { children: [_jsx("dt", { className: "text-muted-foreground", children: fact.label }), _jsx("dd", { className: "min-w-0 break-
|
|
65
|
+
return (_jsxs("div", { "data-slot": "hover-card-summary", className: cn("grid gap-3", className), ...props, children: [_jsxs("div", { className: "grid gap-0.5", children: [_jsx("p", { className: "text-heading-compact", children: name }), _jsx("p", { className: "text-body-sm text-muted-foreground", children: detail })] }), _jsx("dl", { className: "grid grid-cols-[auto_1fr] gap-x-4 gap-y-1 text-body-sm", children: facts.map((fact) => (_jsxs(Fragment, { children: [_jsx("dt", { className: "text-muted-foreground", children: fact.label }), _jsx("dd", { className: "min-w-0 wrap-break-word", children: _jsx(TableValue, { missingLabel: missingLabel, value: fact.value }) })] }, fact.label))) }), action ? (_jsx(ButtonLink, { href: action.href, render: action.render, size: "sm", variant: "outline", className: "justify-self-start", children: action.label })) : null] }));
|
|
66
66
|
}
|
|
67
67
|
export { HoverCard, HoverCardTrigger, HoverCardContent, HoverCardSummary };
|
|
@@ -6,13 +6,13 @@ import { InputBox, type FieldSize } from "../internal/input-box.js";
|
|
|
6
6
|
* One input box with something fixed inside it: a mark, a prefix, a button.
|
|
7
7
|
*
|
|
8
8
|
* @family Inputs
|
|
9
|
-
* @when
|
|
10
|
-
*
|
|
11
|
-
*
|
|
9
|
+
* @when Inside `@nadicodeai/ui` only, which does not export it: the box of `Input`, `ClearableInput`,
|
|
10
|
+
* `Combobox`, `Command` and `Textarea`'s `action`, and a single-line value with a button inside the
|
|
11
|
+
* box, such as a server-given value (a project ID) shown read-only in mono beside its copy button.
|
|
12
12
|
* @instead A prefix or suffix of text or an icon (*https://*, *.com*), in a cell or plain, is the
|
|
13
13
|
* `prefix`, `suffix` and `look` props of `Input`. A value that clears itself is `ClearableInput`; a
|
|
14
14
|
* collection's search is `CollectionSearch`, never a hand-built group. Many known values to filter
|
|
15
|
-
* is `Combobox`.
|
|
15
|
+
* is `Combobox`. A textarea with a control in its corner is `Textarea`'s `action`.
|
|
16
16
|
* @behaviour The group draws the edge and the focus halo for the input inside it, so the ring
|
|
17
17
|
* wraps the addons too, and takes the sizes of `Input`: the input follows the group's. An addon is
|
|
18
18
|
* a `segment` (a filled cell with a divider, the look of `Input`'s prefix and suffix) or `plain`
|
|
@@ -54,6 +54,5 @@ declare function InputGroupButton({ className, type, variant, size, ...props }:
|
|
|
54
54
|
declare function InputGroupText({ className, ...props }: React.ComponentProps<"span">): React.JSX.Element;
|
|
55
55
|
declare function InputGroupControl({ className, ...props }: Omit<React.ComponentProps<typeof InputBox>, "size">): React.JSX.Element;
|
|
56
56
|
declare function InputGroupInput(props: React.ComponentProps<typeof InputGroupControl> & AccessibleName): React.JSX.Element;
|
|
57
|
-
|
|
58
|
-
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InputGroupControl, InputGroupInput, InputGroupTextarea, };
|
|
57
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InputGroupControl, InputGroupInput, };
|
|
59
58
|
//# sourceMappingURL=input-group.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-group.d.ts","sourceRoot":"","sources":["../../src/components/input-group.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,OAA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,QAAQ,CAAC,GAAG,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,CAAC,CAAC;AAE1F,iBAAS,gBAAgB,CAAC,EACxB,SAAS,EACT,IAAe,EACf,OAAiB,EACjB,IAAW,EACX,GAAG,KAAK,EACT,EAAE,qBAAqB,qBAUvB;AAED,iBAAS,cAAc,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,qBAU5E;AAED,iBAAS,iBAAiB,CAAC,EACzB,SAAS,EACT,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,EAAE,MAAM,CAAC,qBAarD;AAED,iBAAS,eAAe,CAAC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,iBAAiB,CAAC,GAAG,cAAc,qBAE9F;AAED,OAAO,EACL,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,eAAe,GAChB,CAAC"}
|
|
@@ -4,7 +4,6 @@ import * as React from "react";
|
|
|
4
4
|
import { cva } from "class-variance-authority";
|
|
5
5
|
import { cn } from "../lib/utils.js";
|
|
6
6
|
import { Button } from "./button.js";
|
|
7
|
-
import { Textarea } from "./textarea.js";
|
|
8
7
|
import { fieldGroupStates, fieldRing, InputBox } from "../internal/input-box.js";
|
|
9
8
|
const InputGroupSizeContext = React.createContext("default");
|
|
10
9
|
const inputGroupVariants = cva([
|
|
@@ -30,13 +29,13 @@ const inputGroupVariants = cva([
|
|
|
30
29
|
* One input box with something fixed inside it: a mark, a prefix, a button.
|
|
31
30
|
*
|
|
32
31
|
* @family Inputs
|
|
33
|
-
* @when
|
|
34
|
-
*
|
|
35
|
-
*
|
|
32
|
+
* @when Inside `@nadicodeai/ui` only, which does not export it: the box of `Input`, `ClearableInput`,
|
|
33
|
+
* `Combobox`, `Command` and `Textarea`'s `action`, and a single-line value with a button inside the
|
|
34
|
+
* box, such as a server-given value (a project ID) shown read-only in mono beside its copy button.
|
|
36
35
|
* @instead A prefix or suffix of text or an icon (*https://*, *.com*), in a cell or plain, is the
|
|
37
36
|
* `prefix`, `suffix` and `look` props of `Input`. A value that clears itself is `ClearableInput`; a
|
|
38
37
|
* collection's search is `CollectionSearch`, never a hand-built group. Many known values to filter
|
|
39
|
-
* is `Combobox`.
|
|
38
|
+
* is `Combobox`. A textarea with a control in its corner is `Textarea`'s `action`.
|
|
40
39
|
* @behaviour The group draws the edge and the focus halo for the input inside it, so the ring
|
|
41
40
|
* wraps the addons too, and takes the sizes of `Input`: the input follows the group's. An addon is
|
|
42
41
|
* a `segment` (a filled cell with a divider, the look of `Input`'s prefix and suffix) or `plain`
|
|
@@ -84,8 +83,9 @@ const inputGroupAddonVariants = cva("flex cursor-text items-center justify-cente
|
|
|
84
83
|
});
|
|
85
84
|
function InputGroupAddon({ className, align = "inline-start", look = "plain", ...props }) {
|
|
86
85
|
return (_jsx("div", { role: "group", "data-slot": "input-group-addon", "data-align": align, "data-look": look, className: cn(inputGroupAddonVariants({ align, look }), className), onClick: (e) => {
|
|
87
|
-
//
|
|
88
|
-
|
|
86
|
+
// The addon's own window's Element, so the check holds in whichever document it renders.
|
|
87
|
+
const view = e.currentTarget.ownerDocument.defaultView;
|
|
88
|
+
if (view && e.target instanceof view.Element && e.target.closest("button")) {
|
|
89
89
|
return;
|
|
90
90
|
}
|
|
91
91
|
e.currentTarget.parentElement?.querySelector("input")?.focus();
|
|
@@ -116,7 +116,4 @@ function InputGroupControl({ className, ...props }) {
|
|
|
116
116
|
function InputGroupInput(props) {
|
|
117
117
|
return _jsx(InputGroupControl, { ...props });
|
|
118
118
|
}
|
|
119
|
-
|
|
120
|
-
return (_jsx(Textarea, { "data-slot": "input-group-control", className: cn("flex-1 resize-none rounded-none bg-transparent shadow-none focus-visible:outline-none disabled:bg-transparent aria-invalid:outline-none", className), ...props }));
|
|
121
|
-
}
|
|
122
|
-
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InputGroupControl, InputGroupInput, InputGroupTextarea, };
|
|
119
|
+
export { InputGroup, InputGroupAddon, InputGroupButton, InputGroupText, InputGroupControl, InputGroupInput, };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"input-otp.d.ts","sourceRoot":"","sources":["../../src/components/input-otp.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAmB,MAAM,WAAW,CAAC;AAKtD;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,kBAAkB,EAClB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,GAAG;IACzC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,
|
|
1
|
+
{"version":3,"file":"input-otp.d.ts","sourceRoot":"","sources":["../../src/components/input-otp.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAmB,MAAM,WAAW,CAAC;AAKtD;;;;;;;;;;;;;;;;GAgBG;AACH,iBAAS,QAAQ,CAAC,EAChB,SAAS,EACT,kBAAkB,EAClB,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,OAAO,QAAQ,CAAC,GAAG;IACzC,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B,qBAiBA;AAED,iBAAS,aAAa,CAAC,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAW1E;AAED,iBAAS,YAAY,CAAC,EACpB,KAAK,EACL,SAAS,EACT,GAAG,KAAK,EACT,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,GAAG;IAC/B,KAAK,EAAE,MAAM,CAAC;CACf,qBAsBA;AAED,iBAAS,iBAAiB,CAAC,EAAE,GAAG,KAAK,EAAE,EAAE,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,qBAWnE;AAED,OAAO,EAAE,QAAQ,EAAE,aAAa,EAAE,YAAY,EAAE,iBAAiB,EAAE,CAAC"}
|
|
@@ -22,7 +22,7 @@ import { MinusIcon } from "lucide-react";
|
|
|
22
22
|
* separator has `role="separator"`.
|
|
23
23
|
*/
|
|
24
24
|
function InputOTP({ className, containerClassName, ...props }) {
|
|
25
|
-
return (_jsx(OTPInput, { "data-slot": "input-otp", containerClassName: cn("
|
|
25
|
+
return (_jsx(OTPInput, { "data-slot": "input-otp", containerClassName: cn("flex items-center has-disabled:opacity-50", containerClassName), spellCheck: false,
|
|
26
26
|
// The hidden native input spans the whole container; the active slot is
|
|
27
27
|
// the visible focus indicator, so the base-layer outline is suppressed.
|
|
28
28
|
className: cn("focus-visible:outline-none disabled:cursor-not-allowed", className), ...props,
|
|
@@ -38,7 +38,7 @@ function InputOTPGroup({ className, ...props }) {
|
|
|
38
38
|
function InputOTPSlot({ index, className, ...props }) {
|
|
39
39
|
const inputOTPContext = React.useContext(OTPInputContext);
|
|
40
40
|
const { char, hasFakeCaret, isActive } = inputOTPContext?.slots[index] ?? {};
|
|
41
|
-
return (_jsxs("div", { "data-slot": "input-otp-slot", "data-active": isActive, className: cn("relative flex size-control-height min-h-touch-target min-w-touch-target items-center justify-center border-y border-r border-input bg-background text-sm transition-[border-color,color,opacity] duration-
|
|
41
|
+
return (_jsxs("div", { "data-slot": "input-otp-slot", "data-active": isActive, className: cn("relative flex size-control-height min-h-touch-target min-w-touch-target items-center justify-center border-y border-r border-input bg-background text-sm transition-[border-color,color,opacity] duration-(--nc-duration-confirm) ease-(--nc-ease-out-strong) outline-none first:rounded-l-sm first:border-l last:rounded-r-sm aria-invalid:border-destructive data-[active=true]:z-10 data-[active=true]:nc-focus-outline data-[active=true]:outline-ring data-[active=true]:aria-invalid:border-destructive data-[active=true]:aria-invalid:outline-destructive [@media(hover:hover)_and_(pointer:fine)]:min-h-0 [@media(hover:hover)_and_(pointer:fine)]:min-w-0", className), ...props, children: [char, hasFakeCaret && (_jsx("div", { className: "pointer-events-none absolute inset-0 flex items-center justify-center", children: _jsx("div", { className: "h-4 w-px bg-foreground" }) }))] }));
|
|
42
42
|
}
|
|
43
43
|
function InputOTPSeparator({ ...props }) {
|
|
44
44
|
return (_jsx("div", { "data-slot": "input-otp-separator", className: "flex items-center [&_svg:not([class*='size-'])]:size-4", role: "separator", ...props, children: _jsx(MinusIcon, {}) }));
|
|
@@ -27,7 +27,7 @@ declare const itemVariants: (props?: ({
|
|
|
27
27
|
* @instead “For tabular data with sortable columns and shared row shape, use `Table` instead.” (https://vercel.com/geist/entity)
|
|
28
28
|
* “For a static key/value metadata block on a detail page, use `Description`.” (https://vercel.com/geist/entity)
|
|
29
29
|
* Ours: Geist's `Table` is a `DataTable` and its `Description` is `ObjectFacts`. An object a person opens, with a mark, facts and a status, is a `RecordList` row; the same row edited in place is a `RecordList` with an `editor`. A page whose job is one collection is `CollectionPage`. Agents in a gallery are `AgentListRow`; Library entries `CatalogEntry`.
|
|
30
|
-
* @behaviour A list of descriptive rows is an `ItemGroup` of `Item`s, never table semantics. Every row has a title over its one muted description line; only a message row read whole, or a second content beside the first, may be description only. Media, content and actions stand 16 px apart, centred on one another, in a 72 px row of 16 px padding; a 600 title stands over one 20 px description with no gap, and each holds one line and ends in an ellipsis (`whole` lets a message wrap). Inside a card the group is `divided`: no gaps, one hairline between items. An item that is an `a`, a `button` or a `label` takes the `accent` hover and is one hit target; a plain item never reacts to hover; nested controls stay independent. A button in the row is `size="sm"` (32 px). A row a person picks starts with `ItemSelect` and is drawn `render={<label />}`, so the whole row ticks its box and has no other control. A second content beside the first takes only the room its words need. Colour is neutral: the title in ink, the description and any trailing words muted, no hue.
|
|
30
|
+
* @behaviour A list of descriptive rows is an `ItemGroup` of `Item`s, never table semantics. Every row has a title over its one muted description line; only a message row read whole, or a second content beside the first, may be description only. Media, content and actions stand 16 px apart, centred on one another, in a 72 px row of 16 px padding; a 600 title stands over one 20 px description with no gap, and each holds one line and ends in an ellipsis (`whole` lets a message wrap). Inside a card the group is `divided`: no gaps, one hairline between items. An item that is an `a`, a `button` or a `label` takes the `accent` hover and is one hit target; a plain item never reacts to hover; nested controls stay independent. An `xs` item inside a menu or a combobox option takes the option's padding and adds none. A button in the row is `size="sm"` (32 px). A row a person picks starts with `ItemSelect` and is drawn `render={<label />}`, so the whole row ticks its box and has no other control. A second content beside the first takes only the room its words need. Colour is neutral: the title in ink, the description and any trailing words muted, no hue.
|
|
31
31
|
* “The right column holds at most one or two controls. If the row needs more, move secondary actions into a `Dots Menu`.” (https://vercel.com/geist/entity)
|
|
32
32
|
* Ours: the third control goes in the row's three dots.
|
|
33
33
|
* “Render the Skeleton variant (`entity-with-skeleton`) during load instead of an empty row, and swap to real content once data resolves.” (https://vercel.com/geist/entity)
|
package/dist/components/item.js
CHANGED
|
@@ -31,7 +31,7 @@ const itemVariants = cva("nc-transition-paint group/item flex w-full flex-wrap i
|
|
|
31
31
|
},
|
|
32
32
|
size: {
|
|
33
33
|
default: "gap-4 p-4",
|
|
34
|
-
xs: "gap-2 px-2.5 py-2 in-data-[slot=dropdown-menu-content]:p-0",
|
|
34
|
+
xs: "gap-2 px-2.5 py-2 in-data-[slot=combobox-item]:p-0 in-data-[slot=dropdown-menu-content]:p-0",
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
37
|
defaultVariants: {
|
|
@@ -48,7 +48,7 @@ const itemVariants = cva("nc-transition-paint group/item flex w-full flex-wrap i
|
|
|
48
48
|
* @instead “For tabular data with sortable columns and shared row shape, use `Table` instead.” (https://vercel.com/geist/entity)
|
|
49
49
|
* “For a static key/value metadata block on a detail page, use `Description`.” (https://vercel.com/geist/entity)
|
|
50
50
|
* Ours: Geist's `Table` is a `DataTable` and its `Description` is `ObjectFacts`. An object a person opens, with a mark, facts and a status, is a `RecordList` row; the same row edited in place is a `RecordList` with an `editor`. A page whose job is one collection is `CollectionPage`. Agents in a gallery are `AgentListRow`; Library entries `CatalogEntry`.
|
|
51
|
-
* @behaviour A list of descriptive rows is an `ItemGroup` of `Item`s, never table semantics. Every row has a title over its one muted description line; only a message row read whole, or a second content beside the first, may be description only. Media, content and actions stand 16 px apart, centred on one another, in a 72 px row of 16 px padding; a 600 title stands over one 20 px description with no gap, and each holds one line and ends in an ellipsis (`whole` lets a message wrap). Inside a card the group is `divided`: no gaps, one hairline between items. An item that is an `a`, a `button` or a `label` takes the `accent` hover and is one hit target; a plain item never reacts to hover; nested controls stay independent. A button in the row is `size="sm"` (32 px). A row a person picks starts with `ItemSelect` and is drawn `render={<label />}`, so the whole row ticks its box and has no other control. A second content beside the first takes only the room its words need. Colour is neutral: the title in ink, the description and any trailing words muted, no hue.
|
|
51
|
+
* @behaviour A list of descriptive rows is an `ItemGroup` of `Item`s, never table semantics. Every row has a title over its one muted description line; only a message row read whole, or a second content beside the first, may be description only. Media, content and actions stand 16 px apart, centred on one another, in a 72 px row of 16 px padding; a 600 title stands over one 20 px description with no gap, and each holds one line and ends in an ellipsis (`whole` lets a message wrap). Inside a card the group is `divided`: no gaps, one hairline between items. An item that is an `a`, a `button` or a `label` takes the `accent` hover and is one hit target; a plain item never reacts to hover; nested controls stay independent. An `xs` item inside a menu or a combobox option takes the option's padding and adds none. A button in the row is `size="sm"` (32 px). A row a person picks starts with `ItemSelect` and is drawn `render={<label />}`, so the whole row ticks its box and has no other control. A second content beside the first takes only the room its words need. Colour is neutral: the title in ink, the description and any trailing words muted, no hue.
|
|
52
52
|
* “The right column holds at most one or two controls. If the row needs more, move secondary actions into a `Dots Menu`.” (https://vercel.com/geist/entity)
|
|
53
53
|
* Ours: the third control goes in the row's three dots.
|
|
54
54
|
* “Render the Skeleton variant (`entity-with-skeleton`) during load instead of an empty row, and swap to real content once data resolves.” (https://vercel.com/geist/entity)
|
package/dist/components/kbd.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export declare const KBD_KEYS: readonly ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "/", ",", ".", "?", "[", "]", "-", "=", "Enter", "Esc", "Tab", "Space", "Backspace", "Delete", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
1
|
+
export declare const KBD_KEYS: readonly ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z", "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "/", ",", ".", "?", "[", "]", "-", "=", "`", "\\", ";", "'", "Enter", "Esc", "Tab", "Space", "Backspace", "Delete", "ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
2
2
|
/** One key: a capital letter, a digit, a punctuation mark or a named key. */
|
|
3
3
|
export type KbdKey = (typeof KBD_KEYS)[number];
|
|
4
4
|
type Modifier = "meta" | "shift" | "alt" | "ctrl";
|
|
@@ -12,13 +12,10 @@ export type KbdProps = Omit<React.ComponentProps<"kbd">, "children"> & {
|
|
|
12
12
|
/** `sm` is for a menu row, a command item or a table cell. */
|
|
13
13
|
size?: "default" | "sm";
|
|
14
14
|
} & ((Modifiers & {
|
|
15
|
-
/**
|
|
16
|
-
|
|
17
|
-
* `kbd-children-no-modifier-text` holds it to `KBD_KEYS`.
|
|
18
|
-
*/
|
|
19
|
-
children: string;
|
|
15
|
+
/** The key, which a modifier flag may precede. */
|
|
16
|
+
keyName: KbdKey;
|
|
20
17
|
}) | (SomeModifier & {
|
|
21
|
-
|
|
18
|
+
keyName?: undefined;
|
|
22
19
|
}));
|
|
23
20
|
/**
|
|
24
21
|
* One key, or a modifier with its key, of a shortcut beside the command it triggers.
|
|
@@ -48,9 +45,9 @@ export type KbdProps = Omit<React.ComponentProps<"kbd">, "children"> & {
|
|
|
48
45
|
* lives outside the element: `Press <Kbd meta>K</Kbd> to open the command menu.`" "Period, comma,
|
|
49
46
|
* and `or` separators stay in surrounding prose so screen readers don’t announce them as keys."
|
|
50
47
|
* (https://vercel.com/geist/keyboard-input)
|
|
51
|
-
* Ours:
|
|
48
|
+
* Ours: `keyName` is a capital letter, a digit, a mark or a named key from `KBD_KEYS`.
|
|
52
49
|
* @access Ours: a `kbd` element, read in order; the command's own name carries the meaning.
|
|
53
50
|
*/
|
|
54
|
-
declare function Kbd({ className, size, meta, shift, alt, ctrl,
|
|
51
|
+
declare function Kbd({ className, size, meta, shift, alt, ctrl, keyName, ...props }: KbdProps): import("react").JSX.Element;
|
|
55
52
|
export { Kbd };
|
|
56
53
|
//# sourceMappingURL=kbd.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"kbd.d.ts","sourceRoot":"","sources":["../../src/components/kbd.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,
|
|
1
|
+
{"version":3,"file":"kbd.d.ts","sourceRoot":"","sources":["../../src/components/kbd.tsx"],"names":[],"mappings":"AAMA,eAAO,MAAM,QAAQ,sWA2DX,CAAC;AAEX,6EAA6E;AAC7E,MAAM,MAAM,MAAM,GAAG,CAAC,OAAO,QAAQ,CAAC,CAAC,MAAM,CAAC,CAAC;AAE/C,KAAK,QAAQ,GAAG,MAAM,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAClD,KAAK,SAAS,GAAG;KAAG,CAAC,IAAI,QAAQ,CAAC,CAAC,EAAE,OAAO;CAAE,CAAC;AAC/C,KAAK,YAAY,GAAG;KAAG,CAAC,IAAI,QAAQ,GAAG,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,GAAG,SAAS;CAAE,CAAC,QAAQ,CAAC,CAAC;AAE/E,MAAM,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,EAAE,UAAU,CAAC,GAAG;IACrE,8DAA8D;IAC9D,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,CAAC;CACzB,GAAG,CACE,CAAC,SAAS,GAAG;IACX,kDAAkD;IAClD,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC,GACF,CAAC,YAAY,GAAG;IAAE,OAAO,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC,CAC3C,CAAC;AA6BJ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,iBAAS,GAAG,CAAC,EAAE,SAAS,EAAE,IAAgB,EAAE,IAAI,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,OAAO,EAAE,GAAG,KAAK,EAAE,EAAE,QAAQ,+BA+BhG;AAED,OAAO,EAAE,GAAG,EAAE,CAAC"}
|
package/dist/components/kbd.js
CHANGED
|
@@ -47,6 +47,10 @@ export const KBD_KEYS = [
|
|
|
47
47
|
"]",
|
|
48
48
|
"-",
|
|
49
49
|
"=",
|
|
50
|
+
"`",
|
|
51
|
+
"\\",
|
|
52
|
+
";",
|
|
53
|
+
"'",
|
|
50
54
|
"Enter",
|
|
51
55
|
"Esc",
|
|
52
56
|
"Tab",
|
|
@@ -108,15 +112,15 @@ const beforeThePlatformIsKnown = () => true;
|
|
|
108
112
|
* lives outside the element: `Press <Kbd meta>K</Kbd> to open the command menu.`" "Period, comma,
|
|
109
113
|
* and `or` separators stay in surrounding prose so screen readers don’t announce them as keys."
|
|
110
114
|
* (https://vercel.com/geist/keyboard-input)
|
|
111
|
-
* Ours:
|
|
115
|
+
* Ours: `keyName` is a capital letter, a digit, a mark or a named key from `KBD_KEYS`.
|
|
112
116
|
* @access Ours: a `kbd` element, read in order; the command's own name carries the meaning.
|
|
113
117
|
*/
|
|
114
|
-
function Kbd({ className, size = "default", meta, shift, alt, ctrl,
|
|
118
|
+
function Kbd({ className, size = "default", meta, shift, alt, ctrl, keyName, ...props }) {
|
|
115
119
|
const onApple = useSyncExternalStore(subscribeToNothing, onAnApplePlatform, beforeThePlatformIsKnown);
|
|
116
120
|
const glyphs = onApple ? APPLE_GLYPHS : OTHER_GLYPHS;
|
|
117
121
|
const flags = { meta, shift, alt, ctrl };
|
|
118
122
|
const held = new Set(MODIFIERS.flatMap((modifier) => (flags[modifier] ? [glyphs[modifier]] : [])));
|
|
119
|
-
const parts =
|
|
123
|
+
const parts = keyName === undefined ? [...held] : [...held, KEY_GLYPHS.get(keyName) ?? keyName];
|
|
120
124
|
return (_jsx("kbd", { "data-slot": "kbd", "data-nc-ui": "", className: cn("pointer-events-none inline-flex w-fit items-center justify-center rounded-xs-plus bg-background font-sans font-normal text-foreground ring-1 ring-border select-none in-data-[slot=tooltip-content]:bg-background/20 in-data-[slot=tooltip-content]:text-background in-data-[slot=tooltip-content]:ring-0", onApple ? "gap-0" : "gap-1", size === "sm"
|
|
121
125
|
? "h-5 min-w-5 px-1 text-caption leading-5"
|
|
122
126
|
: "h-6 min-w-6 px-1.5 text-label leading-6", className), ...props, children: parts.map((part) => (_jsx("span", { children: part }, part))) }));
|
|
@@ -27,7 +27,7 @@ export function MessageNotice({ message, placement, tone = "destructive", classN
|
|
|
27
27
|
const body = bodyBeyondTitle(message);
|
|
28
28
|
const [action, secondAction] = message.actions;
|
|
29
29
|
const mark = _jsx(NoticeMark, { icon: tone === "destructive" ? OctagonAlert : undefined, tone: tone });
|
|
30
|
-
const sentence = (_jsxs("p", { className: "m-0 min-w-0 break-
|
|
30
|
+
const sentence = (_jsxs("p", { className: "m-0 min-w-0 wrap-break-word", children: [_jsx("span", { className: body ? LEAD[placement] : undefined, children: body ? closedSentence(message.title) : message.title }), body ? ` ${body}` : null, placement === "action"
|
|
31
31
|
? [action, secondAction].map((command) => command ? (_jsxs("span", { children: [" ", _jsx(NoticeLink, { command: command, place: "inline" })] }, command.label)) : null)
|
|
32
32
|
: null] }));
|
|
33
33
|
if (placement === "section") {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"middle-truncate.d.ts","sourceRoot":"","sources":["../../src/components/middle-truncate.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"middle-truncate.d.ts","sourceRoot":"","sources":["../../src/components/middle-truncate.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAoC/B;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,iBAAS,cAAc,CAAC,EACtB,SAAS,EACT,MAAM,EACN,KAAK,EACL,GAAG,KAAK,EACT,EAAE,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC,EAAE,UAAU,CAAC,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,qBA0BpE;AAED,OAAO,EAAE,cAAc,EAAE,CAAC"}
|