@bodynarf/react.components 1.13.5 → 1.13.6
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/accordion/component/index.d.ts.map +1 -1
- package/components/accordion/component/index.js +7 -9
- package/components/accordion/types.d.ts +2 -2
- package/components/accordion/types.d.ts.map +1 -1
- package/components/anchor/types.d.ts +1 -1
- package/components/breadcrumbs/component/index.d.ts.map +1 -1
- package/components/breadcrumbs/component/index.js +9 -11
- package/components/breadcrumbs/types.d.ts +16 -16
- package/components/breadcrumbs/types.d.ts.map +1 -1
- package/components/button/component/index.js +3 -3
- package/components/button/components/buttonWithIcon/index.d.ts.map +1 -1
- package/components/button/components/buttonWithIcon/index.js +4 -6
- package/components/button/components/simpleButton/index.d.ts.map +1 -1
- package/components/button/components/simpleButton/index.js +2 -5
- package/components/button/types.d.ts +2 -2
- package/components/button/types.d.ts.map +1 -1
- package/components/dropdown/component/index.d.ts.map +1 -1
- package/components/dropdown/component/index.js +6 -3
- package/components/dropdown/component/style.scss +13 -0
- package/components/dropdown/components/compact/index.d.ts.map +1 -1
- package/components/dropdown/components/compact/index.js +22 -11
- package/components/dropdown/components/item/index.js +6 -6
- package/components/dropdown/components/label/component/index.d.ts +4 -4
- package/components/dropdown/components/label/component/index.d.ts.map +1 -1
- package/components/dropdown/components/label/component/index.js +4 -4
- package/components/dropdown/components/label/components/selected/index.d.ts +1 -1
- package/components/dropdown/components/label/components/selected/index.d.ts.map +1 -1
- package/components/dropdown/components/label/components/selected/index.js +5 -5
- package/components/dropdown/components/label/components/selectedWithIcon/index.d.ts +1 -1
- package/components/dropdown/components/label/components/selectedWithIcon/index.d.ts.map +1 -1
- package/components/dropdown/components/label/components/selectedWithIcon/index.js +4 -4
- package/components/dropdown/components/label/components/withSearch/index.js +3 -3
- package/components/dropdown/components/withLabel/index.d.ts +2 -1
- package/components/dropdown/components/withLabel/index.d.ts.map +1 -1
- package/components/dropdown/components/withLabel/index.js +3 -1
- package/components/file/component/index.d.ts.map +1 -1
- package/components/file/component/index.js +6 -8
- package/components/icon/component/index.d.ts.map +1 -1
- package/components/icon/component/index.js +2 -4
- package/components/index.d.ts +33 -1
- package/components/index.d.ts.map +1 -1
- package/components/index.js +35 -1
- package/components/multiselect/component/index.d.ts.map +1 -1
- package/components/multiselect/component/index.js +6 -3
- package/components/multiselect/component/style.scss +13 -0
- package/components/multiselect/components/item/index.d.ts.map +1 -1
- package/components/multiselect/components/item/index.js +5 -5
- package/components/multiselect/components/label/components/empty/index.js +1 -1
- package/components/multiselect/components/label/components/nonEmpty/index.js +1 -1
- package/components/multiselect/components/withLabel/index.d.ts +2 -1
- package/components/multiselect/components/withLabel/index.d.ts.map +1 -1
- package/components/multiselect/components/withLabel/index.js +3 -1
- package/components/multiselect/components/withoutLabel/index.d.ts.map +1 -1
- package/components/multiselect/components/withoutLabel/index.js +23 -9
- package/components/multiselect/types.d.ts +8 -8
- package/components/multiselect/types.d.ts.map +1 -1
- package/components/paginator/component/index.d.ts.map +1 -1
- package/components/paginator/component/index.js +10 -12
- package/components/paginator/types.d.ts +2 -2
- package/components/paginator/types.d.ts.map +1 -1
- package/components/primitives/checkbox/component/index.d.ts.map +1 -1
- package/components/primitives/checkbox/component/index.js +9 -11
- package/components/primitives/color/component/index.d.ts.map +1 -1
- package/components/primitives/color/component/index.js +7 -3
- package/components/primitives/color/components/picker/index.d.ts +3 -3
- package/components/primitives/color/components/picker/index.d.ts.map +1 -1
- package/components/primitives/color/components/picker/index.js +9 -10
- package/components/primitives/color/components/withLabel/index.d.ts +2 -1
- package/components/primitives/color/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/color/components/withLabel/index.js +5 -5
- package/components/primitives/color/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/color/components/withoutLabel/index.js +5 -4
- package/components/primitives/color/types.d.ts +1 -1
- package/components/primitives/color/types.d.ts.map +1 -1
- package/components/primitives/date/component/index.d.ts +2 -1
- package/components/primitives/date/component/index.d.ts.map +1 -1
- package/components/primitives/date/component/index.js +6 -6
- package/components/primitives/date/types.d.ts +2 -2
- package/components/primitives/date/types.d.ts.map +1 -1
- package/components/primitives/internal/componentWithLabel/index.d.ts.map +1 -1
- package/components/primitives/internal/componentWithLabel/index.js +2 -2
- package/components/primitives/internal/hint/index.d.ts.map +1 -1
- package/components/primitives/internal/hint/index.js +6 -6
- package/components/primitives/multiline/component/index.d.ts.map +1 -1
- package/components/primitives/multiline/component/index.js +6 -3
- package/components/primitives/multiline/components/withLabel/index.d.ts +2 -1
- package/components/primitives/multiline/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/withLabel/index.js +6 -6
- package/components/primitives/multiline/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/multiline/components/withoutLabel/index.js +6 -8
- package/components/primitives/multiline/types.d.ts +2 -2
- package/components/primitives/multiline/types.d.ts.map +1 -1
- package/components/primitives/number/component/index.d.ts.map +1 -1
- package/components/primitives/number/component/index.js +6 -3
- package/components/primitives/number/components/withLabel/index.d.ts +2 -1
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withLabel/index.js +6 -6
- package/components/primitives/number/components/withoutLabel/index.js +6 -8
- package/components/primitives/number/types.d.ts +2 -2
- package/components/primitives/number/types.d.ts.map +1 -1
- package/components/primitives/password/component/index.d.ts.map +1 -1
- package/components/primitives/password/component/index.js +6 -3
- package/components/primitives/password/components/withLabel/index.d.ts +2 -1
- package/components/primitives/password/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withLabel/index.js +5 -7
- package/components/primitives/password/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/password/components/withoutLabel/index.js +5 -7
- package/components/primitives/password/types.d.ts +3 -3
- package/components/primitives/password/types.d.ts.map +1 -1
- package/components/primitives/text/component/index.d.ts.map +1 -1
- package/components/primitives/text/component/index.js +6 -3
- package/components/primitives/text/components/withLabel/index.d.ts +2 -1
- package/components/primitives/text/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/text/components/withLabel/index.js +6 -8
- package/components/primitives/text/components/withoutLabel/index.js +6 -8
- package/components/primitives/text/index.d.ts.map +1 -1
- package/components/primitives/text/types.d.ts +2 -2
- package/components/primitives/text/types.d.ts.map +1 -1
- package/components/progress/component/index.d.ts +7 -0
- package/components/progress/component/index.d.ts.map +1 -0
- package/components/progress/component/index.js +34 -0
- package/components/progress/component/style.scss +211 -0
- package/components/progress/index.d.ts +3 -0
- package/components/progress/index.d.ts.map +1 -0
- package/components/progress/index.js +2 -0
- package/components/progress/types.d.ts +23 -0
- package/components/progress/types.d.ts.map +1 -0
- package/components/progress/types.js +1 -0
- package/components/search/component/index.d.ts.map +1 -1
- package/components/search/component/index.js +7 -9
- package/components/search/types.d.ts +2 -2
- package/components/search/types.d.ts.map +1 -1
- package/components/table/component/index.d.ts.map +1 -1
- package/components/table/component/index.js +3 -5
- package/components/table/components/heading/index.js +4 -4
- package/components/tabs/component/index.d.ts.map +1 -1
- package/components/tabs/component/index.js +10 -31
- package/components/tabs/components/item/index.d.ts.map +1 -1
- package/components/tabs/components/item/index.js +2 -2
- package/components/tabs/types.d.ts +2 -2
- package/components/tabs/types.d.ts.map +1 -1
- package/components/tag/component/index.d.ts.map +1 -1
- package/components/tag/component/index.js +11 -13
- package/components/tag/component/style.scss +1 -1
- package/hooks/useComponentOutsideClick.d.ts.map +1 -1
- package/hooks/useComponentOutsideClick.js +3 -2
- package/hooks/useEventListener.d.ts.map +1 -1
- package/hooks/useEventListener.js +5 -2
- package/hooks/useMount.js +1 -1
- package/hooks/usePagination.d.ts +1 -1
- package/hooks/usePagination.d.ts.map +1 -1
- package/package.json +3 -3
- package/tsconfig.tsbuildinfo +1 -1
- package/types/base/baseInputElementProps.d.ts +5 -4
- package/types/base/baseInputElementProps.d.ts.map +1 -1
- package/types/base/index.d.ts +2 -0
- package/types/base/index.d.ts.map +1 -1
- package/types/base/index.js +2 -0
- package/types/base/keyboardElement.d.ts +9 -0
- package/types/base/keyboardElement.d.ts.map +1 -0
- package/types/base/keyboardElement.js +1 -0
- package/types/base/labeledElement.d.ts +7 -0
- package/types/base/labeledElement.d.ts.map +1 -0
- package/types/base/labeledElement.js +1 -0
- package/utils/dataAttributes.d.ts +2 -1
- package/utils/dataAttributes.d.ts.map +1 -1
- package/utils/dataAttributes.js +5 -2
- package/utils/styles.d.ts +64 -8
- package/utils/styles.d.ts.map +1 -1
- package/utils/styles.js +93 -11
- package/utils/validation.js +3 -3
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { emptyFn, generateGuid, getClassName,
|
|
3
|
+
import { emptyFn, generateGuid, getClassName, isNullish, isStringEmpty } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
|
-
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
5
|
+
import { getSizeClassName, getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import ComponentWithLabel from "../../../internal/componentWithLabel";
|
|
7
7
|
import InternalHint from "../../../internal/hint";
|
|
8
8
|
/** Number component with label */
|
|
9
|
-
const NumberWithLabel = ({ onValueChange = emptyFn, defaultValue, validationState, name = generateGuid(), label, placeholder, size = ElementSize.Normal, style, rounded = false, loading = false, readonly = false, disabled = false, autoFocus = false, onBlur, step = 1, className, title, data, hint, }) => {
|
|
9
|
+
const NumberWithLabel = ({ onValueChange = emptyFn, defaultValue, validationState, name = generateGuid(), label, placeholder, size = ElementSize.Normal, style, rounded = false, loading = false, readonly = false, disabled = false, autoFocus = false, onBlur, onKeyDown, onKeyUp, step = 1, className, title, data, hint, }) => {
|
|
10
10
|
const onChange = useCallback((event) => onValueChange(isStringEmpty(event.target.value) ? undefined : +event.target.value), [onValueChange]);
|
|
11
11
|
const elClassName = getClassName([
|
|
12
12
|
className,
|
|
13
|
-
size
|
|
13
|
+
getSizeClassName(size, ElementSize.Normal),
|
|
14
14
|
rounded ? "is-rounded" : "",
|
|
15
15
|
getStyleClassName(style, validationState),
|
|
16
16
|
"input",
|
|
@@ -19,9 +19,9 @@ const NumberWithLabel = ({ onValueChange = emptyFn, defaultValue, validationStat
|
|
|
19
19
|
"control",
|
|
20
20
|
loading ? "is-loading" : "",
|
|
21
21
|
]);
|
|
22
|
-
const dataAttributes =
|
|
22
|
+
const dataAttributes = isNullish(data)
|
|
23
23
|
? undefined
|
|
24
24
|
: mapDataAttributes(data);
|
|
25
|
-
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", {
|
|
25
|
+
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { id: name, name: name, step: step, type: "number", title: title, onBlur: onBlur, onKeyUp: onKeyUp, onChange: onChange, readOnly: readonly, disabled: disabled, ...dataAttributes, onKeyDown: onKeyDown, autoFocus: autoFocus, className: elClassName, placeholder: placeholder, defaultValue: defaultValue }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
26
26
|
};
|
|
27
27
|
export default NumberWithLabel;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { emptyFn, generateGuid, getClassName
|
|
3
|
+
import { emptyFn, generateGuid, getClassName } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
|
-
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
5
|
+
import { getSizeClassName, getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import InternalHint from "../../../internal/hint";
|
|
7
7
|
/** Number component without label */
|
|
8
|
-
const NumberWithoutLabel = ({ onValueChange = emptyFn, defaultValue, validationState, name = generateGuid(), size, style, readonly = false, disabled = false, autoFocus = false, rounded = false, loading = false, placeholder, onBlur, step = 1, className, title, data, hint, }) => {
|
|
8
|
+
const NumberWithoutLabel = ({ onValueChange = emptyFn, defaultValue, validationState, name = generateGuid(), size, style, readonly = false, disabled = false, autoFocus = false, rounded = false, loading = false, placeholder, onBlur, onKeyDown, onKeyUp, step = 1, className, title, data, hint, }) => {
|
|
9
9
|
const onChange = useCallback((event) => onValueChange(+event.target.value), [onValueChange]);
|
|
10
10
|
const elClassName = getClassName([
|
|
11
11
|
className,
|
|
12
|
-
size
|
|
12
|
+
getSizeClassName(size, ElementSize.Normal),
|
|
13
13
|
rounded ? "is-rounded" : "",
|
|
14
14
|
getStyleClassName(style, validationState),
|
|
15
15
|
"input",
|
|
@@ -19,9 +19,7 @@ const NumberWithoutLabel = ({ onValueChange = emptyFn, defaultValue, validationS
|
|
|
19
19
|
"bbr-input",
|
|
20
20
|
loading ? "is-loading" : "",
|
|
21
21
|
]);
|
|
22
|
-
const dataAttributes =
|
|
23
|
-
|
|
24
|
-
: mapDataAttributes(data);
|
|
25
|
-
return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "number", id: name, name: name, step: step, onBlur: onBlur, onChange: onChange, readOnly: readonly, disabled: disabled, autoFocus: autoFocus, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
22
|
+
const dataAttributes = mapDataAttributes(data);
|
|
23
|
+
return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: containerClassName, children: _jsx("input", { id: name, name: name, step: step, type: "number", title: title, onBlur: onBlur, onKeyUp: onKeyUp, onChange: onChange, readOnly: readonly, disabled: disabled, ...dataAttributes, onKeyDown: onKeyDown, autoFocus: autoFocus, className: elClassName, placeholder: placeholder, defaultValue: defaultValue }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
26
24
|
};
|
|
27
25
|
export default NumberWithoutLabel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseNullableInputElementProps, BlurableElement } from "../../../types";
|
|
1
|
+
import { BaseNullableInputElementProps, BlurableElement, KeyboardElement } from "../../../types";
|
|
2
2
|
/** Number component props type */
|
|
3
|
-
export type NumberProps = BaseNullableInputElementProps<number> & BlurableElement & {
|
|
3
|
+
export type NumberProps = BaseNullableInputElementProps<number> & BlurableElement & KeyboardElement & {
|
|
4
4
|
/**
|
|
5
5
|
* Difference which will be used to change value after step button click.
|
|
6
6
|
* See html input step documentation.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/number/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/number/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7F,kCAAkC;AAClC,MAAM,MAAM,WAAW,GAAG,6BAA6B,CAAC,MAAM,CAAC,GACzD,eAAe,GACf,eAAe,GACf;IACE;;;;MAIE;IACF,IAAI,CAAC,EAAE,MAAM,CAAC;CACjB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/password/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,+BAA+B;AAC/B,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/password/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAItC,+BAA+B;AAC/B,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CAW/B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,12 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { isNullish } from "@bodynarf/utils";
|
|
3
3
|
import "./style.scss";
|
|
4
4
|
import PasswordWithLabel from "../components/withLabel";
|
|
5
5
|
import PasswordWithoutLabel from "../components/withoutLabel";
|
|
6
6
|
/** Password input component */
|
|
7
7
|
const Password = (props) => {
|
|
8
|
-
|
|
8
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
9
|
+
return isNullish(props.label)
|
|
9
10
|
? _jsx(PasswordWithoutLabel, { ...props })
|
|
10
|
-
: _jsx(PasswordWithLabel, { ...props
|
|
11
|
+
: (_jsx(PasswordWithLabel, { ...props,
|
|
12
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
13
|
+
label: props.label }));
|
|
11
14
|
};
|
|
12
15
|
export default Password;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
|
+
import { BaseInputWithLabel } from "../../../../../types";
|
|
2
3
|
import { PasswordProps } from "../..";
|
|
3
|
-
declare const PasswordWithLabel: FC<PasswordProps
|
|
4
|
+
declare const PasswordWithLabel: FC<BaseInputWithLabel<PasswordProps>>;
|
|
4
5
|
export default PasswordWithLabel;
|
|
5
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAyB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAyB,MAAM,OAAO,CAAC;AAI/D,OAAO,EAAE,kBAAkB,EAAe,MAAM,YAAY,CAAC;AAM7D,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,QAAA,MAAM,iBAAiB,EAAE,EAAE,CAAC,kBAAkB,CAAC,aAAa,CAAC,CAmF5D,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
|
-
import { emptyFn, generateGuid, getClassName
|
|
3
|
+
import { emptyFn, generateGuid, getClassName } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import Icon from "../../../../icon";
|
|
7
7
|
import ComponentWithLabel from "../../../internal/componentWithLabel";
|
|
8
8
|
import InternalHint from "../../../internal/hint";
|
|
9
|
-
const PasswordWithLabel = ({ defaultValue, onValueChange = emptyFn, validationState, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, autoFocus = false, disabled = false, canShowPassword = false, label, placeholder, showPasswordIconTitle = "Show password", className, title, data, hint, }) => {
|
|
10
|
-
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
9
|
+
const PasswordWithLabel = ({ defaultValue, onValueChange = emptyFn, validationState, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, autoFocus = false, disabled = false, canShowPassword = false, label, placeholder, showPasswordIconTitle = "Show password", onKeyDown, onKeyUp, className, title, data, hint, }) => {
|
|
11
10
|
const [contentIsHidden, setContentIsHidden] = useState(true);
|
|
11
|
+
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
12
12
|
const onIconClick = useCallback(() => setContentIsHidden(state => !state), [setContentIsHidden]);
|
|
13
13
|
const elSizeClassName = size === ElementSize.Normal ? "" : "is-{0}".format(size);
|
|
14
14
|
const elClassName = getClassName([
|
|
@@ -25,10 +25,8 @@ const PasswordWithLabel = ({ defaultValue, onValueChange = emptyFn, validationSt
|
|
|
25
25
|
canShowPassword ? "has-icons-right" : "",
|
|
26
26
|
"bbr-password__wrapper",
|
|
27
27
|
]);
|
|
28
|
-
const dataAttributes =
|
|
29
|
-
|
|
30
|
-
: mapDataAttributes(data);
|
|
31
|
-
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsxs("div", { className: inputContainerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", id: name, name: name, disabled: disabled, onChange: onChange, autoFocus: autoFocus, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }), !!canShowPassword && !loading &&
|
|
28
|
+
const dataAttributes = mapDataAttributes(data);
|
|
29
|
+
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsxs("div", { className: inputContainerClassName, children: [_jsx("input", { id: name, name: name, title: title, onKeyUp: onKeyUp, disabled: disabled, onChange: onChange, ...dataAttributes, onKeyDown: onKeyDown, autoFocus: autoFocus, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, type: contentIsHidden ? "password" : "text" }), !!canShowPassword && !loading &&
|
|
32
30
|
_jsx("span", { onClick: onIconClick, title: showPasswordIconTitle, className: `icon is-right ${elSizeClassName}`, children: _jsx(Icon, { size: size, name: contentIsHidden ? "eye" : "eye-slash" }) })] }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
33
31
|
};
|
|
34
32
|
export default PasswordWithLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withoutLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAyB,MAAM,OAAO,CAAC;AAS/D,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,QAAA,MAAM,oBAAoB,EAAE,EAAE,CAAC,aAAa,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/password/components/withoutLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAyB,MAAM,OAAO,CAAC;AAS/D,OAAO,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAEtC,QAAA,MAAM,oBAAoB,EAAE,EAAE,CAAC,aAAa,CAkF3C,CAAC;AAEF,eAAe,oBAAoB,CAAC"}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback, useState } from "react";
|
|
3
|
-
import { emptyFn, generateGuid, getClassName
|
|
3
|
+
import { emptyFn, generateGuid, getClassName } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
5
|
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import Icon from "../../../../icon";
|
|
7
7
|
import InternalHint from "../../../internal/hint";
|
|
8
|
-
const PasswordWithoutLabel = ({ defaultValue, onValueChange = emptyFn, disabled, validationState, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, autoFocus = false, placeholder, canShowPassword = false, showPasswordIconTitle = "Show password", className, title, data, hint, }) => {
|
|
9
|
-
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
8
|
+
const PasswordWithoutLabel = ({ defaultValue, onValueChange = emptyFn, disabled, validationState, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, autoFocus = false, placeholder, canShowPassword = false, showPasswordIconTitle = "Show password", onKeyDown, onKeyUp, className, title, data, hint, }) => {
|
|
10
9
|
const [contentIsHidden, setContentIsHidden] = useState(true);
|
|
10
|
+
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
11
11
|
const onIconClick = useCallback(() => setContentIsHidden(state => !state), [setContentIsHidden]);
|
|
12
12
|
const elSizeClassName = size === ElementSize.Normal ? "" : "is-{0}".format(size);
|
|
13
13
|
const elClassName = getClassName([
|
|
@@ -25,10 +25,8 @@ const PasswordWithoutLabel = ({ defaultValue, onValueChange = emptyFn, disabled,
|
|
|
25
25
|
canShowPassword ? "has-icons-right" : "",
|
|
26
26
|
"bbr-password__wrapper",
|
|
27
27
|
]);
|
|
28
|
-
const dataAttributes =
|
|
29
|
-
|
|
30
|
-
: mapDataAttributes(data);
|
|
31
|
-
return (_jsxs("div", { className: "bbr-field field", children: [_jsxs("div", { className: containerClassName, children: [_jsx("input", { type: contentIsHidden ? "password" : "text", id: name, name: name, disabled: disabled, onChange: onChange, autoFocus: autoFocus, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, title: title, ...dataAttributes }), !!canShowPassword && !loading &&
|
|
28
|
+
const dataAttributes = mapDataAttributes(data);
|
|
29
|
+
return (_jsxs("div", { className: "bbr-field field", children: [_jsxs("div", { className: containerClassName, children: [_jsx("input", { id: name, name: name, title: title, onKeyUp: onKeyUp, disabled: disabled, onChange: onChange, ...dataAttributes, onKeyDown: onKeyDown, autoFocus: autoFocus, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, type: contentIsHidden ? "password" : "text" }), !!canShowPassword && !loading &&
|
|
32
30
|
_jsx("span", { onClick: onIconClick, title: showPasswordIconTitle, className: `icon is-right ${elSizeClassName}`, children: _jsx(Icon, { size: size, name: contentIsHidden ? "eye" : "eye-slash" }) })] }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
33
31
|
};
|
|
34
32
|
export default PasswordWithoutLabel;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { BaseNotNullableInputElementProps } from "../../../types";
|
|
1
|
+
import { BaseNotNullableInputElementProps, KeyboardElement } from "../../../types";
|
|
2
2
|
/** Password component props type */
|
|
3
|
-
export
|
|
3
|
+
export type PasswordProps = Omit<BaseNotNullableInputElementProps<string>, "readonly"> & KeyboardElement & {
|
|
4
4
|
/**
|
|
5
5
|
* Is clickable icon "Show password" visible.
|
|
6
6
|
* Will show password on click
|
|
@@ -11,5 +11,5 @@ export interface PasswordProps extends Omit<BaseNotNullableInputElementProps<str
|
|
|
11
11
|
* @default "Show password"
|
|
12
12
|
*/
|
|
13
13
|
showPasswordIconTitle?: string;
|
|
14
|
-
}
|
|
14
|
+
};
|
|
15
15
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/password/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/password/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE/E,oCAAoC;AACpC,MAAM,MAAM,aAAa,GAAG,IAAI,CAC1B,gCAAgC,CAAC,MAAM,CAAC,EACxC,UAAU,CACf,GACK,eAAe,GACf;IACE;;;MAGE;IACF,eAAe,CAAC,EAAE,OAAO,CAAC;IAE1B;;;OAGG;IACH,qBAAqB,CAAC,EAAE,MAAM,CAAC;CAClC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/text/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAI/B,8BAA8B;AAC9B,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/text/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAI3B,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAI/B,8BAA8B;AAC9B,QAAA,MAAM,IAAI,EAAE,EAAE,CAAC,SAAS,CAWvB,CAAC;AAEF,eAAe,IAAI,CAAC"}
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import {
|
|
2
|
+
import { isNullish } from "@bodynarf/utils";
|
|
3
3
|
import TextWithLabel from "../components/withLabel";
|
|
4
4
|
import TextWithoutLabel from "../components/withoutLabel";
|
|
5
5
|
/** Textual input component */
|
|
6
6
|
const Text = (props) => {
|
|
7
|
-
|
|
7
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
8
|
+
return isNullish(props.label)
|
|
8
9
|
? _jsx(TextWithoutLabel, { ...props })
|
|
9
|
-
: _jsx(TextWithLabel, { ...props
|
|
10
|
+
: (_jsx(TextWithLabel, { ...props,
|
|
11
|
+
// eslint-disable-next-line react/destructuring-assignment
|
|
12
|
+
label: props.label }));
|
|
10
13
|
};
|
|
11
14
|
export default Text;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { FC } from "react";
|
|
2
2
|
import { TextProps } from "../..";
|
|
3
|
+
type TextWithLabelProps = Omit<TextProps, "label"> & Required<Pick<TextProps, "label">>;
|
|
3
4
|
/** Textual input with describing label */
|
|
4
|
-
declare const TextWithLabel: FC<
|
|
5
|
+
declare const TextWithLabel: FC<TextWithLabelProps>;
|
|
5
6
|
export default TextWithLabel;
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/withLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAe,MAAM,OAAO,CAAC;AASrD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,0CAA0C;AAC1C,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/text/components/withLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAe,MAAM,OAAO,CAAC;AASrD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAElC,KAAK,kBAAkB,GACjB,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,GACxB,QAAQ,CAAC,IAAI,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC;AAEzC,0CAA0C;AAC1C,QAAA,MAAM,aAAa,EAAE,EAAE,CAAC,kBAAkB,CAgEzC,CAAC;AAEF,eAAe,aAAa,CAAC"}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { emptyFn, generateGuid, getClassName
|
|
3
|
+
import { emptyFn, generateGuid, getClassName } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
|
-
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
5
|
+
import { getSizeClassName, getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import InternalHint from "../../../internal/hint";
|
|
7
7
|
import ComponentWithLabel from "../../../internal/componentWithLabel";
|
|
8
8
|
/** Textual input with describing label */
|
|
9
|
-
const TextWithLabel = ({ onValueChange = emptyFn, readonly, disabled, defaultValue, validationState, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, autoFocus = false, label, placeholder, onBlur, className, title, data, hint, }) => {
|
|
9
|
+
const TextWithLabel = ({ onValueChange = emptyFn, readonly, disabled, defaultValue, validationState, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, autoFocus = false, label, placeholder, onBlur, onKeyDown, onKeyUp, className, title, data, hint, }) => {
|
|
10
10
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
11
11
|
const elClassName = getClassName([
|
|
12
12
|
className,
|
|
13
|
-
size
|
|
13
|
+
getSizeClassName(size, ElementSize.Normal),
|
|
14
14
|
rounded ? "is-rounded" : "",
|
|
15
15
|
getStyleClassName(style, validationState),
|
|
16
16
|
"input",
|
|
@@ -19,9 +19,7 @@ const TextWithLabel = ({ onValueChange = emptyFn, readonly, disabled, defaultVal
|
|
|
19
19
|
"control",
|
|
20
20
|
loading ? "is-loading" : "",
|
|
21
21
|
]);
|
|
22
|
-
const dataAttributes =
|
|
23
|
-
|
|
24
|
-
: mapDataAttributes(data);
|
|
25
|
-
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "text", id: name, name: name, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, autoFocus: autoFocus, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
22
|
+
const dataAttributes = mapDataAttributes(data);
|
|
23
|
+
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { id: name, type: "text", name: name, title: title, onBlur: onBlur, onKeyUp: onKeyUp, readOnly: readonly, disabled: disabled, onChange: onChange, ...dataAttributes, onKeyDown: onKeyDown, autoFocus: autoFocus, className: elClassName, placeholder: placeholder, defaultValue: defaultValue }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
26
24
|
};
|
|
27
25
|
export default TextWithLabel;
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { useCallback } from "react";
|
|
3
|
-
import { emptyFn, generateGuid, getClassName
|
|
3
|
+
import { emptyFn, generateGuid, getClassName } from "@bodynarf/utils";
|
|
4
4
|
import { ElementSize } from "../../../../../types";
|
|
5
|
-
import { getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
5
|
+
import { getSizeClassName, getStyleClassName, mapDataAttributes } from "../../../../../utils";
|
|
6
6
|
import InternalHint from "../../../internal/hint";
|
|
7
7
|
/** Textual input without describing label */
|
|
8
|
-
const TextWithoutLabel = ({ onValueChange = emptyFn, defaultValue, validationState, readonly = false, disabled = false, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, autoFocus = false, placeholder, onBlur, className, title, data, hint, }) => {
|
|
8
|
+
const TextWithoutLabel = ({ onValueChange = emptyFn, defaultValue, validationState, readonly = false, disabled = false, name = generateGuid(), size = ElementSize.Normal, style, rounded = false, loading = false, autoFocus = false, placeholder, onBlur, onKeyDown, onKeyUp, className, title, data, hint, }) => {
|
|
9
9
|
const onChange = useCallback((event) => onValueChange(event.target.value), [onValueChange]);
|
|
10
10
|
const elClassName = getClassName([
|
|
11
11
|
className,
|
|
12
|
-
size
|
|
12
|
+
getSizeClassName(size, ElementSize.Normal),
|
|
13
13
|
rounded ? "is-rounded" : "",
|
|
14
14
|
getStyleClassName(style, validationState),
|
|
15
15
|
"input",
|
|
@@ -19,9 +19,7 @@ const TextWithoutLabel = ({ onValueChange = emptyFn, defaultValue, validationSta
|
|
|
19
19
|
"bbr-input",
|
|
20
20
|
loading ? "is-loading" : "",
|
|
21
21
|
]);
|
|
22
|
-
const dataAttributes =
|
|
23
|
-
|
|
24
|
-
: mapDataAttributes(data);
|
|
25
|
-
return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: containerClassName, children: _jsx("input", { type: "text", id: name, name: name, onBlur: onBlur, readOnly: readonly, disabled: disabled, onChange: onChange, className: elClassName, placeholder: placeholder, defaultValue: defaultValue, autoFocus: autoFocus, title: title, ...dataAttributes }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
22
|
+
const dataAttributes = mapDataAttributes(data);
|
|
23
|
+
return (_jsxs("div", { className: "bbr-field field", children: [_jsx("div", { className: containerClassName, children: _jsx("input", { id: name, type: "text", name: name, title: title, onBlur: onBlur, onKeyUp: onKeyUp, readOnly: readonly, disabled: disabled, onChange: onChange, ...dataAttributes, onKeyDown: onKeyDown, autoFocus: autoFocus, className: elClassName, placeholder: placeholder, defaultValue: defaultValue }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
26
24
|
};
|
|
27
25
|
export default TextWithoutLabel;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/text/index.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/text/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { BaseNotNullableInputElementProps, BlurableElement } from "../../../types";
|
|
1
|
+
import { BaseNotNullableInputElementProps, BlurableElement, KeyboardElement } from "../../../types";
|
|
2
2
|
/** Text input component props type */
|
|
3
|
-
export type TextProps = BaseNotNullableInputElementProps<string> & BlurableElement;
|
|
3
|
+
export type TextProps = BaseNotNullableInputElementProps<string> & BlurableElement & KeyboardElement;
|
|
4
4
|
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/text/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/text/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAEhG,sCAAsC;AACtC,MAAM,MAAM,SAAS,GACf,gCAAgC,CAAC,MAAM,CAAC,GACxC,eAAe,GACf,eAAe,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/progress/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAE,MAAM,OAAO,CAAC;AAO3B,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAEzC,gCAAgC;AAChC,QAAA,MAAM,QAAQ,EAAE,EAAE,CAAC,aAAa,CA2F/B,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { getClassName, isNullish } from "@bodynarf/utils";
|
|
3
|
+
import { ElementColor, ElementSize } from "../../../types";
|
|
4
|
+
import { getElementColorClassName, getSizeClassName, mapDataAttributes } from "../../../utils";
|
|
5
|
+
import "./style.scss";
|
|
6
|
+
/** Progress/Loader component */
|
|
7
|
+
const Progress = ({ value, min = 0, max = 100, size = ElementSize.Normal, color = ElementColor.Primary, showValue = true, indeterminate = false, loadingText = "Loading...", animated = true, className, title, data, }) => {
|
|
8
|
+
if (indeterminate) {
|
|
9
|
+
const elClassName = getClassName([
|
|
10
|
+
"bbr-progress",
|
|
11
|
+
"bbr-progress--indeterminate",
|
|
12
|
+
className,
|
|
13
|
+
getElementColorClassName(color),
|
|
14
|
+
getSizeClassName(size),
|
|
15
|
+
]);
|
|
16
|
+
const dataAttributes = mapDataAttributes(data);
|
|
17
|
+
return (_jsxs("div", { children: [_jsx("div", { title: title, ...dataAttributes, className: elClassName }), !!showValue && (_jsx("div", { className: "bbr-progress-value", children: loadingText }))] }));
|
|
18
|
+
}
|
|
19
|
+
const percentage = isNullish(value) ? 0 : Math.min(max, Math.max(min, value));
|
|
20
|
+
const displayValue = Math.round(((percentage - min) / (max - min)) * 100);
|
|
21
|
+
const progressValue = ((percentage - min) / (max - min)) * max;
|
|
22
|
+
const elClassName = getClassName([
|
|
23
|
+
"bbr-progress",
|
|
24
|
+
animated ? "bbr-progress--animated" : "",
|
|
25
|
+
getElementColorClassName(color),
|
|
26
|
+
getSizeClassName(size),
|
|
27
|
+
className,
|
|
28
|
+
]);
|
|
29
|
+
const dataAttributes = mapDataAttributes(data);
|
|
30
|
+
return (_jsxs("div", { children: [animated ? (_jsx("div", { title: title, "data-min": min, "data-max": max, ...dataAttributes, className: elClassName, "data-value": progressValue, children: _jsx("div", { className: "bbr-progress-fill", style: {
|
|
31
|
+
width: `${(progressValue / max) * 100}%`
|
|
32
|
+
} }) })) : (_jsx("progress", { max: max, title: title, "data-min": min, ...dataAttributes, value: progressValue, className: elClassName })), !!showValue && (_jsxs("div", { className: "bbr-progress-value", children: [displayValue, "%"] }))] }));
|
|
33
|
+
};
|
|
34
|
+
export default Progress;
|
|
@@ -0,0 +1,211 @@
|
|
|
1
|
+
// Bulma variables
|
|
2
|
+
$black: #0a0a0a !default;
|
|
3
|
+
$white: #fff !default;
|
|
4
|
+
$light: #f5f5f5 !default;
|
|
5
|
+
$dark: #363636 !default;
|
|
6
|
+
$primary: #485fc7 !default;
|
|
7
|
+
$link: #485fc7 !default;
|
|
8
|
+
$info: #3e8ed0 !default;
|
|
9
|
+
$success: #48c78e !default;
|
|
10
|
+
$warning: #ffe08a !default;
|
|
11
|
+
$danger: #f14668 !default;
|
|
12
|
+
$text: #4a4a4a !default;
|
|
13
|
+
$background: #f5f5f5 !default;
|
|
14
|
+
$radius: 4px !default;
|
|
15
|
+
$speed: 0.25s !default;
|
|
16
|
+
|
|
17
|
+
$size-small: 0.75rem !default;
|
|
18
|
+
$size-normal: 1rem !default;
|
|
19
|
+
$size-medium: 1.25rem !default;
|
|
20
|
+
$size-large: 1.5rem !default;
|
|
21
|
+
|
|
22
|
+
// Size map
|
|
23
|
+
$sizes: (
|
|
24
|
+
"small": $size-small,
|
|
25
|
+
"normal": $size-normal,
|
|
26
|
+
"medium": $size-medium,
|
|
27
|
+
"large": $size-large
|
|
28
|
+
);
|
|
29
|
+
|
|
30
|
+
// Color map
|
|
31
|
+
$colors: (
|
|
32
|
+
"primary": $primary,
|
|
33
|
+
"link": $link,
|
|
34
|
+
"info": $info,
|
|
35
|
+
"success": $success,
|
|
36
|
+
"warning": $warning,
|
|
37
|
+
"danger": $danger
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
// Mixins for common styles
|
|
41
|
+
@mixin progress-colors($color) {
|
|
42
|
+
&::-webkit-progress-value {
|
|
43
|
+
background-color: $color;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
&::-moz-progress-bar {
|
|
47
|
+
background-color: $color;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
@mixin indeterminate-colors($color) {
|
|
52
|
+
&::after {
|
|
53
|
+
background-color: $color;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
@mixin custom-progress-colors($color) {
|
|
58
|
+
.bbr-progress-fill {
|
|
59
|
+
background-color: $color;
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
.bbr-progress {
|
|
64
|
+
width: 100%;
|
|
65
|
+
appearance: none;
|
|
66
|
+
height: $size-normal;
|
|
67
|
+
border: none;
|
|
68
|
+
border-radius: $radius;
|
|
69
|
+
background-color: $background;
|
|
70
|
+
overflow: hidden;
|
|
71
|
+
|
|
72
|
+
// Custom progress bar for animation
|
|
73
|
+
&.bbr-progress--animated {
|
|
74
|
+
position: relative;
|
|
75
|
+
background-color: $background;
|
|
76
|
+
|
|
77
|
+
.bbr-progress-fill {
|
|
78
|
+
height: 100%;
|
|
79
|
+
background-color: $primary;
|
|
80
|
+
border-radius: $radius;
|
|
81
|
+
transition: width $speed;
|
|
82
|
+
animation: bbr-progress-animated 1s linear infinite;
|
|
83
|
+
background-image: linear-gradient(
|
|
84
|
+
45deg,
|
|
85
|
+
rgba(255, 255, 255, 0.2) 25%,
|
|
86
|
+
transparent 25%,
|
|
87
|
+
transparent 50%,
|
|
88
|
+
rgba(255, 255, 255, 0.2) 50%,
|
|
89
|
+
rgba(255, 255, 255, 0.2) 75%,
|
|
90
|
+
transparent 75%,
|
|
91
|
+
transparent
|
|
92
|
+
);
|
|
93
|
+
background-size: 1rem 1rem;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
// Colors for custom progress bar
|
|
97
|
+
@each $name, $color in $colors {
|
|
98
|
+
&.is-#{$name} {
|
|
99
|
+
@include custom-progress-colors($color);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
&::-webkit-progress-bar {
|
|
105
|
+
background-color: $background;
|
|
106
|
+
border-radius: $radius;
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
&::-webkit-progress-value {
|
|
110
|
+
background-color: $primary;
|
|
111
|
+
border-radius: $radius;
|
|
112
|
+
transition: width $speed;
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&::-moz-progress-bar {
|
|
116
|
+
background-color: $primary;
|
|
117
|
+
border-radius: $radius;
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&-value {
|
|
121
|
+
margin-top: 0.25rem;
|
|
122
|
+
font-size: $size-small;
|
|
123
|
+
color: $text;
|
|
124
|
+
text-align: center;
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
@each $name, $size in $sizes {
|
|
128
|
+
&.is-#{$name} {
|
|
129
|
+
height: $size;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
@each $name, $color in $colors {
|
|
134
|
+
&.is-#{$name} {
|
|
135
|
+
@include progress-colors($color);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
&--animated {
|
|
140
|
+
&::-webkit-progress-value {
|
|
141
|
+
animation: bbr-progress-animated 2s linear infinite;
|
|
142
|
+
background-image: linear-gradient(
|
|
143
|
+
45deg,
|
|
144
|
+
rgba(255, 255, 255, 0.2) 25%,
|
|
145
|
+
transparent 25%,
|
|
146
|
+
transparent 50%,
|
|
147
|
+
rgba(255, 255, 255, 0.2) 50%,
|
|
148
|
+
rgba(255, 255, 255, 0.2) 75%,
|
|
149
|
+
transparent 75%,
|
|
150
|
+
transparent
|
|
151
|
+
);
|
|
152
|
+
background-size: 1rem 1rem;
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
&::-moz-progress-bar {
|
|
156
|
+
animation: bbr-progress-animated 2s linear infinite;
|
|
157
|
+
background-image: linear-gradient(
|
|
158
|
+
45deg,
|
|
159
|
+
rgba(255, 255, 255, 0.2) 25%,
|
|
160
|
+
transparent 25%,
|
|
161
|
+
transparent 50%,
|
|
162
|
+
rgba(255, 255, 255, 0.2) 50%,
|
|
163
|
+
rgba(255, 255, 255, 0.2) 75%,
|
|
164
|
+
transparent 75%,
|
|
165
|
+
transparent
|
|
166
|
+
);
|
|
167
|
+
background-size: 1rem 1rem;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
&--indeterminate {
|
|
172
|
+
position: relative;
|
|
173
|
+
background-color: $background;
|
|
174
|
+
|
|
175
|
+
&::after {
|
|
176
|
+
content: "";
|
|
177
|
+
position: absolute;
|
|
178
|
+
top: 0;
|
|
179
|
+
left: 0;
|
|
180
|
+
bottom: 0;
|
|
181
|
+
width: 50%;
|
|
182
|
+
background-color: $primary;
|
|
183
|
+
border-radius: $radius;
|
|
184
|
+
animation: bbr-progress-indeterminate 1.5s ease-in-out infinite;
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
@each $name, $color in $colors {
|
|
188
|
+
&.is-#{$name} {
|
|
189
|
+
@include indeterminate-colors($color);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
@keyframes bbr-progress-animated {
|
|
196
|
+
0% {
|
|
197
|
+
background-position: 0 0;
|
|
198
|
+
}
|
|
199
|
+
100% {
|
|
200
|
+
background-position: 1rem 0;
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
@keyframes bbr-progress-indeterminate {
|
|
205
|
+
0% {
|
|
206
|
+
left: -50%;
|
|
207
|
+
}
|
|
208
|
+
100% {
|
|
209
|
+
left: 100%;
|
|
210
|
+
}
|
|
211
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/progress/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|