@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.js
CHANGED
|
@@ -66,34 +66,34 @@ const getQTipData = ({ tooltip, tooltipPlacement, isHtmlTooltip, tooltipTestId,
|
|
|
66
66
|
: undefined;
|
|
67
67
|
|
|
68
68
|
const colorClassesThemeLight = {
|
|
69
|
-
'theme': 'tw
|
|
70
|
-
'white': 'tw
|
|
71
|
-
'dark-gray': 'tw
|
|
72
|
-
'warning': 'tw
|
|
73
|
-
'darkish-gray': 'tw
|
|
74
|
-
'gray': 'tw
|
|
69
|
+
'theme': 'tw:text-sq-theme-dark',
|
|
70
|
+
'white': 'tw:text-sq-white',
|
|
71
|
+
'dark-gray': 'tw:text-sq-fairly-dark-gray',
|
|
72
|
+
'warning': 'tw:text-sq-warning',
|
|
73
|
+
'darkish-gray': 'tw:text-sq-darkish-gray',
|
|
74
|
+
'gray': 'tw:text-sq-disabled-gray',
|
|
75
75
|
'color': '',
|
|
76
|
-
'info': 'tw
|
|
77
|
-
'text': 'tw
|
|
76
|
+
'info': 'tw:text-sq-theme-link',
|
|
77
|
+
'text': 'tw:text-sq-text-color',
|
|
78
78
|
'inherit': '',
|
|
79
|
-
'danger': 'tw
|
|
80
|
-
'theme-light': 'tw
|
|
81
|
-
'success': 'tw
|
|
79
|
+
'danger': 'tw:text-sq-danger',
|
|
80
|
+
'theme-light': 'tw:text-sq-theme-light',
|
|
81
|
+
'success': 'tw:text-sq-success',
|
|
82
82
|
};
|
|
83
83
|
const colorClassesThemeDark = {
|
|
84
|
-
'theme': 'dark:
|
|
84
|
+
'theme': 'tw:dark:text-sq-theme-darker',
|
|
85
85
|
'white': '',
|
|
86
|
-
'dark-gray': 'tw
|
|
86
|
+
'dark-gray': 'tw:text-sq-fairly-dark-gray',
|
|
87
87
|
'warning': '',
|
|
88
|
-
'darkish-gray': 'tw
|
|
89
|
-
'gray': 'dark:
|
|
88
|
+
'darkish-gray': 'tw:text-sq-darkish-gray',
|
|
89
|
+
'gray': 'tw:dark:text-sq-dark-disabled-gray',
|
|
90
90
|
'color': '',
|
|
91
|
-
'info': 'dark:
|
|
92
|
-
'text': 'dark:
|
|
91
|
+
'info': 'tw:dark:text-sq-theme-link',
|
|
92
|
+
'text': 'tw:dark:text-sq-dark-text',
|
|
93
93
|
'inherit': '',
|
|
94
|
-
'danger': 'tw
|
|
95
|
-
'theme-light': 'tw
|
|
96
|
-
'success': 'tw
|
|
94
|
+
'danger': 'tw:text-sq-danger',
|
|
95
|
+
'theme-light': 'tw:text-sq-theme-light',
|
|
96
|
+
'success': 'tw:text-sq-success',
|
|
97
97
|
};
|
|
98
98
|
/**
|
|
99
99
|
* Icon:
|
|
@@ -105,14 +105,14 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
|
|
|
105
105
|
const errorMessage = color === undefined || color === ''
|
|
106
106
|
? 'Icon with type="color" must have prop color specified.'
|
|
107
107
|
: 'Icon with prop color must have type="color".';
|
|
108
|
-
return jsxRuntime.jsx("div", { className: "tw
|
|
108
|
+
return jsxRuntime.jsx("div", { className: "tw:text-sq-danger", children: errorMessage });
|
|
109
109
|
}
|
|
110
110
|
const fontAwesomePrefix = iconPrefix ? iconPrefix : 'fa-sharp fa-regular';
|
|
111
111
|
const iconPrefixString = icon.startsWith('fc') ? 'fc' : fontAwesomePrefix;
|
|
112
112
|
const style = type === 'color' && color ? { color } : {};
|
|
113
113
|
const sizeClass = size ? `fa-${size}` : small ? 'fa-sm' : large ? 'fa-lg' : '';
|
|
114
114
|
const appliedClassNames = `${iconPrefixString} ${icon} ${sizeClass}
|
|
115
|
-
${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'tw
|
|
115
|
+
${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'tw:cursor-pointer' : ''} ${extraClassNames} tw:focus:outline-none tw:focus-visible:outline-none tw:outline-none`;
|
|
116
116
|
const tooltipData = getQTipData(tooltipProps);
|
|
117
117
|
return (jsxRuntime.jsx("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number, ...tooltipData }));
|
|
118
118
|
};
|
|
@@ -123,71 +123,71 @@ const Icon = ({ onClick, icon, iconPrefix = undefined, type = 'theme', extraClas
|
|
|
123
123
|
* - include tooltips and/or icons
|
|
124
124
|
*/
|
|
125
125
|
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, }) => {
|
|
126
|
-
const baseClasses = 'tw
|
|
126
|
+
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';
|
|
127
127
|
const baseClassesByVariant = {
|
|
128
|
-
'outline': 'disabled:
|
|
129
|
-
'theme': 'disabled:
|
|
130
|
-
'danger': 'tw
|
|
131
|
-
'tw
|
|
132
|
-
'theme-light': 'disabled:
|
|
133
|
-
'no-border': 'disabled:
|
|
134
|
-
'warning': 'tw
|
|
135
|
-
'disabled:
|
|
128
|
+
'outline': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50 tw:border-solid tw:border',
|
|
129
|
+
'theme': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50 tw:border-solid tw:border',
|
|
130
|
+
'danger': 'tw:bg-sq-danger tw:disabled:opacity-50 tw:aria-disabled:opacity-50 ' +
|
|
131
|
+
'tw:border-solid tw:border tw:border-sq-danger',
|
|
132
|
+
'theme-light': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50 tw:border-solid tw:border',
|
|
133
|
+
'no-border': 'tw:disabled:opacity-50 tw:aria-disabled:opacity-50',
|
|
134
|
+
'warning': 'tw:bg-sq-warning tw:border-solid tw:border tw:border-sq-warning ' +
|
|
135
|
+
'tw:disabled:opacity-50 tw:aria-disabled:opacity-50',
|
|
136
136
|
};
|
|
137
137
|
const textClassesByVariantLightTheme = {
|
|
138
|
-
'outline': 'tw
|
|
139
|
-
'theme': 'tw
|
|
140
|
-
'theme-light': 'tw
|
|
141
|
-
'danger': 'tw
|
|
142
|
-
'no-border': 'tw
|
|
143
|
-
'warning': 'tw
|
|
138
|
+
'outline': 'tw:text-sq-text-color',
|
|
139
|
+
'theme': 'tw:text-sq-white',
|
|
140
|
+
'theme-light': 'tw:text-sq-white',
|
|
141
|
+
'danger': 'tw:text-sq-white',
|
|
142
|
+
'no-border': 'tw:text-sq-text-color',
|
|
143
|
+
'warning': 'tw:text-sq-white',
|
|
144
144
|
};
|
|
145
145
|
const textClassesByVariantDarkTheme = {
|
|
146
|
-
'outline': 'dark:
|
|
147
|
-
'theme': 'dark:
|
|
148
|
-
'theme-light': 'dark:
|
|
149
|
-
'danger': 'dark:
|
|
150
|
-
'no-border': 'dark:
|
|
151
|
-
'warning': 'dark:
|
|
146
|
+
'outline': 'tw:dark:text-sq-dark-text',
|
|
147
|
+
'theme': 'tw:dark:text-sq-white',
|
|
148
|
+
'theme-light': 'tw:dark:text-sq-white',
|
|
149
|
+
'danger': 'tw:dark:text-sq-white',
|
|
150
|
+
'no-border': 'tw:dark:text-sq-dark-text',
|
|
151
|
+
'warning': 'tw:dark:text-sq-white',
|
|
152
152
|
};
|
|
153
153
|
const classesByVariantLightTheme = {
|
|
154
|
-
'outline': 'tw
|
|
155
|
-
'theme': 'tw
|
|
154
|
+
'outline': 'tw:bg-white tw:border-sq-disabled-gray',
|
|
155
|
+
'theme': 'tw:bg-sq-theme-dark tw:border-sq-theme-dark',
|
|
156
156
|
'danger': '',
|
|
157
|
-
'theme-light': 'tw
|
|
157
|
+
'theme-light': 'tw:bg-sq-icon',
|
|
158
158
|
'no-border': '',
|
|
159
159
|
'warning': '',
|
|
160
160
|
};
|
|
161
161
|
const classesByVariantDarkTheme = {
|
|
162
|
-
'outline': 'dark:
|
|
163
|
-
'theme': 'dark:
|
|
162
|
+
'outline': 'tw:dark:bg-sq-dark-background tw:dark:border-sq-dark-disabled-gray',
|
|
163
|
+
'theme': 'tw:dark:bg-sq-theme-dark tw:dark:border-sq-theme-dark',
|
|
164
164
|
'danger': '',
|
|
165
|
-
'theme-light': 'dark:
|
|
165
|
+
'theme-light': 'tw:dark:bg-sq-icon-dark tw:dark:border-sq-icon-dark',
|
|
166
166
|
'no-border': '',
|
|
167
167
|
'warning': '',
|
|
168
168
|
};
|
|
169
169
|
const activeClassesByVariantLightTheme = {
|
|
170
|
-
'outline': 'hover:
|
|
171
|
-
' active:
|
|
172
|
-
'theme': 'hover:
|
|
173
|
-
'danger': 'hover:
|
|
174
|
-
'theme-light': 'hover:
|
|
170
|
+
'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' +
|
|
171
|
+
' tw:active:border-sq-theme-dark',
|
|
172
|
+
'theme': 'tw:hover:bg-sq-theme-highlight tw:hover:border-sq-theme-highlight',
|
|
173
|
+
'danger': 'tw:hover:bg-sq-bg-danger tw:hover:border-sq-bg-danger',
|
|
174
|
+
'theme-light': 'tw:hover:bg-sq-link tw:hover:border-sq-link',
|
|
175
175
|
'no-border': '',
|
|
176
176
|
'warning': '',
|
|
177
177
|
};
|
|
178
178
|
const activeClassesByVariantDarkTheme = {
|
|
179
|
-
'outline': 'dark:hover:
|
|
180
|
-
' dark:active:
|
|
181
|
-
'theme': 'dark:hover:
|
|
182
|
-
'danger': 'dark:hover:
|
|
183
|
-
'theme-light': 'dark:hover:
|
|
179
|
+
'outline': 'tw:dark:hover:bg-sq-highlight-color-dark tw:dark:focus:bg-sq-multi-gray-dark' +
|
|
180
|
+
' tw:dark:active:bg-sq-multi-gray-dark tw:dark:focus:border-sq-theme-dark tw:dark:active:border-sq-theme-dark',
|
|
181
|
+
'theme': 'tw:dark:hover:bg-sq-theme-highlight tw:dark:hover:border-sq-theme-highlight',
|
|
182
|
+
'danger': 'tw:dark:hover:bg-sq-bg-danger tw:dark:hover:border-sq-bg-danger',
|
|
183
|
+
'theme-light': 'tw:dark:hover:bg-sq-link-dark tw:dark:hover:border-sq-link-dark',
|
|
184
184
|
'no-border': '',
|
|
185
185
|
'warning': '',
|
|
186
186
|
};
|
|
187
187
|
const sizeClasses = {
|
|
188
|
-
xs: 'tw
|
|
189
|
-
sm: 'tw
|
|
190
|
-
lg: 'tw
|
|
188
|
+
xs: 'tw:text-xs tw:py-0.5',
|
|
189
|
+
sm: 'tw:text-sm tw:py-1',
|
|
190
|
+
lg: 'tw:text-xl tw:py-1',
|
|
191
191
|
};
|
|
192
192
|
let tooltipData = undefined;
|
|
193
193
|
let appliedClasses = `${baseClasses} ${baseClassesByVariant[variant]} ${sizeClasses[size]} ${classesByVariantLightTheme[variant]} ${classesByVariantDarkTheme[variant]} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]} ${extraClassNames}`;
|
|
@@ -203,7 +203,7 @@ const Button = ({ onClick, label, variant = 'outline', type = 'button', size = '
|
|
|
203
203
|
'data-qtip-delay': tooltipOptions?.delay ?? DEFAULT_TOOL_TIP_DELAY,
|
|
204
204
|
};
|
|
205
205
|
}
|
|
206
|
-
const iconClass = iconPosition === 'left' ? 'tw
|
|
206
|
+
const iconClass = iconPosition === 'left' ? 'tw:mr-1' : 'tw:ml-1';
|
|
207
207
|
const iconElement = icon && (jsxRuntime.jsx(Icon, { icon: icon, iconPrefix: iconPrefix, type: iconStyle, color: iconColor, extraClassNames: label
|
|
208
208
|
? `${iconClass} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}`
|
|
209
209
|
: '', testId: `${id}_spinner` }));
|
|
@@ -1353,7 +1353,7 @@ const arrow$4 = options => ({
|
|
|
1353
1353
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
1354
1354
|
* @see https://floating-ui.com/docs/flip
|
|
1355
1355
|
*/
|
|
1356
|
-
const flip$
|
|
1356
|
+
const flip$3 = function (options) {
|
|
1357
1357
|
if (options === void 0) {
|
|
1358
1358
|
options = {};
|
|
1359
1359
|
}
|
|
@@ -2718,7 +2718,7 @@ const shift$2 = shift$3;
|
|
|
2718
2718
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
2719
2719
|
* @see https://floating-ui.com/docs/flip
|
|
2720
2720
|
*/
|
|
2721
|
-
const flip$
|
|
2721
|
+
const flip$2 = flip$3;
|
|
2722
2722
|
|
|
2723
2723
|
/**
|
|
2724
2724
|
* Provides data that allows you to change the size of the floating element —
|
|
@@ -3076,8 +3076,8 @@ const limitShift = (options, deps) => ({
|
|
|
3076
3076
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
3077
3077
|
* @see https://floating-ui.com/docs/flip
|
|
3078
3078
|
*/
|
|
3079
|
-
const flip$
|
|
3080
|
-
...flip$
|
|
3079
|
+
const flip$1 = (options, deps) => ({
|
|
3080
|
+
...flip$2(options),
|
|
3081
3081
|
options: [options, deps]
|
|
3082
3082
|
});
|
|
3083
3083
|
|
|
@@ -3250,7 +3250,7 @@ var PopperContent = React__namespace.forwardRef(
|
|
|
3250
3250
|
limiter: sticky === "partial" ? limitShift() : void 0,
|
|
3251
3251
|
...detectOverflowOptions
|
|
3252
3252
|
}),
|
|
3253
|
-
avoidCollisions && flip$
|
|
3253
|
+
avoidCollisions && flip$1({ ...detectOverflowOptions }),
|
|
3254
3254
|
size({
|
|
3255
3255
|
...detectOverflowOptions,
|
|
3256
3256
|
apply: ({ elements, rects, availableWidth, availableHeight }) => {
|
|
@@ -4797,31 +4797,30 @@ function getSvgIconPath(icon) {
|
|
|
4797
4797
|
}
|
|
4798
4798
|
|
|
4799
4799
|
const popoverBorderStyles = [
|
|
4800
|
-
'tw
|
|
4801
|
-
'tw
|
|
4802
|
-
'tw
|
|
4803
|
-
'tw
|
|
4804
|
-
'dark:
|
|
4800
|
+
'tw:border-solid',
|
|
4801
|
+
'tw:border',
|
|
4802
|
+
'tw:rounded-md',
|
|
4803
|
+
'tw:border-sq-disabled-gray',
|
|
4804
|
+
'tw:dark:border-gray-500',
|
|
4805
4805
|
].join(' ');
|
|
4806
4806
|
const triggerBackgroundStyles = [
|
|
4807
|
-
'tw
|
|
4808
|
-
'hover:
|
|
4809
|
-
'active:
|
|
4810
|
-
'dark:
|
|
4811
|
-
'dark:hover:
|
|
4812
|
-
'dark:active:
|
|
4807
|
+
'tw:bg-transparent',
|
|
4808
|
+
'tw:hover:bg-sq-worksheetspanel-gray',
|
|
4809
|
+
'tw:active:bg-sq-worksheetspanel-gray',
|
|
4810
|
+
'tw:dark:bg-transparent',
|
|
4811
|
+
'tw:dark:hover:bg-sq-field-disabled-gray/30',
|
|
4812
|
+
'tw:dark:active:bg-sq-field-disabled-gray/30',
|
|
4813
4813
|
].join(' ');
|
|
4814
4814
|
const activeBackgroundStyles = [
|
|
4815
4815
|
'active',
|
|
4816
|
-
'tw
|
|
4817
|
-
'
|
|
4818
|
-
'
|
|
4819
|
-
'dark:
|
|
4820
|
-
'dark:
|
|
4821
|
-
'dark:active:tw-bg-sq-dark-disabled-gray',
|
|
4816
|
+
'tw:bg-sq-overlay',
|
|
4817
|
+
'tw:active:bg-sq-overlay',
|
|
4818
|
+
'tw:dark:bg-sq-dark-disabled-gray',
|
|
4819
|
+
'tw:dark:hover:border-sq-dark-disabled-gray/30',
|
|
4820
|
+
'tw:dark:active:bg-sq-dark-disabled-gray/30',
|
|
4822
4821
|
].join(' ');
|
|
4823
|
-
const bgStyles$3 = ['tw
|
|
4824
|
-
const disabledClasses$4 = ['tw
|
|
4822
|
+
const bgStyles$3 = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
4823
|
+
const disabledClasses$4 = ['tw:opacity-50', 'tw:cursor-not-allowed'].join(' ');
|
|
4825
4824
|
const PopoverContent = React__namespace.forwardRef(({ className, align = 'center', sideOffset = 4, ...props }, ref) => (jsxRuntime.jsx(Content2$3, { ref: ref, align: align, sideOffset: sideOffset, ...props, asChild: true })));
|
|
4826
4825
|
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, }) => {
|
|
4827
4826
|
let tooltipData = undefined;
|
|
@@ -4839,12 +4838,12 @@ const ToolbarButton = ({ isSmall = false, label, icon, secondIcon, forceSmallIco
|
|
|
4839
4838
|
onHide && onHide();
|
|
4840
4839
|
}
|
|
4841
4840
|
};
|
|
4842
|
-
return (jsxRuntime.jsxs(Root2$3, { defaultOpen: false, onOpenChange: onOpenChange, children: [jsxRuntime.jsx(Trigger$3, { id: id, className: `tw-border-none tw
|
|
4841
|
+
return (jsxRuntime.jsxs(Root2$3, { defaultOpen: false, onOpenChange: onOpenChange, children: [jsxRuntime.jsx(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) => {
|
|
4843
4842
|
onClick && onClick(e);
|
|
4844
|
-
}, children: jsxRuntime.jsxs("div", { ...tooltipData, className: `tw
|
|
4845
|
-
' tw
|
|
4846
|
-
' 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' +
|
|
4847
|
-
popoverBorderStyles, children: [hasArrow && (jsxRuntime.jsx(Arrow2$2, { asChild: true, children: jsxRuntime.jsx("div", { className: " tw
|
|
4843
|
+
}, children: jsxRuntime.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: [jsxRuntime.jsxs("span", { className: "tw:nowrap", children: [isPrimaryAnSvg ? (jsxRuntime.jsx("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: jsxRuntime.jsx("path", { d: getSvgIconPath(icon) }) })) : (jsxRuntime.jsx(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 && jsxRuntime.jsx(Icon, { icon: secondIcon, type: "text", testId: "secondIcon" }), popoverContent ? (jsxRuntime.jsx(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 && jsxRuntime.jsx("small", { className: "tw:text-sq-text-color tw:dark:text-sq-dark-text tw:text-2.5", children: label })] }) }), !!popoverContent ? (jsxRuntime.jsx(PopoverContent, { sideOffset: 2, align: "start", children: jsxRuntime.jsxs("div", { className: bgStyles$3 +
|
|
4844
|
+
' 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' +
|
|
4845
|
+
' 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' +
|
|
4846
|
+
popoverBorderStyles, children: [hasArrow && (jsxRuntime.jsx(Arrow2$2, { asChild: true, children: jsxRuntime.jsx("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] }));
|
|
4848
4847
|
};
|
|
4849
4848
|
|
|
4850
4849
|
const setValidInputDimension = (width, height) => {
|
|
@@ -4861,24 +4860,24 @@ const setValidInputDimension = (width, height) => {
|
|
|
4861
4860
|
return inputStyle;
|
|
4862
4861
|
};
|
|
4863
4862
|
|
|
4864
|
-
const errorClasses$4 = 'tw
|
|
4863
|
+
const errorClasses$4 = 'tw:border-sq-danger';
|
|
4865
4864
|
const borderColorClasses$4 = [
|
|
4866
|
-
'tw
|
|
4867
|
-
'dark:
|
|
4868
|
-
'dark:focus:
|
|
4869
|
-
'dark:active:
|
|
4870
|
-
'focus:
|
|
4871
|
-
'active:
|
|
4865
|
+
'tw:border-sq-disabled-gray',
|
|
4866
|
+
'tw:dark:border-sq-dark-disabled-gray',
|
|
4867
|
+
'tw:dark:focus:border-sq-theme-dark-dark',
|
|
4868
|
+
'tw:dark:active:border-sq-theme-darker',
|
|
4869
|
+
'tw:focus:border-sq-theme-dark',
|
|
4870
|
+
'tw:active:border-sq-theme-dark',
|
|
4872
4871
|
].join(' ');
|
|
4873
|
-
const baseClasses$6 = 'tw
|
|
4874
|
-
' disabled:
|
|
4875
|
-
' disabled:
|
|
4876
|
-
' dark:
|
|
4877
|
-
const darkTheme$3 = 'dark:
|
|
4878
|
-
const lightTheme$3 = 'tw
|
|
4872
|
+
const baseClasses$6 = 'tw:h-8.5 tw:leading-normal tw:outline-none tw:py-1 tw:px-3' +
|
|
4873
|
+
' tw:disabled:pointer-events-none tw:disabled:bg-sq-light-gray tw:disabled:dark:bg-sq-dark-disabled-gray' +
|
|
4874
|
+
' tw:disabled:cursor-not-allowed tw:p-1 tw:border-solid tw:border tw:placeholder-gray-400' +
|
|
4875
|
+
' tw:dark:placeholder-sq-dark-text/30 specTextField';
|
|
4876
|
+
const darkTheme$3 = 'tw:dark:bg-sq-dark-background tw:dark:text-sq-dark-text tw:disabled:dark:text-sq-dark-text/30';
|
|
4877
|
+
const lightTheme$3 = 'tw:text-sq-text-color tw:disabled:text-sq-darkish-gray';
|
|
4879
4878
|
const sizeClasses = {
|
|
4880
|
-
sm: 'tw
|
|
4881
|
-
lg: 'tw
|
|
4879
|
+
sm: 'tw:text-sm',
|
|
4880
|
+
lg: 'tw:text-xl',
|
|
4882
4881
|
};
|
|
4883
4882
|
/**
|
|
4884
4883
|
* Textfield.
|
|
@@ -4920,12 +4919,12 @@ const TextField = React.forwardRef((props, ref) => {
|
|
|
4920
4919
|
internalRef.current.value = `${value}`;
|
|
4921
4920
|
}
|
|
4922
4921
|
}, [value]);
|
|
4923
|
-
let borderRadius = 'tw
|
|
4922
|
+
let borderRadius = 'tw:rounded-md';
|
|
4924
4923
|
if (inputGroup === 'left') {
|
|
4925
|
-
borderRadius = 'tw
|
|
4924
|
+
borderRadius = 'tw:rounded-l-md tw:border-r-0 tw:focus:border-r' + ' tw:active:border-r';
|
|
4926
4925
|
}
|
|
4927
4926
|
else if (inputGroup === 'right') {
|
|
4928
|
-
borderRadius = 'tw
|
|
4927
|
+
borderRadius = 'tw:rounded-r-md tw:border-l-0 tw:focus:border-l tw:active:border-l';
|
|
4929
4928
|
}
|
|
4930
4929
|
const appliedClasses = `${baseClasses$6} ${sizeClasses[size]} ${extraClassNames} ${lightTheme$3} ${darkTheme$3} ${borderRadius} ${showError ? errorClasses$4 : borderColorClasses$4} `;
|
|
4931
4930
|
const inputProp = setValidInputDimension(inputWidth, inputHeight)
|
|
@@ -4938,18 +4937,18 @@ const TextField = React.forwardRef((props, ref) => {
|
|
|
4938
4937
|
inputLenghtProp.maxLength = maxLength;
|
|
4939
4938
|
if (minLength)
|
|
4940
4939
|
inputLenghtProp.minLength = minLength;
|
|
4941
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("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 && jsxRuntime.jsx("div", { className: "tw
|
|
4940
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("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 && jsxRuntime.jsx("div", { className: "tw:text-sq-danger tw:text-xs tw:mt-1", children: errorText })] }));
|
|
4942
4941
|
});
|
|
4943
4942
|
|
|
4944
|
-
const alignment = 'tw
|
|
4945
|
-
const labelClasses = 'tw
|
|
4946
|
-
const baseClasses$5 = 'tw-border
|
|
4947
|
-
' dark:
|
|
4948
|
-
' checked:
|
|
4949
|
-
' checked:active:
|
|
4950
|
-
' dark:disabled:
|
|
4951
|
-
const checkboxClasses = `tw
|
|
4952
|
-
const radioClasses = `tw
|
|
4943
|
+
const alignment = 'tw:flex';
|
|
4944
|
+
const labelClasses = 'tw:ml-1.5 tw:text-sm tw:-mt-0.5';
|
|
4945
|
+
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' +
|
|
4946
|
+
' tw:dark:bg-sq-dark-background tw:dark:border-sq-dark-text tw:dark:hover:bg-sq-dark-background' +
|
|
4947
|
+
' tw:checked:text-white tw:checked:border-sq-text-color tw:checked:hover:border-sq-theme-dark' +
|
|
4948
|
+
' tw:checked:active:border-sq-theme-darker tw:checked:focus:border-sq-theme-dark tw:disabled:border-sq-disabled-gray' +
|
|
4949
|
+
' tw:dark:disabled:border-sq-fairly-dark-gray tw:dark:checked:focus:bg-sq-dark-background';
|
|
4950
|
+
const checkboxClasses = `tw:form-checkbox tw:rounded ${baseClasses$5}`;
|
|
4951
|
+
const radioClasses = `tw:form-radio tw:rounded-full ${baseClasses$5}`;
|
|
4953
4952
|
/**
|
|
4954
4953
|
* Checkbox and Radio Box Component.
|
|
4955
4954
|
*/
|
|
@@ -4957,26 +4956,25 @@ const Checkbox = (props) => {
|
|
|
4957
4956
|
const { type = 'checkbox', value, disabled = false, label, onChange, onClick, onKeyDown, checked, defaultChecked, id, name, extraClassNames, extraLabelClassNames, testId, ...tooltipProps } = props;
|
|
4958
4957
|
const assignedId = id ?? 'checkbox_' + Math.random();
|
|
4959
4958
|
const tooltipData = getQTipData(tooltipProps);
|
|
4960
|
-
return (jsxRuntime.jsxs("span", { className: `${alignment} ${extraClassNames}`, children: [jsxRuntime.jsx("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
|
|
4961
|
-
|
|
4962
|
-
|
|
4963
|
-
|
|
4964
|
-
|
|
4965
|
-
|
|
4966
|
-
|
|
4967
|
-
' disabled:
|
|
4968
|
-
|
|
4969
|
-
|
|
4970
|
-
|
|
4971
|
-
const
|
|
4972
|
-
const errorClasses$3 = 'tw-border-sq-danger-color';
|
|
4959
|
+
return (jsxRuntime.jsxs("span", { className: `${alignment} ${extraClassNames}`, children: [jsxRuntime.jsx("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 && (jsxRuntime.jsx("label", { htmlFor: assignedId, className: `${labelClasses} ${extraLabelClassNames} ${disabled
|
|
4960
|
+
? 'tw:cursor-not-allowed tw:dark:text-sq-fairly-dark-gray tw:text-sq-fairly-dark-gray'
|
|
4961
|
+
: 'tw:cursor-pointer tw:text-sq-text-color tw:dark:text-sq-dark-text'}`, children: label }))] }));
|
|
4962
|
+
};
|
|
4963
|
+
|
|
4964
|
+
const baseClasses$4 = 'tw:leading-normal tw:outline-none tw:py-1 tw:px-3 tw:rounded-md tw:w-full' +
|
|
4965
|
+
' tw:disabled:pointer-events-none tw:disabled:bg-sq-light-gray tw:disabled:dark:bg-sq-dark-disabled-gray' +
|
|
4966
|
+
' tw:disabled:cursor-not-allowed tw:p-1 tw:border-solid tw:border tw:text-sm';
|
|
4967
|
+
const darkTheme$2 = 'tw:dark:bg-sq-dark-background tw:dark:text-sq-dark-text ' +
|
|
4968
|
+
'tw:dark:placeholder-sq-dark-text/30 tw:disabled:dark:text-sq-dark-text/30';
|
|
4969
|
+
const lightTheme$2 = 'tw:text-sq-text-color tw:placeholder-gray-400 tw:disabled:text-sq-darkish-gray';
|
|
4970
|
+
const errorClasses$3 = 'tw:border-sq-danger';
|
|
4973
4971
|
const borderColorClasses$3 = [
|
|
4974
|
-
'tw
|
|
4975
|
-
'dark:
|
|
4976
|
-
'dark:focus:
|
|
4977
|
-
'dark:active:
|
|
4978
|
-
'focus:
|
|
4979
|
-
'active:
|
|
4972
|
+
'tw:border-sq-disabled-gray',
|
|
4973
|
+
'tw:dark:border-sq-dark-disabled-gray',
|
|
4974
|
+
'tw:dark:focus:border-sq-theme-darker',
|
|
4975
|
+
'tw:dark:active:border-sq-theme-darker',
|
|
4976
|
+
'tw:focus:border-sq-theme-dark',
|
|
4977
|
+
'tw:active:border-sq-theme-dark',
|
|
4980
4978
|
].join(' ');
|
|
4981
4979
|
/**
|
|
4982
4980
|
* TextArea.
|
|
@@ -5025,28 +5023,28 @@ const TextArea = React.forwardRef(({ readonly = false, disabled = false, onChang
|
|
|
5025
5023
|
* display correctly.
|
|
5026
5024
|
*/
|
|
5027
5025
|
const Tooltip = ({ position = 'bottom', children, text, delay = DEFAULT_TOOL_TIP_DELAY, }) => {
|
|
5028
|
-
const arrowBaseClasses =
|
|
5029
|
-
const centerArrowVertically = 'before:
|
|
5030
|
-
const centerArrowHorizontally = 'before:
|
|
5031
|
-
const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} before:
|
|
5032
|
-
before:
|
|
5033
|
-
const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} before:
|
|
5034
|
-
before:
|
|
5035
|
-
const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} before:-
|
|
5036
|
-
before:
|
|
5037
|
-
const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} before:-
|
|
5038
|
-
before:
|
|
5026
|
+
const arrowBaseClasses = "tw:before:content-[''] tw:before:absolute tw:before:border-8";
|
|
5027
|
+
const centerArrowVertically = 'tw:before:top-1/2 tw:before:-translate-y-1/2';
|
|
5028
|
+
const centerArrowHorizontally = 'tw:before:left-1/2 tw:before:-translate-x-1/2';
|
|
5029
|
+
const arrowRight = `${arrowBaseClasses} ${centerArrowVertically} tw:before:right-full tw:before:border-y-transparent
|
|
5030
|
+
tw:before:border-l-transparent tw:before:border-r-sq-black`;
|
|
5031
|
+
const arrowLeft = `${arrowBaseClasses} ${centerArrowVertically} tw:before:left-full tw:before:border-y-transparent
|
|
5032
|
+
tw:before:border-l-sq-black tw:before:border-r-transparent`;
|
|
5033
|
+
const arrowBottom = `${arrowBaseClasses} ${centerArrowHorizontally} tw:before:-top-4 tw:before:border-b-sq-black
|
|
5034
|
+
tw:before:border-r-transparent tw:before:border-l-transparent tw:before:border-t-transparent`;
|
|
5035
|
+
const arrowTop = `${arrowBaseClasses} ${centerArrowHorizontally} tw:before:-bottom-4 tw:before:border-b-transparent
|
|
5036
|
+
tw:before:border-t-sq-black tw:before:border-l-transparent tw:before:border-r-transparent`;
|
|
5039
5037
|
const placements = {
|
|
5040
|
-
top:
|
|
5041
|
-
left:
|
|
5042
|
-
right: `tw
|
|
5043
|
-
bottom:
|
|
5038
|
+
top: `tw:-top-2 tw:-translate-y-full tw:left-1/2 tw:-translate-x-1/2 ${arrowTop}`,
|
|
5039
|
+
left: `tw:-translate-x-full tw:-left-3 tw:-translate-y-1/2 tw:top-1/2 ${arrowLeft}`,
|
|
5040
|
+
right: `tw:translate-x-full tw:-right-3 tw:-translate-y-1/2 tw:top-1/2 ${arrowRight}`,
|
|
5041
|
+
bottom: `tw:-bottom-2 tw:translate-y-full tw:left-1/2 tw:-translate-x-1/2 ${arrowBottom}`,
|
|
5044
5042
|
};
|
|
5045
|
-
return (jsxRuntime.jsxs("div", { className: "tw
|
|
5046
|
-
tw
|
|
5043
|
+
return (jsxRuntime.jsxs("div", { className: "tw:group tw:relative tw:inline-block", children: [children, jsxRuntime.jsx("div", { className: `tw:z-50 tw:whitespace-nowrap tw:hidden tw:group-hover:inline-block tw:group-hover:delay-[${delay}ms]
|
|
5044
|
+
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 })] }));
|
|
5047
5045
|
};
|
|
5048
5046
|
|
|
5049
|
-
/*! @license DOMPurify 3.2.
|
|
5047
|
+
/*! @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 */
|
|
5050
5048
|
|
|
5051
5049
|
const {
|
|
5052
5050
|
entries,
|
|
@@ -5085,8 +5083,10 @@ if (!construct) {
|
|
|
5085
5083
|
};
|
|
5086
5084
|
}
|
|
5087
5085
|
const arrayForEach = unapply(Array.prototype.forEach);
|
|
5086
|
+
const arrayLastIndexOf = unapply(Array.prototype.lastIndexOf);
|
|
5088
5087
|
const arrayPop = unapply(Array.prototype.pop);
|
|
5089
5088
|
const arrayPush = unapply(Array.prototype.push);
|
|
5089
|
+
const arraySplice = unapply(Array.prototype.splice);
|
|
5090
5090
|
const stringToLowerCase = unapply(String.prototype.toLowerCase);
|
|
5091
5091
|
const stringToString = unapply(String.prototype.toString);
|
|
5092
5092
|
const stringMatch = unapply(String.prototype.match);
|
|
@@ -5104,6 +5104,9 @@ const typeErrorCreate = unconstruct(TypeError);
|
|
|
5104
5104
|
*/
|
|
5105
5105
|
function unapply(func) {
|
|
5106
5106
|
return function (thisArg) {
|
|
5107
|
+
if (thisArg instanceof RegExp) {
|
|
5108
|
+
thisArg.lastIndex = 0;
|
|
5109
|
+
}
|
|
5107
5110
|
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
5108
5111
|
args[_key - 1] = arguments[_key];
|
|
5109
5112
|
}
|
|
@@ -5242,10 +5245,10 @@ const xml = freeze(['xlink:href', 'xml:id', 'xlink:title', 'xml:space', 'xmlns:x
|
|
|
5242
5245
|
// eslint-disable-next-line unicorn/better-regex
|
|
5243
5246
|
const MUSTACHE_EXPR = seal(/\{\{[\w\W]*|[\w\W]*\}\}/gm); // Specify template detection regex for SAFE_FOR_TEMPLATES mode
|
|
5244
5247
|
const ERB_EXPR = seal(/<%[\w\W]*|[\w\W]*%>/gm);
|
|
5245
|
-
const TMPLIT_EXPR = seal(/\$\{[\w\W]
|
|
5248
|
+
const TMPLIT_EXPR = seal(/\$\{[\w\W]*/gm); // eslint-disable-line unicorn/better-regex
|
|
5246
5249
|
const DATA_ATTR = seal(/^data-[\-\w.\u00B7-\uFFFF]+$/); // eslint-disable-line no-useless-escape
|
|
5247
5250
|
const ARIA_ATTR = seal(/^aria-[\-\w]+$/); // eslint-disable-line no-useless-escape
|
|
5248
|
-
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
|
|
5251
|
+
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
|
|
5249
5252
|
);
|
|
5250
5253
|
const IS_SCRIPT_OR_DATA = seal(/^(?:\w+script|data):/i);
|
|
5251
5254
|
const ATTR_WHITESPACE = seal(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g // eslint-disable-line no-control-regex
|
|
@@ -5342,9 +5345,9 @@ const _createHooksMap = function _createHooksMap() {
|
|
|
5342
5345
|
function createDOMPurify() {
|
|
5343
5346
|
let window = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : getGlobal();
|
|
5344
5347
|
const DOMPurify = root => createDOMPurify(root);
|
|
5345
|
-
DOMPurify.version = '3.2.
|
|
5348
|
+
DOMPurify.version = '3.2.6';
|
|
5346
5349
|
DOMPurify.removed = [];
|
|
5347
|
-
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document) {
|
|
5350
|
+
if (!window || !window.document || window.document.nodeType !== NODE_TYPE.document || !window.Element) {
|
|
5348
5351
|
// Not running in a browser, provide a factory function
|
|
5349
5352
|
// so that you can pass your own Window
|
|
5350
5353
|
DOMPurify.isSupported = false;
|
|
@@ -5581,8 +5584,8 @@ function createDOMPurify() {
|
|
|
5581
5584
|
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;
|
|
5582
5585
|
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;
|
|
5583
5586
|
FORBID_CONTENTS = objectHasOwnProperty(cfg, 'FORBID_CONTENTS') ? addToSet({}, cfg.FORBID_CONTENTS, transformCaseFunc) : DEFAULT_FORBID_CONTENTS;
|
|
5584
|
-
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : {};
|
|
5585
|
-
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : {};
|
|
5587
|
+
FORBID_TAGS = objectHasOwnProperty(cfg, 'FORBID_TAGS') ? addToSet({}, cfg.FORBID_TAGS, transformCaseFunc) : clone({});
|
|
5588
|
+
FORBID_ATTR = objectHasOwnProperty(cfg, 'FORBID_ATTR') ? addToSet({}, cfg.FORBID_ATTR, transformCaseFunc) : clone({});
|
|
5586
5589
|
USE_PROFILES = objectHasOwnProperty(cfg, 'USE_PROFILES') ? cfg.USE_PROFILES : false;
|
|
5587
5590
|
ALLOW_ARIA_ATTR = cfg.ALLOW_ARIA_ATTR !== false; // Default true
|
|
5588
5591
|
ALLOW_DATA_ATTR = cfg.ALLOW_DATA_ATTR !== false; // Default true
|
|
@@ -5947,7 +5950,7 @@ function createDOMPurify() {
|
|
|
5947
5950
|
allowedTags: ALLOWED_TAGS
|
|
5948
5951
|
});
|
|
5949
5952
|
/* Detect mXSS attempts abusing namespace confusion */
|
|
5950
|
-
if (currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w]/g, currentNode.innerHTML) && regExpTest(/<[/\w]/g, currentNode.textContent)) {
|
|
5953
|
+
if (SAFE_FOR_XML && currentNode.hasChildNodes() && !_isNode(currentNode.firstElementChild) && regExpTest(/<[/\w!]/g, currentNode.innerHTML) && regExpTest(/<[/\w!]/g, currentNode.textContent)) {
|
|
5951
5954
|
_forceRemove(currentNode);
|
|
5952
5955
|
return true;
|
|
5953
5956
|
}
|
|
@@ -6099,7 +6102,8 @@ function createDOMPurify() {
|
|
|
6099
6102
|
value: attrValue
|
|
6100
6103
|
} = attr;
|
|
6101
6104
|
const lcName = transformCaseFunc(name);
|
|
6102
|
-
|
|
6105
|
+
const initValue = attrValue;
|
|
6106
|
+
let value = name === 'value' ? initValue : stringTrim(initValue);
|
|
6103
6107
|
/* Execute a hook if present */
|
|
6104
6108
|
hookEvent.attrName = lcName;
|
|
6105
6109
|
hookEvent.attrValue = value;
|
|
@@ -6125,10 +6129,9 @@ function createDOMPurify() {
|
|
|
6125
6129
|
if (hookEvent.forceKeepAttr) {
|
|
6126
6130
|
continue;
|
|
6127
6131
|
}
|
|
6128
|
-
/* Remove attribute */
|
|
6129
|
-
_removeAttribute(name, currentNode);
|
|
6130
6132
|
/* Did the hooks approve of the attribute? */
|
|
6131
6133
|
if (!hookEvent.keepAttr) {
|
|
6134
|
+
_removeAttribute(name, currentNode);
|
|
6132
6135
|
continue;
|
|
6133
6136
|
}
|
|
6134
6137
|
/* Work around a security issue in jQuery 3.0 */
|
|
@@ -6145,6 +6148,7 @@ function createDOMPurify() {
|
|
|
6145
6148
|
/* Is `value` valid for this attribute? */
|
|
6146
6149
|
const lcTag = transformCaseFunc(currentNode.nodeName);
|
|
6147
6150
|
if (!_isValidAttribute(lcTag, lcName, value)) {
|
|
6151
|
+
_removeAttribute(name, currentNode);
|
|
6148
6152
|
continue;
|
|
6149
6153
|
}
|
|
6150
6154
|
/* Handle attributes that require Trusted Types */
|
|
@@ -6165,19 +6169,23 @@ function createDOMPurify() {
|
|
|
6165
6169
|
}
|
|
6166
6170
|
}
|
|
6167
6171
|
/* Handle invalid data-* attribute set by try-catching it */
|
|
6168
|
-
|
|
6169
|
-
|
|
6170
|
-
|
|
6171
|
-
|
|
6172
|
-
|
|
6173
|
-
|
|
6174
|
-
|
|
6175
|
-
|
|
6176
|
-
|
|
6177
|
-
|
|
6178
|
-
|
|
6172
|
+
if (value !== initValue) {
|
|
6173
|
+
try {
|
|
6174
|
+
if (namespaceURI) {
|
|
6175
|
+
currentNode.setAttributeNS(namespaceURI, name, value);
|
|
6176
|
+
} else {
|
|
6177
|
+
/* Fallback to setAttribute() for browser-unrecognized namespaces e.g. "x-schema". */
|
|
6178
|
+
currentNode.setAttribute(name, value);
|
|
6179
|
+
}
|
|
6180
|
+
if (_isClobbered(currentNode)) {
|
|
6181
|
+
_forceRemove(currentNode);
|
|
6182
|
+
} else {
|
|
6183
|
+
arrayPop(DOMPurify.removed);
|
|
6184
|
+
}
|
|
6185
|
+
} catch (_) {
|
|
6186
|
+
_removeAttribute(name, currentNode);
|
|
6179
6187
|
}
|
|
6180
|
-
}
|
|
6188
|
+
}
|
|
6181
6189
|
}
|
|
6182
6190
|
/* Execute a hook if present */
|
|
6183
6191
|
_executeHooks(hooks.afterSanitizeAttributes, currentNode, null);
|
|
@@ -6363,7 +6371,11 @@ function createDOMPurify() {
|
|
|
6363
6371
|
}
|
|
6364
6372
|
arrayPush(hooks[entryPoint], hookFunction);
|
|
6365
6373
|
};
|
|
6366
|
-
DOMPurify.removeHook = function (entryPoint) {
|
|
6374
|
+
DOMPurify.removeHook = function (entryPoint, hookFunction) {
|
|
6375
|
+
if (hookFunction !== undefined) {
|
|
6376
|
+
const index = arrayLastIndexOf(hooks[entryPoint], hookFunction);
|
|
6377
|
+
return index === -1 ? undefined : arraySplice(hooks[entryPoint], index, 1)[0];
|
|
6378
|
+
}
|
|
6367
6379
|
return arrayPop(hooks[entryPoint]);
|
|
6368
6380
|
};
|
|
6369
6381
|
DOMPurify.removeHooks = function (entryPoint) {
|
|
@@ -6981,7 +6993,7 @@ const shift = shift$3;
|
|
|
6981
6993
|
* clipping boundary. Alternative to `autoPlacement`.
|
|
6982
6994
|
* @see https://floating-ui.com/docs/flip
|
|
6983
6995
|
*/
|
|
6984
|
-
const flip
|
|
6996
|
+
const flip = flip$3;
|
|
6985
6997
|
|
|
6986
6998
|
/**
|
|
6987
6999
|
* Provides data to position an inner element of the floating element so that it
|
|
@@ -7504,7 +7516,7 @@ const QTip = () => {
|
|
|
7504
7516
|
if (tooltipRef.current && tooltipTarget.current) {
|
|
7505
7517
|
computePosition(tooltipTarget.current, tooltipRef.current, {
|
|
7506
7518
|
placement: position,
|
|
7507
|
-
middleware: [offset$2(10), flip
|
|
7519
|
+
middleware: [offset$2(10), flip(), shift({ padding: 8 }), arrow({ element: tooltipArrowRef.current })],
|
|
7508
7520
|
}).then(({ x, y, middlewareData, placement: finalPlacement }) => {
|
|
7509
7521
|
Object.assign(tooltipRef.current?.style, {
|
|
7510
7522
|
left: `${x}px`,
|
|
@@ -7529,26 +7541,26 @@ const QTip = () => {
|
|
|
7529
7541
|
: positionTooltip();
|
|
7530
7542
|
}
|
|
7531
7543
|
};
|
|
7532
|
-
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.jsxs("div", { onMouseEnter: () => setOverTooltip(true), onMouseLeave: () => setOverTooltip(false), "data-testid": tooltipTestId, ref: tooltipRef, className: 'tw
|
|
7533
|
-
(show ? 'tw
|
|
7544
|
+
return (jsxRuntime.jsx(jsxRuntime.Fragment, { children: jsxRuntime.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 ' +
|
|
7545
|
+
(show ? 'tw:visible' : 'tw:invisible tw:pointer-events-none'), children: [html ? jsxRuntime.jsx(HTMLTip, { text: tooltipText }) : tooltipText, jsxRuntime.jsx("div", { className: "tw:absolute tw:w-2.5 tw:h-2.5 tw:rotate-45 tw:bg-sq-black", ref: tooltipArrowRef })] }) }));
|
|
7534
7546
|
};
|
|
7535
7547
|
|
|
7536
|
-
function _typeof
|
|
7548
|
+
function _typeof(o) {
|
|
7537
7549
|
"@babel/helpers - typeof";
|
|
7538
7550
|
|
|
7539
|
-
return _typeof
|
|
7551
|
+
return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) {
|
|
7540
7552
|
return typeof o;
|
|
7541
7553
|
} : function (o) {
|
|
7542
7554
|
return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o;
|
|
7543
|
-
}, _typeof
|
|
7555
|
+
}, _typeof(o);
|
|
7544
7556
|
}
|
|
7545
7557
|
|
|
7546
7558
|
function toPrimitive(t, r) {
|
|
7547
|
-
if ("object" != _typeof
|
|
7559
|
+
if ("object" != _typeof(t) || !t) return t;
|
|
7548
7560
|
var e = t[Symbol.toPrimitive];
|
|
7549
7561
|
if (void 0 !== e) {
|
|
7550
7562
|
var i = e.call(t, r || "default");
|
|
7551
|
-
if ("object" != _typeof
|
|
7563
|
+
if ("object" != _typeof(i)) return i;
|
|
7552
7564
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
7553
7565
|
}
|
|
7554
7566
|
return ("string" === r ? String : Number)(t);
|
|
@@ -7556,7 +7568,7 @@ function toPrimitive(t, r) {
|
|
|
7556
7568
|
|
|
7557
7569
|
function toPropertyKey(t) {
|
|
7558
7570
|
var i = toPrimitive(t, "string");
|
|
7559
|
-
return "symbol" == _typeof
|
|
7571
|
+
return "symbol" == _typeof(i) ? i : i + "";
|
|
7560
7572
|
}
|
|
7561
7573
|
|
|
7562
7574
|
function _defineProperty(e, r, t) {
|
|
@@ -7799,7 +7811,7 @@ function _assertThisInitialized(e) {
|
|
|
7799
7811
|
}
|
|
7800
7812
|
|
|
7801
7813
|
function _possibleConstructorReturn(t, e) {
|
|
7802
|
-
if (e && ("object" == _typeof
|
|
7814
|
+
if (e && ("object" == _typeof(e) || "function" == typeof e)) return e;
|
|
7803
7815
|
if (void 0 !== e) throw new TypeError("Derived constructors may only return object or undefined");
|
|
7804
7816
|
return _assertThisInitialized(t);
|
|
7805
7817
|
}
|
|
@@ -9845,7 +9857,7 @@ function classNames$1(prefix, state) {
|
|
|
9845
9857
|
|
|
9846
9858
|
var cleanValue = function cleanValue(value) {
|
|
9847
9859
|
if (isArray(value)) return value.filter(Boolean);
|
|
9848
|
-
if (_typeof
|
|
9860
|
+
if (_typeof(value) === 'object' && value !== null) return [value];
|
|
9849
9861
|
return [];
|
|
9850
9862
|
};
|
|
9851
9863
|
|
|
@@ -13945,70 +13957,77 @@ var CreatableSelect = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
13945
13957
|
});
|
|
13946
13958
|
var CreatableSelect$1 = CreatableSelect;
|
|
13947
13959
|
|
|
13948
|
-
const baseClasses$3 = ['focus:
|
|
13949
|
-
const containerStyles = ['tw
|
|
13950
|
-
const errorClasses$2 = 'tw
|
|
13951
|
-
const borderColorClasses$2 = ['tw
|
|
13952
|
-
const borderStyles$3 = ['tw
|
|
13960
|
+
const baseClasses$3 = ['tw:focus:ring-0', 'tw:disabled:cursor-not-allowed'].join(' ');
|
|
13961
|
+
const containerStyles = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
13962
|
+
const errorClasses$2 = 'tw:border-sq-danger';
|
|
13963
|
+
const borderColorClasses$2 = ['tw:border-sq-disabled-gray', 'tw:dark:border-sq-dark-disabled-gray'].join(' ');
|
|
13964
|
+
const borderStyles$3 = ['tw:border-solid', 'tw:border'].join(' ');
|
|
13953
13965
|
const borderActiveClasses = [
|
|
13954
|
-
'hover:
|
|
13955
|
-
'focus-within:
|
|
13956
|
-
'active:
|
|
13957
|
-
'dark:hover:
|
|
13958
|
-
'dark:focus-within:
|
|
13959
|
-
'dark:active:
|
|
13966
|
+
'tw:hover:border-sq-theme-dark',
|
|
13967
|
+
'tw:focus-within:border-sq-theme-dark',
|
|
13968
|
+
'tw:active:border-sq-theme-dark',
|
|
13969
|
+
'tw:dark:hover:border-sq-theme-dark-dark',
|
|
13970
|
+
'tw:dark:focus-within:border-sq-theme-dark-dark',
|
|
13971
|
+
'tw:dark:active:border-sq-theme-dark-dark',
|
|
13960
13972
|
].join(' ');
|
|
13961
|
-
const textStyles = ['tw
|
|
13973
|
+
const textStyles = ['tw:text-sq-text-color', 'tw:dark:text-sq-dark-text', 'tw:text-sm'].join(' ');
|
|
13962
13974
|
const textActiveStyles = [
|
|
13963
|
-
'hover:
|
|
13964
|
-
'
|
|
13965
|
-
'
|
|
13975
|
+
'tw:hover:text-sq-theme-dark',
|
|
13976
|
+
'tw:focus:text-sq-theme-dark',
|
|
13977
|
+
'tw:active:text-sq-theme-dark',
|
|
13978
|
+
'tw:dark:text-sq-dark-disabled-gray',
|
|
13979
|
+
'tw:dark:hover:text-sq-theme-dark-dark',
|
|
13980
|
+
'tw:dark:focus:text-sq-theme-dark-dark',
|
|
13981
|
+
'tw:dark:active:text-sq-theme-dark-dark',
|
|
13982
|
+
'tw:hover:text-sq-theme-dark',
|
|
13983
|
+
'tw:dark:text-sq-dark-disabled-gray',
|
|
13984
|
+
'tw:dark:hover:text-sq-theme-dark-dark',
|
|
13966
13985
|
].join(' ');
|
|
13967
13986
|
const menuStyles = [
|
|
13968
|
-
'tw
|
|
13969
|
-
'tw
|
|
13970
|
-
'tw
|
|
13971
|
-
'tw
|
|
13972
|
-
'dark:
|
|
13973
|
-
'tw
|
|
13974
|
-
'tw
|
|
13975
|
-
'
|
|
13987
|
+
'tw:border-solid',
|
|
13988
|
+
'tw:border',
|
|
13989
|
+
'tw:rounded-b',
|
|
13990
|
+
'tw:border-sq-disabled-gray',
|
|
13991
|
+
'tw:dark:border-sq-dark-disabled-gray',
|
|
13992
|
+
'tw:whitespace-nowrap',
|
|
13993
|
+
'tw:min-w-fit',
|
|
13994
|
+
'tw:!z-[9999]',
|
|
13976
13995
|
].join(' ');
|
|
13977
13996
|
const menuListStyles = [
|
|
13978
|
-
'tw
|
|
13979
|
-
'tw
|
|
13980
|
-
'dark:
|
|
13981
|
-
'tw
|
|
13982
|
-
'
|
|
13997
|
+
'tw:rounded-b',
|
|
13998
|
+
'tw:bg-sq-white',
|
|
13999
|
+
'tw:dark:bg-sq-dark-background',
|
|
14000
|
+
'tw:min-w-fit',
|
|
14001
|
+
'tw:!z-[9999]',
|
|
13983
14002
|
'specSelectMenu',
|
|
13984
14003
|
].join(' ');
|
|
13985
14004
|
const groupHeadingStyles = [
|
|
13986
|
-
'tw
|
|
13987
|
-
'dark:
|
|
13988
|
-
'tw
|
|
13989
|
-
'tw
|
|
13990
|
-
'tw
|
|
14005
|
+
'tw:bg-sq-light-gray',
|
|
14006
|
+
'tw:dark:bg-sq-dark-disabled-gray',
|
|
14007
|
+
'tw:text-sq-darkish-gray',
|
|
14008
|
+
'tw:py-1',
|
|
14009
|
+
'tw:px-2.5',
|
|
13991
14010
|
'specSelectGroupHeading',
|
|
13992
14011
|
].join(' ');
|
|
13993
14012
|
const optionStyles = [
|
|
13994
|
-
'hover:
|
|
13995
|
-
'hover:
|
|
13996
|
-
'dark:hover:
|
|
13997
|
-
'tw
|
|
13998
|
-
'tw
|
|
14013
|
+
'tw:hover:bg-sq-gray-highlight',
|
|
14014
|
+
'tw:hover:cursor-pointer',
|
|
14015
|
+
'tw:dark:hover:bg-sq-gray-highlight-dark',
|
|
14016
|
+
'tw:py-1',
|
|
14017
|
+
'tw:px-2.5',
|
|
13999
14018
|
'specSelectOption',
|
|
14000
14019
|
].join(' ');
|
|
14001
|
-
const disabledClasses$3 = ['tw
|
|
14002
|
-
const dropDownIndicatorStyles = `tw
|
|
14003
|
-
const placeholderStyles = ['tw
|
|
14020
|
+
const disabledClasses$3 = ['tw:bg-sq-field-disabled-gray', 'tw:!cursor-not-allowed', 'tw:opacity-50'].join(' ');
|
|
14021
|
+
const dropDownIndicatorStyles = `tw:text-sq-disabled-gray ${textActiveStyles} specOpenIt`;
|
|
14022
|
+
const placeholderStyles = ['tw:text-gray-400', 'tw:dark:text-sq-dark-text-lighter', 'specOpenSelect'].join(' ');
|
|
14004
14023
|
const multiValueStyles = [
|
|
14005
|
-
'tw
|
|
14006
|
-
'dark:
|
|
14007
|
-
'tw
|
|
14008
|
-
'tw
|
|
14009
|
-
'tw
|
|
14010
|
-
'tw
|
|
14011
|
-
'tw
|
|
14024
|
+
'tw:bg-sq-disabled-gray',
|
|
14025
|
+
'tw:dark:bg-sq-multi-gray-dark',
|
|
14026
|
+
'tw:text-sm',
|
|
14027
|
+
'tw:py-0.5',
|
|
14028
|
+
'tw:px-1',
|
|
14029
|
+
'tw:m-0.5',
|
|
14030
|
+
'tw:rounded-sm',
|
|
14012
14031
|
'specOpenSelect',
|
|
14013
14032
|
].join(' ');
|
|
14014
14033
|
/**
|
|
@@ -14073,38 +14092,38 @@ const Select = ({ options, value, placeholder = 'select', noOptionsMessage = 'no
|
|
|
14073
14092
|
filterOption: filterOption ? filterOption : filterConfig ? createFilter(filterConfig) : undefined,
|
|
14074
14093
|
classNames: {
|
|
14075
14094
|
control: ({ menuIsOpen }) => {
|
|
14076
|
-
let border = menuIsOpen ? 'tw
|
|
14095
|
+
let border = menuIsOpen ? 'tw:rounded-t-md' : 'tw:rounded-md';
|
|
14077
14096
|
// if it's on the left side of the input group make sure the right side is straight and not curved
|
|
14078
14097
|
if (inputGroup === 'left') {
|
|
14079
|
-
border = menuIsOpen ? 'tw
|
|
14098
|
+
border = menuIsOpen ? 'tw:rounded-tl-md' : 'tw:rounded-l-md';
|
|
14080
14099
|
}
|
|
14081
14100
|
else if (inputGroup === 'right') {
|
|
14082
|
-
border = menuIsOpen ? 'tw
|
|
14101
|
+
border = menuIsOpen ? 'tw:rounded-tr-md' : 'tw:rounded-r-md';
|
|
14083
14102
|
}
|
|
14084
14103
|
const appliedClasses = `${borderStyles$3} ${isDisabled ? '' : borderActiveClasses} ${border} ${showError ? errorClasses$2 : borderColorClasses$2} ${small ? 'reactSelectMinHeightSmall' : 'reactSelectMinHeight'} ${controlClassNames}`;
|
|
14085
|
-
return `${appliedClasses} ${baseClasses$3} ${containerStyles} specSelectControl ${isDisabled ? disabledClasses$3 : ''} ${small ? 'tw
|
|
14104
|
+
return `${appliedClasses} ${baseClasses$3} ${containerStyles} specSelectControl ${isDisabled ? disabledClasses$3 : ''} ${small ? 'tw:pl-2 tw:pr-1' : 'tw:pl-2.5 tw:pr-1.5'}`;
|
|
14086
14105
|
},
|
|
14087
14106
|
placeholder: () => placeholderStyles,
|
|
14088
14107
|
container: ({ selectProps }) => {
|
|
14089
|
-
const containerBorderStyles = selectProps?.menuIsOpen ? 'tw
|
|
14090
|
-
return `${textStyles} ${extraClassNames} ${containerBorderStyles}
|
|
14108
|
+
const containerBorderStyles = selectProps?.menuIsOpen ? 'tw:rounded-t-md' : 'tw:rounded-md';
|
|
14109
|
+
return `${textStyles} ${extraClassNames} ${containerBorderStyles} tw:!pointer-events-auto`;
|
|
14091
14110
|
},
|
|
14092
14111
|
input: () => textStyles + ' specSelectInput',
|
|
14093
14112
|
menuList: () => menuListStyles,
|
|
14094
14113
|
menu: () => menuStyles,
|
|
14095
|
-
menuPortal: () => '
|
|
14114
|
+
menuPortal: () => 'tw:!z-[9000]',
|
|
14096
14115
|
dropdownIndicator: () => dropDownIndicatorStyles,
|
|
14097
14116
|
option: ({ isSelected, isDisabled }) => {
|
|
14098
14117
|
let classes = optionStyles;
|
|
14099
14118
|
if (isDisabled) {
|
|
14100
14119
|
classes += ' specDisabledOption ';
|
|
14101
14120
|
}
|
|
14102
|
-
return isSelected ? classes + ' tw
|
|
14121
|
+
return isSelected ? classes + ' tw:bg-sq-colored-hover tw:dark:bg-sq-colored-hover-dark' : classes;
|
|
14103
14122
|
},
|
|
14104
14123
|
singleValue: () => 'specOpenSelect',
|
|
14105
14124
|
multiValue: () => multiValueStyles,
|
|
14106
|
-
multiValueRemove: () => 'hover:
|
|
14107
|
-
clearIndicator: () => 'tw
|
|
14125
|
+
multiValueRemove: () => 'tw:hover:text-sq-danger specSelectMultiValueRemove',
|
|
14126
|
+
clearIndicator: () => 'tw:text-sq-disabled-gray tw:hover:text-sq-danger specClearSelect',
|
|
14108
14127
|
group: () => 'specSelectGroup',
|
|
14109
14128
|
groupHeading: () => groupHeadingStyles,
|
|
14110
14129
|
},
|
|
@@ -14494,11 +14513,11 @@ var classNames = /*@__PURE__*/getDefaultExportFromCjs(classnamesExports);
|
|
|
14494
14513
|
const Dialog = Root$4;
|
|
14495
14514
|
const DialogPortal = Portal$1;
|
|
14496
14515
|
const DialogClose = Close;
|
|
14497
|
-
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (jsxRuntime.jsxs(DialogPortal, { children: [jsxRuntime.jsx("div", { className: "tw
|
|
14498
|
-
tw
|
|
14499
|
-
tw
|
|
14516
|
+
const DialogContent = React.forwardRef(({ className, children, ...props }, ref) => (jsxRuntime.jsxs(DialogPortal, { children: [jsxRuntime.jsx("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 " }), jsxRuntime.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
|
|
14517
|
+
tw:gap-4 tw:border tw:bg-sq-white tw:dark:bg-sq-dark-background tw:shadow-lg tw:duration-200
|
|
14518
|
+
tw:rounded-lg ${className}`, ...props, children: [jsxRuntime.jsx(DialogTitle$1, { className: "tw:hidden" }), children] })] })));
|
|
14500
14519
|
DialogContent.displayName = Content$2.displayName;
|
|
14501
|
-
const DialogHeader = (props) => (jsxRuntime.jsx("div", { className: "tw
|
|
14520
|
+
const DialogHeader = (props) => (jsxRuntime.jsx("div", { className: "tw:w-full tw:justify-between", children: jsxRuntime.jsx("div", { ...props }) }));
|
|
14502
14521
|
DialogHeader.displayName = 'DialogHeader';
|
|
14503
14522
|
const DialogFooter = (props) => jsxRuntime.jsx("div", { ...props });
|
|
14504
14523
|
DialogFooter.displayName = 'DialogFooter';
|
|
@@ -14536,26 +14555,26 @@ const Modal = ({ titleIcon, title = 'Modal title example', titleSuffixLabel, sub
|
|
|
14536
14555
|
let titleIconElement = jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
14537
14556
|
if (titleIcon) {
|
|
14538
14557
|
if (typeof titleIcon === 'string') {
|
|
14539
|
-
titleIconElement = (jsxRuntime.jsx(Icon, { icon: titleIcon, testId: "modalTitleIcon", extraClassNames: "tw
|
|
14558
|
+
titleIconElement = (jsxRuntime.jsx(Icon, { icon: titleIcon, testId: "modalTitleIcon", extraClassNames: "tw:flex tw:text-xl tw:mt-1" }));
|
|
14540
14559
|
}
|
|
14541
14560
|
else {
|
|
14542
|
-
titleIconElement = jsxRuntime.jsx("div", { className: "tw
|
|
14561
|
+
titleIconElement = jsxRuntime.jsx("div", { className: "tw:mt-1.5", children: titleIcon });
|
|
14543
14562
|
}
|
|
14544
14563
|
}
|
|
14545
|
-
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [titleIcon && titleIconPosition === 'left' ? jsxRuntime.jsx("div", { className: "tw
|
|
14564
|
+
return (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [titleIcon && titleIconPosition === 'left' ? jsxRuntime.jsx("div", { className: "tw:flex tw:mr-2", children: titleIconElement }) : jsxRuntime.jsx(jsxRuntime.Fragment, {}), jsxRuntime.jsx(DialogTitle, { asChild: true, children: isTitleEditable ? (jsxRuntime.jsxs("div", { className: "tw:flex tw:w-full tw:items-center", children: [jsxRuntime.jsx(TextField, { extraClassNames: inputExtraClassNames, value: title, type: "text", testId: "modalTitle", onChange: onTitleChanged, placeholder: titlePlaceholder, required: titleRequired, showError: !!titleError }), titleError && jsxRuntime.jsx("p", { className: "tw:text-sq-danger tw:min-w-fit tw:pl-2 tw:mb-0", children: titleError })] })) : (customHeader ?? (jsxRuntime.jsxs("div", { "data-testid": "modalTitle", className: "modal-title", children: [jsxRuntime.jsxs("div", { className: "tw:flex tw:items-center", children: [jsxRuntime.jsx("h3", { children: title }), titleSuffixLabel && jsxRuntime.jsx("span", { className: "tw:text-xl tw:pl-0.5", children: titleSuffixLabel })] }), subtitle && (jsxRuntime.jsx("div", { className: "tw:italic tw:text-sm tw:text-left tw:mt-1", "data-testid": "modal-subtitle", children: subtitle }))] }))) }), titleIcon && titleIconPosition === 'right' ? jsxRuntime.jsx("div", { className: "tw:flex tw:ml-4", children: titleIconElement }) : jsxRuntime.jsx(jsxRuntime.Fragment, {})] }));
|
|
14546
14565
|
};
|
|
14547
|
-
return open ? (jsxRuntime.jsx(Dialog, { open: true, onOpenChange: onClose, modal: keepFocusInsideModal, children: jsxRuntime.jsxs(DialogContent, { onPointerDownOutside: (e) => (onPointerDownOutside ? onPointerDownOutside(e) : e.preventDefault()), onInteractOutside: (e) => (onInteractOutside ? onInteractOutside(e) : e.preventDefault()), "data-testid": testId, className: classNames(`modalContent tw
|
|
14548
|
-
'tw
|
|
14549
|
-
'tw
|
|
14550
|
-
'tw
|
|
14551
|
-
'tw
|
|
14552
|
-
'tw
|
|
14553
|
-
'tw
|
|
14554
|
-
'tw
|
|
14555
|
-
'tw
|
|
14556
|
-
'tw
|
|
14557
|
-
'tw
|
|
14558
|
-
}, dialogClassName), children: [jsxRuntime.jsxs(DialogHeader, { className: "modal-header tw
|
|
14566
|
+
return open ? (jsxRuntime.jsx(Dialog, { open: true, onOpenChange: onClose, modal: keepFocusInsideModal, children: jsxRuntime.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`, {
|
|
14567
|
+
'tw:max-w-xs': size === 'xs',
|
|
14568
|
+
'tw:max-w-sm': size === 'sm',
|
|
14569
|
+
'tw:max-w-md': size === 'md',
|
|
14570
|
+
'tw:max-w-lg': size === 'lg',
|
|
14571
|
+
'tw:max-w-xl': size === 'xl',
|
|
14572
|
+
'tw:max-w-2xl': size === '2xl',
|
|
14573
|
+
'tw:max-w-3xl': size === '3xl',
|
|
14574
|
+
'tw:max-w-4xl': size === '4xl',
|
|
14575
|
+
'tw:max-w-5xl': size === '5xl',
|
|
14576
|
+
'tw:max-w-6xl': size === '6xl',
|
|
14577
|
+
}, dialogClassName), children: [jsxRuntime.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: [jsxRuntime.jsx("div", { className: "tw:flex tw:w-full", children: renderTitle() }), !hideCloseIcon && (jsxRuntime.jsx(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: jsxRuntime.jsx("span", { className: "tw:cursor-pointer", children: "\u00D7" }) }))] }), jsxRuntime.jsx(DialogDescription, { className: "modal-body tw:px-6 tw:py-4 tw:overflow-y-auto", asChild: true, children: children }), !hideFooterButtons && (jsxRuntime.jsx(DialogFooter, { className: "modal-footer tw:px-6 tw:py-4", children: modalFooter ?? (jsxRuntime.jsxs("div", { className: "tw:flex tw:w-full tw:justify-between", "data-testid": "modalFooter", children: [jsxRuntime.jsx("div", { className: "tw:flex tw:justify-start", children: customButton && (jsxRuntime.jsx(Button, { label: customButtonLabel, onClick: onClickCustomButton, disabled: disableCustomButton, extraClassNames: "tw:justify-start tw:min-w-25", testId: "customButton", variant: customButtonVariant })) }), jsxRuntime.jsxs("div", { className: "tw:flex tw:justify-end", children: [jsxRuntime.jsx("div", { className: "tw:flex tw:items-center", children: middleFooterSection }), !hideCancelButton && (jsxRuntime.jsx(DialogClose, { asChild: true, children: jsxRuntime.jsx(Button, { label: cancelButtonLabel, extraClassNames: "tw:mr-5 tw:min-w-25", tooltip: cancelButtonTooltip, variant: "outline", stopPropagation: false, testId: "cancelButton" }) })), !hideSubmitButton && (jsxRuntime.jsx(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" }))] })] })) }))] }) })) : (jsxRuntime.jsx(jsxRuntime.Fragment, {}));
|
|
14559
14578
|
};
|
|
14560
14579
|
|
|
14561
14580
|
function createCollection(name) {
|
|
@@ -15013,11 +15032,11 @@ const Tabs = ({ tabs, defaultActiveTab, activeTab, onTabSelect, extraClassNames,
|
|
|
15013
15032
|
return;
|
|
15014
15033
|
onTabSelect && onTabSelect(tabId);
|
|
15015
15034
|
};
|
|
15016
|
-
return (jsxRuntime.jsxs(Root2$2, { className: `tw
|
|
15017
|
-
? 'tw
|
|
15018
|
-
: 'hover:
|
|
15019
|
-
? 'dark:
|
|
15020
|
-
: 'dark:
|
|
15035
|
+
return (jsxRuntime.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: [jsxRuntime.jsx(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) => (jsxRuntime.jsx(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
|
|
15036
|
+
? 'tw:border-b-sq-theme-darker tw:dark:border-b-sq-theme-darker tw:border-b-[0.1875rem]'
|
|
15037
|
+
: '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: jsxRuntime.jsxs("span", { className: "tw:flex tw:items-center tw:overflow-hidden", children: [icon && (jsxRuntime.jsx(Icon, { icon: icon, testId: `${id}_tab-icon`, extraClassNames: "tw:text-sq-15 tw:mr-sq-7 tw:flex-shrink-0" })), jsxRuntime.jsx("span", { className: `tw:text-sq-13 tw:font-medium tw:whitespace-nowrap tw:overflow-hidden tw:text-ellipsis ${activeTab === id
|
|
15038
|
+
? 'tw:dark:text-sq-dark-text tw:text-gray-500'
|
|
15039
|
+
: 'tw:dark:text-sq-theme-darker tw:text-sq-theme-dark'} ${tabLabelExtraClassNames}`, children: label })] }) }, `${label}-${id}-${index}`))) }), tabs.map((tab, index) => (jsxRuntime.jsx(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`)))] }));
|
|
15021
15040
|
};
|
|
15022
15041
|
|
|
15023
15042
|
var COLLAPSIBLE_NAME = "Collapsible";
|
|
@@ -15442,18 +15461,18 @@ var Trigger2 = AccordionTrigger;
|
|
|
15442
15461
|
var Content2$2 = AccordionContent;
|
|
15443
15462
|
|
|
15444
15463
|
const Accordion = ({ accordionItems, defaultValue, value, onItemSelect, disabled, extraClassNames, testId, }) => {
|
|
15445
|
-
return (jsxRuntime.jsx(Root2$1, { className: `tw
|
|
15464
|
+
return (jsxRuntime.jsx(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) => (jsxRuntime.jsxs(Item, { className: `tw:p-0 tw:flex tw:flex-col tw:w-full`, disabled: disabled, value: item.value, children: [jsxRuntime.jsx(Trigger2, { disabled: disabled, className: `tw:w-full tw:cursor-default tw:focus-visible:outline-none tw:bg-transparent`, children: item.trigger }), jsxRuntime.jsx(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))) }));
|
|
15446
15465
|
};
|
|
15447
15466
|
|
|
15448
|
-
const bgStyles$2 = ['tw
|
|
15467
|
+
const bgStyles$2 = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
15449
15468
|
const borderStyles$2 = [
|
|
15450
|
-
'tw
|
|
15451
|
-
'tw
|
|
15452
|
-
'tw
|
|
15453
|
-
'tw
|
|
15454
|
-
'dark:
|
|
15469
|
+
'tw:border-solid',
|
|
15470
|
+
'tw:border',
|
|
15471
|
+
'tw:rounded-[0.5rem]',
|
|
15472
|
+
'tw:border-sq-disabled-gray',
|
|
15473
|
+
'tw:dark:border-gray-500',
|
|
15455
15474
|
].join(' ');
|
|
15456
|
-
const disabledClasses$2 = ['tw
|
|
15475
|
+
const disabledClasses$2 = ['tw:opacity-50', 'tw:cursor-not-allowed'].join(' ');
|
|
15457
15476
|
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 }) => {
|
|
15458
15477
|
const tooltipData = getQTipData(tooltipProps);
|
|
15459
15478
|
const timeout = React.useRef(null);
|
|
@@ -15484,12 +15503,12 @@ const ButtonWithPopover = ({ children, trigger, id, hasArrow, extraTriggerClassN
|
|
|
15484
15503
|
};
|
|
15485
15504
|
React__namespace.useEffect(() => clearHoverTimeout, []);
|
|
15486
15505
|
const renderContent = () => {
|
|
15487
|
-
return (jsxRuntime.jsx(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:
|
|
15488
|
-
data-[side=top]:
|
|
15489
|
-
${extraPopoverClassNames || ''}`, children: [hasArrow && (jsxRuntime.jsx(Arrow2$2, { asChild: true, children: jsxRuntime.jsx("div", { className: "tw
|
|
15506
|
+
return (jsxRuntime.jsx(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: jsxRuntime.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
|
|
15507
|
+
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
|
|
15508
|
+
${extraPopoverClassNames || ''}`, children: [hasArrow && (jsxRuntime.jsx(Arrow2$2, { asChild: true, children: jsxRuntime.jsx("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] }) }));
|
|
15490
15509
|
};
|
|
15491
15510
|
const renderPopover = (popoverOpenState) => {
|
|
15492
|
-
return (jsxRuntime.jsxs(Root2$3, { open: popoverOpenState, defaultOpen: false, onOpenChange: onOpenChange, children: [trigger ? (jsxRuntime.jsx(Trigger$3, { id: id, asChild: isTriggerAsChild, className: `focus-visible:
|
|
15511
|
+
return (jsxRuntime.jsxs(Root2$3, { open: popoverOpenState, defaultOpen: false, onOpenChange: onOpenChange, children: [trigger ? (jsxRuntime.jsx(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: jsxRuntime.jsx("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 }) })) : (jsxRuntime.jsx(Trigger$3, { asChild: true, children: jsxRuntime.jsx("div", {}) })), isPortal ? jsxRuntime.jsx(Portal$2, { children: renderContent() }) : renderContent()] }));
|
|
15493
15512
|
};
|
|
15494
15513
|
return isHoverEnabled ? renderPopover(isHoveredOpen) : renderPopover(isOpen);
|
|
15495
15514
|
};
|
|
@@ -16554,65 +16573,65 @@ var SubTrigger2 = DropdownMenuSubTrigger;
|
|
|
16554
16573
|
var SubContent2 = DropdownMenuSubContent;
|
|
16555
16574
|
|
|
16556
16575
|
const borderStyles$1 = [
|
|
16557
|
-
'tw
|
|
16558
|
-
'tw
|
|
16559
|
-
'tw
|
|
16560
|
-
'tw
|
|
16561
|
-
'dark:
|
|
16576
|
+
'tw:border-solid',
|
|
16577
|
+
'tw:border',
|
|
16578
|
+
'tw:rounded-[0.5rem]',
|
|
16579
|
+
'tw:border-sq-disabled-gray',
|
|
16580
|
+
'tw:dark:border-gray-500',
|
|
16562
16581
|
].join(' ');
|
|
16563
|
-
const bgStyles$1 = ['tw
|
|
16564
|
-
const disabledClasses$1 = ['tw
|
|
16582
|
+
const bgStyles$1 = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
16583
|
+
const disabledClasses$1 = ['tw:opacity-50', 'tw:cursor-not-allowed'].join(' ');
|
|
16565
16584
|
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 }) => {
|
|
16566
16585
|
const tooltipData = getQTipData(tooltipProps);
|
|
16567
|
-
return (jsxRuntime.jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [jsxRuntime.jsx(Trigger, { id: id, className: `tw-border-none focus-visible:
|
|
16586
|
+
return (jsxRuntime.jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [jsxRuntime.jsx(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: jsxRuntime.jsx("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 }) }), jsxRuntime.jsx(Portal2, { children: jsxRuntime.jsx(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: jsxRuntime.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 && (jsxRuntime.jsx(Arrow2, { asChild: true, children: jsxRuntime.jsx("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) => {
|
|
16568
16587
|
const tooltipData = getQTipData(item);
|
|
16569
16588
|
if (item.isLabel) {
|
|
16570
|
-
return (jsxRuntime.jsxs(Label2, { className: item.itemExtraClassNames, ...tooltipData, children: [item.icon && (jsxRuntime.jsx(Icon, { icon: item.icon, testId: item.iconTestId, type: "text", color: item.iconColor, extraClassNames: "tw
|
|
16589
|
+
return (jsxRuntime.jsxs(Label2, { className: item.itemExtraClassNames, ...tooltipData, children: [item.icon && (jsxRuntime.jsx(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" })), jsxRuntime.jsx("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));
|
|
16571
16590
|
}
|
|
16572
16591
|
if (Array.isArray(item.subMenuItems) && item.subMenuItems.length > 0) {
|
|
16573
|
-
return (jsxRuntime.jsxs(Sub2, { children: [jsxRuntime.jsxs(SubTrigger2, { id: id, className: `tw
|
|
16574
|
-
? '
|
|
16575
|
-
: 'tw
|
|
16576
|
-
return (jsxRuntime.jsxs(Item2, { onSelect: subItem.onClick, "data-qtip-text": subItem.tooltip, className: "tw
|
|
16577
|
-
? 'tw
|
|
16578
|
-
: 'tw
|
|
16592
|
+
return (jsxRuntime.jsxs(Sub2, { children: [jsxRuntime.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: [jsxRuntime.jsxs("div", { className: "tw:flex", children: [item.icon && (jsxRuntime.jsx(Icon, { icon: item.icon, extraClassNames: `tw:w-4.5 ${item.disabled
|
|
16593
|
+
? 'tw:!text-sq-disabled-gray'
|
|
16594
|
+
: 'tw:text-sq-text-color tw:dark:text-sq-white'} ${item.iconExtraClassNames || ''}` })), jsxRuntime.jsx("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 })] }), jsxRuntime.jsx(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` })] }), jsxRuntime.jsx(Portal2, { children: jsxRuntime.jsx(SubContent2, { className: "tw:focus-visible:outline-none tw:outline-none", children: jsxRuntime.jsx("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) => {
|
|
16595
|
+
return (jsxRuntime.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 && (jsxRuntime.jsx(Icon, { icon: subItem.iconClass, type: "text", extraClassNames: `tw:w-4.5 ${item.disabled && 'tw:!opacity-30'}` })), jsxRuntime.jsx("div", { className: `tw:text-sq-13 tw:ml-1 ${subItem.disabled
|
|
16596
|
+
? 'tw:text-sq-disabled-gray'
|
|
16597
|
+
: 'tw:text-sq-text-color tw:dark:text-sq-white'} tw:not-italic tw:font-normal ${item.labelClasses}`, children: subItem.label })] }, subItem.label + subIndex));
|
|
16579
16598
|
}) }) }) })] }, (item.id || item.icon || '') + index));
|
|
16580
16599
|
}
|
|
16581
16600
|
return (jsxRuntime.jsxs("div", { ...tooltipData, children: [jsxRuntime.jsxs(Item2, { "data-customid": item.itemCustomId, onSelect: (e) => {
|
|
16582
16601
|
item.onClick(e);
|
|
16583
|
-
}, className: `tw
|
|
16602
|
+
}, 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 && (jsxRuntime.jsx(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 || ''}` })), jsxRuntime.jsx("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 && (jsxRuntime.jsx(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));
|
|
16584
16603
|
})] }) }) })] }));
|
|
16585
16604
|
};
|
|
16586
16605
|
|
|
16587
|
-
const baseClasses$2 = 'tw
|
|
16588
|
-
' tw
|
|
16589
|
-
const darkTheme$1 = 'dark:
|
|
16590
|
-
const lightTheme$1 = 'tw
|
|
16591
|
-
const errorClasses$1 = 'tw
|
|
16592
|
-
const borderColorClasses$1 = 'tw
|
|
16606
|
+
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' +
|
|
16607
|
+
' tw:border-solid tw:border tw:text-sm tw:flex tw:flex-col tw:justify-center tw:items-center';
|
|
16608
|
+
const darkTheme$1 = 'tw:dark:bg-sq-theme-hover-dark tw:dark:text-sq-text-color-dark';
|
|
16609
|
+
const lightTheme$1 = 'tw:text-sq-text-color tw:bg-sq-theme-highlight/10';
|
|
16610
|
+
const errorClasses$1 = 'tw:border-sq-danger';
|
|
16611
|
+
const borderColorClasses$1 = 'tw:border-sq-theme-dark';
|
|
16593
16612
|
/**
|
|
16594
16613
|
* Alert.
|
|
16595
16614
|
*/
|
|
16596
16615
|
const Alert = ({ children, dismissible = true, onClose, show = true, variant, testId = 'alert-id', id, extraClassNames, ...tooltipProps }) => {
|
|
16597
16616
|
const appliedTheme = {
|
|
16598
16617
|
theme: `${lightTheme$1} ${darkTheme$1}`,
|
|
16599
|
-
formulaError: 'tw
|
|
16600
|
-
danger: 'tw
|
|
16601
|
-
warning: 'tw
|
|
16602
|
-
gray: 'tw
|
|
16618
|
+
formulaError: 'tw:text-red-800 tw:bg-red-200 tw:!rounded-[0.25rem]',
|
|
16619
|
+
danger: 'tw:text-sq-text-color tw:bg-sq-danger',
|
|
16620
|
+
warning: 'tw:bg-sq-bg-warning tw:text-sq-text-color',
|
|
16621
|
+
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',
|
|
16603
16622
|
};
|
|
16604
16623
|
const appliedBorderTheme = {
|
|
16605
16624
|
theme: borderColorClasses$1,
|
|
16606
16625
|
danger: errorClasses$1,
|
|
16607
|
-
warning: 'tw
|
|
16608
|
-
gray: 'tw
|
|
16609
|
-
formulaError: 'tw
|
|
16626
|
+
warning: 'tw:border-none',
|
|
16627
|
+
gray: 'tw:border-sq-darkish-gray',
|
|
16628
|
+
formulaError: 'tw:border-red-100',
|
|
16610
16629
|
};
|
|
16611
16630
|
const appliedClasses = `${baseClasses$2} ${appliedTheme[variant]} ${extraClassNames} ${appliedBorderTheme[variant]}`;
|
|
16612
16631
|
if (!show) {
|
|
16613
16632
|
return jsxRuntime.jsx("div", {});
|
|
16614
16633
|
}
|
|
16615
|
-
return (jsxRuntime.jsxs("div", { "data-testid": testId, id: id, className: appliedClasses, children: [children, dismissible && (jsxRuntime.jsx(Icon, { icon: "fc-delete", type: variant.match(/danger|warning|formulaError/) ? 'color' : 'theme', color: variant.match(/danger|warning|formulaError/) ? 'inherit' : undefined, extraClassNames: `tw
|
|
16634
|
+
return (jsxRuntime.jsxs("div", { "data-testid": testId, id: id, className: appliedClasses, children: [children, dismissible && (jsxRuntime.jsx(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 }))] }));
|
|
16616
16635
|
};
|
|
16617
16636
|
|
|
16618
16637
|
/**
|
|
@@ -16631,47 +16650,40 @@ const Alert = ({ children, dismissible = true, onClose, show = true, variant, te
|
|
|
16631
16650
|
* @param tooltipProps - props to pass to the tooltip
|
|
16632
16651
|
*/
|
|
16633
16652
|
const SvgIcon = ({ onClick, icon, color, type = 'default', extraClassNames, viewBox = '0 0 19 19', id, testId, customId, ...tooltipProps }) => {
|
|
16634
|
-
const appliedClassNames = `${onClick ? 'tw
|
|
16635
|
-
tw
|
|
16653
|
+
const appliedClassNames = `${onClick ? 'tw:cursor-pointer' : ''} ${extraClassNames} tw:focus:outline-none tw:focus-visible:outline-none
|
|
16654
|
+
tw:outline-none`;
|
|
16636
16655
|
const tooltipData = getQTipData(tooltipProps);
|
|
16637
16656
|
const appliedType = type === 'default' ? 'currentColor' : 'rgb(var(--sq-icon))';
|
|
16638
|
-
return (jsxRuntime.jsx("div", { onClick: onClick, ...tooltipData, className: `svgContainer ${appliedClassNames}`, children: jsxRuntime.jsx("svg", { xmlns: "http://www.w3.org/2000/svg", className: `tw
|
|
16657
|
+
return (jsxRuntime.jsx("div", { onClick: onClick, ...tooltipData, className: `svgContainer ${appliedClassNames}`, children: jsxRuntime.jsx("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: jsxRuntime.jsx("path", { d: getSvgIconPath(icon) }) }) }));
|
|
16639
16658
|
};
|
|
16640
16659
|
|
|
16641
16660
|
const SeeqActionDropdownItem = (item) => {
|
|
16642
16661
|
let renderIcon = jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
16643
16662
|
if (item.icon) {
|
|
16644
|
-
renderIcon = isSvgIcon(item.icon) ? (jsxRuntime.jsx(SvgIcon, { icon: item.icon, extraClassNames: 'tw-
|
|
16645
|
-
' dark:tw-text-sq-white tw-text-[22px] tw-text-sq-white ' +
|
|
16646
|
-
item.iconExtraClassNames, ...item })) : (jsxRuntime.jsx(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 ' +
|
|
16647
|
-
item.iconExtraClassNames }));
|
|
16663
|
+
renderIcon = isSvgIcon(item.icon) ? (jsxRuntime.jsx(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 })) : (jsxRuntime.jsx(Icon, { icon: item.icon, type: "text", extraClassNames: 'tw:dark:text-sq-white tw:!text-5.5 tw:text-sq-white ' + item.iconExtraClassNames }));
|
|
16648
16664
|
}
|
|
16649
|
-
return (jsxRuntime.jsxs("div", { className: "tw
|
|
16665
|
+
return (jsxRuntime.jsxs("div", { className: "tw:flex-col tw:flex tw:p-2.5 tw:pl-5 tw:w-150", children: [jsxRuntime.jsxs("div", { className: "tw:flex tw:flex-row tw:gap-2 tw:items-end", children: [jsxRuntime.jsx("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 }), jsxRuntime.jsx("h4", { className: "tw:text-base tw:font-[600] tw:leading-5 mb-0", children: item.display })] }), jsxRuntime.jsx("div", { className: "tw:text-sq-13 tw:font-normal", children: item.text })] }));
|
|
16650
16666
|
};
|
|
16651
16667
|
const ViewWorkbench = (item) => {
|
|
16652
16668
|
let renderIcon = jsxRuntime.jsx(jsxRuntime.Fragment, {});
|
|
16653
16669
|
if (item.icon) {
|
|
16654
|
-
renderIcon = isSvgIcon(item.icon) ? (jsxRuntime.jsx(SvgIcon, { icon: item.icon, extraClassNames: 'tw-
|
|
16655
|
-
' tw-text-sq-text-color ' +
|
|
16656
|
-
item.iconExtraClassNames, type: "default", ...item })) : (jsxRuntime.jsx(Icon, { icon: item.icon, type: "text", extraClassNames: 'tw-flex tw-justify-center tw-items-center tw-text-[1.25rem] dark:tw-text-sq-white' +
|
|
16657
|
-
' tw-text-sq-text-color ' +
|
|
16658
|
-
item.iconExtraClassNames }));
|
|
16670
|
+
renderIcon = isSvgIcon(item.icon) ? (jsxRuntime.jsx(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 })) : (jsxRuntime.jsx(Icon, { icon: item.icon, type: "text", extraClassNames: 'tw:text-5 tw:dark:text-sq-white tw:text-sq-text-color ' + item.iconExtraClassNames }));
|
|
16659
16671
|
}
|
|
16660
|
-
return (jsxRuntime.jsx("div", { className: "tw
|
|
16672
|
+
return (jsxRuntime.jsx("div", { className: "tw:flex-col tw:flex tw:p-2.5", children: jsxRuntime.jsxs("div", { className: "tw:flex tw:flex-row tw:gap-2 tw:items-end", children: [jsxRuntime.jsx("div", { className: "tw:rounded-[0.1875rem] tw:h-5 tw:w-5 tw:flex tw:justify-center tw:items-center ", children: renderIcon }), jsxRuntime.jsx("div", { className: "tw:text-sq-13", children: item.display })] }) }));
|
|
16661
16673
|
};
|
|
16662
16674
|
const InsertSeeqContent = (item) => {
|
|
16663
|
-
return (jsxRuntime.jsxs("div", { className: "tw
|
|
16675
|
+
return (jsxRuntime.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: [jsxRuntime.jsx("h5", { className: "tw:text-4 tw:font-medium tw:text-sq-theme-dark tw:leading-4.5", children: item.display }), jsxRuntime.jsx("div", { className: "tw:text-sq-13 tw:text-sq-text-color tw:dark:text-sq-dark-text tw:!mt-1", children: item.text })] }));
|
|
16664
16676
|
};
|
|
16665
16677
|
|
|
16666
16678
|
const borderStyles = [
|
|
16667
|
-
'tw
|
|
16668
|
-
'tw
|
|
16669
|
-
'tw
|
|
16670
|
-
'tw
|
|
16671
|
-
'dark:
|
|
16679
|
+
'tw:border-solid',
|
|
16680
|
+
'tw:border',
|
|
16681
|
+
'tw:rounded-md',
|
|
16682
|
+
'tw:border-sq-disabled-gray',
|
|
16683
|
+
'tw:dark:border-gray-500',
|
|
16672
16684
|
].join(' ');
|
|
16673
|
-
const bgStyles = ['tw
|
|
16674
|
-
const disabledClasses = ['tw
|
|
16685
|
+
const bgStyles = ['tw:bg-sq-white', 'tw:dark:bg-sq-dark-background'].join(' ');
|
|
16686
|
+
const disabledClasses = ['tw:opacity-50', 'tw:cursor-not-allowed'].join(' ');
|
|
16675
16687
|
const renderItem = (variant, item) => {
|
|
16676
16688
|
switch (variant) {
|
|
16677
16689
|
case 'create-workbench':
|
|
@@ -16686,31 +16698,31 @@ const renderItem = (variant, item) => {
|
|
|
16686
16698
|
};
|
|
16687
16699
|
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 }) => {
|
|
16688
16700
|
const tooltipData = getQTipData(tooltipProps);
|
|
16689
|
-
return (jsxRuntime.jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [jsxRuntime.jsx(Trigger, { id: id, "data-testid": id, className: `tw
|
|
16690
|
-
' tw
|
|
16691
|
-
' data-[state=open]:
|
|
16692
|
-
' forceFont data-[side=top]:
|
|
16693
|
-
borderStyles, children: [hasArrow && (jsxRuntime.jsx(Arrow2, { asChild: true, children: jsxRuntime.jsx("div", { className: " tw
|
|
16701
|
+
return (jsxRuntime.jsxs(Root2, { defaultOpen: false, open: isOpen, onOpenChange: onOpenChange, modal: keepFocusInsideDropdown, children: [jsxRuntime.jsx(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: jsxRuntime.jsx("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 }) }), jsxRuntime.jsx(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: jsxRuntime.jsxs("div", { "data-testid": containerTestId, className: bgStyles +
|
|
16702
|
+
' tw:relative tw:z-[1200] tw:min-w-6 tw:py-2 tw:focus-visible:outline-none tw:outline-none' +
|
|
16703
|
+
' tw:data-[state=open]:animate-in tw:data-[state=closed]:animate-out' +
|
|
16704
|
+
' 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 ' +
|
|
16705
|
+
borderStyles, children: [hasArrow && (jsxRuntime.jsx(Arrow2, { asChild: true, children: jsxRuntime.jsx("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) => {
|
|
16694
16706
|
return (jsxRuntime.jsxs("div", { children: [jsxRuntime.jsx(Item2, { onSelect: (e) => {
|
|
16695
16707
|
item.action(e);
|
|
16696
|
-
}, className: `tw
|
|
16708
|
+
}, 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 && (jsxRuntime.jsx(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));
|
|
16697
16709
|
})] }) })] }));
|
|
16698
16710
|
};
|
|
16699
16711
|
|
|
16700
|
-
const baseClasses$1 = 'tw
|
|
16701
|
-
const errorClasses = 'tw
|
|
16712
|
+
const baseClasses$1 = 'tw:flex tw:outline-none tw:rounded-md tw:w-full tw:relative tw:flex-wrap';
|
|
16713
|
+
const errorClasses = 'tw:border-sq-danger';
|
|
16702
16714
|
const borderColorClasses = [
|
|
16703
|
-
'tw
|
|
16704
|
-
'dark:
|
|
16705
|
-
'dark:focus:
|
|
16706
|
-
'dark:active:
|
|
16707
|
-
'focus:
|
|
16708
|
-
'active:
|
|
16715
|
+
'tw:border-sq-disabled-gray',
|
|
16716
|
+
'tw:dark:border-sq-dark-disabled-gray',
|
|
16717
|
+
'tw:dark:focus:border-sq-theme-darker',
|
|
16718
|
+
'tw:dark:active:border-sq-theme-darker',
|
|
16719
|
+
'tw:focus:border-sq-theme-dark',
|
|
16720
|
+
'tw:active:border-sq-theme-dark',
|
|
16709
16721
|
].join(' ');
|
|
16710
|
-
const fieldBorderRadius = 'tw
|
|
16711
|
-
const fieldClasses = 'tw
|
|
16712
|
-
const darkTheme = 'dark:
|
|
16713
|
-
const lightTheme = 'tw
|
|
16722
|
+
const fieldBorderRadius = 'tw:rounded-l-md tw:rounded-r-none';
|
|
16723
|
+
const fieldClasses = 'tw:leading-normal tw:outline-none tw:py-1 tw:px-3' + 'tw:p-1 tw:border-solid tw:border';
|
|
16724
|
+
const darkTheme = 'tw:dark:bg-sq-dark-background tw:dark:text-sq-dark-text tw:disabled:dark:text-sq-disabled-gray';
|
|
16725
|
+
const lightTheme = 'tw:text-sq-text-color tw:disabled:text-sq-darkish-gray';
|
|
16714
16726
|
/**
|
|
16715
16727
|
* InputGroup.
|
|
16716
16728
|
*/
|
|
@@ -16720,8 +16732,10 @@ const InputGroup = React.forwardRef((props, ref) => {
|
|
|
16720
16732
|
const appliedClasses = `${baseClasses$1} ${extraClassNames}`;
|
|
16721
16733
|
const fieldAppliedClasses = `${fieldClasses} ${extraClassNames} ${lightTheme} ${darkTheme} ${fieldBorderRadius} ${showError ? errorClasses : borderColorClasses} `;
|
|
16722
16734
|
const elementsToAppend = append.filter(Boolean);
|
|
16723
|
-
return (jsxRuntime.jsxs("div", { id: `input-group-${id}`, className: appliedClasses, children: [field ? (jsxRuntime.jsx("div", { "data-testid": testId, className: `tw
|
|
16724
|
-
return item?.variant === 'button' ? (jsxRuntime.jsx(Button, { extraClassNames: `$
|
|
16735
|
+
return (jsxRuntime.jsxs("div", { id: `input-group-${id}`, className: appliedClasses, children: [field ? (jsxRuntime.jsx("div", { "data-testid": testId, className: `tw:flex tw:flex-1 tw:cursor-pointer tw:active:z-50 ${fieldAppliedClasses}`, children: field })) : (jsxRuntime.jsx(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) => {
|
|
16736
|
+
return item?.variant === 'button' ? (jsxRuntime.jsx(Button, { extraClassNames: `$
|
|
16737
|
+
index ? 'tw:-ml-px' : 'tw:ml-0'
|
|
16738
|
+
} tw:focus:z-40 tw:focus:border tw:rounded-none tw:last:rounded-r-md`, ...item.buttonProps }, index)) : (jsxRuntime.jsx("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));
|
|
16725
16739
|
})] }));
|
|
16726
16740
|
});
|
|
16727
16741
|
|
|
@@ -27595,7 +27609,7 @@ var Thumb = SliderThumb;
|
|
|
27595
27609
|
*/
|
|
27596
27610
|
const Slider = (props) => {
|
|
27597
27611
|
const { onValueChange, onPointerUp, id, value, name, disabled = false, rootExtraClassNames = '', trackExtraClassNames = '', rangeExtraClassNames = '', thumbExtraClassNames = '', step, min, max, } = props;
|
|
27598
|
-
return (jsxRuntime.jsxs(Root$1, { className: `tw
|
|
27612
|
+
return (jsxRuntime.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: [jsxRuntime.jsx(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: jsxRuntime.jsx(Range, { className: `tw:absolute tw:h-full tw:rounded-full ${rangeExtraClassNames}` }) }), jsxRuntime.jsx(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 })] }));
|
|
27599
27613
|
};
|
|
27600
27614
|
|
|
27601
27615
|
var PROGRESS_NAME = "Progress";
|
|
@@ -27685,1186 +27699,1206 @@ Defaulting to \`null\`.`;
|
|
|
27685
27699
|
var Root = Progress;
|
|
27686
27700
|
var Indicator = ProgressIndicator$1;
|
|
27687
27701
|
|
|
27688
|
-
|
|
27689
|
-
function _typeof(obj) {
|
|
27690
|
-
"@babel/helpers - typeof";
|
|
27702
|
+
var tinycolor$1 = {exports: {}};
|
|
27691
27703
|
|
|
27692
|
-
|
|
27693
|
-
|
|
27694
|
-
|
|
27695
|
-
|
|
27696
|
-
}, _typeof(obj);
|
|
27697
|
-
}
|
|
27698
|
-
|
|
27699
|
-
// https://github.com/bgrins/TinyColor
|
|
27700
|
-
// Brian Grinstead, MIT License
|
|
27701
|
-
|
|
27702
|
-
var trimLeft = /^\s+/;
|
|
27703
|
-
var trimRight = /\s+$/;
|
|
27704
|
-
function tinycolor(color, opts) {
|
|
27705
|
-
color = color ? color : "";
|
|
27706
|
-
opts = opts || {};
|
|
27707
|
-
|
|
27708
|
-
// If input is already a tinycolor, return itself
|
|
27709
|
-
if (color instanceof tinycolor) {
|
|
27710
|
-
return color;
|
|
27711
|
-
}
|
|
27712
|
-
// If we are called as a function, call using new instead
|
|
27713
|
-
if (!(this instanceof tinycolor)) {
|
|
27714
|
-
return new tinycolor(color, opts);
|
|
27715
|
-
}
|
|
27716
|
-
var rgb = inputToRGB(color);
|
|
27717
|
-
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;
|
|
27718
|
-
this._gradientType = opts.gradientType;
|
|
27719
|
-
|
|
27720
|
-
// Don't let the range of [0,255] come back in [0,1].
|
|
27721
|
-
// Potentially lose a little bit of precision here, but will fix issues where
|
|
27722
|
-
// .5 gets interpreted as half of the total, instead of half of 1
|
|
27723
|
-
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
|
27724
|
-
if (this._r < 1) this._r = Math.round(this._r);
|
|
27725
|
-
if (this._g < 1) this._g = Math.round(this._g);
|
|
27726
|
-
if (this._b < 1) this._b = Math.round(this._b);
|
|
27727
|
-
this._ok = rgb.ok;
|
|
27728
|
-
}
|
|
27729
|
-
tinycolor.prototype = {
|
|
27730
|
-
isDark: function isDark() {
|
|
27731
|
-
return this.getBrightness() < 128;
|
|
27732
|
-
},
|
|
27733
|
-
isLight: function isLight() {
|
|
27734
|
-
return !this.isDark();
|
|
27735
|
-
},
|
|
27736
|
-
isValid: function isValid() {
|
|
27737
|
-
return this._ok;
|
|
27738
|
-
},
|
|
27739
|
-
getOriginalInput: function getOriginalInput() {
|
|
27740
|
-
return this._originalInput;
|
|
27741
|
-
},
|
|
27742
|
-
getFormat: function getFormat() {
|
|
27743
|
-
return this._format;
|
|
27744
|
-
},
|
|
27745
|
-
getAlpha: function getAlpha() {
|
|
27746
|
-
return this._a;
|
|
27747
|
-
},
|
|
27748
|
-
getBrightness: function getBrightness() {
|
|
27749
|
-
//http://www.w3.org/TR/AERT#color-contrast
|
|
27750
|
-
var rgb = this.toRgb();
|
|
27751
|
-
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
27752
|
-
},
|
|
27753
|
-
getLuminance: function getLuminance() {
|
|
27754
|
-
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
27755
|
-
var rgb = this.toRgb();
|
|
27756
|
-
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
27757
|
-
RsRGB = rgb.r / 255;
|
|
27758
|
-
GsRGB = rgb.g / 255;
|
|
27759
|
-
BsRGB = rgb.b / 255;
|
|
27760
|
-
if (RsRGB <= 0.03928) R = RsRGB / 12.92;else R = Math.pow((RsRGB + 0.055) / 1.055, 2.4);
|
|
27761
|
-
if (GsRGB <= 0.03928) G = GsRGB / 12.92;else G = Math.pow((GsRGB + 0.055) / 1.055, 2.4);
|
|
27762
|
-
if (BsRGB <= 0.03928) B = BsRGB / 12.92;else B = Math.pow((BsRGB + 0.055) / 1.055, 2.4);
|
|
27763
|
-
return 0.2126 * R + 0.7152 * G + 0.0722 * B;
|
|
27764
|
-
},
|
|
27765
|
-
setAlpha: function setAlpha(value) {
|
|
27766
|
-
this._a = boundAlpha(value);
|
|
27767
|
-
this._roundA = Math.round(100 * this._a) / 100;
|
|
27768
|
-
return this;
|
|
27769
|
-
},
|
|
27770
|
-
toHsv: function toHsv() {
|
|
27771
|
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
27772
|
-
return {
|
|
27773
|
-
h: hsv.h * 360,
|
|
27774
|
-
s: hsv.s,
|
|
27775
|
-
v: hsv.v,
|
|
27776
|
-
a: this._a
|
|
27777
|
-
};
|
|
27778
|
-
},
|
|
27779
|
-
toHsvString: function toHsvString() {
|
|
27780
|
-
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
27781
|
-
var h = Math.round(hsv.h * 360),
|
|
27782
|
-
s = Math.round(hsv.s * 100),
|
|
27783
|
-
v = Math.round(hsv.v * 100);
|
|
27784
|
-
return this._a == 1 ? "hsv(" + h + ", " + s + "%, " + v + "%)" : "hsva(" + h + ", " + s + "%, " + v + "%, " + this._roundA + ")";
|
|
27785
|
-
},
|
|
27786
|
-
toHsl: function toHsl() {
|
|
27787
|
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
27788
|
-
return {
|
|
27789
|
-
h: hsl.h * 360,
|
|
27790
|
-
s: hsl.s,
|
|
27791
|
-
l: hsl.l,
|
|
27792
|
-
a: this._a
|
|
27793
|
-
};
|
|
27794
|
-
},
|
|
27795
|
-
toHslString: function toHslString() {
|
|
27796
|
-
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
27797
|
-
var h = Math.round(hsl.h * 360),
|
|
27798
|
-
s = Math.round(hsl.s * 100),
|
|
27799
|
-
l = Math.round(hsl.l * 100);
|
|
27800
|
-
return this._a == 1 ? "hsl(" + h + ", " + s + "%, " + l + "%)" : "hsla(" + h + ", " + s + "%, " + l + "%, " + this._roundA + ")";
|
|
27801
|
-
},
|
|
27802
|
-
toHex: function toHex(allow3Char) {
|
|
27803
|
-
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
27804
|
-
},
|
|
27805
|
-
toHexString: function toHexString(allow3Char) {
|
|
27806
|
-
return "#" + this.toHex(allow3Char);
|
|
27807
|
-
},
|
|
27808
|
-
toHex8: function toHex8(allow4Char) {
|
|
27809
|
-
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
27810
|
-
},
|
|
27811
|
-
toHex8String: function toHex8String(allow4Char) {
|
|
27812
|
-
return "#" + this.toHex8(allow4Char);
|
|
27813
|
-
},
|
|
27814
|
-
toRgb: function toRgb() {
|
|
27815
|
-
return {
|
|
27816
|
-
r: Math.round(this._r),
|
|
27817
|
-
g: Math.round(this._g),
|
|
27818
|
-
b: Math.round(this._b),
|
|
27819
|
-
a: this._a
|
|
27820
|
-
};
|
|
27821
|
-
},
|
|
27822
|
-
toRgbString: function toRgbString() {
|
|
27823
|
-
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 + ")";
|
|
27824
|
-
},
|
|
27825
|
-
toPercentageRgb: function toPercentageRgb() {
|
|
27826
|
-
return {
|
|
27827
|
-
r: Math.round(bound01(this._r, 255) * 100) + "%",
|
|
27828
|
-
g: Math.round(bound01(this._g, 255) * 100) + "%",
|
|
27829
|
-
b: Math.round(bound01(this._b, 255) * 100) + "%",
|
|
27830
|
-
a: this._a
|
|
27831
|
-
};
|
|
27832
|
-
},
|
|
27833
|
-
toPercentageRgbString: function toPercentageRgbString() {
|
|
27834
|
-
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 + ")";
|
|
27835
|
-
},
|
|
27836
|
-
toName: function toName() {
|
|
27837
|
-
if (this._a === 0) {
|
|
27838
|
-
return "transparent";
|
|
27839
|
-
}
|
|
27840
|
-
if (this._a < 1) {
|
|
27841
|
-
return false;
|
|
27842
|
-
}
|
|
27843
|
-
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
27844
|
-
},
|
|
27845
|
-
toFilter: function toFilter(secondColor) {
|
|
27846
|
-
var hex8String = "#" + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
27847
|
-
var secondHex8String = hex8String;
|
|
27848
|
-
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
27849
|
-
if (secondColor) {
|
|
27850
|
-
var s = tinycolor(secondColor);
|
|
27851
|
-
secondHex8String = "#" + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
27852
|
-
}
|
|
27853
|
-
return "progid:DXImageTransform.Microsoft.gradient(" + gradientType + "startColorstr=" + hex8String + ",endColorstr=" + secondHex8String + ")";
|
|
27854
|
-
},
|
|
27855
|
-
toString: function toString(format) {
|
|
27856
|
-
var formatSet = !!format;
|
|
27857
|
-
format = format || this._format;
|
|
27858
|
-
var formattedString = false;
|
|
27859
|
-
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
27860
|
-
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
27861
|
-
if (needsAlphaFormat) {
|
|
27862
|
-
// Special case for "transparent", all other non-alpha formats
|
|
27863
|
-
// will return rgba when there is transparency.
|
|
27864
|
-
if (format === "name" && this._a === 0) {
|
|
27865
|
-
return this.toName();
|
|
27866
|
-
}
|
|
27867
|
-
return this.toRgbString();
|
|
27868
|
-
}
|
|
27869
|
-
if (format === "rgb") {
|
|
27870
|
-
formattedString = this.toRgbString();
|
|
27871
|
-
}
|
|
27872
|
-
if (format === "prgb") {
|
|
27873
|
-
formattedString = this.toPercentageRgbString();
|
|
27874
|
-
}
|
|
27875
|
-
if (format === "hex" || format === "hex6") {
|
|
27876
|
-
formattedString = this.toHexString();
|
|
27877
|
-
}
|
|
27878
|
-
if (format === "hex3") {
|
|
27879
|
-
formattedString = this.toHexString(true);
|
|
27880
|
-
}
|
|
27881
|
-
if (format === "hex4") {
|
|
27882
|
-
formattedString = this.toHex8String(true);
|
|
27883
|
-
}
|
|
27884
|
-
if (format === "hex8") {
|
|
27885
|
-
formattedString = this.toHex8String();
|
|
27886
|
-
}
|
|
27887
|
-
if (format === "name") {
|
|
27888
|
-
formattedString = this.toName();
|
|
27889
|
-
}
|
|
27890
|
-
if (format === "hsl") {
|
|
27891
|
-
formattedString = this.toHslString();
|
|
27892
|
-
}
|
|
27893
|
-
if (format === "hsv") {
|
|
27894
|
-
formattedString = this.toHsvString();
|
|
27895
|
-
}
|
|
27896
|
-
return formattedString || this.toHexString();
|
|
27897
|
-
},
|
|
27898
|
-
clone: function clone() {
|
|
27899
|
-
return tinycolor(this.toString());
|
|
27900
|
-
},
|
|
27901
|
-
_applyModification: function _applyModification(fn, args) {
|
|
27902
|
-
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
27903
|
-
this._r = color._r;
|
|
27904
|
-
this._g = color._g;
|
|
27905
|
-
this._b = color._b;
|
|
27906
|
-
this.setAlpha(color._a);
|
|
27907
|
-
return this;
|
|
27908
|
-
},
|
|
27909
|
-
lighten: function lighten() {
|
|
27910
|
-
return this._applyModification(_lighten, arguments);
|
|
27911
|
-
},
|
|
27912
|
-
brighten: function brighten() {
|
|
27913
|
-
return this._applyModification(_brighten, arguments);
|
|
27914
|
-
},
|
|
27915
|
-
darken: function darken() {
|
|
27916
|
-
return this._applyModification(_darken, arguments);
|
|
27917
|
-
},
|
|
27918
|
-
desaturate: function desaturate() {
|
|
27919
|
-
return this._applyModification(_desaturate, arguments);
|
|
27920
|
-
},
|
|
27921
|
-
saturate: function saturate() {
|
|
27922
|
-
return this._applyModification(_saturate, arguments);
|
|
27923
|
-
},
|
|
27924
|
-
greyscale: function greyscale() {
|
|
27925
|
-
return this._applyModification(_greyscale, arguments);
|
|
27926
|
-
},
|
|
27927
|
-
spin: function spin() {
|
|
27928
|
-
return this._applyModification(_spin, arguments);
|
|
27929
|
-
},
|
|
27930
|
-
_applyCombination: function _applyCombination(fn, args) {
|
|
27931
|
-
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
27932
|
-
},
|
|
27933
|
-
analogous: function analogous() {
|
|
27934
|
-
return this._applyCombination(_analogous, arguments);
|
|
27935
|
-
},
|
|
27936
|
-
complement: function complement() {
|
|
27937
|
-
return this._applyCombination(_complement, arguments);
|
|
27938
|
-
},
|
|
27939
|
-
monochromatic: function monochromatic() {
|
|
27940
|
-
return this._applyCombination(_monochromatic, arguments);
|
|
27941
|
-
},
|
|
27942
|
-
splitcomplement: function splitcomplement() {
|
|
27943
|
-
return this._applyCombination(_splitcomplement, arguments);
|
|
27944
|
-
},
|
|
27945
|
-
// Disabled until https://github.com/bgrins/TinyColor/issues/254
|
|
27946
|
-
// polyad: function (number) {
|
|
27947
|
-
// return this._applyCombination(polyad, [number]);
|
|
27948
|
-
// },
|
|
27949
|
-
triad: function triad() {
|
|
27950
|
-
return this._applyCombination(polyad, [3]);
|
|
27951
|
-
},
|
|
27952
|
-
tetrad: function tetrad() {
|
|
27953
|
-
return this._applyCombination(polyad, [4]);
|
|
27954
|
-
}
|
|
27955
|
-
};
|
|
27704
|
+
(function (module) {
|
|
27705
|
+
// TinyColor v1.4.1
|
|
27706
|
+
// https://github.com/bgrins/TinyColor
|
|
27707
|
+
// Brian Grinstead, MIT License
|
|
27956
27708
|
|
|
27957
|
-
|
|
27958
|
-
// String input requires "1.0" as input, so 1 will be treated as 1
|
|
27959
|
-
tinycolor.fromRatio = function (color, opts) {
|
|
27960
|
-
if (_typeof(color) == "object") {
|
|
27961
|
-
var newColor = {};
|
|
27962
|
-
for (var i in color) {
|
|
27963
|
-
if (color.hasOwnProperty(i)) {
|
|
27964
|
-
if (i === "a") {
|
|
27965
|
-
newColor[i] = color[i];
|
|
27966
|
-
} else {
|
|
27967
|
-
newColor[i] = convertToPercentage(color[i]);
|
|
27968
|
-
}
|
|
27969
|
-
}
|
|
27970
|
-
}
|
|
27971
|
-
color = newColor;
|
|
27972
|
-
}
|
|
27973
|
-
return tinycolor(color, opts);
|
|
27974
|
-
};
|
|
27975
|
-
|
|
27976
|
-
// Given a string or object, convert that input to RGB
|
|
27977
|
-
// Possible string inputs:
|
|
27978
|
-
//
|
|
27979
|
-
// "red"
|
|
27980
|
-
// "#f00" or "f00"
|
|
27981
|
-
// "#ff0000" or "ff0000"
|
|
27982
|
-
// "#ff000000" or "ff000000"
|
|
27983
|
-
// "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
27984
|
-
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
27985
|
-
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
27986
|
-
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
27987
|
-
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
27988
|
-
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
27989
|
-
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
27990
|
-
//
|
|
27991
|
-
function inputToRGB(color) {
|
|
27992
|
-
var rgb = {
|
|
27993
|
-
r: 0,
|
|
27994
|
-
g: 0,
|
|
27995
|
-
b: 0
|
|
27996
|
-
};
|
|
27997
|
-
var a = 1;
|
|
27998
|
-
var s = null;
|
|
27999
|
-
var v = null;
|
|
28000
|
-
var l = null;
|
|
28001
|
-
var ok = false;
|
|
28002
|
-
var format = false;
|
|
28003
|
-
if (typeof color == "string") {
|
|
28004
|
-
color = stringInputToObject(color);
|
|
28005
|
-
}
|
|
28006
|
-
if (_typeof(color) == "object") {
|
|
28007
|
-
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
28008
|
-
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
28009
|
-
ok = true;
|
|
28010
|
-
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
28011
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
28012
|
-
s = convertToPercentage(color.s);
|
|
28013
|
-
v = convertToPercentage(color.v);
|
|
28014
|
-
rgb = hsvToRgb(color.h, s, v);
|
|
28015
|
-
ok = true;
|
|
28016
|
-
format = "hsv";
|
|
28017
|
-
} else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
28018
|
-
s = convertToPercentage(color.s);
|
|
28019
|
-
l = convertToPercentage(color.l);
|
|
28020
|
-
rgb = hslToRgb(color.h, s, l);
|
|
28021
|
-
ok = true;
|
|
28022
|
-
format = "hsl";
|
|
28023
|
-
}
|
|
28024
|
-
if (color.hasOwnProperty("a")) {
|
|
28025
|
-
a = color.a;
|
|
28026
|
-
}
|
|
28027
|
-
}
|
|
28028
|
-
a = boundAlpha(a);
|
|
28029
|
-
return {
|
|
28030
|
-
ok: ok,
|
|
28031
|
-
format: color.format || format,
|
|
28032
|
-
r: Math.min(255, Math.max(rgb.r, 0)),
|
|
28033
|
-
g: Math.min(255, Math.max(rgb.g, 0)),
|
|
28034
|
-
b: Math.min(255, Math.max(rgb.b, 0)),
|
|
28035
|
-
a: a
|
|
28036
|
-
};
|
|
28037
|
-
}
|
|
27709
|
+
(function(Math) {
|
|
28038
27710
|
|
|
28039
|
-
|
|
28040
|
-
|
|
27711
|
+
var trimLeft = /^\s+/,
|
|
27712
|
+
trimRight = /\s+$/,
|
|
27713
|
+
tinyCounter = 0,
|
|
27714
|
+
mathRound = Math.round,
|
|
27715
|
+
mathMin = Math.min,
|
|
27716
|
+
mathMax = Math.max,
|
|
27717
|
+
mathRandom = Math.random;
|
|
28041
27718
|
|
|
28042
|
-
|
|
28043
|
-
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
27719
|
+
function tinycolor (color, opts) {
|
|
28044
27720
|
|
|
28045
|
-
|
|
28046
|
-
|
|
28047
|
-
// <http://www.w3.org/TR/css3-color/>
|
|
28048
|
-
// *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
28049
|
-
// *Returns:* { r, g, b } in [0, 255]
|
|
28050
|
-
function rgbToRgb(r, g, b) {
|
|
28051
|
-
return {
|
|
28052
|
-
r: bound01(r, 255) * 255,
|
|
28053
|
-
g: bound01(g, 255) * 255,
|
|
28054
|
-
b: bound01(b, 255) * 255
|
|
28055
|
-
};
|
|
28056
|
-
}
|
|
27721
|
+
color = (color) ? color : '';
|
|
27722
|
+
opts = opts || { };
|
|
28057
27723
|
|
|
28058
|
-
//
|
|
28059
|
-
|
|
28060
|
-
|
|
28061
|
-
|
|
28062
|
-
|
|
28063
|
-
|
|
28064
|
-
|
|
28065
|
-
|
|
28066
|
-
var max = Math.max(r, g, b),
|
|
28067
|
-
min = Math.min(r, g, b);
|
|
28068
|
-
var h,
|
|
28069
|
-
s,
|
|
28070
|
-
l = (max + min) / 2;
|
|
28071
|
-
if (max == min) {
|
|
28072
|
-
h = s = 0; // achromatic
|
|
28073
|
-
} else {
|
|
28074
|
-
var d = max - min;
|
|
28075
|
-
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
28076
|
-
switch (max) {
|
|
28077
|
-
case r:
|
|
28078
|
-
h = (g - b) / d + (g < b ? 6 : 0);
|
|
28079
|
-
break;
|
|
28080
|
-
case g:
|
|
28081
|
-
h = (b - r) / d + 2;
|
|
28082
|
-
break;
|
|
28083
|
-
case b:
|
|
28084
|
-
h = (r - g) / d + 4;
|
|
28085
|
-
break;
|
|
28086
|
-
}
|
|
28087
|
-
h /= 6;
|
|
28088
|
-
}
|
|
28089
|
-
return {
|
|
28090
|
-
h: h,
|
|
28091
|
-
s: s,
|
|
28092
|
-
l: l
|
|
28093
|
-
};
|
|
28094
|
-
}
|
|
27724
|
+
// If input is already a tinycolor, return itself
|
|
27725
|
+
if (color instanceof tinycolor) {
|
|
27726
|
+
return color;
|
|
27727
|
+
}
|
|
27728
|
+
// If we are called as a function, call using new instead
|
|
27729
|
+
if (!(this instanceof tinycolor)) {
|
|
27730
|
+
return new tinycolor(color, opts);
|
|
27731
|
+
}
|
|
28095
27732
|
|
|
28096
|
-
|
|
28097
|
-
|
|
28098
|
-
|
|
28099
|
-
|
|
28100
|
-
|
|
28101
|
-
|
|
28102
|
-
|
|
28103
|
-
|
|
28104
|
-
|
|
28105
|
-
|
|
28106
|
-
|
|
28107
|
-
|
|
28108
|
-
|
|
28109
|
-
|
|
28110
|
-
|
|
28111
|
-
|
|
28112
|
-
|
|
28113
|
-
|
|
28114
|
-
|
|
28115
|
-
|
|
28116
|
-
|
|
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
|
-
}
|
|
28122
|
-
return {
|
|
28123
|
-
r: r * 255,
|
|
28124
|
-
g: g * 255,
|
|
28125
|
-
b: b * 255
|
|
28126
|
-
};
|
|
28127
|
-
}
|
|
27733
|
+
var rgb = inputToRGB(color);
|
|
27734
|
+
this._originalInput = color,
|
|
27735
|
+
this._r = rgb.r,
|
|
27736
|
+
this._g = rgb.g,
|
|
27737
|
+
this._b = rgb.b,
|
|
27738
|
+
this._a = rgb.a,
|
|
27739
|
+
this._roundA = mathRound(100*this._a) / 100,
|
|
27740
|
+
this._format = opts.format || rgb.format;
|
|
27741
|
+
this._gradientType = opts.gradientType;
|
|
27742
|
+
|
|
27743
|
+
// Don't let the range of [0,255] come back in [0,1].
|
|
27744
|
+
// Potentially lose a little bit of precision here, but will fix issues where
|
|
27745
|
+
// .5 gets interpreted as half of the total, instead of half of 1
|
|
27746
|
+
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
|
|
27747
|
+
if (this._r < 1) { this._r = mathRound(this._r); }
|
|
27748
|
+
if (this._g < 1) { this._g = mathRound(this._g); }
|
|
27749
|
+
if (this._b < 1) { this._b = mathRound(this._b); }
|
|
27750
|
+
|
|
27751
|
+
this._ok = rgb.ok;
|
|
27752
|
+
this._tc_id = tinyCounter++;
|
|
27753
|
+
}
|
|
28128
27754
|
|
|
28129
|
-
|
|
28130
|
-
|
|
28131
|
-
|
|
28132
|
-
|
|
28133
|
-
function
|
|
28134
|
-
|
|
28135
|
-
|
|
28136
|
-
|
|
28137
|
-
|
|
28138
|
-
|
|
28139
|
-
|
|
28140
|
-
|
|
28141
|
-
|
|
28142
|
-
|
|
28143
|
-
|
|
28144
|
-
|
|
28145
|
-
|
|
28146
|
-
|
|
28147
|
-
|
|
28148
|
-
|
|
28149
|
-
|
|
28150
|
-
|
|
28151
|
-
|
|
28152
|
-
|
|
28153
|
-
|
|
28154
|
-
|
|
28155
|
-
|
|
28156
|
-
|
|
28157
|
-
|
|
28158
|
-
|
|
28159
|
-
|
|
28160
|
-
|
|
28161
|
-
|
|
28162
|
-
|
|
28163
|
-
|
|
28164
|
-
|
|
28165
|
-
}
|
|
27755
|
+
tinycolor.prototype = {
|
|
27756
|
+
isDark: function() {
|
|
27757
|
+
return this.getBrightness() < 128;
|
|
27758
|
+
},
|
|
27759
|
+
isLight: function() {
|
|
27760
|
+
return !this.isDark();
|
|
27761
|
+
},
|
|
27762
|
+
isValid: function() {
|
|
27763
|
+
return this._ok;
|
|
27764
|
+
},
|
|
27765
|
+
getOriginalInput: function() {
|
|
27766
|
+
return this._originalInput;
|
|
27767
|
+
},
|
|
27768
|
+
getFormat: function() {
|
|
27769
|
+
return this._format;
|
|
27770
|
+
},
|
|
27771
|
+
getAlpha: function() {
|
|
27772
|
+
return this._a;
|
|
27773
|
+
},
|
|
27774
|
+
getBrightness: function() {
|
|
27775
|
+
//http://www.w3.org/TR/AERT#color-contrast
|
|
27776
|
+
var rgb = this.toRgb();
|
|
27777
|
+
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
|
|
27778
|
+
},
|
|
27779
|
+
getLuminance: function() {
|
|
27780
|
+
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
|
|
27781
|
+
var rgb = this.toRgb();
|
|
27782
|
+
var RsRGB, GsRGB, BsRGB, R, G, B;
|
|
27783
|
+
RsRGB = rgb.r/255;
|
|
27784
|
+
GsRGB = rgb.g/255;
|
|
27785
|
+
BsRGB = rgb.b/255;
|
|
27786
|
+
|
|
27787
|
+
if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}
|
|
27788
|
+
if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}
|
|
27789
|
+
if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}
|
|
27790
|
+
return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);
|
|
27791
|
+
},
|
|
27792
|
+
setAlpha: function(value) {
|
|
27793
|
+
this._a = boundAlpha(value);
|
|
27794
|
+
this._roundA = mathRound(100*this._a) / 100;
|
|
27795
|
+
return this;
|
|
27796
|
+
},
|
|
27797
|
+
toHsv: function() {
|
|
27798
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
27799
|
+
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
|
|
27800
|
+
},
|
|
27801
|
+
toHsvString: function() {
|
|
27802
|
+
var hsv = rgbToHsv(this._r, this._g, this._b);
|
|
27803
|
+
var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
|
|
27804
|
+
return (this._a == 1) ?
|
|
27805
|
+
"hsv(" + h + ", " + s + "%, " + v + "%)" :
|
|
27806
|
+
"hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
|
|
27807
|
+
},
|
|
27808
|
+
toHsl: function() {
|
|
27809
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
27810
|
+
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
|
|
27811
|
+
},
|
|
27812
|
+
toHslString: function() {
|
|
27813
|
+
var hsl = rgbToHsl(this._r, this._g, this._b);
|
|
27814
|
+
var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
|
|
27815
|
+
return (this._a == 1) ?
|
|
27816
|
+
"hsl(" + h + ", " + s + "%, " + l + "%)" :
|
|
27817
|
+
"hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
|
|
27818
|
+
},
|
|
27819
|
+
toHex: function(allow3Char) {
|
|
27820
|
+
return rgbToHex(this._r, this._g, this._b, allow3Char);
|
|
27821
|
+
},
|
|
27822
|
+
toHexString: function(allow3Char) {
|
|
27823
|
+
return '#' + this.toHex(allow3Char);
|
|
27824
|
+
},
|
|
27825
|
+
toHex8: function(allow4Char) {
|
|
27826
|
+
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
|
|
27827
|
+
},
|
|
27828
|
+
toHex8String: function(allow4Char) {
|
|
27829
|
+
return '#' + this.toHex8(allow4Char);
|
|
27830
|
+
},
|
|
27831
|
+
toRgb: function() {
|
|
27832
|
+
return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
|
|
27833
|
+
},
|
|
27834
|
+
toRgbString: function() {
|
|
27835
|
+
return (this._a == 1) ?
|
|
27836
|
+
"rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
|
|
27837
|
+
"rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
|
|
27838
|
+
},
|
|
27839
|
+
toPercentageRgb: function() {
|
|
27840
|
+
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 };
|
|
27841
|
+
},
|
|
27842
|
+
toPercentageRgbString: function() {
|
|
27843
|
+
return (this._a == 1) ?
|
|
27844
|
+
"rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
|
|
27845
|
+
"rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
|
|
27846
|
+
},
|
|
27847
|
+
toName: function() {
|
|
27848
|
+
if (this._a === 0) {
|
|
27849
|
+
return "transparent";
|
|
27850
|
+
}
|
|
28166
27851
|
|
|
28167
|
-
|
|
28168
|
-
|
|
28169
|
-
|
|
28170
|
-
// *Returns:* { r, g, b } in the set [0, 255]
|
|
28171
|
-
function hsvToRgb(h, s, v) {
|
|
28172
|
-
h = bound01(h, 360) * 6;
|
|
28173
|
-
s = bound01(s, 100);
|
|
28174
|
-
v = bound01(v, 100);
|
|
28175
|
-
var i = Math.floor(h),
|
|
28176
|
-
f = h - i,
|
|
28177
|
-
p = v * (1 - s),
|
|
28178
|
-
q = v * (1 - f * s),
|
|
28179
|
-
t = v * (1 - (1 - f) * s),
|
|
28180
|
-
mod = i % 6,
|
|
28181
|
-
r = [v, q, p, p, t, v][mod],
|
|
28182
|
-
g = [t, v, v, q, p, p][mod],
|
|
28183
|
-
b = [p, p, t, v, v, q][mod];
|
|
28184
|
-
return {
|
|
28185
|
-
r: r * 255,
|
|
28186
|
-
g: g * 255,
|
|
28187
|
-
b: b * 255
|
|
28188
|
-
};
|
|
28189
|
-
}
|
|
27852
|
+
if (this._a < 1) {
|
|
27853
|
+
return false;
|
|
27854
|
+
}
|
|
28190
27855
|
|
|
28191
|
-
|
|
28192
|
-
|
|
28193
|
-
|
|
28194
|
-
|
|
28195
|
-
|
|
28196
|
-
|
|
27856
|
+
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
|
|
27857
|
+
},
|
|
27858
|
+
toFilter: function(secondColor) {
|
|
27859
|
+
var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);
|
|
27860
|
+
var secondHex8String = hex8String;
|
|
27861
|
+
var gradientType = this._gradientType ? "GradientType = 1, " : "";
|
|
27862
|
+
|
|
27863
|
+
if (secondColor) {
|
|
27864
|
+
var s = tinycolor(secondColor);
|
|
27865
|
+
secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);
|
|
27866
|
+
}
|
|
28197
27867
|
|
|
28198
|
-
|
|
28199
|
-
|
|
28200
|
-
|
|
28201
|
-
|
|
28202
|
-
|
|
28203
|
-
|
|
27868
|
+
return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
|
|
27869
|
+
},
|
|
27870
|
+
toString: function(format) {
|
|
27871
|
+
var formatSet = !!format;
|
|
27872
|
+
format = format || this._format;
|
|
27873
|
+
|
|
27874
|
+
var formattedString = false;
|
|
27875
|
+
var hasAlpha = this._a < 1 && this._a >= 0;
|
|
27876
|
+
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
|
|
27877
|
+
|
|
27878
|
+
if (needsAlphaFormat) {
|
|
27879
|
+
// Special case for "transparent", all other non-alpha formats
|
|
27880
|
+
// will return rgba when there is transparency.
|
|
27881
|
+
if (format === "name" && this._a === 0) {
|
|
27882
|
+
return this.toName();
|
|
27883
|
+
}
|
|
27884
|
+
return this.toRgbString();
|
|
27885
|
+
}
|
|
27886
|
+
if (format === "rgb") {
|
|
27887
|
+
formattedString = this.toRgbString();
|
|
27888
|
+
}
|
|
27889
|
+
if (format === "prgb") {
|
|
27890
|
+
formattedString = this.toPercentageRgbString();
|
|
27891
|
+
}
|
|
27892
|
+
if (format === "hex" || format === "hex6") {
|
|
27893
|
+
formattedString = this.toHexString();
|
|
27894
|
+
}
|
|
27895
|
+
if (format === "hex3") {
|
|
27896
|
+
formattedString = this.toHexString(true);
|
|
27897
|
+
}
|
|
27898
|
+
if (format === "hex4") {
|
|
27899
|
+
formattedString = this.toHex8String(true);
|
|
27900
|
+
}
|
|
27901
|
+
if (format === "hex8") {
|
|
27902
|
+
formattedString = this.toHex8String();
|
|
27903
|
+
}
|
|
27904
|
+
if (format === "name") {
|
|
27905
|
+
formattedString = this.toName();
|
|
27906
|
+
}
|
|
27907
|
+
if (format === "hsl") {
|
|
27908
|
+
formattedString = this.toHslString();
|
|
27909
|
+
}
|
|
27910
|
+
if (format === "hsv") {
|
|
27911
|
+
formattedString = this.toHsvString();
|
|
27912
|
+
}
|
|
28204
27913
|
|
|
28205
|
-
|
|
28206
|
-
|
|
28207
|
-
|
|
28208
|
-
|
|
28209
|
-
|
|
28210
|
-
var hex = [pad2(Math.round(r).toString(16)), pad2(Math.round(g).toString(16)), pad2(Math.round(b).toString(16)), pad2(convertDecimalToHex(a))];
|
|
27914
|
+
return formattedString || this.toHexString();
|
|
27915
|
+
},
|
|
27916
|
+
clone: function() {
|
|
27917
|
+
return tinycolor(this.toString());
|
|
27918
|
+
},
|
|
28211
27919
|
|
|
28212
|
-
|
|
28213
|
-
|
|
28214
|
-
|
|
28215
|
-
|
|
28216
|
-
|
|
28217
|
-
|
|
27920
|
+
_applyModification: function(fn, args) {
|
|
27921
|
+
var color = fn.apply(null, [this].concat([].slice.call(args)));
|
|
27922
|
+
this._r = color._r;
|
|
27923
|
+
this._g = color._g;
|
|
27924
|
+
this._b = color._b;
|
|
27925
|
+
this.setAlpha(color._a);
|
|
27926
|
+
return this;
|
|
27927
|
+
},
|
|
27928
|
+
lighten: function() {
|
|
27929
|
+
return this._applyModification(lighten, arguments);
|
|
27930
|
+
},
|
|
27931
|
+
brighten: function() {
|
|
27932
|
+
return this._applyModification(brighten, arguments);
|
|
27933
|
+
},
|
|
27934
|
+
darken: function() {
|
|
27935
|
+
return this._applyModification(darken, arguments);
|
|
27936
|
+
},
|
|
27937
|
+
desaturate: function() {
|
|
27938
|
+
return this._applyModification(desaturate, arguments);
|
|
27939
|
+
},
|
|
27940
|
+
saturate: function() {
|
|
27941
|
+
return this._applyModification(saturate, arguments);
|
|
27942
|
+
},
|
|
27943
|
+
greyscale: function() {
|
|
27944
|
+
return this._applyModification(greyscale, arguments);
|
|
27945
|
+
},
|
|
27946
|
+
spin: function() {
|
|
27947
|
+
return this._applyModification(spin, arguments);
|
|
27948
|
+
},
|
|
28218
27949
|
|
|
28219
|
-
|
|
28220
|
-
|
|
28221
|
-
|
|
28222
|
-
function
|
|
28223
|
-
|
|
28224
|
-
|
|
28225
|
-
|
|
27950
|
+
_applyCombination: function(fn, args) {
|
|
27951
|
+
return fn.apply(null, [this].concat([].slice.call(args)));
|
|
27952
|
+
},
|
|
27953
|
+
analogous: function() {
|
|
27954
|
+
return this._applyCombination(analogous, arguments);
|
|
27955
|
+
},
|
|
27956
|
+
complement: function() {
|
|
27957
|
+
return this._applyCombination(complement, arguments);
|
|
27958
|
+
},
|
|
27959
|
+
monochromatic: function() {
|
|
27960
|
+
return this._applyCombination(monochromatic, arguments);
|
|
27961
|
+
},
|
|
27962
|
+
splitcomplement: function() {
|
|
27963
|
+
return this._applyCombination(splitcomplement, arguments);
|
|
27964
|
+
},
|
|
27965
|
+
triad: function() {
|
|
27966
|
+
return this._applyCombination(triad, arguments);
|
|
27967
|
+
},
|
|
27968
|
+
tetrad: function() {
|
|
27969
|
+
return this._applyCombination(tetrad, arguments);
|
|
27970
|
+
}
|
|
27971
|
+
};
|
|
27972
|
+
|
|
27973
|
+
// If input is an object, force 1 into "1.0" to handle ratios properly
|
|
27974
|
+
// String input requires "1.0" as input, so 1 will be treated as 1
|
|
27975
|
+
tinycolor.fromRatio = function(color, opts) {
|
|
27976
|
+
if (typeof color == "object") {
|
|
27977
|
+
var newColor = {};
|
|
27978
|
+
for (var i in color) {
|
|
27979
|
+
if (color.hasOwnProperty(i)) {
|
|
27980
|
+
if (i === "a") {
|
|
27981
|
+
newColor[i] = color[i];
|
|
27982
|
+
}
|
|
27983
|
+
else {
|
|
27984
|
+
newColor[i] = convertToPercentage(color[i]);
|
|
27985
|
+
}
|
|
27986
|
+
}
|
|
27987
|
+
}
|
|
27988
|
+
color = newColor;
|
|
27989
|
+
}
|
|
28226
27990
|
|
|
28227
|
-
|
|
28228
|
-
|
|
28229
|
-
|
|
28230
|
-
|
|
28231
|
-
|
|
28232
|
-
|
|
28233
|
-
|
|
28234
|
-
|
|
28235
|
-
|
|
28236
|
-
|
|
28237
|
-
|
|
28238
|
-
|
|
28239
|
-
|
|
27991
|
+
return tinycolor(color, opts);
|
|
27992
|
+
};
|
|
27993
|
+
|
|
27994
|
+
// Given a string or object, convert that input to RGB
|
|
27995
|
+
// Possible string inputs:
|
|
27996
|
+
//
|
|
27997
|
+
// "red"
|
|
27998
|
+
// "#f00" or "f00"
|
|
27999
|
+
// "#ff0000" or "ff0000"
|
|
28000
|
+
// "#ff000000" or "ff000000"
|
|
28001
|
+
// "rgb 255 0 0" or "rgb (255, 0, 0)"
|
|
28002
|
+
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
|
|
28003
|
+
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
|
|
28004
|
+
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
|
|
28005
|
+
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
|
|
28006
|
+
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
|
|
28007
|
+
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
|
|
28008
|
+
//
|
|
28009
|
+
function inputToRGB(color) {
|
|
28010
|
+
|
|
28011
|
+
var rgb = { r: 0, g: 0, b: 0 };
|
|
28012
|
+
var a = 1;
|
|
28013
|
+
var s = null;
|
|
28014
|
+
var v = null;
|
|
28015
|
+
var l = null;
|
|
28016
|
+
var ok = false;
|
|
28017
|
+
var format = false;
|
|
28018
|
+
|
|
28019
|
+
if (typeof color == "string") {
|
|
28020
|
+
color = stringInputToObject(color);
|
|
28021
|
+
}
|
|
28240
28022
|
|
|
28241
|
-
|
|
28242
|
-
|
|
28243
|
-
|
|
28244
|
-
|
|
28245
|
-
|
|
28246
|
-
|
|
28247
|
-
|
|
28248
|
-
|
|
28249
|
-
|
|
28250
|
-
|
|
28251
|
-
|
|
28252
|
-
|
|
28253
|
-
|
|
28254
|
-
|
|
28255
|
-
|
|
28256
|
-
|
|
28257
|
-
|
|
28258
|
-
|
|
28259
|
-
|
|
28260
|
-
|
|
28261
|
-
|
|
28262
|
-
|
|
28263
|
-
|
|
28264
|
-
|
|
28265
|
-
|
|
28266
|
-
hsl.l += amount / 100;
|
|
28267
|
-
hsl.l = clamp01(hsl.l);
|
|
28268
|
-
return tinycolor(hsl);
|
|
28269
|
-
}
|
|
28270
|
-
function _brighten(color, amount) {
|
|
28271
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
28272
|
-
var rgb = tinycolor(color).toRgb();
|
|
28273
|
-
rgb.r = Math.max(0, Math.min(255, rgb.r - Math.round(255 * -(amount / 100))));
|
|
28274
|
-
rgb.g = Math.max(0, Math.min(255, rgb.g - Math.round(255 * -(amount / 100))));
|
|
28275
|
-
rgb.b = Math.max(0, Math.min(255, rgb.b - Math.round(255 * -(amount / 100))));
|
|
28276
|
-
return tinycolor(rgb);
|
|
28277
|
-
}
|
|
28278
|
-
function _darken(color, amount) {
|
|
28279
|
-
amount = amount === 0 ? 0 : amount || 10;
|
|
28280
|
-
var hsl = tinycolor(color).toHsl();
|
|
28281
|
-
hsl.l -= amount / 100;
|
|
28282
|
-
hsl.l = clamp01(hsl.l);
|
|
28283
|
-
return tinycolor(hsl);
|
|
28284
|
-
}
|
|
28285
|
-
|
|
28286
|
-
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
28287
|
-
// Values outside of this range will be wrapped into this range.
|
|
28288
|
-
function _spin(color, amount) {
|
|
28289
|
-
var hsl = tinycolor(color).toHsl();
|
|
28290
|
-
var hue = (hsl.h + amount) % 360;
|
|
28291
|
-
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
28292
|
-
return tinycolor(hsl);
|
|
28293
|
-
}
|
|
28294
|
-
|
|
28295
|
-
// Combination Functions
|
|
28296
|
-
// ---------------------
|
|
28297
|
-
// Thanks to jQuery xColor for some of the ideas behind these
|
|
28298
|
-
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
|
28299
|
-
|
|
28300
|
-
function _complement(color) {
|
|
28301
|
-
var hsl = tinycolor(color).toHsl();
|
|
28302
|
-
hsl.h = (hsl.h + 180) % 360;
|
|
28303
|
-
return tinycolor(hsl);
|
|
28304
|
-
}
|
|
28305
|
-
function polyad(color, number) {
|
|
28306
|
-
if (isNaN(number) || number <= 0) {
|
|
28307
|
-
throw new Error("Argument to polyad must be a positive number");
|
|
28308
|
-
}
|
|
28309
|
-
var hsl = tinycolor(color).toHsl();
|
|
28310
|
-
var result = [tinycolor(color)];
|
|
28311
|
-
var step = 360 / number;
|
|
28312
|
-
for (var i = 1; i < number; i++) {
|
|
28313
|
-
result.push(tinycolor({
|
|
28314
|
-
h: (hsl.h + i * step) % 360,
|
|
28315
|
-
s: hsl.s,
|
|
28316
|
-
l: hsl.l
|
|
28317
|
-
}));
|
|
28318
|
-
}
|
|
28319
|
-
return result;
|
|
28320
|
-
}
|
|
28321
|
-
function _splitcomplement(color) {
|
|
28322
|
-
var hsl = tinycolor(color).toHsl();
|
|
28323
|
-
var h = hsl.h;
|
|
28324
|
-
return [tinycolor(color), tinycolor({
|
|
28325
|
-
h: (h + 72) % 360,
|
|
28326
|
-
s: hsl.s,
|
|
28327
|
-
l: hsl.l
|
|
28328
|
-
}), tinycolor({
|
|
28329
|
-
h: (h + 216) % 360,
|
|
28330
|
-
s: hsl.s,
|
|
28331
|
-
l: hsl.l
|
|
28332
|
-
})];
|
|
28333
|
-
}
|
|
28334
|
-
function _analogous(color, results, slices) {
|
|
28335
|
-
results = results || 6;
|
|
28336
|
-
slices = slices || 30;
|
|
28337
|
-
var hsl = tinycolor(color).toHsl();
|
|
28338
|
-
var part = 360 / slices;
|
|
28339
|
-
var ret = [tinycolor(color)];
|
|
28340
|
-
for (hsl.h = (hsl.h - (part * results >> 1) + 720) % 360; --results;) {
|
|
28341
|
-
hsl.h = (hsl.h + part) % 360;
|
|
28342
|
-
ret.push(tinycolor(hsl));
|
|
28343
|
-
}
|
|
28344
|
-
return ret;
|
|
28345
|
-
}
|
|
28346
|
-
function _monochromatic(color, results) {
|
|
28347
|
-
results = results || 6;
|
|
28348
|
-
var hsv = tinycolor(color).toHsv();
|
|
28349
|
-
var h = hsv.h,
|
|
28350
|
-
s = hsv.s,
|
|
28351
|
-
v = hsv.v;
|
|
28352
|
-
var ret = [];
|
|
28353
|
-
var modification = 1 / results;
|
|
28354
|
-
while (results--) {
|
|
28355
|
-
ret.push(tinycolor({
|
|
28356
|
-
h: h,
|
|
28357
|
-
s: s,
|
|
28358
|
-
v: v
|
|
28359
|
-
}));
|
|
28360
|
-
v = (v + modification) % 1;
|
|
28361
|
-
}
|
|
28362
|
-
return ret;
|
|
28363
|
-
}
|
|
28023
|
+
if (typeof color == "object") {
|
|
28024
|
+
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
|
|
28025
|
+
rgb = rgbToRgb(color.r, color.g, color.b);
|
|
28026
|
+
ok = true;
|
|
28027
|
+
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
|
|
28028
|
+
}
|
|
28029
|
+
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
|
|
28030
|
+
s = convertToPercentage(color.s);
|
|
28031
|
+
v = convertToPercentage(color.v);
|
|
28032
|
+
rgb = hsvToRgb(color.h, s, v);
|
|
28033
|
+
ok = true;
|
|
28034
|
+
format = "hsv";
|
|
28035
|
+
}
|
|
28036
|
+
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
|
|
28037
|
+
s = convertToPercentage(color.s);
|
|
28038
|
+
l = convertToPercentage(color.l);
|
|
28039
|
+
rgb = hslToRgb(color.h, s, l);
|
|
28040
|
+
ok = true;
|
|
28041
|
+
format = "hsl";
|
|
28042
|
+
}
|
|
28043
|
+
|
|
28044
|
+
if (color.hasOwnProperty("a")) {
|
|
28045
|
+
a = color.a;
|
|
28046
|
+
}
|
|
28047
|
+
}
|
|
28364
28048
|
|
|
28365
|
-
|
|
28366
|
-
// ---------------------
|
|
28049
|
+
a = boundAlpha(a);
|
|
28367
28050
|
|
|
28368
|
-
|
|
28369
|
-
|
|
28370
|
-
|
|
28371
|
-
|
|
28372
|
-
|
|
28373
|
-
|
|
28374
|
-
|
|
28375
|
-
|
|
28376
|
-
|
|
28377
|
-
a: (rgb2.a - rgb1.a) * p + rgb1.a
|
|
28378
|
-
};
|
|
28379
|
-
return tinycolor(rgba);
|
|
28380
|
-
};
|
|
28381
|
-
|
|
28382
|
-
// Readability Functions
|
|
28383
|
-
// ---------------------
|
|
28384
|
-
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
|
|
28385
|
-
|
|
28386
|
-
// `contrast`
|
|
28387
|
-
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
|
|
28388
|
-
tinycolor.readability = function (color1, color2) {
|
|
28389
|
-
var c1 = tinycolor(color1);
|
|
28390
|
-
var c2 = tinycolor(color2);
|
|
28391
|
-
return (Math.max(c1.getLuminance(), c2.getLuminance()) + 0.05) / (Math.min(c1.getLuminance(), c2.getLuminance()) + 0.05);
|
|
28392
|
-
};
|
|
28393
|
-
|
|
28394
|
-
// `isReadable`
|
|
28395
|
-
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
|
28396
|
-
// The third argument is an optional Object.
|
|
28397
|
-
// the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
|
|
28398
|
-
// the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
|
|
28399
|
-
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
|
|
28400
|
-
|
|
28401
|
-
// *Example*
|
|
28402
|
-
// tinycolor.isReadable("#000", "#111") => false
|
|
28403
|
-
// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
|
|
28404
|
-
tinycolor.isReadable = function (color1, color2, wcag2) {
|
|
28405
|
-
var readability = tinycolor.readability(color1, color2);
|
|
28406
|
-
var wcag2Parms, out;
|
|
28407
|
-
out = false;
|
|
28408
|
-
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
28409
|
-
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
28410
|
-
case "AAsmall":
|
|
28411
|
-
case "AAAlarge":
|
|
28412
|
-
out = readability >= 4.5;
|
|
28413
|
-
break;
|
|
28414
|
-
case "AAlarge":
|
|
28415
|
-
out = readability >= 3;
|
|
28416
|
-
break;
|
|
28417
|
-
case "AAAsmall":
|
|
28418
|
-
out = readability >= 7;
|
|
28419
|
-
break;
|
|
28420
|
-
}
|
|
28421
|
-
return out;
|
|
28422
|
-
};
|
|
28423
|
-
|
|
28424
|
-
// `mostReadable`
|
|
28425
|
-
// Given a base color and a list of possible foreground or background
|
|
28426
|
-
// colors for that base, returns the most readable color.
|
|
28427
|
-
// Optionally returns Black or White if the most readable color is unreadable.
|
|
28428
|
-
// *Example*
|
|
28429
|
-
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
|
|
28430
|
-
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
|
|
28431
|
-
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
|
|
28432
|
-
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
|
|
28433
|
-
tinycolor.mostReadable = function (baseColor, colorList, args) {
|
|
28434
|
-
var bestColor = null;
|
|
28435
|
-
var bestScore = 0;
|
|
28436
|
-
var readability;
|
|
28437
|
-
var includeFallbackColors, level, size;
|
|
28438
|
-
args = args || {};
|
|
28439
|
-
includeFallbackColors = args.includeFallbackColors;
|
|
28440
|
-
level = args.level;
|
|
28441
|
-
size = args.size;
|
|
28442
|
-
for (var i = 0; i < colorList.length; i++) {
|
|
28443
|
-
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
28444
|
-
if (readability > bestScore) {
|
|
28445
|
-
bestScore = readability;
|
|
28446
|
-
bestColor = tinycolor(colorList[i]);
|
|
28447
|
-
}
|
|
28448
|
-
}
|
|
28449
|
-
if (tinycolor.isReadable(baseColor, bestColor, {
|
|
28450
|
-
level: level,
|
|
28451
|
-
size: size
|
|
28452
|
-
}) || !includeFallbackColors) {
|
|
28453
|
-
return bestColor;
|
|
28454
|
-
} else {
|
|
28455
|
-
args.includeFallbackColors = false;
|
|
28456
|
-
return tinycolor.mostReadable(baseColor, ["#fff", "#000"], args);
|
|
28457
|
-
}
|
|
28458
|
-
};
|
|
28459
|
-
|
|
28460
|
-
// Big List of Colors
|
|
28461
|
-
// ------------------
|
|
28462
|
-
// <https://www.w3.org/TR/css-color-4/#named-colors>
|
|
28463
|
-
var names = tinycolor.names = {
|
|
28464
|
-
aliceblue: "f0f8ff",
|
|
28465
|
-
antiquewhite: "faebd7",
|
|
28466
|
-
aqua: "0ff",
|
|
28467
|
-
aquamarine: "7fffd4",
|
|
28468
|
-
azure: "f0ffff",
|
|
28469
|
-
beige: "f5f5dc",
|
|
28470
|
-
bisque: "ffe4c4",
|
|
28471
|
-
black: "000",
|
|
28472
|
-
blanchedalmond: "ffebcd",
|
|
28473
|
-
blue: "00f",
|
|
28474
|
-
blueviolet: "8a2be2",
|
|
28475
|
-
brown: "a52a2a",
|
|
28476
|
-
burlywood: "deb887",
|
|
28477
|
-
burntsienna: "ea7e5d",
|
|
28478
|
-
cadetblue: "5f9ea0",
|
|
28479
|
-
chartreuse: "7fff00",
|
|
28480
|
-
chocolate: "d2691e",
|
|
28481
|
-
coral: "ff7f50",
|
|
28482
|
-
cornflowerblue: "6495ed",
|
|
28483
|
-
cornsilk: "fff8dc",
|
|
28484
|
-
crimson: "dc143c",
|
|
28485
|
-
cyan: "0ff",
|
|
28486
|
-
darkblue: "00008b",
|
|
28487
|
-
darkcyan: "008b8b",
|
|
28488
|
-
darkgoldenrod: "b8860b",
|
|
28489
|
-
darkgray: "a9a9a9",
|
|
28490
|
-
darkgreen: "006400",
|
|
28491
|
-
darkgrey: "a9a9a9",
|
|
28492
|
-
darkkhaki: "bdb76b",
|
|
28493
|
-
darkmagenta: "8b008b",
|
|
28494
|
-
darkolivegreen: "556b2f",
|
|
28495
|
-
darkorange: "ff8c00",
|
|
28496
|
-
darkorchid: "9932cc",
|
|
28497
|
-
darkred: "8b0000",
|
|
28498
|
-
darksalmon: "e9967a",
|
|
28499
|
-
darkseagreen: "8fbc8f",
|
|
28500
|
-
darkslateblue: "483d8b",
|
|
28501
|
-
darkslategray: "2f4f4f",
|
|
28502
|
-
darkslategrey: "2f4f4f",
|
|
28503
|
-
darkturquoise: "00ced1",
|
|
28504
|
-
darkviolet: "9400d3",
|
|
28505
|
-
deeppink: "ff1493",
|
|
28506
|
-
deepskyblue: "00bfff",
|
|
28507
|
-
dimgray: "696969",
|
|
28508
|
-
dimgrey: "696969",
|
|
28509
|
-
dodgerblue: "1e90ff",
|
|
28510
|
-
firebrick: "b22222",
|
|
28511
|
-
floralwhite: "fffaf0",
|
|
28512
|
-
forestgreen: "228b22",
|
|
28513
|
-
fuchsia: "f0f",
|
|
28514
|
-
gainsboro: "dcdcdc",
|
|
28515
|
-
ghostwhite: "f8f8ff",
|
|
28516
|
-
gold: "ffd700",
|
|
28517
|
-
goldenrod: "daa520",
|
|
28518
|
-
gray: "808080",
|
|
28519
|
-
green: "008000",
|
|
28520
|
-
greenyellow: "adff2f",
|
|
28521
|
-
grey: "808080",
|
|
28522
|
-
honeydew: "f0fff0",
|
|
28523
|
-
hotpink: "ff69b4",
|
|
28524
|
-
indianred: "cd5c5c",
|
|
28525
|
-
indigo: "4b0082",
|
|
28526
|
-
ivory: "fffff0",
|
|
28527
|
-
khaki: "f0e68c",
|
|
28528
|
-
lavender: "e6e6fa",
|
|
28529
|
-
lavenderblush: "fff0f5",
|
|
28530
|
-
lawngreen: "7cfc00",
|
|
28531
|
-
lemonchiffon: "fffacd",
|
|
28532
|
-
lightblue: "add8e6",
|
|
28533
|
-
lightcoral: "f08080",
|
|
28534
|
-
lightcyan: "e0ffff",
|
|
28535
|
-
lightgoldenrodyellow: "fafad2",
|
|
28536
|
-
lightgray: "d3d3d3",
|
|
28537
|
-
lightgreen: "90ee90",
|
|
28538
|
-
lightgrey: "d3d3d3",
|
|
28539
|
-
lightpink: "ffb6c1",
|
|
28540
|
-
lightsalmon: "ffa07a",
|
|
28541
|
-
lightseagreen: "20b2aa",
|
|
28542
|
-
lightskyblue: "87cefa",
|
|
28543
|
-
lightslategray: "789",
|
|
28544
|
-
lightslategrey: "789",
|
|
28545
|
-
lightsteelblue: "b0c4de",
|
|
28546
|
-
lightyellow: "ffffe0",
|
|
28547
|
-
lime: "0f0",
|
|
28548
|
-
limegreen: "32cd32",
|
|
28549
|
-
linen: "faf0e6",
|
|
28550
|
-
magenta: "f0f",
|
|
28551
|
-
maroon: "800000",
|
|
28552
|
-
mediumaquamarine: "66cdaa",
|
|
28553
|
-
mediumblue: "0000cd",
|
|
28554
|
-
mediumorchid: "ba55d3",
|
|
28555
|
-
mediumpurple: "9370db",
|
|
28556
|
-
mediumseagreen: "3cb371",
|
|
28557
|
-
mediumslateblue: "7b68ee",
|
|
28558
|
-
mediumspringgreen: "00fa9a",
|
|
28559
|
-
mediumturquoise: "48d1cc",
|
|
28560
|
-
mediumvioletred: "c71585",
|
|
28561
|
-
midnightblue: "191970",
|
|
28562
|
-
mintcream: "f5fffa",
|
|
28563
|
-
mistyrose: "ffe4e1",
|
|
28564
|
-
moccasin: "ffe4b5",
|
|
28565
|
-
navajowhite: "ffdead",
|
|
28566
|
-
navy: "000080",
|
|
28567
|
-
oldlace: "fdf5e6",
|
|
28568
|
-
olive: "808000",
|
|
28569
|
-
olivedrab: "6b8e23",
|
|
28570
|
-
orange: "ffa500",
|
|
28571
|
-
orangered: "ff4500",
|
|
28572
|
-
orchid: "da70d6",
|
|
28573
|
-
palegoldenrod: "eee8aa",
|
|
28574
|
-
palegreen: "98fb98",
|
|
28575
|
-
paleturquoise: "afeeee",
|
|
28576
|
-
palevioletred: "db7093",
|
|
28577
|
-
papayawhip: "ffefd5",
|
|
28578
|
-
peachpuff: "ffdab9",
|
|
28579
|
-
peru: "cd853f",
|
|
28580
|
-
pink: "ffc0cb",
|
|
28581
|
-
plum: "dda0dd",
|
|
28582
|
-
powderblue: "b0e0e6",
|
|
28583
|
-
purple: "800080",
|
|
28584
|
-
rebeccapurple: "663399",
|
|
28585
|
-
red: "f00",
|
|
28586
|
-
rosybrown: "bc8f8f",
|
|
28587
|
-
royalblue: "4169e1",
|
|
28588
|
-
saddlebrown: "8b4513",
|
|
28589
|
-
salmon: "fa8072",
|
|
28590
|
-
sandybrown: "f4a460",
|
|
28591
|
-
seagreen: "2e8b57",
|
|
28592
|
-
seashell: "fff5ee",
|
|
28593
|
-
sienna: "a0522d",
|
|
28594
|
-
silver: "c0c0c0",
|
|
28595
|
-
skyblue: "87ceeb",
|
|
28596
|
-
slateblue: "6a5acd",
|
|
28597
|
-
slategray: "708090",
|
|
28598
|
-
slategrey: "708090",
|
|
28599
|
-
snow: "fffafa",
|
|
28600
|
-
springgreen: "00ff7f",
|
|
28601
|
-
steelblue: "4682b4",
|
|
28602
|
-
tan: "d2b48c",
|
|
28603
|
-
teal: "008080",
|
|
28604
|
-
thistle: "d8bfd8",
|
|
28605
|
-
tomato: "ff6347",
|
|
28606
|
-
turquoise: "40e0d0",
|
|
28607
|
-
violet: "ee82ee",
|
|
28608
|
-
wheat: "f5deb3",
|
|
28609
|
-
white: "fff",
|
|
28610
|
-
whitesmoke: "f5f5f5",
|
|
28611
|
-
yellow: "ff0",
|
|
28612
|
-
yellowgreen: "9acd32"
|
|
28613
|
-
};
|
|
28614
|
-
|
|
28615
|
-
// Make it easy to access colors via `hexNames[hex]`
|
|
28616
|
-
var hexNames = tinycolor.hexNames = flip(names);
|
|
28617
|
-
|
|
28618
|
-
// Utilities
|
|
28619
|
-
// ---------
|
|
28620
|
-
|
|
28621
|
-
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
|
|
28622
|
-
function flip(o) {
|
|
28623
|
-
var flipped = {};
|
|
28624
|
-
for (var i in o) {
|
|
28625
|
-
if (o.hasOwnProperty(i)) {
|
|
28626
|
-
flipped[o[i]] = i;
|
|
28627
|
-
}
|
|
28628
|
-
}
|
|
28629
|
-
return flipped;
|
|
28630
|
-
}
|
|
28631
|
-
|
|
28632
|
-
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
28633
|
-
function boundAlpha(a) {
|
|
28634
|
-
a = parseFloat(a);
|
|
28635
|
-
if (isNaN(a) || a < 0 || a > 1) {
|
|
28636
|
-
a = 1;
|
|
28637
|
-
}
|
|
28638
|
-
return a;
|
|
28639
|
-
}
|
|
28640
|
-
|
|
28641
|
-
// Take input from [0, n] and return it as [0, 1]
|
|
28642
|
-
function bound01(n, max) {
|
|
28643
|
-
if (isOnePointZero(n)) n = "100%";
|
|
28644
|
-
var processPercent = isPercentage(n);
|
|
28645
|
-
n = Math.min(max, Math.max(0, parseFloat(n)));
|
|
28646
|
-
|
|
28647
|
-
// Automatically convert percentage into number
|
|
28648
|
-
if (processPercent) {
|
|
28649
|
-
n = parseInt(n * max, 10) / 100;
|
|
28650
|
-
}
|
|
28651
|
-
|
|
28652
|
-
// Handle floating point rounding errors
|
|
28653
|
-
if (Math.abs(n - max) < 0.000001) {
|
|
28654
|
-
return 1;
|
|
28655
|
-
}
|
|
28051
|
+
return {
|
|
28052
|
+
ok: ok,
|
|
28053
|
+
format: color.format || format,
|
|
28054
|
+
r: mathMin(255, mathMax(rgb.r, 0)),
|
|
28055
|
+
g: mathMin(255, mathMax(rgb.g, 0)),
|
|
28056
|
+
b: mathMin(255, mathMax(rgb.b, 0)),
|
|
28057
|
+
a: a
|
|
28058
|
+
};
|
|
28059
|
+
}
|
|
28656
28060
|
|
|
28657
|
-
// Convert into [0, 1] range if it isn't already
|
|
28658
|
-
return n % max / parseFloat(max);
|
|
28659
|
-
}
|
|
28660
28061
|
|
|
28661
|
-
//
|
|
28662
|
-
|
|
28663
|
-
return Math.min(1, Math.max(0, val));
|
|
28664
|
-
}
|
|
28062
|
+
// Conversion Functions
|
|
28063
|
+
// --------------------
|
|
28665
28064
|
|
|
28666
|
-
//
|
|
28667
|
-
|
|
28668
|
-
return parseInt(val, 16);
|
|
28669
|
-
}
|
|
28065
|
+
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
|
|
28066
|
+
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
|
|
28670
28067
|
|
|
28671
|
-
//
|
|
28672
|
-
//
|
|
28673
|
-
|
|
28674
|
-
|
|
28675
|
-
}
|
|
28068
|
+
// `rgbToRgb`
|
|
28069
|
+
// Handle bounds / percentage checking to conform to CSS color spec
|
|
28070
|
+
// <http://www.w3.org/TR/css3-color/>
|
|
28071
|
+
// *Assumes:* r, g, b in [0, 255] or [0, 1]
|
|
28072
|
+
// *Returns:* { r, g, b } in [0, 255]
|
|
28073
|
+
function rgbToRgb(r, g, b){
|
|
28074
|
+
return {
|
|
28075
|
+
r: bound01(r, 255) * 255,
|
|
28076
|
+
g: bound01(g, 255) * 255,
|
|
28077
|
+
b: bound01(b, 255) * 255
|
|
28078
|
+
};
|
|
28079
|
+
}
|
|
28676
28080
|
|
|
28677
|
-
//
|
|
28678
|
-
|
|
28679
|
-
|
|
28680
|
-
}
|
|
28081
|
+
// `rgbToHsl`
|
|
28082
|
+
// Converts an RGB color value to HSL.
|
|
28083
|
+
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
|
|
28084
|
+
// *Returns:* { h, s, l } in [0,1]
|
|
28085
|
+
function rgbToHsl(r, g, b) {
|
|
28681
28086
|
|
|
28682
|
-
|
|
28683
|
-
|
|
28684
|
-
|
|
28685
|
-
}
|
|
28087
|
+
r = bound01(r, 255);
|
|
28088
|
+
g = bound01(g, 255);
|
|
28089
|
+
b = bound01(b, 255);
|
|
28686
28090
|
|
|
28687
|
-
|
|
28688
|
-
|
|
28689
|
-
if (n <= 1) {
|
|
28690
|
-
n = n * 100 + "%";
|
|
28691
|
-
}
|
|
28692
|
-
return n;
|
|
28693
|
-
}
|
|
28091
|
+
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
|
28092
|
+
var h, s, l = (max + min) / 2;
|
|
28694
28093
|
|
|
28695
|
-
|
|
28696
|
-
|
|
28697
|
-
|
|
28698
|
-
|
|
28699
|
-
|
|
28700
|
-
|
|
28701
|
-
|
|
28702
|
-
|
|
28703
|
-
|
|
28704
|
-
|
|
28705
|
-
|
|
28094
|
+
if(max == min) {
|
|
28095
|
+
h = s = 0; // achromatic
|
|
28096
|
+
}
|
|
28097
|
+
else {
|
|
28098
|
+
var d = max - min;
|
|
28099
|
+
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
|
|
28100
|
+
switch(max) {
|
|
28101
|
+
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
|
28102
|
+
case g: h = (b - r) / d + 2; break;
|
|
28103
|
+
case b: h = (r - g) / d + 4; break;
|
|
28104
|
+
}
|
|
28706
28105
|
|
|
28707
|
-
|
|
28708
|
-
|
|
28106
|
+
h /= 6;
|
|
28107
|
+
}
|
|
28709
28108
|
|
|
28710
|
-
|
|
28711
|
-
|
|
28109
|
+
return { h: h, s: s, l: l };
|
|
28110
|
+
}
|
|
28712
28111
|
|
|
28713
|
-
|
|
28714
|
-
|
|
28715
|
-
|
|
28716
|
-
|
|
28717
|
-
|
|
28718
|
-
|
|
28719
|
-
|
|
28720
|
-
|
|
28721
|
-
|
|
28722
|
-
|
|
28723
|
-
|
|
28724
|
-
|
|
28725
|
-
|
|
28726
|
-
|
|
28727
|
-
|
|
28728
|
-
|
|
28729
|
-
|
|
28730
|
-
|
|
28731
|
-
}
|
|
28112
|
+
// `hslToRgb`
|
|
28113
|
+
// Converts an HSL color value to RGB.
|
|
28114
|
+
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
|
|
28115
|
+
// *Returns:* { r, g, b } in the set [0, 255]
|
|
28116
|
+
function hslToRgb(h, s, l) {
|
|
28117
|
+
var r, g, b;
|
|
28118
|
+
|
|
28119
|
+
h = bound01(h, 360);
|
|
28120
|
+
s = bound01(s, 100);
|
|
28121
|
+
l = bound01(l, 100);
|
|
28122
|
+
|
|
28123
|
+
function hue2rgb(p, q, t) {
|
|
28124
|
+
if(t < 0) t += 1;
|
|
28125
|
+
if(t > 1) t -= 1;
|
|
28126
|
+
if(t < 1/6) return p + (q - p) * 6 * t;
|
|
28127
|
+
if(t < 1/2) return q;
|
|
28128
|
+
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
|
|
28129
|
+
return p;
|
|
28130
|
+
}
|
|
28732
28131
|
|
|
28733
|
-
|
|
28734
|
-
|
|
28735
|
-
|
|
28736
|
-
|
|
28737
|
-
|
|
28738
|
-
|
|
28739
|
-
|
|
28740
|
-
|
|
28741
|
-
|
|
28742
|
-
|
|
28743
|
-
function stringInputToObject(color) {
|
|
28744
|
-
color = color.replace(trimLeft, "").replace(trimRight, "").toLowerCase();
|
|
28745
|
-
var named = false;
|
|
28746
|
-
if (names[color]) {
|
|
28747
|
-
color = names[color];
|
|
28748
|
-
named = true;
|
|
28749
|
-
} else if (color == "transparent") {
|
|
28750
|
-
return {
|
|
28751
|
-
r: 0,
|
|
28752
|
-
g: 0,
|
|
28753
|
-
b: 0,
|
|
28754
|
-
a: 0,
|
|
28755
|
-
format: "name"
|
|
28756
|
-
};
|
|
28757
|
-
}
|
|
28132
|
+
if(s === 0) {
|
|
28133
|
+
r = g = b = l; // achromatic
|
|
28134
|
+
}
|
|
28135
|
+
else {
|
|
28136
|
+
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
|
|
28137
|
+
var p = 2 * l - q;
|
|
28138
|
+
r = hue2rgb(p, q, h + 1/3);
|
|
28139
|
+
g = hue2rgb(p, q, h);
|
|
28140
|
+
b = hue2rgb(p, q, h - 1/3);
|
|
28141
|
+
}
|
|
28758
28142
|
|
|
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
|
-
|
|
28846
|
-
|
|
28847
|
-
|
|
28848
|
-
|
|
28849
|
-
|
|
28850
|
-
|
|
28851
|
-
|
|
28852
|
-
|
|
28853
|
-
|
|
28854
|
-
|
|
28855
|
-
|
|
28856
|
-
|
|
28857
|
-
|
|
28858
|
-
|
|
28859
|
-
|
|
28860
|
-
|
|
28861
|
-
|
|
28862
|
-
|
|
28863
|
-
|
|
28864
|
-
|
|
28865
|
-
|
|
28143
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
28144
|
+
}
|
|
28145
|
+
|
|
28146
|
+
// `rgbToHsv`
|
|
28147
|
+
// Converts an RGB color value to HSV
|
|
28148
|
+
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
|
|
28149
|
+
// *Returns:* { h, s, v } in [0,1]
|
|
28150
|
+
function rgbToHsv(r, g, b) {
|
|
28151
|
+
|
|
28152
|
+
r = bound01(r, 255);
|
|
28153
|
+
g = bound01(g, 255);
|
|
28154
|
+
b = bound01(b, 255);
|
|
28155
|
+
|
|
28156
|
+
var max = mathMax(r, g, b), min = mathMin(r, g, b);
|
|
28157
|
+
var h, s, v = max;
|
|
28158
|
+
|
|
28159
|
+
var d = max - min;
|
|
28160
|
+
s = max === 0 ? 0 : d / max;
|
|
28161
|
+
|
|
28162
|
+
if(max == min) {
|
|
28163
|
+
h = 0; // achromatic
|
|
28164
|
+
}
|
|
28165
|
+
else {
|
|
28166
|
+
switch(max) {
|
|
28167
|
+
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
|
|
28168
|
+
case g: h = (b - r) / d + 2; break;
|
|
28169
|
+
case b: h = (r - g) / d + 4; break;
|
|
28170
|
+
}
|
|
28171
|
+
h /= 6;
|
|
28172
|
+
}
|
|
28173
|
+
return { h: h, s: s, v: v };
|
|
28174
|
+
}
|
|
28175
|
+
|
|
28176
|
+
// `hsvToRgb`
|
|
28177
|
+
// Converts an HSV color value to RGB.
|
|
28178
|
+
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
|
|
28179
|
+
// *Returns:* { r, g, b } in the set [0, 255]
|
|
28180
|
+
function hsvToRgb(h, s, v) {
|
|
28181
|
+
|
|
28182
|
+
h = bound01(h, 360) * 6;
|
|
28183
|
+
s = bound01(s, 100);
|
|
28184
|
+
v = bound01(v, 100);
|
|
28185
|
+
|
|
28186
|
+
var i = Math.floor(h),
|
|
28187
|
+
f = h - i,
|
|
28188
|
+
p = v * (1 - s),
|
|
28189
|
+
q = v * (1 - f * s),
|
|
28190
|
+
t = v * (1 - (1 - f) * s),
|
|
28191
|
+
mod = i % 6,
|
|
28192
|
+
r = [v, q, p, p, t, v][mod],
|
|
28193
|
+
g = [t, v, v, q, p, p][mod],
|
|
28194
|
+
b = [p, p, t, v, v, q][mod];
|
|
28195
|
+
|
|
28196
|
+
return { r: r * 255, g: g * 255, b: b * 255 };
|
|
28197
|
+
}
|
|
28198
|
+
|
|
28199
|
+
// `rgbToHex`
|
|
28200
|
+
// Converts an RGB color to hex
|
|
28201
|
+
// Assumes r, g, and b are contained in the set [0, 255]
|
|
28202
|
+
// Returns a 3 or 6 character hex
|
|
28203
|
+
function rgbToHex(r, g, b, allow3Char) {
|
|
28204
|
+
|
|
28205
|
+
var hex = [
|
|
28206
|
+
pad2(mathRound(r).toString(16)),
|
|
28207
|
+
pad2(mathRound(g).toString(16)),
|
|
28208
|
+
pad2(mathRound(b).toString(16))
|
|
28209
|
+
];
|
|
28210
|
+
|
|
28211
|
+
// Return a 3 character hex if possible
|
|
28212
|
+
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)) {
|
|
28213
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
|
|
28214
|
+
}
|
|
28215
|
+
|
|
28216
|
+
return hex.join("");
|
|
28217
|
+
}
|
|
28218
|
+
|
|
28219
|
+
// `rgbaToHex`
|
|
28220
|
+
// Converts an RGBA color plus alpha transparency to hex
|
|
28221
|
+
// Assumes r, g, b are contained in the set [0, 255] and
|
|
28222
|
+
// a in [0, 1]. Returns a 4 or 8 character rgba hex
|
|
28223
|
+
function rgbaToHex(r, g, b, a, allow4Char) {
|
|
28224
|
+
|
|
28225
|
+
var hex = [
|
|
28226
|
+
pad2(mathRound(r).toString(16)),
|
|
28227
|
+
pad2(mathRound(g).toString(16)),
|
|
28228
|
+
pad2(mathRound(b).toString(16)),
|
|
28229
|
+
pad2(convertDecimalToHex(a))
|
|
28230
|
+
];
|
|
28231
|
+
|
|
28232
|
+
// Return a 4 character hex if possible
|
|
28233
|
+
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)) {
|
|
28234
|
+
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
|
|
28235
|
+
}
|
|
28236
|
+
|
|
28237
|
+
return hex.join("");
|
|
28238
|
+
}
|
|
28239
|
+
|
|
28240
|
+
// `rgbaToArgbHex`
|
|
28241
|
+
// Converts an RGBA color to an ARGB Hex8 string
|
|
28242
|
+
// Rarely used, but required for "toFilter()"
|
|
28243
|
+
function rgbaToArgbHex(r, g, b, a) {
|
|
28244
|
+
|
|
28245
|
+
var hex = [
|
|
28246
|
+
pad2(convertDecimalToHex(a)),
|
|
28247
|
+
pad2(mathRound(r).toString(16)),
|
|
28248
|
+
pad2(mathRound(g).toString(16)),
|
|
28249
|
+
pad2(mathRound(b).toString(16))
|
|
28250
|
+
];
|
|
28251
|
+
|
|
28252
|
+
return hex.join("");
|
|
28253
|
+
}
|
|
28254
|
+
|
|
28255
|
+
// `equals`
|
|
28256
|
+
// Can be called with any tinycolor input
|
|
28257
|
+
tinycolor.equals = function (color1, color2) {
|
|
28258
|
+
if (!color1 || !color2) { return false; }
|
|
28259
|
+
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
|
|
28260
|
+
};
|
|
28261
|
+
|
|
28262
|
+
tinycolor.random = function() {
|
|
28263
|
+
return tinycolor.fromRatio({
|
|
28264
|
+
r: mathRandom(),
|
|
28265
|
+
g: mathRandom(),
|
|
28266
|
+
b: mathRandom()
|
|
28267
|
+
});
|
|
28268
|
+
};
|
|
28269
|
+
|
|
28270
|
+
|
|
28271
|
+
// Modification Functions
|
|
28272
|
+
// ----------------------
|
|
28273
|
+
// Thanks to less.js for some of the basics here
|
|
28274
|
+
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
|
|
28275
|
+
|
|
28276
|
+
function desaturate(color, amount) {
|
|
28277
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28278
|
+
var hsl = tinycolor(color).toHsl();
|
|
28279
|
+
hsl.s -= amount / 100;
|
|
28280
|
+
hsl.s = clamp01(hsl.s);
|
|
28281
|
+
return tinycolor(hsl);
|
|
28282
|
+
}
|
|
28283
|
+
|
|
28284
|
+
function saturate(color, amount) {
|
|
28285
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28286
|
+
var hsl = tinycolor(color).toHsl();
|
|
28287
|
+
hsl.s += amount / 100;
|
|
28288
|
+
hsl.s = clamp01(hsl.s);
|
|
28289
|
+
return tinycolor(hsl);
|
|
28290
|
+
}
|
|
28291
|
+
|
|
28292
|
+
function greyscale(color) {
|
|
28293
|
+
return tinycolor(color).desaturate(100);
|
|
28294
|
+
}
|
|
28295
|
+
|
|
28296
|
+
function lighten (color, amount) {
|
|
28297
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28298
|
+
var hsl = tinycolor(color).toHsl();
|
|
28299
|
+
hsl.l += amount / 100;
|
|
28300
|
+
hsl.l = clamp01(hsl.l);
|
|
28301
|
+
return tinycolor(hsl);
|
|
28302
|
+
}
|
|
28303
|
+
|
|
28304
|
+
function brighten(color, amount) {
|
|
28305
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28306
|
+
var rgb = tinycolor(color).toRgb();
|
|
28307
|
+
rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
|
|
28308
|
+
rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
|
|
28309
|
+
rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
|
|
28310
|
+
return tinycolor(rgb);
|
|
28311
|
+
}
|
|
28312
|
+
|
|
28313
|
+
function darken (color, amount) {
|
|
28314
|
+
amount = (amount === 0) ? 0 : (amount || 10);
|
|
28315
|
+
var hsl = tinycolor(color).toHsl();
|
|
28316
|
+
hsl.l -= amount / 100;
|
|
28317
|
+
hsl.l = clamp01(hsl.l);
|
|
28318
|
+
return tinycolor(hsl);
|
|
28319
|
+
}
|
|
28320
|
+
|
|
28321
|
+
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
|
|
28322
|
+
// Values outside of this range will be wrapped into this range.
|
|
28323
|
+
function spin(color, amount) {
|
|
28324
|
+
var hsl = tinycolor(color).toHsl();
|
|
28325
|
+
var hue = (hsl.h + amount) % 360;
|
|
28326
|
+
hsl.h = hue < 0 ? 360 + hue : hue;
|
|
28327
|
+
return tinycolor(hsl);
|
|
28328
|
+
}
|
|
28329
|
+
|
|
28330
|
+
// Combination Functions
|
|
28331
|
+
// ---------------------
|
|
28332
|
+
// Thanks to jQuery xColor for some of the ideas behind these
|
|
28333
|
+
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
|
|
28334
|
+
|
|
28335
|
+
function complement(color) {
|
|
28336
|
+
var hsl = tinycolor(color).toHsl();
|
|
28337
|
+
hsl.h = (hsl.h + 180) % 360;
|
|
28338
|
+
return tinycolor(hsl);
|
|
28339
|
+
}
|
|
28340
|
+
|
|
28341
|
+
function triad(color) {
|
|
28342
|
+
var hsl = tinycolor(color).toHsl();
|
|
28343
|
+
var h = hsl.h;
|
|
28344
|
+
return [
|
|
28345
|
+
tinycolor(color),
|
|
28346
|
+
tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
|
|
28347
|
+
tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
|
|
28348
|
+
];
|
|
28349
|
+
}
|
|
28350
|
+
|
|
28351
|
+
function tetrad(color) {
|
|
28352
|
+
var hsl = tinycolor(color).toHsl();
|
|
28353
|
+
var h = hsl.h;
|
|
28354
|
+
return [
|
|
28355
|
+
tinycolor(color),
|
|
28356
|
+
tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
|
|
28357
|
+
tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
|
|
28358
|
+
tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
|
|
28359
|
+
];
|
|
28360
|
+
}
|
|
28361
|
+
|
|
28362
|
+
function splitcomplement(color) {
|
|
28363
|
+
var hsl = tinycolor(color).toHsl();
|
|
28364
|
+
var h = hsl.h;
|
|
28365
|
+
return [
|
|
28366
|
+
tinycolor(color),
|
|
28367
|
+
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
|
|
28368
|
+
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
|
|
28369
|
+
];
|
|
28370
|
+
}
|
|
28371
|
+
|
|
28372
|
+
function analogous(color, results, slices) {
|
|
28373
|
+
results = results || 6;
|
|
28374
|
+
slices = slices || 30;
|
|
28375
|
+
|
|
28376
|
+
var hsl = tinycolor(color).toHsl();
|
|
28377
|
+
var part = 360 / slices;
|
|
28378
|
+
var ret = [tinycolor(color)];
|
|
28379
|
+
|
|
28380
|
+
for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
|
|
28381
|
+
hsl.h = (hsl.h + part) % 360;
|
|
28382
|
+
ret.push(tinycolor(hsl));
|
|
28383
|
+
}
|
|
28384
|
+
return ret;
|
|
28385
|
+
}
|
|
28386
|
+
|
|
28387
|
+
function monochromatic(color, results) {
|
|
28388
|
+
results = results || 6;
|
|
28389
|
+
var hsv = tinycolor(color).toHsv();
|
|
28390
|
+
var h = hsv.h, s = hsv.s, v = hsv.v;
|
|
28391
|
+
var ret = [];
|
|
28392
|
+
var modification = 1 / results;
|
|
28393
|
+
|
|
28394
|
+
while (results--) {
|
|
28395
|
+
ret.push(tinycolor({ h: h, s: s, v: v}));
|
|
28396
|
+
v = (v + modification) % 1;
|
|
28397
|
+
}
|
|
28398
|
+
|
|
28399
|
+
return ret;
|
|
28400
|
+
}
|
|
28401
|
+
|
|
28402
|
+
// Utility Functions
|
|
28403
|
+
// ---------------------
|
|
28404
|
+
|
|
28405
|
+
tinycolor.mix = function(color1, color2, amount) {
|
|
28406
|
+
amount = (amount === 0) ? 0 : (amount || 50);
|
|
28407
|
+
|
|
28408
|
+
var rgb1 = tinycolor(color1).toRgb();
|
|
28409
|
+
var rgb2 = tinycolor(color2).toRgb();
|
|
28410
|
+
|
|
28411
|
+
var p = amount / 100;
|
|
28412
|
+
|
|
28413
|
+
var rgba = {
|
|
28414
|
+
r: ((rgb2.r - rgb1.r) * p) + rgb1.r,
|
|
28415
|
+
g: ((rgb2.g - rgb1.g) * p) + rgb1.g,
|
|
28416
|
+
b: ((rgb2.b - rgb1.b) * p) + rgb1.b,
|
|
28417
|
+
a: ((rgb2.a - rgb1.a) * p) + rgb1.a
|
|
28418
|
+
};
|
|
28419
|
+
|
|
28420
|
+
return tinycolor(rgba);
|
|
28421
|
+
};
|
|
28422
|
+
|
|
28423
|
+
|
|
28424
|
+
// Readability Functions
|
|
28425
|
+
// ---------------------
|
|
28426
|
+
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
|
|
28427
|
+
|
|
28428
|
+
// `contrast`
|
|
28429
|
+
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
|
|
28430
|
+
tinycolor.readability = function(color1, color2) {
|
|
28431
|
+
var c1 = tinycolor(color1);
|
|
28432
|
+
var c2 = tinycolor(color2);
|
|
28433
|
+
return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05);
|
|
28434
|
+
};
|
|
28435
|
+
|
|
28436
|
+
// `isReadable`
|
|
28437
|
+
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
|
|
28438
|
+
// The third argument is an optional Object.
|
|
28439
|
+
// the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
|
|
28440
|
+
// the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
|
|
28441
|
+
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
|
|
28442
|
+
|
|
28443
|
+
// *Example*
|
|
28444
|
+
// tinycolor.isReadable("#000", "#111") => false
|
|
28445
|
+
// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
|
|
28446
|
+
tinycolor.isReadable = function(color1, color2, wcag2) {
|
|
28447
|
+
var readability = tinycolor.readability(color1, color2);
|
|
28448
|
+
var wcag2Parms, out;
|
|
28449
|
+
|
|
28450
|
+
out = false;
|
|
28451
|
+
|
|
28452
|
+
wcag2Parms = validateWCAG2Parms(wcag2);
|
|
28453
|
+
switch (wcag2Parms.level + wcag2Parms.size) {
|
|
28454
|
+
case "AAsmall":
|
|
28455
|
+
case "AAAlarge":
|
|
28456
|
+
out = readability >= 4.5;
|
|
28457
|
+
break;
|
|
28458
|
+
case "AAlarge":
|
|
28459
|
+
out = readability >= 3;
|
|
28460
|
+
break;
|
|
28461
|
+
case "AAAsmall":
|
|
28462
|
+
out = readability >= 7;
|
|
28463
|
+
break;
|
|
28464
|
+
}
|
|
28465
|
+
return out;
|
|
28466
|
+
|
|
28467
|
+
};
|
|
28468
|
+
|
|
28469
|
+
// `mostReadable`
|
|
28470
|
+
// Given a base color and a list of possible foreground or background
|
|
28471
|
+
// colors for that base, returns the most readable color.
|
|
28472
|
+
// Optionally returns Black or White if the most readable color is unreadable.
|
|
28473
|
+
// *Example*
|
|
28474
|
+
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
|
|
28475
|
+
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
|
|
28476
|
+
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
|
|
28477
|
+
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
|
|
28478
|
+
tinycolor.mostReadable = function(baseColor, colorList, args) {
|
|
28479
|
+
var bestColor = null;
|
|
28480
|
+
var bestScore = 0;
|
|
28481
|
+
var readability;
|
|
28482
|
+
var includeFallbackColors, level, size ;
|
|
28483
|
+
args = args || {};
|
|
28484
|
+
includeFallbackColors = args.includeFallbackColors ;
|
|
28485
|
+
level = args.level;
|
|
28486
|
+
size = args.size;
|
|
28487
|
+
|
|
28488
|
+
for (var i= 0; i < colorList.length ; i++) {
|
|
28489
|
+
readability = tinycolor.readability(baseColor, colorList[i]);
|
|
28490
|
+
if (readability > bestScore) {
|
|
28491
|
+
bestScore = readability;
|
|
28492
|
+
bestColor = tinycolor(colorList[i]);
|
|
28493
|
+
}
|
|
28494
|
+
}
|
|
28495
|
+
|
|
28496
|
+
if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) {
|
|
28497
|
+
return bestColor;
|
|
28498
|
+
}
|
|
28499
|
+
else {
|
|
28500
|
+
args.includeFallbackColors=false;
|
|
28501
|
+
return tinycolor.mostReadable(baseColor,["#fff", "#000"],args);
|
|
28502
|
+
}
|
|
28503
|
+
};
|
|
28504
|
+
|
|
28505
|
+
|
|
28506
|
+
// Big List of Colors
|
|
28507
|
+
// ------------------
|
|
28508
|
+
// <http://www.w3.org/TR/css3-color/#svg-color>
|
|
28509
|
+
var names = tinycolor.names = {
|
|
28510
|
+
aliceblue: "f0f8ff",
|
|
28511
|
+
antiquewhite: "faebd7",
|
|
28512
|
+
aqua: "0ff",
|
|
28513
|
+
aquamarine: "7fffd4",
|
|
28514
|
+
azure: "f0ffff",
|
|
28515
|
+
beige: "f5f5dc",
|
|
28516
|
+
bisque: "ffe4c4",
|
|
28517
|
+
black: "000",
|
|
28518
|
+
blanchedalmond: "ffebcd",
|
|
28519
|
+
blue: "00f",
|
|
28520
|
+
blueviolet: "8a2be2",
|
|
28521
|
+
brown: "a52a2a",
|
|
28522
|
+
burlywood: "deb887",
|
|
28523
|
+
burntsienna: "ea7e5d",
|
|
28524
|
+
cadetblue: "5f9ea0",
|
|
28525
|
+
chartreuse: "7fff00",
|
|
28526
|
+
chocolate: "d2691e",
|
|
28527
|
+
coral: "ff7f50",
|
|
28528
|
+
cornflowerblue: "6495ed",
|
|
28529
|
+
cornsilk: "fff8dc",
|
|
28530
|
+
crimson: "dc143c",
|
|
28531
|
+
cyan: "0ff",
|
|
28532
|
+
darkblue: "00008b",
|
|
28533
|
+
darkcyan: "008b8b",
|
|
28534
|
+
darkgoldenrod: "b8860b",
|
|
28535
|
+
darkgray: "a9a9a9",
|
|
28536
|
+
darkgreen: "006400",
|
|
28537
|
+
darkgrey: "a9a9a9",
|
|
28538
|
+
darkkhaki: "bdb76b",
|
|
28539
|
+
darkmagenta: "8b008b",
|
|
28540
|
+
darkolivegreen: "556b2f",
|
|
28541
|
+
darkorange: "ff8c00",
|
|
28542
|
+
darkorchid: "9932cc",
|
|
28543
|
+
darkred: "8b0000",
|
|
28544
|
+
darksalmon: "e9967a",
|
|
28545
|
+
darkseagreen: "8fbc8f",
|
|
28546
|
+
darkslateblue: "483d8b",
|
|
28547
|
+
darkslategray: "2f4f4f",
|
|
28548
|
+
darkslategrey: "2f4f4f",
|
|
28549
|
+
darkturquoise: "00ced1",
|
|
28550
|
+
darkviolet: "9400d3",
|
|
28551
|
+
deeppink: "ff1493",
|
|
28552
|
+
deepskyblue: "00bfff",
|
|
28553
|
+
dimgray: "696969",
|
|
28554
|
+
dimgrey: "696969",
|
|
28555
|
+
dodgerblue: "1e90ff",
|
|
28556
|
+
firebrick: "b22222",
|
|
28557
|
+
floralwhite: "fffaf0",
|
|
28558
|
+
forestgreen: "228b22",
|
|
28559
|
+
fuchsia: "f0f",
|
|
28560
|
+
gainsboro: "dcdcdc",
|
|
28561
|
+
ghostwhite: "f8f8ff",
|
|
28562
|
+
gold: "ffd700",
|
|
28563
|
+
goldenrod: "daa520",
|
|
28564
|
+
gray: "808080",
|
|
28565
|
+
green: "008000",
|
|
28566
|
+
greenyellow: "adff2f",
|
|
28567
|
+
grey: "808080",
|
|
28568
|
+
honeydew: "f0fff0",
|
|
28569
|
+
hotpink: "ff69b4",
|
|
28570
|
+
indianred: "cd5c5c",
|
|
28571
|
+
indigo: "4b0082",
|
|
28572
|
+
ivory: "fffff0",
|
|
28573
|
+
khaki: "f0e68c",
|
|
28574
|
+
lavender: "e6e6fa",
|
|
28575
|
+
lavenderblush: "fff0f5",
|
|
28576
|
+
lawngreen: "7cfc00",
|
|
28577
|
+
lemonchiffon: "fffacd",
|
|
28578
|
+
lightblue: "add8e6",
|
|
28579
|
+
lightcoral: "f08080",
|
|
28580
|
+
lightcyan: "e0ffff",
|
|
28581
|
+
lightgoldenrodyellow: "fafad2",
|
|
28582
|
+
lightgray: "d3d3d3",
|
|
28583
|
+
lightgreen: "90ee90",
|
|
28584
|
+
lightgrey: "d3d3d3",
|
|
28585
|
+
lightpink: "ffb6c1",
|
|
28586
|
+
lightsalmon: "ffa07a",
|
|
28587
|
+
lightseagreen: "20b2aa",
|
|
28588
|
+
lightskyblue: "87cefa",
|
|
28589
|
+
lightslategray: "789",
|
|
28590
|
+
lightslategrey: "789",
|
|
28591
|
+
lightsteelblue: "b0c4de",
|
|
28592
|
+
lightyellow: "ffffe0",
|
|
28593
|
+
lime: "0f0",
|
|
28594
|
+
limegreen: "32cd32",
|
|
28595
|
+
linen: "faf0e6",
|
|
28596
|
+
magenta: "f0f",
|
|
28597
|
+
maroon: "800000",
|
|
28598
|
+
mediumaquamarine: "66cdaa",
|
|
28599
|
+
mediumblue: "0000cd",
|
|
28600
|
+
mediumorchid: "ba55d3",
|
|
28601
|
+
mediumpurple: "9370db",
|
|
28602
|
+
mediumseagreen: "3cb371",
|
|
28603
|
+
mediumslateblue: "7b68ee",
|
|
28604
|
+
mediumspringgreen: "00fa9a",
|
|
28605
|
+
mediumturquoise: "48d1cc",
|
|
28606
|
+
mediumvioletred: "c71585",
|
|
28607
|
+
midnightblue: "191970",
|
|
28608
|
+
mintcream: "f5fffa",
|
|
28609
|
+
mistyrose: "ffe4e1",
|
|
28610
|
+
moccasin: "ffe4b5",
|
|
28611
|
+
navajowhite: "ffdead",
|
|
28612
|
+
navy: "000080",
|
|
28613
|
+
oldlace: "fdf5e6",
|
|
28614
|
+
olive: "808000",
|
|
28615
|
+
olivedrab: "6b8e23",
|
|
28616
|
+
orange: "ffa500",
|
|
28617
|
+
orangered: "ff4500",
|
|
28618
|
+
orchid: "da70d6",
|
|
28619
|
+
palegoldenrod: "eee8aa",
|
|
28620
|
+
palegreen: "98fb98",
|
|
28621
|
+
paleturquoise: "afeeee",
|
|
28622
|
+
palevioletred: "db7093",
|
|
28623
|
+
papayawhip: "ffefd5",
|
|
28624
|
+
peachpuff: "ffdab9",
|
|
28625
|
+
peru: "cd853f",
|
|
28626
|
+
pink: "ffc0cb",
|
|
28627
|
+
plum: "dda0dd",
|
|
28628
|
+
powderblue: "b0e0e6",
|
|
28629
|
+
purple: "800080",
|
|
28630
|
+
rebeccapurple: "663399",
|
|
28631
|
+
red: "f00",
|
|
28632
|
+
rosybrown: "bc8f8f",
|
|
28633
|
+
royalblue: "4169e1",
|
|
28634
|
+
saddlebrown: "8b4513",
|
|
28635
|
+
salmon: "fa8072",
|
|
28636
|
+
sandybrown: "f4a460",
|
|
28637
|
+
seagreen: "2e8b57",
|
|
28638
|
+
seashell: "fff5ee",
|
|
28639
|
+
sienna: "a0522d",
|
|
28640
|
+
silver: "c0c0c0",
|
|
28641
|
+
skyblue: "87ceeb",
|
|
28642
|
+
slateblue: "6a5acd",
|
|
28643
|
+
slategray: "708090",
|
|
28644
|
+
slategrey: "708090",
|
|
28645
|
+
snow: "fffafa",
|
|
28646
|
+
springgreen: "00ff7f",
|
|
28647
|
+
steelblue: "4682b4",
|
|
28648
|
+
tan: "d2b48c",
|
|
28649
|
+
teal: "008080",
|
|
28650
|
+
thistle: "d8bfd8",
|
|
28651
|
+
tomato: "ff6347",
|
|
28652
|
+
turquoise: "40e0d0",
|
|
28653
|
+
violet: "ee82ee",
|
|
28654
|
+
wheat: "f5deb3",
|
|
28655
|
+
white: "fff",
|
|
28656
|
+
whitesmoke: "f5f5f5",
|
|
28657
|
+
yellow: "ff0",
|
|
28658
|
+
yellowgreen: "9acd32"
|
|
28659
|
+
};
|
|
28660
|
+
|
|
28661
|
+
// Make it easy to access colors via `hexNames[hex]`
|
|
28662
|
+
var hexNames = tinycolor.hexNames = flip(names);
|
|
28663
|
+
|
|
28664
|
+
|
|
28665
|
+
// Utilities
|
|
28666
|
+
// ---------
|
|
28667
|
+
|
|
28668
|
+
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
|
|
28669
|
+
function flip(o) {
|
|
28670
|
+
var flipped = { };
|
|
28671
|
+
for (var i in o) {
|
|
28672
|
+
if (o.hasOwnProperty(i)) {
|
|
28673
|
+
flipped[o[i]] = i;
|
|
28674
|
+
}
|
|
28675
|
+
}
|
|
28676
|
+
return flipped;
|
|
28677
|
+
}
|
|
28678
|
+
|
|
28679
|
+
// Return a valid alpha value [0,1] with all invalid values being set to 1
|
|
28680
|
+
function boundAlpha(a) {
|
|
28681
|
+
a = parseFloat(a);
|
|
28682
|
+
|
|
28683
|
+
if (isNaN(a) || a < 0 || a > 1) {
|
|
28684
|
+
a = 1;
|
|
28685
|
+
}
|
|
28686
|
+
|
|
28687
|
+
return a;
|
|
28688
|
+
}
|
|
28689
|
+
|
|
28690
|
+
// Take input from [0, n] and return it as [0, 1]
|
|
28691
|
+
function bound01(n, max) {
|
|
28692
|
+
if (isOnePointZero(n)) { n = "100%"; }
|
|
28693
|
+
|
|
28694
|
+
var processPercent = isPercentage(n);
|
|
28695
|
+
n = mathMin(max, mathMax(0, parseFloat(n)));
|
|
28696
|
+
|
|
28697
|
+
// Automatically convert percentage into number
|
|
28698
|
+
if (processPercent) {
|
|
28699
|
+
n = parseInt(n * max, 10) / 100;
|
|
28700
|
+
}
|
|
28701
|
+
|
|
28702
|
+
// Handle floating point rounding errors
|
|
28703
|
+
if ((Math.abs(n - max) < 0.000001)) {
|
|
28704
|
+
return 1;
|
|
28705
|
+
}
|
|
28706
|
+
|
|
28707
|
+
// Convert into [0, 1] range if it isn't already
|
|
28708
|
+
return (n % max) / parseFloat(max);
|
|
28709
|
+
}
|
|
28710
|
+
|
|
28711
|
+
// Force a number between 0 and 1
|
|
28712
|
+
function clamp01(val) {
|
|
28713
|
+
return mathMin(1, mathMax(0, val));
|
|
28714
|
+
}
|
|
28715
|
+
|
|
28716
|
+
// Parse a base-16 hex value into a base-10 integer
|
|
28717
|
+
function parseIntFromHex(val) {
|
|
28718
|
+
return parseInt(val, 16);
|
|
28719
|
+
}
|
|
28720
|
+
|
|
28721
|
+
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
|
|
28722
|
+
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
|
|
28723
|
+
function isOnePointZero(n) {
|
|
28724
|
+
return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
|
|
28725
|
+
}
|
|
28726
|
+
|
|
28727
|
+
// Check to see if string passed in is a percentage
|
|
28728
|
+
function isPercentage(n) {
|
|
28729
|
+
return typeof n === "string" && n.indexOf('%') != -1;
|
|
28730
|
+
}
|
|
28731
|
+
|
|
28732
|
+
// Force a hex value to have 2 characters
|
|
28733
|
+
function pad2(c) {
|
|
28734
|
+
return c.length == 1 ? '0' + c : '' + c;
|
|
28735
|
+
}
|
|
28736
|
+
|
|
28737
|
+
// Replace a decimal with it's percentage value
|
|
28738
|
+
function convertToPercentage(n) {
|
|
28739
|
+
if (n <= 1) {
|
|
28740
|
+
n = (n * 100) + "%";
|
|
28741
|
+
}
|
|
28742
|
+
|
|
28743
|
+
return n;
|
|
28744
|
+
}
|
|
28745
|
+
|
|
28746
|
+
// Converts a decimal to a hex value
|
|
28747
|
+
function convertDecimalToHex(d) {
|
|
28748
|
+
return Math.round(parseFloat(d) * 255).toString(16);
|
|
28749
|
+
}
|
|
28750
|
+
// Converts a hex value to a decimal
|
|
28751
|
+
function convertHexToDecimal(h) {
|
|
28752
|
+
return (parseIntFromHex(h) / 255);
|
|
28753
|
+
}
|
|
28754
|
+
|
|
28755
|
+
var matchers = (function() {
|
|
28756
|
+
|
|
28757
|
+
// <http://www.w3.org/TR/css3-values/#integers>
|
|
28758
|
+
var CSS_INTEGER = "[-\\+]?\\d+%?";
|
|
28759
|
+
|
|
28760
|
+
// <http://www.w3.org/TR/css3-values/#number-value>
|
|
28761
|
+
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
|
|
28762
|
+
|
|
28763
|
+
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
|
|
28764
|
+
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
|
|
28765
|
+
|
|
28766
|
+
// Actual matching.
|
|
28767
|
+
// Parentheses and commas are optional, but not required.
|
|
28768
|
+
// Whitespace can take the place of commas or opening paren
|
|
28769
|
+
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
28770
|
+
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
|
|
28771
|
+
|
|
28772
|
+
return {
|
|
28773
|
+
CSS_UNIT: new RegExp(CSS_UNIT),
|
|
28774
|
+
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
|
|
28775
|
+
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
|
|
28776
|
+
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
|
|
28777
|
+
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
|
|
28778
|
+
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
|
|
28779
|
+
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
|
|
28780
|
+
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
28781
|
+
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
|
|
28782
|
+
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
|
|
28783
|
+
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
|
|
28784
|
+
};
|
|
28785
|
+
})();
|
|
28786
|
+
|
|
28787
|
+
// `isValidCSSUnit`
|
|
28788
|
+
// Take in a single string / number and check to see if it looks like a CSS unit
|
|
28789
|
+
// (see `matchers` above for definition).
|
|
28790
|
+
function isValidCSSUnit(color) {
|
|
28791
|
+
return !!matchers.CSS_UNIT.exec(color);
|
|
28792
|
+
}
|
|
28793
|
+
|
|
28794
|
+
// `stringInputToObject`
|
|
28795
|
+
// Permissive string parsing. Take in a number of formats, and output an object
|
|
28796
|
+
// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
|
|
28797
|
+
function stringInputToObject(color) {
|
|
28798
|
+
|
|
28799
|
+
color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
|
|
28800
|
+
var named = false;
|
|
28801
|
+
if (names[color]) {
|
|
28802
|
+
color = names[color];
|
|
28803
|
+
named = true;
|
|
28804
|
+
}
|
|
28805
|
+
else if (color == 'transparent') {
|
|
28806
|
+
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
|
|
28807
|
+
}
|
|
28808
|
+
|
|
28809
|
+
// Try to match string input using regular expressions.
|
|
28810
|
+
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
|
|
28811
|
+
// Just return an object and let the conversion functions handle that.
|
|
28812
|
+
// This way the result will be the same whether the tinycolor is initialized with string or object.
|
|
28813
|
+
var match;
|
|
28814
|
+
if ((match = matchers.rgb.exec(color))) {
|
|
28815
|
+
return { r: match[1], g: match[2], b: match[3] };
|
|
28816
|
+
}
|
|
28817
|
+
if ((match = matchers.rgba.exec(color))) {
|
|
28818
|
+
return { r: match[1], g: match[2], b: match[3], a: match[4] };
|
|
28819
|
+
}
|
|
28820
|
+
if ((match = matchers.hsl.exec(color))) {
|
|
28821
|
+
return { h: match[1], s: match[2], l: match[3] };
|
|
28822
|
+
}
|
|
28823
|
+
if ((match = matchers.hsla.exec(color))) {
|
|
28824
|
+
return { h: match[1], s: match[2], l: match[3], a: match[4] };
|
|
28825
|
+
}
|
|
28826
|
+
if ((match = matchers.hsv.exec(color))) {
|
|
28827
|
+
return { h: match[1], s: match[2], v: match[3] };
|
|
28828
|
+
}
|
|
28829
|
+
if ((match = matchers.hsva.exec(color))) {
|
|
28830
|
+
return { h: match[1], s: match[2], v: match[3], a: match[4] };
|
|
28831
|
+
}
|
|
28832
|
+
if ((match = matchers.hex8.exec(color))) {
|
|
28833
|
+
return {
|
|
28834
|
+
r: parseIntFromHex(match[1]),
|
|
28835
|
+
g: parseIntFromHex(match[2]),
|
|
28836
|
+
b: parseIntFromHex(match[3]),
|
|
28837
|
+
a: convertHexToDecimal(match[4]),
|
|
28838
|
+
format: named ? "name" : "hex8"
|
|
28839
|
+
};
|
|
28840
|
+
}
|
|
28841
|
+
if ((match = matchers.hex6.exec(color))) {
|
|
28842
|
+
return {
|
|
28843
|
+
r: parseIntFromHex(match[1]),
|
|
28844
|
+
g: parseIntFromHex(match[2]),
|
|
28845
|
+
b: parseIntFromHex(match[3]),
|
|
28846
|
+
format: named ? "name" : "hex"
|
|
28847
|
+
};
|
|
28848
|
+
}
|
|
28849
|
+
if ((match = matchers.hex4.exec(color))) {
|
|
28850
|
+
return {
|
|
28851
|
+
r: parseIntFromHex(match[1] + '' + match[1]),
|
|
28852
|
+
g: parseIntFromHex(match[2] + '' + match[2]),
|
|
28853
|
+
b: parseIntFromHex(match[3] + '' + match[3]),
|
|
28854
|
+
a: convertHexToDecimal(match[4] + '' + match[4]),
|
|
28855
|
+
format: named ? "name" : "hex8"
|
|
28856
|
+
};
|
|
28857
|
+
}
|
|
28858
|
+
if ((match = matchers.hex3.exec(color))) {
|
|
28859
|
+
return {
|
|
28860
|
+
r: parseIntFromHex(match[1] + '' + match[1]),
|
|
28861
|
+
g: parseIntFromHex(match[2] + '' + match[2]),
|
|
28862
|
+
b: parseIntFromHex(match[3] + '' + match[3]),
|
|
28863
|
+
format: named ? "name" : "hex"
|
|
28864
|
+
};
|
|
28865
|
+
}
|
|
28866
|
+
|
|
28867
|
+
return false;
|
|
28868
|
+
}
|
|
28869
|
+
|
|
28870
|
+
function validateWCAG2Parms(parms) {
|
|
28871
|
+
// return valid WCAG2 parms for isReadable.
|
|
28872
|
+
// If input parms are invalid, return {"level":"AA", "size":"small"}
|
|
28873
|
+
var level, size;
|
|
28874
|
+
parms = parms || {"level":"AA", "size":"small"};
|
|
28875
|
+
level = (parms.level || "AA").toUpperCase();
|
|
28876
|
+
size = (parms.size || "small").toLowerCase();
|
|
28877
|
+
if (level !== "AA" && level !== "AAA") {
|
|
28878
|
+
level = "AA";
|
|
28879
|
+
}
|
|
28880
|
+
if (size !== "small" && size !== "large") {
|
|
28881
|
+
size = "small";
|
|
28882
|
+
}
|
|
28883
|
+
return {"level":level, "size":size};
|
|
28884
|
+
}
|
|
28885
|
+
|
|
28886
|
+
// Node: Export function
|
|
28887
|
+
if (module.exports) {
|
|
28888
|
+
module.exports = tinycolor;
|
|
28889
|
+
}
|
|
28890
|
+
// AMD/requirejs: Define the module
|
|
28891
|
+
else {
|
|
28892
|
+
window.tinycolor = tinycolor;
|
|
28893
|
+
}
|
|
28894
|
+
|
|
28895
|
+
})(Math);
|
|
28896
|
+
} (tinycolor$1));
|
|
28897
|
+
|
|
28898
|
+
var tinycolorExports = tinycolor$1.exports;
|
|
28899
|
+
var tinycolor = /*@__PURE__*/getDefaultExportFromCjs(tinycolorExports);
|
|
28866
28900
|
|
|
28867
|
-
const baseLabelClasses = 'tw
|
|
28901
|
+
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';
|
|
28868
28902
|
const ProgressIndicator = (props) => {
|
|
28869
28903
|
const { value, color = undefined, testId, label, extraClasses = '', labelClasses = '', valuesLength, max, index, totalValue, ...tooltipProps } = props;
|
|
28870
28904
|
const tooltipData = getQTipData(tooltipProps);
|
|
@@ -28877,19 +28911,19 @@ const ProgressIndicator = (props) => {
|
|
|
28877
28911
|
if (totalValue >= max) {
|
|
28878
28912
|
// If progress is 100%, round both ends
|
|
28879
28913
|
if (index === 0 && valuesLength === 1) {
|
|
28880
|
-
roundedCorners = 'tw
|
|
28914
|
+
roundedCorners = 'tw:rounded-[0.9375rem]';
|
|
28881
28915
|
}
|
|
28882
28916
|
else if (index === 0) {
|
|
28883
|
-
roundedCorners = 'tw
|
|
28917
|
+
roundedCorners = 'tw:rounded-l-[0.9375rem]';
|
|
28884
28918
|
}
|
|
28885
28919
|
else if (index === valuesLength - 1) {
|
|
28886
|
-
roundedCorners = 'tw
|
|
28920
|
+
roundedCorners = 'tw:rounded-r-[0.9375rem]';
|
|
28887
28921
|
}
|
|
28888
28922
|
}
|
|
28889
28923
|
else {
|
|
28890
28924
|
// Otherwise, only round the leftmost indicator
|
|
28891
28925
|
if (index === 0) {
|
|
28892
|
-
roundedCorners = 'tw
|
|
28926
|
+
roundedCorners = 'tw:rounded-l-[0.9375rem]';
|
|
28893
28927
|
}
|
|
28894
28928
|
}
|
|
28895
28929
|
React.useEffect(() => {
|
|
@@ -28901,13 +28935,13 @@ const ProgressIndicator = (props) => {
|
|
|
28901
28935
|
return () => clearTimeout(timeout);
|
|
28902
28936
|
}, [value]);
|
|
28903
28937
|
const bgColor = color || undefined;
|
|
28904
|
-
const bgClass = color ? '' : 'tw
|
|
28938
|
+
const bgClass = color ? '' : 'tw:bg-sq-theme-dark';
|
|
28905
28939
|
const computeTextClass = (elem) => {
|
|
28906
28940
|
const computedStyle = getComputedStyle(elem);
|
|
28907
28941
|
const backgroundColor = computedStyle.backgroundColor;
|
|
28908
28942
|
const textColorClass = tinycolor(backgroundColor).isDark()
|
|
28909
|
-
? 'tw
|
|
28910
|
-
: 'tw
|
|
28943
|
+
? 'tw:text-sq-white tw:dark:text-sq-white'
|
|
28944
|
+
: 'tw:text-sq-text-color tw:dark:text-sq-text-color';
|
|
28911
28945
|
setTextColorClass(textColorClass);
|
|
28912
28946
|
};
|
|
28913
28947
|
React.useEffect(() => {
|
|
@@ -28915,35 +28949,35 @@ const ProgressIndicator = (props) => {
|
|
|
28915
28949
|
computeTextClass(indicatorElementRef.current);
|
|
28916
28950
|
}
|
|
28917
28951
|
}, [!!indicatorElementRef.current]);
|
|
28918
|
-
return (React.createElement(Indicator, { className: `tw
|
|
28952
|
+
return (React.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: {
|
|
28919
28953
|
// Background color will default to the theme color if undefined
|
|
28920
28954
|
backgroundColor: bgColor,
|
|
28921
28955
|
animation: 'width 660ms forwards',
|
|
28922
28956
|
width: `${animatedWidth}%`,
|
|
28923
|
-
} }, label ? (jsxRuntime.jsx("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw
|
|
28957
|
+
} }, label ? (jsxRuntime.jsx("span", { className: `${baseLabelClasses} ${labelClasses} ${textColorClass} ${valuesLength === 1 ? 'tw:absolute tw:z-50' : ''}`, children: label })) : undefined));
|
|
28924
28958
|
};
|
|
28925
28959
|
const ProgressBar = ({ values = [], max = 100, containerExtraClasses = '', zeroValueLabel = 'No progress yet', }) => {
|
|
28926
28960
|
const totalValue = values.reduce((acc, { value }) => acc + value, 0);
|
|
28927
|
-
return (jsxRuntime.jsx(Root, { className: `tw
|
|
28928
|
-
return React.createElement(ProgressIndicator, { ...props, max: max, valuesLength: values.length, index: i, totalValue: totalValue, key: i });
|
|
28929
|
-
})) : (jsxRuntime.jsx("div", { className: `${baseLabelClasses} tw
|
|
28961
|
+
return (jsxRuntime.jsx(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) => {
|
|
28962
|
+
return (React.createElement(ProgressIndicator, { ...props, max: max, valuesLength: values.length, index: i, totalValue: totalValue, key: i }));
|
|
28963
|
+
})) : (jsxRuntime.jsx("div", { className: `${baseLabelClasses} tw:mx-auto tw:overflow-hidden`, children: zeroValueLabel })) }));
|
|
28930
28964
|
};
|
|
28931
28965
|
|
|
28932
|
-
const baseClasses = 'tw
|
|
28966
|
+
const baseClasses = 'tw:flex tw:outline-none tw:w-full tw:relative tw:flex-wrap';
|
|
28933
28967
|
const activeClassesByVariantLightTheme = {
|
|
28934
|
-
'outline': '
|
|
28935
|
-
'theme': 'tw
|
|
28968
|
+
'outline': 'tw:!bg-sq-disabled-gray tw:border-sq-theme-dark',
|
|
28969
|
+
'theme': 'tw:bg-sq-theme-highlight',
|
|
28936
28970
|
'danger': '',
|
|
28937
28971
|
'theme-light': '',
|
|
28938
|
-
'no-border': '
|
|
28972
|
+
'no-border': 'tw:!bg-sq-disabled-gray',
|
|
28939
28973
|
'warning': '',
|
|
28940
28974
|
};
|
|
28941
28975
|
const activeClassesByVariantDarkTheme = {
|
|
28942
|
-
'outline': 'dark
|
|
28943
|
-
'theme': 'dark:
|
|
28976
|
+
'outline': 'tw:!dark:bg-sq-multi-gray-dark tw:dark:border-sq-theme-dark',
|
|
28977
|
+
'theme': 'tw:dark:bg-sq-theme-highlight',
|
|
28944
28978
|
'danger': '',
|
|
28945
28979
|
'theme-light': '',
|
|
28946
|
-
'no-border': 'dark
|
|
28980
|
+
'no-border': 'tw:!dark:bg-sq-multi-gray-dark',
|
|
28947
28981
|
'warning': '',
|
|
28948
28982
|
};
|
|
28949
28983
|
/**
|
|
@@ -28955,7 +28989,7 @@ const ButtonGroup = (props) => {
|
|
|
28955
28989
|
const appliedClasses = `${baseClasses} ${extraClassNames}`;
|
|
28956
28990
|
return (jsxRuntime.jsx("div", { id: id ? `button-group-${id}` : undefined, "data-testid": testId, className: appliedClasses, ...tooltipData, children: buttons
|
|
28957
28991
|
.filter(Boolean)
|
|
28958
|
-
.map((item, index) => item?.variant === 'button' ? (jsxRuntime.jsx(Button, { ...item.buttonProps, extraClassNames: `tw
|
|
28992
|
+
.map((item, index) => item?.variant === 'button' ? (jsxRuntime.jsx(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
|
|
28959
28993
|
? `${activeClassesByVariantLightTheme[item?.buttonProps?.variant ?? 'outline']} ${activeClassesByVariantDarkTheme[item?.buttonProps?.variant ?? 'outline']} `
|
|
28960
28994
|
: ''} ${item.buttonProps.extraClassNames}`, onClick: () => onChange && onChange(item?.buttonProps?.value) }, index)) : (item?.element)) }));
|
|
28961
28995
|
};
|
|
@@ -28965,7 +28999,7 @@ const ButtonGroup = (props) => {
|
|
|
28965
28999
|
* - Easily create a carousel with custom slides.
|
|
28966
29000
|
* - Supports automatic sliding, navigation arrows, and slide indicators.
|
|
28967
29001
|
*/
|
|
28968
|
-
const Carousel = ({ testId = 'carousel-id', activeIndex = 0, extraClassNames = '', onSlide = () => { }, autoSlide, showIndicators = true, continuous = true, interval = 4000, prevIcon = 'fc-arrow-dropdown tw
|
|
29002
|
+
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 = [], }) => {
|
|
28969
29003
|
const [currentIndex, setCurrentIndex] = React.useState(activeIndex);
|
|
28970
29004
|
const changeSlide = (nextIndex) => {
|
|
28971
29005
|
const newIndex = (nextIndex + carouselItems.length) % carouselItems.length;
|
|
@@ -29032,7 +29066,7 @@ const Carousel = ({ testId = 'carousel-id', activeIndex = 0, extraClassNames = '
|
|
|
29032
29066
|
transition: springTransition,
|
|
29033
29067
|
}),
|
|
29034
29068
|
};
|
|
29035
|
-
return (jsxRuntime.jsxs("div", { "data-testid": testId, className: `tw
|
|
29069
|
+
return (jsxRuntime.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: [jsxRuntime.jsxs("div", { className: "tw:flex tw:items-center tw:w-full tw:h-max tw:gap-1", children: [showArrows && (jsxRuntime.jsx(Button, { icon: prevIcon, size: "lg", variant: "no-border", testId: "carousel-prev", extraClassNames: `${currentIndex === 0 && !continuous ? 'tw:invisible' : ''} ${iconExtraClassNames} tw:animate-fadeIn`, onClick: onBackClick })), jsxRuntime.jsx("div", { className: "tw:h-full tw:w-full tw:overflow-hidden", children: jsxRuntime.jsx(motion.div, { custom: 1, initial: "initial", animate: "animate", exit: "exit", variants: slideVariants, className: "tw:w-full", children: carouselItems[currentIndex] }, currentIndex) }), showArrows && (jsxRuntime.jsx(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 && (jsxRuntime.jsx("div", { className: "tw:flex tw:gap-1 tw:mt-2", children: carouselItems.map((_, i) => (jsxRuntime.jsx("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))) }))] }));
|
|
29036
29070
|
};
|
|
29037
29071
|
|
|
29038
29072
|
const buttonTypes = ['button', 'reset', 'submit', 'link'];
|