@clicoh/orion-library 1.2.0-beta.2 → 1.2.0-beta.21
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/assets/avatares/caja-chispa.png +0 -0
- package/assets/avatares/caja.png +0 -0
- package/assets/avatares/cohete.png +0 -0
- package/assets/avatares/dino.png +0 -0
- package/assets/avatares/pulpo-lentes.png +0 -0
- package/assets/avatares/pulpo-verde.png +0 -0
- package/assets/avatares/pulpo.png +0 -0
- package/assets/cifras/alerta.png +0 -0
- package/assets/cifras/duda.png +0 -0
- package/assets/cifras/error.png +0 -0
- package/assets/cifras/monedas.png +0 -0
- package/assets/cifras/reloj.png +0 -0
- package/assets/cifras/visto.png +0 -0
- package/assets/css/expresivo.css +1069 -0
- package/assets/logos/oculus-icon.svg +1 -0
- package/assets/logos/oculus-logo-sm-dark.svg +1 -0
- package/assets/logos/oculus-logo-sm.svg +1 -0
- package/assets/mascotas/svg/bugi-mascota-01-alerta.svg +39 -0
- package/assets/mascotas/svg/bugi-mascota-02-investigando.svg +36 -0
- package/assets/mascotas/svg/bugi-mascota-05-sorprendido.svg +38 -0
- package/assets/mascotas/svg/oculus-mascota-01-feliz.svg +52 -0
- package/assets/mascotas/svg/oculus-mascota-02-investigando.svg +51 -0
- package/assets/mascotas/svg/oculus-mascota-03-dudando.svg +51 -0
- package/assets/mascotas/svg/oculus-mascota-04-analizando-documento.svg +53 -0
- package/assets/mascotas/svg/oculus-mascota-06-celebrando.svg +54 -0
- package/assets/mascotas/svg/oculus-mascota-07-buscando-rapido.svg +57 -0
- package/assets/mascotas/svg/oculus-mascota-08-satisfecho.svg +55 -0
- package/assets/mascotas/webp/fixi-mascota-01-feliz-sm.webp +0 -0
- package/assets/mascotas/webp/fixi-mascota-02-investigando-sm.webp +0 -0
- package/assets/mascotas/webp/fixi-mascota-03-dudando-sm.webp +0 -0
- package/assets/mascotas/webp/fixi-mascota-04-reparando-sm.webp +0 -0
- package/assets/mascotas/webp/fixi-mascota-05-sorprendido-sm.webp +0 -0
- package/assets/mascotas/webp/fixi-mascota-06-celebrando-sm.webp +0 -0
- package/assets/mascotas/webp/fixi-mascota-07-corriendo-sm.webp +0 -0
- package/dist/components/01-atoms/Button/Button.d.ts +21 -1
- package/dist/components/01-atoms/Button/Button.d.ts.map +1 -1
- package/dist/components/01-atoms/Button/Button.jsx +38 -4
- package/dist/components/01-atoms/Button/Button.jsx.map +1 -1
- package/dist/components/01-atoms/CodeBlock/CodeBlock.d.ts +56 -0
- package/dist/components/01-atoms/CodeBlock/CodeBlock.d.ts.map +1 -0
- package/dist/components/01-atoms/CodeBlock/CodeBlock.jsx +97 -0
- package/dist/components/01-atoms/CodeBlock/CodeBlock.jsx.map +1 -0
- package/dist/components/01-atoms/CodeBlock/index.d.ts +2 -0
- package/dist/components/01-atoms/CodeBlock/index.d.ts.map +1 -0
- package/dist/components/01-atoms/CodeBlock/index.js +2 -0
- package/dist/components/01-atoms/CodeBlock/index.js.map +1 -0
- package/dist/components/01-atoms/Heading/Heading.jsx +1 -1
- package/dist/components/01-atoms/Heading/Heading.jsx.map +1 -1
- package/dist/components/01-atoms/IconButton/IconButton.d.ts +28 -0
- package/dist/components/01-atoms/IconButton/IconButton.d.ts.map +1 -0
- package/dist/components/01-atoms/IconButton/IconButton.jsx +32 -0
- package/dist/components/01-atoms/IconButton/IconButton.jsx.map +1 -0
- package/dist/components/01-atoms/IconButton/index.d.ts +2 -0
- package/dist/components/01-atoms/IconButton/index.d.ts.map +1 -0
- package/dist/components/01-atoms/IconButton/index.js +2 -0
- package/dist/components/01-atoms/IconButton/index.js.map +1 -0
- package/dist/components/01-atoms/Input/Input.d.ts +1 -1
- package/dist/components/01-atoms/Input/Input.d.ts.map +1 -1
- package/dist/components/01-atoms/Input/Input.jsx +13 -9
- package/dist/components/01-atoms/Input/Input.jsx.map +1 -1
- package/dist/components/01-atoms/Input/utils/RenderErrorOrHelperText.d.ts.map +1 -1
- package/dist/components/01-atoms/Input/utils/RenderErrorOrHelperText.jsx +1 -1
- package/dist/components/01-atoms/Input/utils/RenderErrorOrHelperText.jsx.map +1 -1
- package/dist/components/01-atoms/MultiSelect/MultiSelect.d.ts.map +1 -1
- package/dist/components/01-atoms/MultiSelect/MultiSelect.jsx +2 -1
- package/dist/components/01-atoms/MultiSelect/MultiSelect.jsx.map +1 -1
- package/dist/components/01-atoms/ProgressBar/ProgressBar.d.ts +12 -1
- package/dist/components/01-atoms/ProgressBar/ProgressBar.d.ts.map +1 -1
- package/dist/components/01-atoms/ProgressBar/ProgressBar.jsx +18 -2
- package/dist/components/01-atoms/ProgressBar/ProgressBar.jsx.map +1 -1
- package/dist/components/01-atoms/Select/Select.d.ts +7 -1
- package/dist/components/01-atoms/Select/Select.d.ts.map +1 -1
- package/dist/components/01-atoms/Select/Select.jsx +61 -13
- package/dist/components/01-atoms/Select/Select.jsx.map +1 -1
- package/dist/components/01-atoms/Select/SelectList.d.ts +41 -0
- package/dist/components/01-atoms/Select/SelectList.d.ts.map +1 -0
- package/dist/components/01-atoms/Select/SelectList.jsx +116 -0
- package/dist/components/01-atoms/Select/SelectList.jsx.map +1 -0
- package/dist/components/01-atoms/SmallInput/SmallInput.d.ts.map +1 -1
- package/dist/components/01-atoms/SmallInput/SmallInput.jsx +1 -0
- package/dist/components/01-atoms/SmallInput/SmallInput.jsx.map +1 -1
- package/dist/components/01-atoms/Spinner/Spinner.d.ts +24 -3
- package/dist/components/01-atoms/Spinner/Spinner.d.ts.map +1 -1
- package/dist/components/01-atoms/Spinner/Spinner.jsx +30 -4
- package/dist/components/01-atoms/Spinner/Spinner.jsx.map +1 -1
- package/dist/components/01-atoms/Spinner/index.d.ts +1 -0
- package/dist/components/01-atoms/Spinner/index.d.ts.map +1 -1
- package/dist/components/01-atoms/Stat/Stat.d.ts +47 -0
- package/dist/components/01-atoms/Stat/Stat.d.ts.map +1 -0
- package/dist/components/01-atoms/Stat/Stat.jsx +64 -0
- package/dist/components/01-atoms/Stat/Stat.jsx.map +1 -0
- package/dist/components/01-atoms/Stat/index.d.ts +2 -0
- package/dist/components/01-atoms/Stat/index.d.ts.map +1 -0
- package/dist/components/01-atoms/Stat/index.js +2 -0
- package/dist/components/01-atoms/Stat/index.js.map +1 -0
- package/dist/components/01-atoms/Switch/Switch.d.ts +5 -2
- package/dist/components/01-atoms/Switch/Switch.d.ts.map +1 -1
- package/dist/components/01-atoms/Switch/Switch.jsx +15 -12
- package/dist/components/01-atoms/Switch/Switch.jsx.map +1 -1
- package/dist/components/01-atoms/Textarea/Textarea.d.ts +38 -0
- package/dist/components/01-atoms/Textarea/Textarea.d.ts.map +1 -0
- package/dist/components/01-atoms/Textarea/Textarea.jsx +50 -0
- package/dist/components/01-atoms/Textarea/Textarea.jsx.map +1 -0
- package/dist/components/01-atoms/Textarea/index.d.ts +2 -0
- package/dist/components/01-atoms/Textarea/index.d.ts.map +1 -0
- package/dist/components/01-atoms/Textarea/index.js +2 -0
- package/dist/components/01-atoms/Textarea/index.js.map +1 -0
- package/dist/components/01-atoms/Toast/Toast.d.ts.map +1 -1
- package/dist/components/01-atoms/Toast/Toast.jsx +3 -1
- package/dist/components/01-atoms/Toast/Toast.jsx.map +1 -1
- package/dist/components/01-atoms/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/01-atoms/Tooltip/Tooltip.jsx +4 -1
- package/dist/components/01-atoms/Tooltip/Tooltip.jsx.map +1 -1
- package/dist/components/01-atoms/index.d.ts +4 -0
- package/dist/components/01-atoms/index.d.ts.map +1 -1
- package/dist/components/01-atoms/index.js +4 -0
- package/dist/components/01-atoms/index.js.map +1 -1
- package/dist/components/02-molecules/Accordion/Accordion.d.ts +15 -4
- package/dist/components/02-molecules/Accordion/Accordion.d.ts.map +1 -1
- package/dist/components/02-molecules/Accordion/Accordion.jsx +20 -6
- package/dist/components/02-molecules/Accordion/Accordion.jsx.map +1 -1
- package/dist/components/02-molecules/Accordion/AccordionContext.d.ts +5 -1
- package/dist/components/02-molecules/Accordion/AccordionContext.d.ts.map +1 -1
- package/dist/components/02-molecules/Accordion/AccordionContext.jsx +7 -6
- package/dist/components/02-molecules/Accordion/AccordionContext.jsx.map +1 -1
- package/dist/components/02-molecules/Accordion/AccordionSection.d.ts +2 -1
- package/dist/components/02-molecules/Accordion/AccordionSection.d.ts.map +1 -1
- package/dist/components/02-molecules/Accordion/AccordionSection.jsx +62 -11
- package/dist/components/02-molecules/Accordion/AccordionSection.jsx.map +1 -1
- package/dist/components/02-molecules/Accordion/index.d.ts +1 -0
- package/dist/components/02-molecules/Accordion/index.d.ts.map +1 -1
- package/dist/components/02-molecules/Accordion/index.js.map +1 -1
- package/dist/components/02-molecules/Autocomplete/Autocomplete.d.ts +4 -1
- package/dist/components/02-molecules/Autocomplete/Autocomplete.d.ts.map +1 -1
- package/dist/components/02-molecules/Autocomplete/Autocomplete.jsx +34 -15
- package/dist/components/02-molecules/Autocomplete/Autocomplete.jsx.map +1 -1
- package/dist/components/02-molecules/Card/Card.d.ts +74 -0
- package/dist/components/02-molecules/Card/Card.d.ts.map +1 -0
- package/dist/components/02-molecules/Card/Card.jsx +87 -0
- package/dist/components/02-molecules/Card/Card.jsx.map +1 -0
- package/dist/components/02-molecules/Card/index.d.ts +2 -0
- package/dist/components/02-molecules/Card/index.d.ts.map +1 -0
- package/dist/components/02-molecules/Card/index.js +2 -0
- package/dist/components/02-molecules/Card/index.js.map +1 -0
- package/dist/components/02-molecules/DatePicker/DatePicker.d.ts +41 -3
- package/dist/components/02-molecules/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/02-molecules/DatePicker/DatePicker.jsx +190 -34
- package/dist/components/02-molecules/DatePicker/DatePicker.jsx.map +1 -1
- package/dist/components/02-molecules/Dropdown/Dropdown.d.ts.map +1 -1
- package/dist/components/02-molecules/Dropdown/Dropdown.jsx +1 -0
- package/dist/components/02-molecules/Dropdown/Dropdown.jsx.map +1 -1
- package/dist/components/02-molecules/EmptyState/EmptyState.d.ts +52 -0
- package/dist/components/02-molecules/EmptyState/EmptyState.d.ts.map +1 -0
- package/dist/components/02-molecules/EmptyState/EmptyState.jsx +66 -0
- package/dist/components/02-molecules/EmptyState/EmptyState.jsx.map +1 -0
- package/dist/components/02-molecules/EmptyState/index.d.ts +2 -0
- package/dist/components/02-molecules/EmptyState/index.d.ts.map +1 -0
- package/dist/components/02-molecules/EmptyState/index.js +2 -0
- package/dist/components/02-molecules/EmptyState/index.js.map +1 -0
- package/dist/components/02-molecules/Filter/Filter.d.ts +8 -1
- package/dist/components/02-molecules/Filter/Filter.d.ts.map +1 -1
- package/dist/components/02-molecules/Filter/Filter.jsx +35 -11
- package/dist/components/02-molecules/Filter/Filter.jsx.map +1 -1
- package/dist/components/02-molecules/Filter/index.d.ts +1 -0
- package/dist/components/02-molecules/Filter/index.d.ts.map +1 -1
- package/dist/components/02-molecules/Filter/index.js +1 -0
- package/dist/components/02-molecules/Filter/index.js.map +1 -1
- package/dist/components/02-molecules/Filter/types.d.ts +24 -5
- package/dist/components/02-molecules/Filter/types.d.ts.map +1 -1
- package/dist/components/02-molecules/Filter/utils/pruneOrphanValues.d.ts +34 -0
- package/dist/components/02-molecules/Filter/utils/pruneOrphanValues.d.ts.map +1 -0
- package/dist/components/02-molecules/Filter/utils/pruneOrphanValues.js +70 -0
- package/dist/components/02-molecules/Filter/utils/pruneOrphanValues.js.map +1 -0
- package/dist/components/02-molecules/ImageViewer/ImageViewer.d.ts +55 -5
- package/dist/components/02-molecules/ImageViewer/ImageViewer.d.ts.map +1 -1
- package/dist/components/02-molecules/ImageViewer/ImageViewer.jsx +118 -27
- package/dist/components/02-molecules/ImageViewer/ImageViewer.jsx.map +1 -1
- package/dist/components/02-molecules/ImageViewer/ImageViewerImage.d.ts +40 -0
- package/dist/components/02-molecules/ImageViewer/ImageViewerImage.d.ts.map +1 -0
- package/dist/components/02-molecules/ImageViewer/ImageViewerImage.jsx +109 -0
- package/dist/components/02-molecules/ImageViewer/ImageViewerImage.jsx.map +1 -0
- package/dist/components/02-molecules/InlineMessage/InlineMessage.d.ts +15 -1
- package/dist/components/02-molecules/InlineMessage/InlineMessage.d.ts.map +1 -1
- package/dist/components/02-molecules/InlineMessage/InlineMessage.jsx +18 -3
- package/dist/components/02-molecules/InlineMessage/InlineMessage.jsx.map +1 -1
- package/dist/components/02-molecules/Menu/MenuItem.d.ts.map +1 -1
- package/dist/components/02-molecules/Menu/MenuItem.jsx +2 -2
- package/dist/components/02-molecules/Menu/MenuItem.jsx.map +1 -1
- package/dist/components/02-molecules/Menu/MenuList.d.ts.map +1 -1
- package/dist/components/02-molecules/Menu/MenuList.jsx +1 -1
- package/dist/components/02-molecules/Menu/MenuList.jsx.map +1 -1
- package/dist/components/02-molecules/Modal/Modal.d.ts +5 -1
- package/dist/components/02-molecules/Modal/Modal.d.ts.map +1 -1
- package/dist/components/02-molecules/Modal/Modal.jsx +4 -2
- package/dist/components/02-molecules/Modal/Modal.jsx.map +1 -1
- package/dist/components/02-molecules/MultiAutocomplete/MultiAutocomplete.d.ts +80 -0
- package/dist/components/02-molecules/MultiAutocomplete/MultiAutocomplete.d.ts.map +1 -0
- package/dist/components/02-molecules/MultiAutocomplete/MultiAutocomplete.jsx +261 -0
- package/dist/components/02-molecules/MultiAutocomplete/MultiAutocomplete.jsx.map +1 -0
- package/dist/components/02-molecules/MultiAutocomplete/index.d.ts +2 -0
- package/dist/components/02-molecules/MultiAutocomplete/index.d.ts.map +1 -0
- package/dist/components/02-molecules/MultiAutocomplete/index.js +2 -0
- package/dist/components/02-molecules/MultiAutocomplete/index.js.map +1 -0
- package/dist/components/02-molecules/Stepper/Stepper.d.ts +70 -0
- package/dist/components/02-molecules/Stepper/Stepper.d.ts.map +1 -0
- package/dist/components/02-molecules/Stepper/Stepper.jsx +204 -0
- package/dist/components/02-molecules/Stepper/Stepper.jsx.map +1 -0
- package/dist/components/02-molecules/Stepper/index.d.ts +2 -0
- package/dist/components/02-molecules/Stepper/index.d.ts.map +1 -0
- package/dist/components/02-molecules/Stepper/index.js +2 -0
- package/dist/components/02-molecules/Stepper/index.js.map +1 -0
- package/dist/components/02-molecules/Table/Table.d.ts +3 -1
- package/dist/components/02-molecules/Table/Table.d.ts.map +1 -1
- package/dist/components/02-molecules/Table/Table.jsx +6 -5
- package/dist/components/02-molecules/Table/Table.jsx.map +1 -1
- package/dist/components/02-molecules/Timeline/Timeline.d.ts +47 -0
- package/dist/components/02-molecules/Timeline/Timeline.d.ts.map +1 -0
- package/dist/components/02-molecules/Timeline/Timeline.jsx +65 -0
- package/dist/components/02-molecules/Timeline/Timeline.jsx.map +1 -0
- package/dist/components/02-molecules/Timeline/index.d.ts +2 -0
- package/dist/components/02-molecules/Timeline/index.d.ts.map +1 -0
- package/dist/components/02-molecules/Timeline/index.js +2 -0
- package/dist/components/02-molecules/Timeline/index.js.map +1 -0
- package/dist/components/02-molecules/index.d.ts +5 -0
- package/dist/components/02-molecules/index.d.ts.map +1 -1
- package/dist/components/02-molecules/index.js +5 -0
- package/dist/components/02-molecules/index.js.map +1 -1
- package/dist/components/03-organisms/DataTable/DataTable.d.ts +1 -1
- package/dist/components/03-organisms/DataTable/DataTable.d.ts.map +1 -1
- package/dist/components/03-organisms/DataTable/DataTable.jsx +1 -1
- package/dist/components/03-organisms/DataTable/DataTable.jsx.map +1 -1
- package/dist/components/03-organisms/Header/Header.d.ts +3 -1
- package/dist/components/03-organisms/Header/Header.d.ts.map +1 -1
- package/dist/components/03-organisms/Header/Header.jsx +4 -5
- package/dist/components/03-organisms/Header/Header.jsx.map +1 -1
- package/dist/components/03-organisms/MapView/MapView.d.ts +14 -3
- package/dist/components/03-organisms/MapView/MapView.d.ts.map +1 -1
- package/dist/components/03-organisms/MapView/MapView.jsx +40 -9
- package/dist/components/03-organisms/MapView/MapView.jsx.map +1 -1
- package/dist/components/03-organisms/ModalMultiple/ModalMultiple.d.ts.map +1 -1
- package/dist/components/03-organisms/ModalMultiple/ModalMultiple.jsx +1 -0
- package/dist/components/03-organisms/ModalMultiple/ModalMultiple.jsx.map +1 -1
- package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.d.ts +36 -4
- package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.d.ts.map +1 -1
- package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.jsx +44 -10
- package/dist/components/04-templates/DashboardTemplate/DashboardTemplate.jsx.map +1 -1
- package/dist/components/04-templates/DashboardTemplate/HeadingWithTitle.d.ts +6 -2
- package/dist/components/04-templates/DashboardTemplate/HeadingWithTitle.d.ts.map +1 -1
- package/dist/components/04-templates/DashboardTemplate/HeadingWithTitle.jsx +7 -3
- package/dist/components/04-templates/DashboardTemplate/HeadingWithTitle.jsx.map +1 -1
- package/dist/components/04-templates/LoginTemplate/LoginForm.d.ts +66 -3
- package/dist/components/04-templates/LoginTemplate/LoginForm.d.ts.map +1 -1
- package/dist/components/04-templates/LoginTemplate/LoginForm.jsx +80 -16
- package/dist/components/04-templates/LoginTemplate/LoginForm.jsx.map +1 -1
- package/dist/components/04-templates/LoginTemplate/LoginTemplate.d.ts +24 -4
- package/dist/components/04-templates/LoginTemplate/LoginTemplate.d.ts.map +1 -1
- package/dist/components/04-templates/LoginTemplate/LoginTemplate.jsx +27 -7
- package/dist/components/04-templates/LoginTemplate/LoginTemplate.jsx.map +1 -1
- package/dist/components/04-templates/LoginTemplate/index.d.ts +1 -0
- package/dist/components/04-templates/LoginTemplate/index.d.ts.map +1 -1
- package/dist/components/04-templates/SideFilterTemplate/SideFilterTemplate.d.ts.map +1 -1
- package/dist/components/04-templates/SideFilterTemplate/SideFilterTemplate.jsx +4 -1
- package/dist/components/04-templates/SideFilterTemplate/SideFilterTemplate.jsx.map +1 -1
- package/dist/hooks/useSegments.d.ts.map +1 -1
- package/dist/hooks/useSegments.js +2 -3
- package/dist/hooks/useSegments.js.map +1 -1
- package/dist/hooks/useTheme.d.ts.map +1 -1
- package/dist/hooks/useTheme.jsx +1 -0
- package/dist/hooks/useTheme.jsx.map +1 -1
- package/expresivo/ExpBubble/ExpBubble.d.ts +51 -0
- package/expresivo/ExpBubble/ExpBubble.d.ts.map +1 -0
- package/expresivo/ExpBubble/ExpBubble.jsx +74 -0
- package/expresivo/ExpBubble/ExpBubble.jsx.map +1 -0
- package/expresivo/ExpBubble/index.d.ts +3 -0
- package/expresivo/ExpBubble/index.d.ts.map +1 -0
- package/expresivo/ExpBubble/index.js +2 -0
- package/expresivo/ExpBubble/index.js.map +1 -0
- package/expresivo/ExpChip/ExpChip.d.ts +40 -0
- package/expresivo/ExpChip/ExpChip.d.ts.map +1 -0
- package/expresivo/ExpChip/ExpChip.jsx +67 -0
- package/expresivo/ExpChip/ExpChip.jsx.map +1 -0
- package/expresivo/ExpChip/index.d.ts +3 -0
- package/expresivo/ExpChip/index.d.ts.map +1 -0
- package/expresivo/ExpChip/index.js +2 -0
- package/expresivo/ExpChip/index.js.map +1 -0
- package/expresivo/ExpCollapseToggle/ExpCollapseToggle.d.ts +37 -0
- package/expresivo/ExpCollapseToggle/ExpCollapseToggle.d.ts.map +1 -0
- package/expresivo/ExpCollapseToggle/ExpCollapseToggle.jsx +43 -0
- package/expresivo/ExpCollapseToggle/ExpCollapseToggle.jsx.map +1 -0
- package/expresivo/ExpCollapseToggle/index.d.ts +3 -0
- package/expresivo/ExpCollapseToggle/index.d.ts.map +1 -0
- package/expresivo/ExpCollapseToggle/index.js +2 -0
- package/expresivo/ExpCollapseToggle/index.js.map +1 -0
- package/expresivo/ExpEnterIcon/ExpEnterIcon.d.ts +32 -0
- package/expresivo/ExpEnterIcon/ExpEnterIcon.d.ts.map +1 -0
- package/expresivo/ExpEnterIcon/ExpEnterIcon.jsx +32 -0
- package/expresivo/ExpEnterIcon/ExpEnterIcon.jsx.map +1 -0
- package/expresivo/ExpEnterIcon/index.d.ts +3 -0
- package/expresivo/ExpEnterIcon/index.d.ts.map +1 -0
- package/expresivo/ExpEnterIcon/index.js +2 -0
- package/expresivo/ExpEnterIcon/index.js.map +1 -0
- package/expresivo/ExpGrowBar/ExpGrowBar.d.ts +26 -0
- package/expresivo/ExpGrowBar/ExpGrowBar.d.ts.map +1 -0
- package/expresivo/ExpGrowBar/ExpGrowBar.jsx +39 -0
- package/expresivo/ExpGrowBar/ExpGrowBar.jsx.map +1 -0
- package/expresivo/ExpGrowBar/index.d.ts +3 -0
- package/expresivo/ExpGrowBar/index.d.ts.map +1 -0
- package/expresivo/ExpGrowBar/index.js +2 -0
- package/expresivo/ExpGrowBar/index.js.map +1 -0
- package/expresivo/ExpJourneyTrack/ExpJourneyTrack.d.ts +69 -0
- package/expresivo/ExpJourneyTrack/ExpJourneyTrack.d.ts.map +1 -0
- package/expresivo/ExpJourneyTrack/ExpJourneyTrack.jsx +160 -0
- package/expresivo/ExpJourneyTrack/ExpJourneyTrack.jsx.map +1 -0
- package/expresivo/ExpJourneyTrack/index.d.ts +3 -0
- package/expresivo/ExpJourneyTrack/index.d.ts.map +1 -0
- package/expresivo/ExpJourneyTrack/index.js +2 -0
- package/expresivo/ExpJourneyTrack/index.js.map +1 -0
- package/expresivo/ExpKeyButton/ExpKeyButton.d.ts +49 -0
- package/expresivo/ExpKeyButton/ExpKeyButton.d.ts.map +1 -0
- package/expresivo/ExpKeyButton/ExpKeyButton.jsx +60 -0
- package/expresivo/ExpKeyButton/ExpKeyButton.jsx.map +1 -0
- package/expresivo/ExpKeyButton/index.d.ts +3 -0
- package/expresivo/ExpKeyButton/index.d.ts.map +1 -0
- package/expresivo/ExpKeyButton/index.js +2 -0
- package/expresivo/ExpKeyButton/index.js.map +1 -0
- package/expresivo/ExpLadder/ExpLadder.d.ts +42 -0
- package/expresivo/ExpLadder/ExpLadder.d.ts.map +1 -0
- package/expresivo/ExpLadder/ExpLadder.jsx +82 -0
- package/expresivo/ExpLadder/ExpLadder.jsx.map +1 -0
- package/expresivo/ExpLadder/index.d.ts +3 -0
- package/expresivo/ExpLadder/index.d.ts.map +1 -0
- package/expresivo/ExpLadder/index.js +2 -0
- package/expresivo/ExpLadder/index.js.map +1 -0
- package/expresivo/ExpLensIcon/ExpLensIcon.d.ts +29 -0
- package/expresivo/ExpLensIcon/ExpLensIcon.d.ts.map +1 -0
- package/expresivo/ExpLensIcon/ExpLensIcon.jsx +29 -0
- package/expresivo/ExpLensIcon/ExpLensIcon.jsx.map +1 -0
- package/expresivo/ExpLensIcon/index.d.ts +3 -0
- package/expresivo/ExpLensIcon/index.d.ts.map +1 -0
- package/expresivo/ExpLensIcon/index.js +2 -0
- package/expresivo/ExpLensIcon/index.js.map +1 -0
- package/expresivo/ExpLogo/ExpLogo.d.ts +33 -0
- package/expresivo/ExpLogo/ExpLogo.d.ts.map +1 -0
- package/expresivo/ExpLogo/ExpLogo.jsx +42 -0
- package/expresivo/ExpLogo/ExpLogo.jsx.map +1 -0
- package/expresivo/ExpLogo/catalog.d.ts +17 -0
- package/expresivo/ExpLogo/catalog.d.ts.map +1 -0
- package/expresivo/ExpLogo/catalog.js +11 -0
- package/expresivo/ExpLogo/catalog.js.map +1 -0
- package/expresivo/ExpLogo/index.d.ts +4 -0
- package/expresivo/ExpLogo/index.d.ts.map +1 -0
- package/expresivo/ExpLogo/index.js +2 -0
- package/expresivo/ExpLogo/index.js.map +1 -0
- package/expresivo/ExpMascot/ExpMascot.d.ts +42 -0
- package/expresivo/ExpMascot/ExpMascot.d.ts.map +1 -0
- package/expresivo/ExpMascot/ExpMascot.jsx +46 -0
- package/expresivo/ExpMascot/ExpMascot.jsx.map +1 -0
- package/expresivo/ExpMascot/catalog.d.ts +12 -0
- package/expresivo/ExpMascot/catalog.d.ts.map +1 -0
- package/expresivo/ExpMascot/catalog.js +41 -0
- package/expresivo/ExpMascot/catalog.js.map +1 -0
- package/expresivo/ExpMascot/index.d.ts +4 -0
- package/expresivo/ExpMascot/index.d.ts.map +1 -0
- package/expresivo/ExpMascot/index.js +2 -0
- package/expresivo/ExpMascot/index.js.map +1 -0
- package/expresivo/ExpMedalBadge/ExpMedalBadge.d.ts +29 -0
- package/expresivo/ExpMedalBadge/ExpMedalBadge.d.ts.map +1 -0
- package/expresivo/ExpMedalBadge/ExpMedalBadge.jsx +87 -0
- package/expresivo/ExpMedalBadge/ExpMedalBadge.jsx.map +1 -0
- package/expresivo/ExpMedalBadge/index.d.ts +3 -0
- package/expresivo/ExpMedalBadge/index.d.ts.map +1 -0
- package/expresivo/ExpMedalBadge/index.js +2 -0
- package/expresivo/ExpMedalBadge/index.js.map +1 -0
- package/expresivo/ExpPageHero/ExpPageHero.d.ts +82 -0
- package/expresivo/ExpPageHero/ExpPageHero.d.ts.map +1 -0
- package/expresivo/ExpPageHero/ExpPageHero.jsx +113 -0
- package/expresivo/ExpPageHero/ExpPageHero.jsx.map +1 -0
- package/expresivo/ExpPageHero/index.d.ts +3 -0
- package/expresivo/ExpPageHero/index.d.ts.map +1 -0
- package/expresivo/ExpPageHero/index.js +2 -0
- package/expresivo/ExpPageHero/index.js.map +1 -0
- package/expresivo/ExpPeek/ExpPeek.d.ts +56 -0
- package/expresivo/ExpPeek/ExpPeek.d.ts.map +1 -0
- package/expresivo/ExpPeek/ExpPeek.jsx +131 -0
- package/expresivo/ExpPeek/ExpPeek.jsx.map +1 -0
- package/expresivo/ExpPeek/index.d.ts +3 -0
- package/expresivo/ExpPeek/index.d.ts.map +1 -0
- package/expresivo/ExpPeek/index.js +2 -0
- package/expresivo/ExpPeek/index.js.map +1 -0
- package/expresivo/ExpPillButton/ExpPillButton.d.ts +47 -0
- package/expresivo/ExpPillButton/ExpPillButton.d.ts.map +1 -0
- package/expresivo/ExpPillButton/ExpPillButton.jsx +77 -0
- package/expresivo/ExpPillButton/ExpPillButton.jsx.map +1 -0
- package/expresivo/ExpPillButton/index.d.ts +3 -0
- package/expresivo/ExpPillButton/index.d.ts.map +1 -0
- package/expresivo/ExpPillButton/index.js +2 -0
- package/expresivo/ExpPillButton/index.js.map +1 -0
- package/expresivo/ExpRepoAvatar/ExpRepoAvatar.d.ts +28 -0
- package/expresivo/ExpRepoAvatar/ExpRepoAvatar.d.ts.map +1 -0
- package/expresivo/ExpRepoAvatar/ExpRepoAvatar.jsx +32 -0
- package/expresivo/ExpRepoAvatar/ExpRepoAvatar.jsx.map +1 -0
- package/expresivo/ExpRepoAvatar/catalog.d.ts +6 -0
- package/expresivo/ExpRepoAvatar/catalog.d.ts.map +1 -0
- package/expresivo/ExpRepoAvatar/catalog.js +18 -0
- package/expresivo/ExpRepoAvatar/catalog.js.map +1 -0
- package/expresivo/ExpRepoAvatar/index.d.ts +4 -0
- package/expresivo/ExpRepoAvatar/index.d.ts.map +1 -0
- package/expresivo/ExpRepoAvatar/index.js +2 -0
- package/expresivo/ExpRepoAvatar/index.js.map +1 -0
- package/expresivo/ExpScope/ExpScope.d.ts +63 -0
- package/expresivo/ExpScope/ExpScope.d.ts.map +1 -0
- package/expresivo/ExpScope/ExpScope.jsx +67 -0
- package/expresivo/ExpScope/ExpScope.jsx.map +1 -0
- package/expresivo/ExpScope/index.d.ts +3 -0
- package/expresivo/ExpScope/index.d.ts.map +1 -0
- package/expresivo/ExpScope/index.js +2 -0
- package/expresivo/ExpScope/index.js.map +1 -0
- package/expresivo/ExpScoreRing/ExpScoreRing.d.ts +35 -0
- package/expresivo/ExpScoreRing/ExpScoreRing.d.ts.map +1 -0
- package/expresivo/ExpScoreRing/ExpScoreRing.jsx +67 -0
- package/expresivo/ExpScoreRing/ExpScoreRing.jsx.map +1 -0
- package/expresivo/ExpScoreRing/index.d.ts +3 -0
- package/expresivo/ExpScoreRing/index.d.ts.map +1 -0
- package/expresivo/ExpScoreRing/index.js +2 -0
- package/expresivo/ExpScoreRing/index.js.map +1 -0
- package/expresivo/ExpSearchField/ExpSearchField.d.ts +49 -0
- package/expresivo/ExpSearchField/ExpSearchField.d.ts.map +1 -0
- package/expresivo/ExpSearchField/ExpSearchField.jsx +81 -0
- package/expresivo/ExpSearchField/ExpSearchField.jsx.map +1 -0
- package/expresivo/ExpSearchField/index.d.ts +3 -0
- package/expresivo/ExpSearchField/index.d.ts.map +1 -0
- package/expresivo/ExpSearchField/index.js +2 -0
- package/expresivo/ExpSearchField/index.js.map +1 -0
- package/expresivo/ExpStatIcon/ExpStatIcon.d.ts +25 -0
- package/expresivo/ExpStatIcon/ExpStatIcon.d.ts.map +1 -0
- package/expresivo/ExpStatIcon/ExpStatIcon.jsx +29 -0
- package/expresivo/ExpStatIcon/ExpStatIcon.jsx.map +1 -0
- package/expresivo/ExpStatIcon/catalog.d.ts +6 -0
- package/expresivo/ExpStatIcon/catalog.d.ts.map +1 -0
- package/expresivo/ExpStatIcon/catalog.js +16 -0
- package/expresivo/ExpStatIcon/catalog.js.map +1 -0
- package/expresivo/ExpStatIcon/index.d.ts +4 -0
- package/expresivo/ExpStatIcon/index.d.ts.map +1 -0
- package/expresivo/ExpStatIcon/index.js +2 -0
- package/expresivo/ExpStatIcon/index.js.map +1 -0
- package/expresivo/ExpStepBadge/ExpStepBadge.d.ts +25 -0
- package/expresivo/ExpStepBadge/ExpStepBadge.d.ts.map +1 -0
- package/expresivo/ExpStepBadge/ExpStepBadge.jsx +30 -0
- package/expresivo/ExpStepBadge/ExpStepBadge.jsx.map +1 -0
- package/expresivo/ExpStepBadge/index.d.ts +2 -0
- package/expresivo/ExpStepBadge/index.d.ts.map +1 -0
- package/expresivo/ExpStepBadge/index.js +2 -0
- package/expresivo/ExpStepBadge/index.js.map +1 -0
- package/expresivo/index.d.ts +22 -0
- package/expresivo/index.d.ts.map +1 -0
- package/expresivo/index.js +22 -0
- package/expresivo/index.js.map +1 -0
- package/expresivo/shared/glyphs.d.ts +20 -0
- package/expresivo/shared/glyphs.d.ts.map +1 -0
- package/expresivo/shared/glyphs.jsx +60 -0
- package/expresivo/shared/glyphs.jsx.map +1 -0
- package/package.json +6 -4
|
@@ -8,6 +8,9 @@ type SelectProps = {
|
|
|
8
8
|
readonly error?: string;
|
|
9
9
|
readonly isMutedWhenEmpty?: boolean;
|
|
10
10
|
readonly hideLabel?: boolean;
|
|
11
|
+
readonly labelAddon?: ReactNode;
|
|
12
|
+
readonly customList?: boolean;
|
|
13
|
+
readonly iconL?: ReactNode;
|
|
11
14
|
};
|
|
12
15
|
/**
|
|
13
16
|
* Select component for rendering a dropdown with customizable options, labels, helper text, and error messages.
|
|
@@ -33,9 +36,12 @@ type SelectProps = {
|
|
|
33
36
|
* @param {string} [props.error] - Optional error message to be displayed below the select dropdown.
|
|
34
37
|
* @param {boolean} [props.isMutedWhenEmpty] - Renders the border and label in gray while no option is selected.
|
|
35
38
|
* @param {boolean} [props.hideLabel] - Keeps the label for assistive technology only and drops the floating label and its border notch. Use it when a heading outside the field already names it; pair it with `placeholder`.
|
|
39
|
+
* @param {ReactNode} [props.labelAddon] - Element rendered right after the floating label, inside the border notch — typically an info icon wrapped in a `Tooltip`. It stays interactive and is not part of the label's accessible name. Ignored with `hideLabel`.
|
|
40
|
+
* @param {boolean} [props.customList=false] - Opens Orion's own option list instead of the native popup, which each browser and OS paints its own way. Same `options`, `select.value` and `select.onChange`: picking an option fires the native `change` event.
|
|
41
|
+
* @param {ReactNode} [props.iconL] - Element at the left of the chosen option, as in `Input`: an icon or a `CountryFlag` that follows the value. Decorative: the option text carries the meaning.
|
|
36
42
|
*
|
|
37
43
|
* @returns {ReactNode} The rendered Select component.
|
|
38
44
|
*/
|
|
39
|
-
export declare function Select({ label, options, select, placeholder, helperText, error, isMutedWhenEmpty, hideLabel, }: SelectProps): ReactNode;
|
|
45
|
+
export declare function Select({ label, options, select, placeholder, helperText, error, isMutedWhenEmpty, hideLabel, labelAddon, customList, iconL, }: SelectProps): ReactNode;
|
|
40
46
|
export {};
|
|
41
47
|
//# sourceMappingURL=Select.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Select/Select.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,oBAAoB,
|
|
1
|
+
{"version":3,"file":"Select.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Select/Select.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,SAAS,EACd,KAAK,oBAAoB,EAI1B,MAAM,OAAO,CAAC;AAOf,KAAK,WAAW,GAAG;IACjB,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC;IAClD,QAAQ,CAAC,MAAM,CAAC,EAAE,IAAI,CACpB,iBAAiB,CACf,oBAAoB,CAAC,iBAAiB,CAAC,EACvC,iBAAiB,CAClB,EACD,UAAU,CACX,CAAC;IACF,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IACxB,QAAQ,CAAC,gBAAgB,CAAC,EAAE,OAAO,CAAC;IACpC,QAAQ,CAAC,SAAS,CAAC,EAAE,OAAO,CAAC;IAC7B,QAAQ,CAAC,UAAU,CAAC,EAAE,SAAS,CAAC;IAChC,QAAQ,CAAC,UAAU,CAAC,EAAE,OAAO,CAAC;IAC9B,QAAQ,CAAC,KAAK,CAAC,EAAE,SAAS,CAAC;CAC5B,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6BG;AACH,wBAAgB,MAAM,CAAC,EACrB,KAAK,EACL,OAAO,EACP,MAAM,EACN,WAAW,EACX,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,SAAiB,EACjB,UAAU,EACV,UAAkB,EAClB,KAAK,GACN,EAAE,WAAW,GAAG,SAAS,CAuKzB"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import clsx from 'clsx';
|
|
3
|
-
import { useId, } from 'react';
|
|
3
|
+
import { useId, useRef, useState, } from 'react';
|
|
4
4
|
import { FaSortDown } from 'react-icons/fa';
|
|
5
|
-
import { Each } from '../../00-base';
|
|
5
|
+
import { Each, Show } from '../../00-base';
|
|
6
6
|
import { generateBorder } from '../Input/utils/border';
|
|
7
7
|
import { RenderErrorOrHelperText } from '../Input/utils/RenderErrorOrHelperText';
|
|
8
|
+
import { SelectList } from './SelectList';
|
|
8
9
|
/**
|
|
9
10
|
* Select component for rendering a dropdown with customizable options, labels, helper text, and error messages.
|
|
10
11
|
*
|
|
@@ -29,10 +30,13 @@ import { RenderErrorOrHelperText } from '../Input/utils/RenderErrorOrHelperText'
|
|
|
29
30
|
* @param {string} [props.error] - Optional error message to be displayed below the select dropdown.
|
|
30
31
|
* @param {boolean} [props.isMutedWhenEmpty] - Renders the border and label in gray while no option is selected.
|
|
31
32
|
* @param {boolean} [props.hideLabel] - Keeps the label for assistive technology only and drops the floating label and its border notch. Use it when a heading outside the field already names it; pair it with `placeholder`.
|
|
33
|
+
* @param {ReactNode} [props.labelAddon] - Element rendered right after the floating label, inside the border notch — typically an info icon wrapped in a `Tooltip`. It stays interactive and is not part of the label's accessible name. Ignored with `hideLabel`.
|
|
34
|
+
* @param {boolean} [props.customList=false] - Opens Orion's own option list instead of the native popup, which each browser and OS paints its own way. Same `options`, `select.value` and `select.onChange`: picking an option fires the native `change` event.
|
|
35
|
+
* @param {ReactNode} [props.iconL] - Element at the left of the chosen option, as in `Input`: an icon or a `CountryFlag` that follows the value. Decorative: the option text carries the meaning.
|
|
32
36
|
*
|
|
33
37
|
* @returns {ReactNode} The rendered Select component.
|
|
34
38
|
*/
|
|
35
|
-
export function Select({ label, options, select, placeholder, helperText, error, isMutedWhenEmpty, hideLabel = false, }) {
|
|
39
|
+
export function Select({ label, options, select, placeholder, helperText, error, isMutedWhenEmpty, hideLabel = false, labelAddon, customList = false, iconL, }) {
|
|
36
40
|
const generatedId = useId();
|
|
37
41
|
const id = select?.id ?? generatedId;
|
|
38
42
|
const descriptionId = error || helperText ? `${id}-description` : undefined;
|
|
@@ -41,16 +45,32 @@ export function Select({ label, options, select, placeholder, helperText, error,
|
|
|
41
45
|
const selectProps = !select || !Object.hasOwn(select, 'value')
|
|
42
46
|
? { ...select, defaultValue: '' }
|
|
43
47
|
: select;
|
|
48
|
+
const selectRef = useRef(null);
|
|
49
|
+
const isControlled = Boolean(select && Object.hasOwn(select, 'value'));
|
|
50
|
+
const [uncontrolledValue, setUncontrolledValue] = useState(String(selectProps.defaultValue ?? ''));
|
|
51
|
+
const currentValue = isControlled
|
|
52
|
+
? String(selectProps.value ?? '')
|
|
53
|
+
: uncontrolledValue;
|
|
54
|
+
const labelId = `${id}-label`;
|
|
55
|
+
const chooseFromList = (value) => {
|
|
56
|
+
const element = selectRef.current;
|
|
57
|
+
if (!element || element.value === value)
|
|
58
|
+
return;
|
|
59
|
+
element.value = value;
|
|
60
|
+
element.dispatchEvent(new Event('change', { bubbles: true }));
|
|
61
|
+
if (!isControlled)
|
|
62
|
+
setUncontrolledValue(value);
|
|
63
|
+
};
|
|
44
64
|
const isMuted = Boolean(isMutedWhenEmpty && !selectProps.value && !selectProps.defaultValue);
|
|
45
|
-
const selectClasses = clsx('peer disabled:text-gray-3 dark:disabled:text-gray-2 h-full w-full appearance-none rounded-full border border-none bg-transparent
|
|
65
|
+
const selectClasses = clsx('peer disabled:text-gray-3 dark:disabled:text-gray-2 h-full w-full appearance-none rounded-full border border-none bg-transparent text-sm font-normal outline-0 transition-all dark:bg-black', iconL ? 'pr-5 pl-11' : 'px-5', isMuted ? 'text-gray-2 dark:text-gray-2' : 'text-black dark:text-white', select?.className);
|
|
46
66
|
const { labelProps, legendClasses, fieldsetClasses } = generateBorder(error, {
|
|
47
67
|
isMuted,
|
|
48
68
|
hideLabel,
|
|
49
69
|
});
|
|
50
70
|
labelProps.htmlFor = id;
|
|
51
|
-
return (<div className="w-full max-w-full">
|
|
52
|
-
<div className="relative h-9">
|
|
53
|
-
<select {...selectProps} id={id} className={selectClasses} aria-invalid={error ? true : select?.['aria-invalid']} aria-describedby={describedBy}>
|
|
71
|
+
return (<div data-orion-part="field" className="w-full max-w-full">
|
|
72
|
+
<div data-orion-part="field-box" className="relative h-9">
|
|
73
|
+
<select {...selectProps} data-orion-part="field-control" ref={selectRef} id={id} tabIndex={customList ? -1 : selectProps.tabIndex} aria-hidden={customList || undefined} className={clsx(selectClasses, customList && 'pointer-events-none')} aria-invalid={error ? true : select?.['aria-invalid']} aria-describedby={describedBy}>
|
|
54
74
|
{!!placeholder && (<option value="" disabled hidden className="bg-white text-black dark:bg-black dark:text-white">
|
|
55
75
|
{placeholder}
|
|
56
76
|
</option>)}
|
|
@@ -58,17 +78,45 @@ export function Select({ label, options, select, placeholder, helperText, error,
|
|
|
58
78
|
{text}
|
|
59
79
|
</option>)}/>
|
|
60
80
|
</select>
|
|
61
|
-
{
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
81
|
+
{!!customList && (<SelectList id={id} labelId={labelId} options={Object.entries(options)} value={currentValue} disabled={select?.disabled} invalid={Boolean(error)} describedBy={describedBy} onChoose={chooseFromList}/>)}
|
|
82
|
+
<Show>
|
|
83
|
+
<Show.When isTrue={hideLabel}>
|
|
84
|
+
<label id={labelId} htmlFor={id} className="sr-only">
|
|
85
|
+
{label}
|
|
86
|
+
</label>
|
|
87
|
+
</Show.When>
|
|
88
|
+
<Show.When isTrue={Boolean(labelAddon)}>
|
|
89
|
+
<div data-orion-part="field-label" className={clsx(labelProps.className, 'flex items-center gap-1')}>
|
|
90
|
+
<label id={labelId} htmlFor={id}>
|
|
91
|
+
{label}
|
|
92
|
+
</label>
|
|
93
|
+
<span className="pointer-events-auto flex">{labelAddon}</span>
|
|
94
|
+
</div>
|
|
95
|
+
</Show.When>
|
|
96
|
+
<Show.Else>
|
|
97
|
+
<label {...labelProps} id={labelId} data-orion-part="field-label">
|
|
98
|
+
{label}
|
|
99
|
+
</label>
|
|
100
|
+
</Show.Else>
|
|
101
|
+
</Show>
|
|
102
|
+
<FaSortDown aria-hidden="true" data-orion-part="field-icon" className={clsx('peer-disabled:text-gray-3 dark:peer-disabled:text-gray-2 pointer-events-none absolute top-2 right-4', error
|
|
65
103
|
? 'text-error dark:text-error-dark'
|
|
66
104
|
: isMuted
|
|
67
105
|
? 'text-gray-2 dark:text-gray-2'
|
|
68
106
|
: 'text-black dark:text-white')}/>
|
|
69
|
-
<fieldset className={fieldsetClasses}>
|
|
70
|
-
{!hideLabel && <legend className={legendClasses}>
|
|
107
|
+
<fieldset data-orion-part="field-outline" className={fieldsetClasses}>
|
|
108
|
+
{!hideLabel && (<legend className={legendClasses}>
|
|
109
|
+
{label}
|
|
110
|
+
{!!labelAddon && (<span aria-hidden="true" className="ml-1 inline-flex">
|
|
111
|
+
{labelAddon}
|
|
112
|
+
</span>)}
|
|
113
|
+
</legend>)}
|
|
71
114
|
</fieldset>
|
|
115
|
+
{!!iconL && (<span aria-hidden="true" data-orion-part="field-icon" className={clsx('peer-disabled:text-gray-3 dark:peer-disabled:text-gray-2 pointer-events-none absolute top-1/2 left-4 flex -translate-y-1/2 items-center', error
|
|
116
|
+
? 'text-error dark:text-error-dark'
|
|
117
|
+
: 'text-black dark:text-white')}>
|
|
118
|
+
{iconL}
|
|
119
|
+
</span>)}
|
|
72
120
|
</div>
|
|
73
121
|
<RenderErrorOrHelperText id={descriptionId} disabled={select?.disabled} helperText={helperText} error={error} className="pl-6"/>
|
|
74
122
|
</div>);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Select.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Select/Select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAIL,KAAK,
|
|
1
|
+
{"version":3,"file":"Select.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Select/Select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAIL,KAAK,EACL,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC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AAa,CAAC,CAClB,QAAQ,CAAC,CAAC,MAAM,EAAE,QAAQ,CAAC,CAC3B,UAAU,CAAC,CAAC,UAAU,CAAC,CACvB,KAAK,CAAC,CAAC,KAAK,CAAC,CACb,SAAS,CAAC,MAAM,EAEpB;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
type SelectListProps = {
|
|
3
|
+
readonly id: string;
|
|
4
|
+
readonly labelId: string;
|
|
5
|
+
readonly options: [string, string][];
|
|
6
|
+
readonly value: string;
|
|
7
|
+
readonly disabled?: boolean;
|
|
8
|
+
readonly invalid?: boolean;
|
|
9
|
+
readonly describedBy?: string;
|
|
10
|
+
readonly onChoose: (value: string) => void;
|
|
11
|
+
};
|
|
12
|
+
/**
|
|
13
|
+
* SelectList draws the option list of a `Select` with `customList`, in place of the
|
|
14
|
+
* native popup the browser and the OS paint. A transparent button covers the field and
|
|
15
|
+
* owns focus and keyboard; the native `<select>` underneath keeps the value.
|
|
16
|
+
*
|
|
17
|
+
* @component
|
|
18
|
+
* @example
|
|
19
|
+
* <SelectList
|
|
20
|
+
* id="hour-list"
|
|
21
|
+
* labelId="hour-label"
|
|
22
|
+
* options={[['08:00', '08:00'], ['08:30', '08:30']]}
|
|
23
|
+
* value="08:00"
|
|
24
|
+
* onChoose={(value) => console.log(value)}
|
|
25
|
+
* />
|
|
26
|
+
*
|
|
27
|
+
* @param {SelectListProps} props - The properties of the SelectList component.
|
|
28
|
+
* @param {string} props.id - Base id for the listbox and its options.
|
|
29
|
+
* @param {string} props.labelId - Id of the visible label, which names the trigger.
|
|
30
|
+
* @param {[string, string][]} props.options - Value and text of each option, in order.
|
|
31
|
+
* @param {string} props.value - Value currently selected.
|
|
32
|
+
* @param {boolean} [props.disabled] - Disables the trigger.
|
|
33
|
+
* @param {boolean} [props.invalid] - Marks the trigger as invalid for assistive technology.
|
|
34
|
+
* @param {string} [props.describedBy] - Id of the helper or error text.
|
|
35
|
+
* @param {(value: string) => void} props.onChoose - Fired with the value the user picks.
|
|
36
|
+
*
|
|
37
|
+
* @returns {ReactNode} The trigger and, while open, the option list.
|
|
38
|
+
*/
|
|
39
|
+
export declare function SelectList({ id, labelId, options, value, disabled, invalid, describedBy, onChoose, }: SelectListProps): ReactNode;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=SelectList.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectList.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Select/SelectList.tsx"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,SAAS,EAIf,MAAM,OAAO,CAAC;AAGf,KAAK,eAAe,GAAG;IACrB,QAAQ,CAAC,EAAE,EAAE,MAAM,CAAC;IACpB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,CAAC;IACrC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;IACvB,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,QAAQ,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC;IAC3B,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;IAC9B,QAAQ,CAAC,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;CAC5C,CAAC;AAOF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,UAAU,CAAC,EACzB,EAAE,EACF,OAAO,EACP,OAAO,EACP,KAAK,EACL,QAAQ,EACR,OAAO,EACP,WAAW,EACX,QAAQ,GACT,EAAE,eAAe,GAAG,SAAS,CAgI7B"}
|
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import { useEffect, useRef, useState, } from 'react';
|
|
4
|
+
import { Each } from '../../00-base';
|
|
5
|
+
const listClasses = clsx('absolute top-full left-0 z-40 mt-1 max-h-[200px] min-w-full overflow-y-auto rounded-sm border py-1 shadow-md', 'border-gray-5 dark:border-gray-1 dark:bg-black-1 bg-white text-black dark:text-white');
|
|
6
|
+
/**
|
|
7
|
+
* SelectList draws the option list of a `Select` with `customList`, in place of the
|
|
8
|
+
* native popup the browser and the OS paint. A transparent button covers the field and
|
|
9
|
+
* owns focus and keyboard; the native `<select>` underneath keeps the value.
|
|
10
|
+
*
|
|
11
|
+
* @component
|
|
12
|
+
* @example
|
|
13
|
+
* <SelectList
|
|
14
|
+
* id="hour-list"
|
|
15
|
+
* labelId="hour-label"
|
|
16
|
+
* options={[['08:00', '08:00'], ['08:30', '08:30']]}
|
|
17
|
+
* value="08:00"
|
|
18
|
+
* onChoose={(value) => console.log(value)}
|
|
19
|
+
* />
|
|
20
|
+
*
|
|
21
|
+
* @param {SelectListProps} props - The properties of the SelectList component.
|
|
22
|
+
* @param {string} props.id - Base id for the listbox and its options.
|
|
23
|
+
* @param {string} props.labelId - Id of the visible label, which names the trigger.
|
|
24
|
+
* @param {[string, string][]} props.options - Value and text of each option, in order.
|
|
25
|
+
* @param {string} props.value - Value currently selected.
|
|
26
|
+
* @param {boolean} [props.disabled] - Disables the trigger.
|
|
27
|
+
* @param {boolean} [props.invalid] - Marks the trigger as invalid for assistive technology.
|
|
28
|
+
* @param {string} [props.describedBy] - Id of the helper or error text.
|
|
29
|
+
* @param {(value: string) => void} props.onChoose - Fired with the value the user picks.
|
|
30
|
+
*
|
|
31
|
+
* @returns {ReactNode} The trigger and, while open, the option list.
|
|
32
|
+
*/
|
|
33
|
+
export function SelectList({ id, labelId, options, value, disabled, invalid, describedBy, onChoose, }) {
|
|
34
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
35
|
+
const [activeIndex, setActiveIndex] = useState(-1);
|
|
36
|
+
const rootRef = useRef(null);
|
|
37
|
+
const listRef = useRef(null);
|
|
38
|
+
const listboxId = `${id}-listbox`;
|
|
39
|
+
const selectedIndex = options.findIndex(([optionValue]) => optionValue === value);
|
|
40
|
+
const open = () => {
|
|
41
|
+
setActiveIndex(Math.max(selectedIndex, 0));
|
|
42
|
+
setIsOpen(true);
|
|
43
|
+
};
|
|
44
|
+
const close = () => {
|
|
45
|
+
setIsOpen(false);
|
|
46
|
+
setActiveIndex(-1);
|
|
47
|
+
};
|
|
48
|
+
const choose = (index) => {
|
|
49
|
+
const option = options[index];
|
|
50
|
+
if (option)
|
|
51
|
+
onChoose(option[0]);
|
|
52
|
+
close();
|
|
53
|
+
};
|
|
54
|
+
useEffect(() => {
|
|
55
|
+
if (!isOpen)
|
|
56
|
+
return;
|
|
57
|
+
const handleOutsideClick = (event) => {
|
|
58
|
+
if (rootRef.current && !rootRef.current.contains(event.target)) {
|
|
59
|
+
close();
|
|
60
|
+
}
|
|
61
|
+
};
|
|
62
|
+
document.addEventListener('mousedown', handleOutsideClick);
|
|
63
|
+
return () => document.removeEventListener('mousedown', handleOutsideClick);
|
|
64
|
+
}, [isOpen]);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!isOpen || activeIndex < 0)
|
|
67
|
+
return;
|
|
68
|
+
listRef.current
|
|
69
|
+
?.querySelector(`#${CSS.escape(`${listboxId}-${activeIndex}`)}`)
|
|
70
|
+
?.scrollIntoView({ block: 'nearest' });
|
|
71
|
+
}, [isOpen, activeIndex, listboxId]);
|
|
72
|
+
const handleKeyDown = (event) => {
|
|
73
|
+
const last = options.length - 1;
|
|
74
|
+
if (!isOpen) {
|
|
75
|
+
if (['ArrowDown', 'ArrowUp', 'Enter', ' '].includes(event.key)) {
|
|
76
|
+
event.preventDefault();
|
|
77
|
+
open();
|
|
78
|
+
}
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
const moves = {
|
|
82
|
+
ArrowDown: Math.min(activeIndex + 1, last),
|
|
83
|
+
ArrowUp: Math.max(activeIndex - 1, 0),
|
|
84
|
+
Home: 0,
|
|
85
|
+
End: last,
|
|
86
|
+
};
|
|
87
|
+
if (event.key in moves) {
|
|
88
|
+
event.preventDefault();
|
|
89
|
+
setActiveIndex(moves[event.key]);
|
|
90
|
+
}
|
|
91
|
+
else if (event.key === 'Enter' || event.key === ' ') {
|
|
92
|
+
event.preventDefault();
|
|
93
|
+
choose(activeIndex);
|
|
94
|
+
}
|
|
95
|
+
else if (event.key === 'Escape') {
|
|
96
|
+
event.preventDefault();
|
|
97
|
+
close();
|
|
98
|
+
}
|
|
99
|
+
else if (event.key === 'Tab') {
|
|
100
|
+
close();
|
|
101
|
+
}
|
|
102
|
+
};
|
|
103
|
+
return (<div ref={rootRef} className="absolute inset-0">
|
|
104
|
+
<button type="button" disabled={disabled} aria-haspopup="listbox" aria-expanded={isOpen} aria-controls={listboxId} aria-labelledby={`${labelId} ${id}-value`} aria-describedby={describedBy} aria-invalid={invalid} aria-activedescendant={isOpen && activeIndex >= 0 ? `${listboxId}-${activeIndex}` : undefined} onClick={() => (isOpen ? close() : open())} onKeyDown={handleKeyDown} className="h-full w-full cursor-pointer rounded-full focus:outline-none focus-visible:ring-2 focus-visible:ring-black/20 disabled:cursor-not-allowed dark:focus-visible:ring-white/30">
|
|
105
|
+
<span id={`${id}-value`} className="sr-only">
|
|
106
|
+
{selectedIndex >= 0 ? options[selectedIndex][1] : ''}
|
|
107
|
+
</span>
|
|
108
|
+
</button>
|
|
109
|
+
{!!isOpen && (<ul ref={listRef} id={listboxId} role="listbox" aria-labelledby={labelId} className={listClasses}>
|
|
110
|
+
<Each of={options} render={([optionValue, text], index) => (<li key={optionValue} id={`${listboxId}-${index}`} role="option" aria-selected={index === selectedIndex} onMouseEnter={() => setActiveIndex(index)} onMouseDown={(event) => event.preventDefault()} onClick={() => choose(index)} className={clsx('cursor-pointer px-3 py-2 text-sm whitespace-nowrap', index === activeIndex && 'bg-gray-6 dark:bg-gray-1', index === selectedIndex && 'font-semibold')}>
|
|
111
|
+
{text}
|
|
112
|
+
</li>)}/>
|
|
113
|
+
</ul>)}
|
|
114
|
+
</div>);
|
|
115
|
+
}
|
|
116
|
+
//# sourceMappingURL=SelectList.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SelectList.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Select/SelectList.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;AAEb,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAGL,SAAS,EACT,MAAM,EACN,QAAQ,GACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AAarC,MAAM,WAAW,GAAG,IAAI,CACtB,8GAA8G,EAC9G,sFAAsF,CACvF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,UAAU,CAAC,EACzB,EAAE,EACF,OAAO,EACP,OAAO,EACP,KAAK,EACL,QAAQ,EACR,OAAO,EACP,WAAW,EACX,QAAQ,GACQ;IAChB,MAAM,CAAC,MAAM,EAAE,SAAS,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAC5C,MAAM,CAAC,WAAW,EAAE,cAAc,CAAC,GAAG,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACnD,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAC7C,MAAM,OAAO,GAAG,MAAM,CAAmB,IAAI,CAAC,CAAC;IAC/C,MAAM,SAAS,GAAG,GAAG,EAAE,UAAU,CAAC;IAClC,MAAM,aAAa,GAAG,OAAO,CAAC,SAAS,CACrC,CAAC,CAAC,WAAW,CAAC,EAAE,EAAE,CAAC,WAAW,KAAK,KAAK,CACzC,CAAC;IAEF,MAAM,IAAI,GAAG,GAAG,EAAE;QAChB,cAAc,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,EAAE,CAAC,CAAC,CAAC,CAAC;QAC3C,SAAS,CAAC,IAAI,CAAC,CA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C,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,EAC1E,aAAa,CACd,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,cAAc,GACf,EAAE,eAAe,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"SmallInput.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/SmallInput/SmallInput.tsx"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,SAAS,EAGf,MAAM,OAAO,CAAC;AAGf,KAAK,eAAe,GAAG;IACrB,KAAK,EAAE;QACL,IAAI,EAAE,IAAI,CACR,iBAAiB,CACf,mBAAmB,CAAC,gBAAgB,CAAC,EACrC,gBAAgB,CACjB,CAAC,MAAM,CAAC,EACT,QAAQ,GAAG,UAAU,GAAG,OAAO,CAChC,CAAC;KACH,GAAG,IAAI,CACN,iBAAiB,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,EAC1E,aAAa,CACd,CAAC;IACF,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,wBAAgB,UAAU,CAAC,EACzB,KAAK,EACL,KAAK,EACL,cAAc,GACf,EAAE,eAAe,GAAG,SAAS,CA8B7B"}
|
|
@@ -7,6 +7,7 @@ export function SmallInput({ input, error, classContainer, }) {
|
|
|
7
7
|
const id = input.id ?? (generatedId || undefined);
|
|
8
8
|
useEffect(() => {
|
|
9
9
|
if (!input.id) {
|
|
10
|
+
// eslint-disable-next-line react-hooks/set-state-in-effect -- the id is generated on the client after mount so the server and client markup match
|
|
10
11
|
setGeneratedId(generateUniqueId('small-input'));
|
|
11
12
|
}
|
|
12
13
|
}, [input.id]);
|
|
@@ -1 +1 @@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AC,CACF,WAAW,CAAC,EAAE,EAElB;MAAA,EAAE,GAAG,CACP;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -1,7 +1,28 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
|
-
type
|
|
2
|
+
export type SpinnerSize = 'sm' | 'md';
|
|
3
|
+
export type SpinnerProps = {
|
|
3
4
|
label?: string;
|
|
5
|
+
size?: SpinnerSize;
|
|
4
6
|
};
|
|
5
|
-
|
|
6
|
-
|
|
7
|
+
/**
|
|
8
|
+
* Indeterminate loading indicator.
|
|
9
|
+
*
|
|
10
|
+
* The root is a `span` so it can sit inside a `button` or a line of text; it
|
|
11
|
+
* still renders as a block of its own size.
|
|
12
|
+
*
|
|
13
|
+
* @component
|
|
14
|
+
* @example
|
|
15
|
+
* <Spinner label="Loading orders" />
|
|
16
|
+
*
|
|
17
|
+
* @example
|
|
18
|
+
* // Inline, next to a short text
|
|
19
|
+
* <Spinner size="sm" label="Saving" />
|
|
20
|
+
*
|
|
21
|
+
* @param {Object} props - The properties of the Spinner component.
|
|
22
|
+
* @param {string} [props.label] - Accessible name announced by the `status` role.
|
|
23
|
+
* @param {'sm' | 'md'} [props.size='md'] - `md` is 32px, for a section that is loading. `sm` is 16px, for a button or a line of text.
|
|
24
|
+
*
|
|
25
|
+
* @returns {ReactNode} The rendered Spinner component.
|
|
26
|
+
*/
|
|
27
|
+
export declare function Spinner({ label, size }: SpinnerProps): ReactNode;
|
|
7
28
|
//# sourceMappingURL=Spinner.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Spinner/Spinner.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Spinner.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Spinner/Spinner.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAEvC,MAAM,MAAM,WAAW,GAAG,IAAI,GAAG,IAAI,CAAC;AAEtC,MAAM,MAAM,YAAY,GAAG;IACzB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,WAAW,CAAC;CACpB,CAAC;AAOF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,OAAO,CAAC,EAAE,KAAK,EAAE,IAAW,EAAE,EAAE,YAAY,GAAG,SAAS,CAkBvE"}
|
|
@@ -1,6 +1,32 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
const sizeMap = {
|
|
3
|
+
sm: { box: 'size-4', ring: 'size-4 border-2' },
|
|
4
|
+
md: { box: 'size-8', ring: 'size-8 border-4' },
|
|
5
|
+
};
|
|
6
|
+
/**
|
|
7
|
+
* Indeterminate loading indicator.
|
|
8
|
+
*
|
|
9
|
+
* The root is a `span` so it can sit inside a `button` or a line of text; it
|
|
10
|
+
* still renders as a block of its own size.
|
|
11
|
+
*
|
|
12
|
+
* @component
|
|
13
|
+
* @example
|
|
14
|
+
* <Spinner label="Loading orders" />
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* // Inline, next to a short text
|
|
18
|
+
* <Spinner size="sm" label="Saving" />
|
|
19
|
+
*
|
|
20
|
+
* @param {Object} props - The properties of the Spinner component.
|
|
21
|
+
* @param {string} [props.label] - Accessible name announced by the `status` role.
|
|
22
|
+
* @param {'sm' | 'md'} [props.size='md'] - `md` is 32px, for a section that is loading. `sm` is 16px, for a button or a line of text.
|
|
23
|
+
*
|
|
24
|
+
* @returns {ReactNode} The rendered Spinner component.
|
|
25
|
+
*/
|
|
26
|
+
export function Spinner({ label, size = 'md' }) {
|
|
27
|
+
const sizing = sizeMap[size];
|
|
28
|
+
return (<span role="status" aria-label={label} className={clsx('block', sizing.box)}>
|
|
29
|
+
<span aria-hidden="true" className={clsx('border-gray-2 border-b-lavender dark:border-gray-2 dark:border-b-lavender-dark inline-block animate-spin rounded-full', sizing.ring)}/>
|
|
30
|
+
</span>);
|
|
5
31
|
}
|
|
6
32
|
//# sourceMappingURL=Spinner.jsx.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Spinner.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Spinner/Spinner.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Spinner.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Spinner/Spinner.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAUxB,MAAM,OAAO,GAAuD;IAClE,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,EAAE;IAC9C,EAAE,EAAE,EAAE,GAAG,EAAE,QAAQ,EAAE,IAAI,EAAE,iBAAiB,EAAE;CAC/C,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,GAAG,IAAI,EAAgB;IAC1D,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAE7B,OAAO,CACL,CAAC,IAAI,CACH,IAAI,CAAC,QAAQ,CACb,UAAU,CAAC,CAAC,KAAK,CAAC,CAClB,SAAS,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,CAErC;MAAA,CAAC,IAAI,CACH,WAAW,CAAC,MAAM,CAClB,SAAS,CAAC,CAAC,IAAI,CACb,uHAAuH,EACvH,MAAM,CAAC,IAAI,CACZ,CAAC,EAEN;IAAA,EAAE,IAAI,CAAC,CACR,CAAC;AACJ,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Spinner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Spinner/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import type { HTMLAttributes, ReactNode } from 'react';
|
|
2
|
+
export type StatTone = 'default' | 'success' | 'warning' | 'error';
|
|
3
|
+
export type StatProps = {
|
|
4
|
+
/** What the number measures. */
|
|
5
|
+
label: string;
|
|
6
|
+
/** The figure, already formatted. */
|
|
7
|
+
value: ReactNode;
|
|
8
|
+
/** Change against a previous period, already formatted (`+12 %`). */
|
|
9
|
+
delta?: string;
|
|
10
|
+
/** Short context under the value (`last 30 days`). */
|
|
11
|
+
hint?: string;
|
|
12
|
+
/** Dot next to the label that grades the value. `default` shows none. */
|
|
13
|
+
tone?: StatTone;
|
|
14
|
+
/** Decorative icon in the top right corner, hidden from screen readers. */
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
/** Holds the space with placeholders while the value loads. */
|
|
17
|
+
isLoading?: boolean;
|
|
18
|
+
} & Omit<HTMLAttributes<HTMLDivElement>, 'children'>;
|
|
19
|
+
/**
|
|
20
|
+
* Card with one key figure: a label, the value in large type and an optional
|
|
21
|
+
* line of context. Meant for summary rows above a list or a report, where
|
|
22
|
+
* several of them sit side by side in a grid.
|
|
23
|
+
*
|
|
24
|
+
* `tone` adds a dot next to the label to grade the value. Color is never the
|
|
25
|
+
* only signal: the label, the delta or the hint has to say it in words too.
|
|
26
|
+
*
|
|
27
|
+
* @component
|
|
28
|
+
* @example
|
|
29
|
+
* <Stat label="Resolved" value="84 %" delta="+6 pts" hint="last 30 days" tone="success" />
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // While loading
|
|
33
|
+
* <Stat label="Average cost" value="" isLoading />
|
|
34
|
+
*
|
|
35
|
+
* @param {Object} props - The properties of the Stat component.
|
|
36
|
+
* @param {string} props.label - What the number measures.
|
|
37
|
+
* @param {ReactNode} props.value - The figure, already formatted.
|
|
38
|
+
* @param {string} [props.delta] - Change against a previous period, already formatted.
|
|
39
|
+
* @param {string} [props.hint] - Short context shown after the delta.
|
|
40
|
+
* @param {'default' | 'success' | 'warning' | 'error'} [props.tone='default'] - Dot next to the label that grades the value.
|
|
41
|
+
* @param {ReactNode} [props.icon] - Decorative icon in the top right corner.
|
|
42
|
+
* @param {boolean} [props.isLoading=false] - Shows placeholders instead of the value and the context line.
|
|
43
|
+
*
|
|
44
|
+
* @returns {ReactNode} The rendered Stat component.
|
|
45
|
+
*/
|
|
46
|
+
export declare function Stat({ label, value, delta, hint, tone, icon, isLoading, ...restProps }: StatProps): ReactNode;
|
|
47
|
+
//# sourceMappingURL=Stat.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stat.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Stat/Stat.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAIvD,MAAM,MAAM,QAAQ,GAAG,SAAS,GAAG,SAAS,GAAG,SAAS,GAAG,OAAO,CAAC;AAEnE,MAAM,MAAM,SAAS,GAAG;IACtB,gCAAgC;IAChC,KAAK,EAAE,MAAM,CAAC;IACd,qCAAqC;IACrC,KAAK,EAAE,SAAS,CAAC;IACjB,qEAAqE;IACrE,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sDAAsD;IACtD,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,yEAAyE;IACzE,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,+DAA+D;IAC/D,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB,GAAG,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,CAAC;AAUrD;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,IAAI,CAAC,EACnB,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,IAAgB,EAChB,IAAI,EACJ,SAAiB,EACjB,GAAG,SAAS,EACb,EAAE,SAAS,GAAG,SAAS,CAkDvB"}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
import { Show } from '../../00-base';
|
|
3
|
+
import { Skeleton } from '../Skeleton';
|
|
4
|
+
// `warning` uses the amber family, like `ProgressBar`: the yellow token sits
|
|
5
|
+
// below the 3:1 a graphic needs against the surface.
|
|
6
|
+
const toneMap = {
|
|
7
|
+
success: 'bg-success dark:bg-success-dark',
|
|
8
|
+
warning: 'bg-amber dark:bg-amber-dark',
|
|
9
|
+
error: 'bg-error dark:bg-error-dark',
|
|
10
|
+
};
|
|
11
|
+
/**
|
|
12
|
+
* Card with one key figure: a label, the value in large type and an optional
|
|
13
|
+
* line of context. Meant for summary rows above a list or a report, where
|
|
14
|
+
* several of them sit side by side in a grid.
|
|
15
|
+
*
|
|
16
|
+
* `tone` adds a dot next to the label to grade the value. Color is never the
|
|
17
|
+
* only signal: the label, the delta or the hint has to say it in words too.
|
|
18
|
+
*
|
|
19
|
+
* @component
|
|
20
|
+
* @example
|
|
21
|
+
* <Stat label="Resolved" value="84 %" delta="+6 pts" hint="last 30 days" tone="success" />
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // While loading
|
|
25
|
+
* <Stat label="Average cost" value="" isLoading />
|
|
26
|
+
*
|
|
27
|
+
* @param {Object} props - The properties of the Stat component.
|
|
28
|
+
* @param {string} props.label - What the number measures.
|
|
29
|
+
* @param {ReactNode} props.value - The figure, already formatted.
|
|
30
|
+
* @param {string} [props.delta] - Change against a previous period, already formatted.
|
|
31
|
+
* @param {string} [props.hint] - Short context shown after the delta.
|
|
32
|
+
* @param {'default' | 'success' | 'warning' | 'error'} [props.tone='default'] - Dot next to the label that grades the value.
|
|
33
|
+
* @param {ReactNode} [props.icon] - Decorative icon in the top right corner.
|
|
34
|
+
* @param {boolean} [props.isLoading=false] - Shows placeholders instead of the value and the context line.
|
|
35
|
+
*
|
|
36
|
+
* @returns {ReactNode} The rendered Stat component.
|
|
37
|
+
*/
|
|
38
|
+
export function Stat({ label, value, delta, hint, tone = 'default', icon, isLoading = false, ...restProps }) {
|
|
39
|
+
const context = [delta, hint].filter(Boolean).join(' · ');
|
|
40
|
+
return (<div {...restProps} data-orion-part="stat" aria-busy={isLoading || undefined} className={clsx('border-gray-5 dark:border-gray-1 flex min-w-0 flex-col gap-1 rounded-lg border p-4', !!icon && 'relative pr-14', restProps.className)}>
|
|
41
|
+
{!!icon && (<span aria-hidden="true" data-orion-part="stat-icon" className="absolute top-3.5 right-3.5 flex">
|
|
42
|
+
{icon}
|
|
43
|
+
</span>)}
|
|
44
|
+
<p className="text-gray-1 dark:text-gray-2 flex items-center gap-1.5 text-xs leading-4">
|
|
45
|
+
{tone !== 'default' && (<span aria-hidden="true" className={clsx('size-1.5 shrink-0 rounded-full', toneMap[tone])}/>)}
|
|
46
|
+
{label}
|
|
47
|
+
</p>
|
|
48
|
+
<Show>
|
|
49
|
+
<Show.When isTrue={isLoading}>
|
|
50
|
+
<Skeleton shape="rect" className="h-8 w-24"/>
|
|
51
|
+
<Skeleton className="mt-1.5 w-32"/>
|
|
52
|
+
</Show.When>
|
|
53
|
+
<Show.Else>
|
|
54
|
+
<div className="text-2xl leading-8 font-semibold whitespace-nowrap text-black dark:text-white">
|
|
55
|
+
{value}
|
|
56
|
+
</div>
|
|
57
|
+
{!!context && (<p className="text-gray-1 dark:text-gray-2 text-xs leading-4">
|
|
58
|
+
{context}
|
|
59
|
+
</p>)}
|
|
60
|
+
</Show.Else>
|
|
61
|
+
</Show>
|
|
62
|
+
</div>);
|
|
63
|
+
}
|
|
64
|
+
//# sourceMappingURL=Stat.jsx.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Stat.jsx","sourceRoot":"","sources":["../../../../src/components/01-atoms/Stat/Stat.tsx"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAE,IAAI,EAAE,MAAM,eAAe,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAqBvC,6EAA6E;AAC7E,qDAAqD;AACrD,MAAM,OAAO,GAAiD;IAC5D,OAAO,EAAE,iCAAiC;IAC1C,OAAO,EAAE,6BAA6B;IACtC,KAAK,EAAE,6BAA6B;CACrC,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,MAAM,UAAU,IAAI,CAAC,EACnB,KAAK,EACL,KAAK,EACL,KAAK,EACL,IAAI,EACJ,IAAI,GAAG,SAAS,EAChB,IAAI,EACJ,SAAS,GAAG,KAAK,EACjB,GAAG,SAAS,EACF;IACV,MAAM,OAAO,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAE1D,OAAO,CACL,CAAC,GAAG,CACF,IAAI,SAAS,CAAC,CACd,eAAe,CAAC,MAAM,CACtB,SAAS,CAAC,CAAC,SAAS,IAAI,SAAS,CAAC,CAClC,SAAS,CAAC,CAAC,IAAI,CACb,oFAAoF,EACpF,CAAC,CAAC,IAAI,IAAI,gBAAgB,EAC1B,SAAS,CAAC,SAAS,CACpB,CAAC,CAEF;MAAA,CAAC,CAAC,CAAC,IAAI,IAAI,CACT,CAAC,IAAI,CACH,WAAW,CAAC,MAAM,CAClB,eAAe,CAAC,WAAW,CAC3B,SAAS,CAAC,iCAAiC,CAE3C;UAAA,CAAC,IAAI,CACP;QAAA,EAAE,IAAI,CAAC,CACR,CACD;MAAA,CAAC,CAAC,CAAC,SAAS,CAAC,0EAA0E,CACrF;QAAA,CAAC,IAAI,KAAK,SAAS,IAAI,CACrB,CAAC,IAAI,CACH,WAAW,CAAC,MAAM,CAClB,SAAS,CAAC,CAAC,IAAI,CAAC,gCAAgC,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EACjE,CACH,CACD;QAAA,CAAC,KAAK,CACR;MAAA,EAAE,CAAC,CACH;MAAA,CAAC,IAAI,CACH;QAAA,CAAC,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,CAC3B;UAAA,CAAC,QAAQ,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,UAAU,EAC3C;UAAA,CAAC,QAAQ,CAAC,SAAS,CAAC,aAAa,EACnC;QAAA,EAAE,IAAI,CAAC,IAAI,CACX;QAAA,CAAC,IAAI,CAAC,IAAI,CACR;UAAA,CAAC,GAAG,CAAC,SAAS,CAAC,+EAA+E,CAC5F;YAAA,CAAC,KAAK,CACR;UAAA,EAAE,GAAG,CACL;UAAA,CAAC,CAAC,CAAC,OAAO,IAAI,CACZ,CAAC,CAAC,CAAC,SAAS,CAAC,gDAAgD,CAC3D;cAAA,CAAC,OAAO,CACV;YAAA,EAAE,CAAC,CAAC,CACL,CACH;QAAA,EAAE,IAAI,CAAC,IAAI,CACb;MAAA,EAAE,IAAI,CACR;IAAA,EAAE,GAAG,CAAC,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/01-atoms/Stat/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/01-atoms/Stat/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC"}
|