@boxcustodia/library 2.0.0-alpha.19 → 2.0.0-alpha.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/button/button.cjs.js +1 -1
- package/dist/components/button/button.es.js +19 -18
- package/dist/components/button/components/base-button.cjs.js +1 -1
- package/dist/components/button/components/base-button.es.js +20 -20
- package/dist/components/calendar/calendar.cjs.js +1 -1
- package/dist/components/calendar/calendar.es.js +1 -0
- package/dist/components/date-picker/date-input.cjs.js +1 -1
- package/dist/components/date-picker/date-input.es.js +92 -75
- package/dist/components/date-picker/date-picker.cjs.js +1 -1
- package/dist/components/date-picker/date-picker.es.js +104 -95
- package/dist/components/date-picker/date-picker.utils.cjs.js +1 -1
- package/dist/components/date-picker/date-picker.utils.es.js +51 -43
- package/dist/components/date-picker/use-hidden-field-value.cjs.js +1 -0
- package/dist/components/date-picker/use-hidden-field-value.es.js +11 -0
- package/dist/components/menu/menu.es.js +1 -9
- package/dist/components/otp/otp.cjs.js +2 -0
- package/dist/components/otp/otp.es.js +93 -0
- package/dist/components/password/password.cjs.js +1 -1
- package/dist/components/password/password.es.js +2 -2
- package/dist/components/select/select.cjs.js +1 -1
- package/dist/components/select/select.es.js +68 -60
- package/dist/hooks/internal/is-apple-device.cjs.js +1 -0
- package/dist/hooks/internal/is-apple-device.es.js +9 -0
- package/dist/hooks/internal/use-latest-ref.cjs.js +1 -0
- package/dist/hooks/internal/use-latest-ref.es.js +11 -0
- package/dist/hooks/use-array/use-array.cjs.js +1 -1
- package/dist/hooks/use-array/use-array.es.js +54 -42
- package/dist/hooks/use-async/use-async.cjs.js +1 -1
- package/dist/hooks/use-async/use-async.es.js +53 -20
- package/dist/hooks/use-boolean/use-boolean.cjs.js +1 -0
- package/dist/hooks/use-boolean/use-boolean.es.js +25 -0
- package/dist/hooks/use-click-outside/use-click-outside.cjs.js +1 -1
- package/dist/hooks/use-click-outside/use-click-outside.es.js +26 -12
- package/dist/hooks/use-debounce-callback/use-debounced-callback.cjs.js +1 -1
- package/dist/hooks/use-debounce-callback/use-debounced-callback.es.js +27 -10
- package/dist/hooks/use-debounce-value/use-debounced-value.cjs.js +1 -1
- package/dist/hooks/use-debounce-value/use-debounced-value.es.js +7 -9
- package/dist/hooks/use-disclosure/use-disclosure.cjs.js +1 -1
- package/dist/hooks/use-disclosure/use-disclosure.es.js +21 -11
- package/dist/hooks/use-document-title/use-document-title.cjs.js +1 -1
- package/dist/hooks/use-document-title/use-document-title.es.js +14 -12
- package/dist/hooks/use-event-listener/use-event-listener.cjs.js +1 -1
- package/dist/hooks/use-event-listener/use-event-listener.es.js +17 -9
- package/dist/hooks/use-hotkey/use-hotkey.cjs.js +1 -1
- package/dist/hooks/use-hotkey/use-hotkey.es.js +30 -14
- package/dist/hooks/use-hotkey/utils/is-input-field.cjs.js +1 -1
- package/dist/hooks/use-hotkey/utils/is-input-field.es.js +4 -2
- package/dist/hooks/use-hotkey/utils/match-and-run.cjs.js +1 -0
- package/dist/hooks/use-hotkey/utils/match-and-run.es.js +12 -0
- package/dist/hooks/use-hotkey/utils/match-key-modifiers.cjs.js +1 -1
- package/dist/hooks/use-hotkey/utils/match-key-modifiers.es.js +13 -12
- package/dist/hooks/use-hover/use-hover.cjs.js +1 -1
- package/dist/hooks/use-hover/use-hover.es.js +32 -17
- package/dist/hooks/use-is-visible/use-is-visible.cjs.js +1 -1
- package/dist/hooks/use-is-visible/use-is-visible.es.js +31 -27
- package/dist/hooks/use-local-storage/use-local-storage.cjs.js +1 -1
- package/dist/hooks/use-local-storage/use-local-storage.es.js +52 -20
- package/dist/hooks/use-media-query/use-media-query.cjs.js +1 -1
- package/dist/hooks/use-media-query/use-media-query.es.js +21 -11
- package/dist/hooks/use-mutation/use-mutation.cjs.js +1 -1
- package/dist/hooks/use-mutation/use-mutation.es.js +36 -22
- package/dist/hooks/use-object/use-object.cjs.js +1 -1
- package/dist/hooks/use-object/use-object.es.js +26 -22
- package/dist/hooks/use-prevent-page-close/use-prevent-page-close.cjs.js +1 -0
- package/dist/hooks/use-prevent-page-close/use-prevent-page-close.es.js +14 -0
- package/dist/hooks/use-step/use-step.cjs.js +1 -1
- package/dist/hooks/use-step/use-step.es.js +25 -24
- package/dist/index.cjs.js +1 -1
- package/dist/index.es.js +308 -300
- package/dist/src/components/date-picker/date-picker.utils.d.ts +17 -0
- package/dist/src/components/date-picker/use-hidden-field-value.d.ts +12 -0
- package/dist/src/components/index.d.ts +1 -0
- package/dist/src/hooks/index.d.ts +2 -2
- package/dist/src/hooks/internal/index.d.ts +2 -0
- package/dist/src/hooks/internal/is-apple-device.d.ts +12 -0
- package/dist/src/hooks/internal/use-latest-ref.d.ts +12 -0
- package/dist/src/hooks/use-array/use-array.d.ts +24 -11
- package/dist/src/hooks/use-async/use-async.d.ts +16 -13
- package/dist/src/hooks/use-boolean/index.d.ts +1 -0
- package/dist/src/hooks/use-boolean/use-boolean.d.ts +15 -0
- package/dist/src/hooks/use-boolean/use-boolean.test.d.ts +1 -0
- package/dist/src/hooks/use-click-outside/use-click-outside.d.ts +23 -1
- package/dist/src/hooks/use-debounce-callback/use-debounced-callback.d.ts +19 -1
- package/dist/src/hooks/use-debounce-value/use-debounced-value.d.ts +10 -1
- package/dist/src/hooks/use-disclosure/use-disclosure.d.ts +17 -8
- package/dist/src/hooks/use-document-title/use-document-title.d.ts +11 -0
- package/dist/src/hooks/use-event-listener/use-event-listener.d.ts +18 -1
- package/dist/src/hooks/use-hotkey/index.d.ts +2 -1
- package/dist/src/hooks/use-hotkey/use-hotkey.d.ts +62 -5
- package/dist/src/hooks/use-hotkey/utils/index.d.ts +4 -3
- package/dist/src/hooks/use-hotkey/utils/is-input-field.d.ts +12 -2
- package/dist/src/hooks/use-hotkey/utils/is-input-field.test.d.ts +1 -0
- package/dist/src/hooks/use-hotkey/utils/match-and-run.d.ts +36 -0
- package/dist/src/hooks/use-hotkey/utils/match-and-run.test.d.ts +1 -0
- package/dist/src/hooks/use-hotkey/utils/match-key-modifiers.d.ts +20 -6
- package/dist/src/hooks/use-hotkey/utils/match-key-modifiers.test.d.ts +1 -0
- package/dist/src/hooks/use-hover/use-hover.d.ts +8 -4
- package/dist/src/hooks/use-is-visible/use-is-visible.d.ts +28 -4
- package/dist/src/hooks/use-local-storage/use-local-storage.d.ts +13 -2
- package/dist/src/hooks/use-media-query/use-media-query.d.ts +10 -1
- package/dist/src/hooks/use-media-query/use-media-query.test.d.ts +1 -0
- package/dist/src/hooks/use-mutation/use-mutation.d.ts +18 -11
- package/dist/src/hooks/use-object/use-object.d.ts +15 -6
- package/dist/src/hooks/use-prevent-page-close/index.d.ts +1 -0
- package/dist/src/hooks/use-prevent-page-close/use-prevent-page-close.d.ts +10 -0
- package/dist/src/hooks/use-prevent-page-close/use-prevent-page-close.test.d.ts +1 -0
- package/dist/src/hooks/use-step/use-step.d.ts +18 -11
- package/dist/src/utils/form.d.ts +10 -0
- package/package.json +1 -1
- package/src/components/alert-dialog/alert-dialog.test.tsx +13 -9
- package/src/components/auto-complete/auto-complete.test.tsx +4 -14
- package/src/components/avatar/avatar.test.tsx +7 -12
- package/src/components/button/button.test.tsx +10 -15
- package/src/components/button/button.tsx +14 -9
- package/src/components/button/components/base-button.tsx +2 -4
- package/src/components/calendar/calendar.test.tsx +12 -19
- package/src/components/calendar/calendar.tsx +4 -0
- package/src/components/card/card.test.tsx +4 -6
- package/src/components/checkbox/checkbox.test.tsx +12 -8
- package/src/components/checkbox-group/checkbox-group.test.tsx +7 -8
- package/src/components/combobox/combobox.test.tsx +24 -21
- package/src/components/date-picker/date-input-form.test.tsx +77 -0
- package/src/components/date-picker/date-input.stories.tsx +30 -18
- package/src/components/date-picker/date-input.tsx +77 -44
- package/src/components/date-picker/date-picker.stories.tsx +31 -1
- package/src/components/date-picker/date-picker.test.tsx +3 -13
- package/src/components/date-picker/date-picker.tsx +35 -16
- package/src/components/date-picker/date-picker.utils.test.ts +32 -14
- package/src/components/date-picker/date-picker.utils.ts +33 -0
- package/src/components/date-picker/use-date-input-popover.test.ts +3 -1
- package/src/components/date-picker/use-hidden-field-value.ts +23 -0
- package/src/components/dialog/dialog.test.tsx +10 -8
- package/src/components/dropzone/dropzone.test.tsx +11 -13
- package/src/components/empty/empty.test.tsx +4 -3
- package/src/components/field/field.test.tsx +12 -13
- package/src/components/form/form.stories.tsx +16 -1
- package/src/components/index.ts +1 -0
- package/src/components/label/label.test.tsx +3 -3
- package/src/components/menu/menu.tsx +1 -5
- package/src/components/number-input/number-input.test.tsx +6 -2
- package/src/components/password/password.test.tsx +20 -6
- package/src/components/password/password.tsx +2 -2
- package/src/components/popover/popover.test.tsx +4 -4
- package/src/components/progress/progress.test.tsx +7 -8
- package/src/components/radio-group/radio-group.test.tsx +17 -11
- package/src/components/select/select.test.tsx +10 -10
- package/src/components/select/select.tsx +9 -1
- package/src/components/stepper/stepper.stories.tsx +11 -15
- package/src/components/stepper/stepper.test.tsx +6 -4
- package/src/components/switch/switch.test.tsx +3 -3
- package/src/components/table/table.test.tsx +9 -3
- package/src/components/tabs/tabs.test.tsx +6 -2
- package/src/components/tag/tag.test.tsx +1 -3
- package/src/components/textarea/textarea.test.tsx +4 -1
- package/src/components/timeline/timeline.test.tsx +10 -5
- package/src/components/toast/toast.test.tsx +11 -14
- package/src/components/tooltip/tooltip.test.tsx +1 -5
- package/src/components/tree/tree.test.tsx +3 -1
- package/src/hooks/index.ts +2 -2
- package/src/hooks/internal/index.ts +2 -0
- package/src/hooks/internal/is-apple-device.test.ts +41 -0
- package/src/hooks/internal/is-apple-device.ts +33 -0
- package/src/hooks/internal/use-isomorphic-layout-effect.ts +3 -1
- package/src/hooks/internal/use-latest-ref.ts +21 -0
- package/src/hooks/use-array/use-array.stories.tsx +435 -64
- package/src/hooks/use-array/use-array.test.tsx +398 -15
- package/src/hooks/use-array/use-array.ts +105 -66
- package/src/hooks/use-async/use-async.stories.tsx +255 -131
- package/src/hooks/use-async/use-async.test.ts +397 -0
- package/src/hooks/use-async/use-async.ts +117 -39
- package/src/hooks/use-boolean/index.ts +1 -0
- package/src/hooks/use-boolean/use-boolean.stories.tsx +377 -0
- package/src/hooks/use-boolean/use-boolean.test.tsx +177 -0
- package/src/hooks/use-boolean/use-boolean.ts +50 -0
- package/src/hooks/use-click-outside/use-click-outside.stories.tsx +188 -18
- package/src/hooks/use-click-outside/use-click-outside.test.tsx +89 -10
- package/src/hooks/use-click-outside/use-click-outside.ts +62 -16
- package/src/hooks/use-debounce-callback/use-debounced-callback.stories.tsx +141 -41
- package/src/hooks/use-debounce-callback/use-debounced-callback.test.ts +217 -9
- package/src/hooks/use-debounce-callback/use-debounced-callback.ts +71 -11
- package/src/hooks/use-debounce-value/use-debounced-value.stories.tsx +247 -47
- package/src/hooks/use-debounce-value/use-debounced-value.test.ts +105 -10
- package/src/hooks/use-debounce-value/use-debounced-value.ts +19 -10
- package/src/hooks/use-disclosure/use-disclosure.stories.tsx +305 -14
- package/src/hooks/use-disclosure/use-disclosure.test.ts +198 -50
- package/src/hooks/use-disclosure/use-disclosure.ts +49 -29
- package/src/hooks/use-document-title/use-document-title.stories.tsx +54 -0
- package/src/hooks/use-document-title/use-document-title.test.tsx +26 -0
- package/src/hooks/use-document-title/{use-document-title.tsx → use-document-title.ts} +17 -3
- package/src/hooks/use-event-listener/use-event-listener.stories.tsx +105 -9
- package/src/hooks/use-event-listener/use-event-listener.test.tsx +77 -10
- package/src/hooks/use-event-listener/use-event-listener.ts +71 -11
- package/src/hooks/use-focus-trap/use-focus-trap.test.ts +31 -6
- package/src/hooks/use-focus-trap/use-focus-trap.ts +3 -2
- package/src/hooks/use-hotkey/index.ts +9 -1
- package/src/hooks/use-hotkey/use-hotkey.stories.tsx +279 -74
- package/src/hooks/use-hotkey/use-hotkey.test.tsx +286 -34
- package/src/hooks/use-hotkey/use-hotkey.ts +141 -17
- package/src/hooks/use-hotkey/utils/index.ts +8 -3
- package/src/hooks/use-hotkey/utils/is-input-field.test.ts +78 -0
- package/src/hooks/use-hotkey/utils/is-input-field.ts +31 -10
- package/src/hooks/use-hotkey/utils/match-and-run.test.ts +203 -0
- package/src/hooks/use-hotkey/utils/match-and-run.ts +62 -0
- package/src/hooks/use-hotkey/utils/match-key-modifiers.test.ts +65 -0
- package/src/hooks/use-hotkey/utils/match-key-modifiers.ts +39 -12
- package/src/hooks/use-hover/use-hover.stories.tsx +258 -80
- package/src/hooks/use-hover/use-hover.test.tsx +266 -26
- package/src/hooks/use-hover/use-hover.tsx +93 -28
- package/src/hooks/use-is-visible/use-is-visible.stories.tsx +193 -46
- package/src/hooks/use-is-visible/use-is-visible.test.tsx +235 -7
- package/src/hooks/use-is-visible/use-is-visible.ts +114 -0
- package/src/hooks/use-local-storage/use-local-storage.stories.tsx +129 -29
- package/src/hooks/use-local-storage/use-local-storage.test.ts +106 -41
- package/src/hooks/use-local-storage/use-local-storage.ts +100 -31
- package/src/hooks/use-media-query/use-media-query.stories.tsx +86 -26
- package/src/hooks/use-media-query/use-media-query.test.ts +132 -0
- package/src/hooks/use-media-query/use-media-query.ts +39 -14
- package/src/hooks/use-memoized-fn/use-memoized-fn.ts +0 -1
- package/src/hooks/use-mutation/use-mutation.stories.tsx +260 -94
- package/src/hooks/use-mutation/use-mutation.test.ts +359 -0
- package/src/hooks/use-mutation/use-mutation.ts +97 -0
- package/src/hooks/use-object/use-object.stories.tsx +310 -79
- package/src/hooks/use-object/use-object.test.tsx +235 -56
- package/src/hooks/use-object/use-object.ts +59 -0
- package/src/hooks/use-pagination/use-pagination.tsx +0 -1
- package/src/hooks/use-prevent-page-close/index.ts +1 -0
- package/src/hooks/use-prevent-page-close/use-prevent-page-close.stories.tsx +39 -0
- package/src/hooks/use-prevent-page-close/use-prevent-page-close.test.ts +89 -0
- package/src/hooks/use-prevent-page-close/use-prevent-page-close.ts +27 -0
- package/src/hooks/use-range-pagination/use-range-pagination.test.tsx +1 -1
- package/src/hooks/use-range-pagination/use-range-pagination.tsx +1 -1
- package/src/hooks/use-selection/use-selection.ts +0 -1
- package/src/hooks/use-step/use-step.stories.tsx +178 -65
- package/src/hooks/use-step/use-step.test.ts +178 -53
- package/src/hooks/use-step/use-step.ts +57 -49
- package/src/utils/form.test.tsx +13 -8
- package/src/utils/form.tsx +10 -0
- package/src/utils/functions/getFormData.test.ts +1 -1
- package/dist/hooks/use-hotkey/utils/create-hotkey-listener.cjs.js +0 -1
- package/dist/hooks/use-hotkey/utils/create-hotkey-listener.es.js +0 -10
- package/dist/hooks/use-prevent-close-window/use-prevent-close-window.cjs.js +0 -1
- package/dist/hooks/use-prevent-close-window/use-prevent-close-window.es.js +0 -15
- package/dist/hooks/use-toggle/use-toggle.cjs.js +0 -1
- package/dist/hooks/use-toggle/use-toggle.es.js +0 -10
- package/dist/src/hooks/use-hotkey/utils/create-hotkey-listener.d.ts +0 -1
- package/dist/src/hooks/use-prevent-close-window/index.d.ts +0 -1
- package/dist/src/hooks/use-prevent-close-window/use-prevent-close-window.d.ts +0 -13
- package/dist/src/hooks/use-toggle/index.d.ts +0 -1
- package/dist/src/hooks/use-toggle/use-toggle.d.ts +0 -3
- package/src/hooks/use-async/use-async.test.tsx +0 -68
- package/src/hooks/use-hotkey/utils/create-hotkey-listener.ts +0 -25
- package/src/hooks/use-is-visible/use-is-visible.tsx +0 -49
- package/src/hooks/use-mutation/use-mutation.test.tsx +0 -83
- package/src/hooks/use-mutation/use-mutation.tsx +0 -59
- package/src/hooks/use-object/use-object.tsx +0 -46
- package/src/hooks/use-prevent-close-window/index.ts +0 -1
- package/src/hooks/use-prevent-close-window/use-prevent-close-window.stories.tsx +0 -32
- package/src/hooks/use-prevent-close-window/use-prevent-close-window.test.ts +0 -79
- package/src/hooks/use-prevent-close-window/use-prevent-close-window.ts +0 -33
- package/src/hooks/use-toggle/index.ts +0 -1
- package/src/hooks/use-toggle/use-toggle.stories.tsx +0 -25
- package/src/hooks/use-toggle/use-toggle.test.tsx +0 -64
- package/src/hooks/use-toggle/use-toggle.ts +0 -14
- /package/dist/src/{hooks/use-prevent-close-window/use-prevent-close-window.test.d.ts → components/date-picker/date-input-form.test.d.ts} +0 -0
- /package/dist/src/hooks/{use-toggle/use-toggle.test.d.ts → internal/is-apple-device.test.d.ts} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
import { jsxs as w, jsx as r } from "react/jsx-runtime";
|
|
3
3
|
import { Eye as f, EyeOff as b } from "lucide-react";
|
|
4
4
|
import { Input as x } from "@base-ui/react/input";
|
|
5
|
-
import {
|
|
5
|
+
import { useBoolean as v } from "../../hooks/use-boolean/use-boolean.es.js";
|
|
6
6
|
import { cn as e } from "../../lib/cn.es.js";
|
|
7
7
|
function C({
|
|
8
8
|
className: i,
|
|
@@ -15,7 +15,7 @@ function C({
|
|
|
15
15
|
classNames: t,
|
|
16
16
|
...h
|
|
17
17
|
}) {
|
|
18
|
-
const [o, m] = v(!1), g = () => {
|
|
18
|
+
const [o, { toggle: m }] = v(!1), g = () => {
|
|
19
19
|
m(), o ? c?.() : l?.();
|
|
20
20
|
}, p = a ? (s) => a(s.target.value, s) : void 0;
|
|
21
21
|
return /* @__PURE__ */ w(
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),
|
|
2
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),B=require("@base-ui/react/merge-props"),o=require("@base-ui/react/select"),U=require("@base-ui/react/use-render"),x=require("lucide-react"),s=require("../../lib/cn.cjs.js"),A=require("../input/input.cjs.js"),v=s.cn(A.inputBaseClasses,"relative inline-flex items-center justify-between gap-2 select-none text-left text-foreground","focus-visible:border-ring","aria-invalid:border-error focus-visible:aria-invalid:ring-error/20","has-aria-invalid:border-error has-focus-visible:has-aria-invalid:ring-error/20","data-disabled:cursor-not-allowed data-disabled:opacity-50","[&_svg]:pointer-events-none [&_svg]:shrink-0"),S="-me-1 size-4.5 opacity-80 sm:size-4";function I({...e}){return t.jsx(o.Select.Root,{...e})}function z({className:e,children:r,...l}){return t.jsxs(o.Select.Trigger,{className:s.cn(v,e),"data-slot":"select-trigger",...l,children:[r,t.jsx(o.Select.Icon,{"data-slot":"select-icon",className:"text-muted-foreground hover:text-foreground transition-colors",children:t.jsx(x.ChevronsUpDownIcon,{className:S})})]})}function M({className:e,render:r,children:l,...c}){const d=r?void 0:"button",i={children:t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"flex-1 truncate in-data-placeholder:text-muted-foreground/72",children:l}),t.jsx(x.ChevronsUpDownIcon,{className:S})]}),className:s.cn(v,"min-w-0",e),"data-slot":"select-button",type:d};return U.useRender({defaultTagName:"button",props:B.mergeProps(i,c),render:r})}function C({className:e,...r}){return t.jsx(o.Select.Value,{className:s.cn("flex-1 truncate data-placeholder:text-muted-foreground",e),"data-slot":"select-value",...r})}function j({className:e,children:r,side:l="bottom",sideOffset:c=4,align:d="start",alignOffset:i=0,alignItemWithTrigger:h=!1,anchor:u,portalProps:f,...p}){return t.jsx(o.Select.Portal,{...f,children:t.jsx(o.Select.Positioner,{align:d,alignItemWithTrigger:h,alignOffset:i,anchor:u,className:"z-50 select-none","data-slot":"select-positioner",side:l,sideOffset:c,children:t.jsxs(o.Select.Popup,{className:"origin-(--transform-origin) text-foreground outline-none duration-100 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=top]:slide-in-from-bottom-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2","data-slot":"select-popup",...p,children:[t.jsx(o.Select.ScrollUpArrow,{className:"top-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover","data-slot":"select-scroll-up-arrow",children:t.jsx(x.ChevronUpIcon,{className:"relative size-4.5 sm:size-4"})}),t.jsx("div",{className:"relative h-full min-w-(--anchor-width) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",children:t.jsx(o.Select.List,{className:s.cn("max-h-[min(24rem,var(--available-height))] overflow-y-auto p-1",e),"data-slot":"select-list",children:r})}),t.jsx(o.Select.ScrollDownArrow,{className:"bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover","data-slot":"select-scroll-down-arrow",children:t.jsx(x.ChevronDownIcon,{className:"relative size-4.5 sm:size-4"})})]})})})}function L({className:e,children:r,...l}){return t.jsxs(o.Select.Item,{className:s.cn("grid min-h-8 in-data-[side=none]:min-w-[calc(var(--anchor-width)+1.25rem)] cursor-default grid-cols-[1fr_1rem] items-center gap-2 rounded-sm py-1 px-2 text-base outline-none data-disabled:pointer-events-none data-highlighted:bg-accent data-highlighted:text-accent-foreground data-disabled:opacity-64 sm:min-h-7 sm:text-sm [&_svg:not([class*='size-'])]:size-4.5 sm:[&_svg:not([class*='size-'])]:size-4 [&_svg]:pointer-events-none [&_svg]:shrink-0",e),"data-slot":"select-item",...l,children:[t.jsx(o.Select.ItemText,{className:"col-start-1 min-w-0",children:r}),t.jsx(o.Select.ItemIndicator,{className:"col-start-2",children:t.jsx("svg",{"aria-hidden":"true",fill:"none",height:"24",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:"2",viewBox:"0 0 24 24",width:"24",xmlns:"http://www.w3.org/2000/svg",children:t.jsx("path",{d:"M5.252 12.7 10.2 18.63 18.748 5.37"})})})]})}function O({className:e,...r}){return t.jsx(o.Select.Separator,{className:s.cn("mx-2 my-1 h-px bg-border",e),"data-slot":"select-separator",...r})}function F(e){return t.jsx(o.Select.Group,{"data-slot":"select-group",...e})}function W(e){return t.jsx(o.Select.GroupLabel,{className:"px-2 py-1.5 font-medium text-muted-foreground text-xs","data-slot":"select-group-label",...e})}function E({className:e,...r}){return t.jsx(o.Select.Label,{className:s.cn("not-in-data-[slot=field]:mb-2 inline-flex cursor-default items-center gap-2 font-medium text-base/4.5 text-foreground sm:text-sm/4",e),"data-slot":"select-label",...r})}function H(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number")return String(e);if(typeof e=="object"){const r=e;if("label"in r)return String(r.label);if("name"in r)return String(r.name);if("title"in r)return String(r.title)}return String(e)}function J(e){if(e==null)return"";if(typeof e=="string"||typeof e=="number")return String(e);if(typeof e=="object"){const r=e;if("id"in r)return String(r.id);if("value"in r)return String(r.value)}return String(e)}function K(e){return e!=null&&typeof e=="object"&&"disabled"in e?!!e.disabled:!1}function Q(e){const{items:r,getLabel:l,getId:c,getDisabled:d,renderItem:i,placeholder:h,onValueChange:u,value:f,defaultValue:p,multiple:b,className:P,classNames:w,"aria-invalid":N,...T}=e,y=l??H,a=c??J,_=d??K,k=b?f?.map(a):f!=null?a(f):void 0,D=b?p?.map(a):p!=null?a(p):void 0,G=n=>{if(b){const m=(n??[]).map(R=>r.find(V=>a(V)===R)??null).filter(Boolean);u?.(m)}else{if(n==null){u?.(null);return}const g=r.find(m=>a(m)===n)??null;u?.(g)}},q=n=>{const g=r.find(m=>a(m)===n);return g?y(g):n};return t.jsxs(I,{itemToStringLabel:q,multiple:b,value:k,defaultValue:D,onValueChange:G,...T,children:[t.jsx(z,{className:P,...N===void 0?{}:{"aria-invalid":N},children:t.jsx(C,{placeholder:h})}),t.jsx(j,{className:w?.popup,children:r.map(n=>t.jsx(L,{value:a(n),disabled:_(n),className:w?.item,children:i?i(n):y(n)},a(n)))})]})}Object.defineProperty(exports,"SelectPrimitive",{enumerable:!0,get:()=>o.Select});exports.Select=Q;exports.SelectButton=M;exports.SelectContent=j;exports.SelectGroup=F;exports.SelectGroupLabel=W;exports.SelectItem=L;exports.SelectLabel=E;exports.SelectPopup=j;exports.SelectRoot=I;exports.SelectSeparator=O;exports.SelectTrigger=z;exports.SelectValue=C;exports.selectTriggerClasses=v;exports.selectTriggerIconClassName=S;
|
|
@@ -1,27 +1,27 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsx as r, jsxs as b, Fragment as
|
|
3
|
-
import { mergeProps as
|
|
2
|
+
import { jsx as r, jsxs as b, Fragment as D } from "react/jsx-runtime";
|
|
3
|
+
import { mergeProps as T } from "@base-ui/react/merge-props";
|
|
4
4
|
import { Select as o } from "@base-ui/react/select";
|
|
5
|
-
import { Select as
|
|
6
|
-
import { useRender as
|
|
7
|
-
import { ChevronsUpDownIcon as
|
|
5
|
+
import { Select as de } from "@base-ui/react/select";
|
|
6
|
+
import { useRender as G } from "@base-ui/react/use-render";
|
|
7
|
+
import { ChevronsUpDownIcon as N, ChevronUpIcon as V, ChevronDownIcon as B } from "lucide-react";
|
|
8
8
|
import { cn as s } from "../../lib/cn.es.js";
|
|
9
|
-
import { inputBaseClasses as
|
|
10
|
-
const
|
|
11
|
-
|
|
9
|
+
import { inputBaseClasses as R } from "../input/input.es.js";
|
|
10
|
+
const y = s(
|
|
11
|
+
R,
|
|
12
12
|
"relative inline-flex items-center justify-between gap-2 select-none text-left text-foreground",
|
|
13
13
|
"focus-visible:border-ring",
|
|
14
14
|
"aria-invalid:border-error focus-visible:aria-invalid:ring-error/20",
|
|
15
15
|
"has-aria-invalid:border-error has-focus-visible:has-aria-invalid:ring-error/20",
|
|
16
16
|
"data-disabled:cursor-not-allowed data-disabled:opacity-50",
|
|
17
17
|
"[&_svg]:pointer-events-none [&_svg]:shrink-0"
|
|
18
|
-
),
|
|
19
|
-
function
|
|
18
|
+
), I = "-me-1 size-4.5 opacity-80 sm:size-4";
|
|
19
|
+
function U({
|
|
20
20
|
...e
|
|
21
21
|
}) {
|
|
22
22
|
return /* @__PURE__ */ r(o.Root, { ...e });
|
|
23
23
|
}
|
|
24
|
-
function
|
|
24
|
+
function A({
|
|
25
25
|
className: e,
|
|
26
26
|
children: t,
|
|
27
27
|
...n
|
|
@@ -29,7 +29,7 @@ function U({
|
|
|
29
29
|
return /* @__PURE__ */ b(
|
|
30
30
|
o.Trigger,
|
|
31
31
|
{
|
|
32
|
-
className: s(
|
|
32
|
+
className: s(y, e),
|
|
33
33
|
"data-slot": "select-trigger",
|
|
34
34
|
...n,
|
|
35
35
|
children: [
|
|
@@ -39,35 +39,35 @@ function U({
|
|
|
39
39
|
{
|
|
40
40
|
"data-slot": "select-icon",
|
|
41
41
|
className: "text-muted-foreground hover:text-foreground transition-colors",
|
|
42
|
-
children: /* @__PURE__ */ r(
|
|
42
|
+
children: /* @__PURE__ */ r(N, { className: I })
|
|
43
43
|
}
|
|
44
44
|
)
|
|
45
45
|
]
|
|
46
46
|
}
|
|
47
47
|
);
|
|
48
48
|
}
|
|
49
|
-
function
|
|
49
|
+
function te({
|
|
50
50
|
className: e,
|
|
51
51
|
render: t,
|
|
52
52
|
children: n,
|
|
53
53
|
...d
|
|
54
54
|
}) {
|
|
55
55
|
const c = t ? void 0 : "button", i = {
|
|
56
|
-
children: /* @__PURE__ */ b(
|
|
56
|
+
children: /* @__PURE__ */ b(D, { children: [
|
|
57
57
|
/* @__PURE__ */ r("span", { className: "flex-1 truncate in-data-placeholder:text-muted-foreground/72", children: n }),
|
|
58
|
-
/* @__PURE__ */ r(
|
|
58
|
+
/* @__PURE__ */ r(N, { className: I })
|
|
59
59
|
] }),
|
|
60
|
-
className: s(
|
|
60
|
+
className: s(y, "min-w-0", e),
|
|
61
61
|
"data-slot": "select-button",
|
|
62
62
|
type: c
|
|
63
63
|
};
|
|
64
|
-
return
|
|
64
|
+
return G({
|
|
65
65
|
defaultTagName: "button",
|
|
66
|
-
props:
|
|
66
|
+
props: T(i, d),
|
|
67
67
|
render: t
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
function
|
|
70
|
+
function F({
|
|
71
71
|
className: e,
|
|
72
72
|
...t
|
|
73
73
|
}) {
|
|
@@ -83,7 +83,7 @@ function A({
|
|
|
83
83
|
}
|
|
84
84
|
);
|
|
85
85
|
}
|
|
86
|
-
function
|
|
86
|
+
function M({
|
|
87
87
|
className: e,
|
|
88
88
|
children: t,
|
|
89
89
|
side: n = "bottom",
|
|
@@ -118,7 +118,7 @@ function F({
|
|
|
118
118
|
{
|
|
119
119
|
className: "top-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:top-px before:h-[200%] before:rounded-t-[calc(var(--radius-lg)-1px)] before:bg-linear-to-b before:from-50% before:from-popover",
|
|
120
120
|
"data-slot": "select-scroll-up-arrow",
|
|
121
|
-
children: /* @__PURE__ */ r(
|
|
121
|
+
children: /* @__PURE__ */ r(V, { className: "relative size-4.5 sm:size-4" })
|
|
122
122
|
}
|
|
123
123
|
),
|
|
124
124
|
/* @__PURE__ */ r("div", { className: "relative h-full min-w-(--anchor-width) rounded-lg border bg-popover not-dark:bg-clip-padding shadow-lg/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-lg)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]", children: /* @__PURE__ */ r(
|
|
@@ -137,7 +137,7 @@ function F({
|
|
|
137
137
|
{
|
|
138
138
|
className: "bottom-0 z-50 flex h-6 w-full cursor-default items-center justify-center before:pointer-events-none before:absolute before:inset-x-px before:bottom-px before:h-[200%] before:rounded-b-[calc(var(--radius-lg)-1px)] before:bg-linear-to-t before:from-50% before:from-popover",
|
|
139
139
|
"data-slot": "select-scroll-down-arrow",
|
|
140
|
-
children: /* @__PURE__ */ r(
|
|
140
|
+
children: /* @__PURE__ */ r(B, { className: "relative size-4.5 sm:size-4" })
|
|
141
141
|
}
|
|
142
142
|
)
|
|
143
143
|
]
|
|
@@ -146,7 +146,7 @@ function F({
|
|
|
146
146
|
}
|
|
147
147
|
) });
|
|
148
148
|
}
|
|
149
|
-
function
|
|
149
|
+
function W({
|
|
150
150
|
className: e,
|
|
151
151
|
children: t,
|
|
152
152
|
...n
|
|
@@ -182,7 +182,7 @@ function M({
|
|
|
182
182
|
}
|
|
183
183
|
);
|
|
184
184
|
}
|
|
185
|
-
function
|
|
185
|
+
function re({
|
|
186
186
|
className: e,
|
|
187
187
|
...t
|
|
188
188
|
}) {
|
|
@@ -195,10 +195,10 @@ function te({
|
|
|
195
195
|
}
|
|
196
196
|
);
|
|
197
197
|
}
|
|
198
|
-
function
|
|
198
|
+
function oe(e) {
|
|
199
199
|
return /* @__PURE__ */ r(o.Group, { "data-slot": "select-group", ...e });
|
|
200
200
|
}
|
|
201
|
-
function
|
|
201
|
+
function ae(e) {
|
|
202
202
|
return /* @__PURE__ */ r(
|
|
203
203
|
o.GroupLabel,
|
|
204
204
|
{
|
|
@@ -208,7 +208,7 @@ function oe(e) {
|
|
|
208
208
|
}
|
|
209
209
|
);
|
|
210
210
|
}
|
|
211
|
-
function
|
|
211
|
+
function ne({
|
|
212
212
|
className: e,
|
|
213
213
|
...t
|
|
214
214
|
}) {
|
|
@@ -224,7 +224,7 @@ function ae({
|
|
|
224
224
|
}
|
|
225
225
|
);
|
|
226
226
|
}
|
|
227
|
-
function
|
|
227
|
+
function $(e) {
|
|
228
228
|
if (e == null) return "";
|
|
229
229
|
if (typeof e == "string" || typeof e == "number") return String(e);
|
|
230
230
|
if (typeof e == "object") {
|
|
@@ -235,7 +235,7 @@ function W(e) {
|
|
|
235
235
|
}
|
|
236
236
|
return String(e);
|
|
237
237
|
}
|
|
238
|
-
function
|
|
238
|
+
function q(e) {
|
|
239
239
|
if (e == null) return "";
|
|
240
240
|
if (typeof e == "string" || typeof e == "number") return String(e);
|
|
241
241
|
if (typeof e == "object") {
|
|
@@ -245,10 +245,10 @@ function $(e) {
|
|
|
245
245
|
}
|
|
246
246
|
return String(e);
|
|
247
247
|
}
|
|
248
|
-
function
|
|
248
|
+
function E(e) {
|
|
249
249
|
return e != null && typeof e == "object" && "disabled" in e ? !!e.disabled : !1;
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function le(e) {
|
|
252
252
|
const {
|
|
253
253
|
items: t,
|
|
254
254
|
getLabel: n,
|
|
@@ -262,21 +262,22 @@ function ne(e) {
|
|
|
262
262
|
multiple: h,
|
|
263
263
|
className: z,
|
|
264
264
|
classNames: x,
|
|
265
|
-
|
|
266
|
-
|
|
265
|
+
"aria-invalid": S,
|
|
266
|
+
...L
|
|
267
|
+
} = e, w = n ?? $, l = d ?? q, C = c ?? E, _ = h ? f?.map(l) : f != null ? l(f) : void 0, P = h ? m?.map(l) : m != null ? l(m) : void 0;
|
|
267
268
|
return /* @__PURE__ */ b(
|
|
268
|
-
|
|
269
|
+
U,
|
|
269
270
|
{
|
|
270
271
|
itemToStringLabel: (a) => {
|
|
271
272
|
const p = t.find((g) => l(g) === a);
|
|
272
|
-
return p ?
|
|
273
|
+
return p ? w(p) : a;
|
|
273
274
|
},
|
|
274
275
|
multiple: h,
|
|
275
|
-
value:
|
|
276
|
-
defaultValue:
|
|
276
|
+
value: _,
|
|
277
|
+
defaultValue: P,
|
|
277
278
|
onValueChange: (a) => {
|
|
278
279
|
if (h) {
|
|
279
|
-
const g = (a ?? []).map((
|
|
280
|
+
const g = (a ?? []).map((j) => t.find((k) => l(k) === j) ?? null).filter(Boolean);
|
|
280
281
|
u?.(g);
|
|
281
282
|
} else {
|
|
282
283
|
if (a == null) {
|
|
@@ -287,16 +288,23 @@ function ne(e) {
|
|
|
287
288
|
u?.(p);
|
|
288
289
|
}
|
|
289
290
|
},
|
|
290
|
-
...
|
|
291
|
+
...L,
|
|
291
292
|
children: [
|
|
292
|
-
/* @__PURE__ */ r(
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
/* @__PURE__ */ r(
|
|
294
|
+
A,
|
|
295
|
+
{
|
|
296
|
+
className: z,
|
|
297
|
+
...S === void 0 ? {} : { "aria-invalid": S },
|
|
298
|
+
children: /* @__PURE__ */ r(F, { placeholder: v })
|
|
299
|
+
}
|
|
300
|
+
),
|
|
301
|
+
/* @__PURE__ */ r(M, { className: x?.popup, children: t.map((a) => /* @__PURE__ */ r(
|
|
302
|
+
W,
|
|
295
303
|
{
|
|
296
304
|
value: l(a),
|
|
297
|
-
disabled:
|
|
305
|
+
disabled: C(a),
|
|
298
306
|
className: x?.item,
|
|
299
|
-
children: i ? i(a) :
|
|
307
|
+
children: i ? i(a) : w(a)
|
|
300
308
|
},
|
|
301
309
|
l(a)
|
|
302
310
|
)) })
|
|
@@ -305,19 +313,19 @@ function ne(e) {
|
|
|
305
313
|
);
|
|
306
314
|
}
|
|
307
315
|
export {
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
316
|
+
le as Select,
|
|
317
|
+
te as SelectButton,
|
|
318
|
+
M as SelectContent,
|
|
319
|
+
oe as SelectGroup,
|
|
320
|
+
ae as SelectGroupLabel,
|
|
321
|
+
W as SelectItem,
|
|
322
|
+
ne as SelectLabel,
|
|
323
|
+
M as SelectPopup,
|
|
324
|
+
de as SelectPrimitive,
|
|
325
|
+
U as SelectRoot,
|
|
326
|
+
re as SelectSeparator,
|
|
327
|
+
A as SelectTrigger,
|
|
328
|
+
F as SelectValue,
|
|
329
|
+
y as selectTriggerClasses,
|
|
330
|
+
I as selectTriggerIconClassName
|
|
323
331
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("./is-browser.cjs.js"),i=/mac|iphone|ipad|ipod/i,o=()=>{if(!r.isBrowser||typeof navigator>"u")return!1;const e=navigator,t=e.userAgentData?.platform??e.platform;return t?i.test(t):!1};exports.isAppleDevice=o;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { isBrowser as r } from "./is-browser.es.js";
|
|
2
|
+
const o = /mac|iphone|ipad|ipod/i, n = () => {
|
|
3
|
+
if (!r || typeof navigator > "u") return !1;
|
|
4
|
+
const t = navigator, e = t.userAgentData?.platform ?? t.platform;
|
|
5
|
+
return e ? o.test(e) : !1;
|
|
6
|
+
};
|
|
7
|
+
export {
|
|
8
|
+
n as isAppleDevice
|
|
9
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react"),s=require("./use-isomorphic-layout-effect.cjs.js"),o=e=>{const t=r.useRef(e);return s.useIsomorphicLayoutEffect(()=>{t.current=e}),t};exports.useLatestRef=o;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const c=require("react"),a=require("../internal/use-latest-ref.cjs.js");function g(i,l){const[o,r]=c.useState(i),R=c.useRef(i),d=a.useLatestRef(o),p=a.useLatestRef(l?.onChange),f=c.useRef(!1);c.useEffect(()=>{if(!f.current){f.current=!0;return}p.current?.(o)},[o]);const h=c.useMemo(()=>({push:e=>r(t=>[...t,e]),pop:()=>r(e=>e.slice(0,-1)),insertAt:(e,t)=>r(s=>[...s.slice(0,e),t,...s.slice(e)]),removeAt:e=>r(t=>t.filter((s,n)=>n!==e)),updateAt:(e,t)=>r(s=>s.map((n,u)=>u===e?t:n)),clear:()=>r([]),reset:()=>r(R.current),set:e=>r(e),move:(e,t)=>r(s=>{if(e===t)return s;const n=[...s],[u]=n.splice(e,1);return n.splice(t,0,u),n}),swap:(e,t)=>r(s=>{if(e===t)return s;const n=[...s];return[n[e],n[t]]=[n[t],n[e]],n}),filter:e=>r(t=>t.filter(e)),sort:e=>r(t=>[...t].sort(e)),reverse:()=>r(e=>[...e].reverse()),replace:(e,t)=>r(s=>{const n=s.findIndex(e);return n===-1?s:s.map((u,y)=>y===n?typeof t=="function"?t(u):t:u)}),removeWhere:e=>r(t=>t.filter(s=>!e(s))),pushMany:e=>{e.length!==0&&r(t=>[...t,...e])},find:e=>d.current.find(e)}),[r]);return[o,h]}exports.useArray=g;
|
|
@@ -1,46 +1,58 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
{
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
const e = [...o];
|
|
10
|
-
return e.splice(s, 0, t), e;
|
|
11
|
-
});
|
|
12
|
-
},
|
|
13
|
-
removeAt: (s) => {
|
|
14
|
-
n((t = []) => {
|
|
15
|
-
const o = [...t];
|
|
16
|
-
return o.splice(s, 1), o;
|
|
17
|
-
});
|
|
18
|
-
},
|
|
19
|
-
updateAt: (s, t) => {
|
|
20
|
-
n((o = []) => {
|
|
21
|
-
const e = [...o];
|
|
22
|
-
return e[s] = t, e;
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
clear: () => n([]),
|
|
26
|
-
reset: () => n(c),
|
|
27
|
-
push: (s) => n((t = []) => [...t, s]),
|
|
28
|
-
set: (s) => n(s),
|
|
29
|
-
pop: () => {
|
|
30
|
-
n((s = []) => {
|
|
31
|
-
const t = [...s];
|
|
32
|
-
return t.pop(), t;
|
|
33
|
-
});
|
|
34
|
-
},
|
|
35
|
-
update: (s, t) => {
|
|
36
|
-
n((o = []) => {
|
|
37
|
-
const e = [...o], r = e.findIndex(s);
|
|
38
|
-
return r === -1 || (e[r] = typeof t == "function" ? t(e[r]) : t), e;
|
|
39
|
-
});
|
|
40
|
-
}
|
|
1
|
+
import { useState as A, useRef as i, useEffect as g, useMemo as x } from "react";
|
|
2
|
+
import { useLatestRef as l } from "../internal/use-latest-ref.es.js";
|
|
3
|
+
function L(u, a) {
|
|
4
|
+
const [c, r] = A(u), p = i(u), m = l(c), d = l(a?.onChange), f = i(!1);
|
|
5
|
+
g(() => {
|
|
6
|
+
if (!f.current) {
|
|
7
|
+
f.current = !0;
|
|
8
|
+
return;
|
|
41
9
|
}
|
|
42
|
-
|
|
10
|
+
d.current?.(c);
|
|
11
|
+
}, [c]);
|
|
12
|
+
const h = x(
|
|
13
|
+
() => ({
|
|
14
|
+
push: (e) => r((t) => [...t, e]),
|
|
15
|
+
pop: () => r((e) => e.slice(0, -1)),
|
|
16
|
+
insertAt: (e, t) => r((n) => [
|
|
17
|
+
...n.slice(0, e),
|
|
18
|
+
t,
|
|
19
|
+
...n.slice(e)
|
|
20
|
+
]),
|
|
21
|
+
removeAt: (e) => r((t) => t.filter((n, s) => s !== e)),
|
|
22
|
+
updateAt: (e, t) => r((n) => n.map((s, o) => o === e ? t : s)),
|
|
23
|
+
clear: () => r([]),
|
|
24
|
+
reset: () => r(p.current),
|
|
25
|
+
set: (e) => r(e),
|
|
26
|
+
move: (e, t) => r((n) => {
|
|
27
|
+
if (e === t) return n;
|
|
28
|
+
const s = [...n], [o] = s.splice(e, 1);
|
|
29
|
+
return s.splice(t, 0, o), s;
|
|
30
|
+
}),
|
|
31
|
+
swap: (e, t) => r((n) => {
|
|
32
|
+
if (e === t) return n;
|
|
33
|
+
const s = [...n];
|
|
34
|
+
return [s[e], s[t]] = [s[t], s[e]], s;
|
|
35
|
+
}),
|
|
36
|
+
filter: (e) => r((t) => t.filter(e)),
|
|
37
|
+
sort: (e) => r((t) => [...t].sort(e)),
|
|
38
|
+
reverse: () => r((e) => [...e].reverse()),
|
|
39
|
+
replace: (e, t) => r((n) => {
|
|
40
|
+
const s = n.findIndex(e);
|
|
41
|
+
return s === -1 ? n : n.map(
|
|
42
|
+
(o, R) => R === s ? typeof t == "function" ? t(o) : t : o
|
|
43
|
+
);
|
|
44
|
+
}),
|
|
45
|
+
removeWhere: (e) => r((t) => t.filter((n) => !e(n))),
|
|
46
|
+
pushMany: (e) => {
|
|
47
|
+
e.length !== 0 && r((t) => [...t, ...e]);
|
|
48
|
+
},
|
|
49
|
+
find: (e) => m.current.find(e)
|
|
50
|
+
}),
|
|
51
|
+
[r]
|
|
52
|
+
// setList is stable for component lifetime → memo computes once
|
|
53
|
+
);
|
|
54
|
+
return [c, h];
|
|
43
55
|
}
|
|
44
56
|
export {
|
|
45
|
-
|
|
57
|
+
L as useArray
|
|
46
58
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react");function
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),o=require("../internal/use-latest-ref.cjs.js");function m({fn:L,deps:h=[],enabled:l=!0,keepPreviousData:k=!1,onSuccess:p,onError:q,onSettled:w}){const[n,u]=t.useState(l?"pending":"idle"),[A,f]=t.useState(null),[C,i]=t.useState(null),d=o.useLatestRef(L),R=o.useLatestRef(p),S=o.useLatestRef(q),b=o.useLatestRef(w),c=t.useRef(0),[T,I]=t.useState(0),y=t.useCallback(async(e,s)=>{let E=null,g=null;try{const r=await d.current(e);if(s!==c.current||e.aborted)return;E=r,f(r),u("success"),R.current?.(r)}catch(r){if(e.aborted||s!==c.current)return;const a=r instanceof Error?r:new Error(String(r));g=a,i(a),u("error"),S.current?.(a)}finally{s===c.current&&!e.aborted&&b.current?.(E,g)}},[d,R,S,b]),j=t.useCallback(()=>{I(e=>e+1)},[]);return t.useEffect(()=>{if(!l){u("idle");return}c.current+=1;const e=c.current,s=new AbortController;return u("pending"),i(null),k||f(null),y(s.signal,e),()=>{s.abort()}},[...h,l,y,T]),{data:A,error:C,status:n,loading:n==="pending",isIdle:n==="idle",isSuccess:n==="success",isError:n==="error",refetch:j}}exports.useAsync=m;
|
|
@@ -1,24 +1,57 @@
|
|
|
1
|
-
import { useState as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { useState as o, useRef as L, useCallback as m, useEffect as j } from "react";
|
|
2
|
+
import { useLatestRef as u } from "../internal/use-latest-ref.es.js";
|
|
3
|
+
function B({
|
|
4
|
+
fn: y,
|
|
5
|
+
deps: g = [],
|
|
6
|
+
enabled: l = !0,
|
|
7
|
+
keepPreviousData: k = !1,
|
|
8
|
+
onSuccess: w,
|
|
9
|
+
onError: x,
|
|
10
|
+
onSettled: A
|
|
8
11
|
}) {
|
|
9
|
-
const [
|
|
10
|
-
l
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
12
|
+
const [n, s] = o(
|
|
13
|
+
l ? "pending" : "idle"
|
|
14
|
+
), [C, i] = o(null), [I, a] = o(null), d = u(y), R = u(w), E = u(x), p = u(A), c = L(0), [T, q] = o(0), S = m(
|
|
15
|
+
async (r, t) => {
|
|
16
|
+
let b = null, h = null;
|
|
17
|
+
try {
|
|
18
|
+
const e = await d.current(r);
|
|
19
|
+
if (t !== c.current || r.aborted) return;
|
|
20
|
+
b = e, i(e), s("success"), R.current?.(e);
|
|
21
|
+
} catch (e) {
|
|
22
|
+
if (r.aborted || t !== c.current) return;
|
|
23
|
+
const f = e instanceof Error ? e : new Error(String(e));
|
|
24
|
+
h = f, a(f), s("error"), E.current?.(f);
|
|
25
|
+
} finally {
|
|
26
|
+
t === c.current && !r.aborted && p.current?.(b, h);
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
// All deps are refs — this callback is effectively stable
|
|
30
|
+
[d, R, E, p]
|
|
31
|
+
), D = m(() => {
|
|
32
|
+
q((r) => r + 1);
|
|
33
|
+
}, []);
|
|
34
|
+
return j(() => {
|
|
35
|
+
if (!l) {
|
|
36
|
+
s("idle");
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
c.current += 1;
|
|
40
|
+
const r = c.current, t = new AbortController();
|
|
41
|
+
return s("pending"), a(null), k || i(null), S(t.signal, r), () => {
|
|
42
|
+
t.abort();
|
|
43
|
+
};
|
|
44
|
+
}, [...g, l, S, T]), {
|
|
45
|
+
data: C,
|
|
46
|
+
error: I,
|
|
47
|
+
status: n,
|
|
48
|
+
loading: n === "pending",
|
|
49
|
+
isIdle: n === "idle",
|
|
50
|
+
isSuccess: n === "success",
|
|
51
|
+
isError: n === "error",
|
|
52
|
+
refetch: D
|
|
53
|
+
};
|
|
21
54
|
}
|
|
22
55
|
export {
|
|
23
|
-
|
|
56
|
+
B as useAsync
|
|
24
57
|
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react"),f=require("../internal/use-latest-ref.cjs.js");function l(o,r){const[s,e]=t.useState(o??!1),a=f.useLatestRef(r?.onChange),u=t.useRef(!1);t.useEffect(()=>{if(!u.current){u.current=!0;return}a.current?.(s)},[s]);const c=t.useMemo(()=>({toggle:()=>e(n=>!n),setTrue:()=>e(!0),setFalse:()=>e(!1),set:n=>e(n)}),[e]);return[s,c]}exports.useBoolean=l;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { useState as a, useRef as c, useEffect as l, useMemo as m } from "react";
|
|
2
|
+
import { useLatestRef as i } from "../internal/use-latest-ref.es.js";
|
|
3
|
+
function p(o, r) {
|
|
4
|
+
const [t, e] = a(o ?? !1), u = i(r?.onChange), n = c(!1);
|
|
5
|
+
l(() => {
|
|
6
|
+
if (!n.current) {
|
|
7
|
+
n.current = !0;
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
u.current?.(t);
|
|
11
|
+
}, [t]);
|
|
12
|
+
const f = m(
|
|
13
|
+
() => ({
|
|
14
|
+
toggle: () => e((s) => !s),
|
|
15
|
+
setTrue: () => e(!0),
|
|
16
|
+
setFalse: () => e(!1),
|
|
17
|
+
set: (s) => e(s)
|
|
18
|
+
}),
|
|
19
|
+
[e]
|
|
20
|
+
);
|
|
21
|
+
return [t, f];
|
|
22
|
+
}
|
|
23
|
+
export {
|
|
24
|
+
p as useBoolean
|
|
25
|
+
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react"),n=require("../internal/use-latest-ref.cjs.js"),b=require("../internal/is-browser.cjs.js"),m=["pointerdown"],k=(f,a={})=>{const{enabled:s=!0,events:d,ignore:l,additionalRefs:R}=a,t=d??m,o=i.useRef(null),v=n.useLatestRef(f),E=n.useLatestRef(l),L=n.useLatestRef(R);return i.useEffect(()=>{if(!s||!b.isBrowser)return;const c=e=>{if(E.current?.(e))return;const r=e.target;if(!r||o.current?.contains(r))return;const u=L.current;if(u){for(const g of u)if(g.current?.contains(r))return}v.current(e)};for(const e of t)document.addEventListener(e,c);return()=>{for(const e of t)document.removeEventListener(e,c)}},[s,t.join("|")]),o};exports.useClickOutside=k;
|
|
@@ -1,15 +1,29 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
};
|
|
6
|
-
return
|
|
7
|
-
if (
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
1
|
+
import { useRef as p, useEffect as g } from "react";
|
|
2
|
+
import { useLatestRef as n } from "../internal/use-latest-ref.es.js";
|
|
3
|
+
import { isBrowser as L } from "../internal/is-browser.es.js";
|
|
4
|
+
const x = ["pointerdown"], T = (i, u = {}) => {
|
|
5
|
+
const { enabled: o = !0, events: a, ignore: d, additionalRefs: l } = u, t = a ?? x, s = p(null), m = n(i), E = n(d), R = n(l);
|
|
6
|
+
return g(() => {
|
|
7
|
+
if (!o || !L) return;
|
|
8
|
+
const c = (e) => {
|
|
9
|
+
if (E.current?.(e)) return;
|
|
10
|
+
const r = e.target;
|
|
11
|
+
if (!r || s.current?.contains(r)) return;
|
|
12
|
+
const f = R.current;
|
|
13
|
+
if (f) {
|
|
14
|
+
for (const v of f)
|
|
15
|
+
if (v.current?.contains(r)) return;
|
|
16
|
+
}
|
|
17
|
+
m.current(e);
|
|
18
|
+
};
|
|
19
|
+
for (const e of t)
|
|
20
|
+
document.addEventListener(e, c);
|
|
21
|
+
return () => {
|
|
22
|
+
for (const e of t)
|
|
23
|
+
document.removeEventListener(e, c);
|
|
24
|
+
};
|
|
25
|
+
}, [o, t.join("|")]), s;
|
|
12
26
|
};
|
|
13
27
|
export {
|
|
14
|
-
|
|
28
|
+
T as useClickOutside
|
|
15
29
|
};
|