@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/cjs/index.cjs
CHANGED
|
@@ -1253,13 +1253,18 @@ function generateThemeCSS(colors, theme) {
|
|
|
1253
1253
|
const rgb900 = rgbChannels(parseHex(colors['900']));
|
|
1254
1254
|
const rgb700 = rgbChannels(parseHex(colors['700']));
|
|
1255
1255
|
const rgb500 = rgbChannels(parseHex(colors['500']));
|
|
1256
|
+
const rgb300 = rgbChannels(parseHex(colors['300']));
|
|
1256
1257
|
const colorProps = SHADE_LABELS.map((label) => prop(`color-${label}`, colors[label]));
|
|
1257
1258
|
const gradientProps = GRADIENT_LABELS.map((label) => {
|
|
1258
1259
|
const darker = SHADE_LABELS[SHADE_LABELS.indexOf(label) - 1];
|
|
1259
1260
|
return prop(`gradient-${label}`, `linear-gradient(180deg, ${colors[label]} 15%, ${colors[darker]} 85%)`);
|
|
1260
1261
|
});
|
|
1261
1262
|
const backdropProps = BACKDROP_LABELS.map((label) => prop(`backdrop-${label}`, `rgba(${rgb900}, ${Number(label) / 1000})`));
|
|
1262
|
-
const
|
|
1263
|
+
const skeletonOpacities = Object.entries(SKELETON_OPACITY);
|
|
1264
|
+
const skeletonProps = skeletonOpacities.map(([label, opacity]) => prop(`skeleton-${label}`, `rgba(${rgb700}, ${opacity})`));
|
|
1265
|
+
// Skeleton tokens for dark surfaces, taken from the light step that mirrors
|
|
1266
|
+
// color-700 around color-500, as the foundations mixin does.
|
|
1267
|
+
const skeletonDarkProps = skeletonOpacities.map(([label, opacity]) => prop(`skeleton-dark-${label}`, `rgba(${rgb300}, ${opacity})`));
|
|
1263
1268
|
const shadowProps = [
|
|
1264
1269
|
prop('shadow-color-500', `rgba(${rgb500}, 0.24)`),
|
|
1265
1270
|
prop('shadow-500', `0px 0px 0px 3px rgba(${rgb500}, 0.24)`)
|
|
@@ -1269,6 +1274,7 @@ function generateThemeCSS(colors, theme) {
|
|
|
1269
1274
|
...gradientProps,
|
|
1270
1275
|
...backdropProps,
|
|
1271
1276
|
...skeletonProps,
|
|
1277
|
+
...skeletonDarkProps,
|
|
1272
1278
|
...shadowProps
|
|
1273
1279
|
];
|
|
1274
1280
|
}
|
|
@@ -1338,12 +1344,69 @@ function setThemeColor(baseColor, theme = 'primary') {
|
|
|
1338
1344
|
if (typeof document === 'undefined') {
|
|
1339
1345
|
return;
|
|
1340
1346
|
}
|
|
1347
|
+
resetTheme(theme);
|
|
1341
1348
|
const { properties } = generateThemePalette(baseColor, theme);
|
|
1342
1349
|
const target = document.body || document.documentElement;
|
|
1343
1350
|
properties.forEach(({ name, value }) => {
|
|
1344
1351
|
target.style.setProperty(name, value);
|
|
1345
1352
|
});
|
|
1346
1353
|
}
|
|
1354
|
+
const ALIAS_LABELS = [
|
|
1355
|
+
'900',
|
|
1356
|
+
'800',
|
|
1357
|
+
'700',
|
|
1358
|
+
'600',
|
|
1359
|
+
'500',
|
|
1360
|
+
'400',
|
|
1361
|
+
'300',
|
|
1362
|
+
'200',
|
|
1363
|
+
'100'
|
|
1364
|
+
];
|
|
1365
|
+
const SKELETON_LABELS = Object.keys(SKELETON_OPACITY);
|
|
1366
|
+
const ALIAS_TOKENS = [
|
|
1367
|
+
...SHADE_LABELS.map((label) => `color-${label}`),
|
|
1368
|
+
...ALIAS_LABELS.map((label) => `gradient-${label}`),
|
|
1369
|
+
...ALIAS_LABELS.map((label) => `backdrop-${label}`),
|
|
1370
|
+
...SKELETON_LABELS.map((label) => `skeleton-${label}`),
|
|
1371
|
+
...SKELETON_LABELS.map((label) => `skeleton-dark-${label}`),
|
|
1372
|
+
'shadow-color-500',
|
|
1373
|
+
'shadow-500'
|
|
1374
|
+
];
|
|
1375
|
+
function resetTheme(theme = 'primary') {
|
|
1376
|
+
if (typeof document === 'undefined') {
|
|
1377
|
+
return;
|
|
1378
|
+
}
|
|
1379
|
+
const target = document.body || document.documentElement;
|
|
1380
|
+
ALIAS_TOKENS.forEach((token) => {
|
|
1381
|
+
target.style.removeProperty(`--rls-${theme}-${token}`);
|
|
1382
|
+
});
|
|
1383
|
+
}
|
|
1384
|
+
function generateThemeAlias(source, theme = 'primary') {
|
|
1385
|
+
const properties = ALIAS_TOKENS.map((token) => ({
|
|
1386
|
+
name: `--rls-${theme}-${token}`,
|
|
1387
|
+
value: `var(--rls-${source}-${token})`
|
|
1388
|
+
}));
|
|
1389
|
+
return {
|
|
1390
|
+
source,
|
|
1391
|
+
theme,
|
|
1392
|
+
properties,
|
|
1393
|
+
css: properties.map((p) => `${p.name}: ${p.value};`).join('\n')
|
|
1394
|
+
};
|
|
1395
|
+
}
|
|
1396
|
+
function setThemeAlias(source, theme = 'primary') {
|
|
1397
|
+
if (typeof document === 'undefined') {
|
|
1398
|
+
return;
|
|
1399
|
+
}
|
|
1400
|
+
if (source === theme) {
|
|
1401
|
+
resetTheme(theme);
|
|
1402
|
+
return;
|
|
1403
|
+
}
|
|
1404
|
+
const { properties } = generateThemeAlias(source, theme);
|
|
1405
|
+
const target = document.body || document.documentElement;
|
|
1406
|
+
properties.forEach(({ name, value }) => {
|
|
1407
|
+
target.style.setProperty(name, value);
|
|
1408
|
+
});
|
|
1409
|
+
}
|
|
1347
1410
|
const DEFAULT_COLOR = '#1780e0';
|
|
1348
1411
|
|
|
1349
1412
|
const CONTENT_BACKGROUND = '--pvt-content-background';
|
|
@@ -3823,11 +3886,20 @@ const RlsModal = require$$0.memo(RlsModalComponent);
|
|
|
3823
3886
|
function formatTime(value) {
|
|
3824
3887
|
return String(value).padStart(2, '0');
|
|
3825
3888
|
}
|
|
3889
|
+
function pointerIsInsideTick({ clientX, clientY }, tick) {
|
|
3890
|
+
const { left, top, width, height } = tick.getBoundingClientRect();
|
|
3891
|
+
const distanceX = clientX - (left + width / 2);
|
|
3892
|
+
const distanceY = clientY - (top + height / 2);
|
|
3893
|
+
const radius = Math.min(width, height) / 2;
|
|
3894
|
+
return distanceX ** 2 + distanceY ** 2 <= radius ** 2;
|
|
3895
|
+
}
|
|
3826
3896
|
const CLOCK_VALUES = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12];
|
|
3897
|
+
const CLOCK_HOURS = 12;
|
|
3898
|
+
const CLOCK_MINUTES = 60;
|
|
3827
3899
|
const RADIUS = 48;
|
|
3828
3900
|
const DIAL_RADIUS = 60;
|
|
3829
3901
|
const TICK_RADIUS = 7;
|
|
3830
|
-
function RlsPickerClockTick({
|
|
3902
|
+
function RlsPickerClockTick({ selectionIsHours, value }) {
|
|
3831
3903
|
const styleTick = require$$0.useMemo(() => {
|
|
3832
3904
|
const radian = (value / 6) * Math.PI;
|
|
3833
3905
|
const x = Math.sin(radian) * RADIUS;
|
|
@@ -3837,20 +3909,13 @@ function RlsPickerClockTick({ onValue, selectionIsHours, value }) {
|
|
|
3837
3909
|
top: `${DIAL_RADIUS - y - TICK_RADIUS - 1}rem`
|
|
3838
3910
|
};
|
|
3839
3911
|
}, []);
|
|
3840
|
-
const
|
|
3912
|
+
const tickValue = require$$0.useMemo(() => {
|
|
3841
3913
|
if (selectionIsHours) {
|
|
3842
|
-
return
|
|
3843
|
-
}
|
|
3844
|
-
if (value === 12) {
|
|
3845
|
-
return formatTime(0);
|
|
3914
|
+
return value;
|
|
3846
3915
|
}
|
|
3847
|
-
return
|
|
3916
|
+
return value === CLOCK_HOURS ? 0 : value * 5;
|
|
3848
3917
|
}, [selectionIsHours]);
|
|
3849
|
-
|
|
3850
|
-
event.preventDefault();
|
|
3851
|
-
onValue(value);
|
|
3852
|
-
}, [onValue]);
|
|
3853
|
-
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__tick", style: styleTick, onClick: onClick, children: label }));
|
|
3918
|
+
return (jsxRuntimeExports.jsx("div", { className: "rls-picker-clock__tick", style: styleTick, "data-value": tickValue, children: formatTime(tickValue) }));
|
|
3854
3919
|
}
|
|
3855
3920
|
function RlsPickerClockComponent({ formControl, onListener, rlsTheme, time }) {
|
|
3856
3921
|
const timeInitial = require$$0.useMemo(() => {
|
|
@@ -3923,22 +3988,6 @@ function RlsPickerClockComponent({ formControl, onListener, rlsTheme, time }) {
|
|
|
3923
3988
|
}
|
|
3924
3989
|
changeIsInternal.current = false;
|
|
3925
3990
|
}, [formControl?.value]);
|
|
3926
|
-
const refreshComponent = require$$0.useCallback((clientX, clientY) => {
|
|
3927
|
-
const rectangle = plateElement.current.getBoundingClientRect();
|
|
3928
|
-
const centerX = rectangle.left + rectangle.width / 2;
|
|
3929
|
-
const centerY = rectangle.top + rectangle.height / 2;
|
|
3930
|
-
const positionX = clientX - centerX;
|
|
3931
|
-
const positionY = clientY - centerY;
|
|
3932
|
-
const angle = Math.atan2(-positionX, positionY) + Math.PI;
|
|
3933
|
-
const value = Math.round(angle / radianUnit);
|
|
3934
|
-
refreshClock(value);
|
|
3935
|
-
if (selectionIsHours) {
|
|
3936
|
-
setHour(value === 0 ? 12 : value);
|
|
3937
|
-
}
|
|
3938
|
-
else {
|
|
3939
|
-
setMinute(value);
|
|
3940
|
-
}
|
|
3941
|
-
}, [selectionIsHours, radianUnit]);
|
|
3942
3991
|
const refreshClock = require$$0.useCallback((value) => {
|
|
3943
3992
|
const angle = value * radianUnit;
|
|
3944
3993
|
const x2 = Math.sin(angle) * (RADIUS - TICK_RADIUS);
|
|
@@ -3954,6 +4003,27 @@ function RlsPickerClockComponent({ formControl, onListener, rlsTheme, time }) {
|
|
|
3954
4003
|
pointElement.current.style.visibility =
|
|
3955
4004
|
selectionIsHours || value % 5 === 0 ? 'hidden' : 'visible';
|
|
3956
4005
|
}, [selectionIsHours, radianUnit]);
|
|
4006
|
+
const selectValue = require$$0.useCallback((value) => {
|
|
4007
|
+
refreshClock(value);
|
|
4008
|
+
if (selectionIsHours) {
|
|
4009
|
+
setHour(value === 0 ? CLOCK_HOURS : value);
|
|
4010
|
+
}
|
|
4011
|
+
else {
|
|
4012
|
+
setMinute(value);
|
|
4013
|
+
}
|
|
4014
|
+
}, [selectionIsHours, refreshClock]);
|
|
4015
|
+
const selectFromPosition = require$$0.useCallback((clientX, clientY) => {
|
|
4016
|
+
const rectangle = plateElement.current.getBoundingClientRect();
|
|
4017
|
+
const centerX = rectangle.left + rectangle.width / 2;
|
|
4018
|
+
const centerY = rectangle.top + rectangle.height / 2;
|
|
4019
|
+
const positionX = clientX - centerX;
|
|
4020
|
+
const positionY = clientY - centerY;
|
|
4021
|
+
// Angle in [0, 2π) measured clockwise from 12 o'clock
|
|
4022
|
+
const angle = Math.atan2(-positionX, positionY) + Math.PI;
|
|
4023
|
+
const steps = selectionIsHours ? CLOCK_HOURS : CLOCK_MINUTES;
|
|
4024
|
+
// Modulo keeps the last half step before 12 o'clock as 0, not as 60/12
|
|
4025
|
+
selectValue(Math.round(angle / radianUnit) % steps);
|
|
4026
|
+
}, [selectionIsHours, radianUnit, selectValue]);
|
|
3957
4027
|
const onClickHour = require$$0.useCallback(() => {
|
|
3958
4028
|
setSelectionIsHours(true);
|
|
3959
4029
|
}, []);
|
|
@@ -3966,49 +4036,56 @@ function RlsPickerClockComponent({ formControl, onListener, rlsTheme, time }) {
|
|
|
3966
4036
|
const onClickPM = require$$0.useCallback(() => {
|
|
3967
4037
|
setZoneIsPM(true);
|
|
3968
4038
|
}, []);
|
|
3969
|
-
const
|
|
4039
|
+
const onPointerDown = require$$0.useCallback((event) => {
|
|
4040
|
+
event.preventDefault();
|
|
4041
|
+
event.currentTarget.setPointerCapture(event.pointerId);
|
|
3970
4042
|
selectionIsActive.current = true;
|
|
3971
|
-
|
|
3972
|
-
|
|
4043
|
+
const tick = event.target.closest('.rls-picker-clock__tick');
|
|
4044
|
+
// Pressing inside a label circle snaps to its exact value,
|
|
4045
|
+
// anywhere else (and while dragging) the angle decides
|
|
4046
|
+
if (tick?.dataset.value && pointerIsInsideTick(event, tick)) {
|
|
4047
|
+
selectValue(Number(tick.dataset.value));
|
|
4048
|
+
}
|
|
4049
|
+
else {
|
|
4050
|
+
selectFromPosition(event.clientX, event.clientY);
|
|
4051
|
+
}
|
|
4052
|
+
}, [selectValue, selectFromPosition]);
|
|
4053
|
+
const onPointerMove = require$$0.useCallback((event) => {
|
|
3973
4054
|
if (selectionIsActive.current) {
|
|
3974
|
-
event.
|
|
3975
|
-
refreshComponent(event.clientX, event.clientY);
|
|
4055
|
+
selectFromPosition(event.clientX, event.clientY);
|
|
3976
4056
|
}
|
|
3977
|
-
}, [
|
|
3978
|
-
const
|
|
3979
|
-
|
|
3980
|
-
|
|
3981
|
-
refreshComponent(touch.clientX, touch.clientY);
|
|
4057
|
+
}, [selectFromPosition]);
|
|
4058
|
+
const onPointerUp = require$$0.useCallback(() => {
|
|
4059
|
+
if (!selectionIsActive.current) {
|
|
4060
|
+
return;
|
|
3982
4061
|
}
|
|
3983
|
-
}, [refreshComponent]);
|
|
3984
|
-
const onInactiveSelection = require$$0.useCallback(() => {
|
|
3985
4062
|
selectionIsActive.current = false;
|
|
3986
|
-
|
|
3987
|
-
const onClickValue = require$$0.useCallback((value) => {
|
|
4063
|
+
// Once the hour is chosen, continue with the minutes
|
|
3988
4064
|
if (selectionIsHours) {
|
|
3989
|
-
|
|
3990
|
-
refreshClock(value);
|
|
3991
|
-
}
|
|
3992
|
-
else {
|
|
3993
|
-
const minute = value === 12 ? 0 : value * 5;
|
|
3994
|
-
setMinute(minute);
|
|
3995
|
-
refreshClock(minute);
|
|
4065
|
+
setSelectionIsHours(false);
|
|
3996
4066
|
}
|
|
3997
4067
|
}, [selectionIsHours]);
|
|
4068
|
+
const onPointerCancel = require$$0.useCallback(() => {
|
|
4069
|
+
selectionIsActive.current = false;
|
|
4070
|
+
}, []);
|
|
3998
4071
|
const onCancel = require$$0.useCallback(() => {
|
|
3999
4072
|
onListener?.({ event: components.PickerListenerEvent.Cancel });
|
|
4000
4073
|
}, [onListener]);
|
|
4001
4074
|
const onCurrentTime = require$$0.useCallback(() => {
|
|
4002
4075
|
const currentTime = dates.Time.now();
|
|
4076
|
+
const zoneIsPM = currentTime.hour >= 12;
|
|
4077
|
+
const hour = zoneIsPM ? currentTime.hour - 12 : currentTime.hour;
|
|
4003
4078
|
changeIsInternal.current = true;
|
|
4004
4079
|
formControl?.setValue(currentTime);
|
|
4005
|
-
|
|
4080
|
+
setZoneIsPM(zoneIsPM);
|
|
4081
|
+
setHour(hour);
|
|
4006
4082
|
setMinute(currentTime.minute);
|
|
4083
|
+
refreshClock(selectionIsHours ? hour : currentTime.minute);
|
|
4007
4084
|
onListener?.({
|
|
4008
4085
|
event: components.PickerListenerEvent.Select,
|
|
4009
4086
|
value: currentTime
|
|
4010
4087
|
});
|
|
4011
|
-
}, [formControl, onListener]);
|
|
4088
|
+
}, [formControl, onListener, selectionIsHours, refreshClock]);
|
|
4012
4089
|
const onSelect = require$$0.useCallback(() => {
|
|
4013
4090
|
const hourValue = zoneIsPM
|
|
4014
4091
|
? hour !== 12
|
|
@@ -4025,10 +4102,10 @@ function RlsPickerClockComponent({ formControl, onListener, rlsTheme, time }) {
|
|
|
4025
4102
|
value: timeValue
|
|
4026
4103
|
});
|
|
4027
4104
|
}, [formControl, hour, minute, zoneIsPM, onListener]);
|
|
4028
|
-
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,
|
|
4105
|
+
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: {
|
|
4029
4106
|
transform: `translate(${DIAL_RADIUS}rem, ${DIAL_RADIUS}rem)`
|
|
4030
4107
|
}, 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) => {
|
|
4031
|
-
return (jsxRuntimeExports.jsx(RlsPickerClockTick, { value: value, selectionIsHours: selectionIsHours
|
|
4108
|
+
return (jsxRuntimeExports.jsx(RlsPickerClockTick, { value: value, selectionIsHours: selectionIsHours }, value));
|
|
4032
4109
|
}) })] }) }), 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 }) })] })] }));
|
|
4033
4110
|
}
|
|
4034
4111
|
const RlsPickerClock = require$$0.memo(RlsPickerClockComponent);
|
|
@@ -4842,10 +4919,6 @@ function calculateImgDimension(image, dimension) {
|
|
|
4842
4919
|
}
|
|
4843
4920
|
function RlsImageEditorComponent(props) {
|
|
4844
4921
|
const [selection, setSelection] = require$$0.useState(props.selection ?? 60);
|
|
4845
|
-
const [labels, setLabels] = require$$0.useState({
|
|
4846
|
-
actionRestore: reactI18n('editorImageActionRestore'),
|
|
4847
|
-
actionSelect: reactI18n('editorImageActionSelect')
|
|
4848
|
-
});
|
|
4849
4922
|
const refBody = require$$0.useRef(null);
|
|
4850
4923
|
const refImage = require$$0.useRef(null);
|
|
4851
4924
|
const refSelection = require$$0.useRef(null);
|
|
@@ -4970,16 +5043,9 @@ function RlsImageEditorComponent(props) {
|
|
|
4970
5043
|
refreshImageStyle();
|
|
4971
5044
|
refreshSelectionStyle(selection);
|
|
4972
5045
|
};
|
|
4973
|
-
const unsubscription = i18n.i18nSubscribe(() => {
|
|
4974
|
-
setLabels({
|
|
4975
|
-
actionRestore: reactI18n('editorImageActionRestore'),
|
|
4976
|
-
actionSelect: reactI18n('editorImageActionSelect')
|
|
4977
|
-
});
|
|
4978
|
-
});
|
|
4979
5046
|
window.addEventListener('resize', refreshImageStyle);
|
|
4980
5047
|
return () => {
|
|
4981
5048
|
window.removeEventListener('resize', refreshImageStyle);
|
|
4982
|
-
unsubscription();
|
|
4983
5049
|
};
|
|
4984
5050
|
}, []);
|
|
4985
5051
|
require$$0.useEffect(() => {
|
|
@@ -5042,7 +5108,7 @@ function RlsImageEditorComponent(props) {
|
|
|
5042
5108
|
context?.putImageData(originalImage.current, 0, 0);
|
|
5043
5109
|
}
|
|
5044
5110
|
}, []);
|
|
5045
|
-
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: "
|
|
5111
|
+
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 })] }));
|
|
5046
5112
|
}
|
|
5047
5113
|
const RlsImageEditor = require$$0.memo(RlsImageEditorComponent);
|
|
5048
5114
|
|
|
@@ -5100,7 +5166,7 @@ function useImageEditorController(options) {
|
|
|
5100
5166
|
setSrcEditor(undefined);
|
|
5101
5167
|
}, []);
|
|
5102
5168
|
const RlsImageEditorChooser = require$$0.useMemo(() => {
|
|
5103
|
-
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(
|
|
5169
|
+
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" }) }) })));
|
|
5104
5170
|
}, [
|
|
5105
5171
|
srcEditor,
|
|
5106
5172
|
labels,
|
|
@@ -5630,6 +5696,7 @@ exports.RlsTabs = RlsTabs;
|
|
|
5630
5696
|
exports.RlsTabularText = RlsTabularText;
|
|
5631
5697
|
exports.RlsToolbar = RlsToolbar;
|
|
5632
5698
|
exports.calculateImgDimension = calculateImgDimension;
|
|
5699
|
+
exports.generateThemeAlias = generateThemeAlias;
|
|
5633
5700
|
exports.generateThemePalette = generateThemePalette;
|
|
5634
5701
|
exports.getAppTheme = getAppTheme;
|
|
5635
5702
|
exports.getRemSize = getRemSize$1;
|
|
@@ -5643,12 +5710,14 @@ exports.hsvToRgb = hsvToRgb;
|
|
|
5643
5710
|
exports.normalizeHex = normalizeHex;
|
|
5644
5711
|
exports.rangeFormatTemplate = rangeFormatTemplate;
|
|
5645
5712
|
exports.renderClassStatus = renderClassStatus;
|
|
5713
|
+
exports.resetTheme = resetTheme;
|
|
5646
5714
|
exports.rgbToHex = rgbToHex;
|
|
5647
5715
|
exports.rgbToHsl = rgbToHsl;
|
|
5648
5716
|
exports.rgbToHsv = rgbToHsv;
|
|
5649
5717
|
exports.setAppTheme = setAppTheme;
|
|
5650
5718
|
exports.setDesignSystem = setDesignSystem;
|
|
5651
5719
|
exports.setErrorsI18n = setErrorsI18n;
|
|
5720
|
+
exports.setThemeAlias = setThemeAlias;
|
|
5652
5721
|
exports.setThemeColor = setThemeColor;
|
|
5653
5722
|
exports.toggleAppTheme = toggleAppTheme;
|
|
5654
5723
|
exports.useAppThemeController = useAppThemeController;
|