@propellerads/editable-field 7.0.1 → 7.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import * as react_jsx_runtime from 'react/jsx-runtime';
1
+ import * as react from 'react';
2
2
  import { ChangeEventHandler } from 'react';
3
3
 
4
4
  /** Which colour the errors are shown in. */
@@ -110,7 +110,7 @@ type EditableFieldProps = {
110
110
  * Enter saves and Escape cancels. A click outside does nothing: an edit is not
111
111
  * thrown away by a stray click.
112
112
  */
113
- declare const EditableField: ({ value, errors, tone, hint, textStyle, isRequired, isLoading, isEditable, fieldClassName, editIconColor: _editIconColor, editIconSize: _editIconSize, containerDirection: _containerDirection, elementId, onFocus, onCancel, onSave, onChange, onErrorClick, }: EditableFieldProps) => react_jsx_runtime.JSX.Element;
113
+ declare const EditableField: ({ value, errors, tone, hint, textStyle, isRequired, isLoading, isEditable, fieldClassName, editIconColor: _editIconColor, editIconSize: _editIconSize, containerDirection: _containerDirection, elementId, onFocus, onCancel, onSave, onChange, onErrorClick, }: EditableFieldProps) => react.JSX.Element;
114
114
 
115
115
  export { ContainerDirection, EditIconColor, EditIconSize, EditableFieldTextStyle, EditableFieldTone, EditableField as default };
116
116
  export type { EditableFieldProps };
package/dist/index.js CHANGED
@@ -7,7 +7,7 @@ import { InputGroup as f, InputGroupAddon as re, InputGroupInput as p } from "@p
7
7
  import { useEffect as m, useRef as h, useState as g } from "react";
8
8
  import { clsx as _ } from "clsx";
9
9
  import { jsx as v, jsxs as y } from "react/jsx-runtime";
10
- import './index.css';//#region src/cn.ts
10
+ import './index.css';// src/cn.ts
11
11
  var ie = (...e) => _(e), b = {
12
12
  Danger: "danger",
13
13
  Warning: "warning"
@@ -29,7 +29,7 @@ var ie = (...e) => _(e), b = {
29
29
  Column: "column"
30
30
  }, T = !0, E = !1, ae = () => {
31
31
  E || (E = !0, document.addEventListener("keydown", (e) => {
32
- !e.metaKey && !e.altKey && !e.ctrlKey && (T = !0);
32
+ e.metaKey || e.altKey || e.ctrlKey || (T = !0);
33
33
  }, !0), document.addEventListener("pointerdown", () => {
34
34
  T = !1;
35
35
  }, !0));
@@ -199,7 +199,6 @@ var ie = (...e) => _(e), b = {
199
199
  })]
200
200
  });
201
201
  };
202
- //#endregion
203
202
  export { w as ContainerDirection, S as EditIconColor, C as EditIconSize, x as EditableFieldTextStyle, b as EditableFieldTone, k as default };
204
203
 
