ingeniuscliq-core 0.4.25 → 0.4.27
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/components/common/carousel/CustomCarousel.js +26 -0
- package/dist/components/common/carousel/CustomCarouselSection.js +41 -0
- package/dist/components/common/form/CustomFormField.js +29 -0
- package/dist/components/common/form/{FormCheckbox.tsx → FormCheckbox.js} +7 -7
- package/dist/components/common/form/{FormInput.tsx → FormInput.js} +5 -5
- package/dist/components/common/form/{FormSelect.tsx → FormSelect.js} +7 -7
- package/dist/components/common/form/{FormTextArea.tsx → FormTextArea.js} +5 -5
- package/dist/components/common/form/{FormWrapper.tsx → FormWrapper.js} +2 -2
- package/dist/components/common/logo/{Logo.tsx → Logo.js} +3 -3
- package/dist/components/common/pagination/{CustomPagination.tsx → CustomPagination.js} +6 -6
- package/dist/components/common/select/CustomSelect.js +27 -0
- package/dist/components/common/spinner/Spinner.js +32 -0
- package/dist/components/common/stepper/{Stepper.tsx → Stepper.js} +9 -9
- package/dist/components/layouts/CoreBaseLayout.js +19 -0
- package/dist/components/templates/CoreHomeLayout.js +8 -0
- package/dist/components/templates/{CorePreviewLayout.tsx → CorePreviewLayout.js} +3 -3
- package/dist/components/ui/accordion.js +44 -0
- package/dist/components/ui/{alert-dialog.tsx → alert-dialog.js} +28 -28
- package/dist/components/ui/{alert.tsx → alert.js} +5 -5
- package/dist/components/ui/{avatar.tsx → avatar.js} +11 -11
- package/dist/components/ui/{badge.tsx → badge.js} +3 -3
- package/dist/components/ui/{breadcrumb.tsx → breadcrumb.js} +13 -14
- package/dist/components/ui/{button.tsx → button.js} +4 -4
- package/dist/components/ui/{card.tsx → card.js} +8 -8
- package/dist/components/ui/{carousel.tsx → carousel.js} +14 -15
- package/dist/components/ui/{checkbox.tsx → checkbox.js} +9 -9
- package/dist/components/ui/{dialog.tsx → dialog.js} +26 -26
- package/dist/components/ui/{dropdown-menu.tsx → dropdown-menu.js} +37 -39
- package/dist/components/ui/{form.tsx → form.js} +10 -10
- package/dist/components/ui/{input.tsx → input.js} +2 -2
- package/dist/components/ui/{label.tsx → label.js} +6 -6
- package/dist/components/ui/{pagination.tsx → pagination.js} +16 -18
- package/dist/components/ui/{popover.tsx → popover.js} +8 -8
- package/dist/components/ui/radio-group.js +34 -0
- package/dist/components/ui/{select.tsx → select.js} +38 -40
- package/dist/components/ui/{separator.tsx → separator.js} +5 -5
- package/dist/components/ui/{sheet.tsx → sheet.js} +27 -27
- package/dist/components/ui/{skeleton.tsx → skeleton.js} +2 -2
- package/dist/components/ui/{slider.tsx → slider.js} +9 -9
- package/dist/components/ui/{stepper.tsx → stepper.js} +35 -35
- package/dist/components/ui/{switch.tsx → switch.js} +7 -7
- package/dist/components/ui/{table.tsx → table.js} +9 -9
- package/dist/components/ui/{tabs.tsx → tabs.js} +13 -13
- package/dist/components/ui/{textarea.tsx → textarea.js} +2 -2
- package/dist/components/ui/{tooltip.tsx → tooltip.js} +8 -8
- package/dist/helpers/axiosGlobal.js +1 -2
- package/dist/hooks/useNotification.js +1 -1
- package/dist/index.js +45 -45
- package/dist/lib/utils.js +2 -2
- package/dist/modules/CoreAuth/classes/CoreAuthBuilder.js +1 -1
- package/dist/modules/CoreAuth/context/{AuthContext.tsx → AuthContext.js} +1 -1
- package/dist/modules/CoreAuth/index.js +2 -1
- package/dist/modules/CoreCustomization/classes/CoreCustomizationBuilder.js +1 -1
- package/dist/modules/CoreCustomization/index.js +1 -0
- package/dist/modules/CoreOrder/classes/CoreOrderBuilder.js +1 -1
- package/dist/modules/CoreOrder/index.js +1 -0
- package/dist/modules/CorePayForm/classes/CorePayFormBuilder.js +1 -1
- package/dist/modules/CorePayForm/index.js +1 -0
- package/dist/modules/CoreProduct/classes/CoreProductBuilder.js +1 -1
- package/dist/modules/CoreProduct/index.js +1 -0
- package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.js +1 -1
- package/dist/modules/CoreShipment/index.js +1 -0
- package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.js +1 -1
- package/package.json +2 -7
- package/dist/_virtual/index.js +0 -5
- package/dist/_virtual/index2.js +0 -3
- package/dist/_virtual/jsx-runtime.js +0 -5
- package/dist/_virtual/jsx-runtime2.js +0 -3
- package/dist/_virtual/react-jsx-runtime.development.js +0 -3
- package/dist/_virtual/react-jsx-runtime.production.js +0 -3
- package/dist/_virtual/use-sync-external-store-shim.development.js +0 -3
- package/dist/_virtual/use-sync-external-store-shim.production.js +0 -3
- package/dist/components/common/carousel/CustomCarousel.tsx +0 -26
- package/dist/components/common/carousel/CustomCarouselSection.tsx +0 -41
- package/dist/components/common/form/CustomFormField.tsx +0 -29
- package/dist/components/common/select/CustomSelect.tsx +0 -27
- package/dist/components/common/spinner/Spinner.tsx +0 -32
- package/dist/components/layouts/CoreBaseLayout.tsx +0 -19
- package/dist/components/templates/CoreHomeLayout.tsx +0 -8
- package/dist/components/ui/accordion.tsx +0 -44
- package/dist/components/ui/radio-group.tsx +0 -34
- package/dist/node_modules/@floating-ui/core/dist/floating-ui.core.js +0 -814
- package/dist/node_modules/@floating-ui/dom/dist/floating-ui.dom.js +0 -751
- package/dist/node_modules/@floating-ui/react-dom/dist/floating-ui.react-dom.js +0 -350
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.dom.js +0 -161
- package/dist/node_modules/@floating-ui/utils/dist/floating-ui.utils.js +0 -137
- package/dist/node_modules/@radix-ui/number/dist/index.js +0 -6
- package/dist/node_modules/@radix-ui/primitive/dist/index.js +0 -11
- package/dist/node_modules/@radix-ui/react-accordion/dist/index.js +0 -305
- package/dist/node_modules/@radix-ui/react-alert-dialog/dist/index.js +0 -147
- package/dist/node_modules/@radix-ui/react-arrow/dist/index.js +0 -25
- package/dist/node_modules/@radix-ui/react-avatar/dist/index.js +0 -118
- package/dist/node_modules/@radix-ui/react-checkbox/dist/index.js +0 -270
- package/dist/node_modules/@radix-ui/react-collapsible/dist/index.js +0 -145
- package/dist/node_modules/@radix-ui/react-collection/dist/index.js +0 -70
- package/dist/node_modules/@radix-ui/react-compose-refs/dist/index.js +0 -39
- package/dist/node_modules/@radix-ui/react-context/dist/index.js +0 -79
- package/dist/node_modules/@radix-ui/react-dialog/dist/index.js +0 -321
- package/dist/node_modules/@radix-ui/react-direction/dist/index.js +0 -11
- package/dist/node_modules/@radix-ui/react-dismissable-layer/dist/index.js +0 -211
- package/dist/node_modules/@radix-ui/react-dropdown-menu/dist/index.js +0 -267
- package/dist/node_modules/@radix-ui/react-focus-guards/dist/index.js +0 -29
- package/dist/node_modules/@radix-ui/react-focus-scope/dist/index.js +0 -207
- package/dist/node_modules/@radix-ui/react-id/dist/index.js +0 -15
- package/dist/node_modules/@radix-ui/react-label/dist/index.js +0 -24
- package/dist/node_modules/@radix-ui/react-menu/dist/index.js +0 -834
- package/dist/node_modules/@radix-ui/react-popover/dist/index.js +0 -299
- package/dist/node_modules/@radix-ui/react-popper/dist/index.js +0 -283
- package/dist/node_modules/@radix-ui/react-portal/dist/index.js +0 -17
- package/dist/node_modules/@radix-ui/react-presence/dist/index.js +0 -130
- package/dist/node_modules/@radix-ui/react-primitive/dist/index.js +0 -43
- package/dist/node_modules/@radix-ui/react-radio-group/dist/index.js +0 -282
- package/dist/node_modules/@radix-ui/react-roving-focus/dist/index.js +0 -223
- package/dist/node_modules/@radix-ui/react-select/dist/index.js +0 -1156
- package/dist/node_modules/@radix-ui/react-separator/dist/index.js +0 -30
- package/dist/node_modules/@radix-ui/react-slider/dist/index.js +0 -554
- package/dist/node_modules/@radix-ui/react-slot/dist/index.js +0 -99
- package/dist/node_modules/@radix-ui/react-switch/dist/index.js +0 -152
- package/dist/node_modules/@radix-ui/react-tabs/dist/index.js +0 -187
- package/dist/node_modules/@radix-ui/react-tooltip/dist/index.js +0 -482
- package/dist/node_modules/@radix-ui/react-use-callback-ref/dist/index.js +0 -12
- package/dist/node_modules/@radix-ui/react-use-controllable-state/dist/index.js +0 -70
- package/dist/node_modules/@radix-ui/react-use-escape-keydown/dist/index.js +0 -18
- package/dist/node_modules/@radix-ui/react-use-is-hydrated/dist/index.js +0 -16
- package/dist/node_modules/@radix-ui/react-use-layout-effect/dist/index.js +0 -7
- package/dist/node_modules/@radix-ui/react-use-previous/dist/index.js +0 -15
- package/dist/node_modules/@radix-ui/react-use-size/dist/index.js +0 -40
- package/dist/node_modules/@radix-ui/react-visually-hidden/dist/index.js +0 -35
- package/dist/node_modules/@stepperize/core/dist/index.js +0 -3
- package/dist/node_modules/@stepperize/react/dist/index.js +0 -6
- package/dist/node_modules/aria-hidden/dist/es2015/index.js +0 -137
- package/dist/node_modules/axios/index.js +0 -25
- package/dist/node_modules/axios/lib/adapters/adapters.js +0 -81
- package/dist/node_modules/axios/lib/adapters/fetch.js +0 -229
- package/dist/node_modules/axios/lib/adapters/xhr.js +0 -199
- package/dist/node_modules/axios/lib/axios.js +0 -86
- package/dist/node_modules/axios/lib/cancel/CancelToken.js +0 -133
- package/dist/node_modules/axios/lib/cancel/CanceledError.js +0 -23
- package/dist/node_modules/axios/lib/cancel/isCancel.js +0 -5
- package/dist/node_modules/axios/lib/core/Axios.js +0 -238
- package/dist/node_modules/axios/lib/core/AxiosError.js +0 -101
- package/dist/node_modules/axios/lib/core/AxiosHeaders.js +0 -312
- package/dist/node_modules/axios/lib/core/InterceptorManager.js +0 -69
- package/dist/node_modules/axios/lib/core/buildFullPath.js +0 -22
- package/dist/node_modules/axios/lib/core/dispatchRequest.js +0 -81
- package/dist/node_modules/axios/lib/core/mergeConfig.js +0 -106
- package/dist/node_modules/axios/lib/core/settle.js +0 -27
- package/dist/node_modules/axios/lib/core/transformData.js +0 -28
- package/dist/node_modules/axios/lib/defaults/index.js +0 -159
- package/dist/node_modules/axios/lib/defaults/transitional.js +0 -7
- package/dist/node_modules/axios/lib/env/data.js +0 -3
- package/dist/node_modules/axios/lib/helpers/AxiosURLSearchParams.js +0 -56
- package/dist/node_modules/axios/lib/helpers/HttpStatusCode.js +0 -71
- package/dist/node_modules/axios/lib/helpers/bind.js +0 -7
- package/dist/node_modules/axios/lib/helpers/buildURL.js +0 -69
- package/dist/node_modules/axios/lib/helpers/combineURLs.js +0 -15
- package/dist/node_modules/axios/lib/helpers/composeSignals.js +0 -48
- package/dist/node_modules/axios/lib/helpers/cookies.js +0 -43
- package/dist/node_modules/axios/lib/helpers/formDataToJSON.js +0 -93
- package/dist/node_modules/axios/lib/helpers/isAbsoluteURL.js +0 -15
- package/dist/node_modules/axios/lib/helpers/isAxiosError.js +0 -14
- package/dist/node_modules/axios/lib/helpers/isURLSameOrigin.js +0 -16
- package/dist/node_modules/axios/lib/helpers/null.js +0 -4
- package/dist/node_modules/axios/lib/helpers/parseHeaders.js +0 -55
- package/dist/node_modules/axios/lib/helpers/parseProtocol.js +0 -6
- package/dist/node_modules/axios/lib/helpers/progressEventReducer.js +0 -46
- package/dist/node_modules/axios/lib/helpers/resolveConfig.js +0 -58
- package/dist/node_modules/axios/lib/helpers/speedometer.js +0 -53
- package/dist/node_modules/axios/lib/helpers/spread.js +0 -28
- package/dist/node_modules/axios/lib/helpers/throttle.js +0 -44
- package/dist/node_modules/axios/lib/helpers/toFormData.js +0 -219
- package/dist/node_modules/axios/lib/helpers/toURLEncodedForm.js +0 -19
- package/dist/node_modules/axios/lib/helpers/trackStream.js +0 -88
- package/dist/node_modules/axios/lib/helpers/validator.js +0 -99
- package/dist/node_modules/axios/lib/platform/browser/classes/Blob.js +0 -3
- package/dist/node_modules/axios/lib/platform/browser/classes/FormData.js +0 -3
- package/dist/node_modules/axios/lib/platform/browser/classes/URLSearchParams.js +0 -5
- package/dist/node_modules/axios/lib/platform/browser/index.js +0 -15
- package/dist/node_modules/axios/lib/platform/common/utils.js +0 -45
- package/dist/node_modules/axios/lib/platform/index.js +0 -9
- package/dist/node_modules/axios/lib/utils.js +0 -780
- package/dist/node_modules/class-variance-authority/dist/index.js +0 -44
- package/dist/node_modules/clsx/dist/clsx.js +0 -3
- package/dist/node_modules/embla-carousel/esm/embla-carousel.esm.js +0 -1669
- package/dist/node_modules/embla-carousel-react/esm/embla-carousel-react.esm.js +0 -37
- package/dist/node_modules/embla-carousel-reactive-utils/esm/embla-carousel-reactive-utils.esm.js +0 -38
- package/dist/node_modules/get-nonce/dist/es2015/index.js +0 -8
- package/dist/node_modules/lucide-react/dist/esm/Icon.js +0 -43
- package/dist/node_modules/lucide-react/dist/esm/createLucideIcon.js +0 -30
- package/dist/node_modules/lucide-react/dist/esm/defaultAttributes.js +0 -20
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-left.js +0 -17
- package/dist/node_modules/lucide-react/dist/esm/icons/arrow-right.js +0 -17
- package/dist/node_modules/lucide-react/dist/esm/icons/check.js +0 -14
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-down.js +0 -14
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-left.js +0 -14
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-right.js +0 -14
- package/dist/node_modules/lucide-react/dist/esm/icons/chevron-up.js +0 -14
- package/dist/node_modules/lucide-react/dist/esm/icons/circle.js +0 -14
- package/dist/node_modules/lucide-react/dist/esm/icons/ellipsis.js +0 -18
- package/dist/node_modules/lucide-react/dist/esm/icons/x.js +0 -17
- package/dist/node_modules/lucide-react/dist/esm/shared/src/utils.js +0 -28
- package/dist/node_modules/react/cjs/react-jsx-runtime.development.js +0 -363
- package/dist/node_modules/react/cjs/react-jsx-runtime.production.js +0 -44
- package/dist/node_modules/react/jsx-runtime.js +0 -19
- package/dist/node_modules/react-hook-form/dist/index.esm.js +0 -560
- package/dist/node_modules/react-remove-scroll/dist/es2015/Combination.js +0 -9
- package/dist/node_modules/react-remove-scroll/dist/es2015/SideEffect.js +0 -167
- package/dist/node_modules/react-remove-scroll/dist/es2015/UI.js +0 -38
- package/dist/node_modules/react-remove-scroll/dist/es2015/aggresiveCapture.js +0 -21
- package/dist/node_modules/react-remove-scroll/dist/es2015/handleScroll.js +0 -110
- package/dist/node_modules/react-remove-scroll/dist/es2015/medium.js +0 -5
- package/dist/node_modules/react-remove-scroll/dist/es2015/sidecar.js +0 -7
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/component.js +0 -56
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/constants.js +0 -10
- package/dist/node_modules/react-remove-scroll-bar/dist/es2015/utils.js +0 -31
- package/dist/node_modules/react-style-singleton/dist/es2015/component.js +0 -19
- package/dist/node_modules/react-style-singleton/dist/es2015/hook.js +0 -25
- package/dist/node_modules/react-style-singleton/dist/es2015/singleton.js +0 -51
- package/dist/node_modules/sonner/dist/index.js +0 -299
- package/dist/node_modules/tailwind-merge/dist/bundle-mjs.js +0 -3035
- package/dist/node_modules/tslib/tslib.es6.js +0 -56
- package/dist/node_modules/use-callback-ref/dist/es2015/assignRef.js +0 -24
- package/dist/node_modules/use-callback-ref/dist/es2015/useMergeRef.js +0 -48
- package/dist/node_modules/use-callback-ref/dist/es2015/useRef.js +0 -42
- package/dist/node_modules/use-sidecar/dist/es2015/exports.js +0 -21
- package/dist/node_modules/use-sidecar/dist/es2015/medium.js +0 -77
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.development.js +0 -106
- package/dist/node_modules/use-sync-external-store/cjs/use-sync-external-store-shim.production.js +0 -77
- package/dist/node_modules/use-sync-external-store/shim/index.js +0 -19
- package/dist/node_modules/zustand/esm/react.js +0 -22
- package/dist/node_modules/zustand/esm/vanilla.js +0 -24
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { Primitive } from '../../react-primitive/dist/index.js';
|
|
3
|
-
import { j as jsxRuntimeExports } from '../../../../_virtual/jsx-runtime.js';
|
|
4
|
-
|
|
5
|
-
// src/separator.tsx
|
|
6
|
-
var NAME = "Separator";
|
|
7
|
-
var DEFAULT_ORIENTATION = "horizontal";
|
|
8
|
-
var ORIENTATIONS = ["horizontal", "vertical"];
|
|
9
|
-
var Separator = React.forwardRef((props, forwardedRef) => {
|
|
10
|
-
const { decorative, orientation: orientationProp = DEFAULT_ORIENTATION, ...domProps } = props;
|
|
11
|
-
const orientation = isValidOrientation(orientationProp) ? orientationProp : DEFAULT_ORIENTATION;
|
|
12
|
-
const ariaOrientation = orientation === "vertical" ? orientation : void 0;
|
|
13
|
-
const semanticProps = decorative ? { role: "none" } : { "aria-orientation": ariaOrientation, role: "separator" };
|
|
14
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
15
|
-
Primitive.div,
|
|
16
|
-
{
|
|
17
|
-
"data-orientation": orientation,
|
|
18
|
-
...semanticProps,
|
|
19
|
-
...domProps,
|
|
20
|
-
ref: forwardedRef
|
|
21
|
-
}
|
|
22
|
-
);
|
|
23
|
-
});
|
|
24
|
-
Separator.displayName = NAME;
|
|
25
|
-
function isValidOrientation(orientation) {
|
|
26
|
-
return ORIENTATIONS.includes(orientation);
|
|
27
|
-
}
|
|
28
|
-
var Root = Separator;
|
|
29
|
-
|
|
30
|
-
export { Root, Separator };
|
|
@@ -1,554 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { clamp } from '../../number/dist/index.js';
|
|
3
|
-
import { composeEventHandlers } from '../../primitive/dist/index.js';
|
|
4
|
-
import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
|
|
5
|
-
import { createContextScope } from '../../react-context/dist/index.js';
|
|
6
|
-
import { useControllableState } from '../../react-use-controllable-state/dist/index.js';
|
|
7
|
-
import { useDirection } from '../../react-direction/dist/index.js';
|
|
8
|
-
import { usePrevious } from '../../react-use-previous/dist/index.js';
|
|
9
|
-
import { useSize } from '../../react-use-size/dist/index.js';
|
|
10
|
-
import { Primitive } from '../../react-primitive/dist/index.js';
|
|
11
|
-
import { createCollection } from '../../react-collection/dist/index.js';
|
|
12
|
-
import { j as jsxRuntimeExports } from '../../../../_virtual/jsx-runtime.js';
|
|
13
|
-
|
|
14
|
-
var PAGE_KEYS = ["PageUp", "PageDown"];
|
|
15
|
-
var ARROW_KEYS = ["ArrowUp", "ArrowDown", "ArrowLeft", "ArrowRight"];
|
|
16
|
-
var BACK_KEYS = {
|
|
17
|
-
"from-left": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
18
|
-
"from-right": ["Home", "PageDown", "ArrowDown", "ArrowRight"],
|
|
19
|
-
"from-bottom": ["Home", "PageDown", "ArrowDown", "ArrowLeft"],
|
|
20
|
-
"from-top": ["Home", "PageDown", "ArrowUp", "ArrowLeft"]
|
|
21
|
-
};
|
|
22
|
-
var SLIDER_NAME = "Slider";
|
|
23
|
-
var [Collection, useCollection, createCollectionScope] = createCollection(SLIDER_NAME);
|
|
24
|
-
var [createSliderContext] = createContextScope(SLIDER_NAME, [
|
|
25
|
-
createCollectionScope
|
|
26
|
-
]);
|
|
27
|
-
var [SliderProvider, useSliderContext] = createSliderContext(SLIDER_NAME);
|
|
28
|
-
var Slider = React.forwardRef(
|
|
29
|
-
(props, forwardedRef) => {
|
|
30
|
-
const {
|
|
31
|
-
name,
|
|
32
|
-
min = 0,
|
|
33
|
-
max = 100,
|
|
34
|
-
step = 1,
|
|
35
|
-
orientation = "horizontal",
|
|
36
|
-
disabled = false,
|
|
37
|
-
minStepsBetweenThumbs = 0,
|
|
38
|
-
defaultValue = [min],
|
|
39
|
-
value,
|
|
40
|
-
onValueChange = () => {
|
|
41
|
-
},
|
|
42
|
-
onValueCommit = () => {
|
|
43
|
-
},
|
|
44
|
-
inverted = false,
|
|
45
|
-
form,
|
|
46
|
-
...sliderProps
|
|
47
|
-
} = props;
|
|
48
|
-
const thumbRefs = React.useRef(/* @__PURE__ */ new Set());
|
|
49
|
-
const valueIndexToChangeRef = React.useRef(0);
|
|
50
|
-
const isHorizontal = orientation === "horizontal";
|
|
51
|
-
const SliderOrientation = isHorizontal ? SliderHorizontal : SliderVertical;
|
|
52
|
-
const [values = [], setValues] = useControllableState({
|
|
53
|
-
prop: value,
|
|
54
|
-
defaultProp: defaultValue,
|
|
55
|
-
onChange: (value2) => {
|
|
56
|
-
const thumbs = [...thumbRefs.current];
|
|
57
|
-
thumbs[valueIndexToChangeRef.current]?.focus();
|
|
58
|
-
onValueChange(value2);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
const valuesBeforeSlideStartRef = React.useRef(values);
|
|
62
|
-
function handleSlideStart(value2) {
|
|
63
|
-
const closestIndex = getClosestValueIndex(values, value2);
|
|
64
|
-
updateValues(value2, closestIndex);
|
|
65
|
-
}
|
|
66
|
-
function handleSlideMove(value2) {
|
|
67
|
-
updateValues(value2, valueIndexToChangeRef.current);
|
|
68
|
-
}
|
|
69
|
-
function handleSlideEnd() {
|
|
70
|
-
const prevValue = valuesBeforeSlideStartRef.current[valueIndexToChangeRef.current];
|
|
71
|
-
const nextValue = values[valueIndexToChangeRef.current];
|
|
72
|
-
const hasChanged = nextValue !== prevValue;
|
|
73
|
-
if (hasChanged) onValueCommit(values);
|
|
74
|
-
}
|
|
75
|
-
function updateValues(value2, atIndex, { commit } = { commit: false }) {
|
|
76
|
-
const decimalCount = getDecimalCount(step);
|
|
77
|
-
const snapToStep = roundValue(Math.round((value2 - min) / step) * step + min, decimalCount);
|
|
78
|
-
const nextValue = clamp(snapToStep, [min, max]);
|
|
79
|
-
setValues((prevValues = []) => {
|
|
80
|
-
const nextValues = getNextSortedValues(prevValues, nextValue, atIndex);
|
|
81
|
-
if (hasMinStepsBetweenValues(nextValues, minStepsBetweenThumbs * step)) {
|
|
82
|
-
valueIndexToChangeRef.current = nextValues.indexOf(nextValue);
|
|
83
|
-
const hasChanged = String(nextValues) !== String(prevValues);
|
|
84
|
-
if (hasChanged && commit) onValueCommit(nextValues);
|
|
85
|
-
return hasChanged ? nextValues : prevValues;
|
|
86
|
-
} else {
|
|
87
|
-
return prevValues;
|
|
88
|
-
}
|
|
89
|
-
});
|
|
90
|
-
}
|
|
91
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
92
|
-
SliderProvider,
|
|
93
|
-
{
|
|
94
|
-
scope: props.__scopeSlider,
|
|
95
|
-
name,
|
|
96
|
-
disabled,
|
|
97
|
-
min,
|
|
98
|
-
max,
|
|
99
|
-
valueIndexToChangeRef,
|
|
100
|
-
thumbs: thumbRefs.current,
|
|
101
|
-
values,
|
|
102
|
-
orientation,
|
|
103
|
-
form,
|
|
104
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection.Provider, { scope: props.__scopeSlider, children: /* @__PURE__ */ jsxRuntimeExports.jsx(Collection.Slot, { scope: props.__scopeSlider, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
105
|
-
SliderOrientation,
|
|
106
|
-
{
|
|
107
|
-
"aria-disabled": disabled,
|
|
108
|
-
"data-disabled": disabled ? "" : void 0,
|
|
109
|
-
...sliderProps,
|
|
110
|
-
ref: forwardedRef,
|
|
111
|
-
onPointerDown: composeEventHandlers(sliderProps.onPointerDown, () => {
|
|
112
|
-
if (!disabled) valuesBeforeSlideStartRef.current = values;
|
|
113
|
-
}),
|
|
114
|
-
min,
|
|
115
|
-
max,
|
|
116
|
-
inverted,
|
|
117
|
-
onSlideStart: disabled ? void 0 : handleSlideStart,
|
|
118
|
-
onSlideMove: disabled ? void 0 : handleSlideMove,
|
|
119
|
-
onSlideEnd: disabled ? void 0 : handleSlideEnd,
|
|
120
|
-
onHomeKeyDown: () => !disabled && updateValues(min, 0, { commit: true }),
|
|
121
|
-
onEndKeyDown: () => !disabled && updateValues(max, values.length - 1, { commit: true }),
|
|
122
|
-
onStepKeyDown: ({ event, direction: stepDirection }) => {
|
|
123
|
-
if (!disabled) {
|
|
124
|
-
const isPageKey = PAGE_KEYS.includes(event.key);
|
|
125
|
-
const isSkipKey = isPageKey || event.shiftKey && ARROW_KEYS.includes(event.key);
|
|
126
|
-
const multiplier = isSkipKey ? 10 : 1;
|
|
127
|
-
const atIndex = valueIndexToChangeRef.current;
|
|
128
|
-
const value2 = values[atIndex];
|
|
129
|
-
const stepInDirection = step * multiplier * stepDirection;
|
|
130
|
-
updateValues(value2 + stepInDirection, atIndex, { commit: true });
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
) }) })
|
|
135
|
-
}
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
);
|
|
139
|
-
Slider.displayName = SLIDER_NAME;
|
|
140
|
-
var [SliderOrientationProvider, useSliderOrientationContext] = createSliderContext(SLIDER_NAME, {
|
|
141
|
-
startEdge: "left",
|
|
142
|
-
endEdge: "right",
|
|
143
|
-
size: "width",
|
|
144
|
-
direction: 1
|
|
145
|
-
});
|
|
146
|
-
var SliderHorizontal = React.forwardRef(
|
|
147
|
-
(props, forwardedRef) => {
|
|
148
|
-
const {
|
|
149
|
-
min,
|
|
150
|
-
max,
|
|
151
|
-
dir,
|
|
152
|
-
inverted,
|
|
153
|
-
onSlideStart,
|
|
154
|
-
onSlideMove,
|
|
155
|
-
onSlideEnd,
|
|
156
|
-
onStepKeyDown,
|
|
157
|
-
...sliderProps
|
|
158
|
-
} = props;
|
|
159
|
-
const [slider, setSlider] = React.useState(null);
|
|
160
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setSlider(node));
|
|
161
|
-
const rectRef = React.useRef(void 0);
|
|
162
|
-
const direction = useDirection(dir);
|
|
163
|
-
const isDirectionLTR = direction === "ltr";
|
|
164
|
-
const isSlidingFromLeft = isDirectionLTR && !inverted || !isDirectionLTR && inverted;
|
|
165
|
-
function getValueFromPointer(pointerPosition) {
|
|
166
|
-
const rect = rectRef.current || slider.getBoundingClientRect();
|
|
167
|
-
const input = [0, rect.width];
|
|
168
|
-
const output = isSlidingFromLeft ? [min, max] : [max, min];
|
|
169
|
-
const value = linearScale(input, output);
|
|
170
|
-
rectRef.current = rect;
|
|
171
|
-
return value(pointerPosition - rect.left);
|
|
172
|
-
}
|
|
173
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
174
|
-
SliderOrientationProvider,
|
|
175
|
-
{
|
|
176
|
-
scope: props.__scopeSlider,
|
|
177
|
-
startEdge: isSlidingFromLeft ? "left" : "right",
|
|
178
|
-
endEdge: isSlidingFromLeft ? "right" : "left",
|
|
179
|
-
direction: isSlidingFromLeft ? 1 : -1,
|
|
180
|
-
size: "width",
|
|
181
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
182
|
-
SliderImpl,
|
|
183
|
-
{
|
|
184
|
-
dir: direction,
|
|
185
|
-
"data-orientation": "horizontal",
|
|
186
|
-
...sliderProps,
|
|
187
|
-
ref: composedRefs,
|
|
188
|
-
style: {
|
|
189
|
-
...sliderProps.style,
|
|
190
|
-
["--radix-slider-thumb-transform"]: "translateX(-50%)"
|
|
191
|
-
},
|
|
192
|
-
onSlideStart: (event) => {
|
|
193
|
-
const value = getValueFromPointer(event.clientX);
|
|
194
|
-
onSlideStart?.(value);
|
|
195
|
-
},
|
|
196
|
-
onSlideMove: (event) => {
|
|
197
|
-
const value = getValueFromPointer(event.clientX);
|
|
198
|
-
onSlideMove?.(value);
|
|
199
|
-
},
|
|
200
|
-
onSlideEnd: () => {
|
|
201
|
-
rectRef.current = void 0;
|
|
202
|
-
onSlideEnd?.();
|
|
203
|
-
},
|
|
204
|
-
onStepKeyDown: (event) => {
|
|
205
|
-
const slideDirection = isSlidingFromLeft ? "from-left" : "from-right";
|
|
206
|
-
const isBackKey = BACK_KEYS[slideDirection].includes(event.key);
|
|
207
|
-
onStepKeyDown?.({ event, direction: isBackKey ? -1 : 1 });
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
)
|
|
211
|
-
}
|
|
212
|
-
);
|
|
213
|
-
}
|
|
214
|
-
);
|
|
215
|
-
var SliderVertical = React.forwardRef(
|
|
216
|
-
(props, forwardedRef) => {
|
|
217
|
-
const {
|
|
218
|
-
min,
|
|
219
|
-
max,
|
|
220
|
-
inverted,
|
|
221
|
-
onSlideStart,
|
|
222
|
-
onSlideMove,
|
|
223
|
-
onSlideEnd,
|
|
224
|
-
onStepKeyDown,
|
|
225
|
-
...sliderProps
|
|
226
|
-
} = props;
|
|
227
|
-
const sliderRef = React.useRef(null);
|
|
228
|
-
const ref = useComposedRefs(forwardedRef, sliderRef);
|
|
229
|
-
const rectRef = React.useRef(void 0);
|
|
230
|
-
const isSlidingFromBottom = !inverted;
|
|
231
|
-
function getValueFromPointer(pointerPosition) {
|
|
232
|
-
const rect = rectRef.current || sliderRef.current.getBoundingClientRect();
|
|
233
|
-
const input = [0, rect.height];
|
|
234
|
-
const output = isSlidingFromBottom ? [max, min] : [min, max];
|
|
235
|
-
const value = linearScale(input, output);
|
|
236
|
-
rectRef.current = rect;
|
|
237
|
-
return value(pointerPosition - rect.top);
|
|
238
|
-
}
|
|
239
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
240
|
-
SliderOrientationProvider,
|
|
241
|
-
{
|
|
242
|
-
scope: props.__scopeSlider,
|
|
243
|
-
startEdge: isSlidingFromBottom ? "bottom" : "top",
|
|
244
|
-
endEdge: isSlidingFromBottom ? "top" : "bottom",
|
|
245
|
-
size: "height",
|
|
246
|
-
direction: isSlidingFromBottom ? 1 : -1,
|
|
247
|
-
children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
248
|
-
SliderImpl,
|
|
249
|
-
{
|
|
250
|
-
"data-orientation": "vertical",
|
|
251
|
-
...sliderProps,
|
|
252
|
-
ref,
|
|
253
|
-
style: {
|
|
254
|
-
...sliderProps.style,
|
|
255
|
-
["--radix-slider-thumb-transform"]: "translateY(50%)"
|
|
256
|
-
},
|
|
257
|
-
onSlideStart: (event) => {
|
|
258
|
-
const value = getValueFromPointer(event.clientY);
|
|
259
|
-
onSlideStart?.(value);
|
|
260
|
-
},
|
|
261
|
-
onSlideMove: (event) => {
|
|
262
|
-
const value = getValueFromPointer(event.clientY);
|
|
263
|
-
onSlideMove?.(value);
|
|
264
|
-
},
|
|
265
|
-
onSlideEnd: () => {
|
|
266
|
-
rectRef.current = void 0;
|
|
267
|
-
onSlideEnd?.();
|
|
268
|
-
},
|
|
269
|
-
onStepKeyDown: (event) => {
|
|
270
|
-
const slideDirection = isSlidingFromBottom ? "from-bottom" : "from-top";
|
|
271
|
-
const isBackKey = BACK_KEYS[slideDirection].includes(event.key);
|
|
272
|
-
onStepKeyDown?.({ event, direction: isBackKey ? -1 : 1 });
|
|
273
|
-
}
|
|
274
|
-
}
|
|
275
|
-
)
|
|
276
|
-
}
|
|
277
|
-
);
|
|
278
|
-
}
|
|
279
|
-
);
|
|
280
|
-
var SliderImpl = React.forwardRef(
|
|
281
|
-
(props, forwardedRef) => {
|
|
282
|
-
const {
|
|
283
|
-
__scopeSlider,
|
|
284
|
-
onSlideStart,
|
|
285
|
-
onSlideMove,
|
|
286
|
-
onSlideEnd,
|
|
287
|
-
onHomeKeyDown,
|
|
288
|
-
onEndKeyDown,
|
|
289
|
-
onStepKeyDown,
|
|
290
|
-
...sliderProps
|
|
291
|
-
} = props;
|
|
292
|
-
const context = useSliderContext(SLIDER_NAME, __scopeSlider);
|
|
293
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
294
|
-
Primitive.span,
|
|
295
|
-
{
|
|
296
|
-
...sliderProps,
|
|
297
|
-
ref: forwardedRef,
|
|
298
|
-
onKeyDown: composeEventHandlers(props.onKeyDown, (event) => {
|
|
299
|
-
if (event.key === "Home") {
|
|
300
|
-
onHomeKeyDown(event);
|
|
301
|
-
event.preventDefault();
|
|
302
|
-
} else if (event.key === "End") {
|
|
303
|
-
onEndKeyDown(event);
|
|
304
|
-
event.preventDefault();
|
|
305
|
-
} else if (PAGE_KEYS.concat(ARROW_KEYS).includes(event.key)) {
|
|
306
|
-
onStepKeyDown(event);
|
|
307
|
-
event.preventDefault();
|
|
308
|
-
}
|
|
309
|
-
}),
|
|
310
|
-
onPointerDown: composeEventHandlers(props.onPointerDown, (event) => {
|
|
311
|
-
const target = event.target;
|
|
312
|
-
target.setPointerCapture(event.pointerId);
|
|
313
|
-
event.preventDefault();
|
|
314
|
-
if (context.thumbs.has(target)) {
|
|
315
|
-
target.focus();
|
|
316
|
-
} else {
|
|
317
|
-
onSlideStart(event);
|
|
318
|
-
}
|
|
319
|
-
}),
|
|
320
|
-
onPointerMove: composeEventHandlers(props.onPointerMove, (event) => {
|
|
321
|
-
const target = event.target;
|
|
322
|
-
if (target.hasPointerCapture(event.pointerId)) onSlideMove(event);
|
|
323
|
-
}),
|
|
324
|
-
onPointerUp: composeEventHandlers(props.onPointerUp, (event) => {
|
|
325
|
-
const target = event.target;
|
|
326
|
-
if (target.hasPointerCapture(event.pointerId)) {
|
|
327
|
-
target.releasePointerCapture(event.pointerId);
|
|
328
|
-
onSlideEnd(event);
|
|
329
|
-
}
|
|
330
|
-
})
|
|
331
|
-
}
|
|
332
|
-
);
|
|
333
|
-
}
|
|
334
|
-
);
|
|
335
|
-
var TRACK_NAME = "SliderTrack";
|
|
336
|
-
var SliderTrack = React.forwardRef(
|
|
337
|
-
(props, forwardedRef) => {
|
|
338
|
-
const { __scopeSlider, ...trackProps } = props;
|
|
339
|
-
const context = useSliderContext(TRACK_NAME, __scopeSlider);
|
|
340
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
341
|
-
Primitive.span,
|
|
342
|
-
{
|
|
343
|
-
"data-disabled": context.disabled ? "" : void 0,
|
|
344
|
-
"data-orientation": context.orientation,
|
|
345
|
-
...trackProps,
|
|
346
|
-
ref: forwardedRef
|
|
347
|
-
}
|
|
348
|
-
);
|
|
349
|
-
}
|
|
350
|
-
);
|
|
351
|
-
SliderTrack.displayName = TRACK_NAME;
|
|
352
|
-
var RANGE_NAME = "SliderRange";
|
|
353
|
-
var SliderRange = React.forwardRef(
|
|
354
|
-
(props, forwardedRef) => {
|
|
355
|
-
const { __scopeSlider, ...rangeProps } = props;
|
|
356
|
-
const context = useSliderContext(RANGE_NAME, __scopeSlider);
|
|
357
|
-
const orientation = useSliderOrientationContext(RANGE_NAME, __scopeSlider);
|
|
358
|
-
const ref = React.useRef(null);
|
|
359
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
360
|
-
const valuesCount = context.values.length;
|
|
361
|
-
const percentages = context.values.map(
|
|
362
|
-
(value) => convertValueToPercentage(value, context.min, context.max)
|
|
363
|
-
);
|
|
364
|
-
const offsetStart = valuesCount > 1 ? Math.min(...percentages) : 0;
|
|
365
|
-
const offsetEnd = 100 - Math.max(...percentages);
|
|
366
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
367
|
-
Primitive.span,
|
|
368
|
-
{
|
|
369
|
-
"data-orientation": context.orientation,
|
|
370
|
-
"data-disabled": context.disabled ? "" : void 0,
|
|
371
|
-
...rangeProps,
|
|
372
|
-
ref: composedRefs,
|
|
373
|
-
style: {
|
|
374
|
-
...props.style,
|
|
375
|
-
[orientation.startEdge]: offsetStart + "%",
|
|
376
|
-
[orientation.endEdge]: offsetEnd + "%"
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
);
|
|
380
|
-
}
|
|
381
|
-
);
|
|
382
|
-
SliderRange.displayName = RANGE_NAME;
|
|
383
|
-
var THUMB_NAME = "SliderThumb";
|
|
384
|
-
var SliderThumb = React.forwardRef(
|
|
385
|
-
(props, forwardedRef) => {
|
|
386
|
-
const getItems = useCollection(props.__scopeSlider);
|
|
387
|
-
const [thumb, setThumb] = React.useState(null);
|
|
388
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setThumb(node));
|
|
389
|
-
const index = React.useMemo(
|
|
390
|
-
() => thumb ? getItems().findIndex((item) => item.ref.current === thumb) : -1,
|
|
391
|
-
[getItems, thumb]
|
|
392
|
-
);
|
|
393
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(SliderThumbImpl, { ...props, ref: composedRefs, index });
|
|
394
|
-
}
|
|
395
|
-
);
|
|
396
|
-
var SliderThumbImpl = React.forwardRef(
|
|
397
|
-
(props, forwardedRef) => {
|
|
398
|
-
const { __scopeSlider, index, name, ...thumbProps } = props;
|
|
399
|
-
const context = useSliderContext(THUMB_NAME, __scopeSlider);
|
|
400
|
-
const orientation = useSliderOrientationContext(THUMB_NAME, __scopeSlider);
|
|
401
|
-
const [thumb, setThumb] = React.useState(null);
|
|
402
|
-
const composedRefs = useComposedRefs(forwardedRef, (node) => setThumb(node));
|
|
403
|
-
const isFormControl = thumb ? context.form || !!thumb.closest("form") : true;
|
|
404
|
-
const size = useSize(thumb);
|
|
405
|
-
const value = context.values[index];
|
|
406
|
-
const percent = value === void 0 ? 0 : convertValueToPercentage(value, context.min, context.max);
|
|
407
|
-
const label = getLabel(index, context.values.length);
|
|
408
|
-
const orientationSize = size?.[orientation.size];
|
|
409
|
-
const thumbInBoundsOffset = orientationSize ? getThumbInBoundsOffset(orientationSize, percent, orientation.direction) : 0;
|
|
410
|
-
React.useEffect(() => {
|
|
411
|
-
if (thumb) {
|
|
412
|
-
context.thumbs.add(thumb);
|
|
413
|
-
return () => {
|
|
414
|
-
context.thumbs.delete(thumb);
|
|
415
|
-
};
|
|
416
|
-
}
|
|
417
|
-
}, [thumb, context.thumbs]);
|
|
418
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsxs(
|
|
419
|
-
"span",
|
|
420
|
-
{
|
|
421
|
-
style: {
|
|
422
|
-
transform: "var(--radix-slider-thumb-transform)",
|
|
423
|
-
position: "absolute",
|
|
424
|
-
[orientation.startEdge]: `calc(${percent}% + ${thumbInBoundsOffset}px)`
|
|
425
|
-
},
|
|
426
|
-
children: [
|
|
427
|
-
/* @__PURE__ */ jsxRuntimeExports.jsx(Collection.ItemSlot, { scope: props.__scopeSlider, children: /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
428
|
-
Primitive.span,
|
|
429
|
-
{
|
|
430
|
-
role: "slider",
|
|
431
|
-
"aria-label": props["aria-label"] || label,
|
|
432
|
-
"aria-valuemin": context.min,
|
|
433
|
-
"aria-valuenow": value,
|
|
434
|
-
"aria-valuemax": context.max,
|
|
435
|
-
"aria-orientation": context.orientation,
|
|
436
|
-
"data-orientation": context.orientation,
|
|
437
|
-
"data-disabled": context.disabled ? "" : void 0,
|
|
438
|
-
tabIndex: context.disabled ? void 0 : 0,
|
|
439
|
-
...thumbProps,
|
|
440
|
-
ref: composedRefs,
|
|
441
|
-
style: value === void 0 ? { display: "none" } : props.style,
|
|
442
|
-
onFocus: composeEventHandlers(props.onFocus, () => {
|
|
443
|
-
context.valueIndexToChangeRef.current = index;
|
|
444
|
-
})
|
|
445
|
-
}
|
|
446
|
-
) }),
|
|
447
|
-
isFormControl && /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
448
|
-
SliderBubbleInput,
|
|
449
|
-
{
|
|
450
|
-
name: name ?? (context.name ? context.name + (context.values.length > 1 ? "[]" : "") : void 0),
|
|
451
|
-
form: context.form,
|
|
452
|
-
value
|
|
453
|
-
},
|
|
454
|
-
index
|
|
455
|
-
)
|
|
456
|
-
]
|
|
457
|
-
}
|
|
458
|
-
);
|
|
459
|
-
}
|
|
460
|
-
);
|
|
461
|
-
SliderThumb.displayName = THUMB_NAME;
|
|
462
|
-
var BUBBLE_INPUT_NAME = "RadioBubbleInput";
|
|
463
|
-
var SliderBubbleInput = React.forwardRef(
|
|
464
|
-
({ __scopeSlider, value, ...props }, forwardedRef) => {
|
|
465
|
-
const ref = React.useRef(null);
|
|
466
|
-
const composedRefs = useComposedRefs(ref, forwardedRef);
|
|
467
|
-
const prevValue = usePrevious(value);
|
|
468
|
-
React.useEffect(() => {
|
|
469
|
-
const input = ref.current;
|
|
470
|
-
if (!input) return;
|
|
471
|
-
const inputProto = window.HTMLInputElement.prototype;
|
|
472
|
-
const descriptor = Object.getOwnPropertyDescriptor(inputProto, "value");
|
|
473
|
-
const setValue = descriptor.set;
|
|
474
|
-
if (prevValue !== value && setValue) {
|
|
475
|
-
const event = new Event("input", { bubbles: true });
|
|
476
|
-
setValue.call(input, value);
|
|
477
|
-
input.dispatchEvent(event);
|
|
478
|
-
}
|
|
479
|
-
}, [prevValue, value]);
|
|
480
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(
|
|
481
|
-
Primitive.input,
|
|
482
|
-
{
|
|
483
|
-
style: { display: "none" },
|
|
484
|
-
...props,
|
|
485
|
-
ref: composedRefs,
|
|
486
|
-
defaultValue: value
|
|
487
|
-
}
|
|
488
|
-
);
|
|
489
|
-
}
|
|
490
|
-
);
|
|
491
|
-
SliderBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
492
|
-
function getNextSortedValues(prevValues = [], nextValue, atIndex) {
|
|
493
|
-
const nextValues = [...prevValues];
|
|
494
|
-
nextValues[atIndex] = nextValue;
|
|
495
|
-
return nextValues.sort((a, b) => a - b);
|
|
496
|
-
}
|
|
497
|
-
function convertValueToPercentage(value, min, max) {
|
|
498
|
-
const maxSteps = max - min;
|
|
499
|
-
const percentPerStep = 100 / maxSteps;
|
|
500
|
-
const percentage = percentPerStep * (value - min);
|
|
501
|
-
return clamp(percentage, [0, 100]);
|
|
502
|
-
}
|
|
503
|
-
function getLabel(index, totalValues) {
|
|
504
|
-
if (totalValues > 2) {
|
|
505
|
-
return `Value ${index + 1} of ${totalValues}`;
|
|
506
|
-
} else if (totalValues === 2) {
|
|
507
|
-
return ["Minimum", "Maximum"][index];
|
|
508
|
-
} else {
|
|
509
|
-
return void 0;
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
function getClosestValueIndex(values, nextValue) {
|
|
513
|
-
if (values.length === 1) return 0;
|
|
514
|
-
const distances = values.map((value) => Math.abs(value - nextValue));
|
|
515
|
-
const closestDistance = Math.min(...distances);
|
|
516
|
-
return distances.indexOf(closestDistance);
|
|
517
|
-
}
|
|
518
|
-
function getThumbInBoundsOffset(width, left, direction) {
|
|
519
|
-
const halfWidth = width / 2;
|
|
520
|
-
const halfPercent = 50;
|
|
521
|
-
const offset = linearScale([0, halfPercent], [0, halfWidth]);
|
|
522
|
-
return (halfWidth - offset(left) * direction) * direction;
|
|
523
|
-
}
|
|
524
|
-
function getStepsBetweenValues(values) {
|
|
525
|
-
return values.slice(0, -1).map((value, index) => values[index + 1] - value);
|
|
526
|
-
}
|
|
527
|
-
function hasMinStepsBetweenValues(values, minStepsBetweenValues) {
|
|
528
|
-
if (minStepsBetweenValues > 0) {
|
|
529
|
-
const stepsBetweenValues = getStepsBetweenValues(values);
|
|
530
|
-
const actualMinStepsBetweenValues = Math.min(...stepsBetweenValues);
|
|
531
|
-
return actualMinStepsBetweenValues >= minStepsBetweenValues;
|
|
532
|
-
}
|
|
533
|
-
return true;
|
|
534
|
-
}
|
|
535
|
-
function linearScale(input, output) {
|
|
536
|
-
return (value) => {
|
|
537
|
-
if (input[0] === input[1] || output[0] === output[1]) return output[0];
|
|
538
|
-
const ratio = (output[1] - output[0]) / (input[1] - input[0]);
|
|
539
|
-
return output[0] + ratio * (value - input[0]);
|
|
540
|
-
};
|
|
541
|
-
}
|
|
542
|
-
function getDecimalCount(value) {
|
|
543
|
-
return (String(value).split(".")[1] || "").length;
|
|
544
|
-
}
|
|
545
|
-
function roundValue(value, decimalCount) {
|
|
546
|
-
const rounder = Math.pow(10, decimalCount);
|
|
547
|
-
return Math.round(value * rounder) / rounder;
|
|
548
|
-
}
|
|
549
|
-
var Root = Slider;
|
|
550
|
-
var Track = SliderTrack;
|
|
551
|
-
var Range = SliderRange;
|
|
552
|
-
var Thumb = SliderThumb;
|
|
553
|
-
|
|
554
|
-
export { Range, Root, Slider, SliderRange, SliderThumb, SliderTrack, Thumb, Track };
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { composeRefs } from '../../react-compose-refs/dist/index.js';
|
|
3
|
-
import { j as jsxRuntimeExports } from '../../../../_virtual/jsx-runtime.js';
|
|
4
|
-
|
|
5
|
-
// src/slot.tsx
|
|
6
|
-
// @__NO_SIDE_EFFECTS__
|
|
7
|
-
function createSlot(ownerName) {
|
|
8
|
-
const SlotClone = /* @__PURE__ */ createSlotClone(ownerName);
|
|
9
|
-
const Slot2 = React.forwardRef((props, forwardedRef) => {
|
|
10
|
-
const { children, ...slotProps } = props;
|
|
11
|
-
const childrenArray = React.Children.toArray(children);
|
|
12
|
-
const slottable = childrenArray.find(isSlottable);
|
|
13
|
-
if (slottable) {
|
|
14
|
-
const newElement = slottable.props.children;
|
|
15
|
-
const newChildren = childrenArray.map((child) => {
|
|
16
|
-
if (child === slottable) {
|
|
17
|
-
if (React.Children.count(newElement) > 1) return React.Children.only(null);
|
|
18
|
-
return React.isValidElement(newElement) ? newElement.props.children : null;
|
|
19
|
-
} else {
|
|
20
|
-
return child;
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children: React.isValidElement(newElement) ? React.cloneElement(newElement, void 0, newChildren) : null });
|
|
24
|
-
}
|
|
25
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(SlotClone, { ...slotProps, ref: forwardedRef, children });
|
|
26
|
-
});
|
|
27
|
-
Slot2.displayName = `${ownerName}.Slot`;
|
|
28
|
-
return Slot2;
|
|
29
|
-
}
|
|
30
|
-
var Slot = /* @__PURE__ */ createSlot("Slot");
|
|
31
|
-
// @__NO_SIDE_EFFECTS__
|
|
32
|
-
function createSlotClone(ownerName) {
|
|
33
|
-
const SlotClone = React.forwardRef((props, forwardedRef) => {
|
|
34
|
-
const { children, ...slotProps } = props;
|
|
35
|
-
if (React.isValidElement(children)) {
|
|
36
|
-
const childrenRef = getElementRef(children);
|
|
37
|
-
const props2 = mergeProps(slotProps, children.props);
|
|
38
|
-
if (children.type !== React.Fragment) {
|
|
39
|
-
props2.ref = forwardedRef ? composeRefs(forwardedRef, childrenRef) : childrenRef;
|
|
40
|
-
}
|
|
41
|
-
return React.cloneElement(children, props2);
|
|
42
|
-
}
|
|
43
|
-
return React.Children.count(children) > 1 ? React.Children.only(null) : null;
|
|
44
|
-
});
|
|
45
|
-
SlotClone.displayName = `${ownerName}.SlotClone`;
|
|
46
|
-
return SlotClone;
|
|
47
|
-
}
|
|
48
|
-
var SLOTTABLE_IDENTIFIER = Symbol("radix.slottable");
|
|
49
|
-
// @__NO_SIDE_EFFECTS__
|
|
50
|
-
function createSlottable(ownerName) {
|
|
51
|
-
const Slottable2 = ({ children }) => {
|
|
52
|
-
return /* @__PURE__ */ jsxRuntimeExports.jsx(jsxRuntimeExports.Fragment, { children });
|
|
53
|
-
};
|
|
54
|
-
Slottable2.displayName = `${ownerName}.Slottable`;
|
|
55
|
-
Slottable2.__radixId = SLOTTABLE_IDENTIFIER;
|
|
56
|
-
return Slottable2;
|
|
57
|
-
}
|
|
58
|
-
function isSlottable(child) {
|
|
59
|
-
return React.isValidElement(child) && typeof child.type === "function" && "__radixId" in child.type && child.type.__radixId === SLOTTABLE_IDENTIFIER;
|
|
60
|
-
}
|
|
61
|
-
function mergeProps(slotProps, childProps) {
|
|
62
|
-
const overrideProps = { ...childProps };
|
|
63
|
-
for (const propName in childProps) {
|
|
64
|
-
const slotPropValue = slotProps[propName];
|
|
65
|
-
const childPropValue = childProps[propName];
|
|
66
|
-
const isHandler = /^on[A-Z]/.test(propName);
|
|
67
|
-
if (isHandler) {
|
|
68
|
-
if (slotPropValue && childPropValue) {
|
|
69
|
-
overrideProps[propName] = (...args) => {
|
|
70
|
-
const result = childPropValue(...args);
|
|
71
|
-
slotPropValue(...args);
|
|
72
|
-
return result;
|
|
73
|
-
};
|
|
74
|
-
} else if (slotPropValue) {
|
|
75
|
-
overrideProps[propName] = slotPropValue;
|
|
76
|
-
}
|
|
77
|
-
} else if (propName === "style") {
|
|
78
|
-
overrideProps[propName] = { ...slotPropValue, ...childPropValue };
|
|
79
|
-
} else if (propName === "className") {
|
|
80
|
-
overrideProps[propName] = [slotPropValue, childPropValue].filter(Boolean).join(" ");
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
return { ...slotProps, ...overrideProps };
|
|
84
|
-
}
|
|
85
|
-
function getElementRef(element) {
|
|
86
|
-
let getter = Object.getOwnPropertyDescriptor(element.props, "ref")?.get;
|
|
87
|
-
let mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
88
|
-
if (mayWarn) {
|
|
89
|
-
return element.ref;
|
|
90
|
-
}
|
|
91
|
-
getter = Object.getOwnPropertyDescriptor(element, "ref")?.get;
|
|
92
|
-
mayWarn = getter && "isReactWarning" in getter && getter.isReactWarning;
|
|
93
|
-
if (mayWarn) {
|
|
94
|
-
return element.props.ref;
|
|
95
|
-
}
|
|
96
|
-
return element.props.ref || element.ref;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
export { Slot as Root, Slot, createSlot, createSlottable };
|