@plexui/vue 0.21.0 → 0.23.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 (81) hide show
  1. package/dist/es/components/Alert/Alert.js +16 -4
  2. package/dist/es/components/Alert/Alert.js.map +1 -1
  3. package/dist/es/components/ColorPicker/ColorPicker.js +13 -9
  4. package/dist/es/components/ColorPicker/ColorPicker.js.map +1 -1
  5. package/dist/es/components/ColorPicker/ColorWell.js +5 -3
  6. package/dist/es/components/ColorPicker/ColorWell.js.map +1 -1
  7. package/dist/es/components/ColorPicker/shared.js +5 -4
  8. package/dist/es/components/ColorPicker/shared.js.map +1 -1
  9. package/dist/es/components/ContextMenu/ContextMenu.js +9 -9
  10. package/dist/es/components/ContextMenu/ContextMenu.js.map +1 -1
  11. package/dist/es/components/ContextMenu/shared.js +25 -5
  12. package/dist/es/components/ContextMenu/shared.js.map +1 -1
  13. package/dist/es/components/DataTable/columnHelpers.js +88 -6
  14. package/dist/es/components/DataTable/columnHelpers.js.map +1 -1
  15. package/dist/es/components/DatePicker/DatePicker.js +3 -3
  16. package/dist/es/components/DatePicker/DatePicker.js.map +1 -1
  17. package/dist/es/components/DatePicker/useCalendarCollisionPadding.js +25 -0
  18. package/dist/es/components/DatePicker/useCalendarCollisionPadding.js.map +1 -0
  19. package/dist/es/components/DateRangePicker/DateRangePicker.js +3 -3
  20. package/dist/es/components/DateRangePicker/DateRangePicker.js.map +1 -1
  21. package/dist/es/components/Dialog/Dialog.js +2 -2
  22. package/dist/es/components/Dialog/Dialog.js.map +1 -1
  23. package/dist/es/components/Input/Input.js +3 -0
  24. package/dist/es/components/Input/Input.js.map +1 -1
  25. package/dist/es/components/Menu/Menu.js +10 -1
  26. package/dist/es/components/Menu/Menu.js.map +1 -1
  27. package/dist/es/components/PhoneLayout/PhoneLayout.js +9 -1
  28. package/dist/es/components/PhoneLayout/PhoneLayout.js.map +1 -1
  29. package/dist/es/components/Popover/Popover.js +2 -2
  30. package/dist/es/components/Popover/Popover.js.map +1 -1
  31. package/dist/es/components/ProgressSteps/ProgressSteps.js +7 -3
  32. package/dist/es/components/ProgressSteps/ProgressSteps.js.map +1 -1
  33. package/dist/es/components/ProgressSteps/index.js.map +1 -1
  34. package/dist/es/components/Select/Select.js +178 -32
  35. package/dist/es/components/Select/Select.js.map +1 -1
  36. package/dist/es/components/SelectControl/SelectControl.js +3 -1
  37. package/dist/es/components/SelectControl/SelectControl.js.map +1 -1
  38. package/dist/es/components/Slider/Slider.js +24 -11
  39. package/dist/es/components/Slider/Slider.js.map +1 -1
  40. package/dist/es/components/Slider/sliderPrimitive.js +5 -2
  41. package/dist/es/components/Slider/sliderPrimitive.js.map +1 -1
  42. package/dist/es/components/Sortable/Sortable.js +1 -1
  43. package/dist/es/components/Sortable/Sortable.js.map +1 -1
  44. package/dist/es/components/StatCard/index.js +4 -1
  45. package/dist/es/components/StatCard/index.js.map +1 -1
  46. package/dist/es/components/{StatCard/StatCard.js → StatsCard/StatsCard.js} +32 -27
  47. package/dist/es/components/StatsCard/StatsCard.js.map +1 -0
  48. package/dist/es/components/StatsCard/index.js +2 -0
  49. package/dist/es/components/StatsCard/index.js.map +1 -0
  50. package/dist/es/components/SwipeActions/SwipeActions.js +32 -5
  51. package/dist/es/components/SwipeActions/SwipeActions.js.map +1 -1
  52. package/dist/es/components/TabBar/TabBar.js +52 -21
  53. package/dist/es/components/TabBar/TabBar.js.map +1 -1
  54. package/dist/es/components/Tabs/Tabs.js +229 -6
  55. package/dist/es/components/Tabs/Tabs.js.map +1 -1
  56. package/dist/es/components/Toolbar/Toolbar.js.map +1 -1
  57. package/dist/es/lib/menuTriggerCover.js +40 -3
  58. package/dist/es/lib/menuTriggerCover.js.map +1 -1
  59. package/dist/types/components/ColorPicker/ColorPicker.d.ts +3 -2
  60. package/dist/types/components/ColorPicker/shared.d.ts +5 -4
  61. package/dist/types/components/ContextMenu/shared.d.ts +28 -6
  62. package/dist/types/components/DatePicker/useCalendarCollisionPadding.d.ts +9 -0
  63. package/dist/types/components/Dialog/Dialog.d.ts +2 -2
  64. package/dist/types/components/PhoneLayout/PhoneLayout.d.ts +5 -0
  65. package/dist/types/components/Popover/Popover.d.ts +5 -5
  66. package/dist/types/components/ProgressSteps/ProgressSteps.d.ts +17 -3
  67. package/dist/types/components/ProgressSteps/index.d.ts +1 -1
  68. package/dist/types/components/Select/Select.d.ts +19 -8
  69. package/dist/types/components/StatCard/index.d.ts +9 -1
  70. package/dist/types/components/{StatCard/StatCard.d.ts → StatsCard/StatsCard.d.ts} +19 -19
  71. package/dist/types/components/StatsCard/index.d.ts +1 -0
  72. package/dist/types/components/SwipeActions/SwipeActions.d.ts +4 -4
  73. package/dist/types/components/TabBar/TabBar.d.ts +34 -0
  74. package/dist/types/components/Tabs/Tabs.d.ts +33 -2
  75. package/dist/types/components/Toolbar/Toolbar.d.ts +1 -1
  76. package/dist/types/lib/menuTriggerCover.d.ts +16 -2
  77. package/package.json +2 -2
  78. package/dist/es/components/DatePicker/useCalendarGutter.js +0 -14
  79. package/dist/es/components/DatePicker/useCalendarGutter.js.map +0 -1
  80. package/dist/es/components/StatCard/StatCard.js.map +0 -1
  81. package/dist/types/components/DatePicker/useCalendarGutter.d.ts +0 -2
@@ -1,5 +1,5 @@
1
1
  import clsx from "clsx";
2
- import { defineComponent, h, onBeforeUnmount, onMounted, ref, watch, } from "vue";
2
+ import { defineComponent, h, onBeforeUnmount, onMounted, onUpdated, ref, watch, } from "vue";
3
3
  import { CheckCircle, Info, Warning, X } from "../Icon/index.js";
4
4
  import { Button } from "../Button/index.js";
5
5
  import { hasContent } from "../../lib/slotContent.js";
@@ -25,6 +25,14 @@ const contentBoxSize = (entry, sizeType) => {
25
25
  // Firefox once reported a single object instead of an array
26
26
  return Array.isArray(box) ? box[0]?.[sizeType] : box[sizeType];
27
27
  };
