@digi-frontend/dgate-api-documentation 1.0.28 → 1.0.31
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/.editorconfig +12 -12
- package/.prettierignore +7 -7
- package/.prettierrc +15 -15
- package/dist/{a7568b270e175038.svg → 070dc6ecd197bc80.svg} +8 -8
- package/dist/{43595976d1fdccbf.svg → 2e10bbdb265df50e.svg} +4 -4
- package/dist/{b82c7612e73342f3.svg → 7f54eeb0bb2d1150.svg} +3 -3
- package/dist/{56dc416b683db280.svg → 8789eb84283ea95b.svg} +5 -5
- package/dist/{af16a554be8c4d69.svg → 9bdff13f8d8fa48a.svg} +3 -3
- package/dist/_virtual/index4.js +1 -1
- package/dist/_virtual/index5.js +1 -1
- package/dist/_virtual/index6.js +1 -1
- package/dist/{64efc2716808c4a4.svg → bb8b87cace25e052.svg} +3 -3
- package/dist/{72db3b05a96dd600.svg → d32ce84bbd78babd.svg} +3 -3
- package/dist/{844eba3f2e42a9eb.svg → d501922060662842.svg} +3 -3
- package/dist/node_modules/toposort/index.js +1 -1
- package/dist/node_modules/yup/index.esm.js +1 -1
- package/dist/src/assets/icons/AddRow.svg.js +1 -1
- package/dist/src/assets/icons/AddRow.svg.js.map +1 -1
- package/dist/src/assets/icons/CheckMarkSquare.svg.js +1 -1
- package/dist/src/assets/icons/CheckMarkSquare.svg.js.map +1 -1
- package/dist/src/assets/icons/CloseIcon.svg.js +1 -1
- package/dist/src/assets/icons/CloseIcon.svg.js.map +1 -1
- package/dist/src/assets/icons/DeleteIcon.svg.js +1 -1
- package/dist/src/assets/icons/DeleteIcon.svg.js.map +1 -1
- package/dist/src/assets/icons/DownArrow.svg.js +1 -1
- package/dist/src/assets/icons/DownArrow.svg.js.map +1 -1
- package/dist/src/assets/icons/EditIcon.svg.js +1 -1
- package/dist/src/assets/icons/EditIcon.svg.js.map +1 -1
- package/dist/src/assets/icons/UpArrow.svg.js +1 -1
- package/dist/src/assets/icons/UpArrow.svg.js.map +1 -1
- package/dist/src/assets/icons/deleteOutlinedIcon.svg.js +1 -1
- package/dist/src/assets/icons/deleteOutlinedIcon.svg.js.map +1 -1
- package/dist/src/components/Chips/Chips.js.map +1 -1
- package/dist/src/components/InfoForm/InfoForm.js.map +1 -1
- package/dist/src/components/JsonInput/JsonInput.js.map +1 -1
- package/dist/src/components/LivePreview/LivePreview.js.map +1 -1
- package/dist/src/components/MethodAccordion/MethodAccordion.js +1 -1
- package/dist/src/components/MethodAccordion/MethodAccordion.js.map +1 -1
- package/dist/src/components/SVGLoader/SVGLoader.js.map +1 -1
- package/dist/src/components/SectionHead/SectionHead.js.map +1 -1
- package/dist/src/components/SimpleLabelValue/SimpleLabelValue.js.map +1 -1
- package/dist/src/components/Tooltip/Tooltip.js.map +1 -1
- package/dist/src/components/dialog/index.js.map +1 -1
- package/dist/src/components/table/table.js +1 -1
- package/dist/src/components/table/table.js.map +1 -1
- package/dist/src/components/table/tags-table.js +1 -1
- package/dist/src/components/table/tags-table.js.map +1 -1
- package/dist/src/constants/index.js.map +1 -1
- package/dist/src/constants/regex.js.map +1 -1
- package/dist/src/helpers/layout.helper.js.map +1 -1
- package/dist/src/helpers/methodAccordion.helper.js.map +1 -1
- package/dist/src/layout/layout.js.map +1 -1
- package/dist/src/validator/form.scheme.js.map +1 -1
- package/dist/styles.css +212 -212
- package/package.json +43 -43
- package/rollup.config.js +35 -35
- package/src/assets/icons/AddRow.svg +3 -3
- package/src/assets/icons/CheckMarkSquare.svg +5 -5
- package/src/assets/icons/CloseIcon.svg +4 -4
- package/src/assets/icons/DeleteIcon.svg +3 -3
- package/src/assets/icons/DownArrow.svg +3 -3
- package/src/assets/icons/EditIcon.svg +3 -3
- package/src/assets/icons/UpArrow.svg +3 -3
- package/src/assets/icons/deleteOutlinedIcon.svg +8 -8
- package/src/assets/icons/index.ts +8 -8
- package/src/components/Chips/Chips.tsx +87 -87
- package/src/components/Chips/style.scss +147 -147
- package/src/components/InfoForm/InfoForm.module.scss +165 -165
- package/src/components/InfoForm/InfoForm.tsx +426 -426
- package/src/components/JsonInput/JsonInput.tsx +149 -149
- package/src/components/JsonInput/style.module.scss +133 -133
- package/src/components/LivePreview/LivePreview.module.scss +24 -24
- package/src/components/LivePreview/LivePreview.tsx +184 -184
- package/src/components/MethodAccordion/MethodAccordion.module.scss +338 -338
- package/src/components/MethodAccordion/MethodAccordion.tsx +515 -514
- package/src/components/SVGLoader/SVGLoader.tsx +94 -94
- package/src/components/SectionHead/SectionHead.scss +29 -29
- package/src/components/SectionHead/SectionHead.tsx +22 -22
- package/src/components/SimpleLabelValue/SimpleLabelValue.tsx +31 -31
- package/src/components/SimpleLabelValue/index.ts +1 -1
- package/src/components/SimpleLabelValue/style.scss +30 -30
- package/src/components/Tooltip/Tooltip.scss +133 -133
- package/src/components/Tooltip/Tooltip.tsx +85 -85
- package/src/components/_global.scss +337 -337
- package/src/components/dialog/dialog.ts +54 -54
- package/src/components/dialog/index.tsx +85 -85
- package/src/components/dialog/style.scss +104 -104
- package/src/components/table/style.scss +190 -190
- package/src/components/table/table.tsx +327 -322
- package/src/components/table/tags-table.tsx +348 -341
- package/src/constants/index.ts +93 -93
- package/src/constants/regex.ts +7 -7
- package/src/global.d.ts +13 -13
- package/src/helpers/layout.helper.ts +162 -162
- package/src/helpers/methodAccordion.helper.ts +19 -19
- package/src/index.ts +1 -1
- package/src/layout/layout.module.css +61 -61
- package/src/layout/layout.tsx +150 -150
- package/src/types/layout.type.ts +30 -30
- package/src/types/openApi.ts +108 -108
- package/src/types/transformedOpenApi.ts +52 -52
- package/src/validator/form.scheme.ts +70 -70
- package/tsconfig.json +33 -33
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M12.2013 14.9613C12.0024 14.9611 11.8118 14.882 11.6713 14.7413L8.20129 11.2613C8.06881 11.1191 7.99669 10.9311 8.00012 10.7368C8.00355 10.5424 8.08231 10.3571 8.21972 10.2197C8.35713 10.0822 8.54251 10.0035 8.73681 10.0001C8.93111 9.99669 9.11917 10.0688 9.26135 10.2013L12.2013 13.2013L15.1412 10.2013C15.2834 10.0688 15.4715 9.99669 15.6658 10.0001C15.8601 10.0035 16.0454 10.0822 16.1829 10.2197C16.3203 10.3571 16.399 10.5424 16.4025 10.7368C16.4059 10.9311 16.3338 11.1191 16.2013 11.2613L12.7313 14.7513C12.5892 14.8883 12.3987 14.9638 12.2013 14.9613Z" fill="#12131A"/>
|
|
3
|
-
</svg>
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M12.2013 14.9613C12.0024 14.9611 11.8118 14.882 11.6713 14.7413L8.20129 11.2613C8.06881 11.1191 7.99669 10.9311 8.00012 10.7368C8.00355 10.5424 8.08231 10.3571 8.21972 10.2197C8.35713 10.0822 8.54251 10.0035 8.73681 10.0001C8.93111 9.99669 9.11917 10.0688 9.26135 10.2013L12.2013 13.2013L15.1412 10.2013C15.2834 10.0688 15.4715 9.99669 15.6658 10.0001C15.8601 10.0035 16.0454 10.0822 16.1829 10.2197C16.3203 10.3571 16.399 10.5424 16.4025 10.7368C16.4059 10.9311 16.3338 11.1191 16.2013 11.2613L12.7313 14.7513C12.5892 14.8883 12.3987 14.9638 12.2013 14.9613Z" fill="#12131A"/>
|
|
3
|
+
</svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.96867 13.9157L13.6592 4.41662C14.906 3.19446 16.9283 3.19446 18.175 4.41662L19.4694 5.6854C20.7162 6.90755 20.7162 8.88985 19.4694 10.112L9.74061 19.6486C9.1843 20.1939 8.43007 20.4999 7.64282 20.4999H3.65854C3.28841 20.4999 2.99098 20.201 3.00021 19.8383L3.10043 15.8975C3.12036 15.1526 3.43127 14.4425 3.96867 13.9157ZM18.5381 6.59831L17.2437 5.32953C16.5113 4.61156 15.323 4.61156 14.5905 5.32953L13.8382 6.06697L17.7862 9.93612L18.5381 9.19909C19.2705 8.48112 19.2705 7.31628 18.5381 6.59831ZM4.89998 14.8287L12.9069 6.97989L16.8549 10.849L8.8093 18.7357L8.70228 18.8317C8.4067 19.0745 8.03222 19.2088 7.64282 19.2088L4.33345 19.2084L4.41707 15.9305C4.42814 15.5169 4.60126 15.1215 4.89998 14.8287ZM21 19.8545C21 19.498 20.7052 19.2089 20.3415 19.2089H13.471L13.3816 19.2148C13.0602 19.2576 12.8125 19.5277 12.8125 19.8545C12.8125 20.211 13.1073 20.5 13.471 20.5H20.3415L20.4308 20.4941C20.7523 20.4514 21 20.1813 21 19.8545Z" fill="#3A6CD1"/>
|
|
3
|
-
</svg>
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path fill-rule="evenodd" clip-rule="evenodd" d="M3.96867 13.9157L13.6592 4.41662C14.906 3.19446 16.9283 3.19446 18.175 4.41662L19.4694 5.6854C20.7162 6.90755 20.7162 8.88985 19.4694 10.112L9.74061 19.6486C9.1843 20.1939 8.43007 20.4999 7.64282 20.4999H3.65854C3.28841 20.4999 2.99098 20.201 3.00021 19.8383L3.10043 15.8975C3.12036 15.1526 3.43127 14.4425 3.96867 13.9157ZM18.5381 6.59831L17.2437 5.32953C16.5113 4.61156 15.323 4.61156 14.5905 5.32953L13.8382 6.06697L17.7862 9.93612L18.5381 9.19909C19.2705 8.48112 19.2705 7.31628 18.5381 6.59831ZM4.89998 14.8287L12.9069 6.97989L16.8549 10.849L8.8093 18.7357L8.70228 18.8317C8.4067 19.0745 8.03222 19.2088 7.64282 19.2088L4.33345 19.2084L4.41707 15.9305C4.42814 15.5169 4.60126 15.1215 4.89998 14.8287ZM21 19.8545C21 19.498 20.7052 19.2089 20.3415 19.2089H13.471L13.3816 19.2148C13.0602 19.2576 12.8125 19.5277 12.8125 19.8545C12.8125 20.211 13.1073 20.5 13.471 20.5H20.3415L20.4308 20.4941C20.7523 20.4514 21 20.1813 21 19.8545Z" fill="#3A6CD1"/>
|
|
3
|
+
</svg>
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M15.6713 14.9814C15.4733 14.9771 15.2841 14.8986 15.1412 14.7614L12.2013 11.7614L9.26135 14.7614C9.11917 14.8939 8.93111 14.966 8.73681 14.9626C8.54251 14.9592 8.35713 14.8805 8.21972 14.743C8.08231 14.6056 8.00355 14.4203 8.00012 14.226C7.99669 14.0317 8.06881 13.8436 8.20129 13.7014L11.6713 10.2114C11.8143 10.0757 12.0041 10 12.2013 10C12.3985 10 12.5882 10.0757 12.7313 10.2114L16.2013 13.7014C16.3417 13.842 16.4206 14.0326 16.4206 14.2314C16.4206 14.4301 16.3417 14.6208 16.2013 14.7614C16.0584 14.8986 15.8693 14.9771 15.6713 14.9814V14.9814Z" fill="#12131A"/>
|
|
3
|
-
</svg>
|
|
1
|
+
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M15.6713 14.9814C15.4733 14.9771 15.2841 14.8986 15.1412 14.7614L12.2013 11.7614L9.26135 14.7614C9.11917 14.8939 8.93111 14.966 8.73681 14.9626C8.54251 14.9592 8.35713 14.8805 8.21972 14.743C8.08231 14.6056 8.00355 14.4203 8.00012 14.226C7.99669 14.0317 8.06881 13.8436 8.20129 13.7014L11.6713 10.2114C11.8143 10.0757 12.0041 10 12.2013 10C12.3985 10 12.5882 10.0757 12.7313 10.2114L16.2013 13.7014C16.3417 13.842 16.4206 14.0326 16.4206 14.2314C16.4206 14.4301 16.3417 14.6208 16.2013 14.7614C16.0584 14.8986 15.8693 14.9771 15.6713 14.9814V14.9814Z" fill="#12131A"/>
|
|
3
|
+
</svg>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
<svg width="67" height="67" viewBox="0 0 67 67" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
-
<path d="M33.5 66C51.4493 66 66 51.4493 66 33.5C66 15.5507 51.4493 1 33.5 1C15.5507 1 1 15.5507 1 33.5C1 51.4493 15.5507 66 33.5 66Z" stroke="#DA3F3F" stroke-width="1.5"/>
|
|
3
|
-
<path d="M43 27.98C39.67 27.65 36.32 27.48 32.98 27.48C31 27.48 29.02 27.58 27.04 27.78L25 27.98" stroke="#DA3F3F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
-
<path d="M30.5 26.97L30.72 25.66C30.88 24.71 31 24 32.69 24H35.31C37 24 37.13 24.75 37.28 25.67L37.5 26.97" stroke="#DA3F3F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
-
<path d="M40.85 31.1401L40.2 41.2101C40.09 42.7801 40 44.0001 37.21 44.0001H30.79C28 44.0001 27.91 42.7801 27.8 41.2101L27.15 31.1401" stroke="#DA3F3F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
-
<path d="M32.33 38.5H35.66" stroke="#DA3F3F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
7
|
-
<path d="M31.5 34.5H36.5" stroke="#DA3F3F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
8
|
-
</svg>
|
|
1
|
+
<svg width="67" height="67" viewBox="0 0 67 67" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
2
|
+
<path d="M33.5 66C51.4493 66 66 51.4493 66 33.5C66 15.5507 51.4493 1 33.5 1C15.5507 1 1 15.5507 1 33.5C1 51.4493 15.5507 66 33.5 66Z" stroke="#DA3F3F" stroke-width="1.5"/>
|
|
3
|
+
<path d="M43 27.98C39.67 27.65 36.32 27.48 32.98 27.48C31 27.48 29.02 27.58 27.04 27.78L25 27.98" stroke="#DA3F3F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
4
|
+
<path d="M30.5 26.97L30.72 25.66C30.88 24.71 31 24 32.69 24H35.31C37 24 37.13 24.75 37.28 25.67L37.5 26.97" stroke="#DA3F3F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
5
|
+
<path d="M40.85 31.1401L40.2 41.2101C40.09 42.7801 40 44.0001 37.21 44.0001H30.79C28 44.0001 27.91 42.7801 27.8 41.2101L27.15 31.1401" stroke="#DA3F3F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
6
|
+
<path d="M32.33 38.5H35.66" stroke="#DA3F3F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
7
|
+
<path d="M31.5 34.5H36.5" stroke="#DA3F3F" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
8
|
+
</svg>
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export { default as UpArrowIcon } from './UpArrow.svg'
|
|
2
|
-
export { default as DownArrowIcon } from './DownArrow.svg'
|
|
3
|
-
export { default as CloseIcon } from './CloseIcon.svg'
|
|
4
|
-
export { default as CheckMarkSquare } from './CheckMarkSquare.svg'
|
|
5
|
-
export { default as DeleteIcon } from './DeleteIcon.svg'
|
|
6
|
-
export { default as EditIcon } from './EditIcon.svg'
|
|
7
|
-
export { default as AddRow } from './AddRow.svg'
|
|
8
|
-
export { default as deleteOutlinedIcon } from './deleteOutlinedIcon.svg'
|
|
1
|
+
export { default as UpArrowIcon } from './UpArrow.svg'
|
|
2
|
+
export { default as DownArrowIcon } from './DownArrow.svg'
|
|
3
|
+
export { default as CloseIcon } from './CloseIcon.svg'
|
|
4
|
+
export { default as CheckMarkSquare } from './CheckMarkSquare.svg'
|
|
5
|
+
export { default as DeleteIcon } from './DeleteIcon.svg'
|
|
6
|
+
export { default as EditIcon } from './EditIcon.svg'
|
|
7
|
+
export { default as AddRow } from './AddRow.svg'
|
|
8
|
+
export { default as deleteOutlinedIcon } from './deleteOutlinedIcon.svg'
|
|
@@ -1,87 +1,87 @@
|
|
|
1
|
-
import React, { useEffect, useRef, useState } from 'react'
|
|
2
|
-
import SVGLoader from '../../components/SVGLoader/SVGLoader'
|
|
3
|
-
import { CloseIcon, DownArrowIcon, UpArrowIcon } from '../../assets/icons'
|
|
4
|
-
import './style.scss'
|
|
5
|
-
|
|
6
|
-
type ChipItemType = {
|
|
7
|
-
id: number | string
|
|
8
|
-
label: string
|
|
9
|
-
className?: string
|
|
10
|
-
disabled?: boolean
|
|
11
|
-
[key: string]: unknown
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
export type CustomChipsType = {
|
|
15
|
-
className?: string
|
|
16
|
-
items: ChipItemType[]
|
|
17
|
-
onDelete?: (items: ChipItemType[]) => void
|
|
18
|
-
onClick?: (item: ChipItemType) => void
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
const Chips = ({ className, items, onDelete, onClick }: CustomChipsType) => {
|
|
22
|
-
const showMoreAppearsAfterHeight = 58
|
|
23
|
-
const [showBtnVisible, setShowBtnVisible] = useState(false)
|
|
24
|
-
const [showBtnOpen, setShowBtnOpen] = useState(false) // Fixed typo
|
|
25
|
-
const dropdownList = useRef<HTMLDivElement | null>(null) // Specify the correct type for the ref
|
|
26
|
-
|
|
27
|
-
useEffect(() => {
|
|
28
|
-
if (dropdownList.current) {
|
|
29
|
-
const showMoreOrLess = setTimeout(() => {
|
|
30
|
-
const offsetHeight = dropdownList?.current?.offsetHeight as number // Correctly infer offsetHeight
|
|
31
|
-
setShowBtnVisible(offsetHeight > showMoreAppearsAfterHeight)
|
|
32
|
-
}, 0) // Pass 0 as a number, not an array
|
|
33
|
-
|
|
34
|
-
return () => clearTimeout(showMoreOrLess)
|
|
35
|
-
}
|
|
36
|
-
}, [items?.length, showMoreAppearsAfterHeight])
|
|
37
|
-
|
|
38
|
-
const showButtonHandler = (e: any) => {
|
|
39
|
-
e?.stopPropagation()
|
|
40
|
-
setShowBtnOpen(!showBtnOpen)
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return (
|
|
44
|
-
<div className={`chips-container ${className ?? ''}`}>
|
|
45
|
-
{!!items?.length && (
|
|
46
|
-
<div className={`overflow-dropdown-div ${showBtnOpen && 'dropdown-max-height dropdown-overflow'}`}>
|
|
47
|
-
<div ref={dropdownList} className='dropdown-list'>
|
|
48
|
-
{items?.map((chip, index) => (
|
|
49
|
-
<div
|
|
50
|
-
key={chip.id}
|
|
51
|
-
className={`chip ${chip.disabled ? 'disabled' : ''}${!!onClick ? 'clickable' : ''}${chip?.className ?? ''}`}
|
|
52
|
-
onClick={() => !!onClick && chip.disabled === false && onClick(chip)}
|
|
53
|
-
>
|
|
54
|
-
<span className='chip-text'> {chip.label} </span>
|
|
55
|
-
{chip.disabled !== true && (
|
|
56
|
-
<SVGLoader
|
|
57
|
-
onClick={(e: any) => {
|
|
58
|
-
e.stopPropagation()
|
|
59
|
-
const filteredChips = items.filter((_, iIndex) => iIndex !== index)
|
|
60
|
-
onDelete && onDelete(filteredChips)
|
|
61
|
-
}}
|
|
62
|
-
className='chip-close-icon'
|
|
63
|
-
src={CloseIcon}
|
|
64
|
-
width={'1.25rem'}
|
|
65
|
-
height={'1.25rem'}
|
|
66
|
-
/>
|
|
67
|
-
)}
|
|
68
|
-
</div>
|
|
69
|
-
))}
|
|
70
|
-
</div>
|
|
71
|
-
</div>
|
|
72
|
-
)}
|
|
73
|
-
{showBtnVisible ? (
|
|
74
|
-
<button className='show-btn' onClick={showButtonHandler} type='button'>
|
|
75
|
-
<div className='show-btn-text-container'>
|
|
76
|
-
<span className='show-btn-text'>{showBtnOpen ? 'Show Less' : 'Show More'}</span>
|
|
77
|
-
</div>
|
|
78
|
-
<div className='show-btn-icon-container'>
|
|
79
|
-
<SVGLoader className='show-btn-icon' src={showBtnOpen ? UpArrowIcon : DownArrowIcon} width={'1.25rem'} height={'1.25rem'} />
|
|
80
|
-
</div>
|
|
81
|
-
</button>
|
|
82
|
-
) : null}
|
|
83
|
-
</div>
|
|
84
|
-
)
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
export default Chips
|
|
1
|
+
import React, { useEffect, useRef, useState } from 'react'
|
|
2
|
+
import SVGLoader from '../../components/SVGLoader/SVGLoader'
|
|
3
|
+
import { CloseIcon, DownArrowIcon, UpArrowIcon } from '../../assets/icons'
|
|
4
|
+
import './style.scss'
|
|
5
|
+
|
|
6
|
+
type ChipItemType = {
|
|
7
|
+
id: number | string
|
|
8
|
+
label: string
|
|
9
|
+
className?: string
|
|
10
|
+
disabled?: boolean
|
|
11
|
+
[key: string]: unknown
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export type CustomChipsType = {
|
|
15
|
+
className?: string
|
|
16
|
+
items: ChipItemType[]
|
|
17
|
+
onDelete?: (items: ChipItemType[]) => void
|
|
18
|
+
onClick?: (item: ChipItemType) => void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
const Chips = ({ className, items, onDelete, onClick }: CustomChipsType) => {
|
|
22
|
+
const showMoreAppearsAfterHeight = 58
|
|
23
|
+
const [showBtnVisible, setShowBtnVisible] = useState(false)
|
|
24
|
+
const [showBtnOpen, setShowBtnOpen] = useState(false) // Fixed typo
|
|
25
|
+
const dropdownList = useRef<HTMLDivElement | null>(null) // Specify the correct type for the ref
|
|
26
|
+
|
|
27
|
+
useEffect(() => {
|
|
28
|
+
if (dropdownList.current) {
|
|
29
|
+
const showMoreOrLess = setTimeout(() => {
|
|
30
|
+
const offsetHeight = dropdownList?.current?.offsetHeight as number // Correctly infer offsetHeight
|
|
31
|
+
setShowBtnVisible(offsetHeight > showMoreAppearsAfterHeight)
|
|
32
|
+
}, 0) // Pass 0 as a number, not an array
|
|
33
|
+
|
|
34
|
+
return () => clearTimeout(showMoreOrLess)
|
|
35
|
+
}
|
|
36
|
+
}, [items?.length, showMoreAppearsAfterHeight])
|
|
37
|
+
|
|
38
|
+
const showButtonHandler = (e: any) => {
|
|
39
|
+
e?.stopPropagation()
|
|
40
|
+
setShowBtnOpen(!showBtnOpen)
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
return (
|
|
44
|
+
<div className={`chips-container ${className ?? ''}`}>
|
|
45
|
+
{!!items?.length && (
|
|
46
|
+
<div className={`overflow-dropdown-div ${showBtnOpen && 'dropdown-max-height dropdown-overflow'}`}>
|
|
47
|
+
<div ref={dropdownList} className='dropdown-list'>
|
|
48
|
+
{items?.map((chip, index) => (
|
|
49
|
+
<div
|
|
50
|
+
key={chip.id}
|
|
51
|
+
className={`chip ${chip.disabled ? 'disabled' : ''}${!!onClick ? 'clickable' : ''}${chip?.className ?? ''}`}
|
|
52
|
+
onClick={() => !!onClick && chip.disabled === false && onClick(chip)}
|
|
53
|
+
>
|
|
54
|
+
<span className='chip-text'> {chip.label} </span>
|
|
55
|
+
{chip.disabled !== true && (
|
|
56
|
+
<SVGLoader
|
|
57
|
+
onClick={(e: any) => {
|
|
58
|
+
e.stopPropagation()
|
|
59
|
+
const filteredChips = items.filter((_, iIndex) => iIndex !== index)
|
|
60
|
+
onDelete && onDelete(filteredChips)
|
|
61
|
+
}}
|
|
62
|
+
className='chip-close-icon'
|
|
63
|
+
src={CloseIcon}
|
|
64
|
+
width={'1.25rem'}
|
|
65
|
+
height={'1.25rem'}
|
|
66
|
+
/>
|
|
67
|
+
)}
|
|
68
|
+
</div>
|
|
69
|
+
))}
|
|
70
|
+
</div>
|
|
71
|
+
</div>
|
|
72
|
+
)}
|
|
73
|
+
{showBtnVisible ? (
|
|
74
|
+
<button className='show-btn' onClick={showButtonHandler} type='button'>
|
|
75
|
+
<div className='show-btn-text-container'>
|
|
76
|
+
<span className='show-btn-text'>{showBtnOpen ? 'Show Less' : 'Show More'}</span>
|
|
77
|
+
</div>
|
|
78
|
+
<div className='show-btn-icon-container'>
|
|
79
|
+
<SVGLoader className='show-btn-icon' src={showBtnOpen ? UpArrowIcon : DownArrowIcon} width={'1.25rem'} height={'1.25rem'} />
|
|
80
|
+
</div>
|
|
81
|
+
</button>
|
|
82
|
+
) : null}
|
|
83
|
+
</div>
|
|
84
|
+
)
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
export default Chips
|
|
@@ -1,147 +1,147 @@
|
|
|
1
|
-
.chips-container {
|
|
2
|
-
width: 100%;
|
|
3
|
-
|
|
4
|
-
.overflow-dropdown-div {
|
|
5
|
-
max-height: 4.25rem;
|
|
6
|
-
overflow: hidden;
|
|
7
|
-
|
|
8
|
-
.dropdown-list {
|
|
9
|
-
display: flex;
|
|
10
|
-
flex-wrap: wrap;
|
|
11
|
-
gap: 0.625rem;
|
|
12
|
-
margin-top: 0.625rem;
|
|
13
|
-
|
|
14
|
-
.chip {
|
|
15
|
-
display: flex;
|
|
16
|
-
justify-content: center;
|
|
17
|
-
align-items: center;
|
|
18
|
-
background: #ebecf2;
|
|
19
|
-
border-radius: 3.125rem;
|
|
20
|
-
width: max-content;
|
|
21
|
-
height: 1.5rem;
|
|
22
|
-
overflow: hidden;
|
|
23
|
-
transition: all 0.4s ease-in-out;
|
|
24
|
-
padding-right: 0.9375rem;
|
|
25
|
-
cursor: default;
|
|
26
|
-
|
|
27
|
-
&:not(.disabled) {
|
|
28
|
-
&:hover {
|
|
29
|
-
background: #d8dae5;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
&:active {
|
|
33
|
-
background: #696c80;
|
|
34
|
-
color: #fff;
|
|
35
|
-
|
|
36
|
-
.chip-close-icon {
|
|
37
|
-
path {
|
|
38
|
-
stroke: #fff;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
.chip-close-icon {
|
|
44
|
-
cursor: pointer;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
&.clickable {
|
|
49
|
-
cursor: pointer;
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
.chip-text {
|
|
53
|
-
display: flex;
|
|
54
|
-
align-items: center;
|
|
55
|
-
font-size: 0.95rem;
|
|
56
|
-
height: 100%;
|
|
57
|
-
padding-left: 0.9375rem;
|
|
58
|
-
margin-top: -0.125rem;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.chip-close-icon {
|
|
62
|
-
display: block;
|
|
63
|
-
height: 0.75rem;
|
|
64
|
-
width: 0.75rem;
|
|
65
|
-
margin-block: auto;
|
|
66
|
-
margin-left: 0.625rem;
|
|
67
|
-
|
|
68
|
-
path {
|
|
69
|
-
stroke: #12131a;
|
|
70
|
-
}
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
.dropdown-max-height {
|
|
77
|
-
max-height: -moz-fit-content;
|
|
78
|
-
max-height: fit-content !important;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
.dropdown-overflow {
|
|
82
|
-
overflow: visible !important;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
.show-btn {
|
|
86
|
-
display: flex;
|
|
87
|
-
flex-direction: row;
|
|
88
|
-
flex-wrap: nowrap;
|
|
89
|
-
justify-content: center;
|
|
90
|
-
align-items: center;
|
|
91
|
-
width: auto;
|
|
92
|
-
height: 1.25rem;
|
|
93
|
-
cursor: pointer;
|
|
94
|
-
border: none;
|
|
95
|
-
margin-top: 0.625rem;
|
|
96
|
-
color: #9a9eb2;
|
|
97
|
-
background-color: transparent;
|
|
98
|
-
|
|
99
|
-
.show-btn-text-container {
|
|
100
|
-
flex: 1 1 auto;
|
|
101
|
-
|
|
102
|
-
.show-btn-text {
|
|
103
|
-
font-size: 0.75rem;
|
|
104
|
-
text-decoration-line: underline;
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
.show-btn-icon-container {
|
|
109
|
-
display: flex;
|
|
110
|
-
justify-content: center;
|
|
111
|
-
align-items: center;
|
|
112
|
-
height: 1.25rem;
|
|
113
|
-
width: 1.25rem;
|
|
114
|
-
margin-top: 0.1875rem;
|
|
115
|
-
margin-left: 0.125rem;
|
|
116
|
-
|
|
117
|
-
.show-btn-icon {
|
|
118
|
-
height: 1.25rem;
|
|
119
|
-
width: 1.25rem;
|
|
120
|
-
|
|
121
|
-
path {
|
|
122
|
-
fill: #9a9eb2;
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
&:hover {
|
|
128
|
-
color: #7c9bea;
|
|
129
|
-
|
|
130
|
-
.show-btn-icon-container .show-btn-icon {
|
|
131
|
-
path {
|
|
132
|
-
fill: #7c9bea;
|
|
133
|
-
}
|
|
134
|
-
}
|
|
135
|
-
}
|
|
136
|
-
|
|
137
|
-
&:active {
|
|
138
|
-
color: #2c4fa4;
|
|
139
|
-
|
|
140
|
-
.show-btn-icon-container .show-btn-icon {
|
|
141
|
-
path {
|
|
142
|
-
fill: #2c4fa4;
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
|
-
}
|
|
1
|
+
.chips-container {
|
|
2
|
+
width: 100%;
|
|
3
|
+
|
|
4
|
+
.overflow-dropdown-div {
|
|
5
|
+
max-height: 4.25rem;
|
|
6
|
+
overflow: hidden;
|
|
7
|
+
|
|
8
|
+
.dropdown-list {
|
|
9
|
+
display: flex;
|
|
10
|
+
flex-wrap: wrap;
|
|
11
|
+
gap: 0.625rem;
|
|
12
|
+
margin-top: 0.625rem;
|
|
13
|
+
|
|
14
|
+
.chip {
|
|
15
|
+
display: flex;
|
|
16
|
+
justify-content: center;
|
|
17
|
+
align-items: center;
|
|
18
|
+
background: #ebecf2;
|
|
19
|
+
border-radius: 3.125rem;
|
|
20
|
+
width: max-content;
|
|
21
|
+
height: 1.5rem;
|
|
22
|
+
overflow: hidden;
|
|
23
|
+
transition: all 0.4s ease-in-out;
|
|
24
|
+
padding-right: 0.9375rem;
|
|
25
|
+
cursor: default;
|
|
26
|
+
|
|
27
|
+
&:not(.disabled) {
|
|
28
|
+
&:hover {
|
|
29
|
+
background: #d8dae5;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&:active {
|
|
33
|
+
background: #696c80;
|
|
34
|
+
color: #fff;
|
|
35
|
+
|
|
36
|
+
.chip-close-icon {
|
|
37
|
+
path {
|
|
38
|
+
stroke: #fff;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
.chip-close-icon {
|
|
44
|
+
cursor: pointer;
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
&.clickable {
|
|
49
|
+
cursor: pointer;
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.chip-text {
|
|
53
|
+
display: flex;
|
|
54
|
+
align-items: center;
|
|
55
|
+
font-size: 0.95rem;
|
|
56
|
+
height: 100%;
|
|
57
|
+
padding-left: 0.9375rem;
|
|
58
|
+
margin-top: -0.125rem;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
.chip-close-icon {
|
|
62
|
+
display: block;
|
|
63
|
+
height: 0.75rem;
|
|
64
|
+
width: 0.75rem;
|
|
65
|
+
margin-block: auto;
|
|
66
|
+
margin-left: 0.625rem;
|
|
67
|
+
|
|
68
|
+
path {
|
|
69
|
+
stroke: #12131a;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
.dropdown-max-height {
|
|
77
|
+
max-height: -moz-fit-content;
|
|
78
|
+
max-height: fit-content !important;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
.dropdown-overflow {
|
|
82
|
+
overflow: visible !important;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
.show-btn {
|
|
86
|
+
display: flex;
|
|
87
|
+
flex-direction: row;
|
|
88
|
+
flex-wrap: nowrap;
|
|
89
|
+
justify-content: center;
|
|
90
|
+
align-items: center;
|
|
91
|
+
width: auto;
|
|
92
|
+
height: 1.25rem;
|
|
93
|
+
cursor: pointer;
|
|
94
|
+
border: none;
|
|
95
|
+
margin-top: 0.625rem;
|
|
96
|
+
color: #9a9eb2;
|
|
97
|
+
background-color: transparent;
|
|
98
|
+
|
|
99
|
+
.show-btn-text-container {
|
|
100
|
+
flex: 1 1 auto;
|
|
101
|
+
|
|
102
|
+
.show-btn-text {
|
|
103
|
+
font-size: 0.75rem;
|
|
104
|
+
text-decoration-line: underline;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
.show-btn-icon-container {
|
|
109
|
+
display: flex;
|
|
110
|
+
justify-content: center;
|
|
111
|
+
align-items: center;
|
|
112
|
+
height: 1.25rem;
|
|
113
|
+
width: 1.25rem;
|
|
114
|
+
margin-top: 0.1875rem;
|
|
115
|
+
margin-left: 0.125rem;
|
|
116
|
+
|
|
117
|
+
.show-btn-icon {
|
|
118
|
+
height: 1.25rem;
|
|
119
|
+
width: 1.25rem;
|
|
120
|
+
|
|
121
|
+
path {
|
|
122
|
+
fill: #9a9eb2;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
&:hover {
|
|
128
|
+
color: #7c9bea;
|
|
129
|
+
|
|
130
|
+
.show-btn-icon-container .show-btn-icon {
|
|
131
|
+
path {
|
|
132
|
+
fill: #7c9bea;
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
&:active {
|
|
138
|
+
color: #2c4fa4;
|
|
139
|
+
|
|
140
|
+
.show-btn-icon-container .show-btn-icon {
|
|
141
|
+
path {
|
|
142
|
+
fill: #2c4fa4;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
}
|