etudes 5.2.0 → 5.3.0

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.
Files changed (164) hide show
  1. package/components/Accordion.js +171 -205
  2. package/components/BurgerButton.js +40 -94
  3. package/components/Carousel.js +87 -123
  4. package/components/Collection.js +84 -120
  5. package/components/Counter.js +32 -63
  6. package/components/CoverImage.js +24 -68
  7. package/components/CoverVideo.js +25 -69
  8. package/components/DebugConsole.js +27 -79
  9. package/components/Dial.js +28 -65
  10. package/components/Dropdown.js +86 -98
  11. package/components/FlatSVG.js +22 -71
  12. package/components/Image.js +21 -50
  13. package/components/MasonryGrid.js +122 -257
  14. package/components/Panorama.js +48 -92
  15. package/components/PanoramaSlider.js +57 -113
  16. package/components/RangeSlider.js +125 -182
  17. package/components/RotatingGallery.js +28 -59
  18. package/components/SelectableButton.js +10 -54
  19. package/components/Slider.js +108 -159
  20. package/components/StepwiseSlider.js +124 -176
  21. package/components/SwipeContainer.js +30 -73
  22. package/components/TextField.js +12 -49
  23. package/components/Video.js +31 -61
  24. package/components/WithTooltip.js +117 -111
  25. package/components/index.js +24 -0
  26. package/hooks/index.js +17 -0
  27. package/hooks/useClickOutsideEffect.js +8 -38
  28. package/hooks/useDragEffect.js +20 -53
  29. package/hooks/useDragValueEffect.js +31 -81
  30. package/hooks/useImageSize.js +16 -38
  31. package/hooks/useInterval.js +9 -41
  32. package/hooks/useLoadImageEffect.js +15 -48
  33. package/hooks/useLoadVideoMetadataEffect.js +15 -48
  34. package/hooks/useMounted.js +5 -25
  35. package/hooks/usePrevious.js +4 -9
  36. package/hooks/useRect.js +9 -29
  37. package/hooks/useResizeEffect.js +10 -44
  38. package/hooks/useScrollPositionEffect.js +19 -50
  39. package/hooks/useSearchParamState.js +12 -34
  40. package/hooks/useSize.js +9 -29
  41. package/hooks/useTimeout.js +8 -38
  42. package/hooks/useVideoSize.js +16 -38
  43. package/hooks/useViewportSize.js +7 -27
  44. package/operators/Conditional.js +6 -11
  45. package/operators/Each.js +6 -14
  46. package/operators/ExtractChild.js +9 -36
  47. package/operators/ExtractChildren.js +7 -34
  48. package/operators/Repeat.js +4 -37
  49. package/operators/index.js +5 -0
  50. package/package.json +27 -41
  51. package/providers/ScrollPositionProvider.js +37 -60
  52. package/providers/index.js +1 -0
  53. package/utils/asClassNameDict.js +1 -5
  54. package/utils/asComponentDict.js +11 -16
  55. package/utils/asStyleDict.js +1 -5
  56. package/utils/cloneStyledElement.js +14 -61
  57. package/utils/index.js +5 -22
  58. package/utils/styles.js +5 -21
  59. package/components/Accordion.d.ts +0 -219
  60. package/components/Accordion.js.map +0 -1
  61. package/components/BurgerButton.d.ts +0 -34
  62. package/components/BurgerButton.js.map +0 -1
  63. package/components/Carousel.d.ts +0 -53
  64. package/components/Carousel.js.map +0 -1
  65. package/components/Collection.d.ts +0 -171
  66. package/components/Collection.js.map +0 -1
  67. package/components/Counter.d.ts +0 -11
  68. package/components/Counter.js.map +0 -1
  69. package/components/CoverImage.d.ts +0 -28
  70. package/components/CoverImage.js.map +0 -1
  71. package/components/CoverVideo.d.ts +0 -28
  72. package/components/CoverVideo.js.map +0 -1
  73. package/components/DebugConsole.d.ts +0 -15
  74. package/components/DebugConsole.js.map +0 -1
  75. package/components/Dial.d.ts +0 -79
  76. package/components/Dial.js.map +0 -1
  77. package/components/Dropdown.d.ts +0 -109
  78. package/components/Dropdown.js.map +0 -1
  79. package/components/FlatSVG.d.ts +0 -72
  80. package/components/FlatSVG.js.map +0 -1
  81. package/components/Image.d.ts +0 -144
  82. package/components/Image.js.map +0 -1
  83. package/components/MasonryGrid.d.ts +0 -29
  84. package/components/MasonryGrid.js.map +0 -1
  85. package/components/Panorama.d.ts +0 -77
  86. package/components/Panorama.js.map +0 -1
  87. package/components/PanoramaSlider.d.ts +0 -71
  88. package/components/PanoramaSlider.js.map +0 -1
  89. package/components/RangeSlider.d.ts +0 -34
  90. package/components/RangeSlider.js.map +0 -1
  91. package/components/RotatingGallery.d.ts +0 -91
  92. package/components/RotatingGallery.js.map +0 -1
  93. package/components/SelectableButton.d.ts +0 -19
  94. package/components/SelectableButton.js.map +0 -1
  95. package/components/Slider.d.ts +0 -160
  96. package/components/Slider.js.map +0 -1
  97. package/components/StepwiseSlider.d.ts +0 -215
  98. package/components/StepwiseSlider.js.map +0 -1
  99. package/components/SwipeContainer.d.ts +0 -21
  100. package/components/SwipeContainer.js.map +0 -1
  101. package/components/TextField.d.ts +0 -21
  102. package/components/TextField.js.map +0 -1
  103. package/components/Video.d.ts +0 -38
  104. package/components/Video.js.map +0 -1
  105. package/components/WithTooltip.d.ts +0 -32
  106. package/components/WithTooltip.js.map +0 -1
  107. package/hooks/useClickOutsideEffect.d.ts +0 -2
  108. package/hooks/useClickOutsideEffect.js.map +0 -1
  109. package/hooks/useDragEffect.d.ts +0 -48
  110. package/hooks/useDragEffect.js.map +0 -1
  111. package/hooks/useDragValueEffect.d.ts +0 -56
  112. package/hooks/useDragValueEffect.js.map +0 -1
  113. package/hooks/useImageSize.d.ts +0 -21
  114. package/hooks/useImageSize.js.map +0 -1
  115. package/hooks/useInterval.d.ts +0 -18
  116. package/hooks/useInterval.js.map +0 -1
  117. package/hooks/useLoadImageEffect.d.ts +0 -43
  118. package/hooks/useLoadImageEffect.js.map +0 -1
  119. package/hooks/useLoadVideoMetadataEffect.d.ts +0 -35
  120. package/hooks/useLoadVideoMetadataEffect.js.map +0 -1
  121. package/hooks/useMounted.d.ts +0 -1
  122. package/hooks/useMounted.js.map +0 -1
  123. package/hooks/usePrevious.d.ts +0 -19
  124. package/hooks/usePrevious.js.map +0 -1
  125. package/hooks/useRect.d.ts +0 -11
  126. package/hooks/useRect.js.map +0 -1
  127. package/hooks/useResizeEffect.d.ts +0 -17
  128. package/hooks/useResizeEffect.js.map +0 -1
  129. package/hooks/useScrollPositionEffect.d.ts +0 -13
  130. package/hooks/useScrollPositionEffect.js.map +0 -1
  131. package/hooks/useSearchParamState.d.ts +0 -34
  132. package/hooks/useSearchParamState.js.map +0 -1
  133. package/hooks/useSize.d.ts +0 -10
  134. package/hooks/useSize.js.map +0 -1
  135. package/hooks/useTimeout.d.ts +0 -10
  136. package/hooks/useTimeout.js.map +0 -1
  137. package/hooks/useVideoSize.d.ts +0 -21
  138. package/hooks/useVideoSize.js.map +0 -1
  139. package/hooks/useViewportSize.d.ts +0 -7
  140. package/hooks/useViewportSize.js.map +0 -1
  141. package/operators/Conditional.d.ts +0 -5
  142. package/operators/Conditional.js.map +0 -1
  143. package/operators/Each.d.ts +0 -7
  144. package/operators/Each.js.map +0 -1
  145. package/operators/ExtractChild.d.ts +0 -8
  146. package/operators/ExtractChild.js.map +0 -1
  147. package/operators/ExtractChildren.d.ts +0 -6
  148. package/operators/ExtractChildren.js.map +0 -1
  149. package/operators/Repeat.d.ts +0 -11
  150. package/operators/Repeat.js.map +0 -1
  151. package/providers/ScrollPositionProvider.d.ts +0 -15
  152. package/providers/ScrollPositionProvider.js.map +0 -1
  153. package/utils/asClassNameDict.d.ts +0 -3
  154. package/utils/asClassNameDict.js.map +0 -1
  155. package/utils/asComponentDict.d.ts +0 -5
  156. package/utils/asComponentDict.js.map +0 -1
  157. package/utils/asStyleDict.d.ts +0 -4
  158. package/utils/asStyleDict.js.map +0 -1
  159. package/utils/cloneStyledElement.d.ts +0 -18
  160. package/utils/cloneStyledElement.js.map +0 -1
  161. package/utils/index.d.ts +0 -5
  162. package/utils/index.js.map +0 -1
  163. package/utils/styles.d.ts +0 -2
  164. package/utils/styles.js.map +0 -1
