@bodynarf/react.components 1.7.1 → 1.7.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/{dist/components → components}/accordion/component/index.d.ts +7 -4
- package/components/accordion/component/index.d.ts.map +1 -0
- package/components/accordion/component/index.js +35 -0
- package/components/accordion/index.d.ts +3 -0
- package/components/accordion/index.d.ts.map +1 -0
- package/{dist/components/anchor/index.d.ts → components/accordion/index.js} +2 -2
- package/{dist/components → components}/accordion/types.d.ts +18 -16
- package/components/accordion/types.d.ts.map +1 -0
- package/components/accordion/types.js +1 -0
- package/components/anchor/component/index.d.ts +6 -0
- package/components/anchor/component/index.d.ts.map +1 -0
- package/components/anchor/component/index.js +20 -0
- package/{dist/components → components}/anchor/components/anchorWithIcon/index.d.ts +5 -3
- package/components/anchor/components/anchorWithIcon/index.d.ts.map +1 -0
- package/components/anchor/components/anchorWithIcon/index.js +16 -0
- package/{dist/components → components}/anchor/components/simpleAnchor/index.d.ts +5 -3
- package/components/anchor/components/simpleAnchor/index.d.ts.map +1 -0
- package/components/anchor/components/simpleAnchor/index.js +5 -0
- package/components/anchor/index.d.ts +3 -0
- package/components/anchor/index.d.ts.map +1 -0
- package/{dist/components/button/index.d.ts → components/anchor/index.js} +2 -2
- package/{dist/components → components}/anchor/types.d.ts +39 -38
- package/components/anchor/types.d.ts.map +1 -0
- package/components/anchor/types.js +1 -0
- package/{dist/components → components}/button/component/index.d.ts +9 -6
- package/components/button/component/index.d.ts.map +1 -0
- package/components/button/component/index.js +36 -0
- package/{dist/components → components}/button/components/buttonWithIcon/index.d.ts +5 -3
- package/components/button/components/buttonWithIcon/index.d.ts.map +1 -0
- package/components/button/components/buttonWithIcon/index.js +19 -0
- package/{dist/components → components}/button/components/simpleButton/index.d.ts +5 -3
- package/components/button/components/simpleButton/index.d.ts.map +1 -0
- package/components/button/components/simpleButton/index.js +5 -0
- package/components/button/index.d.ts +3 -0
- package/components/button/index.d.ts.map +1 -0
- package/{dist/components/dropdown/index.d.ts → components/button/index.js} +2 -2
- package/{dist/components → components}/button/types.d.ts +37 -36
- package/components/button/types.d.ts.map +1 -0
- package/components/button/types.js +4 -0
- package/components/dropdown/component/index.d.ts +7 -0
- package/components/dropdown/component/index.d.ts.map +1 -0
- package/components/dropdown/component/index.js +15 -0
- package/{dist/components → components}/dropdown/components/compact/index.d.ts +5 -3
- package/components/dropdown/components/compact/index.d.ts.map +1 -0
- package/components/dropdown/components/compact/index.js +62 -0
- package/{dist/components → components}/dropdown/components/item/index.d.ts +15 -13
- package/components/dropdown/components/item/index.d.ts.map +1 -0
- package/components/dropdown/components/item/index.js +6 -0
- package/{dist/components → components}/dropdown/components/label/index.d.ts +18 -17
- package/components/dropdown/components/label/index.d.ts.map +1 -0
- package/components/dropdown/components/label/index.js +22 -0
- package/{dist/components → components}/dropdown/components/withLabel/index.d.ts +5 -3
- package/components/dropdown/components/withLabel/index.d.ts.map +1 -0
- package/components/dropdown/components/withLabel/index.js +83 -0
- package/components/dropdown/index.d.ts +3 -0
- package/components/dropdown/index.d.ts.map +1 -0
- package/{dist/components/accordion/index.d.ts → components/dropdown/index.js} +2 -2
- package/{dist/components → components}/dropdown/types.d.ts +46 -45
- package/components/dropdown/types.d.ts.map +1 -0
- package/components/dropdown/types.js +1 -0
- package/components/icon/component/index.d.ts +8 -0
- package/components/icon/component/index.d.ts.map +1 -0
- package/components/icon/component/index.js +23 -0
- package/components/icon/index.d.ts +3 -0
- package/components/icon/index.d.ts.map +1 -0
- package/components/icon/index.js +2 -0
- package/{dist/components → components}/icon/types.d.ts +16 -15
- package/components/icon/types.d.ts.map +1 -0
- package/components/icon/types.js +1 -0
- package/components/index.d.ts +12 -0
- package/components/index.d.ts.map +1 -0
- package/{dist/components/index.d.ts → components/index.js} +11 -11
- package/{dist/components → components}/paginator/component/index.d.ts +8 -6
- package/components/paginator/component/index.d.ts.map +1 -0
- package/components/paginator/component/index.js +47 -0
- package/components/paginator/index.d.ts +4 -0
- package/components/paginator/index.d.ts.map +1 -0
- package/{dist/components/paginator/index.d.ts → components/paginator/index.js} +3 -3
- package/{dist/components → components}/paginator/types.d.ts +28 -27
- package/components/paginator/types.d.ts.map +1 -0
- package/components/paginator/types.js +1 -0
- package/{dist/components → components}/paginator/utils.d.ts +10 -9
- package/components/paginator/utils.d.ts.map +1 -0
- package/components/paginator/utils.js +18 -0
- package/{dist/components → components}/primitives/checkbox/component/index.d.ts +7 -4
- package/components/primitives/checkbox/component/index.d.ts.map +1 -0
- package/components/primitives/checkbox/component/index.js +37 -0
- package/components/primitives/checkbox/index.d.ts +3 -0
- package/components/primitives/checkbox/index.d.ts.map +1 -0
- package/components/primitives/checkbox/index.js +2 -0
- package/{dist/components → components}/primitives/checkbox/types.d.ts +25 -24
- package/components/primitives/checkbox/types.d.ts.map +1 -0
- package/components/primitives/checkbox/types.js +1 -0
- package/{dist/components → components}/primitives/date/component/index.d.ts +7 -4
- package/components/primitives/date/component/index.d.ts.map +1 -0
- package/components/primitives/date/component/index.js +48 -0
- package/components/primitives/date/index.d.ts +3 -0
- package/components/primitives/date/index.d.ts.map +1 -0
- package/components/primitives/date/index.js +2 -0
- package/{dist/components → components}/primitives/date/types.d.ts +9 -8
- package/components/primitives/date/types.d.ts.map +1 -0
- package/components/primitives/date/types.js +1 -0
- package/components/primitives/index.d.ts +8 -0
- package/components/primitives/index.d.ts.map +1 -0
- package/{dist/components/primitives/index.d.ts → components/primitives/index.js} +7 -7
- package/components/primitives/multiline/component/index.d.ts +7 -0
- package/components/primitives/multiline/component/index.d.ts.map +1 -0
- package/components/primitives/multiline/component/index.js +15 -0
- package/{dist/components → components}/primitives/multiline/components/multilineWithLabel/index.d.ts +6 -4
- package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +1 -0
- package/components/primitives/multiline/components/multilineWithLabel/index.js +45 -0
- package/{dist/components → components}/primitives/multiline/components/multilineWithoutLabel/index.d.ts +6 -4
- package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +1 -0
- package/components/primitives/multiline/components/multilineWithoutLabel/index.js +27 -0
- package/components/primitives/multiline/index.d.ts +3 -0
- package/components/primitives/multiline/index.d.ts.map +1 -0
- package/components/primitives/multiline/index.js +2 -0
- package/{dist/components → components}/primitives/multiline/types.d.ts +11 -10
- package/components/primitives/multiline/types.d.ts.map +1 -0
- package/components/primitives/multiline/types.js +1 -0
- package/components/primitives/number/component/index.d.ts +6 -0
- package/components/primitives/number/component/index.d.ts.map +1 -0
- package/components/primitives/number/component/index.js +14 -0
- package/{dist/components → components}/primitives/number/components/withLabel/index.d.ts +6 -4
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -0
- package/components/primitives/number/components/withLabel/index.js +44 -0
- package/{dist/components → components}/primitives/number/components/withoutLabel/index.d.ts +6 -4
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -0
- package/components/primitives/number/components/withoutLabel/index.js +26 -0
- package/components/primitives/number/index.d.ts +3 -0
- package/components/primitives/number/index.d.ts.map +1 -0
- package/components/primitives/number/index.js +2 -0
- package/{dist/components → components}/primitives/number/types.d.ts +13 -12
- package/components/primitives/number/types.d.ts.map +1 -0
- package/components/primitives/number/types.js +1 -0
- package/components/primitives/password/component/index.d.ts +7 -0
- package/components/primitives/password/component/index.d.ts.map +1 -0
- package/components/primitives/password/component/index.js +13 -0
- package/{dist/components → components}/primitives/password/components/withLabel/index.d.ts +5 -3
- package/components/primitives/password/components/withLabel/index.d.ts.map +1 -0
- package/components/primitives/password/components/withLabel/index.js +51 -0
- package/{dist/components → components}/primitives/password/components/withoutLabel/index.d.ts +5 -3
- package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -0
- package/components/primitives/password/components/withoutLabel/index.js +33 -0
- package/components/primitives/password/index.d.ts +3 -0
- package/components/primitives/password/index.d.ts.map +1 -0
- package/components/primitives/password/index.js +2 -0
- package/{dist/components → components}/primitives/password/types.d.ts +10 -9
- package/components/primitives/password/types.d.ts.map +1 -0
- package/components/primitives/password/types.js +1 -0
- package/components/primitives/text/component/index.d.ts +7 -0
- package/components/primitives/text/component/index.d.ts.map +1 -0
- package/components/primitives/text/component/index.js +15 -0
- package/{dist/components → components}/primitives/text/components/textWithLabel/index.d.ts +6 -4
- package/components/primitives/text/components/textWithLabel/index.d.ts.map +1 -0
- package/components/primitives/text/components/textWithLabel/index.js +44 -0
- package/{dist/components → components}/primitives/text/components/textWithoutLabel/index.d.ts +6 -4
- package/components/primitives/text/components/textWithoutLabel/index.d.ts.map +1 -0
- package/components/primitives/text/components/textWithoutLabel/index.js +26 -0
- package/components/primitives/text/index.d.ts +3 -0
- package/components/primitives/text/index.d.ts.map +1 -0
- package/components/primitives/text/index.js +2 -0
- package/{dist/components → components}/primitives/text/types.d.ts +7 -6
- package/components/primitives/text/types.d.ts.map +1 -0
- package/components/primitives/text/types.js +1 -0
- package/{dist/components → components}/primitives/types/baseProps.d.ts +30 -29
- package/components/primitives/types/baseProps.d.ts.map +1 -0
- package/components/primitives/types/baseProps.js +1 -0
- package/components/primitives/types/index.d.ts +4 -0
- package/components/primitives/types/index.d.ts.map +1 -0
- package/{dist/components/primitives/types/index.d.ts → components/primitives/types/index.js} +3 -3
- package/{dist/components → components}/primitives/types/label.d.ts +14 -13
- package/components/primitives/types/label.d.ts.map +1 -0
- package/components/primitives/types/label.js +1 -0
- package/components/primitives/types/validation/index.d.ts +3 -0
- package/components/primitives/types/validation/index.d.ts.map +1 -0
- package/{dist/components/primitives/types/validation/index.d.ts → components/primitives/types/validation/index.js} +2 -2
- package/{dist/components → components}/primitives/types/validation/state.d.ts +9 -8
- package/components/primitives/types/validation/state.d.ts.map +1 -0
- package/components/primitives/types/validation/state.js +2 -0
- package/{dist/components → components}/primitives/types/validation/status.d.ts +10 -9
- package/components/primitives/types/validation/status.d.ts.map +1 -0
- package/components/primitives/types/validation/status.js +11 -0
- package/{dist/components → components}/search/component/index.d.ts +6 -3
- package/components/search/component/index.d.ts.map +1 -0
- package/components/search/component/index.js +37 -0
- package/components/search/index.d.ts +3 -0
- package/components/search/index.d.ts.map +1 -0
- package/components/search/index.js +2 -0
- package/{dist/components → components}/search/types.d.ts +27 -26
- package/components/search/types.d.ts.map +1 -0
- package/components/search/types.js +1 -0
- package/{dist/components → components}/tabs/component/index.d.ts +34 -31
- package/components/tabs/component/index.d.ts.map +1 -0
- package/components/tabs/component/index.js +68 -0
- package/{dist/components → components}/tabs/components/item/index.d.ts +13 -11
- package/components/tabs/components/item/index.d.ts.map +1 -0
- package/components/tabs/components/item/index.js +27 -0
- package/components/tabs/index.d.ts +3 -0
- package/components/tabs/index.d.ts.map +1 -0
- package/components/tabs/index.js +2 -0
- package/{dist/components → components}/tabs/types.d.ts +43 -42
- package/components/tabs/types.d.ts.map +1 -0
- package/components/tabs/types.js +34 -0
- package/{dist/components → components}/tag/component/index.d.ts +7 -4
- package/components/tag/component/index.d.ts.map +1 -0
- package/components/tag/component/index.js +28 -0
- package/components/tag/index.d.ts +3 -0
- package/components/tag/index.d.ts.map +1 -0
- package/components/tag/index.js +2 -0
- package/{dist/components → components}/tag/types.d.ts +27 -26
- package/components/tag/types.d.ts.map +1 -0
- package/components/tag/types.js +1 -0
- package/{dist/components → components}/types.d.ts +67 -66
- package/components/types.d.ts.map +1 -0
- package/components/types.js +31 -0
- package/hooks/index.d.ts +3 -0
- package/hooks/index.d.ts.map +1 -0
- package/{dist/hooks/index.d.ts → hooks/index.js} +2 -2
- package/{dist/hooks → hooks}/useComponentOutsideClick.d.ts +11 -10
- package/hooks/useComponentOutsideClick.d.ts.map +1 -0
- package/hooks/useComponentOutsideClick.js +32 -0
- package/{dist/hooks → hooks}/usePagination.d.ts +20 -19
- package/hooks/usePagination.d.ts.map +1 -0
- package/hooks/usePagination.js +28 -0
- package/index.d.ts +4 -0
- package/index.d.ts.map +1 -0
- package/{dist/index.d.ts → index.js} +3 -3
- package/package.json +39 -45
- package/readme.md +56 -0
- package/tsconfig.tsbuildinfo +1 -0
- package/{dist/utils → utils}/dataAttributes.d.ts +8 -7
- package/utils/dataAttributes.d.ts.map +1 -0
- package/utils/dataAttributes.js +19 -0
- package/{dist/utils → utils}/formValidation.d.ts +16 -15
- package/utils/formValidation.d.ts.map +1 -0
- package/utils/formValidation.js +35 -0
- package/utils/index.d.ts +3 -0
- package/utils/index.d.ts.map +1 -0
- package/{dist/utils/index.d.ts → utils/index.js} +2 -2
- package/dist/bbr-components.js +0 -1040
- package/dist/bbr-components.umd.cjs +0 -27
- package/dist/components/anchor/component/index.d.ts +0 -3
- package/dist/components/dropdown/component/index.d.ts +0 -4
- package/dist/components/icon/component/index.d.ts +0 -5
- package/dist/components/icon/index.d.ts +0 -2
- package/dist/components/primitives/checkbox/index.d.ts +0 -2
- package/dist/components/primitives/date/index.d.ts +0 -2
- package/dist/components/primitives/multiline/component/index.d.ts +0 -4
- package/dist/components/primitives/multiline/index.d.ts +0 -2
- package/dist/components/primitives/number/component/index.d.ts +0 -4
- package/dist/components/primitives/number/index.d.ts +0 -2
- package/dist/components/primitives/password/component/index.d.ts +0 -4
- package/dist/components/primitives/password/index.d.ts +0 -2
- package/dist/components/primitives/text/component/index.d.ts +0 -4
- package/dist/components/primitives/text/index.d.ts +0 -2
- package/dist/components/search/index.d.ts +0 -2
- package/dist/components/tabs/index.d.ts +0 -2
- package/dist/components/tag/index.d.ts +0 -2
- package/dist/style.css +0 -1
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import { ElementSize } from
|
|
2
|
-
export interface PaginatorProps {
|
|
3
|
-
/** Amount of pages */
|
|
4
|
-
count: number;
|
|
5
|
-
/** Page change handler */
|
|
6
|
-
onPageChange: (page: number) => void;
|
|
7
|
-
/** Current page */
|
|
8
|
-
currentPage?: number;
|
|
9
|
-
/**
|
|
10
|
-
* Page numbers position.
|
|
11
|
-
* Useful with `showNextButtons = true`
|
|
12
|
-
*/
|
|
13
|
-
position?: "left" | "center" | "right";
|
|
14
|
-
/** Buttons should have rounded borders */
|
|
15
|
-
rounded?: boolean;
|
|
16
|
-
/** Size of paginator component elements */
|
|
17
|
-
size?: ElementSize;
|
|
18
|
-
/** Additional class names */
|
|
19
|
-
className?: string;
|
|
20
|
-
/** Display "Previous" \ "Next" buttons */
|
|
21
|
-
showNextButtons?: boolean;
|
|
22
|
-
/**
|
|
23
|
-
* Max amount of pages from left & right from current page. `3` by default
|
|
24
|
-
* @description If set to 2 it will show `[1, 2], 3, [4, 5]`
|
|
25
|
-
*/
|
|
26
|
-
nearPagesCount?: number;
|
|
27
|
-
}
|
|
1
|
+
import { ElementSize } from "..";
|
|
2
|
+
export interface PaginatorProps {
|
|
3
|
+
/** Amount of pages */
|
|
4
|
+
count: number;
|
|
5
|
+
/** Page change handler */
|
|
6
|
+
onPageChange: (page: number) => void;
|
|
7
|
+
/** Current page */
|
|
8
|
+
currentPage?: number;
|
|
9
|
+
/**
|
|
10
|
+
* Page numbers position.
|
|
11
|
+
* Useful with `showNextButtons = true`
|
|
12
|
+
*/
|
|
13
|
+
position?: "left" | "center" | "right";
|
|
14
|
+
/** Buttons should have rounded borders */
|
|
15
|
+
rounded?: boolean;
|
|
16
|
+
/** Size of paginator component elements */
|
|
17
|
+
size?: ElementSize;
|
|
18
|
+
/** Additional class names */
|
|
19
|
+
className?: string;
|
|
20
|
+
/** Display "Previous" \ "Next" buttons */
|
|
21
|
+
showNextButtons?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Max amount of pages from left & right from current page. `3` by default
|
|
24
|
+
* @description If set to 2 it will show `[1, 2], 3, [4, 5]`
|
|
25
|
+
*/
|
|
26
|
+
nearPagesCount?: number;
|
|
27
|
+
}
|
|
28
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/paginator/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,MAAM,WAAW,cAAc;IAC3B,sBAAsB;IACtB,KAAK,EAAE,MAAM,CAAC;IAEd,0BAA0B;IAC1B,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAErC,mBAAmB;IACnB,WAAW,CAAC,EAAE,MAAM,CAAC;IAErB;;;MAGE;IACF,QAAQ,CAAC,EACP,MAAM,GACN,QAAQ,GACR,OAAO,CACR;IAED,0CAA0C;IAC1C,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2CAA2C;IAC3C,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,0CAA0C;IAC1C,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;MAGE;IACF,cAAc,CAAC,EAAE,MAAM,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Get nearest numbers from each side (left & right)
|
|
3
|
-
* @param page Number of current page
|
|
4
|
-
* @param count Amount of pages
|
|
5
|
-
* @param size Amount of pages from left & right to current page. Default is 3
|
|
6
|
-
* @throws Current page is greater than pages amount
|
|
7
|
-
* @returns Array of nearest numbers to current page
|
|
8
|
-
*/
|
|
9
|
-
export declare const generatePageNumbers: (page: number, count: number, size?: number) => Array<number>;
|
|
1
|
+
/**
|
|
2
|
+
* Get nearest numbers from each side (left & right)
|
|
3
|
+
* @param page Number of current page
|
|
4
|
+
* @param count Amount of pages
|
|
5
|
+
* @param size Amount of pages from left & right to current page. Default is 3
|
|
6
|
+
* @throws Current page is greater than pages amount
|
|
7
|
+
* @returns Array of nearest numbers to current page
|
|
8
|
+
*/
|
|
9
|
+
export declare const generatePageNumbers: (page: number, count: number, size?: number) => Array<number>;
|
|
10
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/components/paginator/utils.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,SAAU,MAAM,SAAS,MAAM,SAAQ,MAAM,KAAO,MAAM,MAAM,CAU/F,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Get nearest numbers from each side (left & right)
|
|
3
|
+
* @param page Number of current page
|
|
4
|
+
* @param count Amount of pages
|
|
5
|
+
* @param size Amount of pages from left & right to current page. Default is 3
|
|
6
|
+
* @throws Current page is greater than pages amount
|
|
7
|
+
* @returns Array of nearest numbers to current page
|
|
8
|
+
*/
|
|
9
|
+
export const generatePageNumbers = (page, count, size = 3) => {
|
|
10
|
+
if (page < 0 || count <= 0 || page > count) {
|
|
11
|
+
return [];
|
|
12
|
+
}
|
|
13
|
+
return [
|
|
14
|
+
...new Array(size).fill(page).map((_, i) => page - i - 1).filter(x => x > 0 && x < page).reverse(),
|
|
15
|
+
page,
|
|
16
|
+
...new Array(size).fill(page).map((_, i) => page + i + 1).filter(x => x > 0 && x > page && x <= count)
|
|
17
|
+
];
|
|
18
|
+
};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "./style.scss";
|
|
3
|
+
import { CheckBoxProps } from "../../checkbox";
|
|
4
|
+
/** Boolean input component */
|
|
5
|
+
declare const CheckBox: ({ label, onValueChange, defaultValue, name, disabled, rounded, size, style, block, withoutBorder, hasBackgroundColor, fixBackgroundColor, isFormLabel, }: CheckBoxProps) => JSX.Element;
|
|
6
|
+
export default CheckBox;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/checkbox/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,8BAA8B;AAC9B,QAAA,MAAM,QAAQ,6JAMX,aAAa,KAAG,WAoFlB,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { generateGuid, getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
+
import "./style.scss";
|
|
5
|
+
/** Boolean input component */
|
|
6
|
+
const CheckBox = ({ label, onValueChange, defaultValue, name, disabled, rounded, size, style, block, withoutBorder, hasBackgroundColor, fixBackgroundColor, isFormLabel, }) => {
|
|
7
|
+
const onChecked = useCallback((event) => onValueChange(event.target.checked), [onValueChange]);
|
|
8
|
+
const id = name || generateGuid();
|
|
9
|
+
const className = getClassName([
|
|
10
|
+
"is-checkradio",
|
|
11
|
+
"m-check-radio",
|
|
12
|
+
(hasBackgroundColor ?? false) ? "has-background-color" : "",
|
|
13
|
+
(fixBackgroundColor ?? false) && (hasBackgroundColor ?? false) ? "m-has-background-color" : "",
|
|
14
|
+
isNullOrUndefined(size) ? "" : size === "normal" ? "" : `is-${size}`,
|
|
15
|
+
(rounded ?? false) ? "is-circle" : "",
|
|
16
|
+
isNullOrUndefined(style) ? "" : `is-${style}`,
|
|
17
|
+
(block ?? false) ? "is-block" : "",
|
|
18
|
+
(withoutBorder ?? false) ? "has-no-border" : "",
|
|
19
|
+
]);
|
|
20
|
+
if (!isNullOrUndefined(label) && isFormLabel === true) {
|
|
21
|
+
const labelClassName = getClassName([
|
|
22
|
+
"label",
|
|
23
|
+
label.className
|
|
24
|
+
]);
|
|
25
|
+
const labelContainerClassName = getClassName([
|
|
26
|
+
"field-label",
|
|
27
|
+
label.horizontalContainerClassName
|
|
28
|
+
]);
|
|
29
|
+
const fieldContainerClassName = getClassName([
|
|
30
|
+
"field-body",
|
|
31
|
+
label.horizontalFieldContainerClassName
|
|
32
|
+
]);
|
|
33
|
+
return (_jsxs("div", { className: "bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsxs("div", { className: "field", children: [_jsx("input", { type: "checkbox", name: id, id: id, disabled: disabled, onChange: onChecked, className: className, defaultChecked: defaultValue }), _jsx("label", { htmlFor: id })] }) })] }));
|
|
34
|
+
}
|
|
35
|
+
return (_jsxs("div", { className: "bbr-input field", children: [_jsx("input", { type: "checkbox", name: id, id: id, disabled: disabled, onChange: onChecked, className: className, defaultChecked: defaultValue }), _jsx("label", { htmlFor: id, children: label?.caption })] }));
|
|
36
|
+
};
|
|
37
|
+
export default CheckBox;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/checkbox/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1,24 +1,25 @@
|
|
|
1
|
-
import { BaseInputElementProps } from
|
|
2
|
-
/** Checkbox component props type */
|
|
3
|
-
export interface CheckBoxProps extends BaseInputElementProps<boolean> {
|
|
4
|
-
/** Is full colored checkbox */
|
|
5
|
-
block?: boolean;
|
|
6
|
-
/** Remove the checkbox border */
|
|
7
|
-
withoutBorder?: boolean;
|
|
8
|
-
/**
|
|
9
|
-
* Checkbox has background color.
|
|
10
|
-
* Only works if style is set
|
|
11
|
-
*/
|
|
12
|
-
hasBackgroundColor?: boolean;
|
|
13
|
-
/**
|
|
14
|
-
* Set unchecked background as transparent.
|
|
15
|
-
* Only used with `hasBackgroundColor` set as `true`
|
|
16
|
-
* @example `{ style: ElementColor.Info, hasBackgroundColor: true, fixBackgroundColor: true }` -
|
|
17
|
-
*/
|
|
18
|
-
fixBackgroundColor?: boolean;
|
|
19
|
-
/**
|
|
20
|
-
* Display component with label as form element.
|
|
21
|
-
* Label will be placed at left
|
|
22
|
-
*/
|
|
23
|
-
isFormLabel?: boolean;
|
|
24
|
-
}
|
|
1
|
+
import { BaseInputElementProps } from "../..";
|
|
2
|
+
/** Checkbox component props type */
|
|
3
|
+
export interface CheckBoxProps extends BaseInputElementProps<boolean> {
|
|
4
|
+
/** Is full colored checkbox */
|
|
5
|
+
block?: boolean;
|
|
6
|
+
/** Remove the checkbox border */
|
|
7
|
+
withoutBorder?: boolean;
|
|
8
|
+
/**
|
|
9
|
+
* Checkbox has background color.
|
|
10
|
+
* Only works if style is set
|
|
11
|
+
*/
|
|
12
|
+
hasBackgroundColor?: boolean;
|
|
13
|
+
/**
|
|
14
|
+
* Set unchecked background as transparent.
|
|
15
|
+
* Only used with `hasBackgroundColor` set as `true`
|
|
16
|
+
* @example `{ style: ElementColor.Info, hasBackgroundColor: true, fixBackgroundColor: true }` -
|
|
17
|
+
*/
|
|
18
|
+
fixBackgroundColor?: boolean;
|
|
19
|
+
/**
|
|
20
|
+
* Display component with label as form element.
|
|
21
|
+
* Label will be placed at left
|
|
22
|
+
*/
|
|
23
|
+
isFormLabel?: boolean;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/checkbox/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,oCAAoC;AACpC,MAAM,WAAW,aAAc,SAAQ,qBAAqB,CAAC,OAAO,CAAC;IACjE,+BAA+B;IAC/B,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,iCAAiC;IACjC,aAAa,CAAC,EAAE,OAAO,CAAC;IAExB;;;MAGE;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;;MAIE;IACF,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAE7B;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "../../../../common.scss";
|
|
3
|
+
import { DateProps } from "../../date";
|
|
4
|
+
/** Date input component */
|
|
5
|
+
declare const DatePicker: ({ defaultValue, onValueChange, readonly, disabled, validationState, name, size, className, rounded, loading, style, label, onBlur }: DateProps) => JSX.Element;
|
|
6
|
+
export default DatePicker;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/date/component/index.tsx"],"names":[],"mappings":";AAIA,OAAO,yBAAyB,CAAC;AAKjC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAEjD,2BAA2B;AAC3B,QAAA,MAAM,UAAU,wIAMb,SAAS,KAAG,WA4Gd,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault, isStringEmpty } from "@bodynarf/utils";
|
|
4
|
+
import "../../../../common.scss";
|
|
5
|
+
import { ElementSize } from "../../..";
|
|
6
|
+
import { getValidationValues } from "../../../../utils";
|
|
7
|
+
/** Date input component */
|
|
8
|
+
const DatePicker = ({ defaultValue, onValueChange, readonly, disabled, validationState, name, size, className, rounded, loading, style, label, onBlur }) => {
|
|
9
|
+
const onChange = useCallback((event) => onValueChange(isStringEmpty(event.target.value)
|
|
10
|
+
? undefined
|
|
11
|
+
: new Date(event.target.value)), [onValueChange]);
|
|
12
|
+
const id = name || generateGuid();
|
|
13
|
+
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
14
|
+
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
15
|
+
const elClassName = getClassName([
|
|
16
|
+
className,
|
|
17
|
+
elSizeClassName,
|
|
18
|
+
styleClassName,
|
|
19
|
+
rounded === true ? "is-rounded" : "",
|
|
20
|
+
"input",
|
|
21
|
+
]);
|
|
22
|
+
const inputContainerClassName = getClassName([
|
|
23
|
+
"control",
|
|
24
|
+
loading === true ? "is-loading" : "",
|
|
25
|
+
]);
|
|
26
|
+
const stingifiedDefValue = defaultValue?.toISOString().split("T")[0];
|
|
27
|
+
const labelClassName = getClassName([
|
|
28
|
+
"label",
|
|
29
|
+
!label.horizontal ? elSizeClassName : "",
|
|
30
|
+
label.className
|
|
31
|
+
]);
|
|
32
|
+
if (label.horizontal) {
|
|
33
|
+
const labelContainerClassName = getClassName([
|
|
34
|
+
"field-label",
|
|
35
|
+
elSizeClassName,
|
|
36
|
+
label.horizontalContainerClassName
|
|
37
|
+
]);
|
|
38
|
+
const fieldContainerClassName = getClassName([
|
|
39
|
+
"field-body",
|
|
40
|
+
label.horizontalFieldContainerClassName
|
|
41
|
+
]);
|
|
42
|
+
return (_jsxs("div", { className: "bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsxs("div", { className: "field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "date", className: elClassName, readOnly: readonly, disabled: disabled, defaultValue: stingifiedDefValue, onChange: onChange, onBlur: onBlur, name: id, id: id }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
43
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }) })] }));
|
|
44
|
+
}
|
|
45
|
+
return (_jsxs("div", { className: "bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "date", className: elClassName, readOnly: readonly, disabled: disabled, defaultValue: stingifiedDefValue, onChange: onChange, onBlur: onBlur, name: id, id: id }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
46
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
47
|
+
};
|
|
48
|
+
export default DatePicker;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { BaseInputElementProps, InputLabel } from
|
|
2
|
-
/** Date input component props type */
|
|
3
|
-
export interface DateProps extends Omit<BaseInputElementProps<Date | undefined>, "placeholder"> {
|
|
4
|
-
/** Label configuration */
|
|
5
|
-
label: InputLabel;
|
|
6
|
-
/** Focus out event handler */
|
|
7
|
-
onBlur?: () => void;
|
|
8
|
-
}
|
|
1
|
+
import { BaseInputElementProps, InputLabel } from "../..";
|
|
2
|
+
/** Date input component props type */
|
|
3
|
+
export interface DateProps extends Omit<BaseInputElementProps<Date | undefined>, "placeholder"> {
|
|
4
|
+
/** Label configuration */
|
|
5
|
+
label: InputLabel;
|
|
6
|
+
/** Focus out event handler */
|
|
7
|
+
onBlur?: () => void;
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAEpE,sCAAsC;AACtC,MAAM,WAAW,SAAU,SAAQ,IAAI,CAAC,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,aAAa,CAAC;IAC3F,0BAA0B;IAC1B,KAAK,EAAE,UAAU,CAAC;IAElB,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
export * from "./checkbox";
|
|
2
|
-
export * from "./date";
|
|
3
|
-
export * from "./multiline";
|
|
4
|
-
export * from "./number";
|
|
5
|
-
export * from "./password";
|
|
6
|
-
export * from "./text";
|
|
7
|
-
export * from "./types";
|
|
1
|
+
export * from "./checkbox";
|
|
2
|
+
export * from "./date";
|
|
3
|
+
export * from "./multiline";
|
|
4
|
+
export * from "./number";
|
|
5
|
+
export * from "./password";
|
|
6
|
+
export * from "./text";
|
|
7
|
+
export * from "./types";
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import "../../../../common.scss";
|
|
3
|
+
import { MultilineProps } from "../../multiline";
|
|
4
|
+
/** Multiline textual input component */
|
|
5
|
+
declare const Multiline: (props: MultilineProps) => JSX.Element;
|
|
6
|
+
export default Multiline;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/multiline/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,yBAAyB,CAAC;AAEjC,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAI3D,wCAAwC;AACxC,QAAA,MAAM,SAAS,UAAW,cAAc,KAAG,WAQ1C,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import "../../../../common.scss";
|
|
4
|
+
import MultilineWithoutLabel from "../../multiline/components/multilineWithoutLabel";
|
|
5
|
+
import MultilineWithLabel from "../../multiline/components/multilineWithLabel";
|
|
6
|
+
/** Multiline textual input component */
|
|
7
|
+
const Multiline = (props) => {
|
|
8
|
+
if (isNullOrUndefined(props.label)) {
|
|
9
|
+
return (_jsx(MultilineWithoutLabel, { ...props }));
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
return (_jsx(MultilineWithLabel, { ...props }));
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
export default Multiline;
|
package/{dist/components → components}/primitives/multiline/components/multilineWithLabel/index.d.ts
RENAMED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MultilineProps } from "../../../multiline";
|
|
3
|
+
/** Multiline textual input component with describing label */
|
|
4
|
+
declare const MultilineWithLabel: ({ defaultValue, onValueChange, validationState, readonly, disabled, name, className, size, style, rounded, loading, label, placeholder, fixed, rows, onBlur }: MultilineProps) => JSX.Element;
|
|
5
|
+
export default MultilineWithLabel;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithLabel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,kKAOrB,cAAc,KAAG,WAyGnB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
4
|
+
import { ElementSize } from "../../../..";
|
|
5
|
+
import { getValidationValues } from "../../../../../utils";
|
|
6
|
+
/** Multiline textual input component with describing label */
|
|
7
|
+
const MultilineWithLabel = ({ defaultValue, onValueChange, validationState, readonly, disabled, name, className, size, style, rounded, loading, label, placeholder, fixed, rows, onBlur }) => {
|
|
8
|
+
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
9
|
+
const id = name || generateGuid();
|
|
10
|
+
const elSizeClassName = "is-{0}".format(getValueOrDefault(size, ElementSize.Normal));
|
|
11
|
+
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
12
|
+
const elClassName = getClassName([
|
|
13
|
+
className,
|
|
14
|
+
elSizeClassName,
|
|
15
|
+
rounded === true ? "is-rounded" : "",
|
|
16
|
+
styleClassName,
|
|
17
|
+
"textarea",
|
|
18
|
+
fixed === true ? "has-fixed-size" : "",
|
|
19
|
+
]);
|
|
20
|
+
const inputContainerClassName = getClassName([
|
|
21
|
+
"control",
|
|
22
|
+
loading === true ? "is-loading" : "",
|
|
23
|
+
]);
|
|
24
|
+
const labelClassName = getClassName([
|
|
25
|
+
"label",
|
|
26
|
+
!label.horizontal ? elSizeClassName : "",
|
|
27
|
+
label.className
|
|
28
|
+
]);
|
|
29
|
+
if (label.horizontal) {
|
|
30
|
+
const labelContainerClassName = getClassName([
|
|
31
|
+
"field-label",
|
|
32
|
+
elSizeClassName,
|
|
33
|
+
label.horizontalContainerClassName
|
|
34
|
+
]);
|
|
35
|
+
const fieldContainerClassName = getClassName([
|
|
36
|
+
"field-body",
|
|
37
|
+
label.horizontalFieldContainerClassName
|
|
38
|
+
]);
|
|
39
|
+
return (_jsxs("div", { className: "bbr-input field is-horizontal", children: [_jsx("div", { className: labelContainerClassName, children: _jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }) }), _jsx("div", { className: fieldContainerClassName, children: _jsxs("div", { className: "field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id, rows: rows }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
40
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }) })] }));
|
|
41
|
+
}
|
|
42
|
+
return (_jsxs("div", { className: "bbr-input field", children: [_jsx("label", { className: labelClassName, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { className: elClassName, placeholder: placeholder, readOnly: readonly, disabled: disabled, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, name: id, id: id, rows: rows }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
43
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
44
|
+
};
|
|
45
|
+
export default MultilineWithLabel;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { MultilineProps } from "../../../multiline";
|
|
3
|
+
/** Multiline textual input component without describing label*/
|
|
4
|
+
declare const MultilineWithoutLabel: ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, className, size, style, rounded, loading, fixed, rows, }: MultilineProps) => JSX.Element;
|
|
5
|
+
export default MultilineWithoutLabel;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithoutLabel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,gEAAgE;AAChE,QAAA,MAAM,qBAAqB,wIAMxB,cAAc,KAAG,WA2CnB,CAAC;AAEF,eAAe,qBAAqB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from "react";
|
|
3
|
+
import { generateGuid, getClassName, getValueOrDefault } from "@bodynarf/utils";
|
|
4
|
+
import { ElementSize } from "../../../..";
|
|
5
|
+
import { getValidationValues } from "../../../../../utils";
|
|
6
|
+
/** Multiline textual input component without describing label*/
|
|
7
|
+
const MultilineWithoutLabel = ({ onValueChange, defaultValue, validationState, name, placeholder, onBlur, className, size, style, rounded, loading, fixed, rows, }) => {
|
|
8
|
+
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
9
|
+
const id = name || generateGuid();
|
|
10
|
+
const [isValidationDefined, styleClassName, validationMessages] = getValidationValues(style, validationState);
|
|
11
|
+
const elClassName = getClassName([
|
|
12
|
+
className,
|
|
13
|
+
"is-{0}".format(getValueOrDefault(size, ElementSize.Normal)),
|
|
14
|
+
rounded === true ? "is-rounded" : "",
|
|
15
|
+
styleClassName,
|
|
16
|
+
"textarea",
|
|
17
|
+
fixed === true ? "has-fixed-size" : "",
|
|
18
|
+
]);
|
|
19
|
+
const inputContainerClassName = getClassName([
|
|
20
|
+
"control",
|
|
21
|
+
"bbr-input",
|
|
22
|
+
loading === true ? "is-loading" : "",
|
|
23
|
+
]);
|
|
24
|
+
return (_jsxs("div", { className: "field", children: [_jsx("div", { className: inputContainerClassName, children: _jsx("textarea", { className: elClassName, placeholder: placeholder, defaultValue: defaultValue, onChange: onChange, onBlur: onBlur, id: id, name: id, rows: rows }) }), isValidationDefined && validationMessages.length > 0 &&
|
|
25
|
+
_jsx("p", { className: `help m-help ${styleClassName}`, children: validationMessages.join("\n") })] }));
|
|
26
|
+
};
|
|
27
|
+
export default MultilineWithoutLabel;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/multiline/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { BaseInputElementProps } from
|
|
2
|
-
/** Multiline textual input component props type */
|
|
3
|
-
export interface MultilineProps extends BaseInputElementProps<string> {
|
|
4
|
-
/** Is input should be resizable */
|
|
5
|
-
fixed?: boolean;
|
|
6
|
-
/** Number of initial rows count */
|
|
7
|
-
rows?: number;
|
|
8
|
-
/** Focus out event handler */
|
|
9
|
-
onBlur?: () => void;
|
|
10
|
-
}
|
|
1
|
+
import { BaseInputElementProps } from "../..";
|
|
2
|
+
/** Multiline textual input component props type */
|
|
3
|
+
export interface MultilineProps extends BaseInputElementProps<string> {
|
|
4
|
+
/** Is input should be resizable */
|
|
5
|
+
fixed?: boolean;
|
|
6
|
+
/** Number of initial rows count */
|
|
7
|
+
rows?: number;
|
|
8
|
+
/** Focus out event handler */
|
|
9
|
+
onBlur?: () => void;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/multiline/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAExD,mDAAmD;AACnD,MAAM,WAAW,cAAe,SAAQ,qBAAqB,CAAC,MAAM,CAAC;IACjE,mCAAmC;IACnC,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,mCAAmC;IACnC,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;CACvB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/number/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAIrD,6BAA6B;AAC7B,QAAA,MAAM,MAAM,UAAW,WAAW,KAAG,WAOpC,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
+
import NumberWithLabel from "../../number/components/withLabel";
|
|
4
|
+
import NumberWithoutLabel from "../../number/components/withoutLabel";
|
|
5
|
+
/** Number input component */
|
|
6
|
+
const Number = (props) => {
|
|
7
|
+
if (isNullOrUndefined(props.label)) {
|
|
8
|
+
return (_jsx(NumberWithoutLabel, { ...props }));
|
|
9
|
+
}
|
|
10
|
+
else {
|
|
11
|
+
return (_jsx(NumberWithLabel, { ...props }));
|
|
12
|
+
}
|
|
13
|
+
};
|
|
14
|
+
export default Number;
|
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
import { NumberProps } from "../../../number";
|
|
3
|
+
/** Number component with label */
|
|
4
|
+
declare const NumberWithLabel: ({ onValueChange, readonly, disabled, defaultValue, validationState, name, className, size, style, rounded, loading, label, placeholder, onBlur, step, }: NumberProps) => JSX.Element;
|
|
5
|
+
export default NumberWithLabel;
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/number/components/withLabel/index.tsx"],"names":[],"mappings":";AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AAErD,kCAAkC;AAClC,QAAA,MAAM,eAAe,4JAOlB,WAAW,KAAG,WA2GhB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|