@namroodinc/liquid-editorial 0.1.6 → 0.1.8
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/AGENTS.md +4 -0
- package/README.md +42 -0
- package/UPGRADING.md +93 -11
- package/dist/chunks/Board-BLhB5_xx.cjs +2 -0
- package/dist/chunks/Board-BLhB5_xx.cjs.map +1 -0
- package/dist/chunks/Board-BTFSzn6c.js +239 -0
- package/dist/chunks/Board-BTFSzn6c.js.map +1 -0
- package/dist/chunks/EntryEditor-CcyYtH74.js +191 -0
- package/dist/chunks/EntryEditor-CcyYtH74.js.map +1 -0
- package/dist/chunks/EntryEditor-DIpc1iPF.cjs +2 -0
- package/dist/chunks/EntryEditor-DIpc1iPF.cjs.map +1 -0
- package/dist/chunks/{RichTextEditor-DC_0oN1s.cjs → RichTextEditor-BxtlbjXj.cjs} +2 -2
- package/dist/chunks/RichTextEditor-BxtlbjXj.cjs.map +1 -0
- package/dist/chunks/{RichTextEditor-CSpjsL1z.js → RichTextEditor-Dnx4i7bQ.js} +104 -93
- package/dist/chunks/RichTextEditor-Dnx4i7bQ.js.map +1 -0
- package/dist/chunks/mergeRefs-Bc3qS0Tt.cjs +2 -0
- package/dist/chunks/mergeRefs-Bc3qS0Tt.cjs.map +1 -0
- package/dist/chunks/mergeRefs-DGM402mE.js +10 -0
- package/dist/chunks/mergeRefs-DGM402mE.js.map +1 -0
- package/dist/components/AppShell/index.cjs +2 -0
- package/dist/components/AppShell/index.cjs.map +1 -0
- package/dist/components/AppShell/index.d.cts +15 -0
- package/dist/components/AppShell/index.d.cts.map +1 -0
- package/dist/components/AppShell/index.d.ts +15 -0
- package/dist/components/AppShell/index.d.ts.map +1 -0
- package/dist/components/AppShell/index.js +93 -0
- package/dist/components/AppShell/index.js.map +1 -0
- package/dist/components/AppShell/style.css +79 -0
- package/dist/components/AssetGrid/index.cjs +1 -1
- package/dist/components/AssetGrid/index.cjs.map +1 -1
- package/dist/components/AssetGrid/index.d.cts.map +1 -1
- package/dist/components/AssetGrid/index.d.ts.map +1 -1
- package/dist/components/AssetGrid/index.js +57 -59
- package/dist/components/AssetGrid/index.js.map +1 -1
- package/dist/components/AssetGrid/style.css +8 -16
- package/dist/components/Board/index.cjs +1 -2
- package/dist/components/Board/index.d.cts.map +1 -1
- package/dist/components/Board/index.d.ts.map +1 -1
- package/dist/components/Board/index.js +1 -227
- package/dist/components/Board/keyboard.d.cts +7 -0
- package/dist/components/Board/keyboard.d.cts.map +1 -0
- package/dist/components/Board/keyboard.d.ts +7 -0
- package/dist/components/Board/keyboard.d.ts.map +1 -0
- package/dist/components/Board/keyboard.test.d.cts +2 -0
- package/dist/components/Board/keyboard.test.d.cts.map +1 -0
- package/dist/components/Board/keyboard.test.d.ts +2 -0
- package/dist/components/Board/keyboard.test.d.ts.map +1 -0
- package/dist/components/Board/moves.d.cts +5 -0
- package/dist/components/Board/moves.d.cts.map +1 -0
- package/dist/components/Board/moves.d.ts +5 -0
- package/dist/components/Board/moves.d.ts.map +1 -0
- package/dist/components/Board/moves.test.d.cts +2 -0
- package/dist/components/Board/moves.test.d.cts.map +1 -0
- package/dist/components/Board/moves.test.d.ts +2 -0
- package/dist/components/Board/moves.test.d.ts.map +1 -0
- package/dist/components/Board/style.css +17 -28
- package/dist/components/Button/index.cjs +1 -1
- package/dist/components/Button/index.cjs.map +1 -1
- package/dist/components/Button/index.d.cts +3 -2
- package/dist/components/Button/index.d.cts.map +1 -1
- package/dist/components/Button/index.d.ts +3 -2
- package/dist/components/Button/index.d.ts.map +1 -1
- package/dist/components/Button/index.js +1 -1
- package/dist/components/Button/index.js.map +1 -1
- package/dist/components/Button/style.css +21 -15
- package/dist/components/DatePicker/index.cjs +1 -1
- package/dist/components/DatePicker/index.cjs.map +1 -1
- package/dist/components/DatePicker/index.d.cts.map +1 -1
- package/dist/components/DatePicker/index.d.ts.map +1 -1
- package/dist/components/DatePicker/index.js +76 -72
- package/dist/components/DatePicker/index.js.map +1 -1
- package/dist/components/DatePicker/style.css +4 -61
- package/dist/components/Drawer/index.cjs +1 -1
- package/dist/components/Drawer/index.cjs.map +1 -1
- package/dist/components/Drawer/index.d.cts +10 -1
- package/dist/components/Drawer/index.d.cts.map +1 -1
- package/dist/components/Drawer/index.d.ts +10 -1
- package/dist/components/Drawer/index.d.ts.map +1 -1
- package/dist/components/Drawer/index.js +78 -49
- package/dist/components/Drawer/index.js.map +1 -1
- package/dist/components/Drawer/style.css +106 -0
- package/dist/components/EntryEditor/index.cjs +1 -1
- package/dist/components/EntryEditor/index.d.cts.map +1 -1
- package/dist/components/EntryEditor/index.d.ts.map +1 -1
- package/dist/components/EntryEditor/index.js +1 -1
- package/dist/components/EntryEditor/model.d.cts.map +1 -1
- package/dist/components/EntryEditor/model.d.ts.map +1 -1
- package/dist/components/EntryPicker/index.cjs +1 -1
- package/dist/components/EntryPicker/index.cjs.map +1 -1
- package/dist/components/EntryPicker/index.d.cts.map +1 -1
- package/dist/components/EntryPicker/index.d.ts.map +1 -1
- package/dist/components/EntryPicker/index.js +12 -11
- package/dist/components/EntryPicker/index.js.map +1 -1
- package/dist/components/EntryPicker/style.css +3 -30
- package/dist/components/Field/style.css +11 -3
- package/dist/components/Menu/index.cjs +1 -1
- package/dist/components/Menu/index.cjs.map +1 -1
- package/dist/components/Menu/index.d.cts.map +1 -1
- package/dist/components/Menu/index.d.ts.map +1 -1
- package/dist/components/Menu/index.js +11 -16
- package/dist/components/Menu/index.js.map +1 -1
- package/dist/components/Menu/style.css +7 -41
- package/dist/components/Modal/index.cjs +1 -1
- package/dist/components/Modal/index.cjs.map +1 -1
- package/dist/components/Modal/index.d.cts.map +1 -1
- package/dist/components/Modal/index.d.ts.map +1 -1
- package/dist/components/Modal/index.js +12 -12
- package/dist/components/Modal/index.js.map +1 -1
- package/dist/components/NumberField/index.cjs +1 -1
- package/dist/components/NumberField/index.cjs.map +1 -1
- package/dist/components/NumberField/index.js +13 -17
- package/dist/components/NumberField/index.js.map +1 -1
- package/dist/components/NumberField/style.css +1 -41
- package/dist/components/Pagination/index.cjs +1 -1
- package/dist/components/Pagination/index.cjs.map +1 -1
- package/dist/components/Pagination/index.js +1 -1
- package/dist/components/Pagination/index.js.map +1 -1
- package/dist/components/Pagination/style.css +0 -1
- package/dist/components/Popover/index.cjs +1 -1
- package/dist/components/Popover/index.cjs.map +1 -1
- package/dist/components/Popover/index.js +4 -4
- package/dist/components/RichTextEditor/index.cjs +1 -1
- package/dist/components/RichTextEditor/index.d.cts.map +1 -1
- package/dist/components/RichTextEditor/index.d.ts.map +1 -1
- package/dist/components/RichTextEditor/index.js +1 -1
- package/dist/components/SearchField/index.cjs +1 -1
- package/dist/components/SearchField/index.cjs.map +1 -1
- package/dist/components/SearchField/index.d.cts.map +1 -1
- package/dist/components/SearchField/index.d.ts.map +1 -1
- package/dist/components/SearchField/index.js +26 -27
- package/dist/components/SearchField/index.js.map +1 -1
- package/dist/components/SearchField/style.css +0 -21
- package/dist/components/Select/index.cjs +1 -1
- package/dist/components/Select/index.cjs.map +1 -1
- package/dist/components/Select/index.d.cts.map +1 -1
- package/dist/components/Select/index.d.ts.map +1 -1
- package/dist/components/Select/index.js +101 -80
- package/dist/components/Select/index.js.map +1 -1
- package/dist/components/Select/style.css +5 -38
- package/dist/components/SideNav/index.cjs +1 -1
- package/dist/components/SideNav/index.cjs.map +1 -1
- package/dist/components/SideNav/index.d.cts.map +1 -1
- package/dist/components/SideNav/index.d.ts.map +1 -1
- package/dist/components/SideNav/index.js +52 -49
- package/dist/components/SideNav/index.js.map +1 -1
- package/dist/components/SideNav/style.css +2 -27
- package/dist/components/SortableList/index.cjs +1 -1
- package/dist/components/SortableList/index.cjs.map +1 -1
- package/dist/components/SortableList/index.d.cts.map +1 -1
- package/dist/components/SortableList/index.d.ts.map +1 -1
- package/dist/components/SortableList/index.js +55 -53
- package/dist/components/SortableList/index.js.map +1 -1
- package/dist/components/SortableList/style.css +9 -15
- package/dist/components/Stepper/index.cjs +1 -1
- package/dist/components/Stepper/index.cjs.map +1 -1
- package/dist/components/Stepper/index.d.cts.map +1 -1
- package/dist/components/Stepper/index.d.ts.map +1 -1
- package/dist/components/Stepper/index.js +48 -39
- package/dist/components/Stepper/index.js.map +1 -1
- package/dist/components/Stepper/style.css +24 -18
- package/dist/components/SubNav/index.cjs +1 -1
- package/dist/components/SubNav/index.cjs.map +1 -1
- package/dist/components/SubNav/index.d.cts.map +1 -1
- package/dist/components/SubNav/index.d.ts.map +1 -1
- package/dist/components/SubNav/index.js +27 -28
- package/dist/components/SubNav/index.js.map +1 -1
- package/dist/components/SubNav/style.css +13 -0
- package/dist/components/Switch/index.cjs +1 -1
- package/dist/components/Switch/index.cjs.map +1 -1
- package/dist/components/Switch/index.d.cts.map +1 -1
- package/dist/components/Switch/index.d.ts.map +1 -1
- package/dist/components/Switch/index.js +23 -21
- package/dist/components/Switch/index.js.map +1 -1
- package/dist/components/Switch/style.css +2 -28
- package/dist/components/TagsInput/index.cjs +1 -1
- package/dist/components/TagsInput/index.cjs.map +1 -1
- package/dist/components/TagsInput/index.js +8 -10
- package/dist/components/TagsInput/index.js.map +1 -1
- package/dist/components/TagsInput/style.css +2 -24
- package/dist/index.cjs +1 -1
- package/dist/index.d.cts +2 -0
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +39 -38
- package/dist/internal/mergeRefs.d.cts +4 -0
- package/dist/internal/mergeRefs.d.cts.map +1 -0
- package/dist/internal/mergeRefs.d.ts +4 -0
- package/dist/internal/mergeRefs.d.ts.map +1 -0
- package/dist/styles.css +1 -0
- package/dist/test/dragEvent.d.cts +3 -0
- package/dist/test/dragEvent.d.cts.map +1 -0
- package/dist/test/dragEvent.d.ts +3 -0
- package/dist/test/dragEvent.d.ts.map +1 -0
- package/package.json +2 -2
- package/dist/chunks/EntryEditor-C32lKKnV.cjs +0 -2
- package/dist/chunks/EntryEditor-C32lKKnV.cjs.map +0 -1
- package/dist/chunks/EntryEditor-xVuiqtFo.js +0 -181
- package/dist/chunks/EntryEditor-xVuiqtFo.js.map +0 -1
- package/dist/chunks/RichTextEditor-CSpjsL1z.js.map +0 -1
- package/dist/chunks/RichTextEditor-DC_0oN1s.cjs.map +0 -1
- package/dist/components/Board/index.cjs.map +0 -1
- package/dist/components/Board/index.js.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Button as e } from "../Button/index.js";
|
|
2
2
|
/* empty css */
|
|
3
3
|
import { FieldAffix as t } from "../FieldAffix/index.js";
|
|
4
4
|
import { forwardRef as n, useCallback as r, useRef as i, useState as a } from "react";
|
|
@@ -18,16 +18,14 @@ var l = n(function({ size: n = "md", value: l, defaultValue: u = "", onValueChan
|
|
|
18
18
|
className: c("ds-number", b),
|
|
19
19
|
"data-size": n,
|
|
20
20
|
children: [
|
|
21
|
-
y && /* @__PURE__ */ o(
|
|
22
|
-
|
|
21
|
+
y && /* @__PURE__ */ o(e, {
|
|
22
|
+
size: n,
|
|
23
|
+
isIconOnly: !0,
|
|
24
|
+
iconStart: "minus",
|
|
23
25
|
className: "ds-number__step",
|
|
24
26
|
"aria-label": "Decrease",
|
|
25
|
-
|
|
26
|
-
onClick: () => A(-1)
|
|
27
|
-
children: /* @__PURE__ */ o(e, {
|
|
28
|
-
name: "minus",
|
|
29
|
-
size: 16
|
|
30
|
-
})
|
|
27
|
+
isDisabled: _ || x || f !== void 0 && D !== "" && D <= f,
|
|
28
|
+
onClick: () => A(-1)
|
|
31
29
|
}),
|
|
32
30
|
/* @__PURE__ */ o(t, {
|
|
33
31
|
className: "ds-number__body",
|
|
@@ -54,16 +52,14 @@ var l = n(function({ size: n = "md", value: l, defaultValue: u = "", onValueChan
|
|
|
54
52
|
...C
|
|
55
53
|
})
|
|
56
54
|
}),
|
|
57
|
-
y && /* @__PURE__ */ o(
|
|
58
|
-
|
|
55
|
+
y && /* @__PURE__ */ o(e, {
|
|
56
|
+
size: n,
|
|
57
|
+
isIconOnly: !0,
|
|
58
|
+
iconStart: "plus",
|
|
59
59
|
className: "ds-number__step",
|
|
60
60
|
"aria-label": "Increase",
|
|
61
|
-
|
|
62
|
-
onClick: () => A(1)
|
|
63
|
-
children: /* @__PURE__ */ o(e, {
|
|
64
|
-
name: "plus",
|
|
65
|
-
size: 16
|
|
66
|
-
})
|
|
61
|
+
isDisabled: _ || x || p !== void 0 && D !== "" && D >= p,
|
|
62
|
+
onClick: () => A(1)
|
|
67
63
|
})
|
|
68
64
|
]
|
|
69
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["
|
|
1
|
+
{"version":3,"file":"index.js","names":["cx","parts","NumberField","forwardRef","ariaInvalid","rest","internal","setInternal","useState","defaultValue","current","value","inputRef","useRef","commit","useCallback","next","onValueChange","nudge","min","direction","step","max","outOfRange","className","size","hasSteppers","Button","isDisabled","disabled","FieldAffix","prefix","suffix","node","ref","isInvalid","raw","event","NumberRangeField","crossed","minLabel","maxLabel"],"sources":["../../../src/components/NumberField/index.tsx"],"sourcesContent":["import {\n forwardRef,\n useCallback,\n useRef,\n useState,\n type InputHTMLAttributes,\n type ReactNode,\n} from \"react\";\nimport { Button } from \"../Button\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nexport interface NumberFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\" | \"value\" | \"defaultValue\" | \"onChange\" | \"prefix\"> {\n size?: FieldSize;\n value?: number | \"\";\n defaultValue?: number | \"\";\n onValueChange?: (value: number | \"\") => void;\n min?: number;\n max?: number;\n step?: number | \"any\";\n /** Rendered inside the field, before the number — \"£\", \"$\", a glyph. */\n prefix?: ReactNode;\n /** Rendered inside the field, after the number — \"kg\", \"%\", \"px\". */\n suffix?: ReactNode;\n isDisabled?: boolean;\n isInvalid?: boolean;\n /** Hide the − / + steppers and keep typing only. */\n hasSteppers?: boolean;\n}\n\n\n/**\n * A quantity, bounded by `min` and `max`. Steppers move by `step` and stop at\n * the bounds; typing is never blocked, an out-of-range value reads invalid.\n */\nexport const NumberField = forwardRef<HTMLInputElement, NumberFieldProps>(function NumberField(\n {\n size = \"md\",\n value,\n defaultValue = \"\",\n onValueChange,\n min,\n max,\n step = 1,\n prefix,\n suffix,\n\n isDisabled = false,\n isInvalid = false,\n hasSteppers = true,\n className,\n disabled,\n \"aria-invalid\": ariaInvalid,\n ...rest\n },\n ref,\n) {\n const [internal, setInternal] = useState<number | \"\">(defaultValue);\n const current = value ?? internal;\n const inputRef = useRef<HTMLInputElement | null>(null);\n\n const commit = useCallback(\n (next: number | \"\") => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n },\n [onValueChange, value],\n );\n\n const nudge = (direction: 1 | -1) => {\n const base = current === \"\" ? (min ?? 0) : current;\n let next = base + direction * (step === \"any\" ? 1 : step);\n if (min !== undefined) next = Math.max(min, next);\n if (max !== undefined) next = Math.min(max, next);\n next = Number(next.toFixed(10));\n commit(next);\n inputRef.current?.focus();\n };\n\n const outOfRange =\n current !== \"\" &&\n ((min !== undefined && current < min) || (max !== undefined && current > max));\n\n return (\n <div className={cx(\"ds-number\", className)} data-size={size}>\n {hasSteppers && (\n <Button\n size={size}\n isIconOnly\n iconStart=\"minus\"\n className=\"ds-number__step\"\n aria-label=\"Decrease\"\n isDisabled={isDisabled || disabled || (min !== undefined && current !== \"\" && current <= min)}\n onClick={() => nudge(-1)}\n />\n )}\n <FieldAffix className=\"ds-number__body\" lead={prefix} trail={suffix}>\n <input\n ref={(node) => {\n inputRef.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n type=\"number\"\n inputMode=\"decimal\"\n value={current}\n min={min}\n max={max}\n step={step}\n disabled={isDisabled || disabled}\n aria-invalid={isInvalid || outOfRange || ariaInvalid || undefined}\n data-size={size}\n className=\"ds-field-skin ds-number__input\"\n onChange={(event) => {\n const raw = event.target.value;\n commit(raw === \"\" ? \"\" : Number(raw));\n }}\n {...rest}\n />\n </FieldAffix>\n\n {hasSteppers && (\n <Button\n size={size}\n isIconOnly\n iconStart=\"plus\"\n className=\"ds-number__step\"\n aria-label=\"Increase\"\n isDisabled={isDisabled || disabled || (max !== undefined && current !== \"\" && current >= max)}\n onClick={() => nudge(1)}\n />\n )}\n </div>\n );\n});\n\nexport interface NumberRangeValue {\n min: number | \"\";\n max: number | \"\";\n}\n\nexport interface NumberRangeFieldProps {\n value?: NumberRangeValue;\n defaultValue?: NumberRangeValue;\n onValueChange?: (value: NumberRangeValue) => void;\n size?: FieldSize;\n /** Hard bounds both ends are clamped to. */\n min?: number;\n max?: number;\n step?: number;\n /** Rendered inside both fields, before the number. */\n prefix?: ReactNode;\n suffix?: ReactNode;\n isDisabled?: boolean;\n minLabel?: string;\n maxLabel?: string;\n}\n\n/**\n * A lower and an upper bound, typed. The pair reads invalid when the minimum\n * passes the maximum — neither field is rewritten behind the user.\n */\nexport function NumberRangeField({\n value,\n defaultValue = { min: \"\", max: \"\" },\n onValueChange,\n size = \"md\",\n min,\n max,\n step = 1,\n prefix,\n suffix,\n isDisabled = false,\n minLabel = \"Minimum\",\n maxLabel = \"Maximum\",\n}: NumberRangeFieldProps) {\n const [internal, setInternal] = useState<NumberRangeValue>(defaultValue);\n const current = value ?? internal;\n\n const commit = (next: NumberRangeValue) => {\n if (value === undefined) setInternal(next);\n onValueChange?.(next);\n };\n\n const crossed = current.min !== \"\" && current.max !== \"\" && current.min > current.max;\n\n return (\n <div className=\"ds-number-range\">\n <NumberField\n aria-label={minLabel}\n size={size}\n value={current.min}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, min: next })}\n />\n <span className=\"ds-number-range__dash\" aria-hidden=\"true\">\n –\n </span>\n <NumberField\n aria-label={maxLabel}\n size={size}\n value={current.max}\n min={min}\n max={max}\n step={step}\n prefix={prefix}\n suffix={suffix}\n isDisabled={isDisabled}\n isInvalid={crossed}\n onValueChange={(next) => commit({ ...current, max: next })}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;AAcA,SAASA,EAAG,GAAGC,GAAuC;CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG;AACvC;AA0BA,IAAaC,IAAcC,EAA+C,SACxE,EACE,UAAO,MACP,UACA,kBAAe,IACf,kBACA,QACA,QACA,UAAO,GACP,WACA,WAEA,gBAAa,IACb,eAAY,IACZ,iBAAc,IACd,cACA,aACA,gBAAgBC,GAChB,GAAGC,KAEL,GACA;CACA,IAAM,CAACC,GAAUC,KAAeC,EAAsBC,CAAY,GAC5DC,IAAUC,KAASL,GACnBM,IAAWC,EAAgC,IAAI,GAE/CC,IAASC,GACZ,MAAsB;EAErB,AADIJ,MAAU,KAAA,KAAWJ,EAAYS,CAAI,GACzCC,IAAgBD,CAAI;CACtB,GACA,CAACC,GAAeN,CAAK,CACvB,GAEMO,KAAS,MAAsB;EAEnC,IAAIF,KADSN,MAAY,KAAMS,KAAO,IAAKT,KACzBU,KAAaC,MAAS,QAAQ,IAAIA;EAKpD,AAJIF,MAAQ,KAAA,MAAW,IAAO,KAAK,IAAIA,GAAKH,CAAI,IAC5CM,MAAQ,KAAA,MAAW,IAAO,KAAK,IAAIA,GAAKN,CAAI,IAChD,IAAO,OAAOA,EAAK,QAAQ,EAAE,CAAC,GAC9BF,EAAOE,CAAI,GACXJ,EAAS,SAAS,MAAM;CAC1B,GAEMW,IACJb,MAAY,OACVS,MAAQ,KAAA,KAAaT,IAAUS,KAASG,MAAQ,KAAA,KAAaZ,IAAUY;CAE3E,OACE,kBAAC,OAAD;EAAK,WAAWtB,EAAG,aAAawB,CAAS;EAAG,aAAWC;EAAvD,UAAA;GACGC,KACC,kBAACC,GAAD;IACQ;IACN,YAAA;IAC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ACE,kBAAC,OAAD;EAAK,WAAU;EAAf,UAAA;GACE,kBAACR,GAAD;IACE,cAAYsC;IACN;IACN,OAAO9B,EAAQ;IACV;IACA;IACC;IACE;IACA;IACI;IACZ,WAAW6B;IACX,gBAAgB,MAASzB,EAAO;KAAE,GAAGJ;KAAS,KAAKM;IAAK,CAAC;GAC1D,CAAA;GACD,kBAAC,QAAD;IAAM,WAAU;IAAwB,eAAY;IAAO,UAAA;GAErD,CAAA;GACN,kBAACd,GAAD;IACE,cAAYuC;IACN;IACN,OAAO/B,EAAQ;IACV;IACA;IACC;IACE;IACA;IACI;IACZ,WAAW6B;IACX,gBAAgB,MAASzB,EAAO;KAAE,GAAGJ;KAAS,KAAKM;IAAK,CAAC;GAC1D,CAAA;EACE;;AAET"}
|
|
@@ -31,47 +31,7 @@
|
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
|
|
34
|
-
.ds-number__step {
|
|
35
|
-
display: grid;
|
|
36
|
-
place-items: center;
|
|
37
|
-
flex: none;
|
|
38
|
-
inline-size: var(--field-height-md);
|
|
39
|
-
block-size: var(--field-height-md);
|
|
40
|
-
border: var(--control-border-width) solid var(--control-border-color);
|
|
41
|
-
border-radius: var(--field-radius);
|
|
42
|
-
background: var(--field-rest);
|
|
43
|
-
color: var(--color-text);
|
|
44
|
-
cursor: pointer;
|
|
45
|
-
transition: background-color var(--duration-fast) var(--ease-standard);
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
.ds-number[data-size="sm"] .ds-number__step {
|
|
49
|
-
inline-size: var(--field-height-sm);
|
|
50
|
-
block-size: var(--field-height-sm);
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
.ds-number[data-size="lg"] .ds-number__step {
|
|
54
|
-
inline-size: var(--field-height-lg);
|
|
55
|
-
block-size: var(--field-height-lg);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
.ds-number__step:hover:not(:disabled) {
|
|
59
|
-
background: var(--field-hover);
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
.ds-number__step:active:not(:disabled) {
|
|
63
|
-
background: var(--field-pressed);
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
.ds-number__step:focus-visible {
|
|
67
|
-
outline: var(--control-border-width) solid var(--color-focus);
|
|
68
|
-
outline-offset: 2px;
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
.ds-number__step:disabled {
|
|
72
|
-
opacity: 45%;
|
|
73
|
-
cursor: not-allowed;
|
|
74
|
-
}
|
|
34
|
+
.ds-number__step { flex: none; }
|
|
75
35
|
|
|
76
36
|
.ds-number-range {
|
|
77
37
|
display: flex;
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../Select/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=(0,n.forwardRef)(function({totalResults:i,page:a,pageSize:o,onChange:s,pageSizeOptions:c=[10,25,50,100],size:l=`
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../Button/index.cjs"),t=require("../Select/index.cjs");let n=require("react"),r=require("react/jsx-runtime");var i=(0,n.forwardRef)(function({totalResults:i,page:a,pageSize:o,onChange:s,pageSizeOptions:c=[10,25,50,100],size:l=`md`,isDisabled:u=!1,showLabels:d=!0,menuPlacement:f=`bottom`,className:p,...m},h){let g=(0,n.useId)(),_=Math.max(1,Math.ceil(i/o)),v=Math.min(Math.max(1,a),_),y=u||i===0,b=y||v===1,x=y||v===_,S=(v-1)*o+1,C=Math.min(v*o,i),w=e=>{let t=Math.min(Math.max(1,e),_);t!==v&&s({page:t,pageSize:o})};return(0,r.jsxs)(`nav`,{ref:h,"aria-label":`Pagination`,"data-size":l,className:[`ds-pagination`,p].filter(Boolean).join(` `),...m,children:[(0,r.jsx)(`div`,{className:`ds-pagination__actions`,children:(0,r.jsx)(e.Button,{variant:`neutral`,size:l,iconStart:`chevron-left`,isIconOnly:!d,"aria-label":`Previous page`,isDisabled:b,onClick:()=>w(v-1),children:`Previous`})}),(0,r.jsxs)(`div`,{className:`ds-pagination__centre`,children:[(0,r.jsxs)(`div`,{className:`ds-pagination__per-page`,children:[(0,r.jsx)(`span`,{id:g,children:`Per page`}),(0,r.jsx)(`div`,{className:`ds-pagination__select`,children:(0,r.jsx)(t.Select,{"aria-labelledby":g,value:String(o),options:c.map(e=>({value:String(e),label:String(e)})),size:l,menuPlacement:f,isDisabled:y||i<=Math.min(...c),onValueChange:e=>{let t=Number(e);if(t===o)return;let n=Math.floor((v-1)*o/t)+1,r=Math.max(1,Math.ceil(i/t));s({page:Math.min(n,r),pageSize:t})}})})]}),(0,r.jsx)(`span`,{className:`ds-pagination__range`,"aria-live":`polite`,"aria-atomic":`true`,children:i===0?`No results`:`${S.toLocaleString(`en-US`)}–${C.toLocaleString(`en-US`)} of ${i.toLocaleString(`en-US`)}`})]}),(0,r.jsx)(`div`,{className:`ds-pagination__actions ds-pagination__actions--next`,children:(0,r.jsx)(e.Button,{variant:`neutral`,size:l,iconStart:d?void 0:`chevron-right`,iconEnd:d?`chevron-right`:void 0,isIconOnly:!d,"aria-label":`Next page`,isDisabled:x,onClick:()=>w(v+1),children:`Next`})})]})});exports.Pagination=i;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","useId","Button","Select","require_components_Button_index","require_components_Select_index","react","react_jsx_runtime","Pagination","rest","labelId","pageCount","totalResults","pageSize","currentPage","page","disabled","isDisabled","atStart","atEnd","start","end","go","next","nextPage","onChange","size","className","showLabels","pageSizeOptions","value","nextSize","nextPageCount"],"sources":["../../../src/components/Pagination/index.tsx"],"sourcesContent":["import { forwardRef, useId, type HTMLAttributes } from \"react\";\nimport { Button } from \"../Button\";\nimport { Select } from \"../Select\";\nimport type { PopoverPlacement } from \"../Popover\";\nimport \"./style.css\";\n\nexport type PaginationSize = \"sm\" | \"md\";\n\nexport interface PaginationState {\n /** One-based page number. */\n page: number;\n /** Positive integer results per page. */\n pageSize: number;\n}\n\nexport interface PaginationProps\n extends\n Omit<HTMLAttributes<HTMLElement>, \"children\" | \"onChange\">,\n PaginationState {\n /** Total number of matching results, before pagination. */\n totalResults: number;\n /** Emitted once per user change, with both values ready to apply together. */\n onChange: (next: PaginationState) => void;\n /** Nonempty list of positive integers containing the current pageSize. */\n pageSizeOptions?: number[];\n size?: PaginationSize;\n isDisabled?: boolean;\n showLabels?: boolean;\n menuPlacement?: PopoverPlacement;\n}\n\n/** Controlled navigation for a result set. Data loading and slicing belong to the application. */\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(\n function Pagination(\n {\n totalResults,\n page,\n pageSize,\n onChange,\n pageSizeOptions = [10, 25, 50, 100],\n size = \"
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","useId","Button","Select","require_components_Button_index","require_components_Select_index","react","react_jsx_runtime","Pagination","rest","labelId","pageCount","totalResults","pageSize","currentPage","page","disabled","isDisabled","atStart","atEnd","start","end","go","next","nextPage","onChange","size","className","showLabels","pageSizeOptions","value","nextSize","nextPageCount"],"sources":["../../../src/components/Pagination/index.tsx"],"sourcesContent":["import { forwardRef, useId, type HTMLAttributes } from \"react\";\nimport { Button } from \"../Button\";\nimport { Select } from \"../Select\";\nimport type { PopoverPlacement } from \"../Popover\";\nimport \"./style.css\";\n\nexport type PaginationSize = \"sm\" | \"md\";\n\nexport interface PaginationState {\n /** One-based page number. */\n page: number;\n /** Positive integer results per page. */\n pageSize: number;\n}\n\nexport interface PaginationProps\n extends\n Omit<HTMLAttributes<HTMLElement>, \"children\" | \"onChange\">,\n PaginationState {\n /** Total number of matching results, before pagination. */\n totalResults: number;\n /** Emitted once per user change, with both values ready to apply together. */\n onChange: (next: PaginationState) => void;\n /** Nonempty list of positive integers containing the current pageSize. */\n pageSizeOptions?: number[];\n size?: PaginationSize;\n isDisabled?: boolean;\n showLabels?: boolean;\n menuPlacement?: PopoverPlacement;\n}\n\n/** Controlled navigation for a result set. Data loading and slicing belong to the application. */\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(\n function Pagination(\n {\n totalResults,\n page,\n pageSize,\n onChange,\n pageSizeOptions = [10, 25, 50, 100],\n size = \"md\",\n isDisabled = false,\n showLabels = true,\n menuPlacement = \"bottom\",\n className,\n ...rest\n },\n ref,\n ) {\n const labelId = useId();\n const pageCount = Math.max(1, Math.ceil(totalResults / pageSize));\n const currentPage = Math.min(Math.max(1, page), pageCount);\n const disabled = isDisabled || totalResults === 0;\n const atStart = disabled || currentPage === 1;\n const atEnd = disabled || currentPage === pageCount;\n const start = (currentPage - 1) * pageSize + 1;\n const end = Math.min(currentPage * pageSize, totalResults);\n\n const go = (nextPage: number) => {\n const next = Math.min(Math.max(1, nextPage), pageCount);\n if (next !== currentPage) onChange({ page: next, pageSize });\n };\n\n return (\n <nav\n ref={ref}\n aria-label=\"Pagination\"\n data-size={size}\n className={[\"ds-pagination\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n <div className=\"ds-pagination__actions\">\n <Button\n variant=\"neutral\"\n size={size}\n iconStart=\"chevron-left\"\n isIconOnly={!showLabels}\n aria-label=\"Previous page\"\n isDisabled={atStart}\n onClick={() => go(currentPage - 1)}\n >\n Previous\n </Button>\n </div>\n\n <div className=\"ds-pagination__centre\">\n <div className=\"ds-pagination__per-page\">\n <span id={labelId}>Per page</span>\n <div className=\"ds-pagination__select\">\n <Select\n aria-labelledby={labelId}\n value={String(pageSize)}\n options={pageSizeOptions.map((value) => ({\n value: String(value),\n label: String(value),\n }))}\n size={size}\n menuPlacement={menuPlacement}\n isDisabled={\n disabled || totalResults <= Math.min(...pageSizeOptions)\n }\n onValueChange={(value) => {\n const nextSize = Number(value);\n if (nextSize === pageSize) return;\n const nextPage =\n Math.floor(((currentPage - 1) * pageSize) / nextSize) + 1;\n const nextPageCount = Math.max(\n 1,\n Math.ceil(totalResults / nextSize),\n );\n onChange({\n page: Math.min(nextPage, nextPageCount),\n pageSize: nextSize,\n });\n }}\n />\n </div>\n </div>\n <span\n className=\"ds-pagination__range\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {totalResults === 0\n ? \"No results\"\n : `${start.toLocaleString(\"en-US\")}–${end.toLocaleString(\"en-US\")} of ${totalResults.toLocaleString(\"en-US\")}`}\n </span>\n </div>\n\n <div className=\"ds-pagination__actions ds-pagination__actions--next\">\n <Button\n variant=\"neutral\"\n size={size}\n iconStart={showLabels ? undefined : \"chevron-right\"}\n iconEnd={showLabels ? \"chevron-right\" : undefined}\n isIconOnly={!showLabels}\n aria-label=\"Next page\"\n isDisabled={atEnd}\n onClick={() => go(currentPage + 1)}\n >\n Next\n </Button>\n </div>\n </nav>\n );\n },\n);\n"],"mappings":"A,iMAgCA,IAAaQ,GAAA,EAAaR,EAAAA,WAAAA,CACxB,SACE,CACE,eACA,OACA,WACA,WACA,kBAAkB,CAAC,GAAI,GAAI,GAAI,GAAG,EAClC,OAAO,KACP,aAAa,GACb,aAAa,GACb,gBAAgB,SAChB,YACA,GAAGS,GAEL,EACA,CACA,IAAMC,GAAA,EAAUT,EAAAA,MAAAA,CAAM,EAChBU,EAAY,KAAK,IAAI,EAAG,KAAK,KAAKC,EAAeC,CAAQ,CAAC,EAC1DC,EAAc,KAAK,IAAI,KAAK,IAAI,EAAGC,CAAI,EAAGJ,CAAS,EACnDK,EAAWC,GAAcL,IAAiB,EAC1CM,EAAUF,GAAYF,IAAgB,EACtCK,EAAQH,GAAYF,IAAgBH,EACpCS,GAASN,EAAc,GAAKD,EAAW,EACvCQ,EAAM,KAAK,IAAIP,EAAcD,EAAUD,CAAY,EAEnDU,EAAM,GAAqB,CAC/B,IAAMC,EAAO,KAAK,IAAI,KAAK,IAAI,EAAGC,CAAQ,EAAGb,CAAS,EAClDY,IAAST,GAAaW,EAAS,CAAE,KAAMF,EAAM,UAAS,CAAC,CAC7D,EAEA,OACE,EAAAhB,EAAA,KAAA,CAAC,MAAD,CACO,MAC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,CACE,UAAU,uBACV,YAAU,SACV,cAAY,OAEX,SAAAK,IAAiB,EACd,aACA,GAAGQ,EAAM,eAAe,OAAO,EAAE,GAAGC,EAAI,eAAe,OAAO,EAAE,MAAMT,EAAa,eAAe,OAAO,GACzG,CAAA,CACH,C,IAEL,EAAAL,EAAA,IAAA,CAAC,MAAD,CAAK,UAAU,sDACb,UAAA,EAAAA,EAAA,IAAA,CAACL,EAAAA,OAAD,CACE,QAAQ,UACF,OACN,UAAW0B,EAAa,IAAA,GAAY,gBACpC,QAASA,EAAa,gBAAkB,IAAA,GACxC,WAAY,CAACA,EACb,aAAW,YACX,WAAYT,EACZ,YAAeG,EAAGR,EAAc,CAAC,EAClC,SAAA,MAEO,CAAA,CACL,CAAA,CACF,C,EAET,CACF,E"}
|
|
@@ -8,7 +8,7 @@ var o = n(function({ totalResults: n, page: o, pageSize: s, onChange: c, pageSiz
|
|
|
8
8
|
25,
|
|
9
9
|
50,
|
|
10
10
|
100
|
|
11
|
-
], size: u = "
|
|
11
|
+
], size: u = "md", isDisabled: d = !1, showLabels: f = !0, menuPlacement: p = "bottom", className: m, ...h }, g) {
|
|
12
12
|
let _ = r(), v = Math.max(1, Math.ceil(n / s)), y = Math.min(Math.max(1, o), v), b = d || n === 0, x = b || y === 1, S = b || y === v, C = (y - 1) * s + 1, w = Math.min(y * s, n), T = (e) => {
|
|
13
13
|
let t = Math.min(Math.max(1, e), v);
|
|
14
14
|
t !== y && c({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Pagination","forwardRef","rest","labelId","useId","pageCount","totalResults","pageSize","currentPage","page","disabled","isDisabled","atStart","atEnd","start","end","go","next","nextPage","onChange","size","className","Button","showLabels","Select","pageSizeOptions","value","nextSize","nextPageCount"],"sources":["../../../src/components/Pagination/index.tsx"],"sourcesContent":["import { forwardRef, useId, type HTMLAttributes } from \"react\";\nimport { Button } from \"../Button\";\nimport { Select } from \"../Select\";\nimport type { PopoverPlacement } from \"../Popover\";\nimport \"./style.css\";\n\nexport type PaginationSize = \"sm\" | \"md\";\n\nexport interface PaginationState {\n /** One-based page number. */\n page: number;\n /** Positive integer results per page. */\n pageSize: number;\n}\n\nexport interface PaginationProps\n extends\n Omit<HTMLAttributes<HTMLElement>, \"children\" | \"onChange\">,\n PaginationState {\n /** Total number of matching results, before pagination. */\n totalResults: number;\n /** Emitted once per user change, with both values ready to apply together. */\n onChange: (next: PaginationState) => void;\n /** Nonempty list of positive integers containing the current pageSize. */\n pageSizeOptions?: number[];\n size?: PaginationSize;\n isDisabled?: boolean;\n showLabels?: boolean;\n menuPlacement?: PopoverPlacement;\n}\n\n/** Controlled navigation for a result set. Data loading and slicing belong to the application. */\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(\n function Pagination(\n {\n totalResults,\n page,\n pageSize,\n onChange,\n pageSizeOptions = [10, 25, 50, 100],\n size = \"
|
|
1
|
+
{"version":3,"file":"index.js","names":["Pagination","forwardRef","rest","labelId","useId","pageCount","totalResults","pageSize","currentPage","page","disabled","isDisabled","atStart","atEnd","start","end","go","next","nextPage","onChange","size","className","Button","showLabels","Select","pageSizeOptions","value","nextSize","nextPageCount"],"sources":["../../../src/components/Pagination/index.tsx"],"sourcesContent":["import { forwardRef, useId, type HTMLAttributes } from \"react\";\nimport { Button } from \"../Button\";\nimport { Select } from \"../Select\";\nimport type { PopoverPlacement } from \"../Popover\";\nimport \"./style.css\";\n\nexport type PaginationSize = \"sm\" | \"md\";\n\nexport interface PaginationState {\n /** One-based page number. */\n page: number;\n /** Positive integer results per page. */\n pageSize: number;\n}\n\nexport interface PaginationProps\n extends\n Omit<HTMLAttributes<HTMLElement>, \"children\" | \"onChange\">,\n PaginationState {\n /** Total number of matching results, before pagination. */\n totalResults: number;\n /** Emitted once per user change, with both values ready to apply together. */\n onChange: (next: PaginationState) => void;\n /** Nonempty list of positive integers containing the current pageSize. */\n pageSizeOptions?: number[];\n size?: PaginationSize;\n isDisabled?: boolean;\n showLabels?: boolean;\n menuPlacement?: PopoverPlacement;\n}\n\n/** Controlled navigation for a result set. Data loading and slicing belong to the application. */\nexport const Pagination = forwardRef<HTMLElement, PaginationProps>(\n function Pagination(\n {\n totalResults,\n page,\n pageSize,\n onChange,\n pageSizeOptions = [10, 25, 50, 100],\n size = \"md\",\n isDisabled = false,\n showLabels = true,\n menuPlacement = \"bottom\",\n className,\n ...rest\n },\n ref,\n ) {\n const labelId = useId();\n const pageCount = Math.max(1, Math.ceil(totalResults / pageSize));\n const currentPage = Math.min(Math.max(1, page), pageCount);\n const disabled = isDisabled || totalResults === 0;\n const atStart = disabled || currentPage === 1;\n const atEnd = disabled || currentPage === pageCount;\n const start = (currentPage - 1) * pageSize + 1;\n const end = Math.min(currentPage * pageSize, totalResults);\n\n const go = (nextPage: number) => {\n const next = Math.min(Math.max(1, nextPage), pageCount);\n if (next !== currentPage) onChange({ page: next, pageSize });\n };\n\n return (\n <nav\n ref={ref}\n aria-label=\"Pagination\"\n data-size={size}\n className={[\"ds-pagination\", className].filter(Boolean).join(\" \")}\n {...rest}\n >\n <div className=\"ds-pagination__actions\">\n <Button\n variant=\"neutral\"\n size={size}\n iconStart=\"chevron-left\"\n isIconOnly={!showLabels}\n aria-label=\"Previous page\"\n isDisabled={atStart}\n onClick={() => go(currentPage - 1)}\n >\n Previous\n </Button>\n </div>\n\n <div className=\"ds-pagination__centre\">\n <div className=\"ds-pagination__per-page\">\n <span id={labelId}>Per page</span>\n <div className=\"ds-pagination__select\">\n <Select\n aria-labelledby={labelId}\n value={String(pageSize)}\n options={pageSizeOptions.map((value) => ({\n value: String(value),\n label: String(value),\n }))}\n size={size}\n menuPlacement={menuPlacement}\n isDisabled={\n disabled || totalResults <= Math.min(...pageSizeOptions)\n }\n onValueChange={(value) => {\n const nextSize = Number(value);\n if (nextSize === pageSize) return;\n const nextPage =\n Math.floor(((currentPage - 1) * pageSize) / nextSize) + 1;\n const nextPageCount = Math.max(\n 1,\n Math.ceil(totalResults / nextSize),\n );\n onChange({\n page: Math.min(nextPage, nextPageCount),\n pageSize: nextSize,\n });\n }}\n />\n </div>\n </div>\n <span\n className=\"ds-pagination__range\"\n aria-live=\"polite\"\n aria-atomic=\"true\"\n >\n {totalResults === 0\n ? \"No results\"\n : `${start.toLocaleString(\"en-US\")}–${end.toLocaleString(\"en-US\")} of ${totalResults.toLocaleString(\"en-US\")}`}\n </span>\n </div>\n\n <div className=\"ds-pagination__actions ds-pagination__actions--next\">\n <Button\n variant=\"neutral\"\n size={size}\n iconStart={showLabels ? undefined : \"chevron-right\"}\n iconEnd={showLabels ? \"chevron-right\" : undefined}\n isIconOnly={!showLabels}\n aria-label=\"Next page\"\n isDisabled={atEnd}\n onClick={() => go(currentPage + 1)}\n >\n Next\n </Button>\n </div>\n </nav>\n );\n },\n);\n"],"mappings":";;;;;AAgCA,IAAaA,IAAaC,EACxB,SACE,EACE,iBACA,SACA,aACA,aACA,qBAAkB;CAAC;CAAI;CAAI;CAAI;AAAG,GAClC,UAAO,MACP,gBAAa,IACb,gBAAa,IACb,mBAAgB,UAChB,cACA,GAAGC,KAEL,GACA;CACA,IAAMC,IAAUC,EAAM,GAChBC,IAAY,KAAK,IAAI,GAAG,KAAK,KAAKC,IAAeC,CAAQ,CAAC,GAC1DC,IAAc,KAAK,IAAI,KAAK,IAAI,GAAGC,CAAI,GAAGJ,CAAS,GACnDK,IAAWC,KAAcL,MAAiB,GAC1CM,IAAUF,KAAYF,MAAgB,GACtCK,IAAQH,KAAYF,MAAgBH,GACpCS,KAASN,IAAc,KAAKD,IAAW,GACvCQ,IAAM,KAAK,IAAIP,IAAcD,GAAUD,CAAY,GAEnDU,KAAM,MAAqB;EAC/B,IAAMC,IAAO,KAAK,IAAI,KAAK,IAAI,GAAGC,CAAQ,GAAGb,CAAS;EACtD,AAAIY,MAAST,KAAaW,EAAS;GAAE,MAAMF;GAAM;EAAS,CAAC;CAC7D;CAEA,OACE,kBAAC,OAAD;EACO;EACL,cAAW;EACX,aAAWG;EACX,WAAW,CA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;IACb,UAAA,kBAACgB,GAAD;KACE,SAAQ;KACF;KACN,WAAWC,IAAa,KAAA,IAAY;KACpC,SAASA,IAAa,kBAAkB,KAAA;KACxC,YAAY,CAACA;KACb,cAAW;KACX,YAAYV;KACZ,eAAeG,EAAGR,IAAc,CAAC;KAClC,UAAA;IAEO,CAAA;GACL,CAAA;EACF;;AAET,CACF"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});let e=require("react"),t=require("react-dom"),n=require("react/jsx-runtime");function r(...e){return e.filter(Boolean).join(` `)}var i=8;function a({anchorRef:a,anchorId:o,isOpen:s,align:c=`start`,placement:l=`bottom`,matchAnchorWidth:u=!1,offset:d=4,className:f,children:p,role:m,id:h,panelRef:g,..._}){let v=(0,e.useRef)(null),y=(0,e.useId)(),b=h??y,x=(0,e.useCallback)(()=>{let e=a.current??(o?document.getElementById(o):null),t=v.current;if(!e||!t)return;let n=e.getBoundingClientRect();u&&(t.style.width=`${n.width}px`);let r=t.getBoundingClientRect(),s=document.documentElement.clientWidth,f=document.documentElement.clientHeight,p=f-n.bottom-d-i,m=n.top-d-i,h=l===`top`?m>=r.height||m>p:p<r.height&&m>p,g=Math.max(120,h?m:p),_=h?Math.max(i,n.top-d-Math.min(r.height,g)):Math.min(n.bottom+d,f-i),y=c===`end`?n.right-r.width:n.left,b=Math.max(i,Math.min(y,s-r.width-i));t.style.left=`${Math.round(b)}px`,t.style.top=`${Math.round(_)}px`,t.style.setProperty(`--popover-max-block-size`,`${Math.round(g)}px`),t.style.visibility=`visible`},[c,o,a,u,d,l]);if((0,e.useEffect)(()=>{if(!s)return;let e=document.querySelector(`[data-popover-instance="${CSS.escape(y)}"]`);v.current=e,g&&(g.current=e),x();let t=()=>x();return window.addEventListener(`resize`,t),window.addEventListener(`scroll`,t,!0),()=>{window.removeEventListener(`resize`,t),window.removeEventListener(`scroll`,t,!0),v.current=null,g&&(g.current=null)}},[y,s,b,g,x]),!s||typeof document>`u`)return null;let S=(0,n.jsx)(`div`,{id:b,"data-popover-instance":y,role:m,className:r(`ds-popover`,f),..._,children:p});return(0,t.createPortal)(S,document.body)}exports.Popover=a;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["useRef","useId","useCallback","createPortal","react","
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["useRef","useId","useCallback","createPortal","react","react_dom","react_jsx_runtime","cx","parts","VIEWPORT_MARGIN","Popover","rest","floatingRef","generatedId","panelId","id","place","reference","anchorRef","anchorId","floating","anchor","matchAnchorWidth","panel","viewportWidth","viewportHeight","roomBelow","offset","roomAbove","placeAbove","placement","availableHeight","top","preferredLeft","align","left","isOpen","panelRef","update","className"],"sources":["../../../src/components/Popover/index.tsx"],"sourcesContent":["import { useCallback, useEffect, useId, useRef, type ReactNode, type RefObject } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport \"./style.css\";\n\nfunction cx(...parts: (string | undefined | false)[]) {\n return parts.filter(Boolean).join(\" \");\n}\n\nconst VIEWPORT_MARGIN = 8;\n\nexport type PopoverAlign = \"start\" | \"end\";\nexport type PopoverPlacement = \"top\" | \"bottom\";\n\nexport interface PopoverProps {\n /** The control the panel hangs off. */\n anchorRef: RefObject<HTMLElement | null>;\n /** Optional DOM id fallback for composed controls whose refs are consumed by a field wrapper. */\n anchorId?: string;\n isOpen: boolean;\n /** Which edge of the anchor the panel lines up with. Flips when it must. */\n align?: PopoverAlign;\n /** Preferred side of the anchor. Flips when the other side has more room. */\n placement?: PopoverPlacement;\n /** Match the anchor's width — for listboxes that read as one field. */\n matchAnchorWidth?: boolean;\n /** Gap between anchor and panel. */\n offset?: number;\n className?: string;\n children: ReactNode;\n role?: string;\n id?: string;\n \"aria-label\"?: string;\n \"aria-labelledby\"?: string;\n panelRef?: RefObject<HTMLDivElement | null>;\n}\n\n/**\n * A panel anchored to a control. It is positioned against the viewport, so it\n * flips above the anchor when the space below runs out and slides inward\n * rather than being cut off at any edge.\n */\nexport function Popover({\n anchorRef,\n anchorId,\n isOpen,\n align = \"start\",\n placement = \"bottom\",\n matchAnchorWidth = false,\n offset = 4,\n className,\n children,\n role,\n id,\n panelRef,\n ...rest\n}: PopoverProps) {\n const floatingRef = useRef<HTMLDivElement | null>(null);\n const generatedId = useId();\n const panelId = id ?? generatedId;\n\n const place = useCallback(() => {\n const reference = anchorRef.current ?? (anchorId ? document.getElementById(anchorId) : null);\n const floating = floatingRef.current;\n if (!reference || !floating) return;\n\n const anchor = reference.getBoundingClientRect();\n if (matchAnchorWidth) floating.style.width = `${anchor.width}px`;\n const panel = floating.getBoundingClientRect();\n const viewportWidth = document.documentElement.clientWidth;\n const viewportHeight = document.documentElement.clientHeight;\n const roomBelow = viewportHeight - anchor.bottom - offset - VIEWPORT_MARGIN;\n const roomAbove = anchor.top - offset - VIEWPORT_MARGIN;\n const placeAbove = placement === \"top\"\n ? roomAbove >= panel.height || roomAbove > roomBelow\n : roomBelow < panel.height && roomAbove > roomBelow;\n const availableHeight = Math.max(120, placeAbove ? roomAbove : roomBelow);\n const top = placeAbove\n ? Math.max(VIEWPORT_MARGIN, anchor.top - offset - Math.min(panel.height, availableHeight))\n : Math.min(anchor.bottom + offset, viewportHeight - VIEWPORT_MARGIN);\n const preferredLeft = align === \"end\" ? anchor.right - panel.width : anchor.left;\n const left = Math.max(\n VIEWPORT_MARGIN,\n Math.min(preferredLeft, viewportWidth - panel.width - VIEWPORT_MARGIN),\n );\n\n floating.style.left = `${Math.round(left)}px`;\n floating.style.top = `${Math.round(top)}px`;\n floating.style.setProperty(\"--popover-max-block-size\", `${Math.round(availableHeight)}px`);\n floating.style.visibility = \"visible\";\n }, [align, anchorId, anchorRef, matchAnchorWidth, offset, placement]);\n\n useEffect(() => {\n if (!isOpen) return;\n const floating = document.querySelector<HTMLDivElement>(\n `[data-popover-instance=\"${CSS.escape(generatedId)}\"]`,\n );\n floatingRef.current = floating;\n if (panelRef) panelRef.current = floating;\n place();\n const update = () => place();\n window.addEventListener(\"resize\", update);\n window.addEventListener(\"scroll\", update, true);\n return () => {\n window.removeEventListener(\"resize\", update);\n window.removeEventListener(\"scroll\", update, true);\n floatingRef.current = null;\n if (panelRef) panelRef.current = null;\n };\n }, [generatedId, isOpen, panelId, panelRef, place]);\n\n if (!isOpen || typeof document === \"undefined\") return null;\n\n const panel = (\n <div\n id={panelId}\n data-popover-instance={generatedId}\n role={role}\n className={cx(\"ds-popover\", className)}\n {...rest}\n >\n {children}\n </div>\n );\n\n return createPortal(panel, document.body);\n}\n"],"mappings":"A,gJAIA,SAASO,EAAG,GAAGC,EAAuC,CACpD,OAAOA,EAAM,OAAO,OAAO,CAAC,CAAC,KAAK,GAAG,CACvC,CAEA,IAAMC,EAAkB,EAiCxB,SAAgBC,EAAQ,CACtB,YACA,WACA,SACA,QAAQ,QACR,YAAY,SACZ,mBAAmB,GACnB,SAAS,EACT,YACA,WACA,OACA,KACA,WACA,GAAGC,GACY,CACf,IAAMC,GAAA,EAAcZ,EAAAA,OAAAA,CAA8B,IAAI,EAChDa,GAAA,EAAcZ,EAAAA,MAAAA,CAAM,EACpBa,EAAUC,GAAMF,EAEhBG,GAAA,EAAQd,EAAAA,YAAAA,KAAkB,CAC9B,IAAMe,EAAYC,EAAU,UAAYC,EAAW,SAAS,eAAeA,CAAQ,EAAI,MACjFC,EAAWR,EAAY,QAC7B,GAAI,CAACK,GAAa,CAACG,EAAU,OAE7B,IAAMC,EAASJ,EAAU,sBAAsB,EAC3CK,IAAkB,EAAS,MAAM,MAAQ,GAAGD,EAAO,MAAM,KAC7D,IAAME,EAAQH,EAAS,sBAAsB,EACvCI,EAAgB,SAAS,gBAAgB,YACzCC,EAAiB,SAAS,gBAAgB,aAC1CC,EAAYD,EAAiBJ,EAAO,OAASM,EAASlB,EACtDmB,EAAYP,EAAO,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UrB,CAAK,CAAC,EAE9C,CAACoB,GAAU,OAAO,SAAa,IAAa,OAAO,KAEvD,IAAMb,GACJ,EAAAjB,EAAA,IAAA,CAAC,MAAD,CACE,GAAIQ,EACJ,wBAAuBD,EACjB,OACN,UAAWN,EAAG,aAAcgC,CAAS,EACrC,GAAI5B,EAEH,UACE,CAAA,EAGP,OAAA,EAAOR,EAAAA,aAAAA,CAAaoB,EAAO,SAAS,IAAI,CAC1C,C"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useCallback as e, useEffect as t, useId as n, useRef as r } from "react";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import { createPortal as i } from "react-dom";
|
|
3
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
4
4
|
//#region src/components/Popover/index.tsx
|
|
5
5
|
function o(...e) {
|
|
6
6
|
return e.filter(Boolean).join(" ");
|
|
@@ -37,7 +37,7 @@ function c({ anchorRef: c, anchorId: l, isOpen: u, align: d = "start", placement
|
|
|
37
37
|
y,
|
|
38
38
|
w
|
|
39
39
|
]), !u || typeof document > "u") return null;
|
|
40
|
-
let T = /* @__PURE__ */
|
|
40
|
+
let T = /* @__PURE__ */ a("div", {
|
|
41
41
|
id: C,
|
|
42
42
|
"data-popover-instance": S,
|
|
43
43
|
role: _,
|
|
@@ -45,7 +45,7 @@ function c({ anchorRef: c, anchorId: l, isOpen: u, align: d = "start", placement
|
|
|
45
45
|
...b,
|
|
46
46
|
children: g
|
|
47
47
|
});
|
|
48
|
-
return
|
|
48
|
+
return i(T, document.body);
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
51
|
export { c as Popover };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../Field/index.cjs"),require("../TextField/index.cjs");const e=require("../../chunks/RichTextEditor-
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`}),require("../Field/index.cjs"),require("../TextField/index.cjs");const e=require("../../chunks/RichTextEditor-BxtlbjXj.cjs");exports.RichTextEditor=e.t;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/RichTextEditor/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAgE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAS1H,OAAO,EAAuE,KAAK,gBAAgB,EAAE,MAAM,YAAY,CAAC;AACxH,OAAO,oBAAoB,CAAC;AAC5B,OAAO,aAAa,CAAC;AAErB,MAAM,MAAM,kBAAkB,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEpD,YAAY,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAEnD,UAAU,yBAAyB;IACjC,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,IAAI,CAAC,EAAE,kBAAkB,CAAC;IAC1B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,+CAA+C;IAC/C,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,iEAAiE;IACjE,YAAY,CAAC,EAAE,SAAS,CAAC;IACzB,uCAAuC;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,GAAG,CAC1D;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA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C,EAAE,SAAS,CAAC;IACzB,uCAAuC;IACvC,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,cAAc,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CACjD;AAED,MAAM,MAAM,mBAAmB,GAAG,yBAAyB,GAAG,CAC1D;IAAE,MAAM,CAAC,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAA;CAAE,GAC7F;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,CAAC,EAAE,gBAAgB,CAAC;IAAC,YAAY,CAAC,EAAE,gBAAgB,CAAC;IAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,EAAE,gBAAgB,KAAK,IAAI,CAAA;CAAE,CACjI,CAAC;AAgNF;;;GAGG;AACH,eAAO,MAAM,cAAc,gHAkI1B,CAAC"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs");;/* empty css */const
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs"),t=require("../Button/index.cjs");;/* empty css */const n=require("../FieldAffix/index.cjs");let r=require("react"),i=require("react/jsx-runtime");var a=(0,r.forwardRef)(function({size:a=`md`,isDisabled:o=!1,onClear:s,className:c,placeholder:l=`Search`,value:u,disabled:d,onKeyDown:f,...p},m){let h=(0,r.useRef)(null),g=u!==void 0&&String(u).length>0;return(0,i.jsx)(n.FieldAffix,{className:c,lead:(0,i.jsx)(e.t,{name:`search`,size:16}),isTrailInteractive:!0,trail:g&&s?(0,i.jsx)(t.Button,{variant:`simple`,size:`xs`,isIconOnly:!0,iconStart:`x`,"aria-label":`Clear search`,isDisabled:o||d,onClick:()=>{s(),h.current?.focus()}}):void 0,children:(0,i.jsx)(`input`,{ref:e=>{h.current=e,typeof m==`function`?m(e):m&&(m.current=e)},type:`search`,value:u,placeholder:l,disabled:o||d,"data-size":a,className:`ds-field-skin ds-search__input`,onKeyDown:e=>{e.key===`Escape`&&s&&s(),f?.(e)},...p})})});exports.SearchField=a;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":["forwardRef","useRef","FieldAffix","Icon","require_Icon","require_components_FieldAffix_index","react","react_jsx_runtime","SearchField","rest","inner","hasValue","value","onClear","isDisabled","disabled","node","ref","size","event","onKeyDown"],"sources":["../../../src/components/SearchField/index.tsx"],"sourcesContent":["import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { Icon } from \"../Icon\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport interface SearchFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\"> {\n size?: FieldSize;\n isDisabled?: boolean;\n /** Fired by the clear button and by Escape. */\n onClear?: () => void;\n}\n\n/** A filter over a collection. Carries the glyph, and clears without a Save. */\nexport const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(function SearchField(\n {\n size = \"md\",\n isDisabled = false,\n onClear,\n className,\n placeholder = \"Search\",\n value,\n disabled,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const hasValue = value !== undefined ? String(value).length > 0 : false;\n\n return (\n <FieldAffix\n className={className}\n lead={<Icon name=\"search\" size={16} />}\n isTrailInteractive\n trail={\n hasValue && onClear ? (\n <
|
|
1
|
+
{"version":3,"file":"index.cjs","names":["forwardRef","useRef","FieldAffix","Icon","Button","require_Icon","require_components_Button_index","require_components_FieldAffix_index","react","react_jsx_runtime","SearchField","rest","inner","hasValue","value","onClear","isDisabled","disabled","node","ref","size","event","onKeyDown"],"sources":["../../../src/components/SearchField/index.tsx"],"sourcesContent":["import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport interface SearchFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\"> {\n size?: FieldSize;\n isDisabled?: boolean;\n /** Fired by the clear button and by Escape. */\n onClear?: () => void;\n}\n\n/** A filter over a collection. Carries the glyph, and clears without a Save. */\nexport const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(function SearchField(\n {\n size = \"md\",\n isDisabled = false,\n onClear,\n className,\n placeholder = \"Search\",\n value,\n disabled,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const hasValue = value !== undefined ? String(value).length > 0 : false;\n\n return (\n <FieldAffix\n className={className}\n lead={<Icon name=\"search\" size={16} />}\n isTrailInteractive\n trail={\n hasValue && onClear ? (\n <Button\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n iconStart=\"x\"\n aria-label=\"Clear search\"\n isDisabled={isDisabled || disabled}\n onClick={() => {\n onClear();\n inner.current?.focus();\n }}\n />\n ) : undefined\n }\n >\n <input\n ref={(node) => {\n inner.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n type=\"search\"\n value={value}\n placeholder={placeholder}\n disabled={isDisabled || disabled}\n data-size={size}\n className=\"ds-field-skin ds-search__input\"\n onKeyDown={(event) => {\n if (event.key === \"Escape\" && onClear) onClear();\n onKeyDown?.(event);\n }}\n {...rest}\n />\n </FieldAffix>\n );\n});\n"],"mappings":"A,kSAiBA,IAAaU,GAAA,EAAcV,EAAAA,WAAAA,CAA+C,SACxE,CACE,OAAO,KACP,aAAa,GACb,UACA,YACA,cAAc,SACd,QACA,WACA,YACA,GAAGW,GAEL,EACA,CACA,IAAMC,GAAA,EAAQX,EAAAA,OAAAA,CAAgC,IAAI,EAC5CY,EAAWC,IAAU,IAAA,IAAY,OAAOA,CAAK,CAAC,CAAC,OAAS,EAE9D,OACE,EAAAL,EAAA,IAAA,CAACP,EAAAA,WAAD,CACa,YACX,MAAM,EAAAO,EAAA,IAAA,CAACN,EAAAA,EAAD,CAAM,KAAK,SAAS,KAAM,EAAK,CAAA,EACrC,mBAAA,GACA,MACEU,GAAYE,GACV,EAAAN,EAAA,IAAA,CAACL,EAAAA,OAAD,CACE,QAAQ,SACR,KAAK,KACL,WAAA,GACA,UAAU,IACV,aAAW,eACX,WAAYY,GAAcC,EAC1B,YAAe,CACbF,EAAQ,EACRH,EAAM,SAAS,MAAM,CACvB,CACD,CAAA,EACC,IAAA,GAGN,UAAA,EAAAH,EAAA,IAAA,CAAC,QAAD,CACE,IAAM,GAAS,CACb,EAAM,QAAUS,EACZ,OAAOC,GAAQ,WAAYA,EAAID,CAAI,EAC9BC,IAAK,EAAI,QAAUD,EAC9B,EACA,KAAK,SACE,QACM,cACb,SAAUF,GAAcC,EACxB,YAAWG,EACX,UAAU,iCACV,UAAY,GAAU,CAChBC,EAAM,MAAQ,UAAYN,GAASA,EAAQ,EAC/CO,IAAYD,CAAK,CACnB,EACA,GAAIV,CACL,CAAA,CACS,CAAA,CAEhB,CAAC,E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/SearchField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/components/SearchField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAIrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,oBAAoB,CAAC;AAC5B,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,gFAAgF;AAChF,eAAO,MAAM,WAAW,+GA2DtB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SearchField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/SearchField/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,mBAAmB,EAAE,MAAM,OAAO,CAAC;AAIrE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAC1C,OAAO,oBAAoB,CAAC;AAC5B,OAAO,aAAa,CAAC;AAErB,MAAM,WAAW,gBACf,SAAQ,IAAI,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IACpE,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,+CAA+C;IAC/C,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,gFAAgF;AAChF,eAAO,MAAM,WAAW,+GA2DtB,CAAC"}
|
|
@@ -1,49 +1,48 @@
|
|
|
1
1
|
import { t as e } from "../../chunks/Icon-CGY1FNXT.js";
|
|
2
|
+
import { Button as t } from "../Button/index.js";
|
|
2
3
|
/* empty css */
|
|
3
|
-
import { FieldAffix as
|
|
4
|
-
import { forwardRef as
|
|
5
|
-
import { jsx as
|
|
4
|
+
import { FieldAffix as n } from "../FieldAffix/index.js";
|
|
5
|
+
import { forwardRef as r, useRef as i } from "react";
|
|
6
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
6
7
|
//#region src/components/SearchField/index.tsx
|
|
7
|
-
var
|
|
8
|
-
let
|
|
9
|
-
return /* @__PURE__ */
|
|
10
|
-
className:
|
|
11
|
-
lead: /* @__PURE__ */
|
|
8
|
+
var o = r(function({ size: r = "md", isDisabled: o = !1, onClear: s, className: c, placeholder: l = "Search", value: u, disabled: d, onKeyDown: f, ...p }, m) {
|
|
9
|
+
let h = i(null), g = u !== void 0 && String(u).length > 0;
|
|
10
|
+
return /* @__PURE__ */ a(n, {
|
|
11
|
+
className: c,
|
|
12
|
+
lead: /* @__PURE__ */ a(e, {
|
|
12
13
|
name: "search",
|
|
13
14
|
size: 16
|
|
14
15
|
}),
|
|
15
16
|
isTrailInteractive: !0,
|
|
16
|
-
trail:
|
|
17
|
-
|
|
18
|
-
|
|
17
|
+
trail: g && s ? /* @__PURE__ */ a(t, {
|
|
18
|
+
variant: "simple",
|
|
19
|
+
size: "xs",
|
|
20
|
+
isIconOnly: !0,
|
|
21
|
+
iconStart: "x",
|
|
19
22
|
"aria-label": "Clear search",
|
|
20
|
-
|
|
23
|
+
isDisabled: o || d,
|
|
21
24
|
onClick: () => {
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
children: /* @__PURE__ */ i(e, {
|
|
25
|
-
name: "x",
|
|
26
|
-
size: 16
|
|
27
|
-
})
|
|
25
|
+
s(), h.current?.focus();
|
|
26
|
+
}
|
|
28
27
|
}) : void 0,
|
|
29
|
-
children: /* @__PURE__ */
|
|
28
|
+
children: /* @__PURE__ */ a("input", {
|
|
30
29
|
ref: (e) => {
|
|
31
|
-
|
|
30
|
+
h.current = e, typeof m == "function" ? m(e) : m && (m.current = e);
|
|
32
31
|
},
|
|
33
32
|
type: "search",
|
|
34
|
-
value:
|
|
35
|
-
placeholder:
|
|
36
|
-
disabled:
|
|
37
|
-
"data-size":
|
|
33
|
+
value: u,
|
|
34
|
+
placeholder: l,
|
|
35
|
+
disabled: o || d,
|
|
36
|
+
"data-size": r,
|
|
38
37
|
className: "ds-field-skin ds-search__input",
|
|
39
38
|
onKeyDown: (e) => {
|
|
40
|
-
e.key === "Escape" &&
|
|
39
|
+
e.key === "Escape" && s && s(), f?.(e);
|
|
41
40
|
},
|
|
42
|
-
...
|
|
41
|
+
...p
|
|
43
42
|
})
|
|
44
43
|
});
|
|
45
44
|
});
|
|
46
45
|
//#endregion
|
|
47
|
-
export {
|
|
46
|
+
export { o as SearchField };
|
|
48
47
|
|
|
49
48
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","names":["Icon","SearchField","forwardRef","rest","inner","useRef","hasValue","value","FieldAffix","onClear","isDisabled","disabled","node","ref","size","event","onKeyDown"],"sources":["../../../src/components/SearchField/index.tsx"],"sourcesContent":["import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { Icon } from \"../Icon\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport interface SearchFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\"> {\n size?: FieldSize;\n isDisabled?: boolean;\n /** Fired by the clear button and by Escape. */\n onClear?: () => void;\n}\n\n/** A filter over a collection. Carries the glyph, and clears without a Save. */\nexport const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(function SearchField(\n {\n size = \"md\",\n isDisabled = false,\n onClear,\n className,\n placeholder = \"Search\",\n value,\n disabled,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const hasValue = value !== undefined ? String(value).length > 0 : false;\n\n return (\n <FieldAffix\n className={className}\n lead={<Icon name=\"search\" size={16} />}\n isTrailInteractive\n trail={\n hasValue && onClear ? (\n <
|
|
1
|
+
{"version":3,"file":"index.js","names":["Icon","SearchField","forwardRef","rest","inner","useRef","hasValue","value","FieldAffix","onClear","Button","isDisabled","disabled","node","ref","size","event","onKeyDown"],"sources":["../../../src/components/SearchField/index.tsx"],"sourcesContent":["import { forwardRef, useRef, type InputHTMLAttributes } from \"react\";\nimport { Icon } from \"../Icon\";\nimport { Button } from \"../Button\";\nimport { FieldAffix } from \"../FieldAffix\";\nimport type { FieldSize } from \"../Field\";\nimport \"../Field/style.css\";\nimport \"./style.css\";\n\nexport interface SearchFieldProps\n extends Omit<InputHTMLAttributes<HTMLInputElement>, \"size\" | \"type\"> {\n size?: FieldSize;\n isDisabled?: boolean;\n /** Fired by the clear button and by Escape. */\n onClear?: () => void;\n}\n\n/** A filter over a collection. Carries the glyph, and clears without a Save. */\nexport const SearchField = forwardRef<HTMLInputElement, SearchFieldProps>(function SearchField(\n {\n size = \"md\",\n isDisabled = false,\n onClear,\n className,\n placeholder = \"Search\",\n value,\n disabled,\n onKeyDown,\n ...rest\n },\n ref,\n) {\n const inner = useRef<HTMLInputElement | null>(null);\n const hasValue = value !== undefined ? String(value).length > 0 : false;\n\n return (\n <FieldAffix\n className={className}\n lead={<Icon name=\"search\" size={16} />}\n isTrailInteractive\n trail={\n hasValue && onClear ? (\n <Button\n variant=\"simple\"\n size=\"xs\"\n isIconOnly\n iconStart=\"x\"\n aria-label=\"Clear search\"\n isDisabled={isDisabled || disabled}\n onClick={() => {\n onClear();\n inner.current?.focus();\n }}\n />\n ) : undefined\n }\n >\n <input\n ref={(node) => {\n inner.current = node;\n if (typeof ref === \"function\") ref(node);\n else if (ref) ref.current = node;\n }}\n type=\"search\"\n value={value}\n placeholder={placeholder}\n disabled={isDisabled || disabled}\n data-size={size}\n className=\"ds-field-skin ds-search__input\"\n onKeyDown={(event) => {\n if (event.key === \"Escape\" && onClear) onClear();\n onKeyDown?.(event);\n }}\n {...rest}\n />\n </FieldAffix>\n );\n});\n"],"mappings":";;;;;;;AAiBA,IAAaC,IAAcC,EAA+C,SACxE,EACE,UAAO,MACP,gBAAa,IACb,YACA,cACA,iBAAc,UACd,UACA,aACA,cACA,GAAGC,KAEL,GACA;CACA,IAAMC,IAAQC,EAAgC,IAAI,GAC5CC,IAAWC,MAAU,KAAA,KAAY,OAAOA,CAAK,CAAC,CAAC,SAAS;CAE9D,OACE,kBAACC,GAAD;EACa;EACX,MAAM,kBAACR,GAAD;GAAM,MAAK;GAAS,MAAM;EAAK,CAAA;EACrC,oBAAA;EACA,OACEM,KAAYG,IACV,kBAACC,GAAD;GACE,SAAQ;GACR,MAAK;GACL,YAAA;GACA,WAAU;GACV,cAAW;GACX,YAAYC,KAAcC;GAC1B,eAAe;IAEb,AADAH,EAAQ,GACRL,EAAM,SAAS,MAAM;GACvB;EACD,CAAA,IACC,KAAA;EAGN,UAAA,kBAAC,SAAD;GACE,MAAM,MAAS;IAEb,AADA,EAAM,UAAUS,GACZ,OAAOC,KAAQ,aAAYA,EAAID,CAAI,IAC9BC,MAAK,EAAI,UAAUD;GAC9B;GACA,MAAK;GACE;GACM;GACb,UAAUF,KAAcC;GACxB,aAAWG;GACX,WAAU;GACV,YAAY,MAAU;IAEpB,AADIC,EAAM,QAAQ,YAAYP,KAASA,EAAQ,GAC/CQ,IAAYD,CAAK;GACnB;GACA,GAAIb;EACL,CAAA;CACS,CAAA;AAEhB,CAAC"}
|
|
@@ -3,25 +3,4 @@
|
|
|
3
3
|
appearance: none;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.ds-search__clear {
|
|
7
|
-
display: grid;
|
|
8
|
-
place-items: center;
|
|
9
|
-
inline-size: var(--space-6);
|
|
10
|
-
block-size: var(--space-6);
|
|
11
|
-
border: none;
|
|
12
|
-
border-radius: var(--radius-sm);
|
|
13
|
-
background: transparent;
|
|
14
|
-
color: var(--color-text-muted);
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.ds-search__clear:hover {
|
|
19
|
-
background: var(--field-hover);
|
|
20
|
-
color: var(--color-text);
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.ds-search__clear:focus-visible {
|
|
24
|
-
outline: var(--control-border-width) solid var(--color-focus);
|
|
25
|
-
outline-offset: 2px;
|
|
26
|
-
}
|
|
27
6
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs");;/* empty css */const
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require("../../chunks/Icon-CWsA1W83.cjs"),t=require("../Button/index.cjs");;/* empty css */const n=require("../Popover/index.cjs");let r=require("react"),i=require("react/jsx-runtime");function a(...e){return e.filter(Boolean).join(` `)}var o=(0,r.forwardRef)(function({options:o,value:s,defaultValue:c,onValueChange:l,placeholder:u=`Select an option`,size:d=`md`,isDisabled:f=!1,isInvalid:p=!1,menuPlacement:m=`bottom`,className:h,disabled:g,onClick:_,onKeyDown:v,...y},b){let[x,S]=(0,r.useState)(c??``),C=s??x,[w,T]=(0,r.useState)(!1),[E,D]=(0,r.useState)(0),O=(0,r.useRef)(null),k=(0,r.useRef)(null),A=(0,r.useRef)(null),j=(0,r.useId)(),M=f||g,N=w&&!M,P=o.find(e=>e.value===C),F=o.filter(e=>!e.isDisabled),I=(0,r.useCallback)(e=>{s===void 0&&S(e),l?.(e),T(!1)},[l,s]);(0,r.useEffect)(()=>{if(!N)return;let e=o.findIndex(e=>e.value===C&&!e.isDisabled);D(e<0?o.indexOf(F[0]):e);let t=e=>{let t=e.target;!O.current?.contains(t)&&!A.current?.contains(t)&&T(!1)};return document.addEventListener(`mousedown`,t),()=>document.removeEventListener(`mousedown`,t)},[N]),(0,r.useEffect)(()=>{N&&(A.current?.querySelectorAll(`[role='option']`)[E])?.scrollIntoView({block:`nearest`})},[E,N]);let L=e=>{let t=o.map((e,t)=>({option:e,index:t})).filter(e=>!e.option.isDisabled);if(t.length===0)return;let n=t[(t.findIndex(e=>e.index===E)+e+t.length)%t.length];D(n.index)},R=e=>{switch(e.key){case`Escape`:e.preventDefault(),T(!1),k.current?.focus();break;case`Tab`:T(!1);break;case`ArrowDown`:case`ArrowUp`:e.preventDefault(),L(e.key===`ArrowDown`?1:-1);break;case`Home`:case`End`:{e.preventDefault();let t=e.key===`Home`?F[0]:F[F.length-1];t&&D(o.indexOf(t));break}case`Enter`:case` `:{e.preventDefault();let t=o[E];t&&!t.isDisabled&&I(t.value);break}}},z=e=>{M||(N?R(e):[`ArrowDown`,`ArrowUp`,`Enter`,` `].includes(e.key)&&(e.preventDefault(),T(!0)))};return(0,i.jsxs)(`div`,{className:`ds-select-root`,ref:O,children:[(0,i.jsxs)(t.Button,{ref:e=>{k.current=e,typeof b==`function`?b(e):b&&(b.current=e)},size:d,role:`combobox`,"aria-haspopup":`listbox`,"aria-expanded":N,"aria-controls":N?j:void 0,"aria-activedescendant":N&&o[E]&&!o[E].isDisabled?`${j}-option-${E}`:void 0,"aria-invalid":p||void 0,isDisabled:M,"data-placeholder":P?void 0:``,className:a(`ds-field-skin`,`ds-select`,h),onClick:e=>{_?.(e),e.defaultPrevented||T(e=>!e)},onKeyDown:e=>{v?.(e),e.defaultPrevented||z(e)},...y,children:[(0,i.jsx)(`span`,{className:`ds-select__value`,children:P?P.label:u}),(0,i.jsx)(e.t,{name:`chevron-down`,size:16,className:`ds-select__chevron`})]}),(0,i.jsx)(n.Popover,{anchorRef:k,isOpen:N,placement:m,matchAnchorWidth:!0,panelRef:A,id:j,role:`listbox`,"aria-label":y[`aria-labelledby`]?void 0:y[`aria-label`]??u,"aria-labelledby":y[`aria-labelledby`],className:`ds-surface-raised ds-select__menu`,children:(0,i.jsx)(`div`,{onKeyDown:z,onPointerDown:e=>e.preventDefault(),children:o.map((n,r)=>(0,i.jsxs)(t.Button,{variant:r===E?`active`:`simple`,size:`sm`,isDisabled:n.isDisabled,tabIndex:-1,id:`${j}-option-${r}`,role:`option`,"aria-selected":n.value===C,"aria-disabled":n.isDisabled||void 0,"data-active":r===E||void 0,className:`ds-select__option`,onMouseEnter:()=>!n.isDisabled&&D(r),onClick:()=>{n.isDisabled||(I(n.value),k.current?.focus())},children:[(0,i.jsxs)(`span`,{className:`ds-select__option-body`,children:[(0,i.jsx)(`span`,{className:`ds-select__option-label`,children:n.label}),n.description&&(0,i.jsx)(`span`,{className:`ds-select__option-description`,children:n.description})]}),n.value===C&&(0,i.jsx)(e.t,{name:`check`,size:16})]},n.value))})})]})});exports.Select=o;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|