diginet-core-ui 1.3.89 → 1.3.90
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/assets/images/menu/dhr/MHRP51N0003.svg +13 -0
- package/assets/images/menu/dhr/MHRP51N0004.svg +14 -0
- package/components/breadcrumb/index.js +144 -0
- package/components/button/icon.js +1 -0
- package/components/index.js +3 -0
- package/components/popover/index.js +37 -31
- package/components/tab/tab-container.js +6 -5
- package/components/tab/tab-header.js +38 -45
- package/components/tab/tab-panel.js +9 -16
- package/components/tab/tab.js +66 -81
- package/icons/basic.js +108 -0
- package/package.json +1 -1
- package/readme.md +9 -0
- package/styles/colors.js +1 -0
- package/styles/general.js +67 -29
- package/styles/utils.js +1 -0
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_847_46)">
|
|
3
|
+
<path d="M18.6998 0H15.7998C14.9998 0 14.2998 0.7 14.2998 1.5V5.9C14.2998 6.7 14.9998 7.4 15.7998 7.4H18.6998C19.4998 7.4 20.1998 6.7 20.1998 5.9V1.5C20.1998 0.7 19.4998 0 18.6998 0Z" fill="#2680EB"/>
|
|
4
|
+
<path d="M27.5998 11.8C27.5998 7.7 25.1998 4.2 21.6998 2.5V5.9C21.6998 7.5 20.3998 8.8 18.7998 8.8H15.8998C14.2998 8.8 12.9998 7.5 12.9998 5.9V2.5C9.39982 4.1 6.99982 7.7 6.99982 11.8C6.19982 11.8 5.49982 12.5 5.49982 13.3V14.8C5.49982 15.6 6.19982 16.3 6.99982 16.3H27.5998C28.3998 16.3 29.0998 15.6 29.0998 14.8V13.3C28.9998 12.4 28.3998 11.8 27.5998 11.8Z" fill="#2680EB"/>
|
|
5
|
+
<path d="M33.4998 21.4C33.2998 21 32.8998 20.8 32.4998 20.8C32.2998 20.8 31.8998 20.9 31.5998 21.2C31.3998 21.5 30.9998 21.9 30.6998 22.2C29.8998 23.1 28.8998 24.3 28.4998 24.6C28.3998 24.7 28.2998 24.7 28.1998 24.7C28.0998 24.7 27.9998 24.6 27.9998 24.5C27.9998 24.4 27.9998 24.3 28.0998 24.2C28.2998 24 28.8998 23.4 29.4998 22.7C30.2998 21.8 31.2998 20.7 31.6998 20.3C31.9998 20 32.0998 19.5 31.8998 19.1C31.6998 18.7 31.3998 18.4 30.8998 18.4C30.5998 18.4 30.2998 18.5 29.9998 18.8C28.8998 19.9 26.6998 22.2 26.3998 22.5C26.2998 22.6 26.1998 22.6 26.0998 22.6C25.9998 22.6 25.8998 22.6 25.8998 22.5C25.8998 22.5 25.8998 22.4 25.9998 22.2C26.2998 21.9 26.6998 21.4 27.2998 20.8C27.8998 20.2 28.4998 19.5 28.9998 18.9C29.3998 18.5 29.4998 18 29.2998 17.6C29.0998 17.2 28.6998 17 28.2998 17C27.8998 17 27.5998 17.2 27.2998 17.4C27.0998 17.6 26.6998 18.1 26.2998 18.6C25.2998 19.9 23.8998 21.6 22.7998 22.2C22.6998 22.2 22.4998 22.4 21.7998 22.3C20.9998 22.2 20.4998 20.8 20.3998 20C20.2998 19.6 20.2998 19.2 20.0998 19C19.8998 18.6 19.2998 18.3 18.6998 18.3C18.2998 18.3 17.9998 18.4 17.7998 18.7C17.6998 18.9 17.4998 19.2 17.5998 19.7C17.6998 20 17.7998 20.3 17.8998 20.7C18.1998 21.9 18.6998 23.8 18.4998 26C18.3998 26.7 18.0998 27.4 17.4998 28C16.4998 27.1 15.8998 26.2 15.7998 25.4C15.7998 23.5 16.0998 22.3 16.3998 21.3C16.4998 21 16.5998 20.7 16.5998 20.3C16.7998 19.6 16.4998 19.2 16.2998 18.9C15.9998 18.6 15.5998 18.4 15.0998 18.4C14.3998 18.4 13.6998 18.8 13.3998 19.3C13.1998 19.7 13.0998 20.1 13.0998 20.5C12.9998 21.2 12.8998 21.8 11.9998 22.3C11.9998 22.3 11.8998 22.3 11.7998 22.3C10.8998 21.8 9.29982 20.2 8.29982 18.9C7.89982 18.4 7.49982 17.9 7.29982 17.7C6.89982 17.3 6.49982 17.1 5.99982 17.1C5.39982 17.1 4.79982 17.4 4.59982 18C4.49982 18.2 4.49982 18.5 4.49982 18.7C4.19982 18.5 3.89982 18.4 3.59982 18.4C2.99982 18.4 2.49982 18.8 2.19982 19.3C1.99982 19.7 1.99982 20.1 2.19982 20.4H2.39982C1.79982 20.4 1.29982 20.7 0.999824 21.3C0.799824 21.7 0.799824 22.3 1.19982 22.7C0.799824 22.8 0.399824 23.1 0.199824 23.5C-0.100176 24 -0.000176042 24.6 0.399824 25.1C0.899824 26.1 12.9998 38.7 12.9998 38.7C13.0998 38.9 13.2998 39 13.4998 39H13.5998C13.7998 39 13.8998 38.9 13.9998 38.8L17.2998 35.8L19.0998 37.4C19.3998 31.8 23.5998 27.4 29.0998 26.8V26.1C29.0998 25.3 29.4998 24.7 30.1998 24.3C30.4998 24.1 30.7998 24.1 31.0998 24.1C31.2998 24.1 31.4998 24.1 31.6998 24.2C32.2998 23.6 32.8998 22.9 33.2998 22.4C33.5998 22 33.6998 21.7 33.4998 21.4ZM13.7998 32.5L16.4998 35.1L13.5998 37.8C12.9998 37 1.69982 25.5 1.09982 24.7C0.999824 24.6 0.899824 24.4 0.999824 24.2C0.999824 24 1.19982 23.9 1.39982 23.9C1.49982 23.9 1.59982 24 1.69982 24.1C2.39982 24.9 3.89982 26.5 4.19982 26.8C4.89982 27.5 5.69982 26.8 5.09982 26.1C4.59982 25.6 2.89982 23.7 1.99982 22.6C1.29982 21.7 2.29982 21.1 2.89982 22C3.09982 22.3 5.49982 25 5.89982 25.3C6.09982 25.5 6.29982 25.6 6.49982 25.6C6.79982 25.6 7.09982 25.4 7.19982 25.2C7.29982 24.9 7.19982 24.6 6.99982 24.4C6.89982 24.3 5.89982 23.3 4.89982 22.3C3.89982 21.1 3.29982 20.6 3.49982 20.2C3.59982 20 3.79982 19.9 3.99982 19.9C4.19982 19.9 4.39982 20.1 4.49982 20.2C5.49982 21.2 7.59982 23.4 7.89982 23.7C8.09982 23.8 8.29982 24 8.49982 24C8.79982 24 8.99982 23.8 9.09982 23.6C9.19982 23.4 9.19982 23.2 8.89982 22.8C8.59982 22.5 8.19982 22 7.69982 21.4C6.99982 20.6 6.39982 20 5.89982 19.4C5.79982 19.3 5.59982 18.9 5.69982 18.7C5.79982 18.5 5.99982 18.3 6.29982 18.3C6.49982 18.3 6.69982 18.4 6.89982 18.6C7.09982 18.8 7.49982 19.3 7.79982 19.7C8.59982 20.7 10.1998 22.5 11.3998 23.2C11.7998 23.4 12.2998 23.6 12.6998 23.3C13.9998 22.6 14.1998 21.6 14.2998 20.8C14.2998 20.5 14.3998 20.2 14.4998 20C14.6998 19.7 14.9998 19.5 15.3998 19.5C15.5998 19.5 15.7998 19.6 15.8998 19.8C15.9998 19.9 15.9998 20.1 15.9998 20.4C15.8998 20.7 15.7998 21 15.7998 21.3C15.4998 22.4 15.1998 23.6 15.1998 25.4C15.1998 26 15.2998 26.2 15.3998 26.6C15.6998 27.4 16.2998 28.2 17.0998 29C15.4998 30.7 13.8998 32.2 13.8998 32.3C13.7998 32.4 13.7998 32.5 13.7998 32.5ZM34.3998 23.7C34.1998 23.3 33.8998 23.1 33.4998 23.1C33.2998 23.1 33.0998 23.2 32.7998 23.4C32.5998 23.7 32.2998 24 31.8998 24.3C31.9998 24.3 31.9998 24.4 32.0998 24.4L33.5998 25.4C33.8998 25.1 34.0998 24.8 34.1998 24.8C34.5998 24.5 34.5998 24.1 34.3998 23.7Z" fill="#2680EB"/>
|
|
6
|
+
<path d="M30.1 35.5C30.1 35.9 30.3 36.2 30.7 36.4C30.8 36.5 31 36.5 31.2 36.5C31.4 36.5 31.6 36.4 31.8 36.3L38.7 31.5C38.9 31.3 39.1 31 39.1 30.7C39.1 30.4 38.9 30.1 38.7 29.9L31.8 25.2C31.6 25.1 31.4 25 31.2 25C31 25 30.9 25 30.7 25.1C30.4 25.3 30.2 25.6 30.1 26V27.6C24.5 27.9 20 32.4 20 38V38.1C20 38.5 20.3 38.8 20.6 38.9C20.7 38.9 20.8 38.9 20.8 38.9C21.1 38.9 21.4 38.7 21.5 38.5C23.3 35.6 26.5 33.8 30 33.7L30.1 35.5Z" fill="#FF8C00"/>
|
|
7
|
+
</g>
|
|
8
|
+
<defs>
|
|
9
|
+
<clipPath id="clip0_847_46">
|
|
10
|
+
<rect width="39" height="39" fill="white"/>
|
|
11
|
+
</clipPath>
|
|
12
|
+
</defs>
|
|
13
|
+
</svg>
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
<svg width="39" height="39" viewBox="0 0 39 39" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<g clip-path="url(#clip0_847_51)">
|
|
3
|
+
<path d="M15.1002 6.8H17.9002C18.7002 6.8 19.3002 6.2 19.3002 5.4V1.4C19.3002 0.7 18.7002 0 17.9002 0H15.1002C14.3002 0 13.7002 0.6 13.7002 1.4V5.5C13.7002 6.2 14.3002 6.8 15.1002 6.8Z" fill="#2680EB"/>
|
|
4
|
+
<path d="M27.7002 12.2V13.6C27.7002 14.4 27.1002 15 26.3002 15H6.70022C5.90022 15 5.30022 14.4 5.30022 13.6V12.2C5.30022 11.4 5.90022 10.8 6.70022 10.8C6.70022 7 9.00022 3.8 12.3002 2.2V5.3C12.3002 6.8 13.6002 8 15.1002 8H17.9002C19.4002 8 20.7002 6.8 20.7002 5.3V2.3C22.5002 3.1 24.0002 4.5 25.0002 6.2C23.3002 7.7 22.3002 9.9 22.3002 12.4V12.5C22.3002 13.2 22.8002 13.9 23.5002 14.1C23.6002 14.1 23.8002 14.2 23.9002 14.2C24.5002 14.2 25.0002 13.9 25.3002 13.5C25.8002 12.7 26.5002 12 27.3002 11.5C27.6002 11.5 27.7002 11.8 27.7002 12.2Z" fill="#2680EB"/>
|
|
5
|
+
<path d="M30.5002 17.8C30.3002 17.4 30.0002 17.2 29.6002 17.2C29.3002 17.2 29.0002 17.3 28.7002 17.6C27.7002 18.6 25.5002 20.8 25.3002 21C25.2002 21.1 25.2002 21.1 25.0002 21.1C24.9002 21.1 24.8002 21.1 24.8002 21C24.8002 21 24.8002 20.9 24.9002 20.7C25.2002 20.4 25.6002 19.9 26.1002 19.4C26.6002 18.9 27.2002 18.2 27.7002 17.7C28.1002 17.3 28.2002 16.9 28.0002 16.5C27.8002 16.2 27.5002 15.9 27.0002 15.9C26.7002 15.9 26.3002 16.1 26.0002 16.3C25.8002 16.5 25.4002 17 25.0002 17.4C24.1002 18.6 22.7002 20.2 21.7002 20.7C21.6002 20.7 21.4002 20.9 20.7002 20.8C19.9002 20.7 19.5002 19.4 19.4002 18.7C19.3002 18.3 19.3002 18 19.1002 17.7C18.9002 17.3 18.3002 17.1 17.8002 17.1C17.4002 17.1 17.1002 17.2 16.9002 17.4C16.8002 17.6 16.6002 17.9 16.8002 18.4C16.9002 18.7 16.9002 19 17.0002 19.3C17.3002 20.4 17.7002 22.1 17.6002 24.2C17.5002 24.9 17.2002 25.5 16.7002 26.1C15.7002 25.2 15.2002 24.4 15.1002 23.7C15.1002 22 15.4002 20.8 15.6002 19.9C15.7002 19.6 15.8002 19.3 15.8002 19C16.0002 18.3 15.8002 17.9 15.6002 17.7C15.3002 17.4 14.9002 17.2 14.4002 17.2C13.7002 17.2 13.1002 17.5 12.8002 18C12.6002 18.3 12.5002 18.7 12.5002 19.1C12.4002 19.8 12.3002 20.3 11.5002 20.7C11.5002 20.7 11.4002 20.8 11.3002 20.7C10.4002 20.2 8.90022 18.7 8.00022 17.6C7.60022 17.1 7.30022 16.7 7.00022 16.5C6.70022 16.2 6.20022 16 5.70022 16C5.10022 16 4.60022 16.3 4.30022 16.8C4.20022 17 4.20022 17.2 4.20022 17.4C3.90022 17.2 3.70022 17.1 3.40022 17.1C2.80022 17.1 2.30022 17.4 2.10022 18C2.00022 18.3 2.00022 18.7 2.10022 19H2.30022C1.70022 19 1.20022 19.3 1.00022 19.8C0.800219 20.2 0.900219 20.7 1.20022 21.1C0.800219 21.2 0.400219 21.5 0.200219 21.9C0.000218511 22.4 0.000218511 22.9 0.400219 23.4C1.00022 24.1 12.5002 35.7 12.5002 35.7C12.6002 35.8 12.8002 35.9 12.9002 36H13.0002C13.2002 36 13.3002 35.9 13.4002 35.8L16.5002 33L19.6002 35.7H19.7002C19.8002 35.7 19.8002 35.7 19.8002 35.6C19.8002 35.6 20.3002 35.1 21.1002 34.4C20.9002 34 20.7002 33.6 20.6002 33.3C20.3002 32.5 20.1002 31.6 20.0002 30.8C20.0002 30.5 20.0002 30.3 20.0002 29.9C20.0002 28.8 20.2002 27.7 20.5002 26.7C20.5002 26.6 20.6002 26.5 20.6002 26.5C20.6002 26.4 20.6002 26.4 20.7002 26.3C21.0002 25.5 21.4002 24.8 21.8002 24.2C22.2002 23.6 22.6002 23.1 23.1002 22.7C23.7002 22.1 24.3002 21.6 25.1002 21.2H25.2002C25.3002 21.1 25.4002 21.1 25.5002 21C25.8002 20.9 26.1002 20.7 26.4002 20.6C26.8002 20.4 27.3002 20.3 27.6002 20.2C28.0002 20.1 28.4002 20 28.8002 20C29.0002 20 29.1002 20 29.3002 19.9C29.8002 19.4 30.2002 19 30.5002 18.7C30.6002 18.6 30.7002 18.2 30.5002 17.8ZM13.2002 30L15.8002 32.4L13.0002 35C12.4002 34.2 1.60022 23.5 1.00022 22.8C0.900219 22.7 0.800218 22.5 0.900218 22.3C1.00022 22.1 1.10022 22 1.30022 22C1.40022 22 1.50022 22 1.60022 22.1C2.20022 22.8 3.70022 24.3 4.00022 24.6C4.70022 25.2 5.40022 24.6 4.80022 24C4.30022 23.5 2.70022 21.8 1.80022 20.8C1.10022 20 2.10022 19.4 2.70022 20.2C2.90022 20.4 5.20022 23 5.50022 23.3C5.70022 23.5 5.90022 23.6 6.10022 23.6C6.40022 23.6 6.60022 23.4 6.70022 23.2C6.80022 22.9 6.70022 22.7 6.50022 22.5C6.40022 22.4 5.50022 21.5 4.50022 20.5C3.50022 19.4 3.00022 18.9 3.20022 18.5C3.30022 18.3 3.50022 18.2 3.60022 18.2C3.80022 18.2 4.00022 18.3 4.10022 18.5C5.10022 19.4 7.10022 21.5 7.30022 21.7C7.50022 21.8 7.70022 22 7.90022 22C8.20022 22 8.40022 21.8 8.50022 21.6C8.60022 21.4 8.60022 21.2 8.30022 20.9C8.00022 20.6 7.60022 20.2 7.10022 19.6C6.60022 19.1 6.10022 18.5 5.60022 18C5.50022 17.9 5.30022 17.6 5.40022 17.4C5.50022 17.2 5.70022 17.1 5.90022 17.1C6.10022 17.1 6.30022 17.2 6.50022 17.4C6.70022 17.6 7.00022 18 7.40022 18.4C8.20022 19.3 9.70022 21 10.8002 21.7C11.1002 21.9 11.6002 22 12.1002 21.8C13.3002 21.1 13.5002 20.2 13.6002 19.5C13.7002 19.2 13.7002 18.9 13.8002 18.8C14.0002 18.5 14.2002 18.3 14.6002 18.3C14.8002 18.3 15.0002 18.4 15.1002 18.5C15.2002 18.6 15.2002 18.8 15.2002 19C15.1002 19.3 15.1002 19.5 15.0002 19.8C14.7002 20.8 14.4002 21.9 14.4002 23.6C14.4002 24.1 14.5002 24.4 14.6002 24.7C14.9002 25.4 15.4002 26.2 16.3002 26.9C14.8002 28.5 13.3002 29.9 13.2002 29.9C13.1002 29.9 13.2002 30 13.2002 30ZM32.0002 19.7C31.8002 19.4 31.5002 19.2 31.1002 19.2C30.9002 19.2 30.6002 19.3 30.3002 19.6C30.2002 19.7 30.0002 19.9 29.9002 20.1C30.0002 20.1 30.0002 20.1 30.1002 20.1C30.8002 20.1 31.5002 20.2 32.2002 20.3C32.1002 20 32.1002 19.9 32.0002 19.7Z" fill="#2680EB"/>
|
|
6
|
+
<path d="M30.5999 10.5C30.5999 10.8 30.7999 11 30.9999 11.2C31.0999 11.3 31.1999 11.3 31.2999 11.3C31.3999 11.3 31.5999 11.3 31.6999 11.2L36.6999 7.7C36.8999 7.5 36.9999 7.3 36.9999 7.1C36.9999 6.9 36.8999 6.7 36.6999 6.6L31.6999 3.2C31.5999 3 31.4999 3 31.2999 3C31.1999 3 31.0999 3 30.9999 3.1C30.7999 3.2 30.5999 3.5 30.5999 3.7V4.9C26.5999 5 23.3999 8.3 23.3999 12.3V12.4C23.3999 12.7 23.5999 12.9 23.8999 13C23.9999 13 23.9999 13 24.0999 13C24.2999 13 24.4999 12.9 24.5999 12.7C25.8999 10.6 28.1999 9.3 30.6999 9.3L30.5999 10.5Z" fill="#FF8C00"/>
|
|
7
|
+
<path d="M36.3 23.6C35.8 23.2 35.4 22.8 34.8 22.4C33.4 21.5 31.8 21 30 21C29.6 21 29.2 21 28.8 21.1C28.4 21.1 28.1 21.2 27.7 21.3C27.3 21.4 27 21.5 26.6 21.7C26.3 21.8 26 21.9 25.8 22.1C25.7 22.1 25.6 22.2 25.5 22.3C24.9 22.7 24.3 23.1 23.8 23.6C23.4 24 23 24.4 22.7 24.9C22.3 25.5 22 26.1 21.7 26.8C21.7 26.9 21.6 27.1 21.6 27.2C21.2 28 21 29 21 30C21 30.3 21 30.5 21 30.8C21.1 31.6 21.2 32.3 21.5 33.1C21.9 34.1 22.4 35 23 35.8C24.7 37.8 27.1 39.1 29.9 39.1C33 39.1 35.7 37.6 37.3 35.2C38.3 33.7 38.9 32 38.9 30.1C39 27.5 38 25.2 36.3 23.6ZM35.6 27.1L31.2 33L30.2 34.3C30 34.8 29.5 35 29 35H28.9C28.4 35 27.9 34.8 27.6 34.4L26.3 33L24.5 31C24 30.5 24 29.6 24.6 29.1C24.9 28.9 25.2 28.7 25.5 28.7C25.9 28.7 26.2 28.9 26.5 29.2L28.7 31.6L28.8 31.7C28.9 31.7 28.9 31.7 28.9 31.6L33.4 25.5C33.7 25.1 34.1 25 34.5 25C34.8 25 35 25.1 35.3 25.3C35.9 25.7 36 26.5 35.6 27.1Z" fill="#1CA261"/>
|
|
8
|
+
</g>
|
|
9
|
+
<defs>
|
|
10
|
+
<clipPath id="clip0_847_51">
|
|
11
|
+
<rect width="39" height="39" fill="white"/>
|
|
12
|
+
</clipPath>
|
|
13
|
+
</defs>
|
|
14
|
+
</svg>
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
/** @jsxRuntime classic */
|
|
2
|
+
/** @jsx jsx */
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { ButtonIcon, Typography } from "./..";
|
|
5
|
+
import { Icon } from "../../icons/effect";
|
|
6
|
+
import OptionWrapper from "../others/option-wrapper";
|
|
7
|
+
import PropTypes from 'prop-types';
|
|
8
|
+
import React, { forwardRef, memo, useImperativeHandle, useMemo, useRef } from 'react';
|
|
9
|
+
import { displayFlex, flexWrap, itemsCenter, mg, mgx, pd, userSelectNone } from "../../styles/general";
|
|
10
|
+
import { classNames } from "../../utils";
|
|
11
|
+
const insertSeparators = (items, separator) => {
|
|
12
|
+
return items.reduce((acc, current, index) => {
|
|
13
|
+
if (index < items.length - 1) {
|
|
14
|
+
acc = acc.concat(current, jsx("li", {
|
|
15
|
+
css: BreadcrumbSeparatorCSS,
|
|
16
|
+
"aria-hidden": true,
|
|
17
|
+
key: `separator-${index}`,
|
|
18
|
+
className: 'DGN-UI-Breadcrumb-separator'
|
|
19
|
+
}, separator));
|
|
20
|
+
} else {
|
|
21
|
+
acc.push(current);
|
|
22
|
+
}
|
|
23
|
+
return acc;
|
|
24
|
+
}, []);
|
|
25
|
+
};
|
|
26
|
+
const Breadcrumb = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
27
|
+
action = {},
|
|
28
|
+
children,
|
|
29
|
+
className,
|
|
30
|
+
data,
|
|
31
|
+
id,
|
|
32
|
+
itemsAfterCollapse,
|
|
33
|
+
itemsBeforeCollapse,
|
|
34
|
+
maxItems,
|
|
35
|
+
separator,
|
|
36
|
+
style
|
|
37
|
+
}, reference) => {
|
|
38
|
+
if (!reference) reference = useRef(null);
|
|
39
|
+
const ref = useRef(null);
|
|
40
|
+
const [expanded, setExpanded] = React.useState(false);
|
|
41
|
+
useImperativeHandle(reference, () => {
|
|
42
|
+
const currentRef = ref.current || {};
|
|
43
|
+
currentRef.element = ref.current;
|
|
44
|
+
const _instance = {
|
|
45
|
+
...action
|
|
46
|
+
}; // methods
|
|
47
|
+
_instance.__proto__ = {}; // hidden methods
|
|
48
|
+
currentRef.instance = _instance;
|
|
49
|
+
return currentRef;
|
|
50
|
+
});
|
|
51
|
+
const renderItemsBeforeAndAfter = allItems => {
|
|
52
|
+
const handleClickExpand = () => {
|
|
53
|
+
setExpanded(true);
|
|
54
|
+
};
|
|
55
|
+
if (itemsBeforeCollapse + itemsAfterCollapse >= allItems.length) {
|
|
56
|
+
return allItems;
|
|
57
|
+
}
|
|
58
|
+
return [...allItems.slice(0, itemsBeforeCollapse), jsx(ButtonIcon, {
|
|
59
|
+
key: "ellipsis",
|
|
60
|
+
name: 'MoreHoriz',
|
|
61
|
+
width: 24,
|
|
62
|
+
height: 16,
|
|
63
|
+
onClick: handleClickExpand
|
|
64
|
+
}), ...allItems.slice(allItems.length - itemsAfterCollapse, allItems.length)];
|
|
65
|
+
};
|
|
66
|
+
const allItems = data !== null && data !== void 0 && data.length ? data.map((item, idx) => {
|
|
67
|
+
var _data$onClick;
|
|
68
|
+
return jsx("li", {
|
|
69
|
+
className: 'DGN-UI-Breadcrumb-li',
|
|
70
|
+
key: `child-${idx}`
|
|
71
|
+
}, jsx(Typography, {
|
|
72
|
+
type: (data === null || data === void 0 ? void 0 : data.length) === idx + 1 ? 'h5' : 'p3',
|
|
73
|
+
mapping: 'a',
|
|
74
|
+
color: 'text.sub',
|
|
75
|
+
href: data === null || data === void 0 ? void 0 : data.href,
|
|
76
|
+
onClick: data === null || data === void 0 ? void 0 : (_data$onClick = data.onClick) === null || _data$onClick === void 0 ? void 0 : _data$onClick.call(data)
|
|
77
|
+
}, item === null || item === void 0 ? void 0 : item.name));
|
|
78
|
+
}) : React.Children.toArray(children).filter(child => {
|
|
79
|
+
return /*#__PURE__*/React.isValidElement(child);
|
|
80
|
+
}).map((child, idx) => jsx("li", {
|
|
81
|
+
className: 'DGN-UI-Breadcrumb-li',
|
|
82
|
+
key: `child-${idx}`
|
|
83
|
+
}, child));
|
|
84
|
+
return useMemo(() => {
|
|
85
|
+
return jsx("nav", {
|
|
86
|
+
ref: ref,
|
|
87
|
+
id: id,
|
|
88
|
+
style: style,
|
|
89
|
+
className: classNames('DGN-UI-Breadcrumb', className)
|
|
90
|
+
}, jsx("ol", {
|
|
91
|
+
css: BreadcrumbOlCSS,
|
|
92
|
+
className: 'DGN-UI-Breadcrumb-ol'
|
|
93
|
+
}, insertSeparators(expanded || maxItems && allItems.length <= maxItems ? allItems : renderItemsBeforeAndAfter(allItems), separator)));
|
|
94
|
+
}, [children, className, data, id, itemsAfterCollapse, itemsBeforeCollapse, maxItems, separator, style, expanded]);
|
|
95
|
+
}));
|
|
96
|
+
const BreadcrumbOlCSS = css`
|
|
97
|
+
${displayFlex};
|
|
98
|
+
${flexWrap};
|
|
99
|
+
${itemsCenter};
|
|
100
|
+
${pd(0)};
|
|
101
|
+
${mg(0)};
|
|
102
|
+
list-style: none;
|
|
103
|
+
`;
|
|
104
|
+
const BreadcrumbSeparatorCSS = css`
|
|
105
|
+
${displayFlex};
|
|
106
|
+
${userSelectNone};
|
|
107
|
+
${mgx([2])};
|
|
108
|
+
`;
|
|
109
|
+
Breadcrumb.defaultProps = {
|
|
110
|
+
className: '',
|
|
111
|
+
itemsBeforeCollapse: 1,
|
|
112
|
+
itemsAfterCollapse: 1,
|
|
113
|
+
maxItems: 8,
|
|
114
|
+
separator: jsx(Icon, {
|
|
115
|
+
name: 'ArrowRight',
|
|
116
|
+
width: 16,
|
|
117
|
+
height: 16
|
|
118
|
+
}),
|
|
119
|
+
style: {}
|
|
120
|
+
};
|
|
121
|
+
Breadcrumb.propTypes = {
|
|
122
|
+
/** The content of the component. */
|
|
123
|
+
children: PropTypes.oneOfType([PropTypes.string, PropTypes.node]),
|
|
124
|
+
/** Class for component. */
|
|
125
|
+
className: PropTypes.string,
|
|
126
|
+
/** Class for component. */
|
|
127
|
+
data: PropTypes.PropTypes.arrayOf(PropTypes.shape({
|
|
128
|
+
name: PropTypes.string,
|
|
129
|
+
href: PropTypes.string,
|
|
130
|
+
onClick: PropTypes.func
|
|
131
|
+
})),
|
|
132
|
+
/** Class for component. */
|
|
133
|
+
itemsBeforeCollapse: PropTypes.number,
|
|
134
|
+
/** Class for component. */
|
|
135
|
+
itemsAfterCollapse: PropTypes.number,
|
|
136
|
+
/** Class for component. */
|
|
137
|
+
maxItems: PropTypes.number,
|
|
138
|
+
/** Custom separator node. */
|
|
139
|
+
separator: PropTypes.node,
|
|
140
|
+
/** Style inline of component. */
|
|
141
|
+
style: PropTypes.object
|
|
142
|
+
};
|
|
143
|
+
export { Breadcrumb };
|
|
144
|
+
export default OptionWrapper(Breadcrumb);
|
|
@@ -124,6 +124,7 @@ const ButtonIcon = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
124
124
|
css: [_ButtonRootCSS, _ButtonSizeCSS, disabled && ButtonDisabledCSS],
|
|
125
125
|
ref: ref,
|
|
126
126
|
id: id,
|
|
127
|
+
disabled: disabled,
|
|
127
128
|
style: style,
|
|
128
129
|
onClick: _onClick,
|
|
129
130
|
className: classNames('DGN-UI-ButtonIcon', viewType, getClassNameFromColor(colorProp), size, loading && 'button-icon--loading', className)
|
package/components/index.js
CHANGED
|
@@ -30,6 +30,9 @@ export { default as Badge } from "./badge";
|
|
|
30
30
|
export { default as Button } from "./button";
|
|
31
31
|
export { default as ButtonIcon } from "./button/icon";
|
|
32
32
|
|
|
33
|
+
// BREADCRUMB
|
|
34
|
+
export { default as Breadcrumb } from "./breadcrumb";
|
|
35
|
+
|
|
33
36
|
// CARD
|
|
34
37
|
export { default as Card } from "./card";
|
|
35
38
|
export { default as CardHeader } from "./card/header";
|
|
@@ -5,15 +5,10 @@ import OptionWrapper from "../others/option-wrapper";
|
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import React, { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
7
7
|
import { createPortal } from 'react-dom';
|
|
8
|
-
import { borderRadius4px,
|
|
8
|
+
import { bgColor, borderBottom, borderRadius4px, displayFlex, displayNone, flexCol, inset, justifyBetween, overflowAuto, parseMaxWidthHeight, parseMinWidthHeight, parseWidthHeight, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative } from "../../styles/general";
|
|
9
9
|
import { useTheme } from "../../theme";
|
|
10
10
|
import { classNames, isMobile, refType as ref } from "../../utils";
|
|
11
11
|
const {
|
|
12
|
-
colors: {
|
|
13
|
-
system: {
|
|
14
|
-
white: systemWhite
|
|
15
|
-
}
|
|
16
|
-
},
|
|
17
12
|
typography: {
|
|
18
13
|
paragraph1
|
|
19
14
|
},
|
|
@@ -139,16 +134,18 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
139
134
|
width,
|
|
140
135
|
zIndex
|
|
141
136
|
}, reference) => {
|
|
137
|
+
if (!reference) reference = useRef(null);
|
|
142
138
|
if (isMobile.any() && trigger === 'hover') trigger = 'click';
|
|
143
139
|
const ref = useRef(null);
|
|
144
140
|
const arrowRef = useRef(null);
|
|
145
141
|
const overflow = useRef(null);
|
|
142
|
+
const anchorRef = useRef(anchor);
|
|
146
143
|
const [openState, setOpenState] = useState(open);
|
|
147
144
|
const [element, setElement] = useState(null);
|
|
145
|
+
const arrowSize = arrow ? 6 : 0;
|
|
148
146
|
const _PortalPopoverCSS = PortalPopoverCSS(zIndex, fullScreen);
|
|
149
147
|
const _PopoverContainerCSS = PopoverContainerCSS(bgColor, width, height);
|
|
150
|
-
const _PopoverArrowCSS = PopoverArrowCSS(bgColor);
|
|
151
|
-
const arrowSize = arrow ? 6 : 0;
|
|
148
|
+
const _PopoverArrowCSS = PopoverArrowCSS(bgColor, arrowSize);
|
|
152
149
|
if (direction) {
|
|
153
150
|
const directionObject = getDirectionPopover(direction);
|
|
154
151
|
anchorOrigin = directionObject.anchorOrigin;
|
|
@@ -193,7 +190,9 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
193
190
|
verticalCenter = 0,
|
|
194
191
|
horizontal = 0,
|
|
195
192
|
horizontalCenter = 0,
|
|
196
|
-
arrowPosition = {
|
|
193
|
+
arrowPosition = {
|
|
194
|
+
display: 'block'
|
|
195
|
+
},
|
|
197
196
|
translate = {
|
|
198
197
|
left: 0,
|
|
199
198
|
top: 0
|
|
@@ -212,7 +211,7 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
212
211
|
var _anchor5, _anchor$current;
|
|
213
212
|
anchor = ((_anchor5 = anchor) === null || _anchor5 === void 0 ? void 0 : _anchor5.element) || ((_anchor$current = anchor.current) === null || _anchor$current === void 0 ? void 0 : _anchor$current.element) || anchor.current;
|
|
214
213
|
}
|
|
215
|
-
if (!anchor) return;
|
|
214
|
+
if (!document.body.contains(anchor)) return;
|
|
216
215
|
if (arrow && anchorOrigin.vertical !== anchorOrigin.horizontal && transformOrigin.vertical !== transformOrigin.horizontal) {
|
|
217
216
|
aPosition = getArrowPosition(anchorOrigin, transformOrigin, translate);
|
|
218
217
|
}
|
|
@@ -386,8 +385,12 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
386
385
|
};
|
|
387
386
|
}, []);
|
|
388
387
|
useEffect(() => {
|
|
389
|
-
|
|
388
|
+
anchorRef.current = anchor;
|
|
389
|
+
}, [anchor]);
|
|
390
|
+
useEffect(() => {
|
|
391
|
+
var _anchor8, _anchor9, _anchorRef$current, _anchorRef$current$pr;
|
|
390
392
|
const anchorEl = ((_anchor8 = anchor) === null || _anchor8 === void 0 ? void 0 : _anchor8.element) || ((_anchor9 = anchor) === null || _anchor9 === void 0 ? void 0 : _anchor9.current) || anchor;
|
|
393
|
+
if (anchorEl !== null && anchorEl !== void 0 && anchorEl.disabled || (_anchorRef$current = anchorRef.current) !== null && _anchorRef$current !== void 0 && (_anchorRef$current$pr = _anchorRef$current.props) !== null && _anchorRef$current$pr !== void 0 && _anchorRef$current$pr.disabled) return;
|
|
391
394
|
const eventArr = eventMap.get(trigger) || [];
|
|
392
395
|
if (anchorEl && open === undefined && (eventArr === null || eventArr === void 0 ? void 0 : eventArr.length) > 0) {
|
|
393
396
|
eventArr.forEach(evt => anchorEl.addEventListener(evt, handleEventTrigger, false));
|
|
@@ -395,14 +398,16 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
395
398
|
eventArr.forEach(evt => anchorEl.removeEventListener(evt, handleEventTrigger, false));
|
|
396
399
|
};
|
|
397
400
|
}
|
|
398
|
-
}, [trigger, openState]);
|
|
401
|
+
}, [anchor, trigger, openState]);
|
|
399
402
|
useEffect(() => {
|
|
400
403
|
if (open !== undefined) setOpenState(open);
|
|
401
404
|
}, [open]);
|
|
402
405
|
useEffect(() => {
|
|
403
406
|
if (openState && ref.current) {
|
|
404
|
-
|
|
405
|
-
|
|
407
|
+
if (document.body.style.overflow !== 'hidden') {
|
|
408
|
+
overflow.current = document.body.style.overflow; // store overflow of <body /> before open
|
|
409
|
+
document.body.style.overflow = 'hidden';
|
|
410
|
+
}
|
|
406
411
|
// Position's anchor
|
|
407
412
|
updatePositionPopover();
|
|
408
413
|
|
|
@@ -483,10 +488,10 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
483
488
|
ref: ref,
|
|
484
489
|
style: style,
|
|
485
490
|
className: classNames('DGN-UI-Popover-Container', className)
|
|
486
|
-
}, children), arrow
|
|
491
|
+
}, children), arrow ? jsx("span", {
|
|
487
492
|
ref: arrowRef,
|
|
488
493
|
css: _PopoverArrowCSS
|
|
489
|
-
}));
|
|
494
|
+
}) : null);
|
|
490
495
|
return /*#__PURE__*/createPortal(node, document.body);
|
|
491
496
|
}
|
|
492
497
|
return null;
|
|
@@ -495,33 +500,34 @@ const Popover = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
495
500
|
}));
|
|
496
501
|
const PortalPopoverCSS = (zIndex, fullScreen) => css`
|
|
497
502
|
${positionFixed};
|
|
503
|
+
${fullScreen ? pointerEventsInitial : pointerEventsNone};
|
|
504
|
+
${inset(0)};
|
|
498
505
|
z-index: ${zIndex};
|
|
499
|
-
pointer-events: ${fullScreen ? 'initial' : 'none'};
|
|
500
|
-
inset: 0;
|
|
501
506
|
`;
|
|
502
|
-
const PopoverContainerCSS = (
|
|
507
|
+
const PopoverContainerCSS = (bgCl, width, height) => css`
|
|
508
|
+
${displayFlex};
|
|
503
509
|
${flexCol};
|
|
504
510
|
${positionRelative};
|
|
505
511
|
${justifyBetween};
|
|
506
512
|
${overflowAuto};
|
|
507
513
|
${borderRadius4px};
|
|
508
514
|
${paragraph1};
|
|
515
|
+
${pointerEventsInitial};
|
|
509
516
|
${parseWidthHeight(width, height)};
|
|
510
517
|
${parseMinWidthHeight(spacing([4]))};
|
|
511
518
|
${parseMaxWidthHeight(`calc(100% - ${spacing([8])})`)};
|
|
519
|
+
${bgColor(bgCl)};
|
|
512
520
|
transition: opacity 0.3s ease;
|
|
513
|
-
pointer-events: initial;
|
|
514
521
|
opacity: 0;
|
|
515
|
-
background-color: ${bgColor};
|
|
516
522
|
box-shadow: 0px 4px 4px rgba(0, 0, 0, 0.25);
|
|
517
523
|
`;
|
|
518
|
-
const PopoverArrowCSS =
|
|
519
|
-
${
|
|
524
|
+
const PopoverArrowCSS = (bgCl, arrowSize) => css`
|
|
525
|
+
${displayNone};
|
|
520
526
|
${positionAbsolute};
|
|
521
527
|
${parseWidthHeight(0)};
|
|
522
|
-
|
|
523
|
-
border-
|
|
524
|
-
border-
|
|
528
|
+
${borderBottom(arrowSize, bgCl)};
|
|
529
|
+
border-left: ${arrowSize}px solid transparent;
|
|
530
|
+
border-right: ${arrowSize}px solid transparent;
|
|
525
531
|
`;
|
|
526
532
|
Popover.defaultProps = {
|
|
527
533
|
anchorOrigin: {
|
|
@@ -529,7 +535,7 @@ Popover.defaultProps = {
|
|
|
529
535
|
horizontal: 'center'
|
|
530
536
|
},
|
|
531
537
|
arrow: false,
|
|
532
|
-
bgColor:
|
|
538
|
+
bgColor: 'system.white',
|
|
533
539
|
className: '',
|
|
534
540
|
clickOutsideToClose: true,
|
|
535
541
|
fullScreen: true,
|
|
@@ -546,10 +552,6 @@ Popover.defaultProps = {
|
|
|
546
552
|
zIndex: zIndexCORE(1)
|
|
547
553
|
};
|
|
548
554
|
Popover.propTypes = {
|
|
549
|
-
/** If `true`, the component is shown. */
|
|
550
|
-
open: PropTypes.bool,
|
|
551
|
-
/** Trigger mode of the component. Will not work when use with `open` prop. */
|
|
552
|
-
trigger: PropTypes.oneOf(['click', 'hover', 'focus']),
|
|
553
555
|
/** An HTML element, or a function that returns one. It's used to set the position of the popover. */
|
|
554
556
|
anchor: PropTypes.oneOfType([PropTypes.instanceOf(Element), PropTypes.func, PropTypes.object, PropTypes.node, ref]),
|
|
555
557
|
/**
|
|
@@ -586,6 +588,8 @@ Popover.propTypes = {
|
|
|
586
588
|
marginThreshold: PropTypes.number,
|
|
587
589
|
/** Callback fired when the component requests to be closed. */
|
|
588
590
|
onClose: PropTypes.func,
|
|
591
|
+
/** If `true`, the component is shown. */
|
|
592
|
+
open: PropTypes.bool,
|
|
589
593
|
/** If `true`, hitting escape will close component. */
|
|
590
594
|
pressESCToClose: PropTypes.bool,
|
|
591
595
|
/** Style inline of component. */
|
|
@@ -598,6 +602,8 @@ Popover.propTypes = {
|
|
|
598
602
|
horizontal: PropTypes.oneOf(['center', 'left', 'right']),
|
|
599
603
|
vertical: PropTypes.oneOf(['bottom', 'center', 'top'])
|
|
600
604
|
}),
|
|
605
|
+
/** Trigger mode of the component. Will not work when use with `open` prop. */
|
|
606
|
+
trigger: PropTypes.oneOf(['click', 'hover', 'focus']),
|
|
601
607
|
/** Width of the component. */
|
|
602
608
|
width: PropTypes.oneOfType([PropTypes.number, PropTypes.string]),
|
|
603
609
|
/** Config z-index of the component. */
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import
|
|
4
|
-
import { jsx, css } from '@emotion/core';
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
5
|
+
import React, { forwardRef, memo, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import { displayFlex, flexCol, flexRow, parseWidth, positionRelative, typographyTypes } from "../../styles/general";
|
|
6
7
|
import { classNames, randomString, refType as ref } from "../../utils";
|
|
7
8
|
import TabContext from "./context";
|
|
8
|
-
import { isNumeric } from "../../utils/type";
|
|
9
|
-
import { flexCol, flexRow, positionRelative, parseWidth, typographyTypes } from "../../styles/general";
|
|
10
9
|
const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
11
10
|
action = {},
|
|
12
11
|
children,
|
|
@@ -18,6 +17,7 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
18
17
|
width,
|
|
19
18
|
...props
|
|
20
19
|
}, reference) => {
|
|
20
|
+
if (!reference) reference = useRef(null);
|
|
21
21
|
const ref = useRef(null);
|
|
22
22
|
const {
|
|
23
23
|
value
|
|
@@ -31,7 +31,7 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
31
31
|
if (level === 'level2') level = 'p1';
|
|
32
32
|
const _TabContainerCSS = TabContainerCSS(direction, width);
|
|
33
33
|
useEffect(() => {
|
|
34
|
-
if (
|
|
34
|
+
if (typeof value === 'number') setTabIndexState(value);else setTabIndexState(tabIndex);
|
|
35
35
|
}, [value, tabIndex]);
|
|
36
36
|
useImperativeHandle(reference, () => {
|
|
37
37
|
const currentRef = ref.current || {};
|
|
@@ -63,6 +63,7 @@ const TabContainer = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
63
63
|
}, [children, className, direction, level, props, style, tabIndex, width, tabIndexState, value]);
|
|
64
64
|
}));
|
|
65
65
|
const TabContainerCSS = (direction, width) => css`
|
|
66
|
+
${displayFlex};
|
|
66
67
|
${direction === 'vertical' ? flexRow : flexCol};
|
|
67
68
|
${positionRelative};
|
|
68
69
|
${parseWidth(width)};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { ButtonIcon } from "./..";
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { boxBorder, displayNone, flexCol, flexRow, justifyCenter, overflowHidden, parseWidth, parseWidthHeight, positionRelative, whiteSpaceNoWrap } from "../../styles/general";
|
|
6
|
+
import React, { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
7
|
+
import { boxBorder, displayFlex, displayNone, flexCol, flexRow, justifyCenter, mg, overflowHidden, parseMaxWidth, parseWidth, parseWidthHeight, pd, positionRelative, selfCenter, whiteSpaceNoWrap } from "../../styles/general";
|
|
9
8
|
import { classNames, refType as ref } from "../../utils";
|
|
10
|
-
import
|
|
11
|
-
const {
|
|
12
|
-
spacing
|
|
13
|
-
} = theme;
|
|
9
|
+
import TabContext from "./context";
|
|
14
10
|
const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
15
11
|
action = {},
|
|
16
12
|
centered,
|
|
@@ -26,15 +22,16 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
26
22
|
const {
|
|
27
23
|
direction
|
|
28
24
|
} = useContext(TabContext);
|
|
25
|
+
if (!reference) reference = useRef(null);
|
|
29
26
|
const ref = useRef(null);
|
|
30
27
|
const [scrollLeft, setScrollLeft] = useState(0);
|
|
31
28
|
const isVertical = direction === 'vertical';
|
|
32
29
|
let showScrollLeftButton = !isVertical && scrollLeft > 0;
|
|
33
30
|
let showScrollRightButton = !isVertical && (ref === null || ref === void 0 ? void 0 : (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.offsetWidth) + scrollLeft < (ref === null || ref === void 0 ? void 0 : (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.scrollWidth);
|
|
34
31
|
const _ContainerCSS = ContainerCSS(centered, isVertical, width);
|
|
35
|
-
const _TabHeaderCSS = TabHeaderCSS(
|
|
36
|
-
const
|
|
37
|
-
const
|
|
32
|
+
const _TabHeaderCSS = TabHeaderCSS(width);
|
|
33
|
+
const ScrollLeftButtonCSS = ScrollButtonCSS(true, showScrollLeftButton, showScrollRightButton);
|
|
34
|
+
const ScrollRightButtonCSS = ScrollButtonCSS(false, showScrollLeftButton, showScrollRightButton);
|
|
38
35
|
const _onClickScrollButton = scrollPrevious => {
|
|
39
36
|
let scrollValue = scrollPrevious ? ref.current.scrollLeft - (ref.current.offsetWidth + 30) : ref.current.scrollLeft + (ref.current.offsetWidth + 30);
|
|
40
37
|
ref.current.scrollLeft = scrollValue;
|
|
@@ -58,7 +55,7 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
58
55
|
style: style,
|
|
59
56
|
...props
|
|
60
57
|
}, scrollButtons && !isVertical && jsx(ButtonIcon, {
|
|
61
|
-
css:
|
|
58
|
+
css: ScrollLeftButtonCSS,
|
|
62
59
|
name: isVertical ? 'ArrowUp' : 'ArrowLeft',
|
|
63
60
|
viewType: 'text',
|
|
64
61
|
size: 'tiny',
|
|
@@ -66,7 +63,7 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
66
63
|
disabled: !showScrollLeftButton,
|
|
67
64
|
onClick: () => _onClickScrollButton(true)
|
|
68
65
|
}), jsx("div", {
|
|
69
|
-
css: _TabHeaderCSS,
|
|
66
|
+
css: [_TabHeaderCSS, !isVertical && TabHeaderHorizontalCSS],
|
|
70
67
|
className: 'DGN-UI-Tab-Header',
|
|
71
68
|
ref: ref,
|
|
72
69
|
onScroll: e => {
|
|
@@ -76,7 +73,7 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
76
73
|
}, React.Children.map(children, child => child && /*#__PURE__*/React.cloneElement(child, {
|
|
77
74
|
level
|
|
78
75
|
}))), scrollButtons && !isVertical && jsx(ButtonIcon, {
|
|
79
|
-
css:
|
|
76
|
+
css: ScrollRightButtonCSS,
|
|
80
77
|
name: isVertical ? 'ArrowDown' : 'ArrowRight',
|
|
81
78
|
viewType: 'text',
|
|
82
79
|
size: 'tiny',
|
|
@@ -87,45 +84,41 @@ const TabHeader = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
87
84
|
}, [centered, children, className, level, props, scrollButtons, style, width, direction, isVertical, scrollLeft]);
|
|
88
85
|
}));
|
|
89
86
|
const ContainerCSS = (centered, isVertical, width) => css`
|
|
90
|
-
${
|
|
87
|
+
${displayFlex};
|
|
91
88
|
${overflowHidden};
|
|
92
89
|
${positionRelative};
|
|
93
90
|
${boxBorder};
|
|
94
91
|
${parseWidthHeight(width, 'auto')};
|
|
95
92
|
${centered && justifyCenter};
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
93
|
+
${isVertical ? flexCol : flexRow};
|
|
94
|
+
${parseMaxWidth(isVertical ? 'max-content' : '100%')};
|
|
95
|
+
${pd(0)};
|
|
99
96
|
`;
|
|
100
|
-
const TabHeaderCSS =
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
97
|
+
const TabHeaderCSS = width => css`
|
|
98
|
+
${displayFlex};
|
|
99
|
+
${flexCol};
|
|
100
|
+
${parseWidth(width)};
|
|
101
|
+
`;
|
|
102
|
+
const TabHeaderHorizontalCSS = css`
|
|
103
|
+
${flexRow};
|
|
104
|
+
${positionRelative};
|
|
105
|
+
${whiteSpaceNoWrap};
|
|
106
|
+
${mg(0)};
|
|
107
|
+
overflow-x: auto;
|
|
108
|
+
scroll-behavior: smooth;
|
|
109
|
+
scroll-snap-type: x mandatory;
|
|
110
|
+
scroll-padding: 50%;
|
|
111
|
+
transition: 0.3s ease-in-out 0.3s;
|
|
112
|
+
&::-webkit-scrollbar {
|
|
113
|
+
${displayNone};
|
|
114
|
+
}
|
|
115
|
+
`;
|
|
116
|
+
const ScrollButtonCSS = (scrollPrevious, showScrollLeftButton, showScrollRightButton) => css`
|
|
119
117
|
${parseWidthHeight(24, 24)};
|
|
118
|
+
${selfCenter};
|
|
119
|
+
${mg(scrollPrevious ? [0, 2, 0, 0] : [0, 0, 0, 2])}
|
|
120
120
|
overflow: initial;
|
|
121
|
-
align-self: center;
|
|
122
|
-
margin: ${scrollPrevious ? spacing([0, 2, 0, 0]) : spacing([0, 0, 0, 2])};
|
|
123
121
|
opacity: ${scrollPrevious && showScrollLeftButton || !scrollPrevious && showScrollRightButton ? '1' : '0'};
|
|
124
|
-
:disabled {
|
|
125
|
-
span {
|
|
126
|
-
cursor: default !important;
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
122
|
`;
|
|
130
123
|
TabHeader.defaultProps = {
|
|
131
124
|
centered: false,
|
|
@@ -1,20 +1,11 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
4
|
-
import { jsx, css } from '@emotion/core';
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
5
4
|
import PropTypes from 'prop-types';
|
|
6
|
-
import
|
|
7
|
-
import { boxBorder, displayNone, flexCol, parseWidthHeight, positionRelative } from "../../styles/general";
|
|
8
|
-
import theme from "../../theme/settings";
|
|
5
|
+
import { forwardRef, memo, useContext, useEffect, useImperativeHandle, useMemo, useRef, useState } from 'react';
|
|
6
|
+
import { boxBorder, displayFlex, displayNone, flexCol, parseWidthHeight, pd, positionRelative, textColor } from "../../styles/general";
|
|
9
7
|
import { classNames, refType as ref } from "../../utils";
|
|
10
|
-
|
|
11
|
-
colors: {
|
|
12
|
-
text: {
|
|
13
|
-
main
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
spacing
|
|
17
|
-
} = theme;
|
|
8
|
+
import TabContext from "./context";
|
|
18
9
|
const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
19
10
|
action = {},
|
|
20
11
|
children,
|
|
@@ -28,6 +19,7 @@ const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
28
19
|
tabIndexState,
|
|
29
20
|
direction
|
|
30
21
|
} = useContext(TabContext);
|
|
22
|
+
if (!reference) reference = useRef(null);
|
|
31
23
|
const [isRendered, setIsRendered] = useState(false);
|
|
32
24
|
const ref = useRef(null);
|
|
33
25
|
const isVertical = direction === 'vertical';
|
|
@@ -60,13 +52,14 @@ const TabPanel = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
60
52
|
}, [children, className, index, lazyLoading, props, style, isActive, isRendered, tabIndexState]);
|
|
61
53
|
}));
|
|
62
54
|
const TabPanelCSS = (isVertical, isActive) => css`
|
|
55
|
+
${displayFlex};
|
|
63
56
|
${flexCol};
|
|
64
57
|
${boxBorder};
|
|
65
58
|
${positionRelative};
|
|
66
59
|
${isActive ? flexCol : displayNone};
|
|
67
|
-
${parseWidthHeight('100%', isVertical ? 300 : '100%')}
|
|
68
|
-
|
|
69
|
-
|
|
60
|
+
${parseWidthHeight('100%', isVertical ? 300 : '100%')};
|
|
61
|
+
${textColor('text.main')};
|
|
62
|
+
${pd([0, isVertical ? 3 : 2.5])};
|
|
70
63
|
`;
|
|
71
64
|
TabPanel.defaultProps = {
|
|
72
65
|
className: '',
|
package/components/tab/tab.js
CHANGED
|
@@ -1,26 +1,13 @@
|
|
|
1
1
|
/** @jsxRuntime classic */
|
|
2
2
|
/** @jsx jsx */
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import PropTypes from 'prop-types';
|
|
6
|
-
import Icon from "../../icons";
|
|
7
|
-
import { useTheme, useColor as colors } from "../../theme";
|
|
3
|
+
import { css, jsx } from '@emotion/core';
|
|
4
|
+
import { Icon, Typography } from "./..";
|
|
8
5
|
import Ripple from "../button/ripple-effect";
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import {
|
|
6
|
+
import PropTypes from 'prop-types';
|
|
7
|
+
import { forwardRef, memo, useContext, useImperativeHandle, useMemo, useRef } from 'react';
|
|
8
|
+
import { bgColor, bgTransparent, borderRadius, boxBorder, breakWord, cursorDefault, cursorPointer, displayFlex, flexRow, itemsCenter, justifyCenter, justifyStart, mgl, mgr, outlineNone, overflowHidden, parseHeight, parseMaxWidth, parseMaxWidthHeight, parseMinWidth, parseWidth, pd, pointerEventsAuto, pointerEventsNone, positionAbsolute, positionRelative, shadowNone, textCenter, textColor, userSelectNone, whiteSpaceNoWrap } from "../../styles/general";
|
|
12
9
|
import { classNames, refType as ref } from "../../utils";
|
|
13
|
-
|
|
14
|
-
colors: {
|
|
15
|
-
system: {
|
|
16
|
-
active,
|
|
17
|
-
disabled: systemDisabled,
|
|
18
|
-
rest,
|
|
19
|
-
white
|
|
20
|
-
}
|
|
21
|
-
},
|
|
22
|
-
spacing
|
|
23
|
-
} = useTheme();
|
|
10
|
+
import TabContext from "./context";
|
|
24
11
|
const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
25
12
|
action = {},
|
|
26
13
|
children,
|
|
@@ -42,13 +29,16 @@ const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
42
29
|
setTabIndexState,
|
|
43
30
|
direction
|
|
44
31
|
} = useContext(TabContext);
|
|
32
|
+
if (!reference) reference = useRef(null);
|
|
45
33
|
const ref = useRef(null);
|
|
34
|
+
const rippleRef = useRef(null);
|
|
46
35
|
const isVertical = direction === 'vertical';
|
|
47
|
-
const
|
|
36
|
+
const _TabItemCSS = TabItemCSS(color, isVertical);
|
|
48
37
|
const _IndicatorCSS = IndicatorCSS(isVertical);
|
|
49
|
-
const _onClick =
|
|
38
|
+
const _onClick = e => {
|
|
50
39
|
if (disabled) return;
|
|
51
|
-
|
|
40
|
+
rippleRef.current.start(e);
|
|
41
|
+
onClick ? onClick(e, index) : setTabIndexState(index);
|
|
52
42
|
};
|
|
53
43
|
useImperativeHandle(reference, () => {
|
|
54
44
|
const currentRef = ref.current || {};
|
|
@@ -60,50 +50,44 @@ const TabItem = /*#__PURE__*/memo( /*#__PURE__*/forwardRef(({
|
|
|
60
50
|
currentRef.instance = _instance;
|
|
61
51
|
return currentRef;
|
|
62
52
|
});
|
|
63
|
-
const
|
|
64
|
-
let node =
|
|
65
|
-
if (typeof node === 'string') {
|
|
66
|
-
node = jsx(Icon, {
|
|
67
|
-
color: 'currentColor',
|
|
68
|
-
name: startIcon
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
return jsx("span", {
|
|
72
|
-
css: ButtonIconCSS
|
|
73
|
-
}, " ", node, " ");
|
|
74
|
-
}, [startIcon]);
|
|
75
|
-
const EndIcon = useMemo(() => {
|
|
76
|
-
let node = endIcon;
|
|
53
|
+
const renderIcon = (icon, isEndIcon) => {
|
|
54
|
+
let node = icon;
|
|
77
55
|
if (typeof node === 'string') {
|
|
78
56
|
node = jsx(Icon, {
|
|
79
57
|
color: 'currentColor',
|
|
80
|
-
name:
|
|
58
|
+
name: icon
|
|
81
59
|
});
|
|
82
60
|
}
|
|
83
61
|
return jsx("span", {
|
|
84
|
-
css:
|
|
85
|
-
className: 'end-icon'
|
|
86
|
-
},
|
|
87
|
-
}
|
|
62
|
+
css: IconCSS,
|
|
63
|
+
className: isEndIcon ? 'end-icon' : ''
|
|
64
|
+
}, node);
|
|
65
|
+
};
|
|
88
66
|
return useMemo(() => {
|
|
89
67
|
return jsx("div", {
|
|
90
|
-
css:
|
|
68
|
+
css: [_TabItemCSS, disabled && TabItemDisabledCSS, index === tabIndexState && !disabled && TabItemSelectedCSS],
|
|
91
69
|
ref: ref,
|
|
92
70
|
className: classNames('DGN-UI-Tab-Item', disabled && 'disabled', index === tabIndexState && !disabled && 'selected', className),
|
|
93
71
|
style: style,
|
|
94
72
|
onClick: _onClick,
|
|
95
73
|
...props
|
|
96
|
-
}, startIcon &&
|
|
97
|
-
...labelProps,
|
|
74
|
+
}, startIcon && renderIcon(startIcon), jsx(Typography, {
|
|
98
75
|
type: level,
|
|
99
|
-
color: 'inherit'
|
|
100
|
-
|
|
76
|
+
color: 'inherit',
|
|
77
|
+
lineClamp: 1,
|
|
78
|
+
hoverTooltip: true,
|
|
79
|
+
...labelProps
|
|
80
|
+
}, label), children, endIcon && renderIcon(endIcon, true), jsx(Ripple, {
|
|
81
|
+
ref: rippleRef,
|
|
82
|
+
css: pointerEventsNone
|
|
83
|
+
}), jsx("span", {
|
|
101
84
|
css: _IndicatorCSS,
|
|
102
85
|
className: 'Indicator'
|
|
103
86
|
}));
|
|
104
|
-
}, [children, className, color, disabled, endIcon, index, label, level, onClick, props, startIcon, style, isVertical, tabIndexState]);
|
|
87
|
+
}, [children, className, color, disabled, endIcon, index, label, labelProps, level, onClick, props, startIcon, style, isVertical, tabIndexState]);
|
|
105
88
|
}));
|
|
106
|
-
const
|
|
89
|
+
const TabItemCSS = (color, isVertical) => css`
|
|
90
|
+
${displayFlex};
|
|
107
91
|
${flexRow};
|
|
108
92
|
${overflowHidden};
|
|
109
93
|
${itemsCenter};
|
|
@@ -116,65 +100,66 @@ const TabButtonCSS = (color, isVertical) => css`
|
|
|
116
100
|
${whiteSpaceNoWrap};
|
|
117
101
|
${shadowNone};
|
|
118
102
|
${!isVertical && textCenter};
|
|
103
|
+
${bgColor('system.white')};
|
|
104
|
+
${textColor(color)};
|
|
105
|
+
${parseMinWidth(80)};
|
|
106
|
+
${parseMaxWidth(isVertical ? '100%' : 287)};
|
|
107
|
+
${pd(isVertical ? [3.5, 4] : [2, 4])}
|
|
108
|
+
${pointerEventsAuto};
|
|
109
|
+
${userSelectNone};
|
|
119
110
|
flex: 0 0 auto;
|
|
120
|
-
background-color: ${white};
|
|
121
111
|
border: 0;
|
|
122
|
-
color: ${colors[color] || color || rest};
|
|
123
|
-
max-width: ${isVertical ? '100%' : '287px'};
|
|
124
|
-
min-width: 80px;
|
|
125
|
-
padding: ${isVertical ? spacing([3.5, 4]) : spacing([2.5, 4])};
|
|
126
|
-
pointer-events: auto;
|
|
127
112
|
transition: all 0.2s ease-in-out, background-color 0.2s ease-in-out;
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
${
|
|
131
|
-
${
|
|
132
|
-
color: ${systemDisabled};
|
|
133
|
-
}
|
|
134
|
-
:hover,
|
|
135
|
-
:focus:not(.selected):not(:disabled) {
|
|
136
|
-
background-color: ${white};
|
|
137
|
-
color: ${rest};
|
|
113
|
+
:hover:not(.selected):not(.disabled),
|
|
114
|
+
:focus {
|
|
115
|
+
${bgColor('system.white')};
|
|
116
|
+
${textColor('system.rest')};
|
|
138
117
|
.Indicator {
|
|
139
|
-
|
|
118
|
+
${bgColor('system.rest')};
|
|
140
119
|
transform: scale(1);
|
|
141
120
|
}
|
|
142
121
|
}
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
122
|
+
`;
|
|
123
|
+
const TabItemDisabledCSS = css`
|
|
124
|
+
${pointerEventsNone};
|
|
125
|
+
${bgTransparent};
|
|
126
|
+
${cursorDefault};
|
|
127
|
+
${textColor('system.disabled')};
|
|
128
|
+
`;
|
|
129
|
+
const TabItemSelectedCSS = css`
|
|
130
|
+
${bgColor('system.white')};
|
|
131
|
+
${textColor('system.active')};
|
|
132
|
+
.Indicator {
|
|
133
|
+
${bgColor('system.active')};
|
|
134
|
+
transform: scale(1);
|
|
150
135
|
}
|
|
151
136
|
`;
|
|
152
137
|
const IndicatorCSS = isVertical => css`
|
|
153
138
|
${positionAbsolute};
|
|
154
|
-
|
|
155
|
-
|
|
139
|
+
${parseHeight(isVertical ? '100%' : 4)};
|
|
140
|
+
${parseWidth(isVertical ? 4 : '100%')}
|
|
141
|
+
${borderRadius(1)};
|
|
156
142
|
bottom: 0;
|
|
157
143
|
left: 0;
|
|
158
144
|
transform: ${isVertical ? 'scaleY(0)' : 'scaleX(0)'};
|
|
159
145
|
transition: transform 0.2s ease-in-out;
|
|
160
|
-
border-radius: 1px;
|
|
161
146
|
`;
|
|
162
|
-
const
|
|
147
|
+
const IconCSS = css`
|
|
163
148
|
${flexRow};
|
|
164
149
|
${itemsCenter};
|
|
165
150
|
${justifyCenter};
|
|
166
151
|
${positionRelative};
|
|
167
152
|
${boxBorder};
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
margin-right: ${spacing([1])};
|
|
153
|
+
${parseMaxWidthHeight(24)};
|
|
154
|
+
${mgr([1])};
|
|
171
155
|
&.end-icon {
|
|
172
|
-
|
|
173
|
-
|
|
156
|
+
${mgr('unset')};
|
|
157
|
+
${mgl([1])};
|
|
174
158
|
}
|
|
175
159
|
`;
|
|
176
160
|
TabItem.defaultProps = {
|
|
177
161
|
className: '',
|
|
162
|
+
color: 'system.rest',
|
|
178
163
|
disabled: false,
|
|
179
164
|
label: '',
|
|
180
165
|
style: {}
|
package/icons/basic.js
CHANGED
|
@@ -1156,6 +1156,34 @@ export const Block = /*#__PURE__*/memo(({
|
|
|
1156
1156
|
fill: colors[color] || color
|
|
1157
1157
|
}));
|
|
1158
1158
|
});
|
|
1159
|
+
export const Cake = /*#__PURE__*/memo(({
|
|
1160
|
+
width,
|
|
1161
|
+
height,
|
|
1162
|
+
color = '#7F828E',
|
|
1163
|
+
viewBox = false
|
|
1164
|
+
}) => {
|
|
1165
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
1166
|
+
width: width || 24,
|
|
1167
|
+
height: height || 24,
|
|
1168
|
+
viewBox: "0 0 24 24",
|
|
1169
|
+
fill: "none"
|
|
1170
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1171
|
+
fillRule: "evenodd",
|
|
1172
|
+
clipRule: "evenodd",
|
|
1173
|
+
d: "M12 6C13.11 6 14 5.1 14 4C14 3.62 13.9 3.27 13.71 2.97L12 0L10.29 2.97C10.1 3.27 10 3.62 10 4C10 5.1 10.9 6 12 6ZM16.6 15.99L15.53 14.92L14.45 15.99C13.15 17.29 10.87 17.3 9.56 15.99L8.49 14.92L7.4 15.99C6.75 16.64 5.88 17 4.96 17C4.23 17 3.56 16.77 3 16.39V21C3 21.55 3.45 22 4 22H20C20.55 22 21 21.55 21 21V16.39C20.44 16.77 19.77 17 19.04 17C18.12 17 17.25 16.64 16.6 15.99ZM13 9H18C19.66 9 21 10.34 20.99 12V13.54C20.99 14.62 20.11 15.5 19.03 15.5C18.51 15.5 18.02 15.3 17.65 14.93L15.52 12.8L13.38 14.93C12.64 15.67 11.35 15.67 10.61 14.93L8.48 12.8L6.34 14.93C5.98 15.3 5.48 15.5 4.96 15.5C3.88 15.5 3 14.62 3 13.54V12C3 10.34 4.34 9 6 9H11V7H13V9Z",
|
|
1174
|
+
fill: colors[color] || color
|
|
1175
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
1176
|
+
width: width || 18,
|
|
1177
|
+
height: height || 22,
|
|
1178
|
+
viewBox: "0 0 18 22",
|
|
1179
|
+
fill: "none"
|
|
1180
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1181
|
+
fillRule: "evenodd",
|
|
1182
|
+
clipRule: "evenodd",
|
|
1183
|
+
d: "M9 6C10.11 6 11 5.1 11 4C11 3.62 10.9 3.27 10.71 2.97L9 0L7.29 2.97C7.1 3.27 7 3.62 7 4C7 5.1 7.9 6 9 6ZM13.6 15.99L12.53 14.92L11.45 15.99C10.15 17.29 7.87 17.3 6.56 15.99L5.49 14.92L4.4 15.99C3.75 16.64 2.88 17 1.96 17C1.23 17 0.56 16.77 0 16.39V21C0 21.55 0.45 22 1 22H17C17.55 22 18 21.55 18 21V16.39C17.44 16.77 16.77 17 16.04 17C15.12 17 14.25 16.64 13.6 15.99ZM10 9H15C16.66 9 18 10.34 17.99 12V13.54C17.99 14.62 17.11 15.5 16.03 15.5C15.51 15.5 15.02 15.3 14.65 14.93L12.52 12.8L10.38 14.93C9.64 15.67 8.35 15.67 7.61 14.93L5.48 12.8L3.34 14.93C2.98 15.3 2.48 15.5 1.96 15.5C0.88 15.5 0 14.62 0 13.54V12C0 10.34 1.34 9 3 9H8V7H10V9Z",
|
|
1184
|
+
fill: colors[color] || color
|
|
1185
|
+
}));
|
|
1186
|
+
});
|
|
1159
1187
|
export const Calculate = /*#__PURE__*/memo(({
|
|
1160
1188
|
width,
|
|
1161
1189
|
height,
|
|
@@ -1412,6 +1440,34 @@ export const Chat = /*#__PURE__*/memo(({
|
|
|
1412
1440
|
fill: '#FFF'
|
|
1413
1441
|
}));
|
|
1414
1442
|
});
|
|
1443
|
+
export const ChatAnswer = /*#__PURE__*/memo(({
|
|
1444
|
+
width,
|
|
1445
|
+
height,
|
|
1446
|
+
color = '#7F828E',
|
|
1447
|
+
viewBox = false
|
|
1448
|
+
}) => {
|
|
1449
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
1450
|
+
width: width || 24,
|
|
1451
|
+
height: height || 24,
|
|
1452
|
+
viewBox: "0 0 24 24",
|
|
1453
|
+
fill: "none"
|
|
1454
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1455
|
+
fillRule: "evenodd",
|
|
1456
|
+
clipRule: "evenodd",
|
|
1457
|
+
d: "M17 3V12C17 12.55 16.55 13 16 13H6L2 17V3C2 2.45 2.45 2 3 2H16C16.55 2 17 2.45 17 3ZM19 6H21C21.55 6 22 6.45 22 7V22L18 18H7C6.45 18 6 17.55 6 17V15H19V6Z",
|
|
1458
|
+
fill: colors[color] || color
|
|
1459
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
1460
|
+
width: width || 20,
|
|
1461
|
+
height: height || 20,
|
|
1462
|
+
viewBox: "0 0 20 20",
|
|
1463
|
+
fill: "none"
|
|
1464
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
1465
|
+
fillRule: "evenodd",
|
|
1466
|
+
clipRule: "evenodd",
|
|
1467
|
+
d: "M15 1V10C15 10.55 14.55 11 14 11H4L0 15V1C0 0.45 0.45 0 1 0H14C14.55 0 15 0.45 15 1ZM17 4H19C19.55 4 20 4.45 20 5V20L16 16H5C4.45 16 4 15.55 4 15V13H17V4Z",
|
|
1468
|
+
fill: colors[color] || color
|
|
1469
|
+
}));
|
|
1470
|
+
});
|
|
1415
1471
|
export const ChatBubble = /*#__PURE__*/memo(({
|
|
1416
1472
|
width,
|
|
1417
1473
|
height,
|
|
@@ -4295,6 +4351,34 @@ export const PaperZoom = /*#__PURE__*/memo(({
|
|
|
4295
4351
|
fill: colors[color] || color
|
|
4296
4352
|
}));
|
|
4297
4353
|
});
|
|
4354
|
+
export const Pause = /*#__PURE__*/memo(({
|
|
4355
|
+
width,
|
|
4356
|
+
height,
|
|
4357
|
+
color = '#7F828E',
|
|
4358
|
+
viewBox = false
|
|
4359
|
+
}) => {
|
|
4360
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
4361
|
+
width: width || 24,
|
|
4362
|
+
height: height || 24,
|
|
4363
|
+
viewBox: "0 0 24 24",
|
|
4364
|
+
fill: "none"
|
|
4365
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
4366
|
+
fillRule: "evenodd",
|
|
4367
|
+
clipRule: "evenodd",
|
|
4368
|
+
d: "M10 19H6V5H10V19ZM14 19V5H18V19H14Z",
|
|
4369
|
+
fill: colors[color] || color
|
|
4370
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
4371
|
+
width: width || 12,
|
|
4372
|
+
height: height || 14,
|
|
4373
|
+
viewBox: "0 0 12 14",
|
|
4374
|
+
fill: "none"
|
|
4375
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
4376
|
+
fillRule: "evenodd",
|
|
4377
|
+
clipRule: "evenodd",
|
|
4378
|
+
d: "M4 14H0V0H4V14ZM8 14V0H12V14H8Z",
|
|
4379
|
+
fill: colors[color] || color
|
|
4380
|
+
}));
|
|
4381
|
+
});
|
|
4298
4382
|
export const Payment = /*#__PURE__*/memo(({
|
|
4299
4383
|
width,
|
|
4300
4384
|
height,
|
|
@@ -5083,6 +5167,30 @@ export const Printer = /*#__PURE__*/memo(({
|
|
|
5083
5167
|
fill: colors[color] || color
|
|
5084
5168
|
}));
|
|
5085
5169
|
});
|
|
5170
|
+
export const Question = /*#__PURE__*/memo(({
|
|
5171
|
+
width,
|
|
5172
|
+
height,
|
|
5173
|
+
color = '#7F828E',
|
|
5174
|
+
viewBox = false
|
|
5175
|
+
}) => {
|
|
5176
|
+
return viewBox ? /*#__PURE__*/React.createElement("svg", {
|
|
5177
|
+
width: width || 24,
|
|
5178
|
+
height: height || 24,
|
|
5179
|
+
viewBox: "0 0 24 24",
|
|
5180
|
+
fill: "none"
|
|
5181
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
5182
|
+
d: "M11.07 12.85C11.84 11.46 13.32 10.64 14.18 9.41C15.09 8.12 14.58 5.71 12 5.71C10.31 5.71 9.48004 6.99 9.13004 8.05L6.54004 6.96C7.25004 4.83 9.18004 3 11.99 3C14.34 3 15.95 4.07 16.77 5.41C17.47 6.56 17.88 8.71 16.8 10.31C15.6 12.08 14.45 12.62 13.83 13.76C13.58 14.22 13.48 14.52 13.48 16H10.59C10.58 15.22 10.46 13.95 11.07 12.85ZM14 20C14 21.1 13.1 22 12 22C10.9 22 10 21.1 10 20C10 18.9 10.9 18 12 18C13.1 18 14 18.9 14 20Z",
|
|
5183
|
+
fill: colors[color] || color
|
|
5184
|
+
})) : /*#__PURE__*/React.createElement("svg", {
|
|
5185
|
+
width: width || 12,
|
|
5186
|
+
height: height || 19,
|
|
5187
|
+
viewBox: "0 0 12 19",
|
|
5188
|
+
fill: "none"
|
|
5189
|
+
}, /*#__PURE__*/React.createElement("path", {
|
|
5190
|
+
d: "M5.07004 9.85C5.84004 8.46 7.32004 7.64 8.18004 6.41C9.09004 5.12 8.58004 2.71 6.00004 2.71C4.31004 2.71 3.48004 3.99 3.13004 5.05L0.540039 3.96C1.25004 1.83 3.18004 0 5.99004 0C8.34004 0 9.95004 1.07 10.77 2.41C11.47 3.56 11.88 5.71 10.8 7.31C9.60004 9.08 8.45004 9.62 7.83004 10.76C7.58004 11.22 7.48004 11.52 7.48004 13H4.59004C4.58004 12.22 4.46004 10.95 5.07004 9.85ZM8.00004 17C8.00004 18.1 7.10004 19 6.00004 19C4.90004 19 4.00004 18.1 4.00004 17C4.00004 15.9 4.90004 15 6.00004 15C7.10004 15 8.00004 15.9 8.00004 17Z",
|
|
5191
|
+
fill: colors[color] || color
|
|
5192
|
+
}));
|
|
5193
|
+
});
|
|
5086
5194
|
export const QuestionMark = /*#__PURE__*/memo(({
|
|
5087
5195
|
width,
|
|
5088
5196
|
height,
|
package/package.json
CHANGED
package/readme.md
CHANGED
|
@@ -38,6 +38,15 @@ npm test
|
|
|
38
38
|
```
|
|
39
39
|
|
|
40
40
|
## Changelog
|
|
41
|
+
## 1.3.90
|
|
42
|
+
- \[Added\]: Breadcrumb – Add component Breadcrumb
|
|
43
|
+
- \[Added\]: Icon – Question, Pause, Cake, ChatAnswer
|
|
44
|
+
- \[Added\]: IconMenu – MHRP51N0003
|
|
45
|
+
- \[Fixed\]: Popover – Fix bug css overflow hidden of document body
|
|
46
|
+
- \[Fixed\]: TAB – Fix UI not match design, fix missing ripple effect
|
|
47
|
+
- \[Fixed\]: Popover – Fix bug popover still open when ButtonIcon disabled
|
|
48
|
+
- \[Fixed\]: Popover – Fix bug update wrong position if anchor not exists
|
|
49
|
+
|
|
41
50
|
## 1.3.89
|
|
42
51
|
- \[Added\]: COLORS – Replace base colors with design system colors
|
|
43
52
|
- \[Added\]: UTILS – Add storybook for utils
|
package/styles/colors.js
CHANGED
|
@@ -323,6 +323,7 @@ color.line = {
|
|
|
323
323
|
tab: color.dark2
|
|
324
324
|
};
|
|
325
325
|
color.primary = color.system.active;
|
|
326
|
+
color.secondary = color.system.rest;
|
|
326
327
|
color.success = color.semantic.success;
|
|
327
328
|
color.warning = color.semantic.warning;
|
|
328
329
|
color.danger = color.semantic.danger;
|
package/styles/general.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { css } from '@emotion/core';
|
|
2
|
-
import { color } from "./colors";
|
|
3
2
|
import { getColor, parseCSSValue, parseToPixel } from "./utils";
|
|
4
3
|
export const rootSpacing = 4;
|
|
5
4
|
export let rootZIndex = 1500;
|
|
@@ -49,7 +48,16 @@ const bgTransparent = css`
|
|
|
49
48
|
background-color: transparent;
|
|
50
49
|
`;
|
|
51
50
|
const border = (withVl, colorVl) => css`
|
|
52
|
-
border: ${parseToPixel(withVl)} solid ${colorVl ||
|
|
51
|
+
border: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system.dark')};
|
|
52
|
+
`;
|
|
53
|
+
const borderBottom = (withVl, colorVl) => css`
|
|
54
|
+
border-bottom: ${parseToPixel(withVl)} solid ${getColor(colorVl || 'system.dark')};
|
|
55
|
+
`;
|
|
56
|
+
const borderBottomColor = cl => css`
|
|
57
|
+
border-bottom-color: ${getColor(cl)};
|
|
58
|
+
`;
|
|
59
|
+
const borderColor = cl => css`
|
|
60
|
+
border-color: ${getColor(cl)};
|
|
53
61
|
`;
|
|
54
62
|
const borderNone = css`
|
|
55
63
|
border: none;
|
|
@@ -66,15 +74,15 @@ const borderRadius4px = css`
|
|
|
66
74
|
const borderRadius50 = css`
|
|
67
75
|
border-radius: 50%;
|
|
68
76
|
`;
|
|
77
|
+
const bottom = vl => css`
|
|
78
|
+
bottom: ${parseCSSValue(vl)};
|
|
79
|
+
`;
|
|
69
80
|
const boxBorder = css`
|
|
70
81
|
box-sizing: border-box;
|
|
71
82
|
`;
|
|
72
83
|
const boxContent = css`
|
|
73
84
|
box-sizing: content-box;
|
|
74
85
|
`;
|
|
75
|
-
const shadowNone = css`
|
|
76
|
-
box-shadow: none;
|
|
77
|
-
`;
|
|
78
86
|
const breakAll = css`
|
|
79
87
|
word-break: break-all;
|
|
80
88
|
`;
|
|
@@ -117,6 +125,9 @@ const displayFlex = css`
|
|
|
117
125
|
const displayNone = css`
|
|
118
126
|
display: none;
|
|
119
127
|
`;
|
|
128
|
+
const fill = cl => css`
|
|
129
|
+
fill: ${getColor(cl)};
|
|
130
|
+
`;
|
|
120
131
|
const flexCol = css`
|
|
121
132
|
display: flex;
|
|
122
133
|
flex-direction: column;
|
|
@@ -176,6 +187,9 @@ const insetY = vl => css`
|
|
|
176
187
|
top: ${parseCSSValue(vl)};
|
|
177
188
|
bottom: ${parseCSSValue(vl)};
|
|
178
189
|
`;
|
|
190
|
+
const invisible = css`
|
|
191
|
+
visibility: hidden;
|
|
192
|
+
`;
|
|
179
193
|
const italic = css`
|
|
180
194
|
font-style: italic;
|
|
181
195
|
`;
|
|
@@ -206,6 +220,9 @@ const justifyEvenly = css`
|
|
|
206
220
|
const justifyStart = css`
|
|
207
221
|
justify-content: flex-start;
|
|
208
222
|
`;
|
|
223
|
+
const left = vl => css`
|
|
224
|
+
left: ${parseCSSValue(vl)};
|
|
225
|
+
`;
|
|
209
226
|
const mg = vl => css`
|
|
210
227
|
margin: ${getSpacing(vl)};
|
|
211
228
|
`;
|
|
@@ -265,29 +282,6 @@ const overflowAuto = css`
|
|
|
265
282
|
const overflowHidden = css`
|
|
266
283
|
overflow: hidden;
|
|
267
284
|
`;
|
|
268
|
-
const pd = vl => css`
|
|
269
|
-
padding: ${getSpacing(vl)};
|
|
270
|
-
`;
|
|
271
|
-
const pdb = vl => css`
|
|
272
|
-
padding-bottom: ${getSpacing(vl)};
|
|
273
|
-
`;
|
|
274
|
-
const pdl = vl => css`
|
|
275
|
-
padding-left: ${getSpacing(vl)};
|
|
276
|
-
`;
|
|
277
|
-
const pdr = vl => css`
|
|
278
|
-
padding-right: ${getSpacing(vl)};
|
|
279
|
-
`;
|
|
280
|
-
const pdt = vl => css`
|
|
281
|
-
padding-top: ${getSpacing(vl)};
|
|
282
|
-
`;
|
|
283
|
-
const pdx = vl => css`
|
|
284
|
-
padding-left: ${getSpacing(vl)};
|
|
285
|
-
padding-right: ${getSpacing(vl)};
|
|
286
|
-
`;
|
|
287
|
-
const pdy = vl => css`
|
|
288
|
-
padding-top: ${getSpacing(vl)};
|
|
289
|
-
padding-bottom: ${getSpacing(vl)};
|
|
290
|
-
`;
|
|
291
285
|
const parseHeight = height => css`
|
|
292
286
|
height: ${parseCSSValue(height)};
|
|
293
287
|
`;
|
|
@@ -318,6 +312,29 @@ const parseWidthHeight = (width, height = width) => css`
|
|
|
318
312
|
width: ${parseCSSValue(width)};
|
|
319
313
|
height: ${parseCSSValue(height)};
|
|
320
314
|
`;
|
|
315
|
+
const pd = vl => css`
|
|
316
|
+
padding: ${getSpacing(vl)};
|
|
317
|
+
`;
|
|
318
|
+
const pdb = vl => css`
|
|
319
|
+
padding-bottom: ${getSpacing(vl)};
|
|
320
|
+
`;
|
|
321
|
+
const pdl = vl => css`
|
|
322
|
+
padding-left: ${getSpacing(vl)};
|
|
323
|
+
`;
|
|
324
|
+
const pdr = vl => css`
|
|
325
|
+
padding-right: ${getSpacing(vl)};
|
|
326
|
+
`;
|
|
327
|
+
const pdt = vl => css`
|
|
328
|
+
padding-top: ${getSpacing(vl)};
|
|
329
|
+
`;
|
|
330
|
+
const pdx = vl => css`
|
|
331
|
+
padding-left: ${getSpacing(vl)};
|
|
332
|
+
padding-right: ${getSpacing(vl)};
|
|
333
|
+
`;
|
|
334
|
+
const pdy = vl => css`
|
|
335
|
+
padding-top: ${getSpacing(vl)};
|
|
336
|
+
padding-bottom: ${getSpacing(vl)};
|
|
337
|
+
`;
|
|
321
338
|
const pointerEventsAuto = css`
|
|
322
339
|
pointer-events: auto;
|
|
323
340
|
`;
|
|
@@ -342,6 +359,18 @@ const positionRelative = css`
|
|
|
342
359
|
const positionSticky = css`
|
|
343
360
|
position: sticky;
|
|
344
361
|
`;
|
|
362
|
+
const right = vl => css`
|
|
363
|
+
right: ${parseCSSValue(vl)};
|
|
364
|
+
`;
|
|
365
|
+
const scale = vl => css`
|
|
366
|
+
transform: scale(${vl});
|
|
367
|
+
`;
|
|
368
|
+
const scaleX = vl => css`
|
|
369
|
+
transform: scaleX(${vl});
|
|
370
|
+
`;
|
|
371
|
+
const scaleY = vl => css`
|
|
372
|
+
transform: scaleY(${vl});
|
|
373
|
+
`;
|
|
345
374
|
const selfCenter = css`
|
|
346
375
|
align-self: center;
|
|
347
376
|
`;
|
|
@@ -351,6 +380,9 @@ const selfEnd = css`
|
|
|
351
380
|
const selfStart = css`
|
|
352
381
|
align-self: flex-start;
|
|
353
382
|
`;
|
|
383
|
+
const shadowNone = css`
|
|
384
|
+
box-shadow: none;
|
|
385
|
+
`;
|
|
354
386
|
const textCapitalize = css`
|
|
355
387
|
text-transform: capitalize;
|
|
356
388
|
`;
|
|
@@ -384,6 +416,9 @@ const textunderline = css`
|
|
|
384
416
|
const textUppercase = css`
|
|
385
417
|
text-transform: uppercase;
|
|
386
418
|
`;
|
|
419
|
+
const top = vl => css`
|
|
420
|
+
top: ${parseCSSValue(vl)};
|
|
421
|
+
`;
|
|
387
422
|
const truncate = css`
|
|
388
423
|
overflow: hidden;
|
|
389
424
|
text-overflow: ellipsis;
|
|
@@ -392,6 +427,9 @@ const truncate = css`
|
|
|
392
427
|
const userSelectNone = css`
|
|
393
428
|
user-select: none;
|
|
394
429
|
`;
|
|
430
|
+
const visible = css`
|
|
431
|
+
visibility: visible;
|
|
432
|
+
`;
|
|
395
433
|
const whiteSpaceBreakSpaces = css`
|
|
396
434
|
white-space: break-spaces;
|
|
397
435
|
`;
|
|
@@ -404,4 +442,4 @@ const whiteSpacePreWrap = css`
|
|
|
404
442
|
const z = vl => css`
|
|
405
443
|
z-index: ${zIndex(vl)};
|
|
406
444
|
`;
|
|
407
|
-
export { bgColor, bgCurrent, bgTransparent, border, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, flexCol, flexColReverse,
|
|
445
|
+
export { bgColor, bgCurrent, bgTransparent, border, borderBottom, borderBottomColor, borderColor, borderNone, borderRadius, borderRadius100, borderRadius4px, borderRadius50, bottom, boxBorder, boxContent, breakAll, breakWord, cursorDefault, cursorInherit, cursorMove, cursorNoDrop, cursorNotAllowed, cursorPointer, cursorText, displayBlock, displayFlex, displayInlineBlock, displayInlineFlex, displayNone, fill, flexCol, flexColReverse, flexNowrap, flexRow, flexRowReverse, flexShrink, flexShrink0, flexWrap, flexWrapReverse, floatLeft, floatNone, floatRight, gap, gapX, gapY, inset, insetX, insetY, invisible, italic, itemsCenter, itemsEnd, itemsStart, justifyAround, justifyBetween, justifyCenter, justifyEnd, justifyEvenly, justifyStart, left, mg, mgb, mgl, mgr, mgt, mgx, mgy, noBorder, noBoxShadow, noMargin, noPadding, objectContain, objectCover, objectFill, objectNone, order, outlineNone, overflowAuto, overflowHidden, parseHeight, parseMaxHeight, parseMaxWidth, parseMaxWidthHeight, parseMinHeight, parseMinWidth, parseMinWidthHeight, parseWidth, parseWidthHeight, pd, pdb, pdl, pdr, pdt, pdx, pdy, pointerEventsAuto, pointerEventsInherit, pointerEventsInitial, pointerEventsNone, positionAbsolute, positionFixed, positionRelative, positionSticky, right, scale, scaleX, scaleY, selfCenter, selfEnd, selfStart, shadowNone, textCapitalize, textCenter, textColor, textCurrent, textEllipsis, textLeft, textLineThrough, textLowercase, textRight, textunderline, textUppercase, top, truncate, userSelectNone, visible, whiteSpaceBreakSpaces, whiteSpaceNoWrap, whiteSpacePreWrap, z };
|
package/styles/utils.js
CHANGED
|
@@ -28,6 +28,7 @@ export const parseToPixel = vl => {
|
|
|
28
28
|
* @returns {string}
|
|
29
29
|
*/
|
|
30
30
|
export const getColor = cl => {
|
|
31
|
+
if (typeof cl !== 'string') return;
|
|
31
32
|
// example param cl: primary, info, system.rest, text.main, red, #333333,...
|
|
32
33
|
return cl.split('.').reduce((p, c) => p && p[c] || null, colors) || cl;
|
|
33
34
|
};
|