@nearform/quantum 1.9.3 → 1.10.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/dist/animations/index.js.map +1 -1
- package/dist/assets/build/open-source.icon.js.map +1 -1
- package/dist/assets/index.d.ts +1 -1
- package/dist/assets/index.js +1 -1
- package/dist/assets/index.js.map +1 -1
- package/dist/colors/index.js.map +1 -1
- package/dist/components/Accordion/index.d.ts +2 -2
- package/dist/components/Accordion/index.js +7 -7
- package/dist/components/Accordion/index.js.map +1 -1
- package/dist/components/AppHeader/index.js +8 -8
- package/dist/components/AppHeader/index.js.map +1 -1
- package/dist/components/Avatar/index.d.ts +3 -3
- package/dist/components/Avatar/index.js +3 -3
- package/dist/components/Avatar/index.js.map +1 -1
- package/dist/components/BackLink/index.d.ts +2 -2
- package/dist/components/BackLink/index.js +3 -3
- package/dist/components/BackLink/index.js.map +1 -1
- package/dist/components/Badge/index.d.ts +3 -3
- package/dist/components/Badge/index.js +2 -2
- package/dist/components/Badge/index.js.map +1 -1
- package/dist/components/Breadcrumb/index.d.ts +1 -1
- package/dist/components/Breadcrumb/index.js +7 -7
- package/dist/components/Breadcrumb/index.js.map +1 -1
- package/dist/components/Button/index.d.ts +3 -3
- package/dist/components/Button/index.js +3 -3
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/ButtonGroup/index.d.ts +2 -2
- package/dist/components/ButtonGroup/index.js +2 -2
- package/dist/components/ButtonGroup/index.js.map +1 -1
- package/dist/components/Calendar/index.js +5 -5
- package/dist/components/Calendar/index.js.map +1 -1
- package/dist/components/Card/index.d.ts +4 -4
- package/dist/components/Card/index.js +10 -10
- package/dist/components/Card/index.js.map +1 -1
- package/dist/components/Chat/index.d.ts +1 -1
- package/dist/components/Chat/index.js +8 -8
- package/dist/components/Chat/index.js.map +1 -1
- package/dist/components/Checkbox/index.js +3 -3
- package/dist/components/Checkbox/index.js.map +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.d.ts +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroup.js +3 -3
- package/dist/components/CheckboxGroup/CheckboxGroup.js.map +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroupItem.d.ts +1 -1
- package/dist/components/CheckboxGroup/CheckboxGroupItem.js +7 -7
- package/dist/components/CheckboxGroup/CheckboxGroupItem.js.map +1 -1
- package/dist/components/CheckboxGroup/index.d.ts +2 -2
- package/dist/components/CheckboxGroup/index.js +5 -5
- package/dist/components/CheckboxGroup/index.js.map +1 -1
- package/dist/components/Chip/index.d.ts +2 -2
- package/dist/components/Chip/index.js +3 -3
- package/dist/components/Chip/index.js.map +1 -1
- package/dist/components/CodeBlock/index.js +2 -2
- package/dist/components/CodeBlock/index.js.map +1 -1
- package/dist/components/ControlLabel/index.d.ts +3 -3
- package/dist/components/ControlLabel/index.js +4 -4
- package/dist/components/ControlLabel/index.js.map +1 -1
- package/dist/components/DateInput/index.js +5 -5
- package/dist/components/DateInput/index.js.map +1 -1
- package/dist/components/DocsList/index.js +9 -9
- package/dist/components/DocsList/index.js.map +1 -1
- package/dist/components/FormGroup/index.d.ts +1 -1
- package/dist/components/FormGroup/index.js +16 -19
- package/dist/components/FormGroup/index.js.map +1 -1
- package/dist/components/HeroButton/index.d.ts +2 -2
- package/dist/components/HeroButton/index.js +3 -3
- package/dist/components/HeroButton/index.js.map +1 -1
- package/dist/components/IconButton/index.d.ts +3 -3
- package/dist/components/IconButton/index.js +3 -3
- package/dist/components/IconButton/index.js.map +1 -1
- package/dist/components/Input/index.d.ts +3 -3
- package/dist/components/Input/index.js +5 -5
- package/dist/components/Input/index.js.map +1 -1
- package/dist/components/Label/index.d.ts +2 -2
- package/dist/components/Label/index.js +3 -3
- package/dist/components/Label/index.js.map +1 -1
- package/dist/components/Link/index.d.ts +3 -3
- package/dist/components/Link/index.js +2 -2
- package/dist/components/Link/index.js.map +1 -1
- package/dist/components/Meter/index.d.ts +20 -0
- package/dist/components/Meter/index.js +136 -0
- package/dist/components/Meter/index.js.map +1 -0
- package/dist/components/Modal/index.d.ts +12 -12
- package/dist/components/Modal/index.js +9 -9
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/Navigation/index.js +3 -3
- package/dist/components/Navigation/index.js.map +1 -1
- package/dist/components/Notice/index.d.ts +2 -2
- package/dist/components/Notice/index.js +9 -9
- package/dist/components/Notice/index.js.map +1 -1
- package/dist/components/PageHeader/index.d.ts +2 -2
- package/dist/components/PageHeader/index.js +4 -4
- package/dist/components/PageHeader/index.js.map +1 -1
- package/dist/components/Pagination/index.d.ts +1 -1
- package/dist/components/Pagination/index.js +9 -6
- package/dist/components/Pagination/index.js.map +1 -1
- package/dist/components/Password/index.js +4 -4
- package/dist/components/Password/index.js.map +1 -1
- package/dist/components/Popover/index.d.ts +1 -1
- package/dist/components/Popover/index.js +6 -6
- package/dist/components/Popover/index.js.map +1 -1
- package/dist/components/Radio/RadioGroup.js +3 -3
- package/dist/components/Radio/RadioGroup.js.map +1 -1
- package/dist/components/Radio/RadioGroupItem.js +6 -6
- package/dist/components/Radio/RadioGroupItem.js.map +1 -1
- package/dist/components/Radio/index.d.ts +2 -2
- package/dist/components/Radio/index.js +4 -4
- package/dist/components/Radio/index.js.map +1 -1
- package/dist/components/Select/index.d.ts +3 -3
- package/dist/components/Select/index.js +8 -8
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Slider/index.d.ts +1 -1
- package/dist/components/Slider/index.js +6 -6
- package/dist/components/Slider/index.js.map +1 -1
- package/dist/components/SortAndShow/index.js +5 -5
- package/dist/components/SortAndShow/index.js.map +1 -1
- package/dist/components/SplitButton/index.d.ts +3 -3
- package/dist/components/SplitButton/index.js +6 -6
- package/dist/components/SplitButton/index.js.map +1 -1
- package/dist/components/Stats/index.d.ts +1 -1
- package/dist/components/Stats/index.js +3 -3
- package/dist/components/Stats/index.js.map +1 -1
- package/dist/components/Stepper/index.js +7 -7
- package/dist/components/Stepper/index.js.map +1 -1
- package/dist/components/StepsIndicator/Step.js +3 -3
- package/dist/components/StepsIndicator/Step.js.map +1 -1
- package/dist/components/StepsIndicator/StepsIndicator.js +4 -4
- package/dist/components/StepsIndicator/StepsIndicator.js.map +1 -1
- package/dist/components/StepsIndicator/index.d.ts +2 -2
- package/dist/components/StepsIndicator/index.js +2 -2
- package/dist/components/StepsIndicator/index.js.map +1 -1
- package/dist/components/Subnav/index.js +5 -5
- package/dist/components/Subnav/index.js.map +1 -1
- package/dist/components/Switch/index.js +2 -2
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Table/index.d.ts +8 -3
- package/dist/components/Table/index.js +25 -19
- package/dist/components/Table/index.js.map +1 -1
- package/dist/components/Tabs/index.d.ts +4 -4
- package/dist/components/Tabs/index.js +5 -5
- package/dist/components/Tabs/index.js.map +1 -1
- package/dist/components/Textarea/index.d.ts +2 -2
- package/dist/components/Textarea/index.js +2 -2
- package/dist/components/Textarea/index.js.map +1 -1
- package/dist/components/ThemeToggle/index.d.ts +9 -0
- package/dist/components/ThemeToggle/index.js +127 -0
- package/dist/components/ThemeToggle/index.js.map +1 -0
- package/dist/components/Toast/index.d.ts +2 -2
- package/dist/components/Toast/index.js +12 -12
- package/dist/components/Toast/index.js.map +1 -1
- package/dist/components/ToggleList/index.d.ts +1 -1
- package/dist/components/ToggleList/index.js +6 -6
- package/dist/components/ToggleList/index.js.map +1 -1
- package/dist/components/Tooltip/index.js +2 -2
- package/dist/components/Tooltip/index.js.map +1 -1
- package/dist/components/WebsiteFooter/index.d.ts +4 -4
- package/dist/components/WebsiteFooter/index.js +5 -5
- package/dist/components/WebsiteFooter/index.js.map +1 -1
- package/dist/components/WebsiteHeader/index.js +8 -8
- package/dist/components/WebsiteHeader/index.js.map +1 -1
- package/dist/components/choice-group.d.ts +3 -3
- package/dist/components/choice-group.js +7 -7
- package/dist/components/choice-group.js.map +1 -1
- package/dist/components/index.d.ts +51 -49
- package/dist/components/index.js +51 -49
- package/dist/components/index.js.map +1 -1
- package/dist/esm/animations/index.d.ts +25 -0
- package/dist/esm/assets/build/open-source.icon.d.ts +2 -0
- package/dist/esm/assets/build/open-source.icon.js +3 -0
- package/dist/esm/assets/build/open-source.icon.js.map +1 -0
- package/dist/esm/assets/index.d.ts +13 -0
- package/dist/esm/assets/index.js +13 -0
- package/dist/esm/assets/index.js.map +1 -0
- package/dist/esm/colors/accent.d.ts +16 -0
- package/dist/esm/colors/accent.js +1 -1
- package/dist/esm/colors/background.d.ts +36 -0
- package/dist/esm/colors/background.js +1 -1
- package/dist/esm/colors/base.d.ts +136 -0
- package/dist/esm/colors/border.d.ts +16 -0
- package/dist/esm/colors/border.js +1 -1
- package/dist/esm/colors/button.d.ts +106 -0
- package/dist/esm/colors/button.js +5 -5
- package/dist/esm/colors/feedback.d.ts +27 -0
- package/dist/esm/colors/feedback.js +1 -1
- package/dist/esm/colors/foreground.d.ts +35 -0
- package/dist/esm/colors/foreground.js +1 -1
- package/dist/esm/colors/index.d.ts +351 -0
- package/dist/esm/colors/index.js +7 -7
- package/dist/esm/components/Accordion/index.d.ts +16 -0
- package/dist/esm/components/Accordion/index.js +58 -0
- package/dist/esm/components/Accordion/index.js.map +1 -0
- package/dist/esm/components/AppHeader/index.d.ts +21 -0
- package/dist/esm/components/AppHeader/index.js +56 -0
- package/dist/esm/components/AppHeader/index.js.map +1 -0
- package/dist/esm/components/Avatar/index.d.ts +32 -0
- package/dist/esm/components/Avatar/index.js +110 -0
- package/dist/esm/components/Avatar/index.js.map +1 -0
- package/dist/esm/components/BackLink/index.d.ts +9 -0
- package/dist/esm/components/BackLink/index.js +43 -0
- package/dist/esm/components/BackLink/index.js.map +1 -0
- package/dist/esm/components/Badge/index.d.ts +48 -0
- package/dist/esm/components/Badge/index.js +154 -0
- package/dist/esm/components/Badge/index.js.map +1 -0
- package/dist/esm/components/Breadcrumb/index.d.ts +13 -0
- package/dist/esm/components/Breadcrumb/index.js +49 -0
- package/dist/esm/components/Breadcrumb/index.js.map +1 -0
- package/dist/esm/components/Button/index.d.ts +17 -0
- package/dist/esm/components/Button/index.js +167 -0
- package/dist/esm/components/Button/index.js.map +1 -0
- package/dist/esm/components/ButtonGroup/index.d.ts +11 -0
- package/dist/esm/components/ButtonGroup/index.js +96 -0
- package/dist/esm/components/ButtonGroup/index.js.map +1 -0
- package/dist/esm/components/Calendar/index.d.ts +8 -0
- package/dist/esm/components/Calendar/index.js +144 -0
- package/dist/esm/components/Calendar/index.js.map +1 -0
- package/dist/esm/components/Card/index.d.ts +28 -0
- package/dist/esm/components/Card/index.js +114 -0
- package/dist/esm/components/Card/index.js.map +1 -0
- package/dist/esm/components/Chat/index.d.ts +39 -0
- package/dist/esm/components/Chat/index.js +91 -0
- package/dist/esm/components/Chat/index.js.map +1 -0
- package/dist/esm/components/Checkbox/index.d.ts +5 -0
- package/dist/esm/components/Checkbox/index.js +92 -0
- package/dist/esm/components/Checkbox/index.js.map +1 -0
- package/dist/esm/components/CheckboxGroup/CheckboxGroup.d.ts +61 -0
- package/dist/esm/components/CheckboxGroup/CheckboxGroup.js +70 -0
- package/dist/esm/components/CheckboxGroup/CheckboxGroup.js.map +1 -0
- package/dist/esm/components/CheckboxGroup/CheckboxGroupItem.d.ts +19 -0
- package/dist/esm/components/CheckboxGroup/CheckboxGroupItem.js +47 -0
- package/dist/esm/components/CheckboxGroup/CheckboxGroupItem.js.map +1 -0
- package/dist/esm/components/CheckboxGroup/index.d.ts +2 -0
- package/dist/esm/components/CheckboxGroup/index.js +3 -0
- package/dist/esm/components/CheckboxGroup/index.js.map +1 -0
- package/dist/esm/components/Chip/index.d.ts +11 -0
- package/dist/esm/components/Chip/index.js +99 -0
- package/dist/esm/components/Chip/index.js.map +1 -0
- package/dist/esm/components/CodeBlock/index.d.ts +7 -0
- package/dist/esm/components/CodeBlock/index.js +21 -0
- package/dist/esm/components/CodeBlock/index.js.map +1 -0
- package/dist/esm/components/ControlLabel/index.d.ts +13 -0
- package/dist/esm/components/ControlLabel/index.js +47 -0
- package/dist/esm/components/ControlLabel/index.js.map +1 -0
- package/dist/esm/components/DateInput/index.d.ts +26 -0
- package/dist/esm/components/DateInput/index.js +225 -0
- package/dist/esm/components/DateInput/index.js.map +1 -0
- package/dist/esm/components/DocsList/index.d.ts +18 -0
- package/dist/esm/components/DocsList/index.js +83 -0
- package/dist/esm/components/DocsList/index.js.map +1 -0
- package/dist/esm/components/FormGroup/index.d.ts +121 -0
- package/dist/esm/components/FormGroup/index.js +317 -0
- package/dist/esm/components/FormGroup/index.js.map +1 -0
- package/dist/esm/components/HeroButton/index.d.ts +17 -0
- package/dist/esm/components/HeroButton/index.js +102 -0
- package/dist/esm/components/HeroButton/index.js.map +1 -0
- package/dist/esm/components/IconButton/index.d.ts +77 -0
- package/dist/esm/components/IconButton/index.js +198 -0
- package/dist/esm/components/IconButton/index.js.map +1 -0
- package/dist/esm/components/Input/index.d.ts +27 -0
- package/dist/esm/components/Input/index.js +172 -0
- package/dist/esm/components/Input/index.js.map +1 -0
- package/dist/esm/components/Label/index.d.ts +12 -0
- package/dist/esm/components/Label/index.js +53 -0
- package/dist/esm/components/Label/index.js.map +1 -0
- package/dist/esm/components/Link/index.d.ts +13 -0
- package/dist/esm/components/Link/index.js +76 -0
- package/dist/esm/components/Link/index.js.map +1 -0
- package/dist/esm/components/Meter/index.d.ts +20 -0
- package/dist/esm/components/Meter/index.js +100 -0
- package/dist/esm/components/Meter/index.js.map +1 -0
- package/dist/esm/components/Modal/index.d.ts +26 -0
- package/dist/esm/components/Modal/index.js +97 -0
- package/dist/esm/components/Modal/index.js.map +1 -0
- package/dist/esm/components/Navigation/index.d.ts +8 -0
- package/dist/esm/components/Navigation/index.js +28 -0
- package/dist/esm/components/Navigation/index.js.map +1 -0
- package/dist/esm/components/Notice/index.d.ts +21 -0
- package/dist/esm/components/Notice/index.js +105 -0
- package/dist/esm/components/Notice/index.js.map +1 -0
- package/dist/esm/components/PageHeader/index.d.ts +15 -0
- package/dist/esm/components/PageHeader/index.js +51 -0
- package/dist/esm/components/PageHeader/index.js.map +1 -0
- package/dist/esm/components/Pagination/index.d.ts +17 -0
- package/dist/esm/components/Pagination/index.js +115 -0
- package/dist/esm/components/Pagination/index.js.map +1 -0
- package/dist/esm/components/Password/index.d.ts +18 -0
- package/dist/esm/components/Password/index.js +70 -0
- package/dist/esm/components/Password/index.js.map +1 -0
- package/dist/esm/components/Popover/index.d.ts +28 -0
- package/dist/esm/components/Popover/index.js +54 -0
- package/dist/esm/components/Popover/index.js.map +1 -0
- package/dist/esm/components/Radio/RadioGroup.d.ts +42 -0
- package/dist/esm/components/Radio/RadioGroup.js +46 -0
- package/dist/esm/components/Radio/RadioGroup.js.map +1 -0
- package/dist/esm/components/Radio/RadioGroupItem.d.ts +17 -0
- package/dist/esm/components/Radio/RadioGroupItem.js +81 -0
- package/dist/esm/components/Radio/RadioGroupItem.js.map +1 -0
- package/dist/esm/components/Radio/index.d.ts +2 -0
- package/dist/esm/components/Radio/index.js +3 -0
- package/dist/esm/components/Radio/index.js.map +1 -0
- package/dist/esm/components/Select/index.d.ts +19 -0
- package/dist/esm/components/Select/index.js +162 -0
- package/dist/esm/components/Select/index.js.map +1 -0
- package/dist/esm/components/Slider/index.d.ts +20 -0
- package/dist/esm/components/Slider/index.js +92 -0
- package/dist/esm/components/Slider/index.js.map +1 -0
- package/dist/esm/components/SortAndShow/index.d.ts +15 -0
- package/dist/esm/components/SortAndShow/index.js +31 -0
- package/dist/esm/components/SortAndShow/index.js.map +1 -0
- package/dist/esm/components/SplitButton/index.d.ts +25 -0
- package/dist/esm/components/SplitButton/index.js +184 -0
- package/dist/esm/components/SplitButton/index.js.map +1 -0
- package/dist/esm/components/Stats/index.d.ts +10 -0
- package/dist/esm/components/Stats/index.js +26 -0
- package/dist/esm/components/Stats/index.js.map +1 -0
- package/dist/esm/components/Stepper/index.d.ts +27 -0
- package/dist/esm/components/Stepper/index.js +124 -0
- package/dist/esm/components/Stepper/index.js.map +1 -0
- package/dist/esm/components/StepsIndicator/Step.d.ts +6 -0
- package/dist/esm/components/StepsIndicator/Step.js +21 -0
- package/dist/esm/components/StepsIndicator/Step.js.map +1 -0
- package/dist/esm/components/StepsIndicator/StepsIndicator.d.ts +12 -0
- package/dist/esm/components/StepsIndicator/StepsIndicator.js +31 -0
- package/dist/esm/components/StepsIndicator/StepsIndicator.js.map +1 -0
- package/dist/esm/components/StepsIndicator/index.d.ts +2 -0
- package/dist/esm/components/StepsIndicator/index.js +3 -0
- package/dist/esm/components/StepsIndicator/index.js.map +1 -0
- package/dist/esm/components/Subnav/index.d.ts +14 -0
- package/dist/esm/components/Subnav/index.js +54 -0
- package/dist/esm/components/Subnav/index.js.map +1 -0
- package/dist/esm/components/Switch/index.d.ts +4 -0
- package/dist/esm/components/Switch/index.js +67 -0
- package/dist/esm/components/Switch/index.js.map +1 -0
- package/dist/esm/components/Table/index.d.ts +53 -0
- package/dist/esm/components/Table/index.js +108 -0
- package/dist/esm/components/Table/index.js.map +1 -0
- package/dist/esm/components/Tabs/index.d.ts +16 -0
- package/dist/esm/components/Tabs/index.js +126 -0
- package/dist/esm/components/Tabs/index.js.map +1 -0
- package/dist/esm/components/Textarea/index.d.ts +13 -0
- package/dist/esm/components/Textarea/index.js +89 -0
- package/dist/esm/components/Textarea/index.js.map +1 -0
- package/dist/esm/components/ThemeToggle/index.d.ts +9 -0
- package/dist/esm/components/ThemeToggle/index.js +90 -0
- package/dist/esm/components/ThemeToggle/index.js.map +1 -0
- package/dist/esm/components/Toast/index.d.ts +24 -0
- package/dist/esm/components/Toast/index.js +129 -0
- package/dist/esm/components/Toast/index.js.map +1 -0
- package/dist/esm/components/ToggleList/index.d.ts +20 -0
- package/dist/esm/components/ToggleList/index.js +31 -0
- package/dist/esm/components/ToggleList/index.js.map +1 -0
- package/dist/esm/components/Tooltip/index.d.ts +11 -0
- package/dist/esm/components/Tooltip/index.js +30 -0
- package/dist/esm/components/Tooltip/index.js.map +1 -0
- package/dist/esm/components/WebsiteFooter/index.d.ts +23 -0
- package/dist/esm/components/WebsiteFooter/index.js +104 -0
- package/dist/esm/components/WebsiteFooter/index.js.map +1 -0
- package/dist/esm/components/WebsiteHeader/index.d.ts +21 -0
- package/dist/esm/components/WebsiteHeader/index.js +56 -0
- package/dist/esm/components/WebsiteHeader/index.js.map +1 -0
- package/dist/esm/components/choice-group.d.ts +109 -0
- package/dist/esm/components/choice-group.js +159 -0
- package/dist/esm/components/choice-group.js.map +1 -0
- package/dist/esm/components/index.d.ts +51 -0
- package/dist/esm/components/index.js +52 -0
- package/dist/esm/components/index.js.map +1 -0
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/lib/utils.d.ts +16 -0
- package/dist/esm/lib/utils.js +18 -0
- package/dist/esm/lib/utils.js.map +1 -0
- package/dist/esm/tailwind-base.d.ts +37 -0
- package/dist/esm/tailwind-plugin.d.ts +22 -0
- package/dist/esm/tailwind-plugin.js +2 -2
- package/dist/esm/theme.d.ts +421 -0
- package/dist/esm/theme.js +2 -2
- package/dist/global.css +72 -9
- package/dist/index.d.ts +3 -3
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js.map +1 -1
- package/dist/tailwind-base.js.map +1 -1
- package/dist/tailwind-plugin.js.map +1 -1
- package/dist/theme.js.map +1 -1
- package/package.json +27 -16
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import { cva } from 'class-variance-authority';
|
|
15
|
+
import { buttonVariants } from '../Button/index.js';
|
|
16
|
+
import { cn } from '../../lib/utils.js';
|
|
17
|
+
/**
|
|
18
|
+
* An icon button is a `Button` with the label taken out, so it takes its
|
|
19
|
+
* colours from `buttonVariants` rather than restating them. That import is
|
|
20
|
+
* the point rather than an economy: the two sit beside each other in a
|
|
21
|
+
* toolbar, so a variant that gained a hover state or a focus ring in one and
|
|
22
|
+
* not the other would be visible in the gap between them.
|
|
23
|
+
*
|
|
24
|
+
* `size: null` is how cva is told to skip a variant *and* its default, so
|
|
25
|
+
* `Button`'s padding and text sizes are left off entirely and the square
|
|
26
|
+
* below is the only thing setting the box.
|
|
27
|
+
*
|
|
28
|
+
* Which is the other half of the borrowing: a `Button`'s height is arithmetic
|
|
29
|
+
* -- padding plus line box plus border, with compound variants putting
|
|
30
|
+
* `secondary`'s 2px back -- and there is no line box here to add up, because
|
|
31
|
+
* there is no text. So the height is set outright, as `Input` sets its own,
|
|
32
|
+
* and `border-box` absorbs `secondary`'s border rather than a compound
|
|
33
|
+
* variant having to. The numbers are `Button`'s, measured: an icon button
|
|
34
|
+
* belongs in a row with one.
|
|
35
|
+
*/
|
|
36
|
+
const iconButtonVariants = cva(['shrink-0', '[&>svg]:shrink-0'], {
|
|
37
|
+
variants: {
|
|
38
|
+
/**
|
|
39
|
+
* The box is square and matches the `Button` of the same name, so the two
|
|
40
|
+
* line up in a row. `xs` and `sm` are the same 36px box there as well --
|
|
41
|
+
* what separates them is the size of what is inside, `text-xs` against
|
|
42
|
+
* `text-sm` in `Button` and a 14px icon against a 16px one here.
|
|
43
|
+
*
|
|
44
|
+
* The icon is sized from here rather than left to the caller, so a row of
|
|
45
|
+
* them agrees without each one repeating an `h-4 w-4` and an icon drawn
|
|
46
|
+
* at some other size cannot set the row's height. `[&>svg]` is the same
|
|
47
|
+
* selector `Input` and `Password` size their own icons with. Being a
|
|
48
|
+
* selector it also outranks a class on the icon itself, so the override
|
|
49
|
+
* is `[&>svg]:h-6 [&>svg]:w-6` in the button's `className`, which
|
|
50
|
+
* `tailwind-merge` takes as replacing this rather than joining it.
|
|
51
|
+
*/
|
|
52
|
+
size: {
|
|
53
|
+
lg: ['h-12', 'w-12', '[&>svg]:h-5', '[&>svg]:w-5'],
|
|
54
|
+
md: ['h-10', 'w-10', '[&>svg]:h-4', '[&>svg]:w-4'],
|
|
55
|
+
sm: ['h-9', 'w-9', '[&>svg]:h-4', '[&>svg]:w-4'],
|
|
56
|
+
xs: ['h-9', 'w-9', '[&>svg]:h-3.5', '[&>svg]:w-3.5']
|
|
57
|
+
},
|
|
58
|
+
shape: {
|
|
59
|
+
// `Button`'s own corner, so a square icon button beside a text one is
|
|
60
|
+
// the same shape.
|
|
61
|
+
rounded: 'rounded-lg',
|
|
62
|
+
circle: 'rounded-full'
|
|
63
|
+
}
|
|
64
|
+
},
|
|
65
|
+
defaultVariants: {
|
|
66
|
+
size: 'md',
|
|
67
|
+
shape: 'rounded'
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
/**
|
|
71
|
+
* Whether the unnamed-button warning has already gone out in this pass.
|
|
72
|
+
*
|
|
73
|
+
* `StrictMode` invokes a component body twice in development to surface impure
|
|
74
|
+
* renders, and both invocations reach the `console.error` below, so one button
|
|
75
|
+
* prints the message twice.
|
|
76
|
+
*
|
|
77
|
+
* `useRef` is the obvious guard and does not work: React rebuilds the hook
|
|
78
|
+
* state for the second invocation, so the ref arrives fresh with `current`
|
|
79
|
+
* false and both passes warn. Measured rather than assumed --
|
|
80
|
+
* `__tests__/icon-button-strict-mode.test.tsx` mounts one under `StrictMode`
|
|
81
|
+
* and counts, and it counts two without this. `useEffect` would dedupe and is
|
|
82
|
+
* worse: effects do not run on the server, so the warning would vanish from
|
|
83
|
+
* every server render and from the rest of this suite, which is where it is
|
|
84
|
+
* most likely to be seen.
|
|
85
|
+
*
|
|
86
|
+
* So a module-level flag, cleared on a microtask rather than never. Both of
|
|
87
|
+
* `StrictMode`'s invocations are synchronous and land in the same pass, so
|
|
88
|
+
* they collapse into one message, while a re-render in some later task warns
|
|
89
|
+
* again. That last part is the reason for the microtask: a warning that fires
|
|
90
|
+
* once per session and then goes quiet cannot be told apart from a warning you
|
|
91
|
+
* have fixed.
|
|
92
|
+
*/
|
|
93
|
+
let warnedThisPass = false;
|
|
94
|
+
const warnUnnamed = () => {
|
|
95
|
+
if (warnedThisPass)
|
|
96
|
+
return;
|
|
97
|
+
warnedThisPass = true;
|
|
98
|
+
queueMicrotask(() => {
|
|
99
|
+
warnedThisPass = false;
|
|
100
|
+
});
|
|
101
|
+
console.error('IconButton: `label` is required and cannot be empty. This button has ' +
|
|
102
|
+
'rendered with no accessible name, and a screen reader will announce ' +
|
|
103
|
+
'it as "button" and nothing more. Pass a label saying what the button ' +
|
|
104
|
+
'does -- "Delete article", not "bin".');
|
|
105
|
+
};
|
|
106
|
+
/**
|
|
107
|
+
* A button whose content is an icon and nothing else: the close on a dialog,
|
|
108
|
+
* the actions at the end of a table row, a toolbar.
|
|
109
|
+
*
|
|
110
|
+
* `label` is required and has no default, which is the one way this differs
|
|
111
|
+
* from every other prop here. An icon button with no accessible name is a
|
|
112
|
+
* control a screen reader announces as "button" and nothing more, and unlike
|
|
113
|
+
* a missing colour it is invisible to everyone who is not affected by it.
|
|
114
|
+
* There is no name that could be guessed from an icon, so the type asks for
|
|
115
|
+
* one rather than inventing it (WCAG 4.1.2).
|
|
116
|
+
*
|
|
117
|
+
* The icon is left out of the accessibility tree by `aria-label` itself,
|
|
118
|
+
* which replaces an element's contents when the name is computed, so the icon
|
|
119
|
+
* needs no `aria-hidden` of its own. What the icon must not carry is a
|
|
120
|
+
* `title`, which would put a browser tooltip on it that the button's own
|
|
121
|
+
* `Tooltip` did not put there. That one is unreachable from here: `icon` is a
|
|
122
|
+
* `ReactNode`, so there is nothing to type-check.
|
|
123
|
+
*
|
|
124
|
+
* `title` is off the button as well, which is the one prop of a `<button>`
|
|
125
|
+
* this component takes away. It is not that it competes for the name --
|
|
126
|
+
* `title` is the last resort in the naming order, behind both `aria-label`
|
|
127
|
+
* and the contents, so while there is a label it never wins. It is that every
|
|
128
|
+
* reason to reach for it here is already served by something better, and
|
|
129
|
+
* served properly: a tooltip is `Tooltip`, which is reachable by keyboard and
|
|
130
|
+
* by touch as a native one is not, and a name is `label`. What is left is a
|
|
131
|
+
* second tooltip doubling up with the first, and a name that appears out of
|
|
132
|
+
* nowhere in the one case where `label` resolved empty. Neither is worth a
|
|
133
|
+
* prop, so the type stops it at the point where it can still be changed
|
|
134
|
+
* cheaply.
|
|
135
|
+
*
|
|
136
|
+
* Only the type stops it. A `title` arriving through an untyped spread is
|
|
137
|
+
* passed to the element like any other attribute, because deleting an
|
|
138
|
+
* attribute a caller explicitly set is a worse surprise than rendering it.
|
|
139
|
+
*
|
|
140
|
+
* `type` defaults to `"button"`. A bare `<button>` inside a form is a submit
|
|
141
|
+
* button, and an icon button is most often a close or a remove -- the one
|
|
142
|
+
* place that default does the most damage.
|
|
143
|
+
*/
|
|
144
|
+
const IconButton = React.forwardRef((_a, ref) => {
|
|
145
|
+
var { className, variant, size, shape, icon, label, type = 'button', 'aria-label': ariaLabel } = _a, props = __rest(_a, ["className", "variant", "size", "shape", "icon", "label", "type", 'aria-label']);
|
|
146
|
+
// An `aria-label` of the caller's own wins, and an empty one falls back
|
|
147
|
+
// rather than being spread over the top of `label` -- a button holding a
|
|
148
|
+
// required name and then blanking it has only one reading, and it is not
|
|
149
|
+
// the one where the name goes away silently. `aria-labelledby` is not
|
|
150
|
+
// weighed against either: it beats them both wherever it is passed, which
|
|
151
|
+
// is the naming order in the specification rather than anything decided
|
|
152
|
+
// here.
|
|
153
|
+
//
|
|
154
|
+
// Trimmed, because the name-computation algorithm trims before it decides
|
|
155
|
+
// whether a label is empty, so a `label` of `" "` is exactly as unnamed as
|
|
156
|
+
// one of `""` -- and `label` is typed `string`, which stops neither. The
|
|
157
|
+
// type is the guard against a name being forgotten; this is the guard
|
|
158
|
+
// against one being supplied and empty, which the type cannot express.
|
|
159
|
+
//
|
|
160
|
+
// Nothing is invented when both are empty. There is no name that could be
|
|
161
|
+
// guessed from an icon, and a placeholder would be worse than none: it
|
|
162
|
+
// would silence the failure with something untrue. So the attribute comes
|
|
163
|
+
// off entirely instead of going on empty. The computed name is the same
|
|
164
|
+
// either way -- an empty `aria-label` is skipped and the algorithm falls
|
|
165
|
+
// through to the contents, which are an icon and say nothing -- but the
|
|
166
|
+
// markup is not. `aria-label=""` reads as a deliberate suppression, and
|
|
167
|
+
// linters and reviewers take it for one. A button with no `aria-label` at
|
|
168
|
+
// all is plainly unnamed, and axe's `button-name` rule says so in the
|
|
169
|
+
// consumer's own CI rather than the component quietly asserting a name it
|
|
170
|
+
// does not have.
|
|
171
|
+
const name = (ariaLabel === null || ariaLabel === void 0 ? void 0 : ariaLabel.trim()) || (label === null || label === void 0 ? void 0 : label.trim()) || undefined;
|
|
172
|
+
// ...and says so in development, where the person who can fix it is
|
|
173
|
+
// looking, rather than leaving it for a consumer's axe run to find.
|
|
174
|
+
//
|
|
175
|
+
// No other component here warns, and the line between them is worth
|
|
176
|
+
// stating rather than assuming. What the others cannot express is
|
|
177
|
+
// contextual -- whether the page holds a second `ButtonGroup`, whether a
|
|
178
|
+
// heading above a `RadioGroup` already carries its name -- so they cannot
|
|
179
|
+
// know they are wrong and would have to guess. This one knows. An icon
|
|
180
|
+
// button with no accessible name has no valid reading at all, whatever
|
|
181
|
+
// surrounds it, so the certainty is what earns the warning and it does not
|
|
182
|
+
// generalise to a convention for the rest of the library.
|
|
183
|
+
//
|
|
184
|
+
// `aria-labelledby` is exempt: it names the button from text already on
|
|
185
|
+
// the page and beats `aria-label` wherever both appear, so a caller using
|
|
186
|
+
// it has named the button and only fallen foul of the type. It is read
|
|
187
|
+
// from `props` rather than destructured so that it still reaches the
|
|
188
|
+
// element through the spread.
|
|
189
|
+
if (process.env.NODE_ENV !== 'production' &&
|
|
190
|
+
!name &&
|
|
191
|
+
!props['aria-labelledby']) {
|
|
192
|
+
warnUnnamed();
|
|
193
|
+
}
|
|
194
|
+
return (_jsx("button", Object.assign({ ref: ref, type: type, "aria-label": name, className: cn(buttonVariants({ variant, size: null }), iconButtonVariants({ size, shape }), className) }, props, { children: icon })));
|
|
195
|
+
});
|
|
196
|
+
IconButton.displayName = 'IconButton';
|
|
197
|
+
export { IconButton, iconButtonVariants };
|
|
198
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/IconButton/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAA;AAEjE,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAqB,CAAA;AACpD,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAEvC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,kBAAkB,GAAG,GAAG,CAAC,CAAC,UAAU,EAAE,kBAAkB,CAAC,EAAE;IAC/D,QAAQ,EAAE;QACR;;;;;;;;;;;;;WAaG;QACH,IAAI,EAAE;YACJ,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,CAAC;YAClD,EAAE,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,aAAa,EAAE,aAAa,CAAC;YAClD,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,aAAa,EAAE,aAAa,CAAC;YAChD,EAAE,EAAE,CAAC,KAAK,EAAE,KAAK,EAAE,eAAe,EAAE,eAAe,CAAC;SACrD;QACD,KAAK,EAAE;YACL,sEAAsE;YACtE,kBAAkB;YAClB,OAAO,EAAE,YAAY;YACrB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AK,uBAAL,KAAK,CAAE,IAAI,EAAE,CAAA,IAAI,SAAS,CAAA;IAE5D,oEAAoE;IACpE,oEAAoE;IACpE,EAAE;IACF,oEAAoE;IACpE,kEAAkE;IAClE,yEAAyE;IACzE,0EAA0E;IAC1E,uEAAuE;IACvE,uEAAuE;IACvE,2EAA2E;IAC3E,0DAA0D;IAC1D,EAAE;IACF,wEAAwE;IACxE,0EAA0E;IAC1E,uEAAuE;IACvE,qEAAqE;IACrE,8BAA8B;IAC9B,IACE,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,YAAY;QACrC,CAAC,IAAI;QACL,CAAC,KAAK,CAAC,iBAAiB,CAAC,EACzB,CAAC;QACD,WAAW,EAAE,CAAA;IACf,CAAC;IAED,OAAO,CACL,+BACE,GAAG,EAAE,GAAG,EACR,IAAI,EAAE,IAAI,gBACE,IAAI,EAChB,SAAS,EAAE,EAAE,CACX,cAAc,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,EACvC,kBAAkB,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,EACnC,SAAS,CACV,IACG,KAAK,cAER,IAAI,IACE,CACV,CAAA;AACH,CAAC,CACF,CAAA;AAED,UAAU,CAAC,WAAW,GAAG,YAAY,CAAA;AAErC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAwB,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const formVariants: (props?: ({
|
|
3
|
+
variant?: "error" | "primary" | "success" | null | undefined;
|
|
4
|
+
size?: "default" | "lg" | "sm" | null | undefined;
|
|
5
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
6
|
+
type InputType = 'color' | 'date' | 'datetime-local' | 'email' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'text' | 'time' | 'url' | 'week' | (string & {});
|
|
7
|
+
/**
|
|
8
|
+
* `size` is the field's height rather than the HTML attribute of that name,
|
|
9
|
+
* which is omitted. The attribute asks for a width in characters, and the
|
|
10
|
+
* `<input>` here is `flex-grow` inside the field, so it was already being
|
|
11
|
+
* overruled by the layout before it could mean anything.
|
|
12
|
+
*/
|
|
13
|
+
interface InputProps extends Omit<React.HTMLProps<HTMLInputElement>, 'size'> {
|
|
14
|
+
variant: 'primary' | 'error' | 'success';
|
|
15
|
+
size?: 'sm' | 'default' | 'lg';
|
|
16
|
+
type: InputType;
|
|
17
|
+
formClassName?: string;
|
|
18
|
+
leftSideClassName?: string;
|
|
19
|
+
leftSideChild?: React.ReactNode;
|
|
20
|
+
rightSideChild?: React.ReactNode;
|
|
21
|
+
labelText?: string;
|
|
22
|
+
helpText?: string;
|
|
23
|
+
clearLabel?: string;
|
|
24
|
+
onClear: () => void;
|
|
25
|
+
}
|
|
26
|
+
declare const Input: React.ForwardRefExoticComponent<Omit<InputProps, "ref"> & React.RefAttributes<HTMLInputElement>>;
|
|
27
|
+
export { Input, InputProps, formVariants };
|
|
@@ -0,0 +1,172 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { cn } from '../../lib/utils.js';
|
|
15
|
+
import { cva } from 'class-variance-authority';
|
|
16
|
+
import { BsX, BsSearch } from '../../assets/index.js';
|
|
17
|
+
/**
|
|
18
|
+
* The design draws the leading icon at 16x16, so the size is set here rather
|
|
19
|
+
* than left to the icon that is passed in. `react-icons` renders at `1em`,
|
|
20
|
+
* which ties every glyph to whatever font size the field inherits -- a search
|
|
21
|
+
* icon and a caller's own icon then come out at different sizes in the same
|
|
22
|
+
* form, and both move when the surrounding text does.
|
|
23
|
+
*/
|
|
24
|
+
const leftSideVariants = cva([
|
|
25
|
+
'flex',
|
|
26
|
+
'shrink-0',
|
|
27
|
+
'items-center',
|
|
28
|
+
'text-inherit',
|
|
29
|
+
'[&>svg]:h-4',
|
|
30
|
+
'[&>svg]:w-4'
|
|
31
|
+
]);
|
|
32
|
+
/**
|
|
33
|
+
* The clear control is a 24x24 target around a 12x12 glyph: the cross is drawn
|
|
34
|
+
* at 12, and 24 is the smallest target WCAG 2.5.8 accepts. The negative margin
|
|
35
|
+
* is half the difference between the two -- the padding the target gains on
|
|
36
|
+
* the right is taken back out of the field's own padding, so the target grows
|
|
37
|
+
* around the cross rather than pushing it inwards, and the cross stays exactly
|
|
38
|
+
* where the design puts it.
|
|
39
|
+
*/
|
|
40
|
+
const rightSideVariants = cva([
|
|
41
|
+
'flex',
|
|
42
|
+
'h-6',
|
|
43
|
+
'w-6',
|
|
44
|
+
'shrink-0',
|
|
45
|
+
'-mr-1.5',
|
|
46
|
+
'items-center',
|
|
47
|
+
'justify-center',
|
|
48
|
+
'self-center text-inherit',
|
|
49
|
+
'rounded-xs',
|
|
50
|
+
'focus-visible:outline-2',
|
|
51
|
+
'focus-visible:outline-offset-2',
|
|
52
|
+
'focus-visible:outline-current',
|
|
53
|
+
'[&>svg]:h-3',
|
|
54
|
+
'[&>svg]:w-3'
|
|
55
|
+
]);
|
|
56
|
+
const formVariants = cva([
|
|
57
|
+
'flex',
|
|
58
|
+
'border',
|
|
59
|
+
'border-2',
|
|
60
|
+
'rounded-lg',
|
|
61
|
+
'overflow-hidden',
|
|
62
|
+
'px-3',
|
|
63
|
+
'items-center',
|
|
64
|
+
'gap-1.5',
|
|
65
|
+
'[&:has(:disabled)]:border-none'
|
|
66
|
+
], {
|
|
67
|
+
variants: {
|
|
68
|
+
variant: {
|
|
69
|
+
primary: [
|
|
70
|
+
'border-border-subtle',
|
|
71
|
+
'dark:border-border-subtle-dark',
|
|
72
|
+
'bg-background-alt',
|
|
73
|
+
'dark:bg-background-alt-dark',
|
|
74
|
+
'hover:border-border-hover',
|
|
75
|
+
'hover:focus-within:border-border-focus',
|
|
76
|
+
'dark:hover:focus-within:border-border-focus-dark',
|
|
77
|
+
'focus-within:shadow-brandGreen',
|
|
78
|
+
'text-foreground-muted',
|
|
79
|
+
'dark:text-foreground-muted-dark',
|
|
80
|
+
'dark:focus-within:shadow-brandGreen10'
|
|
81
|
+
],
|
|
82
|
+
error: [
|
|
83
|
+
'border-feedback-error',
|
|
84
|
+
'text-feedback-error',
|
|
85
|
+
'bg-red-50',
|
|
86
|
+
'hover:border-red-700',
|
|
87
|
+
'focus-within:shadow-red',
|
|
88
|
+
'dark:border-feedback-error-dark',
|
|
89
|
+
'dark:text-feedback-error-dark',
|
|
90
|
+
'dark:bg-background-alt-dark'
|
|
91
|
+
],
|
|
92
|
+
success: [
|
|
93
|
+
'border-feedback-success',
|
|
94
|
+
'text-feedback-success',
|
|
95
|
+
'bg-green-50',
|
|
96
|
+
'hover:border-green-700',
|
|
97
|
+
'focus-within:shadow-green',
|
|
98
|
+
'dark:border-feedback-success-dark',
|
|
99
|
+
'dark:text-feedback-success-dark',
|
|
100
|
+
'dark:bg-background-alt-dark'
|
|
101
|
+
]
|
|
102
|
+
},
|
|
103
|
+
/**
|
|
104
|
+
* `sm` and `default` are the two heights the design file specifies, and
|
|
105
|
+
* the field had neither: its height was a 12px padding plus whatever
|
|
106
|
+
* line box the inherited font produced, which was 40px when #264 was
|
|
107
|
+
* filed and is 52px today. The design has no size that follows the text
|
|
108
|
+
* like that.
|
|
109
|
+
*
|
|
110
|
+
* So they are heights rather than a padding that adds up to one. That
|
|
111
|
+
* also fixes the disabled field, which drops its 2px border and was 4px
|
|
112
|
+
* shorter than every other field because of it.
|
|
113
|
+
*
|
|
114
|
+
* The two of them match `Select`'s `sm` and `lg` to the pixel, which is
|
|
115
|
+
* what lets a select and an input sit next to each other in a row. The
|
|
116
|
+
* names do not match, and cannot: 42px is the size the design calls
|
|
117
|
+
* regular, so it is the default here, and `Select` had already spent
|
|
118
|
+
* `lg` on it.
|
|
119
|
+
*
|
|
120
|
+
* `lg` is not in the design file. It is 48px because that is the height
|
|
121
|
+
* of a large `Button` -- both of its variants, which is what the
|
|
122
|
+
* compound variants in `Button` are there to line up -- so a large field
|
|
123
|
+
* and the button that submits it are the same height.
|
|
124
|
+
*/
|
|
125
|
+
size: {
|
|
126
|
+
sm: ['h-[37px]'],
|
|
127
|
+
default: ['h-[42px]'],
|
|
128
|
+
lg: ['h-[48px]']
|
|
129
|
+
}
|
|
130
|
+
},
|
|
131
|
+
defaultVariants: {
|
|
132
|
+
size: 'default'
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
const inputVariants = cva(['flex', 'flex-grow', 'items-center', 'outline-hidden', 'bg-transparent'], {
|
|
136
|
+
variants: {
|
|
137
|
+
variant: {
|
|
138
|
+
primary: ['text-foreground', 'dark:text-foreground-dark'],
|
|
139
|
+
error: ['text-feedback-error', 'dark:text-feedback-error-dark'],
|
|
140
|
+
success: ['text-green-700', 'dark:text-feedback-success-dark']
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
defaultVariants: {
|
|
144
|
+
variant: 'primary'
|
|
145
|
+
}
|
|
146
|
+
});
|
|
147
|
+
const convertTypeToLeftComponent = (type) => {
|
|
148
|
+
var _a;
|
|
149
|
+
const mapping = {
|
|
150
|
+
search: _jsx(BsSearch, { "aria-hidden": "true" })
|
|
151
|
+
};
|
|
152
|
+
return (_a = mapping[type]) !== null && _a !== void 0 ? _a : null;
|
|
153
|
+
};
|
|
154
|
+
const Input = React.forwardRef((_a, ref) => {
|
|
155
|
+
var { type, id, className, formClassName, leftSideClassName, variant, size, leftSideChild, rightSideChild, labelText, helpText, clearLabel = 'Clear input', onClear, 'aria-describedby': ariaDescribedby } = _a, props = __rest(_a, ["type", "id", "className", "formClassName", "leftSideClassName", "variant", "size", "leftSideChild", "rightSideChild", "labelText", "helpText", "clearLabel", "onClear", 'aria-describedby']);
|
|
156
|
+
const generatedId = React.useId();
|
|
157
|
+
const inputId = id !== null && id !== void 0 ? id : generatedId;
|
|
158
|
+
const helpTextId = `${inputId}-helptext`;
|
|
159
|
+
const describedBy = [ariaDescribedby, helpText ? helpTextId : undefined]
|
|
160
|
+
.filter(Boolean)
|
|
161
|
+
.join(' ') || undefined;
|
|
162
|
+
const leftSideComponent = leftSideChild !== null && leftSideChild !== void 0 ? leftSideChild : convertTypeToLeftComponent(type);
|
|
163
|
+
const rightSideComponent = rightSideChild !== null && rightSideChild !== void 0 ? rightSideChild : (_jsx(BsX, { strokeWidth: 0.6, "aria-hidden": "true" }));
|
|
164
|
+
const field = (_jsxs("div", { className: cn(formVariants({ variant, size }), formClassName), children: [leftSideComponent && (_jsx("div", { className: cn(leftSideVariants(), leftSideClassName), children: leftSideComponent })), _jsx("input", Object.assign({ id: inputId, type: type, className: cn(inputVariants({ variant }), className), ref: ref, "aria-describedby": describedBy }, props)), _jsx("button", { type: "button", onClick: onClear, "aria-label": clearLabel, className: rightSideVariants(), children: rightSideComponent })] }));
|
|
165
|
+
if (!labelText && !helpText) {
|
|
166
|
+
return field;
|
|
167
|
+
}
|
|
168
|
+
return (_jsxs("div", { className: "flex flex-col gap-3", children: [labelText && (_jsx("label", { htmlFor: inputId, className: "text-m text-foreground dark:text-foreground-dark", children: labelText })), field, helpText && (_jsx("span", { id: helpTextId, className: "text-sm text-foreground-muted dark:text-foreground-muted-dark", children: helpText }))] }));
|
|
169
|
+
});
|
|
170
|
+
Input.displayName = 'Input';
|
|
171
|
+
export { Input, formVariants };
|
|
172
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Input/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AACvC,OAAO,EAAE,GAAG,EAAE,MAAM,0BAA0B,CAAA;AAC9C,OAAO,EAAE,GAAG,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAErD;;;;;;GAMG;AACH,MAAM,gBAAgB,GAAG,GAAG,CAAC;IAC3B,MAAM;IACN,UAAU;IACV,cAAc;IACd,cAAc;IACd,aAAa;IACb,aAAa;CACd,CAAC,CAAA;AAEF;;;;;;;GAOG;AACH,MAAM,iBAAiB,GAAG,GAAG,CAAC;IAC5B,MAAM;IACN,KAAK;IACL,KAAK;IACL,UAAU;IACV,SAAS;IACT,cAAc;IACd,gBAAgB;IAChB,0BAA0B;IAC1B,YAAY;IACZ,yBAAyB;IACzB,gCAAgC;IAChC,+BAA+B;IAC/B,aAAa;IACb,aAAa;CACd,CAAC,CAAA;AAEF,MAAM,YAAY,GAAG,GAAG,CACtB;IACE,MAAM;IACN,QAAQ;IACR,UAAU;IACV,YAAY;IACZ,iBAAiB;IACjB,MAAM;IACN,cAAc;IACd,SAAS;IACT,gCAAgC;CACjC,EACD;IACE,QAAQ,EAAE;QACR,OAAO,EAAE;YACP,OAAO,EAAE;gBACP,sBAAsB;gBACtB,gCAAgC;gBAChC,mBAAmB;gBACnB,6BAA6B;gBAC7B,2BAA2B;gBAC3B,wCAAwC;gBACxC,kDAAkD;gBAClD,gCAAgC;gBAChC,uBAAuB;gBACvB,iCAAiC;gBACjC,uCAAuC;aACxC;YACD,KAAK,EAAE;gBACL,uBAAuB;gBACvB,qBAAqB;gBACrB,WAAW;gBACX,sBAAsB;gBACtB,yBAAyB;gBACzB,iCAAiC;gBACjC,+BAA+B;gBAC/B,6BAA6B;aAC9B;YACD,OAAO,EAAE;gBACP,yBAAy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E,CAAC;QAC5B,OAAO,KAAK,CAAA;IACd,CAAC;IAED,OAAO,CACL,eAAK,SAAS,EAAC,qBAAqB,aACjC,SAAS,IAAI,CACZ,gBACE,OAAO,EAAE,OAAO,EAChB,SAAS,EAAC,kDAAkD,YAE3D,SAAS,GACJ,CACT,EACA,KAAK,EACL,QAAQ,IAAI,CACX,eACE,EAAE,EAAE,UAAU,EACd,SAAS,EAAC,+DAA+D,YAExE,QAAQ,GACJ,CACR,IACG,CACP,CAAA;AACH,CAAC,CACF,CAAA;AAED,KAAK,CAAC,WAAW,GAAG,OAAO,CAAA;AAE3B,OAAO,EAAE,KAAK,EAAc,YAAY,EAAE,CAAA"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
3
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
4
|
+
declare const labelVariants: (props?: ({
|
|
5
|
+
size?: "lg" | "md" | "sm" | "xl" | "xs" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
|
+
interface LabelProps extends React.ComponentPropsWithoutRef<typeof LabelPrimitive.Root>, VariantProps<typeof labelVariants> {
|
|
8
|
+
hintText?: string;
|
|
9
|
+
align?: 'left' | 'right';
|
|
10
|
+
}
|
|
11
|
+
declare const Label: React.ForwardRefExoticComponent<LabelProps & React.RefAttributes<HTMLLabelElement>>;
|
|
12
|
+
export { Label, LabelProps };
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
import * as React from 'react';
|
|
15
|
+
import * as LabelPrimitive from '@radix-ui/react-label';
|
|
16
|
+
import { cva } from 'class-variance-authority';
|
|
17
|
+
import { cn } from '../../lib/utils.js';
|
|
18
|
+
const labelVariants = cva('font-medium leading-normal peer-disabled:cursor-not-allowed peer-disabled:opacity-70 dark:text-foreground-inverse', {
|
|
19
|
+
variants: {
|
|
20
|
+
size: {
|
|
21
|
+
lg: 'text-lg',
|
|
22
|
+
md: 'text-md',
|
|
23
|
+
sm: 'text-sm',
|
|
24
|
+
xs: 'text-xs',
|
|
25
|
+
xl: 'text-xl'
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
defaultVariants: {
|
|
29
|
+
size: 'sm'
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
const alignVariants = cva('', {
|
|
33
|
+
variants: {
|
|
34
|
+
align: {
|
|
35
|
+
left: 'text-left',
|
|
36
|
+
right: 'text-right'
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
defaultVariants: {
|
|
40
|
+
align: 'left'
|
|
41
|
+
}
|
|
42
|
+
});
|
|
43
|
+
const Label = React.forwardRef((_a, ref) => {
|
|
44
|
+
var { className, size, hintText, align } = _a, props = __rest(_a, ["className", "size", "hintText", "align"]);
|
|
45
|
+
const label = (_jsx(LabelPrimitive.Root, Object.assign({ ref: ref, className: cn(labelVariants({ size }), alignVariants({ align }), className) }, props)));
|
|
46
|
+
if (hintText) {
|
|
47
|
+
return (_jsxs("div", { className: "flex flex-col", children: [label, _jsx("div", { className: cn(alignVariants({ align }), 'font-semibold text-xs text-foreground-muted dark:text-foreground-muted-dark'), children: hintText })] }));
|
|
48
|
+
}
|
|
49
|
+
return label;
|
|
50
|
+
});
|
|
51
|
+
Label.displayName = LabelPrimitive.Root.displayName;
|
|
52
|
+
export { Label };
|
|
53
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Label/index.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;;;;;;;;;;;;;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,KAAK,cAAc,MAAM,uBAAuB,CAAA;AACvD,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAA;AAEjE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAEvC,MAAM,aAAa,GAAG,GAAG,CACvB,mHAAmH,EACnH;IACE,QAAQ,EAAE;QACR,IAAI,EAAE;YACJ,EAAE,EAAE,SAAS;YACb,EAAE,EAAE,SAAS;YACb,EAAE,EAAE,SAAS;YACb,EAAE,EAAE,SAAS;YACb,EAAE,EAAE,SAAS;SACd;KACF;IACD,eAAe,EAAE;QACf,IAAI,EAAE,IAAI;KACX;CACF,CACF,CAAA;AAED,MAAM,aAAa,GAAG,GAAG,CAAC,EAAE,EAAE;IAC5B,QAAQ,EAAE;QACR,KAAK,EAAE;YACL,IAAI,EAAE,WAAW;YACjB,KAAK,EAAE,YAAY;SACpB;KACF;IACD,eAAe,EAAE;QACf,KAAK,EAAE,MAAM;KACd;CACF,CAAC,CAAA;AAUF,MAAM,KAAK,GAAG,KAAK,CAAC,UAAU,CAG5B,CAAC,EAA8C,EAAE,GAAG,EAAE,EAAE;QAAvD,EAAE,SAAS,EAAE,IAAI,EAAE,QAAQ,EAAE,KAAK,OAAY,EAAP,KAAK,cAA5C,0CAA8C,CAAF;IAC7C,MAAM,KAAK,GAAG,CACZ,KAAC,cAAc,CAAC,IAAI,kBAClB,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,EAAE,CACX,aAAa,CAAC,EAAE,IAAI,EAAE,CAAC,EACvB,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC,EACxB,SAAS,CACV,IACG,KAAK,EACT,CACH,CAAA;IAED,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,CACL,eAAK,SAAS,EAAC,eAAe,aAC3B,KAAK,EACN,cACE,SAAS,EAAE,EAAE,CACX,aAAa,CAAC,EAAE,KAAK,EAAE,CAAC,EACxB,6EAA6E,CAC9E,YAEA,QAAQ,GACL,IACF,CACP,CAAA;IACH,CAAC;IAED,OAAO,KAAK,CAAA;AACd,CAAC,CAAC,CAAA;AACF,KAAK,CAAC,WAAW,GAAG,cAAc,CAAC,IAAI,CAAC,WAAW,CAAA;AAEnD,OAAO,EAAE,KAAK,EAAc,CAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
3
|
+
import { IconType } from '../../assets/index.ts';
|
|
4
|
+
declare const linkVariants: (props?: ({
|
|
5
|
+
variant?: "inline" | "nav" | null | undefined;
|
|
6
|
+
selected?: boolean | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
interface LinkProps extends React.AnchorHTMLAttributes<HTMLAnchorElement>, Omit<VariantProps<typeof linkVariants>, 'selected'> {
|
|
9
|
+
selected?: boolean;
|
|
10
|
+
icon?: IconType;
|
|
11
|
+
}
|
|
12
|
+
declare const Link: React.ForwardRefExoticComponent<LinkProps & React.RefAttributes<HTMLAnchorElement>>;
|
|
13
|
+
export { Link, linkVariants, type LinkProps };
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { cva } from 'class-variance-authority';
|
|
15
|
+
import { cn } from '../../lib/utils.js';
|
|
16
|
+
const linkVariants = cva('cursor-pointer outline-hidden', {
|
|
17
|
+
variants: {
|
|
18
|
+
variant: {
|
|
19
|
+
nav: [
|
|
20
|
+
'flex items-center space-x-3',
|
|
21
|
+
'py-1 px-1.5',
|
|
22
|
+
'rounded',
|
|
23
|
+
'dark:text-white',
|
|
24
|
+
'focus:shadow-brandGreen focus:underline dark:focus:shadow-brandGreen10'
|
|
25
|
+
],
|
|
26
|
+
inline: [
|
|
27
|
+
'inline',
|
|
28
|
+
'rounded-xs',
|
|
29
|
+
'underline underline-offset-2 decoration-1',
|
|
30
|
+
'hover:decoration-2',
|
|
31
|
+
'focus-visible:decoration-2',
|
|
32
|
+
'focus-visible:shadow-brandGreen dark:focus-visible:shadow-brandGreen10'
|
|
33
|
+
]
|
|
34
|
+
},
|
|
35
|
+
selected: {
|
|
36
|
+
true: '',
|
|
37
|
+
false: ''
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
compoundVariants: [
|
|
41
|
+
{
|
|
42
|
+
variant: 'nav',
|
|
43
|
+
selected: true,
|
|
44
|
+
className: 'cursor-default text-white dark:text-foreground-inverse-dark bg-background-inverse dark:bg-background-inverse-dark'
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
variant: 'nav',
|
|
48
|
+
selected: false,
|
|
49
|
+
className: 'hover:bg-grey-100 hover:underline dark:hover:bg-grey-700 focus:bg-grey-100 dark:focus:bg-grey-700'
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
variant: 'inline',
|
|
53
|
+
selected: true,
|
|
54
|
+
className: 'cursor-default font-semibold no-underline'
|
|
55
|
+
}
|
|
56
|
+
],
|
|
57
|
+
defaultVariants: {
|
|
58
|
+
variant: 'nav',
|
|
59
|
+
selected: false
|
|
60
|
+
}
|
|
61
|
+
});
|
|
62
|
+
const Link = React.forwardRef((_a, ref) => {
|
|
63
|
+
var { className, onClick, variant, selected = false, children, icon: Icon, 'aria-current': ariaCurrent } = _a, props = __rest(_a, ["className", "onClick", "variant", "selected", "children", "icon", 'aria-current']);
|
|
64
|
+
const inline = variant === 'inline';
|
|
65
|
+
return (_jsxs("a", Object.assign({ className: cn(linkVariants({ variant, selected }), className), ref: ref, "aria-current": ariaCurrent !== null && ariaCurrent !== void 0 ? ariaCurrent : (selected ? 'page' : undefined), onClick: e => {
|
|
66
|
+
if (selected) {
|
|
67
|
+
e.preventDefault();
|
|
68
|
+
}
|
|
69
|
+
else {
|
|
70
|
+
onClick === null || onClick === void 0 ? void 0 : onClick(e);
|
|
71
|
+
}
|
|
72
|
+
} }, props, { children: [Icon ? (_jsx(Icon, { className: inline ? 'mr-1 inline-block align-[-0.125em]' : 'mr-1', "aria-hidden": "true" })) : null, children] })));
|
|
73
|
+
});
|
|
74
|
+
Link.displayName = 'Link';
|
|
75
|
+
export { Link, linkVariants };
|
|
76
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/Link/index.tsx"],"names":[],"mappings":";;;;;;;;;;;;AAAA,OAAO,KAAK,MAAM,OAAO,CAAA;AACzB,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAA;AACjE,OAAO,EAAE,EAAE,EAAE,MAAM,oBAAoB,CAAA;AAGvC,MAAM,YAAY,GAAG,GAAG,CAAC,+BAA+B,EAAE;IACxD,QAAQ,EAAE;QACR,OAAO,EAAE;YAC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,EAAE,CAAC;gBACb,CAAC,CAAC,cAAc,EAAE,CAAA;YACpB,CAAC;iBAAM,CAAC;gBACN,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAG,CAAC,CAAC,CAAA;YACd,CAAC;QACH,CAAC,IACG,KAAK,eAER,IAAI,CAAC,CAAC,CAAC,CACN,KAAC,IAAI,IACH,SAAS,EAAE,MAAM,CAAC,CAAC,CAAC,oCAAoC,CAAC,CAAC,CAAC,MAAM,iBACrD,MAAM,GAClB,CACH,CAAC,CAAC,CAAC,IAAI,EACP,QAAQ,KACP,CACL,CAAA;AACH,CAAC,CACF,CAAA;AAED,IAAI,CAAC,WAAW,GAAG,MAAM,CAAA;AAEzB,OAAO,EAAE,IAAI,EAAE,YAAY,EAAkB,CAAA"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
type MeterSegmentPattern = 'striped';
|
|
3
|
+
interface MeterSegment {
|
|
4
|
+
value: number;
|
|
5
|
+
variant?: 'primary' | 'error';
|
|
6
|
+
pattern?: MeterSegmentPattern;
|
|
7
|
+
label: string;
|
|
8
|
+
}
|
|
9
|
+
interface MeterMarker {
|
|
10
|
+
at: number;
|
|
11
|
+
label: string;
|
|
12
|
+
}
|
|
13
|
+
interface MeterProps extends Omit<React.HTMLAttributes<HTMLDivElement>, 'role'> {
|
|
14
|
+
max: number;
|
|
15
|
+
segments: MeterSegment[];
|
|
16
|
+
marker?: MeterMarker;
|
|
17
|
+
formatValue?: (value: number) => string;
|
|
18
|
+
}
|
|
19
|
+
declare const Meter: React.ForwardRefExoticComponent<MeterProps & React.RefAttributes<HTMLDivElement>>;
|
|
20
|
+
export { Meter, type MeterProps, type MeterSegment, type MeterSegmentPattern, type MeterMarker };
|