@cloudflare/kumo 2.15.0 → 2.16.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.
Files changed (40) hide show
  1. package/CHANGELOG.md +19 -0
  2. package/ai/component-registry.json +16 -4
  3. package/ai/component-registry.md +44 -1
  4. package/ai/schemas.ts +4 -3
  5. package/dist/.build-complete +1 -1
  6. package/dist/ai/schemas.d.ts +2 -0
  7. package/dist/ai/schemas.js +1 -0
  8. package/dist/chunks/{autocomplete-kgp17p6oz4pczxt9.js → autocomplete-ht782okfv7nv75mq.js} +1 -1
  9. package/dist/chunks/{chart-foxl6xbubuoshfcs.js → chart-hp3vqwe49tbyywqm.js} +17 -6
  10. package/dist/chunks/{clipboard-text-bhy88tgvk1o6wmyl.js → clipboard-text-c0ad6lzyxauxduv1.js} +1 -1
  11. package/dist/chunks/{combobox-hwrq8etkr7p2id0x.js → combobox-kgf0gmniahm15n81.js} +1 -1
  12. package/dist/chunks/{input-group-n08mcd8b36wbylro.js → input-group-hc2qp3m6gsfomqvr.js} +1 -1
  13. package/dist/chunks/{input-ksy1w6j1m6olz6ck.js → input-jk86hoj6nqfhl5u8.js} +1 -1
  14. package/dist/chunks/{input-il37wjigy2xtgdo2.js → input-jsnp6etq7rbjjj9e.js} +1 -1
  15. package/dist/chunks/{pagination-h24on80p2z5ugqdb.js → pagination-nyknrk1lyexwgyrx.js} +25 -23
  16. package/dist/chunks/{select-ey03k4630uckf1rk.js → select-owq85889zm4y23ws.js} +1 -1
  17. package/dist/chunks/{sensitive-input-lfrrtyg9n5ulq3tb.js → sensitive-input-nzwvjuwlpb51ze04.js} +1 -1
  18. package/dist/chunks/{tag-input-b10gfxoob9vcizpm.js → tag-input-fjfzlsaxmnqee7dk.js} +35 -19
  19. package/dist/chunks/{toolbar-hov6sa3ui366f447.js → toolbar-l9laewk5jvf4u0si.js} +2 -2
  20. package/dist/code.js +3 -3
  21. package/dist/components/autocomplete.js +1 -1
  22. package/dist/components/chart.d.ts +1 -1
  23. package/dist/components/chart.js +1 -1
  24. package/dist/components/clipboard-text.js +1 -1
  25. package/dist/components/combobox.js +1 -1
  26. package/dist/components/input-group.js +1 -1
  27. package/dist/components/input.js +3 -3
  28. package/dist/components/pagination.js +1 -1
  29. package/dist/components/select.js +1 -1
  30. package/dist/components/sensitive-input.js +1 -1
  31. package/dist/components/tag-input.d.ts +1 -1
  32. package/dist/components/tag-input.js +1 -1
  33. package/dist/components/toolbar.js +1 -1
  34. package/dist/{index-CiwC1j1N.d.ts → index-2jvVmJ8P.d.ts} +9 -0
  35. package/dist/index-DhOvcB0m.d.ts +60 -0
  36. package/dist/{index-fsZE0vPs.d.ts → index-g-eFm1Bq.d.ts} +2 -0
  37. package/dist/index.d.ts +2 -2
  38. package/dist/index.js +12 -12
  39. package/dist/styles/kumo-standalone.css +1 -1
  40. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -1,5 +1,24 @@
1
1
  # @cloudflare/kumo
2
2
 
3
+ ## 2.16.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 810d820: Add the `xAxisHideLabelOverlap` prop to `TimeseriesChart`, defaulting to `true`.
8
+
9
+ ### Patch Changes
10
+
11
+ - 99b17fb: Match CodeHighlighted loading and error fallback styling to highlighted code. Reset host app backgrounds, borders, and pre border radii to keep the frame and spacing consistent while syntax colors load.
12
+ - 6a093a5: Fix disabled `Input` text color. It used an undefined `text-kumo-disabled` token, so disabled inputs looked the same as enabled ones. It now uses `text-kumo-inactive`.
13
+ - e16f41f: Fix `Pagination` page validation. The page input only accepts whole numbers written as digits, so it no longer calls `setPage` with `NaN`, fractions, or values like `0x10` and `1e1`. Invalid input now restores the current page. With `totalCount={0}`, or when `page` is past the last page, Next and Last are disabled and nothing requests page 0.
14
+ - fedc8a7: Fix three `TagInput` bugs:
15
+
16
+ - `readOnly` now prevents all value changes. Tags can no longer be removed with their remove buttons or Backspace, and new tags can't be added by typing, pasting, or blurring.
17
+ - Pasting comma- or newline-separated text now merges it with the draft text and replaces the current selection before splitting it into tags. Previously, text you were already typing was lost.
18
+ - Native forms now submit the accepted tags. With `name`, each tag is submitted as its own form value, so the empty draft is no longer sent. With `required`, validation passes as soon as there is at least one tag.
19
+
20
+ - 947065a: Fix `TimeseriesChart` crashing with `RangeError: Maximum call stack size exceeded` on large datasets. Marker clustering no longer spreads every timestamp into `Math.max`/`Math.min`, and is skipped entirely when the chart has no markers.
21
+
3
22
  ## 2.15.0
4
23
 
5
24
  ### Minor Changes
@@ -4253,7 +4253,8 @@
4253
4253
  "ring-kumo-danger",
4254
4254
  "ring-kumo-focus",
4255
4255
  "ring-kumo-line",
4256
- "text-kumo-default"
4256
+ "text-kumo-default",
4257
+ "text-kumo-inactive"
4257
4258
  ],
