@langchain/macaw-components 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +27 -0
- package/dist/_chunks/ErrorState-CmPX01HV.js +13361 -0
- package/dist/_chunks/ErrorState-CmPX01HV.js.map +1 -0
- package/dist/_chunks/LoadingIndicator-DgtU9aqD.js +80 -0
- package/dist/_chunks/LoadingIndicator-DgtU9aqD.js.map +1 -0
- package/dist/base.css +305 -0
- package/dist/catalog.json +1675 -0
- package/dist/components/Avatar/Avatar.d.ts +28 -0
- package/dist/components/Avatar/Avatar.js +47 -0
- package/dist/components/Avatar/Avatar.js.map +1 -0
- package/dist/components/Avatar/index.d.ts +2 -0
- package/dist/components/Avatar/index.js +2 -0
- package/dist/components/Badge/Badge.d.ts +25 -0
- package/dist/components/Badge/Badge.js +82 -0
- package/dist/components/Badge/Badge.js.map +1 -0
- package/dist/components/Badge/index.d.ts +2 -0
- package/dist/components/Badge/index.js +2 -0
- package/dist/components/Banner/Banner.d.ts +15 -0
- package/dist/components/Banner/Banner.js +102 -0
- package/dist/components/Banner/Banner.js.map +1 -0
- package/dist/components/Banner/index.d.ts +2 -0
- package/dist/components/Banner/index.js +2 -0
- package/dist/components/BarChart/AnimatedBar.d.ts +20 -0
- package/dist/components/BarChart/AnimatedBar.js +65 -0
- package/dist/components/BarChart/AnimatedBar.js.map +1 -0
- package/dist/components/BarChart/BarChart.d.ts +25 -0
- package/dist/components/BarChart/BarChart.js +248 -0
- package/dist/components/BarChart/BarChart.js.map +1 -0
- package/dist/components/BarChart/BarChart.types.d.ts +239 -0
- package/dist/components/BarChart/BarChart.types.js +0 -0
- package/dist/components/BarChart/BarChart.utils.d.ts +51 -0
- package/dist/components/BarChart/BarChart.utils.js +215 -0
- package/dist/components/BarChart/BarChart.utils.js.map +1 -0
- package/dist/components/BarChart/BarChartAxes.d.ts +22 -0
- package/dist/components/BarChart/BarChartAxes.js +144 -0
- package/dist/components/BarChart/BarChartAxes.js.map +1 -0
- package/dist/components/BarChart/BarChartGuides.d.ts +22 -0
- package/dist/components/BarChart/BarChartGuides.js +83 -0
- package/dist/components/BarChart/BarChartGuides.js.map +1 -0
- package/dist/components/BarChart/BarChartPlot.d.ts +40 -0
- package/dist/components/BarChart/BarChartPlot.js +262 -0
- package/dist/components/BarChart/BarChartPlot.js.map +1 -0
- package/dist/components/BarChart/constants.d.ts +21 -0
- package/dist/components/BarChart/constants.js +26 -0
- package/dist/components/BarChart/constants.js.map +1 -0
- package/dist/components/BarChart/index.d.ts +3 -0
- package/dist/components/BarChart/index.js +3 -0
- package/dist/components/Button/Button.d.ts +36 -0
- package/dist/components/Button/Button.js +99 -0
- package/dist/components/Button/Button.js.map +1 -0
- package/dist/components/Button/constants.d.ts +26 -0
- package/dist/components/Button/constants.js +31 -0
- package/dist/components/Button/constants.js.map +1 -0
- package/dist/components/Button/index.d.ts +2 -0
- package/dist/components/Button/index.js +2 -0
- package/dist/components/ButtonGroup/ButtonGroup.d.ts +30 -0
- package/dist/components/ButtonGroup/ButtonGroup.js +26 -0
- package/dist/components/ButtonGroup/ButtonGroup.js.map +1 -0
- package/dist/components/ButtonGroup/index.d.ts +2 -0
- package/dist/components/ButtonGroup/index.js +2 -0
- package/dist/components/Card/Card.d.ts +10 -0
- package/dist/components/Card/Card.js +23 -0
- package/dist/components/Card/Card.js.map +1 -0
- package/dist/components/Card/index.d.ts +2 -0
- package/dist/components/Card/index.js +2 -0
- package/dist/components/ChartCard/ChartCard.d.ts +53 -0
- package/dist/components/ChartCard/ChartCard.js +172 -0
- package/dist/components/ChartCard/ChartCard.js.map +1 -0
- package/dist/components/ChartCard/ChartCardSkeleton.d.ts +7 -0
- package/dist/components/ChartCard/ChartCardSkeleton.js +61 -0
- package/dist/components/ChartCard/ChartCardSkeleton.js.map +1 -0
- package/dist/components/ChartCard/index.d.ts +4 -0
- package/dist/components/ChartCard/index.js +3 -0
- package/dist/components/ChartLegend/ChartLegend.d.ts +19 -0
- package/dist/components/ChartLegend/ChartLegend.js +195 -0
- package/dist/components/ChartLegend/ChartLegend.js.map +1 -0
- package/dist/components/ChartLegend/ChartLegendItemRenderer.d.ts +14 -0
- package/dist/components/ChartLegend/ChartLegendItemRenderer.js +90 -0
- package/dist/components/ChartLegend/ChartLegendItemRenderer.js.map +1 -0
- package/dist/components/ChartLegend/index.d.ts +3 -0
- package/dist/components/ChartLegend/index.js +3 -0
- package/dist/components/ChartLegend/useChartLegendActiveItem.d.ts +7 -0
- package/dist/components/ChartLegend/useChartLegendActiveItem.js +35 -0
- package/dist/components/ChartLegend/useChartLegendActiveItem.js.map +1 -0
- package/dist/components/ChartLegend/utils.d.ts +20 -0
- package/dist/components/ChartLegend/utils.js +33 -0
- package/dist/components/ChartLegend/utils.js.map +1 -0
- package/dist/components/ChartTooltip/ChartTooltip.d.ts +23 -0
- package/dist/components/ChartTooltip/ChartTooltip.js +83 -0
- package/dist/components/ChartTooltip/ChartTooltip.js.map +1 -0
- package/dist/components/ChartTooltip/index.d.ts +2 -0
- package/dist/components/ChartTooltip/index.js +2 -0
- package/dist/components/Checkbox/Checkbox.d.ts +58 -0
- package/dist/components/Checkbox/Checkbox.js +50 -0
- package/dist/components/Checkbox/Checkbox.js.map +1 -0
- package/dist/components/Checkbox/constants.d.ts +28 -0
- package/dist/components/Checkbox/constants.js +57 -0
- package/dist/components/Checkbox/constants.js.map +1 -0
- package/dist/components/Checkbox/getCheckedState.d.ts +6 -0
- package/dist/components/Checkbox/getCheckedState.js +14 -0
- package/dist/components/Checkbox/getCheckedState.js.map +1 -0
- package/dist/components/Checkbox/index.d.ts +3 -0
- package/dist/components/Checkbox/index.js +3 -0
- package/dist/components/CircularProgress/CircularProgress.d.ts +54 -0
- package/dist/components/CircularProgress/CircularProgress.js +85 -0
- package/dist/components/CircularProgress/CircularProgress.js.map +1 -0
- package/dist/components/CircularProgress/index.d.ts +2 -0
- package/dist/components/CircularProgress/index.js +2 -0
- package/dist/components/Code/Code.utils.d.ts +24 -0
- package/dist/components/Code/Code.utils.js +160 -0
- package/dist/components/Code/Code.utils.js.map +1 -0
- package/dist/components/Code/CodeLite.d.ts +19 -0
- package/dist/components/Code/CodeLite.js +146 -0
- package/dist/components/Code/CodeLite.js.map +1 -0
- package/dist/components/Code/CodeLite.utils.d.ts +24 -0
- package/dist/components/Code/CodeLite.utils.js +273 -0
- package/dist/components/Code/CodeLite.utils.js.map +1 -0
- package/dist/components/Code/ImageReplacerExtension.d.ts +9 -0
- package/dist/components/Code/ImageReplacerExtension.js +227 -0
- package/dist/components/Code/ImageReplacerExtension.js.map +1 -0
- package/dist/components/Code/JsonHighlighterExtension.d.ts +4 -0
- package/dist/components/Code/JsonHighlighterExtension.js +172 -0
- package/dist/components/Code/JsonHighlighterExtension.js.map +1 -0
- package/dist/components/Code/constants.d.ts +6 -0
- package/dist/components/Code/constants.js +11 -0
- package/dist/components/Code/constants.js.map +1 -0
- package/dist/components/Code/index.d.ts +30 -0
- package/dist/components/Code/index.js +140 -0
- package/dist/components/Code/index.js.map +1 -0
- package/dist/components/Code/languages/json.d.ts +1 -0
- package/dist/components/Code/languages/json.js +7 -0
- package/dist/components/Code/languages/json.js.map +1 -0
- package/dist/components/Code/languages/languages.d.ts +7 -0
- package/dist/components/Code/languages/languages.js +12 -0
- package/dist/components/Code/languages/languages.js.map +1 -0
- package/dist/components/Code/languages/python.d.ts +1 -0
- package/dist/components/Code/languages/python.js +7 -0
- package/dist/components/Code/languages/python.js.map +1 -0
- package/dist/components/Code/languages/shell.d.ts +7 -0
- package/dist/components/Code/languages/shell.js +241 -0
- package/dist/components/Code/languages/shell.js.map +1 -0
- package/dist/components/Code/languages/typescript.d.ts +1 -0
- package/dist/components/Code/languages/typescript.js +7 -0
- package/dist/components/Code/languages/typescript.js.map +1 -0
- package/dist/components/Code/languages/yaml.d.ts +2 -0
- package/dist/components/Code/languages/yaml.js +44 -0
- package/dist/components/Code/languages/yaml.js.map +1 -0
- package/dist/components/Code/types.d.ts +8 -0
- package/dist/components/Code/types.js +0 -0
- package/dist/components/Code/utils.d.ts +4 -0
- package/dist/components/Code/utils.js +27 -0
- package/dist/components/Code/utils.js.map +1 -0
- package/dist/components/Command/Command.d.ts +78 -0
- package/dist/components/Command/Command.js +78 -0
- package/dist/components/Command/Command.js.map +1 -0
- package/dist/components/Command/CommandMenu.d.ts +65 -0
- package/dist/components/Command/CommandMenu.js +101 -0
- package/dist/components/Command/CommandMenu.js.map +1 -0
- package/dist/components/Command/index.d.ts +4 -0
- package/dist/components/Command/index.js +3 -0
- package/dist/components/ContextMenu/ContextMenu.d.ts +9 -0
- package/dist/components/ContextMenu/ContextMenu.js +43 -0
- package/dist/components/ContextMenu/ContextMenu.js.map +1 -0
- package/dist/components/ContextMenu/index.d.ts +1 -0
- package/dist/components/ContextMenu/index.js +2 -0
- package/dist/components/CopyButton/CopyButton.d.ts +24 -0
- package/dist/components/CopyButton/CopyButton.js +121 -0
- package/dist/components/CopyButton/CopyButton.js.map +1 -0
- package/dist/components/CopyButton/copyToClipboard.d.ts +1 -0
- package/dist/components/CopyButton/copyToClipboard.js +29 -0
- package/dist/components/CopyButton/copyToClipboard.js.map +1 -0
- package/dist/components/CopyButton/index.d.ts +4 -0
- package/dist/components/CopyButton/index.js +4 -0
- package/dist/components/CopyButton/useCopy.d.ts +10 -0
- package/dist/components/CopyButton/useCopy.js +46 -0
- package/dist/components/CopyButton/useCopy.js.map +1 -0
- package/dist/components/Dialog/index.d.ts +49 -0
- package/dist/components/Dialog/index.js +130 -0
- package/dist/components/Dialog/index.js.map +1 -0
- package/dist/components/Divider/Divider.d.ts +9 -0
- package/dist/components/Divider/Divider.js +27 -0
- package/dist/components/Divider/Divider.js.map +1 -0
- package/dist/components/Divider/index.d.ts +2 -0
- package/dist/components/Divider/index.js +2 -0
- package/dist/components/DonutChart/DonutChart.d.ts +101 -0
- package/dist/components/DonutChart/DonutChart.js +197 -0
- package/dist/components/DonutChart/DonutChart.js.map +1 -0
- package/dist/components/DonutChart/DonutChart.utils.d.ts +38 -0
- package/dist/components/DonutChart/DonutChart.utils.js +93 -0
- package/dist/components/DonutChart/DonutChart.utils.js.map +1 -0
- package/dist/components/DonutChart/constants.d.ts +7 -0
- package/dist/components/DonutChart/constants.js +12 -0
- package/dist/components/DonutChart/constants.js.map +1 -0
- package/dist/components/DonutChart/index.d.ts +4 -0
- package/dist/components/DonutChart/index.js +4 -0
- package/dist/components/DropdownMenu/DropdownMenu.d.ts +24 -0
- package/dist/components/DropdownMenu/DropdownMenu.js +149 -0
- package/dist/components/DropdownMenu/DropdownMenu.js.map +1 -0
- package/dist/components/DropdownMenu/index.d.ts +1 -0
- package/dist/components/DropdownMenu/index.js +2 -0
- package/dist/components/EmptyState/EmptyState.d.ts +26 -0
- package/dist/components/EmptyState/EmptyState.js +85 -0
- package/dist/components/EmptyState/EmptyState.js.map +1 -0
- package/dist/components/EmptyState/index.d.ts +2 -0
- package/dist/components/EmptyState/index.js +2 -0
- package/dist/components/ErrorBoundary.d.ts +35 -0
- package/dist/components/ErrorBoundary.js +41 -0
- package/dist/components/ErrorBoundary.js.map +1 -0
- package/dist/components/ErrorMessage/ErrorMessage.d.ts +17 -0
- package/dist/components/ErrorMessage/ErrorMessage.js +146 -0
- package/dist/components/ErrorMessage/ErrorMessage.js.map +1 -0
- package/dist/components/ErrorMessage/index.d.ts +2 -0
- package/dist/components/ErrorMessage/index.js +2 -0
- package/dist/components/ErrorState/ErrorState.d.ts +23 -0
- package/dist/components/ErrorState/ErrorState.js +2 -0
- package/dist/components/ErrorState/index.d.ts +2 -0
- package/dist/components/ErrorState/index.js +2 -0
- package/dist/components/GroupedTabs/GroupedTabs.d.ts +31 -0
- package/dist/components/GroupedTabs/GroupedTabs.js +92 -0
- package/dist/components/GroupedTabs/GroupedTabs.js.map +1 -0
- package/dist/components/GroupedTabs/index.d.ts +2 -0
- package/dist/components/GroupedTabs/index.js +2 -0
- package/dist/components/HoverCard.d.ts +4 -0
- package/dist/components/HoverCard.js +34 -0
- package/dist/components/HoverCard.js.map +1 -0
- package/dist/components/Icon/Icon.d.ts +25 -0
- package/dist/components/Icon/Icon.js +57 -0
- package/dist/components/Icon/Icon.js.map +1 -0
- package/dist/components/Icon/index.d.ts +2 -0
- package/dist/components/Icon/index.js +2 -0
- package/dist/components/IconButton/IconButton.d.ts +35 -0
- package/dist/components/IconButton/IconButton.js +73 -0
- package/dist/components/IconButton/IconButton.js.map +1 -0
- package/dist/components/IconButton/index.d.ts +2 -0
- package/dist/components/IconButton/index.js +2 -0
- package/dist/components/Input/Input.d.ts +72 -0
- package/dist/components/Input/Input.js +221 -0
- package/dist/components/Input/Input.js.map +1 -0
- package/dist/components/Input/index.d.ts +2 -0
- package/dist/components/Input/index.js +2 -0
- package/dist/components/Input/inputStyles.d.ts +28 -0
- package/dist/components/Input/inputStyles.js +45 -0
- package/dist/components/Input/inputStyles.js.map +1 -0
- package/dist/components/Kbd/Kbd.d.ts +15 -0
- package/dist/components/Kbd/Kbd.js +30 -0
- package/dist/components/Kbd/Kbd.js.map +1 -0
- package/dist/components/Kbd/index.d.ts +2 -0
- package/dist/components/Kbd/index.js +2 -0
- package/dist/components/LineChart/LineChart.d.ts +8 -0
- package/dist/components/LineChart/LineChart.js +194 -0
- package/dist/components/LineChart/LineChart.js.map +1 -0
- package/dist/components/LineChart/LineChart.types.d.ts +138 -0
- package/dist/components/LineChart/LineChart.types.js +0 -0
- package/dist/components/LineChart/LineChart.utils.d.ts +29 -0
- package/dist/components/LineChart/LineChart.utils.js +123 -0
- package/dist/components/LineChart/LineChart.utils.js.map +1 -0
- package/dist/components/LineChart/LineChartPlot.d.ts +43 -0
- package/dist/components/LineChart/LineChartPlot.js +306 -0
- package/dist/components/LineChart/LineChartPlot.js.map +1 -0
- package/dist/components/LineChart/constants.d.ts +3 -0
- package/dist/components/LineChart/constants.js +8 -0
- package/dist/components/LineChart/constants.js.map +1 -0
- package/dist/components/LineChart/index.d.ts +2 -0
- package/dist/components/LineChart/index.js +2 -0
- package/dist/components/LinearProgress/LinearProgress.d.ts +16 -0
- package/dist/components/LinearProgress/LinearProgress.js +42 -0
- package/dist/components/LinearProgress/LinearProgress.js.map +1 -0
- package/dist/components/LinearProgress/index.d.ts +2 -0
- package/dist/components/LinearProgress/index.js +2 -0
- package/dist/components/Link/Link.d.ts +30 -0
- package/dist/components/Link/Link.js +51 -0
- package/dist/components/Link/Link.js.map +1 -0
- package/dist/components/Link/index.d.ts +2 -0
- package/dist/components/Link/index.js +2 -0
- package/dist/components/Logo/index.d.ts +17 -0
- package/dist/components/Logo/index.js +705 -0
- package/dist/components/Logo/index.js.map +1 -0
- package/dist/components/MetricChart/MetricChart.d.ts +9 -0
- package/dist/components/MetricChart/MetricChart.js +42 -0
- package/dist/components/MetricChart/MetricChart.js.map +1 -0
- package/dist/components/MetricChart/formatters.d.ts +18 -0
- package/dist/components/MetricChart/formatters.js +34 -0
- package/dist/components/MetricChart/formatters.js.map +1 -0
- package/dist/components/MetricChart/index.d.ts +4 -0
- package/dist/components/MetricChart/index.js +3 -0
- package/dist/components/Pane/Pane.d.ts +29 -0
- package/dist/components/Pane/Pane.js +171 -0
- package/dist/components/Pane/Pane.js.map +1 -0
- package/dist/components/Pane/Pane.utils.d.ts +10 -0
- package/dist/components/Pane/Pane.utils.js +7 -0
- package/dist/components/Pane/Pane.utils.js.map +1 -0
- package/dist/components/Pane/index.d.ts +3 -0
- package/dist/components/Pane/index.js +3 -0
- package/dist/components/PlainTextEditor/hooks/useResizeTextEditor.d.ts +9 -0
- package/dist/components/PlainTextEditor/hooks/useResizeTextEditor.js +76 -0
- package/dist/components/PlainTextEditor/hooks/useResizeTextEditor.js.map +1 -0
- package/dist/components/PlainTextEditor/index.d.ts +18 -0
- package/dist/components/PlainTextEditor/index.js +71 -0
- package/dist/components/PlainTextEditor/index.js.map +1 -0
- package/dist/components/Popover/Popover.d.ts +13 -0
- package/dist/components/Popover/Popover.js +48 -0
- package/dist/components/Popover/Popover.js.map +1 -0
- package/dist/components/Popover/constants.d.ts +1 -0
- package/dist/components/Popover/constants.js +6 -0
- package/dist/components/Popover/constants.js.map +1 -0
- package/dist/components/Popover/index.d.ts +1 -0
- package/dist/components/Popover/index.js +2 -0
- package/dist/components/PortalSlot.d.ts +11 -0
- package/dist/components/PortalSlot.js +41 -0
- package/dist/components/PortalSlot.js.map +1 -0
- package/dist/components/ProgressBar/ProgressBar.d.ts +38 -0
- package/dist/components/ProgressBar/ProgressBar.js +82 -0
- package/dist/components/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/components/ProgressBar/index.d.ts +2 -0
- package/dist/components/ProgressBar/index.js +2 -0
- package/dist/components/RadioButton/RadioButton.d.ts +62 -0
- package/dist/components/RadioButton/RadioButton.js +38 -0
- package/dist/components/RadioButton/RadioButton.js.map +1 -0
- package/dist/components/RadioButton/constants.d.ts +30 -0
- package/dist/components/RadioButton/constants.js +55 -0
- package/dist/components/RadioButton/constants.js.map +1 -0
- package/dist/components/RadioButton/index.d.ts +2 -0
- package/dist/components/RadioButton/index.js +2 -0
- package/dist/components/RadioCard/RadioCard.d.ts +26 -0
- package/dist/components/RadioCard/RadioCard.js +43 -0
- package/dist/components/RadioCard/RadioCard.js.map +1 -0
- package/dist/components/RadioCard/index.d.ts +2 -0
- package/dist/components/RadioCard/index.js +2 -0
- package/dist/components/RadioGroup/RadioGroup.d.ts +5 -0
- package/dist/components/RadioGroup/RadioGroup.js +17 -0
- package/dist/components/RadioGroup/RadioGroup.js.map +1 -0
- package/dist/components/RadioGroup/RadioGroupItem.d.ts +5 -0
- package/dist/components/RadioGroup/RadioGroupItem.js +22 -0
- package/dist/components/RadioGroup/RadioGroupItem.js.map +1 -0
- package/dist/components/RadioGroup/index.d.ts +4 -0
- package/dist/components/RadioGroup/index.js +3 -0
- package/dist/components/Select/Select.d.ts +84 -0
- package/dist/components/Select/Select.js +120 -0
- package/dist/components/Select/Select.js.map +1 -0
- package/dist/components/Select/SelectPrimitive.d.ts +17 -0
- package/dist/components/Select/SelectPrimitive.js +126 -0
- package/dist/components/Select/SelectPrimitive.js.map +1 -0
- package/dist/components/Select/index.d.ts +4 -0
- package/dist/components/Select/index.js +3 -0
- package/dist/components/Skeleton/Skeleton.d.ts +13 -0
- package/dist/components/Skeleton/Skeleton.js +25 -0
- package/dist/components/Skeleton/Skeleton.js.map +1 -0
- package/dist/components/Skeleton/index.d.ts +1 -0
- package/dist/components/Skeleton/index.js +2 -0
- package/dist/components/Slider/Slider.d.ts +33 -0
- package/dist/components/Slider/Slider.js +64 -0
- package/dist/components/Slider/Slider.js.map +1 -0
- package/dist/components/Slider/index.d.ts +2 -0
- package/dist/components/Slider/index.js +2 -0
- package/dist/components/SparkLineChart/SparkLineChart.d.ts +14 -0
- package/dist/components/SparkLineChart/SparkLineChart.js +112 -0
- package/dist/components/SparkLineChart/SparkLineChart.js.map +1 -0
- package/dist/components/SparkLineChart/index.d.ts +2 -0
- package/dist/components/SparkLineChart/index.js +2 -0
- package/dist/components/Spinner/Spinner.d.ts +12 -0
- package/dist/components/Spinner/Spinner.js +33 -0
- package/dist/components/Spinner/Spinner.js.map +1 -0
- package/dist/components/Spinner/index.d.ts +1 -0
- package/dist/components/Spinner/index.js +2 -0
- package/dist/components/SplitViewPane/SplitViewPane.d.ts +41 -0
- package/dist/components/SplitViewPane/SplitViewPane.js +314 -0
- package/dist/components/SplitViewPane/SplitViewPane.js.map +1 -0
- package/dist/components/SplitViewPane/SplitViewPaneHeader.d.ts +22 -0
- package/dist/components/SplitViewPane/SplitViewPaneHeader.js +105 -0
- package/dist/components/SplitViewPane/SplitViewPaneHeader.js.map +1 -0
- package/dist/components/SplitViewPane/index.d.ts +2 -0
- package/dist/components/SplitViewPane/index.js +3 -0
- package/dist/components/SplitViewPane/openPaneRegistry.d.ts +2 -0
- package/dist/components/SplitViewPane/openPaneRegistry.js +49 -0
- package/dist/components/SplitViewPane/openPaneRegistry.js.map +1 -0
- package/dist/components/Switch/Switch.d.ts +35 -0
- package/dist/components/Switch/Switch.js +65 -0
- package/dist/components/Switch/Switch.js.map +1 -0
- package/dist/components/Switch/index.d.ts +2 -0
- package/dist/components/Switch/index.js +2 -0
- package/dist/components/Tabs/index.d.ts +27 -0
- package/dist/components/Tabs/index.js +45 -0
- package/dist/components/Tabs/index.js.map +1 -0
- package/dist/components/Text/Text.d.ts +13 -0
- package/dist/components/Text/Text.js +58 -0
- package/dist/components/Text/Text.js.map +1 -0
- package/dist/components/Text/index.d.ts +2 -0
- package/dist/components/Text/index.js +2 -0
- package/dist/components/TextVirtualizer.d.ts +8 -0
- package/dist/components/TextVirtualizer.js +53 -0
- package/dist/components/TextVirtualizer.js.map +1 -0
- package/dist/components/TextWithLinks.d.ts +6 -0
- package/dist/components/TextWithLinks.js +61 -0
- package/dist/components/TextWithLinks.js.map +1 -0
- package/dist/components/Textarea/Textarea.d.ts +47 -0
- package/dist/components/Textarea/Textarea.js +150 -0
- package/dist/components/Textarea/Textarea.js.map +1 -0
- package/dist/components/Textarea/index.d.ts +2 -0
- package/dist/components/Textarea/index.js +2 -0
- package/dist/components/ThinkingState/LoadingIndicator.d.ts +19 -0
- package/dist/components/ThinkingState/LoadingIndicator.js +2 -0
- package/dist/components/ThinkingState/NOTICE +25 -0
- package/dist/components/ThinkingState/ThinkingState.d.ts +21 -0
- package/dist/components/ThinkingState/ThinkingState.js +42 -0
- package/dist/components/ThinkingState/ThinkingState.js.map +1 -0
- package/dist/components/ThinkingState/ThinkingStateTimer.d.ts +9 -0
- package/dist/components/ThinkingState/ThinkingStateTimer.js +43 -0
- package/dist/components/ThinkingState/ThinkingStateTimer.js.map +1 -0
- package/dist/components/ThinkingState/index.d.ts +4 -0
- package/dist/components/ThinkingState/index.js +3 -0
- package/dist/components/Toast/ToastContext.d.ts +5 -0
- package/dist/components/Toast/ToastContext.js +9 -0
- package/dist/components/Toast/ToastContext.js.map +1 -0
- package/dist/components/Toast/index.d.ts +13 -0
- package/dist/components/Toast/index.js +166 -0
- package/dist/components/Toast/index.js.map +1 -0
- package/dist/components/Toast/useToast.d.ts +3 -0
- package/dist/components/Toast/useToast.js +11 -0
- package/dist/components/Toast/useToast.js.map +1 -0
- package/dist/components/Tooltip/Tooltip.d.ts +19 -0
- package/dist/components/Tooltip/Tooltip.js +57 -0
- package/dist/components/Tooltip/Tooltip.js.map +1 -0
- package/dist/components/Tooltip/index.d.ts +3 -0
- package/dist/components/Tooltip/index.js +3 -0
- package/dist/components/TopList/TopList.d.ts +3 -0
- package/dist/components/TopList/TopList.js +186 -0
- package/dist/components/TopList/TopList.js.map +1 -0
- package/dist/components/TopList/TopList.types.d.ts +34 -0
- package/dist/components/TopList/TopList.types.js +0 -0
- package/dist/components/TopList/TopList.utils.d.ts +3 -0
- package/dist/components/TopList/TopList.utils.js +16 -0
- package/dist/components/TopList/TopList.utils.js.map +1 -0
- package/dist/components/TopList/index.d.ts +2 -0
- package/dist/components/TopList/index.js +2 -0
- package/dist/components/Typeahead/Typeahead.d.ts +5 -0
- package/dist/components/Typeahead/Typeahead.js +305 -0
- package/dist/components/Typeahead/Typeahead.js.map +1 -0
- package/dist/components/Typeahead/Typeahead.types.d.ts +99 -0
- package/dist/components/Typeahead/Typeahead.types.js +0 -0
- package/dist/components/Typeahead/Typeahead.utils.d.ts +25 -0
- package/dist/components/Typeahead/Typeahead.utils.js +73 -0
- package/dist/components/Typeahead/Typeahead.utils.js.map +1 -0
- package/dist/components/Typeahead/TypeaheadParts.d.ts +25 -0
- package/dist/components/Typeahead/TypeaheadParts.js +109 -0
- package/dist/components/Typeahead/TypeaheadParts.js.map +1 -0
- package/dist/components/Typeahead/TypeaheadView.d.ts +81 -0
- package/dist/components/Typeahead/TypeaheadView.js +228 -0
- package/dist/components/Typeahead/TypeaheadView.js.map +1 -0
- package/dist/components/Typeahead/index.d.ts +2 -0
- package/dist/components/Typeahead/index.js +2 -0
- package/dist/components/Typeahead/useTypeaheadDomSync.d.ts +15 -0
- package/dist/components/Typeahead/useTypeaheadDomSync.js +43 -0
- package/dist/components/Typeahead/useTypeaheadDomSync.js.map +1 -0
- package/dist/components/Typeahead/useTypeaheadUncontrolledInput.d.ts +11 -0
- package/dist/components/Typeahead/useTypeaheadUncontrolledInput.js +32 -0
- package/dist/components/Typeahead/useTypeaheadUncontrolledInput.js.map +1 -0
- package/dist/components/UnsavedChangesDialog.d.ts +14 -0
- package/dist/components/UnsavedChangesDialog.js +67 -0
- package/dist/components/UnsavedChangesDialog.js.map +1 -0
- package/dist/components/index.d.ts +58 -0
- package/dist/components/index.js +35 -0
- package/dist/components.css +102 -0
- package/dist/contexts/ErrorReporterContext.d.ts +6 -0
- package/dist/contexts/ErrorReporterContext.js +7 -0
- package/dist/contexts/ErrorReporterContext.js.map +1 -0
- package/dist/hooks/AppThemeProvider.d.ts +8 -0
- package/dist/hooks/AppThemeProvider.js +52 -0
- package/dist/hooks/AppThemeProvider.js.map +1 -0
- package/dist/hooks/useColorScheme.d.ts +20 -0
- package/dist/hooks/useColorScheme.js +50 -0
- package/dist/hooks/useColorScheme.js.map +1 -0
- package/dist/icons/LongTailPhosphorIcons.d.ts +51 -0
- package/dist/icons/LongTailPhosphorIcons.js +102 -0
- package/dist/icons/LongTailPhosphorIcons.js.map +1 -0
- package/dist/icons/PaddedPhosphorIcons.d.ts +17 -0
- package/dist/icons/PaddedPhosphorIcons.js +55 -0
- package/dist/icons/PaddedPhosphorIcons.js.map +1 -0
- package/dist/icons/WeightedPhosphorIcons.d.ts +45 -0
- package/dist/icons/WeightedPhosphorIcons.js +96 -0
- package/dist/icons/WeightedPhosphorIcons.js.map +1 -0
- package/dist/icons/index.d.ts +2 -0
- package/dist/icons/index.js +4 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +36 -0
- package/dist/styles.css +10 -0
- package/dist/utilities.css +2 -0
- package/dist/utils/VirtuosoCustomScrollParentContext/index.d.ts +7 -0
- package/dist/utils/VirtuosoCustomScrollParentContext/index.js +15 -0
- package/dist/utils/VirtuosoCustomScrollParentContext/index.js.map +1 -0
- package/dist/utils/VirtuosoCustomScrollParentContext/useScrollParent.d.ts +4 -0
- package/dist/utils/VirtuosoCustomScrollParentContext/useScrollParent.js +10 -0
- package/dist/utils/VirtuosoCustomScrollParentContext/useScrollParent.js.map +1 -0
- package/dist/utils/ZIndexContext.d.ts +5 -0
- package/dist/utils/ZIndexContext.js +13 -0
- package/dist/utils/ZIndexContext.js.map +1 -0
- package/dist/utils/animation.d.ts +37 -0
- package/dist/utils/animation.js +42 -0
- package/dist/utils/animation.js.map +1 -0
- package/dist/utils/chartAxisLayout.d.ts +6 -0
- package/dist/utils/chartAxisLayout.js +8 -0
- package/dist/utils/chartAxisLayout.js.map +1 -0
- package/dist/utils/chartColors.d.ts +38 -0
- package/dist/utils/chartColors.js +78 -0
- package/dist/utils/chartColors.js.map +1 -0
- package/dist/utils/chartConstants.d.ts +10 -0
- package/dist/utils/chartConstants.js +15 -0
- package/dist/utils/chartConstants.js.map +1 -0
- package/dist/utils/chartValues.d.ts +2 -0
- package/dist/utils/chartValues.js +36 -0
- package/dist/utils/chartValues.js.map +1 -0
- package/dist/utils/clamp.d.ts +2 -0
- package/dist/utils/clamp.js +7 -0
- package/dist/utils/clamp.js.map +1 -0
- package/dist/utils/cn.d.ts +2 -0
- package/dist/utils/cn.js +191 -0
- package/dist/utils/cn.js.map +1 -0
- package/dist/utils/componentSizes.d.ts +104 -0
- package/dist/utils/componentSizes.js +104 -0
- package/dist/utils/componentSizes.js.map +1 -0
- package/dist/utils/controlIconSizes.d.ts +10 -0
- package/dist/utils/controlIconSizes.js +32 -0
- package/dist/utils/controlIconSizes.js.map +1 -0
- package/dist/utils/csp-nonce.d.ts +11 -0
- package/dist/utils/csp-nonce.js +17 -0
- package/dist/utils/csp-nonce.js.map +1 -0
- package/dist/utils/get-closest-scroll-parent.d.ts +1 -0
- package/dist/utils/get-closest-scroll-parent.js +16 -0
- package/dist/utils/get-closest-scroll-parent.js.map +1 -0
- package/dist/utils/get-color-by-string.d.ts +1 -0
- package/dist/utils/get-color-by-string.js +10 -0
- package/dist/utils/get-color-by-string.js.map +1 -0
- package/dist/utils/getYAxisLeftMargin.d.ts +10 -0
- package/dist/utils/getYAxisLeftMargin.js +20 -0
- package/dist/utils/getYAxisLeftMargin.js.map +1 -0
- package/dist/utils/icon-types.d.ts +8 -0
- package/dist/utils/icon-types.js +0 -0
- package/dist/utils/lazy-codemirror-loader.d.ts +70 -0
- package/dist/utils/lazy-codemirror-loader.js +79 -0
- package/dist/utils/lazy-codemirror-loader.js.map +1 -0
- package/dist/utils/merge-refs.d.ts +2 -0
- package/dist/utils/merge-refs.js +13 -0
- package/dist/utils/merge-refs.js.map +1 -0
- package/dist/utils/parseTextLinks.d.ts +7 -0
- package/dist/utils/parseTextLinks.js +46 -0
- package/dist/utils/parseTextLinks.js.map +1 -0
- package/dist/utils/prettify-error-payload.d.ts +7 -0
- package/dist/utils/prettify-error-payload.js +188 -0
- package/dist/utils/prettify-error-payload.js.map +1 -0
- package/dist/utils/spacing.d.ts +30 -0
- package/dist/utils/spacing.js +34 -0
- package/dist/utils/spacing.js.map +1 -0
- package/dist/utils/useCodeMirror.d.ts +7 -0
- package/dist/utils/useCodeMirror.js +28 -0
- package/dist/utils/useCodeMirror.js.map +1 -0
- package/dist/utils/useZIndex.d.ts +52 -0
- package/dist/utils/useZIndex.js +62 -0
- package/dist/utils/useZIndex.js.map +1 -0
- package/dist/utils/zIndices.d.ts +42 -0
- package/dist/utils/zIndices.js +46 -0
- package/dist/utils/zIndices.js.map +1 -0
- package/docs/DESIGN.md +134 -0
- package/docs/STYLES.md +568 -0
- package/package.json +619 -0
- package/tailwind.preset.cjs +738 -0
- package/tailwind.preset.d.cts +5 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupedTabs.js","names":[],"sources":["../../../src/components/GroupedTabs/GroupedTabs.tsx"],"sourcesContent":["import type { ReactNode } from 'react';\nimport { useEffect, useRef, useState } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport type { IconComponent, IconWeight } from '../../utils/icon-types';\nimport { Text } from '../Text';\nimport type { TooltipProps } from '../Tooltip';\nimport { Tooltip } from '../Tooltip';\n\nexport interface GroupedTabOption<T> {\n display?: ReactNode | ((isActive: boolean) => ReactNode);\n value: T;\n disabled?: boolean;\n tooltip?: string | ReactNode;\n tooltipProps?: Omit<TooltipProps, 'children' | 'title'>;\n icon?: IconComponent;\n iconWeight?: IconWeight;\n leftDecorator?: ReactNode;\n rightDecorator?: ReactNode;\n className?: string;\n size?: 'xs' | 'sm' | 'md';\n textClassName?: string;\n 'aria-label'?: string;\n}\n\nexport type GroupedTabsProps<T extends string | number> = {\n value: T;\n onChange: (value: T) => void;\n options: readonly GroupedTabOption<T>[];\n className?: string;\n size?: 'xs' | 'sm' | 'md';\n disabled?: boolean;\n tooltip?: string | ReactNode;\n selectionClassName?: string;\n /** Optional class for the indicator (e.g. to override top/height for custom margins) */\n indicatorClassName?: string;\n};\n\nexport const GroupedTabs = <T extends string | number>({\n value,\n onChange,\n options,\n className,\n size = 'sm',\n disabled,\n tooltip,\n selectionClassName,\n indicatorClassName,\n}: GroupedTabsProps<T>) => {\n const containerRef = useRef<HTMLDivElement>(null);\n const buttonRefs = useRef<(HTMLButtonElement | null)[]>([]);\n const [clipState, setClipState] = useState<{\n path: string;\n isFirst: boolean;\n animate: boolean;\n }>({ path: '', isFirst: true, animate: false });\n\n useEffect(() => {\n const container = containerRef.current;\n const activeIndex = options.findIndex((option) => option.value === value);\n const activeButton = buttonRefs.current[activeIndex];\n\n if (activeButton && container) {\n const containerRect = container.getBoundingClientRect();\n const buttonRect = activeButton.getBoundingClientRect();\n const roundValue = size === 'xs' ? '1px' : size === 'sm' ? '2px' : '4px';\n\n const top = buttonRect.top - containerRect.top - container.clientTop;\n const bottom =\n containerRect.bottom - buttonRect.bottom - container.clientTop;\n const left = buttonRect.left - containerRect.left - container.clientLeft;\n const right =\n containerRect.right - buttonRect.right - container.clientLeft;\n\n setClipState((prev) => ({\n path: `inset(${top}px ${right}px ${bottom}px ${left}px round ${roundValue})`,\n isFirst: false,\n animate: !prev.isFirst,\n }));\n }\n }, [size, value, options]);\n\n const isActive = (option: GroupedTabOption<T>) => option.value === value;\n return (\n <Tooltip title={tooltip}>\n <div\n ref={containerRef}\n className={cn(\n 'relative flex w-fit border border-subtle bg-surface-level-1 p-0.5 dark:border-muted',\n size === 'xs' ? 'gap-px' : 'gap-0.5',\n size === 'xs'\n ? 'rounded-[2px]'\n : size === 'sm'\n ? 'rounded-[3px]'\n : 'rounded-sm',\n className\n )}\n >\n {/* Clip-path animated background indicator */}\n {clipState.path && (\n <div\n aria-hidden\n className={cn(\n 'pointer-events-none absolute inset-0 bg-surface-level-4',\n selectionClassName,\n indicatorClassName\n )}\n style={{\n clipPath: clipState.path,\n transition: clipState.animate\n ? 'clip-path 0.25s ease-out, background-color 0.25s ease-out'\n : 'none',\n }}\n />\n )}\n\n {options.map((option, idx) => (\n <Tooltip\n key={option.value}\n title={option.tooltip}\n {...option.tooltipProps}\n >\n {/* eslint-disable-next-line react/forbid-elements */}\n <button\n ref={(el) => {\n buttonRefs.current[idx] = el;\n }}\n type=\"button\"\n aria-label={option['aria-label']}\n onClick={() => onChange(option.value)}\n disabled={option.disabled || disabled}\n className={cn(\n 'relative flex items-center gap-space-1',\n 'transition-colors duration-fast',\n {\n 'rounded-xs px-space-1 py-px': size === 'xs',\n 'rounded-xs px-space-2 py-0.5': size === 'sm',\n 'rounded-sm px-space-2 py-space-1': size === 'md',\n },\n {\n 'text-primary': isActive(option),\n 'text-secondary hover:bg-surface-level-1-hover':\n !isActive(option),\n },\n (option.disabled || disabled) &&\n 'text-disabled hover:bg-transparent',\n option.className\n )}\n >\n {option.icon && (\n <option.icon\n aria-hidden\n className={size === 'xs' ? 'size-3' : 'size-4'}\n weight={option.iconWeight}\n />\n )}\n {option.leftDecorator}\n {option.display &&\n (typeof option.display === 'function' ? (\n option.display(isActive(option))\n ) : (\n <Text\n variant={size === 'xs' ? 'xs' : 'sm'}\n className={cn('font-medium', option.textClassName)}\n >\n {option.display}\n </Text>\n ))}\n {option.rightDecorator}\n </button>\n </Tooltip>\n ))}\n </div>\n </Tooltip>\n );\n};\n"],"mappings":";;;;;;AAsCA,IAAa,eAA0C,EACrD,OACA,UACA,SACA,WACA,OAAO,MACP,UACA,SACA,oBACA,yBACyB;CACzB,MAAM,eAAe,OAAuB,IAAI;CAChD,MAAM,aAAa,OAAqC,CAAC,CAAC;CAC1D,MAAM,CAAC,WAAW,gBAAgB,SAI/B;EAAE,MAAM;EAAI,SAAS;EAAM,SAAS;CAAM,CAAC;CAE9C,gBAAgB;EACd,MAAM,YAAY,aAAa;EAC/B,MAAM,cAAc,QAAQ,WAAW,WAAW,OAAO,UAAU,KAAK;EACxE,MAAM,eAAe,WAAW,QAAQ;EAExC,IAAI,gBAAgB,WAAW;GAC7B,MAAM,gBAAgB,UAAU,sBAAsB;GACtD,MAAM,aAAa,aAAa,sBAAsB;GACtD,MAAM,aAAa,SAAS,OAAO,QAAQ,SAAS,OAAO,QAAQ;GAEnE,MAAM,MAAM,WAAW,MAAM,cAAc,MAAM,UAAU;GAC3D,MAAM,SACJ,cAAc,SAAS,WAAW,SAAS,UAAU;GACvD,MAAM,OAAO,WAAW,OAAO,cAAc,OAAO,UAAU;GAC9D,MAAM,QACJ,cAAc,QAAQ,WAAW,QAAQ,UAAU;GAErD,cAAc,UAAU;IACtB,MAAM,SAAS,IAAI,KAAK,MAAM,KAAK,OAAO,KAAK,KAAK,WAAW,WAAW;IAC1E,SAAS;IACT,SAAS,CAAC,KAAK;GACjB,EAAE;EACJ;CACF,GAAG;EAAC;EAAM;EAAO;CAAO,CAAC;CAEzB,MAAM,YAAY,WAAgC,OAAO,UAAU;CACnE,OACE,oBAAC,SAAD;EAAS,OAAO;EACd,UAAA,qBAAC,OAAD;GACE,KAAK;GACL,WAAW,GACT,uFACA,SAAS,OAAO,WAAW,WAC3B,SAAS,OACL,kBACA,SAAS,OACP,kBACA,cACN,SACF;GAXF,UAAA,CAcG,UAAU,QACT,oBAAC,OAAD;IACE,eAAA;IACA,WAAW,GACT,2DACA,oBACA,kBACF;IACA,OAAO;KACL,UAAU,UAAU;KACpB,YAAY,UAAU,UAClB,8DACA;IACN;GACD,CAAA,GAGF,QAAQ,KAAK,QAAQ,QACpB,oBAAC,SAAD;IAEE,OAAO,OAAO;IACd,GAAI,OAAO;IAGX,UAAA,qBAAC,UAAD;KACE,MAAM,OAAO;MACX,WAAW,QAAQ,OAAO;KAC5B;KACA,MAAK;KACL,cAAY,OAAO;KACnB,eAAe,SAAS,OAAO,KAAK;KACpC,UAAU,OAAO,YAAY;KAC7B,WAAW,GACT,0CACA,mCACA;MACE,+BAA+B,SAAS;MACxC,gCAAgC,SAAS;MACzC,oCAAoC,SAAS;KAC/C,GACA;MACE,gBAAgB,SAAS,MAAM;MAC/B,iDACE,CAAC,SAAS,MAAM;KACpB,IACC,OAAO,YAAY,aAClB,sCACF,OAAO,SACT;KAxBF,UAAA;MA0BG,OAAO,QACN,oBAAC,OAAO,MAAR;OACE,eAAA;OACA,WAAW,SAAS,OAAO,WAAW;OACtC,QAAQ,OAAO;MAChB,CAAA;MAEF,OAAO;MACP,OAAO,YACL,OAAO,OAAO,YAAY,aACzB,OAAO,QAAQ,SAAS,MAAM,CAAC,IAE/B,oBAAC,MAAD;OACE,SAAS,SAAS,OAAO,OAAO;OAChC,WAAW,GAAG,eAAe,OAAO,aAAa;OAEhD,UAAA,OAAO;MACJ,CAAA;MAET,OAAO;KACF;;GACD,GApDF,OAAO,KAoDL,CACV,CACE;;CACE,CAAA;AAEb"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
|
2
|
+
export declare const HoverCard: import("react").FC<HoverCardPrimitive.HoverCardProps>;
|
|
3
|
+
export declare const HoverCardTrigger: import("react").ForwardRefExoticComponent<HoverCardPrimitive.HoverCardTriggerProps & import("react").RefAttributes<HTMLAnchorElement>>;
|
|
4
|
+
export declare const HoverCardContent: import("react").ForwardRefExoticComponent<Omit<HoverCardPrimitive.HoverCardContentProps & import("react").RefAttributes<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { cn } from "../utils/cn.js";
|
|
2
|
+
import zIndices from "../utils/zIndices.js";
|
|
3
|
+
import { useZIndex } from "../utils/useZIndex.js";
|
|
4
|
+
import { ZIndexProvider } from "../utils/ZIndexContext.js";
|
|
5
|
+
import { popoverSurfaceClassName } from "./Popover/constants.js";
|
|
6
|
+
import { forwardRef } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
import * as HoverCardPrimitive from "@radix-ui/react-hover-card";
|
|
9
|
+
//#region packages/components/src/components/HoverCard.tsx
|
|
10
|
+
var HoverCard = HoverCardPrimitive.Root;
|
|
11
|
+
var HoverCardTrigger = HoverCardPrimitive.Trigger;
|
|
12
|
+
var HoverCardContent = forwardRef(({ className, align = "center", sideOffset = 4, children, ...props }, ref) => {
|
|
13
|
+
const zIndex = useZIndex(zIndices.popover);
|
|
14
|
+
return /* @__PURE__ */ jsx(HoverCardPrimitive.Portal, { children: /* @__PURE__ */ jsx(HoverCardPrimitive.Content, {
|
|
15
|
+
ref,
|
|
16
|
+
align,
|
|
17
|
+
sideOffset,
|
|
18
|
+
className: cn(popoverSurfaceClassName, className),
|
|
19
|
+
...props,
|
|
20
|
+
style: {
|
|
21
|
+
zIndex,
|
|
22
|
+
...props.style
|
|
23
|
+
},
|
|
24
|
+
children: /* @__PURE__ */ jsx(ZIndexProvider, {
|
|
25
|
+
value: zIndex,
|
|
26
|
+
children
|
|
27
|
+
})
|
|
28
|
+
}) });
|
|
29
|
+
});
|
|
30
|
+
HoverCardContent.displayName = HoverCardPrimitive.Content.displayName;
|
|
31
|
+
//#endregion
|
|
32
|
+
export { HoverCard, HoverCardContent, HoverCardTrigger };
|
|
33
|
+
|
|
34
|
+
//# sourceMappingURL=HoverCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HoverCard.js","names":[],"sources":["../../src/components/HoverCard.tsx"],"sourcesContent":["import type { ComponentPropsWithoutRef, ElementRef } from 'react';\nimport { forwardRef } from 'react';\n\nimport * as HoverCardPrimitive from '@radix-ui/react-hover-card';\n\nimport { cn } from '../utils/cn';\nimport { useZIndex } from '../utils/useZIndex';\nimport { ZIndexProvider } from '../utils/ZIndexContext';\nimport zIndices from '../utils/zIndices';\nimport { popoverSurfaceClassName } from './Popover/constants';\n\nexport const HoverCard = HoverCardPrimitive.Root;\n\nexport const HoverCardTrigger = HoverCardPrimitive.Trigger;\n\nexport const HoverCardContent = forwardRef<\n ElementRef<typeof HoverCardPrimitive.Content>,\n ComponentPropsWithoutRef<typeof HoverCardPrimitive.Content>\n>(\n (\n { className, align = 'center', sideOffset = 4, children, ...props },\n ref\n ) => {\n const zIndex = useZIndex(zIndices.popover);\n\n return (\n <HoverCardPrimitive.Portal>\n <HoverCardPrimitive.Content\n ref={ref}\n align={align}\n sideOffset={sideOffset}\n className={cn(popoverSurfaceClassName, className)}\n {...props}\n style={{ zIndex, ...props.style }}\n >\n <ZIndexProvider value={zIndex}>{children}</ZIndexProvider>\n </HoverCardPrimitive.Content>\n </HoverCardPrimitive.Portal>\n );\n }\n);\nHoverCardContent.displayName = HoverCardPrimitive.Content.displayName;\n"],"mappings":";;;;;;;;;AAWA,IAAa,YAAY,mBAAmB;AAE5C,IAAa,mBAAmB,mBAAmB;AAEnD,IAAa,mBAAmB,YAK5B,EAAE,WAAW,QAAQ,UAAU,aAAa,GAAG,UAAU,GAAG,SAC5D,QACG;CACH,MAAM,SAAS,UAAU,SAAS,OAAO;CAEzC,OACE,oBAAC,mBAAmB,QAApB,EAAA,UACE,oBAAC,mBAAmB,SAApB;EACO;EACE;EACK;EACZ,WAAW,GAAG,yBAAyB,SAAS;EAChD,GAAI;EACJ,OAAO;GAAE;GAAQ,GAAG,MAAM;EAAM;EAEhC,UAAA,oBAAC,gBAAD;GAAgB,OAAO;GAAS;EAAyB,CAAA;CAC/B,CAAA,EACH,CAAA;AAE/B,CACF;AACA,iBAAiB,cAAc,mBAAmB,QAAQ"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { VisualElementSize } from '../../utils/componentSizes.js';
|
|
2
|
+
import type { IconComponent, IconWeight } from '../../utils/icon-types.js';
|
|
3
|
+
import type { TooltipProps } from '../Tooltip/index.js';
|
|
4
|
+
export type { IconComponent } from '../../utils/icon-types.js';
|
|
5
|
+
type IconSize = VisualElementSize | 'lg' | 'xl';
|
|
6
|
+
export interface IconProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
7
|
+
/** Icon component to display */
|
|
8
|
+
icon: IconComponent;
|
|
9
|
+
/** Color scheme for the icon */
|
|
10
|
+
color?: 'neutral' | 'brand' | 'success' | 'warning' | 'info' | 'error' | 'special';
|
|
11
|
+
/** Whether the background should be rounded */
|
|
12
|
+
rounded?: boolean;
|
|
13
|
+
/** Optional label - renders a tooltip when provided */
|
|
14
|
+
label?: React.ReactNode;
|
|
15
|
+
/** The size of the icon. Decorated icons also receive the corresponding presentation box. */
|
|
16
|
+
size?: IconSize;
|
|
17
|
+
/** Class name for the icon */
|
|
18
|
+
iconClassName?: string;
|
|
19
|
+
/** Weight used to render the icon */
|
|
20
|
+
weight?: IconWeight;
|
|
21
|
+
/** Tooltip props */
|
|
22
|
+
tooltipProps?: Omit<TooltipProps, 'children' | 'title'>;
|
|
23
|
+
}
|
|
24
|
+
declare const Icon: import("react").ForwardRefExoticComponent<IconProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
25
|
+
export { Icon };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
3
|
+
import { forwardRef } from "react";
|
|
4
|
+
import { jsx } from "react/jsx-runtime";
|
|
5
|
+
//#region packages/components/src/components/Icon/Icon.tsx
|
|
6
|
+
var ICON_GLYPH_SIZE = {
|
|
7
|
+
xxs: "size-3",
|
|
8
|
+
xs: "size-3",
|
|
9
|
+
sm: "size-3",
|
|
10
|
+
md: "size-4",
|
|
11
|
+
lg: "size-5",
|
|
12
|
+
xl: "size-6"
|
|
13
|
+
};
|
|
14
|
+
var Icon = forwardRef(({ icon: IconElement, color, rounded = false, label, size = "md", className, iconClassName, weight, tooltipProps, ...props }, ref) => {
|
|
15
|
+
const baseStyles = cn("inline-flex flex-shrink-0 items-center justify-center [&_path]:stroke-[1.5px]", color && {
|
|
16
|
+
"p-[2px]": size === "xs",
|
|
17
|
+
"p-space-1": size === "sm" || size === "md",
|
|
18
|
+
"p-space-2": size === "lg",
|
|
19
|
+
"p-space-3": size === "xl"
|
|
20
|
+
}, color && {
|
|
21
|
+
"rounded-full": rounded,
|
|
22
|
+
"rounded-md": !rounded
|
|
23
|
+
});
|
|
24
|
+
const getColorStyles = () => {
|
|
25
|
+
switch (color) {
|
|
26
|
+
case "success": return "bg-success-subtle text-status-green dark:bg-success";
|
|
27
|
+
case "warning": return "bg-warning-subtle dark:bg-warning text-status-orange";
|
|
28
|
+
case "brand":
|
|
29
|
+
case "info": return "bg-brand-subtle text-brand-primary";
|
|
30
|
+
case "error": return "bg-error-subtle text-status-red dark:bg-error";
|
|
31
|
+
case "special": return "bg-ls-acid-50 text-ls-acid-700";
|
|
32
|
+
case "neutral": return "bg-surface-level-4 text-secondary";
|
|
33
|
+
default: return "text-primary";
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
const content = /* @__PURE__ */ jsx("span", {
|
|
37
|
+
ref,
|
|
38
|
+
className: cn(baseStyles, getColorStyles(), className),
|
|
39
|
+
...props,
|
|
40
|
+
children: /* @__PURE__ */ jsx(IconElement, {
|
|
41
|
+
className: cn(ICON_GLYPH_SIZE[size], "flex-shrink-0", iconClassName),
|
|
42
|
+
weight
|
|
43
|
+
})
|
|
44
|
+
});
|
|
45
|
+
if (label) return /* @__PURE__ */ jsx(Tooltip, {
|
|
46
|
+
...tooltipProps,
|
|
47
|
+
title: label,
|
|
48
|
+
side: tooltipProps?.side ?? "top",
|
|
49
|
+
children: content
|
|
50
|
+
});
|
|
51
|
+
return content;
|
|
52
|
+
});
|
|
53
|
+
Icon.displayName = "Icon";
|
|
54
|
+
//#endregion
|
|
55
|
+
export { Icon };
|
|
56
|
+
|
|
57
|
+
//# sourceMappingURL=Icon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Icon.js","names":[],"sources":["../../../src/components/Icon/Icon.tsx"],"sourcesContent":["import { forwardRef } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport type { VisualElementSize } from '../../utils/componentSizes';\nimport type { IconComponent, IconWeight } from '../../utils/icon-types';\nimport type { TooltipProps } from '../Tooltip';\nimport { Tooltip } from '../Tooltip';\n\nexport type { IconComponent } from '../../utils/icon-types';\n\ntype IconSize = VisualElementSize | 'lg' | 'xl';\n\nconst ICON_GLYPH_SIZE: Record<IconSize, string> = {\n xxs: 'size-3',\n xs: 'size-3',\n sm: 'size-3',\n md: 'size-4',\n lg: 'size-5',\n xl: 'size-6',\n};\n\nexport interface IconProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Icon component to display */\n icon: IconComponent;\n /** Color scheme for the icon */\n color?:\n | 'neutral'\n | 'brand'\n | 'success'\n | 'warning'\n | 'info'\n | 'error'\n | 'special';\n /** Whether the background should be rounded */\n rounded?: boolean;\n /** Optional label - renders a tooltip when provided */\n label?: React.ReactNode;\n /** The size of the icon. Decorated icons also receive the corresponding presentation box. */\n size?: IconSize;\n /** Class name for the icon */\n iconClassName?: string;\n /** Weight used to render the icon */\n weight?: IconWeight;\n /** Tooltip props */\n tooltipProps?: Omit<TooltipProps, 'children' | 'title'>;\n}\n\nconst Icon = forwardRef<HTMLDivElement, IconProps>(\n (\n {\n icon: IconElement,\n color,\n rounded = false,\n label,\n size = 'md',\n className,\n iconClassName,\n weight,\n tooltipProps,\n ...props\n },\n ref\n ) => {\n const baseStyles = cn(\n 'inline-flex flex-shrink-0 items-center justify-center [&_path]:stroke-[1.5px]',\n color && {\n 'p-[2px]': size === 'xs',\n 'p-space-1': size === 'sm' || size === 'md',\n 'p-space-2': size === 'lg',\n 'p-space-3': size === 'xl',\n },\n color && {\n 'rounded-full': rounded,\n 'rounded-md': !rounded,\n }\n );\n\n const getColorStyles = () => {\n switch (color) {\n case 'success':\n return 'bg-success-subtle text-status-green dark:bg-success';\n case 'warning':\n return 'bg-warning-subtle dark:bg-warning text-status-orange';\n case 'brand':\n case 'info':\n return 'bg-brand-subtle text-brand-primary';\n case 'error':\n return 'bg-error-subtle text-status-red dark:bg-error';\n case 'special':\n return 'bg-ls-acid-50 text-ls-acid-700';\n case 'neutral':\n return 'bg-surface-level-4 text-secondary';\n default:\n return 'text-primary';\n }\n };\n\n const content = (\n <span\n ref={ref}\n className={cn(baseStyles, getColorStyles(), className)}\n {...props}\n >\n <IconElement\n className={cn(ICON_GLYPH_SIZE[size], 'flex-shrink-0', iconClassName)}\n weight={weight}\n />\n </span>\n );\n\n if (label) {\n return (\n <Tooltip\n {...tooltipProps}\n title={label}\n side={tooltipProps?.side ?? 'top'}\n >\n {content}\n </Tooltip>\n );\n }\n\n return content;\n }\n);\n\nIcon.displayName = 'Icon';\n\nexport { Icon };\n"],"mappings":";;;;;AAYA,IAAM,kBAA4C;CAChD,KAAK;CACL,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;AACN;AA4BA,IAAM,OAAO,YAET,EACE,MAAM,aACN,OACA,UAAU,OACV,OACA,OAAO,MACP,WACA,eACA,QACA,cACA,GAAG,SAEL,QACG;CACH,MAAM,aAAa,GACjB,iFACA,SAAS;EACP,WAAW,SAAS;EACpB,aAAa,SAAS,QAAQ,SAAS;EACvC,aAAa,SAAS;EACtB,aAAa,SAAS;CACxB,GACA,SAAS;EACP,gBAAgB;EAChB,cAAc,CAAC;CACjB,CACF;CAEA,MAAM,uBAAuB;EAC3B,QAAQ,OAAR;GACE,KAAK,WACH,OAAO;GACT,KAAK,WACH,OAAO;GACT,KAAK;GACL,KAAK,QACH,OAAO;GACT,KAAK,SACH,OAAO;GACT,KAAK,WACH,OAAO;GACT,KAAK,WACH,OAAO;GACT,SACE,OAAO;EACX;CACF;CAEA,MAAM,UACJ,oBAAC,QAAD;EACO;EACL,WAAW,GAAG,YAAY,eAAe,GAAG,SAAS;EACrD,GAAI;EAEJ,UAAA,oBAAC,aAAD;GACE,WAAW,GAAG,gBAAgB,OAAO,iBAAiB,aAAa;GAC3D;EACT,CAAA;CACG,CAAA;CAGR,IAAI,OACF,OACE,oBAAC,SAAD;EACE,GAAI;EACJ,OAAO;EACP,MAAM,cAAc,QAAQ;EAE3B,UAAA;CACM,CAAA;CAIb,OAAO;AACT,CACF;AAEA,KAAK,cAAc"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { type ControlSize } from '../../utils/componentSizes.js';
|
|
2
|
+
import type { IconComponent, IconWeight } from '../../utils/icon-types.js';
|
|
3
|
+
import type { TooltipProps } from '../Tooltip/index.js';
|
|
4
|
+
type IconButtonSize = 'xxs' | Exclude<ControlSize, 'lg'>;
|
|
5
|
+
interface IconButtonProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'onClick'> {
|
|
6
|
+
/** Button color scheme */
|
|
7
|
+
color?: 'primary' | 'secondary' | 'error';
|
|
8
|
+
/** Button visual variant */
|
|
9
|
+
variant?: 'normal' | 'outlined' | 'plain';
|
|
10
|
+
/** Click handler */
|
|
11
|
+
onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
|
|
12
|
+
/** Whether the button is disabled */
|
|
13
|
+
disabled?: boolean;
|
|
14
|
+
/** Whether the button should have rounded-full styling */
|
|
15
|
+
round?: boolean;
|
|
16
|
+
/** Icon component to display */
|
|
17
|
+
icon: IconComponent;
|
|
18
|
+
/** Label for the button tooltip and aria-label */
|
|
19
|
+
label: string;
|
|
20
|
+
/** Class name for the icon */
|
|
21
|
+
iconClassName?: string;
|
|
22
|
+
/** Phosphor weight used to render the icon */
|
|
23
|
+
iconWeight?: IconWeight;
|
|
24
|
+
/** Square outer box. xxs=16px is reserved for dense icon-only actions. */
|
|
25
|
+
size?: IconButtonSize;
|
|
26
|
+
/** Whether the button is loading */
|
|
27
|
+
loading?: boolean;
|
|
28
|
+
/** Tooltip props */
|
|
29
|
+
tooltipProps?: Omit<TooltipProps, 'children'>;
|
|
30
|
+
/** Pass through the `<button>` props to a child component */
|
|
31
|
+
asChild?: boolean;
|
|
32
|
+
}
|
|
33
|
+
declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
34
|
+
export { IconButton };
|
|
35
|
+
export type { IconButtonProps };
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { CONTROL_SIZES } from "../../utils/componentSizes.js";
|
|
3
|
+
import { Tooltip } from "../Tooltip/Tooltip.js";
|
|
4
|
+
import { buttonStyleMap } from "../Button/constants.js";
|
|
5
|
+
import { Spinner } from "../Spinner/Spinner.js";
|
|
6
|
+
import { cloneElement, forwardRef, isValidElement } from "react";
|
|
7
|
+
import { jsx } from "react/jsx-runtime";
|
|
8
|
+
//#region packages/components/src/components/IconButton/IconButton.tsx
|
|
9
|
+
var IconButton = forwardRef(({ color = "primary", variant = "normal", onClick, disabled = false, round = false, size = "sm", icon: Icon, label, className, iconClassName, iconWeight, tooltipProps, asChild = false, loading = false, ...props }, ref) => {
|
|
10
|
+
const baseStyles = cn("lc-button relative box-border inline-flex flex-none items-center justify-center p-0 transition-all duration-200", {
|
|
11
|
+
"size-4": size === "xxs",
|
|
12
|
+
[CONTROL_SIZES.xs.heightClassName]: size === "xs",
|
|
13
|
+
[CONTROL_SIZES.sm.heightClassName]: size === "sm",
|
|
14
|
+
[CONTROL_SIZES.md.heightClassName]: size === "md"
|
|
15
|
+
}, {
|
|
16
|
+
"w-5": size === "xs",
|
|
17
|
+
"w-6": size === "sm",
|
|
18
|
+
"w-8": size === "md"
|
|
19
|
+
}, {
|
|
20
|
+
"shadow-[0px_1px_2px_0px_var(--shadow-color-subtle)]": (variant === "normal" || variant === "outlined") && !disabled,
|
|
21
|
+
"rounded-full": round,
|
|
22
|
+
"rounded-xs": !round && (size === "xxs" || size === "xs"),
|
|
23
|
+
"rounded-sm": !round && size === "sm",
|
|
24
|
+
"rounded-md": !round && size === "md"
|
|
25
|
+
});
|
|
26
|
+
const children = loading ? /* @__PURE__ */ jsx(Spinner, { size: size === "xxs" || size === "xs" ? "xxs" : "xs" }) : /* @__PURE__ */ jsx(Icon, {
|
|
27
|
+
"aria-hidden": true,
|
|
28
|
+
className: cn(size === "xxs" && "size-3", size === "xs" && "size-3.5", (size === "sm" || size === "md") && "size-4", "flex-shrink-0", "[&_path]:stroke-[1.5px]", iconClassName),
|
|
29
|
+
weight: iconWeight
|
|
30
|
+
});
|
|
31
|
+
const getColorVariantStyles = () => {
|
|
32
|
+
const key = `${color}-${variant}-${disabled ? "disabled" : "enabled"}`;
|
|
33
|
+
return buttonStyleMap[key] || "";
|
|
34
|
+
};
|
|
35
|
+
const tooltipTitle = tooltipProps && "title" in tooltipProps ? tooltipProps.title : label;
|
|
36
|
+
if (asChild) {
|
|
37
|
+
if (!isValidElement(props.children)) return null;
|
|
38
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
39
|
+
...tooltipProps,
|
|
40
|
+
title: tooltipTitle,
|
|
41
|
+
side: tooltipProps?.side ?? "top",
|
|
42
|
+
children: cloneElement(props.children, {
|
|
43
|
+
className: cn(baseStyles, getColorVariantStyles(), className),
|
|
44
|
+
disabled,
|
|
45
|
+
onClick,
|
|
46
|
+
"aria-label": label,
|
|
47
|
+
ref,
|
|
48
|
+
...props,
|
|
49
|
+
children
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
return /* @__PURE__ */ jsx(Tooltip, {
|
|
54
|
+
...tooltipProps,
|
|
55
|
+
title: tooltipTitle,
|
|
56
|
+
side: tooltipProps?.side ?? "top",
|
|
57
|
+
children: /* @__PURE__ */ jsx("button", {
|
|
58
|
+
ref,
|
|
59
|
+
type: "button",
|
|
60
|
+
className: cn(baseStyles, getColorVariantStyles(), className),
|
|
61
|
+
disabled,
|
|
62
|
+
onClick,
|
|
63
|
+
"aria-label": label,
|
|
64
|
+
...props,
|
|
65
|
+
children
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
});
|
|
69
|
+
IconButton.displayName = "IconButton";
|
|
70
|
+
//#endregion
|
|
71
|
+
export { IconButton };
|
|
72
|
+
|
|
73
|
+
//# sourceMappingURL=IconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.js","names":[],"sources":["../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["import { cloneElement, forwardRef, isValidElement } from 'react';\n\nimport { cn } from '../../utils/cn';\nimport { CONTROL_SIZES, type ControlSize } from '../../utils/componentSizes';\nimport type { IconComponent, IconWeight } from '../../utils/icon-types';\nimport { buttonStyleMap } from '../Button/constants';\nimport { Spinner } from '../Spinner';\nimport type { TooltipProps } from '../Tooltip';\nimport { Tooltip } from '../Tooltip';\n\ntype IconButtonSize = 'xxs' | Exclude<ControlSize, 'lg'>;\n\ninterface IconButtonProps extends Omit<\n React.ButtonHTMLAttributes<HTMLButtonElement>,\n 'onClick'\n> {\n /** Button color scheme */\n color?: 'primary' | 'secondary' | 'error';\n /** Button visual variant */\n variant?: 'normal' | 'outlined' | 'plain';\n /** Click handler */\n onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;\n /** Whether the button is disabled */\n disabled?: boolean;\n /** Whether the button should have rounded-full styling */\n round?: boolean;\n /** Icon component to display */\n icon: IconComponent;\n /** Label for the button tooltip and aria-label */\n label: string;\n /** Class name for the icon */\n iconClassName?: string;\n /** Phosphor weight used to render the icon */\n iconWeight?: IconWeight;\n /** Square outer box. xxs=16px is reserved for dense icon-only actions. */\n size?: IconButtonSize;\n /** Whether the button is loading */\n loading?: boolean;\n /** Tooltip props */\n tooltipProps?: Omit<TooltipProps, 'children'>;\n /** Pass through the `<button>` props to a child component */\n asChild?: boolean;\n}\n\nconst IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(\n (\n {\n color = 'primary',\n variant = 'normal',\n onClick,\n disabled = false,\n round = false,\n size = 'sm',\n icon: Icon,\n label,\n className,\n iconClassName,\n iconWeight,\n tooltipProps,\n asChild = false,\n loading = false,\n ...props\n },\n ref\n ) => {\n const baseStyles = cn(\n 'lc-button relative box-border inline-flex flex-none items-center justify-center p-0 transition-all duration-200',\n {\n 'size-4': size === 'xxs',\n [CONTROL_SIZES.xs.heightClassName]: size === 'xs',\n [CONTROL_SIZES.sm.heightClassName]: size === 'sm',\n [CONTROL_SIZES.md.heightClassName]: size === 'md',\n },\n {\n 'w-5': size === 'xs',\n 'w-6': size === 'sm',\n 'w-8': size === 'md',\n },\n {\n 'shadow-[0px_1px_2px_0px_var(--shadow-color-subtle)]':\n (variant === 'normal' || variant === 'outlined') && !disabled,\n // Apply rounded-full if round prop is true, otherwise use rounded-md\n 'rounded-full': round,\n 'rounded-xs': !round && (size === 'xxs' || size === 'xs'),\n 'rounded-sm': !round && size === 'sm',\n 'rounded-md': !round && size === 'md',\n }\n );\n\n const children = loading ? (\n <Spinner size={size === 'xxs' || size === 'xs' ? 'xxs' : 'xs'} />\n ) : (\n <Icon\n aria-hidden\n className={cn(\n size === 'xxs' && 'size-3',\n size === 'xs' && 'size-3.5',\n (size === 'sm' || size === 'md') && 'size-4',\n 'flex-shrink-0',\n '[&_path]:stroke-[1.5px]',\n iconClassName\n )}\n weight={iconWeight}\n />\n );\n\n // Generate unique class combinations for each color/variant combination\n // This logic is extracted from the Button component to maintain consistency\n // Generate unique class combinations for each color/variant combination\n const getColorVariantStyles = () => {\n const state = disabled ? 'disabled' : 'enabled';\n const key = `${color}-${variant}-${state}` as keyof typeof buttonStyleMap;\n return buttonStyleMap[key] || '';\n };\n const tooltipTitle =\n tooltipProps && 'title' in tooltipProps ? tooltipProps.title : label;\n\n if (asChild) {\n if (\n !isValidElement<React.ComponentPropsWithRef<'button'>>(props.children)\n )\n return null;\n\n return (\n <Tooltip\n {...tooltipProps}\n title={tooltipTitle}\n side={tooltipProps?.side ?? 'top'}\n >\n {cloneElement(props.children, {\n className: cn(baseStyles, getColorVariantStyles(), className),\n disabled,\n onClick,\n 'aria-label': label,\n ref,\n ...props,\n children,\n })}\n </Tooltip>\n );\n }\n\n return (\n <Tooltip\n {...tooltipProps}\n title={tooltipTitle}\n side={tooltipProps?.side ?? 'top'}\n >\n {/* eslint-disable-next-line react/forbid-elements */}\n <button\n ref={ref}\n type=\"button\"\n className={cn(baseStyles, getColorVariantStyles(), className)}\n disabled={disabled}\n onClick={onClick}\n aria-label={label}\n {...props}\n >\n {children}\n </button>\n </Tooltip>\n );\n }\n);\n\nIconButton.displayName = 'IconButton';\n\nexport { IconButton };\nexport type { IconButtonProps };\n"],"mappings":";;;;;;;;AA4CA,IAAM,aAAa,YAEf,EACE,QAAQ,WACR,UAAU,UACV,SACA,WAAW,OACX,QAAQ,OACR,OAAO,MACP,MAAM,MACN,OACA,WACA,eACA,YACA,cACA,UAAU,OACV,UAAU,OACV,GAAG,SAEL,QACG;CACH,MAAM,aAAa,GACjB,mHACA;EACE,UAAU,SAAS;GAClB,cAAc,GAAG,kBAAkB,SAAS;GAC5C,cAAc,GAAG,kBAAkB,SAAS;GAC5C,cAAc,GAAG,kBAAkB,SAAS;CAC/C,GACA;EACE,OAAO,SAAS;EAChB,OAAO,SAAS;EAChB,OAAO,SAAS;CAClB,GACA;EACE,wDACG,YAAY,YAAY,YAAY,eAAe,CAAC;EAEvD,gBAAgB;EAChB,cAAc,CAAC,UAAU,SAAS,SAAS,SAAS;EACpD,cAAc,CAAC,SAAS,SAAS;EACjC,cAAc,CAAC,SAAS,SAAS;CACnC,CACF;CAEA,MAAM,WAAW,UACf,oBAAC,SAAD,EAAS,MAAM,SAAS,SAAS,SAAS,OAAO,QAAQ,KAAO,CAAA,IAEhE,oBAAC,MAAD;EACE,eAAA;EACA,WAAW,GACT,SAAS,SAAS,UAClB,SAAS,QAAQ,aAChB,SAAS,QAAQ,SAAS,SAAS,UACpC,iBACA,2BACA,aACF;EACA,QAAQ;CACT,CAAA;CAMH,MAAM,8BAA8B;EAElC,MAAM,MAAM,GAAG,MAAM,GAAG,QAAQ,GADlB,WAAW,aAAa;EAEtC,OAAO,eAAe,QAAQ;CAChC;CACA,MAAM,eACJ,gBAAgB,WAAW,eAAe,aAAa,QAAQ;CAEjE,IAAI,SAAS;EACX,IACE,CAAC,eAAsD,MAAM,QAAQ,GAErE,OAAO;EAET,OACE,oBAAC,SAAD;GACE,GAAI;GACJ,OAAO;GACP,MAAM,cAAc,QAAQ;GAE3B,UAAA,aAAa,MAAM,UAAU;IAC5B,WAAW,GAAG,YAAY,sBAAsB,GAAG,SAAS;IAC5D;IACA;IACA,cAAc;IACd;IACA,GAAG;IACH;GACF,CAAC;EACM,CAAA;CAEb;CAEA,OACE,oBAAC,SAAD;EACE,GAAI;EACJ,OAAO;EACP,MAAM,cAAc,QAAQ;EAG5B,UAAA,oBAAC,UAAD;GACO;GACL,MAAK;GACL,WAAW,GAAG,YAAY,sBAAsB,GAAG,SAAS;GAClD;GACD;GACT,cAAY;GACZ,GAAI;GAEH;EACK,CAAA;CACD,CAAA;AAEb,CACF;AAEA,WAAW,cAAc"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
import type { IconComponent } from '../../utils/icon-types.js';
|
|
3
|
+
import { IconButton } from '../IconButton/index.js';
|
|
4
|
+
import type { InputSize } from './inputStyles.js';
|
|
5
|
+
export type InputIconAction = Pick<ComponentProps<typeof IconButton>, 'icon' | 'label' | 'disabled' | 'tooltipProps'> & {
|
|
6
|
+
onClick: NonNullable<ComponentProps<typeof IconButton>['onClick']>;
|
|
7
|
+
};
|
|
8
|
+
export interface InputProps {
|
|
9
|
+
/** Exact outer height. The default lg tier preserves the legacy 40px field. */
|
|
10
|
+
size?: InputSize;
|
|
11
|
+
variant?: 'outlined' | 'plain';
|
|
12
|
+
/** Decorative icon. Input owns its size and color. */
|
|
13
|
+
leftIcon?: IconComponent;
|
|
14
|
+
/** Decorative icon. Input owns its size and color. */
|
|
15
|
+
rightIcon?: IconComponent;
|
|
16
|
+
/** Plain icon button. Takes precedence over leftIcon. */
|
|
17
|
+
leftAction?: InputIconAction;
|
|
18
|
+
/** Plain icon button. Takes precedence over rightIcon; precedes the password toggle. */
|
|
19
|
+
rightAction?: InputIconAction;
|
|
20
|
+
/** Custom content; overrides leftIcon/leftAction and the default file icon. */
|
|
21
|
+
leftDecorator?: ReactNode;
|
|
22
|
+
/** Custom content; overrides rightIcon/rightAction. The password toggle remains last. */
|
|
23
|
+
rightDecorator?: ReactNode;
|
|
24
|
+
/** Whether the input is disabled */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** Whether the input has an error state */
|
|
27
|
+
isError?: boolean;
|
|
28
|
+
/** Label text displayed above the input */
|
|
29
|
+
label?: string | ReactNode;
|
|
30
|
+
/** Hint text displayed below the input */
|
|
31
|
+
hintText?: string;
|
|
32
|
+
/** Current input value */
|
|
33
|
+
value?: string | null;
|
|
34
|
+
/** Change handler that will be debounced */
|
|
35
|
+
onChange: (value: string, event?: React.ChangeEvent<HTMLInputElement>) => void;
|
|
36
|
+
/** Placeholder text */
|
|
37
|
+
placeholder?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Input type. Limited to the "text-like" native types that share this
|
|
40
|
+
* component's styled-text rendering and string value contract. `password`
|
|
41
|
+
* renders a masked secret field with a show/hide toggle. `date` uses the
|
|
42
|
+
* browser's native date picker; its value is a `YYYY-MM-DD` string.
|
|
43
|
+
* `datetime-local` uses the native date+time picker; its value is a
|
|
44
|
+
* `YYYY-MM-DDTHH:mm` string in the viewer's local time. `file` is
|
|
45
|
+
* uncontrolled: read the selection from `event.target.files` on the change
|
|
46
|
+
* event, and scope it with `accept`/`multiple`.
|
|
47
|
+
*/
|
|
48
|
+
type?: 'text' | 'email' | 'password' | 'number' | 'url' | 'date' | 'datetime-local' | 'file';
|
|
49
|
+
/** Debounce delay in milliseconds (default: 300). Ignored for `type="file"`. */
|
|
50
|
+
debounceMs?: number;
|
|
51
|
+
/** Additional CSS classes */
|
|
52
|
+
className?: string;
|
|
53
|
+
/** Input ID for accessibility */
|
|
54
|
+
id?: string;
|
|
55
|
+
/** Input name for forms */
|
|
56
|
+
name?: string;
|
|
57
|
+
/** Whether the field is required */
|
|
58
|
+
required?: boolean;
|
|
59
|
+
/** Auto focus on mount */
|
|
60
|
+
autoFocus?: boolean;
|
|
61
|
+
/** CSS class for the input container */
|
|
62
|
+
inputContainerClassName?: string;
|
|
63
|
+
/**
|
|
64
|
+
* Which files the picker offers, as a comma-separated list of extensions or
|
|
65
|
+
* MIME types (`'.csv,.json'`, `'image/*'`). `type="file"` only. The browser
|
|
66
|
+
* treats this as a filter, not a guarantee — validate the selection too.
|
|
67
|
+
*/
|
|
68
|
+
accept?: string;
|
|
69
|
+
/** Whether more than one file can be picked. `type="file"` only. */
|
|
70
|
+
multiple?: boolean;
|
|
71
|
+
}
|
|
72
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & Omit<import("react").InputHTMLAttributes<HTMLInputElement>, keyof InputProps> & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
import { cn } from "../../utils/cn.js";
|
|
2
|
+
import { Text } from "../Text/Text.js";
|
|
3
|
+
import { Icon } from "../Icon/Icon.js";
|
|
4
|
+
import { IconButton } from "../IconButton/IconButton.js";
|
|
5
|
+
import { mergeRefs } from "../../utils/merge-refs.js";
|
|
6
|
+
import { INPUT_TEXT_CLASSES, getInputContainerClasses, getInputElementClasses } from "./inputStyles.js";
|
|
7
|
+
import { CONTROL_ICON_SIZES } from "../../utils/controlIconSizes.js";
|
|
8
|
+
import { forwardRef, useEffect, useId, useRef, useState } from "react";
|
|
9
|
+
import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
|
|
10
|
+
import { useDebouncedCallback } from "use-debounce";
|
|
11
|
+
import { CalendarBlankIcon } from "@phosphor-icons/react/dist/ssr/CalendarBlank";
|
|
12
|
+
import { EyeIcon } from "@phosphor-icons/react/dist/ssr/Eye";
|
|
13
|
+
import { EyeSlashIcon } from "@phosphor-icons/react/dist/ssr/EyeSlash";
|
|
14
|
+
import { PaperclipIcon } from "@phosphor-icons/react/dist/ssr/Paperclip";
|
|
15
|
+
//#region packages/components/src/components/Input/Input.tsx
|
|
16
|
+
function InputIconSlot({ icon, action, size, disabled }) {
|
|
17
|
+
const isDisabled = disabled || action?.disabled;
|
|
18
|
+
const colorClassName = isDisabled ? "text-icon-disabled" : "text-icon-secondary";
|
|
19
|
+
return action ? /* @__PURE__ */ jsx(IconButton, {
|
|
20
|
+
...action,
|
|
21
|
+
color: "secondary",
|
|
22
|
+
variant: "plain",
|
|
23
|
+
size: CONTROL_ICON_SIZES[size].buttonSize,
|
|
24
|
+
className: colorClassName,
|
|
25
|
+
iconWeight: "regular",
|
|
26
|
+
disabled: isDisabled,
|
|
27
|
+
onMouseDown: (event) => event.preventDefault()
|
|
28
|
+
}) : icon ? /* @__PURE__ */ jsx(Icon, {
|
|
29
|
+
"aria-hidden": true,
|
|
30
|
+
icon,
|
|
31
|
+
iconClassName: CONTROL_ICON_SIZES[size].iconClassName,
|
|
32
|
+
className: colorClassName,
|
|
33
|
+
weight: "regular"
|
|
34
|
+
}) : null;
|
|
35
|
+
}
|
|
36
|
+
function FileSelection({ size, fileNames, placeholder }) {
|
|
37
|
+
const summary = fileNames.length > 1 ? `${fileNames.length} files selected` : fileNames[0];
|
|
38
|
+
const textClasses = INPUT_TEXT_CLASSES[size];
|
|
39
|
+
return /* @__PURE__ */ jsxs(Fragment$1, { children: [/* @__PURE__ */ jsx(Text, {
|
|
40
|
+
"aria-hidden": true,
|
|
41
|
+
as: "span",
|
|
42
|
+
className: cn(textClasses, "min-w-0 flex-1 truncate", summary ? "text-primary" : "text-placeholder"),
|
|
43
|
+
children: summary ?? placeholder ?? "No file selected"
|
|
44
|
+
}), /* @__PURE__ */ jsx(Text, {
|
|
45
|
+
"aria-hidden": true,
|
|
46
|
+
as: "span",
|
|
47
|
+
weight: "medium",
|
|
48
|
+
className: cn(textClasses, "shrink-0 text-secondary"),
|
|
49
|
+
children: "Browse"
|
|
50
|
+
})] });
|
|
51
|
+
}
|
|
52
|
+
var Input = forwardRef(({ size = "lg", variant = "outlined", leftIcon, rightIcon, leftAction, rightAction, leftDecorator, rightDecorator, disabled = false, isError = false, label, hintText, value, onChange, placeholder, type = "text", debounceMs = 0, className, inputContainerClassName, id, name, required = false, autoFocus = false, accept, multiple, "aria-describedby": ariaDescribedBy, ...rest }, ref) => {
|
|
53
|
+
const generatedId = useId();
|
|
54
|
+
const inputId = id || generatedId;
|
|
55
|
+
const hintTextId = `${inputId}-hint`;
|
|
56
|
+
const describedBy = [hintText ? hintTextId : void 0, ariaDescribedBy].filter(Boolean).join(" ") || void 0;
|
|
57
|
+
const shouldDebounce = debounceMs > 0;
|
|
58
|
+
const isFileInput = type === "file";
|
|
59
|
+
const isPasswordInput = type === "password";
|
|
60
|
+
const isDateInput = type === "date" || type === "datetime-local";
|
|
61
|
+
const [internalValue, setInternalValue] = useState(value);
|
|
62
|
+
const [isPasswordVisible, setIsPasswordVisible] = useState(false);
|
|
63
|
+
const [selectedFileNames, setSelectedFileNames] = useState([]);
|
|
64
|
+
const debouncedOnChange = useDebouncedCallback(onChange, debounceMs);
|
|
65
|
+
const fileInputRef = useRef(null);
|
|
66
|
+
useEffect(() => {
|
|
67
|
+
if (!shouldDebounce) return;
|
|
68
|
+
return () => debouncedOnChange.flush();
|
|
69
|
+
}, [shouldDebounce, debouncedOnChange]);
|
|
70
|
+
const openFilePicker = (event) => {
|
|
71
|
+
const target = event.target;
|
|
72
|
+
if (disabled || target instanceof Element && target.closest("button, a, input, select, textarea, summary, [role=\"button\"], [role=\"link\"], [contenteditable=\"true\"]")) return;
|
|
73
|
+
fileInputRef.current?.click();
|
|
74
|
+
};
|
|
75
|
+
useEffect(() => {
|
|
76
|
+
if (shouldDebounce) setInternalValue(value);
|
|
77
|
+
}, [shouldDebounce, value]);
|
|
78
|
+
useEffect(() => {
|
|
79
|
+
if (!isPasswordInput) setIsPasswordVisible(false);
|
|
80
|
+
}, [isPasswordInput]);
|
|
81
|
+
useEffect(() => {
|
|
82
|
+
const form = isFileInput ? fileInputRef.current?.form : null;
|
|
83
|
+
if (!form) return;
|
|
84
|
+
const clearFileSelection = () => setSelectedFileNames([]);
|
|
85
|
+
form.addEventListener("reset", clearFileSelection);
|
|
86
|
+
return () => form.removeEventListener("reset", clearFileSelection);
|
|
87
|
+
}, [isFileInput]);
|
|
88
|
+
const handleInputChange = (e) => {
|
|
89
|
+
const newValue = e.target.value;
|
|
90
|
+
if (isFileInput) {
|
|
91
|
+
onChange(newValue, e);
|
|
92
|
+
setSelectedFileNames(Array.from(e.target.files ?? []).map((file) => file.name));
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
if (shouldDebounce) {
|
|
96
|
+
setInternalValue(newValue);
|
|
97
|
+
debouncedOnChange(newValue);
|
|
98
|
+
} else onChange(newValue, e);
|
|
99
|
+
};
|
|
100
|
+
const inputContainerClasses = getInputContainerClasses({
|
|
101
|
+
size,
|
|
102
|
+
variant,
|
|
103
|
+
isError,
|
|
104
|
+
disabled,
|
|
105
|
+
className: inputContainerClassName
|
|
106
|
+
});
|
|
107
|
+
const inputClasses = isFileInput ? "sr-only" : getInputElementClasses({
|
|
108
|
+
size,
|
|
109
|
+
disabled,
|
|
110
|
+
className: cn(isPasswordInput && !isPasswordVisible && "text-security", isDateInput && [
|
|
111
|
+
"supports-[selector(input::-webkit-calendar-picker-indicator)]:[&::-webkit-calendar-picker-indicator]:size-[var(--control-icon-size)]",
|
|
112
|
+
"supports-[selector(input::-webkit-calendar-picker-indicator)]:[&::-webkit-calendar-picker-indicator]:m-0",
|
|
113
|
+
"supports-[selector(input::-webkit-calendar-picker-indicator)]:[&::-webkit-calendar-picker-indicator]:p-0",
|
|
114
|
+
"supports-[selector(input::-webkit-calendar-picker-indicator)]:[&::-webkit-calendar-picker-indicator]:opacity-0"
|
|
115
|
+
])
|
|
116
|
+
});
|
|
117
|
+
const effectiveLeftIcon = leftIcon ?? (isFileInput ? PaperclipIcon : void 0);
|
|
118
|
+
const hasCustomLeftDecorator = leftDecorator != null;
|
|
119
|
+
const hasCustomRightDecorator = rightDecorator != null;
|
|
120
|
+
const effectiveLeftDecorator = leftDecorator ?? (effectiveLeftIcon || leftAction ? /* @__PURE__ */ jsx(InputIconSlot, {
|
|
121
|
+
icon: effectiveLeftIcon,
|
|
122
|
+
action: leftAction,
|
|
123
|
+
size,
|
|
124
|
+
disabled
|
|
125
|
+
}) : null);
|
|
126
|
+
const rightContent = rightDecorator ?? (rightIcon || rightAction ? /* @__PURE__ */ jsx(InputIconSlot, {
|
|
127
|
+
icon: rightIcon,
|
|
128
|
+
action: rightAction,
|
|
129
|
+
size,
|
|
130
|
+
disabled
|
|
131
|
+
}) : null);
|
|
132
|
+
const leftActionOffset = !hasCustomLeftDecorator && leftAction ? CONTROL_ICON_SIZES[size].actionOffset : void 0;
|
|
133
|
+
const rightActionOffset = isPasswordInput || !hasCustomRightDecorator && rightAction ? CONTROL_ICON_SIZES[size].actionOffset : void 0;
|
|
134
|
+
const effectiveRightDecorator = rightContent || isPasswordInput ? /* @__PURE__ */ jsxs(Fragment$1, { children: [rightContent, isPasswordInput && /* @__PURE__ */ jsx(InputIconSlot, {
|
|
135
|
+
size,
|
|
136
|
+
disabled,
|
|
137
|
+
action: {
|
|
138
|
+
icon: isPasswordVisible ? EyeSlashIcon : EyeIcon,
|
|
139
|
+
label: "toggle password visibility",
|
|
140
|
+
tooltipProps: { disabled: true },
|
|
141
|
+
onClick: () => setIsPasswordVisible((show) => !show)
|
|
142
|
+
}
|
|
143
|
+
})] }) : null;
|
|
144
|
+
const nativeInput = /* @__PURE__ */ jsx("input", {
|
|
145
|
+
ref: isFileInput ? mergeRefs([fileInputRef, ref]) : ref,
|
|
146
|
+
id: inputId,
|
|
147
|
+
name: name ?? (typeof label === "string" ? label : void 0),
|
|
148
|
+
type: isPasswordInput ? isPasswordVisible ? "text" : "password" : type,
|
|
149
|
+
value: isFileInput ? void 0 : shouldDebounce ? internalValue ?? "" : value === null ? "" : value,
|
|
150
|
+
onChange: handleInputChange,
|
|
151
|
+
placeholder,
|
|
152
|
+
disabled,
|
|
153
|
+
required,
|
|
154
|
+
autoFocus,
|
|
155
|
+
accept,
|
|
156
|
+
multiple,
|
|
157
|
+
"aria-describedby": describedBy,
|
|
158
|
+
"aria-invalid": isError || void 0,
|
|
159
|
+
className: inputClasses,
|
|
160
|
+
...rest
|
|
161
|
+
});
|
|
162
|
+
return /* @__PURE__ */ jsxs("div", {
|
|
163
|
+
className: cn("w-full", className),
|
|
164
|
+
children: [
|
|
165
|
+
label && /* @__PURE__ */ jsxs(Text, {
|
|
166
|
+
as: "label",
|
|
167
|
+
htmlFor: inputId,
|
|
168
|
+
className: cn("mb-space-1 block text-sm font-medium text-primary", disabled && "text-disabled"),
|
|
169
|
+
variant: "xs",
|
|
170
|
+
children: [label, required && /* @__PURE__ */ jsx("span", {
|
|
171
|
+
className: "ml-space-1 text-error-secondary",
|
|
172
|
+
children: "*"
|
|
173
|
+
})]
|
|
174
|
+
}),
|
|
175
|
+
/* @__PURE__ */ jsxs("div", {
|
|
176
|
+
className: cn(inputContainerClasses, isFileInput && !disabled && "cursor-pointer"),
|
|
177
|
+
onClick: isFileInput ? openFilePicker : void 0,
|
|
178
|
+
children: [
|
|
179
|
+
effectiveLeftDecorator && /* @__PURE__ */ jsx("div", {
|
|
180
|
+
className: "flex items-center text-tertiary",
|
|
181
|
+
style: { marginInlineStart: leftActionOffset },
|
|
182
|
+
children: effectiveLeftDecorator
|
|
183
|
+
}),
|
|
184
|
+
isFileInput && /* @__PURE__ */ jsx(FileSelection, {
|
|
185
|
+
size,
|
|
186
|
+
fileNames: selectedFileNames,
|
|
187
|
+
placeholder
|
|
188
|
+
}),
|
|
189
|
+
isDateInput ? /* @__PURE__ */ jsxs("div", {
|
|
190
|
+
className: cn("relative flex min-w-0 flex-1 items-center", CONTROL_ICON_SIZES[size].sizeVariableClassName),
|
|
191
|
+
children: [nativeInput, /* @__PURE__ */ jsx("span", {
|
|
192
|
+
className: "pointer-events-none absolute inset-y-0 end-0 hidden items-center supports-[selector(input::-webkit-calendar-picker-indicator)]:flex",
|
|
193
|
+
children: /* @__PURE__ */ jsx(InputIconSlot, {
|
|
194
|
+
icon: CalendarBlankIcon,
|
|
195
|
+
size,
|
|
196
|
+
disabled
|
|
197
|
+
})
|
|
198
|
+
})]
|
|
199
|
+
}) : nativeInput,
|
|
200
|
+
effectiveRightDecorator && /* @__PURE__ */ jsx("div", {
|
|
201
|
+
className: cn("flex items-center text-tertiary", "gap-space-1"),
|
|
202
|
+
style: { marginInlineEnd: rightActionOffset },
|
|
203
|
+
children: effectiveRightDecorator
|
|
204
|
+
})
|
|
205
|
+
]
|
|
206
|
+
}),
|
|
207
|
+
hintText && /* @__PURE__ */ jsx(Text, {
|
|
208
|
+
id: hintTextId,
|
|
209
|
+
className: cn("mt-space-1 text-xs", isError ? "text-error-secondary" : "text-tertiary"),
|
|
210
|
+
variant: "xs",
|
|
211
|
+
weight: "normal",
|
|
212
|
+
children: hintText
|
|
213
|
+
})
|
|
214
|
+
]
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
Input.displayName = "Input";
|
|
218
|
+
//#endregion
|
|
219
|
+
export { Input };
|
|
220
|
+
|
|
221
|
+
//# sourceMappingURL=Input.js.map
|