@dktunited-techoff/techoff-suite-ui 1.8.1 → 1.8.2
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/esm/assets/fonts/Montserrat-Medium.ttf +0 -0
- package/esm/assets/fonts/Roboto-Light.ttf +0 -0
- package/esm/components/TsButton/TsButton.css +121 -0
- package/esm/components/TsButton/TsButton.d.ts +5 -0
- package/esm/components/TsButton/TsButton.js +17 -0
- package/esm/components/TsButton/TsButton.js.map +1 -0
- package/esm/components/TsButton/TsButton.types.d.ts +9 -0
- package/esm/components/TsButton/TsButton.types.js +2 -0
- package/esm/components/TsButton/TsButton.types.js.map +1 -0
- package/esm/components/TsButton/__stories__/TsButton.stories.mdx +84 -0
- package/esm/components/TsCheckbox/TsCheckbox.css +64 -0
- package/esm/components/TsCheckbox/TsCheckbox.d.ts +4 -0
- package/esm/components/TsCheckbox/TsCheckbox.js +17 -0
- package/esm/components/TsCheckbox/TsCheckbox.js.map +1 -0
- package/esm/components/TsCheckbox/TsCheckbox.types.d.ts +7 -0
- package/esm/components/TsCheckbox/TsCheckbox.types.js +2 -0
- package/esm/components/TsCheckbox/TsCheckbox.types.js.map +1 -0
- package/esm/components/TsCheckbox/__stories__/TsCheckbox.stories.mdx +56 -0
- package/esm/components/TsDropdowns/TsDropdown/TsDropdown.css +114 -0
- package/esm/components/TsDropdowns/TsDropdown/TsDropdown.d.ts +4 -0
- package/esm/components/TsDropdowns/TsDropdown/TsDropdown.js +100 -0
- package/esm/components/TsDropdowns/TsDropdown/TsDropdown.js.map +1 -0
- package/esm/components/TsDropdowns/TsDropdown/TsDropdown.tsx +165 -0
- package/esm/components/TsDropdowns/TsDropdown/TsDropdown.types.d.ts +17 -0
- package/esm/components/TsDropdowns/TsDropdown/TsDropdown.types.js +2 -0
- package/esm/components/TsDropdowns/TsDropdown/TsDropdown.types.js.map +1 -0
- package/esm/components/TsDropdowns/TsDropdown/TsDropdown.types.ts +18 -0
- package/esm/components/TsDropdowns/TsDropdown/__stories__/TsDropdown.stories.mdx +85 -0
- package/esm/components/TsDropdowns/TsDropdown/__stories__/fruits.d.ts +4 -0
- package/esm/components/TsDropdowns/TsDropdown/__stories__/fruits.js +48 -0
- package/esm/components/TsDropdowns/TsDropdown/__stories__/fruits.js.map +1 -0
- package/esm/components/TsDropdowns/TsDropdown/__stories__/fruits.ts +47 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.css +83 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.d.ts +4 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.js +62 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.js.map +1 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.tsx +105 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.types.d.ts +8 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.types.js +2 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.types.js.map +1 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.types.ts +8 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/__stories__/TsDropdown.stories.mdx +69 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/__stories__/fruits.d.ts +4 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/__stories__/fruits.js +48 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/__stories__/fruits.js.map +1 -0
- package/esm/components/TsDropdowns/TsDropdownFilter/__stories__/fruits.ts +47 -0
- package/esm/components/TsIcon/TsIcon.css +26 -0
- package/esm/components/TsIcon/TsIcon.d.ts +4 -0
- package/esm/components/TsIcon/TsIcon.js +12 -0
- package/esm/components/TsIcon/TsIcon.js.map +1 -0
- package/esm/components/TsIcon/TsIcon.types.d.ts +4 -0
- package/esm/components/TsIcon/TsIcon.types.js +2 -0
- package/esm/components/TsIcon/TsIcon.types.js.map +1 -0
- package/esm/components/TsIcon/__stories__/TsIcon.stories.mdx +89 -0
- package/esm/components/TsIcon/icons/add-circle.svg +1 -0
- package/esm/components/TsIcon/icons/add.svg +1 -0
- package/esm/components/TsIcon/icons/alert-circle-filled.svg +1 -0
- package/esm/components/TsIcon/icons/alert-circle.svg +1 -0
- package/esm/components/TsIcon/icons/alert-triangle-filled.svg +1 -0
- package/esm/components/TsIcon/icons/alert-triangle.svg +1 -0
- package/esm/components/TsIcon/icons/arrow-diagonal-collapse.svg +1 -0
- package/esm/components/TsIcon/icons/arrow-diagonal-expand.svg +1 -0
- package/esm/components/TsIcon/icons/arrow-down.svg +1 -0
- package/esm/components/TsIcon/icons/arrow-go-back.svg +1 -0
- package/esm/components/TsIcon/icons/arrow-left-right.svg +1 -0
- package/esm/components/TsIcon/icons/arrow-left.svg +1 -0
- package/esm/components/TsIcon/icons/arrow-right.svg +1 -0
- package/esm/components/TsIcon/icons/arrow-up-down.svg +1 -0
- package/esm/components/TsIcon/icons/arrow-up.svg +1 -0
- package/esm/components/TsIcon/icons/award.svg +1 -0
- package/esm/components/TsIcon/icons/check-circle-filled.svg +1 -0
- package/esm/components/TsIcon/icons/check-circle-timer.svg +7 -0
- package/esm/components/TsIcon/icons/check-circle.svg +1 -0
- package/esm/components/TsIcon/icons/check-square-filled.svg +1 -0
- package/esm/components/TsIcon/icons/check-square.svg +1 -0
- package/esm/components/TsIcon/icons/check.svg +1 -0
- package/esm/components/TsIcon/icons/chevron-down.svg +1 -0
- package/esm/components/TsIcon/icons/chevron-left.svg +1 -0
- package/esm/components/TsIcon/icons/chevron-right.svg +1 -0
- package/esm/components/TsIcon/icons/chevron-up.svg +1 -0
- package/esm/components/TsIcon/icons/circle.svg +1 -0
- package/esm/components/TsIcon/icons/close-circle.svg +1 -0
- package/esm/components/TsIcon/icons/close.svg +1 -0
- package/esm/components/TsIcon/icons/currency-euro.svg +1 -0
- package/esm/components/TsIcon/icons/download.svg +1 -0
- package/esm/components/TsIcon/icons/edit.svg +1 -0
- package/esm/components/TsIcon/icons/external-link.svg +1 -0
- package/esm/components/TsIcon/icons/filter-off.svg +1 -0
- package/esm/components/TsIcon/icons/filter.svg +1 -0
- package/esm/components/TsIcon/icons/flashlight-off.svg +1 -0
- package/esm/components/TsIcon/icons/flashlight.svg +1 -0
- package/esm/components/TsIcon/icons/header-bikestudio.svg +32 -0
- package/esm/components/TsIcon/icons/header-nsc-helmet.svg +32 -0
- package/esm/components/TsIcon/icons/header-opticost.svg +32 -0
- package/esm/components/TsIcon/icons/header-repairability.svg +32 -0
- package/esm/components/TsIcon/icons/header-techoff-suite.svg +32 -0
- package/esm/components/TsIcon/icons/heart-filled.svg +1 -0
- package/esm/components/TsIcon/icons/heart.svg +1 -0
- package/esm/components/TsIcon/icons/history.svg +1 -0
- package/esm/components/TsIcon/icons/home.svg +1 -0
- package/esm/components/TsIcon/icons/index.d.ts +3 -0
- package/esm/components/TsIcon/icons/index.js +62 -0
- package/esm/components/TsIcon/icons/index.js.map +1 -0
- package/esm/components/TsIcon/icons/index.ts +61 -0
- package/esm/components/TsIcon/icons/link.svg +1 -0
- package/esm/components/TsIcon/icons/list-settings.svg +1 -0
- package/esm/components/TsIcon/icons/lock.svg +1 -0
- package/esm/components/TsIcon/icons/loop-right.svg +1 -0
- package/esm/components/TsIcon/icons/percent.svg +1 -0
- package/esm/components/TsIcon/icons/question-circle.svg +1 -0
- package/esm/components/TsIcon/icons/save.svg +1 -0
- package/esm/components/TsIcon/icons/search.svg +1 -0
- package/esm/components/TsIcon/icons/seedling-circle.svg +12 -0
- package/esm/components/TsIcon/icons/square.svg +1 -0
- package/esm/components/TsIcon/icons/timer.svg +1 -0
- package/esm/components/TsIcon/icons/tools.svg +1 -0
- package/esm/components/TsIcon/icons/user.svg +1 -0
- package/esm/components/TsInput/TsInput/TsInput.css +92 -0
- package/esm/components/TsInput/TsInput/TsInput.d.ts +4 -0
- package/esm/components/TsInput/TsInput/TsInput.js +21 -0
- package/esm/components/TsInput/TsInput/TsInput.js.map +1 -0
- package/esm/components/TsInput/TsInput/TsInput.tsx +34 -0
- package/esm/components/TsInput/TsInput/TsInput.types.d.ts +8 -0
- package/esm/components/TsInput/TsInput/TsInput.types.js +2 -0
- package/esm/components/TsInput/TsInput/TsInput.types.js.map +1 -0
- package/esm/components/TsInput/TsInput/TsInput.types.tsx +9 -0
- package/esm/components/TsInput/TsInput/__stories__/TsInput.stories.mdx +77 -0
- package/esm/components/TsLoader/TsLoader.css +42 -0
- package/esm/components/TsLoader/TsLoader.d.ts +4 -0
- package/esm/components/TsLoader/TsLoader.js +6 -0
- package/esm/components/TsLoader/TsLoader.js.map +1 -0
- package/esm/components/TsLoader/TsLoader.types.d.ts +3 -0
- package/esm/components/TsLoader/TsLoader.types.js +2 -0
- package/esm/components/TsLoader/TsLoader.types.js.map +1 -0
- package/esm/components/TsLoader/__stories__/TsLoader.stories.mdx +30 -0
- package/esm/components/TsTabs/TsTabs.css +69 -0
- package/esm/components/TsTabs/TsTabs.d.ts +4 -0
- package/esm/components/TsTabs/TsTabs.js +30 -0
- package/esm/components/TsTabs/TsTabs.js.map +1 -0
- package/esm/components/TsTabs/TsTabs.types.d.ts +14 -0
- package/esm/components/TsTabs/TsTabs.types.js +2 -0
- package/esm/components/TsTabs/TsTabs.types.js.map +1 -0
- package/esm/components/TsTabs/__stories__/TsTabs.stories.mdx +50 -0
- package/esm/hooks/use-click-outside.d.ts +2 -0
- package/esm/hooks/use-click-outside.js +14 -0
- package/esm/hooks/use-click-outside.js.map +1 -0
- package/esm/index.d.ts +11 -0
- package/esm/index.js +12 -0
- package/esm/index.js.map +1 -0
- package/esm/layouts/TsHeader/TsHeader.css +186 -0
- package/esm/layouts/TsHeader/TsHeader.d.ts +4 -0
- package/esm/layouts/TsHeader/TsHeader.js +13 -0
- package/esm/layouts/TsHeader/TsHeader.js.map +1 -0
- package/esm/layouts/TsHeader/TsHeader.types.d.ts +23 -0
- package/esm/layouts/TsHeader/TsHeader.types.js +2 -0
- package/esm/layouts/TsHeader/TsHeader.types.js.map +1 -0
- package/esm/layouts/TsHeader/TsHeaderProfile.d.ts +5 -0
- package/esm/layouts/TsHeader/TsHeaderProfile.js +38 -0
- package/esm/layouts/TsHeader/TsHeaderProfile.js.map +1 -0
- package/esm/layouts/TsHeader/TsHeaderSearch.d.ts +3 -0
- package/esm/layouts/TsHeader/TsHeaderSearch.js +58 -0
- package/esm/layouts/TsHeader/TsHeaderSearch.js.map +1 -0
- package/esm/layouts/TsHeader/__stories__/TsHeader.stories.mdx +71 -0
- package/esm/layouts/TsNavigation/TsNavigation.css +72 -0
- package/esm/layouts/TsNavigation/TsNavigation.d.ts +7 -0
- package/esm/layouts/TsNavigation/TsNavigation.js +29 -0
- package/esm/layouts/TsNavigation/TsNavigation.js.map +1 -0
- package/esm/layouts/TsNavigation/TsNavigation.types.d.ts +10 -0
- package/esm/layouts/TsNavigation/TsNavigation.types.js +2 -0
- package/esm/layouts/TsNavigation/TsNavigation.types.js.map +1 -0
- package/esm/layouts/TsNavigation/__stories__/TsNavigation.stories.mdx +51 -0
- package/esm/utils/string.utils.d.ts +1 -0
- package/esm/utils/string.utils.js +2 -0
- package/esm/utils/string.utils.js.map +1 -0
- package/lib/assets/fonts/Montserrat-Medium.ttf +0 -0
- package/lib/assets/fonts/Roboto-Light.ttf +0 -0
- package/lib/components/TsButton/TsButton.css +121 -0
- package/lib/components/TsButton/TsButton.d.ts +5 -0
- package/lib/components/TsButton/TsButton.js +21 -0
- package/lib/components/TsButton/TsButton.js.map +1 -0
- package/lib/components/TsButton/TsButton.types.d.ts +9 -0
- package/lib/components/TsButton/TsButton.types.js +3 -0
- package/lib/components/TsButton/TsButton.types.js.map +1 -0
- package/lib/components/TsButton/__stories__/TsButton.stories.mdx +84 -0
- package/lib/components/TsCheckbox/TsCheckbox.css +64 -0
- package/lib/components/TsCheckbox/TsCheckbox.d.ts +4 -0
- package/lib/components/TsCheckbox/TsCheckbox.js +21 -0
- package/lib/components/TsCheckbox/TsCheckbox.js.map +1 -0
- package/lib/components/TsCheckbox/TsCheckbox.types.d.ts +7 -0
- package/lib/components/TsCheckbox/TsCheckbox.types.js +3 -0
- package/lib/components/TsCheckbox/TsCheckbox.types.js.map +1 -0
- package/lib/components/TsCheckbox/__stories__/TsCheckbox.stories.mdx +56 -0
- package/lib/components/TsDropdowns/TsDropdown/TsDropdown.css +114 -0
- package/lib/components/TsDropdowns/TsDropdown/TsDropdown.d.ts +4 -0
- package/lib/components/TsDropdowns/TsDropdown/TsDropdown.js +104 -0
- package/lib/components/TsDropdowns/TsDropdown/TsDropdown.js.map +1 -0
- package/lib/components/TsDropdowns/TsDropdown/TsDropdown.tsx +165 -0
- package/lib/components/TsDropdowns/TsDropdown/TsDropdown.types.d.ts +17 -0
- package/lib/components/TsDropdowns/TsDropdown/TsDropdown.types.js +3 -0
- package/lib/components/TsDropdowns/TsDropdown/TsDropdown.types.js.map +1 -0
- package/lib/components/TsDropdowns/TsDropdown/TsDropdown.types.ts +18 -0
- package/lib/components/TsDropdowns/TsDropdown/__stories__/TsDropdown.stories.mdx +85 -0
- package/lib/components/TsDropdowns/TsDropdown/__stories__/fruits.d.ts +4 -0
- package/lib/components/TsDropdowns/TsDropdown/__stories__/fruits.js +51 -0
- package/lib/components/TsDropdowns/TsDropdown/__stories__/fruits.js.map +1 -0
- package/lib/components/TsDropdowns/TsDropdown/__stories__/fruits.ts +47 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.css +83 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.d.ts +4 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.js +66 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.js.map +1 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.tsx +105 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.types.d.ts +8 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.types.js +3 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.types.js.map +1 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.types.ts +8 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/__stories__/TsDropdown.stories.mdx +69 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/__stories__/fruits.d.ts +4 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/__stories__/fruits.js +51 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/__stories__/fruits.js.map +1 -0
- package/lib/components/TsDropdowns/TsDropdownFilter/__stories__/fruits.ts +47 -0
- package/lib/components/TsIcon/TsIcon.css +26 -0
- package/lib/components/TsIcon/TsIcon.d.ts +4 -0
- package/lib/components/TsIcon/TsIcon.js +16 -0
- package/lib/components/TsIcon/TsIcon.js.map +1 -0
- package/lib/components/TsIcon/TsIcon.types.d.ts +4 -0
- package/lib/components/TsIcon/TsIcon.types.js +3 -0
- package/lib/components/TsIcon/TsIcon.types.js.map +1 -0
- package/lib/components/TsIcon/__stories__/TsIcon.stories.mdx +89 -0
- package/lib/components/TsIcon/icons/add-circle.svg +1 -0
- package/lib/components/TsIcon/icons/add.svg +1 -0
- package/lib/components/TsIcon/icons/alert-circle-filled.svg +1 -0
- package/lib/components/TsIcon/icons/alert-circle.svg +1 -0
- package/lib/components/TsIcon/icons/alert-triangle-filled.svg +1 -0
- package/lib/components/TsIcon/icons/alert-triangle.svg +1 -0
- package/lib/components/TsIcon/icons/arrow-diagonal-collapse.svg +1 -0
- package/lib/components/TsIcon/icons/arrow-diagonal-expand.svg +1 -0
- package/lib/components/TsIcon/icons/arrow-down.svg +1 -0
- package/lib/components/TsIcon/icons/arrow-go-back.svg +1 -0
- package/lib/components/TsIcon/icons/arrow-left-right.svg +1 -0
- package/lib/components/TsIcon/icons/arrow-left.svg +1 -0
- package/lib/components/TsIcon/icons/arrow-right.svg +1 -0
- package/lib/components/TsIcon/icons/arrow-up-down.svg +1 -0
- package/lib/components/TsIcon/icons/arrow-up.svg +1 -0
- package/lib/components/TsIcon/icons/award.svg +1 -0
- package/lib/components/TsIcon/icons/check-circle-filled.svg +1 -0
- package/lib/components/TsIcon/icons/check-circle-timer.svg +7 -0
- package/lib/components/TsIcon/icons/check-circle.svg +1 -0
- package/lib/components/TsIcon/icons/check-square-filled.svg +1 -0
- package/lib/components/TsIcon/icons/check-square.svg +1 -0
- package/lib/components/TsIcon/icons/check.svg +1 -0
- package/lib/components/TsIcon/icons/chevron-down.svg +1 -0
- package/lib/components/TsIcon/icons/chevron-left.svg +1 -0
- package/lib/components/TsIcon/icons/chevron-right.svg +1 -0
- package/lib/components/TsIcon/icons/chevron-up.svg +1 -0
- package/lib/components/TsIcon/icons/circle.svg +1 -0
- package/lib/components/TsIcon/icons/close-circle.svg +1 -0
- package/lib/components/TsIcon/icons/close.svg +1 -0
- package/lib/components/TsIcon/icons/currency-euro.svg +1 -0
- package/lib/components/TsIcon/icons/download.svg +1 -0
- package/lib/components/TsIcon/icons/edit.svg +1 -0
- package/lib/components/TsIcon/icons/external-link.svg +1 -0
- package/lib/components/TsIcon/icons/filter-off.svg +1 -0
- package/lib/components/TsIcon/icons/filter.svg +1 -0
- package/lib/components/TsIcon/icons/flashlight-off.svg +1 -0
- package/lib/components/TsIcon/icons/flashlight.svg +1 -0
- package/lib/components/TsIcon/icons/header-bikestudio.svg +32 -0
- package/lib/components/TsIcon/icons/header-nsc-helmet.svg +32 -0
- package/lib/components/TsIcon/icons/header-opticost.svg +32 -0
- package/lib/components/TsIcon/icons/header-repairability.svg +32 -0
- package/lib/components/TsIcon/icons/header-techoff-suite.svg +32 -0
- package/lib/components/TsIcon/icons/heart-filled.svg +1 -0
- package/lib/components/TsIcon/icons/heart.svg +1 -0
- package/lib/components/TsIcon/icons/history.svg +1 -0
- package/lib/components/TsIcon/icons/home.svg +1 -0
- package/lib/components/TsIcon/icons/index.d.ts +3 -0
- package/lib/components/TsIcon/icons/index.js +65 -0
- package/lib/components/TsIcon/icons/index.js.map +1 -0
- package/lib/components/TsIcon/icons/index.ts +61 -0
- package/lib/components/TsIcon/icons/link.svg +1 -0
- package/lib/components/TsIcon/icons/list-settings.svg +1 -0
- package/lib/components/TsIcon/icons/lock.svg +1 -0
- package/lib/components/TsIcon/icons/loop-right.svg +1 -0
- package/lib/components/TsIcon/icons/percent.svg +1 -0
- package/lib/components/TsIcon/icons/question-circle.svg +1 -0
- package/lib/components/TsIcon/icons/save.svg +1 -0
- package/lib/components/TsIcon/icons/search.svg +1 -0
- package/lib/components/TsIcon/icons/seedling-circle.svg +12 -0
- package/lib/components/TsIcon/icons/square.svg +1 -0
- package/lib/components/TsIcon/icons/timer.svg +1 -0
- package/lib/components/TsIcon/icons/tools.svg +1 -0
- package/lib/components/TsIcon/icons/user.svg +1 -0
- package/lib/components/TsInput/TsInput/TsInput.css +92 -0
- package/lib/components/TsInput/TsInput/TsInput.d.ts +4 -0
- package/lib/components/TsInput/TsInput/TsInput.js +25 -0
- package/lib/components/TsInput/TsInput/TsInput.js.map +1 -0
- package/lib/components/TsInput/TsInput/TsInput.tsx +34 -0
- package/lib/components/TsInput/TsInput/TsInput.types.d.ts +8 -0
- package/lib/components/TsInput/TsInput/TsInput.types.js +3 -0
- package/lib/components/TsInput/TsInput/TsInput.types.js.map +1 -0
- package/lib/components/TsInput/TsInput/TsInput.types.tsx +9 -0
- package/lib/components/TsInput/TsInput/__stories__/TsInput.stories.mdx +77 -0
- package/lib/components/TsLoader/TsLoader.css +42 -0
- package/lib/components/TsLoader/TsLoader.d.ts +4 -0
- package/lib/components/TsLoader/TsLoader.js +10 -0
- package/lib/components/TsLoader/TsLoader.js.map +1 -0
- package/lib/components/TsLoader/TsLoader.types.d.ts +3 -0
- package/lib/components/TsLoader/TsLoader.types.js +3 -0
- package/lib/components/TsLoader/TsLoader.types.js.map +1 -0
- package/lib/components/TsLoader/__stories__/TsLoader.stories.mdx +30 -0
- package/lib/components/TsTabs/TsTabs.css +69 -0
- package/lib/components/TsTabs/TsTabs.d.ts +4 -0
- package/lib/components/TsTabs/TsTabs.js +34 -0
- package/lib/components/TsTabs/TsTabs.js.map +1 -0
- package/lib/components/TsTabs/TsTabs.types.d.ts +14 -0
- package/lib/components/TsTabs/TsTabs.types.js +3 -0
- package/lib/components/TsTabs/TsTabs.types.js.map +1 -0
- package/lib/components/TsTabs/__stories__/TsTabs.stories.mdx +50 -0
- package/lib/hooks/use-click-outside.d.ts +2 -0
- package/lib/hooks/use-click-outside.js +18 -0
- package/lib/hooks/use-click-outside.js.map +1 -0
- package/lib/index.d.ts +11 -0
- package/lib/index.js +28 -0
- package/lib/index.js.map +1 -0
- package/lib/layouts/TsHeader/TsHeader.css +186 -0
- package/lib/layouts/TsHeader/TsHeader.d.ts +4 -0
- package/lib/layouts/TsHeader/TsHeader.js +17 -0
- package/lib/layouts/TsHeader/TsHeader.js.map +1 -0
- package/lib/layouts/TsHeader/TsHeader.types.d.ts +23 -0
- package/lib/layouts/TsHeader/TsHeader.types.js +3 -0
- package/lib/layouts/TsHeader/TsHeader.types.js.map +1 -0
- package/lib/layouts/TsHeader/TsHeaderProfile.d.ts +5 -0
- package/lib/layouts/TsHeader/TsHeaderProfile.js +43 -0
- package/lib/layouts/TsHeader/TsHeaderProfile.js.map +1 -0
- package/lib/layouts/TsHeader/TsHeaderSearch.d.ts +3 -0
- package/lib/layouts/TsHeader/TsHeaderSearch.js +62 -0
- package/lib/layouts/TsHeader/TsHeaderSearch.js.map +1 -0
- package/lib/layouts/TsHeader/__stories__/TsHeader.stories.mdx +71 -0
- package/lib/layouts/TsNavigation/TsNavigation.css +72 -0
- package/lib/layouts/TsNavigation/TsNavigation.d.ts +7 -0
- package/lib/layouts/TsNavigation/TsNavigation.js +35 -0
- package/lib/layouts/TsNavigation/TsNavigation.js.map +1 -0
- package/lib/layouts/TsNavigation/TsNavigation.types.d.ts +10 -0
- package/lib/layouts/TsNavigation/TsNavigation.types.js +3 -0
- package/lib/layouts/TsNavigation/TsNavigation.types.js.map +1 -0
- package/lib/layouts/TsNavigation/__stories__/TsNavigation.stories.mdx +51 -0
- package/lib/utils/string.utils.d.ts +1 -0
- package/lib/utils/string.utils.js +6 -0
- package/lib/utils/string.utils.js.map +1 -0
- package/package.json +1 -1
- package/src/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.tsx +1 -0
|
@@ -0,0 +1,165 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEffect, useRef, useState } from 'react';
|
|
3
|
+
import { TsDropdownProps } from './TsDropdown.types';
|
|
4
|
+
import { TsIcon } from '../../TsIcon/TsIcon';
|
|
5
|
+
import { TsInput } from '../../TsInput/TsInput/TsInput';
|
|
6
|
+
import { useClickOutside } from '../../../hooks/use-click-outside';
|
|
7
|
+
import { TsLoader } from '../../TsLoader/TsLoader';
|
|
8
|
+
import './TsDropdown.css';
|
|
9
|
+
|
|
10
|
+
export const TsDropdown = <T,>({
|
|
11
|
+
containerRef,
|
|
12
|
+
error,
|
|
13
|
+
label,
|
|
14
|
+
options,
|
|
15
|
+
placeholder,
|
|
16
|
+
reloadOptionsOn = [],
|
|
17
|
+
searchPlaceholder,
|
|
18
|
+
value,
|
|
19
|
+
disabled,
|
|
20
|
+
searchable,
|
|
21
|
+
getOptionLabel,
|
|
22
|
+
getOptionValue,
|
|
23
|
+
loadOptions,
|
|
24
|
+
onChange,
|
|
25
|
+
}: TsDropdownProps<T>) => {
|
|
26
|
+
const [showDropdownMenu, setShowDropdownMenu] = useState<boolean>(false);
|
|
27
|
+
const [searchValue, setSearchValue] = useState<string>('');
|
|
28
|
+
const [items, setItems] = useState<T[]>(options ?? []);
|
|
29
|
+
const [loading, setLoading] = useState<boolean>(false);
|
|
30
|
+
const [isFetchError, setIsFetchError] = useState<boolean>(false);
|
|
31
|
+
const dropdownRef = useClickOutside(() => setShowDropdownMenu(false));
|
|
32
|
+
const dropdownMenuRef = useRef<HTMLDivElement>(null);
|
|
33
|
+
|
|
34
|
+
// ########
|
|
35
|
+
// Fetchers
|
|
36
|
+
const fetchOptions = () => {
|
|
37
|
+
if (!options && loadOptions) {
|
|
38
|
+
setLoading(true);
|
|
39
|
+
setIsFetchError(false);
|
|
40
|
+
loadOptions(searchValue)
|
|
41
|
+
.then(setItems)
|
|
42
|
+
.catch(() => setIsFetchError(true))
|
|
43
|
+
.finally(() => setLoading(false));
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
// ########
|
|
48
|
+
// Handlers
|
|
49
|
+
const handleSelectItem = (item: T) => {
|
|
50
|
+
setShowDropdownMenu(false);
|
|
51
|
+
onChange(item);
|
|
52
|
+
};
|
|
53
|
+
const handleShowDropdownMenu = () => !disabled && setShowDropdownMenu(true);
|
|
54
|
+
|
|
55
|
+
// ########
|
|
56
|
+
// Watchers
|
|
57
|
+
useEffect(() => {
|
|
58
|
+
if (!disabled) fetchOptions();
|
|
59
|
+
}, [...reloadOptionsOn, disabled]);
|
|
60
|
+
useEffect(() => {
|
|
61
|
+
if (searchable && options) {
|
|
62
|
+
setItems(options.filter(option => getOptionLabel(option).toLowerCase().includes(searchValue.toLowerCase())));
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
if (searchable && !options && loadOptions) {
|
|
66
|
+
setLoading(true);
|
|
67
|
+
setIsFetchError(false);
|
|
68
|
+
const timeOutId = setTimeout(fetchOptions, 500);
|
|
69
|
+
return () => clearTimeout(timeOutId);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return () => {};
|
|
73
|
+
}, [searchValue]);
|
|
74
|
+
useEffect(() => {
|
|
75
|
+
if (searchable && !showDropdownMenu) setSearchValue('');
|
|
76
|
+
|
|
77
|
+
if (showDropdownMenu && containerRef?.current && dropdownMenuRef.current) {
|
|
78
|
+
const dropdownMenuRect = dropdownMenuRef.current.getBoundingClientRect();
|
|
79
|
+
const containerRect = containerRef.current.getBoundingClientRect();
|
|
80
|
+
|
|
81
|
+
if (dropdownMenuRect.bottom > containerRect.bottom) {
|
|
82
|
+
dropdownMenuRef.current.style.bottom = '40px';
|
|
83
|
+
dropdownMenuRef.current.style.top = 'auto';
|
|
84
|
+
} else {
|
|
85
|
+
dropdownMenuRef.current.style.top = '60px';
|
|
86
|
+
dropdownMenuRef.current.style.bottom = 'auto';
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
}, [showDropdownMenu]);
|
|
90
|
+
|
|
91
|
+
// #########
|
|
92
|
+
// Rendering
|
|
93
|
+
return (
|
|
94
|
+
<div className="ts-dropdown-container" ref={dropdownRef}>
|
|
95
|
+
<div className="ts-dropdown-input-container">
|
|
96
|
+
{label && <div className="ts-dropdown-label">{label}</div>}
|
|
97
|
+
<div
|
|
98
|
+
className={`
|
|
99
|
+
ts-dropdown-input
|
|
100
|
+
${disabled ? 'ts-dropdown-input--disabled' : ''}
|
|
101
|
+
${error && error !== '' ? 'ts-dropdown-container--error' : ''}
|
|
102
|
+
`}
|
|
103
|
+
onClick={handleShowDropdownMenu}
|
|
104
|
+
>
|
|
105
|
+
{!value && placeholder && <div className="ts-dropdown-input--placeholder">{placeholder}</div>}
|
|
106
|
+
{value && <div className="ts-dropdown-input--value">{getOptionLabel(value)}</div>}
|
|
107
|
+
<div className="ts-dropdown-input--chevron">
|
|
108
|
+
<TsIcon name={showDropdownMenu ? 'chevron-up' : 'chevron-down'} />
|
|
109
|
+
</div>
|
|
110
|
+
</div>
|
|
111
|
+
</div>
|
|
112
|
+
|
|
113
|
+
{error && error !== '' && (
|
|
114
|
+
<div className="ts-dropdown-error">
|
|
115
|
+
<div className="ts-dropdown-error--icon">
|
|
116
|
+
<TsIcon name="alert-circle" size="16" />
|
|
117
|
+
</div>
|
|
118
|
+
<div className="ts-dropdown-error--label">{error}</div>
|
|
119
|
+
</div>
|
|
120
|
+
)}
|
|
121
|
+
|
|
122
|
+
{!disabled && showDropdownMenu && (
|
|
123
|
+
<div className="ts-dropdown-menu-container" ref={dropdownMenuRef}>
|
|
124
|
+
{searchable && (
|
|
125
|
+
<div className="ts-dropdown-search">
|
|
126
|
+
<TsInput
|
|
127
|
+
icon="search"
|
|
128
|
+
placeholder={searchPlaceholder}
|
|
129
|
+
value={searchValue}
|
|
130
|
+
autoFocus
|
|
131
|
+
onChange={setSearchValue}
|
|
132
|
+
/>
|
|
133
|
+
</div>
|
|
134
|
+
)}
|
|
135
|
+
|
|
136
|
+
<div className="ts-dropdown-menu">
|
|
137
|
+
{loading && (
|
|
138
|
+
<div className="ts-dropdown-menu-loader">
|
|
139
|
+
<TsLoader size="sm" />
|
|
140
|
+
</div>
|
|
141
|
+
)}
|
|
142
|
+
{!loading && isFetchError && (
|
|
143
|
+
<div className="ts-dropdown-menu-error-text">An error occured, try again later.</div>
|
|
144
|
+
)}
|
|
145
|
+
{!loading && !isFetchError && items.length === 0 && (
|
|
146
|
+
<div className="ts-dropdown-menu-error-text">No options found.</div>
|
|
147
|
+
)}
|
|
148
|
+
{!loading &&
|
|
149
|
+
!isFetchError &&
|
|
150
|
+
items.length > 0 &&
|
|
151
|
+
items.map(item => (
|
|
152
|
+
<div
|
|
153
|
+
key={getOptionValue(item)}
|
|
154
|
+
className="ts-dropdown-menu-item"
|
|
155
|
+
onClick={() => handleSelectItem(item)}
|
|
156
|
+
>
|
|
157
|
+
{getOptionLabel(item)}
|
|
158
|
+
</div>
|
|
159
|
+
))}
|
|
160
|
+
</div>
|
|
161
|
+
</div>
|
|
162
|
+
)}
|
|
163
|
+
</div>
|
|
164
|
+
);
|
|
165
|
+
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
export type TsDropdownProps<T> = {
|
|
3
|
+
containerRef?: RefObject<HTMLElement>;
|
|
4
|
+
error?: string;
|
|
5
|
+
label?: string;
|
|
6
|
+
options?: T[];
|
|
7
|
+
placeholder?: string;
|
|
8
|
+
reloadOptionsOn?: any[];
|
|
9
|
+
searchPlaceholder?: string;
|
|
10
|
+
value?: T;
|
|
11
|
+
disabled?: boolean;
|
|
12
|
+
searchable?: boolean;
|
|
13
|
+
getOptionLabel: (option: T) => string;
|
|
14
|
+
getOptionValue: (option: T) => string;
|
|
15
|
+
loadOptions?: (search?: string) => Promise<T[]>;
|
|
16
|
+
onChange: (value?: T) => void;
|
|
17
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsDropdown.types.js","sourceRoot":"","sources":["../../../../src/components/TsDropdowns/TsDropdown/TsDropdown.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
|
|
3
|
+
export type TsDropdownProps<T> = {
|
|
4
|
+
containerRef?: RefObject<HTMLElement>;
|
|
5
|
+
error?: string;
|
|
6
|
+
label?: string;
|
|
7
|
+
options?: T[];
|
|
8
|
+
placeholder?: string;
|
|
9
|
+
reloadOptionsOn?: any[];
|
|
10
|
+
searchPlaceholder?: string;
|
|
11
|
+
value?: T;
|
|
12
|
+
disabled?: boolean;
|
|
13
|
+
searchable?: boolean;
|
|
14
|
+
getOptionLabel: (option: T) => string;
|
|
15
|
+
getOptionValue: (option: T) => string;
|
|
16
|
+
loadOptions?: (search?: string) => Promise<T[]>;
|
|
17
|
+
onChange: (value?: T) => void;
|
|
18
|
+
};
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
+
import { TsDropdown } from '../TsDropdown';
|
|
4
|
+
import { fruits } from './fruits';
|
|
5
|
+
|
|
6
|
+
<Meta title="Components/Dropdowns/Dropdown" />
|
|
7
|
+
|
|
8
|
+
export const dropdownArgTypes = {
|
|
9
|
+
error: {
|
|
10
|
+
control: 'text',
|
|
11
|
+
description: 'Error of the dropdown.',
|
|
12
|
+
},
|
|
13
|
+
label: {
|
|
14
|
+
control: 'text',
|
|
15
|
+
description: 'Label of the dropdown.',
|
|
16
|
+
},
|
|
17
|
+
placeholder: {
|
|
18
|
+
control: 'text',
|
|
19
|
+
description: 'Placeholder of the dropdown.',
|
|
20
|
+
},
|
|
21
|
+
searchPlaceholder: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'Placeholder of the option search (only for searchable dropdowns).',
|
|
24
|
+
},
|
|
25
|
+
searchable: {
|
|
26
|
+
control: 'boolean',
|
|
27
|
+
description: 'Enable search on dropdown items.',
|
|
28
|
+
table: { defaultValue: { summary: 'false' } },
|
|
29
|
+
},
|
|
30
|
+
disabled: {
|
|
31
|
+
control: 'boolean',
|
|
32
|
+
description: 'Enable state of the dropdown.',
|
|
33
|
+
table: { defaultValue: { summary: 'false' } },
|
|
34
|
+
},
|
|
35
|
+
getOptionLabel: {
|
|
36
|
+
control: 'function',
|
|
37
|
+
description: 'The handler called to get the option label',
|
|
38
|
+
},
|
|
39
|
+
getOptionValue: {
|
|
40
|
+
control: 'function',
|
|
41
|
+
description: 'The handler called to get the option value.',
|
|
42
|
+
},
|
|
43
|
+
loadOptions: {
|
|
44
|
+
control: 'function',
|
|
45
|
+
description: 'The handler called to fetch all options in async (not available on playground).',
|
|
46
|
+
},
|
|
47
|
+
onChange: {
|
|
48
|
+
control: 'function',
|
|
49
|
+
description: 'The handler called when clicking on the dropdown option.',
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
# Dropdown
|
|
54
|
+
|
|
55
|
+
Dropdowns show a list of options that can be used to select, filter or sort content.
|
|
56
|
+
|
|
57
|
+
## Overview
|
|
58
|
+
|
|
59
|
+
<Canvas>
|
|
60
|
+
<Story
|
|
61
|
+
name="Overview"
|
|
62
|
+
args={{
|
|
63
|
+
error: '',
|
|
64
|
+
label: 'Label',
|
|
65
|
+
options: fruits,
|
|
66
|
+
searchPlaceholder: '',
|
|
67
|
+
placeholder: 'Select an item',
|
|
68
|
+
disabled: false,
|
|
69
|
+
searchable: false,
|
|
70
|
+
getOptionLabel: function ol(fruit) {
|
|
71
|
+
return fruit.name;
|
|
72
|
+
},
|
|
73
|
+
getOptionValue: function ov(fruit) {
|
|
74
|
+
return fruit.id;
|
|
75
|
+
},
|
|
76
|
+
}}
|
|
77
|
+
argTypes={dropdownArgTypes}
|
|
78
|
+
>
|
|
79
|
+
{args => <TsDropdown {...args}>{args.children}</TsDropdown>}
|
|
80
|
+
</Story>
|
|
81
|
+
</Canvas>
|
|
82
|
+
|
|
83
|
+
## Props
|
|
84
|
+
|
|
85
|
+
<ArgsTable story="Overview" of={TsDropdown} />
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
export const fruits = [
|
|
2
|
+
{ name: 'Persimmon', id: 52 },
|
|
3
|
+
{ name: 'Strawberry', id: 3 },
|
|
4
|
+
{ name: 'Banana', id: 1 },
|
|
5
|
+
{ name: 'Tomato', id: 5 },
|
|
6
|
+
{ name: 'Pear', id: 4 },
|
|
7
|
+
{ name: 'Durian', id: 60 },
|
|
8
|
+
{ name: 'Blackberry', id: 64 },
|
|
9
|
+
{ name: 'Lingonberry', id: 65 },
|
|
10
|
+
{ name: 'Kiwi', id: 66 },
|
|
11
|
+
{ name: 'Lychee', id: 67 },
|
|
12
|
+
{ name: 'Pineapple', id: 10 },
|
|
13
|
+
{ name: 'Fig', id: 68 },
|
|
14
|
+
{ name: 'Gooseberry', id: 69 },
|
|
15
|
+
{ name: 'Passionfruit', id: 70 },
|
|
16
|
+
{ name: 'Plum', id: 71 },
|
|
17
|
+
{ name: 'Orange', id: 2 },
|
|
18
|
+
{ name: 'GreenApple', id: 72 },
|
|
19
|
+
{ name: 'Raspberry', id: 23 },
|
|
20
|
+
{ name: 'Watermelon', id: 25 },
|
|
21
|
+
{ name: 'Lemon', id: 26 },
|
|
22
|
+
{ name: 'Mango', id: 27 },
|
|
23
|
+
{ name: 'Blueberry', id: 33 },
|
|
24
|
+
{ name: 'Apple', id: 6 },
|
|
25
|
+
{ name: 'Guava', id: 37 },
|
|
26
|
+
{ name: 'Apricot', id: 35 },
|
|
27
|
+
{ name: 'Papaya', id: 42 },
|
|
28
|
+
{ name: 'Melon', id: 41 },
|
|
29
|
+
{ name: 'Tangerine', id: 77 },
|
|
30
|
+
{ name: 'Pitahaya', id: 78 },
|
|
31
|
+
{ name: 'Lime', id: 44 },
|
|
32
|
+
{ name: 'Pomegranate', id: 79 },
|
|
33
|
+
{ name: 'Dragonfruit', id: 80 },
|
|
34
|
+
{ name: 'Grape', id: 81 },
|
|
35
|
+
{ name: 'Morus', id: 82 },
|
|
36
|
+
{ name: 'Feijoa', id: 76 },
|
|
37
|
+
{ name: 'Avocado', id: 84 },
|
|
38
|
+
{ name: 'Kiwifruit', id: 85 },
|
|
39
|
+
{ name: 'Cranberry', id: 87 },
|
|
40
|
+
{ name: 'Cherry', id: 9 },
|
|
41
|
+
{ name: 'Peach', id: 86 },
|
|
42
|
+
{ name: 'Jackfruit', id: 94 },
|
|
43
|
+
{ name: 'Horned Melon', id: 95 },
|
|
44
|
+
{ name: 'Hazelnut', id: 96 },
|
|
45
|
+
{ name: 'Pomelo', id: 98 },
|
|
46
|
+
{ name: 'Mangosteen', id: 99 },
|
|
47
|
+
];
|
|
48
|
+
//# sourceMappingURL=fruits.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fruits.js","sourceRoot":"","sources":["../../../../../src/components/TsDropdowns/TsDropdown/__stories__/fruits.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,MAAM,GAAG;IACpB,EAAE,IAAI,EAAE,WAAW,EAAE,EAAE,EAAE,EAAE,EAAE;IAC7B,EAAE,IAAI,EAAE,YAAY,EAAE,EAAE,EAAE,CAAC,EAAE;IAC7B,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE;IACzB,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,EAAE,CAAC,EAAE;IACzB,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,EAAE;IACvB,EAAE,IAAI,EAAE,QAAQ,EAAE,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its = [
|
|
2
|
+
{ name: 'Persimmon', id: 52 },
|
|
3
|
+
{ name: 'Strawberry', id: 3 },
|
|
4
|
+
{ name: 'Banana', id: 1 },
|
|
5
|
+
{ name: 'Tomato', id: 5 },
|
|
6
|
+
{ name: 'Pear', id: 4 },
|
|
7
|
+
{ name: 'Durian', id: 60 },
|
|
8
|
+
{ name: 'Blackberry', id: 64 },
|
|
9
|
+
{ name: 'Lingonberry', id: 65 },
|
|
10
|
+
{ name: 'Kiwi', id: 66 },
|
|
11
|
+
{ name: 'Lychee', id: 67 },
|
|
12
|
+
{ name: 'Pineapple', id: 10 },
|
|
13
|
+
{ name: 'Fig', id: 68 },
|
|
14
|
+
{ name: 'Gooseberry', id: 69 },
|
|
15
|
+
{ name: 'Passionfruit', id: 70 },
|
|
16
|
+
{ name: 'Plum', id: 71 },
|
|
17
|
+
{ name: 'Orange', id: 2 },
|
|
18
|
+
{ name: 'GreenApple', id: 72 },
|
|
19
|
+
{ name: 'Raspberry', id: 23 },
|
|
20
|
+
{ name: 'Watermelon', id: 25 },
|
|
21
|
+
{ name: 'Lemon', id: 26 },
|
|
22
|
+
{ name: 'Mango', id: 27 },
|
|
23
|
+
{ name: 'Blueberry', id: 33 },
|
|
24
|
+
{ name: 'Apple', id: 6 },
|
|
25
|
+
{ name: 'Guava', id: 37 },
|
|
26
|
+
{ name: 'Apricot', id: 35 },
|
|
27
|
+
{ name: 'Papaya', id: 42 },
|
|
28
|
+
{ name: 'Melon', id: 41 },
|
|
29
|
+
{ name: 'Tangerine', id: 77 },
|
|
30
|
+
{ name: 'Pitahaya', id: 78 },
|
|
31
|
+
{ name: 'Lime', id: 44 },
|
|
32
|
+
{ name: 'Pomegranate', id: 79 },
|
|
33
|
+
{ name: 'Dragonfruit', id: 80 },
|
|
34
|
+
{ name: 'Grape', id: 81 },
|
|
35
|
+
{ name: 'Morus', id: 82 },
|
|
36
|
+
{ name: 'Feijoa', id: 76 },
|
|
37
|
+
{ name: 'Avocado', id: 84 },
|
|
38
|
+
{ name: 'Kiwifruit', id: 85 },
|
|
39
|
+
{ name: 'Cranberry', id: 87 },
|
|
40
|
+
{ name: 'Cherry', id: 9 },
|
|
41
|
+
{ name: 'Peach', id: 86 },
|
|
42
|
+
{ name: 'Jackfruit', id: 94 },
|
|
43
|
+
{ name: 'Horned Melon', id: 95 },
|
|
44
|
+
{ name: 'Hazelnut', id: 96 },
|
|
45
|
+
{ name: 'Pomelo', id: 98 },
|
|
46
|
+
{ name: 'Mangosteen', id: 99 },
|
|
47
|
+
];
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
.ts-dropdown-container {
|
|
2
|
+
position: relative;
|
|
3
|
+
}
|
|
4
|
+
.ts-dropdown-input {
|
|
5
|
+
display: flex;
|
|
6
|
+
height: 32px;
|
|
7
|
+
padding-left: 16px;
|
|
8
|
+
padding-right: 12px;
|
|
9
|
+
background: #e1e3f5;
|
|
10
|
+
color: #3643ba;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
.ts-dropdown-input:hover {
|
|
14
|
+
background: #d7daf1;
|
|
15
|
+
}
|
|
16
|
+
.ts-dropdown-label {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
height: 32px;
|
|
20
|
+
margin-right: 2px;
|
|
21
|
+
}
|
|
22
|
+
.ts-dropdown-input--chevron {
|
|
23
|
+
display: flex;
|
|
24
|
+
align-items: center;
|
|
25
|
+
justify-content: center;
|
|
26
|
+
height: 32px;
|
|
27
|
+
}
|
|
28
|
+
.ts-dropdown-menu-container {
|
|
29
|
+
position: absolute;
|
|
30
|
+
top: calc(100% + 8px);
|
|
31
|
+
display: flex;
|
|
32
|
+
flex-direction: column;
|
|
33
|
+
width: 320px;
|
|
34
|
+
max-height: 200px;
|
|
35
|
+
padding: 12px;
|
|
36
|
+
box-shadow: 0px 8px 9px 0px #1010101a;
|
|
37
|
+
background: #ffffff;
|
|
38
|
+
overflow: hidden;
|
|
39
|
+
z-index: 10;
|
|
40
|
+
}
|
|
41
|
+
.ts-dropdown-search {
|
|
42
|
+
padding-bottom: 12px;
|
|
43
|
+
border-bottom: 1px solid #d9dde1;
|
|
44
|
+
}
|
|
45
|
+
.ts-dropdown-menu-loader {
|
|
46
|
+
display: flex;
|
|
47
|
+
align-items: center;
|
|
48
|
+
justify-content: center;
|
|
49
|
+
padding-top: 12px;
|
|
50
|
+
}
|
|
51
|
+
.ts-dropdown-menu-error-text {
|
|
52
|
+
display: flex;
|
|
53
|
+
align-items: center;
|
|
54
|
+
justify-content: center;
|
|
55
|
+
padding-top: 12px;
|
|
56
|
+
color: #687787;
|
|
57
|
+
font-style: italic;
|
|
58
|
+
}
|
|
59
|
+
.ts-dropdown-menu {
|
|
60
|
+
padding-top: 12px;
|
|
61
|
+
overflow: auto;
|
|
62
|
+
}
|
|
63
|
+
.ts-dropdown-menu-item {
|
|
64
|
+
display: flex;
|
|
65
|
+
align-items: center;
|
|
66
|
+
height: 32px;
|
|
67
|
+
padding: 0 12px;
|
|
68
|
+
cursor: pointer;
|
|
69
|
+
}
|
|
70
|
+
.ts-dropdown-menu-item:hover {
|
|
71
|
+
background: #e1e3f5;
|
|
72
|
+
color: #3643ba;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
/* ######### */
|
|
76
|
+
/* GLOBALS */
|
|
77
|
+
* {
|
|
78
|
+
font-size: 14px;
|
|
79
|
+
outline: none;
|
|
80
|
+
box-sizing: border-box;
|
|
81
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
|
82
|
+
'Helvetica Neue', sans-serif;
|
|
83
|
+
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TsDropdownFilterProps } from './TsDropdownFilter.types';
|
|
3
|
+
import './TsDropdownFilter.css';
|
|
4
|
+
export declare const TsDropdownFilter: <T>({ label, searchPlaceholder, loadOptions, getOptionLabel, getOptionValue, onChange, }: TsDropdownFilterProps<T>) => React.JSX.Element;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useClickOutside } from '../../../hooks/use-click-outside';
|
|
4
|
+
import { capitalize } from '../../../utils/string.utils';
|
|
5
|
+
import { TsIcon } from '../../TsIcon/TsIcon';
|
|
6
|
+
import { TsInput } from '../../TsInput/TsInput/TsInput';
|
|
7
|
+
import { TsLoader } from '../../TsLoader/TsLoader';
|
|
8
|
+
import './TsDropdownFilter.css';
|
|
9
|
+
export const TsDropdownFilter = ({ label, searchPlaceholder, loadOptions, getOptionLabel, getOptionValue, onChange, }) => {
|
|
10
|
+
const [searchValue, setSearchValue] = useState('');
|
|
11
|
+
const [showDropdown, setShowDropdown] = useState(false);
|
|
12
|
+
const [items, setItems] = useState([]);
|
|
13
|
+
const [loading, setLoading] = useState(true);
|
|
14
|
+
const ref = useClickOutside(() => setShowDropdown(false));
|
|
15
|
+
// ########
|
|
16
|
+
// Fetchers
|
|
17
|
+
const fetchAllItems = () => {
|
|
18
|
+
return loadOptions(searchValue)
|
|
19
|
+
.then(setItems)
|
|
20
|
+
.catch(() => { }); // TODO: Manage fetch ERRORS (Show an error message : 'An error occured, please retry later' or something else)
|
|
21
|
+
};
|
|
22
|
+
// ########
|
|
23
|
+
// Handlers
|
|
24
|
+
const handleSelectItem = (value) => {
|
|
25
|
+
onChange(value);
|
|
26
|
+
setShowDropdown(false);
|
|
27
|
+
};
|
|
28
|
+
// ########
|
|
29
|
+
// Watchers
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (!showDropdown)
|
|
32
|
+
setSearchValue('');
|
|
33
|
+
}, [showDropdown]);
|
|
34
|
+
useEffect(() => {
|
|
35
|
+
setLoading(true);
|
|
36
|
+
if (!searchValue) {
|
|
37
|
+
fetchAllItems().finally(() => setLoading(false));
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const timeOutId = setTimeout(() => {
|
|
41
|
+
fetchAllItems().finally(() => setLoading(false));
|
|
42
|
+
}, 500);
|
|
43
|
+
return () => clearTimeout(timeOutId);
|
|
44
|
+
}
|
|
45
|
+
return;
|
|
46
|
+
}, [searchValue]);
|
|
47
|
+
// #########
|
|
48
|
+
// Rendering
|
|
49
|
+
return (React.createElement("div", { className: "ts-dropdown-container", ref: ref },
|
|
50
|
+
React.createElement("div", { className: "ts-dropdown-input", onClick: () => setShowDropdown(!showDropdown) },
|
|
51
|
+
React.createElement("div", { className: "ts-dropdown-label" }, label),
|
|
52
|
+
React.createElement("div", { className: "ts-dropdown-input--chevron" },
|
|
53
|
+
React.createElement(TsIcon, { name: showDropdown ? 'chevron-up' : 'chevron-down' }))),
|
|
54
|
+
showDropdown && (React.createElement("div", { className: "ts-dropdown-menu-container" },
|
|
55
|
+
React.createElement("div", { className: "ts-dropdown-search" },
|
|
56
|
+
React.createElement(TsInput, { icon: "search", placeholder: searchPlaceholder, value: searchValue, autoFocus: true, onChange: setSearchValue })),
|
|
57
|
+
loading && (React.createElement("div", { className: "ts-dropdown-menu-loader" },
|
|
58
|
+
React.createElement(TsLoader, { size: "sm" }))),
|
|
59
|
+
!loading && items.length === 0 && React.createElement("div", { className: "ts-dropdown-menu-error-text" }, "Nothing found."),
|
|
60
|
+
!loading && items.length > 0 && (React.createElement("div", { className: "ts-dropdown-menu" }, items.map(item => (React.createElement("div", { key: getOptionValue(item), className: "ts-dropdown-menu-item", onClick: () => handleSelectItem(item) }, capitalize(getOptionLabel(item)))))))))));
|
|
61
|
+
};
|
|
62
|
+
//# sourceMappingURL=TsDropdownFilter.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsDropdownFilter.js","sourceRoot":"","sources":["../../../../src/components/TsDropdowns/TsDropdownFilter/TsDropdownFilter.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,SAAS,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,WAAW,EAClB,SAAS,QACT,QAAQ,EAAE,cAAc,GACxB,CACE;YAEL,OAAO,IAAI,CACV,6BAAK,SAAS,EAAC,yBAAyB;gBACtC,oBAAC,QAAQ,IAAC,IAAI,EAAC,IAAI,GAAG,CAClB,CACP;YACA,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,6BAAK,SAAS,EAAC,6BAA6B,qBAAqB;YACnG,CAAC,OAAO,IAAI,KAAK,CAAC,MAAM,GAAG,CAAC,IAAI,CAC/B,6BAAK,SAAS,EAAC,kBAAkB,IAC9B,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC,CACjB,6BACE,GAAG,EAAE,cAAc,CAAC,IAAI,CAAC,EACzB,SAAS,EAAC,uBAAuB,EACjC,OAAO,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,IAEpC,UAAU,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,CAC7B,CACP,CAAC,CACE,CACP,CACG,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
|
+
import { useClickOutside } from '../../../hooks/use-click-outside';
|
|
4
|
+
import { capitalize } from '../../../utils/string.utils';
|
|
5
|
+
import { TsIcon } from '../../TsIcon/TsIcon';
|
|
6
|
+
import { TsInput } from '../../TsInput/TsInput/TsInput';
|
|
7
|
+
import { TsLoader } from '../../TsLoader/TsLoader';
|
|
8
|
+
import { TsDropdownFilterProps } from './TsDropdownFilter.types';
|
|
9
|
+
import './TsDropdownFilter.css';
|
|
10
|
+
|
|
11
|
+
export const TsDropdownFilter = <T,>({
|
|
12
|
+
label,
|
|
13
|
+
searchPlaceholder,
|
|
14
|
+
loadOptions,
|
|
15
|
+
getOptionLabel,
|
|
16
|
+
getOptionValue,
|
|
17
|
+
onChange,
|
|
18
|
+
}: TsDropdownFilterProps<T>) => {
|
|
19
|
+
const [searchValue, setSearchValue] = useState<string>('');
|
|
20
|
+
const [showDropdown, setShowDropdown] = useState<boolean>(false);
|
|
21
|
+
const [items, setItems] = useState<T[]>([]);
|
|
22
|
+
const [loading, setLoading] = useState<boolean>(true);
|
|
23
|
+
const ref = useClickOutside(() => setShowDropdown(false));
|
|
24
|
+
|
|
25
|
+
// ########
|
|
26
|
+
// Fetchers
|
|
27
|
+
const fetchAllItems = () => {
|
|
28
|
+
return loadOptions(searchValue)
|
|
29
|
+
.then(setItems)
|
|
30
|
+
.catch(() => {}); // TODO: Manage fetch ERRORS (Show an error message : 'An error occured, please retry later' or something else)
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
// ########
|
|
34
|
+
// Handlers
|
|
35
|
+
const handleSelectItem = (value: T) => {
|
|
36
|
+
onChange(value);
|
|
37
|
+
setShowDropdown(false);
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
// ########
|
|
41
|
+
// Watchers
|
|
42
|
+
useEffect(() => {
|
|
43
|
+
if (!showDropdown) setSearchValue('');
|
|
44
|
+
}, [showDropdown]);
|
|
45
|
+
useEffect(() => {
|
|
46
|
+
setLoading(true);
|
|
47
|
+
|
|
48
|
+
if (!searchValue) {
|
|
49
|
+
fetchAllItems().finally(() => setLoading(false));
|
|
50
|
+
} else {
|
|
51
|
+
const timeOutId = setTimeout(() => {
|
|
52
|
+
fetchAllItems().finally(() => setLoading(false));
|
|
53
|
+
}, 500);
|
|
54
|
+
return () => clearTimeout(timeOutId);
|
|
55
|
+
}
|
|
56
|
+
return;
|
|
57
|
+
}, [searchValue]);
|
|
58
|
+
|
|
59
|
+
// #########
|
|
60
|
+
// Rendering
|
|
61
|
+
return (
|
|
62
|
+
<div className="ts-dropdown-container" ref={ref}>
|
|
63
|
+
<div className="ts-dropdown-input" onClick={() => setShowDropdown(!showDropdown)}>
|
|
64
|
+
<div className="ts-dropdown-label">{label}</div>
|
|
65
|
+
<div className="ts-dropdown-input--chevron">
|
|
66
|
+
<TsIcon name={showDropdown ? 'chevron-up' : 'chevron-down'} />
|
|
67
|
+
</div>
|
|
68
|
+
</div>
|
|
69
|
+
|
|
70
|
+
{showDropdown && (
|
|
71
|
+
<div className="ts-dropdown-menu-container">
|
|
72
|
+
<div className="ts-dropdown-search">
|
|
73
|
+
<TsInput
|
|
74
|
+
icon="search"
|
|
75
|
+
placeholder={searchPlaceholder}
|
|
76
|
+
value={searchValue}
|
|
77
|
+
autoFocus
|
|
78
|
+
onChange={setSearchValue}
|
|
79
|
+
/>
|
|
80
|
+
</div>
|
|
81
|
+
|
|
82
|
+
{loading && (
|
|
83
|
+
<div className="ts-dropdown-menu-loader">
|
|
84
|
+
<TsLoader size="sm" />
|
|
85
|
+
</div>
|
|
86
|
+
)}
|
|
87
|
+
{!loading && items.length === 0 && <div className="ts-dropdown-menu-error-text">Nothing found.</div>}
|
|
88
|
+
{!loading && items.length > 0 && (
|
|
89
|
+
<div className="ts-dropdown-menu">
|
|
90
|
+
{items.map(item => (
|
|
91
|
+
<div
|
|
92
|
+
key={getOptionValue(item)}
|
|
93
|
+
className="ts-dropdown-menu-item"
|
|
94
|
+
onClick={() => handleSelectItem(item)}
|
|
95
|
+
>
|
|
96
|
+
{capitalize(getOptionLabel(item))}
|
|
97
|
+
</div>
|
|
98
|
+
))}
|
|
99
|
+
</div>
|
|
100
|
+
)}
|
|
101
|
+
</div>
|
|
102
|
+
)}
|
|
103
|
+
</div>
|
|
104
|
+
);
|
|
105
|
+
};
|