28
+ /** The actions' own width: their row stretches to the alert's width when they sit at the bottom */
29
+ const actionsWidthOf = (element) => {
30
+ if (!element)
31
+ return 0;
32
+ const children = Array.from(element.children);
33
+ const gap = parseFloat(getComputedStyle(element).columnGap) || 0;
34
+ return children.reduce((width, child) => width + child.offsetWidth, 0) + gap * Math.max(0, children.length - 1);
35
+ };
28
36
  const AlertComponent = defineComponent({
29
37
  name: "Alert",
30
38
  props: {
@@ -80,13 +88,17 @@ const AlertComponent = defineComponent({
80
88
  observer.observe(container, { box: "content-box" });
81
89
  });
82
90
  onBeforeUnmount(() => observer?.disconnect());
83
- watch(containerWidth, (width) => {
84
- const actionsWidth = actionsRef.value?.clientWidth ?? 0;
91
+ const measure = () => {
92
+ const actionsWidth = actionsWidthOf(actionsRef.value);
93
+ const width = containerWidth.value;
85
94
  if (actionsWidth && width) {
86
95
  // If actions are larger than a third of the container width, wrap them.
87
96
  actionsAutoPlacement.value = actionsWidth > width / 3 ? "bottom" : "end";
88
97
  }
89
- });
98
+ };
99
+ watch(containerWidth, measure);
100
+ // Measured again when the actions change too (another button, Dismiss added), not only the width
101
+ onUpdated(measure);
90
102
  return () => {
91
103
  const { color } = props;
92
104
  const title = slots.title ? slots.title() : props.title;
@@ -1 +1 @@
1
- {"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../../../src/components/Alert/Alert.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,eAAe,EACf,CAAC,EACD,eAAe,EACf,SAAS,EACT,GAAG,EACH,KAAK,GAKN,MAAM,KAAK,CAAA;AAEZ,OAAO,EAAE,WAAW,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AAChE,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAA;AAC3C,OAAO,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAA;AACrD,OAAO,CAAC,MAAM,kDAAkD,CAAA;AAgBhE,+EAA+E;AAC/E,MAAM,SAAS,GAAG,CAAC,KAAiB,EAAE,EAAE;IACtC,QAAQ,KAAK,EAAE,CAAC;QACd,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U,EAAE,EAAE;4BAC5E,OAAO;4BACP,KAAK,CAAC,SAAS;gCACb,CAAC,CAAC,CAAC,CACC,MAAM,EACN,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAK,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC,aAAa,EAAE,EACxG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAC7B;gCACH,CAAC,CAAC,IAAI;yBACT,CAAC;wBACJ,CAAC,CAAC,IAAI;iBACT,CAAC;gBACF,wFAAwF;gBACxF,KAAK,CAAC,SAAS;oBACb,CAAC,CAAC,CAAC,CACC,MAAM,EACN,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,EACvL,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAC1B;oBACH,CAAC,CAAC,IAAI;aACT,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,qFAAqF;AACrF,MAAM,CAAC,MAAM,KAAK,GAAG,cAA4E,CAAA","sourcesContent":["import clsx from \"clsx\"\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n ref,\n watch,\n type HTMLAttributes,\n type PropType,\n type VNodeArrayChildren,\n type VNodeChild,\n} from \"vue\"\nimport type { SemanticColors, Variants } from \"@plexui/styles/types\"\nimport { CheckCircle, Info, Warning, X } from \"../Icon/index.js\"\nimport { Button } from \"../Button/index.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport s from \"@plexui/styles/components/Alert/Alert.module.css\"\n\n// Vue port of packages/ui/src/components/Alert/Alert.tsx. ReactNode props\n// are slots (`title`, `description`, `actions`, `indicator`), with string\n// props as fallback for `title` and `description`. `:indicator=\"false\"`\n// hides the indicator. `onDismiss` stays a function prop (`@dismiss` in\n// templates) because its presence adds the Dismiss button.\n// The actions auto placement mirrors usehooks-ts `useResizeObserver`: it\n// reacts to the container's content-box width only.\n\nexport type AlertMobileActions = \"capsules\" | \"own\"\n\nexport type AlertColor = SemanticColors<\n \"primary\" | \"danger\" | \"success\" | \"info\" | \"discovery\" | \"caution\" | \"warning\"\n>\n\n/** Default indicator icon, chosen from the color (which signals intention). */\nconst Indicator = (color: AlertColor) => {\n switch (color) {\n case \"warning\":\n case \"caution\":\n case \"danger\":\n return h(Warning)\n case \"success\":\n return h(CheckCircle)\n default:\n return h(Info)\n }\n}\n\n// usehooks-ts `extractSize` for the content box\nconst contentBoxSize = (entry: ResizeObserverEntry, sizeType: \"inlineSize\" | \"blockSize\") => {\n const box = entry.contentBoxSize as ReadonlyArray<ResizeObserverSize> | ResizeObserverSize | undefined\n if (!box) return entry.contentRect[sizeType === \"inlineSize\" ? \"width\" : \"height\"]\n // Firefox once reported a single object instead of an array\n return Array.isArray(box) ? box[0]?.[sizeType] : (box as ResizeObserverSize)[sizeType]\n}\n\nconst AlertComponent = defineComponent({\n name: \"Alert\",\n props: {\n /** Color of the alert. @default \"primary\" */\n color: { type: String as PropType<AlertColor>, default: \"primary\" },\n /** Style variant. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"solid\" | \"soft\" | \"outline\">>, default: \"outline\" },\n /** Title displayed in the alert (or the `title` slot). */\n title: String,\n /** Description text displayed in the alert (or the `description` slot). */\n description: String,\n /** Places `actions` at the end or the bottom. Automatic from sizing when unset. */\n actionsPlacement: String as PropType<\"end\" | \"bottom\">,\n /**\n * How the actions show at 767px and below: 50px capsules side by side, as the buttons of an iOS tip (TipKit),\n * or the buttons as given, at their own size, for an alert inside a block of buttons of its own. @default \"capsules\"\n */\n mobileActions: { type: String as PropType<AlertMobileActions>, default: \"capsules\" },\n /** `false` hides the indicator. Use the `indicator` slot to replace it. */\n indicator: { type: Boolean, default: undefined },\n /** Class applied to the actions container */\n actionsClassName: String,\n /** Shows the Dismiss button; called when it is clicked. */\n onDismiss: Function as PropType<(event: MouseEvent) => void>,\n /** A full-width strip across a page or panel: square corners, lines above and below only. @default false */\n banner: { type: Boolean, default: false },\n },\n setup(props, { slots }) {\n const containerRef = ref<HTMLDivElement | null>(null)\n const actionsRef = ref<HTMLDivElement | null>(null)\n const actionsAutoPlacement = ref<\"end\" | \"bottom\">(\"end\")\n const containerWidth = ref<number | undefined>(undefined)\n\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const container = containerRef.value\n if (!container) return\n if (typeof window === \"undefined\" || !(\"ResizeObserver\" in window)) return\n let previousWidth: number | undefined\n let previousHeight: number | undefined\n observer = new ResizeObserver(([entry]) => {\n if (!entry) return\n const width = contentBoxSize(entry, \"inlineSize\")\n const height = contentBoxSize(entry, \"blockSize\")\n if (width !== previousWidth || height !== previousHeight) {\n previousWidth = width\n previousHeight = height\n containerWidth.value = width\n }\n })\n observer.observe(container, { box: \"content-box\" })\n })\n onBeforeUnmount(() => observer?.disconnect())\n\n watch(containerWidth, (width) => {\n const actionsWidth = actionsRef.value?.clientWidth ?? 0\n\n if (actionsWidth && width) {\n // If actions are larger than a third of the container width, wrap them.\n actionsAutoPlacement.value = actionsWidth > width / 3 ? \"bottom\" : \"end\"\n }\n })\n\n return () => {\n const { color } = props\n const title: VNodeChild = slots.title ? slots.title() : props.title\n const description: VNodeChild = slots.description ? slots.description() : props.description\n const actions = slots.actions?.()\n const showActions = hasContent(actions) || !!props.onDismiss\n\n return h(\n \"div\",\n {\n \"ref\": containerRef,\n \"class\": s.Alert,\n \"data-variant\": props.variant,\n \"data-color\": color,\n \"role\": color === \"danger\" ? \"alert\" : undefined,\n \"data-actions-placement\": props.actionsPlacement ?? actionsAutoPlacement.value,\n \"data-banner\": props.banner ? \"\" : undefined,\n \"data-mobile-actions\": props.mobileActions === \"own\" ? \"own\" : undefined,\n },\n [\n props.indicator === false\n ? null\n : h(\"div\", { class: s.Indicator }, slots.indicator ? slots.indicator() : [Indicator(color)]),\n h(\"div\", { class: s.Content }, [\n h(\"div\", { class: s.Message }, [\n hasContent([title as VNodeArrayChildren]) ? h(\"div\", { class: s.Title }, [title]) : null,\n hasContent([description as VNodeArrayChildren])\n ? h(\"div\", { class: s.Description }, [description])\n : null,\n ]),\n showActions\n ? h(\"div\", { class: clsx(s.Actions, props.actionsClassName), ref: actionsRef }, [\n actions,\n props.onDismiss\n ? h(\n Button,\n { type: \"button\", onClick: props.onDismiss, color, variant: \"soft\", pill: true, class: s.DismissButton },\n { default: () => \"Dismiss\" },\n )\n : null,\n ])\n : null,\n ]),\n // On a phone the alert is dismissed with a close button in its corner, as an iOS tip is\n props.onDismiss\n ? h(\n Button,\n { \"type\": \"button\", \"onClick\": props.onDismiss, \"color\": \"secondary\", \"variant\": \"soft\", \"size\": \"sm\", \"uniform\": true, \"pill\": true, \"aria-label\": \"Dismiss\", \"class\": s.CloseButton },\n { default: () => [h(X)] },\n )\n : null,\n ],\n )\n }\n },\n})\n\ntype AlertOwnProps = InstanceType<typeof AlertComponent>[\"$props\"]\n\n/** Alert props plus the native <div> attributes that fall through to it, as in React. */\nexport type AlertProps = AlertOwnProps & Omit<HTMLAttributes, keyof AlertOwnProps>\n\n/** Inline message with a semantic color, optional title, description and actions. */\nexport const Alert = AlertComponent as typeof AlertComponent & { new (): { $props: AlertProps } }\n"]}
1
+ {"version":3,"file":"Alert.js","sourceRoot":"","sources":["../../../../src/components/Alert/Alert.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,MAAM,CAAA;AACvB,OAAO,EACL,eAAe,EACf,CAAC,EACD,eAAe,EACf,SAAS,EACT,SAAS,EACT,GAAG,EACH,KAAK,GAKN,MAAM,KAAK,CAA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a,EAAE,EACxG,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,SAAS,EAAE,CAC7B;gCACH,CAAC,CAAC,IAAI;yBACT,CAAC;wBACJ,CAAC,CAAC,IAAI;iBACT,CAAC;gBACF,wFAAwF;gBACxF,KAAK,CAAC,SAAS;oBACb,CAAC,CAAC,CAAC,CACC,MAAM,EACN,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,CAAC,SAAS,EAAE,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,YAAY,EAAE,SAAS,EAAE,OAAO,EAAE,CAAC,CAAC,WAAW,EAAE,EACvL,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,CAC1B;oBACH,CAAC,CAAC,IAAI;aACT,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAOF,qFAAqF;AACrF,MAAM,CAAC,MAAM,KAAK,GAAG,cAA4E,CAAA","sourcesContent":["import clsx from \"clsx\"\nimport {\n defineComponent,\n h,\n onBeforeUnmount,\n onMounted,\n onUpdated,\n ref,\n watch,\n type HTMLAttributes,\n type PropType,\n type VNodeArrayChildren,\n type VNodeChild,\n} from \"vue\"\nimport type { SemanticColors, Variants } from \"@plexui/styles/types\"\nimport { CheckCircle, Info, Warning, X } from \"../Icon/index.js\"\nimport { Button } from \"../Button/index.js\"\nimport { hasContent } from \"../../lib/slotContent.js\"\nimport s from \"@plexui/styles/components/Alert/Alert.module.css\"\n\n// Vue port of packages/ui/src/components/Alert/Alert.tsx. ReactNode props\n// are slots (`title`, `description`, `actions`, `indicator`), with string\n// props as fallback for `title` and `description`. `:indicator=\"false\"`\n// hides the indicator. `onDismiss` stays a function prop (`@dismiss` in\n// templates) because its presence adds the Dismiss button.\n// The actions auto placement mirrors usehooks-ts `useResizeObserver`: it\n// reacts to the container's content-box width only.\n\nexport type AlertMobileActions = \"capsules\" | \"own\"\n\nexport type AlertColor = SemanticColors<\n \"primary\" | \"danger\" | \"success\" | \"info\" | \"discovery\" | \"caution\" | \"warning\"\n>\n\n/** Default indicator icon, chosen from the color (which signals intention). */\nconst Indicator = (color: AlertColor) => {\n switch (color) {\n case \"warning\":\n case \"caution\":\n case \"danger\":\n return h(Warning)\n case \"success\":\n return h(CheckCircle)\n default:\n return h(Info)\n }\n}\n\n// usehooks-ts `extractSize` for the content box\nconst contentBoxSize = (entry: ResizeObserverEntry, sizeType: \"inlineSize\" | \"blockSize\") => {\n const box = entry.contentBoxSize as ReadonlyArray<ResizeObserverSize> | ResizeObserverSize | undefined\n if (!box) return entry.contentRect[sizeType === \"inlineSize\" ? \"width\" : \"height\"]\n // Firefox once reported a single object instead of an array\n return Array.isArray(box) ? box[0]?.[sizeType] : (box as ResizeObserverSize)[sizeType]\n}\n\n/** The actions' own width: their row stretches to the alert's width when they sit at the bottom */\nconst actionsWidthOf = (element: HTMLElement | null) => {\n if (!element) return 0\n const children = Array.from(element.children) as HTMLElement[]\n const gap = parseFloat(getComputedStyle(element).columnGap) || 0\n return children.reduce((width, child) => width + child.offsetWidth, 0) + gap * Math.max(0, children.length - 1)\n}\n\nconst AlertComponent = defineComponent({\n name: \"Alert\",\n props: {\n /** Color of the alert. @default \"primary\" */\n color: { type: String as PropType<AlertColor>, default: \"primary\" },\n /** Style variant. @default \"outline\" */\n variant: { type: String as PropType<Variants<\"solid\" | \"soft\" | \"outline\">>, default: \"outline\" },\n /** Title displayed in the alert (or the `title` slot). */\n title: String,\n /** Description text displayed in the alert (or the `description` slot). */\n description: String,\n /** Places `actions` at the end or the bottom. Automatic from sizing when unset. */\n actionsPlacement: String as PropType<\"end\" | \"bottom\">,\n /**\n * How the actions show at 767px and below: 50px capsules side by side, as the buttons of an iOS tip (TipKit),\n * or the buttons as given, at their own size, for an alert inside a block of buttons of its own. @default \"capsules\"\n */\n mobileActions: { type: String as PropType<AlertMobileActions>, default: \"capsules\" },\n /** `false` hides the indicator. Use the `indicator` slot to replace it. */\n indicator: { type: Boolean, default: undefined },\n /** Class applied to the actions container */\n actionsClassName: String,\n /** Shows the Dismiss button; called when it is clicked. */\n onDismiss: Function as PropType<(event: MouseEvent) => void>,\n /** A full-width strip across a page or panel: square corners, lines above and below only. @default false */\n banner: { type: Boolean, default: false },\n },\n setup(props, { slots }) {\n const containerRef = ref<HTMLDivElement | null>(null)\n const actionsRef = ref<HTMLDivElement | null>(null)\n const actionsAutoPlacement = ref<\"end\" | \"bottom\">(\"end\")\n const containerWidth = ref<number | undefined>(undefined)\n\n let observer: ResizeObserver | undefined\n onMounted(() => {\n const container = containerRef.value\n if (!container) return\n if (typeof window === \"undefined\" || !(\"ResizeObserver\" in window)) return\n let previousWidth: number | undefined\n let previousHeight: number | undefined\n observer = new ResizeObserver(([entry]) => {\n if (!entry) return\n const width = contentBoxSize(entry, \"inlineSize\")\n const height = contentBoxSize(entry, \"blockSize\")\n if (width !== previousWidth || height !== previousHeight) {\n previousWidth = width\n previousHeight = height\n containerWidth.value = width\n }\n })\n observer.observe(container, { box: \"content-box\" })\n })\n onBeforeUnmount(() => observer?.disconnect())\n\n const measure = () => {\n const actionsWidth = actionsWidthOf(actionsRef.value)\n const width = containerWidth.value\n\n if (actionsWidth && width) {\n // If actions are larger than a third of the container width, wrap them.\n actionsAutoPlacement.value = actionsWidth > width / 3 ? \"bottom\" : \"end\"\n }\n }\n watch(containerWidth, measure)\n // Measured again when the actions change too (another button, Dismiss added), not only the width\n onUpdated(measure)\n\n return () => {\n const { color } = props\n const title: VNodeChild = slots.title ? slots.title() : props.title\n const description: VNodeChild = slots.description ? slots.description() : props.description\n const actions = slots.actions?.()\n const showActions = hasContent(actions) || !!props.onDismiss\n\n return h(\n \"div\",\n {\n \"ref\": containerRef,\n \"class\": s.Alert,\n \"data-variant\": props.variant,\n \"data-color\": color,\n \"role\": color === \"danger\" ? \"alert\" : undefined,\n \"data-actions-placement\": props.actionsPlacement ?? actionsAutoPlacement.value,\n \"data-banner\": props.banner ? \"\" : undefined,\n \"data-mobile-actions\": props.mobileActions === \"own\" ? \"own\" : undefined,\n },\n [\n props.indicator === false\n ? null\n : h(\"div\", { class: s.Indicator }, slots.indicator ? slots.indicator() : [Indicator(color)]),\n h(\"div\", { class: s.Content }, [\n h(\"div\", { class: s.Message }, [\n hasContent([title as VNodeArrayChildren]) ? h(\"div\", { class: s.Title }, [title]) : null,\n hasContent([description as VNodeArrayChildren])\n ? h(\"div\", { class: s.Description }, [description])\n : null,\n ]),\n showActions\n ? h(\"div\", { class: clsx(s.Actions, props.actionsClassName), ref: actionsRef }, [\n actions,\n props.onDismiss\n ? h(\n Button,\n { type: \"button\", onClick: props.onDismiss, color, variant: \"soft\", pill: true, class: s.DismissButton },\n { default: () => \"Dismiss\" },\n )\n : null,\n ])\n : null,\n ]),\n // On a phone the alert is dismissed with a close button in its corner, as an iOS tip is\n props.onDismiss\n ? h(\n Button,\n { \"type\": \"button\", \"onClick\": props.onDismiss, \"color\": \"secondary\", \"variant\": \"soft\", \"size\": \"sm\", \"uniform\": true, \"pill\": true, \"aria-label\": \"Dismiss\", \"class\": s.CloseButton },\n { default: () => [h(X)] },\n )\n : null,\n ],\n )\n }\n },\n})\n\ntype AlertOwnProps = InstanceType<typeof AlertComponent>[\"$props\"]\n\n/** Alert props plus the native <div> attributes that fall through to it, as in React. */\nexport type AlertProps = AlertOwnProps & Omit<HTMLAttributes, keyof AlertOwnProps>\n\n/** Inline message with a semantic color, optional title, description and actions. */\nexport const Alert = AlertComponent as typeof AlertComponent & { new (): { $props: AlertProps } }\n"]}
@@ -16,8 +16,8 @@ import { alphaPercent, channelTrack, COLOR_PICKER_CHANNELS, COLOR_PICKER_GRID_CO
16
16
  const BLACK = { r: 0, g: 0, b: 0, a: 1 };
17
17
  const GRID_CELLS = COLOR_PICKER_GRID_COLUMNS * 10;
18
18
  const NAVIGATION_KEYS = ["ArrowRight", "ArrowLeft", "ArrowDown", "ArrowUp", "Home", "End"];
19
- /** A slider on a colored track, after the kit's Opacity slider (515:47434): a 36px ring on a 40px capsule. */
20
- const colorSlider = ({ labelId, value, max, track, valueText, onChange }) => h("div", { class: s.Track, style: { "--color-picker-track": track } }, [
19
+ /** A slider on a colored track, after the kit's Opacity slider (515:47434): a ring filled with the color on a capsule. */
20
+ const colorSlider = ({ labelId, value, max, track, fill, valueText, onChange }) => h("div", { class: s.Track, style: { "--color-picker-track": track } }, [
21
21
  h(SliderRoot, {
22
22
  class: s.SliderRoot,
23
23
  min: 0,
@@ -28,7 +28,7 @@ const colorSlider = ({ labelId, value, max, track, valueText, onChange }) => h("
28
28
  }, {
29
29
  default: () => [
30
30
  h(SliderTrack, { class: s.SliderTrack }),
31
- h(SliderThumb, { "class": s.Knob, "aria-labelledby": labelId, "aria-valuetext": valueText }),
31
+ h(SliderThumb, { "class": s.Knob, "style": { backgroundColor: fill }, "aria-labelledby": labelId, "aria-valuetext": valueText }),
32
32
  ],
33
33
  }),
34
34
  ]);
@@ -195,6 +195,7 @@ const colorSliders = (uid, color, onSelect) => h("div", { class: s.Sliders }, [
195
195
  value: color[channel],
196
196
  max: 255,
197
197
  track: channelTrack(color, channel),
198
+ fill: cssColor(color, 1),
198
199
  valueText: String(color[channel]),
199
200
  onChange: (next) => onSelect({ ...color, [channel]: next }),
200
201
  }),
@@ -212,7 +213,7 @@ const colorSliders = (uid, color, onSelect) => h("div", { class: s.Sliders }, [
212
213
  ]);
213
214
  }),
214
215
  h("div", { class: s.Hex }, [
215
- h("span", { id: `${uid}-hex`, class: s.Label }, "Hex Color #"),
216
+ h("span", { id: `${uid}-hex`, class: s.HexLabel }, "Hex Color #"),
216
217
  h(ColorField, {
217
218
  value: hexDigits(color),
218
219
  labelledBy: `${uid}-hex`,
@@ -228,8 +229,9 @@ const colorSliders = (uid, color, onSelect) => h("div", { class: s.Sliders }, [
228
229
  ]);
229
230
  const colorName = (color) => `#${hexDigits(color)}${color.a < 1 ? `, ${alphaPercent(color.a)}% opacity` : ""}`;
230
231
  /**
231
- * The current color, and the saved colors in pages of two rows of five with Add after the last (kit Swatches
232
- * 515:46585). A saved color is a radio; Delete or Backspace, or Delete in its context menu, removes it.
232
+ * The current color, and the saved colors in pages of two rows of six with Add after the last (iOS 27.2; kit
233
+ * Swatches 515:46585 had rows of five). A saved color is a radio; Delete or Backspace, or Delete in its context
234
+ * menu, removes it.
233
235
  */
234
236
  const ColorSwatches = defineComponent({
235
237
  name: "ColorPickerSwatches",
@@ -432,7 +434,7 @@ const ColorPickerComponent = defineComponent({
432
434
  "class": [s.ColorPicker, attrs.class],
433
435
  "data-mode": mode.value,
434
436
  }, [
435
- h(SegmentedControl, { "aria-label": "Mode", "value": mode.value, "block": true, "class": s.Modes, "onChange": changeMode }, { default: () => COLOR_PICKER_MODES.map((option) => h(SegmentedControlOption, { key: option.value, value: option.value }, () => option.label)) }),
437
+ h(SegmentedControl, { "aria-label": "Mode", "value": mode.value, "block": true, "class": s.Modes, "data-mobile-size": "small", "onChange": changeMode }, { default: () => COLOR_PICKER_MODES.map((option) => h(SegmentedControlOption, { key: option.value, value: option.value }, () => option.label)) }),
436
438
  h("div", { class: s.Body }, [
437
439
  mode.value === "grid" ? colorGrid(current, commit) : null,
438
440
  mode.value === "spectrum" ? h(ColorSpectrum, { color: current, onSelect: commit }) : null,
@@ -447,6 +449,7 @@ const ColorPickerComponent = defineComponent({
447
449
  value: alphaPercent(current.a),
448
450
  max: 100,
449
451
  track: opacityTrack(current),
452
+ fill: cssColor(current),
450
453
  valueText: `${alphaPercent(current.a)}%`,
451
454
  onChange: (percent) => commit({ ...color.value, a: percent / 100 }),
452
455
  }),
@@ -469,8 +472,9 @@ const ColorPickerComponent = defineComponent({
469
472
  },
470
473
  });
471
474
  /**
472
- * The system color picker of iOS 26 (kit Color Picker - iPhone 0:5275): Grid, Spectrum and Sliders, the Opacity
473
- * slider, and the saved colors with Add. Show it inside a Popover or a Sheet, or use `ColorWell`, which does.
475
+ * The system color picker of iOS 27.2 (UIColorPickerViewController, after the iOS 26 kit's Color Picker - iPhone
476
+ * 0:5275): Grid, Spectrum and Sliders, the Opacity slider, and the saved colors with Add. Show it inside a Popover or
477
+ * a Sheet, or use `ColorWell`, which does.
474
478
  */
475
479
  export const ColorPicker = ColorPickerComponent;
476
480
  //# sourceMappingURL=ColorPicker.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../../src/components/ColorPicker/ColorPicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAA6B,MAAM,KAAK,CAAA;AACrG,OAAO,CAAC,MAAM,8DAA8D,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC7F,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACvF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACnF,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,kBAAkB,EAClB,8BAA8B,EAC9B,QAAQ,EACR,WAAW,EACX,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,WAAW,EACX,OAAO,EACP,aAAa,EACb,aAAa,EACb,eAAe,GAIhB,MAAM,aAAa,CAAA;AAEpB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EAAE,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC;gCAC9B,GAAG,EAAE,GAAG;gCACR,KAAK,EAAE,YAAY,CAAC,OAAO,CAAC;gCAC5B,SAAS,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;gCACxC,QAAQ,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,GAAG,GAAG,EAAE,CAAC;6BACpE,CAAC;4BACF,CAAC,CAAC,UAAU,EAAE;gCACZ,KAAK,EAAE,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG;gCACpC,UAAU,EAAE,SAAS;gCACrB,SAAS,EAAE,SAAS;gCACpB,QAAQ,EAAE,CAAC,IAAY,EAAE,EAAE;oCACzB,MAAM,OAAO,GAAG,WAAW,CAAC,IAAI,EAAE,CAAC,EAAE,GAAG,CAAC,CAAA;oCACzC,IAAI,OAAO,KAAK,IAAI;wCAAE,MAAM,CAAC,EAAE,GAAG,KAAK,CAAC,KAAK,EAAE,CAAC,EAAE,OAAO,GAAG,GAAG,EAAE,CAAC,CAAA;gCACpE,CAAC;6BACF,CAAC;yBACH,CAAC;qBACH,CAAC;oBACJ,CAAC,CAAC,IAAI;gBACR,CAAC,CAAC,aAAa,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,CAAC,KAAK,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,CAAC;aAC3G,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAIF;;;GAGG;AACH,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAA","sourcesContent":["import { computed, defineComponent, h, ref, shallowRef, useId, type PropType, type VNode } from \"vue\"\nimport s from \"@plexui/styles/components/ColorPicker/ColorPicker.module.css\"\nimport { ContextMenu, ContextMenuContent, ContextMenuTrigger } from \"../ContextMenu/index.js\"\nimport { Plus, RemoveTrash } from \"../Icon/index.js\"\nimport { MenuItem } from \"../Menu/index.js\"\nimport { PageControl } from \"../PageControl/index.js\"\nimport { prefersReducedMotion } from \"../../lib/helpers.js\"\nimport { SegmentedControl, SegmentedControlOption } from \"../SegmentedControl/index.js\"\nimport { SliderRoot, SliderThumb, SliderTrack } from \"../Slider/sliderPrimitive.js\"\nimport {\n alphaPercent,\n channelTrack,\n COLOR_PICKER_CHANNELS,\n COLOR_PICKER_GRID_COLUMNS,\n COLOR_PICKER_MODES,\n COLOR_PICKER_SWATCHES_PER_PAGE,\n cssColor,\n formatColor,\n gridColor,\n gridIndex,\n gridMove,\n hexDigits,\n listMove,\n opacityTrack,\n parseColor,\n parseNumber,\n sameRgb,\n spectrumColor,\n spectrumPoint,\n swatchPageCount,\n type ColorPickerMode,\n type Rgba,\n type SpectrumPoint,\n} from \"./shared.js\"\n\n// Vue port of packages/ui/src/components/ColorPicker/ColorPicker.tsx: the same DOM (the Mode segmented control,\n// Grid, Spectrum or Sliders, the Opacity slider and the saved colors with Add), keys and pointer. React's\n// `value` + `onChange` become `value` + `update:value` (`v-model:value`) and `change`; `onModeChange` becomes\n// `update:mode` (`v-model:mode`) and `modeChange`; `onSwatchesChange` becomes `update:swatches`\n// (`v-model:swatches`) and `swatchesChange`.\n\nconst BLACK: Rgba = { r: 0, g: 0, b: 0, a: 1 }\nconst GRID_CELLS = COLOR_PICKER_GRID_COLUMNS * 10\nconst NAVIGATION_KEYS = [\"ArrowRight\", \"ArrowLeft\", \"ArrowDown\", \"ArrowUp\", \"Home\", \"End\"]\n\ntype Select = (color: Rgba) => void\n\ntype ColorSliderOptions = {\n labelId: string\n value: number\n max: number\n track: string\n valueText: string\n onChange: (value: number) => void\n}\n\n/** A slider on a colored track, after the kit's Opacity slider (515:47434): a 36px ring on a 40px capsule. */\nconst colorSlider = ({ labelId, value, max, track, valueText, onChange }: ColorSliderOptions) =>\n h(\"div\", { class: s.Track, style: { \"--color-picker-track\": track } }, [\n h(\n SliderRoot,\n {\n class: s.SliderRoot,\n min: 0,\n max,\n step: 1,\n values: [value],\n onValueChange: ([next]: number[]) => onChange(next ?? value),\n },\n {\n default: () => [\n h(SliderTrack, { class: s.SliderTrack }),\n h(SliderThumb, { \"class\": s.Knob, \"aria-labelledby\": labelId, \"aria-valuetext\": valueText }),\n ],\n },\n ),\n ])\n\n/** The value beside a slider, after the kit's Percentage field (515:47438); typing a value and Enter or leaving it applies it. */\nconst ColorField = defineComponent({\n name: \"ColorPickerField\",\n props: {\n value: { type: String, required: true },\n label: String,\n labelledBy: String,\n inputMode: { type: String as PropType<\"numeric\" | \"text\">, required: true },\n wide: { type: Boolean, default: false },\n onCommit: { type: Function as PropType<(text: string) => void>, required: true },\n },\n setup(props) {\n const draft = ref<string | null>(null)\n const commit = () => {\n if (draft.value !== null) props.onCommit(draft.value)\n draft.value = null\n }\n return () =>\n h(\"input\", {\n \"class\": s.Field,\n \"data-wide\": props.wide ? \"\" : undefined,\n \"type\": \"text\",\n \"inputmode\": props.inputMode,\n \"autocomplete\": \"off\",\n \"spellcheck\": \"false\",\n \"aria-label\": props.label,\n \"aria-labelledby\": props.labelledBy,\n \"value\": draft.value ?? props.value,\n \"onFocus\": (event: FocusEvent) => {\n draft.value = props.value\n ;(event.currentTarget as HTMLInputElement).select()\n },\n \"onInput\": (event: Event) => {\n draft.value = (event.currentTarget as HTMLInputElement).value\n },\n \"onBlur\": commit,\n \"onKeydown\": (event: KeyboardEvent) => {\n if (event.key !== \"Enter\") return\n event.preventDefault()\n commit()\n },\n })\n },\n})\n\n/** The kit's Color Grid: twelve hues across, grays then nine shades down; the selected cell has a 3px white ring. */\nconst colorGrid = (color: Rgba, onSelect: Select) => {\n const selected = gridIndex(color)\n const focusable = selected === -1 ? 0 : selected\n\n const onKeydown = (event: KeyboardEvent) => {\n const from = Number((event.target as HTMLElement).dataset.index)\n if (!Number.isInteger(from) || !NAVIGATION_KEYS.includes(event.key)) return\n event.preventDefault()\n const next = gridMove(from, event.key)\n if (next === from) return\n const cell = (event.currentTarget as HTMLElement).querySelector<HTMLElement>(`[data-index=\"${next}\"]`)\n cell?.focus()\n onSelect({ ...(parseColor(gridColor(next)) ?? BLACK), a: color.a })\n }\n\n return h(\n \"div\",\n { \"role\": \"radiogroup\", \"aria-label\": \"Grid\", \"class\": s.Grid, onKeydown },\n Array.from({ length: GRID_CELLS }, (_, index) => {\n const hex = gridColor(index)\n return h(\"button\", {\n \"key\": hex,\n \"type\": \"button\",\n \"role\": \"radio\",\n \"aria-checked\": index === selected,\n \"aria-label\": hex.toUpperCase(),\n \"tabindex\": index === focusable ? 0 : -1,\n \"data-index\": index,\n \"class\": s.Cell,\n \"style\": { backgroundColor: hex },\n \"onClick\": () => onSelect({ ...(parseColor(hex) ?? BLACK), a: color.a }),\n })\n }),\n )\n}\n\nconst SPECTRUM_STEP = 0.01\n\n/**\n * The spectrum: hue from top to bottom, white to the full hue to black across. Up and Down change the hue, Left\n * and Right the lightness, by 1% (10% with Shift or Page Up and Page Down).\n */\nconst ColorSpectrum = defineComponent({\n name: \"ColorPickerSpectrum\",\n props: {\n color: { type: Object as PropType<Rgba>, required: true },\n onSelect: { type: Function as PropType<Select>, required: true },\n },\n setup(props) {\n const held = shallowRef<{ point: SpectrumPoint; digits: string }>({ point: spectrumPoint(props.color), digits: hexDigits(props.color) })\n // The point the picker last chose stays while the color is the one it chose: a hex color loses the exact point,\n // and a gray or white has no hue of its own.\n const point = computed(() => (held.value.digits === hexDigits(props.color) ? held.value.point : spectrumPoint(props.color, held.value.point)))\n\n const choose = (next: SpectrumPoint) => {\n const clamped = { x: Math.min(1, Math.max(0, next.x)), y: Math.min(1, Math.max(0, next.y)) }\n const chosen = spectrumColor(clamped, props.color.a)\n held.value = { point: clamped, digits: hexDigits(chosen) }\n props.onSelect(chosen)\n }\n\n const fromPointer = (event: PointerEvent) => {\n const box = (event.currentTarget as HTMLElement).getBoundingClientRect()\n if (box.width === 0 || box.height === 0) return\n choose({ x: (event.clientX - box.left) / box.width, y: (event.clientY - box.top) / box.height })\n }\n\n const onKeydown = (event: KeyboardEvent) => {\n const { x, y } = point.value\n const step = event.shiftKey ? SPECTRUM_STEP * 10 : SPECTRUM_STEP\n const moves: Record<string, SpectrumPoint> = {\n ArrowLeft: { x: x - step, y },\n ArrowRight: { x: x + step, y },\n ArrowUp: { x, y: y - step },\n ArrowDown: { x, y: y + step },\n PageUp: { x, y: y - SPECTRUM_STEP * 10 },\n PageDown: { x, y: y + SPECTRUM_STEP * 10 },\n }\n const next = moves[event.key]\n if (!next) return\n event.preventDefault()\n choose(next)\n }\n\n return () => {\n const { x, y } = point.value\n const hue = Math.round(y * 360)\n return h(\n \"div\",\n {\n \"role\": \"slider\",\n \"tabindex\": 0,\n \"aria-label\": \"Spectrum\",\n \"aria-valuemin\": 0,\n \"aria-valuemax\": 360,\n \"aria-valuenow\": hue,\n \"aria-valuetext\": `#${hexDigits(props.color)}, hue ${hue}°, lightness ${Math.round((1 - x) * 100)}%`,\n \"class\": s.Spectrum,\n \"onPointerdown\": (event: PointerEvent) => {\n if (event.button !== 0) return\n const target = event.currentTarget as HTMLElement\n target.setPointerCapture?.(event.pointerId)\n target.focus({ preventScroll: true })\n fromPointer(event)\n },\n \"onPointermove\": (event: PointerEvent) => {\n if ((event.currentTarget as HTMLElement).hasPointerCapture?.(event.pointerId)) fromPointer(event)\n },\n onKeydown,\n },\n [h(\"span\", { class: s.Loupe, style: { left: `${x * 100}%`, top: `${y * 100}%`, backgroundColor: cssColor(props.color, 1) } })],\n )\n }\n },\n})\n\n/** Red, Green and Blue, each a slider and a field from 0 to 255, then the Hex field. */\nconst colorSliders = (uid: string, color: Rgba, onSelect: Select) =>\n h(\"div\", { class: s.Sliders }, [\n ...COLOR_PICKER_CHANNELS.map(({ channel, label }) => {\n const labelId = `${uid}-${channel}`\n return h(\"div\", { key: channel, class: s.Channel }, [\n h(\"span\", { id: labelId, class: s.Label }, label),\n h(\"div\", { class: s.Row }, [\n colorSlider({\n labelId,\n value: color[channel],\n max: 255,\n track: channelTrack(color, channel),\n valueText: String(color[channel]),\n onChange: (next) => onSelect({ ...color, [channel]: next }),\n }),\n h(ColorField, {\n value: String(color[channel]),\n labelledBy: labelId,\n inputMode: \"numeric\",\n onCommit: (text: string) => {\n const next = parseNumber(text, 0, 255)\n if (next !== null) onSelect({ ...color, [channel]: next })\n },\n }),\n ]),\n ])\n }),\n h(\"div\", { class: s.Hex }, [\n h(\"span\", { id: `${uid}-hex`, class: s.Label }, \"Hex Color #\"),\n h(ColorField, {\n value: hexDigits(color),\n labelledBy: `${uid}-hex`,\n inputMode: \"text\",\n wide: true,\n onCommit: (text: string) => {\n const next = parseColor(text)\n if (next) onSelect({ ...next, a: color.a })\n },\n }),\n ]),\n ])\n\nconst colorName = (color: Rgba) => `#${hexDigits(color)}${color.a < 1 ? `, ${alphaPercent(color.a)}% opacity` : \"\"}`\n\n/**\n * The current color, and the saved colors in pages of two rows of five with Add after the last (kit Swatches\n * 515:46585). A saved color is a radio; Delete or Backspace, or Delete in its context menu, removes it.\n */\nconst ColorSwatches = defineComponent({\n name: \"ColorPickerSwatches\",\n props: {\n color: { type: Object as PropType<Rgba>, required: true },\n swatches: { type: Array as PropType<string[]>, required: true },\n onSelect: { type: Function as PropType<Select>, required: true },\n onChange: { type: Function as PropType<(swatches: string[]) => void>, required: true },\n },\n setup(props) {\n const pagesRef = ref<HTMLElement | null>(null)\n const page = ref(0)\n\n const reveal = (element: HTMLElement | null | undefined) => element?.scrollIntoView?.({ block: \"nearest\", inline: \"nearest\" })\n\n const remove = (index: number, pages: HTMLElement | null) => {\n const { swatches } = props\n props.onChange(swatches.filter((_, i) => i !== index))\n // Focus stays in the list: on the color that takes the place, the one before at the end, or Add.\n const target = Math.min(index, swatches.length - 2)\n requestAnimationFrame(() => {\n const next = target >= 0 ? pages?.querySelector<HTMLElement>(`[data-swatch=\"${target}\"]`) : pages?.querySelector<HTMLElement>(\"[data-add]\")\n next?.focus()\n reveal(next)\n })\n }\n\n return () => {\n const { color, swatches } = props\n const saved = swatches.map((hex) => parseColor(hex) ?? BLACK)\n const current = formatColor(color)\n const checked = saved.findIndex((swatch) => sameRgb(swatch, color) && alphaPercent(swatch.a) === alphaPercent(color.a))\n const focusable = checked === -1 ? 0 : checked\n const pageCount = swatchPageCount(swatches.length)\n\n const onKeydown = (event: KeyboardEvent) => {\n const from = Number((event.target as HTMLElement).dataset.swatch)\n if (!Number.isInteger(from)) return\n if (event.key === \"Delete\" || event.key === \"Backspace\") {\n event.preventDefault()\n remove(from, event.currentTarget as HTMLElement)\n return\n }\n if (!NAVIGATION_KEYS.includes(event.key)) return\n event.preventDefault()\n const next = listMove(from, swatches.length, event.key)\n if (next === from) return\n const element = (event.currentTarget as HTMLElement).querySelector<HTMLElement>(`[data-swatch=\"${next}\"]`)\n element?.focus()\n reveal(element)\n const swatch = saved[next]\n if (swatch) props.onSelect(swatch)\n }\n\n const items = [...swatches.map((hex, index) => ({ hex, index })), null]\n const pages = Array.from({ length: pageCount }, (_, p) => items.slice(p * COLOR_PICKER_SWATCHES_PER_PAGE, (p + 1) * COLOR_PICKER_SWATCHES_PER_PAGE))\n\n const swatchButton = (index: number): VNode => {\n const swatch = saved[index] ?? BLACK\n return h(ContextMenu, { key: `${index}-${swatches[index]}` }, () => [\n h(ContextMenuTrigger, null, () =>\n h(\n \"button\",\n {\n \"type\": \"button\",\n \"role\": \"radio\",\n \"aria-checked\": index === checked,\n \"aria-label\": colorName(swatch),\n \"tabindex\": index === focusable ? 0 : -1,\n \"data-swatch\": index,\n \"class\": s.Swatch,\n \"onClick\": () => props.onSelect(swatch),\n },\n [h(\"span\", { class: s.SwatchFill, style: { backgroundColor: cssColor(swatch) } })],\n ),\n ),\n h(ContextMenuContent, null, () =>\n h(MenuItem, { danger: true, onSelect: () => remove(index, pagesRef.value) }, () => [h(RemoveTrash, { width: 20, height: 20 }), \" Delete\"]),\n ),\n ])\n }\n\n const addButton = () =>\n h(\n \"button\",\n {\n \"key\": \"add\",\n \"type\": \"button\",\n \"data-add\": \"\",\n \"class\": s.Add,\n \"aria-label\": \"Add color\",\n \"onClick\": (event: MouseEvent) => {\n props.onChange([...swatches, current])\n const add = event.currentTarget as HTMLElement\n requestAnimationFrame(() => reveal(add))\n },\n },\n [h(Plus)],\n )\n\n return h(\"div\", { class: s.Swatches }, [\n h(\"div\", { \"role\": \"img\", \"aria-label\": `Selected color ${colorName(color)}`, \"class\": s.Current }, [\n h(\"span\", { class: s.CurrentFill, style: { backgroundColor: cssColor(color) } }),\n ]),\n h(\"div\", { class: s.Saved }, [\n h(\n \"div\",\n {\n \"ref\": pagesRef,\n \"role\": \"radiogroup\",\n \"aria-label\": \"Saved colors\",\n \"class\": s.Pages,\n onKeydown,\n \"onScroll\": (event: Event) => {\n const { scrollLeft, clientWidth } = event.currentTarget as HTMLElement\n if (clientWidth > 0) page.value = Math.round(scrollLeft / clientWidth)\n },\n },\n pages.map((pageItems, p) =>\n h(\"div\", { key: p, class: s.Page }, pageItems.map((item) => (item === null ? addButton() : swatchButton(item.index)))),\n ),\n ),\n // The row of the page control keeps its height with one page, so the picker does not change size.\n h(\n \"div\",\n { class: s.PageControlRow },\n pageCount > 1\n ? [\n h(PageControl, {\n \"count\": pageCount,\n \"value\": Math.min(page.value, pageCount - 1),\n \"ariaLabel\": \"Saved color pages\",\n \"onUpdate:value\": (index: number) => {\n const pagesElement = pagesRef.value\n if (!pagesElement) return\n page.value = index\n pagesElement.scrollTo?.({ left: index * pagesElement.clientWidth, behavior: prefersReducedMotion() ? \"auto\" : \"smooth\" })\n },\n }),\n ]\n : [],\n ),\n ]),\n ])\n }\n },\n})\n\nconst ColorPickerComponent = defineComponent({\n name: \"ColorPicker\",\n inheritAttrs: false,\n props: {\n /** The `id` of the picker. */\n id: String,\n /** The controlled color, `#rrggbb` or `#rrggbbaa`. Bind with `v-model:value`. */\n value: { type: String, default: undefined },\n /** The color when it is initially rendered. Use when you do not need to control the color. @default \"#000000\" */\n defaultValue: { type: String, default: undefined },\n /** Shows the Opacity slider, as `supportsAlpha` of the system picker. @default true */\n supportsAlpha: { type: Boolean, default: true },\n /** The controlled way to choose a color. Bind with `v-model:mode`. */\n mode: { type: String as PropType<ColorPickerMode>, default: undefined },\n /** The way to choose a color when the picker is initially rendered. @default \"grid\" */\n defaultMode: { type: String as PropType<ColorPickerMode>, default: \"grid\" },\n /** The controlled saved colors. Bind with `v-model:swatches`. */\n swatches: { type: Array as PropType<string[]>, default: undefined },\n /** The saved colors when the picker is initially rendered. @default [] */\n defaultSwatches: { type: Array as PropType<string[]>, default: undefined },\n /** Accessible name of the picker. @default \"Colors\" */\n ariaLabel: { type: String, default: \"Colors\" },\n },\n emits: {\n /** The color changed: `#rrggbb`, or `#rrggbbaa` when it is not opaque */\n \"update:value\": (value: string) => typeof value === \"string\",\n /** The color changed (React `onChange`) */\n \"change\": (value: string) => typeof value === \"string\",\n /** Another of Grid, Spectrum and Sliders was chosen */\n \"update:mode\": (mode: ColorPickerMode) => typeof mode === \"string\",\n /** Another way was chosen (React `onModeChange`) */\n \"modeChange\": (mode: ColorPickerMode) => typeof mode === \"string\",\n /** Add saved the current color or Delete removed one */\n \"update:swatches\": (swatches: string[]) => Array.isArray(swatches),\n /** The saved colors changed (React `onSwatchesChange`) */\n \"swatchesChange\": (swatches: string[]) => Array.isArray(swatches),\n },\n setup(props, { attrs, emit }) {\n const uid = useId()\n const internalValue = ref(props.defaultValue ?? \"#000000\")\n const color = computed(() => parseColor(props.value ?? internalValue.value) ?? BLACK)\n\n const internalMode = ref<ColorPickerMode>(props.defaultMode)\n const mode = computed(() => props.mode ?? internalMode.value)\n\n const internalSwatches = ref<string[]>(props.defaultSwatches ?? [])\n const swatches = computed(() => props.swatches ?? internalSwatches.value)\n\n const commit = (next: Rgba) => {\n const formatted = formatColor(props.supportsAlpha ? next : { ...next, a: 1 })\n // Only a color other than the one shown is reported; an owner that keeps its color hears every new choice.\n if (formatted === formatColor(color.value)) return\n // A controlled color changes only when the owner passes it back.\n if (props.value === undefined) internalValue.value = formatted\n emit(\"update:value\", formatted)\n emit(\"change\", formatted)\n }\n\n const changeMode = (next: string) => {\n const chosen = next as ColorPickerMode\n if (props.mode === undefined) internalMode.value = chosen\n emit(\"update:mode\", chosen)\n emit(\"modeChange\", chosen)\n }\n\n const changeSwatches = (next: string[]) => {\n if (props.swatches === undefined) internalSwatches.value = next\n emit(\"update:swatches\", next)\n emit(\"swatchesChange\", next)\n }\n\n return () => {\n const current = color.value\n const opacityId = `${uid}-opacity`\n return h(\n \"div\",\n {\n ...attrs,\n \"id\": props.id,\n \"role\": \"group\",\n \"aria-label\": props.ariaLabel,\n \"class\": [s.ColorPicker, attrs.class],\n \"data-mode\": mode.value,\n },\n [\n h(\n SegmentedControl,\n { \"aria-label\": \"Mode\", \"value\": mode.value, \"block\": true, \"class\": s.Modes, \"onChange\": changeMode },\n { default: () => COLOR_PICKER_MODES.map((option) => h(SegmentedControlOption, { key: option.value, value: option.value }, () => option.label)) },\n ),\n h(\"div\", { class: s.Body }, [\n mode.value === \"grid\" ? colorGrid(current, commit) : null,\n mode.value === \"spectrum\" ? h(ColorSpectrum, { color: current, onSelect: commit }) : null,\n mode.value === \"sliders\" ? colorSliders(uid, current, commit) : null,\n ]),\n props.supportsAlpha\n ? h(\"div\", { class: s.Opacity }, [\n h(\"span\", { id: opacityId, class: s.Label }, \"Opacity\"),\n h(\"div\", { class: s.Row }, [\n colorSlider({\n labelId: opacityId,\n value: alphaPercent(current.a),\n max: 100,\n track: opacityTrack(current),\n valueText: `${alphaPercent(current.a)}%`,\n onChange: (percent) => commit({ ...color.value, a: percent / 100 }),\n }),\n h(ColorField, {\n value: `${alphaPercent(current.a)}%`,\n labelledBy: opacityId,\n inputMode: \"numeric\",\n onCommit: (text: string) => {\n const percent = parseNumber(text, 0, 100)\n if (percent !== null) commit({ ...color.value, a: percent / 100 })\n },\n }),\n ]),\n ])\n : null,\n h(ColorSwatches, { color: current, swatches: swatches.value, onSelect: commit, onChange: changeSwatches }),\n ],\n )\n }\n },\n})\n\nexport type ColorPickerProps = InstanceType<typeof ColorPickerComponent>[\"$props\"]\n\n/**\n * The system color picker of iOS 26 (kit Color Picker - iPhone 0:5275): Grid, Spectrum and Sliders, the Opacity\n * slider, and the saved colors with Add. Show it inside a Popover or a Sheet, or use `ColorWell`, which does.\n */\nexport const ColorPicker = ColorPickerComponent\n"]}
1
+ {"version":3,"file":"ColorPicker.js","sourceRoot":"","sources":["../../../../src/components/ColorPicker/ColorPicker.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,GAAG,EAAE,UAAU,EAAE,KAAK,EAA6B,MAAM,KAAK,CAAA;AACrG,OAAO,CAAC,MAAM,8DAA8D,CAAA;AAC5E,OAAO,EAAE,WAAW,EAAE,kBAAkB,EAAE,kBAAkB,EAAE,MAAM,yBAAyB,CAAA;AAC7F,OAAO,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAA;AAC3C,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAA;AACrD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAA;AAC3D,OAAO,EAAE,gBAAgB,EAAE,sBAAsB,EAAE,MAAM,8BAA8B,CAAA;AACvF,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAA;AACnF,OAAO,EACL,YAAY,EACZ,YAAY,EACZ,qBAAqB,EACrB,yBAAyB,EACzB,kBAAkB,EAClB,8BAA8B,EAC9B,QAAQ,EACR,WAAW,EACX,SAAS,EACT,SAAS,EACT,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,WAAW,EACX,OAAO,EACP,aAAa,EACb,aAAa,EACb,eAAe,GAIhB,MAAM,aAAa,CAAA;AAEpB,g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AACH,MAAM,CAAC,MAAM,WAAW,GAAG,oBAAoB,CAAA","sourcesContent":["import { computed, defineComponent, h, ref, shallowRef, useId, type PropType, type VNode } from \"vue\"\nimport s from \"@plexui/styles/components/ColorPicker/ColorPicker.module.css\"\nimport { ContextMenu, ContextMenuContent, ContextMenuTrigger } from \"../ContextMenu/index.js\"\nimport { Plus, RemoveTrash } from \"../Icon/index.js\"\nimport { MenuItem } from \"../Menu/index.js\"\nimport { PageControl } from \"../PageControl/index.js\"\nimport { prefersReducedMotion } from \"../../lib/helpers.js\"\nimport { SegmentedControl, SegmentedControlOption } from \"../SegmentedControl/index.js\"\nimport { SliderRoot, SliderThumb, SliderTrack } from \"../Slider/sliderPrimitive.js\"\nimport {\n alphaPercent,\n channelTrack,\n COLOR_PICKER_CHANNELS,\n COLOR_PICKER_GRID_COLUMNS,\n COLOR_PICKER_MODES,\n COLOR_PICKER_SWATCHES_PER_PAGE,\n cssColor,\n formatColor,\n gridColor,\n gridIndex,\n gridMove,\n hexDigits,\n listMove,\n opacityTrack,\n parseColor,\n parseNumber,\n sameRgb,\n spectrumColor,\n spectrumPoint,\n swatchPageCount,\n type ColorPickerMode,\n type Rgba,\n type SpectrumPoint,\n} from \"./shared.js\"\n\n// Vue port of packages/ui/src/components/ColorPicker/ColorPicker.tsx: the same DOM (the Mode segmented control,\n// Grid, Spectrum or Sliders, the Opacity slider and the saved colors with Add), keys and pointer. React's\n// `value` + `onChange` become `value` + `update:value` (`v-model:value`) and `change`; `onModeChange` becomes\n// `update:mode` (`v-model:mode`) and `modeChange`; `onSwatchesChange` becomes `update:swatches`\n// (`v-model:swatches`) and `swatchesChange`.\n\nconst BLACK: Rgba = { r: 0, g: 0, b: 0, a: 1 }\nconst GRID_CELLS = COLOR_PICKER_GRID_COLUMNS * 10\nconst NAVIGATION_KEYS = [\"ArrowRight\", \"ArrowLeft\", \"ArrowDown\", \"ArrowUp\", \"Home\", \"End\"]\n\ntype Select = (color: Rgba) => void\n\ntype ColorSliderOptions = {\n labelId: string\n value: number\n max: number\n track: string\n /** The knob's fill: the current color, as iOS 27.2 fills it (opaque on a channel, at its opacity on Opacity). */\n fill: string\n valueText: string\n onChange: (value: number) => void\n}\n\n/** A slider on a colored track, after the kit's Opacity slider (515:47434): a ring filled with the color on a capsule. */\nconst colorSlider = ({ labelId, value, max, track, fill, valueText, onChange }: ColorSliderOptions) =>\n h(\"div\", { class: s.Track, style: { \"--color-picker-track\": track } }, [\n h(\n SliderRoot,\n {\n class: s.SliderRoot,\n min: 0,\n max,\n step: 1,\n values: [value],\n onValueChange: ([next]: number[]) => onChange(next ?? value),\n },\n {\n default: () => [\n h(SliderTrack, { class: s.SliderTrack }),\n h(SliderThumb, { \"class\": s.Knob, \"style\": { backgroundColor: fill }, \"aria-labelledby\": labelId, \"aria-valuetext\": valueText }),\n ],\n },\n ),\n ])\n\n/** The value beside a slider, after the kit's Percentage field (515:47438); typing a value and Enter or leaving it applies it. */\nconst ColorField = defineComponent({\n name: \"ColorPickerField\",\n props: {\n value: { type: String, required: true },\n label: String,\n labelledBy: String,\n inputMode: { type: String as PropType<\"numeric\" | \"text\">, required: true },\n wide: { type: Boolean, default: false },\n onCommit: { type: Function as PropType<(text: string) => void>, required: true },\n },\n setup(props) {\n const draft = ref<string | null>(null)\n const commit = () => {\n if (draft.value !== null) props.onCommit(draft.value)\n draft.value = null\n }\n return () =>\n h(\"input\", {\n \"class\": s.Field,\n \"data-wide\": props.wide ? \"\" : undefined,\n \"type\": \"text\",\n \"inputmode\": props.inputMode,\n \"autocomplete\": \"off\",\n \"spellcheck\": \"false\",\n \"aria-label\": props.label,\n \"aria-labelledby\": props.labelledBy,\n \"value\": draft.value ?? props.value,\n \"onFocus\": (event: FocusEvent) => {\n draft.value = props.value\n ;(event.currentTarget as HTMLInputElement).select()\n },\n \"onInput\": (event: Event) => {\n draft.value = (event.currentTarget as HTMLInputElement).value\n },\n \"onBlur\": commit,\n \"onKeydown\": (event: KeyboardEvent) => {\n if (event.key !== \"Enter\") return\n event.preventDefault()\n commit()\n },\n })\n },\n})\n\n/** The kit's Color Grid: twelve hues across, grays then nine shades down; the selected cell has a 3px white ring. */\nconst colorGrid = (color: Rgba, onSelect: Select) => {\n const selected = gridIndex(color)\n const focusable = selected === -1 ? 0 : selected\n\n const onKeydown = (event: KeyboardEvent) => {\n const from = Number((event.target as HTMLElement).dataset.index)\n if (!Number.isInteger(from) || !NAVIGATION_KEYS.includes(event.key)) return\n event.preventDefault()\n const next = gridMove(from, event.key)\n if (next === from) return\n const cell = (event.currentTarget as HTMLElement).querySelector<HTMLElement>(`[data-index=\"${next}\"]`)\n cell?.focus()\n onSelect({ ...(parseColor(gridColor(next)) ?? BLACK), a: color.a })\n }\n\n return h(\n \"div\",\n { \"role\": \"radiogroup\", \"aria-label\": \"Grid\", \"class\": s.Grid, onKeydown },\n Array.from({ length: GRID_CELLS }, (_, index) => {\n const hex = gridColor(index)\n return h(\"button\", {\n \"key\": hex,\n \"type\": \"button\",\n \"role\": \"radio\",\n \"aria-checked\": index === selected,\n \"aria-label\": hex.toUpperCase(),\n \"tabindex\": index === focusable ? 0 : -1,\n \"data-index\": index,\n \"class\": s.Cell,\n \"style\": { backgroundColor: hex },\n \"onClick\": () => onSelect({ ...(parseColor(hex) ?? BLACK), a: color.a }),\n })\n }),\n )\n}\n\nconst SPECTRUM_STEP = 0.01\n\n/**\n * The spectrum: hue from top to bottom, white to the full hue to black across. Up and Down change the hue, Left\n * and Right the lightness, by 1% (10% with Shift or Page Up and Page Down).\n */\nconst ColorSpectrum = defineComponent({\n name: \"ColorPickerSpectrum\",\n props: {\n color: { type: Object as PropType<Rgba>, required: true },\n onSelect: { type: Function as PropType<Select>, required: true },\n },\n setup(props) {\n const held = shallowRef<{ point: SpectrumPoint; digits: string }>({ point: spectrumPoint(props.color), digits: hexDigits(props.color) })\n // The point the picker last chose stays while the color is the one it chose: a hex color loses the exact point,\n // and a gray or white has no hue of its own.\n const point = computed(() => (held.value.digits === hexDigits(props.color) ? held.value.point : spectrumPoint(props.color, held.value.point)))\n\n const choose = (next: SpectrumPoint) => {\n const clamped = { x: Math.min(1, Math.max(0, next.x)), y: Math.min(1, Math.max(0, next.y)) }\n const chosen = spectrumColor(clamped, props.color.a)\n held.value = { point: clamped, digits: hexDigits(chosen) }\n props.onSelect(chosen)\n }\n\n const fromPointer = (event: PointerEvent) => {\n const box = (event.currentTarget as HTMLElement).getBoundingClientRect()\n if (box.width === 0 || box.height === 0) return\n choose({ x: (event.clientX - box.left) / box.width, y: (event.clientY - box.top) / box.height })\n }\n\n const onKeydown = (event: KeyboardEvent) => {\n const { x, y } = point.value\n const step = event.shiftKey ? SPECTRUM_STEP * 10 : SPECTRUM_STEP\n const moves: Record<string, SpectrumPoint> = {\n ArrowLeft: { x: x - step, y },\n ArrowRight: { x: x + step, y },\n ArrowUp: { x, y: y - step },\n ArrowDown: { x, y: y + step },\n PageUp: { x, y: y - SPECTRUM_STEP * 10 },\n PageDown: { x, y: y + SPECTRUM_STEP * 10 },\n }\n const next = moves[event.key]\n if (!next) return\n event.preventDefault()\n choose(next)\n }\n\n return () => {\n const { x, y } = point.value\n const hue = Math.round(y * 360)\n return h(\n \"div\",\n {\n \"role\": \"slider\",\n \"tabindex\": 0,\n \"aria-label\": \"Spectrum\",\n \"aria-valuemin\": 0,\n \"aria-valuemax\": 360,\n \"aria-valuenow\": hue,\n \"aria-valuetext\": `#${hexDigits(props.color)}, hue ${hue}°, lightness ${Math.round((1 - x) * 100)}%`,\n \"class\": s.Spectrum,\n \"onPointerdown\": (event: PointerEvent) => {\n if (event.button !== 0) return\n const target = event.currentTarget as HTMLElement\n target.setPointerCapture?.(event.pointerId)\n target.focus({ preventScroll: true })\n fromPointer(event)\n },\n \"onPointermove\": (event: PointerEvent) => {\n if ((event.currentTarget as HTMLElement).hasPointerCapture?.(event.pointerId)) fromPointer(event)\n },\n onKeydown,\n },\n [h(\"span\", { class: s.Loupe, style: { left: `${x * 100}%`, top: `${y * 100}%`, backgroundColor: cssColor(props.color, 1) } })],\n )\n }\n },\n})\n\n/** Red, Green and Blue, each a slider and a field from 0 to 255, then the Hex field. */\nconst colorSliders = (uid: string, color: Rgba, onSelect: Select) =>\n h(\"div\", { class: s.Sliders }, [\n ...COLOR_PICKER_CHANNELS.map(({ channel, label }) => {\n const labelId = `${uid}-${channel}`\n return h(\"div\", { key: channel, class: s.Channel }, [\n h(\"span\", { id: labelId, class: s.Label }, label),\n h(\"div\", { class: s.Row }, [\n colorSlider({\n labelId,\n value: color[channel],\n max: 255,\n track: channelTrack(color, channel),\n fill: cssColor(color, 1),\n valueText: String(color[channel]),\n onChange: (next) => onSelect({ ...color, [channel]: next }),\n }),\n h(ColorField, {\n value: String(color[channel]),\n labelledBy: labelId,\n inputMode: \"numeric\",\n onCommit: (text: string) => {\n const next = parseNumber(text, 0, 255)\n if (next !== null) onSelect({ ...color, [channel]: next })\n },\n }),\n ]),\n ])\n }),\n h(\"div\", { class: s.Hex }, [\n h(\"span\", { id: `${uid}-hex`, class: s.HexLabel }, \"Hex Color #\"),\n h(ColorField, {\n value: hexDigits(color),\n labelledBy: `${uid}-hex`,\n inputMode: \"text\",\n wide: true,\n onCommit: (text: string) => {\n const next = parseColor(text)\n if (next) onSelect({ ...next, a: color.a })\n },\n }),\n ]),\n ])\n\nconst colorName = (color: Rgba) => `#${hexDigits(color)}${color.a < 1 ? `, ${alphaPercent(color.a)}% opacity` : \"\"}`\n\n/**\n * The current color, and the saved colors in pages of two rows of six with Add after the last (iOS 27.2; kit\n * Swatches 515:46585 had rows of five). A saved color is a radio; Delete or Backspace, or Delete in its context\n * menu, removes it.\n */\nconst ColorSwatches = defineComponent({\n name: \"ColorPickerSwatches\",\n props: {\n color: { type: Object as PropType<Rgba>, required: true },\n swatches: { type: Array as PropType<string[]>, required: true },\n onSelect: { type: Function as PropType<Select>, required: true },\n onChange: { type: Function as PropType<(swatches: string[]) => void>, required: true },\n },\n setup(props) {\n const pagesRef = ref<HTMLElement | null>(null)\n const page = ref(0)\n\n const reveal = (element: HTMLElement | null | undefined) => element?.scrollIntoView?.({ block: \"nearest\", inline: \"nearest\" })\n\n const remove = (index: number, pages: HTMLElement | null) => {\n const { swatches } = props\n props.onChange(swatches.filter((_, i) => i !== index))\n // Focus stays in the list: on the color that takes the place, the one before at the end, or Add.\n const target = Math.min(index, swatches.length - 2)\n requestAnimationFrame(() => {\n const next = target >= 0 ? pages?.querySelector<HTMLElement>(`[data-swatch=\"${target}\"]`) : pages?.querySelector<HTMLElement>(\"[data-add]\")\n next?.focus()\n reveal(next)\n })\n }\n\n return () => {\n const { color, swatches } = props\n const saved = swatches.map((hex) => parseColor(hex) ?? BLACK)\n const current = formatColor(color)\n const checked = saved.findIndex((swatch) => sameRgb(swatch, color) && alphaPercent(swatch.a) === alphaPercent(color.a))\n const focusable = checked === -1 ? 0 : checked\n const pageCount = swatchPageCount(swatches.length)\n\n const onKeydown = (event: KeyboardEvent) => {\n const from = Number((event.target as HTMLElement).dataset.swatch)\n if (!Number.isInteger(from)) return\n if (event.key === \"Delete\" || event.key === \"Backspace\") {\n event.preventDefault()\n remove(from, event.currentTarget as HTMLElement)\n return\n }\n if (!NAVIGATION_KEYS.includes(event.key)) return\n event.preventDefault()\n const next = listMove(from, swatches.length, event.key)\n if (next === from) return\n const element = (event.currentTarget as HTMLElement).querySelector<HTMLElement>(`[data-swatch=\"${next}\"]`)\n element?.focus()\n reveal(element)\n const swatch = saved[next]\n if (swatch) props.onSelect(swatch)\n }\n\n const items = [...swatches.map((hex, index) => ({ hex, index })), null]\n const pages = Array.from({ length: pageCount }, (_, p) => items.slice(p * COLOR_PICKER_SWATCHES_PER_PAGE, (p + 1) * COLOR_PICKER_SWATCHES_PER_PAGE))\n\n const swatchButton = (index: number): VNode => {\n const swatch = saved[index] ?? BLACK\n return h(ContextMenu, { key: `${index}-${swatches[index]}` }, () => [\n h(ContextMenuTrigger, null, () =>\n h(\n \"button\",\n {\n \"type\": \"button\",\n \"role\": \"radio\",\n \"aria-checked\": index === checked,\n \"aria-label\": colorName(swatch),\n \"tabindex\": index === focusable ? 0 : -1,\n \"data-swatch\": index,\n \"class\": s.Swatch,\n \"onClick\": () => props.onSelect(swatch),\n },\n [h(\"span\", { class: s.SwatchFill, style: { backgroundColor: cssColor(swatch) } })],\n ),\n ),\n h(ContextMenuContent, null, () =>\n h(MenuItem, { danger: true, onSelect: () => remove(index, pagesRef.value) }, () => [h(RemoveTrash, { width: 20, height: 20 }), \" Delete\"]),\n ),\n ])\n }\n\n const addButton = () =>\n h(\n \"button\",\n {\n \"key\": \"add\",\n \"type\": \"button\",\n \"data-add\": \"\",\n \"class\": s.Add,\n \"aria-label\": \"Add color\",\n \"onClick\": (event: MouseEvent) => {\n props.onChange([...swatches, current])\n const add = event.currentTarget as HTMLElement\n requestAnimationFrame(() => reveal(add))\n },\n },\n [h(Plus)],\n )\n\n return h(\"div\", { class: s.Swatches }, [\n h(\"div\", { \"role\": \"img\", \"aria-label\": `Selected color ${colorName(color)}`, \"class\": s.Current }, [\n h(\"span\", { class: s.CurrentFill, style: { backgroundColor: cssColor(color) } }),\n ]),\n h(\"div\", { class: s.Saved }, [\n h(\n \"div\",\n {\n \"ref\": pagesRef,\n \"role\": \"radiogroup\",\n \"aria-label\": \"Saved colors\",\n \"class\": s.Pages,\n onKeydown,\n \"onScroll\": (event: Event) => {\n const { scrollLeft, clientWidth } = event.currentTarget as HTMLElement\n if (clientWidth > 0) page.value = Math.round(scrollLeft / clientWidth)\n },\n },\n pages.map((pageItems, p) =>\n h(\"div\", { key: p, class: s.Page }, pageItems.map((item) => (item === null ? addButton() : swatchButton(item.index)))),\n ),\n ),\n // The row of the page control keeps its height with one page, so the picker does not change size.\n h(\n \"div\",\n { class: s.PageControlRow },\n pageCount > 1\n ? [\n h(PageControl, {\n \"count\": pageCount,\n \"value\": Math.min(page.value, pageCount - 1),\n \"ariaLabel\": \"Saved color pages\",\n \"onUpdate:value\": (index: number) => {\n const pagesElement = pagesRef.value\n if (!pagesElement) return\n page.value = index\n pagesElement.scrollTo?.({ left: index * pagesElement.clientWidth, behavior: prefersReducedMotion() ? \"auto\" : \"smooth\" })\n },\n }),\n ]\n : [],\n ),\n ]),\n ])\n }\n },\n})\n\nconst ColorPickerComponent = defineComponent({\n name: \"ColorPicker\",\n inheritAttrs: false,\n props: {\n /** The `id` of the picker. */\n id: String,\n /** The controlled color, `#rrggbb` or `#rrggbbaa`. Bind with `v-model:value`. */\n value: { type: String, default: undefined },\n /** The color when it is initially rendered. Use when you do not need to control the color. @default \"#000000\" */\n defaultValue: { type: String, default: undefined },\n /** Shows the Opacity slider, as `supportsAlpha` of the system picker. @default true */\n supportsAlpha: { type: Boolean, default: true },\n /** The controlled way to choose a color. Bind with `v-model:mode`. */\n mode: { type: String as PropType<ColorPickerMode>, default: undefined },\n /** The way to choose a color when the picker is initially rendered. @default \"grid\" */\n defaultMode: { type: String as PropType<ColorPickerMode>, default: \"grid\" },\n /** The controlled saved colors. Bind with `v-model:swatches`. */\n swatches: { type: Array as PropType<string[]>, default: undefined },\n /** The saved colors when the picker is initially rendered. @default [] */\n defaultSwatches: { type: Array as PropType<string[]>, default: undefined },\n /** Accessible name of the picker. @default \"Colors\" */\n ariaLabel: { type: String, default: \"Colors\" },\n },\n emits: {\n /** The color changed: `#rrggbb`, or `#rrggbbaa` when it is not opaque */\n \"update:value\": (value: string) => typeof value === \"string\",\n /** The color changed (React `onChange`) */\n \"change\": (value: string) => typeof value === \"string\",\n /** Another of Grid, Spectrum and Sliders was chosen */\n \"update:mode\": (mode: ColorPickerMode) => typeof mode === \"string\",\n /** Another way was chosen (React `onModeChange`) */\n \"modeChange\": (mode: ColorPickerMode) => typeof mode === \"string\",\n /** Add saved the current color or Delete removed one */\n \"update:swatches\": (swatches: string[]) => Array.isArray(swatches),\n /** The saved colors changed (React `onSwatchesChange`) */\n \"swatchesChange\": (swatches: string[]) => Array.isArray(swatches),\n },\n setup(props, { attrs, emit }) {\n const uid = useId()\n const internalValue = ref(props.defaultValue ?? \"#000000\")\n const color = computed(() => parseColor(props.value ?? internalValue.value) ?? BLACK)\n\n const internalMode = ref<ColorPickerMode>(props.defaultMode)\n const mode = computed(() => props.mode ?? internalMode.value)\n\n const internalSwatches = ref<string[]>(props.defaultSwatches ?? [])\n const swatches = computed(() => props.swatches ?? internalSwatches.value)\n\n const commit = (next: Rgba) => {\n const formatted = formatColor(props.supportsAlpha ? next : { ...next, a: 1 })\n // Only a color other than the one shown is reported; an owner that keeps its color hears every new choice.\n if (formatted === formatColor(color.value)) return\n // A controlled color changes only when the owner passes it back.\n if (props.value === undefined) internalValue.value = formatted\n emit(\"update:value\", formatted)\n emit(\"change\", formatted)\n }\n\n const changeMode = (next: string) => {\n const chosen = next as ColorPickerMode\n if (props.mode === undefined) internalMode.value = chosen\n emit(\"update:mode\", chosen)\n emit(\"modeChange\", chosen)\n }\n\n const changeSwatches = (next: string[]) => {\n if (props.swatches === undefined) internalSwatches.value = next\n emit(\"update:swatches\", next)\n emit(\"swatchesChange\", next)\n }\n\n return () => {\n const current = color.value\n const opacityId = `${uid}-opacity`\n return h(\n \"div\",\n {\n ...attrs,\n \"id\": props.id,\n \"role\": \"group\",\n \"aria-label\": props.ariaLabel,\n \"class\": [s.ColorPicker, attrs.class],\n \"data-mode\": mode.value,\n },\n [\n h(\n SegmentedControl,\n { \"aria-label\": \"Mode\", \"value\": mode.value, \"block\": true, \"class\": s.Modes, \"data-mobile-size\": \"small\", \"onChange\": changeMode },\n { default: () => COLOR_PICKER_MODES.map((option) => h(SegmentedControlOption, { key: option.value, value: option.value }, () => option.label)) },\n ),\n h(\"div\", { class: s.Body }, [\n mode.value === \"grid\" ? colorGrid(current, commit) : null,\n mode.value === \"spectrum\" ? h(ColorSpectrum, { color: current, onSelect: commit }) : null,\n mode.value === \"sliders\" ? colorSliders(uid, current, commit) : null,\n ]),\n props.supportsAlpha\n ? h(\"div\", { class: s.Opacity }, [\n h(\"span\", { id: opacityId, class: s.Label }, \"Opacity\"),\n h(\"div\", { class: s.Row }, [\n colorSlider({\n labelId: opacityId,\n value: alphaPercent(current.a),\n max: 100,\n track: opacityTrack(current),\n fill: cssColor(current),\n valueText: `${alphaPercent(current.a)}%`,\n onChange: (percent) => commit({ ...color.value, a: percent / 100 }),\n }),\n h(ColorField, {\n value: `${alphaPercent(current.a)}%`,\n labelledBy: opacityId,\n inputMode: \"numeric\",\n onCommit: (text: string) => {\n const percent = parseNumber(text, 0, 100)\n if (percent !== null) commit({ ...color.value, a: percent / 100 })\n },\n }),\n ]),\n ])\n : null,\n h(ColorSwatches, { color: current, swatches: swatches.value, onSelect: commit, onChange: changeSwatches }),\n ],\n )\n }\n },\n})\n\nexport type ColorPickerProps = InstanceType<typeof ColorPickerComponent>[\"$props\"]\n\n/**\n * The system color picker of iOS 27.2 (UIColorPickerViewController, after the iOS 26 kit's Color Picker - iPhone\n * 0:5275): Grid, Spectrum and Sliders, the Opacity slider, and the saved colors with Add. Show it inside a Popover or\n * a Sheet, or use `ColorWell`, which does.\n */\nexport const ColorPicker = ColorPickerComponent\n"]}
@@ -164,11 +164,13 @@ const ColorWellComponent = defineComponent({
164
164
  ])
165
165
  : h(Dialog, { "open": open.value, "onUpdate:open": setOpen }, () => [
166
166
  h(DialogTrigger, null, () => well),
167
- h(DialogContent, { mobileVariant: "sheet", showClose: false, class: s.Sheet }, () => [
167
+ h(DialogContent, { mobileVariant: "sheet", surface: "grouped", showClose: false, class: s.Sheet }, () => [
168
+ // iOS 27.2 sets Close first and the eyedropper last (UIColorPickerViewController on an iPhone 17); the
169
+ // iOS 26 kit had them the other way round.
168
170
  h(Toolbar, { background: "solid" }, () => [
169
- h(ToolbarLeading, null, () => eyedropperButton(true)),
171
+ h(ToolbarLeading, null, () => h(DialogClose, null, () => h(NavigationButton, { action: "close" }))),
170
172
  h(ToolbarTitle, null, () => props.title),
171
- h(ToolbarTrailing, null, () => h(DialogClose, null, () => h(NavigationButton, { action: "close" }))),
173
+ h(ToolbarTrailing, null, () => eyedropperButton(true)),
172
174
  ]),
173
175
  h(DialogHeader, null, () => h(DialogTitle, null, () => props.title)),
174
176
  h(DialogBody, { class: s.SheetBody }, () => picker()),
@@ -1 +1 @@
1
- {"version":3,"file":"ColorWell.js","sourceRoot":"","sources":["../../../../src/components/ColorPicker/ColorWell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAiB,MAAM,KAAK,CAAA;AACxF,OAAO,CAAC,MAAM,8DAA8D,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAC7H,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAwB,MAAM,aAAa,CAAA;AAE1H,oHAAoH;AACpH,+GAA+G;AAC/G,iHAAiH;AACjH,oFAAoF;AAEpF,MAAM,kBAAkB,GAAG,eAAe,CAAC;IACzC,IAAI,EAAE,WAAW;IACjB,YAAY,EAAE,KAAK;IACnB,KAAK,EAAE;QACL,4BAA4B;QAC5B,EAAE,EAAE,MAAM;QACV,8HAA8H;QAC9H,KAAK,EAAE,EAAE,IAAI,EAAE,MAAiC,EAAE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C,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;qBACtD,CAAC;iBACH,CAAC,CAAA;YAEN,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;QAC/B,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAIF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAA","sourcesContent":["import { computed, defineComponent, h, onMounted, ref, useId, type PropType } from \"vue\"\nimport s from \"@plexui/styles/components/ColorPicker/ColorPicker.module.css\"\nimport { useBreakpoint } from \"../../composables/useBreakpoints.js\"\nimport { Button, NavigationButton } from \"../Button/index.js\"\nimport { Dialog, DialogBody, DialogClose, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from \"../Dialog/index.js\"\nimport { Eyedropper, X } from \"../Icon/index.js\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"../Popover/index.js\"\nimport { Toolbar, ToolbarLeading, ToolbarTitle, ToolbarTrailing } from \"../Toolbar/index.js\"\nimport { ColorPicker } from \"./ColorPicker.js\"\nimport { alphaPercent, cssColor, eyeDropper, formatColor, hexDigits, parseColor, type ColorPickerMode } from \"./shared.js\"\n\n// Vue port of packages/ui/src/components/ColorPicker/ColorWell.tsx: the same well, and the same picker in a Popover\n// from the well or, on a phone, a sheet with the eyedropper, the title and Close. React's `value` + `onChange`\n// become `value` + `update:value` (`v-model:value`) and `change`; the picker's `mode` and `swatches` events pass\n// through as `update:mode` / `modeChange` and `update:swatches` / `swatchesChange`.\n\nconst ColorWellComponent = defineComponent({\n name: \"ColorWell\",\n inheritAttrs: false,\n props: {\n /** The `id` of the well. */\n id: String,\n /** The controlled color, `#rrggbb` or `#rrggbbaa`; `null` shows the rainbow well with no color. Bind with `v-model:value`. */\n value: { type: String as PropType<string | null>, default: undefined },\n /** The color when it is initially rendered. Use when you do not need to control the color. @default null */\n defaultValue: { type: String as PropType<string | null>, default: null },\n /** The title of the picker. @default \"Colors\" */\n title: { type: String, default: \"Colors\" },\n /** Shows the eyedropper in the picker where the browser can pick a color from the screen (EyeDropper API). @default true */\n supportsEyedropper: { type: Boolean, default: true },\n /** The kit's Picker Button sizes: `sm` 28px, `lg` 36px. @default \"sm\" */\n size: { type: String as PropType<\"sm\" | \"lg\">, default: \"sm\" },\n /** When `true`, prevents the user from opening the picker. */\n disabled: { type: Boolean, default: false },\n /** The name of the well. Submits its color with the owning form. */\n name: String,\n /** Accessible name of the well. @default \"Color\" */\n ariaLabel: String,\n /** The `id` of the visible label of the well. */\n ariaLabelledby: String,\n /** Shows the Opacity slider in the picker. @default true */\n supportsAlpha: { type: Boolean, default: true },\n /** The controlled way to choose a color. Bind with `v-model:mode`. */\n mode: { type: String as PropType<ColorPickerMode>, default: undefined },\n /** The way to choose a color when the picker opens. @default \"grid\" */\n defaultMode: { type: String as PropType<ColorPickerMode>, default: undefined },\n /** The controlled saved colors. Bind with `v-model:swatches`. */\n swatches: { type: Array as PropType<string[]>, default: undefined },\n /** The saved colors when the picker opens. @default [] */\n defaultSwatches: { type: Array as PropType<string[]>, default: undefined },\n },\n emits: {\n /** The picker chose a color */\n \"update:value\": (value: string) => typeof value === \"string\",\n /** The picker chose a color (React `onChange`) */\n \"change\": (value: string) => typeof value === \"string\",\n /** Another of Grid, Spectrum and Sliders was chosen */\n \"update:mode\": (mode: ColorPickerMode) => typeof mode === \"string\",\n /** Another way was chosen (React `onModeChange`) */\n \"modeChange\": (mode: ColorPickerMode) => typeof mode === \"string\",\n /** Add saved the current color or Delete removed one */\n \"update:swatches\": (swatches: string[]) => Array.isArray(swatches),\n /** The saved colors changed (React `onSwatchesChange`) */\n \"swatchesChange\": (swatches: string[]) => Array.isArray(swatches),\n },\n setup(props, { attrs, emit }) {\n const wide = useBreakpoint(\"md\")\n const valueId = `${useId()}-value`\n const open = ref(false)\n const internalValue = ref<string | null>(props.defaultValue)\n const value = computed(() => (props.value === undefined ? internalValue.value : props.value))\n const color = computed(() => parseColor(value.value))\n // The EyeDropper API exists only in a browser, so the button appears after mounting.\n const canPick = ref(false)\n onMounted(() => {\n canPick.value = eyeDropper() !== null\n })\n let picking = false\n\n const choose = (next: string) => {\n if (props.value === undefined) internalValue.value = next\n emit(\"update:value\", next)\n emit(\"change\", next)\n }\n\n const pick = async () => {\n const EyeDropper = eyeDropper()\n if (!EyeDropper || picking) return\n picking = true\n try {\n const picked = parseColor((await new EyeDropper().open()).sRGBHex)\n if (picked) choose(formatColor({ ...picked, a: color.value?.a ?? 1 }))\n } catch {\n // Escape, or a click the browser did not hand to the page, cancels the pick.\n } finally {\n picking = false\n }\n }\n\n const setOpen = (next: boolean) => {\n open.value = next\n }\n\n return () => {\n const current = color.value\n const well = h(\n \"button\",\n {\n ...attrs,\n \"id\": props.id,\n \"type\": \"button\",\n \"class\": [s.Well, attrs.class],\n \"data-size\": props.size,\n \"data-selected\": current ? \"\" : undefined,\n \"disabled\": props.disabled,\n \"aria-label\": props.ariaLabelledby ? undefined : (props.ariaLabel ?? \"Color\"),\n \"aria-labelledby\": props.ariaLabelledby,\n \"aria-describedby\": current ? valueId : undefined,\n \"style\": current ? { \"--color-well-color\": cssColor(current) } : undefined,\n },\n current\n ? [\n h(\"span\", { class: s.WellColor }),\n // The color, read as the well's description.\n h(\"span\", { id: valueId, hidden: true }, `#${hexDigits(current)}${current.a < 1 ? `, ${alphaPercent(current.a)}% opacity` : \"\"}`),\n ]\n : [],\n )\n\n const picker = () =>\n h(ColorPicker, {\n \"supportsAlpha\": props.supportsAlpha,\n \"mode\": props.mode,\n ...(props.defaultMode !== undefined ? { defaultMode: props.defaultMode } : {}),\n \"swatches\": props.swatches,\n \"defaultSwatches\": props.defaultSwatches,\n \"value\": formatColor(current ?? { r: 0, g: 0, b: 0, a: 1 }),\n \"ariaLabel\": props.title,\n \"onChange\": choose,\n \"onUpdate:mode\": (mode: ColorPickerMode) => emit(\"update:mode\", mode),\n \"onModeChange\": (mode: ColorPickerMode) => emit(\"modeChange\", mode),\n \"onUpdate:swatches\": (swatches: string[]) => emit(\"update:swatches\", swatches),\n \"onSwatchesChange\": (swatches: string[]) => emit(\"swatchesChange\", swatches),\n })\n\n const eyedropperButton = (glass: boolean) =>\n props.supportsEyedropper && canPick.value\n ? h(\n Button,\n {\n \"color\": \"secondary\",\n \"variant\": glass ? \"soft\" : \"ghost\",\n \"mobileMaterial\": glass ? \"glass\" : undefined,\n \"size\": glass ? \"lg\" : \"sm\",\n \"uniform\": true,\n \"pill\": true,\n \"aria-label\": \"Eyedropper\",\n \"onClick\": () => void pick(),\n },\n () => h(Eyedropper),\n )\n : null\n\n const hidden = props.name !== undefined ? h(\"input\", { type: \"hidden\", name: props.name, value: value.value ?? \"\", disabled: props.disabled }) : null\n\n const presentation = wide.value\n ? h(Popover, { \"open\": open.value, \"onUpdate:open\": setOpen }, () => [\n h(PopoverTrigger, null, () => well),\n h(PopoverContent, { class: s.Popover, width: \"auto\", side: \"bottom\", align: \"center\" }, () => [\n h(\"div\", { class: s.PopoverHeader }, [\n h(\"div\", { class: s.PopoverLeading }, [eyedropperButton(false)]),\n h(\"span\", { class: s.PopoverTitle }, props.title),\n h(\"div\", { class: s.PopoverTrailing }, [\n h(\n Button,\n { \"color\": \"secondary\", \"variant\": \"ghost\", \"size\": \"sm\", \"uniform\": true, \"pill\": true, \"aria-label\": \"Close\", \"onClick\": () => setOpen(false) },\n () => h(X),\n ),\n ]),\n ]),\n picker(),\n ]),\n ])\n : h(Dialog, { \"open\": open.value, \"onUpdate:open\": setOpen }, () => [\n h(DialogTrigger, null, () => well),\n h(DialogContent, { mobileVariant: \"sheet\", showClose: false, class: s.Sheet }, () => [\n h(Toolbar, { background: \"solid\" }, () => [\n h(ToolbarLeading, null, () => eyedropperButton(true)),\n h(ToolbarTitle, null, () => props.title),\n h(ToolbarTrailing, null, () => h(DialogClose, null, () => h(NavigationButton, { action: \"close\" }))),\n ]),\n h(DialogHeader, null, () => h(DialogTitle, null, () => props.title)),\n h(DialogBody, { class: s.SheetBody }, () => picker()),\n ]),\n ])\n\n return [hidden, presentation]\n }\n },\n})\n\nexport type ColorWellProps = InstanceType<typeof ColorWellComponent>[\"$props\"]\n\n/**\n * A color well, as `UIColorWell`: the kit's Picker Button (5739:34128), a rainbow ring around the chosen color. It\n * opens the color picker, in a Popover from the well, and on a phone in a sheet, as the system picker.\n */\nexport const ColorWell = ColorWellComponent\n"]}
1
+ {"version":3,"file":"ColorWell.js","sourceRoot":"","sources":["../../../../src/components/ColorPicker/ColorWell.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,SAAS,EAAE,GAAG,EAAE,KAAK,EAAiB,MAAM,KAAK,CAAA;AACxF,OAAO,CAAC,MAAM,8DAA8D,CAAA;AAC5E,OAAO,EAAE,aAAa,EAAE,MAAM,qCAAqC,CAAA;AACnE,OAAO,EAAE,MAAM,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAC7D,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,WAAW,EAAE,aAAa,EAAE,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAA;AAC7H,OAAO,EAAE,UAAU,EAAE,CAAC,EAAE,MAAM,kBAAkB,CAAA;AAChD,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAC7E,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,YAAY,EAAE,eAAe,EAAE,MAAM,qBAAqB,CAAA;AAC5F,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAC9C,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,UAAU,EAAE,WAAW,EAAE,SAAS,EAAE,UAAU,EAAwB,MAAM,aAAa,CAAA;AAE1H,oHAAoH;AACpH,+GAA+G;AAC/G,iHAAiH;AACjH,oFAAoF;AAEpF,MAAM,kBAAkB,GAAG,eAAe,CAAC;IACzC,IAAI,EAAE,WAAW;IACjB,YAAY,EAAE,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Y,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;wBACpE,CAAC,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE,EAAE,GAAG,EAAE,CAAC,MAAM,EAAE,CAAC;qBACtD,CAAC;iBACH,CAAC,CAAA;YAEN,OAAO,CAAC,MAAM,EAAE,YAAY,CAAC,CAAA;QAC/B,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAIF;;;GAGG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,kBAAkB,CAAA","sourcesContent":["import { computed, defineComponent, h, onMounted, ref, useId, type PropType } from \"vue\"\nimport s from \"@plexui/styles/components/ColorPicker/ColorPicker.module.css\"\nimport { useBreakpoint } from \"../../composables/useBreakpoints.js\"\nimport { Button, NavigationButton } from \"../Button/index.js\"\nimport { Dialog, DialogBody, DialogClose, DialogContent, DialogHeader, DialogTitle, DialogTrigger } from \"../Dialog/index.js\"\nimport { Eyedropper, X } from \"../Icon/index.js\"\nimport { Popover, PopoverContent, PopoverTrigger } from \"../Popover/index.js\"\nimport { Toolbar, ToolbarLeading, ToolbarTitle, ToolbarTrailing } from \"../Toolbar/index.js\"\nimport { ColorPicker } from \"./ColorPicker.js\"\nimport { alphaPercent, cssColor, eyeDropper, formatColor, hexDigits, parseColor, type ColorPickerMode } from \"./shared.js\"\n\n// Vue port of packages/ui/src/components/ColorPicker/ColorWell.tsx: the same well, and the same picker in a Popover\n// from the well or, on a phone, a sheet with the eyedropper, the title and Close. React's `value` + `onChange`\n// become `value` + `update:value` (`v-model:value`) and `change`; the picker's `mode` and `swatches` events pass\n// through as `update:mode` / `modeChange` and `update:swatches` / `swatchesChange`.\n\nconst ColorWellComponent = defineComponent({\n name: \"ColorWell\",\n inheritAttrs: false,\n props: {\n /** The `id` of the well. */\n id: String,\n /** The controlled color, `#rrggbb` or `#rrggbbaa`; `null` shows the rainbow well with no color. Bind with `v-model:value`. */\n value: { type: String as PropType<string | null>, default: undefined },\n /** The color when it is initially rendered. Use when you do not need to control the color. @default null */\n defaultValue: { type: String as PropType<string | null>, default: null },\n /** The title of the picker. @default \"Colors\" */\n title: { type: String, default: \"Colors\" },\n /** Shows the eyedropper in the picker where the browser can pick a color from the screen (EyeDropper API). @default true */\n supportsEyedropper: { type: Boolean, default: true },\n /** The kit's Picker Button sizes: `sm` 28px, `lg` 36px. @default \"sm\" */\n size: { type: String as PropType<\"sm\" | \"lg\">, default: \"sm\" },\n /** When `true`, prevents the user from opening the picker. */\n disabled: { type: Boolean, default: false },\n /** The name of the well. Submits its color with the owning form. */\n name: String,\n /** Accessible name of the well. @default \"Color\" */\n ariaLabel: String,\n /** The `id` of the visible label of the well. */\n ariaLabelledby: String,\n /** Shows the Opacity slider in the picker. @default true */\n supportsAlpha: { type: Boolean, default: true },\n /** The controlled way to choose a color. Bind with `v-model:mode`. */\n mode: { type: String as PropType<ColorPickerMode>, default: undefined },\n /** The way to choose a color when the picker opens. @default \"grid\" */\n defaultMode: { type: String as PropType<ColorPickerMode>, default: undefined },\n /** The controlled saved colors. Bind with `v-model:swatches`. */\n swatches: { type: Array as PropType<string[]>, default: undefined },\n /** The saved colors when the picker opens. @default [] */\n defaultSwatches: { type: Array as PropType<string[]>, default: undefined },\n },\n emits: {\n /** The picker chose a color */\n \"update:value\": (value: string) => typeof value === \"string\",\n /** The picker chose a color (React `onChange`) */\n \"change\": (value: string) => typeof value === \"string\",\n /** Another of Grid, Spectrum and Sliders was chosen */\n \"update:mode\": (mode: ColorPickerMode) => typeof mode === \"string\",\n /** Another way was chosen (React `onModeChange`) */\n \"modeChange\": (mode: ColorPickerMode) => typeof mode === \"string\",\n /** Add saved the current color or Delete removed one */\n \"update:swatches\": (swatches: string[]) => Array.isArray(swatches),\n /** The saved colors changed (React `onSwatchesChange`) */\n \"swatchesChange\": (swatches: string[]) => Array.isArray(swatches),\n },\n setup(props, { attrs, emit }) {\n const wide = useBreakpoint(\"md\")\n const valueId = `${useId()}-value`\n const open = ref(false)\n const internalValue = ref<string | null>(props.defaultValue)\n const value = computed(() => (props.value === undefined ? internalValue.value : props.value))\n const color = computed(() => parseColor(value.value))\n // The EyeDropper API exists only in a browser, so the button appears after mounting.\n const canPick = ref(false)\n onMounted(() => {\n canPick.value = eyeDropper() !== null\n })\n let picking = false\n\n const choose = (next: string) => {\n if (props.value === undefined) internalValue.value = next\n emit(\"update:value\", next)\n emit(\"change\", next)\n }\n\n const pick = async () => {\n const EyeDropper = eyeDropper()\n if (!EyeDropper || picking) return\n picking = true\n try {\n const picked = parseColor((await new EyeDropper().open()).sRGBHex)\n if (picked) choose(formatColor({ ...picked, a: color.value?.a ?? 1 }))\n } catch {\n // Escape, or a click the browser did not hand to the page, cancels the pick.\n } finally {\n picking = false\n }\n }\n\n const setOpen = (next: boolean) => {\n open.value = next\n }\n\n return () => {\n const current = color.value\n const well = h(\n \"button\",\n {\n ...attrs,\n \"id\": props.id,\n \"type\": \"button\",\n \"class\": [s.Well, attrs.class],\n \"data-size\": props.size,\n \"data-selected\": current ? \"\" : undefined,\n \"disabled\": props.disabled,\n \"aria-label\": props.ariaLabelledby ? undefined : (props.ariaLabel ?? \"Color\"),\n \"aria-labelledby\": props.ariaLabelledby,\n \"aria-describedby\": current ? valueId : undefined,\n \"style\": current ? { \"--color-well-color\": cssColor(current) } : undefined,\n },\n current\n ? [\n h(\"span\", { class: s.WellColor }),\n // The color, read as the well's description.\n h(\"span\", { id: valueId, hidden: true }, `#${hexDigits(current)}${current.a < 1 ? `, ${alphaPercent(current.a)}% opacity` : \"\"}`),\n ]\n : [],\n )\n\n const picker = () =>\n h(ColorPicker, {\n \"supportsAlpha\": props.supportsAlpha,\n \"mode\": props.mode,\n ...(props.defaultMode !== undefined ? { defaultMode: props.defaultMode } : {}),\n \"swatches\": props.swatches,\n \"defaultSwatches\": props.defaultSwatches,\n \"value\": formatColor(current ?? { r: 0, g: 0, b: 0, a: 1 }),\n \"ariaLabel\": props.title,\n \"onChange\": choose,\n \"onUpdate:mode\": (mode: ColorPickerMode) => emit(\"update:mode\", mode),\n \"onModeChange\": (mode: ColorPickerMode) => emit(\"modeChange\", mode),\n \"onUpdate:swatches\": (swatches: string[]) => emit(\"update:swatches\", swatches),\n \"onSwatchesChange\": (swatches: string[]) => emit(\"swatchesChange\", swatches),\n })\n\n const eyedropperButton = (glass: boolean) =>\n props.supportsEyedropper && canPick.value\n ? h(\n Button,\n {\n \"color\": \"secondary\",\n \"variant\": glass ? \"soft\" : \"ghost\",\n \"mobileMaterial\": glass ? \"glass\" : undefined,\n \"size\": glass ? \"lg\" : \"sm\",\n \"uniform\": true,\n \"pill\": true,\n \"aria-label\": \"Eyedropper\",\n \"onClick\": () => void pick(),\n },\n () => h(Eyedropper),\n )\n : null\n\n const hidden = props.name !== undefined ? h(\"input\", { type: \"hidden\", name: props.name, value: value.value ?? \"\", disabled: props.disabled }) : null\n\n const presentation = wide.value\n ? h(Popover, { \"open\": open.value, \"onUpdate:open\": setOpen }, () => [\n h(PopoverTrigger, null, () => well),\n h(PopoverContent, { class: s.Popover, width: \"auto\", side: \"bottom\", align: \"center\" }, () => [\n h(\"div\", { class: s.PopoverHeader }, [\n h(\"div\", { class: s.PopoverLeading }, [eyedropperButton(false)]),\n h(\"span\", { class: s.PopoverTitle }, props.title),\n h(\"div\", { class: s.PopoverTrailing }, [\n h(\n Button,\n { \"color\": \"secondary\", \"variant\": \"ghost\", \"size\": \"sm\", \"uniform\": true, \"pill\": true, \"aria-label\": \"Close\", \"onClick\": () => setOpen(false) },\n () => h(X),\n ),\n ]),\n ]),\n picker(),\n ]),\n ])\n : h(Dialog, { \"open\": open.value, \"onUpdate:open\": setOpen }, () => [\n h(DialogTrigger, null, () => well),\n h(DialogContent, { mobileVariant: \"sheet\", surface: \"grouped\", showClose: false, class: s.Sheet }, () => [\n // iOS 27.2 sets Close first and the eyedropper last (UIColorPickerViewController on an iPhone 17); the\n // iOS 26 kit had them the other way round.\n h(Toolbar, { background: \"solid\" }, () => [\n h(ToolbarLeading, null, () => h(DialogClose, null, () => h(NavigationButton, { action: \"close\" }))),\n h(ToolbarTitle, null, () => props.title),\n h(ToolbarTrailing, null, () => eyedropperButton(true)),\n ]),\n h(DialogHeader, null, () => h(DialogTitle, null, () => props.title)),\n h(DialogBody, { class: s.SheetBody }, () => picker()),\n ]),\n ])\n\n return [hidden, presentation]\n }\n },\n})\n\nexport type ColorWellProps = InstanceType<typeof ColorWellComponent>[\"$props\"]\n\n/**\n * A color well, as `UIColorWell`: the kit's Picker Button (5739:34128), a rainbow ring around the chosen color. It\n * opens the color picker, in a Popover from the well, and on a phone in a sheet, as the system picker.\n */\nexport const ColorWell = ColorWellComponent\n"]}
@@ -18,9 +18,10 @@ export const COLOR_PICKER_GRID = [
18
18
  ];
19
19
  export const COLOR_PICKER_GRID_COLUMNS = 12;
20
20
  const GRID = COLOR_PICKER_GRID.flat();
21
- /** Saved colors fill pages of two rows of five, with the Add button after the last one (kit Swatches 515:52724). */
22
- export const COLOR_PICKER_SWATCHES_PER_PAGE = 10;
23
- export const COLOR_PICKER_SWATCHES_PER_ROW = 5;
21
+ /** Saved colors fill pages of two rows of six, with the Add button after the last one, as iOS 27.2's picker lays them
22
+ * out (UIColorPickerViewController on an iPhone 17; the iOS 26 kit's Swatches 515:52724 had rows of five). */
23
+ export const COLOR_PICKER_SWATCHES_PER_PAGE = 12;
24
+ export const COLOR_PICKER_SWATCHES_PER_ROW = 6;
24
25
  const clamp = (value, min, max) => Math.min(max, Math.max(min, value));
25
26
  const byte = (value) => clamp(Math.round(value), 0, 255);
26
27
  /** Reads `#rgb`, `#rgba`, `#rrggbb` or `#rrggbbaa`, in either case; anything else is `null`. */
@@ -79,7 +80,7 @@ export function listMove(index, count, key) {
79
80
  };
80
81
  return next[key] ?? index;
81
82
  }
82
- /** Pages of saved colors: the colors and the Add button after them, ten to a page. */
83
+ /** Pages of saved colors: the colors and the Add button after them, twelve to a page. */
83
84
  export const swatchPageCount = (count) => Math.max(1, Math.ceil((count + 1) / COLOR_PICKER_SWATCHES_PER_PAGE));
84
85
  function rgbToHsl({ r, g, b }) {
85
86
  const [red, green, blue] = [r / 255, g / 255, b / 255];