@bodynarf/react.components 1.7.3 → 1.7.4
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/{components → dist/components}/accordion/component/index.d.ts +1 -1
- package/{components → dist/components}/accordion/component/index.js +3 -3
- package/dist/components/accordion/types.d.ts +18 -0
- package/{components → dist/components}/anchor/component/index.d.ts +1 -1
- package/{components → dist/components}/anchor/component/index.js +2 -2
- package/{components → dist/components}/anchor/components/anchorWithIcon/index.d.ts +1 -1
- package/{components → dist/components}/anchor/components/anchorWithIcon/index.js +1 -1
- package/{components → dist/components}/anchor/components/simpleAnchor/index.d.ts +1 -1
- package/dist/components/anchor/types.d.ts +39 -0
- package/{components → dist/components}/button/component/index.d.ts +1 -1
- package/{components → dist/components}/button/component/index.js +3 -3
- package/{components → dist/components}/button/components/buttonWithIcon/index.d.ts +1 -1
- package/{components → dist/components}/button/components/buttonWithIcon/index.js +1 -1
- package/{components → dist/components}/button/components/simpleButton/index.d.ts +1 -1
- package/{components → dist/components}/button/types.d.ts +1 -1
- package/{components → dist/components}/dropdown/component/index.d.ts +1 -1
- package/{components → dist/components}/dropdown/component/index.js +2 -2
- package/{components → dist/components}/dropdown/components/compact/index.d.ts +1 -1
- package/{components → dist/components}/dropdown/components/compact/index.js +3 -3
- package/{components → dist/components}/dropdown/components/item/index.d.ts +1 -1
- package/{components → dist/components}/dropdown/components/label/index.d.ts +1 -1
- package/{components → dist/components}/dropdown/components/label/index.js +2 -2
- package/{components → dist/components}/dropdown/components/withLabel/index.d.ts +1 -1
- package/{components → dist/components}/dropdown/components/withLabel/index.js +4 -4
- package/dist/components/dropdown/types.d.ts +46 -0
- package/{components → dist/components}/icon/component/index.d.ts +1 -1
- package/{components → dist/components}/icon/component/index.js +1 -1
- package/dist/components/icon/types.d.ts +16 -0
- package/{components → dist/components}/paginator/component/index.d.ts +1 -1
- package/{components → dist/components}/paginator/component/index.js +1 -1
- package/{components → dist/components}/paginator/types.d.ts +1 -1
- package/{components → dist/components}/primitives/checkbox/component/index.d.ts +1 -1
- package/dist/components/primitives/checkbox/types.d.ts +25 -0
- package/{components → dist/components}/primitives/date/component/index.d.ts +1 -1
- package/{components → dist/components}/primitives/date/component/index.js +2 -2
- package/dist/components/primitives/date/types.d.ts +9 -0
- package/{components → dist/components}/primitives/multiline/component/index.d.ts +1 -1
- package/{components → dist/components}/primitives/multiline/component/index.js +2 -2
- package/{components → dist/components}/primitives/multiline/components/multilineWithLabel/index.d.ts +1 -1
- package/{components → dist/components}/primitives/multiline/components/multilineWithLabel/index.js +2 -2
- package/{components → dist/components}/primitives/multiline/components/multilineWithoutLabel/index.d.ts +1 -1
- package/{components → dist/components}/primitives/multiline/components/multilineWithoutLabel/index.js +2 -2
- package/dist/components/primitives/multiline/types.d.ts +11 -0
- package/{components → dist/components}/primitives/number/component/index.d.ts +1 -1
- package/{components → dist/components}/primitives/number/component/index.js +2 -2
- package/{components → dist/components}/primitives/number/components/withLabel/index.d.ts +1 -1
- package/{components → dist/components}/primitives/number/components/withLabel/index.js +2 -2
- package/{components → dist/components}/primitives/number/components/withoutLabel/index.d.ts +1 -1
- package/{components → dist/components}/primitives/number/components/withoutLabel/index.js +2 -2
- package/dist/components/primitives/number/types.d.ts +13 -0
- package/{components → dist/components}/primitives/password/component/index.d.ts +1 -1
- package/{components → dist/components}/primitives/password/component/index.js +2 -2
- package/{components → dist/components}/primitives/password/components/withLabel/index.d.ts +1 -1
- package/{components → dist/components}/primitives/password/components/withLabel/index.js +3 -3
- package/{components → dist/components}/primitives/password/components/withoutLabel/index.d.ts +1 -1
- package/{components → dist/components}/primitives/password/components/withoutLabel/index.js +3 -3
- package/dist/components/primitives/password/types.d.ts +10 -0
- package/{components → dist/components}/primitives/text/component/index.d.ts +1 -1
- package/{components → dist/components}/primitives/text/component/index.js +2 -2
- package/{components → dist/components}/primitives/text/components/textWithLabel/index.d.ts +1 -1
- package/{components → dist/components}/primitives/text/components/textWithLabel/index.js +2 -2
- package/{components → dist/components}/primitives/text/components/textWithoutLabel/index.d.ts +1 -1
- package/{components → dist/components}/primitives/text/components/textWithoutLabel/index.js +2 -2
- package/dist/components/primitives/text/types.d.ts +7 -0
- package/dist/components/primitives/types/baseProps.d.ts +30 -0
- package/{components → dist/components}/search/component/index.d.ts +1 -1
- package/{components → dist/components}/search/component/index.js +1 -1
- package/dist/components/search/types.d.ts +27 -0
- package/{components → dist/components}/tabs/component/index.d.ts +2 -2
- package/{components → dist/components}/tabs/component/index.js +4 -4
- package/{components → dist/components}/tabs/components/item/index.d.ts +1 -1
- package/{components → dist/components}/tabs/components/item/index.js +1 -1
- package/{components → dist/components}/tabs/types.d.ts +1 -1
- package/{components → dist/components}/tag/component/index.d.ts +1 -1
- package/{components → dist/components}/tag/component/index.js +1 -1
- package/dist/components/tag/types.d.ts +27 -0
- package/dist/package.json +41 -0
- package/dist/readme.md +56 -0
- package/{utils → dist/utils}/dataAttributes.d.ts +1 -1
- package/{utils → dist/utils}/formValidation.d.ts +1 -1
- package/{utils → dist/utils}/formValidation.js +1 -1
- package/package.json +5 -3
- package/src/common.scss +3 -0
- package/src/components/accordion/component/index.tsx +84 -0
- package/src/components/accordion/index.ts +2 -0
- package/{components/accordion/types.d.ts → src/components/accordion/types.ts} +6 -2
- package/src/components/anchor/component/index.tsx +40 -0
- package/src/components/anchor/component/style.scss +15 -0
- package/src/components/anchor/components/anchorWithIcon/index.tsx +45 -0
- package/src/components/anchor/components/simpleAnchor/index.tsx +16 -0
- package/src/components/anchor/index.ts +2 -0
- package/{components/anchor/types.d.ts → src/components/anchor/types.ts} +16 -1
- package/src/components/button/component/index.tsx +58 -0
- package/src/components/button/component/style.scss +12 -0
- package/src/components/button/components/buttonWithIcon/index.tsx +53 -0
- package/src/components/button/components/simpleButton/index.tsx +21 -0
- package/src/components/button/index.ts +2 -0
- package/src/components/button/types.ts +64 -0
- package/src/components/dropdown/component/index.tsx +20 -0
- package/src/components/dropdown/component/style.scss +120 -0
- package/src/components/dropdown/components/compact/index.tsx +121 -0
- package/src/components/dropdown/components/item/index.tsx +30 -0
- package/src/components/dropdown/components/label/index.tsx +68 -0
- package/src/components/dropdown/components/withLabel/index.tsx +201 -0
- package/src/components/dropdown/index.ts +2 -0
- package/{components/dropdown/types.d.ts → src/components/dropdown/types.ts} +15 -2
- package/src/components/icon/component/index.tsx +34 -0
- package/src/components/icon/component/style.scss +21 -0
- package/src/components/icon/index.ts +2 -0
- package/{components/icon/types.d.ts → src/components/icon/types.ts} +3 -1
- package/src/components/index.ts +13 -0
- package/src/components/paginator/component/index.tsx +131 -0
- package/src/components/paginator/index.ts +3 -0
- package/src/components/paginator/types.ts +40 -0
- package/src/components/paginator/utils.ts +19 -0
- package/src/components/primitives/checkbox/component/index.tsx +102 -0
- package/src/components/primitives/checkbox/component/style.scss +10 -0
- package/src/components/primitives/checkbox/index.ts +2 -0
- package/{components/primitives/checkbox/types.d.ts → src/components/primitives/checkbox/types.ts} +6 -2
- package/src/components/primitives/date/component/index.tsx +129 -0
- package/src/components/primitives/date/index.ts +2 -0
- package/{components/primitives/date/types.d.ts → src/components/primitives/date/types.ts} +2 -1
- package/src/components/primitives/index.ts +7 -0
- package/src/components/primitives/multiline/component/index.tsx +20 -0
- package/src/components/primitives/multiline/components/multilineWithLabel/index.tsx +125 -0
- package/src/components/primitives/multiline/components/multilineWithoutLabel/index.tsx +62 -0
- package/src/components/primitives/multiline/index.ts +2 -0
- package/{components/primitives/multiline/types.d.ts → src/components/primitives/multiline/types.ts} +3 -1
- package/src/components/primitives/number/component/index.tsx +17 -0
- package/src/components/primitives/number/components/withLabel/index.tsx +127 -0
- package/src/components/primitives/number/components/withoutLabel/index.tsx +66 -0
- package/src/components/primitives/number/index.ts +2 -0
- package/{components/primitives/number/types.d.ts → src/components/primitives/number/types.ts} +2 -1
- package/src/components/primitives/password/component/index.tsx +19 -0
- package/src/components/primitives/password/component/style.scss +16 -0
- package/src/components/primitives/password/components/withLabel/index.tsx +147 -0
- package/src/components/primitives/password/components/withoutLabel/index.tsx +79 -0
- package/src/components/primitives/password/index.ts +2 -0
- package/{components/primitives/password/types.d.ts → src/components/primitives/password/types.ts} +1 -1
- package/src/components/primitives/text/component/index.tsx +20 -0
- package/src/components/primitives/text/components/textWithLabel/index.tsx +123 -0
- package/src/components/primitives/text/components/textWithoutLabel/index.tsx +64 -0
- package/src/components/primitives/text/index.tsx +2 -0
- package/{components/primitives/text/types.d.ts → src/components/primitives/text/types.ts} +1 -1
- package/{components/primitives/types/baseProps.d.ts → src/components/primitives/types/baseProps.ts} +13 -1
- package/src/components/primitives/types/index.ts +3 -0
- package/src/components/primitives/types/label.ts +17 -0
- package/src/components/primitives/types/validation/index.ts +2 -0
- package/src/components/primitives/types/validation/state.ts +10 -0
- package/src/components/primitives/types/validation/status.ts +11 -0
- package/src/components/search/component/index.tsx +88 -0
- package/src/components/search/component/style.scss +24 -0
- package/src/components/search/index.ts +2 -0
- package/{components/search/types.d.ts → src/components/search/types.ts} +10 -2
- package/src/components/tabs/component/index.tsx +147 -0
- package/src/components/tabs/component/style.scss +12 -0
- package/src/components/tabs/components/item/index.tsx +86 -0
- package/src/components/tabs/index.ts +2 -0
- package/src/components/tabs/types.ts +52 -0
- package/src/components/tag/component/index.tsx +52 -0
- package/src/components/tag/component/style.scss +27 -0
- package/src/components/tag/index.ts +2 -0
- package/{components/tag/types.d.ts → src/components/tag/types.ts} +8 -1
- package/src/components/types.ts +87 -0
- package/src/hooks/index.ts +2 -0
- package/src/hooks/useComponentOutsideClick.ts +48 -0
- package/src/hooks/usePagination.ts +55 -0
- package/src/index.ts +3 -0
- package/src/utils/dataAttributes.ts +26 -0
- package/src/utils/formValidation.ts +42 -0
- package/src/utils/index.ts +2 -0
- package/tsconfig.json +42 -0
- /package/{components → dist/components}/accordion/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/accordion/index.d.ts +0 -0
- /package/{components → dist/components}/accordion/index.d.ts.map +0 -0
- /package/{components → dist/components}/accordion/index.js +0 -0
- /package/{components → dist/components}/accordion/types.d.ts.map +0 -0
- /package/{components → dist/components}/accordion/types.js +0 -0
- /package/{components → dist/components}/anchor/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/anchor/components/anchorWithIcon/index.d.ts.map +0 -0
- /package/{components → dist/components}/anchor/components/simpleAnchor/index.d.ts.map +0 -0
- /package/{components → dist/components}/anchor/components/simpleAnchor/index.js +0 -0
- /package/{components → dist/components}/anchor/index.d.ts +0 -0
- /package/{components → dist/components}/anchor/index.d.ts.map +0 -0
- /package/{components → dist/components}/anchor/index.js +0 -0
- /package/{components → dist/components}/anchor/types.d.ts.map +0 -0
- /package/{components → dist/components}/anchor/types.js +0 -0
- /package/{components → dist/components}/button/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/button/components/buttonWithIcon/index.d.ts.map +0 -0
- /package/{components → dist/components}/button/components/simpleButton/index.d.ts.map +0 -0
- /package/{components → dist/components}/button/components/simpleButton/index.js +0 -0
- /package/{components → dist/components}/button/index.d.ts +0 -0
- /package/{components → dist/components}/button/index.d.ts.map +0 -0
- /package/{components → dist/components}/button/index.js +0 -0
- /package/{components → dist/components}/button/types.d.ts.map +0 -0
- /package/{components → dist/components}/button/types.js +0 -0
- /package/{components → dist/components}/dropdown/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/dropdown/components/compact/index.d.ts.map +0 -0
- /package/{components → dist/components}/dropdown/components/item/index.d.ts.map +0 -0
- /package/{components → dist/components}/dropdown/components/item/index.js +0 -0
- /package/{components → dist/components}/dropdown/components/label/index.d.ts.map +0 -0
- /package/{components → dist/components}/dropdown/components/withLabel/index.d.ts.map +0 -0
- /package/{components → dist/components}/dropdown/index.d.ts +0 -0
- /package/{components → dist/components}/dropdown/index.d.ts.map +0 -0
- /package/{components → dist/components}/dropdown/index.js +0 -0
- /package/{components → dist/components}/dropdown/types.d.ts.map +0 -0
- /package/{components → dist/components}/dropdown/types.js +0 -0
- /package/{components → dist/components}/icon/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/icon/index.d.ts +0 -0
- /package/{components → dist/components}/icon/index.d.ts.map +0 -0
- /package/{components → dist/components}/icon/index.js +0 -0
- /package/{components → dist/components}/icon/types.d.ts.map +0 -0
- /package/{components → dist/components}/icon/types.js +0 -0
- /package/{components → dist/components}/index.d.ts +0 -0
- /package/{components → dist/components}/index.d.ts.map +0 -0
- /package/{components → dist/components}/index.js +0 -0
- /package/{components → dist/components}/paginator/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/paginator/index.d.ts +0 -0
- /package/{components → dist/components}/paginator/index.d.ts.map +0 -0
- /package/{components → dist/components}/paginator/index.js +0 -0
- /package/{components → dist/components}/paginator/types.d.ts.map +0 -0
- /package/{components → dist/components}/paginator/types.js +0 -0
- /package/{components → dist/components}/paginator/utils.d.ts +0 -0
- /package/{components → dist/components}/paginator/utils.d.ts.map +0 -0
- /package/{components → dist/components}/paginator/utils.js +0 -0
- /package/{components → dist/components}/primitives/checkbox/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/checkbox/component/index.js +0 -0
- /package/{components → dist/components}/primitives/checkbox/index.d.ts +0 -0
- /package/{components → dist/components}/primitives/checkbox/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/checkbox/index.js +0 -0
- /package/{components → dist/components}/primitives/checkbox/types.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/checkbox/types.js +0 -0
- /package/{components → dist/components}/primitives/date/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/date/index.d.ts +0 -0
- /package/{components → dist/components}/primitives/date/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/date/index.js +0 -0
- /package/{components → dist/components}/primitives/date/types.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/date/types.js +0 -0
- /package/{components → dist/components}/primitives/index.d.ts +0 -0
- /package/{components → dist/components}/primitives/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/index.js +0 -0
- /package/{components → dist/components}/primitives/multiline/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/multiline/components/multilineWithLabel/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/multiline/index.d.ts +0 -0
- /package/{components → dist/components}/primitives/multiline/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/multiline/index.js +0 -0
- /package/{components → dist/components}/primitives/multiline/types.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/multiline/types.js +0 -0
- /package/{components → dist/components}/primitives/number/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/number/components/withLabel/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/number/components/withoutLabel/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/number/index.d.ts +0 -0
- /package/{components → dist/components}/primitives/number/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/number/index.js +0 -0
- /package/{components → dist/components}/primitives/number/types.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/number/types.js +0 -0
- /package/{components → dist/components}/primitives/password/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/password/components/withLabel/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/password/components/withoutLabel/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/password/index.d.ts +0 -0
- /package/{components → dist/components}/primitives/password/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/password/index.js +0 -0
- /package/{components → dist/components}/primitives/password/types.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/password/types.js +0 -0
- /package/{components → dist/components}/primitives/text/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/text/components/textWithLabel/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/text/components/textWithoutLabel/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/text/index.d.ts +0 -0
- /package/{components → dist/components}/primitives/text/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/text/index.js +0 -0
- /package/{components → dist/components}/primitives/text/types.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/text/types.js +0 -0
- /package/{components → dist/components}/primitives/types/baseProps.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/types/baseProps.js +0 -0
- /package/{components → dist/components}/primitives/types/index.d.ts +0 -0
- /package/{components → dist/components}/primitives/types/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/types/index.js +0 -0
- /package/{components → dist/components}/primitives/types/label.d.ts +0 -0
- /package/{components → dist/components}/primitives/types/label.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/types/label.js +0 -0
- /package/{components → dist/components}/primitives/types/validation/index.d.ts +0 -0
- /package/{components → dist/components}/primitives/types/validation/index.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/types/validation/index.js +0 -0
- /package/{components → dist/components}/primitives/types/validation/state.d.ts +0 -0
- /package/{components → dist/components}/primitives/types/validation/state.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/types/validation/state.js +0 -0
- /package/{components → dist/components}/primitives/types/validation/status.d.ts +0 -0
- /package/{components → dist/components}/primitives/types/validation/status.d.ts.map +0 -0
- /package/{components → dist/components}/primitives/types/validation/status.js +0 -0
- /package/{components → dist/components}/search/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/search/index.d.ts +0 -0
- /package/{components → dist/components}/search/index.d.ts.map +0 -0
- /package/{components → dist/components}/search/index.js +0 -0
- /package/{components → dist/components}/search/types.d.ts.map +0 -0
- /package/{components → dist/components}/search/types.js +0 -0
- /package/{components → dist/components}/tabs/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/tabs/components/item/index.d.ts.map +0 -0
- /package/{components → dist/components}/tabs/index.d.ts +0 -0
- /package/{components → dist/components}/tabs/index.d.ts.map +0 -0
- /package/{components → dist/components}/tabs/index.js +0 -0
- /package/{components → dist/components}/tabs/types.d.ts.map +0 -0
- /package/{components → dist/components}/tabs/types.js +0 -0
- /package/{components → dist/components}/tag/component/index.d.ts.map +0 -0
- /package/{components → dist/components}/tag/index.d.ts +0 -0
- /package/{components → dist/components}/tag/index.d.ts.map +0 -0
- /package/{components → dist/components}/tag/index.js +0 -0
- /package/{components → dist/components}/tag/types.d.ts.map +0 -0
- /package/{components → dist/components}/tag/types.js +0 -0
- /package/{components → dist/components}/types.d.ts +0 -0
- /package/{components → dist/components}/types.d.ts.map +0 -0
- /package/{components → dist/components}/types.js +0 -0
- /package/{hooks → dist/hooks}/index.d.ts +0 -0
- /package/{hooks → dist/hooks}/index.d.ts.map +0 -0
- /package/{hooks → dist/hooks}/index.js +0 -0
- /package/{hooks → dist/hooks}/useComponentOutsideClick.d.ts +0 -0
- /package/{hooks → dist/hooks}/useComponentOutsideClick.d.ts.map +0 -0
- /package/{hooks → dist/hooks}/useComponentOutsideClick.js +0 -0
- /package/{hooks → dist/hooks}/usePagination.d.ts +0 -0
- /package/{hooks → dist/hooks}/usePagination.d.ts.map +0 -0
- /package/{hooks → dist/hooks}/usePagination.js +0 -0
- /package/{index.d.ts → dist/index.d.ts} +0 -0
- /package/{index.d.ts.map → dist/index.d.ts.map} +0 -0
- /package/{index.js → dist/index.js} +0 -0
- /package/{tsconfig.tsbuildinfo → dist/tsconfig.tsbuildinfo} +0 -0
- /package/{utils → dist/utils}/dataAttributes.d.ts.map +0 -0
- /package/{utils → dist/utils}/dataAttributes.js +0 -0
- /package/{utils → dist/utils}/formValidation.d.ts.map +0 -0
- /package/{utils → dist/utils}/index.d.ts +0 -0
- /package/{utils → dist/utils}/index.d.ts.map +0 -0
- /package/{utils → dist/utils}/index.js +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./style.scss";
|
|
3
|
-
import { PasswordProps } from "
|
|
3
|
+
import { PasswordProps } from "../../password";
|
|
4
4
|
/** Password input component */
|
|
5
5
|
declare const Password: (props: PasswordProps) => JSX.Element;
|
|
6
6
|
export default Password;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
3
|
import "./style.scss";
|
|
4
|
-
import PasswordWithLabel from "
|
|
5
|
-
import PasswordWithoutLabel from "
|
|
4
|
+
import PasswordWithLabel from "../../password/components/withLabel";
|
|
5
|
+
import PasswordWithoutLabel from "../../password/components/withoutLabel";
|
|
6
6
|
/** Password input component */
|
|
7
7
|
const Password = (props) => {
|
|
8
8
|
if (isNullOrUndefined(props.label)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { PasswordProps } from "
|
|
2
|
+
import { PasswordProps } from "../../../password";
|
|
3
3
|
declare const PasswordWithLabel: ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, label, placeholder, canShowPassword, }: PasswordProps) => JSX.Element;
|
|
4
4
|
export default PasswordWithLabel;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
3
|
import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
4
|
-
import { getValidationValues } from "
|
|
5
|
-
import { ElementSize } from "
|
|
6
|
-
import Icon from "
|
|
4
|
+
import { getValidationValues } from "../../../../../utils";
|
|
5
|
+
import { ElementSize } from "../../../..";
|
|
6
|
+
import Icon from "../../../../icon";
|
|
7
7
|
const PasswordWithLabel = ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, label, placeholder, canShowPassword, }) => {
|
|
8
8
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
9
9
|
const [contentIsHidden, setContentIsHidden] = useState(true);
|
package/{components → dist/components}/primitives/password/components/withoutLabel/index.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { PasswordProps } from "
|
|
2
|
+
import { PasswordProps } from "../../../password";
|
|
3
3
|
declare const PasswordWithoutLabel: ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, placeholder, canShowPassword, }: PasswordProps) => JSX.Element;
|
|
4
4
|
export default PasswordWithoutLabel;
|
|
5
5
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
3
|
import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
4
|
-
import { ElementSize } from "
|
|
5
|
-
import { getValidationValues } from "
|
|
6
|
-
import Icon from "
|
|
4
|
+
import { ElementSize } from "../../../..";
|
|
5
|
+
import { getValidationValues } from "../../../../../utils";
|
|
6
|
+
import Icon from "../../../../icon";
|
|
7
7
|
const PasswordWithoutLabel = ({ onValueChange, disabled, validationState, name, className, size, style, rounded, loading, placeholder, canShowPassword, }) => {
|
|
8
8
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
9
9
|
const [contentIsHidden, setContentIsHidden] = useState(true);
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { BaseInputElementProps } from "../..";
|
|
2
|
+
/** Password component props type */
|
|
3
|
+
export interface PasswordProps extends Omit<BaseInputElementProps<string>, "defaultValue" | "readonly"> {
|
|
4
|
+
/**
|
|
5
|
+
* Is icon "Show password" visible.
|
|
6
|
+
* Will show password on click
|
|
7
|
+
*/
|
|
8
|
+
canShowPassword: boolean;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
3
|
import "../../../../common.scss";
|
|
4
|
-
import TextWithLabel from "
|
|
5
|
-
import TextWithoutLabel from "
|
|
4
|
+
import TextWithLabel from "../../text/components/textWithLabel";
|
|
5
|
+
import TextWithoutLabel from "../../text/components/textWithoutLabel";
|
|
6
6
|
/** Textual input component */
|
|
7
7
|
const Text = (props) => {
|
|
8
8
|
if (isNullOrUndefined(props.label)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TextProps } from "
|
|
2
|
+
import { TextProps } from "../../../text";
|
|
3
3
|
/** Textual input with describing label */
|
|
4
4
|
declare const TextWithLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, label, placeholder, onBlur, }: TextProps) => JSX.Element;
|
|
5
5
|
export default TextWithLabel;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { generateGuid, getClassName, getValueOrDefault, } from "@bodynarf/utils";
|
|
4
|
-
import { ElementSize } from "
|
|
5
|
-
import { getValidationValues } from "
|
|
4
|
+
import { ElementSize } from "../../../..";
|
|
5
|
+
import { getValidationValues } from "../../../../../utils";
|
|
6
6
|
/** Textual input with describing label */
|
|
7
7
|
const TextWithLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, label, placeholder, onBlur, }) => {
|
|
8
8
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
package/{components → dist/components}/primitives/text/components/textWithoutLabel/index.d.ts
RENAMED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TextProps } from "
|
|
2
|
+
import { TextProps } from "../../../text";
|
|
3
3
|
/** Textual input without describing label */
|
|
4
4
|
declare const TextWithoutLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, placeholder, onBlur, }: TextProps) => JSX.Element;
|
|
5
5
|
export default TextWithoutLabel;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
3
|
import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
4
|
-
import { ElementSize } from "
|
|
5
|
-
import { getValidationValues } from "
|
|
4
|
+
import { ElementSize } from "../../../..";
|
|
5
|
+
import { getValidationValues } from "../../../../../utils";
|
|
6
6
|
/** Textual input without describing label */
|
|
7
7
|
const TextWithoutLabel = ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, placeholder, onBlur, }) => {
|
|
8
8
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { BaseElementProps, ElementColor, ElementSize } from "../..";
|
|
2
|
+
import { InputLabel, ValidationState } from ".";
|
|
3
|
+
/** Base properties for input components */
|
|
4
|
+
export interface BaseInputElementProps<TValue> extends BaseElementProps {
|
|
5
|
+
/** Value change handler. Changed value must be stored outside of component */
|
|
6
|
+
onValueChange: (value?: TValue) => void;
|
|
7
|
+
/** Default value of input component*/
|
|
8
|
+
defaultValue?: TValue;
|
|
9
|
+
/** Input element placeholder */
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
/** Is component borders are rounded */
|
|
12
|
+
rounded?: boolean;
|
|
13
|
+
/** Should be component disabled. Selecting is not allowed */
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
/** Should be component int read only mode. Selecting is allowed */
|
|
16
|
+
readonly?: boolean;
|
|
17
|
+
/** Component size */
|
|
18
|
+
size?: ElementSize;
|
|
19
|
+
/** Label configuration */
|
|
20
|
+
label?: InputLabel;
|
|
21
|
+
/** Displaying loading state of component as spinner in right end of component */
|
|
22
|
+
loading?: boolean;
|
|
23
|
+
/** Style. Colors the border */
|
|
24
|
+
style?: ElementColor;
|
|
25
|
+
/** Name of element. Required for form elements */
|
|
26
|
+
name?: string;
|
|
27
|
+
/** Current validation state */
|
|
28
|
+
validationState?: ValidationState;
|
|
29
|
+
}
|
|
30
|
+
//# sourceMappingURL=baseProps.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./style.scss";
|
|
3
|
-
import { SearchProps } from "
|
|
3
|
+
import { SearchProps } from "../../search";
|
|
4
4
|
/** Search component */
|
|
5
5
|
export default function Search({ searchType, onSearch, caption, name, defaultValue, size, isLoading, rounded, disabled, }: SearchProps): JSX.Element;
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
3
|
import { generateGuid, getClassName } from "@bodynarf/utils";
|
|
4
4
|
import "./style.scss";
|
|
5
|
-
import Button from "
|
|
5
|
+
import Button from "../../button";
|
|
6
6
|
/** Search component */
|
|
7
7
|
export default function Search({ searchType, onSearch, caption, name, defaultValue, size, isLoading, rounded, disabled, }) {
|
|
8
8
|
const [elementName] = useState(name || generateGuid());
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ElementSize } from "..";
|
|
2
|
+
/** Search component props type */
|
|
3
|
+
export interface SearchProps {
|
|
4
|
+
/**
|
|
5
|
+
* Search type: by typing, starts from minimum characters to search
|
|
6
|
+
* or by clicking on button next to search bar.
|
|
7
|
+
* Default `is byTyping`
|
|
8
|
+
*/
|
|
9
|
+
searchType: "byTyping" | "byButton";
|
|
10
|
+
/** Search caption */
|
|
11
|
+
caption: string;
|
|
12
|
+
/** Search handler */
|
|
13
|
+
onSearch: (searchPattern: string) => void;
|
|
14
|
+
/** Initial search value */
|
|
15
|
+
defaultValue?: string;
|
|
16
|
+
/** Control name. If empty - will be replaced by random guid */
|
|
17
|
+
name?: string;
|
|
18
|
+
/** Size of search bar */
|
|
19
|
+
size?: ElementSize;
|
|
20
|
+
/** Should search bar be rounded */
|
|
21
|
+
rounded?: boolean;
|
|
22
|
+
/** Is search bar disabled */
|
|
23
|
+
disabled?: boolean;
|
|
24
|
+
/** Should loading icon be displayed in search bar */
|
|
25
|
+
isLoading?: boolean;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
2
|
import "./style.scss";
|
|
3
|
-
import { BaseElementProps, ElementSize } from "
|
|
4
|
-
import { TabItem, TabsPosition, TabsStyle } from "
|
|
3
|
+
import { BaseElementProps, ElementSize } from "../..";
|
|
4
|
+
import { TabItem, TabsPosition, TabsStyle } from "../../tabs";
|
|
5
5
|
/** Tabs component props type */
|
|
6
6
|
export interface TabsProps extends BaseElementProps {
|
|
7
7
|
/** Tabs */
|
|
@@ -2,10 +2,10 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { useCallback, useState, useEffect, useRef } from "react";
|
|
3
3
|
import { getClassName, isNullOrEmpty, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
4
|
import "./style.scss";
|
|
5
|
-
import { ElementSize } from "
|
|
6
|
-
import { mapDataAttributes } from "
|
|
7
|
-
import { TabsPosition, TabsStyle } from "
|
|
8
|
-
import TabItemComponent from "
|
|
5
|
+
import { ElementSize } from "../..";
|
|
6
|
+
import { mapDataAttributes } from "../../../utils";
|
|
7
|
+
import { TabsPosition, TabsStyle } from "../../tabs";
|
|
8
|
+
import TabItemComponent from "../../tabs/components/item";
|
|
9
9
|
/**
|
|
10
10
|
* Tabs panel
|
|
11
11
|
* @throws Items are empty
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
-
import Icon from "
|
|
3
|
+
import Icon from "../../../icon";
|
|
4
4
|
/** Tabs panel single tab item component */
|
|
5
5
|
const TabItem = ({ item, activeItem }) => {
|
|
6
6
|
if (!isNullOrUndefined(item.icon)) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
import { TagProps } from "
|
|
2
|
+
import { TagProps } from "../../tag";
|
|
3
3
|
import "./style.scss";
|
|
4
4
|
/** Single tag item */
|
|
5
5
|
declare const Tag: ({ content, size, style, rounded, lightColor, customColor, onClick, className, title, }: TagProps) => JSX.Element;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
-
import { ElementColor, ElementSize } from "
|
|
3
|
+
import { ElementColor, ElementSize } from "../..";
|
|
4
4
|
import "./style.scss";
|
|
5
5
|
/** Single tag item */
|
|
6
6
|
const Tag = ({ content, size, style, rounded, lightColor, customColor, onClick, className, title, }) => {
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BaseElementProps, ElementColor, ElementSize } from "..";
|
|
2
|
+
/** Tag item prop types */
|
|
3
|
+
export interface TagProps extends BaseElementProps {
|
|
4
|
+
/** Tag content */
|
|
5
|
+
content: string;
|
|
6
|
+
/**
|
|
7
|
+
* Element size.
|
|
8
|
+
* `Small` isn"t allowed
|
|
9
|
+
*/
|
|
10
|
+
size?: ElementSize;
|
|
11
|
+
/** Element color */
|
|
12
|
+
style?: ElementColor;
|
|
13
|
+
/** Is element with rounded border */
|
|
14
|
+
rounded?: boolean;
|
|
15
|
+
/** Is element has light color */
|
|
16
|
+
lightColor?: boolean;
|
|
17
|
+
/** Click handler */
|
|
18
|
+
onClick?: () => void;
|
|
19
|
+
/** Manual color scheme */
|
|
20
|
+
customColor?: {
|
|
21
|
+
/** Text color */
|
|
22
|
+
color: string;
|
|
23
|
+
/** Background color */
|
|
24
|
+
backgroundColor: string;
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@bodynarf/react.components",
|
|
3
|
+
"version": "1.7.4",
|
|
4
|
+
"author": {
|
|
5
|
+
"name": "Artem",
|
|
6
|
+
"email": "bodynar@gmail.com"
|
|
7
|
+
},
|
|
8
|
+
"repository": {
|
|
9
|
+
"url": "https://github.com/bodynar/bodynarf.react-components",
|
|
10
|
+
"type": "git"
|
|
11
|
+
},
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/bodynar/bodynarf.react-components/issues",
|
|
14
|
+
"email": "bodynar@gmail.com"
|
|
15
|
+
},
|
|
16
|
+
"keywords": [
|
|
17
|
+
"ts",
|
|
18
|
+
"typescript",
|
|
19
|
+
"react",
|
|
20
|
+
"react component",
|
|
21
|
+
"bulma"
|
|
22
|
+
],
|
|
23
|
+
"scripts": {
|
|
24
|
+
"build": "npx tsc && tsc-alias -p tsconfig.json",
|
|
25
|
+
"transfer": "copy package.json dist && copy readme.md dist",
|
|
26
|
+
"build_transfer": "npm run build && npm run transfer && cd dist",
|
|
27
|
+
"publish_pkg": "npm run build_transfer && npm publish --access=public"
|
|
28
|
+
},
|
|
29
|
+
"devDependencies": {
|
|
30
|
+
"@types/react": "^18.0.11",
|
|
31
|
+
"@types/react-dom": "^18.0.5",
|
|
32
|
+
"tsc-alias": "^1.8.6",
|
|
33
|
+
"typescript": "^4.7.3"
|
|
34
|
+
},
|
|
35
|
+
"peerDependencies": {
|
|
36
|
+
"@bodynarf/utils": "^1.1.1",
|
|
37
|
+
"bulma": "^0.9.4",
|
|
38
|
+
"react": "^18.1.0",
|
|
39
|
+
"react-dom": "^18.1.0"
|
|
40
|
+
}
|
|
41
|
+
}
|
package/dist/readme.md
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
# About
|
|
2
|
+
Small library with react components based on Bulma CSS framework <a href="https://bulma.io" title="Bulma css framework">
|
|
3
|
+
<img
|
|
4
|
+
src="https://bulma.io/images/made-with-bulma.png"
|
|
5
|
+
alt="Made with Bulma"
|
|
6
|
+
width="128"
|
|
7
|
+
height="24"/>
|
|
8
|
+
</a>
|
|
9
|
+
|
|
10
|
+
## Installation
|
|
11
|
+
1. Install [React](https://reactjs.org/)
|
|
12
|
+
2. Install [Bulma](https://bulma.io/)
|
|
13
|
+
3. Make sure you imported bulma styles in parent container
|
|
14
|
+
4. *(Optional)* To use **Icon** component - install [Bootstrap Icons](https://icons.getbootstrap.com/) and make sure you imported these styles in parent container
|
|
15
|
+
5. *(Optional)* To use **Checkbox** component - install [bulma-checkradio](https://www.npmjs.com/package/bulma-checkradio) and make sure you imported these styles in parent container
|
|
16
|
+
|
|
17
|
+
## Description
|
|
18
|
+
|
|
19
|
+
Mostly all components have root class with `bbr-` prefix. BBR - Bodynarf Bulma React
|
|
20
|
+
### Simple components
|
|
21
|
+
Simple react components based on html elements.
|
|
22
|
+
|
|
23
|
+
- **Date** - date input;
|
|
24
|
+
- **Multiline** - multiline text input;
|
|
25
|
+
- **Text**- single line text input;
|
|
26
|
+
- **Anchor**
|
|
27
|
+
- **Button**
|
|
28
|
+
- **Number**
|
|
29
|
+
- **Password** - single line password input (requires icon, see *p.4*)
|
|
30
|
+
- **Icon** - *see p.4 of installation*
|
|
31
|
+
- **Dropdown** - custom dropdown component, based on html div elements & css. Allows to use icon in elements
|
|
32
|
+
- **Checkbox** - (*see p.5 of installation*) Checkbox component based on [bulma-checkradio](https://wikiki.github.io/form/checkradio)
|
|
33
|
+
|
|
34
|
+
### Complex components
|
|
35
|
+
Complex components is set of components built via combining simple components or represent complex logical component
|
|
36
|
+
- **Search** - Search bar with optional button to perform search
|
|
37
|
+
- **Paginator** - Pagination elements to navigate through paged list
|
|
38
|
+
|
|
39
|
+
Example:
|
|
40
|
+
```tsx
|
|
41
|
+
const [{ currentPage, pagesCount, onPageChange }, paginate] = usePagination(items.length, ITEMS_PER_PAGE);
|
|
42
|
+
const pageItems = useMemo(() => paginate(items), [paginate, items]);
|
|
43
|
+
|
|
44
|
+
// ...
|
|
45
|
+
|
|
46
|
+
<Paginator
|
|
47
|
+
count={pagesCount}
|
|
48
|
+
currentPage={currentPage}
|
|
49
|
+
onPageChange={onPageChange}
|
|
50
|
+
/>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
### Hooks
|
|
54
|
+
|
|
55
|
+
- **useComponentOutsideClick** - Attach watcher for mouse clicks and emmit event when click was outside of component
|
|
56
|
+
- **usePagination** - Create a pagination config to easily manipulate with Paginator component
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bodynarf/react.components",
|
|
3
|
-
"version": "1.7.
|
|
3
|
+
"version": "1.7.4",
|
|
4
4
|
"author": {
|
|
5
5
|
"name": "Artem",
|
|
6
6
|
"email": "bodynar@gmail.com"
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
],
|
|
23
23
|
"scripts": {
|
|
24
24
|
"build": "npx tsc && tsc-alias -p tsconfig.json",
|
|
25
|
-
"
|
|
25
|
+
"transfer": "copy package.json dist && copy readme.md dist",
|
|
26
|
+
"build_transfer": "npm run build && npm run transfer && cd dist",
|
|
27
|
+
"publish_pkg": "npm run build_transfer && npm publish --access=public"
|
|
26
28
|
},
|
|
27
29
|
"devDependencies": {
|
|
28
30
|
"@types/react": "^18.0.11",
|
|
@@ -30,7 +32,7 @@
|
|
|
30
32
|
"tsc-alias": "^1.8.6",
|
|
31
33
|
"typescript": "^4.7.3"
|
|
32
34
|
},
|
|
33
|
-
"
|
|
35
|
+
"peerDependencies": {
|
|
34
36
|
"@bodynarf/utils": "^1.1.1",
|
|
35
37
|
"bulma": "^0.9.4",
|
|
36
38
|
"react": "^18.1.0",
|
package/src/common.scss
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
+
|
|
5
|
+
import "./style.scss";
|
|
6
|
+
|
|
7
|
+
import { ElementSize } from "@bbr/components";
|
|
8
|
+
import Icon from "@bbr/components/icon";
|
|
9
|
+
|
|
10
|
+
import { mapDataAttributes } from "@bbr/utils";
|
|
11
|
+
|
|
12
|
+
import { AccordionProps } from "@bbr/components/accordion";
|
|
13
|
+
|
|
14
|
+
/** Accordion panel */
|
|
15
|
+
const Accordion = ({
|
|
16
|
+
children, caption,
|
|
17
|
+
style, size, defaultExpanded,
|
|
18
|
+
onToggle,
|
|
19
|
+
className, data, title,
|
|
20
|
+
}: AccordionProps): JSX.Element => {
|
|
21
|
+
const expandablePanelRef = useRef<HTMLDivElement>(null);
|
|
22
|
+
const [isExpanded, setIsExpanded] = useState(defaultExpanded ?? false);
|
|
23
|
+
const [maxHeight, setMaxHeight] = useState<number | undefined>(defaultExpanded === true ? undefined : 0);
|
|
24
|
+
|
|
25
|
+
const toggleCollapse = useCallback(
|
|
26
|
+
() => setMaxHeight(isExpanded ? 0 : expandablePanelRef.current!.scrollHeight),
|
|
27
|
+
[isExpanded]
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
useEffect(() => {
|
|
31
|
+
if (defaultExpanded === true && !isNullOrUndefined(expandablePanelRef.current)) {
|
|
32
|
+
setMaxHeight(expandablePanelRef.current!.scrollHeight);
|
|
33
|
+
}
|
|
34
|
+
}, [defaultExpanded]);
|
|
35
|
+
|
|
36
|
+
useEffect(() => setIsExpanded(maxHeight !== 0), [maxHeight]);
|
|
37
|
+
useEffect(() => {
|
|
38
|
+
onToggle?.call(undefined, !isExpanded);
|
|
39
|
+
}, [isExpanded, onToggle]);
|
|
40
|
+
|
|
41
|
+
const elClassName = getClassName([
|
|
42
|
+
"bbr-accordion",
|
|
43
|
+
"message",
|
|
44
|
+
isNullOrUndefined(style) ? "" : `is-${style}`,
|
|
45
|
+
isNullOrUndefined(size) ? "" : `is-${size}`,
|
|
46
|
+
className,
|
|
47
|
+
]);
|
|
48
|
+
|
|
49
|
+
const dataAttributes = isNullOrUndefined(data)
|
|
50
|
+
? undefined
|
|
51
|
+
: mapDataAttributes(data!);
|
|
52
|
+
|
|
53
|
+
return (
|
|
54
|
+
<article
|
|
55
|
+
className={elClassName}
|
|
56
|
+
aria-expanded={isExpanded}
|
|
57
|
+
{...dataAttributes}
|
|
58
|
+
>
|
|
59
|
+
<div
|
|
60
|
+
className="message-header is-unselectable"
|
|
61
|
+
onClick={toggleCollapse}
|
|
62
|
+
>
|
|
63
|
+
<span title={title}>
|
|
64
|
+
{caption}
|
|
65
|
+
</span>
|
|
66
|
+
<Icon
|
|
67
|
+
name="arrow-down"
|
|
68
|
+
size={size ?? ElementSize.Medium}
|
|
69
|
+
/>
|
|
70
|
+
</div>
|
|
71
|
+
<div
|
|
72
|
+
className="message-body"
|
|
73
|
+
ref={expandablePanelRef}
|
|
74
|
+
style={{ maxHeight: `${maxHeight}px` }}
|
|
75
|
+
>
|
|
76
|
+
<div className="message-body__content">
|
|
77
|
+
{children}
|
|
78
|
+
</div>
|
|
79
|
+
</div>
|
|
80
|
+
</article>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default Accordion;
|
|
@@ -1,18 +1,22 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import { BaseElementProps, ElementColor, ElementSize } from "@bbr/components";
|
|
2
|
+
|
|
3
3
|
/** Accordion panel props type */
|
|
4
4
|
export interface AccordionProps extends BaseElementProps {
|
|
5
5
|
/** Content that should be collapsed inside */
|
|
6
6
|
children: React.ReactNode;
|
|
7
|
+
|
|
7
8
|
/** Collapsible panel caption */
|
|
8
9
|
caption: string;
|
|
10
|
+
|
|
9
11
|
/** Default expanded state */
|
|
10
12
|
defaultExpanded?: boolean;
|
|
13
|
+
|
|
11
14
|
/** Panel size */
|
|
12
15
|
size?: ElementSize;
|
|
16
|
+
|
|
13
17
|
/** Color */
|
|
14
18
|
style?: ElementColor;
|
|
19
|
+
|
|
15
20
|
/** Extra handler for toggling visibility. Doesn't affect component logic */
|
|
16
21
|
onToggle?: (collapsed: boolean) => void;
|
|
17
22
|
}
|
|
18
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { isNullOrUndefined, isNullOrEmpty, getClassName } from "@bodynarf/utils";
|
|
2
|
+
|
|
3
|
+
import "./style.scss";
|
|
4
|
+
|
|
5
|
+
import { AnchorProps, ElementIcon } from "@bbr/components";
|
|
6
|
+
|
|
7
|
+
import { SimpleAnchor } from "@bbr/components/anchor/components/simpleAnchor";
|
|
8
|
+
import { AnchorWithIcon } from "@bbr/components/anchor/components/anchorWithIcon";
|
|
9
|
+
|
|
10
|
+
/** Anchor component */
|
|
11
|
+
export default function Anchor(props: AnchorProps): JSX.Element {
|
|
12
|
+
if (isNullOrUndefined(props.caption) && isNullOrUndefined(props.icon)) {
|
|
13
|
+
throw new Error("No anchor content provided");
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
const className: string = getClassName([
|
|
17
|
+
"bbr-anchor",
|
|
18
|
+
!isNullOrEmpty(props.className) ? ` ${props.className}` : "",
|
|
19
|
+
props.disableHovering === true ? " bbr-anchor--unhoverable" : ""
|
|
20
|
+
]);
|
|
21
|
+
|
|
22
|
+
if (isNullOrUndefined(props.icon)) {
|
|
23
|
+
return (
|
|
24
|
+
<SimpleAnchor
|
|
25
|
+
{...props}
|
|
26
|
+
className={className}
|
|
27
|
+
onClick={props.onClick}
|
|
28
|
+
/>
|
|
29
|
+
);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
return (
|
|
33
|
+
<AnchorWithIcon
|
|
34
|
+
{...props}
|
|
35
|
+
className={className}
|
|
36
|
+
onClick={props.onClick}
|
|
37
|
+
icon={props.icon as ElementIcon}
|
|
38
|
+
/>
|
|
39
|
+
);
|
|
40
|
+
}
|