@rolster/react-components 19.8.21 → 19.8.22
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/LICENSE +21 -21
- package/dist/cjs/index.cjs +73 -16
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/es/index.mjs +73 -16
- package/dist/es/index.mjs.map +1 -1
- package/dist/esm/components/atoms/AreaText/AreaText.d.ts +4 -2
- package/dist/esm/components/atoms/AreaText/AreaText.js +50 -10
- package/dist/esm/components/atoms/AreaText/AreaText.js.map +1 -1
- package/dist/esm/components/atoms/Skeleton/Skeleton.d.ts +5 -1
- package/dist/esm/components/atoms/Skeleton/Skeleton.js +6 -2
- package/dist/esm/components/atoms/Skeleton/Skeleton.js.map +1 -1
- package/dist/esm/components/atoms/SkeletonText/SkeletonText.d.ts +3 -1
- package/dist/esm/components/atoms/SkeletonText/SkeletonText.js +2 -2
- package/dist/esm/components/atoms/SkeletonText/SkeletonText.js.map +1 -1
- package/dist/esm/components/molecules/FieldArea/FieldArea.d.ts +1 -0
- package/dist/esm/components/molecules/FieldArea/FieldArea.js +17 -3
- package/dist/esm/components/molecules/FieldArea/FieldArea.js.map +1 -1
- package/package.json +2 -2
- package/readme.md +392 -2
|
@@ -7,6 +7,9 @@ export interface AreaTextProps extends RlsComponent {
|
|
|
7
7
|
disabled?: boolean;
|
|
8
8
|
formControl?: RolsterReactAreaTextControl<string>;
|
|
9
9
|
identifier?: string;
|
|
10
|
+
maxLength?: number;
|
|
11
|
+
maxRows?: number;
|
|
12
|
+
minRows?: number;
|
|
10
13
|
onBlur?: () => void;
|
|
11
14
|
onEnter?: () => void;
|
|
12
15
|
onFocus?: () => void;
|
|
@@ -16,9 +19,8 @@ export interface AreaTextProps extends RlsComponent {
|
|
|
16
19
|
placeholder?: string;
|
|
17
20
|
readOnly?: boolean;
|
|
18
21
|
resize?: CSSProperties['resize'];
|
|
19
|
-
rows?: number;
|
|
20
22
|
value?: string;
|
|
21
23
|
}
|
|
22
|
-
declare function RlsAreaTextComponent({ autoComplete, disabled, formControl, identifier, onBlur, onEnter, onFocus, onKeyDown, onKeyUp, onValue, placeholder, readOnly, resize,
|
|
24
|
+
declare function RlsAreaTextComponent({ autoComplete, disabled, formControl, identifier, maxLength, maxRows, minRows, onBlur, onEnter, onFocus, onKeyDown, onKeyUp, onValue, placeholder, readOnly, resize, value }: AreaTextProps): import("react/jsx-runtime").JSX.Element;
|
|
23
25
|
export declare const RlsAreaText: import("react").MemoExoticComponent<typeof RlsAreaTextComponent>;
|
|
24
26
|
export {};
|
|
@@ -1,20 +1,41 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useCallback, useEffect, useRef, useState } from 'react';
|
|
3
3
|
import { renderClassStatus } from '../../../helpers/css';
|
|
4
|
-
|
|
4
|
+
const AREA_TEXT_MAX_ROWS = 8;
|
|
5
|
+
const AREA_TEXT_MIN_ROWS = 3;
|
|
6
|
+
function RlsAreaTextComponent({ autoComplete, disabled, formControl, identifier, maxLength, maxRows, minRows, onBlur, onEnter, onFocus, onKeyDown, onKeyUp, onValue, placeholder, readOnly, resize = 'vertical', value }) {
|
|
5
7
|
const valueInitial = String(formControl?.value ?? value ?? '');
|
|
8
|
+
const rowsMin = minRows ?? AREA_TEXT_MIN_ROWS;
|
|
9
|
+
const rowsMax = Math.max(maxRows ?? AREA_TEXT_MAX_ROWS, rowsMin);
|
|
6
10
|
const [valueArea, setValueArea] = useState(valueInitial);
|
|
7
11
|
const [focused, setFocused] = useState(false);
|
|
8
12
|
const elementRef = useRef(null);
|
|
9
13
|
const areaRef = formControl?.elementRef ?? elementRef;
|
|
10
14
|
const changeIsInternal = useRef(false);
|
|
15
|
+
const heightIsManual = useRef(false);
|
|
16
|
+
const heightApplied = useRef(0);
|
|
11
17
|
const refreshHeight = useCallback(() => {
|
|
12
18
|
const element = areaRef.current;
|
|
13
|
-
if (element) {
|
|
14
|
-
|
|
15
|
-
element.style.height = `${element.scrollHeight}px`;
|
|
19
|
+
if (!element || heightIsManual.current) {
|
|
20
|
+
return;
|
|
16
21
|
}
|
|
17
|
-
|
|
22
|
+
element.style.height = 'auto';
|
|
23
|
+
const { lineHeight, paddingBottom, paddingTop } = getComputedStyle(element);
|
|
24
|
+
const heightLine = parseFloat(lineHeight);
|
|
25
|
+
const heightContent = element.scrollHeight;
|
|
26
|
+
if (!heightLine) {
|
|
27
|
+
element.style.height = `${heightContent}px`;
|
|
28
|
+
heightApplied.current = heightContent;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
const heightPadding = parseFloat(paddingTop) + parseFloat(paddingBottom);
|
|
32
|
+
const heightMin = heightLine * rowsMin + heightPadding;
|
|
33
|
+
const heightMax = heightLine * rowsMax + heightPadding;
|
|
34
|
+
const height = Math.min(Math.max(heightContent, heightMin), heightMax);
|
|
35
|
+
element.style.height = `${height}px`;
|
|
36
|
+
element.style.overflowY = heightContent > heightMax ? 'auto' : 'hidden';
|
|
37
|
+
heightApplied.current = height;
|
|
38
|
+
}, [areaRef, rowsMax, rowsMin]);
|
|
18
39
|
useEffect(() => {
|
|
19
40
|
if (!changeIsInternal.current) {
|
|
20
41
|
const nextValue = String(formControl?.value ?? value ?? '');
|
|
@@ -27,14 +48,31 @@ function RlsAreaTextComponent({ autoComplete, disabled, formControl, identifier,
|
|
|
27
48
|
useEffect(() => {
|
|
28
49
|
refreshHeight();
|
|
29
50
|
}, [refreshHeight, valueArea]);
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const element = areaRef.current;
|
|
53
|
+
if (!element ||
|
|
54
|
+
resize === 'none' ||
|
|
55
|
+
typeof ResizeObserver === 'undefined') {
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const observer = new ResizeObserver(() => {
|
|
59
|
+
if (heightIsManual.current || !heightApplied.current) {
|
|
60
|
+
return;
|
|
61
|
+
}
|
|
62
|
+
if (Math.abs(element.offsetHeight - heightApplied.current) > 1) {
|
|
63
|
+
heightIsManual.current = true;
|
|
64
|
+
element.style.overflowY = 'auto';
|
|
65
|
+
}
|
|
66
|
+
});
|
|
67
|
+
observer.observe(element);
|
|
68
|
+
return () => observer.disconnect();
|
|
69
|
+
}, [areaRef, resize]);
|
|
30
70
|
const onChangeArea = useCallback((event) => {
|
|
31
71
|
const nextValue = event.target.value;
|
|
32
72
|
changeIsInternal.current = true;
|
|
33
73
|
onValue?.(nextValue);
|
|
34
74
|
setValueArea(nextValue);
|
|
35
75
|
formControl?.setValue(nextValue);
|
|
36
|
-
event.target.style.height = 'auto';
|
|
37
|
-
event.target.style.height = `${event.target.scrollHeight}px`;
|
|
38
76
|
}, [formControl, onValue]);
|
|
39
77
|
const onKeyDownArea = useCallback((event) => {
|
|
40
78
|
onKeyDown?.(event);
|
|
@@ -55,12 +93,14 @@ function RlsAreaTextComponent({ autoComplete, disabled, formControl, identifier,
|
|
|
55
93
|
setFocused(() => false);
|
|
56
94
|
onBlur?.();
|
|
57
95
|
}, [formControl, onBlur]);
|
|
96
|
+
const disabledArea = formControl?.disabled || disabled;
|
|
58
97
|
const className = renderClassStatus('rls-area-text', {
|
|
59
|
-
disabled:
|
|
98
|
+
disabled: disabledArea,
|
|
60
99
|
focused: formControl?.focused ?? focused,
|
|
61
|
-
readonly: readOnly
|
|
100
|
+
readonly: readOnly,
|
|
101
|
+
resizable: resize !== 'none' && !disabledArea && !readOnly
|
|
62
102
|
});
|
|
63
|
-
return (_jsxs("div", { id: identifier, className: className, children: [_jsx("textarea", { ref: areaRef, className: "rls-area-text__component", autoComplete: autoComplete ?? 'off', placeholder: placeholder, disabled:
|
|
103
|
+
return (_jsxs("div", { id: identifier, className: className, children: [_jsx("textarea", { ref: areaRef, className: "rls-area-text__component", autoComplete: autoComplete ?? 'off', placeholder: placeholder, disabled: disabledArea, readOnly: readOnly, maxLength: maxLength, rows: rowsMin, style: { resize }, onFocus: onFocusArea, onBlur: onBlurArea, onChange: onChangeArea, onKeyDown: onKeyDownArea, onKeyUp: onKeyUpArea, value: valueArea }), _jsx("span", { className: "rls-area-text__value", "aria-hidden": "true", children: valueArea })] }));
|
|
64
104
|
}
|
|
65
105
|
export const RlsAreaText = memo(RlsAreaTextComponent);
|
|
66
106
|
//# sourceMappingURL=AreaText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AreaText.js","sourceRoot":"","sources":["../../../../../src/components/atoms/AreaText/AreaText.tsx"],"names":[],"mappings":";AACA,OAAO,EAIL,IAAI,EAEJ,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"AreaText.js","sourceRoot":"","sources":["../../../../../src/components/atoms/AreaText/AreaText.tsx"],"names":[],"mappings":";AACA,OAAO,EAIL,IAAI,EAEJ,WAAW,EACX,SAAS,EACT,MAAM,EACN,QAAQ,EACT,MAAM,OAAO,CAAC;AACf,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AAGzD,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,kBAAkB,GAAG,CAAC,CAAC;AA0B7B,SAAS,oBAAoB,CAAC,EAC5B,YAAY,EACZ,QAAQ,EACR,WAAW,EACX,UAAU,EACV,SAAS,EACT,OAAO,EACP,OAAO,EACP,MAAM,EACN,OAAO,EACP,OAAO,EACP,SAAS,EACT,OAAO,EACP,OAAO,EACP,WAAW,EACX,QAAQ,EACR,MAAM,GAAG,UAAU,EACnB,KAAK,EACS;IACd,MAAM,YAAY,GAAG,MAAM,CAAC,WAAW,EAAE,KAAK,IAAI,KAAK,IAAI,EAAE,CAAC,CAAC;IAE/D,MAAM,OAAO,GAAG,OAAO,IAAI,kBAAkB,CAAC;IAC9C,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,OAAO,IAAI,kBAAkB,EAAE,OAAO,CAAC,CAAC;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AAE,SAAS,GAChB,EACF,eAAM,SAAS,EAAC,sBAAsB,iBAAa,MAAM,YACtD,SAAS,GACL,IACH,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -1,4 +1,8 @@
|
|
|
1
1
|
import { RlsComponent } from '../../definitions';
|
|
2
|
-
|
|
2
|
+
export type RlsSkeletonAnimation = 'shimmer' | 'pulse' | 'wave';
|
|
3
|
+
export interface SkeletonProps extends RlsComponent {
|
|
4
|
+
animation?: RlsSkeletonAnimation;
|
|
5
|
+
}
|
|
6
|
+
declare function RlsSkeletonComponent({ animation, rlsTheme }: SkeletonProps): import("react/jsx-runtime").JSX.Element;
|
|
3
7
|
export declare const RlsSkeleton: import("react").MemoExoticComponent<typeof RlsSkeletonComponent>;
|
|
4
8
|
export {};
|
|
@@ -1,7 +1,11 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from 'react';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
import { renderClassStatus } from '../../../helpers/css';
|
|
4
|
+
function RlsSkeletonComponent({ animation, rlsTheme }) {
|
|
5
|
+
const className = renderClassStatus('rls-skeleton', {
|
|
6
|
+
animation: animation !== 'shimmer' && animation
|
|
7
|
+
});
|
|
8
|
+
return _jsx("div", { className: className, "rls-theme": rlsTheme });
|
|
5
9
|
}
|
|
6
10
|
export const RlsSkeleton = memo(RlsSkeletonComponent);
|
|
7
11
|
//# sourceMappingURL=Skeleton.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Skeleton.js","sourceRoot":"","sources":["../../../../../src/components/atoms/Skeleton/Skeleton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"Skeleton.js","sourceRoot":"","sources":["../../../../../src/components/atoms/Skeleton/Skeleton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAC7B,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AASzD,SAAS,oBAAoB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAiB;IAClE,MAAM,SAAS,GAAG,iBAAiB,CAAC,cAAc,EAAE;QAClD,SAAS,EAAE,SAAS,KAAK,SAAS,IAAI,SAAS;KAChD,CAAC,CAAC;IAEH,OAAO,cAAK,SAAS,EAAE,SAAS,eAAa,QAAQ,GAAQ,CAAC;AAChE,CAAC;AAED,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,oBAAoB,CAAC,CAAC"}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { RlsComponent } from '../../definitions';
|
|
2
|
+
import { RlsSkeletonAnimation } from '../Skeleton/Skeleton';
|
|
2
3
|
interface SkeletonTextProps extends RlsComponent {
|
|
3
4
|
active?: boolean;
|
|
5
|
+
animation?: RlsSkeletonAnimation;
|
|
4
6
|
}
|
|
5
|
-
declare function RlsSkeletonTextComponent({ active, children, rlsTheme }: SkeletonTextProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
declare function RlsSkeletonTextComponent({ active, animation, children, rlsTheme }: SkeletonTextProps): import("react/jsx-runtime").JSX.Element;
|
|
6
8
|
export declare const RlsSkeletonText: import("react").MemoExoticComponent<typeof RlsSkeletonTextComponent>;
|
|
7
9
|
export {};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo } from 'react';
|
|
3
3
|
import { RlsSkeleton } from '../Skeleton/Skeleton';
|
|
4
|
-
function RlsSkeletonTextComponent({ active, children, rlsTheme }) {
|
|
5
|
-
return (_jsx("div", { className: "rls-skeleton-text", "rls-theme": rlsTheme, children: active ? (_jsx(RlsSkeleton, {})) : (_jsx("div", { className: "rls-skeleton-text__value", children: children })) }));
|
|
4
|
+
function RlsSkeletonTextComponent({ active, animation, children, rlsTheme }) {
|
|
5
|
+
return (_jsx("div", { className: "rls-skeleton-text", "rls-theme": rlsTheme, children: active ? (_jsx(RlsSkeleton, { animation: animation })) : (_jsx("div", { className: "rls-skeleton-text__value", children: children })) }));
|
|
6
6
|
}
|
|
7
7
|
export const RlsSkeletonText = memo(RlsSkeletonTextComponent);
|
|
8
8
|
//# sourceMappingURL=SkeletonText.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SkeletonText.js","sourceRoot":"","sources":["../../../../../src/components/atoms/SkeletonText/SkeletonText.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,WAAW,
|
|
1
|
+
{"version":3,"file":"SkeletonText.js","sourceRoot":"","sources":["../../../../../src/components/atoms/SkeletonText/SkeletonText.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC;AAE7B,OAAO,EAAE,WAAW,EAAwB,MAAM,sBAAsB,CAAC;AAOzE,SAAS,wBAAwB,CAAC,EAChC,MAAM,EACN,SAAS,EACT,QAAQ,EACR,QAAQ,EACU;IAClB,OAAO,CACL,cAAK,SAAS,EAAC,mBAAmB,eAAY,QAAQ,YACnD,MAAM,CAAC,CAAC,CAAC,CACR,KAAC,WAAW,IAAC,SAAS,EAAE,SAAS,GAAI,CACtC,CAAC,CAAC,CAAC,CACF,cAAK,SAAS,EAAC,0BAA0B,YAAE,QAAQ,GAAO,CAC3D,GACG,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,eAAe,GAAG,IAAI,CAAC,wBAAwB,CAAC,CAAC"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { AreaTextProps, RolsterReactAreaTextControl } from '../../atoms/AreaText/AreaText';
|
|
2
2
|
import { RlsComponent } from '../../definitions';
|
|
3
3
|
interface FieldAreaProps extends AreaTextProps, RlsComponent {
|
|
4
|
+
counter?: boolean;
|
|
4
5
|
formControl?: RolsterReactAreaTextControl<string>;
|
|
5
6
|
msgErrorDisabled?: boolean;
|
|
6
7
|
}
|
|
@@ -1,20 +1,34 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
-
import { memo, useMemo } from 'react';
|
|
2
|
+
import { memo, useCallback, useEffect, useMemo, useState } from 'react';
|
|
3
3
|
import { renderClassStatus } from '../../../helpers/css';
|
|
4
4
|
import { RlsAreaText } from '../../atoms/AreaText/AreaText';
|
|
5
5
|
import { RlsMessageFormError } from '../MessageFormError/MessageFormError';
|
|
6
6
|
function RlsFieldAreaComponent(props) {
|
|
7
|
-
const { children, formControl, identifier, rlsTheme } = props;
|
|
7
|
+
const { children, formControl, identifier, maxLength, rlsTheme } = props;
|
|
8
|
+
const { onValue } = props;
|
|
8
9
|
const disabled = useMemo(() => {
|
|
9
10
|
return formControl?.disabled || props.disabled;
|
|
10
11
|
}, [formControl?.disabled, props.disabled]);
|
|
12
|
+
const valueSource = formControl?.value ?? props.value;
|
|
13
|
+
const [valueLength, setValueLength] = useState(() => {
|
|
14
|
+
return (valueSource ?? '').length;
|
|
15
|
+
});
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
if (valueSource !== undefined) {
|
|
18
|
+
setValueLength(valueSource.length);
|
|
19
|
+
}
|
|
20
|
+
}, [valueSource]);
|
|
21
|
+
const onValueArea = useCallback((value) => {
|
|
22
|
+
setValueLength(value.length);
|
|
23
|
+
onValue?.(value);
|
|
24
|
+
}, [onValue]);
|
|
11
25
|
const className = renderClassStatus('rls-field-box', {
|
|
12
26
|
disabled,
|
|
13
27
|
error: formControl?.wrong,
|
|
14
28
|
focused: formControl?.focused && !disabled,
|
|
15
29
|
readonly: props.readOnly
|
|
16
30
|
}, 'rls-field-area');
|
|
17
|
-
return (_jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && _jsx("span", { className: "rls-field-box__label", children: children }), _jsx("div", { className: "rls-field-box__component", children: _jsx("div", { className: "rls-field-box__body", children: _jsx(RlsAreaText, { ...props }) }) }), !props.msgErrorDisabled && (_jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
31
|
+
return (_jsxs("div", { id: identifier, className: className, "rls-theme": rlsTheme, children: [children && _jsx("span", { className: "rls-field-box__label", children: children }), _jsx("div", { className: "rls-field-box__component", children: _jsx("div", { className: "rls-field-box__body", children: _jsx(RlsAreaText, { ...props, onValue: onValueArea }) }) }), props.counter && (_jsx("span", { className: "rls-field-box__helper rls-field-area__counter", children: maxLength ? `${valueLength} / ${maxLength}` : valueLength })), !props.msgErrorDisabled && (_jsx(RlsMessageFormError, { className: "rls-field-box__error", formControl: formControl }))] }));
|
|
18
32
|
}
|
|
19
33
|
export const RlsFieldArea = memo(RlsFieldAreaComponent);
|
|
20
34
|
//# sourceMappingURL=FieldArea.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldArea.js","sourceRoot":"","sources":["../../../../../src/components/molecules/FieldArea/FieldArea.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"FieldArea.js","sourceRoot":"","sources":["../../../../../src/components/molecules/FieldArea/FieldArea.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,SAAS,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACxE,OAAO,EAAE,iBAAiB,EAAE,MAAM,sBAAsB,CAAC;AACzD,OAAO,EAEL,WAAW,EAEZ,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EAAE,mBAAmB,EAAE,MAAM,sCAAsC,CAAC;AAQ3E,SAAS,qBAAqB,CAAC,KAAqB;IAClD,MAAM,EAAE,QAAQ,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,GA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AQ,GAAQ,EAErE,cAAK,SAAS,EAAC,0BAA0B,YACvC,cAAK,SAAS,EAAC,qBAAqB,YAClC,KAAC,WAAW,OAAK,KAAK,EAAE,OAAO,EAAE,WAAW,GAAI,GAC5C,GACF,EAEL,KAAK,CAAC,OAAO,IAAI,CAChB,eAAM,SAAS,EAAC,+CAA+C,YAC5D,SAAS,CAAC,CAAC,CAAC,GAAG,WAAW,MAAM,SAAS,EAAE,CAAC,CAAC,CAAC,WAAW,GACrD,CACR,EAEA,CAAC,KAAK,CAAC,gBAAgB,IAAI,CAC1B,KAAC,mBAAmB,IAClB,SAAS,EAAC,sBAAsB,EAChC,WAAW,EAAE,WAAW,GACxB,CACH,IACG,CACP,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,IAAI,CAAC,qBAAqB,CAAC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rolster/react-components",
|
|
3
|
-
"version": "19.8.
|
|
3
|
+
"version": "19.8.22",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "Package containing UI components for React Project.",
|
|
6
6
|
"license": "MIT",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"devDependencies": {
|
|
51
51
|
"@eslint/js": "^10.0.1",
|
|
52
52
|
"@rolster/rollup": "^2.2.0",
|
|
53
|
-
"@rolster/styles-foundations": "^3.5.
|
|
53
|
+
"@rolster/styles-foundations": "^3.5.23",
|
|
54
54
|
"@rolster/types": "^1.1.1",
|
|
55
55
|
"@types/react": "^19.0.0",
|
|
56
56
|
"@types/react-dom": "^19.0.0",
|