@bodynarf/react.components 1.13.8 → 1.14.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/changelog.md +55 -0
- package/components/accordion/component/index.js +1 -1
- package/components/accordion/component/style.css +21 -0
- package/components/anchor/component/style.css +12 -0
- package/components/button/component/style.css +10 -0
- package/components/dropdown/component/style.css +101 -0
- package/components/dropdown/components/compact/index.d.ts.map +1 -1
- package/components/dropdown/components/compact/index.js +3 -3
- package/components/dropdown/components/label/components/empty/index.js +1 -1
- package/components/dropdown/components/label/components/withSearch/style.css +21 -0
- package/components/dropdown/types.d.ts +6 -6
- package/components/dropdown/types.d.ts.map +1 -1
- package/components/file/component/styles.css +74 -0
- package/components/icon/component/style.css +19 -0
- package/components/index.d.ts +14 -2
- package/components/index.d.ts.map +1 -1
- package/components/index.js +14 -2
- package/components/modal/component/index.d.ts +7 -0
- package/components/modal/component/index.d.ts.map +1 -0
- package/components/modal/component/index.js +42 -0
- package/components/modal/component/style.css +32 -0
- package/components/modal/component/style.scss +42 -0
- package/components/modal/index.d.ts +3 -0
- package/components/modal/index.d.ts.map +1 -0
- package/components/modal/index.js +2 -0
- package/components/modal/types.d.ts +44 -0
- package/components/modal/types.d.ts.map +1 -0
- package/components/modal/types.js +1 -0
- package/components/multiselect/component/style.css +20 -0
- package/components/multiselect/components/withoutLabel/index.d.ts.map +1 -1
- package/components/multiselect/components/withoutLabel/index.js +5 -5
- package/components/primitives/checkbox/component/style.css +19 -0
- package/components/primitives/color/component/style.css +15 -0
- package/components/primitives/date/component/style.css +9 -0
- package/components/primitives/index.d.ts +4 -0
- package/components/primitives/index.d.ts.map +1 -1
- package/components/primitives/index.js +4 -0
- package/components/primitives/internal/hint/style.css +4 -0
- package/components/primitives/number/components/withLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withLabel/index.js +10 -2
- package/components/primitives/number/components/withoutLabel/index.d.ts.map +1 -1
- package/components/primitives/number/components/withoutLabel/index.js +12 -4
- package/components/primitives/number/types.d.ts +6 -0
- package/components/primitives/number/types.d.ts.map +1 -1
- package/components/primitives/password/component/style.css +10 -0
- package/components/primitives/radioGroup/component/index.d.ts +7 -0
- package/components/primitives/radioGroup/component/index.d.ts.map +1 -0
- package/components/primitives/radioGroup/component/index.js +42 -0
- package/components/primitives/radioGroup/component/style.css +382 -0
- package/components/primitives/radioGroup/component/style.scss +271 -0
- package/components/primitives/radioGroup/index.d.ts +3 -0
- package/components/primitives/radioGroup/index.d.ts.map +1 -0
- package/components/primitives/radioGroup/index.js +2 -0
- package/components/primitives/radioGroup/types.d.ts +61 -0
- package/components/primitives/radioGroup/types.d.ts.map +1 -0
- package/components/primitives/radioGroup/types.js +1 -0
- package/components/primitives/slider/component/index.d.ts +7 -0
- package/components/primitives/slider/component/index.d.ts.map +1 -0
- package/components/primitives/slider/component/index.js +47 -0
- package/components/primitives/slider/component/style.css +438 -0
- package/components/primitives/slider/component/style.scss +321 -0
- package/components/primitives/slider/index.d.ts +3 -0
- package/components/primitives/slider/index.d.ts.map +1 -0
- package/components/primitives/slider/index.js +2 -0
- package/components/primitives/slider/types.d.ts +51 -0
- package/components/primitives/slider/types.d.ts.map +1 -0
- package/components/primitives/slider/types.js +1 -0
- package/components/primitives/switch/component/index.d.ts +7 -0
- package/components/primitives/switch/component/index.d.ts.map +1 -0
- package/components/primitives/switch/component/index.js +39 -0
- package/components/primitives/switch/component/style.css +482 -0
- package/components/primitives/switch/component/style.scss +216 -0
- package/components/primitives/switch/index.d.ts +3 -0
- package/components/primitives/switch/index.d.ts.map +1 -0
- package/components/primitives/switch/index.js +2 -0
- package/components/primitives/switch/types.d.ts +23 -0
- package/components/primitives/switch/types.d.ts.map +1 -0
- package/components/primitives/switch/types.js +1 -0
- package/components/primitives/timePicker/component/index.d.ts +8 -0
- package/components/primitives/timePicker/component/index.d.ts.map +1 -0
- package/components/primitives/timePicker/component/index.js +65 -0
- package/components/primitives/timePicker/component/style.css +21 -0
- package/components/primitives/timePicker/component/style.scss +26 -0
- package/components/primitives/timePicker/index.d.ts +3 -0
- package/components/primitives/timePicker/index.d.ts.map +1 -0
- package/components/primitives/timePicker/index.js +2 -0
- package/components/primitives/timePicker/types.d.ts +33 -0
- package/components/primitives/timePicker/types.d.ts.map +1 -0
- package/components/primitives/timePicker/types.js +1 -0
- package/components/progress/component/style.css +167 -0
- package/components/search/component/index.d.ts.map +1 -1
- package/components/search/component/index.js +9 -3
- package/components/search/component/style.css +18 -0
- package/components/search/types.d.ts +5 -0
- package/components/search/types.d.ts.map +1 -1
- package/components/stepper/component/index.d.ts +7 -0
- package/components/stepper/component/index.d.ts.map +1 -0
- package/components/stepper/component/index.js +56 -0
- package/components/stepper/component/style.css +510 -0
- package/components/stepper/component/style.scss +432 -0
- package/components/stepper/index.d.ts +3 -0
- package/components/stepper/index.d.ts.map +1 -0
- package/components/stepper/index.js +2 -0
- package/components/stepper/types.d.ts +65 -0
- package/components/stepper/types.d.ts.map +1 -0
- package/components/stepper/types.js +1 -0
- package/components/table/component/style.css +14 -0
- package/components/tabs/component/style.css +6 -0
- package/components/tag/component/style.css +19 -0
- package/components/timeline/component/index.d.ts +7 -0
- package/components/timeline/component/index.d.ts.map +1 -0
- package/components/timeline/component/index.js +36 -0
- package/components/timeline/component/style.css +488 -0
- package/components/timeline/component/style.scss +397 -0
- package/components/timeline/index.d.ts +3 -0
- package/components/timeline/index.d.ts.map +1 -0
- package/components/timeline/index.js +2 -0
- package/components/timeline/types.d.ts +55 -0
- package/components/timeline/types.d.ts.map +1 -0
- package/components/timeline/types.js +1 -0
- package/components/tooltip/component/index.d.ts +6 -0
- package/components/tooltip/component/index.d.ts.map +1 -0
- package/components/tooltip/component/index.js +80 -0
- package/components/tooltip/index.d.ts +3 -0
- package/components/tooltip/index.d.ts.map +1 -0
- package/components/tooltip/index.js +2 -0
- package/components/tooltip/types.d.ts +31 -0
- package/components/tooltip/types.d.ts.map +1 -0
- package/components/tooltip/types.js +1 -0
- package/package.json +10 -3
- package/readme.md +18 -3
- package/tsconfig.tsbuildinfo +1 -1
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { BaseNotNullableInputElementProps, LabelConfiguration } from "../../../types";
|
|
2
|
+
/** Switch/Toggle component props type */
|
|
3
|
+
export type SwitchProps = Omit<BaseNotNullableInputElementProps<boolean>, "readonly" | "validationState" | "loading" | "placeholder" | "hint" | "autofocus" | "label"> & {
|
|
4
|
+
/** Label configuration */
|
|
5
|
+
label?: Omit<LabelConfiguration, "horizontal"> & Partial<Pick<LabelConfiguration, "horizontal">>;
|
|
6
|
+
/** Display switch with rounded edges (pill-shaped) */
|
|
7
|
+
rounded?: boolean;
|
|
8
|
+
/** Display switch with outlined style */
|
|
9
|
+
outlined?: boolean;
|
|
10
|
+
/** Display switch as thin variant */
|
|
11
|
+
thin?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Right-to-left mode.
|
|
14
|
+
* Switch will be displayed on the right side of the label
|
|
15
|
+
*/
|
|
16
|
+
rtl?: boolean;
|
|
17
|
+
/**
|
|
18
|
+
* Display component with label as form element.
|
|
19
|
+
* Label will be placed at left
|
|
20
|
+
*/
|
|
21
|
+
isFormLabel?: boolean;
|
|
22
|
+
};
|
|
23
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/switch/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gCAAgC,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAElF,yCAAyC;AACzC,MAAM,MAAM,WAAW,GAAG,IAAI,CAAC,gCAAgC,CAAC,OAAO,CAAC,EAClE,UAAU,GAAG,iBAAiB,GAC9B,SAAS,GAAG,aAAa,GACzB,MAAM,GAAG,WAAW,GACpB,OAAO,CACZ,GAAG;IACA,0BAA0B;IAC1B,KAAK,CAAC,EAAE,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,GAAG,OAAO,CAAC,IAAI,CAAC,kBAAkB,EAAE,YAAY,CAAC,CAAC,CAAC;IAEjG,sDAAsD;IACtD,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,yCAAyC;IACzC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,qCAAqC;IACrC,IAAI,CAAC,EAAE,OAAO,CAAC;IAEf;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAC;IAEd;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACzB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FC } from "react";
|
|
2
|
+
import { LabeledElement } from "../../../../types";
|
|
3
|
+
import "./style.scss";
|
|
4
|
+
import { TimePickerProps } from "../types";
|
|
5
|
+
/** TimePicker input component */
|
|
6
|
+
declare const TimePicker: FC<Omit<TimePickerProps, "label"> & LabeledElement>;
|
|
7
|
+
export default TimePicker;
|
|
8
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/primitives/timePicker/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAwB,MAAM,OAAO,CAAC;AAI9D,OAAO,EAAe,cAAc,EAAE,MAAM,YAAY,CAAC;AAKzD,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAE,eAAe,EAAa,MAAM,UAAU,CAAC;AA+CtD,iCAAiC;AACjC,QAAA,MAAM,UAAU,EAAE,EAAE,CAChB,IAAI,CAAC,eAAe,EAAE,OAAO,CAAC,GAAG,cAAc,CA6FlD,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
3
|
+
import { emptyFn, generateGuid, getClassName, isNullish, isStringEmpty } from "@bodynarf/utils";
|
|
4
|
+
import { ElementSize } from "../../../../types";
|
|
5
|
+
import { getSizeClassName, getStyleClassName, mapDataAttributes } from "../../../../utils";
|
|
6
|
+
import ComponentWithLabel from "../../internal/componentWithLabel";
|
|
7
|
+
import InternalHint from "../../internal/hint";
|
|
8
|
+
import "./style.scss";
|
|
9
|
+
/** Parse time string to TimeValue */
|
|
10
|
+
const parseTimeString = (timeString, showSeconds) => {
|
|
11
|
+
if (isStringEmpty(timeString)) {
|
|
12
|
+
return undefined;
|
|
13
|
+
}
|
|
14
|
+
const parts = timeString.split(":");
|
|
15
|
+
if (parts.length < 2) {
|
|
16
|
+
return undefined;
|
|
17
|
+
}
|
|
18
|
+
const hours = parseInt(parts[0], 10);
|
|
19
|
+
const minutes = parseInt(parts[1], 10);
|
|
20
|
+
const seconds = showSeconds && parts.length >= 3 ? parseInt(parts[2], 10) : undefined;
|
|
21
|
+
if (isNaN(hours) || isNaN(minutes)) {
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
return {
|
|
25
|
+
hours,
|
|
26
|
+
minutes,
|
|
27
|
+
seconds: showSeconds ? (seconds ?? 0) : undefined,
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
/** Format TimeValue to string */
|
|
31
|
+
const formatTimeValue = (value, showSeconds) => {
|
|
32
|
+
if (isNullish(value)) {
|
|
33
|
+
return "";
|
|
34
|
+
}
|
|
35
|
+
const hours = value.hours.toString().padStart(2, "0");
|
|
36
|
+
const minutes = value.minutes.toString().padStart(2, "0");
|
|
37
|
+
if (showSeconds) {
|
|
38
|
+
const seconds = (value.seconds ?? 0).toString().padStart(2, "0");
|
|
39
|
+
return `${hours}:${minutes}:${seconds}`;
|
|
40
|
+
}
|
|
41
|
+
return `${hours}:${minutes}`;
|
|
42
|
+
};
|
|
43
|
+
/** TimePicker input component */
|
|
44
|
+
const TimePicker = ({ defaultValue, onValueChange = emptyFn, validationState, name = generateGuid(), style, size = ElementSize.Normal, readonly = false, disabled = false, rounded = false, loading = false, autoFocus = false, label, onBlur, onKeyDown, onKeyUp, showSeconds = false, step = 1, min, max, placeholder, className, title, data, hint, }) => {
|
|
45
|
+
const elClassName = useMemo(() => getClassName([
|
|
46
|
+
className,
|
|
47
|
+
getSizeClassName(size, ElementSize.Normal),
|
|
48
|
+
getStyleClassName(style, validationState),
|
|
49
|
+
rounded === true ? "is-rounded" : "",
|
|
50
|
+
"input",
|
|
51
|
+
"bbr-time-picker",
|
|
52
|
+
]), [className, size, style, validationState, rounded]);
|
|
53
|
+
const inputContainerClassName = useMemo(() => getClassName([
|
|
54
|
+
"control",
|
|
55
|
+
loading === true ? "is-loading" : "",
|
|
56
|
+
]), [loading]);
|
|
57
|
+
const stringifiedDefValue = useMemo(() => formatTimeValue(defaultValue, showSeconds), [defaultValue, showSeconds]);
|
|
58
|
+
const onChange = useCallback((event) => {
|
|
59
|
+
const parsed = parseTimeString(event.target.value, showSeconds);
|
|
60
|
+
onValueChange(parsed);
|
|
61
|
+
}, [onValueChange, showSeconds]);
|
|
62
|
+
const dataAttributes = mapDataAttributes(data);
|
|
63
|
+
return (_jsxs(ComponentWithLabel, { id: name, size: size, label: label, children: [_jsx("div", { className: inputContainerClassName, children: _jsx("input", { id: name, min: min, max: max, type: "time", name: name, title: title, onBlur: onBlur, onKeyUp: onKeyUp, ...dataAttributes, onChange: onChange, readOnly: readonly, disabled: disabled, onKeyDown: onKeyDown, autoFocus: autoFocus, className: elClassName, placeholder: placeholder, defaultValue: stringifiedDefValue, step: showSeconds === true ? step : step * 60 }) }), _jsx(InternalHint, { hint: hint, validationState: validationState })] }));
|
|
64
|
+
};
|
|
65
|
+
export default TimePicker;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.control.is-loading input[type=time]::-webkit-calendar-picker-indicator {
|
|
2
|
+
display: none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.control input[type=time] {
|
|
6
|
+
padding-right: 2.5rem;
|
|
7
|
+
}
|
|
8
|
+
.control input[type=time]::-webkit-calendar-picker-indicator {
|
|
9
|
+
position: absolute;
|
|
10
|
+
right: 0.75rem;
|
|
11
|
+
cursor: pointer;
|
|
12
|
+
}
|
|
13
|
+
.control input[type=time].is-small {
|
|
14
|
+
padding-right: 2rem;
|
|
15
|
+
}
|
|
16
|
+
.control input[type=time].is-medium {
|
|
17
|
+
padding-right: 3rem;
|
|
18
|
+
}
|
|
19
|
+
.control input[type=time].is-large {
|
|
20
|
+
padding-right: 3.5rem;
|
|
21
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
.control.is-loading input[type="time"]::-webkit-calendar-picker-indicator {
|
|
2
|
+
display: none;
|
|
3
|
+
}
|
|
4
|
+
|
|
5
|
+
.control input[type="time"] {
|
|
6
|
+
// Extra padding for AM/PM text to not overlap with clock icon
|
|
7
|
+
padding-right: 2.5rem;
|
|
8
|
+
|
|
9
|
+
&::-webkit-calendar-picker-indicator {
|
|
10
|
+
position: absolute;
|
|
11
|
+
right: 0.75rem;
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
&.is-small {
|
|
16
|
+
padding-right: 2rem;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&.is-medium {
|
|
20
|
+
padding-right: 3rem;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
&.is-large {
|
|
24
|
+
padding-right: 3.5rem;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/timePicker/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AACtC,cAAc,SAAS,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { BaseNullableInputElementProps, BlurableElement, KeyboardElement } from "../../../types";
|
|
2
|
+
/** Time value representation */
|
|
3
|
+
export interface TimeValue {
|
|
4
|
+
/** Hours (0-23) */
|
|
5
|
+
hours: number;
|
|
6
|
+
/** Minutes (0-59) */
|
|
7
|
+
minutes: number;
|
|
8
|
+
/** Seconds (0-59), optional */
|
|
9
|
+
seconds?: number;
|
|
10
|
+
}
|
|
11
|
+
/** TimePicker component props type */
|
|
12
|
+
export type TimePickerProps = BaseNullableInputElementProps<TimeValue> & BlurableElement & KeyboardElement & {
|
|
13
|
+
/**
|
|
14
|
+
* Show seconds input.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
showSeconds?: boolean;
|
|
18
|
+
/**
|
|
19
|
+
* Step for minutes (and seconds if shown).
|
|
20
|
+
* See html input step documentation.
|
|
21
|
+
* @default 1
|
|
22
|
+
*/
|
|
23
|
+
step?: number;
|
|
24
|
+
/**
|
|
25
|
+
* Minimum time value (format: "HH:MM" or "HH:MM:SS").
|
|
26
|
+
*/
|
|
27
|
+
min?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Maximum time value (format: "HH:MM" or "HH:MM:SS").
|
|
30
|
+
*/
|
|
31
|
+
max?: string;
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/timePicker/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,6BAA6B,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAE7F,gCAAgC;AAChC,MAAM,WAAW,SAAS;IACtB,mBAAmB;IACnB,KAAK,EAAE,MAAM,CAAC;IAEd,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAEhB,+BAA+B;IAC/B,OAAO,CAAC,EAAE,MAAM,CAAC;CACpB;AAED,sCAAsC;AACtC,MAAM,MAAM,eAAe,GAAG,6BAA6B,CAAC,SAAS,CAAC,GAChE,eAAe,GACf,eAAe,GACf;IACE;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IAEtB;;;;OAIG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;IAEb;;OAEG;IACH,GAAG,CAAC,EAAE,MAAM,CAAC;CAChB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,167 @@
|
|
|
1
|
+
.bbr-progress {
|
|
2
|
+
width: 100%;
|
|
3
|
+
appearance: none;
|
|
4
|
+
height: 1rem;
|
|
5
|
+
border: none;
|
|
6
|
+
border-radius: 4px;
|
|
7
|
+
background-color: #f5f5f5;
|
|
8
|
+
overflow: hidden;
|
|
9
|
+
}
|
|
10
|
+
.bbr-progress.bbr-progress--animated {
|
|
11
|
+
position: relative;
|
|
12
|
+
background-color: #f5f5f5;
|
|
13
|
+
}
|
|
14
|
+
.bbr-progress.bbr-progress--animated .bbr-progress-fill {
|
|
15
|
+
height: 100%;
|
|
16
|
+
background-color: #485fc7;
|
|
17
|
+
border-radius: 4px;
|
|
18
|
+
transition: width 0.25s;
|
|
19
|
+
animation: bbr-progress-animated 1s linear infinite;
|
|
20
|
+
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);
|
|
21
|
+
background-size: 1rem 1rem;
|
|
22
|
+
}
|
|
23
|
+
.bbr-progress.bbr-progress--animated.is-primary .bbr-progress-fill {
|
|
24
|
+
background-color: #485fc7;
|
|
25
|
+
}
|
|
26
|
+
.bbr-progress.bbr-progress--animated.is-link .bbr-progress-fill {
|
|
27
|
+
background-color: #485fc7;
|
|
28
|
+
}
|
|
29
|
+
.bbr-progress.bbr-progress--animated.is-info .bbr-progress-fill {
|
|
30
|
+
background-color: #3e8ed0;
|
|
31
|
+
}
|
|
32
|
+
.bbr-progress.bbr-progress--animated.is-success .bbr-progress-fill {
|
|
33
|
+
background-color: #48c78e;
|
|
34
|
+
}
|
|
35
|
+
.bbr-progress.bbr-progress--animated.is-warning .bbr-progress-fill {
|
|
36
|
+
background-color: #ffe08a;
|
|
37
|
+
}
|
|
38
|
+
.bbr-progress.bbr-progress--animated.is-danger .bbr-progress-fill {
|
|
39
|
+
background-color: #f14668;
|
|
40
|
+
}
|
|
41
|
+
.bbr-progress::-webkit-progress-bar {
|
|
42
|
+
background-color: #f5f5f5;
|
|
43
|
+
border-radius: 4px;
|
|
44
|
+
}
|
|
45
|
+
.bbr-progress::-webkit-progress-value {
|
|
46
|
+
background-color: #485fc7;
|
|
47
|
+
border-radius: 4px;
|
|
48
|
+
transition: width 0.25s;
|
|
49
|
+
}
|
|
50
|
+
.bbr-progress::-moz-progress-bar {
|
|
51
|
+
background-color: #485fc7;
|
|
52
|
+
border-radius: 4px;
|
|
53
|
+
}
|
|
54
|
+
.bbr-progress-value {
|
|
55
|
+
margin-top: 0.25rem;
|
|
56
|
+
font-size: 0.75rem;
|
|
57
|
+
color: #4a4a4a;
|
|
58
|
+
text-align: center;
|
|
59
|
+
}
|
|
60
|
+
.bbr-progress.is-small {
|
|
61
|
+
height: 0.75rem;
|
|
62
|
+
}
|
|
63
|
+
.bbr-progress.is-normal {
|
|
64
|
+
height: 1rem;
|
|
65
|
+
}
|
|
66
|
+
.bbr-progress.is-medium {
|
|
67
|
+
height: 1.25rem;
|
|
68
|
+
}
|
|
69
|
+
.bbr-progress.is-large {
|
|
70
|
+
height: 1.5rem;
|
|
71
|
+
}
|
|
72
|
+
.bbr-progress.is-primary::-webkit-progress-value {
|
|
73
|
+
background-color: #485fc7;
|
|
74
|
+
}
|
|
75
|
+
.bbr-progress.is-primary::-moz-progress-bar {
|
|
76
|
+
background-color: #485fc7;
|
|
77
|
+
}
|
|
78
|
+
.bbr-progress.is-link::-webkit-progress-value {
|
|
79
|
+
background-color: #485fc7;
|
|
80
|
+
}
|
|
81
|
+
.bbr-progress.is-link::-moz-progress-bar {
|
|
82
|
+
background-color: #485fc7;
|
|
83
|
+
}
|
|
84
|
+
.bbr-progress.is-info::-webkit-progress-value {
|
|
85
|
+
background-color: #3e8ed0;
|
|
86
|
+
}
|
|
87
|
+
.bbr-progress.is-info::-moz-progress-bar {
|
|
88
|
+
background-color: #3e8ed0;
|
|
89
|
+
}
|
|
90
|
+
.bbr-progress.is-success::-webkit-progress-value {
|
|
91
|
+
background-color: #48c78e;
|
|
92
|
+
}
|
|
93
|
+
.bbr-progress.is-success::-moz-progress-bar {
|
|
94
|
+
background-color: #48c78e;
|
|
95
|
+
}
|
|
96
|
+
.bbr-progress.is-warning::-webkit-progress-value {
|
|
97
|
+
background-color: #ffe08a;
|
|
98
|
+
}
|
|
99
|
+
.bbr-progress.is-warning::-moz-progress-bar {
|
|
100
|
+
background-color: #ffe08a;
|
|
101
|
+
}
|
|
102
|
+
.bbr-progress.is-danger::-webkit-progress-value {
|
|
103
|
+
background-color: #f14668;
|
|
104
|
+
}
|
|
105
|
+
.bbr-progress.is-danger::-moz-progress-bar {
|
|
106
|
+
background-color: #f14668;
|
|
107
|
+
}
|
|
108
|
+
.bbr-progress--animated::-webkit-progress-value {
|
|
109
|
+
animation: bbr-progress-animated 2s linear infinite;
|
|
110
|
+
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);
|
|
111
|
+
background-size: 1rem 1rem;
|
|
112
|
+
}
|
|
113
|
+
.bbr-progress--animated::-moz-progress-bar {
|
|
114
|
+
animation: bbr-progress-animated 2s linear infinite;
|
|
115
|
+
background-image: linear-gradient(45deg, rgba(255, 255, 255, 0.2) 25%, transparent 25%, transparent 50%, rgba(255, 255, 255, 0.2) 50%, rgba(255, 255, 255, 0.2) 75%, transparent 75%, transparent);
|
|
116
|
+
background-size: 1rem 1rem;
|
|
117
|
+
}
|
|
118
|
+
.bbr-progress--indeterminate {
|
|
119
|
+
position: relative;
|
|
120
|
+
background-color: #f5f5f5;
|
|
121
|
+
}
|
|
122
|
+
.bbr-progress--indeterminate::after {
|
|
123
|
+
content: "";
|
|
124
|
+
position: absolute;
|
|
125
|
+
top: 0;
|
|
126
|
+
left: 0;
|
|
127
|
+
bottom: 0;
|
|
128
|
+
width: 50%;
|
|
129
|
+
background-color: #485fc7;
|
|
130
|
+
border-radius: 4px;
|
|
131
|
+
animation: bbr-progress-indeterminate 1.5s ease-in-out infinite;
|
|
132
|
+
}
|
|
133
|
+
.bbr-progress--indeterminate.is-primary::after {
|
|
134
|
+
background-color: #485fc7;
|
|
135
|
+
}
|
|
136
|
+
.bbr-progress--indeterminate.is-link::after {
|
|
137
|
+
background-color: #485fc7;
|
|
138
|
+
}
|
|
139
|
+
.bbr-progress--indeterminate.is-info::after {
|
|
140
|
+
background-color: #3e8ed0;
|
|
141
|
+
}
|
|
142
|
+
.bbr-progress--indeterminate.is-success::after {
|
|
143
|
+
background-color: #48c78e;
|
|
144
|
+
}
|
|
145
|
+
.bbr-progress--indeterminate.is-warning::after {
|
|
146
|
+
background-color: #ffe08a;
|
|
147
|
+
}
|
|
148
|
+
.bbr-progress--indeterminate.is-danger::after {
|
|
149
|
+
background-color: #f14668;
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
@keyframes bbr-progress-animated {
|
|
153
|
+
0% {
|
|
154
|
+
background-position: 0 0;
|
|
155
|
+
}
|
|
156
|
+
100% {
|
|
157
|
+
background-position: 1rem 0;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
@keyframes bbr-progress-indeterminate {
|
|
161
|
+
0% {
|
|
162
|
+
left: -50%;
|
|
163
|
+
}
|
|
164
|
+
100% {
|
|
165
|
+
left: 100%;
|
|
166
|
+
}
|
|
167
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/search/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAyB,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/search/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAe,EAAE,EAAyB,MAAM,OAAO,CAAC;AAS/D,OAAO,cAAc,CAAC;AACtB,OAAO,EAAE,WAAW,EAAE,MAAM,IAAI,CAAC;AAEjC,uBAAuB;AACvB,QAAA,MAAM,MAAM,EAAE,EAAE,CAAC,WAAW,CAsH3B,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -4,9 +4,10 @@ import { getClassName } from "@bodynarf/utils";
|
|
|
4
4
|
import { ElementSize } from "../../../types";
|
|
5
5
|
import { getSizeClassName, mapDataAttributes } from "../../../utils";
|
|
6
6
|
import Button, { ButtonStyle } from "../../button";
|
|
7
|
+
import Icon from "../../icon";
|
|
7
8
|
import "./style.scss";
|
|
8
9
|
/** Search component */
|
|
9
|
-
const Search = ({ searchType, onSearch, caption, defaultValue = "", size = ElementSize.Normal, isLoading = false, rounded = false, disabled = false, autoFocus = false, searchButtonCaption = "Search", searchButtonTitle, className, title, data, }) => {
|
|
10
|
+
const Search = ({ searchType, onSearch, caption, defaultValue = "", size = ElementSize.Normal, isLoading = false, rounded = false, disabled = false, autoFocus = false, searchButtonCaption = "Search", searchButtonTitle, showIcon = false, className, title, data, }) => {
|
|
10
11
|
const [searchValue, setSearchValue] = useState(defaultValue);
|
|
11
12
|
const onChange = useCallback((event) => {
|
|
12
13
|
const elementValue = event.target.value;
|
|
@@ -23,6 +24,7 @@ const Search = ({ searchType, onSearch, caption, defaultValue = "", size = Eleme
|
|
|
23
24
|
getSizeClassName(size),
|
|
24
25
|
isLoading ? "is-loading" : "",
|
|
25
26
|
searchType === "byButton" ? "is-expanded" : "",
|
|
27
|
+
showIcon ? "has-icons-left" : "",
|
|
26
28
|
]);
|
|
27
29
|
const inputClassName = getClassName([
|
|
28
30
|
"input",
|
|
@@ -32,8 +34,12 @@ const Search = ({ searchType, onSearch, caption, defaultValue = "", size = Eleme
|
|
|
32
34
|
]);
|
|
33
35
|
const dataAttributes = mapDataAttributes(data);
|
|
34
36
|
if (searchType === "byButton") {
|
|
35
|
-
return (_jsxs("div", { className: "field has-addons", children: [
|
|
37
|
+
return (_jsxs("div", { className: "field has-addons", children: [_jsxs("div", { className: elClassName, children: [_jsx("input", { type: "search", title: title, disabled: disabled, onChange: onChange, ...dataAttributes, placeholder: caption, autoFocus: autoFocus, defaultValue: searchValue, className: inputClassName }), showIcon
|
|
38
|
+
? (_jsx("span", { className: `icon is-left ${getSizeClassName(size)}`, children: _jsx(Icon, { size: size, name: "search" }) }))
|
|
39
|
+
: null] }), _jsx("div", { className: "control", children: _jsx(Button, { size: size, rounded: rounded, disabled: disabled, isLoading: isLoading, style: ButtonStyle.Info, title: searchButtonTitle, caption: searchButtonCaption, onClick: onSearchButtonClick }) })] }));
|
|
36
40
|
}
|
|
37
|
-
return (
|
|
41
|
+
return (_jsxs("div", { className: elClassName, children: [_jsx("input", { type: "search", title: title, disabled: disabled, onChange: onChange, ...dataAttributes, placeholder: caption, autoFocus: autoFocus, defaultValue: searchValue, className: inputClassName }), showIcon
|
|
42
|
+
? (_jsx("span", { className: `icon is-left ${getSizeClassName(size)}`, children: _jsx(Icon, { size: size, name: "search" }) }))
|
|
43
|
+
: null] }));
|
|
38
44
|
};
|
|
39
45
|
export default Search;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.bbr-search input[type=search] {
|
|
2
|
+
transition: 0.15s ease-out;
|
|
3
|
+
transition-property: border-color, color, background-color;
|
|
4
|
+
}
|
|
5
|
+
.bbr-search input[type=search]::placeholder {
|
|
6
|
+
user-select: none;
|
|
7
|
+
}
|
|
8
|
+
.bbr-search input[type=search]::-webkit-input-placeholder {
|
|
9
|
+
transition: 0.15s ease-out color;
|
|
10
|
+
}
|
|
11
|
+
.bbr-search input[type=search]::-webkit-search-cancel-button {
|
|
12
|
+
cursor: pointer;
|
|
13
|
+
font-size: 1.25rem;
|
|
14
|
+
}
|
|
15
|
+
.bbr-search.is-loading::after {
|
|
16
|
+
right: 1rem;
|
|
17
|
+
top: 0.725rem;
|
|
18
|
+
}
|
|
@@ -36,6 +36,11 @@ export type SearchProps = BaseElementProps & {
|
|
|
36
36
|
* Visible only in `searchType = "byButton"`
|
|
37
37
|
*/
|
|
38
38
|
searchButtonTitle?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Should search icon (magnifying glass) be displayed
|
|
41
|
+
* @default false
|
|
42
|
+
*/
|
|
43
|
+
showIcon?: boolean;
|
|
39
44
|
/** Search handler */
|
|
40
45
|
onSearch: (searchPattern: string) => void;
|
|
41
46
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/search/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3D,kCAAkC;AAClC,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG;IACzC;;;;MAIE;IACF,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;IAEpC,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAEhB,2BAA2B;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,yBAAyB;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,mCAAmC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,qDAAqD;IACrD,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B,qBAAqB;IACrB,QAAQ,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C,CAAC"}
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/search/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AAE3D,kCAAkC;AAClC,MAAM,MAAM,WAAW,GAAG,gBAAgB,GAAG;IACzC;;;;MAIE;IACF,UAAU,EAAE,UAAU,GAAG,UAAU,CAAC;IAEpC,qBAAqB;IACrB,OAAO,EAAE,MAAM,CAAC;IAEhB,2BAA2B;IAC3B,YAAY,CAAC,EAAE,MAAM,CAAC;IAEtB,yBAAyB;IACzB,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,mCAAmC;IACnC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,qDAAqD;IACrD,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAE7B;;;OAGG;IACH,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAE3B;;;OAGG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,qBAAqB;IACrB,QAAQ,EAAE,CAAC,aAAa,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/stepper/component/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,EAAE,EAAwB,MAAM,OAAO,CAAC;AAOjD,OAAO,cAAc,CAAC;AAEtB,OAAO,EAAY,YAAY,EAAc,MAAM,UAAU,CAAC;AAsB9D,6DAA6D;AAC7D,QAAA,MAAM,OAAO,EAAE,EAAE,CAAC,YAAY,CA4G7B,CAAC;AAEF,eAAe,OAAO,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useMemo } from "react";
|
|
3
|
+
import { getClassName, isNullish } from "@bodynarf/utils";
|
|
4
|
+
import { ElementColor, ElementSize } from "../../../types";
|
|
5
|
+
import { getElementColorClassName, getSizeClassName, mapDataAttributes } from "../../../utils";
|
|
6
|
+
import "./style.scss";
|
|
7
|
+
/** Get step status based on current step */
|
|
8
|
+
const getStepStatus = (steps, currentStepId, stepId) => {
|
|
9
|
+
const currentIndex = steps.findIndex(s => s.id === currentStepId);
|
|
10
|
+
const stepIndex = steps.findIndex(s => s.id === stepId);
|
|
11
|
+
if (stepIndex < currentIndex) {
|
|
12
|
+
return "completed";
|
|
13
|
+
}
|
|
14
|
+
if (stepIndex === currentIndex) {
|
|
15
|
+
return "current";
|
|
16
|
+
}
|
|
17
|
+
return "upcoming";
|
|
18
|
+
};
|
|
19
|
+
/** Stepper component for displaying step-by-step progress */
|
|
20
|
+
const Stepper = ({ steps, currentStep, size = ElementSize.Normal, color = ElementColor.Primary, vertical = false, showNumbers = true, clickable = false, showConnectors = true, animated = false, showArrows = false, onStepClick, className, title, data, }) => {
|
|
21
|
+
const containerClassName = useMemo(() => getClassName([
|
|
22
|
+
"bbr-stepper",
|
|
23
|
+
className,
|
|
24
|
+
getSizeClassName(size, ElementSize.Normal),
|
|
25
|
+
getElementColorClassName(color),
|
|
26
|
+
vertical ? "is-vertical" : "",
|
|
27
|
+
showConnectors === true || showArrows === true ? "has-connectors" : "",
|
|
28
|
+
animated ? "is-animated" : "",
|
|
29
|
+
]), [className, size, color, vertical, showConnectors, animated, showArrows]);
|
|
30
|
+
const handleStepClick = useCallback((step, index, status) => {
|
|
31
|
+
if (!clickable || isNullish(onStepClick)) {
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
const isStepClickable = step.clickable !== false && status === "completed";
|
|
35
|
+
if (isStepClickable) {
|
|
36
|
+
onStepClick(step, index);
|
|
37
|
+
}
|
|
38
|
+
}, [clickable, onStepClick]);
|
|
39
|
+
const dataAttributes = mapDataAttributes(data);
|
|
40
|
+
return (_jsx("div", { title: title, ...dataAttributes, className: containerClassName, children: steps.map((step, index) => {
|
|
41
|
+
const status = getStepStatus(steps, currentStep, step.id);
|
|
42
|
+
const isClickable = clickable && step.clickable !== false && status === "completed";
|
|
43
|
+
const stepClassName = getClassName([
|
|
44
|
+
"bbr-stepper-step",
|
|
45
|
+
`is-${status}`,
|
|
46
|
+
isClickable ? "is-clickable" : "",
|
|
47
|
+
]);
|
|
48
|
+
return (_jsxs("div", { className: stepClassName, onClick: () => handleStepClick(step, index, status), children: [_jsx("div", { className: "bbr-stepper-marker", children: status === "completed" && !showNumbers ? (_jsx("span", { className: "bbr-stepper-icon", children: _jsx("i", { className: "fas fa-check" }) })) : step.icon && !showNumbers ? (_jsx("span", { className: "bbr-stepper-icon", children: _jsx("i", { className: `fas ${step.icon}` }) })) : (_jsx("span", { className: "bbr-stepper-number", children: index + 1 })) }), _jsxs("div", { className: "bbr-stepper-content", children: [_jsx("div", { className: "bbr-stepper-title", children: step.title }), step.description !== undefined && step.description !== "" && (_jsx("div", { className: "bbr-stepper-description", children: step.description }))] }), index < steps.length - 1 && (_jsx("div", { className: getClassName([
|
|
49
|
+
"bbr-stepper-connector",
|
|
50
|
+
status === "completed" ? "is-completed" : "",
|
|
51
|
+
showArrows === true ? "has-arrow" : "",
|
|
52
|
+
showConnectors !== true && showArrows !== true ? "is-hidden" : "",
|
|
53
|
+
]) }))] }, step.id));
|
|
54
|
+
}) }));
|
|
55
|
+
};
|
|
56
|
+
export default Stepper;
|