@shadow-library/ui 0.1.2 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -23
- package/components/Accordion/Accordion.context.d.ts +7 -0
- package/components/Accordion/Accordion.context.js +6 -0
- package/components/Accordion/Accordion.context.js.map +1 -0
- package/components/Accordion/Accordion.d.ts +12 -0
- package/components/Accordion/Accordion.js +34 -0
- package/components/Accordion/Accordion.js.map +1 -0
- package/components/Accordion/Accordion.module.css.js +4 -0
- package/components/Accordion/Accordion.module.css.js.map +1 -0
- package/components/Accordion/Accordion.types.d.ts +39 -0
- package/components/Accordion/index.d.ts +2 -0
- package/components/Alert/Alert.d.ts +8 -0
- package/components/Alert/Alert.js +26 -0
- package/components/Alert/Alert.js.map +1 -0
- package/components/Alert/Alert.module.css.js +4 -0
- package/components/Alert/Alert.module.css.js.map +1 -0
- package/components/Alert/Alert.types.d.ts +22 -0
- package/components/Alert/index.d.ts +2 -0
- package/components/Avatar/Avatar.context.d.ts +9 -0
- package/components/Avatar/Avatar.context.js +6 -0
- package/components/Avatar/Avatar.context.js.map +1 -0
- package/components/Avatar/Avatar.d.ts +13 -0
- package/components/Avatar/Avatar.js +66 -0
- package/components/Avatar/Avatar.js.map +1 -0
- package/components/Avatar/Avatar.module.css.js +4 -0
- package/components/Avatar/Avatar.module.css.js.map +1 -0
- package/components/Avatar/Avatar.types.d.ts +32 -0
- package/components/Avatar/index.d.ts +2 -0
- package/components/Badge/Badge.d.ts +8 -0
- package/components/Badge/Badge.js +23 -0
- package/components/Badge/Badge.js.map +1 -0
- package/components/Badge/Badge.module.css.js +4 -0
- package/components/Badge/Badge.module.css.js.map +1 -0
- package/components/Badge/Badge.types.d.ts +25 -0
- package/components/Badge/index.d.ts +2 -0
- package/components/Banner/Banner.d.ts +8 -0
- package/components/Banner/Banner.js +74 -0
- package/components/Banner/Banner.js.map +1 -0
- package/components/Banner/Banner.module.css.js +4 -0
- package/components/Banner/Banner.module.css.js.map +1 -0
- package/components/Banner/Banner.provider.d.ts +20 -0
- package/components/Banner/Banner.provider.js +34 -0
- package/components/Banner/Banner.provider.js.map +1 -0
- package/components/Banner/Banner.store.d.ts +18 -0
- package/components/Banner/Banner.store.js +62 -0
- package/components/Banner/Banner.store.js.map +1 -0
- package/components/Banner/Banner.types.d.ts +42 -0
- package/components/Banner/index.d.ts +4 -0
- package/components/BottomSheet/BottomSheet.d.ts +8 -0
- package/components/BottomSheet/BottomSheet.js +127 -0
- package/components/BottomSheet/BottomSheet.js.map +1 -0
- package/components/BottomSheet/BottomSheet.module.css.js +4 -0
- package/components/BottomSheet/BottomSheet.module.css.js.map +1 -0
- package/components/BottomSheet/BottomSheet.types.d.ts +34 -0
- package/components/BottomSheet/index.d.ts +2 -0
- package/components/Breadcrumbs/Breadcrumbs.d.ts +4 -0
- package/components/Breadcrumbs/Breadcrumbs.js +39 -0
- package/components/Breadcrumbs/Breadcrumbs.js.map +1 -0
- package/components/Breadcrumbs/Breadcrumbs.module.css.js +4 -0
- package/components/Breadcrumbs/Breadcrumbs.module.css.js.map +1 -0
- package/components/Breadcrumbs/Breadcrumbs.types.d.ts +17 -0
- package/components/Breadcrumbs/index.d.ts +2 -0
- package/components/Button/Button.d.ts +12 -0
- package/components/Button/Button.js +52 -0
- package/components/Button/Button.js.map +1 -0
- package/components/Button/Button.module.css.js +4 -0
- package/components/Button/Button.module.css.js.map +1 -0
- package/components/Button/Button.types.d.ts +34 -0
- package/components/Button/index.d.ts +2 -0
- package/components/ButtonGroup/ButtonGroup.context.d.ts +23 -0
- package/components/ButtonGroup/ButtonGroup.context.js +9 -0
- package/components/ButtonGroup/ButtonGroup.context.js.map +1 -0
- package/components/ButtonGroup/ButtonGroup.d.ts +7 -0
- package/components/ButtonGroup/ButtonGroup.js +92 -0
- package/components/ButtonGroup/ButtonGroup.js.map +1 -0
- package/components/ButtonGroup/ButtonGroup.module.css.js +4 -0
- package/components/ButtonGroup/ButtonGroup.module.css.js.map +1 -0
- package/components/ButtonGroup/ButtonGroup.types.d.ts +28 -0
- package/components/ButtonGroup/index.d.ts +3 -0
- package/components/Calendar/Calendar.d.ts +8 -0
- package/components/Calendar/Calendar.js +197 -0
- package/components/Calendar/Calendar.js.map +1 -0
- package/components/Calendar/Calendar.module.css.js +4 -0
- package/components/Calendar/Calendar.module.css.js.map +1 -0
- package/components/Calendar/Calendar.types.d.ts +32 -0
- package/components/Calendar/index.d.ts +2 -0
- package/components/Card/Card.d.ts +6 -0
- package/components/Card/Card.js +36 -0
- package/components/Card/Card.js.map +1 -0
- package/components/Card/Card.module.css.js +4 -0
- package/components/Card/Card.module.css.js.map +1 -0
- package/components/Card/Card.types.d.ts +30 -0
- package/components/Card/index.d.ts +2 -0
- package/components/Checkbox/Checkbox.d.ts +7 -0
- package/components/Checkbox/Checkbox.js +46 -0
- package/components/Checkbox/Checkbox.js.map +1 -0
- package/components/Checkbox/Checkbox.module.css.js +4 -0
- package/components/Checkbox/Checkbox.module.css.js.map +1 -0
- package/components/Checkbox/Checkbox.types.d.ts +19 -0
- package/components/Checkbox/index.d.ts +2 -0
- package/components/ColorPicker/ColorPicker.d.ts +10 -0
- package/components/ColorPicker/ColorPicker.js +340 -0
- package/components/ColorPicker/ColorPicker.js.map +1 -0
- package/components/ColorPicker/ColorPicker.module.css.js +4 -0
- package/components/ColorPicker/ColorPicker.module.css.js.map +1 -0
- package/components/ColorPicker/ColorPicker.types.d.ts +33 -0
- package/components/ColorPicker/index.d.ts +2 -0
- package/components/Combobox/Combobox.d.ts +9 -0
- package/components/Combobox/Combobox.js +316 -0
- package/components/Combobox/Combobox.js.map +1 -0
- package/components/Combobox/Combobox.module.css.js +4 -0
- package/components/Combobox/Combobox.module.css.js.map +1 -0
- package/components/Combobox/Combobox.types.d.ts +57 -0
- package/components/Combobox/index.d.ts +2 -0
- package/components/CommandPalette/CommandPalette.d.ts +9 -0
- package/components/CommandPalette/CommandPalette.js +197 -0
- package/components/CommandPalette/CommandPalette.js.map +1 -0
- package/components/CommandPalette/CommandPalette.module.css.js +4 -0
- package/components/CommandPalette/CommandPalette.module.css.js.map +1 -0
- package/components/CommandPalette/CommandPalette.types.d.ts +41 -0
- package/components/CommandPalette/index.d.ts +2 -0
- package/components/ContextMenu/ContextMenu.d.ts +34 -0
- package/components/ContextMenu/ContextMenu.js +98 -0
- package/components/ContextMenu/ContextMenu.js.map +1 -0
- package/components/ContextMenu/ContextMenu.types.d.ts +30 -0
- package/components/ContextMenu/index.d.ts +2 -0
- package/components/DataGrid/DataGrid.d.ts +8 -0
- package/components/DataGrid/DataGrid.js +192 -0
- package/components/DataGrid/DataGrid.js.map +1 -0
- package/components/DataGrid/DataGrid.module.css.js +4 -0
- package/components/DataGrid/DataGrid.module.css.js.map +1 -0
- package/components/DataGrid/DataGrid.types.d.ts +43 -0
- package/components/DataGrid/index.d.ts +2 -0
- package/components/DatePicker/DatePicker.d.ts +9 -0
- package/components/DatePicker/DatePicker.js +218 -0
- package/components/DatePicker/DatePicker.js.map +1 -0
- package/components/DatePicker/DatePicker.module.css.js +4 -0
- package/components/DatePicker/DatePicker.module.css.js.map +1 -0
- package/components/DatePicker/DatePicker.types.d.ts +39 -0
- package/components/DatePicker/index.d.ts +2 -0
- package/components/DateRangePicker/DateRangePicker.d.ts +8 -0
- package/components/DateRangePicker/DateRangePicker.js +139 -0
- package/components/DateRangePicker/DateRangePicker.js.map +1 -0
- package/components/DateRangePicker/DateRangePicker.module.css.js +4 -0
- package/components/DateRangePicker/DateRangePicker.module.css.js.map +1 -0
- package/components/DateRangePicker/DateRangePicker.types.d.ts +34 -0
- package/components/DateRangePicker/index.d.ts +2 -0
- package/components/DescriptionList/DescriptionList.d.ts +12 -0
- package/components/DescriptionList/DescriptionList.js +96 -0
- package/components/DescriptionList/DescriptionList.js.map +1 -0
- package/components/DescriptionList/DescriptionList.module.css.js +4 -0
- package/components/DescriptionList/DescriptionList.module.css.js.map +1 -0
- package/components/DescriptionList/DescriptionList.types.d.ts +35 -0
- package/components/DescriptionList/index.d.ts +2 -0
- package/components/Dialog/Dialog.d.ts +30 -0
- package/components/Dialog/Dialog.js +89 -0
- package/components/Dialog/Dialog.js.map +1 -0
- package/components/Dialog/Dialog.module.css.js +4 -0
- package/components/Dialog/Dialog.module.css.js.map +1 -0
- package/components/Dialog/Dialog.types.d.ts +59 -0
- package/components/Dialog/index.d.ts +2 -0
- package/components/Drawer/Drawer.context.d.ts +9 -0
- package/components/Drawer/Drawer.context.js +7 -0
- package/components/Drawer/Drawer.context.js.map +1 -0
- package/components/Drawer/Drawer.d.ts +20 -0
- package/components/Drawer/Drawer.js +63 -0
- package/components/Drawer/Drawer.js.map +1 -0
- package/components/Drawer/Drawer.module.css.js +4 -0
- package/components/Drawer/Drawer.module.css.js.map +1 -0
- package/components/Drawer/Drawer.types.d.ts +42 -0
- package/components/Drawer/index.d.ts +2 -0
- package/components/DropdownMenu/DropdownMenu.d.ts +33 -0
- package/components/DropdownMenu/DropdownMenu.js +98 -0
- package/components/DropdownMenu/DropdownMenu.js.map +1 -0
- package/components/DropdownMenu/DropdownMenu.module.css.js +4 -0
- package/components/DropdownMenu/DropdownMenu.module.css.js.map +1 -0
- package/components/DropdownMenu/DropdownMenu.types.d.ts +34 -0
- package/components/DropdownMenu/index.d.ts +2 -0
- package/components/EmptyState/EmptyState.d.ts +8 -0
- package/components/EmptyState/EmptyState.js +24 -0
- package/components/EmptyState/EmptyState.js.map +1 -0
- package/components/EmptyState/EmptyState.module.css.js +4 -0
- package/components/EmptyState/EmptyState.module.css.js.map +1 -0
- package/components/EmptyState/EmptyState.types.d.ts +26 -0
- package/components/EmptyState/index.d.ts +2 -0
- package/components/FileUpload/FileUpload.d.ts +9 -0
- package/components/FileUpload/FileUpload.js +174 -0
- package/components/FileUpload/FileUpload.js.map +1 -0
- package/components/FileUpload/FileUpload.module.css.js +4 -0
- package/components/FileUpload/FileUpload.module.css.js.map +1 -0
- package/components/FileUpload/FileUpload.types.d.ts +41 -0
- package/components/FileUpload/index.d.ts +2 -0
- package/components/FormField/FormField.context.d.ts +22 -0
- package/components/FormField/FormField.context.js +9 -0
- package/components/FormField/FormField.context.js.map +1 -0
- package/components/FormField/FormField.d.ts +8 -0
- package/components/FormField/FormField.js +44 -0
- package/components/FormField/FormField.js.map +1 -0
- package/components/FormField/FormField.module.css.js +4 -0
- package/components/FormField/FormField.module.css.js.map +1 -0
- package/components/FormField/FormField.types.d.ts +28 -0
- package/components/FormField/index.d.ts +3 -0
- package/components/HoverCard/HoverCard.d.ts +10 -0
- package/components/HoverCard/HoverCard.js +59 -0
- package/components/HoverCard/HoverCard.js.map +1 -0
- package/components/HoverCard/HoverCard.module.css.js +4 -0
- package/components/HoverCard/HoverCard.module.css.js.map +1 -0
- package/components/HoverCard/HoverCard.types.d.ts +35 -0
- package/components/HoverCard/index.d.ts +2 -0
- package/components/IconButton/IconButton.d.ts +13 -0
- package/components/IconButton/IconButton.js +44 -0
- package/components/IconButton/IconButton.js.map +1 -0
- package/components/IconButton/IconButton.module.css.js +4 -0
- package/components/IconButton/IconButton.module.css.js.map +1 -0
- package/components/IconButton/IconButton.types.d.ts +29 -0
- package/components/IconButton/index.d.ts +2 -0
- package/components/Input/Input.d.ts +9 -0
- package/components/Input/Input.js +102 -0
- package/components/Input/Input.js.map +1 -0
- package/components/Input/Input.module.css.js +4 -0
- package/components/Input/Input.module.css.js.map +1 -0
- package/components/Input/Input.types.d.ts +32 -0
- package/components/Input/index.d.ts +2 -0
- package/components/Kbd/Kbd.d.ts +9 -0
- package/components/Kbd/Kbd.js +65 -0
- package/components/Kbd/Kbd.js.map +1 -0
- package/components/Kbd/Kbd.module.css.js +4 -0
- package/components/Kbd/Kbd.module.css.js.map +1 -0
- package/components/Kbd/Kbd.types.d.ts +15 -0
- package/components/Kbd/index.d.ts +2 -0
- package/components/MultiSelect/MultiSelect.d.ts +7 -0
- package/components/MultiSelect/MultiSelect.js +297 -0
- package/components/MultiSelect/MultiSelect.js.map +1 -0
- package/components/MultiSelect/MultiSelect.module.css.js +4 -0
- package/components/MultiSelect/MultiSelect.module.css.js.map +1 -0
- package/components/MultiSelect/MultiSelect.types.d.ts +60 -0
- package/components/MultiSelect/index.d.ts +2 -0
- package/components/NotificationCenter/NotificationCenter.d.ts +9 -0
- package/components/NotificationCenter/NotificationCenter.js +83 -0
- package/components/NotificationCenter/NotificationCenter.js.map +1 -0
- package/components/NotificationCenter/NotificationCenter.module.css.js +4 -0
- package/components/NotificationCenter/NotificationCenter.module.css.js.map +1 -0
- package/components/NotificationCenter/NotificationCenter.types.d.ts +95 -0
- package/components/NotificationCenter/NotificationList.d.ts +8 -0
- package/components/NotificationCenter/NotificationList.js +105 -0
- package/components/NotificationCenter/NotificationList.js.map +1 -0
- package/components/NotificationCenter/index.d.ts +3 -0
- package/components/NumberStepper/NumberStepper.d.ts +9 -0
- package/components/NumberStepper/NumberStepper.js +184 -0
- package/components/NumberStepper/NumberStepper.js.map +1 -0
- package/components/NumberStepper/NumberStepper.module.css.js +4 -0
- package/components/NumberStepper/NumberStepper.module.css.js.map +1 -0
- package/components/NumberStepper/NumberStepper.types.d.ts +36 -0
- package/components/NumberStepper/index.d.ts +2 -0
- package/components/OtpInput/OtpInput.d.ts +11 -0
- package/components/OtpInput/OtpInput.js +143 -0
- package/components/OtpInput/OtpInput.js.map +1 -0
- package/components/OtpInput/OtpInput.module.css.js +4 -0
- package/components/OtpInput/OtpInput.module.css.js.map +1 -0
- package/components/OtpInput/OtpInput.types.d.ts +45 -0
- package/components/OtpInput/index.d.ts +2 -0
- package/components/Pagination/Pagination.d.ts +8 -0
- package/components/Pagination/Pagination.js +100 -0
- package/components/Pagination/Pagination.js.map +1 -0
- package/components/Pagination/Pagination.module.css.js +4 -0
- package/components/Pagination/Pagination.module.css.js.map +1 -0
- package/components/Pagination/Pagination.types.d.ts +32 -0
- package/components/Pagination/index.d.ts +2 -0
- package/components/Popover/Popover.d.ts +22 -0
- package/components/Popover/Popover.js +48 -0
- package/components/Popover/Popover.js.map +1 -0
- package/components/Popover/Popover.module.css.js +4 -0
- package/components/Popover/Popover.module.css.js.map +1 -0
- package/components/Popover/Popover.types.d.ts +23 -0
- package/components/Popover/index.d.ts +2 -0
- package/components/Progress/Progress.d.ts +7 -0
- package/components/Progress/Progress.js +36 -0
- package/components/Progress/Progress.js.map +1 -0
- package/components/Progress/Progress.module.css.js +4 -0
- package/components/Progress/Progress.module.css.js.map +1 -0
- package/components/Progress/Progress.types.d.ts +23 -0
- package/components/Progress/index.d.ts +2 -0
- package/components/RTEField/RTEField.d.ts +23 -0
- package/components/RTEField/RTEField.js +152 -0
- package/components/RTEField/RTEField.js.map +1 -0
- package/components/RTEField/RTEField.module.css.js +4 -0
- package/components/RTEField/RTEField.module.css.js.map +1 -0
- package/components/RTEField/RTEField.types.d.ts +61 -0
- package/components/RTEField/index.d.ts +2 -0
- package/components/RadioGroup/RadioGroup.context.d.ts +15 -0
- package/components/RadioGroup/RadioGroup.context.js +9 -0
- package/components/RadioGroup/RadioGroup.context.js.map +1 -0
- package/components/RadioGroup/RadioGroup.d.ts +7 -0
- package/components/RadioGroup/RadioGroup.js +43 -0
- package/components/RadioGroup/RadioGroup.js.map +1 -0
- package/components/RadioGroup/RadioGroup.module.css.js +4 -0
- package/components/RadioGroup/RadioGroup.module.css.js.map +1 -0
- package/components/RadioGroup/RadioGroup.types.d.ts +23 -0
- package/components/RadioGroup/index.d.ts +3 -0
- package/components/Rating/Rating.d.ts +8 -0
- package/components/Rating/Rating.js +101 -0
- package/components/Rating/Rating.js.map +1 -0
- package/components/Rating/Rating.module.css.js +4 -0
- package/components/Rating/Rating.module.css.js.map +1 -0
- package/components/Rating/Rating.types.d.ts +28 -0
- package/components/Rating/index.d.ts +2 -0
- package/components/SegmentedControl/SegmentedControl.d.ts +8 -0
- package/components/SegmentedControl/SegmentedControl.js +20 -0
- package/components/SegmentedControl/SegmentedControl.js.map +1 -0
- package/components/SegmentedControl/SegmentedControl.module.css.js +4 -0
- package/components/SegmentedControl/SegmentedControl.module.css.js.map +1 -0
- package/components/SegmentedControl/SegmentedControl.types.d.ts +16 -0
- package/components/SegmentedControl/index.d.ts +2 -0
- package/components/Select/Select.d.ts +22 -0
- package/components/Select/Select.js +102 -0
- package/components/Select/Select.js.map +1 -0
- package/components/Select/Select.module.css.js +4 -0
- package/components/Select/Select.module.css.js.map +1 -0
- package/components/Select/Select.types.d.ts +45 -0
- package/components/Select/index.d.ts +2 -0
- package/components/Shell/Shell.d.ts +13 -0
- package/components/Shell/Shell.js +37 -0
- package/components/Shell/Shell.js.map +1 -0
- package/components/Shell/Shell.module.css.js +4 -0
- package/components/Shell/Shell.module.css.js.map +1 -0
- package/components/Shell/Shell.types.d.ts +31 -0
- package/components/Shell/index.d.ts +2 -0
- package/components/Sidebar/Sidebar.context.d.ts +6 -0
- package/components/Sidebar/Sidebar.context.js +6 -0
- package/components/Sidebar/Sidebar.context.js.map +1 -0
- package/components/Sidebar/Sidebar.d.ts +13 -0
- package/components/Sidebar/Sidebar.js +102 -0
- package/components/Sidebar/Sidebar.js.map +1 -0
- package/components/Sidebar/Sidebar.module.css.js +4 -0
- package/components/Sidebar/Sidebar.module.css.js.map +1 -0
- package/components/Sidebar/Sidebar.types.d.ts +45 -0
- package/components/Sidebar/index.d.ts +2 -0
- package/components/Skeleton/Skeleton.d.ts +13 -0
- package/components/Skeleton/Skeleton.js +48 -0
- package/components/Skeleton/Skeleton.js.map +1 -0
- package/components/Skeleton/Skeleton.module.css.js +4 -0
- package/components/Skeleton/Skeleton.module.css.js.map +1 -0
- package/components/Skeleton/Skeleton.types.d.ts +26 -0
- package/components/Skeleton/index.d.ts +2 -0
- package/components/Slider/Slider.d.ts +8 -0
- package/components/Slider/Slider.js +84 -0
- package/components/Slider/Slider.js.map +1 -0
- package/components/Slider/Slider.module.css.js +4 -0
- package/components/Slider/Slider.module.css.js.map +1 -0
- package/components/Slider/Slider.types.d.ts +35 -0
- package/components/Slider/index.d.ts +2 -0
- package/components/Spinner/Spinner.d.ts +7 -0
- package/components/Spinner/Spinner.js +16 -0
- package/components/Spinner/Spinner.js.map +1 -0
- package/components/Spinner/Spinner.module.css.js +4 -0
- package/components/Spinner/Spinner.module.css.js.map +1 -0
- package/components/Spinner/Spinner.types.d.ts +14 -0
- package/components/Spinner/index.d.ts +2 -0
- package/components/SplitPane/SplitPane.d.ts +18 -0
- package/components/SplitPane/SplitPane.js +169 -0
- package/components/SplitPane/SplitPane.js.map +1 -0
- package/components/SplitPane/SplitPane.module.css.js +4 -0
- package/components/SplitPane/SplitPane.module.css.js.map +1 -0
- package/components/SplitPane/SplitPane.types.d.ts +40 -0
- package/components/SplitPane/index.d.ts +2 -0
- package/components/Statistic/Statistic.d.ts +8 -0
- package/components/Statistic/Statistic.js +106 -0
- package/components/Statistic/Statistic.js.map +1 -0
- package/components/Statistic/Statistic.module.css.js +4 -0
- package/components/Statistic/Statistic.module.css.js.map +1 -0
- package/components/Statistic/Statistic.types.d.ts +42 -0
- package/components/Statistic/index.d.ts +2 -0
- package/components/Stepper/Stepper.d.ts +15 -0
- package/components/Stepper/Stepper.js +148 -0
- package/components/Stepper/Stepper.js.map +1 -0
- package/components/Stepper/Stepper.module.css.js +4 -0
- package/components/Stepper/Stepper.module.css.js.map +1 -0
- package/components/Stepper/Stepper.types.d.ts +48 -0
- package/components/Stepper/index.d.ts +2 -0
- package/components/Switch/Switch.d.ts +10 -0
- package/components/Switch/Switch.js +37 -0
- package/components/Switch/Switch.js.map +1 -0
- package/components/Switch/Switch.module.css.js +4 -0
- package/components/Switch/Switch.module.css.js.map +1 -0
- package/components/Switch/Switch.types.d.ts +19 -0
- package/components/Switch/index.d.ts +2 -0
- package/components/Table/Table.d.ts +14 -0
- package/components/Table/Table.js +131 -0
- package/components/Table/Table.js.map +1 -0
- package/components/Table/Table.module.css.js +4 -0
- package/components/Table/Table.module.css.js.map +1 -0
- package/components/Table/Table.types.d.ts +62 -0
- package/components/Table/index.d.ts +2 -0
- package/components/Tabs/Tabs.d.ts +18 -0
- package/components/Tabs/Tabs.js +32 -0
- package/components/Tabs/Tabs.js.map +1 -0
- package/components/Tabs/Tabs.module.css.js +4 -0
- package/components/Tabs/Tabs.module.css.js.map +1 -0
- package/components/Tabs/Tabs.types.d.ts +20 -0
- package/components/Tabs/index.d.ts +2 -0
- package/components/Tag/Tag.d.ts +8 -0
- package/components/Tag/Tag.js +25 -0
- package/components/Tag/Tag.js.map +1 -0
- package/components/Tag/Tag.module.css.js +4 -0
- package/components/Tag/Tag.module.css.js.map +1 -0
- package/components/Tag/Tag.types.d.ts +18 -0
- package/components/Tag/index.d.ts +2 -0
- package/components/Textarea/Textarea.d.ts +9 -0
- package/components/Textarea/Textarea.js +86 -0
- package/components/Textarea/Textarea.js.map +1 -0
- package/components/Textarea/Textarea.module.css.js +4 -0
- package/components/Textarea/Textarea.module.css.js.map +1 -0
- package/components/Textarea/Textarea.types.d.ts +27 -0
- package/components/Textarea/index.d.ts +2 -0
- package/components/TimePicker/TimePicker.d.ts +8 -0
- package/components/TimePicker/TimePicker.js +220 -0
- package/components/TimePicker/TimePicker.js.map +1 -0
- package/components/TimePicker/TimePicker.module.css.js +4 -0
- package/components/TimePicker/TimePicker.module.css.js.map +1 -0
- package/components/TimePicker/TimePicker.types.d.ts +29 -0
- package/components/TimePicker/index.d.ts +2 -0
- package/components/Timeline/Timeline.d.ts +6 -0
- package/components/Timeline/Timeline.js +49 -0
- package/components/Timeline/Timeline.js.map +1 -0
- package/components/Timeline/Timeline.module.css.js +4 -0
- package/components/Timeline/Timeline.module.css.js.map +1 -0
- package/components/Timeline/Timeline.types.d.ts +19 -0
- package/components/Timeline/index.d.ts +2 -0
- package/components/Toast/Toast.d.ts +11 -0
- package/components/Toast/Toast.js +75 -0
- package/components/Toast/Toast.js.map +1 -0
- package/components/Toast/Toast.module.css.js +4 -0
- package/components/Toast/Toast.module.css.js.map +1 -0
- package/components/Toast/Toast.store.d.ts +29 -0
- package/components/Toast/Toast.store.js +53 -0
- package/components/Toast/Toast.store.js.map +1 -0
- package/components/Toast/Toast.types.d.ts +40 -0
- package/components/Toast/index.d.ts +3 -0
- package/components/TokenInput/TokenInput.d.ts +8 -0
- package/components/TokenInput/TokenInput.js +206 -0
- package/components/TokenInput/TokenInput.js.map +1 -0
- package/components/TokenInput/TokenInput.module.css.js +4 -0
- package/components/TokenInput/TokenInput.module.css.js.map +1 -0
- package/components/TokenInput/TokenInput.types.d.ts +38 -0
- package/components/TokenInput/index.d.ts +2 -0
- package/components/Tooltip/Tooltip.d.ts +17 -0
- package/components/Tooltip/Tooltip.js +32 -0
- package/components/Tooltip/Tooltip.js.map +1 -0
- package/components/Tooltip/Tooltip.module.css.js +4 -0
- package/components/Tooltip/Tooltip.module.css.js.map +1 -0
- package/components/Tooltip/Tooltip.types.d.ts +38 -0
- package/components/Tooltip/index.d.ts +2 -0
- package/components/TopNavigation/TopNavigation.d.ts +4 -0
- package/components/TopNavigation/TopNavigation.js +46 -0
- package/components/TopNavigation/TopNavigation.js.map +1 -0
- package/components/TopNavigation/TopNavigation.module.css.js +4 -0
- package/components/TopNavigation/TopNavigation.module.css.js.map +1 -0
- package/components/TopNavigation/TopNavigation.types.d.ts +23 -0
- package/components/TopNavigation/index.d.ts +2 -0
- package/components/TreeView/TreeView.d.ts +8 -0
- package/components/TreeView/TreeView.js +224 -0
- package/components/TreeView/TreeView.js.map +1 -0
- package/components/TreeView/TreeView.module.css.js +4 -0
- package/components/TreeView/TreeView.module.css.js.map +1 -0
- package/components/TreeView/TreeView.types.d.ts +34 -0
- package/components/TreeView/index.d.ts +2 -0
- package/components/index.d.ts +62 -0
- package/hooks/index.d.ts +1 -0
- package/hooks/useDeferredLoading.d.ts +16 -0
- package/hooks/useDeferredLoading.js +26 -0
- package/hooks/useDeferredLoading.js.map +1 -0
- package/index.d.ts +2 -3
- package/index.js +73 -4
- package/index.js.map +1 -1
- package/lib/api-request.js +5 -3
- package/lib/api-request.js.map +1 -1
- package/lib/cn.d.ts +19 -0
- package/lib/cn.js +8 -0
- package/lib/cn.js.map +1 -0
- package/lib/date.d.ts +17 -0
- package/lib/date.js +54 -0
- package/lib/date.js.map +1 -0
- package/lib/index.d.ts +3 -0
- package/lib/merge-refs.d.ts +15 -0
- package/lib/merge-refs.js +11 -0
- package/lib/merge-refs.js.map +1 -0
- package/package.json +34 -12
- package/styles.css +1 -1
- package/styles.css.map +1 -1
- package/styles.layer.css +1 -1
- package/components/AppLayout/AppLayout.d.ts +0 -21
- package/components/AppLayout/AppLayout.js +0 -34
- package/components/AppLayout/AppLayout.js.map +0 -1
- package/components/AppLayout/AppLayout.module.css.js +0 -4
- package/components/AppLayout/AppLayout.module.css.js.map +0 -1
- package/components/AppLayout/ContentFooter.d.ts +0 -12
- package/components/AppLayout/ContentFooter.js +0 -11
- package/components/AppLayout/ContentFooter.js.map +0 -1
- package/components/AppLayout/SideNavbar.d.ts +0 -21
- package/components/AppLayout/SideNavbar.js +0 -43
- package/components/AppLayout/SideNavbar.js.map +0 -1
- package/components/AppLayout/SideNavbarGroup.d.ts +0 -19
- package/components/AppLayout/SideNavbarGroup.js +0 -16
- package/components/AppLayout/SideNavbarGroup.js.map +0 -1
- package/components/AppLayout/SideNavbarItem.d.ts +0 -19
- package/components/AppLayout/SideNavbarItem.js +0 -74
- package/components/AppLayout/SideNavbarItem.js.map +0 -1
- package/components/AppLayout/TopNavbar.d.ts +0 -20
- package/components/AppLayout/TopNavbar.js +0 -38
- package/components/AppLayout/TopNavbar.js.map +0 -1
- package/components/AppLayout/app-layout.utils.d.ts +0 -14
- package/components/AppLayout/app-layout.utils.js +0 -6
- package/components/AppLayout/app-layout.utils.js.map +0 -1
- package/components/AppLayout/hooks/use-active-nav-label.d.ts +0 -2
- package/components/AppLayout/hooks/use-active-nav-label.js +0 -29
- package/components/AppLayout/hooks/use-active-nav-label.js.map +0 -1
- package/components/AppLayout/hooks/use-layout-state.d.ts +0 -20
- package/components/AppLayout/hooks/use-layout-state.js +0 -14
- package/components/AppLayout/hooks/use-layout-state.js.map +0 -1
- package/components/AppLayout/hooks/use-side-navbar-item.d.ts +0 -11
- package/components/AppLayout/hooks/use-side-navbar-item.js +0 -26
- package/components/AppLayout/hooks/use-side-navbar-item.js.map +0 -1
- package/components/AppLayout/index.d.ts +0 -2
- package/components/AppLayout/layout.types.d.ts +0 -59
- package/components/Logo/Alphabets.d.ts +0 -39
- package/components/Logo/Alphabets.js +0 -119
- package/components/Logo/Alphabets.js.map +0 -1
- package/components/Logo/BrandMark.d.ts +0 -16
- package/components/Logo/BrandMark.js +0 -39
- package/components/Logo/BrandMark.js.map +0 -1
- package/components/Logo/Logo.d.ts +0 -17
- package/components/Logo/Logo.js +0 -22
- package/components/Logo/Logo.js.map +0 -1
- package/components/Logo/Logo.module.css.js +0 -4
- package/components/Logo/Logo.module.css.js.map +0 -1
- package/components/Logo/hooks/use-logo.d.ts +0 -9
- package/components/Logo/hooks/use-logo.js +0 -16
- package/components/Logo/hooks/use-logo.js.map +0 -1
- package/components/Logo/index.d.ts +0 -2
- package/styles/AppLayout.module.css +0 -82
- package/styles/Logo.module.css +0 -51
- package/theme.d.ts +0 -161
- package/theme.js +0 -112
- package/theme.js.map +0 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Defining types
|
|
3
|
+
*/
|
|
4
|
+
export type FileStatus = 'queued' | 'uploading' | 'complete' | 'error';
|
|
5
|
+
export interface FileItem {
|
|
6
|
+
/** Stable id. */
|
|
7
|
+
id: string;
|
|
8
|
+
/** The underlying File. */
|
|
9
|
+
file: File;
|
|
10
|
+
name: string;
|
|
11
|
+
size: number;
|
|
12
|
+
status: FileStatus;
|
|
13
|
+
/** 0–100 while uploading. */
|
|
14
|
+
progress?: number;
|
|
15
|
+
/** Message when status is 'error'. */
|
|
16
|
+
error?: string;
|
|
17
|
+
}
|
|
18
|
+
export interface UploadHandle {
|
|
19
|
+
/** Report 0–100 progress. */
|
|
20
|
+
onProgress: (percent: number) => void;
|
|
21
|
+
/** Aborts when the row is cancelled/removed. */
|
|
22
|
+
signal: AbortSignal;
|
|
23
|
+
}
|
|
24
|
+
export interface FileUploadProps {
|
|
25
|
+
/** Fires whenever the file set or any status changes. */
|
|
26
|
+
onValueChange?: (files: FileItem[]) => void;
|
|
27
|
+
/** Accepted extensions or MIME types (e.g. `['.pdf', '.png']`). */
|
|
28
|
+
accept?: string[];
|
|
29
|
+
/** Max bytes per file. */
|
|
30
|
+
maxSize?: number;
|
|
31
|
+
/** Max number of files. */
|
|
32
|
+
maxFiles?: number;
|
|
33
|
+
/** Transport — the component owns queueing (3 parallel), progress, cancel, retry. Omit to just collect files. */
|
|
34
|
+
upload?: (file: File, handle: UploadHandle) => Promise<void>;
|
|
35
|
+
/** `zone` is the dashed dropzone; `button` is a compact trigger + list. @default 'zone' */
|
|
36
|
+
variant?: 'zone' | 'button';
|
|
37
|
+
disabled?: boolean;
|
|
38
|
+
invalid?: boolean;
|
|
39
|
+
className?: string;
|
|
40
|
+
'aria-label'?: string;
|
|
41
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Importing user defined packages
|
|
3
|
+
*/
|
|
4
|
+
/**
|
|
5
|
+
* Defining types
|
|
6
|
+
*/
|
|
7
|
+
export interface FormFieldContextValue {
|
|
8
|
+
/** `id` assigned to the wrapped control (matches the label's `htmlFor`). */
|
|
9
|
+
controlId: string;
|
|
10
|
+
/** `id` of the helper/error slot, for the control's `aria-describedby`. */
|
|
11
|
+
describedById: string | undefined;
|
|
12
|
+
/** Whether the field is in an error state. */
|
|
13
|
+
invalid: boolean;
|
|
14
|
+
/** Whether the field is disabled. */
|
|
15
|
+
disabled: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Declaring the constants
|
|
19
|
+
*/
|
|
20
|
+
export declare const FormFieldContext: import("react").Context<FormFieldContextValue | null>;
|
|
21
|
+
/** Read the enclosing Form Field's wiring — for custom controls that opt into context. */
|
|
22
|
+
export declare function useFormField(): FormFieldContextValue | null;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { createContext, useContext } from 'react';
|
|
2
|
+
|
|
3
|
+
const FormFieldContext = createContext(null);
|
|
4
|
+
function useFormField() {
|
|
5
|
+
return useContext(FormFieldContext);
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
export { FormFieldContext, useFormField };
|
|
9
|
+
//# sourceMappingURL=FormField.context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormField.context.js","sources":["../../../src/components/FormField/FormField.context.ts"],"sourcesContent":["/**\n * Importing npm packages\n */\nimport { createContext, useContext } from 'react';\n\n/**\n * Importing user defined packages\n */\n\n/**\n * Defining types\n */\nexport interface FormFieldContextValue {\n /** `id` assigned to the wrapped control (matches the label's `htmlFor`). */\n controlId: string;\n /** `id` of the helper/error slot, for the control's `aria-describedby`. */\n describedById: string | undefined;\n /** Whether the field is in an error state. */\n invalid: boolean;\n /** Whether the field is disabled. */\n disabled: boolean;\n}\n\n/**\n * Declaring the constants\n */\nexport const FormFieldContext = createContext<FormFieldContextValue | null>(null);\n\n/** Read the enclosing Form Field's wiring — for custom controls that opt into context. */\nexport function useFormField(): FormFieldContextValue | null {\n return useContext(FormFieldContext);\n}\n"],"names":[],"mappings":";;AA0BO,MAAM,gBAAA,GAAmB,cAA4C,IAAI;AAGzE,SAAS,YAAA,GAA6C;AAC3D,EAAA,OAAO,WAAW,gBAAgB,CAAA;AACpC;;;;"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { type FormFieldProps } from './FormField.types';
|
|
2
|
+
/**
|
|
3
|
+
* The contract between form controls and forms. Renders the label, optionality marker, helper text,
|
|
4
|
+
* and error message, and wires `htmlFor`/`id`, `aria-describedby`, and the invalid/disabled state
|
|
5
|
+
* into the single control it wraps — which is why Input through Switch stay bare. Error replaces
|
|
6
|
+
* helper in the same slot, so the layout never grows a second row of small text.
|
|
7
|
+
*/
|
|
8
|
+
export declare const FormField: import("react").ForwardRefExoticComponent<FormFieldProps & import("react").RefAttributes<HTMLDivElement>>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef, useId, isValidElement, cloneElement } from 'react';
|
|
4
|
+
import '../../lib/api-request.js';
|
|
5
|
+
import { cn } from '../../lib/cn.js';
|
|
6
|
+
import { FormFieldContext } from './FormField.context.js';
|
|
7
|
+
import styles from './FormField.module.css.js';
|
|
8
|
+
|
|
9
|
+
function AlertIcon() {
|
|
10
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: [
|
|
11
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "6.5" }),
|
|
12
|
+
/* @__PURE__ */ jsx("path", { d: "M8 5v3.5M8 11h.01" })
|
|
13
|
+
] });
|
|
14
|
+
}
|
|
15
|
+
const FormField = forwardRef(function FormField2({ label, helper, error, required = false, optional = false, invalid, disabled = false, className, children, ...props }, ref) {
|
|
16
|
+
const generatedId = useId();
|
|
17
|
+
const child = isValidElement(children) ? children : null;
|
|
18
|
+
const controlId = child?.props.id ?? generatedId;
|
|
19
|
+
const messageId = `${controlId}-message`;
|
|
20
|
+
const isInvalid = invalid ?? (error != null && error !== false);
|
|
21
|
+
const hasMessage = isInvalid && error != null && error !== false || helper != null;
|
|
22
|
+
const describedById = hasMessage ? messageId : void 0;
|
|
23
|
+
const marker = required ? "Required" : optional ? "Optional" : null;
|
|
24
|
+
const control = child ? cloneElement(child, {
|
|
25
|
+
id: controlId,
|
|
26
|
+
invalid: isInvalid || void 0,
|
|
27
|
+
disabled: disabled || child.props.disabled,
|
|
28
|
+
"aria-describedby": [child.props["aria-describedby"], describedById].filter(Boolean).join(" ") || void 0
|
|
29
|
+
}) : children;
|
|
30
|
+
return /* @__PURE__ */ jsx(FormFieldContext.Provider, { value: { controlId, describedById, invalid: isInvalid, disabled }, children: /* @__PURE__ */ jsxs("div", { ref, className: cn(styles.root, className), "data-disabled": disabled || void 0, "data-invalid": isInvalid || void 0, ...props, children: [
|
|
31
|
+
label != null ? /* @__PURE__ */ jsxs("div", { className: styles.labelRow, children: [
|
|
32
|
+
/* @__PURE__ */ jsx("label", { htmlFor: controlId, className: styles.label, children: label }),
|
|
33
|
+
marker != null ? /* @__PURE__ */ jsx("span", { className: styles.marker, children: marker }) : null
|
|
34
|
+
] }) : null,
|
|
35
|
+
control,
|
|
36
|
+
isInvalid && error != null && error !== false ? /* @__PURE__ */ jsxs("p", { id: messageId, className: styles.error, role: "alert", children: [
|
|
37
|
+
/* @__PURE__ */ jsx("span", { className: styles.errorIcon, children: /* @__PURE__ */ jsx(AlertIcon, {}) }),
|
|
38
|
+
error
|
|
39
|
+
] }) : helper != null ? /* @__PURE__ */ jsx("p", { id: messageId, className: styles.helper, children: helper }) : null
|
|
40
|
+
] }) });
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export { FormField };
|
|
44
|
+
//# sourceMappingURL=FormField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormField.js","sources":["../../../src/components/FormField/FormField.tsx"],"sourcesContent":["/**\n * Importing npm packages\n */\nimport { cloneElement, forwardRef, isValidElement, type ReactElement, useId } from 'react';\n\n/**\n * Importing user defined packages\n */\nimport { cn } from '@/lib';\n\nimport { FormFieldContext } from './FormField.context';\nimport styles from './FormField.module.css';\nimport { type FormFieldProps } from './FormField.types';\n\n/**\n * Declaring the constants\n */\nfunction AlertIcon() {\n return (\n <svg viewBox='0 0 16 16' fill='none' stroke='currentColor' strokeWidth={1.5} strokeLinecap='round' aria-hidden='true'>\n <circle cx='8' cy='8' r='6.5' />\n <path d='M8 5v3.5M8 11h.01' />\n </svg>\n );\n}\n\n/** Props injected into the wrapped control so consumers avoid prop drilling. */\ninterface InjectedProps {\n id: string;\n invalid?: boolean;\n disabled?: boolean;\n 'aria-describedby'?: string;\n}\n\n/**\n * The contract between form controls and forms. Renders the label, optionality marker, helper text,\n * and error message, and wires `htmlFor`/`id`, `aria-describedby`, and the invalid/disabled state\n * into the single control it wraps — which is why Input through Switch stay bare. Error replaces\n * helper in the same slot, so the layout never grows a second row of small text.\n */\nexport const FormField = forwardRef<HTMLDivElement, FormFieldProps>(function FormField(\n { label, helper, error, required = false, optional = false, invalid, disabled = false, className, children, ...props },\n ref,\n) {\n const generatedId = useId();\n const child = isValidElement(children) ? (children as ReactElement<InjectedProps>) : null;\n const controlId = child?.props.id ?? generatedId;\n const messageId = `${controlId}-message`;\n\n const isInvalid = invalid ?? (error != null && error !== false);\n const hasMessage = (isInvalid && error != null && error !== false) || helper != null;\n const describedById = hasMessage ? messageId : undefined;\n const marker = required ? 'Required' : optional ? 'Optional' : null;\n\n const control = child\n ? cloneElement(child, {\n id: controlId,\n invalid: isInvalid || undefined,\n disabled: disabled || child.props.disabled,\n 'aria-describedby': [child.props['aria-describedby'], describedById].filter(Boolean).join(' ') || undefined,\n })\n : children;\n\n return (\n <FormFieldContext.Provider value={{ controlId, describedById, invalid: isInvalid, disabled }}>\n <div ref={ref} className={cn(styles.root, className)} data-disabled={disabled || undefined} data-invalid={isInvalid || undefined} {...props}>\n {label != null ? (\n <div className={styles.labelRow}>\n <label htmlFor={controlId} className={styles.label}>\n {label}\n </label>\n {marker != null ? <span className={styles.marker}>{marker}</span> : null}\n </div>\n ) : null}\n {control}\n {isInvalid && error != null && error !== false ? (\n <p id={messageId} className={styles.error} role='alert'>\n <span className={styles.errorIcon}>\n <AlertIcon />\n </span>\n {error}\n </p>\n ) : helper != null ? (\n <p id={messageId} className={styles.helper}>\n {helper}\n </p>\n ) : null}\n </div>\n </FormFieldContext.Provider>\n );\n});\n"],"names":["FormField"],"mappings":";;;;;;;;AAiBA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,SAAA,CAAA,CAAA,CAAY,CAAA;AACnB,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CACH,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAU,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACZ,CAAA,CAAA,CAAA,CAAC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAE,CAAA,CAAA,CAAA,CAAI,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAW,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACjC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CACH,CAAA,CAAA,CAAA,CACE,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CAAA,CACN,CAAA,CAAA,CACF,CAAA,CAAA;AAEJ,CAAC,CAAA,CAAA;;"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
var styles = {"root":"sh-root_QkVj-","labelRow":"sh-labelRow_Jqql9","label":"sh-label_98wVM","marker":"sh-marker_jjRXq","helper":"sh-helper_JuBZ6","error":"sh-error_4SHKr","errorIcon":"sh-errorIcon_bd5lg"};
|
|
2
|
+
|
|
3
|
+
export { styles as default };
|
|
4
|
+
//# sourceMappingURL=FormField.module.css.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FormField.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Importing npm packages
|
|
3
|
+
*/
|
|
4
|
+
import { type HTMLAttributes, type ReactNode } from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Importing user defined packages
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Defining types
|
|
10
|
+
*/
|
|
11
|
+
export interface FormFieldProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
12
|
+
/** Field label, rendered above the control and linked via `htmlFor`. */
|
|
13
|
+
label?: ReactNode;
|
|
14
|
+
/** Helper text below the control; hidden while an error shows (same slot). */
|
|
15
|
+
helper?: ReactNode;
|
|
16
|
+
/** Error message; when truthy the field becomes invalid and this replaces the helper. */
|
|
17
|
+
error?: ReactNode;
|
|
18
|
+
/** Show a right-aligned “Required” marker on the label. */
|
|
19
|
+
required?: boolean;
|
|
20
|
+
/** Show a right-aligned “Optional” marker on the label. */
|
|
21
|
+
optional?: boolean;
|
|
22
|
+
/** Force the invalid state; defaults to `true` when `error` is truthy. */
|
|
23
|
+
invalid?: boolean;
|
|
24
|
+
/** Dim the whole field and disable the control. */
|
|
25
|
+
disabled?: boolean;
|
|
26
|
+
/** The single form control this field wraps. */
|
|
27
|
+
children: ReactNode;
|
|
28
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { type HoverCardProps } from './HoverCard.types';
|
|
2
|
+
/**
|
|
3
|
+
* A rich, pointer-traversable preview that appears when the pointer rests on an entity reference —
|
|
4
|
+
* filling the gap between Tooltip (which forbids interactive content) and Popover (which demands a
|
|
5
|
+
* click). It is supplementary by contract: everything inside must exist one click away at the
|
|
6
|
+
* trigger's destination, because touch and screen-reader users never see one. Wraps Radix HoverCard
|
|
7
|
+
* for the shared hover-intent timing and Popover's collision positioning; the async loader fires once
|
|
8
|
+
* at hover-intent so the card opens at its final size.
|
|
9
|
+
*/
|
|
10
|
+
export declare function HoverCard<T = unknown>({ children, card, content, render, fallback, errorFallback, openDelay, closeDelay, width, side, align, sideOffset, 'aria-label': ariaLabel, }: HoverCardProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import * as HoverCardPrimitive from '@radix-ui/react-hover-card';
|
|
4
|
+
import { useState, useRef } from 'react';
|
|
5
|
+
import styles from './HoverCard.module.css.js';
|
|
6
|
+
|
|
7
|
+
function HoverCard({
|
|
8
|
+
children,
|
|
9
|
+
card,
|
|
10
|
+
content,
|
|
11
|
+
render,
|
|
12
|
+
fallback,
|
|
13
|
+
errorFallback = "Couldn't load preview",
|
|
14
|
+
openDelay = 500,
|
|
15
|
+
closeDelay = 300,
|
|
16
|
+
width = 300,
|
|
17
|
+
side = "bottom",
|
|
18
|
+
align = "start",
|
|
19
|
+
sideOffset = 6,
|
|
20
|
+
"aria-label": ariaLabel = "Preview"
|
|
21
|
+
}) {
|
|
22
|
+
const [state, setState] = useState({ status: "idle" });
|
|
23
|
+
const startedRef = useRef(false);
|
|
24
|
+
function onOpenChange(open) {
|
|
25
|
+
if (!open || card != null || content == null || startedRef.current) return;
|
|
26
|
+
startedRef.current = true;
|
|
27
|
+
setState({ status: "loading" });
|
|
28
|
+
content().then(
|
|
29
|
+
(data) => setState({ status: "loaded", data }),
|
|
30
|
+
() => setState({ status: "error" })
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
function body() {
|
|
34
|
+
if (card != null) return card;
|
|
35
|
+
if (state.status === "loaded" && render) return render(state.data);
|
|
36
|
+
if (state.status === "error") return /* @__PURE__ */ jsx("span", { className: styles.fallback, children: errorFallback });
|
|
37
|
+
return fallback ?? /* @__PURE__ */ jsx("span", { className: styles.fallback, children: "Loading\u2026" });
|
|
38
|
+
}
|
|
39
|
+
return /* @__PURE__ */ jsxs(HoverCardPrimitive.Root, { openDelay, closeDelay, onOpenChange, children: [
|
|
40
|
+
/* @__PURE__ */ jsx(HoverCardPrimitive.Trigger, { asChild: true, children }),
|
|
41
|
+
/* @__PURE__ */ jsx(HoverCardPrimitive.Portal, { children: /* @__PURE__ */ jsx(
|
|
42
|
+
HoverCardPrimitive.Content,
|
|
43
|
+
{
|
|
44
|
+
className: styles.card,
|
|
45
|
+
role: "dialog",
|
|
46
|
+
"aria-label": ariaLabel,
|
|
47
|
+
side,
|
|
48
|
+
align,
|
|
49
|
+
sideOffset,
|
|
50
|
+
collisionPadding: 16,
|
|
51
|
+
style: { "--hovercard-width": `${width}px` },
|
|
52
|
+
children: body()
|
|
53
|
+
}
|
|
54
|
+
) })
|
|
55
|
+
] });
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export { HoverCard };
|
|
59
|
+
//# sourceMappingURL=HoverCard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HoverCard.js","sources":["../../../src/components/HoverCard/HoverCard.tsx"],"sourcesContent":["/**\n * Importing npm packages\n */\nimport * as HoverCardPrimitive from '@radix-ui/react-hover-card';\nimport { type CSSProperties, useRef, useState } from 'react';\n\n/**\n * Importing user defined packages\n */\nimport styles from './HoverCard.module.css';\nimport { type HoverCardProps } from './HoverCard.types';\n\n/**\n * Declaring the constants\n */\ntype LoadState<T> = { status: 'idle' } | { status: 'loading' } | { status: 'loaded'; data: T } | { status: 'error' };\n\n/**\n * A rich, pointer-traversable preview that appears when the pointer rests on an entity reference —\n * filling the gap between Tooltip (which forbids interactive content) and Popover (which demands a\n * click). It is supplementary by contract: everything inside must exist one click away at the\n * trigger's destination, because touch and screen-reader users never see one. Wraps Radix HoverCard\n * for the shared hover-intent timing and Popover's collision positioning; the async loader fires once\n * at hover-intent so the card opens at its final size.\n */\nexport function HoverCard<T = unknown>({\n children,\n card,\n content,\n render,\n fallback,\n errorFallback = \"Couldn't load preview\",\n openDelay = 500,\n closeDelay = 300,\n width = 300,\n side = 'bottom',\n align = 'start',\n sideOffset = 6,\n 'aria-label': ariaLabel = 'Preview',\n}: HoverCardProps<T>) {\n const [state, setState] = useState<LoadState<T>>({ status: 'idle' });\n const startedRef = useRef(false);\n\n function onOpenChange(open: boolean): void {\n if (!open || card != null || content == null || startedRef.current) return;\n startedRef.current = true;\n setState({ status: 'loading' });\n content().then(\n data => setState({ status: 'loaded', data }),\n () => setState({ status: 'error' }),\n );\n }\n\n function body(): HoverCardProps<T>['children'] {\n if (card != null) return card;\n if (state.status === 'loaded' && render) return render(state.data);\n if (state.status === 'error') return <span className={styles.fallback}>{errorFallback}</span>;\n return fallback ?? <span className={styles.fallback}>Loading…</span>;\n }\n\n return (\n <HoverCardPrimitive.Root openDelay={openDelay} closeDelay={closeDelay} onOpenChange={onOpenChange}>\n <HoverCardPrimitive.Trigger asChild>{children}</HoverCardPrimitive.Trigger>\n <HoverCardPrimitive.Portal>\n <HoverCardPrimitive.Content\n className={styles.card}\n role='dialog'\n aria-label={ariaLabel}\n side={side}\n align={align}\n sideOffset={sideOffset}\n collisionPadding={16}\n style={{ '--hovercard-width': `${width}px` } as CSSProperties}\n >\n {body()}\n </HoverCardPrimitive.Content>\n </HoverCardPrimitive.Portal>\n </HoverCardPrimitive.Root>\n );\n}\n"],"names":[],"mappings":";;;;;;AAyBO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAS,SAAA,CAAuB,CAAA;AAAA,CAAA,CACrC,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CACA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,GAAgB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CA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AA,CAClB,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAO,CAAA,CAAE,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAqB,CAAA,CAAA,CAAG,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAK,CAAA;AAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAE1C,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,EAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAK,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA,CAAA;AAAA,CAAA,CAAA,CAAA,CAAA,CACR,CAAA,CACF,CAAA;AAAA,CAAA,CAAA,CAAA,EACF,CAAA,CAAA;AAEJ,CAAA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"HoverCard.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Importing npm packages
|
|
3
|
+
*/
|
|
4
|
+
import { type ReactNode } from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Defining types
|
|
7
|
+
*/
|
|
8
|
+
export interface HoverCardProps<T = unknown> {
|
|
9
|
+
/** The trigger — an entity reference (mention, link, avatar). Rendered via Slot. */
|
|
10
|
+
children: ReactNode;
|
|
11
|
+
/** Static preview content. Use this or the async `content`/`render` pair, not both. */
|
|
12
|
+
card?: ReactNode;
|
|
13
|
+
/** Async loader — fires once at hover-intent so the card can open full. */
|
|
14
|
+
content?: () => Promise<T>;
|
|
15
|
+
/** Renders the resolved data from `content`. */
|
|
16
|
+
render?: (data: T) => ReactNode;
|
|
17
|
+
/** Skeleton shown at final size while `content` resolves — content pops in without reflow. */
|
|
18
|
+
fallback?: ReactNode;
|
|
19
|
+
/** Quiet line shown if `content` rejects. @default "Couldn't load preview" */
|
|
20
|
+
errorFallback?: ReactNode;
|
|
21
|
+
/** Rest delay before opening (keyboard focus uses 300ms). @default 500 */
|
|
22
|
+
openDelay?: number;
|
|
23
|
+
/** Grace delay before closing after the pointer leaves trigger and card. @default 300 */
|
|
24
|
+
closeDelay?: number;
|
|
25
|
+
/** Card width in px (user 300, record 320, repo 360). @default 300 */
|
|
26
|
+
width?: number;
|
|
27
|
+
/** Preferred side. @default 'bottom' */
|
|
28
|
+
side?: 'top' | 'right' | 'bottom' | 'left';
|
|
29
|
+
/** Alignment along the side. @default 'start' */
|
|
30
|
+
align?: 'start' | 'center' | 'end';
|
|
31
|
+
/** Gap from the trigger. @default 6 */
|
|
32
|
+
sideOffset?: number;
|
|
33
|
+
/** Accessible name for the preview dialog. @default 'Preview' */
|
|
34
|
+
'aria-label'?: string;
|
|
35
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Importing npm packages
|
|
3
|
+
*/
|
|
4
|
+
import { type IconButtonProps } from './IconButton.types';
|
|
5
|
+
/**
|
|
6
|
+
* Declaring the constants
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* A square, icon-only specialization of Button for scarce space and conventional actions.
|
|
10
|
+
* Requires an `aria-label` (and mirrors it into a native `title` until Tooltip lands); pass
|
|
11
|
+
* `pressed` to switch to toggle semantics.
|
|
12
|
+
*/
|
|
13
|
+
export declare const IconButton: import("react").ForwardRefExoticComponent<IconButtonProps & import("react").RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { Slot, Slottable } from '@radix-ui/react-slot';
|
|
4
|
+
import { forwardRef } from 'react';
|
|
5
|
+
import '../../lib/api-request.js';
|
|
6
|
+
import { cn } from '../../lib/cn.js';
|
|
7
|
+
import styles from './IconButton.module.css.js';
|
|
8
|
+
|
|
9
|
+
const IconButton = forwardRef(function IconButton2({ icon, variant = "ghost", size = "md", loading = false, pressed, asChild = false, type, disabled, title, className, children, ...props }, ref) {
|
|
10
|
+
const ariaLabel = props["aria-label"];
|
|
11
|
+
const nodeEnv = globalThis.process?.env?.NODE_ENV;
|
|
12
|
+
if (nodeEnv !== "production" && !ariaLabel) throw new Error("IconButton: a non-empty `aria-label` is required for an accessible name.");
|
|
13
|
+
const dataProps = {
|
|
14
|
+
"data-variant": variant,
|
|
15
|
+
"data-size": size,
|
|
16
|
+
"data-loading": loading || void 0,
|
|
17
|
+
"data-pressed": pressed ? "true" : void 0
|
|
18
|
+
};
|
|
19
|
+
const content = loading ? /* @__PURE__ */ jsx("span", { className: styles.spinner, "aria-hidden": "true" }) : /* @__PURE__ */ jsx("span", { className: styles.icon, children: icon });
|
|
20
|
+
if (asChild) {
|
|
21
|
+
return /* @__PURE__ */ jsxs(Slot, { ref, className: cn(styles.root, className), ...dataProps, "aria-pressed": pressed, title: title ?? ariaLabel, ...props, children: [
|
|
22
|
+
content,
|
|
23
|
+
/* @__PURE__ */ jsx(Slottable, { children })
|
|
24
|
+
] });
|
|
25
|
+
}
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"button",
|
|
28
|
+
{
|
|
29
|
+
ref,
|
|
30
|
+
type: type ?? "button",
|
|
31
|
+
className: cn(styles.root, className),
|
|
32
|
+
...dataProps,
|
|
33
|
+
"aria-pressed": pressed,
|
|
34
|
+
title: title ?? ariaLabel,
|
|
35
|
+
disabled: disabled ?? loading,
|
|
36
|
+
"aria-busy": loading || void 0,
|
|
37
|
+
...props,
|
|
38
|
+
children: content
|
|
39
|
+
}
|
|
40
|
+
);
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
export { IconButton };
|
|
44
|
+
//# sourceMappingURL=IconButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.js","sources":["../../../src/components/IconButton/IconButton.tsx"],"sourcesContent":["/**\n * Importing npm packages\n */\n\nimport { Slot, Slottable } from '@radix-ui/react-slot';\nimport { forwardRef } from 'react';\n\n/**\n * Importing user defined packages\n */\nimport { cn } from '@/lib';\n\nimport styles from './IconButton.module.css';\nimport { type IconButtonProps } from './IconButton.types';\n\n/**\n * Declaring the constants\n */\n\n/**\n * A square, icon-only specialization of Button for scarce space and conventional actions.\n * Requires an `aria-label` (and mirrors it into a native `title` until Tooltip lands); pass\n * `pressed` to switch to toggle semantics.\n */\nexport const IconButton = forwardRef<HTMLButtonElement, IconButtonProps>(function IconButton(\n { icon, variant = 'ghost', size = 'md', loading = false, pressed, asChild = false, type, disabled, title, className, children, ...props },\n ref,\n) {\n const ariaLabel = props['aria-label'];\n const nodeEnv = (globalThis as { process?: { env?: Record<string, string | undefined> } }).process?.env?.NODE_ENV;\n if (nodeEnv !== 'production' && !ariaLabel) throw new Error('IconButton: a non-empty `aria-label` is required for an accessible name.');\n\n const dataProps = {\n 'data-variant': variant,\n 'data-size': size,\n 'data-loading': loading || undefined,\n 'data-pressed': pressed ? 'true' : undefined,\n };\n const content = loading ? <span className={styles.spinner} aria-hidden='true' /> : <span className={styles.icon}>{icon}</span>;\n\n // asChild renders the consumer's element (e.g. a link) as the button, with the icon injected.\n if (asChild) {\n return (\n <Slot ref={ref} className={cn(styles.root, className)} {...dataProps} aria-pressed={pressed} title={title ?? ariaLabel} {...props}>\n {content}\n <Slottable>{children}</Slottable>\n </Slot>\n );\n }\n\n return (\n <button\n ref={ref}\n type={type ?? 'button'}\n className={cn(styles.root, className)}\n {...dataProps}\n aria-pressed={pressed}\n title={title ?? ariaLabel}\n disabled={disabled ?? loading}\n aria-busy={loading || undefined}\n {...props}\n >\n {content}\n </button>\n );\n});\n"],"names":["IconButton"],"mappings":";;;;;;;;AAwBO,CAAA,CAAA,CAAA,CAAA,CAAA,CAAM,UAAA,CAAA,CAAA,CAAa,CAAA,CAAA,CAAA,CAAA,CAA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,CAAA;AAEJ,CAAC,CAAA,CAAA;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"IconButton.module.css.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Importing npm packages
|
|
3
|
+
*/
|
|
4
|
+
import { type ButtonHTMLAttributes, type ReactNode } from 'react';
|
|
5
|
+
/**
|
|
6
|
+
* Importing user defined packages
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Defining types
|
|
10
|
+
*/
|
|
11
|
+
/** No `text` variant — a bare icon with no hover surface has no affordance. */
|
|
12
|
+
export type IconButtonVariant = 'ghost' | 'secondary' | 'primary' | 'danger';
|
|
13
|
+
export type IconButtonSize = 'sm' | 'md' | 'lg';
|
|
14
|
+
export interface IconButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'aria-label'> {
|
|
15
|
+
/** The icon (16px, or 20px at `lg`). Rendered decoratively — the accessible name is `aria-label`. */
|
|
16
|
+
icon: ReactNode;
|
|
17
|
+
/** Required accessible name. An icon button without one is a defect, not a variant. */
|
|
18
|
+
'aria-label': string;
|
|
19
|
+
/** Visual prominence. @default 'ghost' */
|
|
20
|
+
variant?: IconButtonVariant;
|
|
21
|
+
/** Square footprint scale. @default 'md' */
|
|
22
|
+
size?: IconButtonSize;
|
|
23
|
+
/** Shows a spinner in place of the icon, sets `aria-busy`, and blocks activation. */
|
|
24
|
+
loading?: boolean;
|
|
25
|
+
/** Toggle state — when defined, sets `aria-pressed` and applies the selected fill. */
|
|
26
|
+
pressed?: boolean;
|
|
27
|
+
/** Render the single child element as the button (Radix Slot); the icon is injected into it. */
|
|
28
|
+
asChild?: boolean;
|
|
29
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type InputProps } from './Input.types';
|
|
2
|
+
/**
|
|
3
|
+
* Single-line text entry — the field-surface reference every other form control inherits. The
|
|
4
|
+
* bordered wrapper owns the focus-within ring and adornments; the inner `<input>` is transparent
|
|
5
|
+
* and border-less. Label, helper text, and error messages belong to Form Field, not here.
|
|
6
|
+
*
|
|
7
|
+
* `className`/`style` target the wrapper (layout/width); all other props flow to the `<input>`.
|
|
8
|
+
*/
|
|
9
|
+
export declare const Input: import("react").ForwardRefExoticComponent<InputProps & import("react").RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
import { forwardRef, useRef, useState } from 'react';
|
|
4
|
+
import '../../lib/api-request.js';
|
|
5
|
+
import { cn } from '../../lib/cn.js';
|
|
6
|
+
import { mergeRefs } from '../../lib/merge-refs.js';
|
|
7
|
+
import styles from './Input.module.css.js';
|
|
8
|
+
|
|
9
|
+
function ClearIcon() {
|
|
10
|
+
return /* @__PURE__ */ jsx("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M4 4l8 8M12 4l-8 8" }) });
|
|
11
|
+
}
|
|
12
|
+
function EyeIcon() {
|
|
13
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
14
|
+
/* @__PURE__ */ jsx("path", { d: "M1.5 8S3.9 3.5 8 3.5 14.5 8 14.5 8 12.1 12.5 8 12.5 1.5 8 1.5 8Z" }),
|
|
15
|
+
/* @__PURE__ */ jsx("circle", { cx: "8", cy: "8", r: "2" })
|
|
16
|
+
] });
|
|
17
|
+
}
|
|
18
|
+
function EyeOffIcon() {
|
|
19
|
+
return /* @__PURE__ */ jsxs("svg", { viewBox: "0 0 16 16", fill: "none", stroke: "currentColor", strokeWidth: 1.5, strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: [
|
|
20
|
+
/* @__PURE__ */ jsx("path", { d: "M6.3 6.3a2 2 0 0 0 2.8 2.8M4.2 4.3C2.6 5.3 1.5 8 1.5 8s2.4 4.5 6.5 4.5c1 0 1.9-.2 2.7-.6M9.9 4C9.3 3.7 8.7 3.5 8 3.5 3.9 3.5 1.5 8 1.5 8m13 0s-.6 1.2-1.8 2.4" }),
|
|
21
|
+
/* @__PURE__ */ jsx("path", { d: "M2 2l12 12" })
|
|
22
|
+
] });
|
|
23
|
+
}
|
|
24
|
+
const Input = forwardRef(function Input2({
|
|
25
|
+
type = "text",
|
|
26
|
+
size = "md",
|
|
27
|
+
prefix,
|
|
28
|
+
suffix,
|
|
29
|
+
invalid = false,
|
|
30
|
+
clearable = false,
|
|
31
|
+
revealable = true,
|
|
32
|
+
value,
|
|
33
|
+
defaultValue,
|
|
34
|
+
onChange,
|
|
35
|
+
onValueChange,
|
|
36
|
+
disabled = false,
|
|
37
|
+
readOnly = false,
|
|
38
|
+
className,
|
|
39
|
+
style,
|
|
40
|
+
inputClassName,
|
|
41
|
+
...props
|
|
42
|
+
}, ref) {
|
|
43
|
+
const inputRef = useRef(null);
|
|
44
|
+
const [revealed, setRevealed] = useState(false);
|
|
45
|
+
const isControlled = value !== void 0;
|
|
46
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(() => defaultValue != null ? String(defaultValue) : "");
|
|
47
|
+
const currentValue = isControlled ? value : uncontrolledValue;
|
|
48
|
+
function handleChange(event) {
|
|
49
|
+
if (!isControlled) setUncontrolledValue(event.target.value);
|
|
50
|
+
onValueChange?.(event.target.value);
|
|
51
|
+
onChange?.(event);
|
|
52
|
+
}
|
|
53
|
+
function handleClear() {
|
|
54
|
+
if (!isControlled) setUncontrolledValue("");
|
|
55
|
+
onValueChange?.("");
|
|
56
|
+
inputRef.current?.focus();
|
|
57
|
+
}
|
|
58
|
+
const prefixIsAddon = typeof prefix === "string";
|
|
59
|
+
const suffixIsAddon = typeof suffix === "string";
|
|
60
|
+
const showClear = clearable && !disabled && !readOnly && String(currentValue ?? "").length > 0;
|
|
61
|
+
const isPassword = type === "password";
|
|
62
|
+
const showReveal = isPassword && revealable && !disabled;
|
|
63
|
+
const resolvedType = isPassword && revealed ? "text" : type;
|
|
64
|
+
const lead = prefix == null ? "none" : prefixIsAddon ? "addon" : "icon";
|
|
65
|
+
const trail = suffix != null ? suffixIsAddon ? "addon" : "icon" : showClear || showReveal ? "icon" : "none";
|
|
66
|
+
return /* @__PURE__ */ jsxs(
|
|
67
|
+
"div",
|
|
68
|
+
{
|
|
69
|
+
className: cn(styles.root, className),
|
|
70
|
+
style,
|
|
71
|
+
"data-size": size,
|
|
72
|
+
"data-invalid": invalid || void 0,
|
|
73
|
+
"data-disabled": disabled || void 0,
|
|
74
|
+
"data-readonly": readOnly || void 0,
|
|
75
|
+
"data-lead": lead,
|
|
76
|
+
"data-trail": trail,
|
|
77
|
+
children: [
|
|
78
|
+
prefix != null ? /* @__PURE__ */ jsx("span", { className: prefixIsAddon ? styles.addon : styles.adornment, "data-side": "before", children: prefix }) : null,
|
|
79
|
+
/* @__PURE__ */ jsx(
|
|
80
|
+
"input",
|
|
81
|
+
{
|
|
82
|
+
ref: mergeRefs(ref, inputRef),
|
|
83
|
+
type: resolvedType,
|
|
84
|
+
className: cn(styles.field, inputClassName),
|
|
85
|
+
value: currentValue,
|
|
86
|
+
onChange: handleChange,
|
|
87
|
+
disabled,
|
|
88
|
+
readOnly,
|
|
89
|
+
"aria-invalid": invalid || void 0,
|
|
90
|
+
...props
|
|
91
|
+
}
|
|
92
|
+
),
|
|
93
|
+
showClear ? /* @__PURE__ */ jsx("button", { type: "button", className: styles.clear, "aria-label": "Clear", onClick: handleClear, children: /* @__PURE__ */ jsx(ClearIcon, {}) }) : null,
|
|
94
|
+
showReveal ? /* @__PURE__ */ jsx("button", { type: "button", className: styles.reveal, "aria-label": revealed ? "Hide password" : "Show password", "aria-pressed": revealed, onClick: () => setRevealed((v) => !v), children: revealed ? /* @__PURE__ */ jsx(EyeOffIcon, {}) : /* @__PURE__ */ jsx(EyeIcon, {}) }) : null,
|
|
95
|
+
suffix != null ? /* @__PURE__ */ jsx("span", { className: suffixIsAddon ? styles.addon : styles.adornment, "data-side": "after", children: suffix }) : null
|
|
96
|
+
]
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
});
|
|
100
|
+
|
|
101
|
+
export { Input };
|
|
102
|
+
//# sourceMappingURL=Input.js.map
|