205
204
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":[],"sources":["../src/cn.ts","../src/types.ts","../src/index.tsx"],"sourcesContent":["import {type ClassValue, clsx} from 'clsx';\n\n/**\n * Joins class names. There is no tailwind-merge here on purpose: the editable field\n * ships its own stylesheet instead of utility classes, so there is nothing to\n * deduplicate.\n */\nconst cn = (...inputs: ClassValue[]): string => clsx(inputs);\n\nexport {cn};\n","import {Color, Size} from '@propellerads/icon';\nimport type {ChangeEventHandler} from 'react';\n\n/** Which colour the errors are shown in. */\nexport const EditableFieldTone = {\n /** Something is wrong and has to be fixed. */\n Danger: 'danger',\n /** Something is allowed but worth a second look. */\n Warning: 'warning',\n} as const;\nexport type EditableFieldTone = (typeof EditableFieldTone)[keyof typeof EditableFieldTone];\n\n/**\n * The type the value is set in, from @propellerads/tokens. The same in view and\n * in edit. The description and the hint sizes are left out: a value that small\n * is not something to edit in place. So is hero: it does not fit the 36px box.\n */\nexport const EditableFieldTextStyle = {\n H1: 'h1',\n H2: 'h2',\n H3: 'h3',\n H4: 'h4',\n Text: 'text',\n Paragraph: 'paragraph',\n} as const;\nexport type EditableFieldTextStyle = (typeof EditableFieldTextStyle)[keyof typeof EditableFieldTextStyle];\n\n/** @deprecated The pencil is an inline button in the action tone now. Accepted and ignored. */\nexport const EditIconColor = {\n Gray: Color.GrayDark,\n Blue: Color.Blue,\n} as const;\nexport type EditIconColor = (typeof EditIconColor)[keyof typeof EditIconColor];\n\n/** @deprecated The pencil takes the button's icon size now. Accepted and ignored. */\nexport const EditIconSize = {\n Small: Size.Small,\n Medium: Size.Medium,\n} as const;\nexport type EditIconSize = (typeof EditIconSize)[keyof typeof EditIconSize];\n\n/**\n * @deprecated The actions float over the page now and take no room beside the\n * field, so there is no direction to lay them out in. Accepted and ignored.\n */\nexport const ContainerDirection = {\n Row: 'row',\n Column: 'column',\n} as const;\nexport type ContainerDirection = (typeof ContainerDirection)[keyof typeof ContainerDirection];\n\nexport type EditableFieldProps = {\n errors?: ReadonlyArray<string>;\n /** Which colour the errors are shown in. @default 'danger' */\n tone?: EditableFieldTone;\n /**\n * A note on what the value is for, behind a grey `i` mark at the end of the\n * input while the field is edited. It gives way to `errors`.\n */\n hint?: string;\n value: string;\n /** The type the value is set in, in view and in edit. @default 'text' */\n textStyle?: EditableFieldTextStyle;\n /**\n * Forbids saving an empty value: save is switched off and Enter does nothing\n * while the input holds only spaces. Otherwise an empty value is saved and\n * leaves the pencil alone. @default false\n */\n isRequired?: boolean;\n /** Spinner on the pencil or on save, and the input switched off. */\n isLoading: boolean;\n /** The input and its actions, instead of the text and the pencil. Controlled by the caller. */\n isEditable: boolean;\n /** On the text in view and on the `<input>` in edit, as in v4. */\n fieldClassName?: string;\n /** @deprecated Accepted and ignored: the pencil is an inline button in the action tone. */\n editIconColor?: EditIconColor;\n /** @deprecated Accepted and ignored: the pencil takes the button's icon size. */\n editIconSize?: EditIconSize;\n /** @deprecated Accepted and ignored: the actions float. */\n containerDirection?: ContainerDirection;\n /**\n * Names the parts, as v4 did: the pencil is `${elementId}-editable-field-icon`,\n * the actions `${elementId}-editable-field-save` and `-cancel`.\n */\n elementId: string;\n /** Asks to edit: a click on the text or the pencil. */\n onFocus: () => void;\n /** The cancel button, or Escape. */\n onCancel: () => void;\n /** The save button, or Enter in the input. */\n onSave: () => void;\n onChange: ChangeEventHandler<HTMLInputElement>;\n /** Called when the `!` mark is clicked. */\n onErrorClick?: () => void;\n};\n","import {Popover} from '@base-ui-components/react/popover';\nimport {autoUpdate, flip, offset, shift, useFloating} from '@floating-ui/react-dom';\nimport Button, {ButtonVariant} from '@propellerads/button';\nimport ErrorLabel, {errorLabelTextId} from '@propellerads/error-label';\nimport {Check, Close, Edit, Size} from '@propellerads/icon';\nimport {InputGroup, InputGroupAddon, InputGroupInput} from '@propellerads/input';\nimport {type KeyboardEvent, useEffect, useRef, useState} from 'react';\nimport './editable-field.css';\nimport {cn} from './cn';\nimport {\n ContainerDirection,\n type EditableFieldProps,\n EditableFieldTextStyle,\n EditableFieldTone,\n EditIconColor,\n EditIconSize,\n} from './types';\n\n/*\n * Whether the last thing done on the page was a key or a pointer. A text input\n * matches :focus-visible on a click as well — a browser expects typing either\n * way — so the ring cannot lean on it: a click already turns the contour blue,\n * and the ring is for the keyboard. Kept once for the page, as the\n * focus-visible polyfill did.\n */\nlet isKeyboardModality = true;\nlet isTrackingModality = false;\n\nconst trackModality = (): void => {\n if (isTrackingModality) {\n return;\n }\n isTrackingModality = true;\n document.addEventListener(\n 'keydown',\n (event) => {\n if (!event.metaKey && !event.altKey && !event.ctrlKey) {\n isKeyboardModality = true;\n }\n },\n true,\n );\n document.addEventListener(\n 'pointerdown',\n () => {\n isKeyboardModality = false;\n },\n true,\n );\n};\n\n/** The id of the hidden hint text the input is described by. */\nconst hintTextId = (elementId: string): string => `${elementId}-editable-field-hint-text`;\n\n/**\n * The `i` mark and the hint behind it. The mark is ErrorLabel's in shape — a\n * 20px disc, the glyph in the page colour — and grey, in the icon colour,\n * because nothing is wrong. The hint is the dark tooltip the products use,\n * made of the two ends that turn over with the theme. It opens on hover and on\n * click, and the same text is kept beside the mark for a screen reader.\n */\nconst HintMark = ({elementId, hint}: {elementId: string; hint: string}) => (\n <span className=\"editable-field__hint\">\n <span id={hintTextId(elementId)} hidden>\n {hint}\n </span>\n <Popover.Root>\n <Popover.Trigger\n id={`${elementId}-editable-field-hint`}\n className=\"editable-field__hint-mark\"\n aria-label=\"Hint\"\n openOnHover\n delay={100}\n closeDelay={100}\n >\n i\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Positioner className=\"editable-field__hint-positioner\" side=\"top\" sideOffset={8} collisionPadding={8}>\n <Popover.Popup className=\"editable-field__hint-popup\">\n <Popover.Arrow className=\"editable-field__hint-arrow\" />\n {hint}\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n </span>\n);\n\n/**\n * A value that turns into an input in place.\n *\n * In view the field is as large as its text and the pencil: no box, no inset.\n * In edit the box is drawn outward, around the text, so the text stays where it\n * was and nothing beside the field moves.\n *\n * The save and cancel buttons float under the field instead of standing beside\n * it: they take no room, so a table row does not grow and a form does not jump.\n * They are rendered right after the input and placed by Floating UI with\n * `position: fixed` — so Tab goes from the input to the actions and on, and a\n * cell with `overflow: hidden` still does not clip them. At the bottom of the\n * screen they flip above the field.\n *\n * An empty value can be saved unless the field is required; saved, it leaves\n * the pencil alone.\n *\n * Enter saves and Escape cancels. A click outside does nothing: an edit is not\n * thrown away by a stray click.\n */\nconst EditableField = ({\n value,\n errors = [],\n tone = EditableFieldTone.Danger,\n hint,\n textStyle = EditableFieldTextStyle.Text,\n isRequired = false,\n isLoading,\n isEditable,\n fieldClassName,\n // Accepted for v4 and ignored: the pencil is a button of its own now.\n editIconColor: _editIconColor = EditIconColor.Gray,\n editIconSize: _editIconSize = EditIconSize.Medium,\n // Accepted for v4 and ignored: the actions float.\n containerDirection: _containerDirection = ContainerDirection.Column,\n elementId,\n onFocus,\n onCancel,\n onSave,\n onChange,\n onErrorClick,\n}: EditableFieldProps) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const editRef = useRef<HTMLButtonElement>(null);\n const wasOpen = useRef(isEditable);\n const [isFocusVisible, setFocusVisible] = useState(false);\n\n // The edit leaves the way it came: for a moment after the caller closes the\n // field, the box stays, its contour fades and the actions drop away, and only\n // then the text takes its place. The input and the text stand in the same\n // spot and the box is the page colour, so the swap itself does not show.\n // Worked out while rendering, so there is no frame without the box.\n const [isClosing, setClosing] = useState(false);\n const [lastEditable, setLastEditable] = useState(isEditable);\n if (isEditable !== lastEditable) {\n setLastEditable(isEditable);\n setClosing(!isEditable);\n }\n const isOpen = isEditable || isClosing;\n\n // The fade ends the closing; the timer is there for when no transition runs —\n // no tokens, or a stylesheet that switches motion off.\n useEffect(() => {\n if (!isClosing) {\n return undefined;\n }\n const timer = setTimeout(() => setClosing(false), 400);\n return () => clearTimeout(timer);\n }, [isClosing]);\n\n const isInvalid = errors.length > 0;\n // A hint belongs to the edit, as errors do: the value in view says nothing\n // more. It gives way to errors — when something is wrong, that is what to say.\n const hasHint = isOpen && !isInvalid && hint !== undefined && hint.trim() !== '';\n const isEmpty = value.trim() === '';\n const isSaveBlocked = isRequired && isEmpty;\n\n useEffect(trackModality, []);\n\n // Base UI's Popover would place the actions too, but it manages the focus of\n // what it portals: with no trigger to hand the focus back to, it takes the\n // buttons out of the tab order once the focus has left them. Floating UI\n // only places them.\n const {refs, floatingStyles, placement} = useFloating({\n open: isOpen,\n strategy: 'fixed',\n placement: 'bottom-end',\n // Four pixels under the box, and four to the right: the pad's own inset, so\n // the buttons, not the pad, line up with the end of the box.\n middleware: [offset({mainAxis: 4, crossAxis: 4}), flip({padding: 8}), shift({padding: 8})],\n whileElementsMounted: autoUpdate,\n });\n\n // When the edit ends, the input goes and the focus with it. If it was inside\n // the field, it comes back to the pencil, so the keyboard stays where it was.\n useEffect(() => {\n if (wasOpen.current && !isOpen) {\n const active = document.activeElement;\n if (active === null || active === document.body || rootRef.current?.contains(active)) {\n editRef.current?.focus();\n }\n }\n wasOpen.current = isOpen;\n }, [isOpen]);\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>): void => {\n if (isClosing) {\n return;\n }\n\n if (event.key === 'Enter' && !isLoading) {\n event.preventDefault();\n if (!isSaveBlocked) {\n onSave();\n }\n }\n\n if (event.key === 'Escape') {\n event.preventDefault();\n onCancel();\n }\n };\n\n // Escape on one of the actions cancels this field too.\n const handleActionsKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {\n if (event.key === 'Escape' && !isLoading && !isClosing) {\n event.preventDefault();\n onCancel();\n }\n };\n\n const errorLabel = isInvalid ? (\n <ErrorLabel elementId={elementId} errors={errors} tone={tone} onClick={onErrorClick} />\n ) : (\n hasHint && <HintMark elementId={elementId} hint={hint} />\n );\n\n return (\n <div\n ref={rootRef}\n className=\"editable-field\"\n data-editing={isOpen || undefined}\n data-closing={isClosing || undefined}\n data-loading={isLoading || undefined}\n data-text-style={textStyle}\n >\n {isOpen ? (\n <InputGroup\n ref={refs.setReference}\n tone={tone}\n isInvalid={isInvalid}\n className=\"editable-field__box\"\n data-focus-visible={isFocusVisible || undefined}\n onTransitionEnd={(event) => {\n if (isClosing && event.target === event.currentTarget && event.propertyName === 'box-shadow') {\n setClosing(false);\n }\n }}\n >\n <InputGroupInput\n className={fieldClassName}\n value={value}\n onChange={onChange}\n onKeyDown={handleKeyDown}\n onFocus={() => setFocusVisible(isKeyboardModality)}\n onBlur={() => setFocusVisible(false)}\n onPointerDown={() => setFocusVisible(false)}\n disabled={isLoading}\n readOnly={isClosing}\n tabIndex={isClosing ? -1 : undefined}\n // The field opens because it was asked to; the typing goes straight in.\n autoFocus\n aria-label=\"Value\"\n {...(isInvalid ? {'aria-invalid': true, 'aria-describedby': errorLabelTextId(elementId)} : {})}\n {...(hasHint ? {'aria-describedby': hintTextId(elementId)} : {})}\n />\n {(isInvalid || hasHint) && <InputGroupAddon>{errorLabel}</InputGroupAddon>}\n </InputGroup>\n ) : (\n <div className=\"editable-field__view\">\n {!isEmpty && (\n // biome-ignore lint/a11y/useKeyWithClickEvents: the pencil beside it is the keyboard's way in; this is a larger target for the pointer.\n <span className={cn('editable-field__value', fieldClassName)} onClick={onFocus}>\n {value}\n </span>\n )}\n {errorLabel}\n <Button\n ref={editRef}\n id={`${elementId}-editable-field-icon`}\n className=\"editable-field__edit\"\n variant={ButtonVariant.Inline}\n icon={<Edit color=\"currentColor\" size={Size.Small} />}\n aria-label=\"Edit\"\n isLoading={isLoading}\n onClick={onFocus}\n />\n </div>\n )}\n\n {/*\n Right after the input, so Tab goes to them next. The caller owns the open\n state, and nothing here changes it: Escape is handled for this one field,\n and a click outside is ignored on purpose.\n */}\n {isOpen && (\n <div ref={refs.setFloating} className=\"editable-field__positioner\" style={floatingStyles}>\n <div\n className=\"editable-field__actions\"\n data-side={placement.startsWith('top') ? 'top' : 'bottom'}\n aria-hidden={isClosing || undefined}\n onKeyDown={handleActionsKeyDown}\n >\n <Button\n id={`${elementId}-editable-field-save`}\n variant={ButtonVariant.Primary}\n icon={<Check color=\"currentColor\" size={Size.Small} />}\n aria-label=\"Save\"\n isLoading={isLoading}\n isDisabled={isSaveBlocked}\n onClick={() => {\n if (!isClosing) {\n onSave();\n }\n }}\n />\n <Button\n id={`${elementId}-editable-field-cancel`}\n variant={ButtonVariant.Secondary}\n icon={<Close color=\"currentColor\" size={Size.Small} />}\n aria-label=\"Cancel\"\n isDisabled={isLoading}\n onClick={() => {\n if (!isClosing) {\n onCancel();\n }\n }}\n />\n </div>\n </div>\n )}\n </div>\n );\n};\n\nexport default EditableField;\n\nexport type {EditableFieldProps} from './types';\nexport {ContainerDirection, EditableFieldTextStyle, EditableFieldTone, EditIconColor, EditIconSize} from './types';\n"],"mappings":";;;;;;;;;;AAOA,IAAM,MAAM,GAAG,MAAiC,EAAK,EAAO,ECH/C,IAAoB;CAE/B,QAAQ;CAER,SAAS;CACV,EAQY,IAAyB;CACpC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;CACN,WAAW;CACZ,EAIY,IAAgB;CAC3B,MAAM,EAAM;CACZ,MAAM,EAAM;CACb,EAIY,IAAe;CAC1B,OAAO,EAAK;CACZ,QAAQ,EAAK;CACd,EAOY,IAAqB;CAChC,KAAK;CACL,QAAQ;CACT,ECvBG,IAAqB,IACrB,IAAqB,IAEnB,WAA4B;CAC5B,MAGJ,IAAqB,IACrB,S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AAW;cAJb,CAME,kBAAC,GAAD;KACE,IAAI,GAAG,EAAU;KACjB,SAAS,EAAc;KACvB,MAAM,kBAAC,IAAD;MAAO,OAAM;MAAe,MAAM,EAAK;MAAS,CAAA;KACtD,cAAW;KACA;KACX,YAAY;KACZ,eAAe;MACb,AAAK,KACH,GAAQ;;KAGZ,CAAA,EACF,kBAAC,GAAD;KACE,IAAI,GAAG,EAAU;KACjB,SAAS,EAAc;KACvB,MAAM,kBAAC,IAAD;MAAO,OAAM;MAAe,MAAM,EAAK;MAAS,CAAA;KACtD,cAAW;KACX,YAAY;KACZ,eAAe;MACb,AAAK,KACH,GAAU;;KAGd,CAAA,CACE;;GACF,CAAA,CAEJ"}
1
+ {"version":3,"file":"index.js","names":["Button","ErrorLabel","cn","inputs","clsx","EditableFieldTone","EditableFieldTextStyle","EditIconColor","Color","EditIconSize","Size","ContainerDirection","isKeyboardModality","isTrackingModality","trackModality","event","hintTextId","elementId","HintMark","hint","Popover","EditableField","_editIconColor","_editIconSize","_containerDirection","rootRef","useRef","editRef","wasOpen","isEditable","isFocusVisible","setFocusVisible","useState","isClosing","setClosing","lastEditable","setLastEditable","isOpen","timer","isInvalid","errors","hasHint","isEmpty","value","isSaveBlocked","isRequired","useFloating","offset","flip","shift","autoUpdate","active","handleKeyDown","isLoading","onSave","onCancel","handleActionsKeyDown","errorLabel","onErrorClick","textStyle","InputGroup","refs","InputGroupInput","fieldClassName","errorLabelTextId","InputGroupAddon","onFocus","ButtonVariant","Edit","floatingStyles","placement","Check","Close"],"sources":["../src/cn.ts","../src/types.ts","../src/index.tsx"],"sourcesContent":["import {type ClassValue, clsx} from 'clsx';\n\n/**\n * Joins class names. There is no tailwind-merge here on purpose: the editable field\n * ships its own stylesheet instead of utility classes, so there is nothing to\n * deduplicate.\n */\nconst cn = (...inputs: ClassValue[]): string => clsx(inputs);\n\nexport {cn};\n","import {Color, Size} from '@propellerads/icon';\nimport type {ChangeEventHandler} from 'react';\n\n/** Which colour the errors are shown in. */\nexport const EditableFieldTone = {\n /** Something is wrong and has to be fixed. */\n Danger: 'danger',\n /** Something is allowed but worth a second look. */\n Warning: 'warning',\n} as const;\nexport type EditableFieldTone = (typeof EditableFieldTone)[keyof typeof EditableFieldTone];\n\n/**\n * The type the value is set in, from @propellerads/tokens. The same in view and\n * in edit. The description and the hint sizes are left out: a value that small\n * is not something to edit in place. So is hero: it does not fit the 36px box.\n */\nexport const EditableFieldTextStyle = {\n H1: 'h1',\n H2: 'h2',\n H3: 'h3',\n H4: 'h4',\n Text: 'text',\n Paragraph: 'paragraph',\n} as const;\nexport type EditableFieldTextStyle = (typeof EditableFieldTextStyle)[keyof typeof EditableFieldTextStyle];\n\n/** @deprecated The pencil is an inline button in the action tone now. Accepted and ignored. */\nexport const EditIconColor = {\n Gray: Color.GrayDark,\n Blue: Color.Blue,\n} as const;\nexport type EditIconColor = (typeof EditIconColor)[keyof typeof EditIconColor];\n\n/** @deprecated The pencil takes the button's icon size now. Accepted and ignored. */\nexport const EditIconSize = {\n Small: Size.Small,\n Medium: Size.Medium,\n} as const;\nexport type EditIconSize = (typeof EditIconSize)[keyof typeof EditIconSize];\n\n/**\n * @deprecated The actions float over the page now and take no room beside the\n * field, so there is no direction to lay them out in. Accepted and ignored.\n */\nexport const ContainerDirection = {\n Row: 'row',\n Column: 'column',\n} as const;\nexport type ContainerDirection = (typeof ContainerDirection)[keyof typeof ContainerDirection];\n\nexport type EditableFieldProps = {\n errors?: ReadonlyArray<string>;\n /** Which colour the errors are shown in. @default 'danger' */\n tone?: EditableFieldTone;\n /**\n * A note on what the value is for, behind a grey `i` mark at the end of the\n * input while the field is edited. It gives way to `errors`.\n */\n hint?: string;\n value: string;\n /** The type the value is set in, in view and in edit. @default 'text' */\n textStyle?: EditableFieldTextStyle;\n /**\n * Forbids saving an empty value: save is switched off and Enter does nothing\n * while the input holds only spaces. Otherwise an empty value is saved and\n * leaves the pencil alone. @default false\n */\n isRequired?: boolean;\n /** Spinner on the pencil or on save, and the input switched off. */\n isLoading: boolean;\n /** The input and its actions, instead of the text and the pencil. Controlled by the caller. */\n isEditable: boolean;\n /** On the text in view and on the `<input>` in edit, as in v4. */\n fieldClassName?: string;\n /** @deprecated Accepted and ignored: the pencil is an inline button in the action tone. */\n editIconColor?: EditIconColor;\n /** @deprecated Accepted and ignored: the pencil takes the button's icon size. */\n editIconSize?: EditIconSize;\n /** @deprecated Accepted and ignored: the actions float. */\n containerDirection?: ContainerDirection;\n /**\n * Names the parts, as v4 did: the pencil is `${elementId}-editable-field-icon`,\n * the actions `${elementId}-editable-field-save` and `-cancel`.\n */\n elementId: string;\n /** Asks to edit: a click on the text or the pencil. */\n onFocus: () => void;\n /** The cancel button, or Escape. */\n onCancel: () => void;\n /** The save button, or Enter in the input. */\n onSave: () => void;\n onChange: ChangeEventHandler<HTMLInputElement>;\n /** Called when the `!` mark is clicked. */\n onErrorClick?: () => void;\n};\n","import {Popover} from '@base-ui-components/react/popover';\nimport {autoUpdate, flip, offset, shift, useFloating} from '@floating-ui/react-dom';\nimport Button, {ButtonVariant} from '@propellerads/button';\nimport ErrorLabel, {errorLabelTextId} from '@propellerads/error-label';\nimport {Check, Close, Edit, Size} from '@propellerads/icon';\nimport {InputGroup, InputGroupAddon, InputGroupInput} from '@propellerads/input';\nimport {type KeyboardEvent, useEffect, useRef, useState} from 'react';\nimport './editable-field.css';\nimport {cn} from './cn';\nimport {\n ContainerDirection,\n type EditableFieldProps,\n EditableFieldTextStyle,\n EditableFieldTone,\n EditIconColor,\n EditIconSize,\n} from './types';\n\n/*\n * Whether the last thing done on the page was a key or a pointer. A text input\n * matches :focus-visible on a click as well — a browser expects typing either\n * way — so the ring cannot lean on it: a click already turns the contour blue,\n * and the ring is for the keyboard. Kept once for the page, as the\n * focus-visible polyfill did.\n */\nlet isKeyboardModality = true;\nlet isTrackingModality = false;\n\nconst trackModality = (): void => {\n if (isTrackingModality) {\n return;\n }\n isTrackingModality = true;\n document.addEventListener(\n 'keydown',\n (event) => {\n if (!event.metaKey && !event.altKey && !event.ctrlKey) {\n isKeyboardModality = true;\n }\n },\n true,\n );\n document.addEventListener(\n 'pointerdown',\n () => {\n isKeyboardModality = false;\n },\n true,\n );\n};\n\n/** The id of the hidden hint text the input is described by. */\nconst hintTextId = (elementId: string): string => `${elementId}-editable-field-hint-text`;\n\n/**\n * The `i` mark and the hint behind it. The mark is ErrorLabel's in shape — a\n * 20px disc, the glyph in the page colour — and grey, in the icon colour,\n * because nothing is wrong. The hint is the dark tooltip the products use,\n * made of the two ends that turn over with the theme. It opens on hover and on\n * click, and the same text is kept beside the mark for a screen reader.\n */\nconst HintMark = ({elementId, hint}: {elementId: string; hint: string}) => (\n <span className=\"editable-field__hint\">\n <span id={hintTextId(elementId)} hidden>\n {hint}\n </span>\n <Popover.Root>\n <Popover.Trigger\n id={`${elementId}-editable-field-hint`}\n className=\"editable-field__hint-mark\"\n aria-label=\"Hint\"\n openOnHover\n delay={100}\n closeDelay={100}\n >\n i\n </Popover.Trigger>\n <Popover.Portal>\n <Popover.Positioner className=\"editable-field__hint-positioner\" side=\"top\" sideOffset={8} collisionPadding={8}>\n <Popover.Popup className=\"editable-field__hint-popup\">\n <Popover.Arrow className=\"editable-field__hint-arrow\" />\n {hint}\n </Popover.Popup>\n </Popover.Positioner>\n </Popover.Portal>\n </Popover.Root>\n </span>\n);\n\n/**\n * A value that turns into an input in place.\n *\n * In view the field is as large as its text and the pencil: no box, no inset.\n * In edit the box is drawn outward, around the text, so the text stays where it\n * was and nothing beside the field moves.\n *\n * The save and cancel buttons float under the field instead of standing beside\n * it: they take no room, so a table row does not grow and a form does not jump.\n * They are rendered right after the input and placed by Floating UI with\n * `position: fixed` — so Tab goes from the input to the actions and on, and a\n * cell with `overflow: hidden` still does not clip them. At the bottom of the\n * screen they flip above the field.\n *\n * An empty value can be saved unless the field is required; saved, it leaves\n * the pencil alone.\n *\n * Enter saves and Escape cancels. A click outside does nothing: an edit is not\n * thrown away by a stray click.\n */\nconst EditableField = ({\n value,\n errors = [],\n tone = EditableFieldTone.Danger,\n hint,\n textStyle = EditableFieldTextStyle.Text,\n isRequired = false,\n isLoading,\n isEditable,\n fieldClassName,\n // Accepted for v4 and ignored: the pencil is a button of its own now.\n editIconColor: _editIconColor = EditIconColor.Gray,\n editIconSize: _editIconSize = EditIconSize.Medium,\n // Accepted for v4 and ignored: the actions float.\n containerDirection: _containerDirection = ContainerDirection.Column,\n elementId,\n onFocus,\n onCancel,\n onSave,\n onChange,\n onErrorClick,\n}: EditableFieldProps) => {\n const rootRef = useRef<HTMLDivElement>(null);\n const editRef = useRef<HTMLButtonElement>(null);\n const wasOpen = useRef(isEditable);\n const [isFocusVisible, setFocusVisible] = useState(false);\n\n // The edit leaves the way it came: for a moment after the caller closes the\n // field, the box stays, its contour fades and the actions drop away, and only\n // then the text takes its place. The input and the text stand in the same\n // spot and the box is the page colour, so the swap itself does not show.\n // Worked out while rendering, so there is no frame without the box.\n const [isClosing, setClosing] = useState(false);\n const [lastEditable, setLastEditable] = useState(isEditable);\n if (isEditable !== lastEditable) {\n setLastEditable(isEditable);\n setClosing(!isEditable);\n }\n const isOpen = isEditable || isClosing;\n\n // The fade ends the closing; the timer is there for when no transition runs —\n // no tokens, or a stylesheet that switches motion off.\n useEffect(() => {\n if (!isClosing) {\n return undefined;\n }\n const timer = setTimeout(() => setClosing(false), 400);\n return () => clearTimeout(timer);\n }, [isClosing]);\n\n const isInvalid = errors.length > 0;\n // A hint belongs to the edit, as errors do: the value in view says nothing\n // more. It gives way to errors — when something is wrong, that is what to say.\n const hasHint = isOpen && !isInvalid && hint !== undefined && hint.trim() !== '';\n const isEmpty = value.trim() === '';\n const isSaveBlocked = isRequired && isEmpty;\n\n useEffect(trackModality, []);\n\n // Base UI's Popover would place the actions too, but it manages the focus of\n // what it portals: with no trigger to hand the focus back to, it takes the\n // buttons out of the tab order once the focus has left them. Floating UI\n // only places them.\n const {refs, floatingStyles, placement} = useFloating({\n open: isOpen,\n strategy: 'fixed',\n placement: 'bottom-end',\n // Four pixels under the box, and four to the right: the pad's own inset, so\n // the buttons, not the pad, line up with the end of the box.\n middleware: [offset({mainAxis: 4, crossAxis: 4}), flip({padding: 8}), shift({padding: 8})],\n whileElementsMounted: autoUpdate,\n });\n\n // When the edit ends, the input goes and the focus with it. If it was inside\n // the field, it comes back to the pencil, so the keyboard stays where it was.\n useEffect(() => {\n if (wasOpen.current && !isOpen) {\n const active = document.activeElement;\n if (active === null || active === document.body || rootRef.current?.contains(active)) {\n editRef.current?.focus();\n }\n }\n wasOpen.current = isOpen;\n }, [isOpen]);\n\n const handleKeyDown = (event: KeyboardEvent<HTMLInputElement>): void => {\n if (isClosing) {\n return;\n }\n\n if (event.key === 'Enter' && !isLoading) {\n event.preventDefault();\n if (!isSaveBlocked) {\n onSave();\n }\n }\n\n if (event.key === 'Escape') {\n event.preventDefault();\n onCancel();\n }\n };\n\n // Escape on one of the actions cancels this field too.\n const handleActionsKeyDown = (event: KeyboardEvent<HTMLDivElement>): void => {\n if (event.key === 'Escape' && !isLoading && !isClosing) {\n event.preventDefault();\n onCancel();\n }\n };\n\n const errorLabel = isInvalid ? (\n <ErrorLabel elementId={elementId} errors={errors} tone={tone} onClick={onErrorClick} />\n ) : (\n hasHint && <HintMark elementId={elementId} hint={hint} />\n );\n\n return (\n <div\n ref={rootRef}\n className=\"editable-field\"\n data-editing={isOpen || undefined}\n data-closing={isClosing || undefined}\n data-loading={isLoading || undefined}\n data-text-style={textStyle}\n >\n {isOpen ? (\n <InputGroup\n ref={refs.setReference}\n tone={tone}\n isInvalid={isInvalid}\n className=\"editable-field__box\"\n data-focus-visible={isFocusVisible || undefined}\n onTransitionEnd={(event) => {\n if (isClosing && event.target === event.currentTarget && event.propertyName === 'box-shadow') {\n setClosing(false);\n }\n }}\n >\n <InputGroupInput\n className={fieldClassName}\n value={value}\n onChange={onChange}\n onKeyDown={handleKeyDown}\n onFocus={() => setFocusVisible(isKeyboardModality)}\n onBlur={() => setFocusVisible(false)}\n onPointerDown={() => setFocusVisible(false)}\n disabled={isLoading}\n readOnly={isClosing}\n tabIndex={isClosing ? -1 : undefined}\n // The field opens because it was asked to; the typing goes straight in.\n autoFocus\n aria-label=\"Value\"\n {...(isInvalid ? {'aria-invalid': true, 'aria-describedby': errorLabelTextId(elementId)} : {})}\n {...(hasHint ? {'aria-describedby': hintTextId(elementId)} : {})}\n />\n {(isInvalid || hasHint) && <InputGroupAddon>{errorLabel}</InputGroupAddon>}\n </InputGroup>\n ) : (\n <div className=\"editable-field__view\">\n {!isEmpty && (\n // biome-ignore lint/a11y/useKeyWithClickEvents: the pencil beside it is the keyboard's way in; this is a larger target for the pointer.\n <span className={cn('editable-field__value', fieldClassName)} onClick={onFocus}>\n {value}\n </span>\n )}\n {errorLabel}\n <Button\n ref={editRef}\n id={`${elementId}-editable-field-icon`}\n className=\"editable-field__edit\"\n variant={ButtonVariant.Inline}\n icon={<Edit color=\"currentColor\" size={Size.Small} />}\n aria-label=\"Edit\"\n isLoading={isLoading}\n onClick={onFocus}\n />\n </div>\n )}\n\n {/*\n Right after the input, so Tab goes to them next. The caller owns the open\n state, and nothing here changes it: Escape is handled for this one field,\n and a click outside is ignored on purpose.\n */}\n {isOpen && (\n <div ref={refs.setFloating} className=\"editable-field__positioner\" style={floatingStyles}>\n <div\n className=\"editable-field__actions\"\n data-side={placement.startsWith('top') ? 'top' : 'bottom'}\n aria-hidden={isClosing || undefined}\n onKeyDown={handleActionsKeyDown}\n >\n <Button\n id={`${elementId}-editable-field-save`}\n variant={ButtonVariant.Primary}\n icon={<Check color=\"currentColor\" size={Size.Small} />}\n aria-label=\"Save\"\n isLoading={isLoading}\n isDisabled={isSaveBlocked}\n onClick={() => {\n if (!isClosing) {\n onSave();\n }\n }}\n />\n <Button\n id={`${elementId}-editable-field-cancel`}\n variant={ButtonVariant.Secondary}\n icon={<Close color=\"currentColor\" size={Size.Small} />}\n aria-label=\"Cancel\"\n isDisabled={isLoading}\n onClick={() => {\n if (!isClosing) {\n onCancel();\n }\n }}\n />\n </div>\n </div>\n )}\n </div>\n );\n};\n\nexport default EditableField;\n\nexport type {EditableFieldProps} from './types';\nexport {ContainerDirection, EditableFieldTextStyle, EditableFieldTone, EditIconColor, EditIconSize} from './types';\n"],"mappings":";;;;;;;;;;AAOA,IAAME,MAAM,GAAGC,MAAiCC,EAAKD,CAAM,GCH9CE,IAAoB;CAE/B,QAAQ;CAER,SAAS;AACX,GAQaC,IAAyB;CACpC,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,MAAM;CACN,WAAW;AACb,GAIaC,IAAgB;CAC3B,MAAMC,EAAM;CACZ,MAAMA,EAAM;AACd,GAIaC,IAAe;CAC1B,OAAOC,EAAK;CACZ,QAAQA,EAAK;AACf,GAOaC,IAAqB;CAChC,KAAK;CACL,QAAQ;AACV,GCvBIC,IAAqB,IACrBC,IAAqB,IAEnBC,WAA4B;CAChC,AAAID,MAGJ,IAAqB,IACrB,SAAS,iBACP,YACC,MAAU;EACT,AAAKE,EAAM,WAAYA,EAAM,UAAWA,EAAM,YAC5C,IAAqB;CAEzB,GACA,EACF,GACA,SAAS,iBACP,qBACM;EACJ,IAAqB;CACvB,GACA,EACF;AACF,GAGMC,KAAc,MAA8B,GAAGC,EAAU,4BASzDC,KAAY,EAAC,cAAW,cAC5B,kBAAC,QAAD;CAAM,WAAU;CAAhB,UAAA,CACE,kBAAC,QAAD;EAAM,IAAIF,EAAWC,CAAS;EAAG,QAAA;EAC9B,UAAAE;CACG,CAAA,GACN,kBAACC,EAAQ,MAAT,EAAA,UAAA,CACE,kBAACA,EAAQ,SAAT;EACE,IAAI,GAAGH,EAAU;EACjB,WAAU;EACV,cAAW;EACX,aAAA;EACA,OAAO;EACP,YAAY;EACb,UAAA;CAEgB,CAAA,GACjB,kBAACG,EAAQ,QAAT,EAAA,UACE,kBAACA,EAAQ,YAAT;EAAoB,WAAU;EAAkC,MAAK;EAAM,YAAY;EAAG,kBAAkB;EAC1G,UAAA,kBAACA,EAAQ,OAA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;MAAO,OAAM;MAAe,MAAM9D,EAAK;KAAQ,CAAA;KACrD,cAAW;KACX,YAAY2C;KACZ,eAAe;MACb,AAAKpB,KACHsB,EAAS;KAEb;IACD,CAAA,CACE;;EACF,CAAA,CAEJ;;AAET"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@propellerads/editable-field",
3
- "version": "7.0.1",
3
+ "version": "7.0.3",
4
4
  "type": "module",
5
5
  "types": "dist/index.d.ts",
6
6
  "style": "dist/index.css",
@@ -24,7 +24,7 @@
24
24
  "url": "https://github.com/propellerads/ui-components/issues"
25
25
  },
26
26
  "scripts": {
27
- "build": "tsc && vite build && bunx rollup -c rollup.dts.config.mjs"
27
+ "build": "tsc && vite build && rollup -c rollup.dts.config.mjs"
28
28
  },
29
29
  "homepage": "https://github.com/propellerads/ui-components#readme",
30
30
  "private": false,
@@ -33,7 +33,7 @@
33
33
  "@floating-ui/react-dom": "^2.1.6",
34
34
  "@propellerads/button": "^13.0.0",
35
35
  "@propellerads/error-label": "^8.0.1",
36
- "@propellerads/icon": "^8.0.0",
36
+ "@propellerads/icon": "^10.0.0",
37
37
  "@propellerads/input": "^2.1.0",
38
38
  "clsx": "^2.1.1"
39
39
  },