@bodynarf/react.components 1.6.4 → 1.7.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bbr-components.js +1040 -0
- package/dist/bbr-components.umd.cjs +27 -0
- package/{components → dist/components}/accordion/component/index.d.ts +4 -6
- package/{components/button/index.js → dist/components/accordion/index.d.ts} +2 -2
- package/{components → dist/components}/accordion/types.d.ts +16 -18
- package/dist/components/anchor/component/index.d.ts +3 -0
- package/{components → dist/components}/anchor/components/anchorWithIcon/index.d.ts +3 -5
- package/{components → dist/components}/anchor/components/simpleAnchor/index.d.ts +3 -5
- package/{components/dropdown/index.js → dist/components/anchor/index.d.ts} +2 -2
- package/{components → dist/components}/anchor/types.d.ts +38 -39
- package/{components → dist/components}/button/component/index.d.ts +6 -9
- package/{components → dist/components}/button/components/buttonWithIcon/index.d.ts +3 -5
- package/{components → dist/components}/button/components/simpleButton/index.d.ts +3 -5
- package/{components/accordion/index.js → dist/components/button/index.d.ts} +2 -2
- package/{components → dist/components}/button/types.d.ts +36 -37
- package/dist/components/dropdown/component/index.d.ts +4 -0
- package/{components → dist/components}/dropdown/components/compact/index.d.ts +3 -5
- package/{components → dist/components}/dropdown/components/item/index.d.ts +13 -15
- package/{components → dist/components}/dropdown/components/label/index.d.ts +17 -18
- package/{components → dist/components}/dropdown/components/withLabel/index.d.ts +3 -5
- package/{components/anchor/index.js → dist/components/dropdown/index.d.ts} +2 -2
- package/{components → dist/components}/dropdown/types.d.ts +45 -46
- package/{components → dist/components}/icon/component/index.d.ts +5 -8
- package/dist/components/icon/index.d.ts +2 -0
- package/{components → dist/components}/icon/types.d.ts +15 -16
- package/{components/index.js → dist/components/index.d.ts} +11 -11
- package/{components → dist/components}/paginator/component/index.d.ts +6 -8
- package/{components/paginator/index.js → dist/components/paginator/index.d.ts} +3 -3
- package/{components → dist/components}/paginator/types.d.ts +27 -28
- package/{components → dist/components}/paginator/utils.d.ts +9 -10
- package/{components → dist/components}/primitives/checkbox/component/index.d.ts +4 -7
- package/dist/components/primitives/checkbox/index.d.ts +2 -0
- package/{components → dist/components}/primitives/checkbox/types.d.ts +24 -25
- package/{components → dist/components}/primitives/date/component/index.d.ts +4 -6
- package/dist/components/primitives/date/index.d.ts +2 -0
- package/{components → dist/components}/primitives/date/types.d.ts +8 -9
- package/{components/primitives/index.js → dist/components/primitives/index.d.ts} +7 -7
- package/dist/components/primitives/multiline/component/index.d.ts +4 -0
- package/{components → dist/components}/primitives/multiline/components/multilineWithLabel/index.d.ts +4 -5
- package/{components → dist/components}/primitives/multiline/components/multilineWithoutLabel/index.d.ts +4 -5
- package/dist/components/primitives/multiline/index.d.ts +2 -0
- package/{components → dist/components}/primitives/multiline/types.d.ts +10 -11
- package/{components → dist/components}/primitives/number/component/index.d.ts +4 -6
- package/{components → dist/components}/primitives/number/components/withLabel/index.d.ts +4 -5
- package/{components → dist/components}/primitives/number/components/withoutLabel/index.d.ts +4 -5
- package/dist/components/primitives/number/index.d.ts +2 -0
- package/{components → dist/components}/primitives/number/types.d.ts +12 -13
- package/dist/components/primitives/password/component/index.d.ts +4 -0
- package/{components → dist/components}/primitives/password/components/withLabel/index.d.ts +3 -4
- package/{components → dist/components}/primitives/password/components/withoutLabel/index.d.ts +3 -4
- package/dist/components/primitives/password/index.d.ts +2 -0
- package/{components → dist/components}/primitives/password/types.d.ts +9 -10
- package/dist/components/primitives/text/component/index.d.ts +4 -0
- package/{components → dist/components}/primitives/text/components/textWithLabel/index.d.ts +4 -5
- package/{components → dist/components}/primitives/text/components/textWithoutLabel/index.d.ts +4 -5
- package/dist/components/primitives/text/index.d.ts +2 -0
- package/{components → dist/components}/primitives/text/types.d.ts +6 -7
- package/{components → dist/components}/primitives/types/baseProps.d.ts +29 -30
- package/{components/primitives/types/index.js → dist/components/primitives/types/index.d.ts} +3 -3
- package/{components → dist/components}/primitives/types/label.d.ts +13 -14
- package/{components/primitives/types/validation/index.js → dist/components/primitives/types/validation/index.d.ts} +2 -2
- package/{components → dist/components}/primitives/types/validation/state.d.ts +8 -9
- package/{components → dist/components}/primitives/types/validation/status.d.ts +9 -10
- package/{components → dist/components}/search/component/index.d.ts +3 -6
- package/dist/components/search/index.d.ts +2 -0
- package/{components → dist/components}/search/types.d.ts +26 -27
- package/{components → dist/components}/tabs/component/index.d.ts +31 -33
- package/{components → dist/components}/tabs/components/item/index.d.ts +11 -13
- package/dist/components/tabs/index.d.ts +2 -0
- package/{components → dist/components}/tabs/types.d.ts +42 -43
- package/{components → dist/components}/tag/component/index.d.ts +4 -6
- package/dist/components/tag/index.d.ts +2 -0
- package/{components → dist/components}/tag/types.d.ts +26 -27
- package/{components → dist/components}/types.d.ts +66 -67
- package/{hooks/index.js → dist/hooks/index.d.ts} +2 -2
- package/{hooks → dist/hooks}/useComponentOutsideClick.d.ts +10 -11
- package/{hooks → dist/hooks}/usePagination.d.ts +19 -20
- package/{index.js → dist/index.d.ts} +3 -3
- package/dist/style.css +1 -0
- package/{utils → dist/utils}/dataAttributes.d.ts +7 -8
- package/{utils → dist/utils}/formValidation.d.ts +15 -16
- package/{utils/index.js → dist/utils/index.d.ts} +2 -2
- package/package.json +45 -38
- package/common.scss +0 -3
- package/components/accordion/component/index.d.ts.map +0 -1
- package/components/accordion/component/index.js +0 -35
- package/components/accordion/component/style.scss +0 -31
- package/components/accordion/index.d.ts +0 -3
- package/components/accordion/index.d.ts.map +0 -1
- package/components/accordion/types.d.ts.map +0 -1
- package/components/accordion/types.js +0 -1
- package/components/anchor/component/index.d.ts +0 -6
- package/components/anchor/component/index.d.ts.map +0 -1
- package/components/anchor/component/index.js +0 -20
- package/components/anchor/component/style.scss +0 -15
- package/components/anchor/components/anchorWithIcon/index.d.ts.map +0 -1
- package/components/anchor/components/anchorWithIcon/index.js +0 -16
- package/components/anchor/components/simpleAnchor/index.d.ts.map +0 -1
- package/components/anchor/components/simpleAnchor/index.js +0 -5
- package/components/anchor/index.d.ts +0 -3
- package/components/anchor/index.d.ts.map +0 -1
- package/components/anchor/types.d.ts.map +0 -1
- package/components/anchor/types.js +0 -1
- package/components/button/component/index.d.ts.map +0 -1
- package/components/button/component/index.js +0 -36
- package/components/button/component/style.scss +0 -12
- package/components/button/components/buttonWithIcon/index.d.ts.map +0 -1
- package/components/button/components/buttonWithIcon/index.js +0 -19
- package/components/button/components/simpleButton/index.d.ts.map +0 -1
- package/components/button/components/simpleButton/index.js +0 -5
- package/components/button/index.d.ts +0 -3
- package/components/button/index.d.ts.map +0 -1
- package/components/button/types.d.ts.map +0 -1
- package/components/button/types.js +0 -4
- package/components/dropdown/component/index.d.ts +0 -7
- package/components/dropdown/component/index.d.ts.map +0 -1
- package/components/dropdown/component/index.js +0 -15
- package/components/dropdown/component/style.scss +0 -120
- package/components/dropdown/components/compact/index.d.ts.map +0 -1
- package/components/dropdown/components/compact/index.js +0 -62
- package/components/dropdown/components/item/index.d.ts.map +0 -1
- package/components/dropdown/components/item/index.js +0 -6
- package/components/dropdown/components/label/index.d.ts.map +0 -1
- package/components/dropdown/components/label/index.js +0 -22
- package/components/dropdown/components/withLabel/index.d.ts.map +0 -1
- package/components/dropdown/components/withLabel/index.js +0 -83
- package/components/dropdown/index.d.ts +0 -3
- package/components/dropdown/index.d.ts.map +0 -1
- package/components/dropdown/types.d.ts.map +0 -1
- package/components/dropdown/types.js +0 -1
- package/components/icon/component/index.d.ts.map +0 -1
- package/components/icon/component/index.js +0 -23
- package/components/icon/component/style.scss +0 -21
- package/components/icon/index.d.ts +0 -3
- package/components/icon/index.d.ts.map +0 -1
- package/components/icon/index.js +0 -2
- package/components/icon/types.d.ts.map +0 -1
- package/components/icon/types.js +0 -1
- package/components/index.d.ts +0 -12
- package/components/index.d.ts.map +0 -1
- package/components/paginator/component/index.d.ts.map +0 -1
- package/components/paginator/component/index.js +0 -47
- package/components/paginator/index.d.ts +0 -4
- package/components/paginator/index.d.ts.map +0 -1
- package/components/paginator/types.d.ts.map +0 -1
- package/components/paginator/types.js +0 -1
- package/components/paginator/utils.d.ts.map +0 -1
- package/components/paginator/utils.js +0 -18
- package/components/primitives/checkbox/component/index.d.ts.map +0 -1
- package/components/primitives/checkbox/component/index.js +0 -37
- package/components/primitives/checkbox/component/style.scss +0 -10
- package/components/primitives/checkbox/index.d.ts +0 -3
- package/components/primitives/checkbox/index.d.ts.map +0 -1
- package/components/primitives/checkbox/index.js +0 -2
- package/components/primitives/checkbox/types.d.ts.map +0 -1
- package/components/primitives/checkbox/types.js +0 -1
- package/components/primitives/date/component/index.d.ts.map +0 -1
- package/components/primitives/date/component/index.js +0 -48
- package/components/primitives/date/index.d.ts +0 -3
- package/components/primitives/date/index.d.ts.map +0 -1
- package/components/primitives/date/index.js +0 -2
- package/components/primitives/date/types.d.ts.map +0 -1
- package/components/primitives/date/types.js +0 -1
- package/components/primitives/index.d.ts +0 -8
- package/components/primitives/index.d.ts.map +0 -1
- package/components/primitives/multiline/component/index.d.ts +0 -7
- package/components/primitives/multiline/component/index.d.ts.map +0 -1
- package/components/primitives/multiline/component/index.js +0 -15
- package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +0 -1
- package/components/primitives/multiline/components/multilineWithLabel/index.js +0 -45
- package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +0 -1
- package/components/primitives/multiline/components/multilineWithoutLabel/index.js +0 -27
- package/components/primitives/multiline/index.d.ts +0 -3
- package/components/primitives/multiline/index.d.ts.map +0 -1
- package/components/primitives/multiline/index.js +0 -2
- package/components/primitives/multiline/types.d.ts.map +0 -1
- package/components/primitives/multiline/types.js +0 -1
- package/components/primitives/number/component/index.d.ts.map +0 -1
- package/components/primitives/number/component/index.js +0 -14
- package/components/primitives/number/components/withLabel/index.d.ts.map +0 -1
- package/components/primitives/number/components/withLabel/index.js +0 -44
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +0 -1
- package/components/primitives/number/components/withoutLabel/index.js +0 -26
- package/components/primitives/number/index.d.ts +0 -3
- package/components/primitives/number/index.d.ts.map +0 -1
- package/components/primitives/number/index.js +0 -2
- package/components/primitives/number/types.d.ts.map +0 -1
- package/components/primitives/number/types.js +0 -1
- package/components/primitives/password/component/index.d.ts +0 -7
- package/components/primitives/password/component/index.d.ts.map +0 -1
- package/components/primitives/password/component/index.js +0 -13
- package/components/primitives/password/component/style.scss +0 -16
- package/components/primitives/password/components/withLabel/index.d.ts.map +0 -1
- package/components/primitives/password/components/withLabel/index.js +0 -51
- package/components/primitives/password/components/withoutLabel/index.d.ts.map +0 -1
- package/components/primitives/password/components/withoutLabel/index.js +0 -33
- package/components/primitives/password/index.d.ts +0 -3
- package/components/primitives/password/index.d.ts.map +0 -1
- package/components/primitives/password/index.js +0 -2
- package/components/primitives/password/types.d.ts.map +0 -1
- package/components/primitives/password/types.js +0 -1
- package/components/primitives/text/component/index.d.ts +0 -7
- package/components/primitives/text/component/index.d.ts.map +0 -1
- package/components/primitives/text/component/index.js +0 -15
- package/components/primitives/text/components/textWithLabel/index.d.ts.map +0 -1
- package/components/primitives/text/components/textWithLabel/index.js +0 -44
- package/components/primitives/text/components/textWithoutLabel/index.d.ts.map +0 -1
- package/components/primitives/text/components/textWithoutLabel/index.js +0 -26
- package/components/primitives/text/index.d.ts +0 -3
- package/components/primitives/text/index.d.ts.map +0 -1
- package/components/primitives/text/index.js +0 -2
- package/components/primitives/text/types.d.ts.map +0 -1
- package/components/primitives/text/types.js +0 -1
- package/components/primitives/types/baseProps.d.ts.map +0 -1
- package/components/primitives/types/baseProps.js +0 -1
- package/components/primitives/types/index.d.ts +0 -4
- package/components/primitives/types/index.d.ts.map +0 -1
- package/components/primitives/types/label.d.ts.map +0 -1
- package/components/primitives/types/label.js +0 -1
- package/components/primitives/types/validation/index.d.ts +0 -3
- package/components/primitives/types/validation/index.d.ts.map +0 -1
- package/components/primitives/types/validation/state.d.ts.map +0 -1
- package/components/primitives/types/validation/state.js +0 -2
- package/components/primitives/types/validation/status.d.ts.map +0 -1
- package/components/primitives/types/validation/status.js +0 -11
- package/components/search/component/index.d.ts.map +0 -1
- package/components/search/component/index.js +0 -37
- package/components/search/component/style.scss +0 -24
- package/components/search/index.d.ts +0 -3
- package/components/search/index.d.ts.map +0 -1
- package/components/search/index.js +0 -2
- package/components/search/types.d.ts.map +0 -1
- package/components/search/types.js +0 -1
- package/components/tabs/component/index.d.ts.map +0 -1
- package/components/tabs/component/index.js +0 -68
- package/components/tabs/component/style.scss +0 -12
- package/components/tabs/components/item/index.d.ts.map +0 -1
- package/components/tabs/components/item/index.js +0 -27
- package/components/tabs/index.d.ts +0 -3
- package/components/tabs/index.d.ts.map +0 -1
- package/components/tabs/index.js +0 -2
- package/components/tabs/types.d.ts.map +0 -1
- package/components/tabs/types.js +0 -34
- package/components/tag/component/index.d.ts.map +0 -1
- package/components/tag/component/index.js +0 -28
- package/components/tag/component/style.scss +0 -27
- package/components/tag/index.d.ts +0 -3
- package/components/tag/index.d.ts.map +0 -1
- package/components/tag/index.js +0 -2
- package/components/tag/types.d.ts.map +0 -1
- package/components/tag/types.js +0 -1
- package/components/types.d.ts.map +0 -1
- package/components/types.js +0 -31
- package/hooks/index.d.ts +0 -3
- package/hooks/index.d.ts.map +0 -1
- package/hooks/useComponentOutsideClick.d.ts.map +0 -1
- package/hooks/useComponentOutsideClick.js +0 -32
- package/hooks/usePagination.d.ts.map +0 -1
- package/hooks/usePagination.js +0 -28
- package/index.d.ts +0 -4
- package/index.d.ts.map +0 -1
- package/readme.md +0 -56
- package/tsconfig.tsbuildinfo +0 -1
- package/utils/dataAttributes.d.ts.map +0 -1
- package/utils/dataAttributes.js +0 -19
- package/utils/formValidation.d.ts.map +0 -1
- package/utils/formValidation.js +0 -35
- package/utils/index.d.ts +0 -3
- package/utils/index.d.ts.map +0 -1
package/package.json
CHANGED
|
@@ -1,38 +1,45 @@
|
|
|
1
|
-
{
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
"
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
1
|
+
{
|
|
2
|
+
"name": "@bodynarf/react.components",
|
|
3
|
+
"version": "1.7.1",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"main": "./dist/bbr-components.umd.cjs",
|
|
6
|
+
"module": "./dist/bbr-components.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/bbr-components.js",
|
|
14
|
+
"require": "./dist/bbr-components.umd.cjs"
|
|
15
|
+
}
|
|
16
|
+
},
|
|
17
|
+
"scripts": {
|
|
18
|
+
"dev": "vite",
|
|
19
|
+
"build": "tsc && vite build",
|
|
20
|
+
"lint": "eslint src --ext ts,tsx --report-unused-disable-directives --max-warnings 0",
|
|
21
|
+
"preview": "vite preview"
|
|
22
|
+
},
|
|
23
|
+
"peerDependencies": {
|
|
24
|
+
"react": "^18.2.0",
|
|
25
|
+
"react-dom": "^18.2.0",
|
|
26
|
+
"bulma": "^0.9.4"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"@bodynarf/utils": "^1.1.7",
|
|
30
|
+
"@types/node": "^20.2.2",
|
|
31
|
+
"@types/react": "^18.0.28",
|
|
32
|
+
"@types/react-dom": "^18.0.11",
|
|
33
|
+
"@typescript-eslint/eslint-plugin": "^5.57.1",
|
|
34
|
+
"@typescript-eslint/parser": "^5.57.1",
|
|
35
|
+
"@vitejs/plugin-react": "^4.0.0",
|
|
36
|
+
"eslint": "^8.38.0",
|
|
37
|
+
"eslint-plugin-react-hooks": "^4.6.0",
|
|
38
|
+
"eslint-plugin-react-refresh": "^0.3.4",
|
|
39
|
+
"sass": "^1.62.1",
|
|
40
|
+
"typescript": "^5.0.2",
|
|
41
|
+
"vite": "^4.3.2",
|
|
42
|
+
"vite-plugin-dts": "^2.3.0",
|
|
43
|
+
"vite-tsconfig-paths": "^4.2.0"
|
|
44
|
+
}
|
|
45
|
+
}
|
package/common.scss
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/accordion/component/index.tsx"],"names":[],"mappings":"AAIA,OAAO,cAAc,CAAC;AAOtB,OAAO,EAAE,cAAc,EAAE,MAAM,IAAI,CAAC;AAEpC,sBAAsB;AACtB,QAAA,MAAM,SAAS,2FAKZ,cAAc,KAAG,WA8DnB,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useEffect, useRef, useState } from "react";
|
|
3
|
-
import { getClassName, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
-
import "./style.scss";
|
|
5
|
-
import { ElementSize } from "../..";
|
|
6
|
-
import Icon from "../../icon";
|
|
7
|
-
import { mapDataAttributes } from "../../..";
|
|
8
|
-
/** Accordion panel */
|
|
9
|
-
const Accordion = ({ children, caption, style, size, defaultExpanded, onToggle, className, data, title, }) => {
|
|
10
|
-
const expandablePanelRef = useRef(null);
|
|
11
|
-
const [isExpanded, setIsExpanded] = useState(defaultExpanded ?? false);
|
|
12
|
-
const [maxHeight, setMaxHeight] = useState(defaultExpanded === true ? undefined : 0);
|
|
13
|
-
const toggleCollapse = useCallback(() => setMaxHeight(isExpanded ? 0 : expandablePanelRef.current.scrollHeight), [isExpanded]);
|
|
14
|
-
useEffect(() => {
|
|
15
|
-
if (defaultExpanded === true && !isNullOrUndefined(expandablePanelRef.current)) {
|
|
16
|
-
setMaxHeight(expandablePanelRef.current.scrollHeight);
|
|
17
|
-
}
|
|
18
|
-
}, [defaultExpanded]);
|
|
19
|
-
useEffect(() => setIsExpanded(maxHeight !== 0), [maxHeight]);
|
|
20
|
-
useEffect(() => {
|
|
21
|
-
onToggle?.call(undefined, !isExpanded);
|
|
22
|
-
}, [isExpanded, onToggle]);
|
|
23
|
-
const elClassName = getClassName([
|
|
24
|
-
"bbr-accordion",
|
|
25
|
-
"message",
|
|
26
|
-
isNullOrUndefined(style) ? "" : `is-${style}`,
|
|
27
|
-
isNullOrUndefined(size) ? "" : `is-${size}`,
|
|
28
|
-
className,
|
|
29
|
-
]);
|
|
30
|
-
const dataAttributes = isNullOrUndefined(data)
|
|
31
|
-
? undefined
|
|
32
|
-
: mapDataAttributes(data);
|
|
33
|
-
return (_jsxs("article", { className: elClassName, "aria-expanded": isExpanded, ...dataAttributes, children: [_jsxs("div", { className: "message-header is-unselectable", onClick: toggleCollapse, children: [_jsx("span", { title: title, children: caption }), _jsx(Icon, { name: "arrow-down", size: size ?? ElementSize.Medium })] }), _jsx("div", { className: "message-body", ref: expandablePanelRef, style: { maxHeight: `${maxHeight}px` }, children: _jsx("div", { className: "message-body__content", children: children }) })] }));
|
|
34
|
-
};
|
|
35
|
-
export default Accordion;
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
.bbr-accordion {
|
|
2
|
-
.message {
|
|
3
|
-
&-header {
|
|
4
|
-
cursor: pointer;
|
|
5
|
-
|
|
6
|
-
.bbr-icon {
|
|
7
|
-
transition: transform 0.125s ease-in-out;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
&-body {
|
|
11
|
-
color: black !important;
|
|
12
|
-
transition: max-height 0.2s ease-out;
|
|
13
|
-
overflow-y: inherit;
|
|
14
|
-
padding: 0 1.5em;
|
|
15
|
-
|
|
16
|
-
&__content {
|
|
17
|
-
padding: 1.25em 0;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
&[aria-expanded="true"] {
|
|
22
|
-
.message-header i {
|
|
23
|
-
transform: rotate(180deg);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
&[aria-expanded="false"] {
|
|
27
|
-
.message-body {
|
|
28
|
-
overflow-y: hidden;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/accordion/types.ts"],"names":[],"mappings":";AAAA,OAAO,EAAE,gBAAgB,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjE,iCAAiC;AACjC,MAAM,WAAW,cAAe,SAAQ,gBAAgB;IACpD,8CAA8C;IAC9C,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAE1B,gCAAgC;IAChC,OAAO,EAAE,MAAM,CAAC;IAEhB,8BAA8B;IAC9B,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B,iBAAiB;IACjB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,YAAY;IACZ,KAAK,CAAC,EAAE,YAAY,CAAC;IAErB,4EAA4E;IAC5E,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,KAAK,IAAI,CAAC;CAC3C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/anchor/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAe,MAAM,OAAO,CAAC;AAKjD,uBAAuB;AACvB,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CA6B9D"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { isNullOrUndefined, isNullOrEmpty, getClassName } from "@bodynarf/utils";
|
|
3
|
-
import "./style.scss";
|
|
4
|
-
import { SimpleAnchor } from "../components/simpleAnchor";
|
|
5
|
-
import { AnchorWithIcon } from "../components/anchorWithIcon";
|
|
6
|
-
/** Anchor component */
|
|
7
|
-
export default function Anchor(props) {
|
|
8
|
-
if (isNullOrUndefined(props.caption) && isNullOrUndefined(props.icon)) {
|
|
9
|
-
throw new Error("No anchor content provided");
|
|
10
|
-
}
|
|
11
|
-
const className = getClassName([
|
|
12
|
-
"bbr-anchor",
|
|
13
|
-
!isNullOrEmpty(props.className) ? ` ${props.className}` : "",
|
|
14
|
-
props.disableHovering === true ? " bbr-anchor--unhoverable" : ""
|
|
15
|
-
]);
|
|
16
|
-
if (isNullOrUndefined(props.icon)) {
|
|
17
|
-
return (_jsx(SimpleAnchor, { ...props, className: className, onClick: props.onClick }));
|
|
18
|
-
}
|
|
19
|
-
return (_jsx(AnchorWithIcon, { ...props, className: className, onClick: props.onClick, icon: props.icon }));
|
|
20
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/anchor/components/anchorWithIcon/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,iCAAiC;AACjC,eAAO,MAAM,cAAc,+DAAgE,mBAAmB,KAAG,WAqChH,CAAC"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isNullOrEmpty } from "@bodynarf/utils";
|
|
3
|
-
import Icon from "../../../icon";
|
|
4
|
-
/** Anchor with icon component */
|
|
5
|
-
export const AnchorWithIcon = ({ href, className, onClick, caption, title, target, icon }) => {
|
|
6
|
-
const iconPosition = icon.position || "left";
|
|
7
|
-
const iconClassName = isNullOrEmpty(caption)
|
|
8
|
-
? icon.className
|
|
9
|
-
: iconPosition === "left"
|
|
10
|
-
? `${icon.className} bbr-icon--left`
|
|
11
|
-
: `${icon.className} bbr-icon--right`;
|
|
12
|
-
if (iconPosition === "left") {
|
|
13
|
-
return (_jsxs("a", { href: href, className: className, title: title, target: target, onClick: onClick, children: [_jsx(Icon, { ...icon, className: iconClassName }), caption] }));
|
|
14
|
-
}
|
|
15
|
-
return (_jsxs("a", { href: href, className: className, title: title, target: target, onClick: onClick, children: [caption, _jsx(Icon, { ...icon, className: iconClassName })] }));
|
|
16
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/anchor/components/simpleAnchor/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,4CAA4C;AAC5C,eAAO,MAAM,YAAY,yDAA0D,iBAAiB,KAAG,WAYtG,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/** Simple anchor component, without icon */
|
|
3
|
-
export const SimpleAnchor = ({ href, className, onClick, caption, title, target }) => {
|
|
4
|
-
return (_jsx("a", { className: className, href: href, title: title, target: target, onClick: onClick, children: caption }));
|
|
5
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/anchor/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/anchor/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC,kCAAkC;AAClC,MAAM,WAAW,WAAW;IACxB,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,kCAAkC;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,wCAAwC;IACxC,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAE3B,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B;AAED,MAAM,WAAW,iBAAiB;IAC9B,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,kBAAkB;IAClB,SAAS,EAAE,MAAM,CAAC;IAElB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,wCAAwC;IACxC,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC9B;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC1D,4BAA4B;IAC5B,IAAI,EAAE,WAAW,CAAC;CACrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/button/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,WAAW,EAAe,MAAM,OAAO,CAAC;AAOjD;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CA0C9D"}
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { isNullOrEmpty, isNullOrUndefined, getClassName } from "@bodynarf/utils";
|
|
3
|
-
import "./style.scss";
|
|
4
|
-
import { mapDataAttributes } from "../../../utils";
|
|
5
|
-
import { ButtonWithIcon } from "../components/buttonWithIcon";
|
|
6
|
-
import { SimpleButton } from "../components/simpleButton";
|
|
7
|
-
/**
|
|
8
|
-
* Button component
|
|
9
|
-
* @throws Caption is not defined and icon configuration is not defined at the same time
|
|
10
|
-
*/
|
|
11
|
-
export default function Button(props) {
|
|
12
|
-
if (isNullOrEmpty(props.caption) && isNullOrUndefined(props.icon)) {
|
|
13
|
-
throw new Error("No button content provided.");
|
|
14
|
-
}
|
|
15
|
-
const className = getClassName([
|
|
16
|
-
"button",
|
|
17
|
-
"bbr-button",
|
|
18
|
-
props.className,
|
|
19
|
-
`is-${props.type}`,
|
|
20
|
-
props.light === true ? "is-light" : "",
|
|
21
|
-
!isNullOrUndefined(props.size) ? `is-${props.size}` : "",
|
|
22
|
-
props.outlined === true ? "is-outlined" : "",
|
|
23
|
-
props.rounded === true ? "is-rounded" : "",
|
|
24
|
-
props.isLoading === true ? "is-loading" : "",
|
|
25
|
-
props.static === true ? "is-static" : "",
|
|
26
|
-
]);
|
|
27
|
-
const data = isNullOrUndefined(props.data)
|
|
28
|
-
? undefined
|
|
29
|
-
: mapDataAttributes(props.data);
|
|
30
|
-
if (!isNullOrUndefined(props.icon)) {
|
|
31
|
-
return (_jsx(ButtonWithIcon, { ...props, className: className, onClick: props.onClick, icon: props.icon, data: data }));
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
return (_jsx(SimpleButton, { ...props, className: className, onClick: props.onClick, data: data }));
|
|
35
|
-
}
|
|
36
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/components/buttonWithIcon/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,iCAAiC;AACjC,eAAO,MAAM,cAAc,kEAKxB,mBAAmB,KAAG,WAwCxB,CAAC"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { isNullOrEmpty } from "@bodynarf/utils";
|
|
3
|
-
import Icon from "../../../icon";
|
|
4
|
-
/** Button with icon component */
|
|
5
|
-
export const ButtonWithIcon = ({ className, disabled, onClick, caption, title, icon, data, }) => {
|
|
6
|
-
const iconPosition = icon.position || "left";
|
|
7
|
-
const iconClassName = isNullOrEmpty(caption)
|
|
8
|
-
? icon.className
|
|
9
|
-
: iconPosition === "left"
|
|
10
|
-
? `${icon.className} bbr-icon--left`
|
|
11
|
-
: `${icon.className} bbr-icon--right`;
|
|
12
|
-
className = isNullOrEmpty(caption)
|
|
13
|
-
? `${className} bbr-button--icon-only`
|
|
14
|
-
: className;
|
|
15
|
-
if (iconPosition === "left") {
|
|
16
|
-
return (_jsxs("button", { className: className, disabled: disabled, onClick: onClick, title: title, ...data, children: [_jsx(Icon, { ...icon, className: iconClassName }), caption] }));
|
|
17
|
-
}
|
|
18
|
-
return (_jsxs("button", { className: className, disabled: disabled, onClick: onClick, title: title, ...data, children: [caption, _jsx(Icon, { ...icon, className: iconClassName })] }));
|
|
19
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/components/simpleButton/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,4CAA4C;AAC5C,eAAO,MAAM,YAAY,2DAKtB,iBAAiB,KAAG,WAYtB,CAAC"}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/** Simple button component, without icon */
|
|
3
|
-
export const SimpleButton = ({ className, disabled, onClick, caption, title, data }) => {
|
|
4
|
-
return (_jsx("button", { className: className, disabled: disabled, onClick: onClick, title: title, ...data, children: caption }));
|
|
5
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/button/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEtE,MAAM,WAAW,WAAY,SAAQ,gBAAgB;IACjD,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,8BAA8B;IAC9B,IAAI,EAAE,UAAU,CAAC;IAEjB,kCAAkC;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,mBAAmB;IACnB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,6CAA6C;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,gCAAgC;IAChC,MAAM,CAAC,EAAE,OAAO,CAAC;IAEjB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,gDAAgD;AAChD,oBAAY,UAAU,GAClB,SAAS,CAAC,yBAAyB,GACjC,SAAS,CAAC,2BAA2B,GACrC,MAAM,CAAC,yBAAyB,GAChC,MAAM,CAAC,sBAAsB,GAC7B,SAAS,CAAC,mBAAmB,GAC7B,SAAS,CAAC,oBAAoB,GAC9B,QAAQ,CAAC,iBAAiB,GAC1B,OAAO,CAAC,mBAAmB,GAC3B,OAAO,CAAC,wBAAwB,GAChC,MAAM,CAAC,uBAAuB,GAC9B,OAAO,CAAC,mBAAmB,GAC3B,MAAM,CAAC,sCAAsC,GAC7C,OAAO,CAAC,kDAAkD,CAC3D;AAEL,+BAA+B;AAC/B,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,WAAW,EAAE,WAAW,CAAC;IACrE,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,mBAAoB,SAAQ,iBAAiB;IAC1D,yBAAyB;IACzB,IAAI,EAAE,WAAW,CAAC;CACrB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/dropdown/component/index.tsx"],"names":[],"mappings":";AAEA,OAAO,cAAc,CAAC;AAKtB,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AAEnC,yBAAyB;AACzB,QAAA,MAAM,QAAQ,UAAW,aAAa,KAAG,WAMxC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { isNullOrUndefined } from "@bodynarf/utils";
|
|
3
|
-
import "./style.scss";
|
|
4
|
-
import DropdownWithLabel from "../components/withLabel";
|
|
5
|
-
import DropdownCompact from "../components/compact";
|
|
6
|
-
/** Dropdown component */
|
|
7
|
-
const Dropdown = (props) => {
|
|
8
|
-
if (!isNullOrUndefined(props.label)) {
|
|
9
|
-
return _jsx(DropdownWithLabel, { ...props });
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
return _jsx(DropdownCompact, { ...props });
|
|
13
|
-
}
|
|
14
|
-
};
|
|
15
|
-
export default Dropdown;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
.bbr-dropdown {
|
|
2
|
-
min-width: 7.5rem;
|
|
3
|
-
|
|
4
|
-
&:not(.bbr-dropdown--compact) {
|
|
5
|
-
display: block;
|
|
6
|
-
}
|
|
7
|
-
|
|
8
|
-
&:not(.bbr-dropdown--compact) {
|
|
9
|
-
& .dropdown-menu {
|
|
10
|
-
min-width: 100%;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
& .dropdown-menu {
|
|
15
|
-
& .dropdown-content {
|
|
16
|
-
overflow: auto;
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
&__label {
|
|
21
|
-
cursor: pointer;
|
|
22
|
-
user-select: none;
|
|
23
|
-
display: flex;
|
|
24
|
-
justify-content: flex-start;
|
|
25
|
-
|
|
26
|
-
span {
|
|
27
|
-
white-space: nowrap;
|
|
28
|
-
text-overflow: ellipsis;
|
|
29
|
-
overflow-x: hidden;
|
|
30
|
-
max-width: 15rem;
|
|
31
|
-
}
|
|
32
|
-
|
|
33
|
-
&--default span {
|
|
34
|
-
color: gray;
|
|
35
|
-
font-style: italic;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.bbr-icon {
|
|
39
|
-
&:hover {
|
|
40
|
-
color: #0d6efd;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
&.bi-arrow-down {
|
|
44
|
-
margin-left: auto;
|
|
45
|
-
&::before {
|
|
46
|
-
transition: 0.25s ease-in-out transform;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
&.bi-plus-lg::before {
|
|
51
|
-
transform: rotate(45deg);
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
&.is-success--md {
|
|
56
|
-
border-color: #48c78e;
|
|
57
|
-
}
|
|
58
|
-
&.is-danger--md {
|
|
59
|
-
border-color: #f14668;
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
&-item {
|
|
64
|
-
cursor: pointer;
|
|
65
|
-
user-select: none;
|
|
66
|
-
white-space: normal;
|
|
67
|
-
|
|
68
|
-
transition: 0.25s ease-in-out;
|
|
69
|
-
transition-property: color, background-color;
|
|
70
|
-
|
|
71
|
-
&:hover {
|
|
72
|
-
background-color: rgba(0, 0, 0, 0.05);
|
|
73
|
-
color: #0a0a0a;
|
|
74
|
-
}
|
|
75
|
-
&:active {
|
|
76
|
-
background-color: rgba(0, 0, 0, 0.15);
|
|
77
|
-
color: #0a0a0a;
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
&.is-active {
|
|
81
|
-
background-color: #485fc7;
|
|
82
|
-
color: #fff;
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
&.is-active {
|
|
87
|
-
.bbr-dropdown__label .bbr-icon.bi-arrow-down::before {
|
|
88
|
-
transform: rotate(180deg);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
&--height-default {
|
|
93
|
-
.dropdown-menu .dropdown-content {
|
|
94
|
-
max-height: 15vw;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
&--compact {
|
|
99
|
-
width: fit-content;
|
|
100
|
-
|
|
101
|
-
& .dropdown-menu {
|
|
102
|
-
min-width: 11.75rem;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
&--disabled {
|
|
107
|
-
.bbr-dropdown__label {
|
|
108
|
-
background-color: hsl(0deg, 0%, 96%);
|
|
109
|
-
border-color: hsl(0deg, 0%, 96%);
|
|
110
|
-
box-shadow: none;
|
|
111
|
-
color: hsl(0deg, 0%, 48%);
|
|
112
|
-
|
|
113
|
-
cursor: not-allowed;
|
|
114
|
-
|
|
115
|
-
.bbr-icon {
|
|
116
|
-
pointer-events: none;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/compact/index.tsx"],"names":[],"mappings":";AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAKtC,QAAA,MAAM,eAAe,0HAMlB,aAAa,KAAG,WAsGlB,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { useCallback, useId, useState } from "react";
|
|
3
|
-
import { getClassName, isNullOrEmpty, isNullOrUndefined } from "@bodynarf/utils";
|
|
4
|
-
import { useComponentOutsideClick } from "../../../../hooks";
|
|
5
|
-
import DropdownItem from "../item";
|
|
6
|
-
import DropdownLabel from "../label";
|
|
7
|
-
const DropdownCompact = ({ items, value, onSelect, deselectable, className, hideOnOuterClick, listMaxHeight, placeholder, compact, disabled, }) => {
|
|
8
|
-
const id = useId();
|
|
9
|
-
const [isListVisible, setListVisible] = useState(false);
|
|
10
|
-
const onItemClick = useCallback((event) => {
|
|
11
|
-
if (disabled ?? false) {
|
|
12
|
-
return;
|
|
13
|
-
}
|
|
14
|
-
const target = event.target;
|
|
15
|
-
if (isNullOrUndefined(target)) {
|
|
16
|
-
return;
|
|
17
|
-
}
|
|
18
|
-
const dataValue = target.dataset["dropdownItemValue"];
|
|
19
|
-
if (isNullOrEmpty(dataValue)) {
|
|
20
|
-
return;
|
|
21
|
-
}
|
|
22
|
-
const item = items.find(x => x.value === dataValue);
|
|
23
|
-
if (isNullOrUndefined(item)) {
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
if (value === item) {
|
|
27
|
-
setListVisible(false);
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
onSelect(item);
|
|
31
|
-
setListVisible(false);
|
|
32
|
-
}, [setListVisible, value, items, onSelect, disabled]);
|
|
33
|
-
const onLabelClick = useCallback((event) => {
|
|
34
|
-
if (disabled ?? false) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
const target = event.target;
|
|
38
|
-
if (isNullOrUndefined(target)) {
|
|
39
|
-
return;
|
|
40
|
-
}
|
|
41
|
-
if (target.classList.contains("bi-plus-lg")) {
|
|
42
|
-
onSelect(undefined);
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
setListVisible(state => !state);
|
|
46
|
-
}
|
|
47
|
-
}, [onSelect, setListVisible, disabled]);
|
|
48
|
-
useComponentOutsideClick(`[data-dropdown-id="${id}"]`, isListVisible, () => setListVisible(false), hideOnOuterClick);
|
|
49
|
-
const classNames = getClassName([
|
|
50
|
-
"bbr-dropdown",
|
|
51
|
-
(disabled ?? false) ? "bbr-dropdown--disabled" : "",
|
|
52
|
-
(compact ?? false) ? "bbr-dropdown--compact" : "",
|
|
53
|
-
isListVisible ? "is-active" : "",
|
|
54
|
-
isNullOrEmpty(listMaxHeight) ? "bbr-dropdown--height-default" : "",
|
|
55
|
-
className,
|
|
56
|
-
"dropdown"
|
|
57
|
-
]);
|
|
58
|
-
return (_jsxs("div", { className: classNames, "data-dropdown-id": id, children: [_jsx(DropdownLabel, { caption: placeholder, deselectable: deselectable === true, selectedItem: value, onClick: onLabelClick }), _jsx("div", { className: "dropdown-menu", children: items.length > 0
|
|
59
|
-
? _jsx("ul", { className: "dropdown-content", style: { maxHeight: listMaxHeight }, children: items.map(item => _jsx(DropdownItem, { item: item, selected: value?.value === item.value, onClick: onItemClick }, item.id)) })
|
|
60
|
-
: _jsx("span", { className: "dropdown-content dropdown-item", children: "No items found" }) })] }, id));
|
|
61
|
-
};
|
|
62
|
-
export default DropdownCompact;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/item/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,0BAA0B;AAC1B,UAAU,iBAAiB;IACvB,kCAAkC;IAClC,IAAI,EAAE,cAAc,CAAC;IAErB,sBAAsB;IACtB,QAAQ,EAAE,OAAO,CAAC;IAElB,yBAAyB;IACzB,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;CAC7D;AAED,wCAAwC;AACxC,QAAA,MAAM,YAAY,gCAAiC,iBAAiB,KAAG,WAYtE,CAAC;AAEF,eAAe,YAAY,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
/** Single item in dropdown component */
|
|
3
|
-
const DropdownItem = ({ item, selected, onClick }) => {
|
|
4
|
-
return (_jsx("li", { className: `bbr-dropdown-item dropdown-item${selected ? " is-active" : ""}`, onClick: onClick, "data-dropdown-item-value": item.value, title: item.displayValue, children: item.displayValue }, item.id));
|
|
5
|
-
};
|
|
6
|
-
export default DropdownItem;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/label/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAOnC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,MAAM,WAAW,kBAAkB;IAC/B,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAEhB,wBAAwB;IACxB,YAAY,EAAE,OAAO,CAAC;IAEtB,oBAAoB;IACpB,YAAY,CAAC,EAAE,cAAc,CAAC;IAE9B,yBAAyB;IACzB,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,mBAAmB;IACnB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC1D;AAED,sBAAsB;AACtB,QAAA,MAAM,aAAa,iEAIhB,kBAAkB,KAAG,WAkCvB,CAAC;AAEF,eAAe,aAAa,CAAC"}
|