@seeqdev/qomponents 0.0.180 → 0.0.181
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -0
- package/dist/Accordion/Accordion.d.ts +4 -0
- package/dist/Accordion/Accordion.js +7 -0
- package/dist/Accordion/Accordion.js.map +1 -0
- package/dist/Accordion/Accordion.stories.d.ts +5 -0
- package/dist/Accordion/Accordion.stories.js +75 -0
- package/dist/Accordion/Accordion.stories.js.map +1 -0
- package/dist/Accordion/Accordion.test.d.ts +1 -0
- package/dist/Accordion/Accordion.test.js +55 -0
- package/dist/Accordion/Accordion.test.js.map +1 -0
- package/dist/Accordion/Accordion.types.d.ts +86 -0
- package/dist/Accordion/Accordion.types.js +2 -0
- package/dist/Accordion/Accordion.types.js.map +1 -0
- package/dist/Accordion/index.d.ts +1 -0
- package/dist/Accordion/index.js +2 -0
- package/dist/Accordion/index.js.map +1 -0
- package/dist/Alert/Alert.d.ts +7 -0
- package/dist/Alert/Alert.js +34 -0
- package/dist/Alert/Alert.js.map +1 -0
- package/dist/Alert/Alert.stories.d.ts +6 -0
- package/dist/Alert/Alert.stories.js +65 -0
- package/dist/Alert/Alert.stories.js.map +1 -0
- package/dist/Alert/Alert.test.d.ts +1 -0
- package/dist/Alert/Alert.test.js +50 -0
- package/dist/Alert/Alert.test.js.map +1 -0
- package/dist/Alert/Alert.types.d.ts +62 -0
- package/dist/Alert/Alert.types.js +2 -0
- package/dist/Alert/Alert.types.js.map +1 -0
- package/dist/Alert/index.d.ts +1 -0
- package/dist/Alert/index.js +2 -0
- package/dist/Alert/index.js.map +1 -0
- package/dist/Button/Button.d.ts +10 -0
- package/dist/Button/Button.js +108 -0
- package/dist/Button/Button.js.map +1 -0
- package/dist/Button/Button.stories.d.ts +9 -0
- package/dist/Button/Button.stories.js +29 -0
- package/dist/Button/Button.stories.js.map +1 -0
- package/dist/Button/Button.test.d.ts +1 -0
- package/dist/Button/Button.test.js +65 -0
- package/dist/Button/Button.test.js.map +1 -0
- package/dist/Button/Button.types.d.ts +148 -0
- package/dist/Button/Button.types.js +5 -0
- package/dist/Button/Button.types.js.map +1 -0
- package/dist/Button/index.d.ts +1 -0
- package/dist/Button/index.js +2 -0
- package/dist/Button/index.js.map +1 -0
- package/dist/ButtonGroup/ButtonGroup.d.ts +7 -0
- package/dist/ButtonGroup/ButtonGroup.js +35 -0
- package/dist/ButtonGroup/ButtonGroup.js.map +1 -0
- package/dist/ButtonGroup/ButtonGroup.stories.d.ts +5 -0
- package/dist/ButtonGroup/ButtonGroup.stories.js +317 -0
- package/dist/ButtonGroup/ButtonGroup.stories.js.map +1 -0
- package/dist/ButtonGroup/ButtonGroup.test.d.ts +1 -0
- package/dist/ButtonGroup/ButtonGroup.test.js +66 -0
- package/dist/ButtonGroup/ButtonGroup.test.js.map +1 -0
- package/dist/ButtonGroup/ButtonGroup.types.d.ts +80 -0
- package/dist/ButtonGroup/ButtonGroup.types.js +2 -0
- package/dist/ButtonGroup/ButtonGroup.types.js.map +1 -0
- package/dist/ButtonGroup/index.d.ts +1 -0
- package/dist/ButtonGroup/index.js +2 -0
- package/dist/ButtonGroup/index.js.map +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.d.ts +4 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js +36 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js.map +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.d.ts +5 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +104 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js.map +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.d.ts +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +93 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js.map +1 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.d.ts +232 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js +2 -0
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js.map +1 -0
- package/dist/ButtonWithDropdown/index.d.ts +1 -0
- package/dist/ButtonWithDropdown/index.js +2 -0
- package/dist/ButtonWithDropdown/index.js.map +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.d.ts +4 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.js +55 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.js.map +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.d.ts +5 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +25 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js.map +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.test.d.ts +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js +81 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js.map +1 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.types.d.ts +134 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js +2 -0
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js.map +1 -0
- package/dist/ButtonWithPopover/index.d.ts +1 -0
- package/dist/ButtonWithPopover/index.js +2 -0
- package/dist/ButtonWithPopover/index.js.map +1 -0
- package/dist/Carousel/Carousel.d.ts +9 -0
- package/dist/Carousel/Carousel.js +80 -0
- package/dist/Carousel/Carousel.js.map +1 -0
- package/dist/Carousel/Carousel.stories.d.ts +5 -0
- package/dist/Carousel/Carousel.stories.js +63 -0
- package/dist/Carousel/Carousel.stories.js.map +1 -0
- package/dist/Carousel/Carousel.test.d.ts +1 -0
- package/dist/Carousel/Carousel.test.js +48 -0
- package/dist/Carousel/Carousel.test.js.map +1 -0
- package/dist/Carousel/Carousel.types.d.ts +85 -0
- package/dist/Carousel/Carousel.types.js +2 -0
- package/dist/Carousel/Carousel.types.js.map +1 -0
- package/dist/Carousel/index.d.ts +1 -0
- package/dist/Carousel/index.js +2 -0
- package/dist/Carousel/index.js.map +1 -0
- package/dist/Checkbox/Checkbox.d.ts +7 -0
- package/dist/Checkbox/Checkbox.js +24 -0
- package/dist/Checkbox/Checkbox.js.map +1 -0
- package/dist/Checkbox/Checkbox.stories.d.ts +5 -0
- package/dist/Checkbox/Checkbox.stories.js +12 -0
- package/dist/Checkbox/Checkbox.stories.js.map +1 -0
- package/dist/Checkbox/Checkbox.test.d.ts +1 -0
- package/dist/Checkbox/Checkbox.test.js +94 -0
- package/dist/Checkbox/Checkbox.test.js.map +1 -0
- package/dist/Checkbox/Checkbox.types.d.ts +91 -0
- package/dist/Checkbox/Checkbox.types.js +2 -0
- package/dist/Checkbox/Checkbox.types.js.map +1 -0
- package/dist/Checkbox/index.d.ts +1 -0
- package/dist/Checkbox/index.js +2 -0
- package/dist/Checkbox/index.js.map +1 -0
- package/dist/Collapse/Collapse.d.ts +4 -0
- package/dist/Collapse/Collapse.js +17 -0
- package/dist/Collapse/Collapse.js.map +1 -0
- package/dist/Collapse/Collapse.stories.d.ts +5 -0
- package/dist/Collapse/Collapse.stories.js +15 -0
- package/dist/Collapse/Collapse.stories.js.map +1 -0
- package/dist/Collapse/Collapse.test.d.ts +1 -0
- package/dist/Collapse/Collapse.test.js +17 -0
- package/dist/Collapse/Collapse.test.js.map +1 -0
- package/dist/Collapse/Collapse.types.d.ts +18 -0
- package/dist/Collapse/Collapse.types.js +2 -0
- package/dist/Collapse/Collapse.types.js.map +1 -0
- package/dist/Collapse/index.d.ts +1 -0
- package/dist/Collapse/index.js +2 -0
- package/dist/Collapse/index.js.map +1 -0
- package/dist/Icon/Icon.d.ts +10 -0
- package/dist/Icon/Icon.js +56 -0
- package/dist/Icon/Icon.js.map +1 -0
- package/dist/Icon/Icon.stories.d.ts +5 -0
- package/dist/Icon/Icon.stories.js +15 -0
- package/dist/Icon/Icon.stories.js.map +1 -0
- package/dist/Icon/Icon.test.d.ts +1 -0
- package/dist/Icon/Icon.test.js +55 -0
- package/dist/Icon/Icon.test.js.map +1 -0
- package/dist/Icon/Icon.types.d.ts +90 -0
- package/dist/Icon/Icon.types.js +16 -0
- package/dist/Icon/Icon.types.js.map +1 -0
- package/dist/Icon/index.d.ts +1 -0
- package/dist/Icon/index.js +2 -0
- package/dist/Icon/index.js.map +1 -0
- package/dist/InputGroup/InputGroup.d.ts +7 -0
- package/dist/InputGroup/InputGroup.js +36 -0
- package/dist/InputGroup/InputGroup.js.map +1 -0
- package/dist/InputGroup/InputGroup.stories.d.ts +5 -0
- package/dist/InputGroup/InputGroup.stories.js +129 -0
- package/dist/InputGroup/InputGroup.stories.js.map +1 -0
- package/dist/InputGroup/InputGroup.test.d.ts +1 -0
- package/dist/InputGroup/InputGroup.test.js +42 -0
- package/dist/InputGroup/InputGroup.test.js.map +1 -0
- package/dist/InputGroup/InputGroup.types.d.ts +61 -0
- package/dist/InputGroup/InputGroup.types.js +2 -0
- package/dist/InputGroup/InputGroup.types.js.map +1 -0
- package/dist/InputGroup/index.d.ts +2 -0
- package/dist/InputGroup/index.js +2 -0
- package/dist/InputGroup/index.js.map +1 -0
- package/dist/Modal/Modal.d.ts +5 -0
- package/dist/Modal/Modal.js +76 -0
- package/dist/Modal/Modal.js.map +1 -0
- package/dist/Modal/Modal.stories.d.ts +10 -0
- package/dist/Modal/Modal.stories.js +44 -0
- package/dist/Modal/Modal.stories.js.map +1 -0
- package/dist/Modal/Modal.test.d.ts +1 -0
- package/dist/Modal/Modal.test.js +108 -0
- package/dist/Modal/Modal.test.js.map +1 -0
- package/dist/Modal/Modal.types.d.ts +244 -0
- package/dist/Modal/Modal.types.js +2 -0
- package/dist/Modal/Modal.types.js.map +1 -0
- package/dist/Modal/index.d.ts +1 -0
- package/dist/Modal/index.js +2 -0
- package/dist/Modal/index.js.map +1 -0
- package/dist/ProgressBar/ProgressBar.d.ts +4 -0
- package/dist/ProgressBar/ProgressBar.js +72 -0
- package/dist/ProgressBar/ProgressBar.js.map +1 -0
- package/dist/ProgressBar/ProgressBar.stories.d.ts +5 -0
- package/dist/ProgressBar/ProgressBar.stories.js +35 -0
- package/dist/ProgressBar/ProgressBar.stories.js.map +1 -0
- package/dist/ProgressBar/ProgressBar.test.d.ts +1 -0
- package/dist/ProgressBar/ProgressBar.test.js +43 -0
- package/dist/ProgressBar/ProgressBar.test.js.map +1 -0
- package/dist/ProgressBar/ProgressBar.types.d.ts +77 -0
- package/dist/ProgressBar/ProgressBar.types.js +2 -0
- package/dist/ProgressBar/ProgressBar.types.js.map +1 -0
- package/dist/ProgressBar/index.d.ts +1 -0
- package/dist/ProgressBar/index.js +2 -0
- package/dist/ProgressBar/index.js.map +1 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.d.ts +4 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.js +39 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.js.map +1 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.d.ts +5 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js +58 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.stories.js.map +1 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.test.d.ts +1 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js +73 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.test.js.map +1 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.types.d.ts +164 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js +2 -0
- package/dist/SeeqActionDropdown/SeeqActionDropdown.types.js.map +1 -0
- package/dist/SeeqActionDropdown/index.d.ts +1 -0
- package/dist/SeeqActionDropdown/index.js +2 -0
- package/dist/SeeqActionDropdown/index.js.map +1 -0
- package/dist/SeeqActionDropdown/variants.d.ts +5 -0
- package/dist/SeeqActionDropdown/variants.js +23 -0
- package/dist/SeeqActionDropdown/variants.js.map +1 -0
- package/dist/Select/Select.d.ts +15 -0
- package/dist/Select/Select.js +179 -0
- package/dist/Select/Select.js.map +1 -0
- package/dist/Select/Select.stories.d.ts +5 -0
- package/dist/Select/Select.stories.js +40 -0
- package/dist/Select/Select.stories.js.map +1 -0
- package/dist/Select/Select.test.d.ts +1 -0
- package/dist/Select/Select.test.js +175 -0
- package/dist/Select/Select.test.js.map +1 -0
- package/dist/Select/Select.types.d.ts +220 -0
- package/dist/Select/Select.types.js +2 -0
- package/dist/Select/Select.types.js.map +1 -0
- package/dist/Select/index.d.ts +2 -0
- package/dist/Select/index.js +3 -0
- package/dist/Select/index.js.map +1 -0
- package/dist/Slider/Slider.d.ts +6 -0
- package/dist/Slider/Slider.js +10 -0
- package/dist/Slider/Slider.js.map +1 -0
- package/dist/Slider/Slider.stories.d.ts +5 -0
- package/dist/Slider/Slider.stories.js +14 -0
- package/dist/Slider/Slider.stories.js.map +1 -0
- package/dist/Slider/Slider.test.d.ts +1 -0
- package/dist/Slider/Slider.test.js +32 -0
- package/dist/Slider/Slider.test.js.map +1 -0
- package/dist/Slider/Slider.types.d.ts +84 -0
- package/dist/Slider/Slider.types.js +2 -0
- package/dist/Slider/Slider.types.js.map +1 -0
- package/dist/Slider/index.d.ts +1 -0
- package/dist/Slider/index.js +2 -0
- package/dist/Slider/index.js.map +1 -0
- package/dist/SvgIcon/SvgIcon.d.ts +20 -0
- package/dist/SvgIcon/SvgIcon.js +28 -0
- package/dist/SvgIcon/SvgIcon.js.map +1 -0
- package/dist/SvgIcon/SvgIcon.stories.d.ts +5 -0
- package/dist/SvgIcon/SvgIcon.stories.js +18 -0
- package/dist/SvgIcon/SvgIcon.stories.js.map +1 -0
- package/dist/SvgIcon/SvgIcon.test.d.ts +1 -0
- package/dist/SvgIcon/SvgIcon.test.js +41 -0
- package/dist/SvgIcon/SvgIcon.test.js.map +1 -0
- package/dist/SvgIcon/SvgIcon.types.d.ts +75 -0
- package/dist/SvgIcon/SvgIcon.types.js +3 -0
- package/dist/SvgIcon/SvgIcon.types.js.map +1 -0
- package/dist/SvgIcon/index.d.ts +1 -0
- package/dist/SvgIcon/index.js +2 -0
- package/dist/SvgIcon/index.js.map +1 -0
- package/dist/Tabs/Tabs.d.ts +4 -0
- package/dist/Tabs/Tabs.js +17 -0
- package/dist/Tabs/Tabs.js.map +1 -0
- package/dist/Tabs/Tabs.stories.d.ts +5 -0
- package/dist/Tabs/Tabs.stories.js +73 -0
- package/dist/Tabs/Tabs.stories.js.map +1 -0
- package/dist/Tabs/Tabs.test.d.ts +1 -0
- package/dist/Tabs/Tabs.test.js +86 -0
- package/dist/Tabs/Tabs.test.js.map +1 -0
- package/dist/Tabs/Tabs.types.d.ts +100 -0
- package/dist/Tabs/Tabs.types.js +2 -0
- package/dist/Tabs/Tabs.types.js.map +1 -0
- package/dist/Tabs/index.d.ts +1 -0
- package/dist/Tabs/index.js +2 -0
- package/dist/Tabs/index.js.map +1 -0
- package/dist/TextArea/TextArea.d.ts +7 -0
- package/dist/TextArea/TextArea.js +55 -0
- package/dist/TextArea/TextArea.js.map +1 -0
- package/dist/TextArea/TextArea.stories.d.ts +5 -0
- package/dist/TextArea/TextArea.stories.js +10 -0
- package/dist/TextArea/TextArea.stories.js.map +1 -0
- package/dist/TextArea/TextArea.test.d.ts +1 -0
- package/dist/TextArea/TextArea.test.js +130 -0
- package/dist/TextArea/TextArea.test.js.map +1 -0
- package/dist/TextArea/TextArea.types.d.ts +115 -0
- package/dist/TextArea/TextArea.types.js +2 -0
- package/dist/TextArea/TextArea.types.js.map +1 -0
- package/dist/TextArea/index.d.ts +1 -0
- package/dist/TextArea/index.js +2 -0
- package/dist/TextArea/index.js.map +1 -0
- package/dist/TextField/TextField.d.ts +7 -0
- package/dist/TextField/TextField.js +85 -0
- package/dist/TextField/TextField.js.map +1 -0
- package/dist/TextField/TextField.stories.d.ts +5 -0
- package/dist/TextField/TextField.stories.js +11 -0
- package/dist/TextField/TextField.stories.js.map +1 -0
- package/dist/TextField/TextField.test.d.ts +1 -0
- package/dist/TextField/TextField.test.js +41 -0
- package/dist/TextField/TextField.test.js.map +1 -0
- package/dist/TextField/TextField.types.d.ts +198 -0
- package/dist/TextField/TextField.types.js +2 -0
- package/dist/TextField/TextField.types.js.map +1 -0
- package/dist/TextField/index.d.ts +1 -0
- package/dist/TextField/index.js +2 -0
- package/dist/TextField/index.js.map +1 -0
- package/dist/ToolbarButton/ToolbarButton.d.ts +3 -0
- package/dist/ToolbarButton/ToolbarButton.js +56 -0
- package/dist/ToolbarButton/ToolbarButton.js.map +1 -0
- package/dist/ToolbarButton/ToolbarButton.stories.d.ts +5 -0
- package/dist/ToolbarButton/ToolbarButton.stories.js +28 -0
- package/dist/ToolbarButton/ToolbarButton.stories.js.map +1 -0
- package/dist/ToolbarButton/ToolbarButton.test.d.ts +1 -0
- package/dist/ToolbarButton/ToolbarButton.test.js +85 -0
- package/dist/ToolbarButton/ToolbarButton.test.js.map +1 -0
- package/dist/ToolbarButton/ToolbarButton.types.d.ts +122 -0
- package/dist/ToolbarButton/ToolbarButton.types.js +2 -0
- package/dist/ToolbarButton/ToolbarButton.types.js.map +1 -0
- package/dist/ToolbarButton/index.d.ts +1 -0
- package/dist/ToolbarButton/index.js +2 -0
- package/dist/ToolbarButton/index.js.map +1 -0
- package/dist/Tooltip/QTip.stories.d.ts +5 -0
- package/dist/Tooltip/QTip.stories.js +19 -0
- package/dist/Tooltip/QTip.stories.js.map +1 -0
- package/dist/Tooltip/QTip.types.d.ts +13 -0
- package/dist/Tooltip/QTip.types.js +2 -0
- package/dist/Tooltip/QTip.types.js.map +1 -0
- package/dist/Tooltip/QTipPerformance.stories.d.ts +5 -0
- package/dist/Tooltip/QTipPerformance.stories.js +26 -0
- package/dist/Tooltip/QTipPerformance.stories.js.map +1 -0
- package/dist/Tooltip/Qtip.d.ts +26 -0
- package/dist/Tooltip/Qtip.js +168 -0
- package/dist/Tooltip/Qtip.js.map +1 -0
- package/dist/Tooltip/Tooltip.d.ts +13 -0
- package/dist/Tooltip/Tooltip.js +34 -0
- package/dist/Tooltip/Tooltip.js.map +1 -0
- package/dist/Tooltip/Tooltip.stories.d.ts +5 -0
- package/dist/Tooltip/Tooltip.stories.js +15 -0
- package/dist/Tooltip/Tooltip.stories.js.map +1 -0
- package/dist/Tooltip/Tooltip.types.d.ts +22 -0
- package/dist/Tooltip/Tooltip.types.js +3 -0
- package/dist/Tooltip/Tooltip.types.js.map +1 -0
- package/dist/Tooltip/TooltipPerformance.stories.d.ts +5 -0
- package/dist/Tooltip/TooltipPerformance.stories.js +26 -0
- package/dist/Tooltip/TooltipPerformance.stories.js.map +1 -0
- package/dist/Tooltip/index.d.ts +2 -0
- package/dist/Tooltip/index.js +3 -0
- package/dist/Tooltip/index.js.map +1 -0
- package/dist/Tooltip/qTip.utilities.d.ts +3 -0
- package/dist/Tooltip/qTip.utilities.js +11 -0
- package/dist/Tooltip/qTip.utilities.js.map +1 -0
- package/dist/example/src/Example.tsx +7 -7
- package/dist/index.d.ts +46 -0
- package/dist/index.esm.js +1563 -1529
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1563 -1529
- package/dist/index.js.map +1 -1
- package/dist/setupTests.d.ts +1 -0
- package/dist/setupTests.js +6 -0
- package/dist/setupTests.js.map +1 -0
- package/dist/src/SeeqActionDropdown/SeeqActionDropdown.types.d.ts +5 -0
- package/dist/styles.css +2922 -3539
- package/dist/types.d.ts +27 -0
- package/dist/types.js +26 -0
- package/dist/types.js.map +1 -0
- package/dist/utils/browserId.d.ts +9 -0
- package/dist/utils/browserId.js +29 -0
- package/dist/utils/browserId.js.map +1 -0
- package/dist/utils/svg.d.ts +15 -0
- package/dist/utils/svg.js +20 -0
- package/dist/utils/svg.js.map +1 -0
- package/dist/utils/validateStyleDimension.d.ts +2 -0
- package/dist/utils/validateStyleDimension.js +14 -0
- package/dist/utils/validateStyleDimension.js.map +1 -0
- package/dist/utils/validateStyleDimension.test.d.ts +1 -0
- package/dist/utils/validateStyleDimension.test.js +20 -0
- package/dist/utils/validateStyleDimension.test.js.map +1 -0
- package/package.json +13 -12
package/dist/index.esm.js
CHANGED
|
@@ -46,34 +46,34 @@ const getQTipData = ({ tooltip, tooltipPlacement, isHtmlTooltip, tooltipTestId,
|
|
|
46
46
|
: undefined;
|
|
47
47
|
|
|
48
48
|
const colorClassesThemeLight = {
|
|
49
|
-
'theme': 'tw
|
|
50
|
-
'white': 'tw
|
|
51
|
-
'dark-gray': 'tw
|
|
52
|
-
'warning': 'tw
|
|
53
|
-
'darkish-gray': 'tw
|
|
54
|
-
'gray': 'tw
|
|
49
|
+
'theme': 'tw:text-sq-theme-dark',
|
|
50
|
+
'white': 'tw:text-sq-white',
|
|
51
|
+
'dark-gray': 'tw:text-sq-fairly-dark-gray',
|
|
52
|
+
'warning': 'tw:text-sq-warning',
|
|
53
|
+
'darkish-gray': 'tw:text-sq-darkish-gray',
|
|
54
|
+
'gray': 'tw:text-sq-disabled-gray',
|
|
55
55
|
'color': '',
|
|
56
|
-
'info': 'tw
|
|
57
|
-
'text': 'tw
|
|
56
|
+
'info': 'tw:text-sq-theme-link',
|
|
57
|
+
'text': 'tw:text-sq-text-color',
|
|
58
58
|
'inherit': '',
|
|
59
|
-
'danger': 'tw
|
|
60
|
-
'theme-light': 'tw
|
|
61
|
-
'success': 'tw
|
|
59
|
+
'danger': 'tw:text-sq-danger',
|
|
60
|
+
'theme-light': 'tw:text-sq-theme-light',
|
|
61
|
+
'success': 'tw:text-sq-success',
|
|
62
62
|
};
|
|
63
63
|
const colorClassesThemeDark = {
|
|
64
|
-
'theme': 'dark:
|
|
64
|
+
'theme': 'tw:dark:text-sq-theme-darker',
|
|
65
65
|
'white': '',
|
|
66
|
-
'dark-gray': 'tw
|
|
66
|
+
'dark-gray': 'tw:text-sq-fairly-dark-gray',
|
|
67
67
|
'warning': '',
|
|
68
|
-
'darkish-gray': 'tw
|
|
69
|
-
'gray': 'dark:
|
|
68
|
+
'darkish-gray': 'tw:text-sq-darkish-gray',
|
|
69
|
+
'gray': 'tw:dark:text-sq-dark-disabled-gray',
|
|
70
70
|
'color': '',
|
|
71
|
-
'info': 'dark:
|
|
72
|
-
'text': 'dark:
|
|
71
|
+
'info': 'tw:dark:text-sq-theme-link',
|
|
72
|
+
'text': 'tw:dark:text-sq-dark-text',
|
|
73
73
|
'inherit': '',
|
|
74
|
-
'danger': 'tw
|
|
75
|
-
'theme-light': 'tw
|
|
76
|
-
'success': 'tw
|
|
74
|
+
'danger': 'tw:text-sq-danger',
|
|
75
|
+
'theme-light': 'tw:text-sq-theme-light',
|
|
76
|
+
'success': 'tw:text-sq-success',
|
|
77
77
|
};
|
|
78
78
|
/**
|
|
79
79
|
* Icon:
|
|
@@ -85,14 +85,14 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
|
|
|
85
85
|
const errorMessage = color === undefined || color === ''
|
|
86
86
|
? 'Icon with type="color" must have prop color specified.'
|
|
87
87
|
: 'Icon with prop color must have type="color".';
|
|
88
|
-
return jsx$1("div", { className: "tw
|
|
88
|
+
return jsx$1("div", { className: "tw:text-sq-danger", children: errorMessage });
|
|
89
89
|
}
|
|
90
90
|
const fontAwesomePrefix = iconPrefix ? iconPrefix : 'fa-sharp fa-regular';
|
|
91
91
|
const iconPrefixString = icon.startsWith('fc') ? 'fc' : fontAwesomePrefix;
|
|
92
92
|
const style = type === 'color' && color ? { color } : {};
|
|
93
93
|
const sizeClass = size ? `fa-${size}` : small ? 'fa-sm' : large ? 'fa-lg' : '';
|
|
94
94
|
const appliedClassNames = `${iconPrefixString} ${icon} ${sizeClass}
|
|
95
|
-
${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'tw
|
|
95
|
+
${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'tw:cursor-pointer' : ''} ${extraClassNames} tw:focus:outline-none tw:focus-visible:outline-none tw:outline-none`;
|
|
96
96
|
const tooltipData = getQTipData(tooltipProps);
|
|
97
97
|
return (jsx$1("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number, ...tooltipData }));
|
|
98
98
|
};
|
|
@@ -103,71 +103,71 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
|
|
|
103
103
|
* - include tooltips and/or icons
|
|
104
104
|
*/
|
|
105
105
|
const Button = ({ onClick, label, variant = 'outline', type = 'button', size = 'sm', disabled, extraClassNames, id, testId, stopPropagation = true, tooltip, tooltipOptions, iconStyle = 'text', icon, iconColor, iconPosition = 'left', iconPrefix = undefined, preventBlur = false, isHtmlTooltip = false, tooltipTestId, }) => {
|
|
106
|
-
const baseClasses = 'tw
|
|
106
|
+
const baseClasses = 'tw:px-2.5 tw:rounded-md tw:focus:ring-0 tw:focus-visible:outline-none tw:aria-disabled:cursor-not-allowed tw:disabled:pointer-events-none';
|
|
107
107
|
const baseClassesByVariant = {
|
|
108
|
-
'outline': 'disabled:
|
|
109
|
-
'theme': 'disabled:
|
|
110
|
-
'danger': 'tw
|
|
111
|
-
'tw
|
|
112
|
-
'theme-light': 'disabled:
|
|
113
|
-
'no-border': 'disabled:
|
|
114
|
-
'warning': 'tw
|
|
115
|
-
'disabled:
|
|
108
|
+
'outline': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50 tw:border-solid tw:border',
|
|
109
|
+
'theme': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50 tw:border-solid tw:border',
|
|
110
|
+
'danger': 'tw:bg-sq-danger tw:disabled:opacity-50 tw:aria-disabled:opacity-50 ' +
|
|
111
|
+
'tw:border-solid tw:border tw:border-sq-danger',
|
|
112
|
+
'theme-light': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50 tw:border-solid tw:border',
|
|
113
|
+
'no-border': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50',
|
|
114
|
+
'warning': 'tw:bg-sq-warning tw:border-solid tw:border tw:border-sq-warning ' +
|
|
115
|
+
'tw:disabled:opacity-50 tw:aria-disabled:opacity-50',
|
|
116
116
|
};
|
|
117
117
|
const textClassesByVariantLightTheme = {
|
|
118
|
-
'outline': 'tw
|
|
119
|
-
'theme': 'tw
|
|
120
|
-
'theme-light': 'tw
|
|
121
|
-
'danger': 'tw
|
|
122
|
-
'no-border': 'tw
|
|
123
|
-
'warning': 'tw
|
|
118
|
+
'outline': 'tw:text-sq-text-color',
|
|
119
|
+
'theme': 'tw:text-sq-white',
|
|
120
|
+
'theme-light': 'tw:text-sq-white',
|
|
121
|
+
'danger': 'tw:text-sq-white',
|
|
122
|
+
'no-border': 'tw:text-sq-text-color',
|
|
123
|
+
'warning': 'tw:text-sq-white',
|
|
124
124
|
};
|
|
125
125
|
const textClassesByVariantDarkTheme = {
|
|
126
|
-
'outline': 'dark:
|
|
127
|
-
'theme': 'dark:
|
|
128
|
-
'theme-light': 'dark:
|
|
129
|
-
'danger': 'dark:
|
|
130
|
-
'no-border': 'dark:
|
|
131
|
-
'warning': 'dark:
|
|
126
|
+
'outline': 'tw:dark:text-sq-dark-text',
|
|
127
|
+
'theme': 'tw:dark:text-sq-white',
|
|
128
|
+
'theme-light': 'tw:dark:text-sq-white',
|
|
129
|
+
'danger': 'tw:dark:text-sq-white',
|
|
130
|
+
'no-border': 'tw:dark:text-sq-dark-text',
|
|
131
|
+
'warning': 'tw:dark:text-sq-white',
|
|
132
132
|
};
|
|
133
133
|
const classesByVariantLightTheme = {
|
|
134
|
-
'outline': 'tw
|
|
135
|
-
'theme': 'tw
|
|
134
|
+
'outline': 'tw:bg-white tw:border-sq-disabled-gray',
|
|
135
|
+
'theme': 'tw:bg-sq-theme-dark tw:border-sq-theme-dark',
|
|
136
136
|
'danger': '',
|
|
137
|
-
'theme-light': 'tw
|
|
137
|
+
'theme-light': 'tw:bg-sq-icon',
|
|
138
138
|
'no-border': '',
|
|
139
139
|
'warning': '',
|
|
140
140
|
};
|
|
141
141
|
const classesByVariantDarkTheme = {
|
|
142
|
-
'outline': 'dark:
|
|
143
|
-
'theme': 'dark:
|
|
142
|
+
'outline': 'tw:dark:bg-sq-dark-background tw:dark:border-sq-dark-disabled-gray',
|
|
143
|
+
'theme': 'tw:dark:bg-sq-theme-dark tw:dark:border-sq-theme-dark',
|
|
144
144
|
'danger': '',
|
|
145
|
-
'theme-light': 'dark:
|
|
145
|
+
'theme-light': 'tw:dark:bg-sq-icon-dark tw:dark:border-sq-icon-dark',
|
|
146
146
|
'no-border': '',
|
|
147
147
|
'warning': '',
|
|
148
148
|
};
|
|
149
149
|
const activeClassesByVariantLightTheme = {
|
|
150
|
-
'outline': 'hover:
|
|
151
|
-
' active:
|
|
152
|
-
'theme': 'hover:
|
|
153
|
-
'danger': 'hover:
|
|
154
|
-
'theme-light': 'hover:
|
|
150
|
+
'outline': 'tw:hover:bg-sq-light-gray tw:focus:bg-sq-dark-gray tw:active:bg-sq-dark-gray tw:focus:border-sq-theme-dark' +
|
|
151
|
+
' tw:active:border-sq-theme-dark',
|
|
152
|
+
'theme': 'tw:hover:bg-sq-theme-highlight tw:hover:border-sq-theme-highlight',
|
|
153
|
+
'danger': 'tw:hover:bg-sq-bg-danger tw:hover:border-sq-bg-danger',
|
|
154
|
+
'theme-light': 'tw:hover:bg-sq-link tw:hover:border-sq-link',
|
|
155
155
|
'no-border': '',
|
|
156
156
|
'warning': '',
|
|
157
157
|
};
|
|
158
158
|
const activeClassesByVariantDarkTheme = {
|
|
159
|
-
'outline': 'dark:hover:
|
|
160
|
-
' dark:active:
|
|
161
|
-
'theme': 'dark:hover:
|
|
162
|
-
'danger': 'dark:hover:
|
|
163
|
-
'theme-light': 'dark:hover:
|
|
159
|
+
'outline': 'tw:dark:hover:bg-sq-highlight-color-dark tw:dark:focus:bg-sq-multi-gray-dark' +
|
|
160
|
+
' tw:dark:active:bg-sq-multi-gray-dark tw:dark:focus:border-sq-theme-dark tw:dark:active:border-sq-theme-dark',
|
|
161
|
+
'theme': 'tw:dark:hover:bg-sq-theme-highlight tw:dark:hover:border-sq-theme-highlight',
|
|
162
|
+
'danger': 'tw:dark:hover:bg-sq-bg-danger tw:dark:hover:border-sq-bg-danger',
|
|
163
|
+
'theme-light': 'tw:dark:hover:bg-sq-link-dark tw:dark:hover:border-sq-link-dark',
|
|
164
164
|
'no-border': '',
|
|
165
165
|
'warning': '',
|
|
166
166
|
};
|
|
167
167
|
const sizeClasses = {
|
|
168
|
-
xs: 'tw
|
|
169
|
-
sm: 'tw
|
|
170
|
-
lg: 'tw
|
|
168
|
+
xs: 'tw:text-xs tw:py-0.5',
|
|
169
|
+
sm: 'tw:text-sm tw:py-1',
|
|
170
|
+
lg: 'tw:text-xl tw:py-1',
|
|
171
171
|
};
|
|
172
172
|
let tooltipData = undefined;
|
|
173
173
|
let appliedClasses = `${baseClasses} ${baseClassesByVariant[variant]} ${sizeClasses[size]} ${classesByVariantLightTheme[variant]} ${classesByVariantDarkTheme[variant]} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]} ${extraClassNames}`;
|
|
@@ -183,7 +183,7 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
183
183
|
'data-qtip-delay': tooltipOptions?.delay ?? DEFAULT_TOOL_TIP_DELAY,
|
|
184
184
|
};
|
|
185
185
|
}
|
|
186
|
-
const iconClass = iconPosition === 'left' ? 'tw
|
|
186
|
+
const iconClass = iconPosition === 'left' ? 'tw:mr-1' : 'tw:ml-1';
|
|
187
187
|
const iconElement = icon && (jsx$1(Icon, { icon: icon, iconPrefix: iconPrefix, type: iconStyle, color: iconColor, extraClassNames: label
|
|
188
188
|
? `${iconClass} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}`
|
|
189
189
|
: '', testId: `${id}_spinner` }));
|
|
@@ -1333,7 +1333,7 @@ const arrow$4 = options => ({
|
|
|
1333
1333
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
1334
1334
|
* @see https://floating-ui.com/docs/flip
|
|
1335
1335
|
*/
|
|
1336
|
-
const flip$
|
|
1336
|
+
const flip$3 = function (options) {
|
|
1337
1337
|
if (options === void 0) {
|
|
1338
1338
|
options = {};
|
|
1339
1339
|
}
|
|
@@ -2698,7 +2698,7 @@ const shift$2 = shift$3;
|
|
|
2698
2698
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
2699
2699
|
* @see https://floating-ui.com/docs/flip
|
|
2700
2700
|
*/
|
|
2701
|
-
const flip$
|
|
2701
|
+
const flip$2 = flip$3;
|
|
2702
2702
|
|
|
2703
2703
|
/**
|
|
2704
2704
|
* Provides data that allows you to change the size of the floating element —
|
|
@@ -3056,8 +3056,8 @@ const limitShift = (options, deps) => ({
|
|
|
3056
3056
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
3057
3057
|
* @see https://floating-ui.com/docs/flip
|
|
3058
3058
|
*/
|
|
3059
|
-
const flip$
|
|
3060
|
-
...flip$
|
|
3059
|
+
const flip$1 = (options, deps) => ({
|
|
3060
|
+
...flip$2(options),
|
|
3061
3061
|
options: [options, deps]
|
|
3062
3062
|
});
|
|
3063
3063
|
|
|
@@ -3230,7 +3230,7 @@ var PopperContent = React.forwardRef(
|
|
|
3230
3230
|
limiter: sticky === "partial" ? limitShift() : void 0,
|
|
3231
3231
|
...detectOverflowOptions
|
|
3232
3232
|
}),
|
|
3233
|
-
avoidCollisions && flip$
|
|
3233
|
+
avoidCollisions && flip$1({ ...detectOverflowOptions }),
|
|
3234
3234
|
size({
|
|
3235
3235
|
...detectOverflowOptions,
|
|
3236
3236
|
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
@@ -4777,31 +4777,30 @@ function getSvgIconPath(icon) {
|
|
|
4777
4777
|
}
|
|
4778
4778
|
|
|
4779
4779
|
const popoverBorderStyles = [
|
|
4780
|
-
'tw
|
|
4781
|
-
'tw
|
|
4782
|
-
'tw
|
|
4783
|
-
'tw
|
|
4784
|
-
'dark:
|
|
4780
|
+
'tw:border-solid',
|
|
4781
|
+
'tw:border',
|
|
4782
|
+
'tw:rounded-md',
|
|
4783
|
+
'tw:border-sq-disabled-gray',
|
|
4784
|
+
'tw:dark:border-gray-500',
|
|
4785
4785
|
].join(' ');
|
|
4786
4786
|
const triggerBackgroundStyles = [
|
|
4787
|
-
'tw
|
|
4788
|
-
'hover:
|
|
4789
|
-
'active:
|
|
4790
|
-
'dark:
|
|
4791
|
-
'dark:hover:
|
|
4792
|
-
'dark:active:
|
|
4787
|
+
'tw:bg-transparent',
|
|
4788
|
+
'tw:hover:bg-sq-worksheetspanel-gray',
|
|
4789
|
+
'tw:active:bg-sq-worksheetspanel-gray',
|
|
4790
|
+
'tw:dark:bg-transparent',
|
|
4791
|
+
'tw:dark:hover:bg-sq-field-disabled-gray/30',
|
|
4792
|
+
'tw:dark:active:bg-sq-field-disabled-gray/30',
|
|
4793
4793
|
].join(' ');
|
|
4794
4794
|
const activeBackgroundStyles = [
|
|
4795
4795
|
'active',
|
|
4796
|
-
'tw
|
|
4797
|
-
'
|
|
4798
|
-
'
|
|
4799
|
-
'dark:
|
|
4800
|
-
'dark:
|
|
4801
|
-
'dark:active:tw-bg-sq-dark-disabled-gray',
|
|
4796
|
+
'tw:bg-sq-overlay',
|
|
4797
|
+
'tw:active:bg-sq-overlay',
|
|
4798
|
+
'tw:dark:bg-sq-dark-disabled-gray',
|
|
4799
|
+
'tw:dark:hover:border-sq-dark-disabled-gray/30',
|
|
4800
|
+
'tw:dark:active:bg-sq-dark-disabled-gray/30',
|
|
4802
4801
|
].join(' ');
|
|
4803
|
-
const bgStyles$3 = ['tw
|
|
4804
|
-
const disabledClasses$4 = ['tw
|
|
4802
|
+
const bgStyles$3 = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
4803
|
+
const disabledClasses$4 = ['tw:opacity-50', 'tw:cursor-not-allowed'].join(' ');
|
|
4805
4804
|
const PopoverContent = React.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (jsx$1(Content2$3, { ref: ref, align: align, sideOffset: sideOffset, ...props, asChild: true })));
|
|
4806
4805
|
const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIcon = false, tooltipText, id, popoverContent, extraClassNames, testId, tooltipTestId, tooltipOptions, isActive = false, isHtmlTooltip = false, hasArrow = false, disabled = false, isPrimaryAnSvg = false, primaryIconExtraClassNames = false, iconHeight = 24, iconWidth = 24, primaryIconViewbox = '0 0 24 24', onClick, onHide, }) => {
|
|
4807
4806
|
let tooltipData = undefined;
|
|
@@ -4819,12 +4818,12 @@ const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIco
|
|
|
4819
4818
|
onHide && onHide();
|
|
4820
4819
|
}
|
|
4821
4820
|
};
|
|
4822
|
-
return (jsxs(Root2$3, { defaultOpen: false, onOpenChange: onOpenChange, children: [jsx$1(Trigger$3, { id: id, className: `tw-border-none tw
|
|
4821
|
+
return (jsxs(Root2$3, { defaultOpen: false, onOpenChange: onOpenChange, children: [jsx$1(Trigger$3, { id: id, className: `tw:bg-transparent tw:border-none tw:mx-sq-1.5 tw:first:ml-0 tw:last:mr-0 ${isActive ? 'active' : ''}`, disabled: disabled, "data-testid": testId, onClick: (e) => {
|
|
4823
4822
|
onClick && onClick(e);
|
|
4824
|
-
}, children: jsxs("div", { ...tooltipData, className: `tw
|
|
4825
|
-
' tw
|
|
4826
|
-
' data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2' +
|
|
4827
|
-
popoverBorderStyles, children: [hasArrow && (jsx$1(Arrow2$2, { asChild: true, children: jsx$1("div", { className: " tw
|
|
4823
|
+
}, children: jsxs("div", { ...tooltipData, className: `tw:flex tw:flex-col tw:items-center tw:rounded-md ${isSmall ? 'tw:py-px tw:px-1' : 'tw:px-2 tw:py-sq-5'} ${disabled ? disabledClasses$4 : isActive ? activeBackgroundStyles : triggerBackgroundStyles} ${extraClassNames || ''}`, children: [jsxs("span", { className: "tw:nowrap", children: [isPrimaryAnSvg ? (jsx$1("svg", { xmlns: "http://www.w3.org/2000/svg", className: `tw:text-sq-text-color tw:dark:text-sq-dark-text ${primaryIconExtraClassNames || ''}`, viewBox: primaryIconViewbox, height: `${iconHeight}px`, width: `${iconWidth}px`, fill: "currentColor", "data-testid": testId, children: jsx$1("path", { d: getSvgIconPath(icon) }) })) : (jsx$1(Icon, { icon: icon, testId: "firstIcon", type: "text", size: !isSmall && !label && !secondIcon && !forceSmallIcon ? 'lg' : 'sm', extraClassNames: `tw:text-sq-text-color tw:dark:text-sq-dark-text` })), secondIcon && jsx$1(Icon, { icon: secondIcon, type: "text", testId: "secondIcon" }), popoverContent ? (jsx$1(Icon, { icon: "fc-arrow-dropdown", extraClassNames: "tw:text-sq-text-color tw:dark:text-sq-dark-text tw:ml-sq-3 tw:text-2", type: "text", size: "sm" })) : undefined] }), !isSmall && jsx$1("small", { className: "tw:text-sq-text-color tw:dark:text-sq-dark-text tw:text-2.5", children: label })] }) }), !!popoverContent ? (jsx$1(PopoverContent, { sideOffset: 2, align: "start", children: jsxs("div", { className: bgStyles$3 +
|
|
4824
|
+
' tw:relative tw:z-[1000] tw:min-w-6 tw:p-2 tw:focus-visible:outline-none tw:outline-none tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out' +
|
|
4825
|
+
' tw:data-[state=closed]:fade-out-0 tw:data-[state=open]:fade-in-0 tw:data-[state=closed]:zoom-out-95 tw:data-[state=open]:zoom-in-95 tw:data-[side=bottom]:slide-in-from-top-2 tw:data-[side=left]:slide-in-from-right-2 tw:data-[side=right]:slide-in-from-left-2 tw:data-[side=top]:slide-in-from-bottom-2' +
|
|
4826
|
+
popoverBorderStyles, children: [hasArrow && (jsx$1(Arrow2$2, { asChild: true, children: jsx$1("div", { className: " tw:fill-transparent tw:bg-sq-white tw:w-sq-15 tw:h-sq-15 tw:-mt-sq-7 tw:rotate-45 tw:dark:bg-sq-dark-background tw:border-b tw:border-r tw:border-sq-disabled-gray tw:dark:border-gray-500" }) })), popoverContent] }) })) : undefined] }));
|
|
4828
4827
|
};
|
|
4829
4828
|
|
|
4830
4829
|
const setValidInputDimension = (width, height) => {
|
|
@@ -4841,24 +4840,24 @@ const setValidInputDimension = (width, height) => {
|
|
|
4841
4840
|
return inputStyle;
|
|
4842
4841
|
};
|
|
4843
4842
|
|
|
4844
|
-
const errorClasses$4 = 'tw
|
|
4843
|
+
const errorClasses$4 = 'tw:border-sq-danger';
|
|
4845
4844
|
const borderColorClasses$4 = [
|
|
4846
|
-
'tw
|
|
4847
|
-
'dark:
|
|
4848
|
-
'dark:focus:
|
|
4849
|
-
'dark:active:
|
|
4850
|
-
'focus:
|
|
4851
|
-
'active:
|
|
4845
|
+
'tw:border-sq-disabled-gray',
|
|
4846
|
+
'tw:dark:border-sq-dark-disabled-gray',
|
|
4847
|
+
'tw:dark:focus:border-sq-theme-dark-dark',
|
|
4848
|
+
'tw:dark:active:border-sq-theme-darker',
|
|
4849
|
+
'tw:focus:border-sq-theme-dark',
|
|
4850
|
+
'tw:active:border-sq-theme-dark',
|
|
4852
4851
|
].join(' ');
|
|
4853
|
-
const baseClasses$6 = 'tw
|
|
4854
|
-
' disabled:
|
|
4855
|
-
' disabled:
|
|
4856
|
-
' dark:
|
|
4857
|
-
const darkTheme$3 = 'dark:
|
|
4858
|
-
const lightTheme$3 = 'tw
|
|
4852
|
+
const baseClasses$6 = 'tw:h-8.5 tw:leading-normal tw:outline-none tw:py-1 tw:px-3' +
|
|
4853
|
+
' tw:disabled:pointer-events-none tw:disabled:bg-sq-light-gray tw:disabled:dark:bg-sq-dark-disabled-gray' +
|
|
4854
|
+
' tw:disabled:cursor-not-allowed tw:p-1 tw:border-solid tw:border tw:placeholder-gray-400' +
|
|
4855
|
+
' tw:dark:placeholder-sq-dark-text/30 specTextField';
|
|
4856
|
+
const darkTheme$3 = 'tw:dark:bg-sq-dark-background tw:dark:text-sq-dark-text tw:disabled:dark:text-sq-dark-text/30';
|
|
4857
|
+
const lightTheme$3 = 'tw:text-sq-text-color tw:disabled:text-sq-darkish-gray';
|
|
4859
4858
|
const sizeClasses = {
|
|
4860
|
-
sm: 'tw
|
|
4861
|
-
lg: 'tw
|
|
4859
|
+
sm: 'tw:text-sm',
|
|
4860
|
+
lg: 'tw:text-xl',
|
|
4862
4861
|
};
|
|
4863
4862
|
/**
|
|
4864
4863
|
* Textfield.
|
|
@@ -4900,12 +4899,12 @@ const TextField = React__default.forwardRef((props, ref) => {
|
|
|
4900
4899
|
internalRef.current.value = `${value}`;
|
|
4901
4900
|
}
|
|
4902
4901
|
}, [value]);
|
|
4903
|
-
let borderRadius = 'tw
|
|
4902
|
+
let borderRadius = 'tw:rounded-md';
|
|
4904
4903
|
if (inputGroup === 'left') {
|
|
4905
|
-
borderRadius = 'tw
|
|
4904
|
+
borderRadius = 'tw:rounded-l-md tw:border-r-0 tw:focus:border-r' + ' tw:active:border-r';
|
|
4906
4905
|
}
|
|
4907
4906
|
else if (inputGroup === 'right') {
|
|
4908
|
-
borderRadius = 'tw
|
|
4907
|
+
borderRadius = 'tw:rounded-r-md tw:border-l-0 tw:focus:border-l tw:active:border-l';
|
|
4909
4908
|
}
|
|
4910
4909
|
const appliedClasses = `${baseClasses$6} ${sizeClasses[size]} ${extraClassNames} ${lightTheme$3} ${darkTheme$3} ${borderRadius} ${showError ? errorClasses$4 : borderColorClasses$4} `;
|
|
4911
4910
|
const inputProp = setValidInputDimension(inputWidth, inputHeight)
|
|
@@ -4918,18 +4917,18 @@ const TextField = React__default.forwardRef((props, ref) => {
|
|
|
4918
4917
|
inputLenghtProp.maxLength = maxLength;
|
|
4919
4918
|
if (minLength)
|
|
4920
4919
|
inputLenghtProp.minLength = minLength;
|
|
4921
|
-
return (jsxs(Fragment, { children: [jsx$1("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: disabled, readOnly: readonly, autoComplete: autoComplete, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, step: step, required: required, min: min, max: max, ...inputLenghtProp, ...inputProp, ...tooltipData }), errorText && showError && jsx$1("div", { className: "tw
|
|
4920
|
+
return (jsxs(Fragment, { children: [jsx$1("input", { ref: setAllRefs, "data-testid": testId, name: name, id: id, type: type, value: value, className: appliedClasses, placeholder: placeholder, disabled: disabled, readOnly: readonly, autoComplete: autoComplete, onChange: handleChange, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, onKeyUp: onKeyUp, step: step, required: required, min: min, max: max, ...inputLenghtProp, ...inputProp, ...tooltipData }), errorText && showError && jsx$1("div", { className: "tw:text-sq-danger tw:text-xs tw:mt-1", children: errorText })] }));
|
|
4922
4921
|
});
|
|
4923
4922
|
|
|
4924
|
-
const alignment = 'tw
|
|
4925
|
-
const labelClasses = 'tw
|
|
4926
|
-
const baseClasses$5 = 'tw-border
|
|
4927
|
-
' dark:
|
|
4928
|
-
' checked:
|
|
4929
|
-
' checked:active:
|
|
4930
|
-
' dark:disabled:
|
|
4931
|
-
const checkboxClasses = `tw
|
|
4932
|
-
const radioClasses = `tw
|
|
4923
|
+
const alignment = 'tw:flex';
|
|
4924
|
+
const labelClasses = 'tw:ml-1.5 tw:text-sm tw:-mt-0.5';
|
|
4925
|
+
const baseClasses$5 = 'tw:appearance-none tw:border tw:h-3.5 tw:w-3.5 tw:focus:ring-0 tw:focus:ring-offset-0 tw:outline-none tw:focus:outline-none' +
|
|
4926
|
+
' tw:dark:bg-sq-dark-background tw:dark:border-sq-dark-text tw:dark:hover:bg-sq-dark-background' +
|
|
4927
|
+
' tw:checked:text-white tw:checked:border-sq-text-color tw:checked:hover:border-sq-theme-dark' +
|
|
4928
|
+
' tw:checked:active:border-sq-theme-darker tw:checked:focus:border-sq-theme-dark tw:disabled:border-sq-disabled-gray' +
|
|
4929
|
+
' tw:dark:disabled:border-sq-fairly-dark-gray tw:dark:checked:focus:bg-sq-dark-background';
|
|
4930
|
+
const checkboxClasses = `tw:form-checkbox tw:rounded ${baseClasses$5}`;
|
|
4931
|
+
const radioClasses = `tw:form-radio tw:rounded-full ${baseClasses$5}`;
|
|
4933
4932
|
/**
|
|
4934
4933
|
* Checkbox and Radio Box Component.
|
|
4935
4934
|
*/
|
|
@@ -4937,26 +4936,25 @@ const Checkbox = (props) => {
|
|
|
4937
4936
|
const { type = 'checkbox', value, disabled = false, label, onChange, onClick, onKeyDown, checked, defaultChecked, id, name, extraClassNames, extraLabelClassNames, testId, ...tooltipProps } = props;
|
|
4938
4937
|
const assignedId = id ?? 'checkbox_' + Math.random();
|
|
4939
4938
|
const tooltipData = getQTipData(tooltipProps);
|
|
4940
|
-
return (jsxs("span", { className: `${alignment} ${extraClassNames}`, children: [jsx$1("input", { value: value, type: type, "data-testid": testId, name: name, id: assignedId, readOnly: !onChange, checked: checked, defaultChecked: defaultChecked, className: `${type === 'checkbox' ? checkboxClasses : radioClasses} ${disabled ? 'tw
|
|
4941
|
-
|
|
4942
|
-
|
|
4943
|
-
|
|
4944
|
-
|
|
4945
|
-
|
|
4946
|
-
|
|
4947
|
-
' disabled:
|
|
4948
|
-
|
|
4949
|
-
|
|
4950
|
-
|
|
4951
|
-
const
|
|
4952
|
-
const errorClasses$3 = 'tw-border-sq-danger-color';
|
|
4939
|
+
return (jsxs("span", { className: `${alignment} ${extraClassNames}`, children: [jsx$1("input", { value: value, type: type, "data-testid": testId, name: name, id: assignedId, readOnly: !onChange, checked: checked, defaultChecked: defaultChecked, className: `${type === 'checkbox' ? checkboxClasses : radioClasses} ${disabled ? 'tw:cursor-not-allowed' : 'tw:cursor-pointer'}`, disabled: disabled, onClick: onClick, onChange: onChange, onKeyDown: onKeyDown, ...tooltipData }), label && (jsx$1("label", { htmlFor: assignedId, className: `${labelClasses} ${extraLabelClassNames} ${disabled
|
|
4940
|
+
? 'tw:cursor-not-allowed tw:dark:text-sq-fairly-dark-gray tw:text-sq-fairly-dark-gray'
|
|
4941
|
+
: 'tw:cursor-pointer tw:text-sq-text-color tw:dark:text-sq-dark-text'}`, children: label }))] }));
|
|
4942
|
+
};
|
|
4943
|
+
|
|
4944
|
+
const baseClasses$4 = 'tw:leading-normal tw:outline-none tw:py-1 tw:px-3 tw:rounded-md tw:w-full' +
|
|
4945
|
+
' tw:disabled:pointer-events-none tw:disabled:bg-sq-light-gray tw:disabled:dark:bg-sq-dark-disabled-gray' +
|
|
4946
|
+
' tw:disabled:cursor-not-allowed tw:p-1 tw:border-solid tw:border tw:text-sm';
|
|
4947
|
+
const darkTheme$2 = 'tw:dark:bg-sq-dark-background tw:dark:text-sq-dark-text ' +
|
|
4948
|
+
'tw:dark:placeholder-sq-dark-text/30 tw:disabled:dark:text-sq-dark-text/30';
|
|
4949
|
+
const lightTheme$2 = 'tw:text-sq-text-color tw:placeholder-gray-400 tw:disabled:text-sq-darkish-gray';
|
|
4950
|
+
const errorClasses$3 = 'tw:border-sq-danger';
|
|
4953
4951
|
const borderColorClasses$3 = [
|
|
4954
|
-
'tw
|
|
4955
|
-
'dark:
|
|
4956
|
-
'dark:focus:
|
|
4957
|
-
'dark:active:
|
|
4958
|
-
'focus:
|
|
4959
|
-
'active:
|
|
4952
|
+
'tw:border-sq-disabled-gray',
|
|
4953
|
+
'tw:dark:border-sq-dark-disabled-gray',
|
|
4954
|
+
'tw:dark:focus:border-sq-theme-darker',
|
|
4955
|
+
'tw:dark:active:border-sq-theme-darker',
|
|
4956
|
+
'tw:focus:border-sq-theme-dark',
|
|
4957
|
+
'tw:active:border-sq-theme-dark',
|
|
4960
4958
|
].join(' ');
|
|
4961
4959
|
/**
|
|
4962
4960
|
* TextArea.
|
|
@@ -5005,28 +5003,28 @@ const TextArea = React__default.forwardRef(({ readonly = false, disabled = false
|
|
|
5005
5003
|
* display correctly.
|
|
5006
5004
|
*/
|
|
5007
5005
|
const Tooltip = ({ position = 'bottom', children, text, delay = DEFAULT_TOOL_TIP_DELAY, }) => {
|
|
5008
|
-
const arrowBaseClasses =
|
|
5009
|
-
const centerArrowVertically = 'before:
|
|
5010
|
-
const centerArrowHorizontally = 'before:
|
|
5011
|
-
const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} before:
|
|
5012
|
-
before:
|
|
5013
|
-
const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} before:
|
|
5014
|
-
before:
|
|
5015
|
-
const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} before:-
|
|
5016
|
-
before:
|
|
5017
|
-
const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} before:-
|
|
5018
|
-
before:
|
|
5006
|
+
const arrowBaseClasses = "tw:before:content-[''] tw:before:absolute tw:before:border-8";
|
|
5007
|
+
const centerArrowVertically = 'tw:before:top-1/2 tw:before:-translate-y-1/2';
|
|
5008
|
+
const centerArrowHorizontally = 'tw:before:left-1/2 tw:before:-translate-x-1/2';
|
|
5009
|
+
const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} tw:before:right-full tw:before:border-y-transparent
|
|
5010
|
+
tw:before:border-l-transparent tw:before:border-r-sq-black`;
|
|
5011
|
+
const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} tw:before:left-full tw:before:border-y-transparent
|
|
5012
|
+
tw:before:border-l-sq-black tw:before:border-r-transparent`;
|
|
5013
|
+
const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} tw:before:-top-4 tw:before:border-b-sq-black
|
|
5014
|
+
tw:before:border-r-transparent tw:before:border-l-transparent tw:before:border-t-transparent`;
|
|
5015
|
+
const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} tw:before:-bottom-4 tw:before:border-b-transparent
|
|
5016
|
+
tw:before:border-t-sq-black tw:before:border-l-transparent tw:before:border-r-transparent`;
|
|
5019
5017
|
const placements = {
|
|
5020
|
-
top:
|
|
5021
|
-
left:
|
|
5022
|
-
right: `tw
|
|
5023
|
-
bottom:
|
|
5018
|
+
top: `tw:-top-2 tw:-translate-y-full tw:left-1/2 tw:-translate-x-1/2 ${arrowTop}`,
|
|
5019
|
+
left: `tw:-translate-x-full tw:-left-3 tw:-translate-y-1/2 tw:top-1/2 ${arrowLeft}`,
|
|
5020
|
+
right: `tw:translate-x-full tw:-right-3 tw:-translate-y-1/2 tw:top-1/2 ${arrowRight}`,
|
|
5021
|
+
bottom: `tw:-bottom-2 tw:translate-y-full tw:left-1/2 tw:-translate-x-1/2 ${arrowBottom}`,
|
|
5024
5022
|
};
|
|
5025
|
-
return (jsxs("div", { className: "tw
|
|
5026
|
-
tw
|
|
5023
|
+
return (jsxs("div", { className: "tw:group tw:relative tw:inline-block", children: [children, jsx$1("div", { className: `tw:z-50 tw:whitespace-nowrap tw:hidden tw:group-hover:inline-block tw:group-hover:delay-[${delay}ms]
|
|
5024
|
+
tw:absolute tw:opacity-0 tw:group-hover:opacity-100 tw:rounded tw:bg-sq-black tw:p-2 tw:text-xs tw:text-sq-white ${placements[position]}`, children: text })] }));
|
|
5027
5025
|
};
|
|
5028
5026
|
|
|
5029
|
-
/*! @license DOMPurify 3.2.
|
|
5027
|
+
/*! @license DOMPurify 3.2.6 | (c) Cure53 and other contributors | Released under the Apache license 2.0 and Mozilla Public License 2.0 | github.com/cure53/DOMPurify/blob/3.2.6/LICENSE */
|
|
5030
5028
|
|
|
5031
5029
|
const {
|
|
5032
5030
|
entries,
|
|
@@ -5065,8 +5063,10 @@ if (!construct) {
|
|
|
5065
5063
|
};
|
|
5066
5064
|
}
|
|
5067
5065
|
const arrayForEach = unapply(Array.prototype.forEach);
|
|
5066
|
+
const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
5068
5067
|
const arrayPop = unapply(Array.prototype.pop);
|
|
5069
5068
|
const arrayPush = unapply(Array.prototype.push);
|
|
5069
|
+
const arraySplice = unapply(Array.prototype.splice);
|
|
5070
5070
|
const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
5071
5071
|
const stringToString = unapply(String.prototype.toString);
|
|
5072
5072
|
const stringMatch = unapply(String.prototype.match);
|
|
@@ -5084,6 +5084,9 @@ const typeErrorCreate = unconstruct(TypeError);
|
|
|
5084
5084
|
*/
|
|
5085
5085
|
function unapply(func) {
|
|
5086
5086
|
return function (thisArg) {
|
|
5087
|
+
if (thisArg instanceof RegExp) {
|
|
5088
|
+
thisArg.lastIndex = 0;
|
|
5089
|
+
}
|
|
5087
5090
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5088
5091
|
args[_key - 1] = arguments[_key];
|
|
5089
5092
|
}
|
|
@@ -5222,10 +5225,10 @@ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:x
|
|
|
5222
5225
|
// eslint-disable-next-line unicorn/better-regex
|
|
5223
5226
|
const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
|
|
5224
5227
|
const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
|
5225
|
-
const TMPLIT_EXPR = seal(/\$\{[\w\W]
|
|
5228
|
+
const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
|
|
5226
5229
|
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
|
|
5227
5230
|
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
|
5228
|
-
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
5231
|
+
const IS_ALLOWED_URI = seal(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i // eslint-disable-line no-useless-escape
|
|
5229
5232
|
);
|
|
5230
5233
|
const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
5231
5234
|
const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
|
|
@@ -5322,9 +5325,9 @@ const _createHooksMap = function _createHooksMap() {
|
|
|
5322
5325
|
function createDOMPurify() {
|
|
5323
5326
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
5324
5327
|
const DOMPurify = root => createDOMPurify(root);
|
|
5325
|
-
DOMPurify.version = '3.2.
|
|
5328
|
+
DOMPurify.version = '3.2.6';
|
|
5326
5329
|
DOMPurify.removed = [];
|
|
5327
|
-
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) {
|
|
5330
|
+
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
5328
5331
|
// Not running in a browser, provide a factory function
|
|
5329
5332
|
// so that you can pass your own Window
|
|
5330
5333
|
DOMPurify.isSupported = false;
|
|
@@ -5561,8 +5564,8 @@ function createDOMPurify() {
|
|
|
5561
5564
|
URI_SAFE_ATTRIBUTES = objectHasOwnProperty(cfg, 'ADD_URI_SAFE_ATTR') ? addToSet(clone(DEFAULT_URI_SAFE_ATTRIBUTES), cfg.ADD_URI_SAFE_ATTR, transformCaseFunc) : DEFAULT_URI_SAFE_ATTRIBUTES;
|
|
5562
5565
|
DATA_URI_TAGS = objectHasOwnProperty(cfg, 'ADD_DATA_URI_TAGS') ? addToSet(clone(DEFAULT_DATA_URI_TAGS), cfg.ADD_DATA_URI_TAGS, transformCaseFunc) : DEFAULT_DATA_URI_TAGS;
|
|
5563
5566
|
FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
5564
|
-
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
|
5565
|
-
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
|
5567
|
+
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
|
|
5568
|
+
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
|
|
5566
5569
|
USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
|
|
5567
5570
|
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
5568
5571
|
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
|
@@ -5927,7 +5930,7 @@ function createDOMPurify() {
|
|
|
5927
5930
|
allowedTags: ALLOWED_TAGS
|
|
5928
5931
|
});
|
|
5929
5932
|
/* Detect mXSS attempts abusing namespace confusion */
|
|
5930
|
-
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
|
|
5933
|
+
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
|
|
5931
5934
|
_forceRemove(currentNode);
|
|
5932
5935
|
return true;
|
|
5933
5936
|
}
|
|
@@ -6079,7 +6082,8 @@ function createDOMPurify() {
|
|
|
6079
6082
|
value: attrValue
|
|
6080
6083
|
} = attr;
|
|
6081
6084
|
const lcName = transformCaseFunc(name);
|
|
6082
|
-
|
|
6085
|
+
const initValue = attrValue;
|
|
6086
|
+
let value = name === 'value' ? initValue : stringTrim(initValue);
|
|
6083
6087
|
/* Execute a hook if present */
|
|
6084
6088
|
hookEvent.attrName = lcName;
|
|
6085
6089
|
hookEvent.attrValue = value;
|
|
@@ -6105,10 +6109,9 @@ function createDOMPurify() {
|
|
|
6105
6109
|
if (hookEvent.forceKeepAttr) {
|
|
6106
6110
|
continue;
|
|
6107
6111
|
}
|
|
6108
|
-
/* Remove attribute */
|
|
6109
|
-
_removeAttribute(name, currentNode);
|
|
6110
6112
|
/* Did the hooks approve of the attribute? */
|
|
6111
6113
|
if (!hookEvent.keepAttr) {
|
|
6114
|
+
_removeAttribute(name, currentNode);
|
|
6112
6115
|
continue;
|
|
6113
6116
|
}
|
|
6114
6117
|
/* Work around a security issue in jQuery 3.0 */
|
|
@@ -6125,6 +6128,7 @@ function createDOMPurify() {
|
|
|
6125
6128
|
/* Is `value` valid for this attribute? */
|
|
6126
6129
|
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
6127
6130
|
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
6131
|
+
_removeAttribute(name, currentNode);
|
|
6128
6132
|
continue;
|
|
6129
6133
|
}
|
|
6130
6134
|
/* Handle attributes that require Trusted Types */
|
|
@@ -6145,19 +6149,23 @@ function createDOMPurify() {
|
|
|
6145
6149
|
}
|
|
6146
6150
|
}
|
|
6147
6151
|
/* Handle invalid data-* attribute set by try-catching it */
|
|
6148
|
-
|
|
6149
|
-
|
|
6150
|
-
|
|
6151
|
-
|
|
6152
|
-
|
|
6153
|
-
|
|
6154
|
-
|
|
6155
|
-
|
|
6156
|
-
|
|
6157
|
-
|
|
6158
|
-
|
|
6152
|
+
if (value !== initValue) {
|
|
6153
|
+
try {
|
|
6154
|
+
if (namespaceURI) {
|
|
6155
|
+
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
6156
|
+
} else {
|
|
6157
|
+
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
6158
|
+
currentNode.setAttribute(name, value);
|
|
6159
|
+
}
|
|
6160
|
+
if (_isClobbered(currentNode)) {
|
|
6161
|
+
_forceRemove(currentNode);
|
|
6162
|
+
} else {
|
|
6163
|
+
arrayPop(DOMPurify.removed);
|
|
6164
|
+
}
|
|
6165
|
+
} catch (_) {
|
|
6166
|
+
_removeAttribute(name, currentNode);
|
|
6159
6167
|
}
|
|
6160
|
-
}
|
|
6168
|
+
}
|
|
6161
6169
|
}
|
|
6162
6170
|
/* Execute a hook if present */
|
|
6163
6171
|
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
@@ -6343,7 +6351,11 @@ function createDOMPurify() {
|
|
|
6343
6351
|
}
|
|
6344
6352
|
arrayPush(hooks[entryPoint], hookFunction);
|
|
6345
6353
|
};
|
|
6346
|
-
DOMPurify.removeHook = function (entryPoint) {
|
|
6354
|
+
DOMPurify.removeHook = function (entryPoint, hookFunction) {
|
|
6355
|
+
if (hookFunction !== undefined) {
|
|
6356
|
+
const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
6357
|
+
return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
|
|
6358
|
+
}
|
|
6347
6359
|
return arrayPop(hooks[entryPoint]);
|
|
6348
6360
|
};
|
|
6349
6361
|
DOMPurify.removeHooks = function (entryPoint) {
|
|
@@ -6961,7 +6973,7 @@ const shift = shift$3;
|
|
|
6961
6973
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
6962
6974
|
* @see https://floating-ui.com/docs/flip
|
|
6963
6975
|
*/
|
|
6964
|
-
const flip
|
|
6976
|
+
const flip = flip$3;
|
|
6965
6977
|
|
|
6966
6978
|
/**
|
|
6967
6979
|
* Provides data to position an inner element of the floating element so that it
|
|
@@ -7484,7 +7496,7 @@ const QTip = () => {
|
|
|
7484
7496
|
if (tooltipRef.current && tooltipTarget.current) {
|
|
7485
7497
|
computePosition(tooltipTarget.current, tooltipRef.current, {
|
|
7486
7498
|
placement: position,
|
|
7487
|
-
middleware: [offset$2(10), flip
|
|
7499
|
+
middleware: [offset$2(10), flip(), shift({ padding: 8 }), arrow({ element: tooltipArrowRef.current })],
|
|
7488
7500
|
}).then(({ x, y, middlewareData, placement: finalPlacement }) => {
|
|
7489
7501
|
Object.assign(tooltipRef.current?.style, {
|
|
7490
7502
|
left: `${x}px`,
|
|
@@ -7509,26 +7521,26 @@ const QTip = () => {
|
|
|
7509
7521
|
: positionTooltip();
|
|
7510
7522
|
}
|
|
7511
7523
|
};
|
|
7512
|
-
return (jsx$1(Fragment, { children: jsxs("div", { onMouseEnter: () => setOverTooltip(true), onMouseLeave: () => setOverTooltip(false), "data-testid": tooltipTestId, ref: tooltipRef, className: 'tw
|
|
7513
|
-
(show ? 'tw
|
|
7524
|
+
return (jsx$1(Fragment, { children: jsxs("div", { onMouseEnter: () => setOverTooltip(true), onMouseLeave: () => setOverTooltip(false), "data-testid": tooltipTestId, ref: tooltipRef, className: 'tw:absolute tw:rounded tw:bg-black tw:max-w-96 tw:p-2 tw:text-xs tw:text-sq-white tw:z-[9999] tw:fade-in ' +
|
|
7525
|
+
(show ? 'tw:visible' : 'tw:invisible tw:pointer-events-none'), children: [html ? jsx$1(HTMLTip, { text: tooltipText }) : tooltipText, jsx$1("div", { className: "tw:absolute tw:w-2.5 tw:h-2.5 tw:rotate-45 tw:bg-sq-black", ref: tooltipArrowRef })] }) }));
|
|
7514
7526
|
};
|
|
7515
7527
|
|
|
7516
|
-
function _typeof
|
|
7528
|
+
function _typeof(o) {
|
|
7517
7529
|
"@babel/helpers - typeof";
|
|
7518
7530
|
|
|
7519
|
-
return _typeof
|
|
7531
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7520
7532
|
return typeof o;
|
|
7521
7533
|
} : function (o) {
|
|
7522
7534
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
7523
|
-
}, _typeof
|
|
7535
|
+
}, _typeof(o);
|
|
7524
7536
|
}
|
|
7525
7537
|
|
|
7526
7538
|
function toPrimitive(t, r) {
|
|
7527
|
-
if ("object" != _typeof
|
|
7539
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
7528
7540
|
var e = t[Symbol.toPrimitive];
|
|
7529
7541
|
if (void 0 !== e) {
|
|
7530
7542
|
var i = e.call(t, r || "default");
|
|
7531
|
-
if ("object" != _typeof
|
|
7543
|
+
if ("object" != _typeof(i)) return i;
|
|
7532
7544
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7533
7545
|
}
|
|
7534
7546
|
return ("string" === r ? String : Number)(t);
|
|
@@ -7536,7 +7548,7 @@ function toPrimitive(t, r) {
|
|
|
7536
7548
|
|
|
7537
7549
|
function toPropertyKey(t) {
|
|
7538
7550
|
var i = toPrimitive(t, "string");
|
|
7539
|
-
return "symbol" == _typeof
|
|
7551
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
7540
7552
|
}
|
|
7541
7553
|
|
|
7542
7554
|
function _defineProperty(e, r, t) {
|
|
@@ -7779,7 +7791,7 @@ function _assertThisInitialized(e) {
|
|
|
7779
7791
|
}
|
|
7780
7792
|
|
|
7781
7793
|
function _possibleConstructorReturn(t, e) {
|
|
7782
|
-
if (e && ("object" == _typeof
|
|
7794
|
+
if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
|
|
7783
7795
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
7784
7796
|
return _assertThisInitialized(t);
|
|
7785
7797
|
}
|
|
@@ -9825,7 +9837,7 @@ function classNames$1(prefix, state) {
|
|
|
9825
9837
|
|
|
9826
9838
|
var cleanValue = function cleanValue(value) {
|
|
9827
9839
|
if (isArray(value)) return value.filter(Boolean);
|
|
9828
|
-
if (_typeof
|
|
9840
|
+
if (_typeof(value) === 'object' && value !== null) return [value];
|
|
9829
9841
|
return [];
|
|
9830
9842
|
};
|
|
9831
9843
|
|
|
@@ -13925,70 +13937,77 @@ var CreatableSelect = /*#__PURE__*/forwardRef(function (props, ref) {
|
|
|
13925
13937
|
});
|
|
13926
13938
|
var CreatableSelect$1 = CreatableSelect;
|
|
13927
13939
|
|
|
13928
|
-
const baseClasses$3 = ['focus:
|
|
13929
|
-
const containerStyles = ['tw
|
|
13930
|
-
const errorClasses$2 = 'tw
|
|
13931
|
-
const borderColorClasses$2 = ['tw
|
|
13932
|
-
const borderStyles$3 = ['tw
|
|
13940
|
+
const baseClasses$3 = ['tw:focus:ring-0', 'tw:disabled:cursor-not-allowed'].join(' ');
|
|
13941
|
+
const containerStyles = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
13942
|
+
const errorClasses$2 = 'tw:border-sq-danger';
|
|
13943
|
+
const borderColorClasses$2 = ['tw:border-sq-disabled-gray', 'tw:dark:border-sq-dark-disabled-gray'].join(' ');
|
|
13944
|
+
const borderStyles$3 = ['tw:border-solid', 'tw:border'].join(' ');
|
|
13933
13945
|
const borderActiveClasses = [
|
|
13934
|
-
'hover:
|
|
13935
|
-
'focus-within:
|
|
13936
|
-
'active:
|
|
13937
|
-
'dark:hover:
|
|
13938
|
-
'dark:focus-within:
|
|
13939
|
-
'dark:active:
|
|
13946
|
+
'tw:hover:border-sq-theme-dark',
|
|
13947
|
+
'tw:focus-within:border-sq-theme-dark',
|
|
13948
|
+
'tw:active:border-sq-theme-dark',
|
|
13949
|
+
'tw:dark:hover:border-sq-theme-dark-dark',
|
|
13950
|
+
'tw:dark:focus-within:border-sq-theme-dark-dark',
|
|
13951
|
+
'tw:dark:active:border-sq-theme-dark-dark',
|
|
13940
13952
|
].join(' ');
|
|
13941
|
-
const textStyles = ['tw
|
|
13953
|
+
const textStyles = ['tw:text-sq-text-color', 'tw:dark:text-sq-dark-text', 'tw:text-sm'].join(' ');
|
|
13942
13954
|
const textActiveStyles = [
|
|
13943
|
-
'hover:
|
|
13944
|
-
'
|
|
13945
|
-
'
|
|
13955
|
+
'tw:hover:text-sq-theme-dark',
|
|
13956
|
+
'tw:focus:text-sq-theme-dark',
|
|
13957
|
+
'tw:active:text-sq-theme-dark',
|
|
13958
|
+
'tw:dark:text-sq-dark-disabled-gray',
|
|
13959
|
+
'tw:dark:hover:text-sq-theme-dark-dark',
|
|
13960
|
+
'tw:dark:focus:text-sq-theme-dark-dark',
|
|
13961
|
+
'tw:dark:active:text-sq-theme-dark-dark',
|
|
13962
|
+
'tw:hover:text-sq-theme-dark',
|
|
13963
|
+
'tw:dark:text-sq-dark-disabled-gray',
|
|
13964
|
+
'tw:dark:hover:text-sq-theme-dark-dark',
|
|
13946
13965
|
].join(' ');
|
|
13947
13966
|
const menuStyles = [
|
|
13948
|
-
'tw
|
|
13949
|
-
'tw
|
|
13950
|
-
'tw
|
|
13951
|
-
'tw
|
|
13952
|
-
'dark:
|
|
13953
|
-
'tw
|
|
13954
|
-
'tw
|
|
13955
|
-
'
|
|
13967
|
+
'tw:border-solid',
|
|
13968
|
+
'tw:border',
|
|
13969
|
+
'tw:rounded-b',
|
|
13970
|
+
'tw:border-sq-disabled-gray',
|
|
13971
|
+
'tw:dark:border-sq-dark-disabled-gray',
|
|
13972
|
+
'tw:whitespace-nowrap',
|
|
13973
|
+
'tw:min-w-fit',
|
|
13974
|
+
'tw:!z-[9999]',
|
|
13956
13975
|
].join(' ');
|
|
13957
13976
|
const menuListStyles = [
|
|
13958
|
-
'tw
|
|
13959
|
-
'tw
|
|
13960
|
-
'dark:
|
|
13961
|
-
'tw
|
|
13962
|
-
'
|
|
13977
|
+
'tw:rounded-b',
|
|
13978
|
+
'tw:bg-sq-white',
|
|
13979
|
+
'tw:dark:bg-sq-dark-background',
|
|
13980
|
+
'tw:min-w-fit',
|
|
13981
|
+
'tw:!z-[9999]',
|
|
13963
13982
|
'specSelectMenu',
|
|
13964
13983
|
].join(' ');
|
|
13965
13984
|
const groupHeadingStyles = [
|
|
13966
|
-
'tw
|
|
13967
|
-
'dark:
|
|
13968
|
-
'tw
|
|
13969
|
-
'tw
|
|
13970
|
-
'tw
|
|
13985
|
+
'tw:bg-sq-light-gray',
|
|
13986
|
+
'tw:dark:bg-sq-dark-disabled-gray',
|
|
13987
|
+
'tw:text-sq-darkish-gray',
|
|
13988
|
+
'tw:py-1',
|
|
13989
|
+
'tw:px-2.5',
|
|
13971
13990
|
'specSelectGroupHeading',
|
|
13972
13991
|
].join(' ');
|
|
13973
13992
|
const optionStyles = [
|
|
13974
|
-
'hover:
|
|
13975
|
-
'hover:
|
|
13976
|
-
'dark:hover:
|
|
13977
|
-
'tw
|
|
13978
|
-
'tw
|
|
13993
|
+
'tw:hover:bg-sq-gray-highlight',
|
|
13994
|
+
'tw:hover:cursor-pointer',
|
|
13995
|
+
'tw:dark:hover:bg-sq-gray-highlight-dark',
|
|
13996
|
+
'tw:py-1',
|
|
13997
|
+
'tw:px-2.5',
|
|
13979
13998
|
'specSelectOption',
|
|
13980
13999
|
].join(' ');
|
|
13981
|
-
const disabledClasses$3 = ['tw
|
|
13982
|
-
const dropDownIndicatorStyles = `tw
|
|
13983
|
-
const placeholderStyles = ['tw
|
|
14000
|
+
const disabledClasses$3 = ['tw:bg-sq-field-disabled-gray', 'tw:!cursor-not-allowed', 'tw:opacity-50'].join(' ');
|
|
14001
|
+
const dropDownIndicatorStyles = `tw:text-sq-disabled-gray ${textActiveStyles} specOpenIt`;
|
|
14002
|
+
const placeholderStyles = ['tw:text-gray-400', 'tw:dark:text-sq-dark-text-lighter', 'specOpenSelect'].join(' ');
|
|
13984
14003
|
const multiValueStyles = [
|
|
13985
|
-
'tw
|
|
13986
|
-
'dark:
|
|
13987
|
-
'tw
|
|
13988
|
-
'tw
|
|
13989
|
-
'tw
|
|
13990
|
-
'tw
|
|
13991
|
-
'tw
|
|
14004
|
+
'tw:bg-sq-disabled-gray',
|
|
14005
|
+
'tw:dark:bg-sq-multi-gray-dark',
|
|
14006
|
+
'tw:text-sm',
|
|
14007
|
+
'tw:py-0.5',
|
|
14008
|
+
'tw:px-1',
|
|
14009
|
+
'tw:m-0.5',
|
|
14010
|
+
'tw:rounded-sm',
|
|
13992
14011
|
'specOpenSelect',
|
|
13993
14012
|
].join(' ');
|
|
13994
14013
|
/**
|
|
@@ -14053,38 +14072,38 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
|
|
|
14053
14072
|
filterOption: filterOption ? filterOption : filterConfig ? createFilter(filterConfig) : undefined,
|
|
14054
14073
|
classNames: {
|
|
14055
14074
|
control: ({ menuIsOpen }) => {
|
|
14056
|
-
let border = menuIsOpen ? 'tw
|
|
14075
|
+
let border = menuIsOpen ? 'tw:rounded-t-md' : 'tw:rounded-md';
|
|
14057
14076
|
// if it's on the left side of the input group make sure the right side is straight and not curved
|
|
14058
14077
|
if (inputGroup === 'left') {
|
|
14059
|
-
border = menuIsOpen ? 'tw
|
|
14078
|
+
border = menuIsOpen ? 'tw:rounded-tl-md' : 'tw:rounded-l-md';
|
|
14060
14079
|
}
|
|
14061
14080
|
else if (inputGroup === 'right') {
|
|
14062
|
-
border = menuIsOpen ? 'tw
|
|
14081
|
+
border = menuIsOpen ? 'tw:rounded-tr-md' : 'tw:rounded-r-md';
|
|
14063
14082
|
}
|
|
14064
14083
|
const appliedClasses = `${borderStyles$3} ${isDisabled ? '' : borderActiveClasses} ${border} ${showError ? errorClasses$2 : borderColorClasses$2} ${small ? 'reactSelectMinHeightSmall' : 'reactSelectMinHeight'} ${controlClassNames}`;
|
|
14065
|
-
return `${appliedClasses} ${baseClasses$3} ${containerStyles} specSelectControl ${isDisabled ? disabledClasses$3 : ''} ${small ? 'tw
|
|
14084
|
+
return `${appliedClasses} ${baseClasses$3} ${containerStyles} specSelectControl ${isDisabled ? disabledClasses$3 : ''} ${small ? 'tw:pl-2 tw:pr-1' : 'tw:pl-2.5 tw:pr-1.5'}`;
|
|
14066
14085
|
},
|
|
14067
14086
|
placeholder: () => placeholderStyles,
|
|
14068
14087
|
container: ({ selectProps }) => {
|
|
14069
|
-
const containerBorderStyles = selectProps?.menuIsOpen ? 'tw
|
|
14070
|
-
return `${textStyles} ${extraClassNames} ${containerBorderStyles}
|
|
14088
|
+
const containerBorderStyles = selectProps?.menuIsOpen ? 'tw:rounded-t-md' : 'tw:rounded-md';
|
|
14089
|
+
return `${textStyles} ${extraClassNames} ${containerBorderStyles} tw:!pointer-events-auto`;
|
|
14071
14090
|
},
|
|
14072
14091
|
input: () => textStyles + ' specSelectInput',
|
|
14073
14092
|
menuList: () => menuListStyles,
|
|
14074
14093
|
menu: () => menuStyles,
|
|
14075
|
-
menuPortal: () => '
|
|
14094
|
+
menuPortal: () => 'tw:!z-[9000]',
|
|
14076
14095
|
dropdownIndicator: () => dropDownIndicatorStyles,
|
|
14077
14096
|
option: ({ isSelected, isDisabled }) => {
|
|
14078
14097
|
let classes = optionStyles;
|
|
14079
14098
|
if (isDisabled) {
|
|
14080
14099
|
classes += ' specDisabledOption ';
|
|
14081
14100
|
}
|
|
14082
|
-
return isSelected ? classes + ' tw
|
|
14101
|
+
return isSelected ? classes + ' tw:bg-sq-colored-hover tw:dark:bg-sq-colored-hover-dark' : classes;
|
|
14083
14102
|
},
|
|
14084
14103
|
singleValue: () => 'specOpenSelect',
|
|
14085
14104
|
multiValue: () => multiValueStyles,
|
|
14086
|
-
multiValueRemove: () => 'hover:
|
|
14087
|
-
clearIndicator: () => 'tw
|
|
14105
|
+
multiValueRemove: () => 'tw:hover:text-sq-danger specSelectMultiValueRemove',
|
|
14106
|
+
clearIndicator: () => 'tw:text-sq-disabled-gray tw:hover:text-sq-danger specClearSelect',
|
|
14088
14107
|
group: () => 'specSelectGroup',
|
|
14089
14108
|
groupHeading: () => groupHeadingStyles,
|
|
14090
14109
|
},
|
|
@@ -14474,11 +14493,11 @@ var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
|
14474
14493
|
const Dialog = Root$4;
|
|
14475
14494
|
const DialogPortal = Portal$1;
|
|
14476
14495
|
const DialogClose = Close;
|
|
14477
|
-
const DialogContent = React__default.forwardRef(({ className, children, ...props }, ref) => (jsxs(DialogPortal, { children: [jsx$1("div", { className: "tw
|
|
14478
|
-
tw
|
|
14479
|
-
tw
|
|
14496
|
+
const DialogContent = React__default.forwardRef(({ className, children, ...props }, ref) => (jsxs(DialogPortal, { children: [jsx$1("div", { className: "tw:select-none tw:fixed tw:w-full tw:h-full tw:opacity-50 tw:inset-0 tw:z-[1009] tw:bg-sq-dark-background\n tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out tw:data-[state=closed]:fade-out-0\n tw:data-[state=open]:fade-in-0 " }), jsxs(Content$2, { ref: ref, className: `tw:fixed tw:left-[50%] tw:top-0 tw:my-6 tw:translate-x-[-50%] tw:z-[1010] tw:grid
|
|
14497
|
+
tw:gap-4 tw:border tw:bg-sq-white tw:dark:bg-sq-dark-background tw:shadow-lg tw:duration-200
|
|
14498
|
+
tw:rounded-lg ${className}`, ...props, children: [jsx$1(DialogTitle$1, { className: "tw:hidden" }), children] })] })));
|
|
14480
14499
|
DialogContent.displayName = Content$2.displayName;
|
|
14481
|
-
const DialogHeader = (props) => (jsx$1("div", { className: "tw
|
|
14500
|
+
const DialogHeader = (props) => (jsx$1("div", { className: "tw:w-full tw:justify-between", children: jsx$1("div", { ...props }) }));
|
|
14482
14501
|
DialogHeader.displayName = 'DialogHeader';
|
|
14483
14502
|
const DialogFooter = (props) => jsx$1("div", { ...props });
|
|
14484
14503
|
DialogFooter.displayName = 'DialogFooter';
|
|
@@ -14516,26 +14535,26 @@ const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, sub
|
|
|
14516
14535
|
let titleIconElement = jsx$1(Fragment, {});
|
|
14517
14536
|
if (titleIcon) {
|
|
14518
14537
|
if (typeof titleIcon === 'string') {
|
|
14519
|
-
titleIconElement = (jsx$1(Icon, { icon: titleIcon, testId: "modalTitleIcon", extraClassNames: "tw
|
|
14538
|
+
titleIconElement = (jsx$1(Icon, { icon: titleIcon, testId: "modalTitleIcon", extraClassNames: "tw:flex tw:text-xl tw:mt-1" }));
|
|
14520
14539
|
}
|
|
14521
14540
|
else {
|
|
14522
|
-
titleIconElement = jsx$1("div", { className: "tw
|
|
14541
|
+
titleIconElement = jsx$1("div", { className: "tw:mt-1.5", children: titleIcon });
|
|
14523
14542
|
}
|
|
14524
14543
|
}
|
|
14525
|
-
return (jsxs(Fragment, { children: [titleIcon && titleIconPosition === 'left' ? jsx$1("div", { className: "tw
|
|
14544
|
+
return (jsxs(Fragment, { children: [titleIcon && titleIconPosition === 'left' ? jsx$1("div", { className: "tw:flex tw:mr-2", children: titleIconElement }) : jsx$1(Fragment, {}), jsx$1(DialogTitle, { asChild: true, children: isTitleEditable ? (jsxs("div", { className: "tw:flex tw:w-full tw:items-center", children: [jsx$1(TextField, { extraClassNames: inputExtraClassNames, value: title, type: "text", testId: "modalTitle", onChange: onTitleChanged, placeholder: titlePlaceholder, required: titleRequired, showError: !!titleError }), titleError && jsx$1("p", { className: "tw:text-sq-danger tw:min-w-fit tw:pl-2 tw:mb-0", children: titleError })] })) : (customHeader ?? (jsxs("div", { "data-testid": "modalTitle", className: "modal-title", children: [jsxs("div", { className: "tw:flex tw:items-center", children: [jsx$1("h3", { children: title }), titleSuffixLabel && jsx$1("span", { className: "tw:text-xl tw:pl-0.5", children: titleSuffixLabel })] }), subtitle && (jsx$1("div", { className: "tw:italic tw:text-sm tw:text-left tw:mt-1", "data-testid": "modal-subtitle", children: subtitle }))] }))) }), titleIcon && titleIconPosition === 'right' ? jsx$1("div", { className: "tw:flex tw:ml-4", children: titleIconElement }) : jsx$1(Fragment, {})] }));
|
|
14526
14545
|
};
|
|
14527
|
-
return open ? (jsx$1(Dialog, { open: true, onOpenChange: onClose, modal: keepFocusInsideModal, children: jsxs(DialogContent, { onPointerDownOutside: (e) => (onPointerDownOutside ? onPointerDownOutside(e) : e.preventDefault()), onInteractOutside: (e) => (onInteractOutside ? onInteractOutside(e) : e.preventDefault()), "data-testid": testId, className: classNames(`modalContent tw
|
|
14528
|
-
'tw
|
|
14529
|
-
'tw
|
|
14530
|
-
'tw
|
|
14531
|
-
'tw
|
|
14532
|
-
'tw
|
|
14533
|
-
'tw
|
|
14534
|
-
'tw
|
|
14535
|
-
'tw
|
|
14536
|
-
'tw
|
|
14537
|
-
'tw
|
|
14538
|
-
}, dialogClassName), children: [jsxs(DialogHeader, { className: "modal-header tw
|
|
14546
|
+
return open ? (jsx$1(Dialog, { open: true, onOpenChange: onClose, modal: keepFocusInsideModal, children: jsxs(DialogContent, { onPointerDownOutside: (e) => (onPointerDownOutside ? onPointerDownOutside(e) : e.preventDefault()), onInteractOutside: (e) => (onInteractOutside ? onInteractOutside(e) : e.preventDefault()), "data-testid": testId, className: classNames(`modalContent tw:w-full tw:border-none tw:shadow-none tw:dark:text-sq-dark-text tw:!gap-0`, {
|
|
14547
|
+
'tw:max-w-xs': size === 'xs',
|
|
14548
|
+
'tw:max-w-sm': size === 'sm',
|
|
14549
|
+
'tw:max-w-md': size === 'md',
|
|
14550
|
+
'tw:max-w-lg': size === 'lg',
|
|
14551
|
+
'tw:max-w-xl': size === 'xl',
|
|
14552
|
+
'tw:max-w-2xl': size === '2xl',
|
|
14553
|
+
'tw:max-w-3xl': size === '3xl',
|
|
14554
|
+
'tw:max-w-4xl': size === '4xl',
|
|
14555
|
+
'tw:max-w-5xl': size === '5xl',
|
|
14556
|
+
'tw:max-w-6xl': size === '6xl',
|
|
14557
|
+
}, dialogClassName), children: [jsxs(DialogHeader, { className: "modal-header tw:flex tw:w-full tw:justify-between tw:border-sq-disabled-gray\n tw:dark:border-sq-dark-disabled-gray tw:border-0 tw:border-b tw:px-6 tw:py-4", children: [jsx$1("div", { className: "tw:flex tw:w-full", children: renderTitle() }), !hideCloseIcon && (jsx$1(DialogClose, { autoFocus: false, className: "tw:[&:has(:focus-visible)]:none tw:opacity-70 tw:bg-transparent tw:hover:opacity-100 close tw:text-base tw:cursor-pointer tw:ml-4", "data-testid": "closeButton", children: jsx$1("span", { className: "tw:cursor-pointer", children: "\u00D7" }) }))] }), jsx$1(DialogDescription, { className: "modal-body tw:px-6 tw:py-4 tw:overflow-y-auto", asChild: true, children: children }), !hideFooterButtons && (jsx$1(DialogFooter, { className: "modal-footer tw:px-6 tw:py-4", children: modalFooter ?? (jsxs("div", { className: "tw:flex tw:w-full tw:justify-between", "data-testid": "modalFooter", children: [jsx$1("div", { className: "tw:flex tw:justify-start", children: customButton && (jsx$1(Button, { label: customButtonLabel, onClick: onClickCustomButton, disabled: disableCustomButton, extraClassNames: "tw:justify-start tw:min-w-25", testId: "customButton", variant: customButtonVariant })) }), jsxs("div", { className: "tw:flex tw:justify-end", children: [jsx$1("div", { className: "tw:flex tw:items-center", children: middleFooterSection }), !hideCancelButton && (jsx$1(DialogClose, { asChild: true, children: jsx$1(Button, { label: cancelButtonLabel, extraClassNames: "tw:mr-5 tw:min-w-25", tooltip: cancelButtonTooltip, variant: "outline", stopPropagation: false, testId: "cancelButton" }) })), !hideSubmitButton && (jsx$1(Button, { label: submitButtonLabel, onClick: handleSubmit, disabled: disableSubmitButton || isLoading, variant: submitButtonVariant, stopPropagation: stopPropagationSubmitButton, tooltip: submitButtonTooltip, icon: isLoading ? 'fc-loading-notch tw:animate-spin' : undefined, iconPosition: "left", testId: "submitButton", extraClassNames: "tw:min-w-25" }))] })] })) }))] }) })) : (jsx$1(Fragment, {}));
|
|
14539
14558
|
};
|
|
14540
14559
|
|
|
14541
14560
|
function createCollection(name) {
|
|
@@ -14993,11 +15012,11 @@ const Tabs = ({ tabs, defaultActiveTab, activeTab, onTabSelect, extraClassNames,
|
|
|
14993
15012
|
return;
|
|
14994
15013
|
onTabSelect && onTabSelect(tabId);
|
|
14995
15014
|
};
|
|
14996
|
-
return (jsxs(Root2$2, { className: `tw
|
|
14997
|
-
? 'tw
|
|
14998
|
-
: 'hover:
|
|
14999
|
-
? 'dark:
|
|
15000
|
-
: 'dark:
|
|
15015
|
+
return (jsxs(Root2$2, { className: `tw:flex tw:flex-col tw:min-w-75 tw:max-w-full tw:flex-grow tw:focus-visible:outline-none ${extraClassNames || ''}`, defaultValue: defaultActiveTab, "data-testid": testId, id: id, value: activeTab, onValueChange: handleTabSelect, children: [jsx$1(List, { className: `tw:flex tw:flex-row tw:flex-wrap tw:z-[1001]`, children: tabs.map(({ id, icon, label, tabExtraClassNames, testId: tabsTestId, disabled, tabLabelExtraClassNames = '' }, index) => (jsx$1(Trigger$2, { className: `tw:bg-sq-white tw:dark:bg-sq-dark-background tw:h-sq-25 tw:focus-visible:outline-none tw:min-w-25 tw:px-4 tw:border-solid tw:flex tw:flex-1 tw:justify-center tw:items-center tw:border-r-[2px] tw:last:border-r-0 tw:border-sq-overlay tw:dark:border-gray-700 ${stretchTabs ? '' : 'tw:max-w-max tw:min-w-fit'} ${tabExtraClassNames || ''} ${activeTab === id
|
|
15016
|
+
? 'tw:border-b-sq-theme-darker tw:dark:border-b-sq-theme-darker tw:border-b-[0.1875rem]'
|
|
15017
|
+
: 'tw:hover:bg-sq-light-gray tw:border-b-[0.0625rem] tw:hover:dark:bg-gray-700'}`, "data-testid": tabsTestId, disabled: disabled, value: id, children: jsxs("span", { className: "tw:flex tw:items-center tw:overflow-hidden", children: [icon && (jsx$1(Icon, { icon: icon, testId: `${id}_tab-icon`, extraClassNames: "tw:text-sq-15 tw:mr-sq-7 tw:flex-shrink-0" })), jsx$1("span", { className: `tw:text-sq-13 tw:font-medium tw:whitespace-nowrap tw:overflow-hidden tw:text-ellipsis ${activeTab === id
|
|
15018
|
+
? 'tw:dark:text-sq-dark-text tw:text-gray-500'
|
|
15019
|
+
: 'tw:dark:text-sq-theme-darker tw:text-sq-theme-dark'} ${tabLabelExtraClassNames}`, children: label })] }) }, `${label}-${id}-${index}`))) }), tabs.map((tab, index) => (jsx$1(Content$1, { className: `tw:bg-sq-white tw:dark:bg-sq-dark-background tw:overflow-y-auto tw:-mt-sq-1 tw:border-t-[0.0625rem] tw:border-t-sq-overlay tw:dark:border-t-gray-700 tw:z-[500] tw:flex tw:flex-col tw:flex-grow tw:focus-visible:outline-none ${tab.tabContentExtraClassNames || ''}`, value: tab.id, children: tab.content }, `${tab.label}_${index}_content`)))] }));
|
|
15001
15020
|
};
|
|
15002
15021
|
|
|
15003
15022
|
var COLLAPSIBLE_NAME = "Collapsible";
|
|
@@ -15422,18 +15441,18 @@ var Trigger2 = AccordionTrigger;
|
|
|
15422
15441
|
var Content2$2 = AccordionContent;
|
|
15423
15442
|
|
|
15424
15443
|
const Accordion = ({ accordionItems, defaultValue, value, onItemSelect, disabled, extraClassNames, testId, }) => {
|
|
15425
|
-
return (jsx$1(Root2$1, { className: `tw
|
|
15444
|
+
return (jsx$1(Root2$1, { className: `tw:rounded-md tw:w-full tw:focus-visible:outline-none ${extraClassNames || ''}`, type: "single", defaultValue: defaultValue, value: value, collapsible: true, "data-testid": testId, onValueChange: (_value) => onItemSelect(_value), children: accordionItems.map((item) => (jsxs(Item, { className: `tw:p-0 tw:flex tw:flex-col tw:w-full`, disabled: disabled, value: item.value, children: [jsx$1(Trigger2, { disabled: disabled, className: `tw:w-full tw:cursor-default tw:focus-visible:outline-none tw:bg-transparent`, children: item.trigger }), jsx$1(Content2$2, { className: `tw:data-[state=open]:animate-slideDown tw:data-[state=closed]:animate-slideUp tw:overflow-hidden tw:focus-visible:outline-none ${item.contentClassNames || ''}`, children: item.content })] }, item.value))) }));
|
|
15426
15445
|
};
|
|
15427
15446
|
|
|
15428
|
-
const bgStyles$2 = ['tw
|
|
15447
|
+
const bgStyles$2 = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
15429
15448
|
const borderStyles$2 = [
|
|
15430
|
-
'tw
|
|
15431
|
-
'tw
|
|
15432
|
-
'tw
|
|
15433
|
-
'tw
|
|
15434
|
-
'dark:
|
|
15449
|
+
'tw:border-solid',
|
|
15450
|
+
'tw:border',
|
|
15451
|
+
'tw:rounded-[0.5rem]',
|
|
15452
|
+
'tw:border-sq-disabled-gray',
|
|
15453
|
+
'tw:dark:border-gray-500',
|
|
15435
15454
|
].join(' ');
|
|
15436
|
-
const disabledClasses$2 = ['tw
|
|
15455
|
+
const disabledClasses$2 = ['tw:opacity-50', 'tw:cursor-not-allowed'].join(' ');
|
|
15437
15456
|
const ButtonWithPopover = ({ children, trigger, id, hasArrow, extraTriggerClassNames, extraPopoverClassNames, containerTestId, onInteractOutside, onPointerDownOutside, isTriggerAsChild = false, shouldTriggerFullWidth = false, disabled = false, align = 'end', alignOffset = -35, placement = 'bottom', placementOffset = 2, isHoverEnabled = false, hoverOpenDelay = 300, onOpenChange, isOpen, isCloseOnContentClick = false, isPortal = false, ...tooltipProps }) => {
|
|
15438
15457
|
const tooltipData = getQTipData(tooltipProps);
|
|
15439
15458
|
const timeout = useRef(null);
|
|
@@ -15464,12 +15483,12 @@ const ButtonWithPopover = ({ children, trigger, id, hasArrow, extraTriggerClassN
|
|
|
15464
15483
|
};
|
|
15465
15484
|
React.useEffect(() => clearHoverTimeout, []);
|
|
15466
15485
|
const renderContent = () => {
|
|
15467
|
-
return (jsx$1(Content2$3, { sideOffset: placementOffset, align: align, side: placement, onInteractOutside: onInteractOutside, onPointerDownOutside: onPointerDownOutside, alignOffset: isHoverEnabled ? -10 : alignOffset, asChild: true, onClick: () => isCloseOnContentClick && onOpenChange && onOpenChange(false), className: "focus-visible:
|
|
15468
|
-
data-[side=top]:
|
|
15469
|
-
${extraPopoverClassNames || ''}`, children: [hasArrow && (jsx$1(Arrow2$2, { asChild: true, children: jsx$1("div", { className: "tw
|
|
15486
|
+
return (jsx$1(Content2$3, { sideOffset: placementOffset, align: align, side: placement, onInteractOutside: onInteractOutside, onPointerDownOutside: onPointerDownOutside, alignOffset: isHoverEnabled ? -10 : alignOffset, asChild: true, onClick: () => isCloseOnContentClick && onOpenChange && onOpenChange(false), className: "tw:focus-visible:outline-none tw:outline-none tw:w-full tw:h-full", children: jsxs("div", { "data-testid": containerTestId, className: `${bgStyles$2} ${borderStyles$2} tw:relative tw:z-[1200] tw:min-w-6 tw:focus-visible:outline-none tw:outline-none tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out
|
|
15487
|
+
tw:data-[side=top]:animate-slideDownAndFade tw:data-[side=right]:animate-slideLeftAndFade tw:data-[side=bottom]:animate-slideUpAndFade tw:data-[side=left]:animate-slideRightAndFade tw:text-sq-text-color
|
|
15488
|
+
${extraPopoverClassNames || ''}`, children: [hasArrow && (jsx$1(Arrow2$2, { asChild: true, children: jsx$1("div", { className: "tw:fill-transparent tw:bg-sq-white tw:w-sq-15 tw:h-sq-15 tw:-mt-sq-7 tw:rotate-45 tw:dark:bg-sq-dark-background tw:border-b tw:border-r tw:border-sq-disabled-gray tw:dark:border-gray-500" }) })), children] }) }));
|
|
15470
15489
|
};
|
|
15471
15490
|
const renderPopover = (popoverOpenState) => {
|
|
15472
|
-
return (jsxs(Root2$3, { open: popoverOpenState, defaultOpen: false, onOpenChange: onOpenChange, children: [trigger ? (jsx$1(Trigger$3, { id: id, asChild: isTriggerAsChild, className: `focus-visible:
|
|
15491
|
+
return (jsxs(Root2$3, { open: popoverOpenState, defaultOpen: false, onOpenChange: onOpenChange, children: [trigger ? (jsx$1(Trigger$3, { id: id, asChild: isTriggerAsChild, className: `tw:focus-visible:outline-none tw:outline-none tw:bg-transparent ${shouldTriggerFullWidth ? 'tw:w-full tw:h-full' : ''}`, disabled: disabled, children: jsx$1("div", { ...tooltipData, onMouseOver: onHoverStart, onMouseOut: onHoverEnd, className: `tw:focus-visible:outline-none tw:outline-none tw:dark:text-sq-white ${disabled ? disabledClasses$2 : ''} ${shouldTriggerFullWidth ? 'tw:flex tw:flex-col tw:items-center tw:justify-center' : 'tw:inline'} ${extraTriggerClassNames || ''}`, children: trigger }) })) : (jsx$1(Trigger$3, { asChild: true, children: jsx$1("div", {}) })), isPortal ? jsx$1(Portal$2, { children: renderContent() }) : renderContent()] }));
|
|
15473
15492
|
};
|
|
15474
15493
|
return isHoverEnabled ? renderPopover(isHoveredOpen) : renderPopover(isOpen);
|
|
15475
15494
|
};
|
|
@@ -16534,65 +16553,65 @@ var SubTrigger2 = DropdownMenuSubTrigger;
|
|
|
16534
16553
|
var SubContent2 = DropdownMenuSubContent;
|
|
16535
16554
|
|
|
16536
16555
|
const borderStyles$1 = [
|
|
16537
|
-
'tw
|
|
16538
|
-
'tw
|
|
16539
|
-
'tw
|
|
16540
|
-
'tw
|
|
16541
|
-
'dark:
|
|
16556
|
+
'tw:border-solid',
|
|
16557
|
+
'tw:border',
|
|
16558
|
+
'tw:rounded-[0.5rem]',
|
|
16559
|
+
'tw:border-sq-disabled-gray',
|
|
16560
|
+
'tw:dark:border-gray-500',
|
|
16542
16561
|
].join(' ');
|
|
16543
|
-
const bgStyles$1 = ['tw
|
|
16544
|
-
const disabledClasses$1 = ['tw
|
|
16562
|
+
const bgStyles$1 = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
16563
|
+
const disabledClasses$1 = ['tw:opacity-50', 'tw:cursor-not-allowed'].join(' ');
|
|
16545
16564
|
const ButtonWithDropdown = ({ dropdownItems, triggerIcon, id, extraClassNames = '', contentExtraClassNames = '', containerTestId, disabled = false, align = 'end', placement = 'bottom', placementOffset = 5, alignOffset = -35, hasArrow = false, onOpenChange, isOpen, setFocusOnTriggerOnClose = true, keepFocusInsideDropdown = true, onContainerClick, ...tooltipProps }) => {
|
|
16546
16565
|
const tooltipData = getQTipData(tooltipProps);
|
|
16547
|
-
return (jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [jsx$1(Trigger, { id: id, className: `tw-border-none focus-visible:
|
|
16566
|
+
return (jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [jsx$1(Trigger, { id: id, className: `tw:bg-transparent tw:border-none tw:focus-visible:outline-none tw:focus:outline-none tw:focus-within:outline-none`, disabled: disabled, children: jsx$1("div", { ...tooltipData, className: `tw:bg-transparent tw:flex tw:flex-col tw:items-center tw:focus-visible:outline-none tw:focus:outline-none tw:focus-within:outline-none ${disabled ? disabledClasses$1 : ''} ${extraClassNames}`, children: triggerIcon }) }), jsx$1(Portal2, { children: jsx$1(Content2, { onClick: onContainerClick, sideOffset: placementOffset, side: placement, align: align, alignOffset: alignOffset, asChild: true, onCloseAutoFocus: (e) => !setFocusOnTriggerOnClose && e.preventDefault(), className: "tw:focus-visible:outline-none tw:outline-none", children: jsxs("div", { "data-testid": containerTestId, className: `${bgStyles$1} tw:relative tw:z-[1200] tw:min-w-6 tw:py-2 tw:focus-visible:outline-none tw:outline-none tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out forceFont tw:data-[side=top]:animate-slideDownAndFade tw:data-[side=right]:animate-slideLeftAndFade tw:data-[side=bottom]:animate-slideUpAndFade tw:data-[side=left]:animate-slideRightAndFade ${borderStyles$1} ${contentExtraClassNames}`, children: [hasArrow && (jsx$1(Arrow2, { asChild: true, children: jsx$1("div", { className: "tw:fill-transparent tw:bg-sq-white tw:w-sq-15 tw:h-sq-15 tw:rotate-45 tw:dark:bg-sq-dark-background tw:border-b tw:border-r tw:border-sq-disabled-gray tw:dark:border-gray-500 tw:-mt-sq-7" }) })), dropdownItems.map((item, index) => {
|
|
16548
16567
|
const tooltipData = getQTipData(item);
|
|
16549
16568
|
if (item.isLabel) {
|
|
16550
|
-
return (jsxs(Label2, { className: item.itemExtraClassNames, ...tooltipData, children: [item.icon && (jsx$1(Icon, { icon: item.icon, testId: item.iconTestId, type: "text", color: item.iconColor, extraClassNames: "tw
|
|
16569
|
+
return (jsxs(Label2, { className: item.itemExtraClassNames, ...tooltipData, children: [item.icon && (jsx$1(Icon, { icon: item.icon, testId: item.iconTestId, type: "text", color: item.iconColor, extraClassNames: "tw:text-sq-text-color tw:dark:text-sq-white tw:w-4.5" })), jsx$1("div", { "data-testid": item.labelTestId, className: `tw:text-sq-13 tw:ml-1 ${item.disabled ? 'tw:text-sq-disabled-gray' : 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses}`, children: item.label })] }, (item.id || '') + index));
|
|
16551
16570
|
}
|
|
16552
16571
|
if (Array.isArray(item.subMenuItems) && item.subMenuItems.length > 0) {
|
|
16553
|
-
return (jsxs(Sub2, { children: [jsxs(SubTrigger2, { id: id, className: `tw
|
|
16554
|
-
? '
|
|
16555
|
-
: 'tw
|
|
16556
|
-
return (jsxs(Item2, { onSelect: subItem.onClick, "data-qtip-text": subItem.tooltip, className: "tw
|
|
16557
|
-
? 'tw
|
|
16558
|
-
: 'tw
|
|
16572
|
+
return (jsxs(Sub2, { children: [jsxs(SubTrigger2, { id: id, className: `tw:cursor-pointer tw:flex tw:justify-between tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:h-sq-27 tw:pl-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none ${item.itemExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled, ...tooltipData, children: [jsxs("div", { className: "tw:flex", children: [item.icon && (jsx$1(Icon, { icon: item.icon, extraClassNames: `tw:w-4.5 ${item.disabled
|
|
16573
|
+
? 'tw:!text-sq-disabled-gray'
|
|
16574
|
+
: 'tw:text-sq-text-color tw:dark:text-sq-white'} ${item.iconExtraClassNames || ''}` })), jsx$1("div", { "data-testid": item.labelTestId, "data-customid": item.labelCustomId, className: `tw:text-sq-13 tw:ml-1 ${item.disabled && 'tw:!opacity-30'} tw:not-italic tw:font-semibold ${item.labelClasses}`, children: item.label })] }), jsx$1(Icon, { size: "sm", icon: "fc-arrow-dropdown tw:rotate-270", extraClassNames: `${item.disabled ? 'tw:text-sq-disabled-gray' : 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:w-4.5 tw:ml-4 tw:text-2 tw:justify-center tw:flex` })] }), jsx$1(Portal2, { children: jsx$1(SubContent2, { className: "tw:focus-visible:outline-none tw:outline-none", children: jsx$1("div", { "data-testid": containerTestId, className: `${bgStyles$1} tw:relative tw:z-[1000] tw:min-w-6 tw:py-2 tw:focus-visible:outline-none tw:outline-none tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out forceFont tw:data-[side=top]:animate-slideDownAndFade tw:data-[side=right]:animate-slideLeftAndFade tw:data-[side=bottom]:animate-slideUpAndFade tw:data-[side=left]:animate-slideRightAndFade ${borderStyles$1}`, children: item.subMenuItems.map((subItem, subIndex) => {
|
|
16575
|
+
return (jsxs(Item2, { onSelect: subItem.onClick, "data-qtip-text": subItem.tooltip, className: "tw:cursor-pointer tw:flex tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:h-sq-27 tw:px-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none", disabled: subItem.disabled, children: [subItem.iconClass && (jsx$1(Icon, { icon: subItem.iconClass, type: "text", extraClassNames: `tw:w-4.5 ${item.disabled && 'tw:!opacity-30'}` })), jsx$1("div", { className: `tw:text-sq-13 tw:ml-1 ${subItem.disabled
|
|
16576
|
+
? 'tw:text-sq-disabled-gray'
|
|
16577
|
+
: 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses}`, children: subItem.label })] }, subItem.label + subIndex));
|
|
16559
16578
|
}) }) }) })] }, (item.id || item.icon || '') + index));
|
|
16560
16579
|
}
|
|
16561
16580
|
return (jsxs("div", { ...tooltipData, children: [jsxs(Item2, { "data-customid": item.itemCustomId, onSelect: (e) => {
|
|
16562
16581
|
item.onClick(e);
|
|
16563
|
-
}, className: `tw
|
|
16582
|
+
}, className: `tw:cursor-pointer tw:flex tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:leading-none tw:items-center tw:min-h-sq-27 tw:px-sq-19 tw:relative tw:select-none tw:outline-none tw:data-disabled:pointer-events-none ${item.itemExtraClassNames || ''}`, "data-testid": item.testId, disabled: item.disabled, children: [item.icon && (jsx$1(Icon, { icon: item.icon, testId: item.iconTestId, type: (item.iconType || 'text'), color: item.iconColor, customId: item.iconCustomId, extraClassNames: `tw:w-sq-4.5 ${item.disabled && 'tw:!opacity-30'} ${item.iconExtraClassNames || ''}` })), jsx$1("div", { "data-testid": item.labelTestId, "data-customid": item.labelCustomId, className: `tw:text-sq-13 tw:ml-1 ${item.disabled ? 'tw:text-sq-disabled-gray' : 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses || ''}`, children: item.label })] }, (item.id || item.icon || '') + index), item.hasDivider && (jsx$1(Separator2, { "data-testid": `dropdown-divider-${index}`, className: "tw:h-px tw:bg-sq-disabled-gray tw:dark:bg-gray-500 tw:my-2" }))] }, (item.id || '') + index));
|
|
16564
16583
|
})] }) }) })] }));
|
|
16565
16584
|
};
|
|
16566
16585
|
|
|
16567
|
-
const baseClasses$2 = 'tw
|
|
16568
|
-
' tw
|
|
16569
|
-
const darkTheme$1 = 'dark:
|
|
16570
|
-
const lightTheme$1 = 'tw
|
|
16571
|
-
const errorClasses$1 = 'tw
|
|
16572
|
-
const borderColorClasses$1 = 'tw
|
|
16586
|
+
const baseClasses$2 = 'tw:mx-auto tw:leading-normal tw:outline-none tw:py-2 tw:px-3 tw:rounded-[10px] tw:w-full tw:relative' +
|
|
16587
|
+
' tw:border-solid tw:border tw:text-sm tw:flex tw:flex-col tw:justify-center tw:items-center';
|
|
16588
|
+
const darkTheme$1 = 'tw:dark:bg-sq-theme-hover-dark tw:dark:text-sq-text-color-dark';
|
|
16589
|
+
const lightTheme$1 = 'tw:text-sq-text-color tw:bg-sq-theme-highlight/10';
|
|
16590
|
+
const errorClasses$1 = 'tw:border-sq-danger';
|
|
16591
|
+
const borderColorClasses$1 = 'tw:border-sq-theme-dark';
|
|
16573
16592
|
/**
|
|
16574
16593
|
* Alert.
|
|
16575
16594
|
*/
|
|
16576
16595
|
const Alert = ({ children, dismissible = true, onClose, show = true, variant, testId = 'alert-id', id, extraClassNames, ...tooltipProps }) => {
|
|
16577
16596
|
const appliedTheme = {
|
|
16578
16597
|
theme: `${lightTheme$1} ${darkTheme$1}`,
|
|
16579
|
-
formulaError: 'tw
|
|
16580
|
-
danger: 'tw
|
|
16581
|
-
warning: 'tw
|
|
16582
|
-
gray: 'tw
|
|
16598
|
+
formulaError: 'tw:text-red-800 tw:bg-red-200 tw:!rounded-[0.25rem]',
|
|
16599
|
+
danger: 'tw:text-sq-text-color tw:bg-sq-danger',
|
|
16600
|
+
warning: 'tw:bg-sq-bg-warning tw:text-sq-text-color',
|
|
16601
|
+
gray: 'tw:bg-sq-hover-gray tw:text-sq-text-color tw:dark:bg-sq-tools-background-dark tw:dark:text-sq-text-color-dark',
|
|
16583
16602
|
};
|
|
16584
16603
|
const appliedBorderTheme = {
|
|
16585
16604
|
theme: borderColorClasses$1,
|
|
16586
16605
|
danger: errorClasses$1,
|
|
16587
|
-
warning: 'tw
|
|
16588
|
-
gray: 'tw
|
|
16589
|
-
formulaError: 'tw
|
|
16606
|
+
warning: 'tw:border-none',
|
|
16607
|
+
gray: 'tw:border-sq-darkish-gray',
|
|
16608
|
+
formulaError: 'tw:border-red-100',
|
|
16590
16609
|
};
|
|
16591
16610
|
const appliedClasses = `${baseClasses$2} ${appliedTheme[variant]} ${extraClassNames} ${appliedBorderTheme[variant]}`;
|
|
16592
16611
|
if (!show) {
|
|
16593
16612
|
return jsx$1("div", {});
|
|
16594
16613
|
}
|
|
16595
|
-
return (jsxs("div", { "data-testid": testId, id: id, className: appliedClasses, children: [children, dismissible && (jsx$1(Icon, { icon: "fc-delete", type: variant.match(/danger|warning|formulaError/) ? 'color' : 'theme', color: variant.match(/danger|warning|formulaError/) ? 'inherit' : undefined, extraClassNames: `tw
|
|
16614
|
+
return (jsxs("div", { "data-testid": testId, id: id, className: appliedClasses, children: [children, dismissible && (jsx$1(Icon, { icon: "fc-delete", type: variant.match(/danger|warning|formulaError/) ? 'color' : 'theme', color: variant.match(/danger|warning|formulaError/) ? 'inherit' : undefined, extraClassNames: `tw:self-end tw:text-size-11 tw:cursor-pointer tw:absolute tw:right-2.5 tw:top-2.5 ${variant.match(/danger|warning|gray|formulaError/) ? 'tw:text-sq-text-color tw:dark:text-sq-dark-text' : ''}`, testId: `${testId}-close-btn`, onClick: onClose, ...tooltipProps }))] }));
|
|
16596
16615
|
};
|
|
16597
16616
|
|
|
16598
16617
|
/**
|
|
@@ -16611,47 +16630,40 @@ const Alert = ({ children, dismissible = true, onClose, show = true, variant, te
|
|
|
16611
16630
|
* @param tooltipProps - props to pass to the tooltip
|
|
16612
16631
|
*/
|
|
16613
16632
|
const SvgIcon = ({ onClick, icon, color, type = 'default', extraClassNames, viewBox = '0 0 19 19', id, testId, customId, ...tooltipProps }) => {
|
|
16614
|
-
const appliedClassNames = `${onClick ? 'tw
|
|
16615
|
-
tw
|
|
16633
|
+
const appliedClassNames = `${onClick ? 'tw:cursor-pointer' : ''} ${extraClassNames} tw:focus:outline-none tw:focus-visible:outline-none
|
|
16634
|
+
tw:outline-none`;
|
|
16616
16635
|
const tooltipData = getQTipData(tooltipProps);
|
|
16617
16636
|
const appliedType = type === 'default' ? 'currentColor' : 'rgb(var(--sq-icon))';
|
|
16618
|
-
return (jsx$1("div", { onClick: onClick, ...tooltipData, className: `svgContainer ${appliedClassNames}`, children: jsx$1("svg", { xmlns: "http://www.w3.org/2000/svg", className: `tw
|
|
16637
|
+
return (jsx$1("div", { onClick: onClick, ...tooltipData, className: `svgContainer ${appliedClassNames}`, children: jsx$1("svg", { xmlns: "http://www.w3.org/2000/svg", className: `tw:sq-icon tw:dark:text-sq-white`, viewBox: viewBox, fill: color ? color : appliedType, "data-testid": testId, children: jsx$1("path", { d: getSvgIconPath(icon) }) }) }));
|
|
16619
16638
|
};
|
|
16620
16639
|
|
|
16621
16640
|
const SeeqActionDropdownItem = (item) => {
|
|
16622
16641
|
let renderIcon = jsx$1(Fragment, {});
|
|
16623
16642
|
if (item.icon) {
|
|
16624
|
-
renderIcon = isSvgIcon(item.icon) ? (jsx$1(SvgIcon, { icon: item.icon, extraClassNames: 'tw-
|
|
16625
|
-
' dark:tw-text-sq-white tw-text-[22px] tw-text-sq-white ' +
|
|
16626
|
-
item.iconExtraClassNames, ...item })) : (jsx$1(Icon, { icon: item.icon, type: "text", extraClassNames: 'tw-rounded-[3px] tw-h-8 tw-w-8 tw-flex tw-justify-center tw-items-center tw-bg-sq-color-dark dark:tw-text-sq-white tw-text-[1.375rem] tw-text-sq-white ' +
|
|
16627
|
-
item.iconExtraClassNames }));
|
|
16643
|
+
renderIcon = isSvgIcon(item.icon) ? (jsx$1(SvgIcon, { icon: item.icon, extraClassNames: item.iconExtraClassNames + 'tw:p-1 tw:h-8 tw:w-8 tw:dark:text-sq-white tw:!text-5.5 tw:text-sq-white', ...item })) : (jsx$1(Icon, { icon: item.icon, type: "text", extraClassNames: 'tw:dark:text-sq-white tw:!text-5.5 tw:text-sq-white ' + item.iconExtraClassNames }));
|
|
16628
16644
|
}
|
|
16629
|
-
return (jsxs("div", { className: "tw
|
|
16645
|
+
return (jsxs("div", { className: "tw:flex-col tw:flex tw:p-2.5 tw:pl-5 tw:w-150", children: [jsxs("div", { className: "tw:flex tw:flex-row tw:gap-2 tw:items-end", children: [jsx$1("div", { className: classNames('tw:rounded-[0.1875rem] tw:h-8 tw:w-8 tw:bg-sq-theme-dark tw:flex tw:justify-center tw:items-center ', item.iconContainerExtraClassNames), children: renderIcon }), jsx$1("h4", { className: "tw:text-base tw:font-[600] tw:leading-5 mb-0", children: item.display })] }), jsx$1("div", { className: "tw:text-sq-13 tw:font-normal", children: item.text })] }));
|
|
16630
16646
|
};
|
|
16631
16647
|
const ViewWorkbench = (item) => {
|
|
16632
16648
|
let renderIcon = jsx$1(Fragment, {});
|
|
16633
16649
|
if (item.icon) {
|
|
16634
|
-
renderIcon = isSvgIcon(item.icon) ? (jsx$1(SvgIcon, { icon: item.icon, extraClassNames: 'tw-
|
|
16635
|
-
' tw-text-sq-text-color ' +
|
|
16636
|
-
item.iconExtraClassNames, type: "default", ...item })) : (jsx$1(Icon, { icon: item.icon, type: "text", extraClassNames: 'tw-flex tw-justify-center tw-items-center tw-text-[1.25rem] dark:tw-text-sq-white' +
|
|
16637
|
-
' tw-text-sq-text-color ' +
|
|
16638
|
-
item.iconExtraClassNames }));
|
|
16650
|
+
renderIcon = isSvgIcon(item.icon) ? (jsx$1(SvgIcon, { icon: item.icon, extraClassNames: 'tw:w-4 tw:text-5 tw:dark:text-sq-white' + ' tw:text-sq-text-color ' + item.iconExtraClassNames, type: "default", ...item })) : (jsx$1(Icon, { icon: item.icon, type: "text", extraClassNames: 'tw:text-5 tw:dark:text-sq-white tw:text-sq-text-color ' + item.iconExtraClassNames }));
|
|
16639
16651
|
}
|
|
16640
|
-
return (jsx$1("div", { className: "tw
|
|
16652
|
+
return (jsx$1("div", { className: "tw:flex-col tw:flex tw:p-2.5", children: jsxs("div", { className: "tw:flex tw:flex-row tw:gap-2 tw:items-end", children: [jsx$1("div", { className: "tw:rounded-[0.1875rem] tw:h-5 tw:w-5 tw:flex tw:justify-center tw:items-center ", children: renderIcon }), jsx$1("div", { className: "tw:text-sq-13", children: item.display })] }) }));
|
|
16641
16653
|
};
|
|
16642
16654
|
const InsertSeeqContent = (item) => {
|
|
16643
|
-
return (jsxs("div", { className: "tw
|
|
16655
|
+
return (jsxs("div", { className: "tw:flex-col tw:flex tw:justify-start tw:p-2.5 tw:font-normal tw:text-left tw:text-sq-text-color tw:dark:text-sq-dark-text", children: [jsx$1("h5", { className: "tw:text-4 tw:font-medium tw:text-sq-theme-dark tw:leading-4.5", children: item.display }), jsx$1("div", { className: "tw:text-sq-13 tw:text-sq-text-color tw:dark:text-sq-dark-text tw:!mt-1", children: item.text })] }));
|
|
16644
16656
|
};
|
|
16645
16657
|
|
|
16646
16658
|
const borderStyles = [
|
|
16647
|
-
'tw
|
|
16648
|
-
'tw
|
|
16649
|
-
'tw
|
|
16650
|
-
'tw
|
|
16651
|
-
'dark:
|
|
16659
|
+
'tw:border-solid',
|
|
16660
|
+
'tw:border',
|
|
16661
|
+
'tw:rounded-md',
|
|
16662
|
+
'tw:border-sq-disabled-gray',
|
|
16663
|
+
'tw:dark:border-gray-500',
|
|
16652
16664
|
].join(' ');
|
|
16653
|
-
const bgStyles = ['tw
|
|
16654
|
-
const disabledClasses = ['tw
|
|
16665
|
+
const bgStyles = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
16666
|
+
const disabledClasses = ['tw:opacity-50', 'tw:cursor-not-allowed'].join(' ');
|
|
16655
16667
|
const renderItem = (variant, item) => {
|
|
16656
16668
|
switch (variant) {
|
|
16657
16669
|
case 'create-workbench':
|
|
@@ -16666,31 +16678,31 @@ const renderItem = (variant, item) => {
|
|
|
16666
16678
|
};
|
|
16667
16679
|
const SeeqActionDropdown = ({ seeqActionDropdownItems, trigger, id, extraClassNames, containerTestId, disabled = false, align = 'end', placement = 'bottom', placementOffset = 5, alignOffset = -35, hasArrow = false, onOpenChange, isOpen, setFocusOnTriggerOnClose = true, keepFocusInsideDropdown = true, variant, ...tooltipProps }) => {
|
|
16668
16680
|
const tooltipData = getQTipData(tooltipProps);
|
|
16669
|
-
return (jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [jsx$1(Trigger, { id: id, "data-testid": id, className: `tw
|
|
16670
|
-
' tw
|
|
16671
|
-
' data-[state=open]:
|
|
16672
|
-
' forceFont data-[side=top]:
|
|
16673
|
-
borderStyles, children: [hasArrow && (jsx$1(Arrow2, { asChild: true, children: jsx$1("div", { className: " tw
|
|
16681
|
+
return (jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [jsx$1(Trigger, { id: id, "data-testid": id, className: `tw:border-none tw:focus-visible:outline-none tw:focus:outline-none tw:focus-within:outline-none`, asChild: true, disabled: disabled, children: jsx$1("div", { ...tooltipData, className: `tw:bg-transparent tw:flex tw:flex-col tw:items-center tw:focus-visible:outline-none tw:focus:outline-none tw:focus-within:outline-none ${disabled ? disabledClasses : ''} ${extraClassNames || ''}`, children: trigger }) }), jsx$1(Content2, { sideOffset: placementOffset, side: placement, align: align, alignOffset: alignOffset, asChild: true, onCloseAutoFocus: (e) => !setFocusOnTriggerOnClose && e.preventDefault(), className: "tw:focus-visible:outline-none tw:outline-none", children: jsxs("div", { "data-testid": containerTestId, className: bgStyles +
|
|
16682
|
+
' tw:relative tw:z-[1200] tw:min-w-6 tw:py-2 tw:focus-visible:outline-none tw:outline-none' +
|
|
16683
|
+
' tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out' +
|
|
16684
|
+
' forceFont tw:data-[side=top]:animate-slideDownAndFade tw:data-[side=right]:animate-slideLeftAndFade tw:data-[side=bottom]:animate-slideUpAndFade tw:data-[side=left]:animate-slideRightAndFade ' +
|
|
16685
|
+
borderStyles, children: [hasArrow && (jsx$1(Arrow2, { asChild: true, children: jsx$1("div", { className: " tw:fill-transparent tw:bg-sq-white tw:w-sq-15 tw:h-sq-15 tw:rotate-45 tw:dark:bg-sq-dark-background tw:border-b tw:border-r tw:border-sq-disabled-gray tw:dark:border-gray-500 tw:-mt-sq-7" }) })), seeqActionDropdownItems.map((item, index) => {
|
|
16674
16686
|
return (jsxs("div", { children: [jsx$1(Item2, { onSelect: (e) => {
|
|
16675
16687
|
item.action(e);
|
|
16676
|
-
}, className: `tw
|
|
16688
|
+
}, className: `tw:cursor-pointer tw:flex tw:dark:text-sq-white tw:hover:bg-sq-gray-highlight tw:dark:hover:bg-sq-gray-highlight-dark tw:relative tw:select-none tw:outline-none tw:data-[disabled]:text-sq-disabled-gray tw:data-[disabled]:pointer-events-none`, "data-testid": item.testId, disabled: !item.enabled, children: renderItem(variant, item) }), item.divider && (jsx$1(Separator2, { "data-testid": `dropdown-divider-${index}`, className: "tw:h-px tw:bg-sq-disabled-gray tw:dark:bg-gray-500 tw:my-2" }))] }, item.display + index));
|
|
16677
16689
|
})] }) })] }));
|
|
16678
16690
|
};
|
|
16679
16691
|
|
|
16680
|
-
const baseClasses$1 = 'tw
|
|
16681
|
-
const errorClasses = 'tw
|
|
16692
|
+
const baseClasses$1 = 'tw:flex tw:outline-none tw:rounded-md tw:w-full tw:relative tw:flex-wrap';
|
|
16693
|
+
const errorClasses = 'tw:border-sq-danger';
|
|
16682
16694
|
const borderColorClasses = [
|
|
16683
|
-
'tw
|
|
16684
|
-
'dark:
|
|
16685
|
-
'dark:focus:
|
|
16686
|
-
'dark:active:
|
|
16687
|
-
'focus:
|
|
16688
|
-
'active:
|
|
16695
|
+
'tw:border-sq-disabled-gray',
|
|
16696
|
+
'tw:dark:border-sq-dark-disabled-gray',
|
|
16697
|
+
'tw:dark:focus:border-sq-theme-darker',
|
|
16698
|
+
'tw:dark:active:border-sq-theme-darker',
|
|
16699
|
+
'tw:focus:border-sq-theme-dark',
|
|
16700
|
+
'tw:active:border-sq-theme-dark',
|
|
16689
16701
|
].join(' ');
|
|
16690
|
-
const fieldBorderRadius = 'tw
|
|
16691
|
-
const fieldClasses = 'tw
|
|
16692
|
-
const darkTheme = 'dark:
|
|
16693
|
-
const lightTheme = 'tw
|
|
16702
|
+
const fieldBorderRadius = 'tw:rounded-l-md tw:rounded-r-none';
|
|
16703
|
+
const fieldClasses = 'tw:leading-normal tw:outline-none tw:py-1 tw:px-3' + 'tw:p-1 tw:border-solid tw:border';
|
|
16704
|
+
const darkTheme = 'tw:dark:bg-sq-dark-background tw:dark:text-sq-dark-text tw:disabled:dark:text-sq-disabled-gray';
|
|
16705
|
+
const lightTheme = 'tw:text-sq-text-color tw:disabled:text-sq-darkish-gray';
|
|
16694
16706
|
/**
|
|
16695
16707
|
* InputGroup.
|
|
16696
16708
|
*/
|
|
@@ -16700,8 +16712,10 @@ const InputGroup = React__default.forwardRef((props, ref) => {
|
|
|
16700
16712
|
const appliedClasses = `${baseClasses$1} ${extraClassNames}`;
|
|
16701
16713
|
const fieldAppliedClasses = `${fieldClasses} ${extraClassNames} ${lightTheme} ${darkTheme} ${fieldBorderRadius} ${showError ? errorClasses : borderColorClasses} `;
|
|
16702
16714
|
const elementsToAppend = append.filter(Boolean);
|
|
16703
|
-
return (jsxs("div", { id: `input-group-${id}`, className: appliedClasses, children: [field ? (jsx$1("div", { "data-testid": testId, className: `tw
|
|
16704
|
-
return item?.variant === 'button' ? (jsx$1(Button, { extraClassNames: `$
|
|
16715
|
+
return (jsxs("div", { id: `input-group-${id}`, className: appliedClasses, children: [field ? (jsx$1("div", { "data-testid": testId, className: `tw:flex tw:flex-1 tw:cursor-pointer tw:active:z-50 ${fieldAppliedClasses}`, children: field })) : (jsx$1(TextField, { testId: testId, readonly: readonly, onChange: onChange, onKeyUp: onKeyUp, onFocus: onFocus, onBlur: onBlur, onKeyDown: onKeyDown, name: name, ref: ref, showError: showError, value: value, required: required, placeholder: placeholder, autoComplete: autoComplete, autoFocus: autoFocus, id: id, type: type, disabled: disabled, step: step, min: min, max: max, maxLength: maxLength, minLength: minLength, extraClassNames: `tw:flex tw:flex-1 tw:w-full tw:focus:z-30 tw:rounded-r-none tw:last:rounded-r-md ${extraClassNames}`, ...tooltipData })), elementsToAppend.map((item, index) => {
|
|
16716
|
+
return item?.variant === 'button' ? (jsx$1(Button, { extraClassNames: `$
|
|
16717
|
+
index ? 'tw:-ml-px' : 'tw:ml-0'
|
|
16718
|
+
} tw:focus:z-40 tw:focus:border tw:rounded-none tw:last:rounded-r-md`, ...item.buttonProps }, index)) : (jsx$1("div", { className: `${borderColorClasses} ${index ? 'tw:-ml-px' : 'tw:ml-0'} tw:flex tw:items-center tw:justify-center tw:rounded-none tw:last:rounded-r-md tw:active:z-30 tw:active:border tw:border`, children: item?.element }, index));
|
|
16705
16719
|
})] }));
|
|
16706
16720
|
});
|
|
16707
16721
|
|
|
@@ -27575,7 +27589,7 @@ var Thumb = SliderThumb;
|
|
|
27575
27589
|
*/
|
|
27576
27590
|
const Slider = (props) => {
|
|
27577
27591
|
const { onValueChange, onPointerUp, id, value, name, disabled = false, rootExtraClassNames = '', trackExtraClassNames = '', rangeExtraClassNames = '', thumbExtraClassNames = '', step, min, max, } = props;
|
|
27578
|
-
return (jsxs(Root$1, { className: `tw
|
|
27592
|
+
return (jsxs(Root$1, { className: `tw:relative tw:flex tw:h-5 tw:w-full tw:touch-none tw:select-none tw:items-center ${rootExtraClassNames}`, defaultValue: [value], value: [value], onValueChange: (value) => onValueChange && onValueChange(value), onPointerUp: (e) => onPointerUp && onPointerUp(e), name: name, id: id, max: max, min: min, disabled: disabled, step: step, children: [jsx$1(Track, { className: `tw:relative tw:h-sq-5 tw:grow tw:rounded-sm tw:bg-sq-dark-gray tw:dark:bg-sq-dark-disabled-gray ${trackExtraClassNames}`, children: jsx$1(Range, { className: `tw:absolute tw:h-full tw:rounded-full ${rangeExtraClassNames}` }) }), jsx$1(Thumb, { className: `tw:block tw:h-sq-15 tw:w-sq-15 tw:rounded-full tw:bg-sq-theme-dark tw:active:bg-sq-theme-darker tw:focus:outline-none tw:focus-visible:outline-none tw:aria-disabled:bg-sq-dark-gray tw:dark:aria-disabled:bg-sq-dark-disabled-gray tw:transition tw:ease-in-out ${thumbExtraClassNames}`, "aria-disabled": disabled })] }));
|
|
27579
27593
|
};
|
|
27580
27594
|
|
|
27581
27595
|
var PROGRESS_NAME = "Progress";
|
|
@@ -27665,1186 +27679,1206 @@ Defaulting to \`null\`.`;
|
|
|
27665
27679
|
var Root = Progress;
|
|
27666
27680
|
var Indicator = ProgressIndicator$1;
|
|
27667
27681
|
|
|
27668
|
-
|
|
27669
|
-
function _typeof(obj) {
|
|
27670
|
-
"@babel/helpers - typeof";
|
|
27682
|
+
var tinycolor$1 = {exports: {}};
|
|
27671
27683
|
|
|
27672
|
-
|
|
27673
|
-
|
|
27674
|
-
|
|
27675
|
-
|
|
27676
|
-
}, _typeof(obj);
|
|
27677
|
-
}
|
|
27678
|
-
|
|
27679
|
-
// https://github.com/bgrins/TinyColor
|
|
27680
|
-
// Brian Grinstead, MIT License
|
|
27681
|
-
|
|
27682
|
-
var trimLeft = /^\s+/;
|
|
27683
|
-
var trimRight = /\s+$/;
|
|
27684
|
-
function tinycolor(color, opts) {
|
|
27685
|
-
color = color ? color : "";
|
|
27686
|
-
opts = opts || {};
|
|
27687
|
-
|
|
27688
|
-
// If input is already a tinycolor, return itself
|
|
27689
|
-
if (color instanceof tinycolor) {
|
|
27690
|
-
return color;
|
|
27691
|
-
}
|
|
27692
|
-
// If we are called as a function, call using new instead
|
|
27693
|
-
if (!(this instanceof tinycolor)) {
|
|
27694
|
-
return new tinycolor(color, opts);
|
|
27695
|
-
}
|
|
27696
|
-
var rgb = inputToRGB(color);
|
|
27697
|
-
this._originalInput = color, this._r = rgb.r, this._g = rgb.g, this._b = rgb.b, this._a = rgb.a, this._roundA = Math.round(100 * this._a) / 100, this._format = opts.format || rgb.format;
|
|
27698
|
-
this._gradientType = opts.gradientType;
|
|
27699
|
-
|
|
27700
|
-
// Don't let the range of [0,255] come back in [0,1].
|
|
27701
|
-
// Potentially lose a little bit of precision here, but will fix issues where
|
|
27702
|
-
// .5 gets interpreted as half of the total, instead of half of 1
|
|
27703
|
-
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
|
27704
|
-
if (this._r < 1) this._r = Math.round(this._r);
|
|
27705
|
-
if (this._g < 1) this._g = Math.round(this._g);
|
|
27706
|
-
if (this._b < 1) this._b = Math.round(this._b);
|
|
27707
|
-
this._ok = rgb.ok;
|
|
27708
|
-
}
|
|
27709
|
-
tinycolor.prototype = {
|
|
27710
|
-
isDark: function isDark() {
|
|
27711
|
-
return this.getBrightness() < 128;
|
|
27712
|
-
},
|
|
27713
|
-
isLight: function isLight() {
|
|
27714
|
-
return !this.isDark();
|
|
27715
|
-
},
|
|
27716
|
-
isValid: function isValid() {
|
|
27717
|
-
return this._ok;
|
|
27718
|
-
},
|
|
27719
|
-
getOriginalInput: function getOriginalInput() {
|
|
27720
|
-
return this._originalInput;
|
|
27721
|
-
},
|
|
27722
|
-
getFormat: function getFormat() {
|
|
27723
|
-
return this._format;
|
|
27724
|
-
},
|
|
27725
|
-
getAlpha: function getAlpha() {
|
|
27726
|
-
return this._a;
|
|
27727
|
-
},
|
|
27728
|
-
getBrightness: function getBrightness() {
|
|
27729
|
-
//http://www.w3.org/TR/AERT#color-contrast
|
|
27730
|
-
var rgb = this.toRgb();
|
|
27731
|
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
27732
|
-
},
|
|
27733
|
-
getLuminance: function getLuminance() {
|
|
27734
|
-
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
27735
|
-
var rgb = this.toRgb();
|
|
27736
|
-
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
27737
|
-
RsRGB = rgb.r / 255;
|
|
27738
|
-
GsRGB = rgb.g / 255;
|
|
27739
|
-
BsRGB = rgb.b / 255;
|
|
27740
|
-
if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
27741
|
-
if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
27742
|
-
if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
27743
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
27744
|
-
},
|
|
27745
|
-
setAlpha: function setAlpha(value) {
|
|
27746
|
-
this._a = boundAlpha(value);
|
|
27747
|
-
this._roundA = Math.round(100 * this._a) / 100;
|
|
27748
|
-
return this;
|
|
27749
|
-
},
|
|
27750
|
-
toHsv: function toHsv() {
|
|
27751
|
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
27752
|
-
return {
|
|
27753
|
-
h: hsv.h * 360,
|
|
27754
|
-
s: hsv.s,
|
|
27755
|
-
v: hsv.v,
|
|
27756
|
-
a: this._a
|
|
27757
|
-
};
|
|
27758
|
-
},
|
|
27759
|
-
toHsvString: function toHsvString() {
|
|
27760
|
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
27761
|
-
var h = Math.round(hsv.h * 360),
|
|
27762
|
-
s = Math.round(hsv.s * 100),
|
|
27763
|
-
v = Math.round(hsv.v * 100);
|
|
27764
|
-
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
27765
|
-
},
|
|
27766
|
-
toHsl: function toHsl() {
|
|
27767
|
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
27768
|
-
return {
|
|
27769
|
-
h: hsl.h * 360,
|
|
27770
|
-
s: hsl.s,
|
|
27771
|
-
l: hsl.l,
|
|
27772
|
-
a: this._a
|
|
27773
|
-
};
|
|
27774
|
-
},
|
|
27775
|
-
toHslString: function toHslString() {
|
|
27776
|
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
27777
|
-
var h = Math.round(hsl.h * 360),
|
|
27778
|
-
s = Math.round(hsl.s * 100),
|
|
27779
|
-
l = Math.round(hsl.l * 100);
|
|
27780
|
-
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
27781
|
-
},
|
|
27782
|
-
toHex: function toHex(allow3Char) {
|
|
27783
|
-
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
27784
|
-
},
|
|
27785
|
-
toHexString: function toHexString(allow3Char) {
|
|
27786
|
-
return "#" + this.toHex(allow3Char);
|
|
27787
|
-
},
|
|
27788
|
-
toHex8: function toHex8(allow4Char) {
|
|
27789
|
-
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
27790
|
-
},
|
|
27791
|
-
toHex8String: function toHex8String(allow4Char) {
|
|
27792
|
-
return "#" + this.toHex8(allow4Char);
|
|
27793
|
-
},
|
|
27794
|
-
toRgb: function toRgb() {
|
|
27795
|
-
return {
|
|
27796
|
-
r: Math.round(this._r),
|
|
27797
|
-
g: Math.round(this._g),
|
|
27798
|
-
b: Math.round(this._b),
|
|
27799
|
-
a: this._a
|
|
27800
|
-
};
|
|
27801
|
-
},
|
|
27802
|
-
toRgbString: function toRgbString() {
|
|
27803
|
-
return this._a == 1 ? "rgb(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ")" : "rgba(" + Math.round(this._r) + ", " + Math.round(this._g) + ", " + Math.round(this._b) + ", " + this._roundA + ")";
|
|
27804
|
-
},
|
|
27805
|
-
toPercentageRgb: function toPercentageRgb() {
|
|
27806
|
-
return {
|
|
27807
|
-
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
27808
|
-
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
27809
|
-
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
27810
|
-
a: this._a
|
|
27811
|
-
};
|
|
27812
|
-
},
|
|
27813
|
-
toPercentageRgbString: function toPercentageRgbString() {
|
|
27814
|
-
return this._a == 1 ? "rgb(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%)" : "rgba(" + Math.round(bound01(this._r, 255) * 100) + "%, " + Math.round(bound01(this._g, 255) * 100) + "%, " + Math.round(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
27815
|
-
},
|
|
27816
|
-
toName: function toName() {
|
|
27817
|
-
if (this._a === 0) {
|
|
27818
|
-
return "transparent";
|
|
27819
|
-
}
|
|
27820
|
-
if (this._a < 1) {
|
|
27821
|
-
return false;
|
|
27822
|
-
}
|
|
27823
|
-
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
27824
|
-
},
|
|
27825
|
-
toFilter: function toFilter(secondColor) {
|
|
27826
|
-
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
27827
|
-
var secondHex8String = hex8String;
|
|
27828
|
-
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
27829
|
-
if (secondColor) {
|
|
27830
|
-
var s = tinycolor(secondColor);
|
|
27831
|
-
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
27832
|
-
}
|
|
27833
|
-
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
|
|
27834
|
-
},
|
|
27835
|
-
toString: function toString(format) {
|
|
27836
|
-
var formatSet = !!format;
|
|
27837
|
-
format = format || this._format;
|
|
27838
|
-
var formattedString = false;
|
|
27839
|
-
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
27840
|
-
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
27841
|
-
if (needsAlphaFormat) {
|
|
27842
|
-
// Special case for "transparent", all other non-alpha formats
|
|
27843
|
-
// will return rgba when there is transparency.
|
|
27844
|
-
if (format === "name" && this._a === 0) {
|
|
27845
|
-
return this.toName();
|
|
27846
|
-
}
|
|
27847
|
-
return this.toRgbString();
|
|
27848
|
-
}
|
|
27849
|
-
if (format === "rgb") {
|
|
27850
|
-
formattedString = this.toRgbString();
|
|
27851
|
-
}
|
|
27852
|
-
if (format === "prgb") {
|
|
27853
|
-
formattedString = this.toPercentageRgbString();
|
|
27854
|
-
}
|
|
27855
|
-
if (format === "hex" || format === "hex6") {
|
|
27856
|
-
formattedString = this.toHexString();
|
|
27857
|
-
}
|
|
27858
|
-
if (format === "hex3") {
|
|
27859
|
-
formattedString = this.toHexString(true);
|
|
27860
|
-
}
|
|
27861
|
-
if (format === "hex4") {
|
|
27862
|
-
formattedString = this.toHex8String(true);
|
|
27863
|
-
}
|
|
27864
|
-
if (format === "hex8") {
|
|
27865
|
-
formattedString = this.toHex8String();
|
|
27866
|
-
}
|
|
27867
|
-
if (format === "name") {
|
|
27868
|
-
formattedString = this.toName();
|
|
27869
|
-
}
|
|
27870
|
-
if (format === "hsl") {
|
|
27871
|
-
formattedString = this.toHslString();
|
|
27872
|
-
}
|
|
27873
|
-
if (format === "hsv") {
|
|
27874
|
-
formattedString = this.toHsvString();
|
|
27875
|
-
}
|
|
27876
|
-
return formattedString || this.toHexString();
|
|
27877
|
-
},
|
|
27878
|
-
clone: function clone() {
|
|
27879
|
-
return tinycolor(this.toString());
|
|
27880
|
-
},
|
|
27881
|
-
_applyModification: function _applyModification(fn, args) {
|
|
27882
|
-
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
27883
|
-
this._r = color._r;
|
|
27884
|
-
this._g = color._g;
|
|
27885
|
-
this._b = color._b;
|
|
27886
|
-
this.setAlpha(color._a);
|
|
27887
|
-
return this;
|
|
27888
|
-
},
|
|
27889
|
-
lighten: function lighten() {
|
|
27890
|
-
return this._applyModification(_lighten, arguments);
|
|
27891
|
-
},
|
|
27892
|
-
brighten: function brighten() {
|
|
27893
|
-
return this._applyModification(_brighten, arguments);
|
|
27894
|
-
},
|
|
27895
|
-
darken: function darken() {
|
|
27896
|
-
return this._applyModification(_darken, arguments);
|
|
27897
|
-
},
|
|
27898
|
-
desaturate: function desaturate() {
|
|
27899
|
-
return this._applyModification(_desaturate, arguments);
|
|
27900
|
-
},
|
|
27901
|
-
saturate: function saturate() {
|
|
27902
|
-
return this._applyModification(_saturate, arguments);
|
|
27903
|
-
},
|
|
27904
|
-
greyscale: function greyscale() {
|
|
27905
|
-
return this._applyModification(_greyscale, arguments);
|
|
27906
|
-
},
|
|
27907
|
-
spin: function spin() {
|
|
27908
|
-
return this._applyModification(_spin, arguments);
|
|
27909
|
-
},
|
|
27910
|
-
_applyCombination: function _applyCombination(fn, args) {
|
|
27911
|
-
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
27912
|
-
},
|
|
27913
|
-
analogous: function analogous() {
|
|
27914
|
-
return this._applyCombination(_analogous, arguments);
|
|
27915
|
-
},
|
|
27916
|
-
complement: function complement() {
|
|
27917
|
-
return this._applyCombination(_complement, arguments);
|
|
27918
|
-
},
|
|
27919
|
-
monochromatic: function monochromatic() {
|
|
27920
|
-
return this._applyCombination(_monochromatic, arguments);
|
|
27921
|
-
},
|
|
27922
|
-
splitcomplement: function splitcomplement() {
|
|
27923
|
-
return this._applyCombination(_splitcomplement, arguments);
|
|
27924
|
-
},
|
|
27925
|
-
// Disabled until https://github.com/bgrins/TinyColor/issues/254
|
|
27926
|
-
// polyad: function (number) {
|
|
27927
|
-
// return this._applyCombination(polyad, [number]);
|
|
27928
|
-
// },
|
|
27929
|
-
triad: function triad() {
|
|
27930
|
-
return this._applyCombination(polyad, [3]);
|
|
27931
|
-
},
|
|
27932
|
-
tetrad: function tetrad() {
|
|
27933
|
-
return this._applyCombination(polyad, [4]);
|
|
27934
|
-
}
|
|
27935
|
-
};
|
|
27684
|
+
(function (module) {
|
|
27685
|
+
// TinyColor v1.4.1
|
|
27686
|
+
// https://github.com/bgrins/TinyColor
|
|
27687
|
+
// Brian Grinstead, MIT License
|
|
27936
27688
|
|
|
27937
|
-
|
|
27938
|
-
// String input requires "1.0" as input, so 1 will be treated as 1
|
|
27939
|
-
tinycolor.fromRatio = function (color, opts) {
|
|
27940
|
-
if (_typeof(color) == "object") {
|
|
27941
|
-
var newColor = {};
|
|
27942
|
-
for (var i in color) {
|
|
27943
|
-
if (color.hasOwnProperty(i)) {
|
|
27944
|
-
if (i === "a") {
|
|
27945
|
-
newColor[i] = color[i];
|
|
27946
|
-
} else {
|
|
27947
|
-
newColor[i] = convertToPercentage(color[i]);
|
|
27948
|
-
}
|
|
27949
|
-
}
|
|
27950
|
-
}
|
|
27951
|
-
color = newColor;
|
|
27952
|
-
}
|
|
27953
|
-
return tinycolor(color, opts);
|
|
27954
|
-
};
|
|
27955
|
-
|
|
27956
|
-
// Given a string or object, convert that input to RGB
|
|
27957
|
-
// Possible string inputs:
|
|
27958
|
-
//
|
|
27959
|
-
// "red"
|
|
27960
|
-
// "#f00" or "f00"
|
|
27961
|
-
// "#ff0000" or "ff0000"
|
|
27962
|
-
// "#ff000000" or "ff000000"
|
|
27963
|
-
// "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
27964
|
-
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
27965
|
-
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
27966
|
-
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
27967
|
-
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
27968
|
-
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
27969
|
-
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
27970
|
-
//
|
|
27971
|
-
function inputToRGB(color) {
|
|
27972
|
-
var rgb = {
|
|
27973
|
-
r: 0,
|
|
27974
|
-
g: 0,
|
|
27975
|
-
b: 0
|
|
27976
|
-
};
|
|
27977
|
-
var a = 1;
|
|
27978
|
-
var s = null;
|
|
27979
|
-
var v = null;
|
|
27980
|
-
var l = null;
|
|
27981
|
-
var ok = false;
|
|
27982
|
-
var format = false;
|
|
27983
|
-
if (typeof color == "string") {
|
|
27984
|
-
color = stringInputToObject(color);
|
|
27985
|
-
}
|
|
27986
|
-
if (_typeof(color) == "object") {
|
|
27987
|
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
27988
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
27989
|
-
ok = true;
|
|
27990
|
-
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
27991
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
27992
|
-
s = convertToPercentage(color.s);
|
|
27993
|
-
v = convertToPercentage(color.v);
|
|
27994
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
27995
|
-
ok = true;
|
|
27996
|
-
format = "hsv";
|
|
27997
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
27998
|
-
s = convertToPercentage(color.s);
|
|
27999
|
-
l = convertToPercentage(color.l);
|
|
28000
|
-
rgb = hslToRgb(color.h, s, l);
|
|
28001
|
-
ok = true;
|
|
28002
|
-
format = "hsl";
|
|
28003
|
-
}
|
|
28004
|
-
if (color.hasOwnProperty("a")) {
|
|
28005
|
-
a = color.a;
|
|
28006
|
-
}
|
|
28007
|
-
}
|
|
28008
|
-
a = boundAlpha(a);
|
|
28009
|
-
return {
|
|
28010
|
-
ok: ok,
|
|
28011
|
-
format: color.format || format,
|
|
28012
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
28013
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
28014
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
28015
|
-
a: a
|
|
28016
|
-
};
|
|
28017
|
-
}
|
|
27689
|
+
(function(Math) {
|
|
28018
27690
|
|
|
28019
|
-
|
|
28020
|
-
|
|
27691
|
+
var trimLeft = /^\s+/,
|
|
27692
|
+
trimRight = /\s+$/,
|
|
27693
|
+
tinyCounter = 0,
|
|
27694
|
+
mathRound = Math.round,
|
|
27695
|
+
mathMin = Math.min,
|
|
27696
|
+
mathMax = Math.max,
|
|
27697
|
+
mathRandom = Math.random;
|
|
28021
27698
|
|
|
28022
|
-
|
|
28023
|
-
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
27699
|
+
function tinycolor (color, opts) {
|
|
28024
27700
|
|
|
28025
|
-
|
|
28026
|
-
|
|
28027
|
-
// <http://www.w3.org/TR/css3-color/>
|
|
28028
|
-
// *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
28029
|
-
// *Returns:* { r, g, b } in [0, 255]
|
|
28030
|
-
function rgbToRgb(r, g, b) {
|
|
28031
|
-
return {
|
|
28032
|
-
r: bound01(r, 255) * 255,
|
|
28033
|
-
g: bound01(g, 255) * 255,
|
|
28034
|
-
b: bound01(b, 255) * 255
|
|
28035
|
-
};
|
|
28036
|
-
}
|
|
27701
|
+
color = (color) ? color : '';
|
|
27702
|
+
opts = opts || { };
|
|
28037
27703
|
|
|
28038
|
-
//
|
|
28039
|
-
|
|
28040
|
-
|
|
28041
|
-
|
|
28042
|
-
|
|
28043
|
-
|
|
28044
|
-
|
|
28045
|
-
|
|
28046
|
-
var max = Math.max(r, g, b),
|
|
28047
|
-
min = Math.min(r, g, b);
|
|
28048
|
-
var h,
|
|
28049
|
-
s,
|
|
28050
|
-
l = (max + min) / 2;
|
|
28051
|
-
if (max == min) {
|
|
28052
|
-
h = s = 0; // achromatic
|
|
28053
|
-
} else {
|
|
28054
|
-
var d = max - min;
|
|
28055
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
28056
|
-
switch (max) {
|
|
28057
|
-
case r:
|
|
28058
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
28059
|
-
break;
|
|
28060
|
-
case g:
|
|
28061
|
-
h = (b - r) / d + 2;
|
|
28062
|
-
break;
|
|
28063
|
-
case b:
|
|
28064
|
-
h = (r - g) / d + 4;
|
|
28065
|
-
break;
|
|
28066
|
-
}
|
|
28067
|
-
h /= 6;
|
|
28068
|
-
}
|
|
28069
|
-
return {
|
|
28070
|
-
h: h,
|
|
28071
|
-
s: s,
|
|
28072
|
-
l: l
|
|
28073
|
-
};
|
|
28074
|
-
}
|
|
27704
|
+
// If input is already a tinycolor, return itself
|
|
27705
|
+
if (color instanceof tinycolor) {
|
|
27706
|
+
return color;
|
|
27707
|
+
}
|
|
27708
|
+
// If we are called as a function, call using new instead
|
|
27709
|
+
if (!(this instanceof tinycolor)) {
|
|
27710
|
+
return new tinycolor(color, opts);
|
|
27711
|
+
}
|
|
28075
27712
|
|
|
28076
|
-
|
|
28077
|
-
|
|
28078
|
-
|
|
28079
|
-
|
|
28080
|
-
|
|
28081
|
-
|
|
28082
|
-
|
|
28083
|
-
|
|
28084
|
-
|
|
28085
|
-
|
|
28086
|
-
|
|
28087
|
-
|
|
28088
|
-
|
|
28089
|
-
|
|
28090
|
-
|
|
28091
|
-
|
|
28092
|
-
|
|
28093
|
-
|
|
28094
|
-
|
|
28095
|
-
|
|
28096
|
-
|
|
28097
|
-
var p = 2 * l - q;
|
|
28098
|
-
r = hue2rgb(p, q, h + 1 / 3);
|
|
28099
|
-
g = hue2rgb(p, q, h);
|
|
28100
|
-
b = hue2rgb(p, q, h - 1 / 3);
|
|
28101
|
-
}
|
|
28102
|
-
return {
|
|
28103
|
-
r: r * 255,
|
|
28104
|
-
g: g * 255,
|
|
28105
|
-
b: b * 255
|
|
28106
|
-
};
|
|
28107
|
-
}
|
|
27713
|
+
var rgb = inputToRGB(color);
|
|
27714
|
+
this._originalInput = color,
|
|
27715
|
+
this._r = rgb.r,
|
|
27716
|
+
this._g = rgb.g,
|
|
27717
|
+
this._b = rgb.b,
|
|
27718
|
+
this._a = rgb.a,
|
|
27719
|
+
this._roundA = mathRound(100*this._a) / 100,
|
|
27720
|
+
this._format = opts.format || rgb.format;
|
|
27721
|
+
this._gradientType = opts.gradientType;
|
|
27722
|
+
|
|
27723
|
+
// Don't let the range of [0,255] come back in [0,1].
|
|
27724
|
+
// Potentially lose a little bit of precision here, but will fix issues where
|
|
27725
|
+
// .5 gets interpreted as half of the total, instead of half of 1
|
|
27726
|
+
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
|
27727
|
+
if (this._r < 1) { this._r = mathRound(this._r); }
|
|
27728
|
+
if (this._g < 1) { this._g = mathRound(this._g); }
|
|
27729
|
+
if (this._b < 1) { this._b = mathRound(this._b); }
|
|
27730
|
+
|
|
27731
|
+
this._ok = rgb.ok;
|
|
27732
|
+
this._tc_id = tinyCounter++;
|
|
27733
|
+
}
|
|
28108
27734
|
|
|
28109
|
-
|
|
28110
|
-
|
|
28111
|
-
|
|
28112
|
-
|
|
28113
|
-
function
|
|
28114
|
-
|
|
28115
|
-
|
|
28116
|
-
|
|
28117
|
-
|
|
28118
|
-
|
|
28119
|
-
|
|
28120
|
-
|
|
28121
|
-
|
|
28122
|
-
|
|
28123
|
-
|
|
28124
|
-
|
|
28125
|
-
|
|
28126
|
-
|
|
28127
|
-
|
|
28128
|
-
|
|
28129
|
-
|
|
28130
|
-
|
|
28131
|
-
|
|
28132
|
-
|
|
28133
|
-
|
|
28134
|
-
|
|
28135
|
-
|
|
28136
|
-
|
|
28137
|
-
|
|
28138
|
-
|
|
28139
|
-
|
|
28140
|
-
|
|
28141
|
-
|
|
28142
|
-
|
|
28143
|
-
|
|
28144
|
-
|
|
28145
|
-
}
|
|
27735
|
+
tinycolor.prototype = {
|
|
27736
|
+
isDark: function() {
|
|
27737
|
+
return this.getBrightness() < 128;
|
|
27738
|
+
},
|
|
27739
|
+
isLight: function() {
|
|
27740
|
+
return !this.isDark();
|
|
27741
|
+
},
|
|
27742
|
+
isValid: function() {
|
|
27743
|
+
return this._ok;
|
|
27744
|
+
},
|
|
27745
|
+
getOriginalInput: function() {
|
|
27746
|
+
return this._originalInput;
|
|
27747
|
+
},
|
|
27748
|
+
getFormat: function() {
|
|
27749
|
+
return this._format;
|
|
27750
|
+
},
|
|
27751
|
+
getAlpha: function() {
|
|
27752
|
+
return this._a;
|
|
27753
|
+
},
|
|
27754
|
+
getBrightness: function() {
|
|
27755
|
+
//http://www.w3.org/TR/AERT#color-contrast
|
|
27756
|
+
var rgb = this.toRgb();
|
|
27757
|
+
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
27758
|
+
},
|
|
27759
|
+
getLuminance: function() {
|
|
27760
|
+
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
27761
|
+
var rgb = this.toRgb();
|
|
27762
|
+
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
27763
|
+
RsRGB = rgb.r/255;
|
|
27764
|
+
GsRGB = rgb.g/255;
|
|
27765
|
+
BsRGB = rgb.b/255;
|
|
27766
|
+
|
|
27767
|
+
if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}
|
|
27768
|
+
if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}
|
|
27769
|
+
if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}
|
|
27770
|
+
return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);
|
|
27771
|
+
},
|
|
27772
|
+
setAlpha: function(value) {
|
|
27773
|
+
this._a = boundAlpha(value);
|
|
27774
|
+
this._roundA = mathRound(100*this._a) / 100;
|
|
27775
|
+
return this;
|
|
27776
|
+
},
|
|
27777
|
+
toHsv: function() {
|
|
27778
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
27779
|
+
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
|
|
27780
|
+
},
|
|
27781
|
+
toHsvString: function() {
|
|
27782
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
27783
|
+
var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
|
|
27784
|
+
return (this._a == 1) ?
|
|
27785
|
+
"hsv(" + h + ", " + s + "%, " + v + "%)" :
|
|
27786
|
+
"hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
|
|
27787
|
+
},
|
|
27788
|
+
toHsl: function() {
|
|
27789
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
27790
|
+
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
|
|
27791
|
+
},
|
|
27792
|
+
toHslString: function() {
|
|
27793
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
27794
|
+
var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
|
|
27795
|
+
return (this._a == 1) ?
|
|
27796
|
+
"hsl(" + h + ", " + s + "%, " + l + "%)" :
|
|
27797
|
+
"hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
|
|
27798
|
+
},
|
|
27799
|
+
toHex: function(allow3Char) {
|
|
27800
|
+
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
27801
|
+
},
|
|
27802
|
+
toHexString: function(allow3Char) {
|
|
27803
|
+
return '#' + this.toHex(allow3Char);
|
|
27804
|
+
},
|
|
27805
|
+
toHex8: function(allow4Char) {
|
|
27806
|
+
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
27807
|
+
},
|
|
27808
|
+
toHex8String: function(allow4Char) {
|
|
27809
|
+
return '#' + this.toHex8(allow4Char);
|
|
27810
|
+
},
|
|
27811
|
+
toRgb: function() {
|
|
27812
|
+
return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
|
|
27813
|
+
},
|
|
27814
|
+
toRgbString: function() {
|
|
27815
|
+
return (this._a == 1) ?
|
|
27816
|
+
"rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
|
|
27817
|
+
"rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
|
|
27818
|
+
},
|
|
27819
|
+
toPercentageRgb: function() {
|
|
27820
|
+
return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
|
|
27821
|
+
},
|
|
27822
|
+
toPercentageRgbString: function() {
|
|
27823
|
+
return (this._a == 1) ?
|
|
27824
|
+
"rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
|
|
27825
|
+
"rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
27826
|
+
},
|
|
27827
|
+
toName: function() {
|
|
27828
|
+
if (this._a === 0) {
|
|
27829
|
+
return "transparent";
|
|
27830
|
+
}
|
|
28146
27831
|
|
|
28147
|
-
|
|
28148
|
-
|
|
28149
|
-
|
|
28150
|
-
// *Returns:* { r, g, b } in the set [0, 255]
|
|
28151
|
-
function hsvToRgb(h, s, v) {
|
|
28152
|
-
h = bound01(h, 360) * 6;
|
|
28153
|
-
s = bound01(s, 100);
|
|
28154
|
-
v = bound01(v, 100);
|
|
28155
|
-
var i = Math.floor(h),
|
|
28156
|
-
f = h - i,
|
|
28157
|
-
p = v * (1 - s),
|
|
28158
|
-
q = v * (1 - f * s),
|
|
28159
|
-
t = v * (1 - (1 - f) * s),
|
|
28160
|
-
mod = i % 6,
|
|
28161
|
-
r = [v, q, p, p, t, v][mod],
|
|
28162
|
-
g = [t, v, v, q, p, p][mod],
|
|
28163
|
-
b = [p, p, t, v, v, q][mod];
|
|
28164
|
-
return {
|
|
28165
|
-
r: r * 255,
|
|
28166
|
-
g: g * 255,
|
|
28167
|
-
b: b * 255
|
|
28168
|
-
};
|
|
28169
|
-
}
|
|
27832
|
+
if (this._a < 1) {
|
|
27833
|
+
return false;
|
|
27834
|
+
}
|
|
28170
27835
|
|
|
28171
|
-
|
|
28172
|
-
|
|
28173
|
-
|
|
28174
|
-
|
|
28175
|
-
|
|
28176
|
-
|
|
27836
|
+
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
27837
|
+
},
|
|
27838
|
+
toFilter: function(secondColor) {
|
|
27839
|
+
var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
27840
|
+
var secondHex8String = hex8String;
|
|
27841
|
+
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
27842
|
+
|
|
27843
|
+
if (secondColor) {
|
|
27844
|
+
var s = tinycolor(secondColor);
|
|
27845
|
+
secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
27846
|
+
}
|
|
28177
27847
|
|
|
28178
|
-
|
|
28179
|
-
|
|
28180
|
-
|
|
28181
|
-
|
|
28182
|
-
|
|
28183
|
-
|
|
27848
|
+
return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
|
|
27849
|
+
},
|
|
27850
|
+
toString: function(format) {
|
|
27851
|
+
var formatSet = !!format;
|
|
27852
|
+
format = format || this._format;
|
|
27853
|
+
|
|
27854
|
+
var formattedString = false;
|
|
27855
|
+
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
27856
|
+
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
27857
|
+
|
|
27858
|
+
if (needsAlphaFormat) {
|
|
27859
|
+
// Special case for "transparent", all other non-alpha formats
|
|
27860
|
+
// will return rgba when there is transparency.
|
|
27861
|
+
if (format === "name" && this._a === 0) {
|
|
27862
|
+
return this.toName();
|
|
27863
|
+
}
|
|
27864
|
+
return this.toRgbString();
|
|
27865
|
+
}
|
|
27866
|
+
if (format === "rgb") {
|
|
27867
|
+
formattedString = this.toRgbString();
|
|
27868
|
+
}
|
|
27869
|
+
if (format === "prgb") {
|
|
27870
|
+
formattedString = this.toPercentageRgbString();
|
|
27871
|
+
}
|
|
27872
|
+
if (format === "hex" || format === "hex6") {
|
|
27873
|
+
formattedString = this.toHexString();
|
|
27874
|
+
}
|
|
27875
|
+
if (format === "hex3") {
|
|
27876
|
+
formattedString = this.toHexString(true);
|
|
27877
|
+
}
|
|
27878
|
+
if (format === "hex4") {
|
|
27879
|
+
formattedString = this.toHex8String(true);
|
|
27880
|
+
}
|
|
27881
|
+
if (format === "hex8") {
|
|
27882
|
+
formattedString = this.toHex8String();
|
|
27883
|
+
}
|
|
27884
|
+
if (format === "name") {
|
|
27885
|
+
formattedString = this.toName();
|
|
27886
|
+
}
|
|
27887
|
+
if (format === "hsl") {
|
|
27888
|
+
formattedString = this.toHslString();
|
|
27889
|
+
}
|
|
27890
|
+
if (format === "hsv") {
|
|
27891
|
+
formattedString = this.toHsvString();
|
|
27892
|
+
}
|
|
28184
27893
|
|
|
28185
|
-
|
|
28186
|
-
|
|
28187
|
-
|
|
28188
|
-
|
|
28189
|
-
|
|
28190
|
-
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
|
|
27894
|
+
return formattedString || this.toHexString();
|
|
27895
|
+
},
|
|
27896
|
+
clone: function() {
|
|
27897
|
+
return tinycolor(this.toString());
|
|
27898
|
+
},
|
|
28191
27899
|
|
|
28192
|
-
|
|
28193
|
-
|
|
28194
|
-
|
|
28195
|
-
|
|
28196
|
-
|
|
28197
|
-
|
|
27900
|
+
_applyModification: function(fn, args) {
|
|
27901
|
+
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
27902
|
+
this._r = color._r;
|
|
27903
|
+
this._g = color._g;
|
|
27904
|
+
this._b = color._b;
|
|
27905
|
+
this.setAlpha(color._a);
|
|
27906
|
+
return this;
|
|
27907
|
+
},
|
|
27908
|
+
lighten: function() {
|
|
27909
|
+
return this._applyModification(lighten, arguments);
|
|
27910
|
+
},
|
|
27911
|
+
brighten: function() {
|
|
27912
|
+
return this._applyModification(brighten, arguments);
|
|
27913
|
+
},
|
|
27914
|
+
darken: function() {
|
|
27915
|
+
return this._applyModification(darken, arguments);
|
|
27916
|
+
},
|
|
27917
|
+
desaturate: function() {
|
|
27918
|
+
return this._applyModification(desaturate, arguments);
|
|
27919
|
+
},
|
|
27920
|
+
saturate: function() {
|
|
27921
|
+
return this._applyModification(saturate, arguments);
|
|
27922
|
+
},
|
|
27923
|
+
greyscale: function() {
|
|
27924
|
+
return this._applyModification(greyscale, arguments);
|
|
27925
|
+
},
|
|
27926
|
+
spin: function() {
|
|
27927
|
+
return this._applyModification(spin, arguments);
|
|
27928
|
+
},
|
|
28198
27929
|
|
|
28199
|
-
|
|
28200
|
-
|
|
28201
|
-
|
|
28202
|
-
function
|
|
28203
|
-
|
|
28204
|
-
|
|
28205
|
-
|
|
27930
|
+
_applyCombination: function(fn, args) {
|
|
27931
|
+
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
27932
|
+
},
|
|
27933
|
+
analogous: function() {
|
|
27934
|
+
return this._applyCombination(analogous, arguments);
|
|
27935
|
+
},
|
|
27936
|
+
complement: function() {
|
|
27937
|
+
return this._applyCombination(complement, arguments);
|
|
27938
|
+
},
|
|
27939
|
+
monochromatic: function() {
|
|
27940
|
+
return this._applyCombination(monochromatic, arguments);
|
|
27941
|
+
},
|
|
27942
|
+
splitcomplement: function() {
|
|
27943
|
+
return this._applyCombination(splitcomplement, arguments);
|
|
27944
|
+
},
|
|
27945
|
+
triad: function() {
|
|
27946
|
+
return this._applyCombination(triad, arguments);
|
|
27947
|
+
},
|
|
27948
|
+
tetrad: function() {
|
|
27949
|
+
return this._applyCombination(tetrad, arguments);
|
|
27950
|
+
}
|
|
27951
|
+
};
|
|
27952
|
+
|
|
27953
|
+
// If input is an object, force 1 into "1.0" to handle ratios properly
|
|
27954
|
+
// String input requires "1.0" as input, so 1 will be treated as 1
|
|
27955
|
+
tinycolor.fromRatio = function(color, opts) {
|
|
27956
|
+
if (typeof color == "object") {
|
|
27957
|
+
var newColor = {};
|
|
27958
|
+
for (var i in color) {
|
|
27959
|
+
if (color.hasOwnProperty(i)) {
|
|
27960
|
+
if (i === "a") {
|
|
27961
|
+
newColor[i] = color[i];
|
|
27962
|
+
}
|
|
27963
|
+
else {
|
|
27964
|
+
newColor[i] = convertToPercentage(color[i]);
|
|
27965
|
+
}
|
|
27966
|
+
}
|
|
27967
|
+
}
|
|
27968
|
+
color = newColor;
|
|
27969
|
+
}
|
|
28206
27970
|
|
|
28207
|
-
|
|
28208
|
-
|
|
28209
|
-
|
|
28210
|
-
|
|
28211
|
-
|
|
28212
|
-
|
|
28213
|
-
|
|
28214
|
-
|
|
28215
|
-
|
|
28216
|
-
|
|
28217
|
-
|
|
28218
|
-
|
|
28219
|
-
|
|
27971
|
+
return tinycolor(color, opts);
|
|
27972
|
+
};
|
|
27973
|
+
|
|
27974
|
+
// Given a string or object, convert that input to RGB
|
|
27975
|
+
// Possible string inputs:
|
|
27976
|
+
//
|
|
27977
|
+
// "red"
|
|
27978
|
+
// "#f00" or "f00"
|
|
27979
|
+
// "#ff0000" or "ff0000"
|
|
27980
|
+
// "#ff000000" or "ff000000"
|
|
27981
|
+
// "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
27982
|
+
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
27983
|
+
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
27984
|
+
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
27985
|
+
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
27986
|
+
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
27987
|
+
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
27988
|
+
//
|
|
27989
|
+
function inputToRGB(color) {
|
|
27990
|
+
|
|
27991
|
+
var rgb = { r: 0, g: 0, b: 0 };
|
|
27992
|
+
var a = 1;
|
|
27993
|
+
var s = null;
|
|
27994
|
+
var v = null;
|
|
27995
|
+
var l = null;
|
|
27996
|
+
var ok = false;
|
|
27997
|
+
var format = false;
|
|
27998
|
+
|
|
27999
|
+
if (typeof color == "string") {
|
|
28000
|
+
color = stringInputToObject(color);
|
|
28001
|
+
}
|
|
28220
28002
|
|
|
28221
|
-
|
|
28222
|
-
|
|
28223
|
-
|
|
28224
|
-
|
|
28225
|
-
|
|
28226
|
-
|
|
28227
|
-
|
|
28228
|
-
|
|
28229
|
-
|
|
28230
|
-
|
|
28231
|
-
|
|
28232
|
-
|
|
28233
|
-
|
|
28234
|
-
|
|
28235
|
-
|
|
28236
|
-
|
|
28237
|
-
|
|
28238
|
-
|
|
28239
|
-
|
|
28240
|
-
|
|
28241
|
-
|
|
28242
|
-
|
|
28243
|
-
|
|
28244
|
-
|
|
28245
|
-
|
|
28246
|
-
hsl.l += amount / 100;
|
|
28247
|
-
hsl.l = clamp01(hsl.l);
|
|
28248
|
-
return tinycolor(hsl);
|
|
28249
|
-
}
|
|
28250
|
-
function _brighten(color, amount) {
|
|
28251
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
28252
|
-
var rgb = tinycolor(color).toRgb();
|
|
28253
|
-
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
28254
|
-
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
28255
|
-
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
28256
|
-
return tinycolor(rgb);
|
|
28257
|
-
}
|
|
28258
|
-
function _darken(color, amount) {
|
|
28259
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
28260
|
-
var hsl = tinycolor(color).toHsl();
|
|
28261
|
-
hsl.l -= amount / 100;
|
|
28262
|
-
hsl.l = clamp01(hsl.l);
|
|
28263
|
-
return tinycolor(hsl);
|
|
28264
|
-
}
|
|
28265
|
-
|
|
28266
|
-
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
28267
|
-
// Values outside of this range will be wrapped into this range.
|
|
28268
|
-
function _spin(color, amount) {
|
|
28269
|
-
var hsl = tinycolor(color).toHsl();
|
|
28270
|
-
var hue = (hsl.h + amount) % 360;
|
|
28271
|
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
28272
|
-
return tinycolor(hsl);
|
|
28273
|
-
}
|
|
28274
|
-
|
|
28275
|
-
// Combination Functions
|
|
28276
|
-
// ---------------------
|
|
28277
|
-
// Thanks to jQuery xColor for some of the ideas behind these
|
|
28278
|
-
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
|
28279
|
-
|
|
28280
|
-
function _complement(color) {
|
|
28281
|
-
var hsl = tinycolor(color).toHsl();
|
|
28282
|
-
hsl.h = (hsl.h + 180) % 360;
|
|
28283
|
-
return tinycolor(hsl);
|
|
28284
|
-
}
|
|
28285
|
-
function polyad(color, number) {
|
|
28286
|
-
if (isNaN(number) || number <= 0) {
|
|
28287
|
-
throw new Error("Argument to polyad must be a positive number");
|
|
28288
|
-
}
|
|
28289
|
-
var hsl = tinycolor(color).toHsl();
|
|
28290
|
-
var result = [tinycolor(color)];
|
|
28291
|
-
var step = 360 / number;
|
|
28292
|
-
for (var i = 1; i < number; i++) {
|
|
28293
|
-
result.push(tinycolor({
|
|
28294
|
-
h: (hsl.h + i * step) % 360,
|
|
28295
|
-
s: hsl.s,
|
|
28296
|
-
l: hsl.l
|
|
28297
|
-
}));
|
|
28298
|
-
}
|
|
28299
|
-
return result;
|
|
28300
|
-
}
|
|
28301
|
-
function _splitcomplement(color) {
|
|
28302
|
-
var hsl = tinycolor(color).toHsl();
|
|
28303
|
-
var h = hsl.h;
|
|
28304
|
-
return [tinycolor(color), tinycolor({
|
|
28305
|
-
h: (h + 72) % 360,
|
|
28306
|
-
s: hsl.s,
|
|
28307
|
-
l: hsl.l
|
|
28308
|
-
}), tinycolor({
|
|
28309
|
-
h: (h + 216) % 360,
|
|
28310
|
-
s: hsl.s,
|
|
28311
|
-
l: hsl.l
|
|
28312
|
-
})];
|
|
28313
|
-
}
|
|
28314
|
-
function _analogous(color, results, slices) {
|
|
28315
|
-
results = results || 6;
|
|
28316
|
-
slices = slices || 30;
|
|
28317
|
-
var hsl = tinycolor(color).toHsl();
|
|
28318
|
-
var part = 360 / slices;
|
|
28319
|
-
var ret = [tinycolor(color)];
|
|
28320
|
-
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
|
|
28321
|
-
hsl.h = (hsl.h + part) % 360;
|
|
28322
|
-
ret.push(tinycolor(hsl));
|
|
28323
|
-
}
|
|
28324
|
-
return ret;
|
|
28325
|
-
}
|
|
28326
|
-
function _monochromatic(color, results) {
|
|
28327
|
-
results = results || 6;
|
|
28328
|
-
var hsv = tinycolor(color).toHsv();
|
|
28329
|
-
var h = hsv.h,
|
|
28330
|
-
s = hsv.s,
|
|
28331
|
-
v = hsv.v;
|
|
28332
|
-
var ret = [];
|
|
28333
|
-
var modification = 1 / results;
|
|
28334
|
-
while (results--) {
|
|
28335
|
-
ret.push(tinycolor({
|
|
28336
|
-
h: h,
|
|
28337
|
-
s: s,
|
|
28338
|
-
v: v
|
|
28339
|
-
}));
|
|
28340
|
-
v = (v + modification) % 1;
|
|
28341
|
-
}
|
|
28342
|
-
return ret;
|
|
28343
|
-
}
|
|
28003
|
+
if (typeof color == "object") {
|
|
28004
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
28005
|
+
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
28006
|
+
ok = true;
|
|
28007
|
+
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
28008
|
+
}
|
|
28009
|
+
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
28010
|
+
s = convertToPercentage(color.s);
|
|
28011
|
+
v = convertToPercentage(color.v);
|
|
28012
|
+
rgb = hsvToRgb(color.h, s, v);
|
|
28013
|
+
ok = true;
|
|
28014
|
+
format = "hsv";
|
|
28015
|
+
}
|
|
28016
|
+
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
28017
|
+
s = convertToPercentage(color.s);
|
|
28018
|
+
l = convertToPercentage(color.l);
|
|
28019
|
+
rgb = hslToRgb(color.h, s, l);
|
|
28020
|
+
ok = true;
|
|
28021
|
+
format = "hsl";
|
|
28022
|
+
}
|
|
28023
|
+
|
|
28024
|
+
if (color.hasOwnProperty("a")) {
|
|
28025
|
+
a = color.a;
|
|
28026
|
+
}
|
|
28027
|
+
}
|
|
28344
28028
|
|
|
28345
|
-
|
|
28346
|
-
// ---------------------
|
|
28029
|
+
a = boundAlpha(a);
|
|
28347
28030
|
|
|
28348
|
-
|
|
28349
|
-
|
|
28350
|
-
|
|
28351
|
-
|
|
28352
|
-
|
|
28353
|
-
|
|
28354
|
-
|
|
28355
|
-
|
|
28356
|
-
|
|
28357
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
28358
|
-
};
|
|
28359
|
-
return tinycolor(rgba);
|
|
28360
|
-
};
|
|
28361
|
-
|
|
28362
|
-
// Readability Functions
|
|
28363
|
-
// ---------------------
|
|
28364
|
-
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
|
|
28365
|
-
|
|
28366
|
-
// `contrast`
|
|
28367
|
-
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
|
|
28368
|
-
tinycolor.readability = function (color1, color2) {
|
|
28369
|
-
var c1 = tinycolor(color1);
|
|
28370
|
-
var c2 = tinycolor(color2);
|
|
28371
|
-
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
|
|
28372
|
-
};
|
|
28373
|
-
|
|
28374
|
-
// `isReadable`
|
|
28375
|
-
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
|
28376
|
-
// The third argument is an optional Object.
|
|
28377
|
-
// the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
|
|
28378
|
-
// the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
|
|
28379
|
-
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
|
|
28380
|
-
|
|
28381
|
-
// *Example*
|
|
28382
|
-
// tinycolor.isReadable("#000", "#111") => false
|
|
28383
|
-
// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
|
|
28384
|
-
tinycolor.isReadable = function (color1, color2, wcag2) {
|
|
28385
|
-
var readability = tinycolor.readability(color1, color2);
|
|
28386
|
-
var wcag2Parms, out;
|
|
28387
|
-
out = false;
|
|
28388
|
-
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
28389
|
-
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
28390
|
-
case "AAsmall":
|
|
28391
|
-
case "AAAlarge":
|
|
28392
|
-
out = readability >= 4.5;
|
|
28393
|
-
break;
|
|
28394
|
-
case "AAlarge":
|
|
28395
|
-
out = readability >= 3;
|
|
28396
|
-
break;
|
|
28397
|
-
case "AAAsmall":
|
|
28398
|
-
out = readability >= 7;
|
|
28399
|
-
break;
|
|
28400
|
-
}
|
|
28401
|
-
return out;
|
|
28402
|
-
};
|
|
28403
|
-
|
|
28404
|
-
// `mostReadable`
|
|
28405
|
-
// Given a base color and a list of possible foreground or background
|
|
28406
|
-
// colors for that base, returns the most readable color.
|
|
28407
|
-
// Optionally returns Black or White if the most readable color is unreadable.
|
|
28408
|
-
// *Example*
|
|
28409
|
-
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
|
|
28410
|
-
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
|
|
28411
|
-
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
|
|
28412
|
-
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
|
|
28413
|
-
tinycolor.mostReadable = function (baseColor, colorList, args) {
|
|
28414
|
-
var bestColor = null;
|
|
28415
|
-
var bestScore = 0;
|
|
28416
|
-
var readability;
|
|
28417
|
-
var includeFallbackColors, level, size;
|
|
28418
|
-
args = args || {};
|
|
28419
|
-
includeFallbackColors = args.includeFallbackColors;
|
|
28420
|
-
level = args.level;
|
|
28421
|
-
size = args.size;
|
|
28422
|
-
for (var i = 0; i < colorList.length; i++) {
|
|
28423
|
-
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
28424
|
-
if (readability > bestScore) {
|
|
28425
|
-
bestScore = readability;
|
|
28426
|
-
bestColor = tinycolor(colorList[i]);
|
|
28427
|
-
}
|
|
28428
|
-
}
|
|
28429
|
-
if (tinycolor.isReadable(baseColor, bestColor, {
|
|
28430
|
-
level: level,
|
|
28431
|
-
size: size
|
|
28432
|
-
}) || !includeFallbackColors) {
|
|
28433
|
-
return bestColor;
|
|
28434
|
-
} else {
|
|
28435
|
-
args.includeFallbackColors = false;
|
|
28436
|
-
return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
|
|
28437
|
-
}
|
|
28438
|
-
};
|
|
28439
|
-
|
|
28440
|
-
// Big List of Colors
|
|
28441
|
-
// ------------------
|
|
28442
|
-
// <https://www.w3.org/TR/css-color-4/#named-colors>
|
|
28443
|
-
var names = tinycolor.names = {
|
|
28444
|
-
aliceblue: "f0f8ff",
|
|
28445
|
-
antiquewhite: "faebd7",
|
|
28446
|
-
aqua: "0ff",
|
|
28447
|
-
aquamarine: "7fffd4",
|
|
28448
|
-
azure: "f0ffff",
|
|
28449
|
-
beige: "f5f5dc",
|
|
28450
|
-
bisque: "ffe4c4",
|
|
28451
|
-
black: "000",
|
|
28452
|
-
blanchedalmond: "ffebcd",
|
|
28453
|
-
blue: "00f",
|
|
28454
|
-
blueviolet: "8a2be2",
|
|
28455
|
-
brown: "a52a2a",
|
|
28456
|
-
burlywood: "deb887",
|
|
28457
|
-
burntsienna: "ea7e5d",
|
|
28458
|
-
cadetblue: "5f9ea0",
|
|
28459
|
-
chartreuse: "7fff00",
|
|
28460
|
-
chocolate: "d2691e",
|
|
28461
|
-
coral: "ff7f50",
|
|
28462
|
-
cornflowerblue: "6495ed",
|
|
28463
|
-
cornsilk: "fff8dc",
|
|
28464
|
-
crimson: "dc143c",
|
|
28465
|
-
cyan: "0ff",
|
|
28466
|
-
darkblue: "00008b",
|
|
28467
|
-
darkcyan: "008b8b",
|
|
28468
|
-
darkgoldenrod: "b8860b",
|
|
28469
|
-
darkgray: "a9a9a9",
|
|
28470
|
-
darkgreen: "006400",
|
|
28471
|
-
darkgrey: "a9a9a9",
|
|
28472
|
-
darkkhaki: "bdb76b",
|
|
28473
|
-
darkmagenta: "8b008b",
|
|
28474
|
-
darkolivegreen: "556b2f",
|
|
28475
|
-
darkorange: "ff8c00",
|
|
28476
|
-
darkorchid: "9932cc",
|
|
28477
|
-
darkred: "8b0000",
|
|
28478
|
-
darksalmon: "e9967a",
|
|
28479
|
-
darkseagreen: "8fbc8f",
|
|
28480
|
-
darkslateblue: "483d8b",
|
|
28481
|
-
darkslategray: "2f4f4f",
|
|
28482
|
-
darkslategrey: "2f4f4f",
|
|
28483
|
-
darkturquoise: "00ced1",
|
|
28484
|
-
darkviolet: "9400d3",
|
|
28485
|
-
deeppink: "ff1493",
|
|
28486
|
-
deepskyblue: "00bfff",
|
|
28487
|
-
dimgray: "696969",
|
|
28488
|
-
dimgrey: "696969",
|
|
28489
|
-
dodgerblue: "1e90ff",
|
|
28490
|
-
firebrick: "b22222",
|
|
28491
|
-
floralwhite: "fffaf0",
|
|
28492
|
-
forestgreen: "228b22",
|
|
28493
|
-
fuchsia: "f0f",
|
|
28494
|
-
gainsboro: "dcdcdc",
|
|
28495
|
-
ghostwhite: "f8f8ff",
|
|
28496
|
-
gold: "ffd700",
|
|
28497
|
-
goldenrod: "daa520",
|
|
28498
|
-
gray: "808080",
|
|
28499
|
-
green: "008000",
|
|
28500
|
-
greenyellow: "adff2f",
|
|
28501
|
-
grey: "808080",
|
|
28502
|
-
honeydew: "f0fff0",
|
|
28503
|
-
hotpink: "ff69b4",
|
|
28504
|
-
indianred: "cd5c5c",
|
|
28505
|
-
indigo: "4b0082",
|
|
28506
|
-
ivory: "fffff0",
|
|
28507
|
-
khaki: "f0e68c",
|
|
28508
|
-
lavender: "e6e6fa",
|
|
28509
|
-
lavenderblush: "fff0f5",
|
|
28510
|
-
lawngreen: "7cfc00",
|
|
28511
|
-
lemonchiffon: "fffacd",
|
|
28512
|
-
lightblue: "add8e6",
|
|
28513
|
-
lightcoral: "f08080",
|
|
28514
|
-
lightcyan: "e0ffff",
|
|
28515
|
-
lightgoldenrodyellow: "fafad2",
|
|
28516
|
-
lightgray: "d3d3d3",
|
|
28517
|
-
lightgreen: "90ee90",
|
|
28518
|
-
lightgrey: "d3d3d3",
|
|
28519
|
-
lightpink: "ffb6c1",
|
|
28520
|
-
lightsalmon: "ffa07a",
|
|
28521
|
-
lightseagreen: "20b2aa",
|
|
28522
|
-
lightskyblue: "87cefa",
|
|
28523
|
-
lightslategray: "789",
|
|
28524
|
-
lightslategrey: "789",
|
|
28525
|
-
lightsteelblue: "b0c4de",
|
|
28526
|
-
lightyellow: "ffffe0",
|
|
28527
|
-
lime: "0f0",
|
|
28528
|
-
limegreen: "32cd32",
|
|
28529
|
-
linen: "faf0e6",
|
|
28530
|
-
magenta: "f0f",
|
|
28531
|
-
maroon: "800000",
|
|
28532
|
-
mediumaquamarine: "66cdaa",
|
|
28533
|
-
mediumblue: "0000cd",
|
|
28534
|
-
mediumorchid: "ba55d3",
|
|
28535
|
-
mediumpurple: "9370db",
|
|
28536
|
-
mediumseagreen: "3cb371",
|
|
28537
|
-
mediumslateblue: "7b68ee",
|
|
28538
|
-
mediumspringgreen: "00fa9a",
|
|
28539
|
-
mediumturquoise: "48d1cc",
|
|
28540
|
-
mediumvioletred: "c71585",
|
|
28541
|
-
midnightblue: "191970",
|
|
28542
|
-
mintcream: "f5fffa",
|
|
28543
|
-
mistyrose: "ffe4e1",
|
|
28544
|
-
moccasin: "ffe4b5",
|
|
28545
|
-
navajowhite: "ffdead",
|
|
28546
|
-
navy: "000080",
|
|
28547
|
-
oldlace: "fdf5e6",
|
|
28548
|
-
olive: "808000",
|
|
28549
|
-
olivedrab: "6b8e23",
|
|
28550
|
-
orange: "ffa500",
|
|
28551
|
-
orangered: "ff4500",
|
|
28552
|
-
orchid: "da70d6",
|
|
28553
|
-
palegoldenrod: "eee8aa",
|
|
28554
|
-
palegreen: "98fb98",
|
|
28555
|
-
paleturquoise: "afeeee",
|
|
28556
|
-
palevioletred: "db7093",
|
|
28557
|
-
papayawhip: "ffefd5",
|
|
28558
|
-
peachpuff: "ffdab9",
|
|
28559
|
-
peru: "cd853f",
|
|
28560
|
-
pink: "ffc0cb",
|
|
28561
|
-
plum: "dda0dd",
|
|
28562
|
-
powderblue: "b0e0e6",
|
|
28563
|
-
purple: "800080",
|
|
28564
|
-
rebeccapurple: "663399",
|
|
28565
|
-
red: "f00",
|
|
28566
|
-
rosybrown: "bc8f8f",
|
|
28567
|
-
royalblue: "4169e1",
|
|
28568
|
-
saddlebrown: "8b4513",
|
|
28569
|
-
salmon: "fa8072",
|
|
28570
|
-
sandybrown: "f4a460",
|
|
28571
|
-
seagreen: "2e8b57",
|
|
28572
|
-
seashell: "fff5ee",
|
|
28573
|
-
sienna: "a0522d",
|
|
28574
|
-
silver: "c0c0c0",
|
|
28575
|
-
skyblue: "87ceeb",
|
|
28576
|
-
slateblue: "6a5acd",
|
|
28577
|
-
slategray: "708090",
|
|
28578
|
-
slategrey: "708090",
|
|
28579
|
-
snow: "fffafa",
|
|
28580
|
-
springgreen: "00ff7f",
|
|
28581
|
-
steelblue: "4682b4",
|
|
28582
|
-
tan: "d2b48c",
|
|
28583
|
-
teal: "008080",
|
|
28584
|
-
thistle: "d8bfd8",
|
|
28585
|
-
tomato: "ff6347",
|
|
28586
|
-
turquoise: "40e0d0",
|
|
28587
|
-
violet: "ee82ee",
|
|
28588
|
-
wheat: "f5deb3",
|
|
28589
|
-
white: "fff",
|
|
28590
|
-
whitesmoke: "f5f5f5",
|
|
28591
|
-
yellow: "ff0",
|
|
28592
|
-
yellowgreen: "9acd32"
|
|
28593
|
-
};
|
|
28594
|
-
|
|
28595
|
-
// Make it easy to access colors via `hexNames[hex]`
|
|
28596
|
-
var hexNames = tinycolor.hexNames = flip(names);
|
|
28597
|
-
|
|
28598
|
-
// Utilities
|
|
28599
|
-
// ---------
|
|
28600
|
-
|
|
28601
|
-
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
|
|
28602
|
-
function flip(o) {
|
|
28603
|
-
var flipped = {};
|
|
28604
|
-
for (var i in o) {
|
|
28605
|
-
if (o.hasOwnProperty(i)) {
|
|
28606
|
-
flipped[o[i]] = i;
|
|
28607
|
-
}
|
|
28608
|
-
}
|
|
28609
|
-
return flipped;
|
|
28610
|
-
}
|
|
28611
|
-
|
|
28612
|
-
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
28613
|
-
function boundAlpha(a) {
|
|
28614
|
-
a = parseFloat(a);
|
|
28615
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
28616
|
-
a = 1;
|
|
28617
|
-
}
|
|
28618
|
-
return a;
|
|
28619
|
-
}
|
|
28620
|
-
|
|
28621
|
-
// Take input from [0, n] and return it as [0, 1]
|
|
28622
|
-
function bound01(n, max) {
|
|
28623
|
-
if (isOnePointZero(n)) n = "100%";
|
|
28624
|
-
var processPercent = isPercentage(n);
|
|
28625
|
-
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
28626
|
-
|
|
28627
|
-
// Automatically convert percentage into number
|
|
28628
|
-
if (processPercent) {
|
|
28629
|
-
n = parseInt(n * max, 10) / 100;
|
|
28630
|
-
}
|
|
28631
|
-
|
|
28632
|
-
// Handle floating point rounding errors
|
|
28633
|
-
if (Math.abs(n - max) < 0.000001) {
|
|
28634
|
-
return 1;
|
|
28635
|
-
}
|
|
28031
|
+
return {
|
|
28032
|
+
ok: ok,
|
|
28033
|
+
format: color.format || format,
|
|
28034
|
+
r: mathMin(255, mathMax(rgb.r, 0)),
|
|
28035
|
+
g: mathMin(255, mathMax(rgb.g, 0)),
|
|
28036
|
+
b: mathMin(255, mathMax(rgb.b, 0)),
|
|
28037
|
+
a: a
|
|
28038
|
+
};
|
|
28039
|
+
}
|
|
28636
28040
|
|
|
28637
|
-
// Convert into [0, 1] range if it isn't already
|
|
28638
|
-
return n % max / parseFloat(max);
|
|
28639
|
-
}
|
|
28640
28041
|
|
|
28641
|
-
//
|
|
28642
|
-
|
|
28643
|
-
return Math.min(1, Math.max(0, val));
|
|
28644
|
-
}
|
|
28042
|
+
// Conversion Functions
|
|
28043
|
+
// --------------------
|
|
28645
28044
|
|
|
28646
|
-
//
|
|
28647
|
-
|
|
28648
|
-
return parseInt(val, 16);
|
|
28649
|
-
}
|
|
28045
|
+
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
|
28046
|
+
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
28650
28047
|
|
|
28651
|
-
//
|
|
28652
|
-
//
|
|
28653
|
-
|
|
28654
|
-
|
|
28655
|
-
}
|
|
28048
|
+
// `rgbToRgb`
|
|
28049
|
+
// Handle bounds / percentage checking to conform to CSS color spec
|
|
28050
|
+
// <http://www.w3.org/TR/css3-color/>
|
|
28051
|
+
// *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
28052
|
+
// *Returns:* { r, g, b } in [0, 255]
|
|
28053
|
+
function rgbToRgb(r, g, b){
|
|
28054
|
+
return {
|
|
28055
|
+
r: bound01(r, 255) * 255,
|
|
28056
|
+
g: bound01(g, 255) * 255,
|
|
28057
|
+
b: bound01(b, 255) * 255
|
|
28058
|
+
};
|
|
28059
|
+
}
|
|
28656
28060
|
|
|
28657
|
-
//
|
|
28658
|
-
|
|
28659
|
-
|
|
28660
|
-
}
|
|
28061
|
+
// `rgbToHsl`
|
|
28062
|
+
// Converts an RGB color value to HSL.
|
|
28063
|
+
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
|
|
28064
|
+
// *Returns:* { h, s, l } in [0,1]
|
|
28065
|
+
function rgbToHsl(r, g, b) {
|
|
28661
28066
|
|
|
28662
|
-
|
|
28663
|
-
|
|
28664
|
-
|
|
28665
|
-
}
|
|
28067
|
+
r = bound01(r, 255);
|
|
28068
|
+
g = bound01(g, 255);
|
|
28069
|
+
b = bound01(b, 255);
|
|
28666
28070
|
|
|
28667
|
-
|
|
28668
|
-
|
|
28669
|
-
if (n <= 1) {
|
|
28670
|
-
n = n * 100 + "%";
|
|
28671
|
-
}
|
|
28672
|
-
return n;
|
|
28673
|
-
}
|
|
28071
|
+
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
|
28072
|
+
var h, s, l = (max + min) / 2;
|
|
28674
28073
|
|
|
28675
|
-
|
|
28676
|
-
|
|
28677
|
-
|
|
28678
|
-
|
|
28679
|
-
|
|
28680
|
-
|
|
28681
|
-
|
|
28682
|
-
|
|
28683
|
-
|
|
28684
|
-
|
|
28685
|
-
|
|
28074
|
+
if(max == min) {
|
|
28075
|
+
h = s = 0; // achromatic
|
|
28076
|
+
}
|
|
28077
|
+
else {
|
|
28078
|
+
var d = max - min;
|
|
28079
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
28080
|
+
switch(max) {
|
|
28081
|
+
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
|
28082
|
+
case g: h = (b - r) / d + 2; break;
|
|
28083
|
+
case b: h = (r - g) / d + 4; break;
|
|
28084
|
+
}
|
|
28686
28085
|
|
|
28687
|
-
|
|
28688
|
-
|
|
28086
|
+
h /= 6;
|
|
28087
|
+
}
|
|
28689
28088
|
|
|
28690
|
-
|
|
28691
|
-
|
|
28089
|
+
return { h: h, s: s, l: l };
|
|
28090
|
+
}
|
|
28692
28091
|
|
|
28693
|
-
|
|
28694
|
-
|
|
28695
|
-
|
|
28696
|
-
|
|
28697
|
-
|
|
28698
|
-
|
|
28699
|
-
|
|
28700
|
-
|
|
28701
|
-
|
|
28702
|
-
|
|
28703
|
-
|
|
28704
|
-
|
|
28705
|
-
|
|
28706
|
-
|
|
28707
|
-
|
|
28708
|
-
|
|
28709
|
-
|
|
28710
|
-
|
|
28711
|
-
}
|
|
28092
|
+
// `hslToRgb`
|
|
28093
|
+
// Converts an HSL color value to RGB.
|
|
28094
|
+
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
|
28095
|
+
// *Returns:* { r, g, b } in the set [0, 255]
|
|
28096
|
+
function hslToRgb(h, s, l) {
|
|
28097
|
+
var r, g, b;
|
|
28098
|
+
|
|
28099
|
+
h = bound01(h, 360);
|
|
28100
|
+
s = bound01(s, 100);
|
|
28101
|
+
l = bound01(l, 100);
|
|
28102
|
+
|
|
28103
|
+
function hue2rgb(p, q, t) {
|
|
28104
|
+
if(t < 0) t += 1;
|
|
28105
|
+
if(t > 1) t -= 1;
|
|
28106
|
+
if(t < 1/6) return p + (q - p) * 6 * t;
|
|
28107
|
+
if(t < 1/2) return q;
|
|
28108
|
+
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
|
28109
|
+
return p;
|
|
28110
|
+
}
|
|
28712
28111
|
|
|
28713
|
-
|
|
28714
|
-
|
|
28715
|
-
|
|
28716
|
-
|
|
28717
|
-
|
|
28718
|
-
|
|
28719
|
-
|
|
28720
|
-
|
|
28721
|
-
|
|
28722
|
-
|
|
28723
|
-
function stringInputToObject(color) {
|
|
28724
|
-
color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
|
|
28725
|
-
var named = false;
|
|
28726
|
-
if (names[color]) {
|
|
28727
|
-
color = names[color];
|
|
28728
|
-
named = true;
|
|
28729
|
-
} else if (color == "transparent") {
|
|
28730
|
-
return {
|
|
28731
|
-
r: 0,
|
|
28732
|
-
g: 0,
|
|
28733
|
-
b: 0,
|
|
28734
|
-
a: 0,
|
|
28735
|
-
format: "name"
|
|
28736
|
-
};
|
|
28737
|
-
}
|
|
28112
|
+
if(s === 0) {
|
|
28113
|
+
r = g = b = l; // achromatic
|
|
28114
|
+
}
|
|
28115
|
+
else {
|
|
28116
|
+
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
28117
|
+
var p = 2 * l - q;
|
|
28118
|
+
r = hue2rgb(p, q, h + 1/3);
|
|
28119
|
+
g = hue2rgb(p, q, h);
|
|
28120
|
+
b = hue2rgb(p, q, h - 1/3);
|
|
28121
|
+
}
|
|
28738
28122
|
|
|
28739
|
-
|
|
28740
|
-
|
|
28741
|
-
|
|
28742
|
-
|
|
28743
|
-
|
|
28744
|
-
|
|
28745
|
-
|
|
28746
|
-
|
|
28747
|
-
|
|
28748
|
-
|
|
28749
|
-
|
|
28750
|
-
|
|
28751
|
-
|
|
28752
|
-
|
|
28753
|
-
|
|
28754
|
-
|
|
28755
|
-
|
|
28756
|
-
|
|
28757
|
-
|
|
28758
|
-
|
|
28759
|
-
|
|
28760
|
-
|
|
28761
|
-
|
|
28762
|
-
|
|
28763
|
-
|
|
28764
|
-
|
|
28765
|
-
|
|
28766
|
-
|
|
28767
|
-
|
|
28768
|
-
|
|
28769
|
-
|
|
28770
|
-
|
|
28771
|
-
|
|
28772
|
-
|
|
28773
|
-
|
|
28774
|
-
|
|
28775
|
-
|
|
28776
|
-
|
|
28777
|
-
|
|
28778
|
-
|
|
28779
|
-
|
|
28780
|
-
|
|
28781
|
-
|
|
28782
|
-
|
|
28783
|
-
|
|
28784
|
-
|
|
28785
|
-
|
|
28786
|
-
|
|
28787
|
-
|
|
28788
|
-
|
|
28789
|
-
|
|
28790
|
-
|
|
28791
|
-
|
|
28792
|
-
|
|
28793
|
-
|
|
28794
|
-
|
|
28795
|
-
|
|
28796
|
-
|
|
28797
|
-
|
|
28798
|
-
|
|
28799
|
-
|
|
28800
|
-
|
|
28801
|
-
|
|
28802
|
-
|
|
28803
|
-
|
|
28804
|
-
|
|
28805
|
-
|
|
28806
|
-
|
|
28807
|
-
|
|
28808
|
-
|
|
28809
|
-
|
|
28810
|
-
|
|
28811
|
-
|
|
28812
|
-
|
|
28813
|
-
|
|
28814
|
-
|
|
28815
|
-
|
|
28816
|
-
|
|
28817
|
-
|
|
28818
|
-
|
|
28819
|
-
|
|
28820
|
-
|
|
28821
|
-
|
|
28822
|
-
|
|
28823
|
-
|
|
28824
|
-
|
|
28825
|
-
|
|
28826
|
-
|
|
28827
|
-
|
|
28828
|
-
|
|
28829
|
-
|
|
28830
|
-
|
|
28831
|
-
|
|
28832
|
-
|
|
28833
|
-
|
|
28834
|
-
|
|
28835
|
-
|
|
28836
|
-
|
|
28837
|
-
|
|
28838
|
-
|
|
28839
|
-
|
|
28840
|
-
|
|
28841
|
-
|
|
28842
|
-
|
|
28843
|
-
|
|
28844
|
-
|
|
28845
|
-
|
|
28123
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
28124
|
+
}
|
|
28125
|
+
|
|
28126
|
+
// `rgbToHsv`
|
|
28127
|
+
// Converts an RGB color value to HSV
|
|
28128
|
+
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
28129
|
+
// *Returns:* { h, s, v } in [0,1]
|
|
28130
|
+
function rgbToHsv(r, g, b) {
|
|
28131
|
+
|
|
28132
|
+
r = bound01(r, 255);
|
|
28133
|
+
g = bound01(g, 255);
|
|
28134
|
+
b = bound01(b, 255);
|
|
28135
|
+
|
|
28136
|
+
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
|
28137
|
+
var h, s, v = max;
|
|
28138
|
+
|
|
28139
|
+
var d = max - min;
|
|
28140
|
+
s = max === 0 ? 0 : d / max;
|
|
28141
|
+
|
|
28142
|
+
if(max == min) {
|
|
28143
|
+
h = 0; // achromatic
|
|
28144
|
+
}
|
|
28145
|
+
else {
|
|
28146
|
+
switch(max) {
|
|
28147
|
+
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
|
28148
|
+
case g: h = (b - r) / d + 2; break;
|
|
28149
|
+
case b: h = (r - g) / d + 4; break;
|
|
28150
|
+
}
|
|
28151
|
+
h /= 6;
|
|
28152
|
+
}
|
|
28153
|
+
return { h: h, s: s, v: v };
|
|
28154
|
+
}
|
|
28155
|
+
|
|
28156
|
+
// `hsvToRgb`
|
|
28157
|
+
// Converts an HSV color value to RGB.
|
|
28158
|
+
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
28159
|
+
// *Returns:* { r, g, b } in the set [0, 255]
|
|
28160
|
+
function hsvToRgb(h, s, v) {
|
|
28161
|
+
|
|
28162
|
+
h = bound01(h, 360) * 6;
|
|
28163
|
+
s = bound01(s, 100);
|
|
28164
|
+
v = bound01(v, 100);
|
|
28165
|
+
|
|
28166
|
+
var i = Math.floor(h),
|
|
28167
|
+
f = h - i,
|
|
28168
|
+
p = v * (1 - s),
|
|
28169
|
+
q = v * (1 - f * s),
|
|
28170
|
+
t = v * (1 - (1 - f) * s),
|
|
28171
|
+
mod = i % 6,
|
|
28172
|
+
r = [v, q, p, p, t, v][mod],
|
|
28173
|
+
g = [t, v, v, q, p, p][mod],
|
|
28174
|
+
b = [p, p, t, v, v, q][mod];
|
|
28175
|
+
|
|
28176
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
28177
|
+
}
|
|
28178
|
+
|
|
28179
|
+
// `rgbToHex`
|
|
28180
|
+
// Converts an RGB color to hex
|
|
28181
|
+
// Assumes r, g, and b are contained in the set [0, 255]
|
|
28182
|
+
// Returns a 3 or 6 character hex
|
|
28183
|
+
function rgbToHex(r, g, b, allow3Char) {
|
|
28184
|
+
|
|
28185
|
+
var hex = [
|
|
28186
|
+
pad2(mathRound(r).toString(16)),
|
|
28187
|
+
pad2(mathRound(g).toString(16)),
|
|
28188
|
+
pad2(mathRound(b).toString(16))
|
|
28189
|
+
];
|
|
28190
|
+
|
|
28191
|
+
// Return a 3 character hex if possible
|
|
28192
|
+
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
|
|
28193
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
28194
|
+
}
|
|
28195
|
+
|
|
28196
|
+
return hex.join("");
|
|
28197
|
+
}
|
|
28198
|
+
|
|
28199
|
+
// `rgbaToHex`
|
|
28200
|
+
// Converts an RGBA color plus alpha transparency to hex
|
|
28201
|
+
// Assumes r, g, b are contained in the set [0, 255] and
|
|
28202
|
+
// a in [0, 1]. Returns a 4 or 8 character rgba hex
|
|
28203
|
+
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
28204
|
+
|
|
28205
|
+
var hex = [
|
|
28206
|
+
pad2(mathRound(r).toString(16)),
|
|
28207
|
+
pad2(mathRound(g).toString(16)),
|
|
28208
|
+
pad2(mathRound(b).toString(16)),
|
|
28209
|
+
pad2(convertDecimalToHex(a))
|
|
28210
|
+
];
|
|
28211
|
+
|
|
28212
|
+
// Return a 4 character hex if possible
|
|
28213
|
+
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
|
|
28214
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
28215
|
+
}
|
|
28216
|
+
|
|
28217
|
+
return hex.join("");
|
|
28218
|
+
}
|
|
28219
|
+
|
|
28220
|
+
// `rgbaToArgbHex`
|
|
28221
|
+
// Converts an RGBA color to an ARGB Hex8 string
|
|
28222
|
+
// Rarely used, but required for "toFilter()"
|
|
28223
|
+
function rgbaToArgbHex(r, g, b, a) {
|
|
28224
|
+
|
|
28225
|
+
var hex = [
|
|
28226
|
+
pad2(convertDecimalToHex(a)),
|
|
28227
|
+
pad2(mathRound(r).toString(16)),
|
|
28228
|
+
pad2(mathRound(g).toString(16)),
|
|
28229
|
+
pad2(mathRound(b).toString(16))
|
|
28230
|
+
];
|
|
28231
|
+
|
|
28232
|
+
return hex.join("");
|
|
28233
|
+
}
|
|
28234
|
+
|
|
28235
|
+
// `equals`
|
|
28236
|
+
// Can be called with any tinycolor input
|
|
28237
|
+
tinycolor.equals = function (color1, color2) {
|
|
28238
|
+
if (!color1 || !color2) { return false; }
|
|
28239
|
+
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
28240
|
+
};
|
|
28241
|
+
|
|
28242
|
+
tinycolor.random = function() {
|
|
28243
|
+
return tinycolor.fromRatio({
|
|
28244
|
+
r: mathRandom(),
|
|
28245
|
+
g: mathRandom(),
|
|
28246
|
+
b: mathRandom()
|
|
28247
|
+
});
|
|
28248
|
+
};
|
|
28249
|
+
|
|
28250
|
+
|
|
28251
|
+
// Modification Functions
|
|
28252
|
+
// ----------------------
|
|
28253
|
+
// Thanks to less.js for some of the basics here
|
|
28254
|
+
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
|
|
28255
|
+
|
|
28256
|
+
function desaturate(color, amount) {
|
|
28257
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28258
|
+
var hsl = tinycolor(color).toHsl();
|
|
28259
|
+
hsl.s -= amount / 100;
|
|
28260
|
+
hsl.s = clamp01(hsl.s);
|
|
28261
|
+
return tinycolor(hsl);
|
|
28262
|
+
}
|
|
28263
|
+
|
|
28264
|
+
function saturate(color, amount) {
|
|
28265
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28266
|
+
var hsl = tinycolor(color).toHsl();
|
|
28267
|
+
hsl.s += amount / 100;
|
|
28268
|
+
hsl.s = clamp01(hsl.s);
|
|
28269
|
+
return tinycolor(hsl);
|
|
28270
|
+
}
|
|
28271
|
+
|
|
28272
|
+
function greyscale(color) {
|
|
28273
|
+
return tinycolor(color).desaturate(100);
|
|
28274
|
+
}
|
|
28275
|
+
|
|
28276
|
+
function lighten (color, amount) {
|
|
28277
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28278
|
+
var hsl = tinycolor(color).toHsl();
|
|
28279
|
+
hsl.l += amount / 100;
|
|
28280
|
+
hsl.l = clamp01(hsl.l);
|
|
28281
|
+
return tinycolor(hsl);
|
|
28282
|
+
}
|
|
28283
|
+
|
|
28284
|
+
function brighten(color, amount) {
|
|
28285
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28286
|
+
var rgb = tinycolor(color).toRgb();
|
|
28287
|
+
rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
|
|
28288
|
+
rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
|
|
28289
|
+
rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
|
|
28290
|
+
return tinycolor(rgb);
|
|
28291
|
+
}
|
|
28292
|
+
|
|
28293
|
+
function darken (color, amount) {
|
|
28294
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28295
|
+
var hsl = tinycolor(color).toHsl();
|
|
28296
|
+
hsl.l -= amount / 100;
|
|
28297
|
+
hsl.l = clamp01(hsl.l);
|
|
28298
|
+
return tinycolor(hsl);
|
|
28299
|
+
}
|
|
28300
|
+
|
|
28301
|
+
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
28302
|
+
// Values outside of this range will be wrapped into this range.
|
|
28303
|
+
function spin(color, amount) {
|
|
28304
|
+
var hsl = tinycolor(color).toHsl();
|
|
28305
|
+
var hue = (hsl.h + amount) % 360;
|
|
28306
|
+
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
28307
|
+
return tinycolor(hsl);
|
|
28308
|
+
}
|
|
28309
|
+
|
|
28310
|
+
// Combination Functions
|
|
28311
|
+
// ---------------------
|
|
28312
|
+
// Thanks to jQuery xColor for some of the ideas behind these
|
|
28313
|
+
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
|
28314
|
+
|
|
28315
|
+
function complement(color) {
|
|
28316
|
+
var hsl = tinycolor(color).toHsl();
|
|
28317
|
+
hsl.h = (hsl.h + 180) % 360;
|
|
28318
|
+
return tinycolor(hsl);
|
|
28319
|
+
}
|
|
28320
|
+
|
|
28321
|
+
function triad(color) {
|
|
28322
|
+
var hsl = tinycolor(color).toHsl();
|
|
28323
|
+
var h = hsl.h;
|
|
28324
|
+
return [
|
|
28325
|
+
tinycolor(color),
|
|
28326
|
+
tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
|
|
28327
|
+
tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
|
|
28328
|
+
];
|
|
28329
|
+
}
|
|
28330
|
+
|
|
28331
|
+
function tetrad(color) {
|
|
28332
|
+
var hsl = tinycolor(color).toHsl();
|
|
28333
|
+
var h = hsl.h;
|
|
28334
|
+
return [
|
|
28335
|
+
tinycolor(color),
|
|
28336
|
+
tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
|
|
28337
|
+
tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
|
|
28338
|
+
tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
|
|
28339
|
+
];
|
|
28340
|
+
}
|
|
28341
|
+
|
|
28342
|
+
function splitcomplement(color) {
|
|
28343
|
+
var hsl = tinycolor(color).toHsl();
|
|
28344
|
+
var h = hsl.h;
|
|
28345
|
+
return [
|
|
28346
|
+
tinycolor(color),
|
|
28347
|
+
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
|
|
28348
|
+
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
|
|
28349
|
+
];
|
|
28350
|
+
}
|
|
28351
|
+
|
|
28352
|
+
function analogous(color, results, slices) {
|
|
28353
|
+
results = results || 6;
|
|
28354
|
+
slices = slices || 30;
|
|
28355
|
+
|
|
28356
|
+
var hsl = tinycolor(color).toHsl();
|
|
28357
|
+
var part = 360 / slices;
|
|
28358
|
+
var ret = [tinycolor(color)];
|
|
28359
|
+
|
|
28360
|
+
for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
|
|
28361
|
+
hsl.h = (hsl.h + part) % 360;
|
|
28362
|
+
ret.push(tinycolor(hsl));
|
|
28363
|
+
}
|
|
28364
|
+
return ret;
|
|
28365
|
+
}
|
|
28366
|
+
|
|
28367
|
+
function monochromatic(color, results) {
|
|
28368
|
+
results = results || 6;
|
|
28369
|
+
var hsv = tinycolor(color).toHsv();
|
|
28370
|
+
var h = hsv.h, s = hsv.s, v = hsv.v;
|
|
28371
|
+
var ret = [];
|
|
28372
|
+
var modification = 1 / results;
|
|
28373
|
+
|
|
28374
|
+
while (results--) {
|
|
28375
|
+
ret.push(tinycolor({ h: h, s: s, v: v}));
|
|
28376
|
+
v = (v + modification) % 1;
|
|
28377
|
+
}
|
|
28378
|
+
|
|
28379
|
+
return ret;
|
|
28380
|
+
}
|
|
28381
|
+
|
|
28382
|
+
// Utility Functions
|
|
28383
|
+
// ---------------------
|
|
28384
|
+
|
|
28385
|
+
tinycolor.mix = function(color1, color2, amount) {
|
|
28386
|
+
amount = (amount === 0) ? 0 : (amount || 50);
|
|
28387
|
+
|
|
28388
|
+
var rgb1 = tinycolor(color1).toRgb();
|
|
28389
|
+
var rgb2 = tinycolor(color2).toRgb();
|
|
28390
|
+
|
|
28391
|
+
var p = amount / 100;
|
|
28392
|
+
|
|
28393
|
+
var rgba = {
|
|
28394
|
+
r: ((rgb2.r - rgb1.r) * p) + rgb1.r,
|
|
28395
|
+
g: ((rgb2.g - rgb1.g) * p) + rgb1.g,
|
|
28396
|
+
b: ((rgb2.b - rgb1.b) * p) + rgb1.b,
|
|
28397
|
+
a: ((rgb2.a - rgb1.a) * p) + rgb1.a
|
|
28398
|
+
};
|
|
28399
|
+
|
|
28400
|
+
return tinycolor(rgba);
|
|
28401
|
+
};
|
|
28402
|
+
|
|
28403
|
+
|
|
28404
|
+
// Readability Functions
|
|
28405
|
+
// ---------------------
|
|
28406
|
+
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
|
|
28407
|
+
|
|
28408
|
+
// `contrast`
|
|
28409
|
+
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
|
|
28410
|
+
tinycolor.readability = function(color1, color2) {
|
|
28411
|
+
var c1 = tinycolor(color1);
|
|
28412
|
+
var c2 = tinycolor(color2);
|
|
28413
|
+
return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05);
|
|
28414
|
+
};
|
|
28415
|
+
|
|
28416
|
+
// `isReadable`
|
|
28417
|
+
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
|
28418
|
+
// The third argument is an optional Object.
|
|
28419
|
+
// the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
|
|
28420
|
+
// the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
|
|
28421
|
+
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
|
|
28422
|
+
|
|
28423
|
+
// *Example*
|
|
28424
|
+
// tinycolor.isReadable("#000", "#111") => false
|
|
28425
|
+
// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
|
|
28426
|
+
tinycolor.isReadable = function(color1, color2, wcag2) {
|
|
28427
|
+
var readability = tinycolor.readability(color1, color2);
|
|
28428
|
+
var wcag2Parms, out;
|
|
28429
|
+
|
|
28430
|
+
out = false;
|
|
28431
|
+
|
|
28432
|
+
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
28433
|
+
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
28434
|
+
case "AAsmall":
|
|
28435
|
+
case "AAAlarge":
|
|
28436
|
+
out = readability >= 4.5;
|
|
28437
|
+
break;
|
|
28438
|
+
case "AAlarge":
|
|
28439
|
+
out = readability >= 3;
|
|
28440
|
+
break;
|
|
28441
|
+
case "AAAsmall":
|
|
28442
|
+
out = readability >= 7;
|
|
28443
|
+
break;
|
|
28444
|
+
}
|
|
28445
|
+
return out;
|
|
28446
|
+
|
|
28447
|
+
};
|
|
28448
|
+
|
|
28449
|
+
// `mostReadable`
|
|
28450
|
+
// Given a base color and a list of possible foreground or background
|
|
28451
|
+
// colors for that base, returns the most readable color.
|
|
28452
|
+
// Optionally returns Black or White if the most readable color is unreadable.
|
|
28453
|
+
// *Example*
|
|
28454
|
+
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
|
|
28455
|
+
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
|
|
28456
|
+
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
|
|
28457
|
+
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
|
|
28458
|
+
tinycolor.mostReadable = function(baseColor, colorList, args) {
|
|
28459
|
+
var bestColor = null;
|
|
28460
|
+
var bestScore = 0;
|
|
28461
|
+
var readability;
|
|
28462
|
+
var includeFallbackColors, level, size ;
|
|
28463
|
+
args = args || {};
|
|
28464
|
+
includeFallbackColors = args.includeFallbackColors ;
|
|
28465
|
+
level = args.level;
|
|
28466
|
+
size = args.size;
|
|
28467
|
+
|
|
28468
|
+
for (var i= 0; i < colorList.length ; i++) {
|
|
28469
|
+
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
28470
|
+
if (readability > bestScore) {
|
|
28471
|
+
bestScore = readability;
|
|
28472
|
+
bestColor = tinycolor(colorList[i]);
|
|
28473
|
+
}
|
|
28474
|
+
}
|
|
28475
|
+
|
|
28476
|
+
if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) {
|
|
28477
|
+
return bestColor;
|
|
28478
|
+
}
|
|
28479
|
+
else {
|
|
28480
|
+
args.includeFallbackColors=false;
|
|
28481
|
+
return tinycolor.mostReadable(baseColor,["#fff", "#000"],args);
|
|
28482
|
+
}
|
|
28483
|
+
};
|
|
28484
|
+
|
|
28485
|
+
|
|
28486
|
+
// Big List of Colors
|
|
28487
|
+
// ------------------
|
|
28488
|
+
// <http://www.w3.org/TR/css3-color/#svg-color>
|
|
28489
|
+
var names = tinycolor.names = {
|
|
28490
|
+
aliceblue: "f0f8ff",
|
|
28491
|
+
antiquewhite: "faebd7",
|
|
28492
|
+
aqua: "0ff",
|
|
28493
|
+
aquamarine: "7fffd4",
|
|
28494
|
+
azure: "f0ffff",
|
|
28495
|
+
beige: "f5f5dc",
|
|
28496
|
+
bisque: "ffe4c4",
|
|
28497
|
+
black: "000",
|
|
28498
|
+
blanchedalmond: "ffebcd",
|
|
28499
|
+
blue: "00f",
|
|
28500
|
+
blueviolet: "8a2be2",
|
|
28501
|
+
brown: "a52a2a",
|
|
28502
|
+
burlywood: "deb887",
|
|
28503
|
+
burntsienna: "ea7e5d",
|
|
28504
|
+
cadetblue: "5f9ea0",
|
|
28505
|
+
chartreuse: "7fff00",
|
|
28506
|
+
chocolate: "d2691e",
|
|
28507
|
+
coral: "ff7f50",
|
|
28508
|
+
cornflowerblue: "6495ed",
|
|
28509
|
+
cornsilk: "fff8dc",
|
|
28510
|
+
crimson: "dc143c",
|
|
28511
|
+
cyan: "0ff",
|
|
28512
|
+
darkblue: "00008b",
|
|
28513
|
+
darkcyan: "008b8b",
|
|
28514
|
+
darkgoldenrod: "b8860b",
|
|
28515
|
+
darkgray: "a9a9a9",
|
|
28516
|
+
darkgreen: "006400",
|
|
28517
|
+
darkgrey: "a9a9a9",
|
|
28518
|
+
darkkhaki: "bdb76b",
|
|
28519
|
+
darkmagenta: "8b008b",
|
|
28520
|
+
darkolivegreen: "556b2f",
|
|
28521
|
+
darkorange: "ff8c00",
|
|
28522
|
+
darkorchid: "9932cc",
|
|
28523
|
+
darkred: "8b0000",
|
|
28524
|
+
darksalmon: "e9967a",
|
|
28525
|
+
darkseagreen: "8fbc8f",
|
|
28526
|
+
darkslateblue: "483d8b",
|
|
28527
|
+
darkslategray: "2f4f4f",
|
|
28528
|
+
darkslategrey: "2f4f4f",
|
|
28529
|
+
darkturquoise: "00ced1",
|
|
28530
|
+
darkviolet: "9400d3",
|
|
28531
|
+
deeppink: "ff1493",
|
|
28532
|
+
deepskyblue: "00bfff",
|
|
28533
|
+
dimgray: "696969",
|
|
28534
|
+
dimgrey: "696969",
|
|
28535
|
+
dodgerblue: "1e90ff",
|
|
28536
|
+
firebrick: "b22222",
|
|
28537
|
+
floralwhite: "fffaf0",
|
|
28538
|
+
forestgreen: "228b22",
|
|
28539
|
+
fuchsia: "f0f",
|
|
28540
|
+
gainsboro: "dcdcdc",
|
|
28541
|
+
ghostwhite: "f8f8ff",
|
|
28542
|
+
gold: "ffd700",
|
|
28543
|
+
goldenrod: "daa520",
|
|
28544
|
+
gray: "808080",
|
|
28545
|
+
green: "008000",
|
|
28546
|
+
greenyellow: "adff2f",
|
|
28547
|
+
grey: "808080",
|
|
28548
|
+
honeydew: "f0fff0",
|
|
28549
|
+
hotpink: "ff69b4",
|
|
28550
|
+
indianred: "cd5c5c",
|
|
28551
|
+
indigo: "4b0082",
|
|
28552
|
+
ivory: "fffff0",
|
|
28553
|
+
khaki: "f0e68c",
|
|
28554
|
+
lavender: "e6e6fa",
|
|
28555
|
+
lavenderblush: "fff0f5",
|
|
28556
|
+
lawngreen: "7cfc00",
|
|
28557
|
+
lemonchiffon: "fffacd",
|
|
28558
|
+
lightblue: "add8e6",
|
|
28559
|
+
lightcoral: "f08080",
|
|
28560
|
+
lightcyan: "e0ffff",
|
|
28561
|
+
lightgoldenrodyellow: "fafad2",
|
|
28562
|
+
lightgray: "d3d3d3",
|
|
28563
|
+
lightgreen: "90ee90",
|
|
28564
|
+
lightgrey: "d3d3d3",
|
|
28565
|
+
lightpink: "ffb6c1",
|
|
28566
|
+
lightsalmon: "ffa07a",
|
|
28567
|
+
lightseagreen: "20b2aa",
|
|
28568
|
+
lightskyblue: "87cefa",
|
|
28569
|
+
lightslategray: "789",
|
|
28570
|
+
lightslategrey: "789",
|
|
28571
|
+
lightsteelblue: "b0c4de",
|
|
28572
|
+
lightyellow: "ffffe0",
|
|
28573
|
+
lime: "0f0",
|
|
28574
|
+
limegreen: "32cd32",
|
|
28575
|
+
linen: "faf0e6",
|
|
28576
|
+
magenta: "f0f",
|
|
28577
|
+
maroon: "800000",
|
|
28578
|
+
mediumaquamarine: "66cdaa",
|
|
28579
|
+
mediumblue: "0000cd",
|
|
28580
|
+
mediumorchid: "ba55d3",
|
|
28581
|
+
mediumpurple: "9370db",
|
|
28582
|
+
mediumseagreen: "3cb371",
|
|
28583
|
+
mediumslateblue: "7b68ee",
|
|
28584
|
+
mediumspringgreen: "00fa9a",
|
|
28585
|
+
mediumturquoise: "48d1cc",
|
|
28586
|
+
mediumvioletred: "c71585",
|
|
28587
|
+
midnightblue: "191970",
|
|
28588
|
+
mintcream: "f5fffa",
|
|
28589
|
+
mistyrose: "ffe4e1",
|
|
28590
|
+
moccasin: "ffe4b5",
|
|
28591
|
+
navajowhite: "ffdead",
|
|
28592
|
+
navy: "000080",
|
|
28593
|
+
oldlace: "fdf5e6",
|
|
28594
|
+
olive: "808000",
|
|
28595
|
+
olivedrab: "6b8e23",
|
|
28596
|
+
orange: "ffa500",
|
|
28597
|
+
orangered: "ff4500",
|
|
28598
|
+
orchid: "da70d6",
|
|
28599
|
+
palegoldenrod: "eee8aa",
|
|
28600
|
+
palegreen: "98fb98",
|
|
28601
|
+
paleturquoise: "afeeee",
|
|
28602
|
+
palevioletred: "db7093",
|
|
28603
|
+
papayawhip: "ffefd5",
|
|
28604
|
+
peachpuff: "ffdab9",
|
|
28605
|
+
peru: "cd853f",
|
|
28606
|
+
pink: "ffc0cb",
|
|
28607
|
+
plum: "dda0dd",
|
|
28608
|
+
powderblue: "b0e0e6",
|
|
28609
|
+
purple: "800080",
|
|
28610
|
+
rebeccapurple: "663399",
|
|
28611
|
+
red: "f00",
|
|
28612
|
+
rosybrown: "bc8f8f",
|
|
28613
|
+
royalblue: "4169e1",
|
|
28614
|
+
saddlebrown: "8b4513",
|
|
28615
|
+
salmon: "fa8072",
|
|
28616
|
+
sandybrown: "f4a460",
|
|
28617
|
+
seagreen: "2e8b57",
|
|
28618
|
+
seashell: "fff5ee",
|
|
28619
|
+
sienna: "a0522d",
|
|
28620
|
+
silver: "c0c0c0",
|
|
28621
|
+
skyblue: "87ceeb",
|
|
28622
|
+
slateblue: "6a5acd",
|
|
28623
|
+
slategray: "708090",
|
|
28624
|
+
slategrey: "708090",
|
|
28625
|
+
snow: "fffafa",
|
|
28626
|
+
springgreen: "00ff7f",
|
|
28627
|
+
steelblue: "4682b4",
|
|
28628
|
+
tan: "d2b48c",
|
|
28629
|
+
teal: "008080",
|
|
28630
|
+
thistle: "d8bfd8",
|
|
28631
|
+
tomato: "ff6347",
|
|
28632
|
+
turquoise: "40e0d0",
|
|
28633
|
+
violet: "ee82ee",
|
|
28634
|
+
wheat: "f5deb3",
|
|
28635
|
+
white: "fff",
|
|
28636
|
+
whitesmoke: "f5f5f5",
|
|
28637
|
+
yellow: "ff0",
|
|
28638
|
+
yellowgreen: "9acd32"
|
|
28639
|
+
};
|
|
28640
|
+
|
|
28641
|
+
// Make it easy to access colors via `hexNames[hex]`
|
|
28642
|
+
var hexNames = tinycolor.hexNames = flip(names);
|
|
28643
|
+
|
|
28644
|
+
|
|
28645
|
+
// Utilities
|
|
28646
|
+
// ---------
|
|
28647
|
+
|
|
28648
|
+
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
|
|
28649
|
+
function flip(o) {
|
|
28650
|
+
var flipped = { };
|
|
28651
|
+
for (var i in o) {
|
|
28652
|
+
if (o.hasOwnProperty(i)) {
|
|
28653
|
+
flipped[o[i]] = i;
|
|
28654
|
+
}
|
|
28655
|
+
}
|
|
28656
|
+
return flipped;
|
|
28657
|
+
}
|
|
28658
|
+
|
|
28659
|
+
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
28660
|
+
function boundAlpha(a) {
|
|
28661
|
+
a = parseFloat(a);
|
|
28662
|
+
|
|
28663
|
+
if (isNaN(a) || a < 0 || a > 1) {
|
|
28664
|
+
a = 1;
|
|
28665
|
+
}
|
|
28666
|
+
|
|
28667
|
+
return a;
|
|
28668
|
+
}
|
|
28669
|
+
|
|
28670
|
+
// Take input from [0, n] and return it as [0, 1]
|
|
28671
|
+
function bound01(n, max) {
|
|
28672
|
+
if (isOnePointZero(n)) { n = "100%"; }
|
|
28673
|
+
|
|
28674
|
+
var processPercent = isPercentage(n);
|
|
28675
|
+
n = mathMin(max, mathMax(0, parseFloat(n)));
|
|
28676
|
+
|
|
28677
|
+
// Automatically convert percentage into number
|
|
28678
|
+
if (processPercent) {
|
|
28679
|
+
n = parseInt(n * max, 10) / 100;
|
|
28680
|
+
}
|
|
28681
|
+
|
|
28682
|
+
// Handle floating point rounding errors
|
|
28683
|
+
if ((Math.abs(n - max) < 0.000001)) {
|
|
28684
|
+
return 1;
|
|
28685
|
+
}
|
|
28686
|
+
|
|
28687
|
+
// Convert into [0, 1] range if it isn't already
|
|
28688
|
+
return (n % max) / parseFloat(max);
|
|
28689
|
+
}
|
|
28690
|
+
|
|
28691
|
+
// Force a number between 0 and 1
|
|
28692
|
+
function clamp01(val) {
|
|
28693
|
+
return mathMin(1, mathMax(0, val));
|
|
28694
|
+
}
|
|
28695
|
+
|
|
28696
|
+
// Parse a base-16 hex value into a base-10 integer
|
|
28697
|
+
function parseIntFromHex(val) {
|
|
28698
|
+
return parseInt(val, 16);
|
|
28699
|
+
}
|
|
28700
|
+
|
|
28701
|
+
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
28702
|
+
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
28703
|
+
function isOnePointZero(n) {
|
|
28704
|
+
return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
|
|
28705
|
+
}
|
|
28706
|
+
|
|
28707
|
+
// Check to see if string passed in is a percentage
|
|
28708
|
+
function isPercentage(n) {
|
|
28709
|
+
return typeof n === "string" && n.indexOf('%') != -1;
|
|
28710
|
+
}
|
|
28711
|
+
|
|
28712
|
+
// Force a hex value to have 2 characters
|
|
28713
|
+
function pad2(c) {
|
|
28714
|
+
return c.length == 1 ? '0' + c : '' + c;
|
|
28715
|
+
}
|
|
28716
|
+
|
|
28717
|
+
// Replace a decimal with it's percentage value
|
|
28718
|
+
function convertToPercentage(n) {
|
|
28719
|
+
if (n <= 1) {
|
|
28720
|
+
n = (n * 100) + "%";
|
|
28721
|
+
}
|
|
28722
|
+
|
|
28723
|
+
return n;
|
|
28724
|
+
}
|
|
28725
|
+
|
|
28726
|
+
// Converts a decimal to a hex value
|
|
28727
|
+
function convertDecimalToHex(d) {
|
|
28728
|
+
return Math.round(parseFloat(d) * 255).toString(16);
|
|
28729
|
+
}
|
|
28730
|
+
// Converts a hex value to a decimal
|
|
28731
|
+
function convertHexToDecimal(h) {
|
|
28732
|
+
return (parseIntFromHex(h) / 255);
|
|
28733
|
+
}
|
|
28734
|
+
|
|
28735
|
+
var matchers = (function() {
|
|
28736
|
+
|
|
28737
|
+
// <http://www.w3.org/TR/css3-values/#integers>
|
|
28738
|
+
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
28739
|
+
|
|
28740
|
+
// <http://www.w3.org/TR/css3-values/#number-value>
|
|
28741
|
+
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
28742
|
+
|
|
28743
|
+
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
|
28744
|
+
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
28745
|
+
|
|
28746
|
+
// Actual matching.
|
|
28747
|
+
// Parentheses and commas are optional, but not required.
|
|
28748
|
+
// Whitespace can take the place of commas or opening paren
|
|
28749
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
28750
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
28751
|
+
|
|
28752
|
+
return {
|
|
28753
|
+
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
28754
|
+
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
28755
|
+
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
28756
|
+
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
28757
|
+
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
28758
|
+
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
28759
|
+
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
28760
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
28761
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
28762
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
28763
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
28764
|
+
};
|
|
28765
|
+
})();
|
|
28766
|
+
|
|
28767
|
+
// `isValidCSSUnit`
|
|
28768
|
+
// Take in a single string / number and check to see if it looks like a CSS unit
|
|
28769
|
+
// (see `matchers` above for definition).
|
|
28770
|
+
function isValidCSSUnit(color) {
|
|
28771
|
+
return !!matchers.CSS_UNIT.exec(color);
|
|
28772
|
+
}
|
|
28773
|
+
|
|
28774
|
+
// `stringInputToObject`
|
|
28775
|
+
// Permissive string parsing. Take in a number of formats, and output an object
|
|
28776
|
+
// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
|
28777
|
+
function stringInputToObject(color) {
|
|
28778
|
+
|
|
28779
|
+
color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
|
|
28780
|
+
var named = false;
|
|
28781
|
+
if (names[color]) {
|
|
28782
|
+
color = names[color];
|
|
28783
|
+
named = true;
|
|
28784
|
+
}
|
|
28785
|
+
else if (color == 'transparent') {
|
|
28786
|
+
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
28787
|
+
}
|
|
28788
|
+
|
|
28789
|
+
// Try to match string input using regular expressions.
|
|
28790
|
+
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
|
28791
|
+
// Just return an object and let the conversion functions handle that.
|
|
28792
|
+
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
28793
|
+
var match;
|
|
28794
|
+
if ((match = matchers.rgb.exec(color))) {
|
|
28795
|
+
return { r: match[1], g: match[2], b: match[3] };
|
|
28796
|
+
}
|
|
28797
|
+
if ((match = matchers.rgba.exec(color))) {
|
|
28798
|
+
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
28799
|
+
}
|
|
28800
|
+
if ((match = matchers.hsl.exec(color))) {
|
|
28801
|
+
return { h: match[1], s: match[2], l: match[3] };
|
|
28802
|
+
}
|
|
28803
|
+
if ((match = matchers.hsla.exec(color))) {
|
|
28804
|
+
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
28805
|
+
}
|
|
28806
|
+
if ((match = matchers.hsv.exec(color))) {
|
|
28807
|
+
return { h: match[1], s: match[2], v: match[3] };
|
|
28808
|
+
}
|
|
28809
|
+
if ((match = matchers.hsva.exec(color))) {
|
|
28810
|
+
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
28811
|
+
}
|
|
28812
|
+
if ((match = matchers.hex8.exec(color))) {
|
|
28813
|
+
return {
|
|
28814
|
+
r: parseIntFromHex(match[1]),
|
|
28815
|
+
g: parseIntFromHex(match[2]),
|
|
28816
|
+
b: parseIntFromHex(match[3]),
|
|
28817
|
+
a: convertHexToDecimal(match[4]),
|
|
28818
|
+
format: named ? "name" : "hex8"
|
|
28819
|
+
};
|
|
28820
|
+
}
|
|
28821
|
+
if ((match = matchers.hex6.exec(color))) {
|
|
28822
|
+
return {
|
|
28823
|
+
r: parseIntFromHex(match[1]),
|
|
28824
|
+
g: parseIntFromHex(match[2]),
|
|
28825
|
+
b: parseIntFromHex(match[3]),
|
|
28826
|
+
format: named ? "name" : "hex"
|
|
28827
|
+
};
|
|
28828
|
+
}
|
|
28829
|
+
if ((match = matchers.hex4.exec(color))) {
|
|
28830
|
+
return {
|
|
28831
|
+
r: parseIntFromHex(match[1] + '' + match[1]),
|
|
28832
|
+
g: parseIntFromHex(match[2] + '' + match[2]),
|
|
28833
|
+
b: parseIntFromHex(match[3] + '' + match[3]),
|
|
28834
|
+
a: convertHexToDecimal(match[4] + '' + match[4]),
|
|
28835
|
+
format: named ? "name" : "hex8"
|
|
28836
|
+
};
|
|
28837
|
+
}
|
|
28838
|
+
if ((match = matchers.hex3.exec(color))) {
|
|
28839
|
+
return {
|
|
28840
|
+
r: parseIntFromHex(match[1] + '' + match[1]),
|
|
28841
|
+
g: parseIntFromHex(match[2] + '' + match[2]),
|
|
28842
|
+
b: parseIntFromHex(match[3] + '' + match[3]),
|
|
28843
|
+
format: named ? "name" : "hex"
|
|
28844
|
+
};
|
|
28845
|
+
}
|
|
28846
|
+
|
|
28847
|
+
return false;
|
|
28848
|
+
}
|
|
28849
|
+
|
|
28850
|
+
function validateWCAG2Parms(parms) {
|
|
28851
|
+
// return valid WCAG2 parms for isReadable.
|
|
28852
|
+
// If input parms are invalid, return {"level":"AA", "size":"small"}
|
|
28853
|
+
var level, size;
|
|
28854
|
+
parms = parms || {"level":"AA", "size":"small"};
|
|
28855
|
+
level = (parms.level || "AA").toUpperCase();
|
|
28856
|
+
size = (parms.size || "small").toLowerCase();
|
|
28857
|
+
if (level !== "AA" && level !== "AAA") {
|
|
28858
|
+
level = "AA";
|
|
28859
|
+
}
|
|
28860
|
+
if (size !== "small" && size !== "large") {
|
|
28861
|
+
size = "small";
|
|
28862
|
+
}
|
|
28863
|
+
return {"level":level, "size":size};
|
|
28864
|
+
}
|
|
28865
|
+
|
|
28866
|
+
// Node: Export function
|
|
28867
|
+
if (module.exports) {
|
|
28868
|
+
module.exports = tinycolor;
|
|
28869
|
+
}
|
|
28870
|
+
// AMD/requirejs: Define the module
|
|
28871
|
+
else {
|
|
28872
|
+
window.tinycolor = tinycolor;
|
|
28873
|
+
}
|
|
28874
|
+
|
|
28875
|
+
})(Math);
|
|
28876
|
+
} (tinycolor$1));
|
|
28877
|
+
|
|
28878
|
+
var tinycolorExports = tinycolor$1.exports;
|
|
28879
|
+
var tinycolor = /*@__PURE__*/getDefaultExportFromCjs(tinycolorExports);
|
|
28846
28880
|
|
|
28847
|
-
const baseLabelClasses = 'tw
|
|
28881
|
+
const baseLabelClasses = 'tw:left-1 tw:text-xs tw:text-sq-text-color tw:dark:text-sq-dark-text tw:items-center tw:h-4.5';
|
|
28848
28882
|
const ProgressIndicator = (props) => {
|
|
28849
28883
|
const { value, color = undefined, testId, label, extraClasses = '', labelClasses = '', valuesLength, max, index, totalValue, ...tooltipProps } = props;
|
|
28850
28884
|
const tooltipData = getQTipData(tooltipProps);
|
|
@@ -28857,19 +28891,19 @@ const ProgressIndicator = (props) => {
|
|
|
28857
28891
|
if (totalValue >= max) {
|
|
28858
28892
|
// If progress is 100%, round both ends
|
|
28859
28893
|
if (index === 0 && valuesLength === 1) {
|
|
28860
|
-
roundedCorners = 'tw
|
|
28894
|
+
roundedCorners = 'tw:rounded-[0.9375rem]';
|
|
28861
28895
|
}
|
|
28862
28896
|
else if (index === 0) {
|
|
28863
|
-
roundedCorners = 'tw
|
|
28897
|
+
roundedCorners = 'tw:rounded-l-[0.9375rem]';
|
|
28864
28898
|
}
|
|
28865
28899
|
else if (index === valuesLength - 1) {
|
|
28866
|
-
roundedCorners = 'tw
|
|
28900
|
+
roundedCorners = 'tw:rounded-r-[0.9375rem]';
|
|
28867
28901
|
}
|
|
28868
28902
|
}
|
|
28869
28903
|
else {
|
|
28870
28904
|
// Otherwise, only round the leftmost indicator
|
|
28871
28905
|
if (index === 0) {
|
|
28872
|
-
roundedCorners = 'tw
|
|
28906
|
+
roundedCorners = 'tw:rounded-l-[0.9375rem]';
|
|
28873
28907
|
}
|
|
28874
28908
|
}
|
|
28875
28909
|
useEffect(() => {
|
|
@@ -28881,13 +28915,13 @@ const ProgressIndicator = (props) => {
|
|
|
28881
28915
|
return () => clearTimeout(timeout);
|
|
28882
28916
|
}, [value]);
|
|
28883
28917
|
const bgColor = color || undefined;
|
|
28884
|
-
const bgClass = color ? '' : 'tw
|
|
28918
|
+
const bgClass = color ? '' : 'tw:bg-sq-theme-dark';
|
|
28885
28919
|
const computeTextClass = (elem) => {
|
|
28886
28920
|
const computedStyle = getComputedStyle(elem);
|
|
28887
28921
|
const backgroundColor = computedStyle.backgroundColor;
|
|
28888
28922
|
const textColorClass = tinycolor(backgroundColor).isDark()
|
|
28889
|
-
? 'tw
|
|
28890
|
-
: 'tw
|
|
28923
|
+
? 'tw:text-sq-white tw:dark:text-sq-white'
|
|
28924
|
+
: 'tw:text-sq-text-color tw:dark:text-sq-text-color';
|
|
28891
28925
|
setTextColorClass(textColorClass);
|
|
28892
28926
|
};
|
|
28893
28927
|
useEffect(() => {
|
|
@@ -28895,35 +28929,35 @@ const ProgressIndicator = (props) => {
|
|
|
28895
28929
|
computeTextClass(indicatorElementRef.current);
|
|
28896
28930
|
}
|
|
28897
28931
|
}, [!!indicatorElementRef.current]);
|
|
28898
|
-
return (createElement(Indicator, { className: `tw
|
|
28932
|
+
return (createElement(Indicator, { className: `tw:ease-[cubic-bezier(0.65, 0, 0.35, 1)] tw:w-full tw:h-4.5 tw:duration-[660ms] tw:flex tw:justify-center tw:items-center ${valuesLength === 1 ? '' : 'tw:overflow-hidden'} ${roundedCorners} ${bgClass} ${extraClasses}`, ...tooltipData, "data-qtip-text": tooltipProps.tooltip ? tooltipProps.tooltip : `${value}%`, "data-testid": `progress-bar-indicator-${testId ? testId : value}`, key: `${index}-${value}`, ref: indicatorElementRef, style: {
|
|
28899
28933
|
// Background color will default to the theme color if undefined
|
|
28900
28934
|
backgroundColor: bgColor,
|
|
28901
28935
|
animation: 'width 660ms forwards',
|
|
28902
28936
|
width: `${animatedWidth}%`,
|
|
28903
|
-
} }, label ? (jsx$1("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw
|
|
28937
|
+
} }, label ? (jsx$1("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw:absolute tw:z-50' : ''}`, children: label })) : undefined));
|
|
28904
28938
|
};
|
|
28905
28939
|
const ProgressBar = ({ values = [], max = 100, containerExtraClasses = '', zeroValueLabel = 'No progress yet', }) => {
|
|
28906
28940
|
const totalValue = values.reduce((acc, { value }) => acc + value, 0);
|
|
28907
|
-
return (jsx$1(Root, { className: `tw
|
|
28908
|
-
return createElement(ProgressIndicator, { ...props, max: max, valuesLength: values.length, index: i, totalValue: totalValue, key: i });
|
|
28909
|
-
})) : (jsx$1("div", { className: `${baseLabelClasses} tw
|
|
28941
|
+
return (jsx$1(Root, { className: `tw:relative tw:h-4.5 tw:w-full tw:overflow-hidden tw:rounded-[0.9375rem] tw:bg-sq-dark-gray tw:dark:bg-sq-dark-disabled-gray tw:flex tw:flex-1 ${containerExtraClasses}`, max: max, value: totalValue, children: totalValue > 0 ? (values.map((props, i) => {
|
|
28942
|
+
return (createElement(ProgressIndicator, { ...props, max: max, valuesLength: values.length, index: i, totalValue: totalValue, key: i }));
|
|
28943
|
+
})) : (jsx$1("div", { className: `${baseLabelClasses} tw:mx-auto tw:overflow-hidden`, children: zeroValueLabel })) }));
|
|
28910
28944
|
};
|
|
28911
28945
|
|
|
28912
|
-
const baseClasses = 'tw
|
|
28946
|
+
const baseClasses = 'tw:flex tw:outline-none tw:w-full tw:relative tw:flex-wrap';
|
|
28913
28947
|
const activeClassesByVariantLightTheme = {
|
|
28914
|
-
'outline': '
|
|
28915
|
-
'theme': 'tw
|
|
28948
|
+
'outline': 'tw:!bg-sq-disabled-gray tw:border-sq-theme-dark',
|
|
28949
|
+
'theme': 'tw:bg-sq-theme-highlight',
|
|
28916
28950
|
'danger': '',
|
|
28917
28951
|
'theme-light': '',
|
|
28918
|
-
'no-border': '
|
|
28952
|
+
'no-border': 'tw:!bg-sq-disabled-gray',
|
|
28919
28953
|
'warning': '',
|
|
28920
28954
|
};
|
|
28921
28955
|
const activeClassesByVariantDarkTheme = {
|
|
28922
|
-
'outline': 'dark
|
|
28923
|
-
'theme': 'dark:
|
|
28956
|
+
'outline': 'tw:!dark:bg-sq-multi-gray-dark tw:dark:border-sq-theme-dark',
|
|
28957
|
+
'theme': 'tw:dark:bg-sq-theme-highlight',
|
|
28924
28958
|
'danger': '',
|
|
28925
28959
|
'theme-light': '',
|
|
28926
|
-
'no-border': 'dark
|
|
28960
|
+
'no-border': 'tw:!dark:bg-sq-multi-gray-dark',
|
|
28927
28961
|
'warning': '',
|
|
28928
28962
|
};
|
|
28929
28963
|
/**
|
|
@@ -28935,7 +28969,7 @@ const ButtonGroup = (props) => {
|
|
|
28935
28969
|
const appliedClasses = `${baseClasses} ${extraClassNames}`;
|
|
28936
28970
|
return (jsx$1("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData, children: buttons
|
|
28937
28971
|
.filter(Boolean)
|
|
28938
|
-
.map((item, index) => item?.variant === 'button' ? (jsx$1(Button, { ...item.buttonProps, extraClassNames: `tw
|
|
28972
|
+
.map((item, index) => item?.variant === 'button' ? (jsx$1(Button, { ...item.buttonProps, extraClassNames: `tw:-ml-sq-1 tw:focus:z-40 tw:outline-none tw:focus:border tw:rounded-none tw:first:rounded-l-md tw:last:rounded-r-md ${item.buttonProps?.isActive
|
|
28939
28973
|
? `${activeClassesByVariantLightTheme[item?.buttonProps?.variant ?? 'outline']} ${activeClassesByVariantDarkTheme[item?.buttonProps?.variant ?? 'outline']} `
|
|
28940
28974
|
: ''} ${item.buttonProps.extraClassNames}`, onClick: () => onChange && onChange(item?.buttonProps?.value) }, index)) : (item?.element)) }));
|
|
28941
28975
|
};
|
|
@@ -28945,7 +28979,7 @@ const ButtonGroup = (props) => {
|
|
|
28945
28979
|
* - Easily create a carousel with custom slides.
|
|
28946
28980
|
* - Supports automatic sliding, navigation arrows, and slide indicators.
|
|
28947
28981
|
*/
|
|
28948
|
-
const Carousel = ({ testId = 'carousel-id', activeIndex = 0, extraClassNames = '', onSlide = () => { }, autoSlide, showIndicators = true, continuous = true, interval = 4000, prevIcon = 'fc-arrow-dropdown tw
|
|
28982
|
+
const Carousel = ({ testId = 'carousel-id', activeIndex = 0, extraClassNames = '', onSlide = () => { }, autoSlide, showIndicators = true, continuous = true, interval = 4000, prevIcon = 'fc-arrow-dropdown tw:rotate-90', nextIcon = 'fc-arrow-dropdown tw:rotate-270', showArrows = true, iconExtraClassNames = '', carouselItems = [], }) => {
|
|
28949
28983
|
const [currentIndex, setCurrentIndex] = useState(activeIndex);
|
|
28950
28984
|
const changeSlide = (nextIndex) => {
|
|
28951
28985
|
const newIndex = (nextIndex + carouselItems.length) % carouselItems.length;
|
|
@@ -29012,7 +29046,7 @@ const Carousel = ({ testId = 'carousel-id', activeIndex = 0, extraClassNames = '
|
|
|
29012
29046
|
transition: springTransition,
|
|
29013
29047
|
}),
|
|
29014
29048
|
};
|
|
29015
|
-
return (jsxs("div", { "data-testid": testId, className: `tw
|
|
29049
|
+
return (jsxs("div", { "data-testid": testId, className: `tw:flex tw:flex-col tw:items-center tw:justify-center tw:w-full tw:overflow-hidden ${extraClassNames}`, children: [jsxs("div", { className: "tw:flex tw:items-center tw:w-full tw:h-max tw:gap-1", children: [showArrows && (jsx$1(Button, { icon: prevIcon, size: "lg", variant: "no-border", testId: "carousel-prev", extraClassNames: `${currentIndex === 0 && !continuous ? 'tw:invisible' : ''} ${iconExtraClassNames} tw:animate-fadeIn`, onClick: onBackClick })), jsx$1("div", { className: "tw:h-full tw:w-full tw:overflow-hidden", children: jsx$1(motion.div, { custom: 1, initial: "initial", animate: "animate", exit: "exit", variants: slideVariants, className: "tw:w-full", children: carouselItems[currentIndex] }, currentIndex) }), showArrows && (jsx$1(Button, { icon: nextIcon, testId: "carousel-next", size: "lg", variant: "no-border", extraClassNames: `${currentIndex === carouselItems.length - 1 && !continuous ? 'tw:invisible' : ''} ${iconExtraClassNames} tw:animate-fadeIn`, onClick: onForwardClick }))] }), showIndicators && (jsx$1("div", { className: "tw:flex tw:gap-1 tw:mt-2", children: carouselItems.map((_, i) => (jsx$1("div", { className: `tw:w-2 tw:h-2 tw:rounded-full tw:cursor-pointer ${i === currentIndex ? 'tw:bg-sq-theme-dark' : 'tw:bg-sq-darkish-gray'}`, onClick: () => changeSlide(i) }, i))) }))] }));
|
|
29016
29050
|
};
|
|
29017
29051
|
|
|
29018
29052
|
const buttonTypes = ['button', 'reset', 'submit', 'link'];
|