ingeniuscliq-core 0.4.19 → 0.4.20
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.d.ts +1 -1
- package/dist/components/common/carousel/CustomCarousel.d.ts.map +1 -1
- package/dist/components/common/carousel/CustomCarouselSection.d.ts +1 -1
- package/dist/components/common/carousel/CustomCarouselSection.d.ts.map +1 -1
- package/dist/components/common/form/FormCheckbox.d.ts +1 -1
- package/dist/components/common/form/FormCheckbox.d.ts.map +1 -1
- package/dist/components/common/form/FormInput.d.ts +1 -1
- package/dist/components/common/form/FormInput.d.ts.map +1 -1
- package/dist/components/common/form/FormSelect.d.ts +1 -1
- package/dist/components/common/form/FormSelect.d.ts.map +1 -1
- package/dist/components/common/form/FormTextArea.d.ts +1 -1
- package/dist/components/common/form/FormTextArea.d.ts.map +1 -1
- package/dist/components/common/form/FormWrapper.d.ts +1 -1
- package/dist/components/common/form/FormWrapper.d.ts.map +1 -1
- package/dist/components/common/logo/Logo.d.ts +1 -1
- package/dist/components/common/logo/Logo.d.ts.map +1 -1
- package/dist/components/common/pagination/CustomPagination.d.ts +1 -1
- package/dist/components/common/pagination/CustomPagination.d.ts.map +1 -1
- package/dist/components/common/select/CustomSelect.d.ts +1 -1
- package/dist/components/common/select/CustomSelect.d.ts.map +1 -1
- package/dist/components/common/spinner/Spinner.d.ts +1 -1
- package/dist/components/common/spinner/Spinner.d.ts.map +1 -1
- package/dist/components/common/stepper/Stepper.d.ts +1 -1
- package/dist/components/common/stepper/Stepper.d.ts.map +1 -1
- package/dist/components/common/stepper/Stepper.tsx +1 -1
- package/dist/components/layouts/CoreBaseLayout.d.ts +1 -1
- package/dist/components/layouts/CoreBaseLayout.d.ts.map +1 -1
- package/dist/components/templates/CoreHomeLayout.d.ts +1 -1
- package/dist/components/templates/CoreHomeLayout.d.ts.map +1 -1
- package/dist/components/templates/CorePreviewLayout.d.ts +1 -1
- package/dist/components/templates/CorePreviewLayout.d.ts.map +1 -1
- package/dist/components/ui/accordion.tsx +9 -9
- package/dist/components/ui/alert-dialog.d.ts +2 -2
- package/dist/components/ui/alert-dialog.tsx +16 -16
- package/dist/components/ui/alert.d.ts +3 -3
- package/dist/components/ui/alert.d.ts.map +1 -1
- package/dist/components/ui/alert.tsx +1 -1
- package/dist/components/ui/avatar.tsx +7 -7
- package/dist/components/ui/badge.d.ts +4 -4
- package/dist/components/ui/badge.d.ts.map +1 -1
- package/dist/components/ui/badge.tsx +1 -1
- package/dist/components/ui/breadcrumb.d.ts +2 -2
- package/dist/components/ui/breadcrumb.tsx +3 -4
- package/dist/components/ui/button.d.ts +4 -4
- package/dist/components/ui/button.d.ts.map +1 -1
- package/dist/components/ui/button.tsx +2 -2
- package/dist/components/ui/carousel.tsx +2 -3
- package/dist/components/ui/checkbox.tsx +5 -5
- package/dist/components/ui/dialog.d.ts +2 -2
- package/dist/components/ui/dialog.tsx +15 -15
- package/dist/components/ui/dropdown-menu.d.ts +1 -1
- package/dist/components/ui/dropdown-menu.tsx +27 -29
- package/dist/components/ui/form.d.ts +1 -1
- package/dist/components/ui/form.d.ts.map +1 -1
- package/dist/components/ui/form.tsx +2 -2
- package/dist/components/ui/label.d.ts +1 -1
- package/dist/components/ui/label.d.ts.map +1 -1
- package/dist/components/ui/label.tsx +4 -4
- package/dist/components/ui/pagination.d.ts +5 -5
- package/dist/components/ui/pagination.tsx +2 -4
- package/dist/components/ui/popover.tsx +7 -7
- package/dist/components/ui/radio-group.tsx +7 -7
- package/dist/components/ui/select.tsx +25 -27
- package/dist/components/ui/separator.tsx +3 -3
- package/dist/components/ui/sheet.d.ts +5 -5
- package/dist/components/ui/sheet.d.ts.map +1 -1
- package/dist/components/ui/sheet.tsx +16 -16
- package/dist/components/ui/skeleton.d.ts +1 -1
- package/dist/components/ui/skeleton.d.ts.map +1 -1
- package/dist/components/ui/slider.tsx +6 -6
- package/dist/components/ui/stepper.tsx +4 -4
- package/dist/components/ui/switch.tsx +4 -4
- package/dist/components/ui/tabs.tsx +9 -9
- package/dist/components/ui/tooltip.tsx +6 -6
- package/dist/helpers/axiosGlobal.js +1 -2
- package/dist/hooks/useLanguage.js +2 -5
- package/dist/hooks/useNotification.js +1 -1
- package/dist/i18n/config.js +1 -5
- package/dist/lib/utils.js +1 -1
- package/dist/modules/CoreAuth/classes/CoreAuthBuilder.d.ts +2 -2
- package/dist/modules/CoreAuth/classes/CoreAuthBuilder.js +1 -1
- package/dist/modules/CoreAuth/context/AuthContext.d.ts +2 -2
- package/dist/modules/CoreAuth/context/AuthContext.d.ts.map +1 -1
- package/dist/modules/CoreAuth/hooks/useAuth.d.ts +3 -3
- package/dist/modules/CoreAuth/index.js +1 -0
- package/dist/modules/CoreAuth/stores/authStore.d.ts +2 -2
- package/dist/modules/CoreCustomization/classes/CoreCustomizationBuilder.d.ts +8 -8
- 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.d.ts +2 -2
- package/dist/modules/CorePayForm/classes/CorePayFormBuilder.js +1 -1
- package/dist/modules/CorePayForm/index.js +1 -0
- package/dist/modules/CoreProduct/classes/CoreProductBuilder.d.ts +8 -8
- package/dist/modules/CoreProduct/classes/CoreProductBuilder.js +1 -1
- package/dist/modules/CoreProduct/index.js +1 -0
- package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.d.ts +6 -6
- package/dist/modules/CoreShipment/classes/CoreShipmentBuilder.js +1 -1
- package/dist/modules/CoreShipment/index.js +1 -0
- package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.d.ts +4 -4
- package/dist/modules/CoreShopCart/classes/CoreShopCartBuilder.js +1 -1
- package/package.json +21 -13
- package/src/commands/common/constants.js +10 -0
- package/src/commands/helpers/index.js +15 -0
- package/src/commands/helpers/strings.js +4 -0
- package/src/commands/templates/locale.js +14 -0
- package/src/commands/templates/service.js +12 -0
- package/src/commands/templates/type.js +10 -0
- package/README.md +0 -417
- package/dist/_virtual/index.js +0 -5
- package/dist/_virtual/index2.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/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-hook-form/dist/index.esm.js +0 -560
- package/dist/node_modules/react-i18next/dist/es/IcuTransUtils/htmlEntityDecoder.js +0 -210
- package/dist/node_modules/react-i18next/dist/es/context.js +0 -18
- package/dist/node_modules/react-i18next/dist/es/defaults.js +0 -22
- package/dist/node_modules/react-i18next/dist/es/i18nInstance.js +0 -7
- package/dist/node_modules/react-i18next/dist/es/initReactI18next.js +0 -12
- package/dist/node_modules/react-i18next/dist/es/unescape.js +0 -27
- package/dist/node_modules/react-i18next/dist/es/useTranslation.js +0 -157
- package/dist/node_modules/react-i18next/dist/es/utils.js +0 -63
- 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/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
- /package/src/{core/commands → commands}/create-core-module.js +0 -0
- /package/src/{core/commands → commands}/create-module.js +0 -0
- /package/src/{core/commands → commands}/create-template.js +0 -0
- /package/src/{core/commands → commands}/rollback-core-module.js +0 -0
- /package/src/{core/commands → commands}/rollback-module.js +0 -0
|
@@ -1,270 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
|
|
3
|
-
import { createContextScope } from '../../react-context/dist/index.js';
|
|
4
|
-
import { composeEventHandlers } from '../../primitive/dist/index.js';
|
|
5
|
-
import { useControllableState } from '../../react-use-controllable-state/dist/index.js';
|
|
6
|
-
import { usePrevious } from '../../react-use-previous/dist/index.js';
|
|
7
|
-
import { useSize } from '../../react-use-size/dist/index.js';
|
|
8
|
-
import { Presence } from '../../react-presence/dist/index.js';
|
|
9
|
-
import { Primitive } from '../../react-primitive/dist/index.js';
|
|
10
|
-
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
11
|
-
|
|
12
|
-
var CHECKBOX_NAME = "Checkbox";
|
|
13
|
-
var [createCheckboxContext] = createContextScope(CHECKBOX_NAME);
|
|
14
|
-
var [CheckboxProviderImpl, useCheckboxContext] = createCheckboxContext(CHECKBOX_NAME);
|
|
15
|
-
function CheckboxProvider(props) {
|
|
16
|
-
const {
|
|
17
|
-
__scopeCheckbox,
|
|
18
|
-
checked: checkedProp,
|
|
19
|
-
children,
|
|
20
|
-
defaultChecked,
|
|
21
|
-
disabled,
|
|
22
|
-
form,
|
|
23
|
-
name,
|
|
24
|
-
onCheckedChange,
|
|
25
|
-
required,
|
|
26
|
-
value = "on",
|
|
27
|
-
// @ts-expect-error
|
|
28
|
-
internal_do_not_use_render
|
|
29
|
-
} = props;
|
|
30
|
-
const [checked, setChecked] = useControllableState({
|
|
31
|
-
prop: checkedProp,
|
|
32
|
-
defaultProp: defaultChecked ?? false,
|
|
33
|
-
onChange: onCheckedChange,
|
|
34
|
-
caller: CHECKBOX_NAME
|
|
35
|
-
});
|
|
36
|
-
const [control, setControl] = React.useState(null);
|
|
37
|
-
const [bubbleInput, setBubbleInput] = React.useState(null);
|
|
38
|
-
const hasConsumerStoppedPropagationRef = React.useRef(false);
|
|
39
|
-
const isFormControl = control ? !!form || !!control.closest("form") : (
|
|
40
|
-
// We set this to true by default so that events bubble to forms without JS (SSR)
|
|
41
|
-
true
|
|
42
|
-
);
|
|
43
|
-
const context = {
|
|
44
|
-
checked,
|
|
45
|
-
disabled,
|
|
46
|
-
setChecked,
|
|
47
|
-
control,
|
|
48
|
-
setControl,
|
|
49
|
-
name,
|
|
50
|
-
form,
|
|
51
|
-
value,
|
|
52
|
-
hasConsumerStoppedPropagationRef,
|
|
53
|
-
required,
|
|
54
|
-
defaultChecked: isIndeterminate(defaultChecked) ? false : defaultChecked,
|
|
55
|
-
isFormControl,
|
|
56
|
-
bubbleInput,
|
|
57
|
-
setBubbleInput
|
|
58
|
-
};
|
|
59
|
-
return /* @__PURE__ */ jsx(
|
|
60
|
-
CheckboxProviderImpl,
|
|
61
|
-
{
|
|
62
|
-
scope: __scopeCheckbox,
|
|
63
|
-
...context,
|
|
64
|
-
children: isFunction(internal_do_not_use_render) ? internal_do_not_use_render(context) : children
|
|
65
|
-
}
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
var TRIGGER_NAME = "CheckboxTrigger";
|
|
69
|
-
var CheckboxTrigger = React.forwardRef(
|
|
70
|
-
({ __scopeCheckbox, onKeyDown, onClick, ...checkboxProps }, forwardedRef) => {
|
|
71
|
-
const {
|
|
72
|
-
control,
|
|
73
|
-
value,
|
|
74
|
-
disabled,
|
|
75
|
-
checked,
|
|
76
|
-
required,
|
|
77
|
-
setControl,
|
|
78
|
-
setChecked,
|
|
79
|
-
hasConsumerStoppedPropagationRef,
|
|
80
|
-
isFormControl,
|
|
81
|
-
bubbleInput
|
|
82
|
-
} = useCheckboxContext(TRIGGER_NAME, __scopeCheckbox);
|
|
83
|
-
const composedRefs = useComposedRefs(forwardedRef, setControl);
|
|
84
|
-
const initialCheckedStateRef = React.useRef(checked);
|
|
85
|
-
React.useEffect(() => {
|
|
86
|
-
const form = control?.form;
|
|
87
|
-
if (form) {
|
|
88
|
-
const reset = () => setChecked(initialCheckedStateRef.current);
|
|
89
|
-
form.addEventListener("reset", reset);
|
|
90
|
-
return () => form.removeEventListener("reset", reset);
|
|
91
|
-
}
|
|
92
|
-
}, [control, setChecked]);
|
|
93
|
-
return /* @__PURE__ */ jsx(
|
|
94
|
-
Primitive.button,
|
|
95
|
-
{
|
|
96
|
-
type: "button",
|
|
97
|
-
role: "checkbox",
|
|
98
|
-
"aria-checked": isIndeterminate(checked) ? "mixed" : checked,
|
|
99
|
-
"aria-required": required,
|
|
100
|
-
"data-state": getState(checked),
|
|
101
|
-
"data-disabled": disabled ? "" : void 0,
|
|
102
|
-
disabled,
|
|
103
|
-
value,
|
|
104
|
-
...checkboxProps,
|
|
105
|
-
ref: composedRefs,
|
|
106
|
-
onKeyDown: composeEventHandlers(onKeyDown, (event) => {
|
|
107
|
-
if (event.key === "Enter") event.preventDefault();
|
|
108
|
-
}),
|
|
109
|
-
onClick: composeEventHandlers(onClick, (event) => {
|
|
110
|
-
setChecked((prevChecked) => isIndeterminate(prevChecked) ? true : !prevChecked);
|
|
111
|
-
if (bubbleInput && isFormControl) {
|
|
112
|
-
hasConsumerStoppedPropagationRef.current = event.isPropagationStopped();
|
|
113
|
-
if (!hasConsumerStoppedPropagationRef.current) event.stopPropagation();
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
}
|
|
117
|
-
);
|
|
118
|
-
}
|
|
119
|
-
);
|
|
120
|
-
CheckboxTrigger.displayName = TRIGGER_NAME;
|
|
121
|
-
var Checkbox = React.forwardRef(
|
|
122
|
-
(props, forwardedRef) => {
|
|
123
|
-
const {
|
|
124
|
-
__scopeCheckbox,
|
|
125
|
-
name,
|
|
126
|
-
checked,
|
|
127
|
-
defaultChecked,
|
|
128
|
-
required,
|
|
129
|
-
disabled,
|
|
130
|
-
value,
|
|
131
|
-
onCheckedChange,
|
|
132
|
-
form,
|
|
133
|
-
...checkboxProps
|
|
134
|
-
} = props;
|
|
135
|
-
return /* @__PURE__ */ jsx(
|
|
136
|
-
CheckboxProvider,
|
|
137
|
-
{
|
|
138
|
-
__scopeCheckbox,
|
|
139
|
-
checked,
|
|
140
|
-
defaultChecked,
|
|
141
|
-
disabled,
|
|
142
|
-
required,
|
|
143
|
-
onCheckedChange,
|
|
144
|
-
name,
|
|
145
|
-
form,
|
|
146
|
-
value,
|
|
147
|
-
internal_do_not_use_render: ({ isFormControl }) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
148
|
-
/* @__PURE__ */ jsx(
|
|
149
|
-
CheckboxTrigger,
|
|
150
|
-
{
|
|
151
|
-
...checkboxProps,
|
|
152
|
-
ref: forwardedRef,
|
|
153
|
-
__scopeCheckbox
|
|
154
|
-
}
|
|
155
|
-
),
|
|
156
|
-
isFormControl && /* @__PURE__ */ jsx(
|
|
157
|
-
CheckboxBubbleInput,
|
|
158
|
-
{
|
|
159
|
-
__scopeCheckbox
|
|
160
|
-
}
|
|
161
|
-
)
|
|
162
|
-
] })
|
|
163
|
-
}
|
|
164
|
-
);
|
|
165
|
-
}
|
|
166
|
-
);
|
|
167
|
-
Checkbox.displayName = CHECKBOX_NAME;
|
|
168
|
-
var INDICATOR_NAME = "CheckboxIndicator";
|
|
169
|
-
var CheckboxIndicator = React.forwardRef(
|
|
170
|
-
(props, forwardedRef) => {
|
|
171
|
-
const { __scopeCheckbox, forceMount, ...indicatorProps } = props;
|
|
172
|
-
const context = useCheckboxContext(INDICATOR_NAME, __scopeCheckbox);
|
|
173
|
-
return /* @__PURE__ */ jsx(
|
|
174
|
-
Presence,
|
|
175
|
-
{
|
|
176
|
-
present: forceMount || isIndeterminate(context.checked) || context.checked === true,
|
|
177
|
-
children: /* @__PURE__ */ jsx(
|
|
178
|
-
Primitive.span,
|
|
179
|
-
{
|
|
180
|
-
"data-state": getState(context.checked),
|
|
181
|
-
"data-disabled": context.disabled ? "" : void 0,
|
|
182
|
-
...indicatorProps,
|
|
183
|
-
ref: forwardedRef,
|
|
184
|
-
style: { pointerEvents: "none", ...props.style }
|
|
185
|
-
}
|
|
186
|
-
)
|
|
187
|
-
}
|
|
188
|
-
);
|
|
189
|
-
}
|
|
190
|
-
);
|
|
191
|
-
CheckboxIndicator.displayName = INDICATOR_NAME;
|
|
192
|
-
var BUBBLE_INPUT_NAME = "CheckboxBubbleInput";
|
|
193
|
-
var CheckboxBubbleInput = React.forwardRef(
|
|
194
|
-
({ __scopeCheckbox, ...props }, forwardedRef) => {
|
|
195
|
-
const {
|
|
196
|
-
control,
|
|
197
|
-
hasConsumerStoppedPropagationRef,
|
|
198
|
-
checked,
|
|
199
|
-
defaultChecked,
|
|
200
|
-
required,
|
|
201
|
-
disabled,
|
|
202
|
-
name,
|
|
203
|
-
value,
|
|
204
|
-
form,
|
|
205
|
-
bubbleInput,
|
|
206
|
-
setBubbleInput
|
|
207
|
-
} = useCheckboxContext(BUBBLE_INPUT_NAME, __scopeCheckbox);
|
|
208
|
-
const composedRefs = useComposedRefs(forwardedRef, setBubbleInput);
|
|
209
|
-
const prevChecked = usePrevious(checked);
|
|
210
|
-
const controlSize = useSize(control);
|
|
211
|
-
React.useEffect(() => {
|
|
212
|
-
const input = bubbleInput;
|
|
213
|
-
if (!input) return;
|
|
214
|
-
const inputProto = window.HTMLInputElement.prototype;
|
|
215
|
-
const descriptor = Object.getOwnPropertyDescriptor(
|
|
216
|
-
inputProto,
|
|
217
|
-
"checked"
|
|
218
|
-
);
|
|
219
|
-
const setChecked = descriptor.set;
|
|
220
|
-
const bubbles = !hasConsumerStoppedPropagationRef.current;
|
|
221
|
-
if (prevChecked !== checked && setChecked) {
|
|
222
|
-
const event = new Event("click", { bubbles });
|
|
223
|
-
input.indeterminate = isIndeterminate(checked);
|
|
224
|
-
setChecked.call(input, isIndeterminate(checked) ? false : checked);
|
|
225
|
-
input.dispatchEvent(event);
|
|
226
|
-
}
|
|
227
|
-
}, [bubbleInput, prevChecked, checked, hasConsumerStoppedPropagationRef]);
|
|
228
|
-
const defaultCheckedRef = React.useRef(isIndeterminate(checked) ? false : checked);
|
|
229
|
-
return /* @__PURE__ */ jsx(
|
|
230
|
-
Primitive.input,
|
|
231
|
-
{
|
|
232
|
-
type: "checkbox",
|
|
233
|
-
"aria-hidden": true,
|
|
234
|
-
defaultChecked: defaultChecked ?? defaultCheckedRef.current,
|
|
235
|
-
required,
|
|
236
|
-
disabled,
|
|
237
|
-
name,
|
|
238
|
-
value,
|
|
239
|
-
form,
|
|
240
|
-
...props,
|
|
241
|
-
tabIndex: -1,
|
|
242
|
-
ref: composedRefs,
|
|
243
|
-
style: {
|
|
244
|
-
...props.style,
|
|
245
|
-
...controlSize,
|
|
246
|
-
position: "absolute",
|
|
247
|
-
pointerEvents: "none",
|
|
248
|
-
opacity: 0,
|
|
249
|
-
margin: 0,
|
|
250
|
-
// We transform because the input is absolutely positioned but we have
|
|
251
|
-
// rendered it **after** the button. This pulls it back to sit on top
|
|
252
|
-
// of the button.
|
|
253
|
-
transform: "translateX(-100%)"
|
|
254
|
-
}
|
|
255
|
-
}
|
|
256
|
-
);
|
|
257
|
-
}
|
|
258
|
-
);
|
|
259
|
-
CheckboxBubbleInput.displayName = BUBBLE_INPUT_NAME;
|
|
260
|
-
function isFunction(value) {
|
|
261
|
-
return typeof value === "function";
|
|
262
|
-
}
|
|
263
|
-
function isIndeterminate(checked) {
|
|
264
|
-
return checked === "indeterminate";
|
|
265
|
-
}
|
|
266
|
-
function getState(checked) {
|
|
267
|
-
return isIndeterminate(checked) ? "indeterminate" : checked ? "checked" : "unchecked";
|
|
268
|
-
}
|
|
269
|
-
|
|
270
|
-
export { Checkbox, CheckboxIndicator, CheckboxIndicator as Indicator, Checkbox as Root, CheckboxBubbleInput as unstable_BubbleInput, CheckboxBubbleInput as unstable_CheckboxBubbleInput, CheckboxProvider as unstable_CheckboxProvider, CheckboxTrigger as unstable_CheckboxTrigger, CheckboxProvider as unstable_Provider, CheckboxTrigger as unstable_Trigger };
|
|
@@ -1,145 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { composeEventHandlers } from '../../primitive/dist/index.js';
|
|
3
|
-
import { createContextScope } from '../../react-context/dist/index.js';
|
|
4
|
-
import { useControllableState } from '../../react-use-controllable-state/dist/index.js';
|
|
5
|
-
import { useLayoutEffect as useLayoutEffect2 } from '../../react-use-layout-effect/dist/index.js';
|
|
6
|
-
import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
|
|
7
|
-
import { Primitive } from '../../react-primitive/dist/index.js';
|
|
8
|
-
import { Presence } from '../../react-presence/dist/index.js';
|
|
9
|
-
import { useId } from '../../react-id/dist/index.js';
|
|
10
|
-
import { jsx } from 'react/jsx-runtime';
|
|
11
|
-
|
|
12
|
-
var COLLAPSIBLE_NAME = "Collapsible";
|
|
13
|
-
var [createCollapsibleContext, createCollapsibleScope] = createContextScope(COLLAPSIBLE_NAME);
|
|
14
|
-
var [CollapsibleProvider, useCollapsibleContext] = createCollapsibleContext(COLLAPSIBLE_NAME);
|
|
15
|
-
var Collapsible = React.forwardRef(
|
|
16
|
-
(props, forwardedRef) => {
|
|
17
|
-
const {
|
|
18
|
-
__scopeCollapsible,
|
|
19
|
-
open: openProp,
|
|
20
|
-
defaultOpen,
|
|
21
|
-
disabled,
|
|
22
|
-
onOpenChange,
|
|
23
|
-
...collapsibleProps
|
|
24
|
-
} = props;
|
|
25
|
-
const [open, setOpen] = useControllableState({
|
|
26
|
-
prop: openProp,
|
|
27
|
-
defaultProp: defaultOpen ?? false,
|
|
28
|
-
onChange: onOpenChange,
|
|
29
|
-
caller: COLLAPSIBLE_NAME
|
|
30
|
-
});
|
|
31
|
-
return /* @__PURE__ */ jsx(
|
|
32
|
-
CollapsibleProvider,
|
|
33
|
-
{
|
|
34
|
-
scope: __scopeCollapsible,
|
|
35
|
-
disabled,
|
|
36
|
-
contentId: useId(),
|
|
37
|
-
open,
|
|
38
|
-
onOpenToggle: React.useCallback(() => setOpen((prevOpen) => !prevOpen), [setOpen]),
|
|
39
|
-
children: /* @__PURE__ */ jsx(
|
|
40
|
-
Primitive.div,
|
|
41
|
-
{
|
|
42
|
-
"data-state": getState(open),
|
|
43
|
-
"data-disabled": disabled ? "" : void 0,
|
|
44
|
-
...collapsibleProps,
|
|
45
|
-
ref: forwardedRef
|
|
46
|
-
}
|
|
47
|
-
)
|
|
48
|
-
}
|
|
49
|
-
);
|
|
50
|
-
}
|
|
51
|
-
);
|
|
52
|
-
Collapsible.displayName = COLLAPSIBLE_NAME;
|
|
53
|
-
var TRIGGER_NAME = "CollapsibleTrigger";
|
|
54
|
-
var CollapsibleTrigger = React.forwardRef(
|
|
55
|
-
(props, forwardedRef) => {
|
|
56
|
-
const { __scopeCollapsible, ...triggerProps } = props;
|
|
57
|
-
const context = useCollapsibleContext(TRIGGER_NAME, __scopeCollapsible);
|
|
58
|
-
return /* @__PURE__ */ jsx(
|
|
59
|
-
Primitive.button,
|
|
60
|
-
{
|
|
61
|
-
type: "button",
|
|
62
|
-
"aria-controls": context.contentId,
|
|
63
|
-
"aria-expanded": context.open || false,
|
|
64
|
-
"data-state": getState(context.open),
|
|
65
|
-
"data-disabled": context.disabled ? "" : void 0,
|
|
66
|
-
disabled: context.disabled,
|
|
67
|
-
...triggerProps,
|
|
68
|
-
ref: forwardedRef,
|
|
69
|
-
onClick: composeEventHandlers(props.onClick, context.onOpenToggle)
|
|
70
|
-
}
|
|
71
|
-
);
|
|
72
|
-
}
|
|
73
|
-
);
|
|
74
|
-
CollapsibleTrigger.displayName = TRIGGER_NAME;
|
|
75
|
-
var CONTENT_NAME = "CollapsibleContent";
|
|
76
|
-
var CollapsibleContent = React.forwardRef(
|
|
77
|
-
(props, forwardedRef) => {
|
|
78
|
-
const { forceMount, ...contentProps } = props;
|
|
79
|
-
const context = useCollapsibleContext(CONTENT_NAME, props.__scopeCollapsible);
|
|
80
|
-
return /* @__PURE__ */ jsx(Presence, { present: forceMount || context.open, children: ({ present }) => /* @__PURE__ */ jsx(CollapsibleContentImpl, { ...contentProps, ref: forwardedRef, present }) });
|
|
81
|
-
}
|
|
82
|
-
);
|
|
83
|
-
CollapsibleContent.displayName = CONTENT_NAME;
|
|
84
|
-
var CollapsibleContentImpl = React.forwardRef((props, forwardedRef) => {
|
|
85
|
-
const { __scopeCollapsible, present, children, ...contentProps } = props;
|
|
86
|
-
const context = useCollapsibleContext(CONTENT_NAME, __scopeCollapsible);
|
|
87
|
-
const [isPresent, setIsPresent] = React.useState(present);
|
|
88
|
-
const ref = React.useRef(null);
|
|
89
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
90
|
-
const heightRef = React.useRef(0);
|
|
91
|
-
const height = heightRef.current;
|
|
92
|
-
const widthRef = React.useRef(0);
|
|
93
|
-
const width = widthRef.current;
|
|
94
|
-
const isOpen = context.open || isPresent;
|
|
95
|
-
const isMountAnimationPreventedRef = React.useRef(isOpen);
|
|
96
|
-
const originalStylesRef = React.useRef(void 0);
|
|
97
|
-
React.useEffect(() => {
|
|
98
|
-
const rAF = requestAnimationFrame(() => isMountAnimationPreventedRef.current = false);
|
|
99
|
-
return () => cancelAnimationFrame(rAF);
|
|
100
|
-
}, []);
|
|
101
|
-
useLayoutEffect2(() => {
|
|
102
|
-
const node = ref.current;
|
|
103
|
-
if (node) {
|
|
104
|
-
originalStylesRef.current = originalStylesRef.current || {
|
|
105
|
-
transitionDuration: node.style.transitionDuration,
|
|
106
|
-
animationName: node.style.animationName
|
|
107
|
-
};
|
|
108
|
-
node.style.transitionDuration = "0s";
|
|
109
|
-
node.style.animationName = "none";
|
|
110
|
-
const rect = node.getBoundingClientRect();
|
|
111
|
-
heightRef.current = rect.height;
|
|
112
|
-
widthRef.current = rect.width;
|
|
113
|
-
if (!isMountAnimationPreventedRef.current) {
|
|
114
|
-
node.style.transitionDuration = originalStylesRef.current.transitionDuration;
|
|
115
|
-
node.style.animationName = originalStylesRef.current.animationName;
|
|
116
|
-
}
|
|
117
|
-
setIsPresent(present);
|
|
118
|
-
}
|
|
119
|
-
}, [context.open, present]);
|
|
120
|
-
return /* @__PURE__ */ jsx(
|
|
121
|
-
Primitive.div,
|
|
122
|
-
{
|
|
123
|
-
"data-state": getState(context.open),
|
|
124
|
-
"data-disabled": context.disabled ? "" : void 0,
|
|
125
|
-
id: context.contentId,
|
|
126
|
-
hidden: !isOpen,
|
|
127
|
-
...contentProps,
|
|
128
|
-
ref: composedRefs,
|
|
129
|
-
style: {
|
|
130
|
-
[`--radix-collapsible-content-height`]: height ? `${height}px` : void 0,
|
|
131
|
-
[`--radix-collapsible-content-width`]: width ? `${width}px` : void 0,
|
|
132
|
-
...props.style
|
|
133
|
-
},
|
|
134
|
-
children: isOpen && children
|
|
135
|
-
}
|
|
136
|
-
);
|
|
137
|
-
});
|
|
138
|
-
function getState(open) {
|
|
139
|
-
return open ? "open" : "closed";
|
|
140
|
-
}
|
|
141
|
-
var Root = Collapsible;
|
|
142
|
-
var Trigger = CollapsibleTrigger;
|
|
143
|
-
var Content = CollapsibleContent;
|
|
144
|
-
|
|
145
|
-
export { Collapsible, CollapsibleContent, CollapsibleTrigger, Content, Root, Trigger, createCollapsibleScope };
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
import React__default from 'react';
|
|
2
|
-
import { createContextScope } from '../../react-context/dist/index.js';
|
|
3
|
-
import { useComposedRefs } from '../../react-compose-refs/dist/index.js';
|
|
4
|
-
import { createSlot } from '../../react-slot/dist/index.js';
|
|
5
|
-
import { jsx } from 'react/jsx-runtime';
|
|
6
|
-
|
|
7
|
-
function createCollection(name) {
|
|
8
|
-
const PROVIDER_NAME = name + "CollectionProvider";
|
|
9
|
-
const [createCollectionContext, createCollectionScope] = createContextScope(PROVIDER_NAME);
|
|
10
|
-
const [CollectionProviderImpl, useCollectionContext] = createCollectionContext(
|
|
11
|
-
PROVIDER_NAME,
|
|
12
|
-
{ collectionRef: { current: null }, itemMap: /* @__PURE__ */ new Map() }
|
|
13
|
-
);
|
|
14
|
-
const CollectionProvider = (props) => {
|
|
15
|
-
const { scope, children } = props;
|
|
16
|
-
const ref = React__default.useRef(null);
|
|
17
|
-
const itemMap = React__default.useRef(/* @__PURE__ */ new Map()).current;
|
|
18
|
-
return /* @__PURE__ */ jsx(CollectionProviderImpl, { scope, itemMap, collectionRef: ref, children });
|
|
19
|
-
};
|
|
20
|
-
CollectionProvider.displayName = PROVIDER_NAME;
|
|
21
|
-
const COLLECTION_SLOT_NAME = name + "CollectionSlot";
|
|
22
|
-
const CollectionSlotImpl = createSlot(COLLECTION_SLOT_NAME);
|
|
23
|
-
const CollectionSlot = React__default.forwardRef(
|
|
24
|
-
(props, forwardedRef) => {
|
|
25
|
-
const { scope, children } = props;
|
|
26
|
-
const context = useCollectionContext(COLLECTION_SLOT_NAME, scope);
|
|
27
|
-
const composedRefs = useComposedRefs(forwardedRef, context.collectionRef);
|
|
28
|
-
return /* @__PURE__ */ jsx(CollectionSlotImpl, { ref: composedRefs, children });
|
|
29
|
-
}
|
|
30
|
-
);
|
|
31
|
-
CollectionSlot.displayName = COLLECTION_SLOT_NAME;
|
|
32
|
-
const ITEM_SLOT_NAME = name + "CollectionItemSlot";
|
|
33
|
-
const ITEM_DATA_ATTR = "data-radix-collection-item";
|
|
34
|
-
const CollectionItemSlotImpl = createSlot(ITEM_SLOT_NAME);
|
|
35
|
-
const CollectionItemSlot = React__default.forwardRef(
|
|
36
|
-
(props, forwardedRef) => {
|
|
37
|
-
const { scope, children, ...itemData } = props;
|
|
38
|
-
const ref = React__default.useRef(null);
|
|
39
|
-
const composedRefs = useComposedRefs(forwardedRef, ref);
|
|
40
|
-
const context = useCollectionContext(ITEM_SLOT_NAME, scope);
|
|
41
|
-
React__default.useEffect(() => {
|
|
42
|
-
context.itemMap.set(ref, { ref, ...itemData });
|
|
43
|
-
return () => void context.itemMap.delete(ref);
|
|
44
|
-
});
|
|
45
|
-
return /* @__PURE__ */ jsx(CollectionItemSlotImpl, { ...{ [ITEM_DATA_ATTR]: "" }, ref: composedRefs, children });
|
|
46
|
-
}
|
|
47
|
-
);
|
|
48
|
-
CollectionItemSlot.displayName = ITEM_SLOT_NAME;
|
|
49
|
-
function useCollection(scope) {
|
|
50
|
-
const context = useCollectionContext(name + "CollectionConsumer", scope);
|
|
51
|
-
const getItems = React__default.useCallback(() => {
|
|
52
|
-
const collectionNode = context.collectionRef.current;
|
|
53
|
-
if (!collectionNode) return [];
|
|
54
|
-
const orderedNodes = Array.from(collectionNode.querySelectorAll(`[${ITEM_DATA_ATTR}]`));
|
|
55
|
-
const items = Array.from(context.itemMap.values());
|
|
56
|
-
const orderedItems = items.sort(
|
|
57
|
-
(a, b) => orderedNodes.indexOf(a.ref.current) - orderedNodes.indexOf(b.ref.current)
|
|
58
|
-
);
|
|
59
|
-
return orderedItems;
|
|
60
|
-
}, [context.collectionRef, context.itemMap]);
|
|
61
|
-
return getItems;
|
|
62
|
-
}
|
|
63
|
-
return [
|
|
64
|
-
{ Provider: CollectionProvider, Slot: CollectionSlot, ItemSlot: CollectionItemSlot },
|
|
65
|
-
useCollection,
|
|
66
|
-
createCollectionScope
|
|
67
|
-
];
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
export { createCollection };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
|
|
3
|
-
// packages/react/compose-refs/src/compose-refs.tsx
|
|
4
|
-
function setRef(ref, value) {
|
|
5
|
-
if (typeof ref === "function") {
|
|
6
|
-
return ref(value);
|
|
7
|
-
} else if (ref !== null && ref !== void 0) {
|
|
8
|
-
ref.current = value;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
function composeRefs(...refs) {
|
|
12
|
-
return (node) => {
|
|
13
|
-
let hasCleanup = false;
|
|
14
|
-
const cleanups = refs.map((ref) => {
|
|
15
|
-
const cleanup = setRef(ref, node);
|
|
16
|
-
if (!hasCleanup && typeof cleanup == "function") {
|
|
17
|
-
hasCleanup = true;
|
|
18
|
-
}
|
|
19
|
-
return cleanup;
|
|
20
|
-
});
|
|
21
|
-
if (hasCleanup) {
|
|
22
|
-
return () => {
|
|
23
|
-
for (let i = 0; i < cleanups.length; i++) {
|
|
24
|
-
const cleanup = cleanups[i];
|
|
25
|
-
if (typeof cleanup == "function") {
|
|
26
|
-
cleanup();
|
|
27
|
-
} else {
|
|
28
|
-
setRef(refs[i], null);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
};
|
|
32
|
-
}
|
|
33
|
-
};
|
|
34
|
-
}
|
|
35
|
-
function useComposedRefs(...refs) {
|
|
36
|
-
return React.useCallback(composeRefs(...refs), refs);
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
export { composeRefs, useComposedRefs };
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { jsx } from 'react/jsx-runtime';
|
|
3
|
-
|
|
4
|
-
// packages/react/context/src/create-context.tsx
|
|
5
|
-
function createContext2(rootComponentName, defaultContext) {
|
|
6
|
-
const Context = React.createContext(defaultContext);
|
|
7
|
-
const Provider = (props) => {
|
|
8
|
-
const { children, ...context } = props;
|
|
9
|
-
const value = React.useMemo(() => context, Object.values(context));
|
|
10
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
11
|
-
};
|
|
12
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
13
|
-
function useContext2(consumerName) {
|
|
14
|
-
const context = React.useContext(Context);
|
|
15
|
-
if (context) return context;
|
|
16
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
17
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
18
|
-
}
|
|
19
|
-
return [Provider, useContext2];
|
|
20
|
-
}
|
|
21
|
-
function createContextScope(scopeName, createContextScopeDeps = []) {
|
|
22
|
-
let defaultContexts = [];
|
|
23
|
-
function createContext3(rootComponentName, defaultContext) {
|
|
24
|
-
const BaseContext = React.createContext(defaultContext);
|
|
25
|
-
const index = defaultContexts.length;
|
|
26
|
-
defaultContexts = [...defaultContexts, defaultContext];
|
|
27
|
-
const Provider = (props) => {
|
|
28
|
-
const { scope, children, ...context } = props;
|
|
29
|
-
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
30
|
-
const value = React.useMemo(() => context, Object.values(context));
|
|
31
|
-
return /* @__PURE__ */ jsx(Context.Provider, { value, children });
|
|
32
|
-
};
|
|
33
|
-
Provider.displayName = rootComponentName + "Provider";
|
|
34
|
-
function useContext2(consumerName, scope) {
|
|
35
|
-
const Context = scope?.[scopeName]?.[index] || BaseContext;
|
|
36
|
-
const context = React.useContext(Context);
|
|
37
|
-
if (context) return context;
|
|
38
|
-
if (defaultContext !== void 0) return defaultContext;
|
|
39
|
-
throw new Error(`\`${consumerName}\` must be used within \`${rootComponentName}\``);
|
|
40
|
-
}
|
|
41
|
-
return [Provider, useContext2];
|
|
42
|
-
}
|
|
43
|
-
const createScope = () => {
|
|
44
|
-
const scopeContexts = defaultContexts.map((defaultContext) => {
|
|
45
|
-
return React.createContext(defaultContext);
|
|
46
|
-
});
|
|
47
|
-
return function useScope(scope) {
|
|
48
|
-
const contexts = scope?.[scopeName] || scopeContexts;
|
|
49
|
-
return React.useMemo(
|
|
50
|
-
() => ({ [`__scope${scopeName}`]: { ...scope, [scopeName]: contexts } }),
|
|
51
|
-
[scope, contexts]
|
|
52
|
-
);
|
|
53
|
-
};
|
|
54
|
-
};
|
|
55
|
-
createScope.scopeName = scopeName;
|
|
56
|
-
return [createContext3, composeContextScopes(createScope, ...createContextScopeDeps)];
|
|
57
|
-
}
|
|
58
|
-
function composeContextScopes(...scopes) {
|
|
59
|
-
const baseScope = scopes[0];
|
|
60
|
-
if (scopes.length === 1) return baseScope;
|
|
61
|
-
const createScope = () => {
|
|
62
|
-
const scopeHooks = scopes.map((createScope2) => ({
|
|
63
|
-
useScope: createScope2(),
|
|
64
|
-
scopeName: createScope2.scopeName
|
|
65
|
-
}));
|
|
66
|
-
return function useComposedScopes(overrideScopes) {
|
|
67
|
-
const nextScopes = scopeHooks.reduce((nextScopes2, { useScope, scopeName }) => {
|
|
68
|
-
const scopeProps = useScope(overrideScopes);
|
|
69
|
-
const currentScope = scopeProps[`__scope${scopeName}`];
|
|
70
|
-
return { ...nextScopes2, ...currentScope };
|
|
71
|
-
}, {});
|
|
72
|
-
return React.useMemo(() => ({ [`__scope${baseScope.scopeName}`]: nextScopes }), [nextScopes]);
|
|
73
|
-
};
|
|
74
|
-
};
|
|
75
|
-
createScope.scopeName = baseScope.scopeName;
|
|
76
|
-
return createScope;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
export { createContext2 as createContext, createContextScope };
|