@misoto22/folio 0.0.0 → 0.17.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/AGENTS.md +88 -0
- package/CLAUDE.md +1 -0
- package/LICENSE +21 -0
- package/README.md +208 -2
- package/bin/folio-design.mjs +277 -0
- package/bin/migrate-legacy.mjs +81 -0
- package/dist/agent/Accordion.md +65 -0
- package/dist/agent/Actions.md +49 -0
- package/dist/agent/Alert.md +65 -0
- package/dist/agent/AppShell.md +69 -0
- package/dist/agent/ArchitectureFigure.md +72 -0
- package/dist/agent/AreaChart.md +94 -0
- package/dist/agent/Article.md +65 -0
- package/dist/agent/AspectRatio.md +58 -0
- package/dist/agent/Avatar.md +53 -0
- package/dist/agent/Badge.md +62 -0
- package/dist/agent/BarChart.md +93 -0
- package/dist/agent/BarList.md +67 -0
- package/dist/agent/BigNumber.md +70 -0
- package/dist/agent/BoxPlot.md +82 -0
- package/dist/agent/Breadcrumb.md +55 -0
- package/dist/agent/BulletChart.md +71 -0
- package/dist/agent/Button.md +81 -0
- package/dist/agent/Calendar.md +77 -0
- package/dist/agent/CalendarHeatmap.md +75 -0
- package/dist/agent/Card.md +72 -0
- package/dist/agent/Checkbox.md +57 -0
- package/dist/agent/Code.md +51 -0
- package/dist/agent/CodeBlock.md +77 -0
- package/dist/agent/Collapsible.md +68 -0
- package/dist/agent/Collection.md +169 -0
- package/dist/agent/ColorPicker.md +76 -0
- package/dist/agent/Combobox.md +77 -0
- package/dist/agent/Command.md +122 -0
- package/dist/agent/ComposedChart.md +82 -0
- package/dist/agent/Contact.md +90 -0
- package/dist/agent/Content.md +70 -0
- package/dist/agent/ContextMenu.md +93 -0
- package/dist/agent/Conversation.md +247 -0
- package/dist/agent/DataflowFigure.md +49 -0
- package/dist/agent/DatePicker.md +104 -0
- package/dist/agent/DescriptionList.md +69 -0
- package/dist/agent/Diagram.md +71 -0
- package/dist/agent/DiagramCanvas.md +71 -0
- package/dist/agent/DiagramExportMenu.md +65 -0
- package/dist/agent/DiagramInspector.md +73 -0
- package/dist/agent/DiagramLegend.md +56 -0
- package/dist/agent/DiagramMinimap.md +69 -0
- package/dist/agent/DiagramToolbar.md +70 -0
- package/dist/agent/Dialog.md +76 -0
- package/dist/agent/DropdownMenu.md +110 -0
- package/dist/agent/EmptyState.md +63 -0
- package/dist/agent/ErrorState.md +67 -0
- package/dist/agent/Evidence.md +165 -0
- package/dist/agent/Facet.md +107 -0
- package/dist/agent/Field.md +79 -0
- package/dist/agent/FigureBand.md +49 -0
- package/dist/agent/FloatingIconButton.md +61 -0
- package/dist/agent/FunnelChart.md +75 -0
- package/dist/agent/Heading.md +65 -0
- package/dist/agent/Heatmap.md +78 -0
- package/dist/agent/Histogram.md +88 -0
- package/dist/agent/Input.md +52 -0
- package/dist/agent/Kbd.md +48 -0
- package/dist/agent/LifecycleFigure.md +50 -0
- package/dist/agent/LineChart.md +85 -0
- package/dist/agent/LinkArrow.md +49 -0
- package/dist/agent/Markdown.md +69 -0
- package/dist/agent/Media.md +261 -0
- package/dist/agent/Metric.md +70 -0
- package/dist/agent/Metrics.md +114 -0
- package/dist/agent/Music.md +86 -0
- package/dist/agent/NativeSelect.md +62 -0
- package/dist/agent/NavItem.md +56 -0
- package/dist/agent/NumberField.md +73 -0
- package/dist/agent/PageHeader.md +69 -0
- package/dist/agent/Pagination.md +70 -0
- package/dist/agent/PieChart.md +80 -0
- package/dist/agent/Popover.md +80 -0
- package/dist/agent/Portfolio.md +93 -0
- package/dist/agent/PortfolioIndex.md +34 -0
- package/dist/agent/Progress.md +58 -0
- package/dist/agent/RadarChart.md +79 -0
- package/dist/agent/RadialChart.md +81 -0
- package/dist/agent/RadioGroup.md +66 -0
- package/dist/agent/Reading.md +233 -0
- package/dist/agent/Recovery.md +72 -0
- package/dist/agent/SankeyChart.md +85 -0
- package/dist/agent/ScatterChart.md +80 -0
- package/dist/agent/ScrollArea.md +62 -0
- package/dist/agent/SearchPalette.md +51 -0
- package/dist/agent/SearchableMenu.md +69 -0
- package/dist/agent/Select.md +102 -0
- package/dist/agent/Separator.md +60 -0
- package/dist/agent/SequenceFigure.md +51 -0
- package/dist/agent/Sheet.md +82 -0
- package/dist/agent/Sidebar.md +194 -0
- package/dist/agent/SiteNavigation.md +62 -0
- package/dist/agent/SiteShell.md +67 -0
- package/dist/agent/Skeleton.md +96 -0
- package/dist/agent/Slider.md +67 -0
- package/dist/agent/Sparkline.md +68 -0
- package/dist/agent/Spinner.md +62 -0
- package/dist/agent/StatusDot.md +56 -0
- package/dist/agent/StatusPill.md +55 -0
- package/dist/agent/Steps.md +68 -0
- package/dist/agent/Switch.md +50 -0
- package/dist/agent/Table.md +111 -0
- package/dist/agent/Tabs.md +71 -0
- package/dist/agent/Tag.md +67 -0
- package/dist/agent/Text.md +66 -0
- package/dist/agent/Textarea.md +46 -0
- package/dist/agent/Timeline.md +114 -0
- package/dist/agent/Timestamp.md +65 -0
- package/dist/agent/Toast.md +51 -0
- package/dist/agent/ToggleGroup.md +67 -0
- package/dist/agent/Toolbar.md +72 -0
- package/dist/agent/Tooltip.md +74 -0
- package/dist/agent/TreemapChart.md +76 -0
- package/dist/agent/WaterfallChart.md +86 -0
- package/dist/agent/Workbench.md +142 -0
- package/dist/agent/WorkflowFigure.md +51 -0
- package/dist/agent/catalog.json +8055 -0
- package/dist/agent/index.md +185 -0
- package/dist/article.css +407 -0
- package/dist/charts/AreaChart/AreaChart.d.ts +198 -0
- package/dist/charts/AreaChart/AreaChart.js +479 -0
- package/dist/charts/AreaChart/AreaChart.js.map +1 -0
- package/dist/charts/BarChart/BarChart.d.ts +190 -0
- package/dist/charts/BarChart/BarChart.js +599 -0
- package/dist/charts/BarChart/BarChart.js.map +1 -0
- package/dist/charts/BarList/BarList.d.ts +65 -0
- package/dist/charts/BarList/BarList.js +79 -0
- package/dist/charts/BarList/BarList.js.map +1 -0
- package/dist/charts/BigNumber/BigNumber.d.ts +72 -0
- package/dist/charts/BigNumber/BigNumber.js +51 -0
- package/dist/charts/BigNumber/BigNumber.js.map +1 -0
- package/dist/charts/BoxPlot/BoxPlot.d.ts +177 -0
- package/dist/charts/BoxPlot/BoxPlot.js +497 -0
- package/dist/charts/BoxPlot/BoxPlot.js.map +1 -0
- package/dist/charts/BulletChart/BulletChart.d.ts +100 -0
- package/dist/charts/BulletChart/BulletChart.js +197 -0
- package/dist/charts/BulletChart/BulletChart.js.map +1 -0
- package/dist/charts/CalendarHeatmap/CalendarHeatmap.d.ts +106 -0
- package/dist/charts/CalendarHeatmap/CalendarHeatmap.js +103 -0
- package/dist/charts/CalendarHeatmap/CalendarHeatmap.js.map +1 -0
- package/dist/charts/ComposedChart/ComposedChart.d.ts +178 -0
- package/dist/charts/ComposedChart/ComposedChart.js +667 -0
- package/dist/charts/ComposedChart/ComposedChart.js.map +1 -0
- package/dist/charts/Facet/Facet.d.ts +240 -0
- package/dist/charts/Facet/Facet.js +133 -0
- package/dist/charts/Facet/Facet.js.map +1 -0
- package/dist/charts/Facet/panels.d.ts +187 -0
- package/dist/charts/Facet/panels.js +203 -0
- package/dist/charts/Facet/panels.js.map +1 -0
- package/dist/charts/FunnelChart/FunnelChart.d.ts +106 -0
- package/dist/charts/FunnelChart/FunnelChart.js +137 -0
- package/dist/charts/FunnelChart/FunnelChart.js.map +1 -0
- package/dist/charts/Heatmap/Heatmap.d.ts +101 -0
- package/dist/charts/Heatmap/Heatmap.js +125 -0
- package/dist/charts/Heatmap/Heatmap.js.map +1 -0
- package/dist/charts/Histogram/Histogram.d.ts +188 -0
- package/dist/charts/Histogram/Histogram.js +382 -0
- package/dist/charts/Histogram/Histogram.js.map +1 -0
- package/dist/charts/LineChart/LineChart.d.ts +174 -0
- package/dist/charts/LineChart/LineChart.js +485 -0
- package/dist/charts/LineChart/LineChart.js.map +1 -0
- package/dist/charts/PieChart/PieChart.d.ts +140 -0
- package/dist/charts/PieChart/PieChart.js +317 -0
- package/dist/charts/PieChart/PieChart.js.map +1 -0
- package/dist/charts/RadarChart/RadarChart.d.ts +135 -0
- package/dist/charts/RadarChart/RadarChart.js +303 -0
- package/dist/charts/RadarChart/RadarChart.js.map +1 -0
- package/dist/charts/RadialChart/RadialChart.d.ts +142 -0
- package/dist/charts/RadialChart/RadialChart.js +279 -0
- package/dist/charts/RadialChart/RadialChart.js.map +1 -0
- package/dist/charts/SankeyChart/SankeyChart.d.ts +149 -0
- package/dist/charts/SankeyChart/SankeyChart.js +509 -0
- package/dist/charts/SankeyChart/SankeyChart.js.map +1 -0
- package/dist/charts/ScatterChart/ScatterChart.d.ts +149 -0
- package/dist/charts/ScatterChart/ScatterChart.js +275 -0
- package/dist/charts/ScatterChart/ScatterChart.js.map +1 -0
- package/dist/charts/Sparkline/Sparkline.d.ts +53 -0
- package/dist/charts/Sparkline/Sparkline.js +95 -0
- package/dist/charts/Sparkline/Sparkline.js.map +1 -0
- package/dist/charts/TreemapChart/TreemapChart.d.ts +98 -0
- package/dist/charts/TreemapChart/TreemapChart.js +127 -0
- package/dist/charts/TreemapChart/TreemapChart.js.map +1 -0
- package/dist/charts/WaterfallChart/WaterfallChart.d.ts +164 -0
- package/dist/charts/WaterfallChart/WaterfallChart.js +321 -0
- package/dist/charts/WaterfallChart/WaterfallChart.js.map +1 -0
- package/dist/charts/index.d.ts +43 -0
- package/dist/charts/index.js +130 -0
- package/dist/charts/index.js.map +1 -0
- package/dist/charts/lib/annotations.d.ts +103 -0
- package/dist/charts/lib/annotations.js +99 -0
- package/dist/charts/lib/annotations.js.map +1 -0
- package/dist/charts/lib/axis.d.ts +18 -0
- package/dist/charts/lib/axis.js +21 -0
- package/dist/charts/lib/axis.js.map +1 -0
- package/dist/charts/lib/background.d.ts +33 -0
- package/dist/charts/lib/background.js +173 -0
- package/dist/charts/lib/background.js.map +1 -0
- package/dist/charts/lib/brush.d.ts +94 -0
- package/dist/charts/lib/brush.js +535 -0
- package/dist/charts/lib/brush.js.map +1 -0
- package/dist/charts/lib/chart.d.ts +94 -0
- package/dist/charts/lib/chart.js +149 -0
- package/dist/charts/lib/chart.js.map +1 -0
- package/dist/charts/lib/dot.d.ts +29 -0
- package/dist/charts/lib/dot.js +78 -0
- package/dist/charts/lib/dot.js.map +1 -0
- package/dist/charts/lib/empty.d.ts +31 -0
- package/dist/charts/lib/empty.js +24 -0
- package/dist/charts/lib/empty.js.map +1 -0
- package/dist/charts/lib/export.d.ts +94 -0
- package/dist/charts/lib/export.js +62 -0
- package/dist/charts/lib/export.js.map +1 -0
- package/dist/charts/lib/figure.d.ts +81 -0
- package/dist/charts/lib/figure.js +62 -0
- package/dist/charts/lib/figure.js.map +1 -0
- package/dist/charts/lib/format.d.ts +46 -0
- package/dist/charts/lib/format.js +56 -0
- package/dist/charts/lib/format.js.map +1 -0
- package/dist/charts/lib/legend.d.ts +45 -0
- package/dist/charts/lib/legend.js +117 -0
- package/dist/charts/lib/legend.js.map +1 -0
- package/dist/charts/lib/loading.d.ts +48 -0
- package/dist/charts/lib/loading.js +105 -0
- package/dist/charts/lib/loading.js.map +1 -0
- package/dist/charts/lib/paint.d.ts +154 -0
- package/dist/charts/lib/paint.js +551 -0
- package/dist/charts/lib/paint.js.map +1 -0
- package/dist/charts/lib/scale.d.ts +23 -0
- package/dist/charts/lib/scale.js +13 -0
- package/dist/charts/lib/scale.js.map +1 -0
- package/dist/charts/lib/selection.d.ts +20 -0
- package/dist/charts/lib/selection.js +18 -0
- package/dist/charts/lib/selection.js.map +1 -0
- package/dist/charts/lib/sonify-control.d.ts +163 -0
- package/dist/charts/lib/sonify-control.js +172 -0
- package/dist/charts/lib/sonify-control.js.map +1 -0
- package/dist/charts/lib/sonify.d.ts +248 -0
- package/dist/charts/lib/sonify.js +262 -0
- package/dist/charts/lib/sonify.js.map +1 -0
- package/dist/charts/lib/toolbar.d.ts +144 -0
- package/dist/charts/lib/toolbar.js +156 -0
- package/dist/charts/lib/toolbar.js.map +1 -0
- package/dist/charts/lib/tooltip.d.ts +59 -0
- package/dist/charts/lib/tooltip.js +135 -0
- package/dist/charts/lib/tooltip.js.map +1 -0
- package/dist/charts/lib/values.d.ts +56 -0
- package/dist/charts/lib/values.js +71 -0
- package/dist/charts/lib/values.js.map +1 -0
- package/dist/charts/lib/zoom.d.ts +139 -0
- package/dist/charts/lib/zoom.js +314 -0
- package/dist/charts/lib/zoom.js.map +1 -0
- package/dist/components/Accordion/Accordion.d.ts +34 -0
- package/dist/components/Accordion/Accordion.js +43 -0
- package/dist/components/Accordion/Accordion.js.map +1 -0
- package/dist/components/Alert/Alert.d.ts +32 -0
- package/dist/components/Alert/Alert.js +49 -0
- package/dist/components/Alert/Alert.js.map +1 -0
- package/dist/components/AppShell/AppShell.d.ts +58 -0
- package/dist/components/AppShell/AppShell.js +126 -0
- package/dist/components/AppShell/AppShell.js.map +1 -0
- package/dist/components/Article/Article.d.ts +58 -0
- package/dist/components/Article/Article.js +34 -0
- package/dist/components/Article/Article.js.map +1 -0
- package/dist/components/AspectRatio/AspectRatio.d.ts +46 -0
- package/dist/components/AspectRatio/AspectRatio.js +33 -0
- package/dist/components/AspectRatio/AspectRatio.js.map +1 -0
- package/dist/components/Avatar/Avatar.d.ts +38 -0
- package/dist/components/Avatar/Avatar.js +44 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Badge/Badge.d.ts +30 -0
- package/dist/components/Badge/Badge.js +29 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Breadcrumb/Breadcrumb.d.ts +37 -0
- package/dist/components/Breadcrumb/Breadcrumb.js +46 -0
- package/dist/components/Breadcrumb/Breadcrumb.js.map +1 -0
- package/dist/components/Button/Button.d.ts +70 -0
- package/dist/components/Button/Button.js +95 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Calendar/Calendar.d.ts +54 -0
- package/dist/components/Calendar/Calendar.js +369 -0
- package/dist/components/Calendar/Calendar.js.map +1 -0
- package/dist/components/Card/Card.d.ts +55 -0
- package/dist/components/Card/Card.js +64 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Checkbox/Checkbox.d.ts +26 -0
- package/dist/components/Checkbox/Checkbox.js +34 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Code/Code.d.ts +30 -0
- package/dist/components/Code/Code.js +21 -0
- package/dist/components/Code/Code.js.map +1 -0
- package/dist/components/CodeBlock/CodeBlock.d.ts +145 -0
- package/dist/components/CodeBlock/CodeBlock.js +114 -0
- package/dist/components/CodeBlock/CodeBlock.js.map +1 -0
- package/dist/components/Collapsible/Collapsible.d.ts +45 -0
- package/dist/components/Collapsible/Collapsible.js +60 -0
- package/dist/components/Collapsible/Collapsible.js.map +1 -0
- package/dist/components/ColorPicker/ColorPicker.d.ts +67 -0
- package/dist/components/ColorPicker/ColorPicker.js +334 -0
- package/dist/components/ColorPicker/ColorPicker.js.map +1 -0
- package/dist/components/Combobox/Combobox.d.ts +77 -0
- package/dist/components/Combobox/Combobox.js +170 -0
- package/dist/components/Combobox/Combobox.js.map +1 -0
- package/dist/components/Command/Command.d.ts +125 -0
- package/dist/components/Command/Command.js +204 -0
- package/dist/components/Command/Command.js.map +1 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +63 -0
- package/dist/components/ContextMenu/ContextMenu.js +109 -0
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -0
- package/dist/components/DatePicker/DatePicker.d.ts +130 -0
- package/dist/components/DatePicker/DatePicker.js +257 -0
- package/dist/components/DatePicker/DatePicker.js.map +1 -0
- package/dist/components/DescriptionList/DescriptionList.d.ts +73 -0
- package/dist/components/DescriptionList/DescriptionList.js +35 -0
- package/dist/components/DescriptionList/DescriptionList.js.map +1 -0
- package/dist/components/Diagram/Diagram.d.ts +86 -0
- package/dist/components/Diagram/Diagram.js +211 -0
- package/dist/components/Diagram/Diagram.js.map +1 -0
- package/dist/components/Dialog/Dialog.d.ts +63 -0
- package/dist/components/Dialog/Dialog.js +90 -0
- package/dist/components/Dialog/Dialog.js.map +1 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +87 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +120 -0
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -0
- package/dist/components/EmptyState/EmptyState.d.ts +55 -0
- package/dist/components/EmptyState/EmptyState.js +32 -0
- package/dist/components/EmptyState/EmptyState.js.map +1 -0
- package/dist/components/ErrorState/ErrorState.d.ts +55 -0
- package/dist/components/ErrorState/ErrorState.js +41 -0
- package/dist/components/ErrorState/ErrorState.js.map +1 -0
- package/dist/components/Field/Field.d.ts +111 -0
- package/dist/components/Field/Field.js +95 -0
- package/dist/components/Field/Field.js.map +1 -0
- package/dist/components/Field/field-control.d.ts +31 -0
- package/dist/components/Field/field-control.js +12 -0
- package/dist/components/Field/field-control.js.map +1 -0
- package/dist/components/FigureBand/FigureBand.d.ts +31 -0
- package/dist/components/FigureBand/FigureBand.js +51 -0
- package/dist/components/FigureBand/FigureBand.js.map +1 -0
- package/dist/components/FloatingIconButton/FloatingIconButton.d.ts +29 -0
- package/dist/components/FloatingIconButton/FloatingIconButton.js +34 -0
- package/dist/components/FloatingIconButton/FloatingIconButton.js.map +1 -0
- package/dist/components/Heading/Heading.d.ts +62 -0
- package/dist/components/Heading/Heading.js +44 -0
- package/dist/components/Heading/Heading.js.map +1 -0
- package/dist/components/Input/Input.d.ts +22 -0
- package/dist/components/Input/Input.js +21 -0
- package/dist/components/Input/Input.js.map +1 -0
- package/dist/components/Kbd/Kbd.d.ts +27 -0
- package/dist/components/Kbd/Kbd.js +21 -0
- package/dist/components/Kbd/Kbd.js.map +1 -0
- package/dist/components/LinkArrow/LinkArrow.d.ts +24 -0
- package/dist/components/LinkArrow/LinkArrow.js +24 -0
- package/dist/components/LinkArrow/LinkArrow.js.map +1 -0
- package/dist/components/Markdown/Markdown.d.ts +139 -0
- package/dist/components/Markdown/Markdown.js +135 -0
- package/dist/components/Markdown/Markdown.js.map +1 -0
- package/dist/components/Markdown/inline.d.ts +29 -0
- package/dist/components/Markdown/inline.js +74 -0
- package/dist/components/Markdown/inline.js.map +1 -0
- package/dist/components/Markdown/nodes.d.ts +65 -0
- package/dist/components/Markdown/nodes.js +1 -0
- package/dist/components/Markdown/nodes.js.map +1 -0
- package/dist/components/Markdown/parse.d.ts +24 -0
- package/dist/components/Markdown/parse.js +110 -0
- package/dist/components/Markdown/parse.js.map +1 -0
- package/dist/components/Markdown/slug.d.ts +15 -0
- package/dist/components/Markdown/slug.js +7 -0
- package/dist/components/Markdown/slug.js.map +1 -0
- package/dist/components/Metric/Metric.d.ts +61 -0
- package/dist/components/Metric/Metric.js +51 -0
- package/dist/components/Metric/Metric.js.map +1 -0
- package/dist/components/NativeSelect/NativeSelect.d.ts +33 -0
- package/dist/components/NativeSelect/NativeSelect.js +44 -0
- package/dist/components/NativeSelect/NativeSelect.js.map +1 -0
- package/dist/components/NavItem/NavItem.d.ts +39 -0
- package/dist/components/NavItem/NavItem.js +31 -0
- package/dist/components/NavItem/NavItem.js.map +1 -0
- package/dist/components/NumberField/NumberField.d.ts +69 -0
- package/dist/components/NumberField/NumberField.js +162 -0
- package/dist/components/NumberField/NumberField.js.map +1 -0
- package/dist/components/PageHeader/PageHeader.d.ts +92 -0
- package/dist/components/PageHeader/PageHeader.js +37 -0
- package/dist/components/PageHeader/PageHeader.js.map +1 -0
- package/dist/components/Pagination/Pagination.d.ts +67 -0
- package/dist/components/Pagination/Pagination.js +112 -0
- package/dist/components/Pagination/Pagination.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +39 -0
- package/dist/components/Popover/Popover.js +57 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/Progress/Progress.d.ts +43 -0
- package/dist/components/Progress/Progress.js +57 -0
- package/dist/components/Progress/Progress.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +49 -0
- package/dist/components/RadioGroup/RadioGroup.js +53 -0
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/components/ScrollArea/ScrollArea.d.ts +46 -0
- package/dist/components/ScrollArea/ScrollArea.js +54 -0
- package/dist/components/ScrollArea/ScrollArea.js.map +1 -0
- package/dist/components/SearchableMenu/SearchableMenu.d.ts +68 -0
- package/dist/components/SearchableMenu/SearchableMenu.js +101 -0
- package/dist/components/SearchableMenu/SearchableMenu.js.map +1 -0
- package/dist/components/Select/Select.d.ts +87 -0
- package/dist/components/Select/Select.js +130 -0
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/Separator/Separator.d.ts +48 -0
- package/dist/components/Separator/Separator.js +43 -0
- package/dist/components/Separator/Separator.js.map +1 -0
- package/dist/components/Sheet/Sheet.d.ts +43 -0
- package/dist/components/Sheet/Sheet.js +79 -0
- package/dist/components/Sheet/Sheet.js.map +1 -0
- package/dist/components/Sidebar/Sidebar.d.ts +357 -0
- package/dist/components/Sidebar/Sidebar.js +447 -0
- package/dist/components/Sidebar/Sidebar.js.map +1 -0
- package/dist/components/Skeleton/Skeleton.d.ts +70 -0
- package/dist/components/Skeleton/Skeleton.js +44 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Slider/Slider.d.ts +74 -0
- package/dist/components/Slider/Slider.js +143 -0
- package/dist/components/Slider/Slider.js.map +1 -0
- package/dist/components/Spinner/Spinner.d.ts +58 -0
- package/dist/components/Spinner/Spinner.js +49 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/StatusDot/StatusDot.d.ts +29 -0
- package/dist/components/StatusDot/StatusDot.js +44 -0
- package/dist/components/StatusDot/StatusDot.js.map +1 -0
- package/dist/components/StatusPill/StatusPill.d.ts +30 -0
- package/dist/components/StatusPill/StatusPill.js +37 -0
- package/dist/components/StatusPill/StatusPill.js.map +1 -0
- package/dist/components/Steps/Steps.d.ts +65 -0
- package/dist/components/Steps/Steps.js +25 -0
- package/dist/components/Steps/Steps.js.map +1 -0
- package/dist/components/Switch/Switch.d.ts +23 -0
- package/dist/components/Switch/Switch.js +23 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Table/Table.d.ts +116 -0
- package/dist/components/Table/Table.js +137 -0
- package/dist/components/Table/Table.js.map +1 -0
- package/dist/components/Tabs/Tabs.d.ts +37 -0
- package/dist/components/Tabs/Tabs.js +205 -0
- package/dist/components/Tabs/Tabs.js.map +1 -0
- package/dist/components/Tag/Tag.d.ts +87 -0
- package/dist/components/Tag/Tag.js +62 -0
- package/dist/components/Tag/Tag.js.map +1 -0
- package/dist/components/Text/Text.d.ts +62 -0
- package/dist/components/Text/Text.js +30 -0
- package/dist/components/Text/Text.js.map +1 -0
- package/dist/components/Textarea/Textarea.d.ts +20 -0
- package/dist/components/Textarea/Textarea.js +32 -0
- package/dist/components/Textarea/Textarea.js.map +1 -0
- package/dist/components/Timestamp/Timestamp.d.ts +59 -0
- package/dist/components/Timestamp/Timestamp.js +56 -0
- package/dist/components/Timestamp/Timestamp.js.map +1 -0
- package/dist/components/Toast/Toast.d.ts +32 -0
- package/dist/components/Toast/Toast.js +64 -0
- package/dist/components/Toast/Toast.js.map +1 -0
- package/dist/components/ToggleGroup/ToggleGroup.d.ts +46 -0
- package/dist/components/ToggleGroup/ToggleGroup.js +88 -0
- package/dist/components/ToggleGroup/ToggleGroup.js.map +1 -0
- package/dist/components/Toolbar/Toolbar.d.ts +55 -0
- package/dist/components/Toolbar/Toolbar.js +43 -0
- package/dist/components/Toolbar/Toolbar.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +43 -0
- package/dist/components/Tooltip/Tooltip.js +40 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.d.ts +55 -0
- package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.js +175 -0
- package/dist/diagrams/ArchitectureFigure/ArchitectureFigure.js.map +1 -0
- package/dist/diagrams/DataflowFigure/DataflowFigure.d.ts +28 -0
- package/dist/diagrams/DataflowFigure/DataflowFigure.js +148 -0
- package/dist/diagrams/DataflowFigure/DataflowFigure.js.map +1 -0
- package/dist/diagrams/DiagramCanvas/DiagramCanvas.d.ts +78 -0
- package/dist/diagrams/DiagramCanvas/DiagramCanvas.js +229 -0
- package/dist/diagrams/DiagramCanvas/DiagramCanvas.js.map +1 -0
- package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.d.ts +106 -0
- package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.js +123 -0
- package/dist/diagrams/DiagramExportMenu/DiagramExportMenu.js.map +1 -0
- package/dist/diagrams/DiagramInspector/DiagramInspector.d.ts +70 -0
- package/dist/diagrams/DiagramInspector/DiagramInspector.js +94 -0
- package/dist/diagrams/DiagramInspector/DiagramInspector.js.map +1 -0
- package/dist/diagrams/DiagramLegend/DiagramLegend.d.ts +42 -0
- package/dist/diagrams/DiagramLegend/DiagramLegend.js +35 -0
- package/dist/diagrams/DiagramLegend/DiagramLegend.js.map +1 -0
- package/dist/diagrams/DiagramMinimap/DiagramMinimap.d.ts +77 -0
- package/dist/diagrams/DiagramMinimap/DiagramMinimap.js +106 -0
- package/dist/diagrams/DiagramMinimap/DiagramMinimap.js.map +1 -0
- package/dist/diagrams/DiagramToolbar/DiagramToolbar.d.ts +48 -0
- package/dist/diagrams/DiagramToolbar/DiagramToolbar.js +53 -0
- package/dist/diagrams/DiagramToolbar/DiagramToolbar.js.map +1 -0
- package/dist/diagrams/LifecycleFigure/LifecycleFigure.d.ts +31 -0
- package/dist/diagrams/LifecycleFigure/LifecycleFigure.js +234 -0
- package/dist/diagrams/LifecycleFigure/LifecycleFigure.js.map +1 -0
- package/dist/diagrams/SequenceFigure/SequenceFigure.d.ts +38 -0
- package/dist/diagrams/SequenceFigure/SequenceFigure.js +261 -0
- package/dist/diagrams/SequenceFigure/SequenceFigure.js.map +1 -0
- package/dist/diagrams/WorkflowFigure/WorkflowFigure.d.ts +36 -0
- package/dist/diagrams/WorkflowFigure/WorkflowFigure.js +259 -0
- package/dist/diagrams/WorkflowFigure/WorkflowFigure.js.map +1 -0
- package/dist/diagrams/index.d.ts +17 -0
- package/dist/diagrams/index.js +29 -0
- package/dist/diagrams/index.js.map +1 -0
- package/dist/diagrams/lib/dev.d.ts +61 -0
- package/dist/diagrams/lib/dev.js +96 -0
- package/dist/diagrams/lib/dev.js.map +1 -0
- package/dist/diagrams/lib/frame.d.ts +138 -0
- package/dist/diagrams/lib/frame.js +131 -0
- package/dist/diagrams/lib/frame.js.map +1 -0
- package/dist/diagrams/lib/geometry.d.ts +114 -0
- package/dist/diagrams/lib/geometry.js +113 -0
- package/dist/diagrams/lib/geometry.js.map +1 -0
- package/dist/diagrams/lib/legend.d.ts +32 -0
- package/dist/diagrams/lib/legend.js +84 -0
- package/dist/diagrams/lib/legend.js.map +1 -0
- package/dist/diagrams/lib/marks.d.ts +207 -0
- package/dist/diagrams/lib/marks.js +480 -0
- package/dist/diagrams/lib/marks.js.map +1 -0
- package/dist/diagrams/lib/route.d.ts +106 -0
- package/dist/diagrams/lib/route.js +201 -0
- package/dist/diagrams/lib/route.js.map +1 -0
- package/dist/diagrams/lib/wires.d.ts +59 -0
- package/dist/diagrams/lib/wires.js +94 -0
- package/dist/diagrams/lib/wires.js.map +1 -0
- package/dist/diagrams/spec.d.ts +405 -0
- package/dist/diagrams/spec.js +1 -0
- package/dist/diagrams/spec.js.map +1 -0
- package/dist/fonts/hanken-grotesk-300.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-400.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-500.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-600.woff2 +0 -0
- package/dist/fonts/hanken-grotesk-700.woff2 +0 -0
- package/dist/fonts/ibm-plex-mono-400.woff2 +0 -0
- package/dist/fonts/ibm-plex-mono-500.woff2 +0 -0
- package/dist/fonts/ibm-plex-mono-600.woff2 +0 -0
- package/dist/fonts/newsreader-300.woff2 +0 -0
- package/dist/fonts/newsreader-400.woff2 +0 -0
- package/dist/fonts/newsreader-500.woff2 +0 -0
- package/dist/fonts/newsreader-600.woff2 +0 -0
- package/dist/fonts.css +96 -0
- package/dist/index.d.ts +97 -0
- package/dist/index.js +80 -0
- package/dist/index.js.map +1 -0
- package/dist/keyframes.css +300 -0
- package/dist/lib/cn.d.ts +21 -0
- package/dist/lib/cn.js +9 -0
- package/dist/lib/cn.js.map +1 -0
- package/dist/lib/color.d.ts +80 -0
- package/dist/lib/color.js +189 -0
- package/dist/lib/color.js.map +1 -0
- package/dist/lib/control.d.ts +32 -0
- package/dist/lib/control.js +14 -0
- package/dist/lib/control.js.map +1 -0
- package/dist/lib/index.d.ts +4 -0
- package/dist/lib/index.js +11 -0
- package/dist/lib/index.js.map +1 -0
- package/dist/lib/numeric.d.ts +35 -0
- package/dist/lib/numeric.js +29 -0
- package/dist/lib/numeric.js.map +1 -0
- package/dist/lib/overlay-container.d.ts +48 -0
- package/dist/lib/overlay-container.js +15 -0
- package/dist/lib/overlay-container.js.map +1 -0
- package/dist/lib/slot-content.d.ts +8 -0
- package/dist/lib/slot-content.js +17 -0
- package/dist/lib/slot-content.js.map +1 -0
- package/dist/lib/step-rail.d.ts +45 -0
- package/dist/lib/step-rail.js +47 -0
- package/dist/lib/step-rail.js.map +1 -0
- package/dist/lib/svg-export.d.ts +138 -0
- package/dist/lib/svg-export.js +198 -0
- package/dist/lib/svg-export.js.map +1 -0
- package/dist/lib/useClipboardCopy.d.ts +30 -0
- package/dist/lib/useClipboardCopy.js +37 -0
- package/dist/lib/useClipboardCopy.js.map +1 -0
- package/dist/lib/useSelectionIndicator.d.ts +29 -0
- package/dist/lib/useSelectionIndicator.js +49 -0
- package/dist/lib/useSelectionIndicator.js.map +1 -0
- package/dist/lib/warn.d.ts +73 -0
- package/dist/lib/warn.js +38 -0
- package/dist/lib/warn.js.map +1 -0
- package/dist/semantic.css +200 -0
- package/dist/styles.css +98 -0
- package/dist/themes.css +607 -0
- package/dist/tokens/brand.d.ts +47 -0
- package/dist/tokens/brand.js +38 -0
- package/dist/tokens/brand.js.map +1 -0
- package/dist/tokens.css +666 -0
- package/dist/tokens.d.ts +205 -0
- package/dist/tokens.js +1056 -0
- package/dist/tokens.json +1055 -0
- package/dist/website/Actions/Actions.d.ts +34 -0
- package/dist/website/Actions/Actions.js +29 -0
- package/dist/website/Actions/Actions.js.map +1 -0
- package/dist/website/Collection/Collection.d.ts +128 -0
- package/dist/website/Collection/Collection.js +162 -0
- package/dist/website/Collection/Collection.js.map +1 -0
- package/dist/website/Contact/Contact.d.ts +87 -0
- package/dist/website/Contact/Contact.js +94 -0
- package/dist/website/Contact/Contact.js.map +1 -0
- package/dist/website/Content/CodePanel.d.ts +27 -0
- package/dist/website/Content/CodePanel.js +30 -0
- package/dist/website/Content/CodePanel.js.map +1 -0
- package/dist/website/Content/Content.d.ts +29 -0
- package/dist/website/Content/Content.js +38 -0
- package/dist/website/Content/Content.js.map +1 -0
- package/dist/website/Conversation/Conversation.d.ts +193 -0
- package/dist/website/Conversation/Conversation.js +252 -0
- package/dist/website/Conversation/Conversation.js.map +1 -0
- package/dist/website/Evidence/Evidence.d.ts +116 -0
- package/dist/website/Evidence/Evidence.js +142 -0
- package/dist/website/Evidence/Evidence.js.map +1 -0
- package/dist/website/Media/Media.d.ts +173 -0
- package/dist/website/Media/Media.js +225 -0
- package/dist/website/Media/Media.js.map +1 -0
- package/dist/website/Media/MediaLightbox.d.ts +18 -0
- package/dist/website/Media/MediaLightbox.js +38 -0
- package/dist/website/Media/MediaLightbox.js.map +1 -0
- package/dist/website/Metrics/Metrics.d.ts +74 -0
- package/dist/website/Metrics/Metrics.js +96 -0
- package/dist/website/Metrics/Metrics.js.map +1 -0
- package/dist/website/Music/Music.d.ts +60 -0
- package/dist/website/Music/Music.js +80 -0
- package/dist/website/Music/Music.js.map +1 -0
- package/dist/website/Portfolio/FrameLayout.d.ts +9 -0
- package/dist/website/Portfolio/FrameLayout.js +42 -0
- package/dist/website/Portfolio/FrameLayout.js.map +1 -0
- package/dist/website/Portfolio/Portfolio.d.ts +49 -0
- package/dist/website/Portfolio/Portfolio.js +66 -0
- package/dist/website/Portfolio/Portfolio.js.map +1 -0
- package/dist/website/Portfolio/QuestionCard.d.ts +22 -0
- package/dist/website/Portfolio/QuestionCard.js +33 -0
- package/dist/website/Portfolio/QuestionCard.js.map +1 -0
- package/dist/website/PortfolioIndex/PortfolioIndex.d.ts +21 -0
- package/dist/website/PortfolioIndex/PortfolioIndex.js +31 -0
- package/dist/website/PortfolioIndex/PortfolioIndex.js.map +1 -0
- package/dist/website/Reading/Reading.d.ts +203 -0
- package/dist/website/Reading/Reading.js +357 -0
- package/dist/website/Reading/Reading.js.map +1 -0
- package/dist/website/Recovery/Recovery.d.ts +39 -0
- package/dist/website/Recovery/Recovery.js +96 -0
- package/dist/website/Recovery/Recovery.js.map +1 -0
- package/dist/website/SearchPalette/SearchPalette.d.ts +59 -0
- package/dist/website/SearchPalette/SearchPalette.js +120 -0
- package/dist/website/SearchPalette/SearchPalette.js.map +1 -0
- package/dist/website/SiteNavigation/SiteNavigation.d.ts +46 -0
- package/dist/website/SiteNavigation/SiteNavigation.js +101 -0
- package/dist/website/SiteNavigation/SiteNavigation.js.map +1 -0
- package/dist/website/SiteShell/SiteShell.d.ts +45 -0
- package/dist/website/SiteShell/SiteShell.js +46 -0
- package/dist/website/SiteShell/SiteShell.js.map +1 -0
- package/dist/website/Timeline/Timeline.d.ts +80 -0
- package/dist/website/Timeline/Timeline.js +99 -0
- package/dist/website/Timeline/Timeline.js.map +1 -0
- package/dist/website/Workbench/Chronology.d.ts +32 -0
- package/dist/website/Workbench/Chronology.js +32 -0
- package/dist/website/Workbench/Chronology.js.map +1 -0
- package/dist/website/Workbench/ContactRow.d.ts +13 -0
- package/dist/website/Workbench/ContactRow.js +11 -0
- package/dist/website/Workbench/ContactRow.js.map +1 -0
- package/dist/website/Workbench/PhotoMosaic.d.ts +13 -0
- package/dist/website/Workbench/PhotoMosaic.js +15 -0
- package/dist/website/Workbench/PhotoMosaic.js.map +1 -0
- package/dist/website/Workbench/Reveal.d.ts +19 -0
- package/dist/website/Workbench/Reveal.js +29 -0
- package/dist/website/Workbench/Reveal.js.map +1 -0
- package/dist/website/Workbench/ToolStrip.d.ts +18 -0
- package/dist/website/Workbench/ToolStrip.js +15 -0
- package/dist/website/Workbench/ToolStrip.js.map +1 -0
- package/dist/website/Workbench/Workbench.d.ts +23 -0
- package/dist/website/Workbench/Workbench.js +22 -0
- package/dist/website/Workbench/Workbench.js.map +1 -0
- package/dist/website/Workbench/WorkbenchCard.d.ts +29 -0
- package/dist/website/Workbench/WorkbenchCard.js +21 -0
- package/dist/website/Workbench/WorkbenchCard.js.map +1 -0
- package/dist/website/Workbench/WorkbenchEntries.d.ts +22 -0
- package/dist/website/Workbench/WorkbenchEntries.js +24 -0
- package/dist/website/Workbench/WorkbenchEntries.js.map +1 -0
- package/dist/website/Workbench/WorkbenchFigure.d.ts +20 -0
- package/dist/website/Workbench/WorkbenchFigure.js +15 -0
- package/dist/website/Workbench/WorkbenchFigure.js.map +1 -0
- package/dist/website/Workbench/WorkbenchHero.d.ts +24 -0
- package/dist/website/Workbench/WorkbenchHero.js +24 -0
- package/dist/website/Workbench/WorkbenchHero.js.map +1 -0
- package/dist/website/Workbench/theme.d.ts +22 -0
- package/dist/website/Workbench/theme.js +12 -0
- package/dist/website/Workbench/theme.js.map +1 -0
- package/dist/website/index.d.ts +38 -0
- package/dist/website/index.js +32 -0
- package/dist/website/index.js.map +1 -0
- package/dist/website-actions.css +6 -0
- package/dist/website-base.css +46 -0
- package/dist/website-collection.css +89 -0
- package/dist/website-contact.css +29 -0
- package/dist/website-content.css +20 -0
- package/dist/website-controls.css +91 -0
- package/dist/website-conversation.css +115 -0
- package/dist/website-evidence.css +56 -0
- package/dist/website-media.css +227 -0
- package/dist/website-metrics.css +15 -0
- package/dist/website-music.css +27 -0
- package/dist/website-portfolio.css +94 -0
- package/dist/website-reading.css +159 -0
- package/dist/website-recovery.css +28 -0
- package/dist/website-search.css +26 -0
- package/dist/website-shell.css +89 -0
- package/dist/website-timeline.css +43 -0
- package/dist/website-workbench.css +162 -0
- package/dist/website.css +26 -0
- package/llms.txt +35 -0
- package/package.json +163 -5
- package/skills/folio-design/SKILL.md +228 -0
- package/skills/folio-design/evals/claims.json +95 -0
- package/skills/folio-design/evals/evals.json +84 -0
- package/skills/folio-design/rules/a11y.md +167 -0
- package/skills/folio-design/rules/composition.md +108 -0
- package/skills/folio-design/rules/forms.md +135 -0
- package/skills/folio-design/rules/naming.md +155 -0
- package/skills/folio-design/rules/tokens.md +135 -0
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface MenuAction {
|
|
5
|
+
/**
|
|
6
|
+
* Stable identity for the row. Not what the filter matches — the label is,
|
|
7
|
+
* and an id a reader would never type is exactly what this used to be.
|
|
8
|
+
*/
|
|
9
|
+
id: string;
|
|
10
|
+
/** What the row prints. Its text is the first thing the filter matches. */
|
|
11
|
+
label: ReactNode;
|
|
12
|
+
/**
|
|
13
|
+
* More text the filter should match, beyond the label's own words.
|
|
14
|
+
*
|
|
15
|
+
* The synonym a reader reaches for first: "download" for Export, "bin" for
|
|
16
|
+
* Delete. Required in practice only when the label prints no text at all.
|
|
17
|
+
*/
|
|
18
|
+
keywords?: string[];
|
|
19
|
+
/** Printed at the end of the row. */
|
|
20
|
+
shortcut?: string;
|
|
21
|
+
/** Optional group heading. Rows with the same value are shown together. */
|
|
22
|
+
group?: string;
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
destructive?: boolean;
|
|
25
|
+
onSelect: () => void;
|
|
26
|
+
}
|
|
27
|
+
interface SearchableMenuProps {
|
|
28
|
+
actions: MenuAction[];
|
|
29
|
+
/** The trigger's text. */
|
|
30
|
+
children: ReactNode;
|
|
31
|
+
/** Names the menu for assistive tech. */
|
|
32
|
+
label: string;
|
|
33
|
+
searchPlaceholder?: string;
|
|
34
|
+
emptyMessage?: string;
|
|
35
|
+
align?: 'start' | 'center' | 'end';
|
|
36
|
+
className?: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* A menu of actions you can type into.
|
|
40
|
+
*
|
|
41
|
+
* The fourth corner of a square the system otherwise had three of, and the
|
|
42
|
+
* distinction is worth stating because reaching for the wrong one is easy:
|
|
43
|
+
*
|
|
44
|
+
* | | few options | many options |
|
|
45
|
+
* |---|---|---|
|
|
46
|
+
* | **sets a value** | `Select` | `Combobox` |
|
|
47
|
+
* | **runs an action** | `DropdownMenu` | `SearchableMenu` |
|
|
48
|
+
*
|
|
49
|
+
* A `DropdownMenu` past about a dozen rows stops being scannable, and the
|
|
50
|
+
* usual response — nesting submenus — makes it worse. This is the same list
|
|
51
|
+
* with a filter over it.
|
|
52
|
+
*
|
|
53
|
+
* Not the same thing as `Command`: that is a page-level palette, usually modal
|
|
54
|
+
* and usually bound to ⌘K. This is anchored to a control, like the menu it
|
|
55
|
+
* replaces.
|
|
56
|
+
*
|
|
57
|
+
* The rows are `option`s inside a listbox rather than `menuitem`s, because that
|
|
58
|
+
* is what the filtering pattern requires — the highlight moves through
|
|
59
|
+
* `aria-activedescendant` while focus stays in the input, and a menu cannot do
|
|
60
|
+
* that. The trade is deliberate: a menu that cannot be filtered is worse for
|
|
61
|
+
* the reader than a listbox that runs actions.
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* <SearchableMenu label="Actions" actions={ACTIONS}>Actions</SearchableMenu>
|
|
65
|
+
*/
|
|
66
|
+
declare function SearchableMenu({ actions, children, label, searchPlaceholder, emptyMessage, align, className, }: SearchableMenuProps): react.JSX.Element;
|
|
67
|
+
|
|
68
|
+
export { type MenuAction, SearchableMenu, type SearchableMenuProps, SearchableMenu as default };
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { RiArrowDownSLine } from "@remixicon/react";
|
|
4
|
+
import { isValidElement, useState } from "react";
|
|
5
|
+
import { cn } from "../../lib/cn.js";
|
|
6
|
+
import { DEV, warn } from "../../lib/warn.js";
|
|
7
|
+
import {
|
|
8
|
+
Command,
|
|
9
|
+
CommandEmpty,
|
|
10
|
+
CommandGroup,
|
|
11
|
+
CommandInput,
|
|
12
|
+
CommandItem,
|
|
13
|
+
CommandList,
|
|
14
|
+
CommandSeparator
|
|
15
|
+
} from "../Command/Command.js";
|
|
16
|
+
import { Popover, PopoverContent, PopoverTrigger } from "../Popover/Popover.js";
|
|
17
|
+
function textOf(node) {
|
|
18
|
+
if (typeof node === "string") return node;
|
|
19
|
+
if (typeof node === "number") return String(node);
|
|
20
|
+
if (Array.isArray(node)) return node.map(textOf).join(" ");
|
|
21
|
+
if (isValidElement(node)) return textOf(node.props.children);
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
function filterKeywords(action) {
|
|
25
|
+
const label = textOf(action.label).trim();
|
|
26
|
+
const extra = action.keywords ?? [];
|
|
27
|
+
if (DEV && !label && extra.length === 0) {
|
|
28
|
+
warn({
|
|
29
|
+
code: "SEARCHABLE_MENU_LABEL_UNREADABLE",
|
|
30
|
+
problem: "A SearchableMenu action has a label with no text in it, so the filter has nothing to match and the row can never be found by typing.",
|
|
31
|
+
field: "actions[].label",
|
|
32
|
+
fix: "Give the action keywords with the words a reader would type for it, or put text in the label.",
|
|
33
|
+
component: "SearchableMenu"
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
return label ? [label, ...extra] : extra;
|
|
37
|
+
}
|
|
38
|
+
function SearchableMenu({
|
|
39
|
+
actions,
|
|
40
|
+
children,
|
|
41
|
+
label,
|
|
42
|
+
searchPlaceholder = "Filter\u2026",
|
|
43
|
+
emptyMessage = "Nothing matches.",
|
|
44
|
+
align = "start",
|
|
45
|
+
className
|
|
46
|
+
}) {
|
|
47
|
+
const [open, setOpen] = useState(false);
|
|
48
|
+
const groups = [];
|
|
49
|
+
for (const action of actions) {
|
|
50
|
+
const last = groups.at(-1);
|
|
51
|
+
if (last && last.name === action.group) last.items.push(action);
|
|
52
|
+
else groups.push({ name: action.group, items: [action] });
|
|
53
|
+
}
|
|
54
|
+
return /* @__PURE__ */ jsxs(Popover, { open, onOpenChange: setOpen, children: [
|
|
55
|
+
/* @__PURE__ */ jsxs(
|
|
56
|
+
PopoverTrigger,
|
|
57
|
+
{
|
|
58
|
+
"aria-label": label,
|
|
59
|
+
className: cn(
|
|
60
|
+
"inline-flex min-h-(--control-h-sm) items-center gap-2 rounded-(--radius-pill) border border-(--rule-2) px-4 text-sm text-(--ink) transition-colors duration-(--duration-fast) hover:border-(--ink)",
|
|
61
|
+
className
|
|
62
|
+
),
|
|
63
|
+
children: [
|
|
64
|
+
children,
|
|
65
|
+
/* @__PURE__ */ jsx(RiArrowDownSLine, { size: 14, "aria-hidden": true, className: "shrink-0 text-(--ink-3-aa)" })
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
),
|
|
69
|
+
/* @__PURE__ */ jsx(PopoverContent, { label, align, className: "w-64 overflow-hidden p-0", children: /* @__PURE__ */ jsxs(Command, { label: `${label}: ${searchPlaceholder}`, className: "rounded-none border-0", children: [
|
|
70
|
+
/* @__PURE__ */ jsx(CommandInput, { placeholder: searchPlaceholder }),
|
|
71
|
+
/* @__PURE__ */ jsxs(CommandList, { children: [
|
|
72
|
+
/* @__PURE__ */ jsx(CommandEmpty, { children: emptyMessage }),
|
|
73
|
+
groups.map((group, index) => /* @__PURE__ */ jsxs("div", { children: [
|
|
74
|
+
index > 0 && /* @__PURE__ */ jsx(CommandSeparator, {}),
|
|
75
|
+
/* @__PURE__ */ jsx(CommandGroup, { heading: group.name, children: group.items.map((action) => /* @__PURE__ */ jsx(
|
|
76
|
+
CommandItem,
|
|
77
|
+
{
|
|
78
|
+
value: action.id,
|
|
79
|
+
keywords: filterKeywords(action),
|
|
80
|
+
disabled: action.disabled,
|
|
81
|
+
shortcut: action.shortcut,
|
|
82
|
+
onSelect: () => {
|
|
83
|
+
setOpen(false);
|
|
84
|
+
action.onSelect();
|
|
85
|
+
},
|
|
86
|
+
className: action.destructive ? "text-(--danger)" : void 0,
|
|
87
|
+
children: action.label
|
|
88
|
+
},
|
|
89
|
+
action.id
|
|
90
|
+
)) })
|
|
91
|
+
] }, group.name ?? index))
|
|
92
|
+
] })
|
|
93
|
+
] }) })
|
|
94
|
+
] });
|
|
95
|
+
}
|
|
96
|
+
var SearchableMenu_default = SearchableMenu;
|
|
97
|
+
export {
|
|
98
|
+
SearchableMenu,
|
|
99
|
+
SearchableMenu_default as default
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=SearchableMenu.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/SearchableMenu/SearchableMenu.tsx"],"sourcesContent":["'use client'\n\nimport { RiArrowDownSLine } from '@remixicon/react'\nimport { isValidElement, useState, type ReactNode } from 'react'\nimport { cn } from '../../lib/cn'\nimport { DEV, warn } from '../../lib/warn'\nimport {\n Command,\n CommandEmpty,\n CommandGroup,\n CommandInput,\n CommandItem,\n CommandList,\n CommandSeparator,\n} from '../Command/Command'\nimport { Popover, PopoverContent, PopoverTrigger } from '../Popover/Popover'\n\nexport interface MenuAction {\n /**\n * Stable identity for the row. Not what the filter matches — the label is,\n * and an id a reader would never type is exactly what this used to be.\n */\n id: string\n /** What the row prints. Its text is the first thing the filter matches. */\n label: ReactNode\n /**\n * More text the filter should match, beyond the label's own words.\n *\n * The synonym a reader reaches for first: \"download\" for Export, \"bin\" for\n * Delete. Required in practice only when the label prints no text at all.\n */\n keywords?: string[]\n /** Printed at the end of the row. */\n shortcut?: string\n /** Optional group heading. Rows with the same value are shown together. */\n group?: string\n disabled?: boolean\n destructive?: boolean\n onSelect: () => void\n}\n\nexport interface SearchableMenuProps {\n actions: MenuAction[]\n /** The trigger's text. */\n children: ReactNode\n /** Names the menu for assistive tech. */\n label: string\n searchPlaceholder?: string\n emptyMessage?: string\n align?: 'start' | 'center' | 'end'\n className?: string\n}\n\n/** The plain text a label prints, gathered through whatever wraps it. */\nfunction textOf(node: ReactNode): string {\n if (typeof node === 'string') return node\n if (typeof node === 'number') return String(node)\n if (Array.isArray(node)) return node.map(textOf).join(' ')\n if (isValidElement<{ children?: ReactNode }>(node)) return textOf(node.props.children)\n return ''\n}\n\n/**\n * What the filter matches this row on.\n *\n * cmdk derives an item's value from the first string in\n * `[props.value, props.children, ref]`, and only falls back to the row's\n * `textContent` when `value` is absent. This component passes the id as the\n * value, because that is the row's identity and two rows may print the same\n * words — so with the opaque ids an application actually has, the label a\n * reader can SEE scored zero and the menu showed its empty state. Lifting the\n * label's text into the keywords is what makes the visible words match, while\n * the id stays the identity.\n */\nfunction filterKeywords(action: MenuAction): string[] {\n const label = textOf(action.label).trim()\n const extra = action.keywords ?? []\n\n if (DEV && !label && extra.length === 0) {\n warn({\n code: 'SEARCHABLE_MENU_LABEL_UNREADABLE',\n problem:\n 'A SearchableMenu action has a label with no text in it, so the filter has nothing to match and the row can never be found by typing.',\n field: 'actions[].label',\n fix: 'Give the action keywords with the words a reader would type for it, or put text in the label.',\n component: 'SearchableMenu',\n })\n }\n\n return label ? [label, ...extra] : extra\n}\n\n/**\n * A menu of actions you can type into.\n *\n * The fourth corner of a square the system otherwise had three of, and the\n * distinction is worth stating because reaching for the wrong one is easy:\n *\n * | | few options | many options |\n * |---|---|---|\n * | **sets a value** | `Select` | `Combobox` |\n * | **runs an action** | `DropdownMenu` | `SearchableMenu` |\n *\n * A `DropdownMenu` past about a dozen rows stops being scannable, and the\n * usual response — nesting submenus — makes it worse. This is the same list\n * with a filter over it.\n *\n * Not the same thing as `Command`: that is a page-level palette, usually modal\n * and usually bound to ⌘K. This is anchored to a control, like the menu it\n * replaces.\n *\n * The rows are `option`s inside a listbox rather than `menuitem`s, because that\n * is what the filtering pattern requires — the highlight moves through\n * `aria-activedescendant` while focus stays in the input, and a menu cannot do\n * that. The trade is deliberate: a menu that cannot be filtered is worse for\n * the reader than a listbox that runs actions.\n *\n * @example\n * <SearchableMenu label=\"Actions\" actions={ACTIONS}>Actions</SearchableMenu>\n */\nexport function SearchableMenu({\n actions,\n children,\n label,\n searchPlaceholder = 'Filter…',\n emptyMessage = 'Nothing matches.',\n align = 'start',\n className,\n}: SearchableMenuProps) {\n const [open, setOpen] = useState(false)\n\n // Grouped in declaration order, so a caller controls the arrangement by the\n // order they list actions rather than by an extra prop.\n const groups: { name: string | undefined; items: MenuAction[] }[] = []\n for (const action of actions) {\n const last = groups.at(-1)\n if (last && last.name === action.group) last.items.push(action)\n else groups.push({ name: action.group, items: [action] })\n }\n\n return (\n <Popover open={open} onOpenChange={setOpen}>\n <PopoverTrigger\n aria-label={label}\n className={cn(\n 'inline-flex min-h-(--control-h-sm) items-center gap-2 rounded-(--radius-pill) border border-(--rule-2) px-4 text-sm text-(--ink) transition-colors duration-(--duration-fast) hover:border-(--ink)',\n className,\n )}\n >\n {children}\n <RiArrowDownSLine size={14} aria-hidden className=\"shrink-0 text-(--ink-3-aa)\" />\n </PopoverTrigger>\n <PopoverContent label={label} align={align} className=\"w-64 overflow-hidden p-0\">\n <Command label={`${label}: ${searchPlaceholder}`} className=\"rounded-none border-0\">\n <CommandInput placeholder={searchPlaceholder} />\n <CommandList>\n <CommandEmpty>{emptyMessage}</CommandEmpty>\n {groups.map((group, index) => (\n <div key={group.name ?? index}>\n {index > 0 && <CommandSeparator />}\n <CommandGroup heading={group.name}>\n {group.items.map((action) => (\n <CommandItem\n key={action.id}\n value={action.id}\n keywords={filterKeywords(action)}\n disabled={action.disabled}\n shortcut={action.shortcut}\n onSelect={() => {\n setOpen(false)\n action.onSelect()\n }}\n className={action.destructive ? 'text-(--danger)' : undefined}\n >\n {action.label}\n </CommandItem>\n ))}\n </CommandGroup>\n </div>\n ))}\n </CommandList>\n </Command>\n </PopoverContent>\n </Popover>\n )\n}\n\nexport default SearchableMenu\n"],"mappings":";AA8IM,SAQE,KARF;AA5IN,SAAS,wBAAwB;AACjC,SAAS,gBAAgB,gBAAgC;AACzD,SAAS,UAAU;AACnB,SAAS,KAAK,YAAY;AAC1B;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;AACP,SAAS,SAAS,gBAAgB,sBAAsB;AAuCxD,SAAS,OAAO,MAAyB;AACvC,MAAI,OAAO,SAAS,SAAU,QAAO;AACrC,MAAI,OAAO,SAAS,SAAU,QAAO,OAAO,IAAI;AAChD,MAAI,MAAM,QAAQ,IAAI,EAAG,QAAO,KAAK,IAAI,MAAM,EAAE,KAAK,GAAG;AACzD,MAAI,eAAyC,IAAI,EAAG,QAAO,OAAO,KAAK,MAAM,QAAQ;AACrF,SAAO;AACT;AAcA,SAAS,eAAe,QAA8B;AACpD,QAAM,QAAQ,OAAO,OAAO,KAAK,EAAE,KAAK;AACxC,QAAM,QAAQ,OAAO,YAAY,CAAC;AAElC,MAAI,OAAO,CAAC,SAAS,MAAM,WAAW,GAAG;AACvC,SAAK;AAAA,MACH,MAAM;AAAA,MACN,SACE;AAAA,MACF,OAAO;AAAA,MACP,KAAK;AAAA,MACL,WAAW;AAAA,IACb,CAAC;AAAA,EACH;AAEA,SAAO,QAAQ,CAAC,OAAO,GAAG,KAAK,IAAI;AACrC;AA8BO,SAAS,eAAe;AAAA,EAC7B;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB,eAAe;AAAA,EACf,QAAQ;AAAA,EACR;AACF,GAAwB;AACtB,QAAM,CAAC,MAAM,OAAO,IAAI,SAAS,KAAK;AAItC,QAAM,SAA8D,CAAC;AACrE,aAAW,UAAU,SAAS;AAC5B,UAAM,OAAO,OAAO,GAAG,EAAE;AACzB,QAAI,QAAQ,KAAK,SAAS,OAAO,MAAO,MAAK,MAAM,KAAK,MAAM;AAAA,QACzD,QAAO,KAAK,EAAE,MAAM,OAAO,OAAO,OAAO,CAAC,MAAM,EAAE,CAAC;AAAA,EAC1D;AAEA,SACE,qBAAC,WAAQ,MAAY,cAAc,SACjC;AAAA;AAAA,MAAC;AAAA;AAAA,QACC,cAAY;AAAA,QACZ,WAAW;AAAA,UACT;AAAA,UACA;AAAA,QACF;AAAA,QAEC;AAAA;AAAA,UACD,oBAAC,oBAAiB,MAAM,IAAI,eAAW,MAAC,WAAU,8BAA6B;AAAA;AAAA;AAAA,IACjF;AAAA,IACA,oBAAC,kBAAe,OAAc,OAAc,WAAU,4BACpD,+BAAC,WAAQ,OAAO,GAAG,KAAK,KAAK,iBAAiB,IAAI,WAAU,yBAC1D;AAAA,0BAAC,gBAAa,aAAa,mBAAmB;AAAA,MAC9C,qBAAC,eACC;AAAA,4BAAC,gBAAc,wBAAa;AAAA,QAC3B,OAAO,IAAI,CAAC,OAAO,UAClB,qBAAC,SACE;AAAA,kBAAQ,KAAK,oBAAC,oBAAiB;AAAA,UAChC,oBAAC,gBAAa,SAAS,MAAM,MAC1B,gBAAM,MAAM,IAAI,CAAC,WAChB;AAAA,YAAC;AAAA;AAAA,cAEC,OAAO,OAAO;AAAA,cACd,UAAU,eAAe,MAAM;AAAA,cAC/B,UAAU,OAAO;AAAA,cACjB,UAAU,OAAO;AAAA,cACjB,UAAU,MAAM;AACd,wBAAQ,KAAK;AACb,uBAAO,SAAS;AAAA,cAClB;AAAA,cACA,WAAW,OAAO,cAAc,oBAAoB;AAAA,cAEnD,iBAAO;AAAA;AAAA,YAXH,OAAO;AAAA,UAYd,CACD,GACH;AAAA,aAnBQ,MAAM,QAAQ,KAoBxB,CACD;AAAA,SACH;AAAA,OACF,GACF;AAAA,KACF;AAEJ;AAEA,IAAO,yBAAQ;","names":[]}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
import * as SelectPrimitive from '@radix-ui/react-select';
|
|
4
|
+
|
|
5
|
+
/** Radix Select root, group and label, as typed passthroughs. */
|
|
6
|
+
declare const SelectRoot: react.FC<SelectPrimitive.SelectProps>;
|
|
7
|
+
declare const SelectGroup: react.ForwardRefExoticComponent<SelectPrimitive.SelectGroupProps & react.RefAttributes<HTMLDivElement>>;
|
|
8
|
+
interface SelectProps extends ComponentProps<typeof SelectPrimitive.Root> {
|
|
9
|
+
/**
|
|
10
|
+
* Classes for the option PANEL, not the trigger.
|
|
11
|
+
*
|
|
12
|
+
* `className` styles the trigger, which is the common case. This exists for
|
|
13
|
+
* the uncommon one: a select inside a bounded surface, where the default
|
|
14
|
+
* 18rem of list would cover the thing the reader is choosing for — a year
|
|
15
|
+
* picker over its own calendar, say.
|
|
16
|
+
*/
|
|
17
|
+
contentClassName?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Names the control. Required — the trigger shows a value, and a value is not
|
|
20
|
+
* a name.
|
|
21
|
+
*
|
|
22
|
+
* It is announced together with the value, not instead of it: the trigger is
|
|
23
|
+
* named by the label and by its own text, so a reader hears "Region,
|
|
24
|
+
* Australia". Inside a `Field` with a label, that label is used and this one
|
|
25
|
+
* is not repeated.
|
|
26
|
+
*/
|
|
27
|
+
label: string;
|
|
28
|
+
placeholder?: string;
|
|
29
|
+
/** Paints the resting border with `--danger` and reflects `aria-invalid`. */
|
|
30
|
+
invalid?: boolean;
|
|
31
|
+
disabled?: boolean;
|
|
32
|
+
className?: string;
|
|
33
|
+
/** The TRIGGER's id — the element a label points at. A `Field` sets it. */
|
|
34
|
+
id?: string;
|
|
35
|
+
/** Ids of the copy describing the control. A `Field` sets it from hint, error and description. */
|
|
36
|
+
'aria-describedby'?: string;
|
|
37
|
+
/** The spelling a form library sets; read together with `invalid`. */
|
|
38
|
+
'aria-invalid'?: boolean | 'true' | 'false';
|
|
39
|
+
/** Announced on the trigger. A `Field` sets it from `required`. */
|
|
40
|
+
'aria-required'?: boolean;
|
|
41
|
+
/** `SelectItem`s, optionally wrapped in `SelectGroup` with a `SelectLabel`. */
|
|
42
|
+
children: ReactNode;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* A choice from a list, styled the whole way down.
|
|
46
|
+
*
|
|
47
|
+
* The option list is ours — drawn from the same tokens as everything else, so
|
|
48
|
+
* it does not change typeface, spacing and selection colour the moment it
|
|
49
|
+
* opens. That is the whole reason this replaced the native control as the
|
|
50
|
+
* default: a design system whose most common form control stops being part of
|
|
51
|
+
* the system on click is not a design system, it is a stylesheet for closed
|
|
52
|
+
* states.
|
|
53
|
+
*
|
|
54
|
+
* The keyboard contract is Radix's, which means it is the platform's: typeahead
|
|
55
|
+
* works, the arrows move, Home and End reach the ends, and Escape closes
|
|
56
|
+
* without choosing. That was the one genuine argument for staying native, and
|
|
57
|
+
* it is answered.
|
|
58
|
+
*
|
|
59
|
+
* Past roughly a dozen options, reach for `Combobox` — a list nobody can filter
|
|
60
|
+
* is worse than one they can type into. Where the platform picker is genuinely
|
|
61
|
+
* better — a phone, or a form that must survive without JavaScript — reach for
|
|
62
|
+
* `NativeSelect`.
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* <Field label="Region">
|
|
66
|
+
* <Select label="Region" defaultValue="au">
|
|
67
|
+
* <SelectItem value="au">Australia</SelectItem>
|
|
68
|
+
* <SelectItem value="nz">New Zealand</SelectItem>
|
|
69
|
+
* </Select>
|
|
70
|
+
* </Field>
|
|
71
|
+
*/
|
|
72
|
+
declare function Select({ label, placeholder, invalid, disabled, className, contentClassName, children, id, 'aria-describedby': describedBy, 'aria-invalid': ariaInvalid, 'aria-required': ariaRequired, ...props }: SelectProps): react.JSX.Element;
|
|
73
|
+
type SelectItemProps = ComponentProps<typeof SelectPrimitive.Item>;
|
|
74
|
+
/** One option. The tick marks the chosen one; the fill marks the highlighted one. */
|
|
75
|
+
declare function SelectItem({ className, children, ...props }: SelectItemProps): react.JSX.Element;
|
|
76
|
+
/**
|
|
77
|
+
* Mono eyebrow heading for a group of options.
|
|
78
|
+
*
|
|
79
|
+
* Must sit inside a `SelectGroup` — Radix throws otherwise, because a heading
|
|
80
|
+
* with no group is a heading for nothing, and assistive tech would announce it
|
|
81
|
+
* as an option.
|
|
82
|
+
*/
|
|
83
|
+
declare function SelectLabel({ className, ...props }: ComponentProps<typeof SelectPrimitive.Label>): react.JSX.Element;
|
|
84
|
+
/** Hairline divider between groups. */
|
|
85
|
+
declare function SelectSeparator({ className, ...props }: ComponentProps<typeof SelectPrimitive.Separator>): react.JSX.Element;
|
|
86
|
+
|
|
87
|
+
export { Select, SelectGroup, SelectItem, type SelectItemProps, SelectLabel, type SelectProps, SelectRoot, SelectSeparator, Select as default };
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
3
|
+
import * as SelectPrimitive from "@radix-ui/react-select";
|
|
4
|
+
import { RiArrowDownSLine, RiArrowUpSLine, RiCheckLine } from "@remixicon/react";
|
|
5
|
+
import { useId } from "react";
|
|
6
|
+
import { cn } from "../../lib/cn.js";
|
|
7
|
+
import { warnBlankName } from "../../lib/warn.js";
|
|
8
|
+
import { useOverlayContainer } from "../../lib/overlay-container.js";
|
|
9
|
+
import { useFieldControl } from "../Field/field-control.js";
|
|
10
|
+
import { CONTROL_BASE, CONTROL_BORDER, isInvalid } from "../../lib/control.js";
|
|
11
|
+
const SelectRoot = SelectPrimitive.Root;
|
|
12
|
+
const SelectGroup = SelectPrimitive.Group;
|
|
13
|
+
function Select({
|
|
14
|
+
label,
|
|
15
|
+
placeholder = "Select\u2026",
|
|
16
|
+
invalid,
|
|
17
|
+
disabled,
|
|
18
|
+
className,
|
|
19
|
+
contentClassName,
|
|
20
|
+
children,
|
|
21
|
+
id,
|
|
22
|
+
"aria-describedby": describedBy,
|
|
23
|
+
"aria-invalid": ariaInvalid,
|
|
24
|
+
"aria-required": ariaRequired,
|
|
25
|
+
...props
|
|
26
|
+
}) {
|
|
27
|
+
warnBlankName("Select", "label", label, "the trigger is announced with no name");
|
|
28
|
+
const bad = isInvalid(invalid, ariaInvalid);
|
|
29
|
+
const field = useFieldControl();
|
|
30
|
+
const generated = useId();
|
|
31
|
+
const triggerId = id ?? generated;
|
|
32
|
+
const valueId = `${triggerId}-value`;
|
|
33
|
+
const nameId = field?.labelId ?? `${triggerId}-name`;
|
|
34
|
+
const container = useOverlayContainer();
|
|
35
|
+
return /* @__PURE__ */ jsxs(SelectPrimitive.Root, { disabled, ...props, children: [
|
|
36
|
+
/* @__PURE__ */ jsxs(
|
|
37
|
+
SelectPrimitive.Trigger,
|
|
38
|
+
{
|
|
39
|
+
id: triggerId,
|
|
40
|
+
"aria-labelledby": `${nameId} ${valueId}`,
|
|
41
|
+
"aria-describedby": describedBy,
|
|
42
|
+
"aria-required": ariaRequired,
|
|
43
|
+
"aria-invalid": bad || void 0,
|
|
44
|
+
className: cn(
|
|
45
|
+
CONTROL_BASE,
|
|
46
|
+
"group flex cursor-pointer items-center justify-between gap-2 text-start data-[placeholder]:text-(--ink-3-aa)",
|
|
47
|
+
bad ? CONTROL_BORDER.invalid : CONTROL_BORDER.resting,
|
|
48
|
+
className
|
|
49
|
+
),
|
|
50
|
+
children: [
|
|
51
|
+
field?.labelId == null && /* @__PURE__ */ jsx("span", { id: nameId, className: "sr-only", children: label }),
|
|
52
|
+
/* @__PURE__ */ jsx("span", { id: valueId, className: "truncate", children: /* @__PURE__ */ jsx(SelectPrimitive.Value, { placeholder }) }),
|
|
53
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Icon, { asChild: true, children: /* @__PURE__ */ jsx(
|
|
54
|
+
RiArrowDownSLine,
|
|
55
|
+
{
|
|
56
|
+
size: 16,
|
|
57
|
+
"aria-hidden": true,
|
|
58
|
+
className: "shrink-0 text-(--ink-3-aa) transition-transform duration-(--duration-fast) group-data-[state=open]:rotate-180"
|
|
59
|
+
}
|
|
60
|
+
) })
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
),
|
|
64
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Portal, { container: container ?? void 0, children: /* @__PURE__ */ jsxs(
|
|
65
|
+
SelectPrimitive.Content,
|
|
66
|
+
{
|
|
67
|
+
collisionBoundary: container ?? void 0,
|
|
68
|
+
collisionPadding: 8,
|
|
69
|
+
position: "popper",
|
|
70
|
+
sideOffset: 6,
|
|
71
|
+
"data-folio-animated": true,
|
|
72
|
+
className: cn(
|
|
73
|
+
"z-(--z-dropdown) max-h-72 min-w-(--radix-select-trigger-width) overflow-hidden rounded-(--radius-lg) border border-(--panel-border) bg-(--panel-bg) shadow-(--panel-lift) panel-blur",
|
|
74
|
+
contentClassName,
|
|
75
|
+
"data-[state=open]:animate-[folio-pop-in_var(--duration-fast)_var(--ease-out-expo)] data-[state=closed]:animate-[folio-pop-out_var(--duration-fast)_var(--ease)] origin-(--radix-popper-transform-origin)"
|
|
76
|
+
),
|
|
77
|
+
children: [
|
|
78
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ScrollUpButton, { className: "flex h-6 items-center justify-center text-(--ink-3-aa)", children: /* @__PURE__ */ jsx(RiArrowUpSLine, { size: 14, "aria-hidden": true }) }),
|
|
79
|
+
/* @__PURE__ */ jsx(SelectPrimitive.Viewport, { className: "p-1.5", children }),
|
|
80
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ScrollDownButton, { className: "flex h-6 items-center justify-center text-(--ink-3-aa)", children: /* @__PURE__ */ jsx(RiArrowDownSLine, { size: 14, "aria-hidden": true }) })
|
|
81
|
+
]
|
|
82
|
+
}
|
|
83
|
+
) })
|
|
84
|
+
] });
|
|
85
|
+
}
|
|
86
|
+
function SelectItem({ className, children, ...props }) {
|
|
87
|
+
return /* @__PURE__ */ jsxs(
|
|
88
|
+
SelectPrimitive.Item,
|
|
89
|
+
{
|
|
90
|
+
className: cn(
|
|
91
|
+
"flex cursor-pointer select-none items-center gap-2.5 rounded-(--radius-row) px-2.5 py-2 text-sm text-(--ink-2) outline-none transition-colors duration-(--duration-fast) data-[highlighted]:bg-(--stone) data-[highlighted]:text-(--ink) data-[disabled]:pointer-events-none data-[disabled]:opacity-(--disabled-opacity)",
|
|
92
|
+
className
|
|
93
|
+
),
|
|
94
|
+
...props,
|
|
95
|
+
children: [
|
|
96
|
+
/* @__PURE__ */ jsx("span", { className: "grid size-3.5 shrink-0 place-items-center", children: /* @__PURE__ */ jsx(SelectPrimitive.ItemIndicator, { asChild: true, children: /* @__PURE__ */ jsx(RiCheckLine, { size: 14, "aria-hidden": true }) }) }),
|
|
97
|
+
/* @__PURE__ */ jsx(SelectPrimitive.ItemText, { children })
|
|
98
|
+
]
|
|
99
|
+
}
|
|
100
|
+
);
|
|
101
|
+
}
|
|
102
|
+
function SelectLabel({
|
|
103
|
+
className,
|
|
104
|
+
...props
|
|
105
|
+
}) {
|
|
106
|
+
return /* @__PURE__ */ jsx(
|
|
107
|
+
SelectPrimitive.Label,
|
|
108
|
+
{
|
|
109
|
+
className: cn("px-2.5 py-1.5 eyebrow text-(--ink-3-aa)", className),
|
|
110
|
+
...props
|
|
111
|
+
}
|
|
112
|
+
);
|
|
113
|
+
}
|
|
114
|
+
function SelectSeparator({
|
|
115
|
+
className,
|
|
116
|
+
...props
|
|
117
|
+
}) {
|
|
118
|
+
return /* @__PURE__ */ jsx(SelectPrimitive.Separator, { className: cn("my-1 h-px bg-(--rule)", className), ...props });
|
|
119
|
+
}
|
|
120
|
+
var Select_default = Select;
|
|
121
|
+
export {
|
|
122
|
+
Select,
|
|
123
|
+
SelectGroup,
|
|
124
|
+
SelectItem,
|
|
125
|
+
SelectLabel,
|
|
126
|
+
SelectRoot,
|
|
127
|
+
SelectSeparator,
|
|
128
|
+
Select_default as default
|
|
129
|
+
};
|
|
130
|
+
//# sourceMappingURL=Select.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Select/Select.tsx"],"sourcesContent":["'use client'\n\nimport * as SelectPrimitive from '@radix-ui/react-select'\nimport { RiArrowDownSLine, RiArrowUpSLine, RiCheckLine } from '@remixicon/react'\nimport { useId, type ComponentProps, type ReactNode } from 'react'\nimport { cn } from '../../lib/cn'\nimport { warnBlankName } from '../../lib/warn'\nimport { useOverlayContainer } from '../../lib/overlay-container'\nimport { useFieldControl } from '../Field/field-control'\nimport { CONTROL_BASE, CONTROL_BORDER, isInvalid } from '../../lib/control'\n\n/** Radix Select root, group and label, as typed passthroughs. */\nexport const SelectRoot = SelectPrimitive.Root\nexport const SelectGroup = SelectPrimitive.Group\n\nexport interface SelectProps extends ComponentProps<typeof SelectPrimitive.Root> {\n /**\n * Classes for the option PANEL, not the trigger.\n *\n * `className` styles the trigger, which is the common case. This exists for\n * the uncommon one: a select inside a bounded surface, where the default\n * 18rem of list would cover the thing the reader is choosing for — a year\n * picker over its own calendar, say.\n */\n contentClassName?: string\n /**\n * Names the control. Required — the trigger shows a value, and a value is not\n * a name.\n *\n * It is announced together with the value, not instead of it: the trigger is\n * named by the label and by its own text, so a reader hears \"Region,\n * Australia\". Inside a `Field` with a label, that label is used and this one\n * is not repeated.\n */\n label: string\n placeholder?: string\n /** Paints the resting border with `--danger` and reflects `aria-invalid`. */\n invalid?: boolean\n disabled?: boolean\n className?: string\n /** The TRIGGER's id — the element a label points at. A `Field` sets it. */\n id?: string\n /** Ids of the copy describing the control. A `Field` sets it from hint, error and description. */\n 'aria-describedby'?: string\n /** The spelling a form library sets; read together with `invalid`. */\n 'aria-invalid'?: boolean | 'true' | 'false'\n /** Announced on the trigger. A `Field` sets it from `required`. */\n 'aria-required'?: boolean\n /** `SelectItem`s, optionally wrapped in `SelectGroup` with a `SelectLabel`. */\n children: ReactNode\n}\n\n/**\n * A choice from a list, styled the whole way down.\n *\n * The option list is ours — drawn from the same tokens as everything else, so\n * it does not change typeface, spacing and selection colour the moment it\n * opens. That is the whole reason this replaced the native control as the\n * default: a design system whose most common form control stops being part of\n * the system on click is not a design system, it is a stylesheet for closed\n * states.\n *\n * The keyboard contract is Radix's, which means it is the platform's: typeahead\n * works, the arrows move, Home and End reach the ends, and Escape closes\n * without choosing. That was the one genuine argument for staying native, and\n * it is answered.\n *\n * Past roughly a dozen options, reach for `Combobox` — a list nobody can filter\n * is worse than one they can type into. Where the platform picker is genuinely\n * better — a phone, or a form that must survive without JavaScript — reach for\n * `NativeSelect`.\n *\n * @example\n * <Field label=\"Region\">\n * <Select label=\"Region\" defaultValue=\"au\">\n * <SelectItem value=\"au\">Australia</SelectItem>\n * <SelectItem value=\"nz\">New Zealand</SelectItem>\n * </Select>\n * </Field>\n */\nexport function Select({\n label,\n placeholder = 'Select…',\n invalid,\n disabled,\n className,\n contentClassName,\n children,\n id,\n 'aria-describedby': describedBy,\n 'aria-invalid': ariaInvalid,\n 'aria-required': ariaRequired,\n ...props\n}: SelectProps) {\n warnBlankName('Select', 'label', label, 'the trigger is announced with no name')\n const bad = isInvalid(invalid, ariaInvalid)\n\n const field = useFieldControl()\n const generated = useId()\n // The id belongs on the TRIGGER: Radix's root renders no DOM node at all, so\n // an id handed to it lands nowhere and the label above points at nothing.\n const triggerId = id ?? generated\n const valueId = `${triggerId}-value`\n const nameId = field?.labelId ?? `${triggerId}-name`\n\n const container = useOverlayContainer()\n\n return (\n <SelectPrimitive.Root disabled={disabled} {...props}>\n <SelectPrimitive.Trigger\n id={triggerId}\n // Named by the label AND by its own value, in that order. `aria-label`\n // outranks name-from-content, so naming it \"Region\" told a reader the\n // noun and never the answer — and the answer is the only thing on the\n // trigger.\n aria-labelledby={`${nameId} ${valueId}`}\n aria-describedby={describedBy}\n aria-required={ariaRequired}\n aria-invalid={bad || undefined}\n className={cn(\n CONTROL_BASE,\n 'group flex cursor-pointer items-center justify-between gap-2 text-start data-[placeholder]:text-(--ink-3-aa)',\n bad ? CONTROL_BORDER.invalid : CONTROL_BORDER.resting,\n className,\n )}\n >\n {field?.labelId == null && (\n <span id={nameId} className=\"sr-only\">\n {label}\n </span>\n )}\n {/* Wrapped rather than styled directly: Radix's Value drops className.\n The wrapper is also what `aria-labelledby` points at, so the name\n picks up the value and not the chevron. */}\n <span id={valueId} className=\"truncate\">\n <SelectPrimitive.Value placeholder={placeholder} />\n </span>\n <SelectPrimitive.Icon asChild>\n <RiArrowDownSLine\n size={16}\n aria-hidden\n className=\"shrink-0 text-(--ink-3-aa) transition-transform duration-(--duration-fast) group-data-[state=open]:rotate-180\"\n />\n </SelectPrimitive.Icon>\n </SelectPrimitive.Trigger>\n\n <SelectPrimitive.Portal container={container ?? undefined}>\n <SelectPrimitive.Content\n collisionBoundary={container ?? undefined}\n collisionPadding={8}\n position=\"popper\"\n sideOffset={6}\n data-folio-animated\n className={cn(\n 'z-(--z-dropdown) max-h-72 min-w-(--radix-select-trigger-width) overflow-hidden rounded-(--radius-lg) border border-(--panel-border) bg-(--panel-bg) shadow-(--panel-lift) panel-blur',\n contentClassName,\n 'data-[state=open]:animate-[folio-pop-in_var(--duration-fast)_var(--ease-out-expo)] data-[state=closed]:animate-[folio-pop-out_var(--duration-fast)_var(--ease)] origin-(--radix-popper-transform-origin)',\n )}\n >\n <SelectPrimitive.ScrollUpButton className=\"flex h-6 items-center justify-center text-(--ink-3-aa)\">\n <RiArrowUpSLine size={14} aria-hidden />\n </SelectPrimitive.ScrollUpButton>\n <SelectPrimitive.Viewport className=\"p-1.5\">{children}</SelectPrimitive.Viewport>\n <SelectPrimitive.ScrollDownButton className=\"flex h-6 items-center justify-center text-(--ink-3-aa)\">\n <RiArrowDownSLine size={14} aria-hidden />\n </SelectPrimitive.ScrollDownButton>\n </SelectPrimitive.Content>\n </SelectPrimitive.Portal>\n </SelectPrimitive.Root>\n )\n}\n\nexport type SelectItemProps = ComponentProps<typeof SelectPrimitive.Item>\n\n/** One option. The tick marks the chosen one; the fill marks the highlighted one. */\nexport function SelectItem({ className, children, ...props }: SelectItemProps) {\n return (\n <SelectPrimitive.Item\n className={cn(\n 'flex cursor-pointer select-none items-center gap-2.5 rounded-(--radius-row) px-2.5 py-2 text-sm text-(--ink-2) outline-none transition-colors duration-(--duration-fast) data-[highlighted]:bg-(--stone) data-[highlighted]:text-(--ink) data-[disabled]:pointer-events-none data-[disabled]:opacity-(--disabled-opacity)',\n className,\n )}\n {...props}\n >\n {/* The box is always there and only the tick inside it appears, so\n choosing an option does not shunt every label sideways. */}\n <span className=\"grid size-3.5 shrink-0 place-items-center\">\n <SelectPrimitive.ItemIndicator asChild>\n <RiCheckLine size={14} aria-hidden />\n </SelectPrimitive.ItemIndicator>\n </span>\n <SelectPrimitive.ItemText>{children}</SelectPrimitive.ItemText>\n </SelectPrimitive.Item>\n )\n}\n\n/**\n * Mono eyebrow heading for a group of options.\n *\n * Must sit inside a `SelectGroup` — Radix throws otherwise, because a heading\n * with no group is a heading for nothing, and assistive tech would announce it\n * as an option.\n */\nexport function SelectLabel({\n className,\n ...props\n}: ComponentProps<typeof SelectPrimitive.Label>) {\n return (\n <SelectPrimitive.Label\n className={cn('px-2.5 py-1.5 eyebrow text-(--ink-3-aa)', className)}\n {...props}\n />\n )\n}\n\n/** Hairline divider between groups. */\nexport function SelectSeparator({\n className,\n ...props\n}: ComponentProps<typeof SelectPrimitive.Separator>) {\n return (\n <SelectPrimitive.Separator className={cn('my-1 h-px bg-(--rule)', className)} {...props} />\n )\n}\n\nexport default Select\n"],"mappings":";AA6GM,SAkBI,KAlBJ;AA3GN,YAAY,qBAAqB;AACjC,SAAS,kBAAkB,gBAAgB,mBAAmB;AAC9D,SAAS,aAAkD;AAC3D,SAAS,UAAU;AACnB,SAAS,qBAAqB;AAC9B,SAAS,2BAA2B;AACpC,SAAS,uBAAuB;AAChC,SAAS,cAAc,gBAAgB,iBAAiB;AAGjD,MAAM,aAAa,gBAAgB;AACnC,MAAM,cAAc,gBAAgB;AAmEpC,SAAS,OAAO;AAAA,EACrB;AAAA,EACA,cAAc;AAAA,EACd;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA,oBAAoB;AAAA,EACpB,gBAAgB;AAAA,EAChB,iBAAiB;AAAA,EACjB,GAAG;AACL,GAAgB;AACd,gBAAc,UAAU,SAAS,OAAO,uCAAuC;AAC/E,QAAM,MAAM,UAAU,SAAS,WAAW;AAE1C,QAAM,QAAQ,gBAAgB;AAC9B,QAAM,YAAY,MAAM;AAGxB,QAAM,YAAY,MAAM;AACxB,QAAM,UAAU,GAAG,SAAS;AAC5B,QAAM,SAAS,OAAO,WAAW,GAAG,SAAS;AAE7C,QAAM,YAAY,oBAAoB;AAEtC,SACE,qBAAC,gBAAgB,MAAhB,EAAqB,UAAqB,GAAG,OAC5C;AAAA;AAAA,MAAC,gBAAgB;AAAA,MAAhB;AAAA,QACC,IAAI;AAAA,QAKJ,mBAAiB,GAAG,MAAM,IAAI,OAAO;AAAA,QACrC,oBAAkB;AAAA,QAClB,iBAAe;AAAA,QACf,gBAAc,OAAO;AAAA,QACrB,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA,MAAM,eAAe,UAAU,eAAe;AAAA,UAC9C;AAAA,QACF;AAAA,QAEC;AAAA,iBAAO,WAAW,QACjB,oBAAC,UAAK,IAAI,QAAQ,WAAU,WACzB,iBACH;AAAA,UAKF,oBAAC,UAAK,IAAI,SAAS,WAAU,YAC3B,8BAAC,gBAAgB,OAAhB,EAAsB,aAA0B,GACnD;AAAA,UACA,oBAAC,gBAAgB,MAAhB,EAAqB,SAAO,MAC3B;AAAA,YAAC;AAAA;AAAA,cACC,MAAM;AAAA,cACN,eAAW;AAAA,cACX,WAAU;AAAA;AAAA,UACZ,GACF;AAAA;AAAA;AAAA,IACF;AAAA,IAEA,oBAAC,gBAAgB,QAAhB,EAAuB,WAAW,aAAa,QAC9C;AAAA,MAAC,gBAAgB;AAAA,MAAhB;AAAA,QACD,mBAAmB,aAAa;AAAA,QAChC,kBAAkB;AAAA,QAChB,UAAS;AAAA,QACT,YAAY;AAAA,QACZ,uBAAmB;AAAA,QACnB,WAAW;AAAA,UACT;AAAA,UACA;AAAA,UACA;AAAA,QACF;AAAA,QAEA;AAAA,8BAAC,gBAAgB,gBAAhB,EAA+B,WAAU,0DACxC,8BAAC,kBAAe,MAAM,IAAI,eAAW,MAAC,GACxC;AAAA,UACA,oBAAC,gBAAgB,UAAhB,EAAyB,WAAU,SAAS,UAAS;AAAA,UACtD,oBAAC,gBAAgB,kBAAhB,EAAiC,WAAU,0DAC1C,8BAAC,oBAAiB,MAAM,IAAI,eAAW,MAAC,GAC1C;AAAA;AAAA;AAAA,IACF,GACF;AAAA,KACF;AAEJ;AAKO,SAAS,WAAW,EAAE,WAAW,UAAU,GAAG,MAAM,GAAoB;AAC7E,SACE;AAAA,IAAC,gBAAgB;AAAA,IAAhB;AAAA,MACC,WAAW;AAAA,QACT;AAAA,QACA;AAAA,MACF;AAAA,MACC,GAAG;AAAA,MAIJ;AAAA,4BAAC,UAAK,WAAU,6CACd,8BAAC,gBAAgB,eAAhB,EAA8B,SAAO,MACpC,8BAAC,eAAY,MAAM,IAAI,eAAW,MAAC,GACrC,GACF;AAAA,QACA,oBAAC,gBAAgB,UAAhB,EAA0B,UAAS;AAAA;AAAA;AAAA,EACtC;AAEJ;AASO,SAAS,YAAY;AAAA,EAC1B;AAAA,EACA,GAAG;AACL,GAAiD;AAC/C,SACE;AAAA,IAAC,gBAAgB;AAAA,IAAhB;AAAA,MACC,WAAW,GAAG,2CAA2C,SAAS;AAAA,MACjE,GAAG;AAAA;AAAA,EACN;AAEJ;AAGO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA,GAAG;AACL,GAAqD;AACnD,SACE,oBAAC,gBAAgB,WAAhB,EAA0B,WAAW,GAAG,yBAAyB,SAAS,GAAI,GAAG,OAAO;AAE7F;AAEA,IAAO,iBAAQ;","names":[]}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { HTMLAttributes, ReactNode } from 'react';
|
|
3
|
+
|
|
4
|
+
interface SeparatorProps extends HTMLAttributes<HTMLDivElement> {
|
|
5
|
+
orientation?: 'horizontal' | 'vertical';
|
|
6
|
+
/** `hairline` divides rows inside one block; `edge` divides one block from the next. */
|
|
7
|
+
weight?: 'hairline' | 'edge' | 'hard';
|
|
8
|
+
/**
|
|
9
|
+
* A rule that only groups things visually is decoration and must not be
|
|
10
|
+
* announced. Set `false` when the rule genuinely separates two sections a
|
|
11
|
+
* screen reader should hear as distinct.
|
|
12
|
+
*/
|
|
13
|
+
decorative?: boolean;
|
|
14
|
+
/**
|
|
15
|
+
* Words in the break — "or continue with", "Older".
|
|
16
|
+
*
|
|
17
|
+
* Horizontal only, and it changes the construction rather than the styling:
|
|
18
|
+
* see the note on the component. `decorative` no longer applies, because the
|
|
19
|
+
* label is content and the two rules beside it are decoration either way.
|
|
20
|
+
*/
|
|
21
|
+
label?: ReactNode;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* A rule, with or without words in it.
|
|
25
|
+
*
|
|
26
|
+
* In a monochrome system the rule does the work colour would otherwise do, so
|
|
27
|
+
* it has three weights rather than one: hairline between rows, edge between
|
|
28
|
+
* blocks, hard under a masthead. Picking by name keeps a page from drifting
|
|
29
|
+
* into five hand-tuned greys.
|
|
30
|
+
*
|
|
31
|
+
* **On the label.** "or continue with" was two Separators and a span at every
|
|
32
|
+
* call site, and the usual one-element version — text laid over a single rule
|
|
33
|
+
* with a background to punch a hole in it — needs to know the ground it is
|
|
34
|
+
* sitting on. Get that wrong and the notch is `--paper` on a card that is
|
|
35
|
+
* `--stone`, which reads as a rendering bug. So there is no ground: the rule is
|
|
36
|
+
* drawn twice, one piece either side of the label, and the gap is a gap. It is
|
|
37
|
+
* correct on any surface without being told which one it is on.
|
|
38
|
+
*
|
|
39
|
+
* @example
|
|
40
|
+
* <Separator weight="hard" />
|
|
41
|
+
* @example
|
|
42
|
+
* <Separator orientation="vertical" className="h-4" />
|
|
43
|
+
* @example
|
|
44
|
+
* <Separator label="or continue with" />
|
|
45
|
+
*/
|
|
46
|
+
declare function Separator({ orientation, weight, decorative, label, className, ...rest }: SeparatorProps): react.JSX.Element;
|
|
47
|
+
|
|
48
|
+
export { Separator, type SeparatorProps, Separator as default };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { cn } from "../../lib/cn.js";
|
|
3
|
+
const WEIGHT = {
|
|
4
|
+
hairline: "bg-(--rule)",
|
|
5
|
+
edge: "bg-(--rule-2)",
|
|
6
|
+
hard: "bg-(--rule-hard)"
|
|
7
|
+
};
|
|
8
|
+
function Separator({
|
|
9
|
+
orientation = "horizontal",
|
|
10
|
+
weight = "hairline",
|
|
11
|
+
decorative = true,
|
|
12
|
+
label,
|
|
13
|
+
className,
|
|
14
|
+
...rest
|
|
15
|
+
}) {
|
|
16
|
+
if (label != null && orientation === "horizontal") {
|
|
17
|
+
return /* @__PURE__ */ jsxs("div", { className: cn("flex w-full items-center gap-3", className), ...rest, children: [
|
|
18
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("h-px flex-1", WEIGHT[weight]) }),
|
|
19
|
+
/* @__PURE__ */ jsx("span", { className: "shrink-0 mono-meta text-(--ink-3-aa)", children: label }),
|
|
20
|
+
/* @__PURE__ */ jsx("span", { "aria-hidden": "true", className: cn("h-px flex-1", WEIGHT[weight]) })
|
|
21
|
+
] });
|
|
22
|
+
}
|
|
23
|
+
return /* @__PURE__ */ jsx(
|
|
24
|
+
"div",
|
|
25
|
+
{
|
|
26
|
+
role: decorative ? "none" : "separator",
|
|
27
|
+
"aria-orientation": decorative ? void 0 : orientation,
|
|
28
|
+
className: cn(
|
|
29
|
+
"shrink-0",
|
|
30
|
+
orientation === "horizontal" ? "h-px w-full" : "h-full w-px",
|
|
31
|
+
WEIGHT[weight],
|
|
32
|
+
className
|
|
33
|
+
),
|
|
34
|
+
...rest
|
|
35
|
+
}
|
|
36
|
+
);
|
|
37
|
+
}
|
|
38
|
+
var Separator_default = Separator;
|
|
39
|
+
export {
|
|
40
|
+
Separator,
|
|
41
|
+
Separator_default as default
|
|
42
|
+
};
|
|
43
|
+
//# sourceMappingURL=Separator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/components/Separator/Separator.tsx"],"sourcesContent":["import type { HTMLAttributes, ReactNode } from 'react'\nimport { cn } from '../../lib/cn'\n\nexport interface SeparatorProps extends HTMLAttributes<HTMLDivElement> {\n orientation?: 'horizontal' | 'vertical'\n /** `hairline` divides rows inside one block; `edge` divides one block from the next. */\n weight?: 'hairline' | 'edge' | 'hard'\n /**\n * A rule that only groups things visually is decoration and must not be\n * announced. Set `false` when the rule genuinely separates two sections a\n * screen reader should hear as distinct.\n */\n decorative?: boolean\n /**\n * Words in the break — \"or continue with\", \"Older\".\n *\n * Horizontal only, and it changes the construction rather than the styling:\n * see the note on the component. `decorative` no longer applies, because the\n * label is content and the two rules beside it are decoration either way.\n */\n label?: ReactNode\n}\n\nconst WEIGHT = {\n hairline: 'bg-(--rule)',\n edge: 'bg-(--rule-2)',\n hard: 'bg-(--rule-hard)',\n} as const\n\n/**\n * A rule, with or without words in it.\n *\n * In a monochrome system the rule does the work colour would otherwise do, so\n * it has three weights rather than one: hairline between rows, edge between\n * blocks, hard under a masthead. Picking by name keeps a page from drifting\n * into five hand-tuned greys.\n *\n * **On the label.** \"or continue with\" was two Separators and a span at every\n * call site, and the usual one-element version — text laid over a single rule\n * with a background to punch a hole in it — needs to know the ground it is\n * sitting on. Get that wrong and the notch is `--paper` on a card that is\n * `--stone`, which reads as a rendering bug. So there is no ground: the rule is\n * drawn twice, one piece either side of the label, and the gap is a gap. It is\n * correct on any surface without being told which one it is on.\n *\n * @example\n * <Separator weight=\"hard\" />\n * @example\n * <Separator orientation=\"vertical\" className=\"h-4\" />\n * @example\n * <Separator label=\"or continue with\" />\n */\nexport function Separator({\n orientation = 'horizontal',\n weight = 'hairline',\n decorative = true,\n label,\n className,\n ...rest\n}: SeparatorProps) {\n if (label != null && orientation === 'horizontal') {\n return (\n <div className={cn('flex w-full items-center gap-3', className)} {...rest}>\n <span aria-hidden=\"true\" className={cn('h-px flex-1', WEIGHT[weight])} />\n <span className=\"shrink-0 mono-meta text-(--ink-3-aa)\">{label}</span>\n <span aria-hidden=\"true\" className={cn('h-px flex-1', WEIGHT[weight])} />\n </div>\n )\n }\n\n return (\n <div\n role={decorative ? 'none' : 'separator'}\n aria-orientation={decorative ? undefined : orientation}\n className={cn(\n 'shrink-0',\n orientation === 'horizontal' ? 'h-px w-full' : 'h-full w-px',\n WEIGHT[weight],\n className,\n )}\n {...rest}\n />\n )\n}\n\nexport default Separator\n"],"mappings":"AA8DM,SACE,KADF;AA7DN,SAAS,UAAU;AAsBnB,MAAM,SAAS;AAAA,EACb,UAAU;AAAA,EACV,MAAM;AAAA,EACN,MAAM;AACR;AAyBO,SAAS,UAAU;AAAA,EACxB,cAAc;AAAA,EACd,SAAS;AAAA,EACT,aAAa;AAAA,EACb;AAAA,EACA;AAAA,EACA,GAAG;AACL,GAAmB;AACjB,MAAI,SAAS,QAAQ,gBAAgB,cAAc;AACjD,WACE,qBAAC,SAAI,WAAW,GAAG,kCAAkC,SAAS,GAAI,GAAG,MACnE;AAAA,0BAAC,UAAK,eAAY,QAAO,WAAW,GAAG,eAAe,OAAO,MAAM,CAAC,GAAG;AAAA,MACvE,oBAAC,UAAK,WAAU,wCAAwC,iBAAM;AAAA,MAC9D,oBAAC,UAAK,eAAY,QAAO,WAAW,GAAG,eAAe,OAAO,MAAM,CAAC,GAAG;AAAA,OACzE;AAAA,EAEJ;AAEA,SACE;AAAA,IAAC;AAAA;AAAA,MACC,MAAM,aAAa,SAAS;AAAA,MAC5B,oBAAkB,aAAa,SAAY;AAAA,MAC3C,WAAW;AAAA,QACT;AAAA,QACA,gBAAgB,eAAe,gBAAgB;AAAA,QAC/C,OAAO,MAAM;AAAA,QACb;AAAA,MACF;AAAA,MACC,GAAG;AAAA;AAAA,EACN;AAEJ;AAEA,IAAO,oBAAQ;","names":[]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import * as react from 'react';
|
|
2
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
3
|
+
import * as DialogPrimitive from '@radix-ui/react-dialog';
|
|
4
|
+
|
|
5
|
+
/** Radix Dialog root, trigger and close — a sheet IS a dialog, docked. */
|
|
6
|
+
declare const Sheet: react.FC<DialogPrimitive.DialogProps>;
|
|
7
|
+
declare const SheetTrigger: react.ForwardRefExoticComponent<DialogPrimitive.DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
8
|
+
declare const SheetClose: react.ForwardRefExoticComponent<DialogPrimitive.DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
|
|
9
|
+
type SheetSide = 'start' | 'end' | 'top' | 'bottom';
|
|
10
|
+
interface SheetContentProps extends Omit<ComponentProps<typeof DialogPrimitive.Content>, 'title'> {
|
|
11
|
+
/** Which edge it is docked to. `end` by default. */
|
|
12
|
+
side?: SheetSide;
|
|
13
|
+
title: ReactNode;
|
|
14
|
+
description?: ReactNode;
|
|
15
|
+
/** Hide the title visually while keeping it for assistive tech. */
|
|
16
|
+
hideTitle?: boolean;
|
|
17
|
+
/** Accessible close action, supplied by the host locale. */
|
|
18
|
+
closeLabel?: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* A panel docked to an edge of the viewport.
|
|
22
|
+
*
|
|
23
|
+
* It is a modal dialog — Radix's, so the focus trap, the escape key, the scroll
|
|
24
|
+
* lock and the `aria-modal` wiring are the same ones `Dialog` gets. The only
|
|
25
|
+
* differences are where it sits and which way it arrives, which is why this
|
|
26
|
+
* shares that implementation rather than reproducing it: a second focus trap is
|
|
27
|
+
* a second focus trap to get wrong.
|
|
28
|
+
*
|
|
29
|
+
* The title is required, visible or not. A modal with no accessible name drops
|
|
30
|
+
* a screen reader into an unnamed region with no way back out.
|
|
31
|
+
*
|
|
32
|
+
* Portals into the element an enclosing `OverlayContainer` names, docking to
|
|
33
|
+
* that element's edge rather than the viewport's when there is one.
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* <Sheet>
|
|
37
|
+
* <SheetTrigger asChild><Button variant="secondary">Filters</Button></SheetTrigger>
|
|
38
|
+
* <SheetContent title="Filters" description="Narrow the list.">…</SheetContent>
|
|
39
|
+
* </Sheet>
|
|
40
|
+
*/
|
|
41
|
+
declare function SheetContent({ side, title, description, hideTitle, closeLabel, className, children, ...rest }: SheetContentProps): react.JSX.Element;
|
|
42
|
+
|
|
43
|
+
export { Sheet, SheetClose, SheetContent, type SheetContentProps, type SheetSide, SheetTrigger, Sheet as default };
|