@lar-works/design-system 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -1
- package/dist/actions/Button.d.ts +39 -1
- package/dist/actions/Button.js +39 -9
- package/dist/actions/Button.js.map +1 -1
- package/dist/actions/ButtonLink.d.ts +5 -1
- package/dist/actions/ButtonLink.js +28 -2
- package/dist/actions/ButtonLink.js.map +1 -1
- package/dist/actions/ButtonRecipes.js +7 -0
- package/dist/actions/ButtonRecipes.js.map +1 -0
- package/dist/actions/IconButton.d.ts +2 -2
- package/dist/actions/IconButton.js +1 -1
- package/dist/actions/IconButton.js.map +1 -1
- package/dist/actions/ThemeSwitch.js +1 -1
- package/dist/board/ActivityLine.d.ts +36 -0
- package/dist/board/ActivityLine.js +144 -0
- package/dist/board/ActivityLine.js.map +1 -0
- package/dist/board/ActivityTrack.d.ts +11 -0
- package/dist/board/ActivityTrack.js +25 -0
- package/dist/board/ActivityTrack.js.map +1 -0
- package/dist/board/AddItem.d.ts +82 -0
- package/dist/board/AddItem.js +185 -0
- package/dist/board/AddItem.js.map +1 -0
- package/dist/board/Archive.d.ts +21 -0
- package/dist/board/Archive.js +63 -0
- package/dist/board/Archive.js.map +1 -0
- package/dist/board/Attention.d.ts +66 -0
- package/dist/board/Attention.js +122 -0
- package/dist/board/Attention.js.map +1 -0
- package/dist/board/BoardShell.d.ts +16 -0
- package/dist/board/BoardShell.js +35 -0
- package/dist/board/BoardShell.js.map +1 -0
- package/dist/board/BoardTitleBar.d.ts +50 -0
- package/dist/board/BoardTitleBar.js +125 -0
- package/dist/board/BoardTitleBar.js.map +1 -0
- package/dist/board/ButtonKinds.d.ts +24 -0
- package/dist/board/ButtonKinds.js +19 -0
- package/dist/board/ButtonKinds.js.map +1 -0
- package/dist/board/Cleanup.d.ts +8 -0
- package/dist/board/Cleanup.js +15 -0
- package/dist/board/Cleanup.js.map +1 -0
- package/dist/board/Counters.d.ts +101 -0
- package/dist/board/Counters.js +202 -0
- package/dist/board/Counters.js.map +1 -0
- package/dist/board/DataAttributes.d.ts +6 -0
- package/dist/board/Dependencies.d.ts +17 -0
- package/dist/board/Dependencies.js +44 -0
- package/dist/board/Dependencies.js.map +1 -0
- package/dist/board/Desk.d.ts +52 -0
- package/dist/board/Desk.js +130 -0
- package/dist/board/Desk.js.map +1 -0
- package/dist/board/Dossier.d.ts +100 -0
- package/dist/board/Dossier.js +194 -0
- package/dist/board/Dossier.js.map +1 -0
- package/dist/board/Filters.d.ts +33 -0
- package/dist/board/Filters.js +64 -0
- package/dist/board/Filters.js.map +1 -0
- package/dist/board/ItemDetails.d.ts +167 -0
- package/dist/board/ItemDetails.js +339 -0
- package/dist/board/ItemDetails.js.map +1 -0
- package/dist/board/ItemDialog.d.ts +73 -0
- package/dist/board/ItemDialog.js +140 -0
- package/dist/board/ItemDialog.js.map +1 -0
- package/dist/board/ItemParts.d.ts +42 -0
- package/dist/board/ItemParts.js +82 -0
- package/dist/board/ItemParts.js.map +1 -0
- package/dist/board/ItemProgress.d.ts +56 -0
- package/dist/board/ItemProgress.js +138 -0
- package/dist/board/ItemProgress.js.map +1 -0
- package/dist/board/List.d.ts +65 -0
- package/dist/board/List.js +118 -0
- package/dist/board/List.js.map +1 -0
- package/dist/board/LoadingScreen.d.ts +38 -0
- package/dist/board/LoadingScreen.js +74 -0
- package/dist/board/LoadingScreen.js.map +1 -0
- package/dist/board/NeedsYou.d.ts +13 -0
- package/dist/board/NeedsYou.js +31 -0
- package/dist/board/NeedsYou.js.map +1 -0
- package/dist/board/Onboarding.d.ts +53 -0
- package/dist/board/Onboarding.js +122 -0
- package/dist/board/Onboarding.js.map +1 -0
- package/dist/board/PartsList.d.ts +60 -0
- package/dist/board/PartsList.js +115 -0
- package/dist/board/PartsList.js.map +1 -0
- package/dist/board/ProjectIcon.d.ts +51 -0
- package/dist/board/ProjectIcon.js +120 -0
- package/dist/board/ProjectIcon.js.map +1 -0
- package/dist/board/PullRequests.d.ts +43 -0
- package/dist/board/PullRequests.js +83 -0
- package/dist/board/PullRequests.js.map +1 -0
- package/dist/board/RowStyles.js +14 -0
- package/dist/board/RowStyles.js.map +1 -0
- package/dist/board/Settings.d.ts +54 -0
- package/dist/board/Settings.js +112 -0
- package/dist/board/Settings.js.map +1 -0
- package/dist/board/Slices.d.ts +32 -0
- package/dist/board/Slices.js +88 -0
- package/dist/board/Slices.js.map +1 -0
- package/dist/board/SourceIcon.d.ts +12 -0
- package/dist/board/SourceIcon.js +24 -0
- package/dist/board/SourceIcon.js.map +1 -0
- package/dist/board/StagePane.d.ts +43 -0
- package/dist/board/StagePane.js +97 -0
- package/dist/board/StagePane.js.map +1 -0
- package/dist/board/StageRow.d.ts +141 -0
- package/dist/board/StageRow.js +287 -0
- package/dist/board/StageRow.js.map +1 -0
- package/dist/board/StageTrack.d.ts +18 -0
- package/dist/board/StageTrack.js +38 -0
- package/dist/board/StageTrack.js.map +1 -0
- package/dist/board/StartControls.d.ts +30 -0
- package/dist/board/StartControls.js +51 -0
- package/dist/board/StartControls.js.map +1 -0
- package/dist/board/StatusColors.d.ts +5 -0
- package/dist/board/StatusColors.js +17 -0
- package/dist/board/StatusColors.js.map +1 -0
- package/dist/board/StatusGlyph.d.ts +18 -0
- package/dist/board/StatusGlyph.js +51 -0
- package/dist/board/StatusGlyph.js.map +1 -0
- package/dist/board/Threads.d.ts +13 -0
- package/dist/board/Threads.js +35 -0
- package/dist/board/Threads.js.map +1 -0
- package/dist/board/TrackerLabels.d.ts +27 -0
- package/dist/board/TrackerLabels.js +56 -0
- package/dist/board/TrackerLabels.js.map +1 -0
- package/dist/board/UpdatePill.d.ts +52 -0
- package/dist/board/UpdatePill.js +188 -0
- package/dist/board/UpdatePill.js.map +1 -0
- package/dist/board/Vocabulary.d.ts +56 -0
- package/dist/board/Vocabulary.js +104 -0
- package/dist/board/Vocabulary.js.map +1 -0
- package/dist/board/Warnings.d.ts +35 -0
- package/dist/board/Warnings.js +85 -0
- package/dist/board/Warnings.js.map +1 -0
- package/dist/board/WorkMap.d.ts +136 -0
- package/dist/board/WorkMap.js +274 -0
- package/dist/board/WorkMap.js.map +1 -0
- package/dist/board/index.d.ts +42 -0
- package/dist/collections/CollectionState.d.ts +10 -1
- package/dist/collections/CollectionState.js +12 -5
- package/dist/collections/CollectionState.js.map +1 -1
- package/dist/collections/ResultList.js +1 -1
- package/dist/collections/ScrollRow.js +1 -1
- package/dist/collections/VirtualList.js +1 -1
- package/dist/display/Avatar.d.ts +5 -2
- package/dist/display/Avatar.js +2 -2
- package/dist/display/Avatar.js.map +1 -1
- package/dist/display/Badge.d.ts +6 -1
- package/dist/display/Badge.js +9 -4
- package/dist/display/Badge.js.map +1 -1
- package/dist/display/CheckList.js +1 -1
- package/dist/display/Comment.d.ts +12 -0
- package/dist/display/Comment.js +39 -0
- package/dist/display/Comment.js.map +1 -0
- package/dist/display/CopyButton.d.ts +10 -2
- package/dist/display/CopyButton.js +29 -16
- package/dist/display/CopyButton.js.map +1 -1
- package/dist/display/Diagram.d.ts +17 -0
- package/dist/display/Diagram.js +49 -0
- package/dist/display/Diagram.js.map +1 -0
- package/dist/display/ImagePicker.js +1 -1
- package/dist/display/InfoBox.js +2 -2
- package/dist/display/InsetPanel.d.ts +3 -1
- package/dist/display/InsetPanel.js +7 -4
- package/dist/display/InsetPanel.js.map +1 -1
- package/dist/display/ItemAction.js +2 -2
- package/dist/display/LabelChip.d.ts +26 -0
- package/dist/display/LabelChip.js +41 -0
- package/dist/display/LabelChip.js.map +1 -0
- package/dist/display/LabelTint.js +60 -0
- package/dist/display/LabelTint.js.map +1 -0
- package/dist/display/Person.d.ts +5 -0
- package/dist/display/Person.js +19 -0
- package/dist/display/Person.js.map +1 -0
- package/dist/display/PropertySheet.js +1 -1
- package/dist/display/RadioChoice.d.ts +9 -2
- package/dist/display/RadioChoice.js +5 -1
- package/dist/display/RadioChoice.js.map +1 -1
- package/dist/display/RatingLink.js +1 -1
- package/dist/display/RichText.d.ts +12 -0
- package/dist/display/RichText.js +94 -0
- package/dist/display/RichText.js.map +1 -0
- package/dist/display/RowList.js +1 -1
- package/dist/display/index.d.ts +6 -1
- package/dist/feedback/Alert.js +1 -1
- package/dist/feedback/AsyncState.js +1 -1
- package/dist/feedback/DismissButton.d.ts +12 -0
- package/dist/feedback/DismissButton.js +20 -0
- package/dist/feedback/DismissButton.js.map +1 -0
- package/dist/feedback/ErrorNotification.js +2 -0
- package/dist/feedback/ErrorNotification.js.map +1 -1
- package/dist/feedback/FormResult.d.ts +16 -0
- package/dist/feedback/FormResult.js +30 -0
- package/dist/feedback/FormResult.js.map +1 -0
- package/dist/feedback/LiveRegion.d.ts +7 -0
- package/dist/feedback/LiveRegion.js +15 -0
- package/dist/feedback/LiveRegion.js.map +1 -0
- package/dist/feedback/Loading.d.ts +19 -0
- package/dist/feedback/Loading.js +63 -0
- package/dist/feedback/Loading.js.map +1 -0
- package/dist/feedback/Notifications.d.ts +35 -1
- package/dist/feedback/Notifications.js +196 -4
- package/dist/feedback/Notifications.js.map +1 -1
- package/dist/feedback/Progress.d.ts +15 -0
- package/dist/feedback/Progress.js +38 -0
- package/dist/feedback/Progress.js.map +1 -0
- package/dist/feedback/ProgressStatusRow.js +1 -1
- package/dist/feedback/StatusIndicator.d.ts +6 -1
- package/dist/feedback/StatusIndicator.js +19 -5
- package/dist/feedback/StatusIndicator.js.map +1 -1
- package/dist/feedback/index.d.ts +8 -4
- package/dist/forms/Checkbox.js +1 -1
- package/dist/forms/ColorSwatches.d.ts +21 -0
- package/dist/forms/ColorSwatches.js +26 -0
- package/dist/forms/ColorSwatches.js.map +1 -0
- package/dist/forms/FormSection.d.ts +68 -6
- package/dist/forms/FormSection.js +139 -8
- package/dist/forms/FormSection.js.map +1 -1
- package/dist/forms/HiddenField.d.ts +6 -0
- package/dist/forms/HiddenField.js +13 -0
- package/dist/forms/HiddenField.js.map +1 -0
- package/dist/forms/Input.d.ts +12 -2
- package/dist/forms/Input.js +10 -3
- package/dist/forms/Input.js.map +1 -1
- package/dist/forms/LabelPicker.d.ts +43 -0
- package/dist/forms/LabelPicker.js +107 -0
- package/dist/forms/LabelPicker.js.map +1 -0
- package/dist/forms/MarkdownEditor.d.ts +21 -0
- package/dist/forms/MarkdownEditor.js +175 -0
- package/dist/forms/MarkdownEditor.js.map +1 -0
- package/dist/forms/MarkdownToolbar.js +204 -0
- package/dist/forms/MarkdownToolbar.js.map +1 -0
- package/dist/forms/OptionSelect.d.ts +30 -9
- package/dist/forms/OptionSelect.js +53 -13
- package/dist/forms/OptionSelect.js.map +1 -1
- package/dist/forms/Select.d.ts +4 -1
- package/dist/forms/Select.js +3 -1
- package/dist/forms/Select.js.map +1 -1
- package/dist/forms/Switch.d.ts +4 -1
- package/dist/forms/Switch.js +5 -2
- package/dist/forms/Switch.js.map +1 -1
- package/dist/forms/TagInput.js +1 -1
- package/dist/forms/index.d.ts +7 -3
- package/dist/foundations/AmbientMotion.d.ts +2 -0
- package/dist/foundations/AmbientMotion.js +39 -0
- package/dist/foundations/AmbientMotion.js.map +1 -0
- package/dist/foundations/DesignSystemProvider.d.ts +34 -0
- package/dist/foundations/DesignSystemProvider.js +26 -1
- package/dist/foundations/DesignSystemProvider.js.map +1 -1
- package/dist/foundations/index.d.ts +2 -1
- package/dist/icons/BrandIcons.d.ts +8 -2
- package/dist/icons/BrandIcons.js +14 -3
- package/dist/icons/BrandIcons.js.map +1 -1
- package/dist/icons/dynamic.d.ts +2 -0
- package/dist/icons/dynamic.js +1 -0
- package/dist/icons/index.d.ts +2 -2
- package/dist/icons/index.js +1 -1
- package/dist/icons.d.ts +2 -2
- package/dist/icons.js +1 -1
- package/dist/index.d.ts +71 -10
- package/dist/index.js +78 -21
- package/dist/layout/Site.js +1 -1
- package/dist/layout/TitleBar.js +1 -1
- package/dist/layout/index.d.ts +2 -2
- package/dist/layout/index.js +3 -3
- package/dist/layout/toolbar/CommandPaletteTrigger.d.ts +17 -2
- package/dist/layout/toolbar/CommandPaletteTrigger.js +89 -6
- package/dist/layout/toolbar/CommandPaletteTrigger.js.map +1 -1
- package/dist/layout/toolbar/TriggerFit.js +56 -0
- package/dist/layout/toolbar/TriggerFit.js.map +1 -0
- package/dist/navigation/CollectionBrowseSelector.js +1 -1
- package/dist/navigation/CollectionViewToggle.d.ts +26 -0
- package/dist/navigation/CollectionViewToggle.js +54 -23
- package/dist/navigation/CollectionViewToggle.js.map +1 -1
- package/dist/navigation/DrilldownBrowseSelector.js +1 -1
- package/dist/navigation/FolderSelector.js +2 -2
- package/dist/navigation/SortMenu.d.ts +10 -0
- package/dist/navigation/SortMenu.js +33 -0
- package/dist/navigation/SortMenu.js.map +1 -0
- package/dist/navigation/index.d.ts +3 -2
- package/dist/overlays/CommandPalette.d.ts +38 -4
- package/dist/overlays/CommandPalette.js +140 -54
- package/dist/overlays/CommandPalette.js.map +1 -1
- package/dist/overlays/Drawer.js +1 -1
- package/dist/overlays/DropdownMenu.d.ts +7 -1
- package/dist/overlays/DropdownMenu.js +13 -2
- package/dist/overlays/DropdownMenu.js.map +1 -1
- package/dist/overlays/HelpTip.d.ts +8 -0
- package/dist/overlays/HelpTip.js +29 -0
- package/dist/overlays/HelpTip.js.map +1 -0
- package/dist/overlays/ImageViewer.js +2 -2
- package/dist/overlays/Modal.d.ts +5 -0
- package/dist/overlays/Modal.js +17 -2
- package/dist/overlays/Modal.js.map +1 -1
- package/dist/overlays/ModalExpandButton.d.ts +18 -0
- package/dist/overlays/ModalExpandButton.js +43 -0
- package/dist/overlays/ModalExpandButton.js.map +1 -0
- package/dist/overlays/Popover.d.ts +2 -1
- package/dist/overlays/Popover.js +1 -0
- package/dist/overlays/Popover.js.map +1 -1
- package/dist/overlays/index.d.ts +4 -2
- package/dist/showcase/Cards.js +1 -1
- package/dist/showcase/FeatureRow.js +1 -1
- package/dist/showcase/PhotoSearchConcept.js +1 -1
- package/dist/showcase/ProductBand.js +1 -1
- package/dist/showcase/Status.js +1 -1
- package/dist/typography/Code.d.ts +18 -0
- package/dist/typography/Code.js +24 -0
- package/dist/typography/Code.js.map +1 -0
- package/dist/typography/Link.d.ts +7 -2
- package/dist/typography/Link.js +15 -5
- package/dist/typography/Link.js.map +1 -1
- package/dist/typography/Typography.d.ts +19 -1
- package/dist/typography/Typography.js +11 -3
- package/dist/typography/Typography.js.map +1 -1
- package/dist/typography/index.d.ts +3 -3
- package/package.json +26 -3
- package/src/actions/Button.tsx +78 -11
- package/src/actions/ButtonLink.tsx +34 -0
- package/src/actions/ButtonRecipes.ts +10 -0
- package/src/actions/IconButton.tsx +7 -4
- package/src/board/ActivityLine.tsx +176 -0
- package/src/board/ActivityTrack.tsx +23 -0
- package/src/board/AddItem.tsx +259 -0
- package/src/board/Archive.tsx +75 -0
- package/src/board/Attention.tsx +135 -0
- package/src/board/BoardShell.tsx +30 -0
- package/src/board/BoardTitleBar.tsx +167 -0
- package/src/board/ButtonKinds.ts +32 -0
- package/src/board/Cleanup.tsx +19 -0
- package/src/board/Counters.tsx +224 -0
- package/src/board/DataAttributes.ts +3 -0
- package/src/board/Dependencies.tsx +49 -0
- package/src/board/Desk.tsx +155 -0
- package/src/board/Dossier.tsx +262 -0
- package/src/board/Filters.tsx +85 -0
- package/src/board/ItemDetails.tsx +435 -0
- package/src/board/ItemDialog.tsx +179 -0
- package/src/board/ItemParts.tsx +128 -0
- package/src/board/ItemProgress.tsx +164 -0
- package/src/board/List.tsx +154 -0
- package/src/board/LoadingScreen.tsx +78 -0
- package/src/board/NeedsYou.tsx +30 -0
- package/src/board/Onboarding.tsx +124 -0
- package/src/board/PartsList.tsx +160 -0
- package/src/board/ProjectIcon.tsx +172 -0
- package/src/board/PullRequests.tsx +106 -0
- package/src/board/RowStyles.ts +17 -0
- package/src/board/Settings.tsx +124 -0
- package/src/board/Slices.tsx +103 -0
- package/src/board/SourceIcon.tsx +33 -0
- package/src/board/StagePane.tsx +128 -0
- package/src/board/StageRow.tsx +320 -0
- package/src/board/StageTrack.tsx +61 -0
- package/src/board/StartControls.tsx +77 -0
- package/src/board/StatusColors.ts +28 -0
- package/src/board/StatusGlyph.tsx +70 -0
- package/src/board/Threads.tsx +38 -0
- package/src/board/TrackerLabels.tsx +75 -0
- package/src/board/UpdatePill.tsx +222 -0
- package/src/board/Vocabulary.tsx +155 -0
- package/src/board/Warnings.tsx +83 -0
- package/src/board/WorkMap.tsx +436 -0
- package/src/board/base.css +121 -0
- package/src/board/button-kinds.css +8 -0
- package/src/board/index.ts +224 -0
- package/src/board/items.css +75 -0
- package/src/board/loading-screen.css +171 -0
- package/src/board/rows.css +180 -0
- package/src/board/title-bar.css +56 -0
- package/src/board/tokens.css +52 -0
- package/src/board.css +19 -0
- package/src/collections/CollectionState.tsx +20 -7
- package/src/display/Avatar.tsx +6 -3
- package/src/display/Badge.tsx +25 -3
- package/src/display/Comment.tsx +26 -0
- package/src/display/CopyButton.tsx +48 -18
- package/src/display/Diagram.tsx +59 -0
- package/src/display/InsetPanel.tsx +4 -1
- package/src/display/LabelChip.tsx +73 -0
- package/src/display/LabelTint.ts +72 -0
- package/src/display/Person.tsx +11 -0
- package/src/display/RadioChoice.tsx +11 -2
- package/src/display/RichText.tsx +114 -0
- package/src/display/index.ts +5 -0
- package/src/feedback/DismissButton.tsx +28 -0
- package/src/feedback/ErrorNotification.ts +3 -0
- package/src/feedback/FormResult.tsx +50 -0
- package/src/feedback/LiveRegion.tsx +10 -0
- package/src/feedback/Loading.tsx +75 -0
- package/src/feedback/Notifications.tsx +267 -2
- package/src/feedback/Progress.tsx +44 -0
- package/src/feedback/StatusIndicator.tsx +34 -3
- package/src/feedback/index.ts +12 -2
- package/src/forms/ColorSwatches.tsx +50 -0
- package/src/forms/FormSection.tsx +245 -10
- package/src/forms/HiddenField.tsx +4 -0
- package/src/forms/Input.tsx +26 -4
- package/src/forms/LabelPicker.tsx +140 -0
- package/src/forms/MarkdownEditor.tsx +283 -0
- package/src/forms/MarkdownToolbar.tsx +267 -0
- package/src/forms/OptionSelect.tsx +110 -25
- package/src/forms/Select.tsx +20 -13
- package/src/forms/Switch.tsx +16 -2
- package/src/forms/index.ts +16 -2
- package/src/foundations/AmbientMotion.ts +51 -0
- package/src/foundations/DesignSystemProvider.tsx +19 -0
- package/src/foundations/index.ts +1 -0
- package/src/foundations/theme.css +64 -0
- package/src/icons/BrandIcons.tsx +12 -3
- package/src/icons/dynamic.ts +4 -0
- package/src/icons/index.ts +1 -1
- package/src/index.ts +2 -1
- package/src/layout/index.ts +1 -1
- package/src/layout/toolbar/CommandPaletteTrigger.tsx +187 -31
- package/src/layout/toolbar/TriggerFit.ts +84 -0
- package/src/navigation/CollectionViewToggle.tsx +94 -24
- package/src/navigation/SortMenu.tsx +41 -0
- package/src/navigation/index.ts +2 -1
- package/src/overlays/CommandPalette.tsx +190 -60
- package/src/overlays/DropdownMenu.tsx +12 -1
- package/src/overlays/HelpTip.tsx +29 -0
- package/src/overlays/Modal.tsx +23 -0
- package/src/overlays/ModalExpandButton.tsx +48 -0
- package/src/overlays/Popover.tsx +3 -1
- package/src/overlays/index.ts +9 -1
- package/src/styles.css +3 -1
- package/src/typography/Code.tsx +24 -0
- package/src/typography/Link.tsx +19 -10
- package/src/typography/Typography.tsx +25 -2
- package/src/typography/index.ts +1 -1
- package/dist/feedback/index.js +0 -11
- package/dist/typography/index.js +0 -4
package/dist/overlays/Drawer.js
CHANGED
|
@@ -3,8 +3,8 @@ import { useDesignSystemLabels } from "../foundations/DesignSystemProvider.js";
|
|
|
3
3
|
import { Heading, Text } from "../typography/Typography.js";
|
|
4
4
|
import { useModalAutoFocus } from "./useModalAutoFocus.js";
|
|
5
5
|
import { forwardRef } from "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
6
|
import { XIcon } from "lucide-react";
|
|
7
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
8
|
import { Drawer } from "@ninna-ui/overlays";
|
|
9
9
|
// src/overlays/Drawer.tsx
|
|
10
10
|
function DrawerRoot(props) {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ComponentProps } from "react";
|
|
1
|
+
import { ComponentProps, ReactNode } from "react";
|
|
2
2
|
import { DropdownMenu, DropdownMenuContentProps, DropdownMenuItemProps, DropdownMenuLabelProps, DropdownMenuRadioGroupProps, DropdownMenuRadioItemProps } from "@ninna-ui/overlays";
|
|
3
3
|
interface DropdownMenuContentPolicyProps extends Omit<DropdownMenuContentProps, 'className'> {
|
|
4
4
|
width?: 'sm' | 'md';
|
|
@@ -16,6 +16,11 @@ interface DropdownMenuRadioGroupPolicyProps extends Omit<DropdownMenuRadioGroupP
|
|
|
16
16
|
interface DropdownMenuRadioItemPolicyProps extends Omit<DropdownMenuRadioItemProps, 'className'> {
|
|
17
17
|
presentation?: 'default' | 'segmented';
|
|
18
18
|
}
|
|
19
|
+
/** An entry's label, truncating to the menu's width, with an optional smaller `detail` line under it. */
|
|
20
|
+
declare function DropdownMenuItemText({ children, detail }: {
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
detail?: ReactNode;
|
|
23
|
+
}): import("react").JSX.Element;
|
|
19
24
|
declare function DropdownMenuRoot(props: ComponentProps<typeof DropdownMenu>): import("react").JSX.Element;
|
|
20
25
|
declare const DropdownMenu$1: typeof DropdownMenuRoot & {
|
|
21
26
|
({ children, open, defaultOpen, onOpenChange, modal, dir }: import("@ninna-ui/overlays").DropdownMenuProps): import("react").JSX.Element;
|
|
@@ -42,6 +47,7 @@ declare const DropdownMenu$1: typeof DropdownMenuRoot & {
|
|
|
42
47
|
Label: import("react").ForwardRefExoticComponent<DropdownMenuLabelPolicyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
43
48
|
RadioGroup: import("react").ForwardRefExoticComponent<DropdownMenuRadioGroupPolicyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
44
49
|
RadioItem: import("react").ForwardRefExoticComponent<DropdownMenuRadioItemPolicyProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
50
|
+
ItemText: typeof DropdownMenuItemText;
|
|
45
51
|
};
|
|
46
52
|
export { DropdownMenu$1 as DropdownMenu };
|
|
47
53
|
//# sourceMappingURL=DropdownMenu.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { forwardRef } from "react";
|
|
2
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
import { DropdownMenu } from "@ninna-ui/overlays";
|
|
4
4
|
// src/overlays/DropdownMenu.tsx
|
|
5
5
|
const contentWidthClasses = {
|
|
@@ -43,6 +43,16 @@ const DropdownMenuRadioItem = forwardRef(({ onSelect, presentation = "default",
|
|
|
43
43
|
className: presentation === "segmented" ? "text-base-600 focus:bg-base-300 focus:text-base-content data-[state=checked]:bg-base-100 data-[state=checked]:text-base-content size-7 justify-center rounded-md p-0 data-[state=checked]:shadow-sm [&>span]:hidden [&>svg]:size-4" : "max-lg:min-h-11 pointer-coarse:min-h-11 [&>svg]:size-4 [&>svg]:shrink-0"
|
|
44
44
|
}));
|
|
45
45
|
DropdownMenuRadioItem.displayName = "DropdownMenu.RadioItem";
|
|
46
|
+
/** An entry's label, truncating to the menu's width, with an optional smaller `detail` line under it. */
|
|
47
|
+
function DropdownMenuItemText({ children, detail }) {
|
|
48
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
49
|
+
className: "min-w-0 flex-1 truncate",
|
|
50
|
+
children: [children, detail && /* @__PURE__ */ jsx("span", {
|
|
51
|
+
className: "block truncate text-xs",
|
|
52
|
+
children: detail
|
|
53
|
+
})]
|
|
54
|
+
});
|
|
55
|
+
}
|
|
46
56
|
function DropdownMenuRoot(props) {
|
|
47
57
|
return /* @__PURE__ */ jsx(DropdownMenu, { ...props });
|
|
48
58
|
}
|
|
@@ -51,7 +61,8 @@ const DropdownMenu$1 = Object.assign(DropdownMenuRoot, DropdownMenu, {
|
|
|
51
61
|
Item: DropdownMenuItem,
|
|
52
62
|
Label: DropdownMenuLabel,
|
|
53
63
|
RadioGroup: DropdownMenuRadioGroup,
|
|
54
|
-
RadioItem: DropdownMenuRadioItem
|
|
64
|
+
RadioItem: DropdownMenuRadioItem,
|
|
65
|
+
ItemText: DropdownMenuItemText
|
|
55
66
|
});
|
|
56
67
|
export { DropdownMenu$1 as DropdownMenu };
|
|
57
68
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DropdownMenu.js","names":["NinnaDropdownMenu","DropdownMenu"],"sources":["../../src/overlays/DropdownMenu.tsx"],"sourcesContent":["/* oxlint-disable react/only-export-components -- Compound members are exported through DropdownMenu. */\n\nimport {\n DropdownMenu as NinnaDropdownMenu,\n type DropdownMenuContentProps,\n type DropdownMenuItemProps,\n type DropdownMenuLabelProps,\n type DropdownMenuRadioGroupProps,\n type DropdownMenuRadioItemProps,\n} from '@ninna-ui/overlays';\nimport { type ComponentProps, forwardRef } from 'react';\n\ninterface DropdownMenuContentPolicyProps extends Omit<DropdownMenuContentProps, 'className'> {\n width?: 'sm' | 'md';\n}\n\nconst contentWidthClasses: Record<NonNullable<DropdownMenuContentPolicyProps['width']>, string> = {\n sm: 'w-60',\n md: 'w-64',\n};\n\nconst DropdownMenuContent = forwardRef<HTMLDivElement, DropdownMenuContentPolicyProps>(\n ({ side = 'bottom', sideOffset = 8, width = 'sm', ...props }, ref) => (\n <NinnaDropdownMenu.Content\n ref={ref}\n side={side}\n sideOffset={sideOffset}\n {...props}\n className={`${contentWidthClasses[width]} max-h-(--radix-dropdown-menu-content-available-height) max-w-[calc(100vw-2rem)] overflow-y-auto`}\n />\n ),\n);\n\nDropdownMenuContent.displayName = 'DropdownMenu.Content';\n\ninterface DropdownMenuLabelPolicyProps extends Omit<DropdownMenuLabelProps, 'className'> {\n presentation?: 'section' | 'identity';\n}\n\nconst DropdownMenuLabel = forwardRef<HTMLDivElement, DropdownMenuLabelPolicyProps>(\n ({ presentation = 'section', ...props }, ref) => (\n <NinnaDropdownMenu.Label\n ref={ref}\n {...props}\n className={presentation === 'identity' ? 'tracking-normal normal-case' : undefined}\n />\n ),\n);\n\nDropdownMenuLabel.displayName = 'DropdownMenu.Label';\n\ninterface DropdownMenuItemPolicyProps extends Omit<DropdownMenuItemProps, 'className'> {\n /** Forward the underlying menu item's behavior to a link without a second tab stop. */\n asChild?: boolean;\n}\n\nconst DropdownMenuItem = forwardRef<HTMLDivElement, DropdownMenuItemPolicyProps>((props, ref) => (\n <NinnaDropdownMenu.Item\n ref={ref}\n {...props}\n className=\"aria-[current=page]:bg-primary/10 aria-[current=page]:text-primary max-lg:min-h-11 pointer-coarse:min-h-11 [&>svg]:size-4 [&>svg]:shrink-0\"\n />\n));\n\nDropdownMenuItem.displayName = 'DropdownMenu.Item';\n\ninterface DropdownMenuRadioGroupPolicyProps extends Omit<DropdownMenuRadioGroupProps, 'className'> {\n presentation?: 'default' | 'segmented';\n}\n\nconst DropdownMenuRadioGroup = forwardRef<HTMLDivElement, DropdownMenuRadioGroupPolicyProps>(\n ({ presentation = 'default', ...props }, ref) => (\n <NinnaDropdownMenu.RadioGroup\n ref={ref}\n {...props}\n className={presentation === 'segmented' ? 'bg-base-200/70 flex gap-0.5 rounded-lg p-0.5' : undefined}\n />\n ),\n);\n\nDropdownMenuRadioGroup.displayName = 'DropdownMenu.RadioGroup';\n\ninterface DropdownMenuRadioItemPolicyProps extends Omit<DropdownMenuRadioItemProps, 'className'> {\n presentation?: 'default' | 'segmented';\n}\n\nconst DropdownMenuRadioItem = forwardRef<HTMLDivElement, DropdownMenuRadioItemPolicyProps>(\n ({ onSelect, presentation = 'default', ...props }, ref) => (\n <NinnaDropdownMenu.RadioItem\n ref={ref}\n {...props}\n data-presentation={presentation}\n onSelect={\n presentation === 'segmented'\n ? (event) => {\n event.preventDefault();\n onSelect?.(event);\n }\n : onSelect\n }\n className={\n presentation === 'segmented'\n ? 'text-base-600 focus:bg-base-300 focus:text-base-content data-[state=checked]:bg-base-100 data-[state=checked]:text-base-content size-7 justify-center rounded-md p-0 data-[state=checked]:shadow-sm [&>span]:hidden [&>svg]:size-4'\n : 'max-lg:min-h-11 pointer-coarse:min-h-11 [&>svg]:size-4 [&>svg]:shrink-0'\n }\n />\n ),\n);\n\nDropdownMenuRadioItem.displayName = 'DropdownMenu.RadioItem';\n\nfunction DropdownMenuRoot(props: ComponentProps<typeof NinnaDropdownMenu>) {\n return <NinnaDropdownMenu {...props} />;\n}\n\nexport const DropdownMenu = Object.assign(DropdownMenuRoot, NinnaDropdownMenu, {\n Content: DropdownMenuContent,\n Item: DropdownMenuItem,\n Label: DropdownMenuLabel,\n RadioGroup: DropdownMenuRadioGroup,\n RadioItem: DropdownMenuRadioItem,\n});\n"],"mappings":";;;;AAgBA,MAAM,sBAA4F;CAC9F,IAAI;CACJ,IAAI;AACR;AAEA,MAAM,sBAAsB,YACvB,EAAE,OAAO,UAAU,aAAa,GAAG,QAAQ,MAAM,GAAG,SAAS,QAC1D,oBAACA,aAAkB,SAAnB;CACS;CACC;CACM;CACZ,GAAI;CACJ,WAAW,GAAG,oBAAoB,OAAO;AAC5C,CAAA,CAET;AAEA,oBAAoB,cAAc;AAMlC,MAAM,oBAAoB,YACrB,EAAE,eAAe,WAAW,GAAG,SAAS,QACrC,oBAACA,aAAkB,OAAnB;CACS;CACL,GAAI;CACJ,WAAW,iBAAiB,aAAa,gCAAgC,KAAA;AAC5E,CAAA,CAET;AAEA,kBAAkB,cAAc;AAOhC,MAAM,mBAAmB,YAAyD,OAAO,QACrF,oBAACA,aAAkB,MAAnB;CACS;CACL,GAAI;CACJ,WAAU;AACb,CAAA,CACJ;AAED,iBAAiB,cAAc;AAM/B,MAAM,yBAAyB,YAC1B,EAAE,eAAe,WAAW,GAAG,SAAS,QACrC,oBAACA,aAAkB,YAAnB;CACS;CACL,GAAI;CACJ,WAAW,iBAAiB,cAAc,iDAAiD,KAAA;AAC9F,CAAA,CAET;AAEA,uBAAuB,cAAc;AAMrC,MAAM,wBAAwB,YACzB,EAAE,UAAU,eAAe,WAAW,GAAG,SAAS,QAC/C,oBAACA,aAAkB,WAAnB;CACS;CACL,GAAI;CACJ,qBAAmB;CACnB,UACI,iBAAiB,eACV,UAAU;EACP,MAAM,eAAe;EACrB,WAAW,KAAK;CACpB,IACA;CAEV,WACI,iBAAiB,cACX,uOACA;AAEb,CAAA,CAET;AAEA,sBAAsB,cAAc;
|
|
1
|
+
{"version":3,"file":"DropdownMenu.js","names":["NinnaDropdownMenu","DropdownMenu"],"sources":["../../src/overlays/DropdownMenu.tsx"],"sourcesContent":["/* oxlint-disable react/only-export-components -- Compound members are exported through DropdownMenu. */\n\nimport {\n DropdownMenu as NinnaDropdownMenu,\n type DropdownMenuContentProps,\n type DropdownMenuItemProps,\n type DropdownMenuLabelProps,\n type DropdownMenuRadioGroupProps,\n type DropdownMenuRadioItemProps,\n} from '@ninna-ui/overlays';\nimport { type ComponentProps, forwardRef, type ReactNode } from 'react';\n\ninterface DropdownMenuContentPolicyProps extends Omit<DropdownMenuContentProps, 'className'> {\n width?: 'sm' | 'md';\n}\n\nconst contentWidthClasses: Record<NonNullable<DropdownMenuContentPolicyProps['width']>, string> = {\n sm: 'w-60',\n md: 'w-64',\n};\n\nconst DropdownMenuContent = forwardRef<HTMLDivElement, DropdownMenuContentPolicyProps>(\n ({ side = 'bottom', sideOffset = 8, width = 'sm', ...props }, ref) => (\n <NinnaDropdownMenu.Content\n ref={ref}\n side={side}\n sideOffset={sideOffset}\n {...props}\n className={`${contentWidthClasses[width]} max-h-(--radix-dropdown-menu-content-available-height) max-w-[calc(100vw-2rem)] overflow-y-auto`}\n />\n ),\n);\n\nDropdownMenuContent.displayName = 'DropdownMenu.Content';\n\ninterface DropdownMenuLabelPolicyProps extends Omit<DropdownMenuLabelProps, 'className'> {\n presentation?: 'section' | 'identity';\n}\n\nconst DropdownMenuLabel = forwardRef<HTMLDivElement, DropdownMenuLabelPolicyProps>(\n ({ presentation = 'section', ...props }, ref) => (\n <NinnaDropdownMenu.Label\n ref={ref}\n {...props}\n className={presentation === 'identity' ? 'tracking-normal normal-case' : undefined}\n />\n ),\n);\n\nDropdownMenuLabel.displayName = 'DropdownMenu.Label';\n\ninterface DropdownMenuItemPolicyProps extends Omit<DropdownMenuItemProps, 'className'> {\n /** Forward the underlying menu item's behavior to a link without a second tab stop. */\n asChild?: boolean;\n}\n\nconst DropdownMenuItem = forwardRef<HTMLDivElement, DropdownMenuItemPolicyProps>((props, ref) => (\n <NinnaDropdownMenu.Item\n ref={ref}\n {...props}\n className=\"aria-[current=page]:bg-primary/10 aria-[current=page]:text-primary max-lg:min-h-11 pointer-coarse:min-h-11 [&>svg]:size-4 [&>svg]:shrink-0\"\n />\n));\n\nDropdownMenuItem.displayName = 'DropdownMenu.Item';\n\ninterface DropdownMenuRadioGroupPolicyProps extends Omit<DropdownMenuRadioGroupProps, 'className'> {\n presentation?: 'default' | 'segmented';\n}\n\nconst DropdownMenuRadioGroup = forwardRef<HTMLDivElement, DropdownMenuRadioGroupPolicyProps>(\n ({ presentation = 'default', ...props }, ref) => (\n <NinnaDropdownMenu.RadioGroup\n ref={ref}\n {...props}\n className={presentation === 'segmented' ? 'bg-base-200/70 flex gap-0.5 rounded-lg p-0.5' : undefined}\n />\n ),\n);\n\nDropdownMenuRadioGroup.displayName = 'DropdownMenu.RadioGroup';\n\ninterface DropdownMenuRadioItemPolicyProps extends Omit<DropdownMenuRadioItemProps, 'className'> {\n presentation?: 'default' | 'segmented';\n}\n\nconst DropdownMenuRadioItem = forwardRef<HTMLDivElement, DropdownMenuRadioItemPolicyProps>(\n ({ onSelect, presentation = 'default', ...props }, ref) => (\n <NinnaDropdownMenu.RadioItem\n ref={ref}\n {...props}\n data-presentation={presentation}\n onSelect={\n presentation === 'segmented'\n ? (event) => {\n event.preventDefault();\n onSelect?.(event);\n }\n : onSelect\n }\n className={\n presentation === 'segmented'\n ? 'text-base-600 focus:bg-base-300 focus:text-base-content data-[state=checked]:bg-base-100 data-[state=checked]:text-base-content size-7 justify-center rounded-md p-0 data-[state=checked]:shadow-sm [&>span]:hidden [&>svg]:size-4'\n : 'max-lg:min-h-11 pointer-coarse:min-h-11 [&>svg]:size-4 [&>svg]:shrink-0'\n }\n />\n ),\n);\n\nDropdownMenuRadioItem.displayName = 'DropdownMenu.RadioItem';\n\n/** An entry's label, truncating to the menu's width, with an optional smaller `detail` line under it. */\nfunction DropdownMenuItemText({ children, detail }: { children: ReactNode; detail?: ReactNode }) {\n return (\n <span className=\"min-w-0 flex-1 truncate\">\n {children}\n {detail && <span className=\"block truncate text-xs\">{detail}</span>}\n </span>\n );\n}\n\nfunction DropdownMenuRoot(props: ComponentProps<typeof NinnaDropdownMenu>) {\n return <NinnaDropdownMenu {...props} />;\n}\n\nexport const DropdownMenu = Object.assign(DropdownMenuRoot, NinnaDropdownMenu, {\n Content: DropdownMenuContent,\n Item: DropdownMenuItem,\n Label: DropdownMenuLabel,\n RadioGroup: DropdownMenuRadioGroup,\n RadioItem: DropdownMenuRadioItem,\n ItemText: DropdownMenuItemText,\n});\n"],"mappings":";;;;AAgBA,MAAM,sBAA4F;CAC9F,IAAI;CACJ,IAAI;AACR;AAEA,MAAM,sBAAsB,YACvB,EAAE,OAAO,UAAU,aAAa,GAAG,QAAQ,MAAM,GAAG,SAAS,QAC1D,oBAACA,aAAkB,SAAnB;CACS;CACC;CACM;CACZ,GAAI;CACJ,WAAW,GAAG,oBAAoB,OAAO;AAC5C,CAAA,CAET;AAEA,oBAAoB,cAAc;AAMlC,MAAM,oBAAoB,YACrB,EAAE,eAAe,WAAW,GAAG,SAAS,QACrC,oBAACA,aAAkB,OAAnB;CACS;CACL,GAAI;CACJ,WAAW,iBAAiB,aAAa,gCAAgC,KAAA;AAC5E,CAAA,CAET;AAEA,kBAAkB,cAAc;AAOhC,MAAM,mBAAmB,YAAyD,OAAO,QACrF,oBAACA,aAAkB,MAAnB;CACS;CACL,GAAI;CACJ,WAAU;AACb,CAAA,CACJ;AAED,iBAAiB,cAAc;AAM/B,MAAM,yBAAyB,YAC1B,EAAE,eAAe,WAAW,GAAG,SAAS,QACrC,oBAACA,aAAkB,YAAnB;CACS;CACL,GAAI;CACJ,WAAW,iBAAiB,cAAc,iDAAiD,KAAA;AAC9F,CAAA,CAET;AAEA,uBAAuB,cAAc;AAMrC,MAAM,wBAAwB,YACzB,EAAE,UAAU,eAAe,WAAW,GAAG,SAAS,QAC/C,oBAACA,aAAkB,WAAnB;CACS;CACL,GAAI;CACJ,qBAAmB;CACnB,UACI,iBAAiB,eACV,UAAU;EACP,MAAM,eAAe;EACrB,WAAW,KAAK;CACpB,IACA;CAEV,WACI,iBAAiB,cACX,uOACA;AAEb,CAAA,CAET;AAEA,sBAAsB,cAAc;;AAGpC,SAAS,qBAAqB,EAAE,UAAU,UAAuD;CAC7F,OACI,qBAAC,QAAD;EAAM,WAAU;EAAhB,UAAA,CACK,UACA,UAAU,oBAAC,QAAD;GAAM,WAAU;GAA0B,UAAA;EAAa,CAAA,CAChE;;AAEd;AAEA,SAAS,iBAAiB,OAAiD;CACvE,OAAO,oBAACA,cAAD,EAAmB,GAAI,MAAQ,CAAA;AAC1C;AAEA,MAAaC,iBAAe,OAAO,OAAO,kBAAkBD,cAAmB;CAC3E,SAAS;CACT,MAAM;CACN,OAAO;CACP,YAAY;CACZ,WAAW;CACX,UAAU;AACd,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/** A small help button after a setting's name that opens what the setting does in a popover. `label` is what it
|
|
3
|
+
* explains; the button reads "About {label}". */
|
|
4
|
+
export declare function HelpTip({ label, children }: {
|
|
5
|
+
label: string;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=HelpTip.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { tabbable } from "../foundations/KeyboardFocus.js";
|
|
2
|
+
import { Popover } from "./Popover.js";
|
|
3
|
+
import { CircleHelpIcon } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
+
// src/overlays/HelpTip.tsx
|
|
6
|
+
/** A small help button after a setting's name that opens what the setting does in a popover. `label` is what it
|
|
7
|
+
* explains; the button reads "About {label}". */
|
|
8
|
+
function HelpTip({ label, children }) {
|
|
9
|
+
return /* @__PURE__ */ jsxs(Popover, { children: [/* @__PURE__ */ jsx(Popover.Trigger, {
|
|
10
|
+
asChild: true,
|
|
11
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
12
|
+
...tabbable,
|
|
13
|
+
type: "button",
|
|
14
|
+
"aria-label": `About ${label}`,
|
|
15
|
+
className: "text-base-700 hover:text-base-content inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-full",
|
|
16
|
+
children: /* @__PURE__ */ jsx(CircleHelpIcon, { className: "size-3.5" })
|
|
17
|
+
})
|
|
18
|
+
}), /* @__PURE__ */ jsx(Popover.Content, {
|
|
19
|
+
width: "sm",
|
|
20
|
+
children: /* @__PURE__ */ jsx("div", {
|
|
21
|
+
className: "max-w-full text-xs leading-5 wrap-anywhere",
|
|
22
|
+
"data-help-text": true,
|
|
23
|
+
children
|
|
24
|
+
})
|
|
25
|
+
})] });
|
|
26
|
+
}
|
|
27
|
+
export { HelpTip };
|
|
28
|
+
|
|
29
|
+
//# sourceMappingURL=HelpTip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HelpTip.js","names":[],"sources":["../../src/overlays/HelpTip.tsx"],"sourcesContent":["import { CircleHelpIcon } from 'lucide-react';\nimport type { ReactNode } from 'react';\n\nimport { tabbable } from '../foundations/KeyboardFocus';\nimport { Popover } from './Popover';\n\n/** A small help button after a setting's name that opens what the setting does in a popover. `label` is what it\n * explains; the button reads \"About {label}\". */\nexport function HelpTip({ label, children }: { label: string; children: ReactNode }) {\n return (\n <Popover>\n <Popover.Trigger asChild>\n <button\n {...tabbable}\n type=\"button\"\n aria-label={`About ${label}`}\n className=\"text-base-700 hover:text-base-content inline-flex size-5 shrink-0 cursor-pointer items-center justify-center rounded-full\"\n >\n <CircleHelpIcon className=\"size-3.5\" />\n </button>\n </Popover.Trigger>\n <Popover.Content width=\"sm\">\n <div className=\"max-w-full text-xs leading-5 wrap-anywhere\" data-help-text>\n {children}\n </div>\n </Popover.Content>\n </Popover>\n );\n}\n"],"mappings":";;;;;;;AAQA,SAAgB,QAAQ,EAAE,OAAO,YAAoD;CACjF,OACI,qBAAC,SAAD,EAAA,UAAA,CACI,oBAAC,QAAQ,SAAT;EAAiB,SAAA;EACb,UAAA,oBAAC,UAAD;GACI,GAAI;GACJ,MAAK;GACL,cAAY,SAAS;GACrB,WAAU;GAEV,UAAA,oBAAC,gBAAD,EAAgB,WAAU,WAAY,CAAA;EAClC,CAAA;CACK,CAAA,GACjB,oBAAC,QAAQ,SAAT;EAAiB,OAAM;EACnB,UAAA,oBAAC,OAAD;GAAK,WAAU;GAA6C,kBAAA;GACvD;EACA,CAAA;CACQ,CAAA,CACZ,EAAA,CAAA;AAEjB"}
|
|
@@ -3,9 +3,9 @@ import { useDesignSystemLabels } from "../foundations/DesignSystemProvider.js";
|
|
|
3
3
|
import { Text } from "../typography/Typography.js";
|
|
4
4
|
import { useModalAutoFocus } from "./useModalAutoFocus.js";
|
|
5
5
|
import { useId, useState } from "react";
|
|
6
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
-
import { XIcon } from "lucide-react";
|
|
8
6
|
import { Loading } from "@ninna-ui/feedback";
|
|
7
|
+
import { XIcon } from "lucide-react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { Modal } from "@ninna-ui/overlays";
|
|
10
10
|
// src/overlays/ImageViewer.tsx
|
|
11
11
|
/**
|
package/dist/overlays/Modal.d.ts
CHANGED
|
@@ -8,6 +8,11 @@ interface ModalContentPolicyProps extends Omit<ModalContentProps, 'className' |
|
|
|
8
8
|
sidebar?: ReactNode;
|
|
9
9
|
/** The dialog's size; a dialog with a sidebar is `paned` unless it says otherwise. */
|
|
10
10
|
presentation?: 'default' | 'paned' | 'workspace';
|
|
11
|
+
/** Grows the dialog to the window, less a small margin, under a 52px title bar; see ModalExpandButton. */
|
|
12
|
+
expanded?: boolean;
|
|
13
|
+
/** A paned dialog that keeps its width but takes its content's height, such as a short pane; a long list in it
|
|
14
|
+
* scrolls inside. Expanding wins. */
|
|
15
|
+
fitsContent?: boolean;
|
|
11
16
|
title: string;
|
|
12
17
|
}
|
|
13
18
|
declare function ModalForm(props: Omit<ComponentProps<'form'>, 'className'>): import("react").JSX.Element;
|
package/dist/overlays/Modal.js
CHANGED
|
@@ -4,18 +4,33 @@ import { Heading, Text } from "../typography/Typography.js";
|
|
|
4
4
|
import { useModalAutoFocus } from "./useModalAutoFocus.js";
|
|
5
5
|
import { useScrollFade } from "./useScrollFade.js";
|
|
6
6
|
import { createContext, forwardRef, useCallback, useContext } from "react";
|
|
7
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
8
7
|
import { XIcon } from "lucide-react";
|
|
8
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
9
9
|
import { Modal } from "@ninna-ui/overlays";
|
|
10
10
|
// src/overlays/Modal.tsx
|
|
11
11
|
const ModalLoadingContext = createContext(false);
|
|
12
|
-
|
|
12
|
+
/** The expanded dialog's size, inline so it wins over every presentation's size classes. */
|
|
13
|
+
const expandedStyle = {
|
|
14
|
+
width: "calc(100vw - 2rem)",
|
|
15
|
+
maxWidth: "none",
|
|
16
|
+
height: "calc(100dvh - (52px + 1rem))",
|
|
17
|
+
maxHeight: "none",
|
|
18
|
+
top: "52px",
|
|
19
|
+
translate: "-50% 0"
|
|
20
|
+
};
|
|
21
|
+
/** A dialog that takes its content's height, inline so it wins over the paned size classes. */
|
|
22
|
+
const fitsContentStyle = { height: "auto" };
|
|
23
|
+
const ModalContent = forwardRef(({ accessibleTitle, children, closeOnEscape, closeOnOverlayClick, description, focusFirstField, headerActions, onPointerDownOutside, sidebar, presentation = sidebar ? "paned" : "default", expanded = false, fitsContent = false, title, ...props }, ref) => {
|
|
13
24
|
const loading = useContext(ModalLoadingContext);
|
|
14
25
|
const focusProps = useModalAutoFocus(focusFirstField);
|
|
15
26
|
return /* @__PURE__ */ jsxs(Modal.Content, {
|
|
16
27
|
ref,
|
|
17
28
|
...props,
|
|
18
29
|
...focusProps,
|
|
30
|
+
...expanded ? {
|
|
31
|
+
"data-expanded": true,
|
|
32
|
+
style: expandedStyle
|
|
33
|
+
} : fitsContent && { style: fitsContentStyle },
|
|
19
34
|
title: accessibleTitle ?? title,
|
|
20
35
|
description,
|
|
21
36
|
closeOnEscape: loading ? false : closeOnEscape,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Modal.js","names":["NinnaModal","Modal"],"sources":["../../src/overlays/Modal.tsx"],"sourcesContent":["/* oxlint-disable react/only-export-components -- Compound members are exported through Modal. */\n\nimport {\n Modal as NinnaModal,\n type ModalBodyProps,\n type ModalContentProps,\n type ModalFooterProps,\n} from '@ninna-ui/overlays';\nimport { XIcon } from 'lucide-react';\nimport {\n type ComponentProps,\n createContext,\n forwardRef,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n} from 'react';\n\nimport { IconButton } from '../actions/IconButton';\nimport { useDesignSystemLabels } from '../foundations/DesignSystemProvider';\nimport { Heading, Text } from '../typography/Typography';\nimport { useModalAutoFocus } from './useModalAutoFocus';\nimport { useScrollFade } from './useScrollFade';\n\nconst ModalLoadingContext = createContext(false);\n\ninterface ModalContentPolicyProps extends Omit<ModalContentProps, 'className' | 'size' | 'title'> {\n accessibleTitle?: string;\n /** Whether opening focuses the first editable field; off while the caller focuses something else. */\n focusFirstField?: boolean;\n headerActions?: ReactNode;\n sidebar?: ReactNode;\n /** The dialog's size; a dialog with a sidebar is `paned` unless it says otherwise. */\n presentation?: 'default' | 'paned' | 'workspace';\n title: string;\n}\n\nconst ModalContent = forwardRef<HTMLDivElement, ModalContentPolicyProps>(\n (\n {\n accessibleTitle,\n children,\n closeOnEscape,\n closeOnOverlayClick,\n description,\n focusFirstField,\n headerActions,\n onPointerDownOutside,\n sidebar,\n presentation = sidebar ? 'paned' : 'default',\n title,\n ...props\n },\n ref,\n ) => {\n const loading = useContext(ModalLoadingContext);\n const focusProps = useModalAutoFocus(focusFirstField);\n\n return (\n <NinnaModal.Content\n ref={ref}\n {...props}\n {...focusProps}\n title={accessibleTitle ?? title}\n description={description}\n closeOnEscape={loading ? false : closeOnEscape}\n closeOnOverlayClick={loading ? false : closeOnOverlayClick}\n onPointerDownOutside={(event) => {\n if (event.target instanceof Element && event.target.closest('[data-slot=\"toaster\"]')) {\n event.preventDefault();\n }\n\n onPointerDownOutside?.(event);\n }}\n size={presentation === 'workspace' ? 'full' : undefined}\n className={`flex max-h-[calc(100dvh-1rem)] w-[calc(100vw-1rem)] flex-col overflow-hidden sm:max-h-[calc(100dvh-2rem)] sm:w-[calc(100vw-2rem)] ${\n sidebar ? 'md:grid md:grid-cols-[14rem_minmax(0,1fr)] md:grid-rows-[auto_minmax(0,1fr)]' : ''\n } ${\n presentation === 'workspace'\n ? 'h-[calc(100dvh-1rem)] max-w-6xl sm:h-[calc(100dvh-2rem)] sm:max-w-6xl'\n : presentation === 'paned'\n ? // Paned dialogs keep one height across panes; the body scrolls instead of the dialog resizing.\n 'h-[calc(100dvh-1rem)] max-w-4xl sm:h-[min(44rem,calc(100dvh-2rem))] sm:max-w-4xl'\n : 'max-w-160 sm:max-w-160'\n }`}\n >\n <header\n data-slot=\"modal-header\"\n className={`@container min-w-0 shrink-0 px-5 pt-5 sm:px-6 sm:pt-6 ${\n description ? (sidebar ? 'pb-4 md:pb-0' : '') : 'pb-4'\n } ${sidebar ? 'md:col-start-2 md:row-start-1' : ''}`}\n >\n <div className=\"flex min-w-0 flex-wrap items-center justify-between gap-x-4 gap-y-3\">\n <Heading as=\"h2\" className=\"min-w-0 flex-1 wrap-break-word\" variant=\"section\">\n {title}\n </Heading>\n {headerActions ? (\n <div className=\"order-3 flex basis-full items-center justify-end gap-2 @min-[32rem]:order-0 @min-[32rem]:ml-auto @min-[32rem]:basis-auto\">\n {headerActions}\n </div>\n ) : null}\n <div className=\"shrink-0\">\n <ModalClose />\n </div>\n </div>\n </header>\n {sidebar ? (\n <div className=\"min-h-0 min-w-0 shrink-0 md:col-start-1 md:row-span-2 md:row-start-1\">\n {sidebar}\n </div>\n ) : null}\n <div\n className={`flex min-h-0 min-w-0 flex-1 flex-col ${sidebar ? 'md:col-start-2 md:row-start-2' : ''}`}\n >\n {description ? (\n <Text\n className={`shrink-0 px-5 pb-4 sm:px-6 ${sidebar ? 'pt-4 md:pt-2' : 'pt-2'}`}\n tone=\"muted\"\n >\n {description}\n </Text>\n ) : null}\n {children}\n </div>\n </NinnaModal.Content>\n );\n },\n);\n\nModalContent.displayName = 'Modal.Content';\n\nconst ModalBody = forwardRef<HTMLDivElement, Omit<ModalBodyProps, 'className'> & { layout?: 'scroll' | 'fill' }>(\n ({ layout = 'scroll', children, ...props }, ref: Ref<HTMLDivElement>) => {\n const { setViewport, setContent, className } = useScrollFade();\n const bodyRef = useCallback(\n (element: HTMLDivElement) => {\n setViewport(element);\n\n const cleanup = typeof ref === 'function' ? ref(element) : undefined;\n\n if (ref && typeof ref !== 'function') ref.current = element;\n\n return () => {\n setViewport(null);\n\n if (typeof cleanup === 'function') cleanup();\n else if (typeof ref === 'function') ref(null);\n else if (ref) ref.current = null;\n };\n },\n [ref, setViewport],\n );\n\n return (\n <NinnaModal.Body\n ref={bodyRef}\n {...props}\n className={`min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-2 pb-6 sm:px-6 ${layout === 'fill' ? 'flex flex-col' : ''} ${className}`}\n >\n <div\n ref={setContent}\n className={layout === 'fill' ? 'flex min-h-0 flex-1 flex-col gap-3' : 'flow-root'}\n >\n {children}\n </div>\n </NinnaModal.Body>\n );\n },\n);\n\nModalBody.displayName = 'Modal.Body';\n\nfunction ModalForm(props: Omit<ComponentProps<'form'>, 'className'>) {\n return <form {...props} className=\"flex min-h-0 flex-1 flex-col\" />;\n}\n\nfunction ModalPane({ active, children }: { active: boolean; children: ReactNode }) {\n return (\n <div hidden={!active} className={active ? 'flex min-h-0 flex-1 flex-col' : 'hidden'}>\n {children}\n </div>\n );\n}\n\nconst ModalFooter = forwardRef<HTMLDivElement, Omit<ModalFooterProps, 'className'> & { leading?: ReactNode }>(\n ({ leading, children, ...props }, ref) => (\n <NinnaModal.Footer\n ref={ref}\n {...props}\n className=\"border-base-300 bg-base-50/60 shrink-0 border-t px-5 py-4 sm:px-6 sm:pb-4\"\n >\n {leading ? <div className=\"mr-auto min-w-0 basis-full pb-2 sm:basis-auto sm:pb-0\">{leading}</div> : null}\n {children}\n </NinnaModal.Footer>\n ),\n);\n\nModalFooter.displayName = 'Modal.Footer';\n\nfunction ModalClose() {\n const labels = useDesignSystemLabels();\n const loading = useContext(ModalLoadingContext);\n\n return (\n <NinnaModal.Close asChild>\n <IconButton aria-label={labels.close} disabled={loading} icon={<XIcon />} variant=\"header\" />\n </NinnaModal.Close>\n );\n}\n\ninterface ModalRootPolicyProps {\n children: ReactNode;\n loading?: boolean;\n onClose: () => void;\n}\n\nfunction ModalRoot({ children, loading = false, onClose }: ModalRootPolicyProps) {\n return (\n <ModalLoadingContext.Provider value={loading}>\n <NinnaModal open onOpenChange={(open) => !open && !loading && onClose()}>\n {children}\n </NinnaModal>\n </ModalLoadingContext.Provider>\n );\n}\n\nexport const Modal = Object.assign(ModalRoot, {\n Body: ModalBody,\n Form: ModalForm,\n Pane: ModalPane,\n Content: ModalContent,\n Footer: ModalFooter,\n});\n"],"mappings":"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"}
|
|
1
|
+
{"version":3,"file":"Modal.js","names":["NinnaModal","Modal"],"sources":["../../src/overlays/Modal.tsx"],"sourcesContent":["/* oxlint-disable react/only-export-components -- Compound members are exported through Modal. */\n\nimport {\n Modal as NinnaModal,\n type ModalBodyProps,\n type ModalContentProps,\n type ModalFooterProps,\n} from '@ninna-ui/overlays';\nimport { XIcon } from 'lucide-react';\nimport {\n type ComponentProps,\n createContext,\n forwardRef,\n type ReactNode,\n type Ref,\n useCallback,\n useContext,\n} from 'react';\n\nimport { IconButton } from '../actions/IconButton';\nimport { useDesignSystemLabels } from '../foundations/DesignSystemProvider';\nimport { Heading, Text } from '../typography/Typography';\nimport { useModalAutoFocus } from './useModalAutoFocus';\nimport { useScrollFade } from './useScrollFade';\n\nconst ModalLoadingContext = createContext(false);\n\ninterface ModalContentPolicyProps extends Omit<ModalContentProps, 'className' | 'size' | 'title'> {\n accessibleTitle?: string;\n /** Whether opening focuses the first editable field; off while the caller focuses something else. */\n focusFirstField?: boolean;\n headerActions?: ReactNode;\n sidebar?: ReactNode;\n /** The dialog's size; a dialog with a sidebar is `paned` unless it says otherwise. */\n presentation?: 'default' | 'paned' | 'workspace';\n /** Grows the dialog to the window, less a small margin, under a 52px title bar; see ModalExpandButton. */\n expanded?: boolean;\n /** A paned dialog that keeps its width but takes its content's height, such as a short pane; a long list in it\n * scrolls inside. Expanding wins. */\n fitsContent?: boolean;\n title: string;\n}\n\n/** The expanded dialog's size, inline so it wins over every presentation's size classes. */\nconst expandedStyle = {\n width: 'calc(100vw - 2rem)',\n maxWidth: 'none',\n height: 'calc(100dvh - (52px + 1rem))',\n maxHeight: 'none',\n top: '52px',\n translate: '-50% 0',\n} as const;\n\n/** A dialog that takes its content's height, inline so it wins over the paned size classes. */\nconst fitsContentStyle = { height: 'auto' } as const;\n\nconst ModalContent = forwardRef<HTMLDivElement, ModalContentPolicyProps>(\n (\n {\n accessibleTitle,\n children,\n closeOnEscape,\n closeOnOverlayClick,\n description,\n focusFirstField,\n headerActions,\n onPointerDownOutside,\n sidebar,\n presentation = sidebar ? 'paned' : 'default',\n expanded = false,\n fitsContent = false,\n title,\n ...props\n },\n ref,\n ) => {\n const loading = useContext(ModalLoadingContext);\n const focusProps = useModalAutoFocus(focusFirstField);\n\n return (\n <NinnaModal.Content\n ref={ref}\n {...props}\n {...focusProps}\n {...(expanded\n ? { 'data-expanded': true, style: expandedStyle }\n : fitsContent && { style: fitsContentStyle })}\n title={accessibleTitle ?? title}\n description={description}\n closeOnEscape={loading ? false : closeOnEscape}\n closeOnOverlayClick={loading ? false : closeOnOverlayClick}\n onPointerDownOutside={(event) => {\n if (event.target instanceof Element && event.target.closest('[data-slot=\"toaster\"]')) {\n event.preventDefault();\n }\n\n onPointerDownOutside?.(event);\n }}\n size={presentation === 'workspace' ? 'full' : undefined}\n className={`flex max-h-[calc(100dvh-1rem)] w-[calc(100vw-1rem)] flex-col overflow-hidden sm:max-h-[calc(100dvh-2rem)] sm:w-[calc(100vw-2rem)] ${\n sidebar ? 'md:grid md:grid-cols-[14rem_minmax(0,1fr)] md:grid-rows-[auto_minmax(0,1fr)]' : ''\n } ${\n presentation === 'workspace'\n ? 'h-[calc(100dvh-1rem)] max-w-6xl sm:h-[calc(100dvh-2rem)] sm:max-w-6xl'\n : presentation === 'paned'\n ? // Paned dialogs keep one height across panes; the body scrolls instead of the dialog resizing.\n 'h-[calc(100dvh-1rem)] max-w-4xl sm:h-[min(44rem,calc(100dvh-2rem))] sm:max-w-4xl'\n : 'max-w-160 sm:max-w-160'\n }`}\n >\n <header\n data-slot=\"modal-header\"\n className={`@container min-w-0 shrink-0 px-5 pt-5 sm:px-6 sm:pt-6 ${\n description ? (sidebar ? 'pb-4 md:pb-0' : '') : 'pb-4'\n } ${sidebar ? 'md:col-start-2 md:row-start-1' : ''}`}\n >\n <div className=\"flex min-w-0 flex-wrap items-center justify-between gap-x-4 gap-y-3\">\n <Heading as=\"h2\" className=\"min-w-0 flex-1 wrap-break-word\" variant=\"section\">\n {title}\n </Heading>\n {headerActions ? (\n <div className=\"order-3 flex basis-full items-center justify-end gap-2 @min-[32rem]:order-0 @min-[32rem]:ml-auto @min-[32rem]:basis-auto\">\n {headerActions}\n </div>\n ) : null}\n <div className=\"shrink-0\">\n <ModalClose />\n </div>\n </div>\n </header>\n {sidebar ? (\n <div className=\"min-h-0 min-w-0 shrink-0 md:col-start-1 md:row-span-2 md:row-start-1\">\n {sidebar}\n </div>\n ) : null}\n <div\n className={`flex min-h-0 min-w-0 flex-1 flex-col ${sidebar ? 'md:col-start-2 md:row-start-2' : ''}`}\n >\n {description ? (\n <Text\n className={`shrink-0 px-5 pb-4 sm:px-6 ${sidebar ? 'pt-4 md:pt-2' : 'pt-2'}`}\n tone=\"muted\"\n >\n {description}\n </Text>\n ) : null}\n {children}\n </div>\n </NinnaModal.Content>\n );\n },\n);\n\nModalContent.displayName = 'Modal.Content';\n\nconst ModalBody = forwardRef<HTMLDivElement, Omit<ModalBodyProps, 'className'> & { layout?: 'scroll' | 'fill' }>(\n ({ layout = 'scroll', children, ...props }, ref: Ref<HTMLDivElement>) => {\n const { setViewport, setContent, className } = useScrollFade();\n const bodyRef = useCallback(\n (element: HTMLDivElement) => {\n setViewport(element);\n\n const cleanup = typeof ref === 'function' ? ref(element) : undefined;\n\n if (ref && typeof ref !== 'function') ref.current = element;\n\n return () => {\n setViewport(null);\n\n if (typeof cleanup === 'function') cleanup();\n else if (typeof ref === 'function') ref(null);\n else if (ref) ref.current = null;\n };\n },\n [ref, setViewport],\n );\n\n return (\n <NinnaModal.Body\n ref={bodyRef}\n {...props}\n className={`min-h-0 flex-1 overflow-y-auto overscroll-contain px-5 pt-2 pb-6 sm:px-6 ${layout === 'fill' ? 'flex flex-col' : ''} ${className}`}\n >\n <div\n ref={setContent}\n className={layout === 'fill' ? 'flex min-h-0 flex-1 flex-col gap-3' : 'flow-root'}\n >\n {children}\n </div>\n </NinnaModal.Body>\n );\n },\n);\n\nModalBody.displayName = 'Modal.Body';\n\nfunction ModalForm(props: Omit<ComponentProps<'form'>, 'className'>) {\n return <form {...props} className=\"flex min-h-0 flex-1 flex-col\" />;\n}\n\nfunction ModalPane({ active, children }: { active: boolean; children: ReactNode }) {\n return (\n <div hidden={!active} className={active ? 'flex min-h-0 flex-1 flex-col' : 'hidden'}>\n {children}\n </div>\n );\n}\n\nconst ModalFooter = forwardRef<HTMLDivElement, Omit<ModalFooterProps, 'className'> & { leading?: ReactNode }>(\n ({ leading, children, ...props }, ref) => (\n <NinnaModal.Footer\n ref={ref}\n {...props}\n className=\"border-base-300 bg-base-50/60 shrink-0 border-t px-5 py-4 sm:px-6 sm:pb-4\"\n >\n {leading ? <div className=\"mr-auto min-w-0 basis-full pb-2 sm:basis-auto sm:pb-0\">{leading}</div> : null}\n {children}\n </NinnaModal.Footer>\n ),\n);\n\nModalFooter.displayName = 'Modal.Footer';\n\nfunction ModalClose() {\n const labels = useDesignSystemLabels();\n const loading = useContext(ModalLoadingContext);\n\n return (\n <NinnaModal.Close asChild>\n <IconButton aria-label={labels.close} disabled={loading} icon={<XIcon />} variant=\"header\" />\n </NinnaModal.Close>\n );\n}\n\ninterface ModalRootPolicyProps {\n children: ReactNode;\n loading?: boolean;\n onClose: () => void;\n}\n\nfunction ModalRoot({ children, loading = false, onClose }: ModalRootPolicyProps) {\n return (\n <ModalLoadingContext.Provider value={loading}>\n <NinnaModal open onOpenChange={(open) => !open && !loading && onClose()}>\n {children}\n </NinnaModal>\n </ModalLoadingContext.Provider>\n );\n}\n\nexport const Modal = Object.assign(ModalRoot, {\n Body: ModalBody,\n Form: ModalForm,\n Pane: ModalPane,\n Content: ModalContent,\n Footer: ModalFooter,\n});\n"],"mappings":"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"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
interface ModalExpandButtonProps {
|
|
2
|
+
expanded: boolean;
|
|
3
|
+
onToggle: () => void;
|
|
4
|
+
/** The shortcut that toggles it too, as shown (⌘⇧E) and as `aria-keyshortcuts` reads it (Meta+Shift+E). */
|
|
5
|
+
shortcut?: {
|
|
6
|
+
label: string;
|
|
7
|
+
keys: string;
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The control a dialog's header shows (in Modal.Content's `headerActions`) to grow the dialog to the window and back,
|
|
12
|
+
* with its shortcut in a tooltip. The tooltip opens on hover only: a dialog that opens with no field focuses this
|
|
13
|
+
* button, and a tooltip opened by that focus would take the dialog's first Escape. `aria-keyshortcuts` still tells
|
|
14
|
+
* assistive tech the shortcut.
|
|
15
|
+
*/
|
|
16
|
+
export declare function ModalExpandButton({ expanded, onToggle, shortcut }: ModalExpandButtonProps): import("react").JSX.Element;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=ModalExpandButton.d.ts.map
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { IconButton } from "../actions/IconButton.js";
|
|
2
|
+
import { useDesignSystemLabels } from "../foundations/DesignSystemProvider.js";
|
|
3
|
+
import { Tooltip, TooltipPopup, TooltipTrigger } from "./Tooltip.js";
|
|
4
|
+
import { useState } from "react";
|
|
5
|
+
import { Maximize2Icon, Minimize2Icon } from "lucide-react";
|
|
6
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
7
|
+
// src/overlays/ModalExpandButton.tsx
|
|
8
|
+
/**
|
|
9
|
+
* The control a dialog's header shows (in Modal.Content's `headerActions`) to grow the dialog to the window and back,
|
|
10
|
+
* with its shortcut in a tooltip. The tooltip opens on hover only: a dialog that opens with no field focuses this
|
|
11
|
+
* button, and a tooltip opened by that focus would take the dialog's first Escape. `aria-keyshortcuts` still tells
|
|
12
|
+
* assistive tech the shortcut.
|
|
13
|
+
*/
|
|
14
|
+
function ModalExpandButton({ expanded, onToggle, shortcut }) {
|
|
15
|
+
const labels = useDesignSystemLabels().dialog;
|
|
16
|
+
const label = expanded ? labels.restoreSize : labels.expand;
|
|
17
|
+
const [hint, setHint] = useState(false);
|
|
18
|
+
return /* @__PURE__ */ jsxs(Tooltip, {
|
|
19
|
+
open: hint,
|
|
20
|
+
onOpenChange: (open) => setHint(open && document.querySelector("button[data-expand]:hover") !== null),
|
|
21
|
+
children: [/* @__PURE__ */ jsx(TooltipTrigger, {
|
|
22
|
+
asChild: true,
|
|
23
|
+
children: /* @__PURE__ */ jsx(IconButton, {
|
|
24
|
+
"data-expand": true,
|
|
25
|
+
variant: "header",
|
|
26
|
+
"aria-label": label,
|
|
27
|
+
"aria-pressed": expanded,
|
|
28
|
+
"aria-keyshortcuts": shortcut?.keys,
|
|
29
|
+
icon: expanded ? /* @__PURE__ */ jsx(Minimize2Icon, {}) : /* @__PURE__ */ jsx(Maximize2Icon, {}),
|
|
30
|
+
onClick: onToggle
|
|
31
|
+
})
|
|
32
|
+
}), /* @__PURE__ */ jsxs(TooltipPopup, {
|
|
33
|
+
side: "bottom",
|
|
34
|
+
children: [label, shortcut ? /* @__PURE__ */ jsx("span", {
|
|
35
|
+
className: "text-base-500 ms-2",
|
|
36
|
+
children: shortcut.label
|
|
37
|
+
}) : null]
|
|
38
|
+
})]
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
export { ModalExpandButton };
|
|
42
|
+
|
|
43
|
+
//# sourceMappingURL=ModalExpandButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ModalExpandButton.js","names":[],"sources":["../../src/overlays/ModalExpandButton.tsx"],"sourcesContent":["import { Maximize2Icon, Minimize2Icon } from 'lucide-react';\nimport { useState } from 'react';\n\nimport { IconButton } from '../actions/IconButton';\nimport { useDesignSystemLabels } from '../foundations/DesignSystemProvider';\nimport { Tooltip, TooltipPopup, TooltipTrigger } from './Tooltip';\n\ninterface ModalExpandButtonProps {\n expanded: boolean;\n onToggle: () => void;\n /** The shortcut that toggles it too, as shown (⌘⇧E) and as `aria-keyshortcuts` reads it (Meta+Shift+E). */\n shortcut?: { label: string; keys: string };\n}\n\n/**\n * The control a dialog's header shows (in Modal.Content's `headerActions`) to grow the dialog to the window and back,\n * with its shortcut in a tooltip. The tooltip opens on hover only: a dialog that opens with no field focuses this\n * button, and a tooltip opened by that focus would take the dialog's first Escape. `aria-keyshortcuts` still tells\n * assistive tech the shortcut.\n */\nexport function ModalExpandButton({ expanded, onToggle, shortcut }: ModalExpandButtonProps) {\n const labels = useDesignSystemLabels().dialog;\n const label = expanded ? labels.restoreSize : labels.expand;\n const [hint, setHint] = useState(false);\n\n return (\n <Tooltip\n open={hint}\n onOpenChange={(open) => setHint(open && document.querySelector('button[data-expand]:hover') !== null)}\n >\n <TooltipTrigger asChild>\n <IconButton\n data-expand\n variant=\"header\"\n aria-label={label}\n aria-pressed={expanded}\n aria-keyshortcuts={shortcut?.keys}\n icon={expanded ? <Minimize2Icon /> : <Maximize2Icon />}\n onClick={onToggle}\n />\n </TooltipTrigger>\n <TooltipPopup side=\"bottom\">\n {label}\n {shortcut ? <span className=\"text-base-500 ms-2\">{shortcut.label}</span> : null}\n </TooltipPopup>\n </Tooltip>\n );\n}\n"],"mappings":";;;;;;;;;;;;;AAoBA,SAAgB,kBAAkB,EAAE,UAAU,UAAU,YAAoC;CACxF,MAAM,SAAS,sBAAsB,CAAC,CAAC;CACvC,MAAM,QAAQ,WAAW,OAAO,cAAc,OAAO;CACrD,MAAM,CAAC,MAAM,WAAW,SAAS,KAAK;CAEtC,OACI,qBAAC,SAAD;EACI,MAAM;EACN,eAAe,SAAS,QAAQ,QAAQ,SAAS,cAAc,2BAA2B,MAAM,IAAI;EAFxG,UAAA,CAII,oBAAC,gBAAD;GAAgB,SAAA;GACZ,UAAA,oBAAC,YAAD;IACI,eAAA;IACA,SAAQ;IACR,cAAY;IACZ,gBAAc;IACd,qBAAmB,UAAU;IAC7B,MAAM,WAAW,oBAAC,eAAD,CAAgB,CAAA,IAAI,oBAAC,eAAD,CAAgB,CAAA;IACrD,SAAS;GACZ,CAAA;EACW,CAAA,GAChB,qBAAC,cAAD;GAAc,MAAK;GAAnB,UAAA,CACK,OACA,WAAW,oBAAC,QAAD;IAAM,WAAU;IAAsB,UAAA,SAAS;GAAY,CAAA,IAAI,IACjE;EACT,CAAA,CAAA;;AAEjB"}
|
|
@@ -5,7 +5,8 @@ interface PopoverContentPolicyProps extends Omit<PopoverContentProps, 'className
|
|
|
5
5
|
onOpenAutoFocus?: (event: Event) => void;
|
|
6
6
|
onCloseAutoFocus?: (event: Event) => void;
|
|
7
7
|
presentation?: 'default' | 'menu';
|
|
8
|
-
|
|
8
|
+
/** `sm` is 16rem and `md` 22rem, such as a chooser with a list; either stays inside the window. */
|
|
9
|
+
width?: 'content' | 'sm' | 'md' | 'trigger';
|
|
9
10
|
}
|
|
10
11
|
declare function PopoverRoot(props: ComponentProps<typeof Popover>): import("react").JSX.Element;
|
|
11
12
|
declare const Popover$1: typeof PopoverRoot & {
|
package/dist/overlays/Popover.js
CHANGED
|
@@ -5,6 +5,7 @@ import { Popover } from "@ninna-ui/overlays";
|
|
|
5
5
|
const popoverWidthClasses = {
|
|
6
6
|
content: void 0,
|
|
7
7
|
sm: "w-64",
|
|
8
|
+
md: "w-88",
|
|
8
9
|
trigger: "w-(--radix-popover-trigger-width)"
|
|
9
10
|
};
|
|
10
11
|
const PopoverContent = forwardRef(({ layout = "scroll", presentation = "default", width = "content", ...props }, ref) => /* @__PURE__ */ jsx(Popover.Content, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Popover.js","names":["NinnaPopover","Popover"],"sources":["../../src/overlays/Popover.tsx"],"sourcesContent":["/* oxlint-disable react/only-export-components -- Compound members are exported through Popover. */\n\nimport { Popover as NinnaPopover, type PopoverContentProps } from '@ninna-ui/overlays';\nimport { type ComponentProps, forwardRef } from 'react';\n\ninterface PopoverContentPolicyProps extends Omit<PopoverContentProps, 'className'> {\n layout?: 'fill' | 'scroll';\n onOpenAutoFocus?: (event: Event) => void;\n onCloseAutoFocus?: (event: Event) => void;\n presentation?: 'default' | 'menu';\n width?: 'content' | 'sm' | 'trigger';\n}\n\nconst popoverWidthClasses: Record<NonNullable<PopoverContentPolicyProps['width']>, string | undefined> = {\n content: undefined,\n sm: 'w-64',\n trigger: 'w-(--radix-popover-trigger-width)',\n};\n\nconst PopoverContent = forwardRef<HTMLDivElement, PopoverContentPolicyProps>(\n ({ layout = 'scroll', presentation = 'default', width = 'content', ...props }, ref) => (\n <NinnaPopover.Content\n ref={ref}\n {...props}\n data-layout={layout}\n className={`${popoverWidthClasses[width] ?? ''} ${presentation === 'menu' ? 'p-1' : ''}`}\n />\n ),\n);\n\nPopoverContent.displayName = 'Popover.Content';\n\nfunction PopoverRoot(props: ComponentProps<typeof NinnaPopover>) {\n return <NinnaPopover {...props} />;\n}\n\nexport const Popover = Object.assign(PopoverRoot, {\n ...NinnaPopover,\n Content: PopoverContent,\n});\n"],"mappings":";;;;
|
|
1
|
+
{"version":3,"file":"Popover.js","names":["NinnaPopover","Popover"],"sources":["../../src/overlays/Popover.tsx"],"sourcesContent":["/* oxlint-disable react/only-export-components -- Compound members are exported through Popover. */\n\nimport { Popover as NinnaPopover, type PopoverContentProps } from '@ninna-ui/overlays';\nimport { type ComponentProps, forwardRef } from 'react';\n\ninterface PopoverContentPolicyProps extends Omit<PopoverContentProps, 'className'> {\n layout?: 'fill' | 'scroll';\n onOpenAutoFocus?: (event: Event) => void;\n onCloseAutoFocus?: (event: Event) => void;\n presentation?: 'default' | 'menu';\n /** `sm` is 16rem and `md` 22rem, such as a chooser with a list; either stays inside the window. */\n width?: 'content' | 'sm' | 'md' | 'trigger';\n}\n\nconst popoverWidthClasses: Record<NonNullable<PopoverContentPolicyProps['width']>, string | undefined> = {\n content: undefined,\n sm: 'w-64',\n md: 'w-88',\n trigger: 'w-(--radix-popover-trigger-width)',\n};\n\nconst PopoverContent = forwardRef<HTMLDivElement, PopoverContentPolicyProps>(\n ({ layout = 'scroll', presentation = 'default', width = 'content', ...props }, ref) => (\n <NinnaPopover.Content\n ref={ref}\n {...props}\n data-layout={layout}\n className={`${popoverWidthClasses[width] ?? ''} ${presentation === 'menu' ? 'p-1' : ''}`}\n />\n ),\n);\n\nPopoverContent.displayName = 'Popover.Content';\n\nfunction PopoverRoot(props: ComponentProps<typeof NinnaPopover>) {\n return <NinnaPopover {...props} />;\n}\n\nexport const Popover = Object.assign(PopoverRoot, {\n ...NinnaPopover,\n Content: PopoverContent,\n});\n"],"mappings":";;;;AAcA,MAAM,sBAAmG;CACrG,SAAS,KAAA;CACT,IAAI;CACJ,IAAI;CACJ,SAAS;AACb;AAEA,MAAM,iBAAiB,YAClB,EAAE,SAAS,UAAU,eAAe,WAAW,QAAQ,WAAW,GAAG,SAAS,QAC3E,oBAACA,QAAa,SAAd;CACS;CACL,GAAI;CACJ,eAAa;CACb,WAAW,GAAG,oBAAoB,UAAU,GAAG,GAAG,iBAAiB,SAAS,QAAQ;AACvF,CAAA,CAET;AAEA,eAAe,cAAc;AAE7B,SAAS,YAAY,OAA4C;CAC7D,OAAO,oBAACA,SAAD,EAAc,GAAI,MAAQ,CAAA;AACrC;AAEA,MAAaC,YAAU,OAAO,OAAO,aAAa;CAC9C,GAAGD;CACH,SAAS;AACb,CAAC"}
|
package/dist/overlays/index.d.ts
CHANGED
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ActionModal } from "./ActionModal.js";
|
|
2
|
-
import { CommandPalette, CommandPaletteGroup, useCommandPaletteOption } from "./CommandPalette.js";
|
|
2
|
+
import { CommandPalette, CommandPaletteGroup, CommandPaletteOption, CommandPaletteToken, useCommandPaletteOption } from "./CommandPalette.js";
|
|
3
3
|
import { Drawer } from "./Drawer.js";
|
|
4
4
|
import { DropdownMenu } from "./DropdownMenu.js";
|
|
5
|
+
import { HelpTip } from "./HelpTip.js";
|
|
5
6
|
import { ImageViewer } from "./ImageViewer.js";
|
|
6
7
|
import { Modal } from "./Modal.js";
|
|
8
|
+
import { ModalExpandButton } from "./ModalExpandButton.js";
|
|
7
9
|
import { Popover } from "./Popover.js";
|
|
8
10
|
import { Tooltip, TooltipPopup, TooltipProvider, TooltipTrigger } from "./Tooltip.js";
|
|
9
|
-
export { ActionModal, CommandPalette, CommandPaletteGroup, Drawer, DropdownMenu, ImageViewer, Modal, Popover, Tooltip, TooltipPopup, TooltipProvider, TooltipTrigger, useCommandPaletteOption };
|
|
11
|
+
export { ActionModal, CommandPalette, CommandPaletteGroup, CommandPaletteOption, type CommandPaletteToken, Drawer, DropdownMenu, HelpTip, ImageViewer, Modal, ModalExpandButton, Popover, Tooltip, TooltipPopup, TooltipProvider, TooltipTrigger, useCommandPaletteOption };
|
package/dist/showcase/Cards.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { tabbable } from "../foundations/KeyboardFocus.js";
|
|
2
2
|
import { Heading, Text } from "../typography/Typography.js";
|
|
3
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
3
|
import { ArrowRightIcon } from "lucide-react";
|
|
4
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
// src/showcase/Cards.tsx
|
|
6
6
|
/** A product on the home page: its name and promise above a screenshot that runs off the card's edge. */
|
|
7
7
|
function ProductCard({ hue, icon, name, status, title, description, linkLabel, href, onNavigate, media }) {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Eyebrow } from "../layout/PageSection.js";
|
|
2
2
|
import { Heading, Text } from "../typography/Typography.js";
|
|
3
3
|
import { useId } from "react";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
import { CheckIcon } from "lucide-react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
// src/showcase/FeatureRow.tsx
|
|
7
7
|
/** A feature told in copy on one side and shown on a device on the other. */
|
|
8
8
|
function FeatureRow({ eyebrow, title, children, points, media, reverse, wide, badge, mediaWidth = "measure", largeMedia }) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
1
|
import { SearchIcon } from "lucide-react";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
3
|
// src/showcase/PhotoSearchConcept.tsx
|
|
4
4
|
/** An illustration, not a screenshot: a search over your own photo library, with the matches lit. Its label says
|
|
5
5
|
* it is a concept. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { tabbable } from "../foundations/KeyboardFocus.js";
|
|
2
2
|
import { Heading, Text } from "../typography/Typography.js";
|
|
3
3
|
import { useId } from "react";
|
|
4
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
4
|
import { ArrowRightIcon } from "lucide-react";
|
|
5
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
6
6
|
// src/showcase/ProductBand.tsx
|
|
7
7
|
/** The family of products under a hero, one compact entry each, wrapping as the family grows. */
|
|
8
8
|
function ProductIndex({ products, label, onNavigate }) {
|
package/dist/showcase/Status.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { tabbable } from "../foundations/KeyboardFocus.js";
|
|
2
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
2
|
import { ArrowRightIcon } from "lucide-react";
|
|
3
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
4
4
|
// src/showcase/Status.tsx
|
|
5
5
|
const readinessClasses = {
|
|
6
6
|
available: {
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { CodeProps } from "@ninna-ui/primitives";
|
|
2
|
+
declare const wrapping: {
|
|
3
|
+
readonly anywhere: 'break-all';
|
|
4
|
+
readonly never: 'whitespace-nowrap';
|
|
5
|
+
};
|
|
6
|
+
type CodeProps$1 = CodeProps & {
|
|
7
|
+
/** A path or command inside a sentence, in the page's plain inline code with no chip: a path may break `anywhere`,
|
|
8
|
+
* a command `never`. Without it, the code chip. */
|
|
9
|
+
wrap?: keyof typeof wrapping;
|
|
10
|
+
};
|
|
11
|
+
/** Inline code: ninna-ui's code chip, or with `wrap`, plain inline code that breaks anywhere or never. */
|
|
12
|
+
declare const Code$1: import("react").ForwardRefExoticComponent<CodeProps & {
|
|
13
|
+
/** A path or command inside a sentence, in the page's plain inline code with no chip: a path may break `anywhere`,
|
|
14
|
+
* a command `never`. Without it, the code chip. */
|
|
15
|
+
wrap?: keyof typeof wrapping;
|
|
16
|
+
} & import("react").RefAttributes<HTMLElement>>;
|
|
17
|
+
export { Code$1 as Code, CodeProps$1 as CodeProps };
|
|
18
|
+
//# sourceMappingURL=Code.d.ts.map
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Code } from "@ninna-ui/primitives";
|
|
2
|
+
import { forwardRef } from "react";
|
|
3
|
+
import { jsx } from "react/jsx-runtime";
|
|
4
|
+
// src/typography/Code.tsx
|
|
5
|
+
const wrapping = {
|
|
6
|
+
anywhere: "break-all",
|
|
7
|
+
never: "whitespace-nowrap"
|
|
8
|
+
};
|
|
9
|
+
/** Inline code: ninna-ui's code chip, or with `wrap`, plain inline code that breaks anywhere or never. */
|
|
10
|
+
const Code$1 = forwardRef(({ wrap, ...props }, ref) => {
|
|
11
|
+
if (wrap) return /* @__PURE__ */ jsx("code", {
|
|
12
|
+
ref,
|
|
13
|
+
className: wrapping[wrap],
|
|
14
|
+
children: props.children
|
|
15
|
+
});
|
|
16
|
+
return /* @__PURE__ */ jsx(Code, {
|
|
17
|
+
ref,
|
|
18
|
+
...props
|
|
19
|
+
});
|
|
20
|
+
});
|
|
21
|
+
Code$1.displayName = "Code";
|
|
22
|
+
export { Code$1 as Code };
|
|
23
|
+
|
|
24
|
+
//# sourceMappingURL=Code.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Code.js","names":["Code","NinnaCode"],"sources":["../../src/typography/Code.tsx"],"sourcesContent":["import { Code as NinnaCode, type CodeProps as NinnaCodeProps } from '@ninna-ui/primitives';\nimport { forwardRef } from 'react';\n\nconst wrapping = { anywhere: 'break-all', never: 'whitespace-nowrap' } as const;\n\nexport type CodeProps = NinnaCodeProps & {\n /** A path or command inside a sentence, in the page's plain inline code with no chip: a path may break `anywhere`,\n * a command `never`. Without it, the code chip. */\n wrap?: keyof typeof wrapping;\n};\n\n/** Inline code: ninna-ui's code chip, or with `wrap`, plain inline code that breaks anywhere or never. */\nexport const Code = forwardRef<HTMLElement, CodeProps>(({ wrap, ...props }, ref) => {\n if (wrap)\n return (\n <code ref={ref} className={wrapping[wrap]}>\n {props.children}\n </code>\n );\n\n return <NinnaCode ref={ref} {...props} />;\n});\n\nCode.displayName = 'Code';\n"],"mappings":";;;;AAGA,MAAM,WAAW;CAAE,UAAU;CAAa,OAAO;AAAoB;;AASrE,MAAaA,SAAO,YAAoC,EAAE,MAAM,GAAG,SAAS,QAAQ;CAChF,IAAI,MACA,OACI,oBAAC,QAAD;EAAW;EAAK,WAAW,SAAS;EAC/B,UAAA,MAAM;CACL,CAAA;CAGd,OAAO,oBAACC,MAAD;EAAgB;EAAK,GAAI;CAAQ,CAAA;AAC5C,CAAC;AAED,OAAK,cAAc"}
|
|
@@ -12,10 +12,15 @@ declare const Link$1: import("react").ForwardRefExoticComponent<Omit<LinkProps,
|
|
|
12
12
|
variant?: 'body' | 'caption';
|
|
13
13
|
onNavigate?: (href: string) => void;
|
|
14
14
|
} & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
15
|
-
/** A link inside running text or a note: the surrounding size and colour, underlined.
|
|
16
|
-
|
|
15
|
+
/** A link inside running text or a note: the surrounding size and colour, underlined. With `onClick` in place of
|
|
16
|
+
* `href` it is a button with the same look, such as "Change" after what was kept, and can be `disabled`. */
|
|
17
|
+
export declare function InlineLink(props: {
|
|
17
18
|
href: string;
|
|
18
19
|
children?: ReactNode;
|
|
20
|
+
} | {
|
|
21
|
+
onClick: () => void;
|
|
22
|
+
disabled?: boolean | undefined;
|
|
23
|
+
children?: ReactNode;
|
|
19
24
|
}): import("react").JSX.Element;
|
|
20
25
|
export { Link$1 as Link, LinkBox$1 as LinkBox, LinkOverlay$1 as LinkOverlay, LinkOverlayProps$1 as LinkOverlayProps, LinkProps$1 as LinkProps };
|
|
21
26
|
//# sourceMappingURL=Link.d.ts.map
|
package/dist/typography/Link.js
CHANGED
|
@@ -44,15 +44,25 @@ function navigationClick({ href, onNavigate, onClick, external, target, download
|
|
|
44
44
|
onNavigate(href);
|
|
45
45
|
};
|
|
46
46
|
}
|
|
47
|
-
|
|
48
|
-
|
|
47
|
+
const inline = "focus-visible:outline-primary text-inherit underline decoration-current/40 underline-offset-2 transition-colors hover:decoration-current focus-visible:outline-2";
|
|
48
|
+
/** A link inside running text or a note: the surrounding size and colour, underlined. With `onClick` in place of
|
|
49
|
+
* `href` it is a button with the same look, such as "Change" after what was kept, and can be `disabled`. */
|
|
50
|
+
function InlineLink(props) {
|
|
51
|
+
if ("onClick" in props) return /* @__PURE__ */ jsx("button", {
|
|
52
|
+
...tabbable,
|
|
53
|
+
type: "button",
|
|
54
|
+
disabled: props.disabled,
|
|
55
|
+
onClick: props.onClick,
|
|
56
|
+
className: inline,
|
|
57
|
+
children: props.children
|
|
58
|
+
});
|
|
49
59
|
return /* @__PURE__ */ jsx("a", {
|
|
50
60
|
...tabbable,
|
|
51
|
-
href,
|
|
61
|
+
href: props.href,
|
|
52
62
|
target: "_blank",
|
|
53
63
|
rel: "noreferrer",
|
|
54
|
-
className:
|
|
55
|
-
children
|
|
64
|
+
className: inline,
|
|
65
|
+
children: props.children
|
|
56
66
|
});
|
|
57
67
|
}
|
|
58
68
|
export { InlineLink, Link$1 as Link, LinkBox$1 as LinkBox, LinkOverlay$1 as LinkOverlay };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Link.js","names":["LinkBox","NinnaLinkBox","LinkOverlay","NinnaLinkOverlay","Link","NinnaLink"],"sources":["../../src/typography/Link.tsx"],"sourcesContent":["import {\n Link as NinnaLink,\n LinkBox as NinnaLinkBox,\n type LinkBoxProps,\n LinkOverlay as NinnaLinkOverlay,\n type LinkOverlayProps as NinnaLinkOverlayProps,\n type LinkProps as NinnaLinkProps,\n} from '@ninna-ui/primitives';\nimport { forwardRef, type ReactNode } from 'react';\n\nimport { tabbable } from '../foundations/KeyboardFocus';\n\nexport type LinkProps = Omit<NinnaLinkProps, 'size' | 'color'> & {\n variant?: 'body' | 'caption';\n onNavigate?: (href: string) => void;\n};\n\nexport type LinkOverlayProps = NinnaLinkOverlayProps & Pick<LinkProps, 'onNavigate'>;\n\n/** Keep secondary links and buttons above the stretched primary link or action. */\nexport function LinkBox({ className = '', ...props }: LinkBoxProps) {\n return (\n <NinnaLinkBox\n {...props}\n className={`isolate [&_:is(a,button):not([data-slot=link-overlay]):not([data-slot=action-overlay])]:relative [&_:is(a,button):not([data-slot=link-overlay]):not([data-slot=action-overlay])]:z-10 ${className}`}\n />\n );\n}\n\nexport const LinkOverlay = forwardRef<HTMLAnchorElement, LinkOverlayProps>(\n ({ onNavigate, onClick, className = '', ...props }, ref) => (\n <NinnaLinkOverlay\n {...tabbable}\n {...props}\n ref={ref}\n className={`focus-visible:before:outline-primary before:z-1 before:rounded-[inherit] focus-visible:outline-none focus-visible:before:outline-2 focus-visible:before:-outline-offset-2 ${className}`}\n onClick={navigationClick({ ...props, onClick, onNavigate })}\n />\n ),\n);\n\nLinkOverlay.displayName = 'LinkOverlay';\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(\n ({ variant = 'body', onNavigate, onClick, ...props }, ref) => (\n <NinnaLink\n {...tabbable}\n {...props}\n ref={ref}\n size={variant === 'caption' ? 'xs' : 'sm'}\n underline=\"hover\"\n onClick={navigationClick({ ...props, onClick, onNavigate })}\n />\n ),\n);\n\nLink.displayName = 'Link';\n\nfunction navigationClick({\n href,\n onNavigate,\n onClick,\n external,\n target,\n download,\n}: LinkOverlayProps): LinkProps['onClick'] {\n return (event) => {\n if (onNavigate) event.stopPropagation();\n\n onClick?.(event);\n\n if (\n !onNavigate ||\n !href ||\n event.defaultPrevented ||\n event.button !== 0 ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey ||\n external ||\n (target && target !== '_self') ||\n (download !== undefined && download !== false)\n )\n return;\n\n event.preventDefault();\n onNavigate(href);\n };\n}\n\n/** A link inside running text or a note: the surrounding size and colour, underlined. */\nexport function InlineLink({ href
|
|
1
|
+
{"version":3,"file":"Link.js","names":["LinkBox","NinnaLinkBox","LinkOverlay","NinnaLinkOverlay","Link","NinnaLink"],"sources":["../../src/typography/Link.tsx"],"sourcesContent":["import {\n Link as NinnaLink,\n LinkBox as NinnaLinkBox,\n type LinkBoxProps,\n LinkOverlay as NinnaLinkOverlay,\n type LinkOverlayProps as NinnaLinkOverlayProps,\n type LinkProps as NinnaLinkProps,\n} from '@ninna-ui/primitives';\nimport { forwardRef, type ReactNode } from 'react';\n\nimport { tabbable } from '../foundations/KeyboardFocus';\n\nexport type LinkProps = Omit<NinnaLinkProps, 'size' | 'color'> & {\n variant?: 'body' | 'caption';\n onNavigate?: (href: string) => void;\n};\n\nexport type LinkOverlayProps = NinnaLinkOverlayProps & Pick<LinkProps, 'onNavigate'>;\n\n/** Keep secondary links and buttons above the stretched primary link or action. */\nexport function LinkBox({ className = '', ...props }: LinkBoxProps) {\n return (\n <NinnaLinkBox\n {...props}\n className={`isolate [&_:is(a,button):not([data-slot=link-overlay]):not([data-slot=action-overlay])]:relative [&_:is(a,button):not([data-slot=link-overlay]):not([data-slot=action-overlay])]:z-10 ${className}`}\n />\n );\n}\n\nexport const LinkOverlay = forwardRef<HTMLAnchorElement, LinkOverlayProps>(\n ({ onNavigate, onClick, className = '', ...props }, ref) => (\n <NinnaLinkOverlay\n {...tabbable}\n {...props}\n ref={ref}\n className={`focus-visible:before:outline-primary before:z-1 before:rounded-[inherit] focus-visible:outline-none focus-visible:before:outline-2 focus-visible:before:-outline-offset-2 ${className}`}\n onClick={navigationClick({ ...props, onClick, onNavigate })}\n />\n ),\n);\n\nLinkOverlay.displayName = 'LinkOverlay';\n\nexport const Link = forwardRef<HTMLAnchorElement, LinkProps>(\n ({ variant = 'body', onNavigate, onClick, ...props }, ref) => (\n <NinnaLink\n {...tabbable}\n {...props}\n ref={ref}\n size={variant === 'caption' ? 'xs' : 'sm'}\n underline=\"hover\"\n onClick={navigationClick({ ...props, onClick, onNavigate })}\n />\n ),\n);\n\nLink.displayName = 'Link';\n\nfunction navigationClick({\n href,\n onNavigate,\n onClick,\n external,\n target,\n download,\n}: LinkOverlayProps): LinkProps['onClick'] {\n return (event) => {\n if (onNavigate) event.stopPropagation();\n\n onClick?.(event);\n\n if (\n !onNavigate ||\n !href ||\n event.defaultPrevented ||\n event.button !== 0 ||\n event.metaKey ||\n event.ctrlKey ||\n event.shiftKey ||\n event.altKey ||\n external ||\n (target && target !== '_self') ||\n (download !== undefined && download !== false)\n )\n return;\n\n event.preventDefault();\n onNavigate(href);\n };\n}\n\nconst inline =\n 'focus-visible:outline-primary text-inherit underline decoration-current/40 underline-offset-2 transition-colors hover:decoration-current focus-visible:outline-2';\n\n/** A link inside running text or a note: the surrounding size and colour, underlined. With `onClick` in place of\n * `href` it is a button with the same look, such as \"Change\" after what was kept, and can be `disabled`. */\nexport function InlineLink(\n props:\n | { href: string; children?: ReactNode }\n | { onClick: () => void; disabled?: boolean | undefined; children?: ReactNode },\n) {\n if ('onClick' in props)\n return (\n <button {...tabbable} type=\"button\" disabled={props.disabled} onClick={props.onClick} className={inline}>\n {props.children}\n </button>\n );\n\n return (\n <a {...tabbable} href={props.href} target=\"_blank\" rel=\"noreferrer\" className={inline}>\n {props.children}\n </a>\n );\n}\n"],"mappings":";;;;;;AAoBA,SAAgBA,UAAQ,EAAE,YAAY,IAAI,GAAG,SAAuB;CAChE,OACI,oBAACC,SAAD;EACI,GAAI;EACJ,WAAW,yLAAyL;CACvM,CAAA;AAET;AAEA,MAAaC,gBAAc,YACtB,EAAE,YAAY,SAAS,YAAY,IAAI,GAAG,SAAS,QAChD,oBAACC,aAAD;CACI,GAAI;CACJ,GAAI;CACC;CACL,WAAW,6KAA6K;CACxL,SAAS,gBAAgB;EAAE,GAAG;EAAO;EAAS;CAAW,CAAC;AAC7D,CAAA,CAET;AAEA,cAAY,cAAc;AAE1B,MAAaC,SAAO,YACf,EAAE,UAAU,QAAQ,YAAY,SAAS,GAAG,SAAS,QAClD,oBAACC,MAAD;CACI,GAAI;CACJ,GAAI;CACC;CACL,MAAM,YAAY,YAAY,OAAO;CACrC,WAAU;CACV,SAAS,gBAAgB;EAAE,GAAG;EAAO;EAAS;CAAW,CAAC;AAC7D,CAAA,CAET;AAEA,OAAK,cAAc;AAEnB,SAAS,gBAAgB,EACrB,MACA,YACA,SACA,UACA,QACA,YACuC;CACvC,QAAQ,UAAU;EACd,IAAI,YAAY,MAAM,gBAAgB;EAEtC,UAAU,KAAK;EAEf,IACI,CAAC,cACD,CAAC,QACD,MAAM,oBACN,MAAM,WAAW,KACjB,MAAM,WACN,MAAM,WACN,MAAM,YACN,MAAM,UACN,YACC,UAAU,WAAW,WACrB,aAAa,KAAA,KAAa,aAAa,OAExC;EAEJ,MAAM,eAAe;EACrB,WAAW,IAAI;CACnB;AACJ;AAEA,MAAM,SACF;;;AAIJ,SAAgB,WACZ,OAGF;CACE,IAAI,aAAa,OACb,OACI,oBAAC,UAAD;EAAQ,GAAI;EAAU,MAAK;EAAS,UAAU,MAAM;EAAU,SAAS,MAAM;EAAS,WAAW;EAC5F,UAAA,MAAM;CACH,CAAA;CAGhB,OACI,oBAAC,KAAD;EAAG,GAAI;EAAU,MAAM,MAAM;EAAM,QAAO;EAAS,KAAI;EAAa,WAAW;EAC1E,UAAA,MAAM;CACR,CAAA;AAEX"}
|