@@ -1,79 +1,24 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
- var __read = (this && this.__read) || function (o, n) {
25
- var m = typeof Symbol === "function" && o[Symbol.iterator];
26
- if (!m) return o;
27
- var i = m.call(o), r, ar = [], e;
28
- try {
29
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
30
- }
31
- catch (error) { e = { error: error }; }
32
- finally {
33
- try {
34
- if (r && !r.done && (m = i["return"])) m.call(i);
35
- }
36
- finally { if (e) throw e.error; }
37
- }
38
- return ar;
39
- };
40
- var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
41
- if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
42
- if (ar || !(i in from)) {
43
- if (!ar) ar = Array.prototype.slice.call(from, 0, i);
44
- ar[i] = from[i];
45
- }
46
- }
47
- return to.concat(ar || Array.prototype.slice.call(from));
48
- };
49
- var __importDefault = (this && this.__importDefault) || function (mod) {
50
- return (mod && mod.__esModule) ? mod : { "default": mod };
51
- };
52
- Object.defineProperty(exports, "__esModule", { value: true });
53
- exports.RangeSliderKnob = exports.RangeSliderHighlight = exports.RangeSliderLabel = exports.RangeSliderGutter = exports.RangeSlider = void 0;
54
- var jsx_runtime_1 = require("react/jsx-runtime");
55
- var clsx_1 = __importDefault(require("clsx"));
56
- var react_1 = __importDefault(require("fast-deep-equal/react"));
57
- var react_2 = require("react");
58
- var useDragValueEffect_1 = require("../hooks/useDragValueEffect");
59
- var useRect_1 = require("../hooks/useRect");
60
- var utils_1 = require("../utils");
61
- exports.RangeSlider = (0, react_2.forwardRef)(function (_a, ref) {
62
- var _b, _c, _d, _e, _f, _g, _h, _j;
63
- var children = _a.children, className = _a.className, _k = _a.areLabelsVisible, areLabelsVisible = _k === void 0 ? true : _k, _l = _a.decimalPlaces, decimalPlaces = _l === void 0 ? 2 : _l, _m = _a.knobPadding, knobPadding = _m === void 0 ? 20 : _m, maxValue = _a.max, minValue = _a.min, _o = _a.orientation, orientation = _o === void 0 ? 'vertical' : _o, externalRange = _a.range, _p = _a.steps, steps = _p === void 0 ? -1 : _p, _q = _a.usesDefaultStyles, usesDefaultStyles = _q === void 0 ? false : _q, onRangeChange = _a.onRangeChange, props = __rest(_a, ["children", "className", "areLabelsVisible", "decimalPlaces", "knobPadding", "max", "min", "orientation", "range", "steps", "usesDefaultStyles", "onRangeChange"]);
64
- var getPositionByValue = function (value) { return (value - minValue) / (maxValue - minValue); };
65
- var getPositionByDisplacement = function (displacement) { return displacement / (orientation === 'horizontal' ? bodyRect.width : bodyRect.height); };
66
- var getValueByPosition = function (position) { return position * (maxValue - minValue) + minValue; };
67
- var getValueByDisplacement = function (displacement) { return getValueByPosition(getPositionByDisplacement(displacement)); };
68
- var getDisplacementByPosition = function (position) { return position * (orientation === 'horizontal' ? bodyRect.width : bodyRect.height); };
69
- var getDisplacementByValue = function (value) { return getDisplacementByPosition(getPositionByValue(value)); };
70
- var getClosestSteppedValue = function (value) {
71
- var n = breakpoints.length;
72
- var idx = 0;
73
- var diff = Infinity;
74
- for (var i = 0; i < n; i++) {
75
- var t = breakpoints[i];
76
- var d = Math.abs(value - t);
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import clsx from 'clsx';
3
+ import isDeepEqual from 'fast-deep-equal/react';
4
+ import { forwardRef, useEffect, useRef, useState } from 'react';
5
+ import { useDragValueEffect } from '../hooks/useDragValueEffect.js';
6
+ import { useRect } from '../hooks/useRect.js';
7
+ import { asComponentDict, asStyleDict, cloneStyledElement, styles } from '../utils/index.js';
8
+ export const RangeSlider = forwardRef(({ children, className, areLabelsVisible = true, decimalPlaces = 2, knobPadding = 20, max: maxValue, min: minValue, orientation = 'vertical', range: externalRange, steps = -1, usesDefaultStyles = false, onRangeChange, ...props }, ref) => {
9
+ const getPositionByValue = (value) => (value - minValue) / (maxValue - minValue);
10
+ const getPositionByDisplacement = (displacement) => displacement / (orientation === 'horizontal' ? bodyRect.width : bodyRect.height);
11
+ const getValueByPosition = (position) => position * (maxValue - minValue) + minValue;
12
+ const getValueByDisplacement = (displacement) => getValueByPosition(getPositionByDisplacement(displacement));
13
+ const getDisplacementByPosition = (position) => position * (orientation === 'horizontal' ? bodyRect.width : bodyRect.height);
14
+ const getDisplacementByValue = (value) => getDisplacementByPosition(getPositionByValue(value));
15
+ const getClosestSteppedValue = (value) => {
16
+ const n = breakpoints.length;
17
+ let idx = 0;
18
+ let diff = Infinity;
19
+ for (let i = 0; i < n; i++) {
20
+ const t = breakpoints[i];
21
+ const d = Math.abs(value - t);
77
22
  if (d < diff) {
78
23
  diff = d;
79
24
  idx = i;
@@ -81,143 +26,130 @@ exports.RangeSlider = (0, react_2.forwardRef)(function (_a, ref) {
81
26
  }
82
27
  return breakpoints[idx];
83
28
  };
84
- var bodyRef = (0, react_2.useRef)(null);
85
- var bodyRect = (0, useRect_1.useRect)(bodyRef);
86
- var startKnobRef = (0, react_2.useRef)(null);
87
- var endKnobRef = (0, react_2.useRef)(null);
88
- var _r = __read((0, react_2.useState)(externalRange !== null && externalRange !== void 0 ? externalRange : [minValue, maxValue]), 2), range = _r[0], setRange = _r[1];
89
- var _s = (0, useDragValueEffect_1.useDragValueEffect)(startKnobRef, {
90
- initialValue: (_b = externalRange === null || externalRange === void 0 ? void 0 : externalRange[0]) !== null && _b !== void 0 ? _b : minValue,
91
- transform: function (value, dx, dy) {
92
- var delta = orientation === 'horizontal' ? dx : dy;
93
- var dMin = getDisplacementByValue(minValue);
94
- var dMax = getDisplacementByValue(range[1]);
95
- var dCurr = getDisplacementByValue(value) + delta;
29
+ const bodyRef = useRef(null);
30
+ const bodyRect = useRect(bodyRef);
31
+ const startKnobRef = useRef(null);
32
+ const endKnobRef = useRef(null);
33
+ const [range, setRange] = useState(externalRange ?? [minValue, maxValue]);
34
+ const { isDragging: [isDraggingStartKnob], isReleasing: [isReleasingStartKnob], value: [startValue, setStartValue] } = useDragValueEffect(startKnobRef, {
35
+ initialValue: externalRange?.[0] ?? minValue,
36
+ transform: (value, dx, dy) => {
37
+ const delta = orientation === 'horizontal' ? dx : dy;
38
+ const dMin = getDisplacementByValue(minValue);
39
+ const dMax = getDisplacementByValue(range[1]);
40
+ const dCurr = getDisplacementByValue(value) + delta;
96
41
  return getValueByDisplacement(Math.max(dMin, Math.min(dMax, dCurr)));
97
42
  },
98
- }, [minValue, orientation, bodyRect.size.width, bodyRect.size.height, range[1]]), _t = __read(_s.isDragging, 1), isDraggingStartKnob = _t[0], _u = __read(_s.isReleasing, 1), isReleasingStartKnob = _u[0], _v = __read(_s.value, 2), startValue = _v[0], setStartValue = _v[1];
99
- var _w = (0, useDragValueEffect_1.useDragValueEffect)(endKnobRef, {
100
- initialValue: (_c = externalRange === null || externalRange === void 0 ? void 0 : externalRange[1]) !== null && _c !== void 0 ? _c : maxValue,
101
- transform: function (value, dx, dy) {
102
- var delta = orientation === 'horizontal' ? dx : dy;
103
- var dMin = getDisplacementByValue(range[0]);
104
- var dMax = getDisplacementByValue(maxValue);
105
- var dCurr = getDisplacementByValue(value) + delta;
43
+ }, [minValue, orientation, bodyRect.size.width, bodyRect.size.height, range[1]]);
44
+ const { isDragging: [isDraggingEndKnob], isReleasing: [isReleasingEndKnob], value: [endValue, setEndValue] } = useDragValueEffect(endKnobRef, {
45
+ initialValue: externalRange?.[1] ?? maxValue,
46
+ transform: (value, dx, dy) => {
47
+ const delta = orientation === 'horizontal' ? dx : dy;
48
+ const dMin = getDisplacementByValue(range[0]);
49
+ const dMax = getDisplacementByValue(maxValue);
50
+ const dCurr = getDisplacementByValue(value) + delta;
106
51
  return getValueByDisplacement(Math.max(dMin, Math.min(dMax, dCurr)));
107
52
  },
108
- }, [maxValue, orientation, bodyRect.size.width, bodyRect.size.height, range[0]]), _x = __read(_w.isDragging, 1), isDraggingEndKnob = _x[0], _y = __read(_w.isReleasing, 1), isReleasingEndKnob = _y[0], _z = __read(_w.value, 2), endValue = _z[0], setEndValue = _z[1];
109
- var breakpoints = __spreadArray(__spreadArray([minValue], __read(__spreadArray([], __read(Array(steps)), false).map(function (v, i) { return minValue + (i + 1) * (maxValue - minValue) / (1 + steps); })), false), [maxValue], false);
110
- var _0 = __read(range.map(getDisplacementByValue), 2), start = _0[0], end = _0[1];
111
- var highlightLength = end - start;
112
- (0, react_2.useEffect)(function () {
53
+ }, [maxValue, orientation, bodyRect.size.width, bodyRect.size.height, range[0]]);
54
+ const breakpoints = [minValue, ...[...Array(steps)].map((v, i) => minValue + (i + 1) * (maxValue - minValue) / (1 + steps)), maxValue];
55
+ const [start, end] = range.map(getDisplacementByValue);
56
+ const highlightLength = end - start;
57
+ useEffect(() => {
113
58
  if (range[0] === startValue)
114
59
  return;
115
60
  setRange([startValue, range[1]]);
116
- onRangeChange === null || onRangeChange === void 0 ? void 0 : onRangeChange(range);
61
+ onRangeChange?.(range);
117
62
  }, [startValue]);
118
- (0, react_2.useEffect)(function () {
63
+ useEffect(() => {
119
64
  if (range[1] === endValue)
120
65
  return;
121
66
  setRange([range[0], endValue]);
122
- onRangeChange === null || onRangeChange === void 0 ? void 0 : onRangeChange(range);
67
+ onRangeChange?.(range);
123
68
  }, [endValue]);
124
- (0, react_2.useEffect)(function () {
125
- if (isDraggingStartKnob || isDraggingEndKnob || (0, react_1.default)(externalRange, range))
69
+ useEffect(() => {
70
+ if (isDraggingStartKnob || isDraggingEndKnob || isDeepEqual(externalRange, range))
126
71
  return;
127
- setRange(externalRange !== null && externalRange !== void 0 ? externalRange : [minValue, maxValue]);
72
+ setRange(externalRange ?? [minValue, maxValue]);
128
73
  }, [externalRange]);
129
- (0, react_2.useEffect)(function () {
74
+ useEffect(() => {
130
75
  if (steps < 0)
131
76
  return;
132
77
  setStartValue(getClosestSteppedValue(startValue));
133
78
  }, [isReleasingStartKnob]);
134
- (0, react_2.useEffect)(function () {
79
+ useEffect(() => {
135
80
  if (steps < 0 || !isReleasingEndKnob)
136
81
  return;
137
82
  setEndValue(getClosestSteppedValue(endValue));
138
83
  }, [isReleasingEndKnob]);
139
- var components = (0, utils_1.asComponentDict)(children, {
140
- gutter: exports.RangeSliderGutter,
141
- highlight: exports.RangeSliderHighlight,
142
- knob: exports.RangeSliderKnob,
143
- label: exports.RangeSliderLabel,
84
+ const components = asComponentDict(children, {
85
+ gutter: RangeSliderGutter,
86
+ highlight: RangeSliderHighlight,
87
+ knob: RangeSliderKnob,
88
+ label: RangeSliderLabel,
144
89
  });
145
- var fixedStyles = getFixedStyles({ orientation: orientation, highlightLength: highlightLength, start: start, knobPadding: knobPadding });
146
- var defaultStyles = usesDefaultStyles ? getDefaultStyles({ isReleasingStartKnob: isReleasingStartKnob, isReleasingEndKnob: isReleasingEndKnob, orientation: orientation }) : undefined;
147
- return ((0, jsx_runtime_1.jsx)("div", __assign({}, props, { ref: ref, className: (0, clsx_1.default)(className, orientation), "data-component": 'range-slider', children: (0, jsx_runtime_1.jsxs)("div", { ref: bodyRef, style: fixedStyles.body, children: [(0, utils_1.cloneStyledElement)((_d = components.gutter) !== null && _d !== void 0 ? _d : (0, jsx_runtime_1.jsx)(exports.RangeSliderGutter, { style: defaultStyles === null || defaultStyles === void 0 ? void 0 : defaultStyles.gutter }), {
148
- style: (0, utils_1.styles)(fixedStyles.gutter),
149
- }), (0, utils_1.cloneStyledElement)((_e = components.highlight) !== null && _e !== void 0 ? _e : (0, jsx_runtime_1.jsx)(exports.RangeSliderHighlight, { style: defaultStyles === null || defaultStyles === void 0 ? void 0 : defaultStyles.highlight }), {
150
- style: (0, utils_1.styles)(fixedStyles.highlight),
151
- }), (0, utils_1.cloneStyledElement)((_f = components.knob) !== null && _f !== void 0 ? _f : (0, jsx_runtime_1.jsx)(exports.RangeSliderKnob, { style: (0, utils_1.styles)(defaultStyles === null || defaultStyles === void 0 ? void 0 : defaultStyles.knob, {
90
+ const fixedStyles = getFixedStyles({ orientation, highlightLength, start, knobPadding });
91
+ const defaultStyles = usesDefaultStyles ? getDefaultStyles({ isReleasingStartKnob, isReleasingEndKnob, orientation }) : undefined;
92
+ return (_jsx("div", { ...props, ref: ref, className: clsx(className, orientation), "data-component": 'range-slider', children: _jsxs("div", { ref: bodyRef, style: fixedStyles.body, children: [cloneStyledElement(components.gutter ?? _jsx(RangeSliderGutter, { style: defaultStyles?.gutter }), {
93
+ style: styles(fixedStyles.gutter),
94
+ }), cloneStyledElement(components.highlight ?? _jsx(RangeSliderHighlight, { style: defaultStyles?.highlight }), {
95
+ style: styles(fixedStyles.highlight),
96
+ }), cloneStyledElement(components.knob ?? _jsx(RangeSliderKnob, { style: styles(defaultStyles?.knob, {
152
97
  transitionProperty: isReleasingStartKnob ? 'opacity, transform' : 'opacity',
153
98
  }) }), {
154
99
  ref: startKnobRef,
155
- disabled: (0, react_1.default)([startValue, endValue], [maxValue, maxValue]),
156
- className: (0, clsx_1.default)({
100
+ disabled: isDeepEqual([startValue, endValue], [maxValue, maxValue]),
101
+ className: clsx({
157
102
  dragging: isDraggingStartKnob,
158
103
  releasing: isReleasingStartKnob,
159
104
  }),
160
- style: (0, utils_1.styles)(fixedStyles.knob, {
161
- pointerEvents: (0, react_1.default)([startValue, endValue], [minValue, minValue]) ? 'none' : 'auto',
105
+ style: styles(fixedStyles.knob, {
106
+ pointerEvents: isDeepEqual([startValue, endValue], [minValue, minValue]) ? 'none' : 'auto',
162
107
  }, orientation === 'horizontal' ? {
163
- marginLeft: "".concat(start, "px"),
108
+ marginLeft: `${start}px`,
164
109
  } : {
165
- marginTop: "".concat(start, "px"),
110
+ marginTop: `${start}px`,
166
111
  }),
167
- }, (0, jsx_runtime_1.jsx)("div", { style: fixedStyles.knobHitbox }), areLabelsVisible && (0, utils_1.cloneStyledElement)((_g = components.label) !== null && _g !== void 0 ? _g : (0, jsx_runtime_1.jsx)(exports.RangeSliderLabel, { style: (0, utils_1.styles)(defaultStyles === null || defaultStyles === void 0 ? void 0 : defaultStyles.label, {
112
+ }, _jsx("div", { style: fixedStyles.knobHitbox }), areLabelsVisible && cloneStyledElement(components.label ?? _jsx(RangeSliderLabel, { style: styles(defaultStyles?.label, {
168
113
  transitionProperty: isReleasingStartKnob ? 'opacity, transform' : 'opacity',
169
114
  }) }), {
170
- className: (0, clsx_1.default)({
115
+ className: clsx({
171
116
  dragging: isDraggingStartKnob || isDraggingEndKnob,
172
117
  releasing: isReleasingStartKnob || isReleasingEndKnob,
173
118
  }),
174
- style: (0, utils_1.styles)(fixedStyles.label),
175
- }, Number(startValue.toFixed(decimalPlaces)).toLocaleString())), (0, utils_1.cloneStyledElement)((_h = components.knob) !== null && _h !== void 0 ? _h : (0, jsx_runtime_1.jsx)(exports.RangeSliderKnob, { style: (0, utils_1.styles)(defaultStyles === null || defaultStyles === void 0 ? void 0 : defaultStyles.knob, {
119
+ style: styles(fixedStyles.label),
120
+ }, Number(startValue.toFixed(decimalPlaces)).toLocaleString())), cloneStyledElement(components.knob ?? _jsx(RangeSliderKnob, { style: styles(defaultStyles?.knob, {
176
121
  transitionProperty: isReleasingEndKnob ? 'opacity, transform' : 'opacity',
177
122
  }) }), {
178
123
  ref: endKnobRef,
179
- disabled: (0, react_1.default)([startValue, endValue], [maxValue, maxValue]),
180
- className: (0, clsx_1.default)({
124
+ disabled: isDeepEqual([startValue, endValue], [maxValue, maxValue]),
125
+ className: clsx({
181
126
  dragging: isDraggingEndKnob,
182
127
  releasing: isDraggingEndKnob,
183
128
  }),
184
- style: (0, utils_1.styles)(fixedStyles.knob, {
185
- pointerEvents: (0, react_1.default)([startValue, endValue], [maxValue, maxValue]) ? 'none' : 'auto',
129
+ style: styles(fixedStyles.knob, {
130
+ pointerEvents: isDeepEqual([startValue, endValue], [maxValue, maxValue]) ? 'none' : 'auto',
186
131
  }, orientation === 'horizontal' ? {
187
- marginLeft: "".concat(end, "px"),
132
+ marginLeft: `${end}px`,
188
133
  } : {
189
- marginTop: "".concat(end, "px"),
134
+ marginTop: `${end}px`,
190
135
  }),
191
- }, (0, jsx_runtime_1.jsx)("div", { style: fixedStyles.knobHitbox }), areLabelsVisible && (0, utils_1.cloneStyledElement)((_j = components.label) !== null && _j !== void 0 ? _j : (0, jsx_runtime_1.jsx)(exports.RangeSliderLabel, { style: (0, utils_1.styles)(defaultStyles === null || defaultStyles === void 0 ? void 0 : defaultStyles.label, {
136
+ }, _jsx("div", { style: fixedStyles.knobHitbox }), areLabelsVisible && cloneStyledElement(components.label ?? _jsx(RangeSliderLabel, { style: styles(defaultStyles?.label, {
192
137
  transitionProperty: isReleasingEndKnob ? 'opacity, transform' : 'opacity',
193
138
  }) }), {
194
- className: (0, clsx_1.default)({
139
+ className: clsx({
195
140
  dragging: isDraggingEndKnob,
196
141
  releasing: isReleasingEndKnob,
197
142
  }),
198
- style: (0, utils_1.styles)(fixedStyles.label),
199
- }, Number(endValue.toFixed(decimalPlaces)).toLocaleString()))] }) })));
143
+ style: styles(fixedStyles.label),
144
+ }, Number(endValue.toFixed(decimalPlaces)).toLocaleString()))] }) }));
200
145
  });
201
- Object.defineProperty(exports.RangeSlider, 'displayName', { value: 'RangeSlider', writable: false });
202
- exports.RangeSliderGutter = (0, react_2.forwardRef)(function (_a, ref) {
203
- var props = __rest(_a, []);
204
- return (0, jsx_runtime_1.jsx)("div", __assign({}, props, { ref: ref, "data-child": 'gutter' }));
205
- });
206
- exports.RangeSliderLabel = (0, react_2.forwardRef)(function (_a, ref) {
207
- var props = __rest(_a, []);
208
- return (0, jsx_runtime_1.jsx)("div", __assign({}, props, { ref: ref, "data-child": 'label' }));
209
- });
210
- exports.RangeSliderHighlight = (0, react_2.forwardRef)(function (_a, ref) {
211
- var props = __rest(_a, []);
212
- return (0, jsx_runtime_1.jsx)("div", __assign({}, props, { ref: ref, "data-child": 'highlight' }));
213
- });
214
- exports.RangeSliderKnob = (0, react_2.forwardRef)(function (_a, ref) {
215
- var props = __rest(_a, []);
216
- return (0, jsx_runtime_1.jsx)("div", __assign({}, props, { ref: ref, "data-child": 'knob' }));
217
- });
218
- function getFixedStyles(_a) {
219
- var _b = _a.orientation, orientation = _b === void 0 ? 'horizontal' : _b, _c = _a.highlightLength, highlightLength = _c === void 0 ? 0 : _c, _d = _a.start, start = _d === void 0 ? 0 : _d, _e = _a.knobPadding, knobPadding = _e === void 0 ? 0 : _e;
220
- return (0, utils_1.asStyleDict)({
146
+ Object.defineProperty(RangeSlider, 'displayName', { value: 'RangeSlider', writable: false });
147
+ export const RangeSliderGutter = forwardRef(({ ...props }, ref) => _jsx("div", { ...props, ref: ref, "data-child": 'gutter' }));
148
+ export const RangeSliderLabel = forwardRef(({ ...props }, ref) => _jsx("div", { ...props, ref: ref, "data-child": 'label' }));
149
+ export const RangeSliderHighlight = forwardRef(({ ...props }, ref) => _jsx("div", { ...props, ref: ref, "data-child": 'highlight' }));
150
+ export const RangeSliderKnob = forwardRef(({ ...props }, ref) => _jsx("div", { ...props, ref: ref, "data-child": 'knob' }));
151
+ function getFixedStyles({ orientation = 'horizontal', highlightLength = 0, start = 0, knobPadding = 0 }) {
152
+ return asStyleDict({
221
153
  body: {
222
154
  height: '100%',
223
155
  width: '100%',
@@ -230,13 +162,19 @@ function getFixedStyles(_a) {
230
162
  width: '100%',
231
163
  height: '100%',
232
164
  },
233
- highlight: __assign({ height: '100%', left: '0', position: 'absolute', top: '0' }, orientation === 'horizontal' ? {
234
- width: "".concat(highlightLength, "px"),
235
- transform: "translate3d(".concat(start, "px, 0, 0)"),
236
- } : {
237
- height: "".concat(highlightLength, "px"),
238
- transform: "translate3d(0, ".concat(start, "px, 0)"),
239
- }),
165
+ highlight: {
166
+ height: '100%',
167
+ left: '0',
168
+ position: 'absolute',
169
+ top: '0',
170
+ ...orientation === 'horizontal' ? {
171
+ width: `${highlightLength}px`,
172
+ transform: `translate3d(${start}px, 0, 0)`,
173
+ } : {
174
+ height: `${highlightLength}px`,
175
+ transform: `translate3d(0, ${start}px, 0)`,
176
+ },
177
+ },
240
178
  knob: {
241
179
  bottom: '0',
242
180
  left: '0',
@@ -249,12 +187,12 @@ function getFixedStyles(_a) {
249
187
  },
250
188
  knobHitbox: {
251
189
  background: 'transparent',
252
- height: "calc(100% + ".concat(knobPadding * 2, "px)"),
253
- left: "-".concat(knobPadding, "px"),
254
- padding: "".concat(knobPadding, "px"),
190
+ height: `calc(100% + ${knobPadding * 2}px)`,
191
+ left: `-${knobPadding}px`,
192
+ padding: `${knobPadding}px`,
255
193
  position: 'absolute',
256
- top: "-".concat(knobPadding, "px"),
257
- width: "calc(100% + ".concat(knobPadding * 2, "px)"),
194
+ top: `-${knobPadding}px`,
195
+ width: `calc(100% + ${knobPadding * 2}px)`,
258
196
  },
259
197
  label: {
260
198
  pointerEvents: 'none',
@@ -263,9 +201,8 @@ function getFixedStyles(_a) {
263
201
  },
264
202
  });
265
203
  }
266
- function getDefaultStyles(_a) {
267
- var _b = _a.isReleasingStartKnob, isReleasingStartKnob = _b === void 0 ? false : _b, _c = _a.isReleasingEndKnob, isReleasingEndKnob = _c === void 0 ? false : _c, _d = _a.orientation, orientation = _d === void 0 ? 'horizontal' : _d;
268
- return (0, utils_1.asStyleDict)({
204
+ function getDefaultStyles({ isReleasingStartKnob = false, isReleasingEndKnob = false, orientation = 'horizontal' }) {
205
+ return asStyleDict({
269
206
  gutter: {
270
207
  background: 'rgba(255, 255, 255, .2)',
271
208
  },
@@ -287,11 +224,17 @@ function getDefaultStyles(_a) {
287
224
  transitionTimingFunction: 'ease-out',
288
225
  width: '20px',
289
226
  },
290
- label: __assign({ background: 'transparent', color: '#fff', textAlign: 'center', transitionDuration: '100ms', transitionTimingFunction: 'ease-out' }, orientation === 'horizontal' ? {
291
- top: 'calc(100% + 10px)',
292
- } : {
293
- left: 'calc(100% + 10px)',
294
- }),
227
+ label: {
228
+ background: 'transparent',
229
+ color: '#fff',
230
+ textAlign: 'center',
231
+ transitionDuration: '100ms',
232
+ transitionTimingFunction: 'ease-out',
233
+ ...orientation === 'horizontal' ? {
234
+ top: 'calc(100% + 10px)',
235
+ } : {
236
+ left: 'calc(100% + 10px)',
237
+ },
238
+ },
295
239
  });
296
240
  }
297
- //# sourceMappingURL=RangeSlider.js.map
@@ -1,89 +1,58 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
- var __importDefault = (this && this.__importDefault) || function (mod) {
25
- return (mod && mod.__esModule) ? mod : { "default": mod };
26
- };
27
- Object.defineProperty(exports, "__esModule", { value: true });
28
- exports.RotatingGallery = void 0;
29
- var jsx_runtime_1 = require("react/jsx-runtime");
30
- var clsx_1 = __importDefault(require("clsx"));
31
- var react_1 = require("react");
32
- var useInterval_1 = require("../hooks/useInterval");
33
- var Each_1 = require("../operators/Each");
34
- var utils_1 = require("../utils");
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import clsx from 'clsx';
3
+ import { forwardRef, useEffect } from 'react';
4
+ import { useInterval } from '../hooks/useInterval.js';
5
+ import { Each } from '../operators/Each.js';
6
+ import { asClassNameDict, asStyleDict, styles } from '../utils/index.js';
35
7
  /**
36
8
  * A component displaying rotating images.
37
9
  */
38
- exports.RotatingGallery = (0, react_1.forwardRef)(function (_a, ref) {
39
- var children = _a.children, className = _a.className, _b = _a.index, index = _b === void 0 ? 0 : _b, _c = _a.lazy, lazy = _c === void 0 ? true : _c, _d = _a.rotationDuration, rotationDuration = _d === void 0 ? 5000 : _d, _e = _a.srcs, srcs = _e === void 0 ? [] : _e, _f = _a.transitionDuration, transitionDuration = _f === void 0 ? 500 : _f, _g = _a.usesDefaultStyles, usesDefaultStyles = _g === void 0 ? true : _g, onIndexChange = _a.onIndexChange, ImageComponent = _a.ImageComponent, props = __rest(_a, ["children", "className", "index", "lazy", "rotationDuration", "srcs", "transitionDuration", "usesDefaultStyles", "onIndexChange", "ImageComponent"]);
40
- var handleIndexChange = function (newValue) {
41
- onIndexChange === null || onIndexChange === void 0 ? void 0 : onIndexChange(newValue);
10
+ export const RotatingGallery = forwardRef(({ children, className, index = 0, lazy = true, rotationDuration = 5000, srcs = [], transitionDuration = 500, usesDefaultStyles = true, onIndexChange, ImageComponent, ...props }, ref) => {
11
+ const handleIndexChange = (newValue) => {
12
+ onIndexChange?.(newValue);
42
13
  };
43
- var fixedClassNames = getFixedClassNames();
44
- var fixedStyles = getFixedStyles({ transitionDuration: transitionDuration });
45
- var defaultStyles = usesDefaultStyles ? getDefaultStyles() : undefined;
46
- (0, useInterval_1.useInterval)(function () {
14
+ const fixedClassNames = getFixedClassNames();
15
+ const fixedStyles = getFixedStyles({ transitionDuration });
16
+ const defaultStyles = usesDefaultStyles ? getDefaultStyles() : undefined;
17
+ useInterval(() => {
47
18
  handleIndexChange((index + 1) % srcs.length);
48
19
  }, rotationDuration, undefined, [JSON.stringify(srcs), index]);
49
- (0, react_1.useEffect)(function () {
50
- onIndexChange === null || onIndexChange === void 0 ? void 0 : onIndexChange(index);
20
+ useEffect(() => {
21
+ onIndexChange?.(index);
51
22
  }, [index]);
52
- return ((0, jsx_runtime_1.jsx)("div", __assign({}, props, { ref: ref, className: (0, clsx_1.default)(className, fixedClassNames.root), "data-component": 'rotating-gallery', children: (0, jsx_runtime_1.jsx)(Each_1.Each, { in: srcs, children: function (src, idx) {
53
- var isVisible = idx === index;
54
- return ImageComponent ? ((0, jsx_runtime_1.jsx)(ImageComponent, { className: (0, clsx_1.default)(fixedClassNames.image), "data-child": 'item', index: idx, isVisible: isVisible, src: src, style: (0, utils_1.styles)(fixedStyles.image, defaultStyles === null || defaultStyles === void 0 ? void 0 : defaultStyles.image, usesDefaultStyles ? {
23
+ return (_jsx("div", { ...props, ref: ref, className: clsx(className, fixedClassNames.root), "data-component": 'rotating-gallery', children: _jsx(Each, { in: srcs, children: (src, idx) => {
24
+ const isVisible = idx === index;
25
+ return ImageComponent ? (_jsx(ImageComponent, { className: clsx(fixedClassNames.image), "data-child": 'item', index: idx, isVisible: isVisible, src: src, style: styles(fixedStyles.image, defaultStyles?.image, usesDefaultStyles ? {
55
26
  opacity: isVisible ? '1' : '0',
56
- } : {}) })) : ((0, jsx_runtime_1.jsx)("img", { className: (0, clsx_1.default)(fixedClassNames.image), "data-child": 'item', loading: lazy ? 'lazy' : 'eager', src: src, style: (0, utils_1.styles)(fixedStyles.image, defaultStyles === null || defaultStyles === void 0 ? void 0 : defaultStyles.image, usesDefaultStyles ? {
27
+ } : {}) })) : (_jsx("img", { className: clsx(fixedClassNames.image), "data-child": 'item', loading: lazy ? 'lazy' : 'eager', src: src, style: styles(fixedStyles.image, defaultStyles?.image, usesDefaultStyles ? {
57
28
  opacity: isVisible ? '1' : '0',
58
29
  } : {}) }));
59
- } }) })));
30
+ } }) }));
60
31
  });
61
- Object.defineProperty(exports.RotatingGallery, 'displayName', { value: 'RotatingGallery', writable: false });
32
+ Object.defineProperty(RotatingGallery, 'displayName', { value: 'RotatingGallery', writable: false });
62
33
  function getFixedClassNames() {
63
- return (0, utils_1.asClassNameDict)({
64
- root: (0, clsx_1.default)('rotating-gallery'),
65
- image: (0, clsx_1.default)('image'),
34
+ return asClassNameDict({
35
+ root: clsx('rotating-gallery'),
36
+ image: clsx('image'),
66
37
  });
67
38
  }
68
- function getFixedStyles(_a) {
69
- var _b = _a.transitionDuration, transitionDuration = _b === void 0 ? 0 : _b;
70
- return (0, utils_1.asStyleDict)({
39
+ function getFixedStyles({ transitionDuration = 0 }) {
40
+ return asStyleDict({
71
41
  image: {
72
42
  height: '100%',
73
43
  left: '0',
74
44
  position: 'absolute',
75
45
  top: '0',
76
46
  width: '100%',
77
- transitionDuration: "".concat(transitionDuration, "ms"),
47
+ transitionDuration: `${transitionDuration}ms`,
78
48
  },
79
49
  });
80
50
  }
81
51
  function getDefaultStyles() {
82
- return (0, utils_1.asStyleDict)({
52
+ return asStyleDict({
83
53
  image: {
84
54
  transitionProperty: 'opacity',
85
55
  transitionTimingFunction: 'linear',
86
56
  },
87
57
  });
88
58
  }
89
- //# sourceMappingURL=RotatingGallery.js.map
@@ -1,68 +1,24 @@
1
- "use strict";
2
- var __assign = (this && this.__assign) || function () {
3
- __assign = Object.assign || function(t) {
4
- for (var s, i = 1, n = arguments.length; i < n; i++) {
5
- s = arguments[i];
6
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
- t[p] = s[p];
8
- }
9
- return t;
10
- };
11
- return __assign.apply(this, arguments);
12
- };
13
- var __rest = (this && this.__rest) || function (s, e) {
14
- var t = {};
15
- for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
16
- t[p] = s[p];
17
- if (s != null && typeof Object.getOwnPropertySymbols === "function")
18
- for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
19
- if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
20
- t[p[i]] = s[p[i]];
21
- }
22
- return t;
23
- };
24
- var __read = (this && this.__read) || function (o, n) {
25
- var m = typeof Symbol === "function" && o[Symbol.iterator];
26
- if (!m) return o;
27
- var i = m.call(o), r, ar = [], e;
28
- try {
29
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
30
- }
31
- catch (error) { e = { error: error }; }
32
- finally {
33
- try {
34
- if (r && !r.done && (m = i["return"])) m.call(i);
35
- }
36
- finally { if (e) throw e.error; }
37
- }
38
- return ar;
39
- };
40
- Object.defineProperty(exports, "__esModule", { value: true });
41
- exports.SelectableButton = void 0;
42
- var jsx_runtime_1 = require("react/jsx-runtime");
43
- var react_1 = require("react");
44
- exports.SelectableButton = (0, react_1.forwardRef)(function (_a, ref) {
45
- var _b;
46
- var children = _a.children, _c = _a.isDeselectable, isDeselectable = _c === void 0 ? false : _c, _d = _a.isDisabled, isDisabled = _d === void 0 ? false : _d, _e = _a.isSelected, externalIsSelected = _e === void 0 ? false : _e, label = _a.label, onDeselect = _a.onDeselect, onSelect = _a.onSelect, props = __rest(_a, ["children", "isDeselectable", "isDisabled", "isSelected", "label", "onDeselect", "onSelect"]);
47
- var _f = __read((0, react_1.useState)(externalIsSelected), 2), isSelected = _f[0], setIsSelected = _f[1];
48
- var toggleSelection = function () {
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef, useEffect, useState } from 'react';
3
+ export const SelectableButton = forwardRef(({ children, isDeselectable = false, isDisabled = false, isSelected: externalIsSelected = false, label, onDeselect, onSelect, ...props }, ref) => {
4
+ const [isSelected, setIsSelected] = useState(externalIsSelected);
5
+ const toggleSelection = () => {
49
6
  if (isDisabled)
50
7
  return;
51
8
  if (isSelected) {
52
9
  if (!isDeselectable)
53
10
  return;
54
11
  setIsSelected(false);
55
- onDeselect === null || onDeselect === void 0 ? void 0 : onDeselect();
12
+ onDeselect?.();
56
13
  }
57
14
  else {
58
15
  setIsSelected(true);
59
- onSelect === null || onSelect === void 0 ? void 0 : onSelect();
16
+ onSelect?.();
60
17
  }
61
18
  };
62
- (0, react_1.useEffect)(function () {
19
+ useEffect(() => {
63
20
  setIsSelected(externalIsSelected);
64
21
  }, [externalIsSelected]);
65
- return ((0, jsx_runtime_1.jsx)("button", __assign({}, props, { ref: ref, "data-component": 'selectable-button', disabled: isDisabled || isSelected && !isDeselectable, onClick: function () { return toggleSelection(); }, children: (_b = children === null || children === void 0 ? void 0 : children({ isDeselectable: isDeselectable, isDisabled: isDisabled, isSelected: isSelected, label: label })) !== null && _b !== void 0 ? _b : label })));
22
+ return (_jsx("button", { ...props, ref: ref, "data-component": 'selectable-button', disabled: isDisabled || isSelected && !isDeselectable, onClick: () => toggleSelection(), children: children?.({ isDeselectable, isDisabled, isSelected, label }) ?? label }));
66
23
  });
67
- Object.defineProperty(exports.SelectableButton, 'displayName', { value: 'SelectableButton', writable: false });
68
- //# sourceMappingURL=SelectableButton.js.map
24
+ Object.defineProperty(SelectableButton, 'displayName', { value: 'SelectableButton', writable: false });