@seeqdev/qomponents 0.0.2 → 0.0.3
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/Checkbox/Checkbox.d.ts +7 -0
- package/dist/Checkbox/Checkbox.stories.d.ts +5 -0
- package/dist/Checkbox/Checkbox.test.d.ts +1 -0
- package/dist/Checkbox/Checkbox.types.d.ts +15 -0
- package/dist/Checkbox/index.d.ts +1 -0
- package/dist/TextArea/TextArea.d.ts +7 -0
- package/dist/TextArea/TextArea.stories.d.ts +5 -0
- package/dist/TextArea/TextArea.test.d.ts +1 -0
- package/dist/TextArea/TextArea.types.d.ts +26 -0
- package/dist/TextArea/index.d.ts +1 -0
- package/dist/TextField/TextField.types.d.ts +0 -2
- package/dist/index.d.ts +4 -0
- package/dist/index.esm.js +35 -1
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +36 -0
- package/dist/index.js.map +1 -1
- package/dist/sharedTypes.d.ts +1 -0
- package/dist/styles.css +160 -0
- package/package.json +2 -1
- package/dist/Button/Button.js +0 -71
- package/dist/Button/Button.js.map +0 -1
- package/dist/Button/Button.stories.js +0 -58
- 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 -4
- 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/Icon/Icon.js +0 -54
- package/dist/Icon/Icon.js.map +0 -1
- package/dist/Icon/Icon.stories.js +0 -40
- 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/TextField/TextField.js +0 -47
- package/dist/TextField/TextField.js.map +0 -1
- package/dist/TextField/TextField.stories.js +0 -33
- 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/Tooltip/Tooltip.js +0 -30
- 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/index.js +0 -2
- package/dist/Tooltip/index.js.map +0 -1
- package/dist/utils/browserId.js +0 -29
- package/dist/utils/browserId.js.map +0 -1
package/dist/styles.css
CHANGED
|
@@ -1602,6 +1602,84 @@ video {
|
|
|
1602
1602
|
--tw-backdrop-sepia: ;
|
|
1603
1603
|
}
|
|
1604
1604
|
|
|
1605
|
+
.tw-form-checkbox,.tw-form-radio {
|
|
1606
|
+
-webkit-appearance: none;
|
|
1607
|
+
-moz-appearance: none;
|
|
1608
|
+
appearance: none;
|
|
1609
|
+
padding: 0;
|
|
1610
|
+
-webkit-print-color-adjust: exact;
|
|
1611
|
+
print-color-adjust: exact;
|
|
1612
|
+
display: inline-block;
|
|
1613
|
+
vertical-align: middle;
|
|
1614
|
+
background-origin: border-box;
|
|
1615
|
+
-webkit-user-select: none;
|
|
1616
|
+
-moz-user-select: none;
|
|
1617
|
+
user-select: none;
|
|
1618
|
+
flex-shrink: 0;
|
|
1619
|
+
height: 1rem;
|
|
1620
|
+
width: 1rem;
|
|
1621
|
+
color: #2563eb;
|
|
1622
|
+
background-color: #fff;
|
|
1623
|
+
border-color: #6b7280;
|
|
1624
|
+
border-width: 1px;
|
|
1625
|
+
--tw-shadow: 0 0 #0000;
|
|
1626
|
+
}
|
|
1627
|
+
|
|
1628
|
+
.tw-form-checkbox {
|
|
1629
|
+
border-radius: 0px;
|
|
1630
|
+
}
|
|
1631
|
+
|
|
1632
|
+
.tw-form-radio {
|
|
1633
|
+
border-radius: 100%;
|
|
1634
|
+
}
|
|
1635
|
+
|
|
1636
|
+
.tw-form-checkbox:focus,.tw-form-radio:focus {
|
|
1637
|
+
outline: 2px solid transparent;
|
|
1638
|
+
outline-offset: 2px;
|
|
1639
|
+
--tw-ring-inset: var(--tw-empty,/*!*/ /*!*/);
|
|
1640
|
+
--tw-ring-offset-width: 2px;
|
|
1641
|
+
--tw-ring-offset-color: #fff;
|
|
1642
|
+
--tw-ring-color: #2563eb;
|
|
1643
|
+
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
1644
|
+
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(2px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
1645
|
+
box-shadow: var(--tw-ring-offset-shadow), var(--tw-ring-shadow), var(--tw-shadow);
|
|
1646
|
+
}
|
|
1647
|
+
|
|
1648
|
+
.tw-form-checkbox:checked,.tw-form-radio:checked {
|
|
1649
|
+
border-color: transparent;
|
|
1650
|
+
background-color: currentColor;
|
|
1651
|
+
background-size: 100% 100%;
|
|
1652
|
+
background-position: center;
|
|
1653
|
+
background-repeat: no-repeat;
|
|
1654
|
+
}
|
|
1655
|
+
|
|
1656
|
+
.tw-form-checkbox:checked {
|
|
1657
|
+
background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3cpath d='M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z'/%3e%3c/svg%3e");
|
|
1658
|
+
}
|
|
1659
|
+
|
|
1660
|
+
.tw-form-radio:checked {
|
|
1661
|
+
background-image: url("data:image/svg+xml,%3csvg viewBox='0 0 16 16' fill='white' xmlns='http://www.w3.org/2000/svg'%3e%3ccircle cx='8' cy='8' r='3'/%3e%3c/svg%3e");
|
|
1662
|
+
}
|
|
1663
|
+
|
|
1664
|
+
.tw-form-checkbox:checked:hover,.tw-form-checkbox:checked:focus,.tw-form-radio:checked:hover,.tw-form-radio:checked:focus {
|
|
1665
|
+
border-color: transparent;
|
|
1666
|
+
background-color: currentColor;
|
|
1667
|
+
}
|
|
1668
|
+
|
|
1669
|
+
.tw-form-checkbox:indeterminate {
|
|
1670
|
+
background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 16 16'%3e%3cpath stroke='white' stroke-linecap='round' stroke-linejoin='round' stroke-width='2' d='M4 8h8'/%3e%3c/svg%3e");
|
|
1671
|
+
border-color: transparent;
|
|
1672
|
+
background-color: currentColor;
|
|
1673
|
+
background-size: 100% 100%;
|
|
1674
|
+
background-position: center;
|
|
1675
|
+
background-repeat: no-repeat;
|
|
1676
|
+
}
|
|
1677
|
+
|
|
1678
|
+
.tw-form-checkbox:indeterminate:hover,.tw-form-checkbox:indeterminate:focus {
|
|
1679
|
+
border-color: transparent;
|
|
1680
|
+
background-color: currentColor;
|
|
1681
|
+
}
|
|
1682
|
+
|
|
1605
1683
|
.tw-absolute {
|
|
1606
1684
|
position: absolute;
|
|
1607
1685
|
}
|
|
@@ -1638,6 +1716,14 @@ video {
|
|
|
1638
1716
|
z-index: 50;
|
|
1639
1717
|
}
|
|
1640
1718
|
|
|
1719
|
+
.tw-ml-1 {
|
|
1720
|
+
margin-left: 0.25rem;
|
|
1721
|
+
}
|
|
1722
|
+
|
|
1723
|
+
.tw-ml-1\.5 {
|
|
1724
|
+
margin-left: 0.375rem;
|
|
1725
|
+
}
|
|
1726
|
+
|
|
1641
1727
|
.tw-mr-1 {
|
|
1642
1728
|
margin-right: 0.25rem;
|
|
1643
1729
|
}
|
|
@@ -1646,6 +1732,10 @@ video {
|
|
|
1646
1732
|
display: inline-block;
|
|
1647
1733
|
}
|
|
1648
1734
|
|
|
1735
|
+
.tw-flex {
|
|
1736
|
+
display: flex;
|
|
1737
|
+
}
|
|
1738
|
+
|
|
1649
1739
|
.tw-grid {
|
|
1650
1740
|
display: grid;
|
|
1651
1741
|
}
|
|
@@ -1654,6 +1744,22 @@ video {
|
|
|
1654
1744
|
display: none;
|
|
1655
1745
|
}
|
|
1656
1746
|
|
|
1747
|
+
.tw-h-3 {
|
|
1748
|
+
height: 0.75rem;
|
|
1749
|
+
}
|
|
1750
|
+
|
|
1751
|
+
.tw-h-3\.5 {
|
|
1752
|
+
height: 0.875rem;
|
|
1753
|
+
}
|
|
1754
|
+
|
|
1755
|
+
.tw-w-3 {
|
|
1756
|
+
width: 0.75rem;
|
|
1757
|
+
}
|
|
1758
|
+
|
|
1759
|
+
.tw-w-3\.5 {
|
|
1760
|
+
width: 0.875rem;
|
|
1761
|
+
}
|
|
1762
|
+
|
|
1657
1763
|
.-tw-translate-x-1\/2 {
|
|
1658
1764
|
--tw-translate-x: -50%;
|
|
1659
1765
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
@@ -1684,6 +1790,14 @@ video {
|
|
|
1684
1790
|
transform: translate(var(--tw-translate-x), var(--tw-translate-y)) rotate(var(--tw-rotate)) skewX(var(--tw-skew-x)) skewY(var(--tw-skew-y)) scaleX(var(--tw-scale-x)) scaleY(var(--tw-scale-y));
|
|
1685
1791
|
}
|
|
1686
1792
|
|
|
1793
|
+
.tw-cursor-not-allowed {
|
|
1794
|
+
cursor: not-allowed;
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
.tw-cursor-pointer {
|
|
1798
|
+
cursor: pointer;
|
|
1799
|
+
}
|
|
1800
|
+
|
|
1687
1801
|
.tw-grid-cols-2 {
|
|
1688
1802
|
grid-template-columns: repeat(2, minmax(0, 1fr));
|
|
1689
1803
|
}
|
|
@@ -1696,6 +1810,10 @@ video {
|
|
|
1696
1810
|
grid-template-columns: repeat(4, minmax(0, 1fr));
|
|
1697
1811
|
}
|
|
1698
1812
|
|
|
1813
|
+
.tw-items-center {
|
|
1814
|
+
align-items: center;
|
|
1815
|
+
}
|
|
1816
|
+
|
|
1699
1817
|
.tw-gap-4 {
|
|
1700
1818
|
gap: 1rem;
|
|
1701
1819
|
}
|
|
@@ -1878,6 +1996,14 @@ video {
|
|
|
1878
1996
|
|
|
1879
1997
|
/* Make sure to keep these colors in sync with the webserver/_custom_variables.scss values to ensure cohesive UIs */
|
|
1880
1998
|
|
|
1999
|
+
[type='checkbox']:checked, [type='radio']:checked {
|
|
2000
|
+
background-image: url('data:image/svg+xml,<svg viewBox="0 0 16 16" fill="white" xmlns="http://www.w3.org/2000/svg"><path d="M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z"/></svg>');
|
|
2001
|
+
}
|
|
2002
|
+
|
|
2003
|
+
.tw-dark [type='checkbox']:checked, .tw-dark [type='radio']:checked {
|
|
2004
|
+
background-image: url('data:image/svg+xml,<svg viewBox="0 0 16 16" fill="black" xmlns="http://www.w3.org/2000/svg"><path d="M12.207 4.793a1 1 0 010 1.414l-5 5a1 1 0 01-1.414 0l-2-2a1 1 0 011.414-1.414L6.5 9.086l4.293-4.293a1 1 0 011.414 0z"/></svg>');
|
|
2005
|
+
}
|
|
2006
|
+
|
|
1881
2007
|
.before\:tw-absolute::before {
|
|
1882
2008
|
content: var(--tw-content);
|
|
1883
2009
|
position: absolute;
|
|
@@ -1985,6 +2111,11 @@ video {
|
|
|
1985
2111
|
content: var(--tw-content);
|
|
1986
2112
|
}
|
|
1987
2113
|
|
|
2114
|
+
.checked\:tw-text-sq-text-color:checked {
|
|
2115
|
+
--tw-text-opacity: 1;
|
|
2116
|
+
color: rgba(var(--sq-text-color), var(--tw-text-opacity));
|
|
2117
|
+
}
|
|
2118
|
+
|
|
1988
2119
|
.hover\:tw-bg-sq-color-highlight:hover {
|
|
1989
2120
|
--tw-bg-opacity: 1;
|
|
1990
2121
|
background-color: rgba(var(--sq-color-highlight), var(--tw-bg-opacity));
|
|
@@ -2015,6 +2146,11 @@ video {
|
|
|
2015
2146
|
background-color: rgba(var(--sq-dark-gray), var(--tw-bg-opacity));
|
|
2016
2147
|
}
|
|
2017
2148
|
|
|
2149
|
+
.focus\:tw-outline-none:focus {
|
|
2150
|
+
outline: 2px solid transparent;
|
|
2151
|
+
outline-offset: 2px;
|
|
2152
|
+
}
|
|
2153
|
+
|
|
2018
2154
|
.focus\:tw-ring-0:focus {
|
|
2019
2155
|
--tw-ring-offset-shadow: var(--tw-ring-inset) 0 0 0 var(--tw-ring-offset-width) var(--tw-ring-offset-color);
|
|
2020
2156
|
--tw-ring-shadow: var(--tw-ring-inset) 0 0 0 calc(0px + var(--tw-ring-offset-width)) var(--tw-ring-color);
|
|
@@ -2022,6 +2158,10 @@ video {
|
|
|
2022
2158
|
--tw-ring-color: r;
|
|
2023
2159
|
}
|
|
2024
2160
|
|
|
2161
|
+
.focus\:tw-ring-offset-0:focus {
|
|
2162
|
+
--tw-ring-offset-width: 0px;
|
|
2163
|
+
}
|
|
2164
|
+
|
|
2025
2165
|
.active\:tw-border-sq-color-dark:active {
|
|
2026
2166
|
--tw-border-opacity: 1;
|
|
2027
2167
|
border-color: rgba(var(--sq-color-dark), var(--tw-border-opacity));
|
|
@@ -2044,6 +2184,11 @@ video {
|
|
|
2044
2184
|
--tw-bg-opacity: 0.5;
|
|
2045
2185
|
}
|
|
2046
2186
|
|
|
2187
|
+
.disabled\:tw-text-sq-fairly-dark-gray:disabled {
|
|
2188
|
+
--tw-text-opacity: 1;
|
|
2189
|
+
color: rgba(var(--sq-fairly-dark-gray), var(--tw-text-opacity));
|
|
2190
|
+
}
|
|
2191
|
+
|
|
2047
2192
|
.tw-group:hover .group-hover\:tw-inline-block {
|
|
2048
2193
|
display: inline-block;
|
|
2049
2194
|
}
|
|
@@ -2057,6 +2202,11 @@ video {
|
|
|
2057
2202
|
border-color: rgba(var(--sq-dark-disabled-gray), var(--tw-border-opacity));
|
|
2058
2203
|
}
|
|
2059
2204
|
|
|
2205
|
+
.tw-dark .dark\:tw-border-sq-dark-text {
|
|
2206
|
+
--tw-border-opacity: 1;
|
|
2207
|
+
border-color: rgba(var(--sq-dark-text), var(--tw-border-opacity));
|
|
2208
|
+
}
|
|
2209
|
+
|
|
2060
2210
|
.tw-dark .dark\:tw-bg-sq-color-dark {
|
|
2061
2211
|
--tw-bg-opacity: 1;
|
|
2062
2212
|
background-color: rgba(var(--sq-color-dark), var(--tw-bg-opacity));
|
|
@@ -2087,6 +2237,11 @@ video {
|
|
|
2087
2237
|
color: rgba(var(--sq-dark-text), var(--tw-text-opacity));
|
|
2088
2238
|
}
|
|
2089
2239
|
|
|
2240
|
+
.tw-dark .dark\:tw-text-sq-fairly-dark-gray {
|
|
2241
|
+
--tw-text-opacity: 1;
|
|
2242
|
+
color: rgba(var(--sq-fairly-dark-gray), var(--tw-text-opacity));
|
|
2243
|
+
}
|
|
2244
|
+
|
|
2090
2245
|
.tw-dark .dark\:tw-text-sq-link-dark {
|
|
2091
2246
|
--tw-text-opacity: 1;
|
|
2092
2247
|
color: rgba(var(--sq-link-dark), var(--tw-text-opacity));
|
|
@@ -2097,6 +2252,11 @@ video {
|
|
|
2097
2252
|
color: rgb(255 255 255 / var(--tw-text-opacity));
|
|
2098
2253
|
}
|
|
2099
2254
|
|
|
2255
|
+
.tw-dark .dark\:checked\:tw-bg-sq-dark-text:checked {
|
|
2256
|
+
--tw-bg-opacity: 1;
|
|
2257
|
+
background-color: rgba(var(--sq-dark-text), var(--tw-bg-opacity));
|
|
2258
|
+
}
|
|
2259
|
+
|
|
2100
2260
|
.tw-dark .dark\:hover\:tw-bg-sq-color-highlight:hover {
|
|
2101
2261
|
--tw-bg-opacity: 1;
|
|
2102
2262
|
background-color: rgba(var(--sq-color-highlight), var(--tw-bg-opacity));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@seeqdev/qomponents",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"main": "dist/index.js",
|
|
5
5
|
"module": "dist/index.esm.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"@ladle/react": "2.9.0",
|
|
37
37
|
"@rollup/plugin-commonjs": "24.0.1",
|
|
38
38
|
"@rollup/plugin-node-resolve": "15.0.1",
|
|
39
|
+
"@tailwindcss/forms": "0.5.3",
|
|
39
40
|
"@testing-library/jest-dom": "5.16.5",
|
|
40
41
|
"@testing-library/react": "14.0.0",
|
|
41
42
|
"@testing-library/user-event": "14.4.3",
|
package/dist/Button/Button.js
DELETED
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import '../styles.css';
|
|
3
|
-
import { browserIsFirefox } from '../utils/browserId';
|
|
4
|
-
import Tooltip from '../Tooltip';
|
|
5
|
-
import Icon from '../Icon';
|
|
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, }) => {
|
|
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': 'tw-border-solid tw-border',
|
|
15
|
-
'theme': 'disabled:tw-bg-opacity-50',
|
|
16
|
-
'danger': 'tw-bg-sq-danger-color hover:tw-bg-sq-danger-color-hover disabled:tw-bg-opacity-50',
|
|
17
|
-
'theme-light': 'disabled:tw-bg-opacity-50',
|
|
18
|
-
'no-border': '',
|
|
19
|
-
'warning': 'tw-bg-sq-warning-color',
|
|
20
|
-
};
|
|
21
|
-
const textClassesByVariantLightTheme = {
|
|
22
|
-
'outline': 'tw-text-sq-text-color',
|
|
23
|
-
'theme': 'tw-text-white',
|
|
24
|
-
'theme-light': 'tw-text-white',
|
|
25
|
-
'danger': 'tw-text-white',
|
|
26
|
-
'no-border': 'tw-text-sq-text-color',
|
|
27
|
-
'warning': 'tw-text-white',
|
|
28
|
-
};
|
|
29
|
-
const textClassesByVariantDarkTheme = {
|
|
30
|
-
'outline': 'dark:tw-text-sq-dark-text',
|
|
31
|
-
'theme': 'dark:tw-text-white',
|
|
32
|
-
'theme-light': 'dark:tw-text-white',
|
|
33
|
-
'danger': 'dark:tw-text-white',
|
|
34
|
-
'no-border': 'dark:tw-text-sq-dark-text',
|
|
35
|
-
'warning': 'dark:tw-text-white',
|
|
36
|
-
};
|
|
37
|
-
const classesByVariantLightTheme = {
|
|
38
|
-
'outline': 'tw-border-sq-disabled-gray hover:tw-bg-sq-light-gray' +
|
|
39
|
-
' focus:tw-bg-sq-dark-gray active:tw-bg-sq-dark-gray focus:tw-border-sq-color-dark active:tw-border-sq-color-dark',
|
|
40
|
-
'theme': 'tw-bg-sq-color-dark hover:tw-bg-sq-color-highlight',
|
|
41
|
-
'danger': '',
|
|
42
|
-
'theme-light': 'tw-bg-sq-icon hover:tw-bg-sq-link',
|
|
43
|
-
'no-border': '',
|
|
44
|
-
'warning': 'tw-bg-sq-warning-color',
|
|
45
|
-
};
|
|
46
|
-
const classesByVariantDarkTheme = {
|
|
47
|
-
'outline': 'dark:tw-border-sq-dark-disabled-gray dark:hover:tw-bg-sq-highlight-color-dark' +
|
|
48
|
-
' dark:focus:tw-bg-sq-dark-gray dark:active:tw-bg-sq-dark-gray dark:focus:tw-border-sq-color-dark' +
|
|
49
|
-
' dark:active:tw-border-sq-color-dark',
|
|
50
|
-
'theme': 'dark:tw-bg-sq-color-dark dark:hover:tw-bg-sq-color-highlight',
|
|
51
|
-
'danger': '',
|
|
52
|
-
'theme-light': 'dark:tw-bg-sq-icon-dark dark:hover:tw-bg-sq-link-dark',
|
|
53
|
-
'no-border': '',
|
|
54
|
-
'warning': '',
|
|
55
|
-
};
|
|
56
|
-
const sizeClasses = {
|
|
57
|
-
sm: 'tw-text-sm',
|
|
58
|
-
lg: 'tw-text-xl',
|
|
59
|
-
};
|
|
60
|
-
const appliedClasses = `${baseClasses} ${baseClassesByVariant[variant]} ${sizeClasses[size]} ${classesByVariantLightTheme[variant]} ${classesByVariantDarkTheme[variant]} ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]} ${extraClassNames}`;
|
|
61
|
-
const button = (React.createElement("button", { id: id, disabled: disabled, "data-testid": testId, type: type === 'link' || (type === 'submit' && browserIsFirefox) ? 'button' : type, onClick: (e) => {
|
|
62
|
-
stopPropagation && e.stopPropagation();
|
|
63
|
-
onClick && onClick();
|
|
64
|
-
}, className: appliedClasses },
|
|
65
|
-
icon && (React.createElement(Icon, { icon: icon, type: iconStyle, color: iconColor, extraClassNames: label ?
|
|
66
|
-
`tw-mr-1 ${textClassesByVariantLightTheme[variant]} ${textClassesByVariantDarkTheme[variant]}` : '', testId: `${id}_spinner` })),
|
|
67
|
-
label));
|
|
68
|
-
return tooltip ? (React.createElement(Tooltip, { text: tooltip, ...tooltipOptions }, button)) : (button);
|
|
69
|
-
};
|
|
70
|
-
export default Button;
|
|
71
|
-
//# 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,OAAO,CAAC;AAE1B,OAAO,eAAe,CAAC;AACvB,OAAO,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AACtD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OAAO,CAAC,CAAC,CAAC,CACf,oBAAC,OAAO,IAAC,IAAI,EAAE,OAAO,KAAM,cAAc,IACvC,MAAM,CACC,CACX,CAAC,CAAC,CAAC,CACF,MAAM,CACP,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,MAAM,CAAC"}
|
|
@@ -1,58 +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-3 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
|
-
};
|
|
24
|
-
export const ButtonWithTooltip = () => {
|
|
25
|
-
const renderButtonWithTooltip = () => (React.createElement(React.Fragment, null,
|
|
26
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
27
|
-
React.createElement(Button, { tooltip: "Helpful tooltip", variant: "theme", label: "Hover me" })),
|
|
28
|
-
React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
|
|
29
|
-
React.createElement(Button, { tooltip: "Helpful tooltip", variant: "theme", label: "Hover me" }))));
|
|
30
|
-
return (React.createElement("div", { className: "tw-grid tw-grid-cols-3 tw-gap-4" },
|
|
31
|
-
React.createElement("div", { className: "color_topic" },
|
|
32
|
-
React.createElement("b", null, "Topic Colors"),
|
|
33
|
-
renderButtonWithTooltip()),
|
|
34
|
-
React.createElement("div", { className: "color_analysis" },
|
|
35
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
36
|
-
renderButtonWithTooltip()),
|
|
37
|
-
React.createElement("div", { className: "color_datalab" },
|
|
38
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
39
|
-
renderButtonWithTooltip())));
|
|
40
|
-
};
|
|
41
|
-
export const ButtonWithIcon = () => {
|
|
42
|
-
const renderButtonWithIcon = () => (React.createElement(React.Fragment, null,
|
|
43
|
-
React.createElement("div", { className: "tw-p-4" },
|
|
44
|
-
React.createElement(Button, { icon: "fc-search-power", variant: "theme", label: "With Icon" })),
|
|
45
|
-
React.createElement("div", { className: "tw-p-4 tw-dark tw-bg-sq-dark-background" },
|
|
46
|
-
React.createElement(Button, { icon: "fc-search-power", variant: "theme", label: "With Icon" }))));
|
|
47
|
-
return (React.createElement("div", { className: "tw-grid tw-grid-cols-3 tw-gap-4" },
|
|
48
|
-
React.createElement("div", { className: "color_topic" },
|
|
49
|
-
React.createElement("b", null, "Topic Colors"),
|
|
50
|
-
renderButtonWithIcon()),
|
|
51
|
-
React.createElement("div", { className: "color_analysis" },
|
|
52
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
53
|
-
renderButtonWithIcon()),
|
|
54
|
-
React.createElement("div", { className: "color_datalab" },
|
|
55
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
56
|
-
renderButtonWithIcon())));
|
|
57
|
-
};
|
|
58
|
-
//# sourceMappingURL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,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,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,MAAM,OAAO;QACX,MAAM,GAAG,cAAc,CAAC;QACxB,KAAK,GAAG,cAAc,CAAC;QACvB,KAAK,GAAgB;YACnB,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,OAAO,EAAE,IAAI,CAAC,EAAE,EAAE;YAClB,MAAM,EAAE,IAAI,CAAC,MAAM;SACpB,CAAC;KACH;IAED,IAAI,EAAW,CAAC;IAChB,UAAU,CAAC,GAAG,EAAE;QACd,EAAE,GAAG,IAAI,OAAO,EAAE,CAAC;IACrB,CAAC,CAAC,CAAC;IAEH,MAAM,YAAY,GAAG,CAAC,KAAkB,EAAE,EAAE,CAAC,MAAM,CAAC,oBAAC,MAAM,OAAK,KAAK,GAAI,CAAC,CAAC;IAE3E,EAAE,CAAC,sBAAsB,EAAE,GAAG,EAAE;QAC9B,YAAY,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC;QACvB,MAAM,CAAC,M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,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 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Button.types.js","sourceRoot":"","sources":["../../src/Button/Button.types.ts"],"names":[],"mappings":"AAGA,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"}
|
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"}
|
package/dist/Icon/Icon.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import '../styles.css';
|
|
3
|
-
import Tooltip from '../Tooltip';
|
|
4
|
-
/**
|
|
5
|
-
* Icon:
|
|
6
|
-
* - access to Seeq custom icons by providing the desired icon
|
|
7
|
-
* - leverage "type" to style your icon
|
|
8
|
-
*/
|
|
9
|
-
const Icon = ({ onClick, icon, type = 'theme', extraClassNames, id, large, small, color, testId, customId, tooltip, tooltipDelay, tooltipPlacement, number, hasExternalTooltipHandler = false, }) => {
|
|
10
|
-
if ((type === 'color' && (color === undefined || color === '')) || (color && type !== 'color')) {
|
|
11
|
-
const errorMessage = color === undefined || color === ''
|
|
12
|
-
? 'Icon with type="color" must have prop color specified.'
|
|
13
|
-
: 'Icon with prop color must have type="color".';
|
|
14
|
-
return React.createElement("div", { className: "tw-text-sq-danger-color" }, errorMessage);
|
|
15
|
-
}
|
|
16
|
-
const colorClassesThemeLight = {
|
|
17
|
-
'theme': 'tw-text-sq-color-dark',
|
|
18
|
-
'white': 'tw-text-white',
|
|
19
|
-
'dark-gray': 'tw-text-sq-fairly-dark-gray',
|
|
20
|
-
'warning': 'tw-text-sq-warning-color',
|
|
21
|
-
'darkish-gray': 'tw-text-sq-darkish-gray',
|
|
22
|
-
'gray': 'tw-text-sq-disabled-gray',
|
|
23
|
-
'color': '',
|
|
24
|
-
'info': 'tw-text-sq-link',
|
|
25
|
-
'text': 'tw-text-sq-text-color',
|
|
26
|
-
'inherit': '',
|
|
27
|
-
'danger': 'tw-text-sq-danger-color',
|
|
28
|
-
'theme-light': 'tw-text-sq-color-light',
|
|
29
|
-
'success': 'tw-text-sq-success-color',
|
|
30
|
-
};
|
|
31
|
-
const colorClassesThemeDark = {
|
|
32
|
-
'theme': 'dark:tw-text-sq-color-dark-dark',
|
|
33
|
-
'white': '',
|
|
34
|
-
'dark-gray': 'tw-text-sq-fairly-dark-gray',
|
|
35
|
-
'warning': '',
|
|
36
|
-
'darkish-gray': 'tw-text-sq-darkish-gray',
|
|
37
|
-
'gray': 'dark:tw-text-sq-dark-disabled-gray',
|
|
38
|
-
'color': '',
|
|
39
|
-
'info': 'dark:tw-text-sq-link-dark',
|
|
40
|
-
'text': 'dark:tw-text-sq-dark-text',
|
|
41
|
-
'inherit': '',
|
|
42
|
-
'danger': 'tw-text-sq-danger-color',
|
|
43
|
-
'theme-light': 'tw-text-sq-color-light',
|
|
44
|
-
'success': 'tw-text-sq-success-color',
|
|
45
|
-
};
|
|
46
|
-
const iconPrefix = icon.startsWith('fc') ? 'fc' : 'fa';
|
|
47
|
-
const style = type === 'color' && color ? { color } : {};
|
|
48
|
-
const appliedClassNames = `${iconPrefix} ${icon} ${small ? 'fa-sm' : ''} ${large ? 'fa-lg' : ''}
|
|
49
|
-
${colorClassesThemeLight[type]} ${colorClassesThemeDark[type]} ${onClick ? 'cursor-pointer' : ''} ${extraClassNames}`;
|
|
50
|
-
const iconTag = (React.createElement("i", { className: appliedClassNames, style: style, onClick: onClick, "data-testid": testId, "data-customid": customId, id: id, "data-number": number }));
|
|
51
|
-
return !hasExternalTooltipHandler && tooltip && tooltip !== '' ? (React.createElement(Tooltip, { text: tooltip, delay: tooltipDelay, position: tooltipPlacement }, iconTag)) : (iconTag);
|
|
52
|
-
};
|
|
53
|
-
export default Icon;
|
|
54
|
-
//# sourceMappingURL=Icon.js.map
|
package/dist/Icon/Icon.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../src/Icon/Icon.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,eAAe,CAAC;AAEvB,OAAO,OAAO,MAAM,YAAY,CAAC;AAEjC;;;;GAIG;AACH,MAAM,IAAI,GAAuC,CAAC,EAChD,OAAO,EACP,IAAI,EACJ,IAAI,GAAG,OAAO,EACd,eAAe,EACf,EAAE,EACF,KAAK,EACL,KAAK,EACL,KAAK,EACL,MAAM,EACN,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,gBAAgB,EAChB,MAAM,EACN,yBAAyB,GAAG,KAAK,GAClC,EAAE,EAAE;IACH,IAAI,CAAC,IAAI,KAAK,OAAO,IAAI,CAAC,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,IAAI,CAAC,KAAK,IAAI,IAAI,KAAK,OAAO,CAAC,EAAE;QAC9F,MAAM,YAAY,GAChB,KAAK,KAAK,SAAS,IAAI,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CAAC,EAAE,IAAI,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,EAAE;IAC7F,sBAAsB,CAAC,IAAI,CAAC,IAAI,qBAAqB,CAAC,IAAI,CAAC,IAAI,OAAO,CAAC,CAAC,CAAC,gBAAgB,CAAC,CAAC,CAAC,EAAE,IAAI,eAAe,EAAE,CAAC;IAEtH,MAAM,OAAO,GAAG,CACd,2BACE,SAAS,EAAE,iBAAiB,EAC5B,KAAK,EAAE,KAAK,EACZ,OAAO,EAAE,OAAO,iBACH,MAAM,mBACJ,QAAQ,EACvB,EAAE,EAAE,EAAE,iBACO,MAAM,GACnB,CACH,CAAC;IAEF,OAAO,CAAC,yBAAyB,IAAI,OAAO,IAAI,OAAO,KAAK,EAAE,CAAC,CAAC,CAAC,CAC/D,oBAAC,OAAO,IAAC,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,IACpE,OAAO,CACA,CACX,CAAC,CAAC,CAAC,CACF,OAAO,CACR,CAAC;AACJ,CAAC,CAAC;AACF,eAAe,IAAI,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import Icon from './Icon';
|
|
3
|
-
import { iconTypes } from './Icon.types';
|
|
4
|
-
export default {
|
|
5
|
-
title: 'Icons',
|
|
6
|
-
};
|
|
7
|
-
export const AllIcons = () => {
|
|
8
|
-
const renderAllVariations = () => {
|
|
9
|
-
return (React.createElement(React.Fragment, null,
|
|
10
|
-
React.createElement("br", null),
|
|
11
|
-
React.createElement("br", null),
|
|
12
|
-
iconTypes.map((iconType) => {
|
|
13
|
-
return (React.createElement("div", { key: `${iconType}` },
|
|
14
|
-
React.createElement("b", null,
|
|
15
|
-
"type=",
|
|
16
|
-
iconType),
|
|
17
|
-
React.createElement("br", null),
|
|
18
|
-
React.createElement("div", null,
|
|
19
|
-
React.createElement(Icon, { icon: 'fc-announcements', small: true, extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'purple' : undefined }),
|
|
20
|
-
React.createElement(Icon, { icon: 'fc-announcements', extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? '#928378' : undefined }),
|
|
21
|
-
React.createElement(Icon, { icon: 'fc-announcements', large: true, extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'pink' : undefined })),
|
|
22
|
-
React.createElement("div", { className: "tw-dark tw-bg-sq-dark-background" },
|
|
23
|
-
React.createElement(Icon, { icon: 'fc-announcements', small: true, extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'purple' : undefined }),
|
|
24
|
-
React.createElement(Icon, { icon: 'fc-announcements', extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? '#928378' : undefined }),
|
|
25
|
-
React.createElement(Icon, { icon: 'fc-announcements', large: true, extraClassNames: 'tw-p-2', type: iconType, color: iconType === 'color' ? 'pink' : undefined })),
|
|
26
|
-
React.createElement("br", null)));
|
|
27
|
-
})));
|
|
28
|
-
};
|
|
29
|
-
return (React.createElement("div", { className: "tw-grid tw-grid-cols-3 tw-gap-4" },
|
|
30
|
-
React.createElement("div", { className: "color_topic" },
|
|
31
|
-
React.createElement("b", null, "Topic Colors"),
|
|
32
|
-
renderAllVariations()),
|
|
33
|
-
React.createElement("div", { className: "color_analysis" },
|
|
34
|
-
React.createElement("b", null, "Analysis Colors"),
|
|
35
|
-
renderAllVariations()),
|
|
36
|
-
React.createElement("div", { className: "color_datalab" },
|
|
37
|
-
React.createElement("b", null, "Datalab Colors"),
|
|
38
|
-
renderAllVariations())));
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=Icon.stories.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Icon.stories.js","sourceRoot":"","sources":["../../src/Icon/Icon.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,IAAI,MAAM,QAAQ,CAAC;AAC1B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ClD;wBACF,oBAAC,IAAI,IACH,IAAI,EAAE,kBAAkB,EACxB,eAAe,EAAE,QAAQ,EACzB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,SAAS,GACnD;wBACF,oBAAC,IAAI,IACH,IAAI,EAAE,kBAAkB,EACxB,KAAK,EAAE,IAAI,EACX,eAAe,EAAE,QAAQ,EACzB,IAAI,EAAE,QAAQ,EACd,KAAK,EAAE,QAAQ,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,GAChD,CACE;oBACN,+BAAM,CACF,CACP,CAAC;YACJ,CAAC,CAAC,CACD,CACJ,CAAC;IACJ,CAAC,CAAC;IACF,OAAO,CACL,6BAAK,SAAS,EAAC,iCAAiC;QAC9C,6BAAK,SAAS,EAAC,aAAa;YAC1B,8CAAmB;YAClB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,gBAAgB;YAC7B,iDAAsB;YACrB,mBAAmB,EAAE,CAClB;QAEN,6BAAK,SAAS,EAAC,eAAe;YAC5B,gDAAqB;YACpB,mBAAmB,EAAE,CAClB,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/Icon/Icon.test.js
DELETED
|
@@ -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 Icon from './Icon';
|
|
5
|
-
describe('Icon', () => {
|
|
6
|
-
class Context {
|
|
7
|
-
testId = 'iconTestId';
|
|
8
|
-
icon = 'testIcon';
|
|
9
|
-
props = {
|
|
10
|
-
icon: this.icon,
|
|
11
|
-
onClick: jest.fn(),
|
|
12
|
-
testId: this.testId,
|
|
13
|
-
};
|
|
14
|
-
}
|
|
15
|
-
let tc;
|
|
16
|
-
beforeEach(() => {
|
|
17
|
-
tc = new Context();
|
|
18
|
-
});
|
|
19
|
-
const renderIcon = (props) => render(React.createElement(Icon, { ...props }));
|
|
20
|
-
it('renders icon', () => {
|
|
21
|
-
renderIcon(tc.props);
|
|
22
|
-
expect(screen.getByTestId(tc.testId)).toHaveClass(tc.icon);
|
|
23
|
-
});
|
|
24
|
-
it('renders large icon', () => {
|
|
25
|
-
renderIcon({ ...tc.props, large: true });
|
|
26
|
-
expect(screen.getByTestId(tc.testId)).toHaveClass('fa-lg');
|
|
27
|
-
});
|
|
28
|
-
it('renders small icon', () => {
|
|
29
|
-
renderIcon({ ...tc.props, small: true });
|
|
30
|
-
expect(screen.getByTestId(tc.testId)).toHaveClass('fa-sm');
|
|
31
|
-
});
|
|
32
|
-
describe('icon types', () => {
|
|
33
|
-
it('renders the theme type by default', () => {
|
|
34
|
-
renderIcon(tc.props);
|
|
35
|
-
expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-sq-color-dark');
|
|
36
|
-
});
|
|
37
|
-
it('renders the white icon', () => {
|
|
38
|
-
renderIcon({ ...tc.props, type: 'white' });
|
|
39
|
-
expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-white');
|
|
40
|
-
});
|
|
41
|
-
it('renders the text-type icon', () => {
|
|
42
|
-
renderIcon({ ...tc.props, type: 'text' });
|
|
43
|
-
expect(screen.getByTestId(tc.testId)).toHaveClass('tw-text-sq-text-color');
|
|
44
|
-
});
|
|
45
|
-
it('renders the color-type icon', () => {
|
|
46
|
-
renderIcon({ ...tc.props, type: 'color', color: '#AABBFF' });
|
|
47
|
-
expect(screen.getByTestId(tc.testId)).toHaveStyle('color: #AABBFF');
|
|
48
|
-
});
|
|
49
|
-
it('renders a warning if type=color and no color is provided', () => {
|
|
50
|
-
renderIcon({ ...tc.props, type: 'color' });
|
|
51
|
-
expect(screen.getByText('Icon with type="color" must have prop color specified.')).toBeInTheDocument();
|
|
52
|
-
});
|
|
53
|
-
});
|
|
54
|
-
});
|
|
55
|
-
//# sourceMappingURL=Icon.test.js.map
|