@plexui/vue 0.34.1 → 0.36.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.
@@ -26,7 +26,7 @@ const ColorWellComponent = defineComponent({
26
26
  title: { type: String, default: "Colors" },
27
27
  /** Shows the eyedropper in the picker where the browser can pick a color from the screen (EyeDropper API). @default true */
28
28
  supportsEyedropper: { type: Boolean, default: true },
29
- /** The kit's Picker Button sizes: `sm` 28px, `lg` 36px. @default "sm" */
29
+ /** The kit's Picker Button sizes, `sm` 28px and `lg` 36px, and `xs` 24px for the start of a 32px field. @default "sm" */
30
30
  size: { type: String, default: "sm" },
31
31
  /** When `true`, prevents the user from opening the picker. */
32
32
  disabled: { type: Boolean, default: false },
@@ -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,CA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,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;4BACnG,CAAC,CAAC,YAAY,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;4BACxC,CAAC,CAAC,eAAe,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;yBACvD,CAAC;wBACF,CAAC,CAAC,YAAY,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"]}
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;AAC7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AC;wBACvG,uGAAuG;wBACvG,2CAA2C;wBAC3C,CAAC,CAAC,OAAO,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,EAAE,GAAG,EAAE,CAAC;4BACxC,CAAC,CAAC,cAAc,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,WAAW,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,CAAC,CAAC,gBAAgB,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;4BACnG,CAAC,CAAC,YAAY,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,KAAK,CAAC,KAAK,CAAC;4BACxC,CAAC,CAAC,eAAe,EAAE,IAAI,EAAE,GAAG,EAAE,CAAC,gBAAgB,CAAC,IAAI,CAAC,CAAC;yBACvD,CAAC;wBACF,CAAC,CAAC,YAAY,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 and `lg` 36px, and `xs` 24px for the start of a 32px field. @default \"sm\" */\n size: { type: String as PropType<\"xs\" | \"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"]}
@@ -1,8 +1,23 @@
1
- import { defineComponent, h, ref } from "vue";
1
+ import { defineComponent, h, nextTick, onBeforeUnmount, onMounted, onUpdated, ref, watch } from "vue";
2
2
  import { Button, ButtonLink } from "../Button/index.js";
3
3
  import { Disclosure } from "../Icon/index.js";
4
+ import { useFieldColumns } from "../../lib/fieldRow.js";
4
5
  import s from "@plexui/styles/components/NavigationRow/NavigationRow.module.css";
5
6
  const shown = (value) => value !== null && value !== undefined && value !== false && value !== "";
7
+ /** Whether the label and the value of a row fit beside each other on one line: measured in the end layout, unwrapped */
8
+ const valueFitsBeside = (row) => {
9
+ const content = row.querySelector("[data-navigation-row-content]");
10
+ if (!content)
11
+ return true;
12
+ const below = row.hasAttribute("data-value-below");
13
+ row.removeAttribute("data-value-below");
14
+ row.setAttribute("data-measuring", "");
15
+ const fits = [content, ...content.querySelectorAll("[data-navigation-row-part]")].every((element) => element.scrollWidth <= element.clientWidth + 0.5);
16
+ row.removeAttribute("data-measuring");
17
+ if (below)
18
+ row.setAttribute("data-value-below", "");
19
+ return fits;
20
+ };
6
21
  /**
7
22
  * Vue port of `NavigationRow` from packages/ui/src/components/NavigationRow/NavigationRow.tsx: a FieldGroup row
8
23
  * that opens what it holds, as an iOS Settings drill-in. Attributes (id, class, ARIA, data, listeners) fall through
@@ -28,24 +43,75 @@ const NavigationRowComponent = defineComponent({
28
43
  as: [String, Object, Function],
29
44
  /** The row can't be pressed. A disabled link renders as a disabled button, so it never navigates. */
30
45
  disabled: { type: Boolean, default: undefined },
46
+ /**
47
+ * Where the value stands: at the `end` of the row, `below` the label at the full width, or `auto`: at the end while
48
+ * it fits beside the label on one line, otherwise below (as Calendar sets a long value).
49
+ */
50
+ valuePlacement: { type: String, default: "end" },
31
51
  },