4258
4259
  "styling": {
4259
4260
  "dimensions": {
@@ -5087,6 +5088,7 @@
5087
5088
  "<Pagination\n text={() => `Page ${page}`}\n page={page}\n setPage={setPage}\n hasNextPage={hasNextPage}\n />",
5088
5089
  "<Pagination\n page={page}\n setPage={setPage}\n perPage={10}\n totalCount={100}\n controls=\"full\"\n />",
5089
5090
  "<Pagination page={page} setPage={setPage} perPage={10} totalCount={100} />",
5091
+ "<Pagination page={page} setPage={setPage} perPage={10} totalCount={0} />",
5090
5092
  "<Pagination page={page} setPage={setPage} perPage={25} totalCount={1250} />",
5091
5093
  "<Pagination\n text={({ perPage }: { perPage?: number }) =>\n `Page ${page} - showing ${perPage} per page`\n }\n page={page}\n setPage={setPage}\n perPage={25}\n totalCount={100}\n />",
5092
5094
  "<Pagination\n page={page}\n setPage={setPage}\n perPage={perPage}\n totalCount={500}\n >\n <Pagination.Info />\n <Pagination.Separator />\n <Pagination.PageSize\n value={perPage}\n onChange={(size) => {\n setPerPage(size);\n setPage(1);\n }}\n />\n <Pagination.Controls />\n </Pagination>",
@@ -7383,7 +7385,8 @@
7383
7385
  },
7384
7386
  "name": {
7385
7387
  "type": "string",
7386
- "optional": true
7388
+ "optional": true,
7389
+ "description": "Submits each accepted tag as a separate form value under this name."
7387
7390
  },
7388
7391
  "placeholder": {
7389
7392
  "type": "string",
@@ -7391,11 +7394,13 @@
7391
7394
  },
7392
7395
  "readOnly": {
7393
7396
  "type": "boolean",
7394
- "optional": true
7397
+ "optional": true,
7398
+ "description": "Prevents adding or removing tags while keeping the input focusable."
7395
7399
  },
7396
7400
  "required": {
7397
7401
  "type": "boolean",
7398
- "optional": true
7402
+ "optional": true,
7403
+ "description": "Requires at least one accepted tag for native form validation. Like a native input, a `readOnly` TagInput is skipped by validation."
7399
7404
  },
7400
7405
  "type": {
7401
7406
  "type": "React.HTMLInputTypeAttribute",
@@ -7480,6 +7485,8 @@
7480
7485
  "<TagInput\n label=\"Recipients\"\n description=\"Paste comma- or newline-separated email addresses.\"\n placeholder=\"name@example.com\"\n autoComplete=\"off\"\n value={recipients}\n onValueChange={setRecipients}\n validateValue={(value) => /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)}\n />",
7481
7486
  "<TagInput\n defaultValue={[\"frontend\", \"priority\"]}\n label=\"Labels\"\n description=\"Accepts any non-empty value.\"\n placeholder=\"Add a label\"\n />",
7482
7487
  "<TagInput\n defaultValue={[\"alpha\"]}\n label=\"Access groups\"\n maxValues={3}\n description=\"A maximum of three groups.\"\n placeholder=\"Type a group name\"\n />",
7488
+ "<form\n className=\"flex w-full max-w-md flex-col gap-3\"\n onSubmit={(event) => {\n event.preventDefault();\n const data = new FormData(event.currentTarget);\n setSubmitted(data.getAll(\"topics\").map(String));\n }}\n >\n <TagInput\n name=\"topics\"\n required\n label=\"Topics\"\n description=\"Add at least one topic, then submit.\"\n placeholder=\"Add a topic\"\n />\n <div className=\"flex items-center gap-3\">\n <Button type=\"submit\" variant=\"primary\">\n Submit\n </Button>\n {submitted ? (\n <code className=\"text-sm text-kumo-subtle\">\n topics: {JSON.stringify(submitted)}\n </code>\n ) : null}\n </div>\n </form>",
7489
+ "<TagInput\n readOnly\n defaultValue={[\"billing\", \"dns\", \"workers\"]}\n label=\"Assigned teams\"\n description=\"Managed by your organization's administrator.\"\n />",
7483
7490
  "<TagInput\n defaultValue={[\"uno\"]}\n label=\"Etiquetas\"\n labels={{\n input: \"Agregar etiqueta\",\n removeValue: (value) => `Eliminar ${value}`,\n invalidValue: (value) => `${value} no es valido.`,\n maxValuesReached: (maxValues) => `Maximo de ${maxValues} etiquetas.`,\n }}\n maxValues={3}\n placeholder=\"Agregar una etiqueta\"\n />"
7484
7491
  ],
7485
7492
  "colors": [
@@ -7690,6 +7697,11 @@
7690
7697
  "optional": true,
7691
7698
  "description": "Number of ticks to display on the x-axis"
7692
7699
  },
7700
+ "xAxisHideLabelOverlap": {
7701
+ "type": "boolean",
7702
+ "optional": true,
7703
+ "description": "Whether overlapping x-axis labels are automatically hidden. Defaults to `true`."
7704
+ },
7693
7705
  "xAxisTickFormat": {
7694
7706
  "type": "(value: number) => string",
7695
7707
  "optional": true,
@@ -5001,7 +5001,7 @@ Input component
5001
5001
 
5002
5002
  **Colors (kumo tokens used):**
5003
5003
 
5004
- `bg-kumo-control`, `ring-kumo-danger`, `ring-kumo-focus`, `ring-kumo-line`, `text-kumo-default`
5004
+ `bg-kumo-control`, `ring-kumo-danger`, `ring-kumo-focus`, `ring-kumo-line`, `text-kumo-default`, `text-kumo-inactive`
5005
5005
 
5006
5006
  **Styling:**
5007
5007
 
@@ -10683,9 +10683,12 @@ TagInput component
10683
10683
  - `height`: number | string
10684
10684
  - `list`: string
10685
10685
  - `name`: string
10686
+ Submits each accepted tag as a separate form value under this name.
10686
10687
  - `placeholder`: string
10687
10688
  - `readOnly`: boolean
10689
+ Prevents adding or removing tags while keeping the input focusable.
10688
10690
  - `required`: boolean
10691
+ Requires at least one accepted tag for native form validation. Like a native input, a `readOnly` TagInput is skipped by validation.
10689
10692
  - `type`: React.HTMLInputTypeAttribute
10690
10693
  - `width`: number | string
10691
10694
  - `className`: string
@@ -10747,6 +10750,44 @@ TagInput component
10747
10750
  />
10748
10751
  ```
10749
10752
 
10753
+ ```tsx
10754
+ <form
10755
+ className="flex w-full max-w-md flex-col gap-3"
10756
+ onSubmit={(event) => {
10757
+ event.preventDefault();
10758
+ const data = new FormData(event.currentTarget);
10759
+ setSubmitted(data.getAll("topics").map(String));
10760
+ }}
10761
+ >
10762
+ <TagInput
10763
+ name="topics"
10764
+ required
10765
+ label="Topics"
10766
+ description="Add at least one topic, then submit."
10767
+ placeholder="Add a topic"
10768
+ />
10769
+ <div className="flex items-center gap-3">
10770
+ <Button type="submit" variant="primary">
10771
+ Submit
10772
+ </Button>
10773
+ {submitted ? (
10774
+ <code className="text-sm text-kumo-subtle">
10775
+ topics: {JSON.stringify(submitted)}
10776
+ </code>
10777
+ ) : null}
10778
+ </div>
10779
+ </form>
10780
+ ```
10781
+
10782
+ ```tsx
10783
+ <TagInput
10784
+ readOnly
10785
+ defaultValue={["billing", "dns", "workers"]}
10786
+ label="Assigned teams"
10787
+ description="Managed by your organization's administrator."
10788
+ />
10789
+ ```
10790
+
10750
10791
  ```tsx
10751
10792
  <TagInput
10752
10793
  defaultValue={["uno"]}
@@ -10914,6 +10955,8 @@ TimeseriesChart — a time-series line or bar chart.
10914
10955
  Label for the x-axis (time axis)
10915
10956
  - `xAxisTickCount`: number
10916
10957
  Number of ticks to display on the x-axis
10958
+ - `xAxisHideLabelOverlap`: boolean
10959
+ Whether overlapping x-axis labels are automatically hidden. Defaults to `true`.
10917
10960
  - `xAxisTickFormat`: (value: number) => string
10918
10961
  Custom formatter for x-axis tick labels. Receives the raw timestamp in milliseconds and returns a display string, overriding ECharts' built-in time formatting.
10919
10962
  - `yAxisTickFormat`: (value: number) => string
package/ai/schemas.ts CHANGED
@@ -962,10 +962,10 @@ export const TagInputPropsSchema = z.object({
962
962
  checked: z.boolean().optional(),
963
963
  height: z.unknown().optional(),
964
964
  list: z.string().optional(),
965
- name: z.string().optional(),
965
+ name: z.string().optional(), // Submits each accepted tag as a separate form value under this name.
966
966
  placeholder: z.string().optional(),
967
- readOnly: z.boolean().optional(),
968
- required: z.boolean().optional(),
967
+ readOnly: z.boolean().optional(), // Prevents adding or removing tags while keeping the input focusable.
968
+ required: z.boolean().optional(), // Requires at least one accepted tag for native form validation. Like a native input, a `readOnly` TagInput is skipped by validation.
969
969
  type: z.unknown().optional(),
970
970
  width: z.unknown().optional(),
971
971
  className: z.string().optional(),
@@ -1002,6 +1002,7 @@ export const TimeseriesChartPropsSchema = z.object({
1002
1002
  thresholds: z.array(z.unknown()).optional(), // Horizontal threshold lines rendered on the value axis.
1003
1003
  xAxisName: z.string().optional(), // Label for the x-axis (time axis)
1004
1004
  xAxisTickCount: z.number().optional(), // Number of ticks to display on the x-axis
1005
+ xAxisHideLabelOverlap: z.boolean().optional(), // Whether overlapping x-axis labels are automatically hidden. Defaults to `true`.
1005
1006
  xAxisTickFormat: z.unknown().optional(), // Custom formatter for x-axis tick labels. Receives the raw timestamp in milliseconds and returns a display string, overriding ECharts' built-in time formatting.
1006
1007
  yAxisTickFormat: z.unknown().optional(), // Custom formatter for y-axis tick labels. Receives the raw value and returns a display string. When omitted, ECharts' built-in formatter is used.
1007
1008
  yAxisTickLabelFormat: z.unknown().optional(),
@@ -1 +1 @@
1
- 1792421209932
1
+ 1793034911517
@@ -1448,6 +1448,7 @@ export declare const TimeseriesChartPropsSchema: z.ZodObject<{
1448
1448
  thresholds: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
1449
1449
  xAxisName: z.ZodOptional<z.ZodString>;
1450
1450
  xAxisTickCount: z.ZodOptional<z.ZodNumber>;
1451
+ xAxisHideLabelOverlap: z.ZodOptional<z.ZodBoolean>;
1451
1452
  xAxisTickFormat: z.ZodOptional<z.ZodUnknown>;
1452
1453
  yAxisTickFormat: z.ZodOptional<z.ZodUnknown>;
1453
1454
  yAxisTickLabelFormat: z.ZodOptional<z.ZodUnknown>;
@@ -2934,6 +2935,7 @@ export declare const ComponentPropsSchemas: {
2934
2935
  thresholds: z.ZodOptional<z.ZodArray<z.ZodUnknown>>;
2935
2936
  xAxisName: z.ZodOptional<z.ZodString>;
2936
2937
  xAxisTickCount: z.ZodOptional<z.ZodNumber>;
2938
+ xAxisHideLabelOverlap: z.ZodOptional<z.ZodBoolean>;
2937
2939
  xAxisTickFormat: z.ZodOptional<z.ZodUnknown>;
2938
2940
  yAxisTickFormat: z.ZodOptional<z.ZodUnknown>;
2939
2941
  yAxisTickLabelFormat: z.ZodOptional<z.ZodUnknown>;
@@ -5656,6 +5656,7 @@ const TimeseriesChartPropsSchema = object({
5656
5656
  thresholds: array(unknown()).optional(),
5657
5657
  xAxisName: string().optional(),
5658
5658
  xAxisTickCount: number().optional(),
5659
+ xAxisHideLabelOverlap: boolean().optional(),
5659
5660
  xAxisTickFormat: unknown().optional(),
5660
5661
  yAxisTickFormat: unknown().optional(),
5661
5662
  yAxisTickLabelFormat: unknown().optional(),
@@ -2,7 +2,7 @@
2
2
  import { t as cn } from "./vendor-styling-gs32v7xt5znc8kg0.js";
3
3
  import { t as resolveVariant } from "./resolve-variant-l6x5ksfrjtu4m66l.js";
4
4
  import { t as Field } from "./field-jzzlgre0jmrr38o2.js";
5
- import { n as KUMO_INPUT_VARIANTS, r as inputVariants } from "./input-ksy1w6j1m6olz6ck.js";
5
+ import { n as KUMO_INPUT_VARIANTS, r as inputVariants } from "./input-jk86hoj6nqfhl5u8.js";
6
6
  import { a as ComboboxGroupLabel, c as ComboboxCollection, l as ComboboxInput, o as ComboboxGroup, s as ComboboxList, t as ComboboxEmpty, w as useCoreFilter } from "./ComboboxEmpty-gkt1y5b81a4983v7.js";
7
7
  import { n as ComboboxPositioner, r as ComboboxPortal, t as ComboboxPopup } from "./ComboboxPopup-n8cbgys9st446j1i.js";
8
8
  import { n as AutocompleteRoot, t as AutocompleteItem } from "./AutocompleteItem-36ysm5nwbsd0snr6.js";
@@ -352,8 +352,16 @@ function clusterTimeseriesMarkers(markers, interval) {
352
352
  });
353
353
  }
354
354
  function getApproximateMarkerClusterInterval(timestamps, tickCount) {
355
- if (timestamps.length < 2) return 0;
356
- return (Math.max(...timestamps) - Math.min(...timestamps)) / tickCount;
355
+ let min = Infinity;
356
+ let max = -Infinity;
357
+ let count = 0;
358
+ for (const timestamp of timestamps) {
359
+ if (timestamp < min) min = timestamp;
360
+ if (timestamp > max) max = timestamp;
361
+ count++;
362
+ }
363
+ if (count < 2) return 0;
364
+ return (max - min) / tickCount;
357
365
  }
358
366
  function getTimeseriesMarkerFromEvent(params) {
359
367
  if (params.componentType !== "markLine") return;
@@ -539,7 +547,7 @@ const DEFAULT_X_AXIS_TICK_COUNT = 5;
539
547
  * />
540
548
  * ```
541
549
  */
542
- const TimeseriesChart = forwardRef(function TimeseriesChart({ echarts, type = "line", data, markers, thresholds, xAxisName, xAxisTickCount, xAxisTickFormat, yAxisTickFormat, yAxisTickLabelFormat, yAxisName, yAxisTickCount, yAxisMinInterval, tooltipValueFormat, tooltipTimestampFormat, tooltipFooter, onTimeRangeChange, height = 350, incomplete, enableLegendSelection = false, isDarkMode, gradient, loading, ariaDescription, optionUpdateBehavior, tooltipMode = "all", tooltipMaxItems = 10, tooltipFollowCursor = "both", tooltipBoundary }, ref) {
550
+ const TimeseriesChart = forwardRef(function TimeseriesChart({ echarts, type = "line", data, markers, thresholds, xAxisName, xAxisTickCount, xAxisHideLabelOverlap = true, xAxisTickFormat, yAxisTickFormat, yAxisTickLabelFormat, yAxisName, yAxisTickCount, yAxisMinInterval, tooltipValueFormat, tooltipTimestampFormat, tooltipFooter, onTimeRangeChange, height = 350, incomplete, enableLegendSelection = false, isDarkMode, gradient, loading, ariaDescription, optionUpdateBehavior, tooltipMode = "all", tooltipMaxItems = 10, tooltipFollowCursor = "both", tooltipBoundary }, ref) {
543
551
  const chartRef = useRef(null);
544
552
  const containerRef = useRef(null);
545
553
  const mergedRef = useCallback((instance) => {
@@ -612,7 +620,7 @@ const TimeseriesChart = forwardRef(function TimeseriesChart({ echarts, type = "l
612
620
  };
613
621
  const thresholdAnnotations = buildTimeseriesThresholdAnnotations(thresholds);
614
622
  const thresholdExtent = getThresholdValueExtent(thresholds);
615
- const markerAnnotations = buildTimeseriesMarkerAnnotations(clusterTimeseriesMarkers(markers, getApproximateMarkerClusterInterval(getTimestamps(data, markers), xAxisTickCount ?? DEFAULT_X_AXIS_TICK_COUNT)), {
623
+ const markerAnnotations = buildTimeseriesMarkerAnnotations(markers?.length ? clusterTimeseriesMarkers(markers, getApproximateMarkerClusterInterval(getTimestamps(data, markers), xAxisTickCount ?? DEFAULT_X_AXIS_TICK_COUNT)) : [], {
616
624
  color: markerColor,
617
625
  labelBackgroundColor: markerLabelBackgroundColor
618
626
  });
@@ -701,6 +709,7 @@ const TimeseriesChart = forwardRef(function TimeseriesChart({ echarts, type = "l
701
709
  splitNumber: xAxisTickCount ?? DEFAULT_X_AXIS_TICK_COUNT,
702
710
  axisLabel: {
703
711
  color: axisTextColor,
712
+ hideOverlap: xAxisHideLabelOverlap,
704
713
  ...xAxisTickFormat && { formatter: (value) => xAxisTickFormat(value) }
705
714
  }
706
715
  },
@@ -743,6 +752,7 @@ const TimeseriesChart = forwardRef(function TimeseriesChart({ echarts, type = "l
743
752
  data,
744
753
  xAxisName,
745
754
  xAxisTickCount,
755
+ xAxisHideLabelOverlap,
746
756
  xAxisTickFormat,
747
757
  yAxisTickFormat,
748
758
  yAxisName,
@@ -924,8 +934,9 @@ function findNearest(data, ts) {
924
934
  if (lo > 0 && Math.abs(data[lo - 1][0] - ts) < Math.abs(data[lo][0] - ts)) lo--;
925
935
  return data[lo][1];
926
936
  }
927
- function getTimestamps(data, markers) {
928
- return [...data.flatMap((series) => series.data.map(([timestamp]) => timestamp)), ...markers?.map((marker) => marker.timestamp) ?? []];
937
+ function* getTimestamps(data, markers) {
938
+ for (const series of data) for (const [timestamp] of series.data) yield timestamp;
939
+ for (const marker of markers) yield marker.timestamp;
929
940
  }
930
941
  function getAllTooltipRowsAtTimestamp(data, ts, legendSelected) {
931
942
  const seenNames = /* @__PURE__ */ new Set();
@@ -5,7 +5,7 @@ import { a as TooltipTrigger, i as TooltipPortal, n as TooltipPositioner, s as T
5
5
  import { t as TooltipProvider } from "./TooltipProvider-hyans0ens4axh1y8.js";
6
6
  import { t as Button } from "./button-oxy32x5w9x9az80g.js";
7
7
  import { a as ToastDescription, h as ToastProvider, l as ToastRoot, n as useToastManager, p as ToastViewport, r as ToastPositioner, t as createToastManager } from "./createToastManager-cxjmn4jx3ejh85fs.js";
8
- import { r as inputVariants } from "./input-ksy1w6j1m6olz6ck.js";
8
+ import { r as inputVariants } from "./input-jk86hoj6nqfhl5u8.js";
9
9
  import { forwardRef, useCallback, useEffect, useRef, useState } from "react";
10
10
  import { jsx, jsxs } from "react/jsx-runtime";
11
11
  import { CheckIcon, CopyIcon } from "@phosphor-icons/react";
@@ -2,7 +2,7 @@
2
2
  import { t as cn } from "./vendor-styling-gs32v7xt5znc8kg0.js";
3
3
  import { n as usePortalContainer } from "./portal-provider-eveknxf26oudn7pp.js";
4
4
  import { t as Field } from "./field-jzzlgre0jmrr38o2.js";
5
- import { n as KUMO_INPUT_VARIANTS, r as inputVariants } from "./input-ksy1w6j1m6olz6ck.js";
5
+ import { n as KUMO_INPUT_VARIANTS, r as inputVariants } from "./input-jk86hoj6nqfhl5u8.js";
6
6
  import { C as useComboboxFilter, a as ComboboxGroupLabel, c as ComboboxCollection, l as ComboboxInput, n as ComboboxItem, o as ComboboxGroup, s as ComboboxList, t as ComboboxEmpty } from "./ComboboxEmpty-gkt1y5b81a4983v7.js";
7
7
  import { a as ComboboxItemIndicator, i as ComboboxChips, n as ComboboxChipRemove, o as ComboboxValue, r as ComboboxChip, s as ComboboxRoot, t as createComboboxItems } from "./createItems-n07tfwx89cdoar18.js";
8
8
  import { n as ComboboxIcon, r as ComboboxTrigger, t as ComboboxClear } from "./ComboboxClear-ioejwvtnmqanph88.js";
@@ -3,7 +3,7 @@ import { t as cn } from "./vendor-styling-gs32v7xt5znc8kg0.js";
3
3
  import { t as Tooltip } from "./tooltip-lguwh8bjhxwnjfus.js";
4
4
  import { t as Button$1 } from "./button-oxy32x5w9x9az80g.js";
5
5
  import { t as Field } from "./field-jzzlgre0jmrr38o2.js";
6
- import { r as inputVariants, t as Input$1 } from "./input-ksy1w6j1m6olz6ck.js";
6
+ import { r as inputVariants, t as Input$1 } from "./input-jk86hoj6nqfhl5u8.js";
7
7
  import React, { Children, cloneElement, createContext, forwardRef, isValidElement, useContext, useId, useMemo } from "react";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
9
9
  //#region src/components/input-group/context.ts
@@ -42,7 +42,7 @@ const KUMO_INPUT_DEFAULT_VARIANTS = {
42
42
  variant: "default"
43
43
  };
44
44
  function inputVariants({ variant = KUMO_INPUT_DEFAULT_VARIANTS.variant, size = KUMO_INPUT_DEFAULT_VARIANTS.size, parentFocusIndicator = false, focusIndicator = false } = {}) {
45
- return cn("border-0 bg-kumo-control text-kumo-default ring ring-kumo-line outline-none focus:outline-none", "kumo-input-placeholder disabled:text-kumo-disabled", resolveVariant(KUMO_INPUT_VARIANTS.size, size, KUMO_INPUT_DEFAULT_VARIANTS.size).classes, resolveVariant(KUMO_INPUT_VARIANTS.variant, variant, KUMO_INPUT_DEFAULT_VARIANTS.variant).classes, parentFocusIndicator && (variant === "error" ? "focus-within:ring-[1.5px] focus-within:ring-kumo-danger/50" : "focus-within:ring-[1.5px] focus-within:ring-kumo-focus/50"), focusIndicator && (variant === "error" ? "focus:ring-[1.5px] focus:ring-kumo-danger/50" : "focus:ring-[1.5px] focus:ring-kumo-focus/50"));
45
+ return cn("border-0 bg-kumo-control text-kumo-default ring ring-kumo-line outline-none focus:outline-none", "kumo-input-placeholder disabled:text-kumo-inactive", resolveVariant(KUMO_INPUT_VARIANTS.size, size, KUMO_INPUT_DEFAULT_VARIANTS.size).classes, resolveVariant(KUMO_INPUT_VARIANTS.variant, variant, KUMO_INPUT_DEFAULT_VARIANTS.variant).classes, parentFocusIndicator && (variant === "error" ? "focus-within:ring-[1.5px] focus-within:ring-kumo-danger/50" : "focus-within:ring-[1.5px] focus-within:ring-kumo-focus/50"), focusIndicator && (variant === "error" ? "focus:ring-[1.5px] focus:ring-kumo-danger/50" : "focus:ring-[1.5px] focus:ring-kumo-focus/50"));
46
46
  }
47
47
  const Input = forwardRef((props, ref) => {
48
48
  const { className, size = "base", variant: variantProp, label, labelTooltip, description, error, passwordManagerIgnore = false, ...inputProps } = props;
@@ -2,7 +2,7 @@
2
2
  import { t as cn } from "./vendor-styling-gs32v7xt5znc8kg0.js";
3
3
  import { t as FieldControl } from "./FieldControl-hjj2tcqruozadgdi.js";
4
4
  import { a as normalizeFieldError, t as Field } from "./field-jzzlgre0jmrr38o2.js";
5
- import { r as inputVariants } from "./input-ksy1w6j1m6olz6ck.js";
5
+ import { r as inputVariants } from "./input-jk86hoj6nqfhl5u8.js";
6
6
  import * as React$1 from "react";
7
7
  import { useCallback, useEffect, useLayoutEffect, useRef } from "react";
8
8
  import { jsx } from "react/jsx-runtime";
@@ -1,7 +1,7 @@
1
1
  "use client";
2
2
  import { t as cn } from "./vendor-styling-gs32v7xt5znc8kg0.js";
3
- import { t as InputGroup } from "./input-group-n08mcd8b36wbylro.js";
4
- import { t as Select } from "./select-ey03k4630uckf1rk.js";
3
+ import { t as InputGroup } from "./input-group-hc2qp3m6gsfomqvr.js";
4
+ import { t as Select } from "./select-owq85889zm4y23ws.js";
5
5
  import { createContext, useContext, useEffect, useMemo, useState } from "react";
6
6
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
7
7
  import { CaretDoubleLeftIcon, CaretDoubleRightIcon, CaretLeftIcon, CaretRightIcon } from "@phosphor-icons/react";
@@ -80,7 +80,17 @@ function PaginationControls({ controls = KUMO_PAGINATION_DEFAULT_VARIANTS.contro
80
80
  const { page, totalCount, hasNextPage, maxPage, setPage, editingPage, setEditingPage, labels } = usePaginationContext();
81
81
  const hasKnownTotal = totalCount != null;
82
82
  const showFullControls = controls === "full" && !(!hasKnownTotal && hasNextPage !== void 0);
83
- const isNextDisabled = hasKnownTotal ? page === maxPage : hasNextPage !== true;
83
+ const isNextDisabled = hasKnownTotal ? page >= maxPage : hasNextPage !== true;
84
+ const commitEditingPage = () => {
85
+ const value = editingPage.trim();
86
+ if (!/^\d+$/.test(value)) {
87
+ setEditingPage(String(page));
88
+ return;
89
+ }
90
+ const clamped = clamp(Number(value), 1, maxPage);
91
+ setPage(clamped);
92
+ setEditingPage(String(clamped));
93
+ };
84
94
  return /* @__PURE__ */ jsx("div", {
85
95
  "data-slot": "pagination-controls",
86
96
  className: cn("flex grow flex-col items-end", className),
@@ -93,7 +103,7 @@ function PaginationControls({ controls = KUMO_PAGINATION_DEFAULT_VARIANTS.contro
93
103
  disabled: page <= 1,
94
104
  onClick: () => {
95
105
  setPage(1);
96
- setEditingPage(1);
106
+ setEditingPage("1");
97
107
  },
98
108
  children: /* @__PURE__ */ jsx(CaretDoubleLeftIcon, { size: 16 })
99
109
  }),
@@ -104,7 +114,7 @@ function PaginationControls({ controls = KUMO_PAGINATION_DEFAULT_VARIANTS.contro
104
114
  onClick: () => {
105
115
  const previousPage = Math.max(page - 1, 1);
106
116
  setPage(previousPage);
107
- setEditingPage(previousPage);
117
+ setEditingPage(String(previousPage));
108
118
  },
109
119
  children: /* @__PURE__ */ jsx(CaretLeftIcon, { size: 16 })
110
120
  }),
@@ -115,7 +125,7 @@ function PaginationControls({ controls = KUMO_PAGINATION_DEFAULT_VARIANTS.contro
115
125
  onValueChange: (value) => {
116
126
  const num = value;
117
127
  setPage(num);
118
- setEditingPage(num);
128
+ setEditingPage(String(num));
119
129
  },
120
130
  children: Array.from({ length: maxPage }, (_, i) => i + 1).map((p) => /* @__PURE__ */ jsx(Select.Option, {
121
131
  value: p,
@@ -127,19 +137,11 @@ function PaginationControls({ controls = KUMO_PAGINATION_DEFAULT_VARIANTS.contro
127
137
  "aria-label": labels.pageNumber,
128
138
  value: editingPage,
129
139
  onValueChange: (value) => {
130
- setEditingPage(Number(value));
131
- },
132
- onBlur: () => {
133
- const clamped = clamp(editingPage, 1, maxPage);
134
- setPage(clamped);
135
- setEditingPage(clamped);
140
+ setEditingPage(value);
136
141
  },
142
+ onBlur: commitEditingPage,
137
143
  onKeyDown: (e) => {
138
- if (e.key === "Enter") {
139
- const clamped = clamp(editingPage, 1, maxPage);
140
- setPage(clamped);
141
- setEditingPage(clamped);
142
- }
144
+ if (e.key === "Enter") commitEditingPage();
143
145
  },
144
146
  autoComplete: "off",
145
147
  "data-1p-ignore": true,
@@ -153,17 +155,17 @@ function PaginationControls({ controls = KUMO_PAGINATION_DEFAULT_VARIANTS.contro
153
155
  onClick: () => {
154
156
  const nextPage = hasKnownTotal ? Math.min(page + 1, maxPage) : page + 1;
155
157
  setPage(nextPage);
156
- setEditingPage(nextPage);
158
+ setEditingPage(String(nextPage));
157
159
  },
158
160
  children: /* @__PURE__ */ jsx(CaretRightIcon, { size: 16 })
159
161
  }),
160
162
  showFullControls && /* @__PURE__ */ jsx(InputGroup.Button, {
161
163
  variant: "secondary",
162
164
  "aria-label": labels.lastPage,
163
- disabled: page === maxPage,
165
+ disabled: page >= maxPage,
164
166
  onClick: () => {
165
167
  setPage(maxPage);
166
- setEditingPage(maxPage);
168
+ setEditingPage(String(maxPage));
167
169
  },
168
170
  children: /* @__PURE__ */ jsx(CaretDoubleRightIcon, { size: 16 })
169
171
  })
@@ -205,13 +207,13 @@ function PaginationRoot(props) {
205
207
  const { page = 1, perPage, totalCount, hasNextPage, setPage, children, className, labels: labelsProp } = props;
206
208
  const text = "text" in props ? props.text : void 0;
207
209
  const controls = "controls" in props ? props.controls ?? KUMO_PAGINATION_DEFAULT_VARIANTS.controls : KUMO_PAGINATION_DEFAULT_VARIANTS.controls;
208
- const [editingPage, setEditingPage] = useState(1);
210
+ const [editingPage, setEditingPage] = useState(String(page));
209
211
  const labels = useMemo(() => ({
210
212
  ...DEFAULT_LABELS,
211
213
  ...labelsProp
212
214
  }), [labelsProp]);
213
215
  useEffect(() => {
214
- setEditingPage(page);
216
+ setEditingPage(String(page));
215
217
  }, [page]);
216
218
  const pageShowingRange = useMemo(() => {
217
219
  let lower = page * (perPage ?? 1) - (perPage ?? 0) + 1;
@@ -230,7 +232,7 @@ function PaginationRoot(props) {
230
232
  totalCount,
231
233
  hasNextPage,
232
234
  maxPage: useMemo(() => {
233
- return Math.ceil((totalCount ?? 1) / (perPage ?? 1));
235
+ return Math.max(Math.ceil((totalCount ?? 1) / (perPage ?? 1)), 1);
234
236
  }, [totalCount, perPage]),
235
237
  pageShowingRange,
236
238
  setPage,
@@ -4,7 +4,7 @@ import { n as usePortalContainer } from "./portal-provider-eveknxf26oudn7pp.js";
4
4
  import { i as buttonVariants } from "./button-oxy32x5w9x9az80g.js";
5
5
  import { r as Label } from "./label-hugrtzreeqk5mtqu.js";
6
6
  import { t as Field } from "./field-jzzlgre0jmrr38o2.js";
7
- import { n as KUMO_INPUT_VARIANTS } from "./input-ksy1w6j1m6olz6ck.js";
7
+ import { n as KUMO_INPUT_VARIANTS } from "./input-jk86hoj6nqfhl5u8.js";
8
8
  import { t as SkeletonLine } from "./skeleton-line-gjf1fecmyy82aejz.js";
9
9
  import { _ as SelectLabel, a as SelectItemIndicator, c as SelectPopup, f as SelectPortal, h as SelectTrigger, i as SelectItemText, m as SelectValue, n as SelectGroupLabel, o as SelectItem, p as SelectIcon, r as SelectGroup, s as SelectList, t as SelectSeparator, u as SelectPositioner, v as SelectRoot } from "./SelectSeparator-nnak70azojox8b2b.js";
10
10
  import { forwardRef, useId } from "react";
@@ -2,7 +2,7 @@
2
2
  import { t as cn } from "./vendor-styling-gs32v7xt5znc8kg0.js";
3
3
  import { t as Input } from "./Input-ozudotydd679ly63.js";
4
4
  import { t as Field } from "./field-jzzlgre0jmrr38o2.js";
5
- import { n as KUMO_INPUT_VARIANTS, r as inputVariants } from "./input-ksy1w6j1m6olz6ck.js";
5
+ import { n as KUMO_INPUT_VARIANTS, r as inputVariants } from "./input-jk86hoj6nqfhl5u8.js";
6
6
  import { t as useCopyFeedback } from "./use-copy-feedback-gl55ghst0csvpv4j.js";
7
7
  import { forwardRef, useCallback, useId, useRef, useState } from "react";
8
8
  import { Fragment as Fragment$1, jsx, jsxs } from "react/jsx-runtime";
@@ -3,7 +3,7 @@ import { t as cn } from "./vendor-styling-gs32v7xt5znc8kg0.js";
3
3
  import { t as Button } from "./button-oxy32x5w9x9az80g.js";
4
4
  import { t as FieldControl } from "./FieldControl-hjj2tcqruozadgdi.js";
5
5
  import { a as normalizeFieldError, t as Field } from "./field-jzzlgre0jmrr38o2.js";
6
- import { r as inputVariants } from "./input-ksy1w6j1m6olz6ck.js";
6
+ import { r as inputVariants } from "./input-jk86hoj6nqfhl5u8.js";
7
7
  import { forwardRef, useId, useState } from "react";
8
8
  import { jsx, jsxs } from "react/jsx-runtime";
9
9
  import { XIcon } from "@phosphor-icons/react";
@@ -17,7 +17,7 @@ const DEFAULT_LABELS = {
17
17
  function splitValues(value) {
18
18
  return value.split(/[\n,]+/).map((item) => item.trim()).filter(Boolean);
19
19
  }
20
- const TagInput = forwardRef(({ value, defaultValue = [], onValueChange, validateValue, maxValues, labels, label, labelTooltip, description, error, variant, disabled, className, placeholder, id, autoComplete = "off", onBlur, onChange, onKeyDown: onKeyDownProp, onPaste: onPasteProp, ...inputProps }, forwardedRef) => {
20
+ const TagInput = forwardRef(({ value, defaultValue = [], onValueChange, validateValue, maxValues, labels, label, labelTooltip, description, error, variant, disabled, readOnly, name, form, required, className, placeholder, id, autoComplete = "off", onBlur, onChange, onKeyDown: onKeyDownProp, onPaste: onPasteProp, ...inputProps }, forwardedRef) => {
21
21
  const [uncontrolledValue, setUncontrolledValue] = useState(defaultValue);
22
22
  const [inputValue, setInputValue] = useState("");
23
23
  const [message, setMessage] = useState();
@@ -54,7 +54,7 @@ const TagInput = forwardRef(({ value, defaultValue = [], onValueChange, validate
54
54
  };
55
55
  const handleKeyDown = (event) => {
56
56
  onKeyDownProp?.(event);
57
- if (event.defaultPrevented) return;
57
+ if (event.defaultPrevented || readOnly) return;
58
58
  if (event.nativeEvent.isComposing || event.keyCode === 229) return;
59
59
  if (!inputValue && event.key === "Backspace") {
60
60
  setValues(values.slice(0, -1));
@@ -70,11 +70,14 @@ const TagInput = forwardRef(({ value, defaultValue = [], onValueChange, validate
70
70
  };
71
71
  const handlePaste = (event) => {
72
72
  onPasteProp?.(event);
73
- if (event.defaultPrevented) return;
73
+ if (event.defaultPrevented || readOnly) return;
74
74
  const text = event.clipboardData.getData("text");
75
75
  if (!/[\n,]/.test(text)) return;
76
76
  event.preventDefault();
77
- commit(text);
77
+ const { selectionStart, selectionEnd } = event.currentTarget;
78
+ const start = selectionStart ?? inputValue.length;
79
+ const end = selectionEnd ?? start;
80
+ commit(inputValue.slice(0, start) + text + inputValue.slice(end));
78
81
  };
79
82
  const fieldError = normalizeFieldError(error) ?? normalizeFieldError(message);
80
83
  const inputVariant = variant ?? (fieldError ? "error" : "default");
@@ -87,13 +90,16 @@ const TagInput = forwardRef(({ value, defaultValue = [], onValueChange, validate
87
90
  "aria-label": inputProps["aria-label"] ?? (typeof label === "string" ? label : labels?.input ?? DEFAULT_LABELS.input),
88
91
  className: cn("min-w-32 flex-1 border-0 bg-transparent outline-none", "px-1 py-0.5"),
89
92
  disabled,
93
+ readOnly,
94
+ form,
95
+ required: required && values.length === 0,
90
96
  autoComplete,
91
97
  id: controlProps?.id ?? id ?? inputId,
92
98
  placeholder,
93
99
  value: inputValue,
94
100
  onBlur: (event) => {
95
101
  onBlur?.(event);
96
- if (!event.defaultPrevented) commit(inputValue);
102
+ if (!event.defaultPrevented && !readOnly) commit(inputValue);
97
103
  },
98
104
  onChange: (event) => {
99
105
  setInputValue(event.target.value);
@@ -111,19 +117,29 @@ const TagInput = forwardRef(({ value, defaultValue = [], onValueChange, validate
111
117
  }), "flex h-auto min-h-9 flex-wrap items-center gap-x-2 gap-y-1.5 px-2 py-1.5", className),
112
118
  children: [values.map((item) => /* @__PURE__ */ jsxs("span", {
113
119
  className: cn(chipClassName, "text-kumo-default"),
114
- children: [/* @__PURE__ */ jsx("span", {
115
- className: "truncate",
116
- children: item
117
- }), /* @__PURE__ */ jsx(Button, {
118
- "aria-label": (labels?.removeValue ?? DEFAULT_LABELS.removeValue)(item),
119
- icon: /* @__PURE__ */ jsx(XIcon, { size: 10 }),
120
- shape: "square",
121
- size: "xs",
122
- variant: "ghost",
123
- disabled,
124
- onMouseDown: (event) => event.preventDefault(),
125
- onClick: () => setValues(values.filter((value) => value !== item))
126
- })]
120
+ children: [
121
+ /* @__PURE__ */ jsx("span", {
122
+ className: "truncate",
123
+ children: item
124
+ }),
125
+ /* @__PURE__ */ jsx(Button, {
126
+ "aria-label": (labels?.removeValue ?? DEFAULT_LABELS.removeValue)(item),
127
+ icon: /* @__PURE__ */ jsx(XIcon, { size: 10 }),
128
+ shape: "square",
129
+ size: "xs",
130
+ variant: "ghost",
131
+ disabled: disabled || readOnly,
132
+ onMouseDown: (event) => event.preventDefault(),
133
+ onClick: () => setValues(values.filter((value) => value !== item))
134
+ }),
135
+ name ? /* @__PURE__ */ jsx("input", {
136
+ type: "hidden",
137
+ name,
138
+ form,
139
+ disabled,
140
+ value: item
141
+ }) : null
142
+ ]
127
143
  }, item)), hasField ? /* @__PURE__ */ jsx(FieldControl, { render: (controlProps) => input(controlProps) }) : input()]
128
144
  });
129
145
  if (hasField) return /* @__PURE__ */ jsx(Field, {
@@ -1,8 +1,8 @@
1
1
  "use client";
2
2
  import { t as cn } from "./vendor-styling-gs32v7xt5znc8kg0.js";
3
3
  import { n as LinkButton, t as Button$1 } from "./button-oxy32x5w9x9az80g.js";
4
- import { t as Input$1 } from "./input-ksy1w6j1m6olz6ck.js";
5
- import { t as InputGroup } from "./input-group-n08mcd8b36wbylro.js";
4
+ import { t as Input$1 } from "./input-jk86hoj6nqfhl5u8.js";
5
+ import { t as InputGroup } from "./input-group-hc2qp3m6gsfomqvr.js";
6
6
  import { i as ToolbarRoot, n as ToolbarLink, r as ToolbarButton, t as ToolbarInput } from "./ToolbarInput-kyxl1be0p3cyuayp.js";
7
7
  import React, { Children, cloneElement, createContext, isValidElement } from "react";
8
8
  import { jsx } from "react/jsx-runtime";