@seeqdev/qomponents 0.0.83 → 0.0.84
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ToolbarButton/ToolbarButton.types.d.ts +10 -0
- package/dist/index.esm.js +24 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +24 -3
- package/dist/index.js.map +1 -1
- package/dist/styles.css +3 -3
- package/dist/utils/svg.d.ts +15 -0
- package/dist/utils/svg.js +20 -0
- package/dist/utils/svg.js.map +1 -0
- package/package.json +1 -1
- package/dist/Accordion/Accordion.js +0 -9
- package/dist/Accordion/Accordion.js.map +0 -1
- package/dist/Accordion/Accordion.stories.js +0 -115
- package/dist/Accordion/Accordion.stories.js.map +0 -1
- package/dist/Accordion/Accordion.test.js +0 -55
- package/dist/Accordion/Accordion.test.js.map +0 -1
- package/dist/Accordion/Accordion.types.js +0 -2
- package/dist/Accordion/Accordion.types.js.map +0 -1
- package/dist/Accordion/index.js +0 -2
- package/dist/Accordion/index.js.map +0 -1
- package/dist/Button/Button.js +0 -90
- package/dist/Button/Button.js.map +0 -1
- package/dist/Button/Button.stories.js +0 -98
- package/dist/Button/Button.stories.js.map +0 -1
- package/dist/Button/Button.test.js +0 -49
- package/dist/Button/Button.test.js.map +0 -1
- package/dist/Button/Button.types.js +0 -5
- package/dist/Button/Button.types.js.map +0 -1
- package/dist/Button/index.js +0 -2
- package/dist/Button/index.js.map +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js +0 -68
- package/dist/ButtonWithDropdown/ButtonWithDropdown.js.map +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js +0 -96
- package/dist/ButtonWithDropdown/ButtonWithDropdown.stories.js.map +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js +0 -72
- package/dist/ButtonWithDropdown/ButtonWithDropdown.test.js.map +0 -1
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js +0 -2
- package/dist/ButtonWithDropdown/ButtonWithDropdown.types.js.map +0 -1
- package/dist/ButtonWithDropdown/index.js +0 -2
- package/dist/ButtonWithDropdown/index.js.map +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.js +0 -53
- package/dist/ButtonWithPopover/ButtonWithPopover.js.map +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js +0 -75
- package/dist/ButtonWithPopover/ButtonWithPopover.stories.js.map +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js +0 -82
- package/dist/ButtonWithPopover/ButtonWithPopover.test.js.map +0 -1
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js +0 -2
- package/dist/ButtonWithPopover/ButtonWithPopover.types.js.map +0 -1
- package/dist/ButtonWithPopover/index.js +0 -2
- package/dist/ButtonWithPopover/index.js.map +0 -1
- package/dist/Checkbox/Checkbox.js +0 -26
- package/dist/Checkbox/Checkbox.js.map +0 -1
- package/dist/Checkbox/Checkbox.stories.js +0 -34
- package/dist/Checkbox/Checkbox.stories.js.map +0 -1
- package/dist/Checkbox/Checkbox.test.js +0 -94
- package/dist/Checkbox/Checkbox.test.js.map +0 -1
- package/dist/Checkbox/Checkbox.types.js +0 -2
- package/dist/Checkbox/Checkbox.types.js.map +0 -1
- package/dist/Checkbox/index.js +0 -2
- package/dist/Checkbox/index.js.map +0 -1
- package/dist/Icon/Icon.js +0 -55
- package/dist/Icon/Icon.js.map +0 -1
- package/dist/Icon/Icon.stories.js +0 -44
- package/dist/Icon/Icon.stories.js.map +0 -1
- package/dist/Icon/Icon.test.js +0 -55
- package/dist/Icon/Icon.test.js.map +0 -1
- package/dist/Icon/Icon.types.js +0 -16
- package/dist/Icon/Icon.types.js.map +0 -1
- package/dist/Icon/index.js +0 -2
- package/dist/Icon/index.js.map +0 -1
- package/dist/Modal/Modal.js +0 -100
- package/dist/Modal/Modal.js.map +0 -1
- package/dist/Modal/Modal.stories.js +0 -102
- package/dist/Modal/Modal.stories.js.map +0 -1
- package/dist/Modal/Modal.test.js +0 -108
- package/dist/Modal/Modal.test.js.map +0 -1
- package/dist/Modal/Modal.types.js +0 -2
- package/dist/Modal/Modal.types.js.map +0 -1
- package/dist/Modal/index.js +0 -2
- package/dist/Modal/index.js.map +0 -1
- package/dist/NewWorkbench/NewWorkbench.js +0 -48
- package/dist/NewWorkbench/NewWorkbench.js.map +0 -1
- package/dist/NewWorkbench/NewWorkbench.stories.js +0 -80
- package/dist/NewWorkbench/NewWorkbench.stories.js.map +0 -1
- package/dist/NewWorkbench/NewWorkbench.test.js +0 -73
- package/dist/NewWorkbench/NewWorkbench.test.js.map +0 -1
- package/dist/NewWorkbench/NewWorkbench.types.js +0 -2
- package/dist/NewWorkbench/NewWorkbench.types.js.map +0 -1
- package/dist/NewWorkbench/index.js +0 -2
- package/dist/NewWorkbench/index.js.map +0 -1
- package/dist/NewWorkbench/variants.js +0 -23
- package/dist/NewWorkbench/variants.js.map +0 -1
- package/dist/Select/Select.js +0 -171
- package/dist/Select/Select.js.map +0 -1
- package/dist/Select/Select.stories.js +0 -80
- package/dist/Select/Select.stories.js.map +0 -1
- package/dist/Select/Select.test.js +0 -182
- package/dist/Select/Select.test.js.map +0 -1
- package/dist/Select/Select.types.js +0 -2
- package/dist/Select/Select.types.js.map +0 -1
- package/dist/Select/index.js +0 -2
- package/dist/Select/index.js.map +0 -1
- package/dist/Tabs/Tabs.js +0 -22
- package/dist/Tabs/Tabs.js.map +0 -1
- package/dist/Tabs/Tabs.stories.js +0 -91
- package/dist/Tabs/Tabs.stories.js.map +0 -1
- package/dist/Tabs/Tabs.test.js +0 -91
- package/dist/Tabs/Tabs.test.js.map +0 -1
- package/dist/Tabs/Tabs.types.js +0 -2
- package/dist/Tabs/Tabs.types.js.map +0 -1
- package/dist/Tabs/index.js +0 -2
- package/dist/Tabs/index.js.map +0 -1
- package/dist/TextArea/TextArea.js +0 -23
- package/dist/TextArea/TextArea.js.map +0 -1
- package/dist/TextArea/TextArea.stories.js +0 -42
- package/dist/TextArea/TextArea.stories.js.map +0 -1
- package/dist/TextArea/TextArea.test.js +0 -68
- package/dist/TextArea/TextArea.test.js.map +0 -1
- package/dist/TextArea/TextArea.types.js +0 -2
- package/dist/TextArea/TextArea.types.js.map +0 -1
- package/dist/TextArea/index.js +0 -2
- package/dist/TextArea/index.js.map +0 -1
- package/dist/TextField/TextField.js +0 -66
- package/dist/TextField/TextField.js.map +0 -1
- package/dist/TextField/TextField.stories.js +0 -48
- package/dist/TextField/TextField.stories.js.map +0 -1
- package/dist/TextField/TextField.test.js +0 -35
- package/dist/TextField/TextField.test.js.map +0 -1
- package/dist/TextField/TextField.types.js +0 -2
- package/dist/TextField/TextField.types.js.map +0 -1
- package/dist/TextField/index.js +0 -2
- package/dist/TextField/index.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.js +0 -73
- package/dist/ToolbarButton/ToolbarButton.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.stories.js +0 -92
- package/dist/ToolbarButton/ToolbarButton.stories.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.test.js +0 -93
- package/dist/ToolbarButton/ToolbarButton.test.js.map +0 -1
- package/dist/ToolbarButton/ToolbarButton.types.js +0 -2
- package/dist/ToolbarButton/ToolbarButton.types.js.map +0 -1
- package/dist/ToolbarButton/index.js +0 -2
- package/dist/ToolbarButton/index.js.map +0 -1
- package/dist/Tooltip/QTip.stories.js +0 -40
- package/dist/Tooltip/QTip.stories.js.map +0 -1
- package/dist/Tooltip/QTip.types.js +0 -2
- package/dist/Tooltip/QTip.types.js.map +0 -1
- package/dist/Tooltip/QTipPerformance.stories.js +0 -30
- package/dist/Tooltip/QTipPerformance.stories.js.map +0 -1
- package/dist/Tooltip/Qtip.js +0 -158
- package/dist/Tooltip/Qtip.js.map +0 -1
- package/dist/Tooltip/Tooltip.js +0 -36
- package/dist/Tooltip/Tooltip.js.map +0 -1
- package/dist/Tooltip/Tooltip.stories.js +0 -32
- package/dist/Tooltip/Tooltip.stories.js.map +0 -1
- package/dist/Tooltip/Tooltip.types.js +0 -3
- package/dist/Tooltip/Tooltip.types.js.map +0 -1
- package/dist/Tooltip/TooltipPerformance.stories.js +0 -30
- package/dist/Tooltip/TooltipPerformance.stories.js.map +0 -1
- package/dist/Tooltip/index.js +0 -3
- package/dist/Tooltip/index.js.map +0 -1
- package/dist/Tooltip/qTip.utilities.js +0 -11
- package/dist/Tooltip/qTip.utilities.js.map +0 -1
- package/dist/types.js +0 -2
- package/dist/types.js.map +0 -1
- package/dist/utils/browserId.js +0 -29
- package/dist/utils/browserId.js.map +0 -1
package/dist/styles.css
CHANGED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export declare const SVG_PATH = "svgpath:";
|
|
2
|
+
/**
|
|
3
|
+
* Determines if an icon is SVG
|
|
4
|
+
*
|
|
5
|
+
* @param icon - an icon string that will either be an icon class or an SVG path definition (e.g. "fa fa-wrench" or
|
|
6
|
+
* "svgpath:M 17.0181 0 ...")
|
|
7
|
+
*/
|
|
8
|
+
export declare function isSvgIcon(icon: string): boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Retrieves the SVG path from an SVG icon
|
|
11
|
+
*
|
|
12
|
+
* @param icon - an SVG icon string including path definition (e.g. "svgpath:M 17.0181 0 ...")
|
|
13
|
+
* @returns the SVG icon path or an empty string if the supplied icon is not SVG
|
|
14
|
+
*/
|
|
15
|
+
export declare function getSvgIconPath(icon: string): string;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export const SVG_PATH = 'svgpath:';
|
|
2
|
+
/**
|
|
3
|
+
* Determines if an icon is SVG
|
|
4
|
+
*
|
|
5
|
+
* @param icon - an icon string that will either be an icon class or an SVG path definition (e.g. "fa fa-wrench" or
|
|
6
|
+
* "svgpath:M 17.0181 0 ...")
|
|
7
|
+
*/
|
|
8
|
+
export function isSvgIcon(icon) {
|
|
9
|
+
return icon.startsWith(SVG_PATH);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Retrieves the SVG path from an SVG icon
|
|
13
|
+
*
|
|
14
|
+
* @param icon - an SVG icon string including path definition (e.g. "svgpath:M 17.0181 0 ...")
|
|
15
|
+
* @returns the SVG icon path or an empty string if the supplied icon is not SVG
|
|
16
|
+
*/
|
|
17
|
+
export function getSvgIconPath(icon) {
|
|
18
|
+
return isSvgIcon(icon) ? icon.substring(SVG_PATH.length) : '';
|
|
19
|
+
}
|
|
20
|
+
//# sourceMappingURL=svg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"svg.js","sourceRoot":"","sources":["../../src/utils/svg.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,QAAQ,GAAG,UAAU,CAAC;AAEnC;;;;;GAKG;AACH,MAAM,UAAU,SAAS,CAAC,IAAY;IACpC,OAAO,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;AACnC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,cAAc,CAAC,IAAY;IACzC,OAAO,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;AAChE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Root, Item, Trigger, Content } from '@radix-ui/react-accordion';
|
|
3
|
-
const Accordion = ({ accordionItems, defaultValue, value, onItemSelect, disabled, extraClassNames, testId, }) => {
|
|
4
|
-
return (React.createElement(Root, { className: `tw-rounded-md tw-w-full focus-visible:tw-outline-none ${extraClassNames || ''}`, type: "single", defaultValue: defaultValue, value: value, collapsible: true, "data-testid": testId, onValueChange: (_value) => onItemSelect(_value) }, accordionItems.map((item) => (React.createElement(Item, { className: `tw-bg-transparent tw-p-0 tw-flex tw-flex-col tw-w-full`, key: item.value, disabled: disabled, value: item.value },
|
|
5
|
-
React.createElement(Trigger, { disabled: disabled, className: `tw-w-full tw-cursor-default focus-visible:tw-outline-none` }, item.trigger),
|
|
6
|
-
React.createElement(Content, { className: `data-[state=open]:tw-animate-slideDown data-[state=closed]:tw-animate-slideUp tw-overflow-hidden focus-visible:tw-outline-none ${item.contentClassNames || ''}` }, item.content))))));
|
|
7
|
-
};
|
|
8
|
-
export default Accordion;
|
|
9
|
-
//# sourceMappingURL=Accordion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.js","sourceRoot":"","sources":["../../src/Accordion/Accordion.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,2BAA2B,CAAC;AAGzE,MAAM,SAAS,GAA4C,CAAC,EAC1D,cAAc,EACd,YAAY,EACZ,KAAK,EACL,YAAY,EACZ,QAAQ,EACR,eAAe,EACf,MAAM,GACP,EAAE,EAAE;IACH,OAAO,CACL,oBAAC,IAAI,IACH,SAAS,EAAE,yDAAyD,eAAe,IAAI,EAAE,EAAE,EAC3F,IAAI,EAAC,QAAQ,EACb,YAAY,EAAE,YAAY,EAC1B,KAAK,EAAE,KAAK,EACZ,WAAW,uBACE,MAAM,EACnB,aAAa,EAAE,CAAC,MAAM,EAAE,EAAE,CAAC,YAAY,CAAC,MAAM,CAAC,IAC9C,cAAc,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAC5B,oBAAC,IAAI,IACH,SAAS,EAAE,wDAAwD,EACnE,GAAG,EAAE,IAAI,CAAC,KAAK,EACf,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,IAAI,CAAC,KAAK;QACjB,oBAAC,OAAO,IAAC,QAAQ,EAAE,QAAQ,EAAE,SAAS,EAAE,2DAA2D,IAChG,IAAI,CAAC,OAAO,CACL;QACV,oBAAC,OAAO,IACN,SAAS,EAAE,kIACT,IAAI,CAAC,iBAAiB,IAAI,EAC5B,EAAE,IACD,IAAI,CAAC,OAAO,CACL,CACL,CACR,CAAC,CACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Accordion from './Accordion';
|
|
3
|
-
import { QTip } from '../Tooltip/Qtip';
|
|
4
|
-
import Icon from '../Icon';
|
|
5
|
-
import Tabs from '../Tabs';
|
|
6
|
-
import Button from '../Button';
|
|
7
|
-
export default {
|
|
8
|
-
title: 'Accordion',
|
|
9
|
-
};
|
|
10
|
-
const Trigger = ({ label }) => (React.createElement("div", { className: "tw-flex tw-justify-start tw-items-center tw-border-b tw-px-2 tw-text-sq-color-dark" },
|
|
11
|
-
React.createElement(Icon, { icon: "fc-arrow-dropdown", extraClassNames: "tw-text-sq-color-dark tw-mr-[0.5rem] tw-text-[12px]", type: "text" }),
|
|
12
|
-
label));
|
|
13
|
-
const TriggerSecond = ({ label }) => (React.createElement("div", { className: "tw-flex tw-justify-between tw-items-center tw-border-b tw-px-2 tw-text-sq-color-dark tw-py-2" },
|
|
14
|
-
label,
|
|
15
|
-
React.createElement(Icon, { icon: "fc-arrow-dropdown", extraClassNames: "tw-text-sq-color-dark tw-mr-[0.5rem] tw-text-[12px]", type: "text" })));
|
|
16
|
-
const renderData = () => (React.createElement("div", { className: "tw-text-sq-color-gray dark:tw-text-sq-white" },
|
|
17
|
-
React.createElement("p", { className: "tw-mb-5 tw-text-[15px] tw-leading-normal" }, "This is a data tab to show details about your data. You can make changes to your account"),
|
|
18
|
-
React.createElement(Button, { variant: "outline", label: "Save data" })));
|
|
19
|
-
const renderTools = () => (React.createElement("div", { className: "tw-text-sq-color-gray dark:tw-text-sq-white" },
|
|
20
|
-
React.createElement("p", { className: "tw-mb-5 tw-text-[15px] tw-leading-normal" }, "Make changes to your account here. Click save when you're done."),
|
|
21
|
-
React.createElement(Button, { variant: "outline", label: "Save tools" })));
|
|
22
|
-
const renderJournal = () => (React.createElement("div", { className: "tw-text-sq-color-gray dark:tw-text-sq-white" },
|
|
23
|
-
React.createElement("p", { className: "tw-mb-5 tw-text-[15px] tw-leading-normal" }, "Make changes to your account here. Click save when you're done."),
|
|
24
|
-
React.createElement(Button, { variant: "outline", label: "Save journal" })));
|
|
25
|
-
const tabsList = [
|
|
26
|
-
{
|
|
27
|
-
id: 'data',
|
|
28
|
-
label: 'Data',
|
|
29
|
-
icon: 'fc-data',
|
|
30
|
-
content: renderData(),
|
|
31
|
-
},
|
|
32
|
-
{
|
|
33
|
-
id: 'tools',
|
|
34
|
-
label: 'Tools',
|
|
35
|
-
icon: 'fc-gears-2',
|
|
36
|
-
content: renderTools(),
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
id: 'journal',
|
|
40
|
-
label: 'Journal',
|
|
41
|
-
icon: 'fc-workbook-lock',
|
|
42
|
-
content: renderJournal(),
|
|
43
|
-
},
|
|
44
|
-
];
|
|
45
|
-
export const AllAccordionVariants = () => {
|
|
46
|
-
const [activeTab, setActiveTab] = React.useState('data');
|
|
47
|
-
const [value, setValue] = React.useState('oranges');
|
|
48
|
-
const accordionItems = [
|
|
49
|
-
{
|
|
50
|
-
value: 'oranges',
|
|
51
|
-
id: 'oranges',
|
|
52
|
-
itemTestId: 'oranges',
|
|
53
|
-
trigger: React.createElement(Trigger, { label: "Oranges" }),
|
|
54
|
-
content: (React.createElement("div", { className: "tw-p-2 tw-text-[13px] dark:tw-text-sq-white" }, "Oranges are the fruit of the citrus species Citrus \u00D7 sinensis in the family Rutaceae. They are also called sweet oranges to distinguish them from the related Citrus \u00D7 aurantium, referred to as bitter oranges. They are round and orange, and usually have a sour or bitter taste. Oranges are a good source of vitamin C.")),
|
|
55
|
-
},
|
|
56
|
-
{
|
|
57
|
-
value: 'apples',
|
|
58
|
-
id: 'apples',
|
|
59
|
-
itemTestId: 'apples',
|
|
60
|
-
trigger: React.createElement(Trigger, { label: "Apples" }),
|
|
61
|
-
content: (React.createElement("div", null,
|
|
62
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
63
|
-
React.createElement(Tabs, { stretchTabs: true, activeTab: activeTab, onTabSelect: setActiveTab, defaultActiveTab: "data", tabs: tabsList })))),
|
|
64
|
-
},
|
|
65
|
-
{
|
|
66
|
-
value: 'bananas',
|
|
67
|
-
id: 'bananas',
|
|
68
|
-
trigger: React.createElement(Trigger, { label: "Bananas" }),
|
|
69
|
-
itemTestId: 'bananas',
|
|
70
|
-
content: (React.createElement("div", null, "A banana is an elongated, edible fruit \u2013 botanically a berry \u2013 produced by several kinds of large herbaceous flowering plants in the genus Musa. In some countries, bananas used for cooking may be called \"plantains\", distinguishing them from dessert bananas. The fruit is variable in size, color, and firmness, but is usually elongated and curved, with soft flesh rich in starch covered with a rind, which may be green, yellow, red, purple, or brown when ripe.")),
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
value: 'pineapples',
|
|
74
|
-
id: 'pineapples',
|
|
75
|
-
trigger: React.createElement(Trigger, { label: "Pineapples" }),
|
|
76
|
-
itemTestId: 'pineapples',
|
|
77
|
-
content: (React.createElement("div", null, "The pineapple is a tropical plant with an edible fruit and the most economically significant plant in the family Bromeliaceae. The pineapple is indigenous to South America, where it has been cultivated for many centuries. The introduction of the pineapple to Europe in the 17th century made it a significant cultural icon of luxury. Since the 1820s, pineapple has been commercially grown in greenhouses and many tropical plantations.")),
|
|
78
|
-
},
|
|
79
|
-
];
|
|
80
|
-
const allAccordions = (isDark) => (React.createElement("div", { className: isDark ? 'tw-dark tw-bg-sq-dark-background' : '' },
|
|
81
|
-
React.createElement("div", { className: "tw-p-5 " },
|
|
82
|
-
React.createElement(Accordion, { accordionItems: isDark
|
|
83
|
-
? accordionItems
|
|
84
|
-
: accordionItems.map((item) => ({ ...item, trigger: React.createElement(TriggerSecond, { label: item.value.toUpperCase() }) })), value: value, testId: "basic-accordion1", onItemSelect: (value) => setValue(value) }))));
|
|
85
|
-
const renderAllVariations = (isDark) => React.createElement("div", { className: "tw-p-4" }, allAccordions(isDark));
|
|
86
|
-
return (React.createElement(React.Fragment, null,
|
|
87
|
-
React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
|
|
88
|
-
React.createElement(QTip, null),
|
|
89
|
-
React.createElement("div", { className: "color_topic" },
|
|
90
|
-
React.createElement("b", null, "Topic Colors"),
|
|
91
|
-
renderAllVariations()),
|
|
92
|
-
React.createElement("div", { className: "color_analysis" },
|
|
93
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
94
|
-
renderAllVariations()),
|
|
95
|
-
React.createElement("div", { className: "color_datalab" },
|
|
96
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
97
|
-
renderAllVariations()),
|
|
98
|
-
React.createElement("div", { className: "color_vantage" },
|
|
99
|
-
React.createElement("b", null, "Vantage Colors"),
|
|
100
|
-
renderAllVariations())),
|
|
101
|
-
React.createElement("div", { className: "tw-dark tw-bg-sq-dark-background tw-grid tw-grid-cols-4 tw-gap-4 tw-py-4" },
|
|
102
|
-
React.createElement("div", { className: "color_topic dark:tw-text-sq-white tw-text-center" },
|
|
103
|
-
React.createElement("b", null, "Topic Colors"),
|
|
104
|
-
renderAllVariations(true)),
|
|
105
|
-
React.createElement("div", { className: "color_analysis dark:tw-text-sq-white tw-text-center" },
|
|
106
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
107
|
-
renderAllVariations(true)),
|
|
108
|
-
React.createElement("div", { className: "color_datalab dark:tw-text-sq-white tw-text-center" },
|
|
109
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
110
|
-
renderAllVariations(true)),
|
|
111
|
-
React.createElement("div", { className: "color_vantage dark:tw-text-sq-white tw-text-center" },
|
|
112
|
-
React.createElement("b", null, "Vantage Colors"),
|
|
113
|
-
renderAllVariations(true)))));
|
|
114
|
-
};
|
|
115
|
-
//# sourceMappingURL=Accordion.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.stories.js","sourceRoot":"","sources":["../../src/Accordion/Accordion.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CACL;QACE,6BAAK,SAAS,EAAC,iCAAiC;YAC9C,oBAAC,IAAI,OAAG;YACR,6BAAK,SAAS,EAAC,aAAa;gBAC1B,8CAAmB;gBAClB,mBAAmB,EAAE,CAClB;YAEN,6BAAK,SAAS,EAAC,gBAAgB;gBAC7B,iDAAsB;gBACrB,mBAAmB,EAAE,CAClB;YAEN,6BAAK,SAAS,EAAC,eAAe;gBAC5B,gDAAqB;gBACpB,mBAAmB,EAAE,CAClB;YAEN,6BAAK,SAAS,EAAC,eAAe;gBAC5B,gDAAqB;gBACpB,mBAAmB,EAAE,CAClB,CACF;QACN,6BAAK,SAAS,EAAC,0EAA0E;YACvF,6BAAK,SAAS,EAAC,kDAAkD;gBAC/D,8CAAmB;gBAClB,mBAAmB,CAAC,IAAI,CAAC,CACtB;YAEN,6BAAK,SAAS,EAAC,qDAAqD;gBAClE,iDAAsB;gBACrB,mBAAmB,CAAC,IAAI,CAAC,CACtB;YAEN,6BAAK,SAAS,EAAC,oDAAoD;gBACjE,gDAAqB;gBACpB,mBAAmB,CAAC,IAAI,CAAC,CACtB;YAEN,6BAAK,SAAS,EAAC,oDAAoD;gBACjE,gDAAqB;gBACpB,mBAAmB,CAAC,IAAI,CAAC,CACtB,CACF,CACL,CACJ,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import '@testing-library/jest-dom';
|
|
3
|
-
import { render, screen } from '@testing-library/react';
|
|
4
|
-
import userEvent from '@testing-library/user-event';
|
|
5
|
-
import Accordion from './Accordion';
|
|
6
|
-
describe('Accordion', () => {
|
|
7
|
-
const mockOnItemSelect = jest.fn();
|
|
8
|
-
class Context {
|
|
9
|
-
testId = 'buttonTestId';
|
|
10
|
-
label = 'button label';
|
|
11
|
-
props = {
|
|
12
|
-
accordionItems: [
|
|
13
|
-
{
|
|
14
|
-
id: 'item1',
|
|
15
|
-
value: 'item1',
|
|
16
|
-
trigger: 'Item 1',
|
|
17
|
-
content: 'Content 1',
|
|
18
|
-
},
|
|
19
|
-
{
|
|
20
|
-
id: 'item2',
|
|
21
|
-
value: 'item2',
|
|
22
|
-
trigger: 'Item 2',
|
|
23
|
-
content: 'Content 2',
|
|
24
|
-
},
|
|
25
|
-
],
|
|
26
|
-
defaultValue: 'item1',
|
|
27
|
-
value: 'item1',
|
|
28
|
-
onItemSelect: (key) => mockOnItemSelect(key),
|
|
29
|
-
disabled: false,
|
|
30
|
-
extraClassNames: 'extra-class',
|
|
31
|
-
testId: this.testId,
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
let tc;
|
|
35
|
-
beforeEach(() => {
|
|
36
|
-
tc = new Context();
|
|
37
|
-
});
|
|
38
|
-
const renderAccordion = (props) => render(React.createElement(Accordion, { ...props }));
|
|
39
|
-
it('renders accordion items', () => {
|
|
40
|
-
renderAccordion(tc.props);
|
|
41
|
-
expect(screen.getByText('Item 1')).toBeInTheDocument();
|
|
42
|
-
expect(screen.getByText('Item 2')).toBeInTheDocument();
|
|
43
|
-
});
|
|
44
|
-
it('renders accordion content', () => {
|
|
45
|
-
renderAccordion(tc.props);
|
|
46
|
-
expect(screen.getByText('Content 1')).toBeInTheDocument();
|
|
47
|
-
expect(screen.queryByText('Content 2')).not.toBeInTheDocument();
|
|
48
|
-
});
|
|
49
|
-
it('calls onItemSelect when an item is selected', async () => {
|
|
50
|
-
renderAccordion(tc.props);
|
|
51
|
-
await userEvent.click(screen.getByText('Item 2'));
|
|
52
|
-
expect(mockOnItemSelect).toHaveBeenCalledWith('item2');
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
//# sourceMappingURL=Accordion.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.test.js","sourceRoot":"","sources":["../../src/Accordion/Accordion.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAA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CAAC,QAAQ,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;IACzD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2BAA2B,EAAE,GAAG,EAAE;QACnC,eAAe,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QAC1B,MAAM,CAAC,MAAM,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,iBAAiB,EAAE,CAAC;QAC1D,MAAM,CAAC,MAAM,CAAC,WAAW,CAAC,WAAW,CAAC,CAAC,CAAC,GAAG,CAAC,iBAAiB,EAAE,CAAC;IAClE,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,6CAA6C,EAAE,KAAK,IAAI,EAAE;QAC3D,eAAe,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QAC1B,MAAM,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC,CAAC,CAAC;QAClD,MAAM,CAAC,gBAAgB,CAAC,CAAC,oBAAoB,CAAC,OAAO,CAAC,CAAC;IACzD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Accordion.types.js","sourceRoot":"","sources":["../../src/Accordion/Accordion.types.ts"],"names":[],"mappings":""}
|
package/dist/Accordion/index.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Accordion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC"}
|
package/dist/Button/Button.js
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import '../styles.css';
|
|
3
|
-
import { browserIsFirefox } from '../utils/browserId';
|
|
4
|
-
import Icon from '../Icon';
|
|
5
|
-
import { DEFAULT_TOOL_TIP_DELAY } from '../Tooltip/Tooltip.types';
|
|
6
|
-
/**
|
|
7
|
-
* All-in-one Button:
|
|
8
|
-
* - use "variant" to achieve the desired style
|
|
9
|
-
* - include tooltips and/or icons
|
|
10
|
-
*/
|
|
11
|
-
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, }) => {
|
|
12
|
-
const baseClasses = 'tw-py-1 tw-px-2.5 tw-rounded-sm focus:tw-ring-0 disabled:tw-pointer-events-none';
|
|
13
|
-
const baseClassesByVariant = {
|
|
14
|
-
'outline': 'disabled:tw-opacity-50 tw-border-solid tw-border',
|
|
15
|
-
'theme': 'disabled:tw-opacity-50 tw-border-solid tw-border',
|
|
16
|
-
'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-opacity-50 tw-border-solid tw-border ' +
|
|
17
|
-
'tw-border-sq-danger-color hover:tw-border-sq-danger-color-hover',
|
|
18
|
-
'theme-light': 'disabled:tw-opacity-50 tw-border-solid tw-border',
|
|
19
|
-
'no-border': 'disabled:tw-opacity-50',
|
|
20
|
-
'warning': 'tw-bg-sq-warning-color tw-border-solid tw-border tw-border-sq-warning-color',
|
|
21
|
-
};
|
|
22
|
-
const textClassesByVariantLightTheme = {
|
|
23
|
-
'outline': 'tw-text-sq-text-color',
|
|
24
|
-
'theme': 'tw-text-white',
|
|
25
|
-
'theme-light': 'tw-text-white',
|
|
26
|
-
'danger': 'tw-text-white',
|
|
27
|
-
'no-border': 'tw-text-sq-text-color',
|
|
28
|
-
'warning': 'tw-text-white',
|
|
29
|
-
};
|
|
30
|
-
const textClassesByVariantDarkTheme = {
|
|
31
|
-
'outline': 'dark:tw-text-sq-dark-text',
|
|
32
|
-
'theme': 'dark:tw-text-white',
|
|
33
|
-
'theme-light': 'dark:tw-text-white',
|
|
34
|
-
'danger': 'dark:tw-text-white',
|
|
35
|
-
'no-border': 'dark:tw-text-sq-dark-text',
|
|
36
|
-
'warning': 'dark:tw-text-white',
|
|
37
|
-
};
|
|
38
|
-
const classesByVariantLightTheme = {
|
|
39
|
-
'outline': 'tw-bg-white dark:tw-bg-sq-dark-background tw-border-sq-disabled-gray hover:tw-bg-sq-light-gray' +
|
|
40
|
-
' focus:tw-bg-sq-dark-gray active:tw-bg-sq-dark-gray focus:tw-border-sq-color-dark active:tw-border-sq-color-dark',
|
|
41
|
-
'theme': 'tw-bg-sq-color-dark hover:tw-bg-sq-color-highlight tw-border-sq-color-dark' +
|
|
42
|
-
' hover:tw-border-sq-color-highlight',
|
|
43
|
-
'danger': '',
|
|
44
|
-
'theme-light': 'tw-bg-sq-icon hover:tw-bg-sq-link tw-border-sq-icon hover:tw-border-sq-link',
|
|
45
|
-
'no-border': '',
|
|
46
|
-
'warning': '',
|
|
47
|
-
};
|
|
48
|
-
const classesByVariantDarkTheme = {
|
|
49
|
-
'outline': 'dark:tw-border-sq-dark-disabled-gray dark:hover:tw-bg-sq-highlight-color-dark' +
|
|
50
|
-
' dark:focus:tw-bg-sq-multi-gray-dark dark:active:tw-bg-sq-multi-gray-dark dark:focus:tw-border-sq-color-dark' +
|
|
51
|
-
' dark:active:tw-border-sq-color-dark',
|
|
52
|
-
'theme': 'dark:tw-bg-sq-color-dark dark:hover:tw-bg-sq-color-highlight dark:tw-border-sq-color-dark' +
|
|
53
|
-
' dark:hover:tw-border-sq-color-highlight',
|
|
54
|
-
'danger': '',
|
|
55
|
-
'theme-light': 'dark:tw-bg-sq-icon-dark dark:hover:tw-bg-sq-link-dark dark:tw-border-sq-icon-dark' +
|
|
56
|
-
' dark:hover:tw-border-sq-link-dark',
|
|
57
|
-
'no-border': '',
|
|
58
|
-
'warning': '',
|
|
59
|
-
};
|
|
60
|
-
const sizeClasses = {
|
|
61
|
-
sm: 'tw-text-sm',
|
|
62
|
-
lg: 'tw-text-xl',
|
|
63
|
-
};
|
|
64
|
-
const appliedClasses = `${baseClasses} ${baseClassesByVariant[variant]} ${sizeClasses[size]} ${classesByVariantLightTheme[variant]} ${classesByVariantDarkTheme[variant]} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]} ${extraClassNames}`;
|
|
65
|
-
let tooltipData = undefined;
|
|
66
|
-
if (tooltip) {
|
|
67
|
-
tooltipData = {
|
|
68
|
-
'data-qtip-text': tooltip,
|
|
69
|
-
'data-qtip-placement': tooltipOptions?.position,
|
|
70
|
-
'data-qtip-is-html': isHtmlTooltip,
|
|
71
|
-
'data-qtip-testid': tooltipTestId,
|
|
72
|
-
'data-qtip-delay': tooltipOptions?.delay ?? DEFAULT_TOOL_TIP_DELAY,
|
|
73
|
-
};
|
|
74
|
-
}
|
|
75
|
-
const iconClass = (iconPosition === 'left' ? 'tw-mr-1' : 'tw-ml-1');
|
|
76
|
-
const iconElement = icon && (React.createElement(Icon, { icon: icon, iconPrefix: iconPrefix, type: iconStyle, color: iconColor, extraClassNames: label ? `${iconClass} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : '', testId: `${id}_spinner` }));
|
|
77
|
-
return (React.createElement("button", { id: id, ...tooltipData, disabled: disabled, "data-testid": testId, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
|
|
78
|
-
stopPropagation && e.stopPropagation();
|
|
79
|
-
onClick && onClick(e);
|
|
80
|
-
}, onMouseDown: (e) => {
|
|
81
|
-
if (preventBlur) {
|
|
82
|
-
e.preventDefault();
|
|
83
|
-
}
|
|
84
|
-
}, className: appliedClasses },
|
|
85
|
-
iconPosition === 'left' && iconElement,
|
|
86
|
-
label,
|
|
87
|
-
iconPosition === 'right' && iconElement));
|
|
88
|
-
};
|
|
89
|
-
export default Button;
|
|
90
|
-
//# sourceMappingURL=Button.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.js","sourceRoot":"","sources":["../../src/Button/Button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAA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I,EAAE,IAAI,EACV,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,SAAS,EACf,KAAK,EAAE,SAAS,EAChB,eAAe,EACb,KAAK,CAAC,CAAC,CAAC,GAAG,SAAS,IAAI,8BAA8B,CAAC,OAAO,CAAC,KAAK,6BAA6B,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,EAEnH,MAAM,EAAE,GAAG,EAAE,UAAU,GACvB,CACH,CAAC;IAEF,OAAO,CACL,gCACE,EAAE,EAAE,EAAE,KACF,WAAW,EACf,QAAQ,EAAE,QAAQ,iBACL,MAAM,EACnB,IAAI,EAAE,IAAI,KAAK,MAAM,IAAI,CAAC,IAAI,KAAK,QAAQ,IAAI,gBAAgB,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,EAClF,OAAO,EAAE,CAAC,CAAmB,EAAE,EAAE;YAC/B,eAAe,IAAI,CAAC,CAAC,eAAe,EAAE,CAAC;YACvC,OAAO,IAAI,OAAO,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC,EACD,WAAW,EAAE,CAAC,CAAC,EAAE,EAAE;YACjB,IAAI,WAAW,EAAE;gBACf,CAAC,CAAC,cAAc,EAAE,CAAC;aACpB;QACH,CAAC,EACD,SAAS,EAAE,cAAc;QACxB,YAAY,KAAK,MAAM,IAAI,WAAW;QACtC,KAAK;QACL,YAAY,KAAK,OAAO,IAAI,WAAW,CACjC,CACV,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,MAAM,CAAC"}
|
|
@@ -1,98 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Button from './Button';
|
|
3
|
-
import { buttonVariants } from './Button.types';
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Button',
|
|
6
|
-
};
|
|
7
|
-
export const AllButtonVariants = () => {
|
|
8
|
-
const renderAllVariations = () => (React.createElement(React.Fragment, null, buttonVariants.map((variant) => (React.createElement("div", { key: `{variant_${variant}`, className: "tw-grid tw-grid-cols-2 tw-gap-4" },
|
|
9
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
10
|
-
React.createElement(Button, { label: `Variant: ${variant}`, onClick: () => { }, variant: variant })),
|
|
11
|
-
React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
|
|
12
|
-
React.createElement(Button, { label: `Variant: ${variant}`, onClick: () => { }, variant: variant })))))));
|
|
13
|
-
return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
|
|
14
|
-
React.createElement("div", { className: "color_topic" },
|
|
15
|
-
React.createElement("b", null, "Topic Colors"),
|
|
16
|
-
renderAllVariations()),
|
|
17
|
-
React.createElement("div", { className: "color_analysis" },
|
|
18
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
19
|
-
renderAllVariations()),
|
|
20
|
-
React.createElement("div", { className: "color_datalab" },
|
|
21
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
22
|
-
renderAllVariations()),
|
|
23
|
-
React.createElement("div", { className: "color_vantage" },
|
|
24
|
-
React.createElement("b", null, "Vantage Colors"),
|
|
25
|
-
renderAllVariations())));
|
|
26
|
-
};
|
|
27
|
-
export const ButtonWithTooltip = () => {
|
|
28
|
-
const renderButtonWithTooltip = () => (React.createElement(React.Fragment, null,
|
|
29
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
30
|
-
React.createElement(Button, { tooltip: "Helpful tooltip", variant: "theme", label: "Hover me" })),
|
|
31
|
-
React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
|
|
32
|
-
React.createElement(Button, { tooltip: "Helpful tooltip", variant: "theme", label: "Hover me" }))));
|
|
33
|
-
return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
|
|
34
|
-
React.createElement("div", { className: "color_topic" },
|
|
35
|
-
React.createElement("b", null, "Topic Colors"),
|
|
36
|
-
renderButtonWithTooltip()),
|
|
37
|
-
React.createElement("div", { className: "color_analysis" },
|
|
38
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
39
|
-
renderButtonWithTooltip()),
|
|
40
|
-
React.createElement("div", { className: "color_datalab" },
|
|
41
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
42
|
-
renderButtonWithTooltip()),
|
|
43
|
-
React.createElement("div", { className: "color_vantage" },
|
|
44
|
-
React.createElement("b", null, "Vantage Colors"),
|
|
45
|
-
renderButtonWithTooltip())));
|
|
46
|
-
};
|
|
47
|
-
export const ButtonWithIcon = () => {
|
|
48
|
-
const renderButtonWithIcon = () => (React.createElement(React.Fragment, null,
|
|
49
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
50
|
-
React.createElement(Button, { icon: "fc-search-power", variant: "theme", label: "With Icon" })),
|
|
51
|
-
React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
|
|
52
|
-
React.createElement(Button, { icon: "fc-search-power", variant: "theme", label: "With Icon" }))));
|
|
53
|
-
const renderButtonWithIconOnRight = () => (React.createElement(React.Fragment, null,
|
|
54
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
55
|
-
React.createElement(Button, { icon: "fc-search-power", iconPosition: "right", variant: "theme", label: "With Icon On Right" })),
|
|
56
|
-
React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
|
|
57
|
-
React.createElement(Button, { icon: "fc-search-power", iconPosition: "right", variant: "theme", label: "With Icon On Right" }))));
|
|
58
|
-
return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
|
|
59
|
-
React.createElement("div", { className: "color_topic" },
|
|
60
|
-
React.createElement("b", null, "Topic Colors"),
|
|
61
|
-
renderButtonWithIcon()),
|
|
62
|
-
React.createElement("div", { className: "color_analysis" },
|
|
63
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
64
|
-
renderButtonWithIcon()),
|
|
65
|
-
React.createElement("div", { className: "color_datalab" },
|
|
66
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
67
|
-
renderButtonWithIcon()),
|
|
68
|
-
React.createElement("div", { className: "color_vantage" },
|
|
69
|
-
React.createElement("b", null, "Vantage Colors"),
|
|
70
|
-
renderButtonWithIcon()),
|
|
71
|
-
React.createElement("div", { className: "color_topic" }, renderButtonWithIconOnRight()),
|
|
72
|
-
React.createElement("div", { className: "color_analysis" }, renderButtonWithIconOnRight()),
|
|
73
|
-
React.createElement("div", { className: "color_datalab" }, renderButtonWithIconOnRight()),
|
|
74
|
-
React.createElement("div", { className: "color_vantage" }, renderButtonWithIconOnRight())));
|
|
75
|
-
};
|
|
76
|
-
export const DisabledButton = () => {
|
|
77
|
-
const renderDisabledButton = () => (React.createElement(React.Fragment, null,
|
|
78
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
79
|
-
React.createElement(Button, { disabled: true, variant: "theme", label: "Disabled Button" }),
|
|
80
|
-
React.createElement(Button, { extraClassNames: "tw-m-5", disabled: true, label: "Disabled Button" })),
|
|
81
|
-
React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
|
|
82
|
-
React.createElement(Button, { disabled: true, variant: "theme", label: "Disabled Button" }),
|
|
83
|
-
React.createElement(Button, { extraClassNames: "tw-m-5", disabled: true, label: "Disabled Button" }))));
|
|
84
|
-
return (React.createElement("div", { className: "tw-grid tw-grid-cols-4 tw-gap-4" },
|
|
85
|
-
React.createElement("div", { className: "color_topic" },
|
|
86
|
-
React.createElement("b", null, "Topic Colors"),
|
|
87
|
-
renderDisabledButton()),
|
|
88
|
-
React.createElement("div", { className: "color_analysis" },
|
|
89
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
90
|
-
renderDisabledButton()),
|
|
91
|
-
React.createElement("div", { className: "color_datalab" },
|
|
92
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
93
|
-
renderDisabledButton()),
|
|
94
|
-
React.createElement("div", { className: "color_vantage" },
|
|
95
|
-
React.createElement("b", null, "Vantage Colors"),
|
|
96
|
-
renderDisabledButton())));
|
|
97
|
-
};
|
|
98
|
-
//# sourceMapping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AC,eAAe,EAAC,QAAQ,EAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAC,iBAAiB,GAAG,CACvE;QACN,6BAAK,SAAS,EAAC,yCAAyC;YACtD,oBAAC,MAAM,IAAC,QAAQ,EAAE,IAAI,EAAE,OAAO,EAAC,OAAO,EAAC,KAAK,EAAC,iBAAiB,GAAG;YAClE,oBAAC,MAAM,IAAC,eAAe,EAAC,QAAQ,EAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,EAAC,iBAAiB,GAAG,CACvE,CACL,CACJ,CAAC;IACF,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,6BAAK,SAAS,EAAC,aAAa;YAC1B,8CAAmB;YAClB,oBAAoB,EAAE,CACnB;QAEN,6BAAK,SAAS,EAAC,gBAAgB;YAC7B,iDAAsB;YACrB,oBAAoB,EAAE,CACnB;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,oBAAoB,EAAE,CACnB;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,oBAAoB,EAAE,CACnB,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import '@testing-library/jest-dom';
|
|
3
|
-
import { render, screen } from '@testing-library/react';
|
|
4
|
-
import userEvent from '@testing-library/user-event';
|
|
5
|
-
import Button from './Button';
|
|
6
|
-
describe('Button', () => {
|
|
7
|
-
class Context {
|
|
8
|
-
testId = 'buttonTestId';
|
|
9
|
-
label = 'button label';
|
|
10
|
-
props = {
|
|
11
|
-
label: this.label,
|
|
12
|
-
onClick: jest.fn(),
|
|
13
|
-
testId: this.testId,
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
let tc;
|
|
17
|
-
beforeEach(() => {
|
|
18
|
-
tc = new Context();
|
|
19
|
-
});
|
|
20
|
-
const renderButton = (props) => render(React.createElement(Button, { ...props }));
|
|
21
|
-
it('renders button label', () => {
|
|
22
|
-
renderButton(tc.props);
|
|
23
|
-
expect(screen.getByText(tc.label)).toBeInTheDocument();
|
|
24
|
-
});
|
|
25
|
-
it('calls on click', async () => {
|
|
26
|
-
renderButton(tc.props);
|
|
27
|
-
await userEvent.click(screen.getByTestId(tc.testId));
|
|
28
|
-
expect(tc.props.onClick).toHaveBeenCalled();
|
|
29
|
-
});
|
|
30
|
-
it('renders disabled button', () => {
|
|
31
|
-
renderButton({ ...tc.props, disabled: true });
|
|
32
|
-
expect(screen.getByText(tc.label)).toBeDisabled();
|
|
33
|
-
});
|
|
34
|
-
it('respects stopPropagation default', async () => {
|
|
35
|
-
const callOnPropagation = jest.fn();
|
|
36
|
-
render(React.createElement("div", { onClick: callOnPropagation },
|
|
37
|
-
React.createElement(Button, { ...tc.props })));
|
|
38
|
-
await userEvent.click(screen.getByTestId(tc.testId));
|
|
39
|
-
expect(callOnPropagation).not.toHaveBeenCalled();
|
|
40
|
-
});
|
|
41
|
-
it('propagates click event if not told not to', async () => {
|
|
42
|
-
const callOnPropagation = jest.fn();
|
|
43
|
-
render(React.createElement("div", { onClick: callOnPropagation },
|
|
44
|
-
React.createElement(Button, { ...{ ...tc.props, stopPropagation: false } })));
|
|
45
|
-
await userEvent.click(screen.getByTestId(tc.testId));
|
|
46
|
-
expect(callOnPropagation).toHaveBeenCalled();
|
|
47
|
-
});
|
|
48
|
-
});
|
|
49
|
-
//# sourceMappingURL=Button.test.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.test.js","sourceRoot":"","sources":["../../src/Button/Button.test.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,2BAA2B,CAAC;AACnC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,SAAS,MAAM,6BAA6B,CAAC;AAEpD,OAAO,MAAM,MAAM,UAAU,CAAC;AAG9B,QAAQ,CA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CAAC;IACpD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,kCAAkC,EAAE,KAAK,IAAI,EAAE;QAChD,MAAM,iBAAiB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,CACJ,6BAAK,OAAO,EAAE,iBAAiB;YAC7B,oBAAC,MAAM,OAAK,EAAE,CAAC,KAAK,GAAI,CACpB,CACP,CAAC;QACF,MAAM,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACrD,MAAM,CAAC,iBAAiB,CAAC,CAAC,GAAG,CAAC,gBAAgB,EAAE,CAAC;IACnD,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,2CAA2C,EAAE,KAAK,IAAI,EAAE;QACzD,MAAM,iBAAiB,GAAG,IAAI,CAAC,EAAE,EAAE,CAAC;QACpC,MAAM,CACJ,6BAAK,OAAO,EAAE,iBAAiB;YAC7B,oBAAC,MAAM,OAAK,EAAE,GAAG,EAAE,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,GAAI,CACnD,CACP,CAAC;QACF,MAAM,SAAS,CAAC,KAAK,CAAC,MAAM,CAAC,WAAW,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;QACrD,MAAM,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,EAAE,CAAC;IAC/C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export const buttonTypes = ['button', 'reset', 'submit', 'link'];
|
|
2
|
-
export const buttonSizes = ['sm', 'lg'];
|
|
3
|
-
export const buttonVariants = ['outline', 'theme', 'theme-light', 'warning', 'danger', 'no-border'];
|
|
4
|
-
export const iconPositions = ['left', 'right'];
|
|
5
|
-
//# sourceMappingURL=Button.types.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.types.js","sourceRoot":"","sources":["../../src/Button/Button.types.ts"],"names":[],"mappings":"AAIA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,CAAU,CAAC;AAC1E,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,IAAI,EAAE,IAAI,CAAU,CAAC;AACjD,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,SAAS,EAAE,OAAO,EAAE,aAAa,EAAE,SAAS,EAAE,QAAQ,EAAE,WAAW,CAAU,CAAC;AAC7G,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC"}
|
package/dist/Button/index.js
DELETED
package/dist/Button/index.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/Button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,UAAU,CAAC"}
|