32
52
  setup(props, { attrs, slots, expose }) {
33
53
  const pressable = ref(null);
34
54
  const element = () => (pressable.value?.$el ?? null);
35
55
  // A ref reaches the pressable, as in React: its element and focus()
36
56
  expose({ focus: (options) => element()?.focus(options), get element() { return element(); } });
57
+ // "auto": measure after each render and when the row's width changes
58
+ const row = ref(null);
59
+ const fits = ref(true);
60
+ const hasValueNow = () => !!slots.value || shown(props.value);
61
+ const check = () => {
62
+ if (props.valuePlacement !== "auto" || !hasValueNow() || !row.value)
63
+ return;
64
+ const next = valueFitsBeside(row.value);
65
+ if (next !== fits.value)
66
+ fits.value = next;
67
+ };
68
+ let observer;
69
+ let width = -1;
70
+ // A web font that arrives late (font-display: swap) changes the words' widths, not the row's
71
+ const fonts = typeof document !== "undefined" ? document.fonts : undefined;
72
+ let live = true;
73
+ const onFonts = () => {
74
+ if (live)
75
+ check();
76
+ };
77
+ onMounted(() => {
78
+ check();
79
+ fonts?.ready.then(onFonts);
80
+ fonts?.addEventListener?.("loadingdone", onFonts);
81
+ if (typeof ResizeObserver === "undefined" || !row.value)
82
+ return;
83
+ width = row.value.getBoundingClientRect().width;
84
+ observer = new ResizeObserver(() => {
85
+ const next = row.value?.getBoundingClientRect().width ?? width;
86
+ if (next === width)
87
+ return;
88
+ width = next;
89
+ check();
90
+ });
91
+ observer.observe(row.value);
92
+ });
93
+ onUpdated(check);
94
+ // FieldGroup columns give the label a column of its own: a change of them measures again, after the group renders
95
+ const columns = useFieldColumns();
96
+ watch(columns, () => nextTick(check), { flush: "post" });
97
+ onBeforeUnmount(() => {
98
+ live = false;
99
+ fonts?.removeEventListener?.("loadingdone", onFonts);
100
+ observer?.disconnect();
101
+ });
37
102
  return () => {
38
103
  const label = slots.label ? slots.label() : props.label;
39
104
  const value = slots.value ? slots.value() : shown(props.value) ? props.value : undefined;
40
105
  const description = slots.description ? slots.description() : props.description;
41
106
  const hasValue = slots.value ? true : shown(props.value);
42
107
  const hasDescription = slots.description ? true : shown(props.description);
43
- const content = () => h("span", { class: s.Content }, [
108
+ const below = hasValue && (props.valuePlacement === "below" || (props.valuePlacement === "auto" && !fits.value));
109
+ const content = () => h("span", { "class": s.Content, "data-navigation-row-content": "" }, [
44
110
  h("span", { class: s.Text }, [
45
- h("span", { class: s.Label }, [label]),
111
+ h("span", { "class": s.Label, "data-navigation-row-part": "" }, [label]),
46
112
  hasDescription ? h("span", { class: s.Description }, [description]) : null,
47
113
  ]),
48
- hasValue ? h("span", { class: s.Value }, [value]) : null,
114
+ hasValue ? h("span", { "class": s.Value, "data-navigation-row-part": "" }, [value]) : null,
49
115
  h(Disclosure, { "class": s.Disclosure, "aria-hidden": "true", "data-no-autosize": "" }),
50
116
  ]);
51
117
  const { class: className, ...rest } = attrs;
@@ -58,8 +124,10 @@ const NavigationRowComponent = defineComponent({
58
124
  };
59
125
  const link = (props.href !== undefined || props.to !== undefined) && !props.disabled;
60
126
  return h("div", {
127
+ "ref": row,
61
128
  "class": s.NavigationRow,
62
129
  "data-row": "",
130
+ "data-value-below": below ? "" : undefined,
63
131
  "data-value": hasValue ? "" : undefined,
64
132
  "data-description": hasDescription ? "" : undefined,
65
133
  }, [
@@ -1 +1 @@
1
- {"version":3,"file":"NavigationRow.js","sourceRoot":"","sources":["../../../../src/components/NavigationRow/NavigationRow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsF,eAAe,EAAE,CAAC,EAAiB,GAAG,EAAmB,MAAM,KAAK,CAAA;AACjK,OAAO,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAA;AACvD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAE7C,OAAO,CAAC,MAAM,kEAAkE,CAAA;AAIhF,MAAM,KAAK,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,KAAK,KAAK,IAAI,IAAI,KAAK,KAAK,SAAS,IAAI,KAAK,KAAK,KAAK,IAAI,KAAK,KAAK,EAAE,CAAA;AAE1G;;;;GAIG;AACH,MAAM,sBAAsB,GAAG,eAAe,CAAC;IAC7C,IAAI,EAAE,eAAe;IACrB,YAAY,EAAE,KAAK;IACnB,KAAK,EAAE;QACL,iDAAiD;QACjD,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAA8B;QACpD,uHAAuH;QACvH,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,CAAqC;QAC3D,+DAA+D;QAC/D,WAAW,EAAE,CAAC,MAAM,EAAE,MAAM,CAA8B;QAC1D,2GAA2G;QAC3G,IAAI,EAAE,MAAM;QACZ,uFAAuF;QACvF,EAAE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,EAAE,OAAO;gBAClB,qBAAqB,EAAE,EAAE;aACjB,CAAA;YACV,MAAM,IAAI,GAAG,CAAC,KAAK,CAAC,IAAI,KAAK,SAAS,IAAI,KAAK,CAAC,EAAE,KAAK,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAA;YAEpF,OAAO,CAAC,CACN,KAAK,EACL;gBACE,OAAO,EAAE,CAAC,CAAC,aAAa;gBACxB,UAAU,EAAE,EAAE;gBACd,YAAY,EAAE,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;gBACvC,kBAAkB,EAAE,cAAc,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS;aACpD,EACD;gBACE,IAAI;oBACF,CAAC,CAAC,CAAC,CACC,UAAU,EACV,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,IAAI,EAAE,KAAK,CAAC,IAAI,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,KAAK,CAAC,EAAE,EAAE,EAC9G,EAAE,OAAO,EAAE,OAAO,EAAE,CACrB;oBACH,CAAC,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,GAAG,IAAI,EAAE,GAAG,MAAM,EAAE,GAAG,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,CAAC,QAAQ,EAAE,EAAE,EAAE,OAAO,EAAE,OAAO,EAAE,CAAC;aACtG,CACF,CAAA;QACH,CAAC,CAAA;IACH,CAAC;CACF,CAAC,CAAA;AAYF,MAAM,CAAC,MAAM,aAAa,GAAG,sBAE5B,CAAA","sourcesContent":["import { type AnchorHTMLAttributes, type ButtonHTMLAttributes, type ComponentPublicInstance, defineComponent, h, type PropType, ref, type VNodeChild } from \"vue\"\nimport { Button, ButtonLink } from \"../Button/index.js\"\nimport { Disclosure } from \"../Icon/index.js\"\nimport type { LinkComponent } from \"../PlexUIProvider/index.js\"\nimport s from \"@plexui/styles/components/NavigationRow/NavigationRow.module.css\"\n\ntype RouteTarget = string | Record<string, unknown>\n\nconst shown = (value: unknown) => value !== null && value !== undefined && value !== false && value !== \"\"\n\n/**\n * Vue port of `NavigationRow` from packages/ui/src/components/NavigationRow/NavigationRow.tsx: a FieldGroup row\n * that opens what it holds, as an iOS Settings drill-in. Attributes (id, class, ARIA, data, listeners) fall through\n * to the pressable. The `label`, `value` and `description` slots take the place of their props.\n */\nconst NavigationRowComponent = defineComponent({\n name: \"NavigationRow\",\n inheritAttrs: false,\n props: {\n /** The row's name, where a row's label starts */\n label: [String, Number] as PropType<string | number>,\n /** The current value, at the end of the row in the secondary label. `0` shows; `null`, `undefined` and `\"\"` do not. */\n value: [String, Number] as PropType<string | number | null>,\n /** A line under the label; the row grows from 52 to hold it */\n description: [String, Number] as PropType<string | number>,\n /** Where the row goes. With it the row is a link (through `PlexUIProvider`'s `linkComponent`, or `as`). */\n href: String,\n /** A router target; with it the row is a link through the provider's link component */\n to: [String, Object] as PropType<RouteTarget>,\n /** Force external-link behavior */\n external: { type: Boolean, default: undefined },\n /** Link component override (e.g. a router link). */\n as: [String, Object, Function] as PropType<LinkComponent>,\n /** The row can't be pressed. A disabled link renders as a disabled button, so it never navigates. */\n disabled: { type: Boolean, default: undefined },\n },\n setup(props, { attrs, slots, expose }) {\n const pressable = ref<ComponentPublicInstance | null>(null)\n const element = () => (pressable.value?.$el ?? null) as HTMLElement | null\n // A ref reaches the pressable, as in React: its element and focus()\n expose({ focus: (options?: FocusOptions) => element()?.focus(options), get element() { return element() } })\n\n return () => {\n const label: VNodeChild = slots.label ? slots.label() : props.label\n const value: VNodeChild = slots.value ? slots.value() : shown(props.value) ? props.value : undefined\n const description: VNodeChild = slots.description ? slots.description() : props.description\n const hasValue = slots.value ? true : shown(props.value)\n const hasDescription = slots.description ? true : shown(props.description)\n\n const content = () =>\n h(\"span\", { class: s.Content }, [\n h(\"span\", { class: s.Text }, [\n h(\"span\", { class: s.Label }, [label as never]),\n hasDescription ? h(\"span\", { class: s.Description }, [description as never]) : null,\n ]),\n hasValue ? h(\"span\", { class: s.Value }, [value as never]) : null,\n h(Disclosure, { \"class\": s.Disclosure, \"aria-hidden\": \"true\", \"data-no-autosize\": \"\" }),\n ])\n\n const { class: className, ...rest } = attrs\n const shared = {\n \"class\": [s.Pressable, className],\n \"block\": true,\n \"color\": \"secondary\",\n \"variant\": \"ghost\",\n \"data-navigation-row\": \"\",\n } as const\n const link = (props.href !== undefined || props.to !== undefined) && !props.disabled\n\n return h(\n \"div\",\n {\n \"class\": s.NavigationRow,\n \"data-row\": \"\",\n \"data-value\": hasValue ? \"\" : undefined,\n \"data-description\": hasDescription ? \"\" : undefined,\n },\n [\n link\n ? h(\n ButtonLink,\n { ...rest, ...shared, ref: pressable, href: props.href, to: props.to, external: props.external, as: props.as },\n { default: content },\n )\n : h(Button, { ...rest, ...shared, ref: pressable, disabled: props.disabled }, { default: content }),\n ],\n )\n }\n },\n})\n\ntype NavigationRowOwnProps = InstanceType<typeof NavigationRowComponent>[\"$props\"]\n\n/** NavigationRow props plus the native button and link attributes and the click listener that fall through to the\n * pressable, as in React. */\nexport type NavigationRowProps = NavigationRowOwnProps &\n Omit<ButtonHTMLAttributes, keyof NavigationRowOwnProps | \"value\" | \"type\"> &\n Pick<AnchorHTMLAttributes, \"target\" | \"rel\" | \"download\" | \"hreflang\" | \"ping\" | \"referrerpolicy\"> & {\n onClick?: (event: MouseEvent) => void\n }\n\nexport const NavigationRow = NavigationRowComponent as typeof NavigationRowComponent & {\n new (): { $props: NavigationRowProps; focus: (options?: FocusOptions) => void; element: HTMLElement | null }\n}\n"]}
1
+ {"version":3,"file":"NavigationRow.js","sourceRoot":"","sources":["../../../../src/components/NavigationRow/NavigationRow.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsF,eAAe,EAAE,CAAC,EAAE,QAAQ,EAAE,eAAe,EAAE,SAAS,EAAE,SAAS,EAAiB,GA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C;CACF,CAAC,CAAA;AAYF,MAAM,CAAC,MAAM,aAAa,GAAG,sBAE5B,CAAA","sourcesContent":["import { type AnchorHTMLAttributes, type ButtonHTMLAttributes, type ComponentPublicInstance, defineComponent, h, nextTick, onBeforeUnmount, onMounted, onUpdated, type PropType, ref, type VNodeChild, watch } from \"vue\"\nimport { Button, ButtonLink } from \"../Button/index.js\"\nimport { Disclosure } from \"../Icon/index.js\"\nimport { useFieldColumns } from \"../../lib/fieldRow.js\"\nimport type { LinkComponent } from \"../PlexUIProvider/index.js\"\nimport s from \"@plexui/styles/components/NavigationRow/NavigationRow.module.css\"\n\ntype RouteTarget = string | Record<string, unknown>\n\nconst shown = (value: unknown) => value !== null && value !== undefined && value !== false && value !== \"\"\n\n/** Whether the label and the value of a row fit beside each other on one line: measured in the end layout, unwrapped */\nconst valueFitsBeside = (row: HTMLElement) => {\n const content = row.querySelector<HTMLElement>(\"[data-navigation-row-content]\")\n if (!content) return true\n const below = row.hasAttribute(\"data-value-below\")\n row.removeAttribute(\"data-value-below\")\n row.setAttribute(\"data-measuring\", \"\")\n const fits = [content, ...content.querySelectorAll<HTMLElement>(\"[data-navigation-row-part]\")].every(\n (element) => element.scrollWidth <= element.clientWidth + 0.5,\n )\n row.removeAttribute(\"data-measuring\")\n if (below) row.setAttribute(\"data-value-below\", \"\")\n return fits\n}\n\n/**\n * Vue port of `NavigationRow` from packages/ui/src/components/NavigationRow/NavigationRow.tsx: a FieldGroup row\n * that opens what it holds, as an iOS Settings drill-in. Attributes (id, class, ARIA, data, listeners) fall through\n * to the pressable. The `label`, `value` and `description` slots take the place of their props.\n */\nconst NavigationRowComponent = defineComponent({\n name: \"NavigationRow\",\n inheritAttrs: false,\n props: {\n /** The row's name, where a row's label starts */\n label: [String, Number] as PropType<string | number>,\n /** The current value, at the end of the row in the secondary label. `0` shows; `null`, `undefined` and `\"\"` do not. */\n value: [String, Number] as PropType<string | number | null>,\n /** A line under the label; the row grows from 52 to hold it */\n description: [String, Number] as PropType<string | number>,\n /** Where the row goes. With it the row is a link (through `PlexUIProvider`'s `linkComponent`, or `as`). */\n href: String,\n /** A router target; with it the row is a link through the provider's link component */\n to: [String, Object] as PropType<RouteTarget>,\n /** Force external-link behavior */\n external: { type: Boolean, default: undefined },\n /** Link component override (e.g. a router link). */\n as: [String, Object, Function] as PropType<LinkComponent>,\n /** The row can't be pressed. A disabled link renders as a disabled button, so it never navigates. */\n disabled: { type: Boolean, default: undefined },\n /**\n * Where the value stands: at the `end` of the row, `below` the label at the full width, or `auto`: at the end while\n * it fits beside the label on one line, otherwise below (as Calendar sets a long value).\n */\n valuePlacement: { type: String as PropType<\"end\" | \"below\" | \"auto\">, default: \"end\" },\n },\n setup(props, { attrs, slots, expose }) {\n const pressable = ref<ComponentPublicInstance | null>(null)\n const element = () => (pressable.value?.$el ?? null) as HTMLElement | null\n // A ref reaches the pressable, as in React: its element and focus()\n expose({ focus: (options?: FocusOptions) => element()?.focus(options), get element() { return element() } })\n\n // \"auto\": measure after each render and when the row's width changes\n const row = ref<HTMLElement | null>(null)\n const fits = ref(true)\n const hasValueNow = () => !!slots.value || shown(props.value)\n const check = () => {\n if (props.valuePlacement !== \"auto\" || !hasValueNow() || !row.value) return\n const next = valueFitsBeside(row.value)\n if (next !== fits.value) fits.value = next\n }\n let observer: ResizeObserver | undefined\n let width = -1\n // A web font that arrives late (font-display: swap) changes the words' widths, not the row's\n const fonts = typeof document !== \"undefined\" ? document.fonts : undefined\n let live = true\n const onFonts = () => {\n if (live) check()\n }\n onMounted(() => {\n check()\n fonts?.ready.then(onFonts)\n fonts?.addEventListener?.(\"loadingdone\", onFonts)\n if (typeof ResizeObserver === \"undefined\" || !row.value) return\n width = row.value.getBoundingClientRect().width\n observer = new ResizeObserver(() => {\n const next = row.value?.getBoundingClientRect().width ?? width\n if (next === width) return\n width = next\n check()\n })\n observer.observe(row.value)\n })\n onUpdated(check)\n // FieldGroup columns give the label a column of its own: a change of them measures again, after the group renders\n const columns = useFieldColumns()\n watch(columns, () => nextTick(check), { flush: \"post\" })\n onBeforeUnmount(() => {\n live = false\n fonts?.removeEventListener?.(\"loadingdone\", onFonts)\n observer?.disconnect()\n })\n\n return () => {\n const label: VNodeChild = slots.label ? slots.label() : props.label\n const value: VNodeChild = slots.value ? slots.value() : shown(props.value) ? props.value : undefined\n const description: VNodeChild = slots.description ? slots.description() : props.description\n const hasValue = slots.value ? true : shown(props.value)\n const hasDescription = slots.description ? true : shown(props.description)\n const below = hasValue && (props.valuePlacement === \"below\" || (props.valuePlacement === \"auto\" && !fits.value))\n\n const content = () =>\n h(\"span\", { \"class\": s.Content, \"data-navigation-row-content\": \"\" }, [\n h(\"span\", { class: s.Text }, [\n h(\"span\", { \"class\": s.Label, \"data-navigation-row-part\": \"\" }, [label as never]),\n hasDescription ? h(\"span\", { class: s.Description }, [description as never]) : null,\n ]),\n hasValue ? h(\"span\", { \"class\": s.Value, \"data-navigation-row-part\": \"\" }, [value as never]) : null,\n h(Disclosure, { \"class\": s.Disclosure, \"aria-hidden\": \"true\", \"data-no-autosize\": \"\" }),\n ])\n\n const { class: className, ...rest } = attrs\n const shared = {\n \"class\": [s.Pressable, className],\n \"block\": true,\n \"color\": \"secondary\",\n \"variant\": \"ghost\",\n \"data-navigation-row\": \"\",\n } as const\n const link = (props.href !== undefined || props.to !== undefined) && !props.disabled\n\n return h(\n \"div\",\n {\n \"ref\": row,\n \"class\": s.NavigationRow,\n \"data-row\": \"\",\n \"data-value-below\": below ? \"\" : undefined,\n \"data-value\": hasValue ? \"\" : undefined,\n \"data-description\": hasDescription ? \"\" : undefined,\n },\n [\n link\n ? h(\n ButtonLink,\n { ...rest, ...shared, ref: pressable, href: props.href, to: props.to, external: props.external, as: props.as },\n { default: content },\n )\n : h(Button, { ...rest, ...shared, ref: pressable, disabled: props.disabled }, { default: content }),\n ],\n )\n }\n },\n})\n\ntype NavigationRowOwnProps = InstanceType<typeof NavigationRowComponent>[\"$props\"]\n\n/** NavigationRow props plus the native button and link attributes and the click listener that fall through to the\n * pressable, as in React. */\nexport type NavigationRowProps = NavigationRowOwnProps &\n Omit<ButtonHTMLAttributes, keyof NavigationRowOwnProps | \"value\" | \"type\"> &\n Pick<AnchorHTMLAttributes, \"target\" | \"rel\" | \"download\" | \"hreflang\" | \"ping\" | \"referrerpolicy\"> & {\n onClick?: (event: MouseEvent) => void\n }\n\nexport const NavigationRow = NavigationRowComponent as typeof NavigationRowComponent & {\n new (): { $props: NavigationRowProps; focus: (options?: FocusOptions) => void; element: HTMLElement | null }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import { computed, defineComponent, h, onBeforeUnmount, ref } from "vue";
2
2
  import s from "@plexui/styles/components/Stepper/Stepper.module.css";
3
- import { Minus, Plus } from "../Icon/index.js";
3
+ import { Minus, Plus, RemoveTrash } from "../Icon/index.js";
4
4
  // Vue port of packages/ui/src/components/Stepper/Stepper.tsx: the same DOM (a spin button with two
5
5
  // unfocusable segments and an optional hidden input), keys, hold-to-repeat and clamped or wrapped steps.
6
6
  // React's `value` + `onChange` become `value` + `update:value` (`v-model:value`) and `change`.
@@ -49,6 +49,13 @@ const StepperComponent = defineComponent({
49
49
  decrementLabel: { type: String, default: "Decrease" },
50
50
  /** Accessible name of the increment segment. @default "Increase" */
51
51
  incrementLabel: { type: String, default: "Increase" },
52
+ /**
53
+ * Called (`@remove`) when the decrement segment is pressed at `min`. With it, the segment shows a trash can there
54
+ * and removes the item, as a cart's stepper does at a quantity of one (without `wrap`).
55
+ */
56
+ onRemove: Function,
57
+ /** Accessible name of the decrement segment when it removes. @default "Remove" */
58
+ removeLabel: { type: String, default: "Remove" },
52
59
  /** The name of the stepper. Submits its value with the owning form. */
53
60
  name: String,
54
61
  /** Accessible name of the value the stepper changes, when no visible label names it. */
@@ -96,9 +103,19 @@ const StepperComponent = defineComponent({
96
103
  onBeforeUnmount(stopRepeat);
97
104
  const atMin = computed(() => !props.wrap && value.value <= props.min);
98
105
  const atMax = computed(() => !props.wrap && value.value >= props.max);
106
+ // At the minimum the decrement segment removes the item, when the owner can remove it
107
+ const removes = computed(() => atMin.value && props.onRemove !== undefined);
99
108
  const startPress = (segment, event) => {
100
109
  if (event.button !== 0 || props.disabled)
101
110
  return;
111
+ if (segment === "decrement" && removes.value) {
112
+ const target = event.currentTarget;
113
+ if (target instanceof HTMLElement)
114
+ target.setPointerCapture?.(event.pointerId);
115
+ pressed.value = segment;
116
+ props.onRemove?.();
117
+ return;
118
+ }
102
119
  if (segment === "decrement" ? atMin.value : atMax.value)
103
120
  return;
104
121
  const target = event.currentTarget;
@@ -120,6 +137,8 @@ const StepperComponent = defineComponent({
120
137
  const handleClick = (segment, event) => {
121
138
  if (event.detail !== 0 || props.disabled)
122
139
  return;
140
+ if (segment === "decrement" && removes.value)
141
+ return props.onRemove?.();
123
142
  stepBy(segment === "decrement" ? -1 : 1);
124
143
  };
125
144
  const handleKeyDown = (event) => {
@@ -132,6 +151,8 @@ const StepperComponent = defineComponent({
132
151
  PageDown: () => stepBy(-1, 10),
133
152
  Home: () => commit(props.min),
134
153
  End: () => commit(props.max),
154
+ // At the minimum Delete or Backspace removes, as the trash can does; the arrows never do
155
+ ...(removes.value && { Delete: () => props.onRemove?.(), Backspace: () => props.onRemove?.() }),
135
156
  };
136
157
  const action = keys[event.key];
137
158
  if (!action)
@@ -140,15 +161,17 @@ const StepperComponent = defineComponent({
140
161
  action();
141
162
  };
142
163
  const segment = (kind) => {
143
- const atEnd = kind === "decrement" ? atMin.value : atMax.value;
164
+ const remove = kind === "decrement" && removes.value;
165
+ const atEnd = !remove && (kind === "decrement" ? atMin.value : atMax.value);
144
166
  return h("button", {
145
167
  "type": "button",
146
168
  "tabindex": -1,
147
- "aria-label": kind === "decrement" ? props.decrementLabel : props.incrementLabel,
169
+ "aria-label": remove ? props.removeLabel : kind === "decrement" ? props.decrementLabel : props.incrementLabel,
148
170
  "aria-disabled": atEnd || undefined,
149
171
  "disabled": props.disabled,
150
172
  "class": s.Segment,
151
173
  "data-segment": kind,
174
+ "data-remove": remove ? "" : undefined,
152
175
  "data-disabled": atEnd || props.disabled ? "" : undefined,
153
176
  "data-pressed": pressed.value === kind && !props.disabled ? "" : undefined,
154
177
  // Keeps the focus where it is, as a native stepper takes none.
@@ -158,7 +181,7 @@ const StepperComponent = defineComponent({
158
181
  "onPointercancel": stopRepeat,
159
182
  "onLostpointercapture": stopRepeat,
160
183
  "onClick": (event) => handleClick(kind, event),
161
- }, [h(kind === "decrement" ? Minus : Plus, { class: s.Icon })]);
184
+ }, [h(remove ? RemoveTrash : kind === "decrement" ? Minus : Plus, { class: s.Icon })]);
162
185
  };
163
186
  return () => h("div", {
164
187
  ...attrs,
@@ -171,6 +194,7 @@ const StepperComponent = defineComponent({
171
194
  "aria-label": props.ariaLabel,
172
195
  "aria-labelledby": props.ariaLabelledby,
173
196
  "aria-describedby": props.ariaDescribedby,
197
+ "aria-keyshortcuts": removes.value ? "Delete" : undefined,
174
198
  "aria-disabled": props.disabled || undefined,
175
199
  "class": [s.Stepper, attrs.class],
176
200
  "data-disabled": props.disabled ? "" : undefined,
@@ -1 +1 @@
1
- {"version":3,"file":"Stepper.js","sourceRoot":"","sources":["../../../../src/components/Stepper/Stepper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AACxE,OAAO,CAAC,MAAM,sDAAsD,CAAA;AACpE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAA;AAE9C,mGAAmG;AACnG,yGAAyG;AACzG,+FAA+F;AAE/F,yFAAyF;AACzF,MAAM,YAAY,GAAG,GAAG,CAAA;AACxB,MAAM,eAAe,GAAG,GAAG,CAAA;AAE3B,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE;IAC7B,MAAM,CAAC,EAAE,QAAQ,GAAG,EAAE,CAAC,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,GA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AAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAA","sourcesContent":["import { computed, defineComponent, h, onBeforeUnmount, ref } from \"vue\"\nimport s from \"@plexui/styles/components/Stepper/Stepper.module.css\"\nimport { Minus, Plus } from \"../Icon/index.js\"\n\n// Vue port of packages/ui/src/components/Stepper/Stepper.tsx: the same DOM (a spin button with two\n// unfocusable segments and an optional hidden input), keys, hold-to-repeat and clamped or wrapped steps.\n// React's `value` + `onChange` become `value` + `update:value` (`v-model:value`) and `change`.\n\n/** Delay before a held segment starts repeating, and the time between repeats, in ms. */\nconst REPEAT_DELAY = 400\nconst REPEAT_INTERVAL = 100\n\nconst decimals = (n: number) => {\n const [, fraction = \"\"] = String(n).split(\".\")\n return fraction.length\n}\n\n/** The value one step away, clamped to the range or wrapped, without floating point drift. */\nexport const stepValue = (current: number, direction: 1 | -1, { min, max, step, wrap }: { min: number; max: number; step: number; wrap: boolean }) => {\n const precision = Math.max(decimals(step), decimals(min), decimals(current))\n const next = Number((current + direction * step).toFixed(precision))\n if (next > max) return wrap ? min : max\n if (next < min) return wrap ? max : min\n return next\n}\n\ntype Segment = \"decrement\" | \"increment\"\n\nconst StepperComponent = defineComponent({\n name: \"Stepper\",\n inheritAttrs: false,\n props: {\n /** The `id` of the stepper. */\n id: String,\n /** The controlled value. Bind with `v-model:value`. */\n value: { type: Number, default: undefined },\n /** The value when it is initially rendered. Use when you do not need to control the value. @default min */\n defaultValue: { type: Number, default: undefined },\n /** The lowest value. @default 0 */\n min: { type: Number, default: 0 },\n /** The highest value. @default 100 */\n max: { type: Number, default: 100 },\n /** The amount each step adds or removes. @default 1 */\n step: { type: Number, default: 1 },\n /** A step past `max` continues from `min`, and one below `min` from `max`. @default false */\n wrap: { type: Boolean, default: false },\n /** Holding a segment keeps stepping, as a native stepper does. @default true */\n autoRepeat: { type: Boolean, default: true },\n /** When `true`, prevents the user from interacting with the stepper. */\n disabled: { type: Boolean, default: false },\n /** Fully rounded ends. @default true */\n pill: { type: Boolean, default: true },\n /** Accessible name of the decrement segment. @default \"Decrease\" */\n decrementLabel: { type: String, default: \"Decrease\" },\n /** Accessible name of the increment segment. @default \"Increase\" */\n incrementLabel: { type: String, default: \"Increase\" },\n /** The name of the stepper. Submits its value with the owning form. */\n name: String,\n /** Accessible name of the value the stepper changes, when no visible label names it. */\n ariaLabel: String,\n /** The `id` of the visible label of the value the stepper changes. */\n ariaLabelledby: String,\n /** The `id` of an element that describes the stepper, such as the text that shows its value. */\n ariaDescribedby: String,\n },\n emits: {\n /** The value changed */\n \"update:value\": (value: number) => typeof value === \"number\",\n /** The value changed (React `onChange`) */\n change: (value: number) => typeof value === \"number\",\n /** The stepper gained focus */\n focus: (event: FocusEvent) => event.type === \"focus\",\n /** The stepper lost focus */\n blur: (event: FocusEvent) => event.type === \"blur\",\n },\n setup(props, { attrs, emit }) {\n const internalValue = ref(props.defaultValue ?? props.min)\n const value = computed(() => props.value ?? internalValue.value)\n const pressed = ref<Segment | null>(null)\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const commit = (next: number) => {\n if (next === value.value) return false\n if (props.value === undefined) internalValue.value = next\n emit(\"update:value\", next)\n emit(\"change\", next)\n return true\n }\n\n const stepBy = (direction: 1 | -1, times = 1) => {\n let next = value.value\n for (let i = 0; i < times; i++) next = stepValue(next, direction, props)\n return commit(next)\n }\n\n const stopRepeat = () => {\n clearTimeout(timer)\n timer = undefined\n pressed.value = null\n }\n onBeforeUnmount(stopRepeat)\n\n const atMin = computed(() => !props.wrap && value.value <= props.min)\n const atMax = computed(() => !props.wrap && value.value >= props.max)\n\n const startPress = (segment: Segment, event: PointerEvent) => {\n if (event.button !== 0 || props.disabled) return\n if (segment === \"decrement\" ? atMin.value : atMax.value) return\n const target = event.currentTarget\n if (target instanceof HTMLElement) target.setPointerCapture?.(event.pointerId)\n pressed.value = segment\n const direction = segment === \"decrement\" ? -1 : 1\n stepBy(direction)\n if (!props.autoRepeat) return\n const repeat = () => {\n if (props.disabled || !stepBy(direction)) return stopRepeat()\n timer = setTimeout(repeat, REPEAT_INTERVAL)\n }\n timer = setTimeout(repeat, REPEAT_DELAY)\n }\n\n // A pointer steps on press, so only a click without one (assistive technology, `element.click()`) steps here.\n const handleClick = (segment: Segment, event: MouseEvent) => {\n if (event.detail !== 0 || props.disabled) return\n stepBy(segment === \"decrement\" ? -1 : 1)\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (props.disabled || event.altKey || event.ctrlKey || event.metaKey) return\n const keys: Record<string, () => void> = {\n ArrowUp: () => stepBy(1),\n ArrowDown: () => stepBy(-1),\n PageUp: () => stepBy(1, 10),\n PageDown: () => stepBy(-1, 10),\n Home: () => commit(props.min),\n End: () => commit(props.max),\n }\n const action = keys[event.key]\n if (!action) return\n event.preventDefault()\n action()\n }\n\n const segment = (kind: Segment) => {\n const atEnd = kind === \"decrement\" ? atMin.value : atMax.value\n return h(\"button\", {\n \"type\": \"button\",\n \"tabindex\": -1,\n \"aria-label\": kind === \"decrement\" ? props.decrementLabel : props.incrementLabel,\n \"aria-disabled\": atEnd || undefined,\n \"disabled\": props.disabled,\n \"class\": s.Segment,\n \"data-segment\": kind,\n \"data-disabled\": atEnd || props.disabled ? \"\" : undefined,\n \"data-pressed\": pressed.value === kind && !props.disabled ? \"\" : undefined,\n // Keeps the focus where it is, as a native stepper takes none.\n \"onMousedown\": (event: MouseEvent) => event.preventDefault(),\n \"onPointerdown\": (event: PointerEvent) => startPress(kind, event),\n \"onPointerup\": stopRepeat,\n \"onPointercancel\": stopRepeat,\n \"onLostpointercapture\": stopRepeat,\n \"onClick\": (event: MouseEvent) => handleClick(kind, event),\n }, [h(kind === \"decrement\" ? Minus : Plus, { class: s.Icon })])\n }\n\n return () => h(\"div\", {\n ...attrs,\n \"id\": props.id,\n \"role\": \"spinbutton\",\n \"tabindex\": props.disabled ? -1 : 0,\n \"aria-valuenow\": value.value,\n \"aria-valuemin\": props.min,\n \"aria-valuemax\": props.max,\n \"aria-label\": props.ariaLabel,\n \"aria-labelledby\": props.ariaLabelledby,\n \"aria-describedby\": props.ariaDescribedby,\n \"aria-disabled\": props.disabled || undefined,\n \"class\": [s.Stepper, attrs.class],\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-pill\": props.pill ? \"\" : undefined,\n \"onKeydown\": handleKeyDown,\n \"onFocus\": (event: FocusEvent) => emit(\"focus\", event),\n \"onBlur\": (event: FocusEvent) => emit(\"blur\", event),\n }, [\n segment(\"decrement\"),\n h(\"span\", { \"class\": s.Separator, \"aria-hidden\": \"true\" }),\n segment(\"increment\"),\n props.name !== undefined ? h(\"input\", { type: \"hidden\", name: props.name, value: value.value, disabled: props.disabled }) : null,\n ])\n },\n})\n\ntype StepperOwnProps = InstanceType<typeof StepperComponent>[\"$props\"]\n\n/** Stepper props. */\nexport type StepperProps = StepperOwnProps\n\n/**\n * Two segments that decrease and increase a number, as the iOS 26 stepper does. It shows no value of its own:\n * name it with `aria-label` or `aria-labelledby` and show the value beside it. Keyboard focus lands on the\n * stepper, a spin button: Up and Down step, Page Up and Page Down step ten times, Home and End go to the range ends.\n */\nexport const Stepper = StepperComponent\n"]}
1
+ {"version":3,"file":"Stepper.js","sourceRoot":"","sources":["../../../../src/components/Stepper/Stepper.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC,EAAE,eAAe,EAAiB,GAAG,EAAE,MAAM,KAAK,CAAA;AACvF,OAAO,CAAC,MAAM,sDAAsD,CAAA;AACpE,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAA;AAE3D,mGAAmG;AACnG,yGAAyG;AACzG,+FAA+F;AAE/F,yFAAyF;AACzF,MAAM,YAAY,GAAG,GAAG,CAAA;AACxB,MAAM,eAAe,GAAG,GAAG,CAAA;AAE3B,MAAM,QAAQ,GAAG,CAAC,CAAS,EAAE,EAAE;IAC7B,MAAM,CAAC,EAAE,QAAQ,GAAG,EAAE,CAAC,GAAG,MAAM,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CAAC,CAAC,IAAI;SACjI,CAAC,CAAA;IACJ,CAAC;CACF,CAAC,CAAA;AAOF;;;;GAIG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,gBAAgB,CAAA","sourcesContent":["import { computed, defineComponent, h, onBeforeUnmount, type PropType, ref } from \"vue\"\nimport s from \"@plexui/styles/components/Stepper/Stepper.module.css\"\nimport { Minus, Plus, RemoveTrash } from \"../Icon/index.js\"\n\n// Vue port of packages/ui/src/components/Stepper/Stepper.tsx: the same DOM (a spin button with two\n// unfocusable segments and an optional hidden input), keys, hold-to-repeat and clamped or wrapped steps.\n// React's `value` + `onChange` become `value` + `update:value` (`v-model:value`) and `change`.\n\n/** Delay before a held segment starts repeating, and the time between repeats, in ms. */\nconst REPEAT_DELAY = 400\nconst REPEAT_INTERVAL = 100\n\nconst decimals = (n: number) => {\n const [, fraction = \"\"] = String(n).split(\".\")\n return fraction.length\n}\n\n/** The value one step away, clamped to the range or wrapped, without floating point drift. */\nexport const stepValue = (current: number, direction: 1 | -1, { min, max, step, wrap }: { min: number; max: number; step: number; wrap: boolean }) => {\n const precision = Math.max(decimals(step), decimals(min), decimals(current))\n const next = Number((current + direction * step).toFixed(precision))\n if (next > max) return wrap ? min : max\n if (next < min) return wrap ? max : min\n return next\n}\n\ntype Segment = \"decrement\" | \"increment\"\n\nconst StepperComponent = defineComponent({\n name: \"Stepper\",\n inheritAttrs: false,\n props: {\n /** The `id` of the stepper. */\n id: String,\n /** The controlled value. Bind with `v-model:value`. */\n value: { type: Number, default: undefined },\n /** The value when it is initially rendered. Use when you do not need to control the value. @default min */\n defaultValue: { type: Number, default: undefined },\n /** The lowest value. @default 0 */\n min: { type: Number, default: 0 },\n /** The highest value. @default 100 */\n max: { type: Number, default: 100 },\n /** The amount each step adds or removes. @default 1 */\n step: { type: Number, default: 1 },\n /** A step past `max` continues from `min`, and one below `min` from `max`. @default false */\n wrap: { type: Boolean, default: false },\n /** Holding a segment keeps stepping, as a native stepper does. @default true */\n autoRepeat: { type: Boolean, default: true },\n /** When `true`, prevents the user from interacting with the stepper. */\n disabled: { type: Boolean, default: false },\n /** Fully rounded ends. @default true */\n pill: { type: Boolean, default: true },\n /** Accessible name of the decrement segment. @default \"Decrease\" */\n decrementLabel: { type: String, default: \"Decrease\" },\n /** Accessible name of the increment segment. @default \"Increase\" */\n incrementLabel: { type: String, default: \"Increase\" },\n /**\n * Called (`@remove`) when the decrement segment is pressed at `min`. With it, the segment shows a trash can there\n * and removes the item, as a cart's stepper does at a quantity of one (without `wrap`).\n */\n onRemove: Function as PropType<() => void>,\n /** Accessible name of the decrement segment when it removes. @default \"Remove\" */\n removeLabel: { type: String, default: \"Remove\" },\n /** The name of the stepper. Submits its value with the owning form. */\n name: String,\n /** Accessible name of the value the stepper changes, when no visible label names it. */\n ariaLabel: String,\n /** The `id` of the visible label of the value the stepper changes. */\n ariaLabelledby: String,\n /** The `id` of an element that describes the stepper, such as the text that shows its value. */\n ariaDescribedby: String,\n },\n emits: {\n /** The value changed */\n \"update:value\": (value: number) => typeof value === \"number\",\n /** The value changed (React `onChange`) */\n change: (value: number) => typeof value === \"number\",\n /** The stepper gained focus */\n focus: (event: FocusEvent) => event.type === \"focus\",\n /** The stepper lost focus */\n blur: (event: FocusEvent) => event.type === \"blur\",\n },\n setup(props, { attrs, emit }) {\n const internalValue = ref(props.defaultValue ?? props.min)\n const value = computed(() => props.value ?? internalValue.value)\n const pressed = ref<Segment | null>(null)\n let timer: ReturnType<typeof setTimeout> | undefined\n\n const commit = (next: number) => {\n if (next === value.value) return false\n if (props.value === undefined) internalValue.value = next\n emit(\"update:value\", next)\n emit(\"change\", next)\n return true\n }\n\n const stepBy = (direction: 1 | -1, times = 1) => {\n let next = value.value\n for (let i = 0; i < times; i++) next = stepValue(next, direction, props)\n return commit(next)\n }\n\n const stopRepeat = () => {\n clearTimeout(timer)\n timer = undefined\n pressed.value = null\n }\n onBeforeUnmount(stopRepeat)\n\n const atMin = computed(() => !props.wrap && value.value <= props.min)\n const atMax = computed(() => !props.wrap && value.value >= props.max)\n // At the minimum the decrement segment removes the item, when the owner can remove it\n const removes = computed(() => atMin.value && props.onRemove !== undefined)\n\n const startPress = (segment: Segment, event: PointerEvent) => {\n if (event.button !== 0 || props.disabled) return\n if (segment === \"decrement\" && removes.value) {\n const target = event.currentTarget\n if (target instanceof HTMLElement) target.setPointerCapture?.(event.pointerId)\n pressed.value = segment\n props.onRemove?.()\n return\n }\n if (segment === \"decrement\" ? atMin.value : atMax.value) return\n const target = event.currentTarget\n if (target instanceof HTMLElement) target.setPointerCapture?.(event.pointerId)\n pressed.value = segment\n const direction = segment === \"decrement\" ? -1 : 1\n stepBy(direction)\n if (!props.autoRepeat) return\n const repeat = () => {\n if (props.disabled || !stepBy(direction)) return stopRepeat()\n timer = setTimeout(repeat, REPEAT_INTERVAL)\n }\n timer = setTimeout(repeat, REPEAT_DELAY)\n }\n\n // A pointer steps on press, so only a click without one (assistive technology, `element.click()`) steps here.\n const handleClick = (segment: Segment, event: MouseEvent) => {\n if (event.detail !== 0 || props.disabled) return\n if (segment === \"decrement\" && removes.value) return props.onRemove?.()\n stepBy(segment === \"decrement\" ? -1 : 1)\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n if (props.disabled || event.altKey || event.ctrlKey || event.metaKey) return\n const keys: Record<string, () => void> = {\n ArrowUp: () => stepBy(1),\n ArrowDown: () => stepBy(-1),\n PageUp: () => stepBy(1, 10),\n PageDown: () => stepBy(-1, 10),\n Home: () => commit(props.min),\n End: () => commit(props.max),\n // At the minimum Delete or Backspace removes, as the trash can does; the arrows never do\n ...(removes.value && { Delete: () => props.onRemove?.(), Backspace: () => props.onRemove?.() }),\n }\n const action = keys[event.key]\n if (!action) return\n event.preventDefault()\n action()\n }\n\n const segment = (kind: Segment) => {\n const remove = kind === \"decrement\" && removes.value\n const atEnd = !remove && (kind === \"decrement\" ? atMin.value : atMax.value)\n return h(\"button\", {\n \"type\": \"button\",\n \"tabindex\": -1,\n \"aria-label\": remove ? props.removeLabel : kind === \"decrement\" ? props.decrementLabel : props.incrementLabel,\n \"aria-disabled\": atEnd || undefined,\n \"disabled\": props.disabled,\n \"class\": s.Segment,\n \"data-segment\": kind,\n \"data-remove\": remove ? \"\" : undefined,\n \"data-disabled\": atEnd || props.disabled ? \"\" : undefined,\n \"data-pressed\": pressed.value === kind && !props.disabled ? \"\" : undefined,\n // Keeps the focus where it is, as a native stepper takes none.\n \"onMousedown\": (event: MouseEvent) => event.preventDefault(),\n \"onPointerdown\": (event: PointerEvent) => startPress(kind, event),\n \"onPointerup\": stopRepeat,\n \"onPointercancel\": stopRepeat,\n \"onLostpointercapture\": stopRepeat,\n \"onClick\": (event: MouseEvent) => handleClick(kind, event),\n }, [h(remove ? RemoveTrash : kind === \"decrement\" ? Minus : Plus, { class: s.Icon })])\n }\n\n return () => h(\"div\", {\n ...attrs,\n \"id\": props.id,\n \"role\": \"spinbutton\",\n \"tabindex\": props.disabled ? -1 : 0,\n \"aria-valuenow\": value.value,\n \"aria-valuemin\": props.min,\n \"aria-valuemax\": props.max,\n \"aria-label\": props.ariaLabel,\n \"aria-labelledby\": props.ariaLabelledby,\n \"aria-describedby\": props.ariaDescribedby,\n \"aria-keyshortcuts\": removes.value ? \"Delete\" : undefined,\n \"aria-disabled\": props.disabled || undefined,\n \"class\": [s.Stepper, attrs.class],\n \"data-disabled\": props.disabled ? \"\" : undefined,\n \"data-pill\": props.pill ? \"\" : undefined,\n \"onKeydown\": handleKeyDown,\n \"onFocus\": (event: FocusEvent) => emit(\"focus\", event),\n \"onBlur\": (event: FocusEvent) => emit(\"blur\", event),\n }, [\n segment(\"decrement\"),\n h(\"span\", { \"class\": s.Separator, \"aria-hidden\": \"true\" }),\n segment(\"increment\"),\n props.name !== undefined ? h(\"input\", { type: \"hidden\", name: props.name, value: value.value, disabled: props.disabled }) : null,\n ])\n },\n})\n\ntype StepperOwnProps = InstanceType<typeof StepperComponent>[\"$props\"]\n\n/** Stepper props. */\nexport type StepperProps = StepperOwnProps\n\n/**\n * Two segments that decrease and increase a number, as the iOS 26 stepper does. It shows no value of its own:\n * name it with `aria-label` or `aria-labelledby` and show the value beside it. Keyboard focus lands on the\n * stepper, a spin button: Up and Down step, Page Up and Page Down step ten times, Home and End go to the range ends.\n */\nexport const Stepper = StepperComponent\n"]}
@@ -23,9 +23,9 @@ declare const ColorWellComponent: import("vue").DefineComponent<import("vue").Ex
23
23
  type: BooleanConstructor;
24
24
  default: boolean;
25
25
  };
26
- /** The kit's Picker Button sizes: `sm` 28px, `lg` 36px. @default "sm" */
26
+ /** The kit's Picker Button sizes, `sm` 28px and `lg` 36px, and `xs` 24px for the start of a 32px field. @default "sm" */
27
27
  size: {
28
- type: PropType<"sm" | "lg">;
28
+ type: PropType<"xs" | "sm" | "lg">;
29
29
  default: string;
30
30
  };
31
31
  /** When `true`, prevents the user from opening the picker. */
@@ -102,9 +102,9 @@ declare const ColorWellComponent: import("vue").DefineComponent<import("vue").Ex
102
102
  type: BooleanConstructor;
103
103
  default: boolean;
104
104
  };
105
- /** The kit's Picker Button sizes: `sm` 28px, `lg` 36px. @default "sm" */
105
+ /** The kit's Picker Button sizes, `sm` 28px and `lg` 36px, and `xs` 24px for the start of a 32px field. @default "sm" */
106
106
  size: {
107
- type: PropType<"sm" | "lg">;
107
+ type: PropType<"xs" | "sm" | "lg">;
108
108
  default: string;
109
109
  };
110
110
  /** When `true`, prevents the user from opening the picker. */
@@ -156,7 +156,7 @@ declare const ColorWellComponent: import("vue").DefineComponent<import("vue").Ex
156
156
  value: string | null;
157
157
  defaultValue: string | null;
158
158
  disabled: boolean;
159
- size: "sm" | "lg";
159
+ size: "xs" | "sm" | "lg";
160
160
  swatches: string[];
161
161
  supportsAlpha: boolean;
162
162
  defaultMode: ColorPickerMode;
@@ -191,9 +191,9 @@ export declare const ColorWell: import("vue").DefineComponent<import("vue").Extr
191
191
  type: BooleanConstructor;
192
192
  default: boolean;
193
193
  };
194
- /** The kit's Picker Button sizes: `sm` 28px, `lg` 36px. @default "sm" */
194
+ /** The kit's Picker Button sizes, `sm` 28px and `lg` 36px, and `xs` 24px for the start of a 32px field. @default "sm" */
195
195
  size: {
196
- type: PropType<"sm" | "lg">;
196
+ type: PropType<"xs" | "sm" | "lg">;
197
197
  default: string;
198
198
  };
199
199
  /** When `true`, prevents the user from opening the picker. */
@@ -270,9 +270,9 @@ export declare const ColorWell: import("vue").DefineComponent<import("vue").Extr
270
270
  type: BooleanConstructor;
271
271
  default: boolean;
272
272
  };
273
- /** The kit's Picker Button sizes: `sm` 28px, `lg` 36px. @default "sm" */
273
+ /** The kit's Picker Button sizes, `sm` 28px and `lg` 36px, and `xs` 24px for the start of a 32px field. @default "sm" */
274
274
  size: {
275
- type: PropType<"sm" | "lg">;
275
+ type: PropType<"xs" | "sm" | "lg">;
276
276
  default: string;
277
277
  };
278
278
  /** When `true`, prevents the user from opening the picker. */
@@ -324,7 +324,7 @@ export declare const ColorWell: import("vue").DefineComponent<import("vue").Extr
324
324
  value: string | null;
325
325
  defaultValue: string | null;
326
326
  disabled: boolean;
327
- size: "sm" | "lg";
327
+ size: "xs" | "sm" | "lg";
328
328
  swatches: string[];
329
329
  supportsAlpha: boolean;
330
330
  defaultMode: ColorPickerMode;
@@ -29,6 +29,14 @@ declare const NavigationRowComponent: import("vue").DefineComponent<import("vue"
29
29
  type: BooleanConstructor;
30
30
  default: undefined;
31
31
  };
32
+ /**
33
+ * Where the value stands: at the `end` of the row, `below` the label at the full width, or `auto`: at the end while
34
+ * it fits beside the label on one line, otherwise below (as Calendar sets a long value).
35
+ */
36
+ valuePlacement: {
37
+ type: PropType<"end" | "below" | "auto">;
38
+ default: string;
39
+ };
32
40
  }>, () => import("vue").VNode<import("vue").RendererNode, import("vue").RendererElement, {
33
41
  [key: string]: any;
34
42
  }>, {}, {}, {}, import("vue").ComponentOptionsMixin, import("vue").ComponentOptionsMixin, {}, string, import("vue").PublicProps, Readonly<import("vue").ExtractPropTypes<{
@@ -54,9 +62,18 @@ declare const NavigationRowComponent: import("vue").DefineComponent<import("vue"
54
62
  type: BooleanConstructor;
55
63
  default: undefined;
56
64
  };
65
+ /**
66
+ * Where the value stands: at the `end` of the row, `below` the label at the full width, or `auto`: at the end while
67
+ * it fits beside the label on one line, otherwise below (as Calendar sets a long value).
68
+ */
69
+ valuePlacement: {
70
+ type: PropType<"end" | "below" | "auto">;
71
+ default: string;
72
+ };
57
73
  }>> & Readonly<{}>, {
58
74
  disabled: boolean;
59
75
  external: boolean;
76
+ valuePlacement: "auto" | "end" | "below";
60
77
  }, {}, {}, {}, string, import("vue").ComponentProvideOptions, true, {}, any>;
61
78
  type NavigationRowOwnProps = InstanceType<typeof NavigationRowComponent>["$props"];
62
79
  /** NavigationRow props plus the native button and link attributes and the click listener that fall through to the
@@ -1,3 +1,4 @@
1
+ import { type PropType } from "vue";
1
2
  /** The value one step away, clamped to the range or wrapped, without floating point drift. */
2
3
  export declare const stepValue: (current: number, direction: 1 | -1, { min, max, step, wrap }: {
3
4
  min: number;
@@ -63,6 +64,16 @@ declare const StepperComponent: import("vue").DefineComponent<import("vue").Extr
63
64
  type: StringConstructor;
64
65
  default: string;
65
66
  };
67
+ /**
68
+ * Called (`@remove`) when the decrement segment is pressed at `min`. With it, the segment shows a trash can there
69
+ * and removes the item, as a cart's stepper does at a quantity of one (without `wrap`).
70
+ */
71
+ onRemove: PropType<() => void>;
72
+ /** Accessible name of the decrement segment when it removes. @default "Remove" */
73
+ removeLabel: {
74
+ type: StringConstructor;
75
+ default: string;
76
+ };
66
77
  /** The name of the stepper. Submits its value with the owning form. */
67
78
  name: StringConstructor;
68
79
  /** Accessible name of the value the stepper changes, when no visible label names it. */
@@ -140,6 +151,16 @@ declare const StepperComponent: import("vue").DefineComponent<import("vue").Extr
140
151
  type: StringConstructor;
141
152
  default: string;
142
153
  };
154
+ /**
155
+ * Called (`@remove`) when the decrement segment is pressed at `min`. With it, the segment shows a trash can there
156
+ * and removes the item, as a cart's stepper does at a quantity of one (without `wrap`).
157
+ */
158
+ onRemove: PropType<() => void>;
159
+ /** Accessible name of the decrement segment when it removes. @default "Remove" */
160
+ removeLabel: {
161
+ type: StringConstructor;
162
+ default: string;
163
+ };
143
164
  /** The name of the stepper. Submits its value with the owning form. */
144
165
  name: StringConstructor;
145
166
  /** Accessible name of the value the stepper changes, when no visible label names it. */
@@ -161,6 +182,7 @@ declare const StepperComponent: import("vue").DefineComponent<import("vue").Extr
161
182
  pill: boolean;
162
183
  max: number;
163
184
  min: number;
185
+ removeLabel: string;
164
186
  step: number;
165
187
  autoRepeat: boolean;
166
188
  decrementLabel: string;
@@ -232,6 +254,16 @@ export declare const Stepper: import("vue").DefineComponent<import("vue").Extrac
232
254
  type: StringConstructor;
233
255
  default: string;
234
256
  };
257
+ /**
258
+ * Called (`@remove`) when the decrement segment is pressed at `min`. With it, the segment shows a trash can there
259
+ * and removes the item, as a cart's stepper does at a quantity of one (without `wrap`).
260
+ */
261
+ onRemove: PropType<() => void>;
262
+ /** Accessible name of the decrement segment when it removes. @default "Remove" */
263
+ removeLabel: {
264
+ type: StringConstructor;
265
+ default: string;
266
+ };
235
267
  /** The name of the stepper. Submits its value with the owning form. */
236
268
  name: StringConstructor;
237
269
  /** Accessible name of the value the stepper changes, when no visible label names it. */
@@ -309,6 +341,16 @@ export declare const Stepper: import("vue").DefineComponent<import("vue").Extrac
309
341
  type: StringConstructor;
310
342
  default: string;
311
343
  };
344
+ /**
345
+ * Called (`@remove`) when the decrement segment is pressed at `min`. With it, the segment shows a trash can there
346
+ * and removes the item, as a cart's stepper does at a quantity of one (without `wrap`).
347
+ */
348
+ onRemove: PropType<() => void>;
349
+ /** Accessible name of the decrement segment when it removes. @default "Remove" */
350
+ removeLabel: {
351
+ type: StringConstructor;
352
+ default: string;
353
+ };
312
354
  /** The name of the stepper. Submits its value with the owning form. */
313
355
  name: StringConstructor;
314
356
  /** Accessible name of the value the stepper changes, when no visible label names it. */
@@ -330,6 +372,7 @@ export declare const Stepper: import("vue").DefineComponent<import("vue").Extrac
330
372
  pill: boolean;
331
373
  max: number;
332
374
  min: number;
375
+ removeLabel: string;
333
376
  step: number;
334
377
  autoRepeat: boolean;
335
378
  decrementLabel: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@plexui/vue",
3
- "version": "0.34.1",
3
+ "version": "0.36.0",
4
4
  "description": "Plex UI components for Vue 3, built on Reka UI and the shared @plexui/styles CSS",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -77,7 +77,7 @@
77
77
  "@maskito/core": "5.2.2",
78
78
  "@maskito/kit": "5.2.2",
79
79
  "@maskito/vue": "5.2.2",
80
- "@plexui/styles": "^0.12.0",
80
+ "@plexui/styles": "^0.14.0",
81
81
  "@tanstack/table-core": "8.21.3",
82
82
  "@tanstack/vue-table": "8.21.3",
83
83
  "@tiptap/core": "3.21.0",