@rolster/react-components 19.11.0 → 19.11.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/index.cjs +136 -67
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/es/index.mjs +134 -68
- package/dist/es/index.mjs.map +1 -1
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.js +2 -15
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.js.map +1 -1
- package/dist/esm/components/organisms/PickerClock/PickerClock.js +67 -53
- package/dist/esm/components/organisms/PickerClock/PickerClock.js.map +1 -1
- package/dist/esm/controllers/ImageEditorController.js +2 -2
- package/dist/esm/controllers/ImageEditorController.js.map +1 -1
- package/dist/esm/helpers/color.d.ts +12 -0
- package/dist/esm/helpers/color.js +64 -1
- package/dist/esm/helpers/color.js.map +1 -1
- package/package.json +2 -2
package/dist/es/index.mjs
CHANGED
|
@@ -1251,13 +1251,18 @@ function generateThemeCSS(colors, theme) {
|
|
|
1251
1251
|
const rgb900 = rgbChannels(parseHex(colors['900']));
|
|
1252
1252
|
const rgb700 = rgbChannels(parseHex(colors['700']));
|
|
1253
1253
|
const rgb500 = rgbChannels(parseHex(colors['500']));
|
|
1254
|
+
const rgb300 = rgbChannels(parseHex(colors['300']));
|
|
1254
1255
|
const colorProps = SHADE_LABELS.map((label) => prop(`color-${label}`, colors[label]));
|
|
1255
1256
|
const gradientProps = GRADIENT_LABELS.map((label) => {
|
|
1256
1257
|
const darker = SHADE_LABELS[SHADE_LABELS.indexOf(label) - 1];
|
|
1257
1258
|
return prop(`gradient-${label}`, `linear-gradient(180deg, ${colors[label]} 15%, ${colors[darker]} 85%)`);
|
|
1258
1259
|
});
|
|
1259
1260
|
const backdropProps = BACKDROP_LABELS.map((label) => prop(`backdrop-${label}`, `rgba(${rgb900}, ${Number(label) / 1000})`));
|
|
1260
|
-
const
|
|
1261
|
+
const skeletonOpacities = Object.entries(SKELETON_OPACITY);
|
|
1262
|
+
const skeletonProps = skeletonOpacities.map(([label, opacity]) => prop(`skeleton-${label}`, `rgba(${rgb700}, ${opacity})`));
|
|
1263
|
+
// Skeleton tokens for dark surfaces, taken from the light step that mirrors
|
|
1264
|
+
// color-700 around color-500, as the foundations mixin does.
|
|
1265
|
+
const skeletonDarkProps = skeletonOpacities.map(([label, opacity]) => prop(`skeleton-dark-${label}`, `rgba(${rgb300}, ${opacity})`));
|
|
1261
1266
|
const shadowProps = [
|
|
1262
1267
|
prop('shadow-color-500', `rgba(${rgb500}, 0.24)`),
|
|
1263
1268
|
prop('shadow-500', `0px 0px 0px 3px rgba(${rgb500}, 0.24)`)
|
|
@@ -1267,6 +1272,7 @@ function generateThemeCSS(colors, theme) {
|
|
|
1267
1272
|
...gradientProps,
|
|
1268
1273
|
...backdropProps,
|
|
1269
1274
|
...skeletonProps,
|
|
1275
|
+
...skeletonDarkProps,
|
|
1270
1276
|
...shadowProps
|
|
1271
1277
|
];
|
|
1272
1278
|
}
|
|
@@ -1336,12 +1342,69 @@ function setThemeColor(baseColor, theme = 'primary') {
|
|
|
1336
1342
|
if (typeof document === 'undefined') {
|
|
1337
1343
|
return;
|
|
1338
1344
|
}
|
|
1345
|
+
resetTheme(theme);
|
|
1339
1346
|
const { properties } = generateThemePalette(baseColor, theme);
|
|
1340
1347
|
const target = document.body || document.documentElement;
|
|
1341
1348
|
properties.forEach(({ name, value }) => {
|
|
1342
1349
|
target.style.setProperty(name, value);
|
|
1343
1350
|
});
|
|
1344
1351
|
}
|
|
1352
|
+
const ALIAS_LABELS = [
|
|
1353
|
+
'900',
|
|
1354
|
+
'800',
|
|
1355
|
+
'700',
|
|
1356
|
+
'600',
|
|
1357
|
+
'500',
|
|
1358
|
+
'400',
|
|
1359
|
+
'300',
|
|
1360
|
+
'200',
|
|
1361
|
+
'100'
|
|
1362
|
+
];
|
|
1363
|
+
const SKELETON_LABELS = Object.keys(SKELETON_OPACITY);
|
|
1364
|
+
const ALIAS_TOKENS = [
|
|
1365
|
+
...SHADE_LABELS.map((label) => `color-${label}`),
|
|
1366
|
+
...ALIAS_LABELS.map((label) => `gradient-${label}`),
|
|
1367
|
+
...ALIAS_LABELS.map((label) => `backdrop-${label}`),
|
|
1368
|
+
...SKELETON_LABELS.map((label) => `skeleton-${label}`),
|
|
1369
|
+
...SKELETON_LABELS.map((label) => `skeleton-dark-${label}`),
|
|
1370
|
+
'shadow-color-500',
|
|
1371
|
+
'shadow-500'
|
|
1372
|
+
];
|
|
1373
|
+
function resetTheme(theme = 'primary') {
|
|
1374
|
+
if (typeof document === 'undefined') {
|
|
1375
|
+
return;
|
|
1376
|
+
}
|
|
1377
|
+
const target = document.body || document.documentElement;
|
|
1378
|
+
ALIAS_TOKENS.forEach((token) => {
|
|
1379
|
+
target.style.removeProperty(`--rls-${theme}-${token}`);
|
|
1380
|
+
});
|
|
1381
|
+
}
|
|
1382
|
+
function generateThemeAlias(source, theme = 'primary') {
|
|
1383
|
+
const properties = ALIAS_TOKENS.map((token) => ({
|
|
1384
|
+
name: `--rls-${theme}-${token}`,
|
|
1385
|
+
value: `var(--rls-${source}-${token})`
|
|
1386
|
+
}));
|
|
1387
|
+
return {
|
|
1388
|
+
source,
|
|
1389
|
+
theme,
|
|
1390
|
+
properties,
|
|
1391
|
+
css: properties.map((p) => `${p.name}: ${p.value};`).join('\n')
|
|
1392
|
+
};
|
|
1393
|
+
}
|
|
1394
|
+
function setThemeAlias(source, theme = 'primary') {
|
|
1395
|
+
if (typeof document === 'undefined') {
|
|
1396
|
+
return;
|
|
1397
|
+
}
|
|
1398
|
+
if (source === theme) {
|
|
1399
|
+
resetTheme(theme);
|
|
1400
|
+
return;
|
|
1401
|
+
}
|
|
1402
|
+
const { properties } = generateThemeAlias(source, theme);
|
|
1403
|
+
const target = document.body || document.documentElement;
|
|
1404
|
+
properties.forEach(({ name, value }) => {
|
|
1405
|
+
target.style.setProperty(name, value);
|
|
1406
|
+
});
|
|
1407
|
+
}
|
|
1345
1408
|
const DEFAULT_COLOR = '#1780e0';
|
|
1346
1409
|
|
|
1347
1410
|
const CONTENT_BACKGROUND = '--pvt-content-background';
|
|
@@ -3821,11 +3884,20 @@ const RlsModal = memo(RlsModalComponent);
|
|
|
3821
3884
|
function formatTime(value) {
|
|
3822
3885
|
return String(value).padStart(2, '0');
|
|
3823
3886
|
}
|
|
3887
|
+
function pointerIsInsideTick({ clientX, clientY }, tick) {
|
|
3888
|
+
const { left, top, width, height } = tick.getBoundingClientRect();
|
|
3889
|
+
const distanceX = clientX - (left + width / 2);
|
|
3890
|
+
const distanceY = clientY - (top + height / 2);
|
|
3891
|
+
const radius = Math.min(width, height) / 2;
|
|
3892
|
+
return distanceX ** 2 + distanceY ** 2 <= radius ** 2;
|
|
3893
|
+
}
|
|
3824
3894
|
const CLOCK_VALUES = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
3895
|
+
const CLOCK_HOURS = 12;
|
|
3896
|
+
const CLOCK_MINUTES = 60;
|
|
3825
3897
|
const RADIUS = 48;
|
|
3826
3898
|
const DIAL_RADIUS = 60;
|
|
3827
3899
|
const TICK_RADIUS = 7;
|
|
3828
|
-
function RlsPickerClockTick({
|
|
3900
|
+
function RlsPickerClockTick({ selectionIsHours, value }) {
|
|
3829
3901
|
const styleTick = useMemo(() => {
|
|
3830
3902
|
const radian = (value / 6) * Math.PI;
|
|
3831
3903
|
const x = Math.sin(radian) * RADIUS;
|
|
@@ -3835,20 +3907,13 @@ function RlsPickerClockTick({ onValue, selectionIsHours, value }) {
|
|
|
3835
3907
|
top: `${DIAL_RADIUS - y - TICK_RADIUS - 1}rem`
|
|
3836
3908
|
};
|
|
3837
3909
|
}, []);
|
|
3838
|
-
const
|
|
3910
|
+
const tickValue = useMemo(() => {
|
|
3839
3911
|
if (selectionIsHours) {
|
|
3840
|
-
return
|
|
3841
|
-
}
|
|
3842
|
-
if (value === 12) {
|
|
3843
|
-
return formatTime(0);
|
|
3912
|
+
return value;
|
|
3844
3913
|
}
|
|
3845
|
-
return
|
|
3914
|
+
return value === CLOCK_HOURS ? 0 : value * 5;
|
|
3846
3915
|
}, [selectionIsHours]);
|
|
3847
|
-
|
|
3848
|
-
event.preventDefault();
|
|
3849
|
-
onValue(value);
|
|
3850
|
-
}, [onValue]);
|
|
3851
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__tick", style: styleTick, onClick: onClick, children: label }));
|
|
3916
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__tick", style: styleTick, "data-value": tickValue, children: formatTime(tickValue) }));
|
|
3852
3917
|
}
|
|
3853
3918
|
function RlsPickerClockComponent({ formControl, onListener, rlsTheme, time }) {
|
|
3854
3919
|
const timeInitial = useMemo(() => {
|
|
@@ -3921,22 +3986,6 @@ function RlsPickerClockComponent({ formControl, onListener, rlsTheme, time }) {
|
|
|
3921
3986
|
}
|
|
3922
3987
|
changeIsInternal.current = false;
|
|
3923
3988
|
}, [formControl?.value]);
|
|
3924
|
-
const refreshComponent = useCallback((clientX, clientY) => {
|
|
3925
|
-
const rectangle = plateElement.current.getBoundingClientRect();
|
|
3926
|
-
const centerX = rectangle.left + rectangle.width / 2;
|
|
3927
|
-
const centerY = rectangle.top + rectangle.height / 2;
|
|
3928
|
-
const positionX = clientX - centerX;
|
|
3929
|
-
const positionY = clientY - centerY;
|
|
3930
|
-
const angle = Math.atan2(-positionX, positionY) + Math.PI;
|
|
3931
|
-
const value = Math.round(angle / radianUnit);
|
|
3932
|
-
refreshClock(value);
|
|
3933
|
-
if (selectionIsHours) {
|
|
3934
|
-
setHour(value === 0 ? 12 : value);
|
|
3935
|
-
}
|
|
3936
|
-
else {
|
|
3937
|
-
setMinute(value);
|
|
3938
|
-
}
|
|
3939
|
-
}, [selectionIsHours, radianUnit]);
|
|
3940
3989
|
const refreshClock = useCallback((value) => {
|
|
3941
3990
|
const angle = value * radianUnit;
|
|
3942
3991
|
const x2 = Math.sin(angle) * (RADIUS - TICK_RADIUS);
|
|
@@ -3952,6 +4001,27 @@ function RlsPickerClockComponent({ formControl, onListener, rlsTheme, time }) {
|
|
|
3952
4001
|
pointElement.current.style.visibility =
|
|
3953
4002
|
selectionIsHours || value % 5 === 0 ? 'hidden' : 'visible';
|
|
3954
4003
|
}, [selectionIsHours, radianUnit]);
|
|
4004
|
+
const selectValue = useCallback((value) => {
|
|
4005
|
+
refreshClock(value);
|
|
4006
|
+
if (selectionIsHours) {
|
|
4007
|
+
setHour(value === 0 ? CLOCK_HOURS : value);
|
|
4008
|
+
}
|
|
4009
|
+
else {
|
|
4010
|
+
setMinute(value);
|
|
4011
|
+
}
|
|
4012
|
+
}, [selectionIsHours, refreshClock]);
|
|
4013
|
+
const selectFromPosition = useCallback((clientX, clientY) => {
|
|
4014
|
+
const rectangle = plateElement.current.getBoundingClientRect();
|
|
4015
|
+
const centerX = rectangle.left + rectangle.width / 2;
|
|
4016
|
+
const centerY = rectangle.top + rectangle.height / 2;
|
|
4017
|
+
const positionX = clientX - centerX;
|
|
4018
|
+
const positionY = clientY - centerY;
|
|
4019
|
+
// Angle in [0, 2π) measured clockwise from 12 o'clock
|
|
4020
|
+
const angle = Math.atan2(-positionX, positionY) + Math.PI;
|
|
4021
|
+
const steps = selectionIsHours ? CLOCK_HOURS : CLOCK_MINUTES;
|
|
4022
|
+
// Modulo keeps the last half step before 12 o'clock as 0, not as 60/12
|
|
4023
|
+
selectValue(Math.round(angle / radianUnit) % steps);
|
|
4024
|
+
}, [selectionIsHours, radianUnit, selectValue]);
|
|
3955
4025
|
const onClickHour = useCallback(() => {
|
|
3956
4026
|
setSelectionIsHours(true);
|
|
3957
4027
|
}, []);
|
|
@@ -3964,49 +4034,56 @@ function RlsPickerClockComponent({ formControl, onListener, rlsTheme, time }) {
|
|
|
3964
4034
|
const onClickPM = useCallback(() => {
|
|
3965
4035
|
setZoneIsPM(true);
|
|
3966
4036
|
}, []);
|
|
3967
|
-
const
|
|
4037
|
+
const onPointerDown = useCallback((event) => {
|
|
4038
|
+
event.preventDefault();
|
|
4039
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
3968
4040
|
selectionIsActive.current = true;
|
|
3969
|
-
|
|
3970
|
-
|
|
4041
|
+
const tick = event.target.closest('.rls-picker-clock__tick');
|
|
4042
|
+
// Pressing inside a label circle snaps to its exact value,
|
|
4043
|
+
// anywhere else (and while dragging) the angle decides
|
|
4044
|
+
if (tick?.dataset.value && pointerIsInsideTick(event, tick)) {
|
|
4045
|
+
selectValue(Number(tick.dataset.value));
|
|
4046
|
+
}
|
|
4047
|
+
else {
|
|
4048
|
+
selectFromPosition(event.clientX, event.clientY);
|
|
4049
|
+
}
|
|
4050
|
+
}, [selectValue, selectFromPosition]);
|
|
4051
|
+
const onPointerMove = useCallback((event) => {
|
|
3971
4052
|
if (selectionIsActive.current) {
|
|
3972
|
-
event.
|
|
3973
|
-
refreshComponent(event.clientX, event.clientY);
|
|
4053
|
+
selectFromPosition(event.clientX, event.clientY);
|
|
3974
4054
|
}
|
|
3975
|
-
}, [
|
|
3976
|
-
const
|
|
3977
|
-
|
|
3978
|
-
|
|
3979
|
-
refreshComponent(touch.clientX, touch.clientY);
|
|
4055
|
+
}, [selectFromPosition]);
|
|
4056
|
+
const onPointerUp = useCallback(() => {
|
|
4057
|
+
if (!selectionIsActive.current) {
|
|
4058
|
+
return;
|
|
3980
4059
|
}
|
|
3981
|
-
}, [refreshComponent]);
|
|
3982
|
-
const onInactiveSelection = useCallback(() => {
|
|
3983
4060
|
selectionIsActive.current = false;
|
|
3984
|
-
|
|
3985
|
-
const onClickValue = useCallback((value) => {
|
|
4061
|
+
// Once the hour is chosen, continue with the minutes
|
|
3986
4062
|
if (selectionIsHours) {
|
|
3987
|
-
|
|
3988
|
-
refreshClock(value);
|
|
3989
|
-
}
|
|
3990
|
-
else {
|
|
3991
|
-
const minute = value === 12 ? 0 : value * 5;
|
|
3992
|
-
setMinute(minute);
|
|
3993
|
-
refreshClock(minute);
|
|
4063
|
+
setSelectionIsHours(false);
|
|
3994
4064
|
}
|
|
3995
4065
|
}, [selectionIsHours]);
|
|
4066
|
+
const onPointerCancel = useCallback(() => {
|
|
4067
|
+
selectionIsActive.current = false;
|
|
4068
|
+
}, []);
|
|
3996
4069
|
const onCancel = useCallback(() => {
|
|
3997
4070
|
onListener?.({ event: PickerListenerEvent.Cancel });
|
|
3998
4071
|
}, [onListener]);
|
|
3999
4072
|
const onCurrentTime = useCallback(() => {
|
|
4000
4073
|
const currentTime = Time.now();
|
|
4074
|
+
const zoneIsPM = currentTime.hour >= 12;
|
|
4075
|
+
const hour = zoneIsPM ? currentTime.hour - 12 : currentTime.hour;
|
|
4001
4076
|
changeIsInternal.current = true;
|
|
4002
4077
|
formControl?.setValue(currentTime);
|
|
4003
|
-
|
|
4078
|
+
setZoneIsPM(zoneIsPM);
|
|
4079
|
+
setHour(hour);
|
|
4004
4080
|
setMinute(currentTime.minute);
|
|
4081
|
+
refreshClock(selectionIsHours ? hour : currentTime.minute);
|
|
4005
4082
|
onListener?.({
|
|
4006
4083
|
event: PickerListenerEvent.Select,
|
|
4007
4084
|
value: currentTime
|
|
4008
4085
|
});
|
|
4009
|
-
}, [formControl, onListener]);
|
|
4086
|
+
}, [formControl, onListener, selectionIsHours, refreshClock]);
|
|
4010
4087
|
const onSelect = useCallback(() => {
|
|
4011
4088
|
const hourValue = zoneIsPM
|
|
4012
4089
|
? hour !== 12
|
|
@@ -4023,10 +4100,10 @@ function RlsPickerClockComponent({ formControl, onListener, rlsTheme, time }) {
|
|
|
4023
4100
|
value: timeValue
|
|
4024
4101
|
});
|
|
4025
4102
|
}, [formControl, hour, minute, zoneIsPM, onListener]);
|
|
4026
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__header", children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__title", children: [jsxRuntimeExports.jsx("span", { className: classNameHour, onClick: onClickHour, children: hourFormat }), jsxRuntimeExports.jsx("span", { className: "rls-picker-clock__title__separator", children: ":" }), jsxRuntimeExports.jsx("span", { className: classNameMinute, onClick: onClickMinute, children: minuteFormat })] }), jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__zone", children: [jsxRuntimeExports.jsx("span", { className: classNameAM, onClick: onClickAM, children: "AM" }), jsxRuntimeExports.jsx("span", { className: classNamePM, onClick: onClickPM, children: "PM" })] })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__body", children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__plate", ref: plateElement,
|
|
4103
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock", "rls-theme": rlsTheme, children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__header", children: [jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__title", children: [jsxRuntimeExports.jsx("span", { className: classNameHour, onClick: onClickHour, children: hourFormat }), jsxRuntimeExports.jsx("span", { className: "rls-picker-clock__title__separator", children: ":" }), jsxRuntimeExports.jsx("span", { className: classNameMinute, onClick: onClickMinute, children: minuteFormat })] }), jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__zone", children: [jsxRuntimeExports.jsx("span", { className: classNameAM, onClick: onClickAM, children: "AM" }), jsxRuntimeExports.jsx("span", { className: classNamePM, onClick: onClickPM, children: "PM" })] })] }), jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__body", children: jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__plate", ref: plateElement, onPointerDown: onPointerDown, onPointerMove: onPointerMove, onPointerUp: onPointerUp, onPointerCancel: onPointerCancel, children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__canvas", children: jsxRuntimeExports.jsx("svg", { width: "120rem", height: "120rem", children: jsxRuntimeExports.jsxs("g", { style: {
|
|
4027
4104
|
transform: `translate(${DIAL_RADIUS}rem, ${DIAL_RADIUS}rem)`
|
|
4028
4105
|
}, children: [jsxRuntimeExports.jsx("line", { ref: lineElement, className: "rls-picker-clock__canvas__line", x1: "-1", y1: "-1" }), jsxRuntimeExports.jsx("circle", { ref: centerElement, className: "rls-picker-clock__canvas__center", r: "4", cx: "-1", cy: "-1" }), jsxRuntimeExports.jsx("circle", { ref: indicatorElement, className: "rls-picker-clock__canvas__indicator", r: `${TICK_RADIUS}rem` }), jsxRuntimeExports.jsx("circle", { ref: pointElement, className: "rls-picker-clock__canvas__point", r: "3.5" })] }) }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__hours", children: CLOCK_VALUES.map((value) => {
|
|
4029
|
-
return (jsxRuntimeExports.jsx(RlsPickerClockTick, { value: value, selectionIsHours: selectionIsHours
|
|
4106
|
+
return (jsxRuntimeExports.jsx(RlsPickerClockTick, { value: value, selectionIsHours: selectionIsHours }, value));
|
|
4030
4107
|
}) })] }) }), jsxRuntimeExports.jsxs("div", { className: "rls-picker-clock__footer", children: [jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__footer--cancel", children: jsxRuntimeExports.jsx(RlsButton, { type: "flat", onClick: onCancel, children: labels.timeActionCancel }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__footer--today", children: jsxRuntimeExports.jsx(RlsButtonAction, { icon: "timer", onClick: onCurrentTime }) }), jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__footer--ok", children: jsxRuntimeExports.jsx(RlsButton, { type: "raised", onClick: onSelect, children: labels.timeActionSelect }) })] })] }));
|
|
4031
4108
|
}
|
|
4032
4109
|
const RlsPickerClock = memo(RlsPickerClockComponent);
|
|
@@ -4840,10 +4917,6 @@ function calculateImgDimension(image, dimension) {
|
|
|
4840
4917
|
}
|
|
4841
4918
|
function RlsImageEditorComponent(props) {
|
|
4842
4919
|
const [selection, setSelection] = useState(props.selection ?? 60);
|
|
4843
|
-
const [labels, setLabels] = useState({
|
|
4844
|
-
actionRestore: reactI18n('editorImageActionRestore'),
|
|
4845
|
-
actionSelect: reactI18n('editorImageActionSelect')
|
|
4846
|
-
});
|
|
4847
4920
|
const refBody = useRef(null);
|
|
4848
4921
|
const refImage = useRef(null);
|
|
4849
4922
|
const refSelection = useRef(null);
|
|
@@ -4968,16 +5041,9 @@ function RlsImageEditorComponent(props) {
|
|
|
4968
5041
|
refreshImageStyle();
|
|
4969
5042
|
refreshSelectionStyle(selection);
|
|
4970
5043
|
};
|
|
4971
|
-
const unsubscription = i18nSubscribe(() => {
|
|
4972
|
-
setLabels({
|
|
4973
|
-
actionRestore: reactI18n('editorImageActionRestore'),
|
|
4974
|
-
actionSelect: reactI18n('editorImageActionSelect')
|
|
4975
|
-
});
|
|
4976
|
-
});
|
|
4977
5044
|
window.addEventListener('resize', refreshImageStyle);
|
|
4978
5045
|
return () => {
|
|
4979
5046
|
window.removeEventListener('resize', refreshImageStyle);
|
|
4980
|
-
unsubscription();
|
|
4981
5047
|
};
|
|
4982
5048
|
}, []);
|
|
4983
5049
|
useEffect(() => {
|
|
@@ -5040,7 +5106,7 @@ function RlsImageEditorComponent(props) {
|
|
|
5040
5106
|
context?.putImageData(originalImage.current, 0, 0);
|
|
5041
5107
|
}
|
|
5042
5108
|
}, []);
|
|
5043
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-image-editor", children: [jsxRuntimeExports.jsx("div", { ref: refBody, className: "rls-image-editor__body", children: jsxRuntimeExports.jsxs("div", { ref: refImage, className: "rls-image-editor__body__image", children: [jsxRuntimeExports.jsx("div", { ref: refSelection, className: "rls-image-editor__body__selection" }), jsxRuntimeExports.jsx("div", { ref: refOverlayTop, className: "rls-image-editor__body__overlay--top" }), jsxRuntimeExports.jsx("div", { ref: refOverlayRight, className: "rls-image-editor__body__overlay--right" }), jsxRuntimeExports.jsx("div", { ref: refOverlayBottom, className: "rls-image-editor__body__overlay--bottom" }), jsxRuntimeExports.jsx("div", { ref: refOverlayLeft, className: "rls-image-editor__body__overlay--left" }), jsxRuntimeExports.jsx("canvas", { ref: refCanvas })] }) }), jsxRuntimeExports.jsxs("div", { className: "rls-image-editor__footer", children: [jsxRuntimeExports.jsx("div", { className: "rls-image-editor__sliders", children: jsxRuntimeExports.jsx(RlsSlider, { prefixIcon: "
|
|
5109
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-image-editor", children: [jsxRuntimeExports.jsx("div", { ref: refBody, className: "rls-image-editor__body", children: jsxRuntimeExports.jsxs("div", { ref: refImage, className: "rls-image-editor__body__image", children: [jsxRuntimeExports.jsx("div", { ref: refSelection, className: "rls-image-editor__body__selection" }), jsxRuntimeExports.jsx("div", { ref: refOverlayTop, className: "rls-image-editor__body__overlay--top" }), jsxRuntimeExports.jsx("div", { ref: refOverlayRight, className: "rls-image-editor__body__overlay--right" }), jsxRuntimeExports.jsx("div", { ref: refOverlayBottom, className: "rls-image-editor__body__overlay--bottom" }), jsxRuntimeExports.jsx("div", { ref: refOverlayLeft, className: "rls-image-editor__body__overlay--left" }), jsxRuntimeExports.jsx("canvas", { ref: refCanvas })] }) }), jsxRuntimeExports.jsxs("div", { className: "rls-image-editor__footer", children: [jsxRuntimeExports.jsx("div", { className: "rls-image-editor__sliders", children: jsxRuntimeExports.jsx(RlsSlider, { prefixIcon: "crop", value: selection, minValue: MIN_SLIDER_VALUE, maxValue: MAX_SLIDER_VALUE, onValue: setSelection, disabled: props.disabled }) }), jsxRuntimeExports.jsxs("div", { className: "rls-image-editor__actions", children: [props.children, jsxRuntimeExports.jsx("button", { className: "rls-image-editor__action", "rls-theme": "standard", onClick: onRestore, disabled: props.disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: "refresh" }) }), jsxRuntimeExports.jsx("button", { className: "rls-image-editor__action", "rls-theme": "success", onClick: onCropImage, disabled: props.disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: "checkmark-circle-out" }) })] })] }), jsxRuntimeExports.jsx("canvas", { ref: refPicture })] }));
|
|
5044
5110
|
}
|
|
5045
5111
|
const RlsImageEditor = memo(RlsImageEditorComponent);
|
|
5046
5112
|
|
|
@@ -5098,7 +5164,7 @@ function useImageEditorController(options) {
|
|
|
5098
5164
|
setSrcEditor(undefined);
|
|
5099
5165
|
}, []);
|
|
5100
5166
|
const RlsImageEditorChooser = useMemo(() => {
|
|
5101
|
-
return (srcEditor && (jsxRuntimeExports.jsx(RlsImageEditorModal, { visible: true, src: srcEditor, formControl: options.formControl, maxWidth: options.maxWidth, quality: options.quality, ratio: options.ratio, selection: options.selection, onValue: onEditorValue, children: jsxRuntimeExports.jsx(
|
|
5167
|
+
return (srcEditor && (jsxRuntimeExports.jsx(RlsImageEditorModal, { visible: true, src: srcEditor, formControl: options.formControl, maxWidth: options.maxWidth, quality: options.quality, ratio: options.ratio, selection: options.selection, onValue: onEditorValue, children: jsxRuntimeExports.jsx("button", { className: "rls-image-editor__action", "rls-theme": "danger", onClick: onCancel, disabled: options.disabled, children: jsxRuntimeExports.jsx(RlsIcon, { value: "close" }) }) })));
|
|
5102
5168
|
}, [
|
|
5103
5169
|
srcEditor,
|
|
5104
5170
|
labels,
|
|
@@ -5506,5 +5572,5 @@ function useTabsController(options) {
|
|
|
5506
5572
|
return useMemo(() => ({ Tabs, formControl }), [Tabs, formControl]);
|
|
5507
5573
|
}
|
|
5508
5574
|
|
|
5509
|
-
export { APP_THEMES, ConfirmationResult, DEFAULT_COLOR, RlsAccordion, RlsAlert, RlsAmount, RlsAppThemeTabs, RlsApplication, RlsAreaText, RlsAvatar, RlsBadge, RlsBallot, RlsBody, RlsBottomSheet, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonIcon, RlsButtonOption, RlsButtonProgress, RlsButtonStepper, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsChip, RlsChipGroup, RlsChooserAutocomplete, RlsChooserAutocompleteTemplate, RlsChooserList, RlsChooserListTemplate, RlsChooserSelect, RlsChooserSelectTemplate, RlsConfirmation, RlsContent, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableFloating, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsDropdown, RlsFieldArea, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldClock, RlsFieldColor, RlsFieldDate, RlsFieldDateRange, RlsFieldDecimal, RlsFieldFile, RlsFieldList, RlsFieldListSuggestions, RlsFieldListTemplate, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldPercentage, RlsFieldReadonly, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsHoverSwap, RlsIcon, RlsImage, RlsImageChooser, RlsImageEditor, RlsInput, RlsInputCounter, RlsInputDecimal, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputPercentage, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsLed, RlsLedColor, RlsMessageEmpty, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsModalClock, RlsModalDate, RlsModalDateRange, RlsModalSheet, RlsNavbar, RlsNavbarMenu, RlsPagination, RlsPickerClock, RlsPickerColor, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSlider, RlsSnackbar, RlsSpinner, RlsSwitch, RlsSwitchControl, RlsTabs, RlsTabularText, RlsToolbar, calculateImgDimension, generateThemePalette, getAppTheme, getRemSize$1 as getRemSize, hexIsValid, hexToHsl, hexToHsv, hexToRgb, hslToHex, hsvToHex, hsvToRgb, normalizeHex, rangeFormatTemplate, renderClassStatus, rgbToHex, rgbToHsl, rgbToHsv, setAppTheme, setDesignSystem, setErrorsI18n, setThemeColor, toggleAppTheme, useAppThemeController, useConfirmation, useDatatable, useDesingSystemController, useDropdownController, useEventCallback, useFieldAutocomplete, useFieldList, useFieldSelect, useFormSingleSelectionController, useFormToggleController, useImageEditorController, useListController, useNotifications, usePortalController, useRelocationOnComponent, useResize, useRlsContext, useSnackbar, useTabsController };
|
|
5575
|
+
export { APP_THEMES, ConfirmationResult, DEFAULT_COLOR, RlsAccordion, RlsAlert, RlsAmount, RlsAppThemeTabs, RlsApplication, RlsAreaText, RlsAvatar, RlsBadge, RlsBallot, RlsBody, RlsBottomSheet, RlsBreadcrumb, RlsButton, RlsButtonAction, RlsButtonIcon, RlsButtonOption, RlsButtonProgress, RlsButtonStepper, RlsButtonToggle, RlsCard, RlsCheckBox, RlsCheckBoxControl, RlsChip, RlsChipGroup, RlsChooserAutocomplete, RlsChooserAutocompleteTemplate, RlsChooserList, RlsChooserListTemplate, RlsChooserSelect, RlsChooserSelectTemplate, RlsConfirmation, RlsContent, RlsContext, RlsDatatable, RlsDatatableCell, RlsDatatableData, RlsDatatableFloating, RlsDatatableHeader, RlsDatatableRecord, RlsDatatableSubheader, RlsDatatableTitle, RlsDatatableTotals, RlsDropdown, RlsFieldArea, RlsFieldAutocomplete, RlsFieldAutocompleteTemplate, RlsFieldClock, RlsFieldColor, RlsFieldDate, RlsFieldDateRange, RlsFieldDecimal, RlsFieldFile, RlsFieldList, RlsFieldListSuggestions, RlsFieldListTemplate, RlsFieldMoney, RlsFieldNumber, RlsFieldPassword, RlsFieldPercentage, RlsFieldReadonly, RlsFieldSelect, RlsFieldSelectTemplate, RlsFieldText, RlsFormNavigation, RlsHoverSwap, RlsIcon, RlsImage, RlsImageChooser, RlsImageEditor, RlsInput, RlsInputCounter, RlsInputDecimal, RlsInputMoney, RlsInputNumber, RlsInputPassword, RlsInputPercentage, RlsInputSearch, RlsInputText, RlsLabel, RlsLabelCheckBox, RlsLabelRadioButton, RlsLabelSwitch, RlsLed, RlsLedColor, RlsMessageEmpty, RlsMessageFormError, RlsMessageIcon, RlsModal, RlsModalClock, RlsModalDate, RlsModalDateRange, RlsModalSheet, RlsNavbar, RlsNavbarMenu, RlsPagination, RlsPickerClock, RlsPickerColor, RlsPickerDate, RlsPickerDateRange, RlsPickerDay, RlsPickerDayRange, RlsPickerMonth, RlsPickerSelectorTitle, RlsPickerYear, RlsPoster, RlsProgressBar, RlsProgressCircular, RlsRadioButton, RlsSkeleton, RlsSkeletonText, RlsSlider, RlsSnackbar, RlsSpinner, RlsSwitch, RlsSwitchControl, RlsTabs, RlsTabularText, RlsToolbar, calculateImgDimension, generateThemeAlias, generateThemePalette, getAppTheme, getRemSize$1 as getRemSize, hexIsValid, hexToHsl, hexToHsv, hexToRgb, hslToHex, hsvToHex, hsvToRgb, normalizeHex, rangeFormatTemplate, renderClassStatus, resetTheme, rgbToHex, rgbToHsl, rgbToHsv, setAppTheme, setDesignSystem, setErrorsI18n, setThemeAlias, setThemeColor, toggleAppTheme, useAppThemeController, useConfirmation, useDatatable, useDesingSystemController, useDropdownController, useEventCallback, useFieldAutocomplete, useFieldList, useFieldSelect, useFormSingleSelectionController, useFormToggleController, useImageEditorController, useListController, useNotifications, usePortalController, useRelocationOnComponent, useResize, useRlsContext, useSnackbar, useTabsController };
|
|
5510
5576
|
//# sourceMappingURL=index.mjs.map
|