@rolster/react-components 19.6.3 → 19.6.4
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 +31 -24
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/es/index.mjs +4521 -0
- package/dist/es/index.mjs.map +1 -0
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.d.ts +2 -3
- package/dist/esm/components/atoms/Breadcrumb/Breadcrumb.js.map +1 -1
- package/dist/esm/components/atoms/ProgressCircular/ProgressCircular.d.ts +2 -6
- package/dist/esm/components/atoms/ProgressCircular/ProgressCircular.js.map +1 -1
- package/dist/esm/components/definitions.d.ts +1 -1
- package/dist/esm/components/molecules/ButtonProgress/ButtonProgress.d.ts +2 -3
- package/dist/esm/components/molecules/ButtonProgress/ButtonProgress.js.map +1 -1
- package/dist/esm/components/organisms/Confirmation/Confirmation.d.ts +4 -7
- package/dist/esm/components/organisms/Confirmation/Confirmation.js.map +1 -1
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.js +17 -9
- package/dist/esm/components/organisms/ImageEditor/ImageEditor.js.map +1 -1
- package/dist/esm/components/organisms/Snackbar/Snackbar.d.ts +2 -3
- package/dist/esm/components/organisms/Snackbar/Snackbar.js.map +1 -1
- package/dist/esm/helpers/color.d.ts +1 -1
- package/dist/esm/helpers/color.js +1 -10
- package/dist/esm/helpers/color.js.map +1 -1
- package/dist/esm/types.d.ts +7 -0
- package/dist/esm/types.js +1 -1
- package/dist/esm/types.js.map +1 -1
- package/package.json +22 -22
package/dist/cjs/index.cjs
CHANGED
|
@@ -414,13 +414,21 @@ function requireReactJsxRuntime_development () {
|
|
|
414
414
|
return reactJsxRuntime_development;
|
|
415
415
|
}
|
|
416
416
|
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
417
|
+
var hasRequiredJsxRuntime;
|
|
418
|
+
|
|
419
|
+
function requireJsxRuntime () {
|
|
420
|
+
if (hasRequiredJsxRuntime) return jsxRuntime.exports;
|
|
421
|
+
hasRequiredJsxRuntime = 1;
|
|
422
|
+
|
|
423
|
+
if (process.env.NODE_ENV === 'production') {
|
|
424
|
+
jsxRuntime.exports = requireReactJsxRuntime_production();
|
|
425
|
+
} else {
|
|
426
|
+
jsxRuntime.exports = requireReactJsxRuntime_development();
|
|
427
|
+
}
|
|
428
|
+
return jsxRuntime.exports;
|
|
421
429
|
}
|
|
422
430
|
|
|
423
|
-
var jsxRuntimeExports =
|
|
431
|
+
var jsxRuntimeExports = requireJsxRuntime();
|
|
424
432
|
|
|
425
433
|
function renderClassStatus(base, status = {}, additionals) {
|
|
426
434
|
const _classElement = [base];
|
|
@@ -1139,13 +1147,8 @@ function oklabToLinearRgb(l, a, b) {
|
|
|
1139
1147
|
}
|
|
1140
1148
|
const inGamut = ([r, g, b]) => {
|
|
1141
1149
|
const e = 1e-4;
|
|
1142
|
-
return r >= -e && r <= 1 + e && g >= -e && g <= 1 + e && b >= -e && b <= 1 + e;
|
|
1150
|
+
return (r >= -e && r <= 1 + e && g >= -e && g <= 1 + e && b >= -e && b <= 1 + e);
|
|
1143
1151
|
};
|
|
1144
|
-
/**
|
|
1145
|
-
* Converts an OKLCH color to sRGB. If the requested chroma falls outside the
|
|
1146
|
-
* sRGB gamut, chroma is reduced (binary search) while keeping lightness and
|
|
1147
|
-
* hue fixed — this preserves the intended tone instead of clipping channels.
|
|
1148
|
-
*/
|
|
1149
1152
|
function oklchToRgb({ l, c, h }) {
|
|
1150
1153
|
const a = Math.cos(h);
|
|
1151
1154
|
const b = Math.sin(h);
|
|
@@ -1167,10 +1170,6 @@ function oklchToRgb({ l, c, h }) {
|
|
|
1167
1170
|
const [lr, lg, lb] = linearAt(c);
|
|
1168
1171
|
return { r: linearToSrgb(lr), g: linearToSrgb(lg), b: linearToSrgb(lb) };
|
|
1169
1172
|
}
|
|
1170
|
-
/**
|
|
1171
|
-
* Scales chroma down toward the lightness extremes (very light / very dark) so
|
|
1172
|
-
* shades do not look oversaturated at the ends. Peaks at L=0.5 (factor 1).
|
|
1173
|
-
*/
|
|
1174
1173
|
const chromaFactor = (lightness) => 0.4 + 0.6 * (1 - Math.abs(lightness - 0.5) * 2);
|
|
1175
1174
|
function detectShadeLevel(lightness) {
|
|
1176
1175
|
let bestLevel = '500';
|
|
@@ -3979,8 +3978,8 @@ function useResize(props) {
|
|
|
3979
3978
|
}, []);
|
|
3980
3979
|
}
|
|
3981
3980
|
|
|
3982
|
-
const
|
|
3983
|
-
const
|
|
3981
|
+
const MIN_SLIDER_VALUE = 50;
|
|
3982
|
+
const MAX_SLIDER_VALUE = 100;
|
|
3984
3983
|
function getRatioFactor(ratio) {
|
|
3985
3984
|
switch (ratio) {
|
|
3986
3985
|
case '16:9':
|
|
@@ -4028,6 +4027,7 @@ function RlsImageEditor(props) {
|
|
|
4028
4027
|
const refPicture = require$$0.useRef(null);
|
|
4029
4028
|
const image = require$$0.useRef(new Image());
|
|
4030
4029
|
const originalImage = require$$0.useRef(undefined);
|
|
4030
|
+
const hasInteracted = require$$0.useRef(false);
|
|
4031
4031
|
const ratio = require$$0.useMemo(() => {
|
|
4032
4032
|
return props.ratio || '1:1';
|
|
4033
4033
|
}, [props.ratio]);
|
|
@@ -4086,18 +4086,22 @@ function RlsImageEditor(props) {
|
|
|
4086
4086
|
image.current.width > 0 &&
|
|
4087
4087
|
image.current.height > 0) {
|
|
4088
4088
|
const { height, width } = image.current.width >= image.current.height
|
|
4089
|
-
?
|
|
4090
|
-
:
|
|
4089
|
+
? refreshSelectionFromWidth(rateSelection)
|
|
4090
|
+
: refreshSelectionFromHeight(rateSelection);
|
|
4091
4091
|
refSelection.current.style.width = `${width}px`;
|
|
4092
4092
|
refSelection.current.style.height = `${height}px`;
|
|
4093
|
+
const left = refImage.current.offsetWidth - width;
|
|
4094
|
+
const top = refImage.current.offsetHeight - height;
|
|
4095
|
+
if (!hasInteracted.current) {
|
|
4096
|
+
refSelection.current.style.left = `${left / 2}px`;
|
|
4097
|
+
refSelection.current.style.top = `${top / 2}px`;
|
|
4098
|
+
}
|
|
4093
4099
|
if (refSelection.current.offsetLeft + width >
|
|
4094
4100
|
refImage.current.offsetWidth) {
|
|
4095
|
-
const left = refImage.current.offsetWidth - width;
|
|
4096
4101
|
refSelection.current.style.left = `${left < 0 ? 0 : left}px`;
|
|
4097
4102
|
}
|
|
4098
4103
|
if (refSelection.current.offsetTop + height >
|
|
4099
4104
|
refImage.current.offsetHeight) {
|
|
4100
|
-
const top = refImage.current.offsetHeight - height;
|
|
4101
4105
|
refSelection.current.style.top = `${top < 0 ? 0 : top}px`;
|
|
4102
4106
|
}
|
|
4103
4107
|
refreshOverlaysStyle();
|
|
@@ -4121,7 +4125,7 @@ function RlsImageEditor(props) {
|
|
|
4121
4125
|
const width = (refBody.current.offsetHeight * image.current.width) /
|
|
4122
4126
|
image.current.height;
|
|
4123
4127
|
return setImageStyle(`${width}px`, '100%');
|
|
4124
|
-
}, [
|
|
4128
|
+
}, []);
|
|
4125
4129
|
require$$0.useEffect(() => {
|
|
4126
4130
|
image.current.onload = () => {
|
|
4127
4131
|
const context = refCanvas.current.getContext('2d', {
|
|
@@ -4160,7 +4164,10 @@ function RlsImageEditor(props) {
|
|
|
4160
4164
|
useRelocationOnComponent({
|
|
4161
4165
|
container: refImage,
|
|
4162
4166
|
element: refSelection,
|
|
4163
|
-
onDrag:
|
|
4167
|
+
onDrag: () => {
|
|
4168
|
+
hasInteracted.current = true;
|
|
4169
|
+
refreshOverlaysStyle();
|
|
4170
|
+
}
|
|
4164
4171
|
});
|
|
4165
4172
|
useResize({ refElement: refImage, onResize: onResizeElement });
|
|
4166
4173
|
const onCropImage = require$$0.useCallback(() => {
|
|
@@ -4199,7 +4206,7 @@ function RlsImageEditor(props) {
|
|
|
4199
4206
|
context?.putImageData(originalImage.current, 0, 0);
|
|
4200
4207
|
}
|
|
4201
4208
|
}, []);
|
|
4202
|
-
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: "external-link", value: selection, minValue:
|
|
4209
|
+
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: "external-link", 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(RlsButton, { type: "flat", rlsTheme: "standard", prefixIcon: "refresh", onClick: onRestore, disabled: props.disabled, children: labels.actionRestore }), jsxRuntimeExports.jsx(RlsButton, { type: "raised", rlsTheme: "primary", prefixIcon: "crop", onClick: onCropImage, disabled: props.disabled, children: labels.actionSelect })] })] }), jsxRuntimeExports.jsx("canvas", { ref: refPicture })] }));
|
|
4203
4210
|
}
|
|
4204
4211
|
|
|
4205
4212
|
function RlsImageEditorModal(props) {
|