@cimpress-ui/react 1.4.1 → 1.5.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.
- package/dist/commonjs/components/internal/x-button/x-button.js.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.d.ts +5 -0
- package/dist/commonjs/components/text-inputs/text-field.d.ts.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.js +21 -4
- package/dist/commonjs/components/text-inputs/text-field.js.map +1 -1
- package/dist/commonjs/i18n/messages/en-US.js +1 -1
- package/dist/commonjs/i18n/messages/en-US.js.map +1 -1
- package/dist/commonjs/i18n/messages/types.d.ts +2 -0
- package/dist/commonjs/i18n/messages/types.d.ts.map +1 -1
- package/dist/commonjs/i18n/messages/types.js.map +1 -1
- package/dist/esm/components/internal/x-button/x-button.js.map +1 -1
- package/dist/esm/components/text-inputs/text-field.d.ts +5 -0
- package/dist/esm/components/text-inputs/text-field.d.ts.map +1 -1
- package/dist/esm/components/text-inputs/text-field.js +20 -3
- package/dist/esm/components/text-inputs/text-field.js.map +1 -1
- package/dist/esm/i18n/messages/en-US.js +1 -1
- package/dist/esm/i18n/messages/en-US.js.map +1 -1
- package/dist/esm/i18n/messages/types.d.ts +2 -0
- package/dist/esm/i18n/messages/types.d.ts.map +1 -1
- package/dist/esm/i18n/messages/types.js.map +1 -1
- package/dist-styles/core.css +1 -1
- package/dist-styles/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x-button.js","sourceRoot":"","sources":["../../../../../src/components/internal/x-button/x-button.tsx"],"names":[],"mappings":";;;;;
|
|
1
|
+
{"version":3,"file":"x-button.js","sourceRoot":"","sources":["../../../../../src/components/internal/x-button/x-button.tsx"],"names":[],"mappings":";;;;;AA0BA,0BAqBC;;AA/CD,gDAAwB;AAExB,iEAAgG;AAChG,sDAAyE;AAezE,MAAM,QAAQ,GAAqF;IACjG,QAAQ,EAAE,wBAAa;IACvB,OAAO,EAAE,0BAAe;CACzB,CAAC;AAEF;;GAEG;AACH,SAAgB,OAAO,CAAC,EACtB,IAAI,GAAG,QAAQ,EACf,OAAO,GAAG,QAAQ,EAClB,QAAQ,GAAG,UAAU,EACrB,gBAAgB,EAChB,YAAY,EACZ,GAAG,KAAK,EACK;IACb,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAEhC,OAAO,CACL,uBAAC,8BAAS,OACJ,KAAK,EACT,SAAS,EAAE,IAAA,cAAI,EAAC,cAAc,EAAE,gBAAgB,CAAC,EACjD,KAAK,EAAE,YAAY,eACR,IAAI,kBACD,OAAO,YAErB,uBAAC,IAAI,KAAG,GACE,CACb,CAAC;AACJ,CAAC","sourcesContent":["import clsx from 'clsx';\nimport type { JSX } from 'react';\nimport { type ButtonProps as RACButtonProps, Button as RACButton } from 'react-aria-components';\nimport { IconCloseBold, IconCloseCircle } from '../../../icons/index.js';\nimport type { CommonProps, IconProps } from '../../types.js';\n\ninterface XButtonProps\n extends CommonProps,\n Pick<RACButtonProps, 'isDisabled' | 'onPress' | 'slot' | 'excludeFromTabOrder'> {\n 'aria-label': string;\n /** @default 'medium' */\n size?: 'small' | 'medium';\n /** @default 'square' */\n variant?: 'circle' | 'square';\n /** @default 'standard' */\n iconType?: 'standard' | 'circled';\n}\n\nconst ICON_MAP: Record<NonNullable<XButtonProps['iconType']>, (props: IconProps) => JSX.Element> = {\n standard: IconCloseBold,\n circled: IconCloseCircle,\n};\n\n/**\n * @internal\n */\nexport function XButton({\n size = 'medium',\n variant = 'square',\n iconType = 'standard',\n UNSAFE_className,\n UNSAFE_style,\n ...props\n}: XButtonProps) {\n const Icon = ICON_MAP[iconType];\n\n return (\n <RACButton\n {...props}\n className={clsx('cim-x-button', UNSAFE_className)}\n style={UNSAFE_style}\n data-size={size}\n data-variant={variant}\n >\n <Icon />\n </RACButton>\n );\n}\n"]}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type TextFieldProps as RACTextFieldProps } from 'react-aria-components';
|
|
2
2
|
import type { AffixProps, CommonProps, FieldWithPlaceholderProps } from '../types.js';
|
|
3
3
|
export interface TextFieldProps extends CommonProps, FieldWithPlaceholderProps<string>, AffixProps, Pick<RACTextFieldProps, 'value' | 'defaultValue' | 'onChange' | 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'type' | 'autoFocus' | 'autoComplete' | 'inputMode' | 'minLength' | 'maxLength' | 'pattern' | 'onFocus' | 'onBlur'> {
|
|
4
|
+
/**
|
|
5
|
+
* Whether to render a button that can be used to clear the text field.
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
isClearable?: boolean;
|
|
4
9
|
}
|
|
5
10
|
/**
|
|
6
11
|
* Allows users to enter a single line of text with a keyboard.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field.d.ts","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-field.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text-field.d.ts","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-field.tsx"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,cAAc,IAAI,iBAAiB,EAIzC,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGtF,MAAM,WAAW,cACf,SAAQ,WAAW,EACjB,yBAAyB,CAAC,MAAM,CAAC,EACjC,UAAU,EACV,IAAI,CACF,iBAAiB,EACf,OAAO,GACP,cAAc,GACd,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,MAAM,GACN,WAAW,GACX,cAAc,GACd,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,CACX;IACH;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAqHD;;;;GAIG;AACH,QAAA,MAAM,UAAU,gKAAqD,CAAC;AAEtE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"}
|
|
@@ -6,25 +6,42 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.TextField = void 0;
|
|
8
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
-
const utils_1 = require("@react-
|
|
9
|
+
const utils_1 = require("@react-aria/utils");
|
|
10
|
+
const utils_2 = require("@react-stately/utils");
|
|
10
11
|
const clsx_1 = __importDefault(require("clsx"));
|
|
11
12
|
const react_1 = require("react");
|
|
12
13
|
const react_aria_components_1 = require("react-aria-components");
|
|
13
14
|
const forward_ref_js_1 = require("../../forward-ref.js");
|
|
15
|
+
const localization_provider_js_1 = require("../../i18n/localization-provider.js");
|
|
14
16
|
const use_production_warning_js_1 = require("../../utils/use-production-warning.js");
|
|
15
17
|
const with_style_props_js_1 = require("../../with-style-props.js");
|
|
16
18
|
const form_field_js_1 = require("../internal/form-field/form-field.js");
|
|
19
|
+
const x_button_js_1 = require("../internal/x-button/x-button.js");
|
|
17
20
|
const utils_js_1 = require("../typography/utils.js");
|
|
18
|
-
function TextField({ label, description, error: errorMessage, placeholder, prefix, suffix, UNSAFE_className, UNSAFE_style, value: consumerValue, defaultValue: consumerDefaultValue, onChange, ...props }, ref) {
|
|
21
|
+
function TextField({ label, description, error: errorMessage, placeholder, prefix, suffix, UNSAFE_className, UNSAFE_style, isClearable = false, value: consumerValue, defaultValue: consumerDefaultValue, onChange, ...props }, ref) {
|
|
22
|
+
const { isDisabled, isReadOnly } = props;
|
|
19
23
|
const inputRef = (0, react_1.useRef)(null);
|
|
20
|
-
const [value, setValue] = (0,
|
|
24
|
+
const [value, setValue] = (0, utils_2.useControlledState)(consumerValue, consumerDefaultValue ?? '', onChange);
|
|
25
|
+
const messages = (0, localization_provider_js_1.useLocalizedMessages)('common');
|
|
26
|
+
const clearDescriptionId = (0, utils_1.useId)();
|
|
21
27
|
const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
|
|
28
|
+
function onKeyDown(e) {
|
|
29
|
+
if (isDisabled || isReadOnly) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (e.key === 'Escape' && isClearable) {
|
|
33
|
+
e.preventDefault();
|
|
34
|
+
setValue('');
|
|
35
|
+
}
|
|
36
|
+
}
|
|
22
37
|
(0, use_production_warning_js_1.useProductionWarning)(() => {
|
|
23
38
|
if (!label && !ariaLabel && !ariaLabelledBy) {
|
|
24
39
|
console.warn('TextField requires one of label / aria-label / aria-labelledby for accessibility');
|
|
25
40
|
}
|
|
26
41
|
}, [label, ariaLabel, ariaLabelledBy]);
|
|
27
|
-
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.TextField, { ...props, ref: ref, className: (0, clsx_1.default)('cim-text-field', UNSAFE_className), style: UNSAFE_style, value: value, onChange: setValue,
|
|
42
|
+
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.TextField, { ...props, ref: ref, className: (0, clsx_1.default)('cim-text-field', UNSAFE_className), style: UNSAFE_style, value: value, onChange: setValue, "aria-describedby": [props['aria-describedby'], isClearable ? clearDescriptionId : undefined]
|
|
43
|
+
.filter(Boolean)
|
|
44
|
+
.join(' '), children: ({ isDisabled, isRequired }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldLabel, { isRequired: isRequired, isDisabled: isDisabled, children: label }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.Group, { className: "cim-text-field-input-group", onClick: () => inputRef.current?.focus(), children: [prefix && ((0, jsx_runtime_1.jsx)("div", { className: (0, clsx_1.default)('cim-text-field-affix', (0, utils_js_1.textStyle)({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' })), "aria-hidden": true, children: prefix })), (0, jsx_runtime_1.jsx)(react_aria_components_1.Input, { ref: inputRef, className: (0, clsx_1.default)('cim-text-field-input', (0, utils_js_1.textStyle)({ variant: 'body' })), placeholder: placeholder, onKeyDown: onKeyDown }), isClearable && value !== '' && !isDisabled && !isReadOnly && ((0, jsx_runtime_1.jsx)(x_button_js_1.XButton, { slot: null, UNSAFE_className: "cim-text-field-clear", "aria-label": messages.format('clearValue'), onPress: () => setValue(''), iconType: "circled", excludeFromTabOrder: true })), suffix && ((0, jsx_runtime_1.jsx)("div", { className: (0, clsx_1.default)('cim-text-field-affix', (0, utils_js_1.textStyle)({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' })), "aria-hidden": true, children: suffix }))] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: errorMessage }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description }), (0, jsx_runtime_1.jsx)("p", { id: clearDescriptionId, className: "cim-text-field-clear-description", hidden: true, children: messages.format('clearValueDescription') })] })) }));
|
|
28
45
|
}
|
|
29
46
|
/**
|
|
30
47
|
* Allows users to enter a single line of text with a keyboard.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field.js","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAA0D;AAC1D,gDAAwB;AACxB,
|
|
1
|
+
{"version":3,"file":"text-field.js","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,6CAA0C;AAC1C,gDAA0D;AAC1D,gDAAwB;AACxB,iCAAsE;AACtE,iEAK+B;AAC/B,yDAAkD;AAClD,kFAA2E;AAC3E,qFAA6E;AAC7E,mEAA2D;AAC3D,wEAA4G;AAC5G,kEAA2D;AAE3D,qDAAmD;AAgCnD,SAAS,SAAS,CAChB,EACE,KAAK,EACL,WAAW,EACX,KAAK,EAAE,YAAY,EACnB,WAAW,EACX,MAAM,EACN,MAAM,EACN,gBAAgB,EACh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,mBAAmB,SACnB,CACH,EAEA,MAAM,IAAI,CACT,gCACE,SAAS,EAAE,IAAA,cAAI,EACb,sBAAsB,EACtB,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CACtE,iCAGA,MAAM,GACH,CACP,IACQ,EACX,uBAAC,8BAAc,cAAE,YAAY,GAAkB,EAC/C,uBAAC,oCAAoB,cAAE,WAAW,GAAwB,EAC1D,8BAAG,EAAE,EAAE,kBAAkB,EAAE,SAAS,EAAC,kCAAkC,EAAC,MAAM,kBAC3E,QAAQ,CAAC,MAAM,CAAC,uBAAuB,CAAC,GACvC,IACH,CACJ,GACY,CAChB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,SAAS,CAAC,EAAE,WAAW,CAAC,CAAC;AAE/C,+BAAS","sourcesContent":["'use client';\n\nimport { useId } from '@react-aria/utils';\nimport { useControlledState } from '@react-stately/utils';\nimport clsx from 'clsx';\nimport { type ForwardedRef, type KeyboardEvent, useRef } from 'react';\nimport {\n type TextFieldProps as RACTextFieldProps,\n Group as RACGroup,\n Input as RACInput,\n TextField as RACTextField,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/localization-provider.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport { XButton } from '../internal/x-button/x-button.js';\nimport type { AffixProps, CommonProps, FieldWithPlaceholderProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface TextFieldProps\n extends CommonProps,\n FieldWithPlaceholderProps<string>,\n AffixProps,\n Pick<\n RACTextFieldProps,\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'type'\n | 'autoFocus'\n | 'autoComplete'\n | 'inputMode'\n | 'minLength'\n | 'maxLength'\n | 'pattern'\n | 'onFocus'\n | 'onBlur'\n > {\n /**\n * Whether to render a button that can be used to clear the text field.\n * @default false\n */\n isClearable?: boolean;\n}\n\nfunction TextField(\n {\n label,\n description,\n error: errorMessage,\n placeholder,\n prefix,\n suffix,\n UNSAFE_className,\n UNSAFE_style,\n isClearable = false,\n value: consumerValue,\n defaultValue: consumerDefaultValue,\n onChange,\n ...props\n }: TextFieldProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { isDisabled, isReadOnly } = props;\n const inputRef = useRef<HTMLInputElement>(null);\n const [value, setValue] = useControlledState(consumerValue, consumerDefaultValue ?? '', onChange);\n const messages = useLocalizedMessages('common');\n const clearDescriptionId = useId();\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n function onKeyDown(e: KeyboardEvent) {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n if (e.key === 'Escape' && isClearable) {\n e.preventDefault();\n\n setValue('');\n }\n }\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('TextField requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n return (\n <RACTextField\n {...props}\n ref={ref}\n className={clsx('cim-text-field', UNSAFE_className)}\n style={UNSAFE_style}\n value={value}\n onChange={setValue}\n aria-describedby={[props['aria-describedby'], isClearable ? clearDescriptionId : undefined]\n .filter(Boolean)\n .join(' ')}\n >\n {({ isDisabled, isRequired }) => (\n <>\n <FormFieldLabel isRequired={isRequired} isDisabled={isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-text-field-input-group\" onClick={() => inputRef.current?.focus()}>\n {prefix && (\n <div\n className={clsx(\n 'cim-text-field-affix',\n textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' }),\n )}\n aria-hidden\n >\n {prefix}\n </div>\n )}\n\n <RACInput\n ref={inputRef}\n className={clsx('cim-text-field-input', textStyle({ variant: 'body' }))}\n placeholder={placeholder}\n onKeyDown={onKeyDown}\n />\n\n {isClearable && value !== '' && !isDisabled && !isReadOnly && (\n <XButton\n slot={null}\n UNSAFE_className=\"cim-text-field-clear\"\n aria-label={messages.format('clearValue')}\n onPress={() => setValue('')}\n iconType=\"circled\"\n excludeFromTabOrder\n />\n )}\n\n {suffix && (\n <div\n className={clsx(\n 'cim-text-field-affix',\n textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' }),\n )}\n aria-hidden\n >\n {suffix}\n </div>\n )}\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <p id={clearDescriptionId} className=\"cim-text-field-clear-description\" hidden>\n {messages.format('clearValueDescription')}\n </p>\n </>\n )}\n </RACTextField>\n );\n}\n\n/**\n * Allows users to enter a single line of text with a keyboard.\n *\n * See [text field usage guidelines](https://ui.cimpress.io/components/text-field/).\n */\nconst _TextField = withStyleProps(forwardRef(TextField), 'TextField');\n\nexport { _TextField as TextField };\n"]}
|
|
@@ -4,7 +4,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.enUS = void 0;
|
|
5
5
|
/** Strings used by Cimpress UI components, localized in the `en-US` locale. */
|
|
6
6
|
exports.enUS = {
|
|
7
|
-
common: { clearValue: `Clear`, dismiss: `Dismiss` },
|
|
7
|
+
common: { clearValue: `Clear`, dismiss: `Dismiss`, clearValueDescription: `Press Escape to clear text.` },
|
|
8
8
|
label: { required: `(required)` },
|
|
9
9
|
datePicker: {
|
|
10
10
|
clearValue: `Clear`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en-US.js","sourceRoot":"","sources":["../../../../src/i18n/messages/en-US.ts"],"names":[],"mappings":";AAAA,cAAc;;;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M,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE;KACrG;IACD,QAAQ,EAAE;QACR,aAAa,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CACjC,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,EAAE,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,gBAAgB,EAAE,KAAK,EAAE,GAAG,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,iBAAiB,CAAC,iBAAiB,EAAE,CAAC,EAAE;KACvM;IACD,UAAU,EAAE;QACV,UAAU,EAAE,aAAa;QACzB,eAAe,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CACnC,GAAG,SAAS,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,mBAAmB,EAAE,KAAK,EAAE,kBAAkB,EAAE,EAAE,IAAI,CAAC,cAAc,CAAC,EAAE;QACtG,qBAAqB,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ;KACxF;IACD,KAAK,EAAE,EAAE,qBAAqB,EAAE,8BAA8B,EAAE;IAChE,cAAc,EAAE;QACd,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,SAAS;QACjB,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,uBAAuB,IAAI,CAAC,YAAY,EAAE;QACpE,WAAW,EAAE,cAAc;KAC5B;IACD,mBAAmB,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAE;CACrF,CAAC","sourcesContent":["// @ts-nocheck\n\nimport type { LocalizedMessages } from './types.js';\n\n/** Strings used by Cimpress UI components, localized in the `en-US` locale. */\nexport const enUS: LocalizedMessages = {\n common: { clearValue: `Clear`, dismiss: `Dismiss`, clearValueDescription: `Press Escape to clear text.` },\n label: { required: `(required)` },\n datePicker: {\n clearValue: `Clear`,\n openCalendar: `Open calendar`,\n previousMonth: `Previous month`,\n nextMonth: `Next month`,\n switchToYearView: `Year view`,\n previousYear: `Previous year`,\n nextYear: `Next year`,\n switchToMultiYearView: `Multi-year view`,\n previousMultiYearSection: (args, formatter) => `Previous ${formatter.number(args.yearCount)} years`,\n nextMultiYearSection: (args, formatter) => `Next ${formatter.number(args.yearCount)} years`,\n },\n numberField: { decrement: `Decrement`, increment: `Increment` },\n pagination: {\n goToPage: (args, formatter) => `Page ${formatter.number(args.pageNumber)}`,\n previousPage: `Previous page`,\n nextPage: `Next page`,\n selectedPageAnnouncement: (args, formatter) => `Selected page: ${formatter.number(args.pageNumber)}`,\n },\n tagField: {\n itemsSelected: (args, formatter) =>\n `${formatter.plural(args.selectedItemCount, { one: () => `${formatter.number(args.selectedItemCount)} item selected`, other: () => `${formatter.number(args.selectedItemCount)} items selected` })}`,\n },\n filePicker: {\n chooseFile: `Choose file`,\n noFilesSelected: (args, formatter) =>\n `${formatter.select({ true: `No files selected`, other: `No file selected` }, args.allowsMultiple)}`,\n multipleFilesSelected: (args, formatter) => `${formatter.number(args.fileCount)} files`,\n },\n table: { toggleColumnSortOrder: `Toggle sort order of column:` },\n simpleAuthTool: {\n logIn: `Log in`,\n logOut: `Log out`,\n profileDetails: (args) => `Profile details for ${args.userFullName}`,\n unknownUser: `Unknown User`,\n },\n UNSTABLE_collection: { loading: `Loading items`, loadingMore: `Loading more items` },\n};\n"]}
|
|
@@ -11,6 +11,8 @@ export type LocalizedMessages = {
|
|
|
11
11
|
clearValue: LocalizedString;
|
|
12
12
|
/** An ARIA label for a button that closes or dismisses an alert, a callout, a dialog, or other overlay component. Used for accessibility purposes to clearly indicate the button's function to screen reader users. */
|
|
13
13
|
dismiss: LocalizedString;
|
|
14
|
+
/** A visually hidden label that indicates a text field can be cleared by pressing the Escape key. This text is only announced by screen readers. */
|
|
15
|
+
clearValueDescription: LocalizedString;
|
|
14
16
|
};
|
|
15
17
|
label: {
|
|
16
18
|
/** A visually hidden label that indicates a form field is required. This text is appended to the field's visible label and is only announced by screen readers. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/i18n/messages/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,CAAC,CACC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAChD,SAAS,CAAC,EAAE,wBAAwB,CAAC,MAAM,EAAE,eAAe,CAAC,KAC1D,MAAM,CAAC,CAAC;AAEjB,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE;QACN,mEAAmE;QACnE,UAAU,EAAE,eAAe,CAAC;QAC5B,uNAAuN;QACvN,OAAO,EAAE,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/i18n/messages/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,CAAC,CACC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAChD,SAAS,CAAC,EAAE,wBAAwB,CAAC,MAAM,EAAE,eAAe,CAAC,KAC1D,MAAM,CAAC,CAAC;AAEjB,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE;QACN,mEAAmE;QACnE,UAAU,EAAE,eAAe,CAAC;QAC5B,uNAAuN;QACvN,OAAO,EAAE,eAAe,CAAC;QACzB,oJAAoJ;QACpJ,qBAAqB,EAAE,eAAe,CAAC;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ACxC,CAAC;IACF,cAAc,EAAE;QACd,gEAAgE;QAChE,KAAK,EAAE,eAAe,CAAC;QACvB,gEAAgE;QAChE,MAAM,EAAE,eAAe,CAAC;QACxB,sFAAsF;QACtF,cAAc,EAAE,eAAe,CAAC;QAChC,uEAAuE;QACvE,WAAW,EAAE,eAAe,CAAC;KAC9B,CAAC;IACF,mBAAmB,EAAE;QACnB,0GAA0G;QAC1G,OAAO,EAAE,eAAe,CAAC;QACzB,gGAAgG;QAChG,WAAW,EAAE,eAAe,CAAC;KAC9B,CAAC;CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/i18n/messages/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { LocalizedStringFormatter } from 'react-aria';\n\n/**\n * Represents a localized piece of text used within a component.\n * It can either be a plain string, or a function that returns a plain string based on provided context.\n */\nexport type LocalizedString =\n | string\n | ((\n args?: Record<string, string | number | boolean>,\n formatter?: LocalizedStringFormatter<string, LocalizedString>,\n ) => string);\n\n/** A collection of localized strings used by Cimpress UI components. */\nexport type LocalizedMessages = {\n common: {\n /** An ARIA label for a button that clears the value of a field. */\n clearValue: LocalizedString;\n /** An ARIA label for a button that closes or dismisses an alert, a callout, a dialog, or other overlay component. Used for accessibility purposes to clearly indicate the button's function to screen reader users. */\n dismiss: LocalizedString;\n };\n label: {\n /** A visually hidden label that indicates a form field is required. This text is appended to the field's visible label and is only announced by screen readers. */\n required: LocalizedString;\n };\n datePicker: {\n /** An ARIA label for a button that clears the value of a date picker field. */\n clearValue: LocalizedString;\n /** An ARIA label for a button that opens a calendar popup. Part of a date picker. */\n openCalendar: LocalizedString;\n /** An ARIA label for a button that displays the previous month in a calendar popup. Part of a date picker. */\n previousMonth: LocalizedString;\n /** An ARIA label for a button that displays the next month in a calendar popup. Part of a date picker. */\n nextMonth: LocalizedString;\n /** An ARIA label for a button that changes the calendar popup to a single-year view. Part of a date picker. */\n switchToYearView: LocalizedString;\n /** An ARIA label for a button that displays the previous year in a calendar popup. Part of a date picker. */\n previousYear: LocalizedString;\n /** An ARIA label for a button that displays the next year in a calendar popup. Part of a date picker. */\n nextYear: LocalizedString;\n /** An ARIA label for a button that changes the calendar popup to a multi-year view. Part of a date picker. */\n switchToMultiYearView: LocalizedString;\n /** An ARIA label for a button that displays the previous section of a multi-year view in a calendar popup. Year count will always be larger than 1. Part of a date picker. */\n previousMultiYearSection: LocalizedString;\n /** An ARIA label for a button that displays the next section of a multi-year view in a calendar popup. Year count will always be larger than 1. Part of a date picker. */\n nextMultiYearSection: LocalizedString;\n };\n numberField: {\n /** An ARIA label for a button that decrements the value of a number field. */\n decrement: LocalizedString;\n /** An ARIA label for a button that increments the value of a number field. */\n increment: LocalizedString;\n };\n pagination: {\n /** An ARIA label for a button that navigates to a specific page. Part of a pagination navigation structure. */\n goToPage: LocalizedString;\n /** An ARIA label for a button that navigates to the previous page. Part of a pagination navigation structure. */\n previousPage: LocalizedString;\n /** An ARIA label for a button that navigates to the next page. Part of a pagination navigation structure. */\n nextPage: LocalizedString;\n /** A screen reader announcement for when the selected page changes. Part of a pagination navigation structure. */\n selectedPageAnnouncement: LocalizedString;\n };\n tagField: {\n /** A label displayed within a tag field to inform the user about the number of selected items. */\n itemsSelected: LocalizedString;\n };\n filePicker: {\n /** A label for the button that opens the native file picker dialog. */\n chooseFile: LocalizedString;\n /** A label for when no files are selected. */\n noFilesSelected: LocalizedString;\n /** A label for when multiple files are selected. */\n multipleFilesSelected: LocalizedString;\n };\n table: {\n /** An ARIA label for a button that toggles the sort order of a specific column in a data table. This label will be followed by the name of the column. */\n toggleColumnSortOrder: LocalizedString;\n };\n simpleAuthTool: {\n /** A label used for a button that redirects to a login flow. */\n logIn: LocalizedString;\n /** A label used for a button that logs the current user out. */\n logOut: LocalizedString;\n /** An ARIA label for a popover that contains information about the logged in user. */\n profileDetails: LocalizedString;\n /** A name that's displayed when the current user's name is unknown. */\n unknownUser: LocalizedString;\n };\n UNSTABLE_collection: {\n /** An ARIA label for a spinner displayed when the list of items is first being loaded in a collection. */\n loading: LocalizedString;\n /** An ARIA label for a spinner displayed when more items are being loaded into a collection. */\n loadingMore: LocalizedString;\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/i18n/messages/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { LocalizedStringFormatter } from 'react-aria';\n\n/**\n * Represents a localized piece of text used within a component.\n * It can either be a plain string, or a function that returns a plain string based on provided context.\n */\nexport type LocalizedString =\n | string\n | ((\n args?: Record<string, string | number | boolean>,\n formatter?: LocalizedStringFormatter<string, LocalizedString>,\n ) => string);\n\n/** A collection of localized strings used by Cimpress UI components. */\nexport type LocalizedMessages = {\n common: {\n /** An ARIA label for a button that clears the value of a field. */\n clearValue: LocalizedString;\n /** An ARIA label for a button that closes or dismisses an alert, a callout, a dialog, or other overlay component. Used for accessibility purposes to clearly indicate the button's function to screen reader users. */\n dismiss: LocalizedString;\n /** A visually hidden label that indicates a text field can be cleared by pressing the Escape key. This text is only announced by screen readers. */\n clearValueDescription: LocalizedString;\n };\n label: {\n /** A visually hidden label that indicates a form field is required. This text is appended to the field's visible label and is only announced by screen readers. */\n required: LocalizedString;\n };\n datePicker: {\n /** An ARIA label for a button that clears the value of a date picker field. */\n clearValue: LocalizedString;\n /** An ARIA label for a button that opens a calendar popup. Part of a date picker. */\n openCalendar: LocalizedString;\n /** An ARIA label for a button that displays the previous month in a calendar popup. Part of a date picker. */\n previousMonth: LocalizedString;\n /** An ARIA label for a button that displays the next month in a calendar popup. Part of a date picker. */\n nextMonth: LocalizedString;\n /** An ARIA label for a button that changes the calendar popup to a single-year view. Part of a date picker. */\n switchToYearView: LocalizedString;\n /** An ARIA label for a button that displays the previous year in a calendar popup. Part of a date picker. */\n previousYear: LocalizedString;\n /** An ARIA label for a button that displays the next year in a calendar popup. Part of a date picker. */\n nextYear: LocalizedString;\n /** An ARIA label for a button that changes the calendar popup to a multi-year view. Part of a date picker. */\n switchToMultiYearView: LocalizedString;\n /** An ARIA label for a button that displays the previous section of a multi-year view in a calendar popup. Year count will always be larger than 1. Part of a date picker. */\n previousMultiYearSection: LocalizedString;\n /** An ARIA label for a button that displays the next section of a multi-year view in a calendar popup. Year count will always be larger than 1. Part of a date picker. */\n nextMultiYearSection: LocalizedString;\n };\n numberField: {\n /** An ARIA label for a button that decrements the value of a number field. */\n decrement: LocalizedString;\n /** An ARIA label for a button that increments the value of a number field. */\n increment: LocalizedString;\n };\n pagination: {\n /** An ARIA label for a button that navigates to a specific page. Part of a pagination navigation structure. */\n goToPage: LocalizedString;\n /** An ARIA label for a button that navigates to the previous page. Part of a pagination navigation structure. */\n previousPage: LocalizedString;\n /** An ARIA label for a button that navigates to the next page. Part of a pagination navigation structure. */\n nextPage: LocalizedString;\n /** A screen reader announcement for when the selected page changes. Part of a pagination navigation structure. */\n selectedPageAnnouncement: LocalizedString;\n };\n tagField: {\n /** A label displayed within a tag field to inform the user about the number of selected items. */\n itemsSelected: LocalizedString;\n };\n filePicker: {\n /** A label for the button that opens the native file picker dialog. */\n chooseFile: LocalizedString;\n /** A label for when no files are selected. */\n noFilesSelected: LocalizedString;\n /** A label for when multiple files are selected. */\n multipleFilesSelected: LocalizedString;\n };\n table: {\n /** An ARIA label for a button that toggles the sort order of a specific column in a data table. This label will be followed by the name of the column. */\n toggleColumnSortOrder: LocalizedString;\n };\n simpleAuthTool: {\n /** A label used for a button that redirects to a login flow. */\n logIn: LocalizedString;\n /** A label used for a button that logs the current user out. */\n logOut: LocalizedString;\n /** An ARIA label for a popover that contains information about the logged in user. */\n profileDetails: LocalizedString;\n /** A name that's displayed when the current user's name is unknown. */\n unknownUser: LocalizedString;\n };\n UNSTABLE_collection: {\n /** An ARIA label for a spinner displayed when the list of items is first being loaded in a collection. */\n loading: LocalizedString;\n /** An ARIA label for a spinner displayed when more items are being loaded into a collection. */\n loadingMore: LocalizedString;\n };\n};\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"x-button.js","sourceRoot":"","sources":["../../../../../src/components/internal/x-button/x-button.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAsC,MAAM,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;
|
|
1
|
+
{"version":3,"file":"x-button.js","sourceRoot":"","sources":["../../../../../src/components/internal/x-button/x-button.tsx"],"names":[],"mappings":";AAAA,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB,OAAO,EAAsC,MAAM,IAAI,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAChG,OAAO,EAAE,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AAezE,MAAM,QAAQ,GAAqF;IACjG,QAAQ,EAAE,aAAa;IACvB,OAAO,EAAE,eAAe;CACzB,CAAC;AAEF;;GAEG;AACH,MAAM,UAAU,OAAO,CAAC,EACtB,IAAI,GAAG,QAAQ,EACf,OAAO,GAAG,QAAQ,EAClB,QAAQ,GAAG,UAAU,EACrB,gBAAgB,EAChB,YAAY,EACZ,GAAG,KAAK,EACK;IACb,MAAM,IAAI,GAAG,QAAQ,CAAC,QAAQ,CAAC,CAAC;IAEhC,OAAO,CACL,KAAC,SAAS,OACJ,KAAK,EACT,SAAS,EAAE,IAAI,CAAC,cAAc,EAAE,gBAAgB,CAAC,EACjD,KAAK,EAAE,YAAY,eACR,IAAI,kBACD,OAAO,YAErB,KAAC,IAAI,KAAG,GACE,CACb,CAAC;AACJ,CAAC","sourcesContent":["import clsx from 'clsx';\nimport type { JSX } from 'react';\nimport { type ButtonProps as RACButtonProps, Button as RACButton } from 'react-aria-components';\nimport { IconCloseBold, IconCloseCircle } from '../../../icons/index.js';\nimport type { CommonProps, IconProps } from '../../types.js';\n\ninterface XButtonProps\n extends CommonProps,\n Pick<RACButtonProps, 'isDisabled' | 'onPress' | 'slot' | 'excludeFromTabOrder'> {\n 'aria-label': string;\n /** @default 'medium' */\n size?: 'small' | 'medium';\n /** @default 'square' */\n variant?: 'circle' | 'square';\n /** @default 'standard' */\n iconType?: 'standard' | 'circled';\n}\n\nconst ICON_MAP: Record<NonNullable<XButtonProps['iconType']>, (props: IconProps) => JSX.Element> = {\n standard: IconCloseBold,\n circled: IconCloseCircle,\n};\n\n/**\n * @internal\n */\nexport function XButton({\n size = 'medium',\n variant = 'square',\n iconType = 'standard',\n UNSAFE_className,\n UNSAFE_style,\n ...props\n}: XButtonProps) {\n const Icon = ICON_MAP[iconType];\n\n return (\n <RACButton\n {...props}\n className={clsx('cim-x-button', UNSAFE_className)}\n style={UNSAFE_style}\n data-size={size}\n data-variant={variant}\n >\n <Icon />\n </RACButton>\n );\n}\n"]}
|
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import { type TextFieldProps as RACTextFieldProps } from 'react-aria-components';
|
|
2
2
|
import type { AffixProps, CommonProps, FieldWithPlaceholderProps } from '../types.js';
|
|
3
3
|
export interface TextFieldProps extends CommonProps, FieldWithPlaceholderProps<string>, AffixProps, Pick<RACTextFieldProps, 'value' | 'defaultValue' | 'onChange' | 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'type' | 'autoFocus' | 'autoComplete' | 'inputMode' | 'minLength' | 'maxLength' | 'pattern' | 'onFocus' | 'onBlur'> {
|
|
4
|
+
/**
|
|
5
|
+
* Whether to render a button that can be used to clear the text field.
|
|
6
|
+
* @default false
|
|
7
|
+
*/
|
|
8
|
+
isClearable?: boolean;
|
|
4
9
|
}
|
|
5
10
|
/**
|
|
6
11
|
* Allows users to enter a single line of text with a keyboard.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field.d.ts","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-field.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"text-field.d.ts","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-field.tsx"],"names":[],"mappings":"AAMA,OAAO,EACL,KAAK,cAAc,IAAI,iBAAiB,EAIzC,MAAM,uBAAuB,CAAC;AAO/B,OAAO,KAAK,EAAE,UAAU,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGtF,MAAM,WAAW,cACf,SAAQ,WAAW,EACjB,yBAAyB,CAAC,MAAM,CAAC,EACjC,UAAU,EACV,IAAI,CACF,iBAAiB,EACf,OAAO,GACP,cAAc,GACd,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,MAAM,GACN,WAAW,GACX,cAAc,GACd,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,CACX;IACH;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAqHD;;;;GAIG;AACH,QAAA,MAAM,UAAU,gKAAqD,CAAC;AAEtE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"}
|
|
@@ -1,24 +1,41 @@
|
|
|
1
1
|
'use client';
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from '@react-aria/utils';
|
|
3
4
|
import { useControlledState } from '@react-stately/utils';
|
|
4
5
|
import clsx from 'clsx';
|
|
5
6
|
import { useRef } from 'react';
|
|
6
|
-
import {
|
|
7
|
+
import { Group as RACGroup, Input as RACInput, TextField as RACTextField, } from 'react-aria-components';
|
|
7
8
|
import { forwardRef } from '../../forward-ref.js';
|
|
9
|
+
import { useLocalizedMessages } from '../../i18n/localization-provider.js';
|
|
8
10
|
import { useProductionWarning } from '../../utils/use-production-warning.js';
|
|
9
11
|
import { withStyleProps } from '../../with-style-props.js';
|
|
10
12
|
import { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';
|
|
13
|
+
import { XButton } from '../internal/x-button/x-button.js';
|
|
11
14
|
import { textStyle } from '../typography/utils.js';
|
|
12
|
-
function TextField({ label, description, error: errorMessage, placeholder, prefix, suffix, UNSAFE_className, UNSAFE_style, value: consumerValue, defaultValue: consumerDefaultValue, onChange, ...props }, ref) {
|
|
15
|
+
function TextField({ label, description, error: errorMessage, placeholder, prefix, suffix, UNSAFE_className, UNSAFE_style, isClearable = false, value: consumerValue, defaultValue: consumerDefaultValue, onChange, ...props }, ref) {
|
|
16
|
+
const { isDisabled, isReadOnly } = props;
|
|
13
17
|
const inputRef = useRef(null);
|
|
14
18
|
const [value, setValue] = useControlledState(consumerValue, consumerDefaultValue ?? '', onChange);
|
|
19
|
+
const messages = useLocalizedMessages('common');
|
|
20
|
+
const clearDescriptionId = useId();
|
|
15
21
|
const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
|
|
22
|
+
function onKeyDown(e) {
|
|
23
|
+
if (isDisabled || isReadOnly) {
|
|
24
|
+
return;
|
|
25
|
+
}
|
|
26
|
+
if (e.key === 'Escape' && isClearable) {
|
|
27
|
+
e.preventDefault();
|
|
28
|
+
setValue('');
|
|
29
|
+
}
|
|
30
|
+
}
|
|
16
31
|
useProductionWarning(() => {
|
|
17
32
|
if (!label && !ariaLabel && !ariaLabelledBy) {
|
|
18
33
|
console.warn('TextField requires one of label / aria-label / aria-labelledby for accessibility');
|
|
19
34
|
}
|
|
20
35
|
}, [label, ariaLabel, ariaLabelledBy]);
|
|
21
|
-
return (_jsx(RACTextField, { ...props, ref: ref, className: clsx('cim-text-field', UNSAFE_className), style: UNSAFE_style, value: value, onChange: setValue,
|
|
36
|
+
return (_jsx(RACTextField, { ...props, ref: ref, className: clsx('cim-text-field', UNSAFE_className), style: UNSAFE_style, value: value, onChange: setValue, "aria-describedby": [props['aria-describedby'], isClearable ? clearDescriptionId : undefined]
|
|
37
|
+
.filter(Boolean)
|
|
38
|
+
.join(' '), children: ({ isDisabled, isRequired }) => (_jsxs(_Fragment, { children: [_jsx(FormFieldLabel, { isRequired: isRequired, isDisabled: isDisabled, children: label }), _jsxs(RACGroup, { className: "cim-text-field-input-group", onClick: () => inputRef.current?.focus(), children: [prefix && (_jsx("div", { className: clsx('cim-text-field-affix', textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' })), "aria-hidden": true, children: prefix })), _jsx(RACInput, { ref: inputRef, className: clsx('cim-text-field-input', textStyle({ variant: 'body' })), placeholder: placeholder, onKeyDown: onKeyDown }), isClearable && value !== '' && !isDisabled && !isReadOnly && (_jsx(XButton, { slot: null, UNSAFE_className: "cim-text-field-clear", "aria-label": messages.format('clearValue'), onPress: () => setValue(''), iconType: "circled", excludeFromTabOrder: true })), suffix && (_jsx("div", { className: clsx('cim-text-field-affix', textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' })), "aria-hidden": true, children: suffix }))] }), _jsx(FormFieldError, { children: errorMessage }), _jsx(FormFieldDescription, { children: description }), _jsx("p", { id: clearDescriptionId, className: "cim-text-field-clear-description", hidden: true, children: messages.format('clearValueDescription') })] })) }));
|
|
22
39
|
}
|
|
23
40
|
/**
|
|
24
41
|
* Allows users to enter a single line of text with a keyboard.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text-field.js","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,
|
|
1
|
+
{"version":3,"file":"text-field.js","sourceRoot":"","sources":["../../../../src/components/text-inputs/text-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAC1C,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,IAAI,MAAM,MAAM,CAAC;AACxB,OAAO,EAAyC,MAAM,EAAE,MAAM,OAAO,CAAC;AACtE,O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@react-stately/utils';\nimport clsx from 'clsx';\nimport { type ForwardedRef, type KeyboardEvent, useRef } from 'react';\nimport {\n type TextFieldProps as RACTextFieldProps,\n Group as RACGroup,\n Input as RACInput,\n TextField as RACTextField,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/localization-provider.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport { XButton } from '../internal/x-button/x-button.js';\nimport type { AffixProps, CommonProps, FieldWithPlaceholderProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface TextFieldProps\n extends CommonProps,\n FieldWithPlaceholderProps<string>,\n AffixProps,\n Pick<\n RACTextFieldProps,\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'type'\n | 'autoFocus'\n | 'autoComplete'\n | 'inputMode'\n | 'minLength'\n | 'maxLength'\n | 'pattern'\n | 'onFocus'\n | 'onBlur'\n > {\n /**\n * Whether to render a button that can be used to clear the text field.\n * @default false\n */\n isClearable?: boolean;\n}\n\nfunction TextField(\n {\n label,\n description,\n error: errorMessage,\n placeholder,\n prefix,\n suffix,\n UNSAFE_className,\n UNSAFE_style,\n isClearable = false,\n value: consumerValue,\n defaultValue: consumerDefaultValue,\n onChange,\n ...props\n }: TextFieldProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { isDisabled, isReadOnly } = props;\n const inputRef = useRef<HTMLInputElement>(null);\n const [value, setValue] = useControlledState(consumerValue, consumerDefaultValue ?? '', onChange);\n const messages = useLocalizedMessages('common');\n const clearDescriptionId = useId();\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n function onKeyDown(e: KeyboardEvent) {\n if (isDisabled || isReadOnly) {\n return;\n }\n\n if (e.key === 'Escape' && isClearable) {\n e.preventDefault();\n\n setValue('');\n }\n }\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('TextField requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n return (\n <RACTextField\n {...props}\n ref={ref}\n className={clsx('cim-text-field', UNSAFE_className)}\n style={UNSAFE_style}\n value={value}\n onChange={setValue}\n aria-describedby={[props['aria-describedby'], isClearable ? clearDescriptionId : undefined]\n .filter(Boolean)\n .join(' ')}\n >\n {({ isDisabled, isRequired }) => (\n <>\n <FormFieldLabel isRequired={isRequired} isDisabled={isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-text-field-input-group\" onClick={() => inputRef.current?.focus()}>\n {prefix && (\n <div\n className={clsx(\n 'cim-text-field-affix',\n textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' }),\n )}\n aria-hidden\n >\n {prefix}\n </div>\n )}\n\n <RACInput\n ref={inputRef}\n className={clsx('cim-text-field-input', textStyle({ variant: 'body' }))}\n placeholder={placeholder}\n onKeyDown={onKeyDown}\n />\n\n {isClearable && value !== '' && !isDisabled && !isReadOnly && (\n <XButton\n slot={null}\n UNSAFE_className=\"cim-text-field-clear\"\n aria-label={messages.format('clearValue')}\n onPress={() => setValue('')}\n iconType=\"circled\"\n excludeFromTabOrder\n />\n )}\n\n {suffix && (\n <div\n className={clsx(\n 'cim-text-field-affix',\n textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'subtle' }),\n )}\n aria-hidden\n >\n {suffix}\n </div>\n )}\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <p id={clearDescriptionId} className=\"cim-text-field-clear-description\" hidden>\n {messages.format('clearValueDescription')}\n </p>\n </>\n )}\n </RACTextField>\n );\n}\n\n/**\n * Allows users to enter a single line of text with a keyboard.\n *\n * See [text field usage guidelines](https://ui.cimpress.io/components/text-field/).\n */\nconst _TextField = withStyleProps(forwardRef(TextField), 'TextField');\n\nexport { _TextField as TextField };\n"]}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
// @ts-nocheck
|
|
2
2
|
/** Strings used by Cimpress UI components, localized in the `en-US` locale. */
|
|
3
3
|
export const enUS = {
|
|
4
|
-
common: { clearValue: `Clear`, dismiss: `Dismiss` },
|
|
4
|
+
common: { clearValue: `Clear`, dismiss: `Dismiss`, clearValueDescription: `Press Escape to clear text.` },
|
|
5
5
|
label: { required: `(required)` },
|
|
6
6
|
datePicker: {
|
|
7
7
|
clearValue: `Clear`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"en-US.js","sourceRoot":"","sources":["../../../../src/i18n/messages/en-US.ts"],"names":[],"mappings":"AAAA,cAAc;AAId,+EAA+E;AAC/E,MAAM,CAAC,MAAM,IAAI,GAAsB;IACrC,MAAM,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"en-US.js","sourceRoot":"","sources":["../../../../src/i18n/messages/en-US.ts"],"names":[],"mappings":"AAAA,cAAc;AAId,+EAA+E;AAC/E,MAAM,CAAC,MAAM,IAAI,GAAsB;IACrC,MAAM,EAAE,EAAE,UAAU,EAAE,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,qBAAqB,EAAE,6BAA6B,EAAE;IACzG,KAAK,EAAE,EAAE,QAAQ,EAAE,YAAY,EAAE;IACjC,UAAU,EAAE;QACV,UAAU,EAAE,OAAO;QACnB,YAAY,EAAE,eAAe;QAC7B,aAAa,EAAE,gBAAgB;QAC/B,SAAS,EAAE,YAAY;QACvB,gBAAgB,EAAE,WAAW;QAC7B,YAAY,EAAE,eAAe;QAC7B,QAAQ,EAAE,WAAW;QACrB,qBAAqB,EAAE,iBAAiB;QACxC,wBAAwB,EAAE,CAAC,IAAI,EAAE,SAAS,EAAE,EAAE,CAAC,YAAY,SA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,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,SAAS,CAAC,QAAQ;KACxF;IACD,KAAK,EAAE,EAAE,qBAAqB,EAAE,8BAA8B,EAAE;IAChE,cAAc,EAAE;QACd,KAAK,EAAE,QAAQ;QACf,MAAM,EAAE,SAAS;QACjB,cAAc,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,uBAAuB,IAAI,CAAC,YAAY,EAAE;QACpE,WAAW,EAAE,cAAc;KAC5B;IACD,mBAAmB,EAAE,EAAE,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,oBAAoB,EAAE;CACrF,CAAC","sourcesContent":["// @ts-nocheck\n\nimport type { LocalizedMessages } from './types.js';\n\n/** Strings used by Cimpress UI components, localized in the `en-US` locale. */\nexport const enUS: LocalizedMessages = {\n common: { clearValue: `Clear`, dismiss: `Dismiss`, clearValueDescription: `Press Escape to clear text.` },\n label: { required: `(required)` },\n datePicker: {\n clearValue: `Clear`,\n openCalendar: `Open calendar`,\n previousMonth: `Previous month`,\n nextMonth: `Next month`,\n switchToYearView: `Year view`,\n previousYear: `Previous year`,\n nextYear: `Next year`,\n switchToMultiYearView: `Multi-year view`,\n previousMultiYearSection: (args, formatter) => `Previous ${formatter.number(args.yearCount)} years`,\n nextMultiYearSection: (args, formatter) => `Next ${formatter.number(args.yearCount)} years`,\n },\n numberField: { decrement: `Decrement`, increment: `Increment` },\n pagination: {\n goToPage: (args, formatter) => `Page ${formatter.number(args.pageNumber)}`,\n previousPage: `Previous page`,\n nextPage: `Next page`,\n selectedPageAnnouncement: (args, formatter) => `Selected page: ${formatter.number(args.pageNumber)}`,\n },\n tagField: {\n itemsSelected: (args, formatter) =>\n `${formatter.plural(args.selectedItemCount, { one: () => `${formatter.number(args.selectedItemCount)} item selected`, other: () => `${formatter.number(args.selectedItemCount)} items selected` })}`,\n },\n filePicker: {\n chooseFile: `Choose file`,\n noFilesSelected: (args, formatter) =>\n `${formatter.select({ true: `No files selected`, other: `No file selected` }, args.allowsMultiple)}`,\n multipleFilesSelected: (args, formatter) => `${formatter.number(args.fileCount)} files`,\n },\n table: { toggleColumnSortOrder: `Toggle sort order of column:` },\n simpleAuthTool: {\n logIn: `Log in`,\n logOut: `Log out`,\n profileDetails: (args) => `Profile details for ${args.userFullName}`,\n unknownUser: `Unknown User`,\n },\n UNSTABLE_collection: { loading: `Loading items`, loadingMore: `Loading more items` },\n};\n"]}
|
|
@@ -11,6 +11,8 @@ export type LocalizedMessages = {
|
|
|
11
11
|
clearValue: LocalizedString;
|
|
12
12
|
/** An ARIA label for a button that closes or dismisses an alert, a callout, a dialog, or other overlay component. Used for accessibility purposes to clearly indicate the button's function to screen reader users. */
|
|
13
13
|
dismiss: LocalizedString;
|
|
14
|
+
/** A visually hidden label that indicates a text field can be cleared by pressing the Escape key. This text is only announced by screen readers. */
|
|
15
|
+
clearValueDescription: LocalizedString;
|
|
14
16
|
};
|
|
15
17
|
label: {
|
|
16
18
|
/** A visually hidden label that indicates a form field is required. This text is appended to the field's visible label and is only announced by screen readers. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/i18n/messages/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,YAAY,CAAC;AAE3D;;;GAGG;AACH,MAAM,MAAM,eAAe,GACvB,MAAM,GACN,CAAC,CACC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,CAAC,EAChD,SAAS,CAAC,EAAE,wBAAwB,CAAC,MAAM,EAAE,eAAe,CAAC,KAC1D,MAAM,CAAC,CAAC;AAEjB,wEAAwE;AACxE,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE;QACN,mEAAmE;QACnE,UAAU,EAAE,eAAe,CAAC;QAC5B,uNAAuN;QACvN,OAAO,EAAE,eAAe,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","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KAC5B,CAAC;IACF,UAAU,EAAE;QACV,+GAA+G;QAC/G,QAAQ,EAAE,eAAe,CAAC;QAC1B,iHAAiH;QACjH,YAAY,EAAE,eAAe,CAAC;QAC9B,6GAA6G;QAC7G,QAAQ,EAAE,eAAe,CAAC;QAC1B,kHAAkH;QAClH,wBAAwB,EAAE,eAAe,CAAC;KAC3C,CAAC;IACF,QAAQ,EAAE;QACR,kGAAkG;QAClG,aAAa,EAAE,eAAe,CAAC;KAChC,CAAC;IACF,UAAU,EAAE;QACV,uEAAuE;QACvE,UAAU,EAAE,eAAe,CAAC;QAC5B,8CAA8C;QAC9C,eAAe,EAAE,eAAe,CAAC;QACjC,oDAAoD;QACpD,qBAAqB,EAAE,eAAe,CAAC;KACxC,CAAC;IACF,KAAK,EAAE;QACL,0JAA0J;QAC1J,qBAAqB,EAAE,eAAe,CAAC;KACxC,CAAC;IACF,cAAc,EAAE;QACd,gEAAgE;QAChE,KAAK,EAAE,eAAe,CAAC;QACvB,gEAAgE;QAChE,MAAM,EAAE,eAAe,CAAC;QACxB,sFAAsF;QACtF,cAAc,EAAE,eAAe,CAAC;QAChC,uEAAuE;QACvE,WAAW,EAAE,eAAe,CAAC;KAC9B,CAAC;IACF,mBAAmB,EAAE;QACnB,0GAA0G;QAC1G,OAAO,EAAE,eAAe,CAAC;QACzB,gGAAgG;QAChG,WAAW,EAAE,eAAe,CAAC;KAC9B,CAAC;CACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/i18n/messages/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { LocalizedStringFormatter } from 'react-aria';\n\n/**\n * Represents a localized piece of text used within a component.\n * It can either be a plain string, or a function that returns a plain string based on provided context.\n */\nexport type LocalizedString =\n | string\n | ((\n args?: Record<string, string | number | boolean>,\n formatter?: LocalizedStringFormatter<string, LocalizedString>,\n ) => string);\n\n/** A collection of localized strings used by Cimpress UI components. */\nexport type LocalizedMessages = {\n common: {\n /** An ARIA label for a button that clears the value of a field. */\n clearValue: LocalizedString;\n /** An ARIA label for a button that closes or dismisses an alert, a callout, a dialog, or other overlay component. Used for accessibility purposes to clearly indicate the button's function to screen reader users. */\n dismiss: LocalizedString;\n };\n label: {\n /** A visually hidden label that indicates a form field is required. This text is appended to the field's visible label and is only announced by screen readers. */\n required: LocalizedString;\n };\n datePicker: {\n /** An ARIA label for a button that clears the value of a date picker field. */\n clearValue: LocalizedString;\n /** An ARIA label for a button that opens a calendar popup. Part of a date picker. */\n openCalendar: LocalizedString;\n /** An ARIA label for a button that displays the previous month in a calendar popup. Part of a date picker. */\n previousMonth: LocalizedString;\n /** An ARIA label for a button that displays the next month in a calendar popup. Part of a date picker. */\n nextMonth: LocalizedString;\n /** An ARIA label for a button that changes the calendar popup to a single-year view. Part of a date picker. */\n switchToYearView: LocalizedString;\n /** An ARIA label for a button that displays the previous year in a calendar popup. Part of a date picker. */\n previousYear: LocalizedString;\n /** An ARIA label for a button that displays the next year in a calendar popup. Part of a date picker. */\n nextYear: LocalizedString;\n /** An ARIA label for a button that changes the calendar popup to a multi-year view. Part of a date picker. */\n switchToMultiYearView: LocalizedString;\n /** An ARIA label for a button that displays the previous section of a multi-year view in a calendar popup. Year count will always be larger than 1. Part of a date picker. */\n previousMultiYearSection: LocalizedString;\n /** An ARIA label for a button that displays the next section of a multi-year view in a calendar popup. Year count will always be larger than 1. Part of a date picker. */\n nextMultiYearSection: LocalizedString;\n };\n numberField: {\n /** An ARIA label for a button that decrements the value of a number field. */\n decrement: LocalizedString;\n /** An ARIA label for a button that increments the value of a number field. */\n increment: LocalizedString;\n };\n pagination: {\n /** An ARIA label for a button that navigates to a specific page. Part of a pagination navigation structure. */\n goToPage: LocalizedString;\n /** An ARIA label for a button that navigates to the previous page. Part of a pagination navigation structure. */\n previousPage: LocalizedString;\n /** An ARIA label for a button that navigates to the next page. Part of a pagination navigation structure. */\n nextPage: LocalizedString;\n /** A screen reader announcement for when the selected page changes. Part of a pagination navigation structure. */\n selectedPageAnnouncement: LocalizedString;\n };\n tagField: {\n /** A label displayed within a tag field to inform the user about the number of selected items. */\n itemsSelected: LocalizedString;\n };\n filePicker: {\n /** A label for the button that opens the native file picker dialog. */\n chooseFile: LocalizedString;\n /** A label for when no files are selected. */\n noFilesSelected: LocalizedString;\n /** A label for when multiple files are selected. */\n multipleFilesSelected: LocalizedString;\n };\n table: {\n /** An ARIA label for a button that toggles the sort order of a specific column in a data table. This label will be followed by the name of the column. */\n toggleColumnSortOrder: LocalizedString;\n };\n simpleAuthTool: {\n /** A label used for a button that redirects to a login flow. */\n logIn: LocalizedString;\n /** A label used for a button that logs the current user out. */\n logOut: LocalizedString;\n /** An ARIA label for a popover that contains information about the logged in user. */\n profileDetails: LocalizedString;\n /** A name that's displayed when the current user's name is unknown. */\n unknownUser: LocalizedString;\n };\n UNSTABLE_collection: {\n /** An ARIA label for a spinner displayed when the list of items is first being loaded in a collection. */\n loading: LocalizedString;\n /** An ARIA label for a spinner displayed when more items are being loaded into a collection. */\n loadingMore: LocalizedString;\n };\n};\n"]}
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/i18n/messages/types.ts"],"names":[],"mappings":"","sourcesContent":["import type { LocalizedStringFormatter } from 'react-aria';\n\n/**\n * Represents a localized piece of text used within a component.\n * It can either be a plain string, or a function that returns a plain string based on provided context.\n */\nexport type LocalizedString =\n | string\n | ((\n args?: Record<string, string | number | boolean>,\n formatter?: LocalizedStringFormatter<string, LocalizedString>,\n ) => string);\n\n/** A collection of localized strings used by Cimpress UI components. */\nexport type LocalizedMessages = {\n common: {\n /** An ARIA label for a button that clears the value of a field. */\n clearValue: LocalizedString;\n /** An ARIA label for a button that closes or dismisses an alert, a callout, a dialog, or other overlay component. Used for accessibility purposes to clearly indicate the button's function to screen reader users. */\n dismiss: LocalizedString;\n /** A visually hidden label that indicates a text field can be cleared by pressing the Escape key. This text is only announced by screen readers. */\n clearValueDescription: LocalizedString;\n };\n label: {\n /** A visually hidden label that indicates a form field is required. This text is appended to the field's visible label and is only announced by screen readers. */\n required: LocalizedString;\n };\n datePicker: {\n /** An ARIA label for a button that clears the value of a date picker field. */\n clearValue: LocalizedString;\n /** An ARIA label for a button that opens a calendar popup. Part of a date picker. */\n openCalendar: LocalizedString;\n /** An ARIA label for a button that displays the previous month in a calendar popup. Part of a date picker. */\n previousMonth: LocalizedString;\n /** An ARIA label for a button that displays the next month in a calendar popup. Part of a date picker. */\n nextMonth: LocalizedString;\n /** An ARIA label for a button that changes the calendar popup to a single-year view. Part of a date picker. */\n switchToYearView: LocalizedString;\n /** An ARIA label for a button that displays the previous year in a calendar popup. Part of a date picker. */\n previousYear: LocalizedString;\n /** An ARIA label for a button that displays the next year in a calendar popup. Part of a date picker. */\n nextYear: LocalizedString;\n /** An ARIA label for a button that changes the calendar popup to a multi-year view. Part of a date picker. */\n switchToMultiYearView: LocalizedString;\n /** An ARIA label for a button that displays the previous section of a multi-year view in a calendar popup. Year count will always be larger than 1. Part of a date picker. */\n previousMultiYearSection: LocalizedString;\n /** An ARIA label for a button that displays the next section of a multi-year view in a calendar popup. Year count will always be larger than 1. Part of a date picker. */\n nextMultiYearSection: LocalizedString;\n };\n numberField: {\n /** An ARIA label for a button that decrements the value of a number field. */\n decrement: LocalizedString;\n /** An ARIA label for a button that increments the value of a number field. */\n increment: LocalizedString;\n };\n pagination: {\n /** An ARIA label for a button that navigates to a specific page. Part of a pagination navigation structure. */\n goToPage: LocalizedString;\n /** An ARIA label for a button that navigates to the previous page. Part of a pagination navigation structure. */\n previousPage: LocalizedString;\n /** An ARIA label for a button that navigates to the next page. Part of a pagination navigation structure. */\n nextPage: LocalizedString;\n /** A screen reader announcement for when the selected page changes. Part of a pagination navigation structure. */\n selectedPageAnnouncement: LocalizedString;\n };\n tagField: {\n /** A label displayed within a tag field to inform the user about the number of selected items. */\n itemsSelected: LocalizedString;\n };\n filePicker: {\n /** A label for the button that opens the native file picker dialog. */\n chooseFile: LocalizedString;\n /** A label for when no files are selected. */\n noFilesSelected: LocalizedString;\n /** A label for when multiple files are selected. */\n multipleFilesSelected: LocalizedString;\n };\n table: {\n /** An ARIA label for a button that toggles the sort order of a specific column in a data table. This label will be followed by the name of the column. */\n toggleColumnSortOrder: LocalizedString;\n };\n simpleAuthTool: {\n /** A label used for a button that redirects to a login flow. */\n logIn: LocalizedString;\n /** A label used for a button that logs the current user out. */\n logOut: LocalizedString;\n /** An ARIA label for a popover that contains information about the logged in user. */\n profileDetails: LocalizedString;\n /** A name that's displayed when the current user's name is unknown. */\n unknownUser: LocalizedString;\n };\n UNSTABLE_collection: {\n /** An ARIA label for a spinner displayed when the list of items is first being loaded in a collection. */\n loading: LocalizedString;\n /** An ARIA label for a spinner displayed when more items are being loaded into a collection. */\n loadingMore: LocalizedString;\n };\n};\n"]}
|