@xqmsg/ui-core 0.17.2 → 0.18.1
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/components/icons/checkmark/index.d.ts +8 -0
- package/dist/components/icons/index.d.ts +2 -1
- package/dist/components/toolbar/Toolbar.stories.d.ts +5 -0
- package/dist/components/toolbar/components/actions/add/index.d.ts +8 -0
- package/dist/components/toolbar/components/actions/search/index.d.ts +10 -0
- package/dist/components/toolbar/components/actions/sort/index.d.ts +10 -0
- package/dist/components/toolbar/components/breadcrumbs/index.d.ts +10 -0
- package/dist/components/toolbar/components/breadcrumbs/item/index.d.ts +10 -0
- package/dist/components/toolbar/components/dropdown/index.d.ts +14 -0
- package/dist/components/toolbar/index.d.ts +15 -0
- package/dist/index.d.ts +1 -0
- package/dist/ui-core.cjs.development.js +305 -136
- package/dist/ui-core.cjs.development.js.map +1 -1
- package/dist/ui-core.cjs.production.min.js +1 -1
- package/dist/ui-core.cjs.production.min.js.map +1 -1
- package/dist/ui-core.esm.js +304 -137
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/components/icons/checkmark/checkmark.svg +3 -0
- package/src/components/icons/checkmark/index.tsx +13 -0
- package/src/components/icons/chevron/down/chevron-down.svg +1 -1
- package/src/components/icons/chevron/right/chevron-right.svg +1 -1
- package/src/components/icons/folder/add/outline/folder-add-outline.svg +1 -1
- package/src/components/icons/google/index.tsx +1 -1
- package/src/components/icons/index.tsx +2 -0
- package/src/components/icons/search/search.svg +1 -1
- package/src/components/icons/table/fill/table-fill.svg +1 -1
- package/src/components/icons/table/outline/table-outline.svg +1 -1
- package/src/components/input/Input.stories.tsx +6 -0
- package/src/components/input/index.tsx +0 -1
- package/src/components/navigation/index.tsx +1 -1
- package/src/components/toolbar/Toolbar.stories.tsx +60 -0
- package/src/components/toolbar/components/actions/add/index.tsx +18 -0
- package/src/components/toolbar/components/actions/search/index.tsx +38 -0
- package/src/components/toolbar/components/actions/sort/index.tsx +49 -0
- package/src/components/toolbar/components/breadcrumbs/index.tsx +63 -0
- package/src/components/toolbar/components/breadcrumbs/item/index.tsx +73 -0
- package/src/components/toolbar/components/dropdown/index.tsx +107 -0
- package/src/components/toolbar/index.tsx +37 -0
- package/src/index.tsx +3 -0
package/package.json
CHANGED
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
<svg width="12" height="10" viewBox="0 0 12 10" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M11.7467 0.127888C12.0291 0.33708 12.0836 0.729242 11.8685 1.00381L5.01133 9.75378C4.89891 9.89724 4.72822 9.98649 4.54313 9.99859C4.35804 10.0107 4.17659 9.94447 4.04542 9.81694L0.188288 6.06695C-0.0627627 5.82288 -0.0627627 5.42715 0.188288 5.18307C0.439339 4.939 0.846372 4.939 1.09742 5.18307L4.43443 8.42738L10.8458 0.246255C11.0609 -0.0283092 11.4643 -0.0813041 11.7467 0.127888Z" fill="black"/>
|
|
3
|
+
</svg>
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ReactComponent as CheckmarkIcon } from './checkmark.svg';
|
|
3
|
+
|
|
4
|
+
export interface CheckmarkProps {
|
|
5
|
+
boxSize: number | string;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* A functional React component utilized to render the `Checkmark` icon component
|
|
10
|
+
*/
|
|
11
|
+
export const Checkmark: React.FC<CheckmarkProps> = ({ boxSize }) => {
|
|
12
|
+
return <CheckmarkIcon boxSize={boxSize} />;
|
|
13
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
<svg width="8" height="6" viewBox="0 0 8 6" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.184136 0.767507C0.422999 0.537831 0.802824 0.545278 1.0325 0.784142L4 3.93434L6.9675 0.784142C7.19718 0.545279 7.577 0.537831 7.81587 0.767507C8.05473 0.997183 8.06218 1.37701 7.8325 1.61587L4.4325 5.21587C4.31938 5.33352 4.16321 5.40001 4 5.40001C3.83679 5.40001 3.68062 5.33352 3.5675 5.21587L0.167501 1.61587C-0.0621751 1.37701 -0.0547276 0.997183 0.184136 0.767507Z" fill="
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.184136 0.767507C0.422999 0.537831 0.802824 0.545278 1.0325 0.784142L4 3.93434L6.9675 0.784142C7.19718 0.545279 7.577 0.537831 7.81587 0.767507C8.05473 0.997183 8.06218 1.37701 7.8325 1.61587L4.4325 5.21587C4.31938 5.33352 4.16321 5.40001 4 5.40001C3.83679 5.40001 3.68062 5.33352 3.5675 5.21587L0.167501 1.61587C-0.0621751 1.37701 -0.0547276 0.997183 0.184136 0.767507Z" fill="#3C3C432E"/>
|
|
3
3
|
</svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
<svg width="6" height="8" viewBox="0 0 6 8" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.767599 7.81586C0.537923 7.577 0.54537 7.19718 0.784233 6.9675L3.93443 4L0.784233 1.0325C0.54537 0.802823 0.537922 0.422997 0.767598 0.184134C0.997274 -0.0547285 1.3771 -0.0621767 1.61596 0.167499L5.21596 3.5675C5.33361 3.68062 5.4001 3.83679 5.4001 4C5.4001 4.16321 5.33361 4.31938 5.21596 4.4325L1.61596 7.8325C1.3771 8.06218 0.997275 8.05473 0.767599 7.81586Z" fill="
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.767599 7.81586C0.537923 7.577 0.54537 7.19718 0.784233 6.9675L3.93443 4L0.784233 1.0325C0.54537 0.802823 0.537922 0.422997 0.767598 0.184134C0.997274 -0.0547285 1.3771 -0.0621767 1.61596 0.167499L5.21596 3.5675C5.33361 3.68062 5.4001 3.83679 5.4001 4C5.4001 4.16321 5.33361 4.31938 5.21596 4.4325L1.61596 7.8325C1.3771 8.06218 0.997275 8.05473 0.767599 7.81586Z" fill="#3C3C432E"/>
|
|
3
3
|
</svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
<svg width="14" height="12" viewBox="0 0 14 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M7 5V9M9 7H5M7.70711 2.20711L6.29289 0.792893C6.10536 0.605357 5.851 0.5 5.58579 0.5H2C1.17157 0.5 0.5 1.17157 0.5 2V10C0.5 10.8284 1.17157 11.5 2 11.5H12C12.8284 11.5 13.5 10.8284 13.5 10V4C13.5 3.17157 12.8284 2.5 12 2.5H8.41421C8.149 2.5 7.89464 2.39464 7.70711 2.20711Z" stroke="
|
|
2
|
+
<path d="M7 5V9M9 7H5M7.70711 2.20711L6.29289 0.792893C6.10536 0.605357 5.851 0.5 5.58579 0.5H2C1.17157 0.5 0.5 1.17157 0.5 2V10C0.5 10.8284 1.17157 11.5 2 11.5H12C12.8284 11.5 13.5 10.8284 13.5 10V4C13.5 3.17157 12.8284 2.5 12 2.5H8.41421C8.149 2.5 7.89464 2.39464 7.70711 2.20711Z" stroke="#3C3C4399" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
3
|
</svg>
|
|
@@ -9,5 +9,5 @@ export interface GoogleProps {
|
|
|
9
9
|
* A functional React component utilized to render the `Google` icon component
|
|
10
10
|
*/
|
|
11
11
|
export const Google: React.FC<GoogleProps> = ({ boxSize }) => {
|
|
12
|
-
return <GoogleLogo boxSize={boxSize} />;
|
|
12
|
+
return <GoogleLogo width={boxSize} height={boxSize} />;
|
|
13
13
|
};
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Checkmark } from './checkmark';
|
|
1
2
|
import { ChevronDown } from './chevron/down';
|
|
2
3
|
import { ChevronRight } from './chevron/right';
|
|
3
4
|
import { Clock } from './clock';
|
|
@@ -27,6 +28,7 @@ import { Trash } from './trash';
|
|
|
27
28
|
import { Warning } from './warning';
|
|
28
29
|
|
|
29
30
|
export {
|
|
31
|
+
Checkmark,
|
|
30
32
|
ChevronDown,
|
|
31
33
|
ChevronRight,
|
|
32
34
|
Clock,
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
<svg width="14" height="14" viewBox="0 0 14 14" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.2001 1.8C3.77005 1.8 1.8001 3.76995 1.8001 6.2C1.8001 8.63005 3.77005 10.6 6.2001 10.6C7.41529 10.6 8.51447 10.1082 9.31137 9.31127C10.1083 8.51437 10.6001 7.41519 10.6001 6.2C10.6001 3.76995 8.63015 1.8 6.2001 1.8ZM0.600098 6.2C0.600098 3.10721 3.1073 0.6 6.2001 0.6C9.29289 0.6 11.8001 3.10721 11.8001 6.2C11.8001 7.53002 11.3358 8.75245 10.5615 9.71285L13.2244 12.3757C13.4587 12.6101 13.4587 12.9899 13.2244 13.2243C12.99 13.4586 12.6101 13.4586 12.3758 13.2243L9.71295 10.5614C8.75255 11.3358 7.53012 11.8 6.2001 11.8C3.1073 11.8 0.600098 9.29279 0.600098 6.2Z" fill="
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M6.2001 1.8C3.77005 1.8 1.8001 3.76995 1.8001 6.2C1.8001 8.63005 3.77005 10.6 6.2001 10.6C7.41529 10.6 8.51447 10.1082 9.31137 9.31127C10.1083 8.51437 10.6001 7.41519 10.6001 6.2C10.6001 3.76995 8.63015 1.8 6.2001 1.8ZM0.600098 6.2C0.600098 3.10721 3.1073 0.6 6.2001 0.6C9.29289 0.6 11.8001 3.10721 11.8001 6.2C11.8001 7.53002 11.3358 8.75245 10.5615 9.71285L13.2244 12.3757C13.4587 12.6101 13.4587 12.9899 13.2244 13.2243C12.99 13.4586 12.6101 13.4586 12.3758 13.2243L9.71295 10.5614C8.75255 11.3358 7.53012 11.8 6.2001 11.8C3.1073 11.8 0.600098 9.29279 0.600098 6.2Z" fill="#3C3C4399"/>
|
|
3
3
|
</svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
<svg width="16" height="12" viewBox="0 0 16 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.791992 2.19199C0.791992 1.19788 1.60589 0.400002 2.6 0.400002H13.4C14.3941 0.400002 15.2 1.20589 15.2 2.2L15.208 9.8C15.208 10.7941 14.4021 11.6 13.408 11.6C10.3413 11.6 5.67467 11.6 2.60801 11.6C1.6139 11.6 0.8 10.7861 0.8 9.79199L0.791992 2.19199ZM7.4 9.80801V9.30801C7.4 8.97664 7.13137 8.70801 6.8 8.70801H2.6C2.26863 8.70801 2 8.97664 2 9.30801V9.8C2 10.1314 2.26863 10.4 2.6 10.4H6.89827C7.18289 10.3531 7.4 10.1059 7.4 9.80801ZM8.6 9.80801C8.6 10.1059 8.81711 10.3531 9.10173 10.4H13.4C13.7314 10.4 14 10.1314 14 9.8V9.30801C14 8.97664 13.7314 8.70801 13.4 8.70801H9.2C8.86863 8.70801 8.6 8.97664 8.6 9.30801V9.80801ZM14 6.90401V6.40401C14 6.07264 13.7314 5.80401 13.4 5.80401H9.2C8.86863 5.80401 8.6 6.07264 8.6 6.40401V6.90401C8.6 7.23538 8.86863 7.50401 9.2 7.50401H13.4C13.7314 7.50401 14 7.23538 14 6.90401ZM7.4 6.90401V6.40401C7.4 6.07264 7.13137 5.80401 6.8 5.80401H2.6C2.26863 5.80401 2 6.07264 2 6.40401V6.90401C2 7.23538 2.26863 7.50401 2.6 7.50401H6.8C7.13137 7.50401 7.4 7.23538 7.4 6.90401ZM14 4V3.5C14 3.16863 13.7314 2.9 13.4 2.9H9.2C8.86863 2.9 8.6 3.16863 8.6 3.5V4C8.6 4.33137 8.86863 4.6 9.2 4.6H13.4C13.7314 4.6 14 4.33137 14 4ZM7.4 4V3.5C7.4 3.16863 7.13137 2.9 6.8 2.9H2.6C2.26863 2.9 2 3.16863 2 3.5V4C2 4.33137 2.26863 4.6 2.6 4.6H6.8C7.13137 4.6 7.4 4.33137 7.4 4Z" fill="
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M0.791992 2.19199C0.791992 1.19788 1.60589 0.400002 2.6 0.400002H13.4C14.3941 0.400002 15.2 1.20589 15.2 2.2L15.208 9.8C15.208 10.7941 14.4021 11.6 13.408 11.6C10.3413 11.6 5.67467 11.6 2.60801 11.6C1.6139 11.6 0.8 10.7861 0.8 9.79199L0.791992 2.19199ZM7.4 9.80801V9.30801C7.4 8.97664 7.13137 8.70801 6.8 8.70801H2.6C2.26863 8.70801 2 8.97664 2 9.30801V9.8C2 10.1314 2.26863 10.4 2.6 10.4H6.89827C7.18289 10.3531 7.4 10.1059 7.4 9.80801ZM8.6 9.80801C8.6 10.1059 8.81711 10.3531 9.10173 10.4H13.4C13.7314 10.4 14 10.1314 14 9.8V9.30801C14 8.97664 13.7314 8.70801 13.4 8.70801H9.2C8.86863 8.70801 8.6 8.97664 8.6 9.30801V9.80801ZM14 6.90401V6.40401C14 6.07264 13.7314 5.80401 13.4 5.80401H9.2C8.86863 5.80401 8.6 6.07264 8.6 6.40401V6.90401C8.6 7.23538 8.86863 7.50401 9.2 7.50401H13.4C13.7314 7.50401 14 7.23538 14 6.90401ZM7.4 6.90401V6.40401C7.4 6.07264 7.13137 5.80401 6.8 5.80401H2.6C2.26863 5.80401 2 6.07264 2 6.40401V6.90401C2 7.23538 2.26863 7.50401 2.6 7.50401H6.8C7.13137 7.50401 7.4 7.23538 7.4 6.90401ZM14 4V3.5C14 3.16863 13.7314 2.9 13.4 2.9H9.2C8.86863 2.9 8.6 3.16863 8.6 3.5V4C8.6 4.33137 8.86863 4.6 9.2 4.6H13.4C13.7314 4.6 14 4.33137 14 4ZM7.4 4V3.5C7.4 3.16863 7.13137 2.9 6.8 2.9H2.6C2.26863 2.9 2 3.16863 2 3.5V4C2 4.33137 2.26863 4.6 2.6 4.6H6.8C7.13137 4.6 7.4 4.33137 7.4 4Z" fill="#3C3C432E"/>
|
|
3
3
|
</svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
<svg width="14" height="12" viewBox="0 0 14 12" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M1.25 11H12.75M1.25 11C0.835786 11 0.5 10.6642 0.5 10.25M1.25 11H6.25C6.66421 11 7 10.6642 7 10.25M0.5 10.25V1.75M0.5 10.25V9.25C0.5 8.83579 0.835787 8.5 1.25 8.5M13.5 10.25V1.75M13.5 10.25C13.5 10.6642 13.1642 11 12.75 11M13.5 10.25V9.25C13.5 8.83579 13.1642 8.5 12.75 8.5M12.75 11H7.75C7.33579 11 7 10.6642 7 10.25M13.5 1.75C13.5 1.33579 13.1642 1 12.75 1H1.25C0.835786 1 0.5 1.33579 0.5 1.75M13.5 1.75V2.75C13.5 3.16421 13.1642 3.5 12.75 3.5M0.5 1.75V2.75C0.5 3.16421 0.835786 3.5 1.25 3.5M1.25 3.5H12.75M1.25 3.5H6.25C6.66421 3.5 7 3.83579 7 4.25M1.25 3.5C0.835786 3.5 0.5 3.83579 0.5 4.25V5.25C0.5 5.66421 0.835787 6 1.25 6M12.75 3.5H7.75C7.33579 3.5 7 3.83579 7 4.25M12.75 3.5C13.1642 3.5 13.5 3.83579 13.5 4.25V5.25C13.5 5.66421 13.1642 6 12.75 6M1.25 6H6.25M1.25 6C0.835787 6 0.5 6.33579 0.5 6.75V7.75C0.5 8.16421 0.835787 8.5 1.25 8.5M7 5.25V4.25M7 5.25C7 5.66421 6.66421 6 6.25 6M7 5.25C7 5.66421 7.33579 6 7.75 6M6.25 6C6.66421 6 7 6.33579 7 6.75M7.75 6H12.75M7.75 6C7.33579 6 7 6.33579 7 6.75M12.75 6C13.1642 6 13.5 6.33579 13.5 6.75V7.75C13.5 8.16421 13.1642 8.5 12.75 8.5M1.25 8.5H6.25M7 7.75V6.75M7 7.75C7 8.16421 6.66421 8.5 6.25 8.5M7 7.75C7 8.16421 7.33579 8.5 7.75 8.5M6.25 8.5C6.66421 8.5 7 8.83579 7 9.25M7 10.25V9.25M7 9.25C7 8.83579 7.33579 8.5 7.75 8.5M7.75 8.5H12.75" stroke="
|
|
2
|
+
<path d="M1.25 11H12.75M1.25 11C0.835786 11 0.5 10.6642 0.5 10.25M1.25 11H6.25C6.66421 11 7 10.6642 7 10.25M0.5 10.25V1.75M0.5 10.25V9.25C0.5 8.83579 0.835787 8.5 1.25 8.5M13.5 10.25V1.75M13.5 10.25C13.5 10.6642 13.1642 11 12.75 11M13.5 10.25V9.25C13.5 8.83579 13.1642 8.5 12.75 8.5M12.75 11H7.75C7.33579 11 7 10.6642 7 10.25M13.5 1.75C13.5 1.33579 13.1642 1 12.75 1H1.25C0.835786 1 0.5 1.33579 0.5 1.75M13.5 1.75V2.75C13.5 3.16421 13.1642 3.5 12.75 3.5M0.5 1.75V2.75C0.5 3.16421 0.835786 3.5 1.25 3.5M1.25 3.5H12.75M1.25 3.5H6.25C6.66421 3.5 7 3.83579 7 4.25M1.25 3.5C0.835786 3.5 0.5 3.83579 0.5 4.25V5.25C0.5 5.66421 0.835787 6 1.25 6M12.75 3.5H7.75C7.33579 3.5 7 3.83579 7 4.25M12.75 3.5C13.1642 3.5 13.5 3.83579 13.5 4.25V5.25C13.5 5.66421 13.1642 6 12.75 6M1.25 6H6.25M1.25 6C0.835787 6 0.5 6.33579 0.5 6.75V7.75C0.5 8.16421 0.835787 8.5 1.25 8.5M7 5.25V4.25M7 5.25C7 5.66421 6.66421 6 6.25 6M7 5.25C7 5.66421 7.33579 6 7.75 6M6.25 6C6.66421 6 7 6.33579 7 6.75M7.75 6H12.75M7.75 6C7.33579 6 7 6.33579 7 6.75M12.75 6C13.1642 6 13.5 6.33579 13.5 6.75V7.75C13.5 8.16421 13.1642 8.5 12.75 8.5M1.25 8.5H6.25M7 7.75V6.75M7 7.75C7 8.16421 6.66421 8.5 6.25 8.5M7 7.75C7 8.16421 7.33579 8.5 7.75 8.5M6.25 8.5C6.66421 8.5 7 8.83579 7 9.25M7 10.25V9.25M7 9.25C7 8.83579 7.33579 8.5 7.75 8.5M7.75 8.5H12.75" stroke="#3C3C4399" stroke-linecap="round" stroke-linejoin="round"/>
|
|
3
3
|
</svg>
|
|
@@ -142,6 +142,12 @@ const Template: Story<InputProps<StoryFormSchema>> = args => {
|
|
|
142
142
|
inputType="switch"
|
|
143
143
|
setValue={form.setValue}
|
|
144
144
|
/>
|
|
145
|
+
<Input
|
|
146
|
+
{...args}
|
|
147
|
+
name="prop6"
|
|
148
|
+
inputType="checkbox"
|
|
149
|
+
setValue={form.setValue}
|
|
150
|
+
/>
|
|
145
151
|
</Form>
|
|
146
152
|
);
|
|
147
153
|
};
|
|
@@ -41,7 +41,7 @@ export const NavigationMenu: React.FC<NavigationMenuProps> = ({
|
|
|
41
41
|
width="220px"
|
|
42
42
|
>
|
|
43
43
|
{sortedGroupedMenuItems?.map(menuItemGroup => (
|
|
44
|
-
<Box>
|
|
44
|
+
<Box _notLast={{ paddingBottom: '8px' }}>
|
|
45
45
|
{menuItemGroup.groupHeader && (
|
|
46
46
|
<NavigationMenuHeader label={menuItemGroup.groupHeader} />
|
|
47
47
|
)}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Meta, Story } from '@storybook/react';
|
|
3
|
+
|
|
4
|
+
import { Box } from '@chakra-ui/react';
|
|
5
|
+
import { Toolbar, ToolbarProps } from '.';
|
|
6
|
+
import { useState } from '@storybook/addons';
|
|
7
|
+
import { Button } from '../button';
|
|
8
|
+
|
|
9
|
+
const meta: Meta<ToolbarProps> = {
|
|
10
|
+
title: 'Toolbar example',
|
|
11
|
+
component: Toolbar,
|
|
12
|
+
argTypes: {},
|
|
13
|
+
parameters: {
|
|
14
|
+
controls: { expanded: true },
|
|
15
|
+
},
|
|
16
|
+
};
|
|
17
|
+
export default meta;
|
|
18
|
+
const Template: Story<ToolbarProps> = args => {
|
|
19
|
+
const [currentPage, setCurrentPage] = useState('howdy');
|
|
20
|
+
const [searchValue, setSearchValue] = useState('');
|
|
21
|
+
const pageList = [
|
|
22
|
+
{ label: 'hi', handler: () => setCurrentPage('hi') },
|
|
23
|
+
{ label: 'hey', handler: () => setCurrentPage('hey') },
|
|
24
|
+
{ label: 'hello', handler: () => setCurrentPage('hello') },
|
|
25
|
+
{ label: 'howdy', handler: () => setCurrentPage('howdy') },
|
|
26
|
+
];
|
|
27
|
+
|
|
28
|
+
const sortOptions = [
|
|
29
|
+
{ label: 'Sort by', value: 'section_header', sortValue: 0 },
|
|
30
|
+
{ label: 'Name', value: 'name', sortValue: 1 },
|
|
31
|
+
{ label: 'Type', value: 'type', sortValue: 2 },
|
|
32
|
+
{ label: 'Date Last Opened', value: 'date_last_opened', sortValue: 3 },
|
|
33
|
+
{ label: 'Date Added', value: 'date_added', sortValue: 4 },
|
|
34
|
+
{ label: 'Date Modified', value: 'date_modified', sortValue: 5 },
|
|
35
|
+
{ label: 'Date Created', value: 'date_created', sortValue: 5 },
|
|
36
|
+
{ label: 'Size', value: 'size', sortValue: 5 },
|
|
37
|
+
];
|
|
38
|
+
|
|
39
|
+
return (
|
|
40
|
+
<Box>
|
|
41
|
+
<Toolbar
|
|
42
|
+
{...args}
|
|
43
|
+
pageList={pageList}
|
|
44
|
+
currentPage={currentPage}
|
|
45
|
+
searchValue={searchValue}
|
|
46
|
+
onChangeSearch={(value: string) => setSearchValue(value)}
|
|
47
|
+
>
|
|
48
|
+
<Button
|
|
49
|
+
variant="secondary"
|
|
50
|
+
text="Sign Out"
|
|
51
|
+
width="variable"
|
|
52
|
+
ariaLabel="button"
|
|
53
|
+
/>
|
|
54
|
+
</Toolbar>
|
|
55
|
+
</Box>
|
|
56
|
+
);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export const Default = Template.bind({});
|
|
60
|
+
Default.args = {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box } from '@chakra-ui/react';
|
|
3
|
+
import { FolderAddOutline } from 'src/components/icons';
|
|
4
|
+
|
|
5
|
+
export interface AddProps {
|
|
6
|
+
onClick: () => void;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* A functional React component utilized to render the `Add` component
|
|
11
|
+
*/
|
|
12
|
+
export const Add: React.FC<AddProps> = ({ onClick }) => {
|
|
13
|
+
return (
|
|
14
|
+
<Box mx="8px" cursor="pointer" onClick={onClick}>
|
|
15
|
+
<FolderAddOutline boxSize="16px" />
|
|
16
|
+
</Box>
|
|
17
|
+
);
|
|
18
|
+
};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Box, useMediaQuery } from '@chakra-ui/react';
|
|
3
|
+
import { Search as SearchIcon } from '../../../../icons';
|
|
4
|
+
import StackedInput from '../../../..//input/StackedInput/StackedInput';
|
|
5
|
+
|
|
6
|
+
export interface SearchProps {
|
|
7
|
+
searchValue: string;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
onChange: (value: string) => void;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A functional React component utilized to render the `Search` component
|
|
14
|
+
*/
|
|
15
|
+
export const Search: React.FC<SearchProps> = ({
|
|
16
|
+
searchValue,
|
|
17
|
+
onClick,
|
|
18
|
+
onChange,
|
|
19
|
+
}) => {
|
|
20
|
+
const [breakpoint600] = useMediaQuery('(max-width: 600px)');
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
<Box>
|
|
24
|
+
{breakpoint600 ? (
|
|
25
|
+
<Box cursor="pointer" onClick={onClick}>
|
|
26
|
+
<SearchIcon boxSize="16px" />
|
|
27
|
+
</Box>
|
|
28
|
+
) : (
|
|
29
|
+
<StackedInput
|
|
30
|
+
placeholder="Search..."
|
|
31
|
+
name="search"
|
|
32
|
+
value={searchValue}
|
|
33
|
+
onChange={e => onChange(e.target.value)}
|
|
34
|
+
/>
|
|
35
|
+
)}
|
|
36
|
+
</Box>
|
|
37
|
+
);
|
|
38
|
+
};
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import React, { useRef, useState } from 'react';
|
|
2
|
+
import { Box, Flex, useOutsideClick } from '@chakra-ui/react';
|
|
3
|
+
import { ChevronDown, TableOutline } from '../../../../icons';
|
|
4
|
+
import { Dropdown } from '../../dropdown';
|
|
5
|
+
import { FieldOption, FieldOptions } from '../../../../input/InputTypes';
|
|
6
|
+
|
|
7
|
+
export interface SortProps {
|
|
8
|
+
onSelectItem: (option: FieldOption) => void;
|
|
9
|
+
sortOptions: FieldOptions;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A functional React component utilized to render the `Sort` component
|
|
14
|
+
*/
|
|
15
|
+
export const Sort: React.FC<SortProps> = ({ onSelectItem, sortOptions }) => {
|
|
16
|
+
const dropdownMenuRef = useRef<HTMLDivElement>(null);
|
|
17
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
18
|
+
const [optionIndex, setOptionIndex] = useState<number | null>(null);
|
|
19
|
+
|
|
20
|
+
useOutsideClick({
|
|
21
|
+
ref: dropdownMenuRef,
|
|
22
|
+
handler: () => setShowDropdown(false),
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
<Box onClick={() => setShowDropdown(!showDropdown)} position="relative">
|
|
27
|
+
<Flex
|
|
28
|
+
alignItems="center"
|
|
29
|
+
cursor="pointer"
|
|
30
|
+
onClick={() => setShowDropdown(!showDropdown)}
|
|
31
|
+
>
|
|
32
|
+
<TableOutline boxSize="16px" />
|
|
33
|
+
<Box ml="2px">
|
|
34
|
+
<ChevronDown boxSize="12px" />
|
|
35
|
+
</Box>
|
|
36
|
+
{showDropdown && (
|
|
37
|
+
<Dropdown
|
|
38
|
+
onSelectItem={onSelectItem}
|
|
39
|
+
options={sortOptions}
|
|
40
|
+
position="top"
|
|
41
|
+
dropdownRef={dropdownMenuRef}
|
|
42
|
+
optionIndex={optionIndex}
|
|
43
|
+
setOptionIndex={setOptionIndex}
|
|
44
|
+
/>
|
|
45
|
+
)}
|
|
46
|
+
</Flex>
|
|
47
|
+
</Box>
|
|
48
|
+
);
|
|
49
|
+
};
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import React, { useMemo, useCallback } from 'react';
|
|
2
|
+
import { Box, Flex, useMediaQuery } from '@chakra-ui/react';
|
|
3
|
+
import { ToolbarBreadcrumbItem } from './item';
|
|
4
|
+
import { ToolbarLabelAndHandler } from '../..';
|
|
5
|
+
import { ChevronRight } from '../../../../components/icons';
|
|
6
|
+
|
|
7
|
+
export interface ToolbarBreadcrumbsProps {
|
|
8
|
+
pageList: ToolbarLabelAndHandler[];
|
|
9
|
+
currentPage: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* A functional React component utilized to render the `ToolbarBreadcrumbs` component
|
|
14
|
+
*/
|
|
15
|
+
export const ToolbarBreadcrumbs: React.FC<ToolbarBreadcrumbsProps> = ({
|
|
16
|
+
pageList,
|
|
17
|
+
currentPage,
|
|
18
|
+
}) => {
|
|
19
|
+
const [breakpoint400] = useMediaQuery('(max-width: 400px)');
|
|
20
|
+
|
|
21
|
+
const filteredPageList = useMemo(() => {
|
|
22
|
+
if (breakpoint400)
|
|
23
|
+
return pageList.filter(page => page.label === currentPage);
|
|
24
|
+
|
|
25
|
+
const sliceIndex = pageList.findIndex(page => page.label === currentPage);
|
|
26
|
+
return pageList.slice(0, sliceIndex + 1);
|
|
27
|
+
}, [breakpoint400, currentPage, pageList]);
|
|
28
|
+
|
|
29
|
+
const getPageType = useCallback(
|
|
30
|
+
(index: number) => {
|
|
31
|
+
switch (index) {
|
|
32
|
+
case filteredPageList.length - 1:
|
|
33
|
+
return 'current';
|
|
34
|
+
case filteredPageList.length - 2:
|
|
35
|
+
return 'previous';
|
|
36
|
+
case 0:
|
|
37
|
+
return 'initial';
|
|
38
|
+
default:
|
|
39
|
+
return 'other';
|
|
40
|
+
}
|
|
41
|
+
},
|
|
42
|
+
[filteredPageList]
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
return (
|
|
46
|
+
<Flex height="26px">
|
|
47
|
+
{filteredPageList.map((page, i) => (
|
|
48
|
+
<Flex alignItems="center">
|
|
49
|
+
<ToolbarBreadcrumbItem
|
|
50
|
+
page={getPageType(i)}
|
|
51
|
+
pageLabel={page.label}
|
|
52
|
+
onClick={page.handler}
|
|
53
|
+
/>
|
|
54
|
+
{i !== filteredPageList.length - 1 && (
|
|
55
|
+
<Box mx="8px">
|
|
56
|
+
<ChevronRight boxSize="16px" />
|
|
57
|
+
</Box>
|
|
58
|
+
)}
|
|
59
|
+
</Flex>
|
|
60
|
+
))}
|
|
61
|
+
</Flex>
|
|
62
|
+
);
|
|
63
|
+
};
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import React, { useMemo } from 'react';
|
|
2
|
+
import { Box, useMediaQuery } from '@chakra-ui/react';
|
|
3
|
+
import colors from '../../../../../theme/foundations/colors';
|
|
4
|
+
|
|
5
|
+
export interface ToolbarBreadcrumbItemProps {
|
|
6
|
+
pageLabel: string;
|
|
7
|
+
page: 'current' | 'previous' | 'initial' | 'other';
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* A functional React component utilized to render the `ToolbarBreadcrumbItem` component
|
|
13
|
+
*/
|
|
14
|
+
export const ToolbarBreadcrumbItem: React.FC<ToolbarBreadcrumbItemProps> = ({
|
|
15
|
+
page,
|
|
16
|
+
pageLabel,
|
|
17
|
+
onClick,
|
|
18
|
+
}) => {
|
|
19
|
+
const [breakpoint400] = useMediaQuery('(max-width: 400px)');
|
|
20
|
+
const [breakpoint600] = useMediaQuery('(max-width: 600px)');
|
|
21
|
+
const [breakpoint800] = useMediaQuery('(max-width: 800px)');
|
|
22
|
+
const [breakpoint1512] = useMediaQuery('(max-width: 1512px)');
|
|
23
|
+
|
|
24
|
+
const getPageLabel = useMemo(() => {
|
|
25
|
+
if (breakpoint400) {
|
|
26
|
+
if (page === 'current') {
|
|
27
|
+
console.log('hi');
|
|
28
|
+
return pageLabel;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (breakpoint600) {
|
|
33
|
+
if (page === 'current' || page === 'previous') {
|
|
34
|
+
return pageLabel;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return '...';
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
if (breakpoint800 || breakpoint1512) {
|
|
41
|
+
if (page !== 'other') {
|
|
42
|
+
return pageLabel;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return '...';
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return pageLabel;
|
|
49
|
+
}, [
|
|
50
|
+
breakpoint1512,
|
|
51
|
+
breakpoint400,
|
|
52
|
+
breakpoint600,
|
|
53
|
+
breakpoint800,
|
|
54
|
+
page,
|
|
55
|
+
pageLabel,
|
|
56
|
+
]);
|
|
57
|
+
|
|
58
|
+
return (
|
|
59
|
+
<Box
|
|
60
|
+
color={
|
|
61
|
+
page === 'current'
|
|
62
|
+
? colors.label.primary.light
|
|
63
|
+
: colors.label.secondary.light
|
|
64
|
+
}
|
|
65
|
+
fontSize="13px"
|
|
66
|
+
letterSpacing="0.02em"
|
|
67
|
+
onClick={onClick}
|
|
68
|
+
cursor="pointer"
|
|
69
|
+
>
|
|
70
|
+
{getPageLabel}
|
|
71
|
+
</Box>
|
|
72
|
+
);
|
|
73
|
+
};
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import React, { RefObject, useMemo } from 'react';
|
|
2
|
+
import { Box, Flex } from '@chakra-ui/react';
|
|
3
|
+
import colors from '../../../../theme/foundations/colors';
|
|
4
|
+
import { FieldOption, FieldOptions } from '../../../input/InputTypes';
|
|
5
|
+
import { Checkmark } from '../../../icons';
|
|
6
|
+
|
|
7
|
+
export interface DropdownProps {
|
|
8
|
+
onSelectItem: (option: FieldOption) => void;
|
|
9
|
+
options: FieldOptions;
|
|
10
|
+
dropdownRef: RefObject<HTMLDivElement>;
|
|
11
|
+
position: 'top' | 'bottom';
|
|
12
|
+
optionIndex: number | null;
|
|
13
|
+
setOptionIndex: React.Dispatch<React.SetStateAction<number | null>>;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
/**
|
|
17
|
+
* A functional React component utilized to render the `Dropdown` component
|
|
18
|
+
*/
|
|
19
|
+
export const Dropdown: React.FC<DropdownProps> = ({
|
|
20
|
+
onSelectItem,
|
|
21
|
+
options,
|
|
22
|
+
dropdownRef,
|
|
23
|
+
position,
|
|
24
|
+
optionIndex,
|
|
25
|
+
setOptionIndex,
|
|
26
|
+
}) => {
|
|
27
|
+
const DropdownContent = useMemo(() => {
|
|
28
|
+
return options.map((option, idx) => (
|
|
29
|
+
<>
|
|
30
|
+
{option.value === 'section_header' &&
|
|
31
|
+
options[idx + 1] &&
|
|
32
|
+
options[idx + 1].value !== 'section_header' && (
|
|
33
|
+
<Box
|
|
34
|
+
color={colors.label.secondary.light}
|
|
35
|
+
fontSize="13px"
|
|
36
|
+
width="fit-content"
|
|
37
|
+
fontWeight="bold"
|
|
38
|
+
px="8px"
|
|
39
|
+
pl="26px"
|
|
40
|
+
whiteSpace="nowrap"
|
|
41
|
+
>
|
|
42
|
+
{idx > 0 && (
|
|
43
|
+
<Box
|
|
44
|
+
width="100%"
|
|
45
|
+
my="3px"
|
|
46
|
+
borderTop="2px solid"
|
|
47
|
+
borderColor={colors.border.default}
|
|
48
|
+
/>
|
|
49
|
+
)}
|
|
50
|
+
{option.label}
|
|
51
|
+
</Box>
|
|
52
|
+
)}
|
|
53
|
+
{option.value !== 'section_header' && (
|
|
54
|
+
<Flex
|
|
55
|
+
alignItems="center"
|
|
56
|
+
cursor="pointer"
|
|
57
|
+
onClick={() => {
|
|
58
|
+
setOptionIndex(idx);
|
|
59
|
+
onSelectItem(option);
|
|
60
|
+
}}
|
|
61
|
+
key={option.value}
|
|
62
|
+
fontSize="13px"
|
|
63
|
+
px="8px"
|
|
64
|
+
py="4px"
|
|
65
|
+
width="100%"
|
|
66
|
+
color={colors.label.primary.light}
|
|
67
|
+
whiteSpace="nowrap"
|
|
68
|
+
id={option.value}
|
|
69
|
+
>
|
|
70
|
+
<Box mr="8px" width="12px">
|
|
71
|
+
{optionIndex === idx && <Checkmark boxSize="12px" />}
|
|
72
|
+
</Box>
|
|
73
|
+
|
|
74
|
+
{option.label}
|
|
75
|
+
</Flex>
|
|
76
|
+
)}
|
|
77
|
+
</>
|
|
78
|
+
));
|
|
79
|
+
}, [onSelectItem, optionIndex, options, setOptionIndex]);
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<Flex
|
|
83
|
+
flexDirection="column"
|
|
84
|
+
ref={dropdownRef}
|
|
85
|
+
scrollMargin="15px"
|
|
86
|
+
backdropFilter="auto"
|
|
87
|
+
backdropBlur="64px"
|
|
88
|
+
borderRadius="4px"
|
|
89
|
+
bg={colors.fill.light.tertiary}
|
|
90
|
+
mt="3px"
|
|
91
|
+
maxH="240px"
|
|
92
|
+
overflowY="auto"
|
|
93
|
+
px="8px"
|
|
94
|
+
py="4px"
|
|
95
|
+
position="absolute"
|
|
96
|
+
top={position === 'top' ? 26 : undefined}
|
|
97
|
+
bottom={position === 'bottom' ? 30 : undefined}
|
|
98
|
+
right={0}
|
|
99
|
+
width="fit-content"
|
|
100
|
+
minWidth="100%"
|
|
101
|
+
zIndex={100}
|
|
102
|
+
tabIndex={-2000}
|
|
103
|
+
>
|
|
104
|
+
{DropdownContent}
|
|
105
|
+
</Flex>
|
|
106
|
+
);
|
|
107
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import React, { PropsWithChildren } from 'react';
|
|
2
|
+
import { Flex } from '@chakra-ui/react';
|
|
3
|
+
import { ToolbarBreadcrumbs } from './components/breadcrumbs';
|
|
4
|
+
|
|
5
|
+
export type ToolbarLabelAndHandler = { label: string; handler: () => void };
|
|
6
|
+
|
|
7
|
+
export interface ToolbarProps extends PropsWithChildren {
|
|
8
|
+
pageList: ToolbarLabelAndHandler[];
|
|
9
|
+
currentPage: string;
|
|
10
|
+
searchValue: string;
|
|
11
|
+
|
|
12
|
+
onChangeSearch: (value: string) => void;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* A functional React component utilized to render the `Toolbar` component
|
|
17
|
+
*/
|
|
18
|
+
export const Toolbar: React.FC<ToolbarProps> = ({
|
|
19
|
+
children,
|
|
20
|
+
pageList,
|
|
21
|
+
currentPage,
|
|
22
|
+
}) => {
|
|
23
|
+
return (
|
|
24
|
+
<Flex flexDirection="column">
|
|
25
|
+
<Flex
|
|
26
|
+
height="52px"
|
|
27
|
+
px="13px"
|
|
28
|
+
alignItems="center"
|
|
29
|
+
justifyContent="space-between"
|
|
30
|
+
background="white"
|
|
31
|
+
>
|
|
32
|
+
<ToolbarBreadcrumbs pageList={pageList} currentPage={currentPage} />
|
|
33
|
+
<Flex alignItems="center">{children} </Flex>
|
|
34
|
+
</Flex>
|
|
35
|
+
</Flex>
|
|
36
|
+
);
|
|
37
|
+
};
|