@knkcs/anker 2.7.0 → 2.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-77EOXDGW.js +49 -0
- package/dist/chunk-77EOXDGW.js.map +1 -0
- package/dist/chunk-7KPPPE4U.js +59 -0
- package/dist/chunk-7KPPPE4U.js.map +1 -0
- package/dist/chunk-CWBQKGL4.js +75 -0
- package/dist/chunk-CWBQKGL4.js.map +1 -0
- package/dist/components/index.js +1 -1
- package/dist/components/index.js.map +1 -1
- package/dist/forms/index.d.ts +12 -9
- package/dist/forms/index.js +5 -21
- package/dist/forms/index.js.map +1 -1
- package/dist/navigation/index.d.ts +26 -0
- package/dist/navigation/index.js +28 -0
- package/dist/navigation/index.js.map +1 -0
- package/dist/primitives/index.js +2 -1
- package/dist/primitives/index.js.map +1 -1
- package/dist/templates/index.js +47 -37
- package/dist/templates/index.js.map +1 -1
- package/dist/unsaved-changes-guard-kwzxMb6r.d.ts +67 -0
- package/package.json +6 -1
- package/dist/chunk-M5WNB4K6.js +0 -126
- package/dist/chunk-M5WNB4K6.js.map +0 -1
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { LeavePageConfirmation } from './chunk-7KPPPE4U.js';
|
|
2
|
+
import { useBlocker } from 'react-router-dom';
|
|
3
|
+
import { jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
function useUnsavedChangesBlocker(isDirty, opts) {
|
|
6
|
+
const blocker = useBlocker(({ currentLocation, nextLocation }) => {
|
|
7
|
+
if (!isDirty) return false;
|
|
8
|
+
if (opts?.shouldBlock) {
|
|
9
|
+
return opts.shouldBlock({ currentLocation, nextLocation });
|
|
10
|
+
}
|
|
11
|
+
if (opts?.safePathPrefix && nextLocation.pathname.startsWith(opts.safePathPrefix)) {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
if (nextLocation.pathname === currentLocation.pathname) return false;
|
|
15
|
+
return true;
|
|
16
|
+
});
|
|
17
|
+
return blocker;
|
|
18
|
+
}
|
|
19
|
+
function UnsavedChangesGuard({
|
|
20
|
+
isDirty,
|
|
21
|
+
safePathPrefix,
|
|
22
|
+
shouldBlock,
|
|
23
|
+
title,
|
|
24
|
+
message,
|
|
25
|
+
confirmLabel,
|
|
26
|
+
cancelLabel
|
|
27
|
+
}) {
|
|
28
|
+
const blocker = useUnsavedChangesBlocker(isDirty, {
|
|
29
|
+
safePathPrefix,
|
|
30
|
+
shouldBlock
|
|
31
|
+
});
|
|
32
|
+
return /* @__PURE__ */ jsx(
|
|
33
|
+
LeavePageConfirmation,
|
|
34
|
+
{
|
|
35
|
+
blocked: blocker.state === "blocked",
|
|
36
|
+
onConfirmLeave: () => blocker.proceed?.(),
|
|
37
|
+
onCancelLeave: () => blocker.reset?.(),
|
|
38
|
+
title,
|
|
39
|
+
message,
|
|
40
|
+
confirmLabel,
|
|
41
|
+
cancelLabel
|
|
42
|
+
}
|
|
43
|
+
);
|
|
44
|
+
}
|
|
45
|
+
UnsavedChangesGuard.displayName = "UnsavedChangesGuard";
|
|
46
|
+
|
|
47
|
+
export { UnsavedChangesGuard, useUnsavedChangesBlocker };
|
|
48
|
+
//# sourceMappingURL=chunk-77EOXDGW.js.map
|
|
49
|
+
//# sourceMappingURL=chunk-77EOXDGW.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/navigation/use-unsaved-changes-blocker.ts","../src/navigation/unsaved-changes-guard.tsx"],"names":[],"mappings":";;;;AAgCO,SAAS,wBAAA,CACf,SACA,IAAA,EACU;AACV,EAAA,MAAM,UAAU,UAAA,CAAW,CAAC,EAAE,eAAA,EAAiB,cAAa,KAAM;AACjE,IAAA,IAAI,CAAC,SAAS,OAAO,KAAA;AACrB,IAAA,IAAI,MAAM,WAAA,EAAa;AACtB,MAAA,OAAO,IAAA,CAAK,WAAA,CAAY,EAAE,eAAA,EAAiB,cAAc,CAAA;AAAA,IAC1D;AACA,IAAA,IACC,MAAM,cAAA,IACN,YAAA,CAAa,SAAS,UAAA,CAAW,IAAA,CAAK,cAAc,CAAA,EACnD;AACD,MAAA,OAAO,KAAA;AAAA,IACR;AACA,IAAA,IAAI,YAAA,CAAa,QAAA,KAAa,eAAA,CAAgB,QAAA,EAAU,OAAO,KAAA;AAC/D,IAAA,OAAO,IAAA;AAAA,EACR,CAAC,CAAA;AACD,EAAA,OAAO,OAAA;AACR;AChBO,SAAS,mBAAA,CAAoB;AAAA,EACnC,OAAA;AAAA,EACA,cAAA;AAAA,EACA,WAAA;AAAA,EACA,KAAA;AAAA,EACA,OAAA;AAAA,EACA,YAAA;AAAA,EACA;AACD,CAAA,EAA6B;AAC5B,EAAA,MAAM,OAAA,GAAU,yBAAyB,OAAA,EAAS;AAAA,IACjD,cAAA;AAAA,IACA;AAAA,GACA,CAAA;AACD,EAAA,uBACC,GAAA;AAAA,IAAC,qBAAA;AAAA,IAAA;AAAA,MACA,OAAA,EAAS,QAAQ,KAAA,KAAU,SAAA;AAAA,MAC3B,cAAA,EAAgB,MAAM,OAAA,CAAQ,OAAA,IAAU;AAAA,MACxC,aAAA,EAAe,MAAM,OAAA,CAAQ,KAAA,IAAQ;AAAA,MACrC,KAAA;AAAA,MACA,OAAA;AAAA,MACA,YAAA;AAAA,MACA;AAAA;AAAA,GACD;AAEF;AACA,mBAAA,CAAoB,WAAA,GAAc,qBAAA","file":"chunk-77EOXDGW.js","sourcesContent":["import type { Blocker, Location } from \"react-router-dom\";\nimport { useBlocker } from \"react-router-dom\";\n\nexport interface UnsavedChangesBlockerOptions {\n\t/**\n\t * Pathname prefix considered \"safe\" — navigation to a path starting with\n\t * this prefix does NOT trigger the block. Use for sibling tabs of the\n\t * same detail page (e.g. `/foo/bar/${id}/`). Trailing slash matters.\n\t */\n\tsafePathPrefix?: string;\n\t/**\n\t * Custom predicate. Receives react-router's blocker args. Takes\n\t * precedence over `safePathPrefix`. Default: block iff\n\t * `isDirty && nextLocation.pathname !== currentLocation.pathname`.\n\t */\n\tshouldBlock?: (args: {\n\t\tcurrentLocation: Location;\n\t\tnextLocation: Location;\n\t}) => boolean;\n}\n\n/**\n * Block in-app navigation while there are unsaved changes.\n *\n * Returns the raw react-router `Blocker` so the caller can render their own\n * dialog. For the conventional dialog UX use `<UnsavedChangesGuard/>` (which\n * composes this hook with `<LeavePageConfirmation/>`).\n *\n * Requires a react-router-dom **data router** (`createBrowserRouter` /\n * `createMemoryRouter` + `<RouterProvider/>`). The legacy `<BrowserRouter>` /\n * `<MemoryRouter>` JSX routers do not implement `useBlocker`.\n */\nexport function useUnsavedChangesBlocker(\n\tisDirty: boolean,\n\topts?: UnsavedChangesBlockerOptions,\n): Blocker {\n\tconst blocker = useBlocker(({ currentLocation, nextLocation }) => {\n\t\tif (!isDirty) return false;\n\t\tif (opts?.shouldBlock) {\n\t\t\treturn opts.shouldBlock({ currentLocation, nextLocation });\n\t\t}\n\t\tif (\n\t\t\topts?.safePathPrefix &&\n\t\t\tnextLocation.pathname.startsWith(opts.safePathPrefix)\n\t\t) {\n\t\t\treturn false;\n\t\t}\n\t\tif (nextLocation.pathname === currentLocation.pathname) return false;\n\t\treturn true;\n\t});\n\treturn blocker;\n}\n","import { LeavePageConfirmation } from \"../primitives/leave-page-confirmation\";\nimport {\n\ttype UnsavedChangesBlockerOptions,\n\tuseUnsavedChangesBlocker,\n} from \"./use-unsaved-changes-blocker\";\n\nexport interface UnsavedChangesGuardProps extends UnsavedChangesBlockerOptions {\n\t/** Source of truth for whether there's unsaved work. */\n\tisDirty: boolean;\n\t/** Dialog title. @default \"You have unsaved changes\" */\n\ttitle?: string;\n\t/** Dialog message body. @default \"Are you sure you want to leave this page? You have unsaved changes.\" */\n\tmessage?: string;\n\t/** Confirm/leave label. @default \"Leave\" */\n\tconfirmLabel?: string;\n\t/** Cancel/stay label. @default \"Stay\" */\n\tcancelLabel?: string;\n}\n\n/**\n * Blocks in-app navigation while `isDirty` is true and renders\n * `LeavePageConfirmation` to ask the user to confirm. Non-form-aware —\n * pass any boolean (form `formState.isDirty`, Monaco buffer state, etc.).\n * For react-hook-form pages use `<DirtyFormGuard/>` which sources `isDirty`\n * from `useFormContext()` automatically.\n *\n * Use `safePathPrefix` to exempt sibling tabs of the same detail page:\n *\n * ```tsx\n * <UnsavedChangesGuard\n * isDirty={editor.hasAnyDirty}\n * safePathPrefix={`/template/templates/${templateId}/`}\n * />\n * ```\n */\nexport function UnsavedChangesGuard({\n\tisDirty,\n\tsafePathPrefix,\n\tshouldBlock,\n\ttitle,\n\tmessage,\n\tconfirmLabel,\n\tcancelLabel,\n}: UnsavedChangesGuardProps) {\n\tconst blocker = useUnsavedChangesBlocker(isDirty, {\n\t\tsafePathPrefix,\n\t\tshouldBlock,\n\t});\n\treturn (\n\t\t<LeavePageConfirmation\n\t\t\tblocked={blocker.state === \"blocked\"}\n\t\t\tonConfirmLeave={() => blocker.proceed?.()}\n\t\t\tonCancelLeave={() => blocker.reset?.()}\n\t\t\ttitle={title}\n\t\t\tmessage={message}\n\t\t\tconfirmLabel={confirmLabel}\n\t\t\tcancelLabel={cancelLabel}\n\t\t/>\n\t);\n}\nUnsavedChangesGuard.displayName = \"UnsavedChangesGuard\";\n"]}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { Dialog, Portal, ButtonGroup, Button } from '@chakra-ui/react';
|
|
2
|
+
import { useRef } from 'react';
|
|
3
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/primitives/leave-page-confirmation.tsx
|
|
6
|
+
var LeavePageConfirmation = (props) => {
|
|
7
|
+
const {
|
|
8
|
+
blocked,
|
|
9
|
+
onConfirmLeave,
|
|
10
|
+
onCancelLeave,
|
|
11
|
+
title = "You have unsaved changes",
|
|
12
|
+
message = "Are you sure you want to leave this page? You have unsaved changes.",
|
|
13
|
+
confirmLabel = "Leave",
|
|
14
|
+
cancelLabel = "Stay"
|
|
15
|
+
} = props;
|
|
16
|
+
const cancelRef = useRef(null);
|
|
17
|
+
return /* @__PURE__ */ jsx(
|
|
18
|
+
Dialog.Root,
|
|
19
|
+
{
|
|
20
|
+
open: blocked,
|
|
21
|
+
initialFocusEl: () => cancelRef.current,
|
|
22
|
+
role: "alertdialog",
|
|
23
|
+
onOpenChange: (e) => {
|
|
24
|
+
if (!e.open) {
|
|
25
|
+
onCancelLeave();
|
|
26
|
+
}
|
|
27
|
+
},
|
|
28
|
+
children: /* @__PURE__ */ jsx(Portal, { children: /* @__PURE__ */ jsx(Dialog.Backdrop, { children: /* @__PURE__ */ jsx(Dialog.Positioner, { children: /* @__PURE__ */ jsxs(Dialog.Content, { children: [
|
|
29
|
+
/* @__PURE__ */ jsx(Dialog.Header, { fontSize: "lg", fontWeight: "bold", children: title }),
|
|
30
|
+
/* @__PURE__ */ jsx(Dialog.Body, { children: message }),
|
|
31
|
+
/* @__PURE__ */ jsx(Dialog.Footer, { children: /* @__PURE__ */ jsxs(ButtonGroup, { children: [
|
|
32
|
+
/* @__PURE__ */ jsx(
|
|
33
|
+
Button,
|
|
34
|
+
{
|
|
35
|
+
variant: "solid",
|
|
36
|
+
colorPalette: "primary",
|
|
37
|
+
onClick: onConfirmLeave,
|
|
38
|
+
children: confirmLabel
|
|
39
|
+
}
|
|
40
|
+
),
|
|
41
|
+
/* @__PURE__ */ jsx(
|
|
42
|
+
Button,
|
|
43
|
+
{
|
|
44
|
+
variant: "outline",
|
|
45
|
+
onClick: onCancelLeave,
|
|
46
|
+
ref: cancelRef,
|
|
47
|
+
children: cancelLabel
|
|
48
|
+
}
|
|
49
|
+
)
|
|
50
|
+
] }) })
|
|
51
|
+
] }) }) }) })
|
|
52
|
+
}
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
LeavePageConfirmation.displayName = "LeavePageConfirmation";
|
|
56
|
+
|
|
57
|
+
export { LeavePageConfirmation };
|
|
58
|
+
//# sourceMappingURL=chunk-7KPPPE4U.js.map
|
|
59
|
+
//# sourceMappingURL=chunk-7KPPPE4U.js.map
|
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;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACA,OAAA,EAAQ,OAAA;AAAA,cACR,YAAA,EAAa,SAAA;AAAA,cACb,OAAA,EAAS,cAAA;AAAA,cAER,QAAA,EAAA;AAAA;AAAA,WACF;AAAA,0BACA,GAAA;AAAA,YAAC,MAAA;AAAA,YAAA;AAAA,cACA,OAAA,EAAQ,SAAA;AAAA,cACR,OAAA,EAAS,aAAA;AAAA,cACT,GAAA,EAAK,SAAA;AAAA,cAEJ,QAAA,EAAA;AAAA;AAAA;AACF,SAAA,EACD,CAAA,EACD;AAAA,OAAA,EACD,CAAA,EACD,GACD,CAAA,EACD;AAAA;AAAA,GACD;AAEF;AACA,qBAAA,CAAsB,WAAA,GAAc,uBAAA","file":"chunk-7KPPPE4U.js","sourcesContent":["import { Button, ButtonGroup, Dialog, Portal } from \"@chakra-ui/react\";\nimport type React from \"react\";\nimport { useRef } from \"react\";\n\nexport interface LeavePageConfirmationProps {\n\t/** Whether the dialog is currently open (i.e., navigation is blocked). */\n\tblocked: boolean;\n\t/** Called when the user confirms they want to leave. */\n\tonConfirmLeave: () => void;\n\t/** Called when the user cancels and wants to stay. */\n\tonCancelLeave: () => void;\n\t/** Dialog title. Defaults to \"You have unsaved changes\". */\n\ttitle?: string;\n\t/** Dialog message body. Defaults to a generic unsaved-changes prompt. */\n\tmessage?: string;\n\t/** Label for the confirm/leave button. Defaults to \"Leave\". */\n\tconfirmLabel?: string;\n\t/** Label for the cancel/stay button. Defaults to \"Stay\". */\n\tcancelLabel?: string;\n}\n\nexport const LeavePageConfirmation: React.FC<LeavePageConfirmationProps> = (\n\tprops,\n) => {\n\tconst {\n\t\tblocked,\n\t\tonConfirmLeave,\n\t\tonCancelLeave,\n\t\ttitle = \"You have unsaved changes\",\n\t\tmessage = \"Are you sure you want to leave this page? You have unsaved changes.\",\n\t\tconfirmLabel = \"Leave\",\n\t\tcancelLabel = \"Stay\",\n\t} = props;\n\n\tconst cancelRef = useRef<HTMLButtonElement | null>(null);\n\n\treturn (\n\t\t<Dialog.Root\n\t\t\topen={blocked}\n\t\t\tinitialFocusEl={() => cancelRef.current}\n\t\t\trole=\"alertdialog\"\n\t\t\tonOpenChange={(e) => {\n\t\t\t\tif (!e.open) {\n\t\t\t\t\tonCancelLeave();\n\t\t\t\t}\n\t\t\t}}\n\t\t>\n\t\t\t<Portal>\n\t\t\t\t<Dialog.Backdrop>\n\t\t\t\t\t<Dialog.Positioner>\n\t\t\t\t\t\t<Dialog.Content>\n\t\t\t\t\t\t\t<Dialog.Header fontSize=\"lg\" fontWeight=\"bold\">\n\t\t\t\t\t\t\t\t{title}\n\t\t\t\t\t\t\t</Dialog.Header>\n\t\t\t\t\t\t\t<Dialog.Body>{message}</Dialog.Body>\n\t\t\t\t\t\t\t<Dialog.Footer>\n\t\t\t\t\t\t\t\t<ButtonGroup>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"solid\"\n\t\t\t\t\t\t\t\t\t\tcolorPalette=\"primary\"\n\t\t\t\t\t\t\t\t\t\tonClick={onConfirmLeave}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{confirmLabel}\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t\t<Button\n\t\t\t\t\t\t\t\t\t\tvariant=\"outline\"\n\t\t\t\t\t\t\t\t\t\tonClick={onCancelLeave}\n\t\t\t\t\t\t\t\t\t\tref={cancelRef}\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t{cancelLabel}\n\t\t\t\t\t\t\t\t\t</Button>\n\t\t\t\t\t\t\t\t</ButtonGroup>\n\t\t\t\t\t\t\t</Dialog.Footer>\n\t\t\t\t\t\t</Dialog.Content>\n\t\t\t\t\t</Dialog.Positioner>\n\t\t\t\t</Dialog.Backdrop>\n\t\t\t</Portal>\n\t\t</Dialog.Root>\n\t);\n};\nLeavePageConfirmation.displayName = \"LeavePageConfirmation\";\n"]}
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
import { NumberInput, RadioGroup as RadioGroup$1, NativeSelect as NativeSelect$1 } from '@chakra-ui/react';
|
|
2
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
3
|
+
|
|
4
|
+
// src/primitives/native-select.tsx
|
|
5
|
+
var NativeSelect = function NativeSelect2({
|
|
6
|
+
ref,
|
|
7
|
+
...props
|
|
8
|
+
}) {
|
|
9
|
+
const {
|
|
10
|
+
size,
|
|
11
|
+
variant,
|
|
12
|
+
disabled,
|
|
13
|
+
invalid,
|
|
14
|
+
unstyled,
|
|
15
|
+
placeholder,
|
|
16
|
+
children,
|
|
17
|
+
...fieldProps
|
|
18
|
+
} = props;
|
|
19
|
+
return /* @__PURE__ */ jsxs(
|
|
20
|
+
NativeSelect$1.Root,
|
|
21
|
+
{
|
|
22
|
+
size,
|
|
23
|
+
variant,
|
|
24
|
+
disabled,
|
|
25
|
+
invalid,
|
|
26
|
+
unstyled,
|
|
27
|
+
children: [
|
|
28
|
+
/* @__PURE__ */ jsxs(NativeSelect$1.Field, { ref, ...fieldProps, children: [
|
|
29
|
+
placeholder && /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: placeholder }),
|
|
30
|
+
children
|
|
31
|
+
] }),
|
|
32
|
+
/* @__PURE__ */ jsx(NativeSelect$1.Indicator, {})
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
);
|
|
36
|
+
};
|
|
37
|
+
NativeSelect.displayName = "NativeSelect";
|
|
38
|
+
var NumberInputRoot = function NumberInput$1({
|
|
39
|
+
ref,
|
|
40
|
+
...props
|
|
41
|
+
}) {
|
|
42
|
+
const { children, showStepper = true, ...rest } = props;
|
|
43
|
+
return /* @__PURE__ */ jsxs(NumberInput.Root, { ref, variant: "outline", ...rest, children: [
|
|
44
|
+
children,
|
|
45
|
+
showStepper && /* @__PURE__ */ jsxs(NumberInput.Control, { children: [
|
|
46
|
+
/* @__PURE__ */ jsx(NumberInput.IncrementTrigger, {}),
|
|
47
|
+
/* @__PURE__ */ jsx(NumberInput.DecrementTrigger, {})
|
|
48
|
+
] })
|
|
49
|
+
] });
|
|
50
|
+
};
|
|
51
|
+
NumberInputRoot.displayName = "NumberInputRoot";
|
|
52
|
+
var NumberInputField = NumberInput.Input;
|
|
53
|
+
NumberInputField.displayName = "NumberInputField";
|
|
54
|
+
var NumberInputScrubber = NumberInput.Scrubber;
|
|
55
|
+
NumberInputScrubber.displayName = "NumberInputScrubber";
|
|
56
|
+
var NumberInputLabel = NumberInput.Label;
|
|
57
|
+
NumberInputLabel.displayName = "NumberInputLabel";
|
|
58
|
+
var Radio = function Radio2({
|
|
59
|
+
ref,
|
|
60
|
+
...props
|
|
61
|
+
}) {
|
|
62
|
+
const { children, inputProps, rootRef, ...rest } = props;
|
|
63
|
+
return /* @__PURE__ */ jsxs(RadioGroup$1.Item, { ref: rootRef, ...rest, children: [
|
|
64
|
+
/* @__PURE__ */ jsx(RadioGroup$1.ItemHiddenInput, { ref, ...inputProps }),
|
|
65
|
+
/* @__PURE__ */ jsx(RadioGroup$1.ItemIndicator, {}),
|
|
66
|
+
children && /* @__PURE__ */ jsx(RadioGroup$1.ItemText, { children })
|
|
67
|
+
] });
|
|
68
|
+
};
|
|
69
|
+
Radio.displayName = "Radio";
|
|
70
|
+
var RadioGroup = RadioGroup$1.Root;
|
|
71
|
+
RadioGroup.displayName = "RadioGroup";
|
|
72
|
+
|
|
73
|
+
export { NativeSelect, NumberInputField, NumberInputLabel, NumberInputRoot, NumberInputScrubber, Radio, RadioGroup };
|
|
74
|
+
//# sourceMappingURL=chunk-CWBQKGL4.js.map
|
|
75
|
+
//# sourceMappingURL=chunk-CWBQKGL4.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/primitives/native-select.tsx","../src/primitives/number-input.tsx","../src/primitives/radio.tsx"],"names":["NativeSelect","ChakraNativeSelect","NumberInput","jsxs","ChakraNumberInput","jsx","Radio","ChakraRad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ootProps,\n} from \"@chakra-ui/react\";\nimport type * as React from \"react\";\n\nexport interface NativeSelectProps\n\textends Omit<NativeSelectFieldProps, \"placeholder\"> {\n\t/** Props forwarded to the root wrapper. */\n\tsize?: NativeSelectRootProps[\"size\"];\n\tvariant?: NativeSelectRootProps[\"variant\"];\n\tdisabled?: NativeSelectRootProps[\"disabled\"];\n\tinvalid?: NativeSelectRootProps[\"invalid\"];\n\tunstyled?: NativeSelectRootProps[\"unstyled\"];\n\t/** Rendered as a disabled first <option> */\n\tplaceholder?: string;\n}\n\nexport const NativeSelect = function NativeSelect({\n\tref,\n\t...props\n}: NativeSelectProps & { ref?: React.Ref<HTMLSelectElement> }) {\n\tconst {\n\t\tsize,\n\t\tvariant,\n\t\tdisabled,\n\t\tinvalid,\n\t\tunstyled,\n\t\tplaceholder,\n\t\tchildren,\n\t\t...fieldProps\n\t} = props;\n\n\treturn (\n\t\t<ChakraNativeSelect.Root\n\t\t\tsize={size}\n\t\t\tvariant={variant}\n\t\t\tdisabled={disabled}\n\t\t\tinvalid={invalid}\n\t\t\tunstyled={unstyled}\n\t\t>\n\t\t\t<ChakraNativeSelect.Field ref={ref} {...fieldProps}>\n\t\t\t\t{placeholder && (\n\t\t\t\t\t<option value=\"\" disabled>\n\t\t\t\t\t\t{placeholder}\n\t\t\t\t\t</option>\n\t\t\t\t)}\n\t\t\t\t{children}\n\t\t\t</ChakraNativeSelect.Field>\n\t\t\t<ChakraNativeSelect.Indicator />\n\t\t</ChakraNativeSelect.Root>\n\t);\n};\nNativeSelect.displayName = \"NativeSelect\";\n","import { NumberInput as ChakraNumberInput } from \"@chakra-ui/react\";\nimport type * as React from \"react\";\n\nexport interface NumberInputProps extends ChakraNumberInput.RootProps {\n\tshowStepper?: boolean;\n}\n\nexport const NumberInputRoot = function NumberInput({\n\tref,\n\t...props\n}: NumberInputProps & { ref?: React.Ref<HTMLDivElement> }) {\n\tconst { children, showStepper = true, ...rest } = props;\n\treturn (\n\t\t<ChakraNumberInput.Root ref={ref} variant=\"outline\" {...rest}>\n\t\t\t{children}\n\t\t\t{showStepper && (\n\t\t\t\t<ChakraNumberInput.Control>\n\t\t\t\t\t<ChakraNumberInput.IncrementTrigger />\n\t\t\t\t\t<ChakraNumberInput.DecrementTrigger />\n\t\t\t\t</ChakraNumberInput.Control>\n\t\t\t)}\n\t\t</ChakraNumberInput.Root>\n\t);\n};\nNumberInputRoot.displayName = \"NumberInputRoot\";\n\nexport const NumberInputField = ChakraNumberInput.Input;\nNumberInputField.displayName = \"NumberInputField\";\nexport const NumberInputScrubber = ChakraNumberInput.Scrubber;\nNumberInputScrubber.displayName = \"NumberInputScrubber\";\nexport const NumberInputLabel = ChakraNumberInput.Label;\nNumberInputLabel.displayName = \"NumberInputLabel\";\n","import { RadioGroup as ChakraRadioGroup } from \"@chakra-ui/react\";\nimport type * as React from \"react\";\n\nexport interface RadioProps extends ChakraRadioGroup.ItemProps {\n\t/** Ref attached to the root element. */\n\trootRef?: React.RefObject<HTMLDivElement | null>;\n\t/** Additional props forwarded to the hidden input element. */\n\tinputProps?: React.InputHTMLAttributes<HTMLInputElement>;\n}\n\nexport const Radio = function Radio({\n\tref,\n\t...props\n}: RadioProps & { ref?: React.Ref<HTMLInputElement> }) {\n\tconst { children, inputProps, rootRef, ...rest } = props;\n\treturn (\n\t\t<ChakraRadioGroup.Item ref={rootRef} {...rest}>\n\t\t\t<ChakraRadioGroup.ItemHiddenInput ref={ref} {...inputProps} />\n\t\t\t<ChakraRadioGroup.ItemIndicator />\n\t\t\t{children && (\n\t\t\t\t<ChakraRadioGroup.ItemText>{children}</ChakraRadioGroup.ItemText>\n\t\t\t)}\n\t\t</ChakraRadioGroup.Item>\n\t);\n};\nRadio.displayName = \"Radio\";\n\nexport const RadioGroup = ChakraRadioGroup.Root;\nRadioGroup.displayName = \"RadioGroup\";\n"]}
|
package/dist/components/index.js
CHANGED
|
@@ -1981,7 +1981,7 @@ var NavListGroup = ({ label, children }) => {
|
|
|
1981
1981
|
children: label
|
|
1982
1982
|
}
|
|
1983
1983
|
),
|
|
1984
|
-
/* @__PURE__ */ jsx(Flex, { direction: "column", gap: "
|
|
1984
|
+
/* @__PURE__ */ jsx(Flex, { direction: "column", gap: "1", "data-testid": "nav-list-group-items", children })
|
|
1985
1985
|
] });
|
|
1986
1986
|
};
|
|
1987
1987
|
NavListGroup.displayName = "NavList.Group";
|