@cimpress-ui/react 1.19.1 → 1.20.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/nav-list/nav-list.d.ts +34 -0
- package/dist/commonjs/components/nav-list/nav-list.d.ts.map +1 -0
- package/dist/commonjs/components/nav-list/nav-list.js +44 -0
- package/dist/commonjs/components/nav-list/nav-list.js.map +1 -0
- package/dist/commonjs/components/switch/switch.d.ts +26 -0
- package/dist/commonjs/components/switch/switch.d.ts.map +1 -0
- package/dist/commonjs/components/switch/switch.js +36 -0
- package/dist/commonjs/components/switch/switch.js.map +1 -0
- package/dist/commonjs/components/text-inputs/search-field.d.ts.map +1 -1
- package/dist/commonjs/components/text-inputs/search-field.js +1 -1
- package/dist/commonjs/components/text-inputs/search-field.js.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.d.ts.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.js +1 -1
- package/dist/commonjs/components/text-inputs/text-field.js.map +1 -1
- package/dist/commonjs/index.d.ts +2 -1
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +2 -1
- package/dist/commonjs/index.js.map +1 -1
- package/dist/esm/components/nav-list/nav-list.d.ts +34 -0
- package/dist/esm/components/nav-list/nav-list.d.ts.map +1 -0
- package/dist/esm/components/nav-list/nav-list.js +36 -0
- package/dist/esm/components/nav-list/nav-list.js.map +1 -0
- package/dist/esm/components/switch/switch.d.ts +26 -0
- package/dist/esm/components/switch/switch.d.ts.map +1 -0
- package/dist/esm/components/switch/switch.js +30 -0
- package/dist/esm/components/switch/switch.js.map +1 -0
- package/dist/esm/components/text-inputs/search-field.d.ts.map +1 -1
- package/dist/esm/components/text-inputs/search-field.js +1 -1
- package/dist/esm/components/text-inputs/search-field.js.map +1 -1
- package/dist/esm/components/text-inputs/text-field.d.ts.map +1 -1
- package/dist/esm/components/text-inputs/text-field.js +1 -1
- package/dist/esm/components/text-inputs/text-field.js.map +1 -1
- package/dist/esm/index.d.ts +2 -1
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +2 -1
- package/dist/esm/index.js.map +1 -1
- package/dist-styles/core.css +1 -1
- package/dist-styles/styles.css +1 -1
- package/package.json +1 -1
- package/dist/commonjs/components/toggle/toggle.d.ts +0 -14
- package/dist/commonjs/components/toggle/toggle.d.ts.map +0 -1
- package/dist/commonjs/components/toggle/toggle.js +0 -32
- package/dist/commonjs/components/toggle/toggle.js.map +0 -1
- package/dist/esm/components/toggle/toggle.d.ts +0 -14
- package/dist/esm/components/toggle/toggle.d.ts.map +0 -1
- package/dist/esm/components/toggle/toggle.js +0 -26
- package/dist/esm/components/toggle/toggle.js.map +0 -1
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Href, NavigationProps, StringLikeChildren } from '../types.js';
|
|
3
|
+
export interface UNSTABLE_NavListProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Displays a vertical navigation list.
|
|
8
|
+
*/
|
|
9
|
+
export declare function UNSTABLE_NavList({ children }: UNSTABLE_NavListProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export interface UNSTABLE_NavListItemProps extends NavigationProps {
|
|
11
|
+
children: StringLikeChildren;
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
href?: Href;
|
|
14
|
+
isCurrent?: boolean;
|
|
15
|
+
isDisabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Displays a single navigation item.
|
|
19
|
+
*/
|
|
20
|
+
export declare function UNSTABLE_NavListItem({ children, icon, href, isCurrent, isDisabled, routerOptions, ...props }: UNSTABLE_NavListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export interface UNSTABLE_NavListGroupProps {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
label: StringLikeChildren;
|
|
24
|
+
icon?: ReactNode;
|
|
25
|
+
isExpanded?: boolean;
|
|
26
|
+
defaultExpanded?: boolean;
|
|
27
|
+
onExpandedChange?: (isExpanded: boolean) => void;
|
|
28
|
+
isDisabled?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Displays an expandable navigation item group.
|
|
32
|
+
*/
|
|
33
|
+
export declare function UNSTABLE_NavListGroup({ children, label, icon, isExpanded, defaultExpanded, onExpandedChange, isDisabled, }: UNSTABLE_NavListGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
//# sourceMappingURL=nav-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-list.d.ts","sourceRoot":"","sources":["../../../../src/components/nav-list/nav-list.tsx"],"names":[],"mappings":"AAKA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlE,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAG7E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,qBAAqB,2CAEnE;AAiBD,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,UAAU,EACV,aAAa,EACb,GAAG,KAAK,EACT,EAAE,yBAAyB,2CAmB3B;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,UAAU,EACV,eAAuB,EACvB,gBAAgB,EAChB,UAAU,GACX,EAAE,0BAA0B,2CA0B5B"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.UNSTABLE_NavList = UNSTABLE_NavList;
|
|
8
|
+
exports.UNSTABLE_NavListItem = UNSTABLE_NavListItem;
|
|
9
|
+
exports.UNSTABLE_NavListGroup = UNSTABLE_NavListGroup;
|
|
10
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
|
+
const utils_1 = require("@react-aria/utils");
|
|
12
|
+
const utils_2 = require("@react-stately/utils");
|
|
13
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
14
|
+
const react_1 = require("react");
|
|
15
|
+
const react_aria_components_1 = require("react-aria-components");
|
|
16
|
+
const index_js_1 = require("../../icons/index.js");
|
|
17
|
+
const text_js_1 = require("../typography/text.js");
|
|
18
|
+
/**
|
|
19
|
+
* Displays a vertical navigation list.
|
|
20
|
+
*/
|
|
21
|
+
function UNSTABLE_NavList({ children }) {
|
|
22
|
+
return (0, jsx_runtime_1.jsx)("ul", { className: "cim-nav-list", children: children });
|
|
23
|
+
}
|
|
24
|
+
const NavListRowContext = (0, react_1.createContext)(null);
|
|
25
|
+
function NavListRow({ children }) {
|
|
26
|
+
const navListRowContext = (0, react_1.useContext)(NavListRowContext);
|
|
27
|
+
const newDepth = navListRowContext == null ? 0 : navListRowContext.depth + 1;
|
|
28
|
+
return ((0, jsx_runtime_1.jsx)(NavListRowContext.Provider, { value: { depth: newDepth }, children: (0, jsx_runtime_1.jsx)("li", { className: "cim-nav-list-row", style: { '--cim-nav-list-depth': newDepth }, children: children }) }));
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Displays a single navigation item.
|
|
32
|
+
*/
|
|
33
|
+
function UNSTABLE_NavListItem({ children, icon, href, isCurrent, isDisabled, routerOptions, ...props }) {
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)(NavListRow, { children: (0, jsx_runtime_1.jsxs)(react_aria_components_1.Link, { ...props, className: "cim-nav-list-item", href: href, routerOptions: routerOptions, "aria-current": isCurrent ? 'page' : undefined, isDisabled: isDisabled, "data-active": isCurrent || undefined, children: [icon, (0, jsx_runtime_1.jsx)(text_js_1.Text, { as: "span", variant: "medium", UNSAFE_className: "cim-nav-list-item-label", children: children })] }) }));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Displays an expandable navigation item group.
|
|
38
|
+
*/
|
|
39
|
+
function UNSTABLE_NavListGroup({ children, label, icon, isExpanded, defaultExpanded = false, onExpandedChange, isDisabled, }) {
|
|
40
|
+
const groupId = (0, utils_1.useId)();
|
|
41
|
+
const [expanded, setExpanded] = (0, utils_2.useControlledState)(isExpanded, defaultExpanded, onExpandedChange);
|
|
42
|
+
return ((0, jsx_runtime_1.jsxs)(NavListRow, { children: [(0, jsx_runtime_1.jsxs)(react_aria_components_1.Button, { className: "cim-nav-list-item", onPress: () => setExpanded(!expanded), "aria-controls": groupId, "aria-expanded": expanded, isDisabled: isDisabled, children: [icon, (0, jsx_runtime_1.jsx)(text_js_1.Text, { as: "span", variant: "medium", UNSAFE_className: "cim-nav-list-item-label", children: label }), (0, jsx_runtime_1.jsx)(index_js_1.IconChevronDown, { UNSAFE_className: (0, clsx_1.default)('cim-nav-list-group-icon', expanded && 'cim-nav-list-group-icon-expanded') })] }), (0, jsx_runtime_1.jsx)("ul", { id: groupId, className: "cim-nav-list-group-content", hidden: !expanded, children: children })] }));
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=nav-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-list.js","sourceRoot":"","sources":["../../../../src/components/nav-list/nav-list.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AAkBb,4CAEC;AA4BD,oDA2BC;AAeD,sDAkCC;;AA1HD,6CAA0C;AAC1C,gDAA0D;AAC1D,gDAAwB;AACxB,iCAAkE;AAClE,iEAA6E;AAC7E,mDAAuD;AAEvD,mDAA6C;AAM7C;;GAEG;AACH,SAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAyB;IAClE,OAAO,+BAAI,SAAS,EAAC,cAAc,YAAE,QAAQ,GAAM,CAAC;AACtD,CAAC;AAED,MAAM,iBAAiB,GAAG,IAAA,qBAAa,EAA2B,IAAI,CAAC,CAAC;AAExE,SAAS,UAAU,CAAC,EAAE,QAAQ,EAA2B;IACvD,MAAM,iBAAiB,GAAG,IAAA,kBAAU,EAAC,iBAAiB,CAAC,CAAC;IACxD,MAAM,QAAQ,GAAG,iBAAiB,IAAI,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,iBAAiB,CAAC,KAAK,GAAG,CAAC,CAAC;IAE7E,OAAO,CACL,uBAAC,iBAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,YACpD,+BAAI,SAAS,EAAC,kBAAkB,EAAC,KAAK,EAAE,EAAE,sBAAsB,EAAE,QAAQ,EAAyB,YAChG,QAAQ,GACN,GACsB,CAC9B,CAAC;AACJ,CAAC;AAUD;;GAEG;AACH,SAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,IAAI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E,OAAO,EAAE,SAAS,EAAC,4BAA4B,EAAC,MAAM,EAAE,CAAC,QAAQ,YACtE,QAAQ,GACN,IACM,CACd,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useId } from '@react-aria/utils';\nimport { useControlledState } from '@react-stately/utils';\nimport clsx from 'clsx';\nimport { createContext, useContext, type ReactNode } from 'react';\nimport { Button as RACButton, Link as RACLink } from 'react-aria-components';\nimport { IconChevronDown } from '../../icons/index.js';\nimport type { Href, NavigationProps, StringLikeChildren } from '../types.js';\nimport { Text } from '../typography/text.js';\n\nexport interface UNSTABLE_NavListProps {\n children: ReactNode;\n}\n\n/**\n * Displays a vertical navigation list.\n */\nexport function UNSTABLE_NavList({ children }: UNSTABLE_NavListProps) {\n return <ul className=\"cim-nav-list\">{children}</ul>;\n}\n\nconst NavListRowContext = createContext<{ depth: number } | null>(null);\n\nfunction NavListRow({ children }: { children: ReactNode }) {\n const navListRowContext = useContext(NavListRowContext);\n const newDepth = navListRowContext == null ? 0 : navListRowContext.depth + 1;\n\n return (\n <NavListRowContext.Provider value={{ depth: newDepth }}>\n <li className=\"cim-nav-list-row\" style={{ '--cim-nav-list-depth': newDepth } as React.CSSProperties}>\n {children}\n </li>\n </NavListRowContext.Provider>\n );\n}\n\nexport interface UNSTABLE_NavListItemProps extends NavigationProps {\n children: StringLikeChildren;\n icon?: ReactNode;\n href?: Href;\n isCurrent?: boolean;\n isDisabled?: boolean;\n}\n\n/**\n * Displays a single navigation item.\n */\nexport function UNSTABLE_NavListItem({\n children,\n icon,\n href,\n isCurrent,\n isDisabled,\n routerOptions,\n ...props\n}: UNSTABLE_NavListItemProps) {\n return (\n <NavListRow>\n <RACLink\n {...props}\n className=\"cim-nav-list-item\"\n href={href}\n routerOptions={routerOptions}\n aria-current={isCurrent ? 'page' : undefined}\n isDisabled={isDisabled}\n data-active={isCurrent || undefined}\n >\n {icon}\n <Text as=\"span\" variant=\"medium\" UNSAFE_className=\"cim-nav-list-item-label\">\n {children}\n </Text>\n </RACLink>\n </NavListRow>\n );\n}\n\nexport interface UNSTABLE_NavListGroupProps {\n children: ReactNode;\n label: StringLikeChildren;\n icon?: ReactNode;\n isExpanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (isExpanded: boolean) => void;\n isDisabled?: boolean;\n}\n\n/**\n * Displays an expandable navigation item group.\n */\nexport function UNSTABLE_NavListGroup({\n children,\n label,\n icon,\n isExpanded,\n defaultExpanded = false,\n onExpandedChange,\n isDisabled,\n}: UNSTABLE_NavListGroupProps) {\n const groupId = useId();\n const [expanded, setExpanded] = useControlledState(isExpanded, defaultExpanded, onExpandedChange);\n\n return (\n <NavListRow>\n <RACButton\n className=\"cim-nav-list-item\"\n onPress={() => setExpanded(!expanded)}\n aria-controls={groupId}\n aria-expanded={expanded}\n isDisabled={isDisabled}\n >\n {icon}\n <Text as=\"span\" variant=\"medium\" UNSAFE_className=\"cim-nav-list-item-label\">\n {label}\n </Text>\n <IconChevronDown\n UNSAFE_className={clsx('cim-nav-list-group-icon', expanded && 'cim-nav-list-group-icon-expanded')}\n />\n </RACButton>\n <ul id={groupId} className=\"cim-nav-list-group-content\" hidden={!expanded}>\n {children}\n </ul>\n </NavListRow>\n );\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type SwitchProps as RACSwitchProps } from 'react-aria-components';
|
|
2
|
+
import type { AriaLabelingProps, CommonProps, StringLikeChildren } from '../types.js';
|
|
3
|
+
export interface SwitchProps extends CommonProps, AriaLabelingProps, Pick<RACSwitchProps, 'onChange' | 'isSelected' | 'isDisabled' | 'isReadOnly' | 'defaultSelected' | 'autoFocus' | 'form' | 'name' | 'value'> {
|
|
4
|
+
/** The label rendered next to the switch. */
|
|
5
|
+
children?: StringLikeChildren;
|
|
6
|
+
/** A description for the switch. Provides a hint such as specific requirements for which setting to choose. */
|
|
7
|
+
description?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Controls where the label is rendered relative to the switch.
|
|
10
|
+
* @default 'end'
|
|
11
|
+
*/
|
|
12
|
+
labelPosition?: 'top' | 'start' | 'end';
|
|
13
|
+
/**
|
|
14
|
+
* Whether the switch should take up the whole available width. Enabling this option will add space between the switch and its label.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
fullWidth?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Allows users to turn a setting on or off.
|
|
21
|
+
*
|
|
22
|
+
* See [switch usage guidelines](https://ui.cimpress.io/components/switch/).
|
|
23
|
+
*/
|
|
24
|
+
declare const _Switch: (props: SwitchProps & import("react").RefAttributes<HTMLLabelElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
|
|
25
|
+
export { _Switch as Switch };
|
|
26
|
+
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../../src/components/switch/switch.tsx"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,WAAW,IAAI,cAAc,EAEnC,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtF,MAAM,WAAW,WACf,SACE,WAAW,EACX,iBAAiB,EACjB,IAAI,CACF,cAAc,EACZ,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,iBAAiB,GACjB,WAAW,GACX,MAAM,GACN,MAAM,GACN,OAAO,CACV;IACH,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,+GAA+G;IAC/G,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAoED;;;;GAIG;AACH,QAAA,MAAM,OAAO,+JAA+C,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use strict";
|
|
3
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
4
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
5
|
+
};
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.Switch = void 0;
|
|
8
|
+
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
|
+
const utils_1 = require("@react-aria/utils");
|
|
10
|
+
const clsx_1 = __importDefault(require("clsx"));
|
|
11
|
+
const react_aria_components_1 = require("react-aria-components");
|
|
12
|
+
const forward_ref_js_1 = require("../../forward-ref.js");
|
|
13
|
+
const index_js_1 = require("../../icons/index.js");
|
|
14
|
+
const use_production_warning_js_1 = require("../../utils/use-production-warning.js");
|
|
15
|
+
const with_style_props_js_1 = require("../../with-style-props.js");
|
|
16
|
+
const form_field_js_1 = require("../internal/form-field/form-field.js");
|
|
17
|
+
const text_js_1 = require("../typography/text.js");
|
|
18
|
+
function Switch({ children, description, labelPosition = 'end', fullWidth = false, 'aria-describedby': ariaDescribedBy, UNSAFE_className, UNSAFE_style, ...props }, ref) {
|
|
19
|
+
const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
|
|
20
|
+
(0, use_production_warning_js_1.useProductionWarning)(() => {
|
|
21
|
+
if (!children && !ariaLabel && !ariaLabelledBy) {
|
|
22
|
+
console.warn('Switch requires one of children / aria-label / aria-labelledby for accessibility');
|
|
23
|
+
}
|
|
24
|
+
}, [children, ariaLabel, ariaLabelledBy]);
|
|
25
|
+
const descriptionId = (0, utils_1.useSlotId)([Boolean(description)]);
|
|
26
|
+
const label = ((0, jsx_runtime_1.jsx)(jsx_runtime_1.Fragment, { children: children && ((0, jsx_runtime_1.jsx)(text_js_1.Text, { as: "span", variant: "medium", children: children })) }));
|
|
27
|
+
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.Provider, { values: [[react_aria_components_1.TextContext, { slots: { description: { id: descriptionId } } }]], children: (0, jsx_runtime_1.jsxs)("div", { className: (0, clsx_1.default)('cim-switch', UNSAFE_className), style: UNSAFE_style, "data-label-position": labelPosition, "data-full-width": fullWidth || undefined, children: [(0, jsx_runtime_1.jsxs)(react_aria_components_1.Switch, { ...props, className: "cim-switch-control-wrapper", ref: ref, "aria-describedby": descriptionId || ariaDescribedBy ? [descriptionId, ariaDescribedBy].join(' ') : undefined, children: [labelPosition !== 'end' && label, (0, jsx_runtime_1.jsx)("div", { className: "cim-switch-track-wrapper", "aria-hidden": true, children: (0, jsx_runtime_1.jsxs)("div", { className: "cim-switch-track", children: [(0, jsx_runtime_1.jsx)(index_js_1.IconCheckBold, { UNSAFE_className: "cim-switch-icon-on" }), (0, jsx_runtime_1.jsx)(index_js_1.IconCloseBold, { UNSAFE_className: "cim-switch-icon-off" }), (0, jsx_runtime_1.jsx)("div", { className: "cim-switch-track-head" })] }) }), labelPosition === 'end' && label] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description })] }) }));
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Allows users to turn a setting on or off.
|
|
31
|
+
*
|
|
32
|
+
* See [switch usage guidelines](https://ui.cimpress.io/components/switch/).
|
|
33
|
+
*/
|
|
34
|
+
const _Switch = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.forwardRef)(Switch), 'Switch');
|
|
35
|
+
exports.Switch = _Switch;
|
|
36
|
+
//# sourceMappingURL=switch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../../src/components/switch/switch.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,6CAA8C;AAC9C,gDAAwB;AAExB,iEAK+B;AAC/B,yDAAkD;AAClD,mDAAoE;AACpE,qFAA6E;AAC7E,mEAA2D;AAC3D,w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,eAAe,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,SAAS,aAE1G,aAAa,KAAK,KAAK,IAAI,KAAK,EAEjC,gCAAK,SAAS,EAAC,0BAA0B,iCACvC,iCAAK,SAAS,EAAC,kBAAkB,aAC/B,uBAAC,wBAAa,IAAC,gBAAgB,EAAC,oBAAoB,GAAG,EACvD,uBAAC,wBAAa,IAAC,gBAAgB,EAAC,qBAAqB,GAAG,EACxD,gCAAK,SAAS,EAAC,uBAAuB,GAAG,IACrC,GACF,EAEL,aAAa,KAAK,KAAK,IAAI,KAAK,IACvB,EAEZ,uBAAC,oCAAoB,cAAE,WAAW,GAAwB,IACtD,GACM,CACf,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,OAAO,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,MAAM,CAAC,EAAE,QAAQ,CAAC,CAAC;AAEzC,yBAAM","sourcesContent":["'use client';\n\nimport { useSlotId } from '@react-aria/utils';\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\nimport {\n Provider as RACProvider,\n Switch as RACSwitch,\n type SwitchProps as RACSwitchProps,\n TextContext as RACTextContext,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { IconCheckBold, IconCloseBold } from '../../icons/index.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { FormFieldDescription } from '../internal/form-field/form-field.js';\nimport type { AriaLabelingProps, CommonProps, StringLikeChildren } from '../types.js';\nimport { Text } from '../typography/text.js';\n\nexport interface SwitchProps\n extends\n CommonProps,\n AriaLabelingProps,\n Pick<\n RACSwitchProps,\n | 'onChange'\n | 'isSelected'\n | 'isDisabled'\n | 'isReadOnly'\n | 'defaultSelected'\n | 'autoFocus'\n | 'form'\n | 'name'\n | 'value'\n > {\n /** The label rendered next to the switch. */\n children?: StringLikeChildren;\n /** A description for the switch. Provides a hint such as specific requirements for which setting to choose. */\n description?: string;\n /**\n * Controls where the label is rendered relative to the switch.\n * @default 'end'\n */\n labelPosition?: 'top' | 'start' | 'end';\n /**\n * Whether the switch should take up the whole available width. Enabling this option will add space between the switch and its label.\n * @default false\n */\n fullWidth?: boolean;\n}\n\nfunction Switch(\n {\n children,\n description,\n labelPosition = 'end',\n fullWidth = false,\n 'aria-describedby': ariaDescribedBy,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n }: SwitchProps,\n ref: ForwardedRef<HTMLLabelElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!children && !ariaLabel && !ariaLabelledBy) {\n console.warn('Switch requires one of children / aria-label / aria-labelledby for accessibility');\n }\n }, [children, ariaLabel, ariaLabelledBy]);\n\n const descriptionId = useSlotId([Boolean(description)]);\n\n const label = (\n <>\n {children && (\n <Text as=\"span\" variant=\"medium\">\n {children}\n </Text>\n )}\n </>\n );\n\n return (\n <RACProvider values={[[RACTextContext, { slots: { description: { id: descriptionId } } }]]}>\n <div\n className={clsx('cim-switch', UNSAFE_className)}\n style={UNSAFE_style}\n data-label-position={labelPosition}\n data-full-width={fullWidth || undefined}\n >\n <RACSwitch\n {...props}\n className=\"cim-switch-control-wrapper\"\n ref={ref}\n aria-describedby={descriptionId || ariaDescribedBy ? [descriptionId, ariaDescribedBy].join(' ') : undefined}\n >\n {labelPosition !== 'end' && label}\n\n <div className=\"cim-switch-track-wrapper\" aria-hidden>\n <div className=\"cim-switch-track\">\n <IconCheckBold UNSAFE_className=\"cim-switch-icon-on\" />\n <IconCloseBold UNSAFE_className=\"cim-switch-icon-off\" />\n <div className=\"cim-switch-track-head\" />\n </div>\n </div>\n\n {labelPosition === 'end' && label}\n </RACSwitch>\n\n <FormFieldDescription>{description}</FormFieldDescription>\n </div>\n </RACProvider>\n );\n}\n\n/**\n * Allows users to turn a setting on or off.\n *\n * See [switch usage guidelines](https://ui.cimpress.io/components/switch/).\n */\nconst _Switch = withStyleProps(forwardRef(Switch), 'Switch');\n\nexport { _Switch as Switch };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-field.d.ts","sourceRoot":"","sources":["../../../../src/components/text-inputs/search-field.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,gBAAgB,IAAI,mBAAmB,EAE7C,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGpF,MAAM,WAAW,gBACf,SACE,WAAW,EACX,yBAAyB,CAAC,MAAM,CAAC,EACjC,QAAQ,CAAC,cAAc,CAAC,EACxB,IAAI,CACF,mBAAmB,EACjB,OAAO,GACP,cAAc,GACd,UAAU,GACV,UAAU,GACV,SAAS,GACT,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,WAAW,GACX,cAAc,GACd,aAAa,GACb,YAAY,GACZ,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,CACX;CAAG;AAER,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;
|
|
1
|
+
{"version":3,"file":"search-field.d.ts","sourceRoot":"","sources":["../../../../src/components/text-inputs/search-field.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,gBAAgB,IAAI,mBAAmB,EAE7C,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGpF,MAAM,WAAW,gBACf,SACE,WAAW,EACX,yBAAyB,CAAC,MAAM,CAAC,EACjC,QAAQ,CAAC,cAAc,CAAC,EACxB,IAAI,CACF,mBAAmB,EACjB,OAAO,GACP,cAAc,GACd,UAAU,GACV,UAAU,GACV,SAAS,GACT,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,WAAW,GACX,cAAc,GACd,aAAa,GACb,YAAY,GACZ,WAAW,GACX,WAAW,GACX,WAAW,GACX,SAAS,GACT,SAAS,GACT,QAAQ,CACX;CAAG;AAER,iEAAiE;AACjE,MAAM,WAAW,cAAc;IAC7B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAmFD;;;;GAIG;AACH,QAAA,MAAM,YAAY,kKAAyD,CAAC;AAE5E,OAAO,EAAE,YAAY,IAAI,WAAW,EAAE,CAAC"}
|
|
@@ -30,7 +30,7 @@ function SearchField({ label, description, error: errorMessage, placeholder, UNS
|
|
|
30
30
|
focus: () => inputRef.current?.focus(),
|
|
31
31
|
select: () => inputRef.current?.select(),
|
|
32
32
|
}), []);
|
|
33
|
-
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.SearchField, { ...props, ref: ref, className: (0, clsx_1.default)('cim-search-field', UNSAFE_className), style: UNSAFE_style, enterKeyHint: "search", children: ({ state }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.Group, { className: "cim-search-field-input-group", onClick: () => inputRef.current?.focus(), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, clsx_1.default)('cim-text-field-affix', (0, utils_js_1.textStyle)({ variant: 'body', tone: props.isDisabled ? 'muted' : 'subtle' })), "aria-hidden": true, children: (0, jsx_runtime_1.jsx)(index_js_1.IconSearch, {}) }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Input, { ref: inputRef, className: (0, clsx_1.default)('cim-search-field-input', (0, utils_js_1.textStyle)({ variant: 'body' })), placeholder: placeholder }),
|
|
33
|
+
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.SearchField, { ...props, ref: ref, className: (0, clsx_1.default)('cim-search-field', UNSAFE_className), style: UNSAFE_style, enterKeyHint: "search", children: ({ state }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldLabel, { isRequired: props.isRequired, isDisabled: props.isDisabled, children: label }), (0, jsx_runtime_1.jsxs)(react_aria_components_1.Group, { className: "cim-search-field-input-group", onClick: () => inputRef.current?.focus(), children: [(0, jsx_runtime_1.jsx)("div", { className: (0, clsx_1.default)('cim-text-field-affix', (0, utils_js_1.textStyle)({ variant: 'body', tone: props.isDisabled ? 'muted' : 'subtle' })), "aria-hidden": true, children: (0, jsx_runtime_1.jsx)(index_js_1.IconSearch, {}) }), (0, jsx_runtime_1.jsx)(react_aria_components_1.Input, { ref: inputRef, className: (0, clsx_1.default)('cim-search-field-input', (0, utils_js_1.textStyle)({ variant: 'body' })), placeholder: placeholder }), (0, jsx_runtime_1.jsx)(x_button_js_1.XButton, { UNSAFE_className: "cim-search-field-clear", "data-visible": (state.value !== '' && !props.isDisabled && !props.isReadOnly) || undefined, "aria-label": commonMessages.format('clearValue'), iconType: "circled" })] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: errorMessage }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description })] })) }));
|
|
34
34
|
}
|
|
35
35
|
/**
|
|
36
36
|
* Allows users to enter and clear a search query.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search-field.js","sourceRoot":"","sources":["../../../../src/components/text-inputs/search-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AACxB,iCAAuE;AACvE,iEAK+B;AAC/B,yDAAkD;AAClD,kFAA2E;AAC3E,mDAAkD;AAClD,qFAA6E;AAC7E,mEAA2D;AAC3D,wEAA4G;AAC5G,k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AwB,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,EACzE,WAAW,EAAE,WAAW,GACxB,EAEF,uBAAC,qBAAO,IACN,gBAAgB,EAAC,wBAAwB,kBAC3B,CAAC,KAAK,CAAC,KAAK,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,UAAU,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,IAAI,SAAS,gBAC7E,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,EAC/C,QAAQ,EAAC,SAAS,GAClB,IACO,EAEX,uBAAC,8BAAc,cAAE,YAAY,GAAkB,EAC/C,uBAAC,oCAAoB,cAAE,WAAW,GAAwB,IACzD,CACJ,GACc,CAClB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,YAAY,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,WAAW,CAAC,EAAE,aAAa,CAAC,CAAC;AAEnD,mCAAW","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { type ForwardedRef, useImperativeHandle, useRef } from 'react';\nimport {\n Input as RACInput,\n SearchField as RACSearchField,\n type SearchFieldProps as RACSearchFieldProps,\n Group as RACGroup,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/localization-provider.js';\nimport { IconSearch } from '../../icons/index.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 { ApiProps, CommonProps, FieldWithPlaceholderProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface SearchFieldProps\n extends\n CommonProps,\n FieldWithPlaceholderProps<string>,\n ApiProps<SearchFieldApi>,\n Pick<\n RACSearchFieldProps,\n | 'value'\n | 'defaultValue'\n | 'onChange'\n | 'onSubmit'\n | 'onClear'\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'autoFocus'\n | 'autoComplete'\n | 'autoCorrect'\n | 'spellCheck'\n | 'inputMode'\n | 'minLength'\n | 'maxLength'\n | 'pattern'\n | 'onFocus'\n | 'onBlur'\n > {}\n\n/** The imperative API exposed by the `SearchField` component. */\nexport interface SearchFieldApi {\n /** Focuses the input field. */\n focus: () => void;\n /** Selects the contents of the input field. */\n select: () => void;\n}\n\nfunction SearchField(\n {\n label,\n description,\n error: errorMessage,\n placeholder,\n UNSAFE_className,\n UNSAFE_style,\n apiRef,\n ...props\n }: SearchFieldProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const inputRef = useRef<HTMLInputElement>(null);\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('SearchField requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const commonMessages = useLocalizedMessages('common');\n\n useImperativeHandle(\n apiRef,\n () => ({\n focus: () => inputRef.current?.focus(),\n select: () => inputRef.current?.select(),\n }),\n [],\n );\n\n return (\n <RACSearchField\n {...props}\n ref={ref}\n className={clsx('cim-search-field', UNSAFE_className)}\n style={UNSAFE_style}\n enterKeyHint=\"search\"\n >\n {({ state }) => (\n <>\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n\n <RACGroup className=\"cim-search-field-input-group\" onClick={() => inputRef.current?.focus()}>\n <div\n className={clsx(\n 'cim-text-field-affix',\n textStyle({ variant: 'body', tone: props.isDisabled ? 'muted' : 'subtle' }),\n )}\n aria-hidden\n >\n <IconSearch />\n </div>\n\n <RACInput\n ref={inputRef}\n className={clsx('cim-search-field-input', textStyle({ variant: 'body' }))}\n placeholder={placeholder}\n />\n\n <XButton\n UNSAFE_className=\"cim-search-field-clear\"\n data-visible={(state.value !== '' && !props.isDisabled && !props.isReadOnly) || undefined}\n aria-label={commonMessages.format('clearValue')}\n iconType=\"circled\"\n />\n </RACGroup>\n\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </>\n )}\n </RACSearchField>\n );\n}\n\n/**\n * Allows users to enter and clear a search query.\n *\n * See [search field usage guidelines](https://ui.cimpress.io/components/search-field/).\n */\nconst _SearchField = withStyleProps(forwardRef(SearchField), 'SearchField');\n\nexport { _SearchField as SearchField };\n"]}
|
|
@@ -1 +1 @@
|
|
|
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,QAAQ,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGhG,MAAM,WAAW,cACf,SACE,WAAW,EACX,yBAAyB,CAAC,MAAM,CAAC,EACjC,UAAU,EACV,QAAQ,CAAC,YAAY,CAAC,EACtB,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,GACR,WAAW,CACd;IACH;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;
|
|
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,QAAQ,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;AAGhG,MAAM,WAAW,cACf,SACE,WAAW,EACX,yBAAyB,CAAC,MAAM,CAAC,EACjC,UAAU,EACV,QAAQ,CAAC,YAAY,CAAC,EACtB,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,GACR,WAAW,CACd;IACH;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;CACvB;AAED,+DAA+D;AAC/D,MAAM,WAAW,YAAY;IAC3B,+BAA+B;IAC/B,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,+CAA+C;IAC/C,MAAM,EAAE,MAAM,IAAI,CAAC;CACpB;AAoID;;;;GAIG;AACH,QAAA,MAAM,UAAU,gKAAqD,CAAC;AAEtE,OAAO,EAAE,UAAU,IAAI,SAAS,EAAE,CAAC"}
|
|
@@ -46,7 +46,7 @@ function TextField({ label, description, error: errorMessage, placeholder, prefi
|
|
|
46
46
|
}, [label, ariaLabel, ariaLabelledBy]);
|
|
47
47
|
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'], isFieldClearable ? clearDescriptionId : undefined]
|
|
48
48
|
.filter(Boolean)
|
|
49
|
-
.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 }),
|
|
49
|
+
.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 && ((0, jsx_runtime_1.jsx)(x_button_js_1.XButton, { slot: null, UNSAFE_className: "cim-text-field-clear", "data-visible": (isFieldClearable && value !== '') || undefined, "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 }), isFieldClearable && ((0, jsx_runtime_1.jsx)("p", { id: clearDescriptionId, className: "cim-text-field-clear-description", hidden: true, children: messages.format('clearValueDescription') }))] })) }));
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* 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,6CAA0C;AAC1C,gDAA0D;AAC1D,gDAAwB;AACxB,iCAA2F;AAC3F,iEAK+B;AAC/B,yDAAkD;AAClD,kFAA2E;AAC3E,qFAA6E;AAC7E,mEAA2D;AAC3D,wEAA4G;AAC5G,kEAA2D;AAE3D,qDAAmD;AA2CnD,SAAS,SAAS,CAChB,EACE,KAAK,EACL,WAAW,EACX,KAAK,EAAE,YAAY,EACnB,WAAW,EACX,MAAM,EACN,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,WAAW,GAAG,KAAK,EACnB,KAAK,EAAE,aAAa,EACpB,YAAY,EAAE,oBAAoB,EAClC,QAAQ,EACR,MAAM,EACN,GAAG,KAAK,EACO,EACjB,GAAiC;IAEjC,MAAM,EAAE,UAAU,EAAE,UAAU,EAAE,GAAG,KAAK,CAAC;IACzC,MAAM,QAAQ,GAAG,IAAA,cAAM,EAAmB,IAAI,CAAC,CAAC;IAChD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,IAAA,0BAAkB,EAAC,aAAa,EAAE,oBAAoB,IAAI,EAAE,EAAE,QAAQ,CAAC,CAAC;IAClG,MAAM,QAAQ,GAAG,IAAA,+CAAoB,EAAC,QAAQ,CAAC,CAAC;IAChD,MAAM,kBAAkB,GAAG,IAAA,aAAK,GAAE,CAAC;IAEnC,IAAA,2BA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CAAC,GAAG,CAAC,YAEX,CAAC,EAAE,UAAU,EAAE,UAAU,EAAE,EAAE,EAAE,CAAC,CAC/B,6DACE,uBAAC,8BAAc,IAAC,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,YAC3D,KAAK,GACS,EACjB,wBAAC,6BAAQ,IAAC,SAAS,EAAC,4BAA4B,EAAC,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,OAAO,EAAE,KAAK,EAAE,aACtF,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,EAED,uBAAC,6BAAQ,IACP,GAAG,EAAE,QAAQ,EACb,SAAS,EAAE,IAAA,cAAI,EAAC,sBAAsB,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC,CAAC,EACvE,WAAW,EAAE,WAAW,EACxB,SAAS,EAAE,SAAS,GACpB,EAED,
|
|
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,iCAA2F;AAC3F,iEAK+B;AAC/B,yDAAkD;AAClD,kFAA2E;AAC3E,qFAA6E;AAC7E,mEAA2D;AAC3D,wEAA4G;AAC5G,kEAA2D;AAE3D,qDAAmD;AA2CnD,SAAS,SAAS,CAChB,EACE,KAAK,EACL,WAAW,EACX,KAAK,EAAE,YAAY,EACnB,WAAW,EACX,MAAM,EACN,MAAM,EACN,gBAAgB,EAChB,YAAY,EACZ,WAAW,GAAG,KAAK,EACnB,KAAK,EAAE,aAAa,EACpB,YAAY,EAAE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EAAE,IAAI,EACV,gBAAgB,EAAC,sBAAsB,kBACzB,CAAC,gBAAgB,IAAI,KAAK,KAAK,EAAE,CAAC,IAAI,SAAS,gBACjD,QAAQ,CAAC,MAAM,CAAC,YAAY,CAAC,EACzC,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,EAAE,CAAC,EAC3B,QAAQ,EAAC,SAAS,EAClB,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,EACzD,gBAAgB,IAAI,CACnB,8BAAG,EAAE,EAAE,kBAAkB,EAAE,SAAS,EAAC,kCAAkC,EAAC,MAAM,kBAC3E,QAAQ,CAAC,MAAM,CAAC,uBAAuB,CAAC,GACvC,CACL,IACA,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, useImperativeHandle, 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, ApiProps, CommonProps, FieldWithPlaceholderProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface TextFieldProps\n extends\n CommonProps,\n FieldWithPlaceholderProps<string>,\n AffixProps,\n ApiProps<TextFieldApi>,\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 | 'onKeyDown'\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\n/** The imperative API exposed by the `TextField` component. */\nexport interface TextFieldApi {\n /** Focuses the input field. */\n focus: () => void;\n /** Selects the contents of the input field. */\n select: () => void;\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 apiRef,\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 useImperativeHandle(\n apiRef,\n () => ({\n focus: () => inputRef.current?.focus(),\n select: () => inputRef.current?.select(),\n }),\n [],\n );\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n const isFieldClearable = isClearable && !isDisabled && !isReadOnly;\n\n function onKeyDown(e: KeyboardEvent) {\n if (!isFieldClearable) {\n return;\n }\n\n if (e.key === 'Escape') {\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'], isFieldClearable ? 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 && (\n <XButton\n slot={null}\n UNSAFE_className=\"cim-text-field-clear\"\n data-visible={(isFieldClearable && value !== '') || undefined}\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 {isFieldClearable && (\n <p id={clearDescriptionId} className=\"cim-text-field-clear-description\" hidden>\n {messages.format('clearValueDescription')}\n </p>\n )}\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"]}
|
package/dist/commonjs/index.d.ts
CHANGED
|
@@ -39,6 +39,7 @@ export * from './components/text-inputs/text-area.js';
|
|
|
39
39
|
export * from './components/breadcrumbs/breadcrumbs.js';
|
|
40
40
|
export * from './components/tooltip/tooltip.js';
|
|
41
41
|
export * from './components/popover/popover.js';
|
|
42
|
+
export * from './components/switch/switch.js';
|
|
42
43
|
export * from './components/table/table-container.js';
|
|
43
44
|
export * from './components/table/table.js';
|
|
44
45
|
export * from './components/table/table-header.js';
|
|
@@ -75,7 +76,6 @@ export * from './utils/use-is-mobile.js';
|
|
|
75
76
|
export * from './components/visually-hidden/visually-hidden.js';
|
|
76
77
|
export * from './components/file-picker/file-picker.js';
|
|
77
78
|
export * from './components/container/container.js';
|
|
78
|
-
export * from './components/toggle/toggle.js';
|
|
79
79
|
export * from './components/toast/toast-region.js';
|
|
80
80
|
export { UNSTABLE_toastQueue, type UNSTABLE_ToastQueue } from './components/toast/toast-queue.js';
|
|
81
81
|
export type { UNSTABLE_ToastOptions } from './components/toast/types.js';
|
|
@@ -88,4 +88,5 @@ export * from './components/hidden/hidden.js';
|
|
|
88
88
|
export * from './components/app-header/nav-button.js';
|
|
89
89
|
export * from './components/top-nav/top-nav.js';
|
|
90
90
|
export * from './components/page-layout/page-layout.js';
|
|
91
|
+
export * from './components/nav-list/nav-list.js';
|
|
91
92
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,6BAA6B,CAAC;AAC5C,cAAc,2CAA2C,CAAC;AAC1D,cAAc,uCAAuC,CAAC;AACtD,cAAc,6CAA6C,CAAC;AAC5D,cAAc,6BAA6B,CAAC;AAC5C,cAAc,+BAA+B,CAAC;AAC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AAC;AACzE,cAAc,iCAAiC,CAAC;AAChD,cAAc,sCAAsC,CAAC;AACrD,YAAY,EAAE,aAAa,EAAE,MAAM,+BAA+B,CAAC;AACnE,cAAc,qCAAqC,CAAC;AACpD,cAAc,qCAAqC,CAAC;AACpD,cAAc,+BAA+B,CAAC;AAC9C,cAAc,uCAAuC,CAAC;AACtD,cAAc,iCAAiC,CAAC;AAChD,cAAc,yCAAyC,CAAC;AACxD,cAAc,mCAAmC,CAAC"}
|
package/dist/commonjs/index.js
CHANGED
|
@@ -55,6 +55,7 @@ __exportStar(require("./components/text-inputs/text-area.js"), exports);
|
|
|
55
55
|
__exportStar(require("./components/breadcrumbs/breadcrumbs.js"), exports);
|
|
56
56
|
__exportStar(require("./components/tooltip/tooltip.js"), exports);
|
|
57
57
|
__exportStar(require("./components/popover/popover.js"), exports);
|
|
58
|
+
__exportStar(require("./components/switch/switch.js"), exports);
|
|
58
59
|
__exportStar(require("./components/table/table-container.js"), exports);
|
|
59
60
|
__exportStar(require("./components/table/table.js"), exports);
|
|
60
61
|
__exportStar(require("./components/table/table-header.js"), exports);
|
|
@@ -86,7 +87,6 @@ __exportStar(require("./utils/use-is-mobile.js"), exports);
|
|
|
86
87
|
__exportStar(require("./components/visually-hidden/visually-hidden.js"), exports);
|
|
87
88
|
__exportStar(require("./components/file-picker/file-picker.js"), exports);
|
|
88
89
|
__exportStar(require("./components/container/container.js"), exports);
|
|
89
|
-
__exportStar(require("./components/toggle/toggle.js"), exports);
|
|
90
90
|
__exportStar(require("./components/toast/toast-region.js"), exports);
|
|
91
91
|
var toast_queue_js_1 = require("./components/toast/toast-queue.js");
|
|
92
92
|
Object.defineProperty(exports, "UNSTABLE_toastQueue", { enumerable: true, get: function () { return toast_queue_js_1.UNSTABLE_toastQueue; } });
|
|
@@ -98,4 +98,5 @@ __exportStar(require("./components/hidden/hidden.js"), exports);
|
|
|
98
98
|
__exportStar(require("./components/app-header/nav-button.js"), exports);
|
|
99
99
|
__exportStar(require("./components/top-nav/top-nav.js"), exports);
|
|
100
100
|
__exportStar(require("./components/page-layout/page-layout.js"), exports);
|
|
101
|
+
__exportStar(require("./components/nav-list/nav-list.js"), exports);
|
|
101
102
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,4EAA0D;AAC1D,wEAAsD;AACtD,8EAA4D;AAC5D,8DAA4C;AAC5C,gEAA8C;AAC9C,qEAAmD;AACnD,qEAAmD;AACnD,0EAAwD;AACxD,kEAAgD;AAChD,4DAA0C;AAC1C,oEAAkD;AAClD,0EAAwD;AACxD,sEAAoD;AACpD,mEAAiD;AACjD,mEAAiD;AACjD,0EAAwD;AACxD,0EAAwD;AACxD,wEAAsD;AACtD,8EAA4D;AAE5D,kEAAgD;AAChD,gEAA8C;AAC9C,4DAA0C;AAC1C,sEAAoD;AACpD,4DAA0C;AAC1C,4EAA0D;AAC1D,4EAA0D;AAC1D,wEAAsD;AACtD,4EAA0D;AAC1D,8DAA4C;AAC5C,oEAAkD;AAClD,gEAA8C;AAC9C,gEAA8C;AAC9C,kEAAgD;AAChD,2EAAyD;AACzD,yEAAuD;AACvD,wEAAsD;AACtD,0EAAwD;AACxD,kEAAgD;AAChD,kEAAgD;AAChD,wEAAsD;AACtD,8DAA4C;AAC5C,qEAAmD;AACnD,yEAAuD;AACvD,0EAAwD;AACxD,mEAAiD;AACjD,uEAAqD;AACrD,wEAAsD;AACtD,2EAAyD;AACzD,gFAA8D;AAC9D,0EAAwD;AAGxD,4DAA0C;AAC1C,0DAAwC;AACxC,gEAA8C;AAC9C,sEAAoD;AACpD,8EAA4D;AAC5D,mFAAiE;AACjE,oFAAkE;AAClE,+DAA6C;AAE7C,kEAAgD;AAChD,sEAAoD;AAEpD,kEAAgD;AAChD,kEAAgD;AAoBhD,kEAAgD;AAChD,wEAAsD;AAEtD,6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,0EAAwD;AACxD,sEAAoD;AACpD,qEAAmD;AACnD,oEAAkG;AAAzF,qHAAA,mBAAmB,OAAA;AAE5B,kEAAgD;AAChD,uEAAqD;AAErD,sEAAoD;AACpD,sEAAoD;AACpD,gEAA8C;AAC9C,wEAAsD;AACtD,kEAAgD;AAChD,0EAAwD;AACxD,oEAAkD","sourcesContent":["export * from './components/alert/alert.js';\nexport * from './components/alert-dialog/alert-dialog.js';\nexport * from './components/app-header/app-header.js';\nexport * from './components/app-header/simple-auth-tool.js';\nexport * from './components/badge/badge.js';\nexport * from './components/button/button.js';\nexport * from './components/button/link-button.js';\nexport * from './components/button/icon-button.js';\nexport * from './components/button/icon-link-button.js';\nexport * from './components/callout/callout.js';\nexport * from './components/card/card.js';\nexport * from './components/checkbox/checkbox.js';\nexport * from './components/checkbox/checkbox-group.js';\nexport * from './components/combo-box/combo-box.js';\nexport * from './components/copy/copy-button.js';\nexport * from './components/copy/copy-inline.js';\nexport * from './components/date-picker/date-picker.js';\nexport * from './components/dialog-root/dialog-root.js';\nexport * from './components/disclosure/disclosure.js';\nexport * from './components/disclosure/disclosure-group.js';\nexport type { DisclosureSize, DisclosureVariant } from './components/disclosure/context.js';\nexport * from './components/divider/divider.js';\nexport * from './components/drawer/drawer.js';\nexport * from './components/form/form.js';\nexport * from './components/link-tabs/link-tabs.js';\nexport * from './components/menu/menu.js';\nexport * from './components/modal-dialog/modal-dialog.js';\nexport * from './components/number-field/number-field.js';\nexport * from './components/pagination/pagination.js';\nexport * from './components/progress-bar/progress-bar.js';\nexport * from './components/radio/radio.js';\nexport * from './components/radio/radio-group.js';\nexport * from './components/select/select.js';\nexport * from './components/slider/slider.js';\nexport * from './components/spinner/spinner.js';\nexport * from './components/text-inputs/search-field.js';\nexport * from './components/text-inputs/text-field.js';\nexport * from './components/text-inputs/text-area.js';\nexport * from './components/breadcrumbs/breadcrumbs.js';\nexport * from './components/tooltip/tooltip.js';\nexport * from './components/popover/popover.js';\nexport * from './components/switch/switch.js';\nexport * from './components/table/table-container.js';\nexport * from './components/table/table.js';\nexport * from './components/table/table-header.js';\nexport * from './components/table/table-header-row.js';\nexport * from './components/table/table-header-cell.js';\nexport * from './components/table/table-body.js';\nexport * from './components/table/table-body-row.js';\nexport * from './components/table/table-body-cell.js';\nexport * from './components/table/table-row-selector.js';\nexport * from './components/table/table-all-rows-selector.js';\nexport * from './components/table/table-empty-state.js';\nexport type { RowSelectionMode as TableRowSelectionMode } from './components/table/contexts/table-state.js';\nexport type { ColumnContentAlignment as TableColumnContentAlignment } from './components/table/contexts/column-collection.js';\nexport * from './components/tabs/tabs.js';\nexport * from './components/tag/tag.js';\nexport * from './components/tag/tag-group.js';\nexport * from './components/tag-field/tag-field.js';\nexport * from './components/toggle-button/toggle-button.js';\nexport * from './components/toggle-button/toggle-icon-button.js';\nexport * from './components/toggle-button/toggle-button-group.js';\nexport * from './components/file-trigger.js';\n\nexport * from './components/spacing/box/box.js';\nexport * from './components/spacing/stack/stack.js';\n\nexport * from './components/typography/text.js';\nexport * from './components/typography/link.js';\n\nexport type { ForegroundTone } from './utils/style/types.js';\n\nexport type {\n CollectionItem,\n Direction,\n FieldError,\n HoverEvent,\n Key,\n Selection,\n PressEvent,\n RouterConfig,\n Href,\n RouterOptions,\n ValidationResult,\n} from './components/types.js';\nexport type { Spacing, Responsive } from './components/spacing/types.js';\nexport type { StyleProps } from './with-style-props.js';\n\nexport * from './providers/ssr/ssr-provider.js';\nexport * from './providers/router/router-provider.js';\n\nexport * from './components/internal/x-button/x-button.js';\n\nexport * from './utils/use-is-mobile.js';\n\n// Unfinished exports below\nexport * from './components/visually-hidden/visually-hidden.js';\nexport * from './components/file-picker/file-picker.js';\nexport * from './components/container/container.js';\nexport * from './components/toast/toast-region.js';\nexport { UNSTABLE_toastQueue, type UNSTABLE_ToastQueue } from './components/toast/toast-queue.js';\nexport type { UNSTABLE_ToastOptions } from './components/toast/types.js';\nexport * from './components/stepper/stepper.js';\nexport * from './components/stepper/stepper-item.js';\nexport type { StepperStatus } from './components/stepper/types.js';\nexport * from './components/app-shell/app-shell.js';\nexport * from './components/app-header/side-nav.js';\nexport * from './components/hidden/hidden.js';\nexport * from './components/app-header/nav-button.js';\nexport * from './components/top-nav/top-nav.js';\nexport * from './components/page-layout/page-layout.js';\nexport * from './components/nav-list/nav-list.js';\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { type ReactNode } from 'react';
|
|
2
|
+
import type { Href, NavigationProps, StringLikeChildren } from '../types.js';
|
|
3
|
+
export interface UNSTABLE_NavListProps {
|
|
4
|
+
children: ReactNode;
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Displays a vertical navigation list.
|
|
8
|
+
*/
|
|
9
|
+
export declare function UNSTABLE_NavList({ children }: UNSTABLE_NavListProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export interface UNSTABLE_NavListItemProps extends NavigationProps {
|
|
11
|
+
children: StringLikeChildren;
|
|
12
|
+
icon?: ReactNode;
|
|
13
|
+
href?: Href;
|
|
14
|
+
isCurrent?: boolean;
|
|
15
|
+
isDisabled?: boolean;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Displays a single navigation item.
|
|
19
|
+
*/
|
|
20
|
+
export declare function UNSTABLE_NavListItem({ children, icon, href, isCurrent, isDisabled, routerOptions, ...props }: UNSTABLE_NavListItemProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export interface UNSTABLE_NavListGroupProps {
|
|
22
|
+
children: ReactNode;
|
|
23
|
+
label: StringLikeChildren;
|
|
24
|
+
icon?: ReactNode;
|
|
25
|
+
isExpanded?: boolean;
|
|
26
|
+
defaultExpanded?: boolean;
|
|
27
|
+
onExpandedChange?: (isExpanded: boolean) => void;
|
|
28
|
+
isDisabled?: boolean;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Displays an expandable navigation item group.
|
|
32
|
+
*/
|
|
33
|
+
export declare function UNSTABLE_NavListGroup({ children, label, icon, isExpanded, defaultExpanded, onExpandedChange, isDisabled, }: UNSTABLE_NavListGroupProps): import("react/jsx-runtime").JSX.Element;
|
|
34
|
+
//# sourceMappingURL=nav-list.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-list.d.ts","sourceRoot":"","sources":["../../../../src/components/nav-list/nav-list.tsx"],"names":[],"mappings":"AAKA,OAAO,EAA6B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAGlE,OAAO,KAAK,EAAE,IAAI,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAG7E,MAAM,WAAW,qBAAqB;IACpC,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,EAAE,QAAQ,EAAE,EAAE,qBAAqB,2CAEnE;AAiBD,MAAM,WAAW,yBAA0B,SAAQ,eAAe;IAChE,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAAC,EACnC,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,UAAU,EACV,aAAa,EACb,GAAG,KAAK,EACT,EAAE,yBAAyB,2CAmB3B;AAED,MAAM,WAAW,0BAA0B;IACzC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,kBAAkB,CAAC;IAC1B,IAAI,CAAC,EAAE,SAAS,CAAC;IACjB,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,gBAAgB,CAAC,EAAE,CAAC,UAAU,EAAE,OAAO,KAAK,IAAI,CAAC;IACjD,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CAAC,EACpC,QAAQ,EACR,KAAK,EACL,IAAI,EACJ,UAAU,EACV,eAAuB,EACvB,gBAAgB,EAChB,UAAU,GACX,EAAE,0BAA0B,2CA0B5B"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId } from '@react-aria/utils';
|
|
4
|
+
import { useControlledState } from '@react-stately/utils';
|
|
5
|
+
import clsx from 'clsx';
|
|
6
|
+
import { createContext, useContext } from 'react';
|
|
7
|
+
import { Button as RACButton, Link as RACLink } from 'react-aria-components';
|
|
8
|
+
import { IconChevronDown } from '../../icons/index.js';
|
|
9
|
+
import { Text } from '../typography/text.js';
|
|
10
|
+
/**
|
|
11
|
+
* Displays a vertical navigation list.
|
|
12
|
+
*/
|
|
13
|
+
export function UNSTABLE_NavList({ children }) {
|
|
14
|
+
return _jsx("ul", { className: "cim-nav-list", children: children });
|
|
15
|
+
}
|
|
16
|
+
const NavListRowContext = createContext(null);
|
|
17
|
+
function NavListRow({ children }) {
|
|
18
|
+
const navListRowContext = useContext(NavListRowContext);
|
|
19
|
+
const newDepth = navListRowContext == null ? 0 : navListRowContext.depth + 1;
|
|
20
|
+
return (_jsx(NavListRowContext.Provider, { value: { depth: newDepth }, children: _jsx("li", { className: "cim-nav-list-row", style: { '--cim-nav-list-depth': newDepth }, children: children }) }));
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Displays a single navigation item.
|
|
24
|
+
*/
|
|
25
|
+
export function UNSTABLE_NavListItem({ children, icon, href, isCurrent, isDisabled, routerOptions, ...props }) {
|
|
26
|
+
return (_jsx(NavListRow, { children: _jsxs(RACLink, { ...props, className: "cim-nav-list-item", href: href, routerOptions: routerOptions, "aria-current": isCurrent ? 'page' : undefined, isDisabled: isDisabled, "data-active": isCurrent || undefined, children: [icon, _jsx(Text, { as: "span", variant: "medium", UNSAFE_className: "cim-nav-list-item-label", children: children })] }) }));
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Displays an expandable navigation item group.
|
|
30
|
+
*/
|
|
31
|
+
export function UNSTABLE_NavListGroup({ children, label, icon, isExpanded, defaultExpanded = false, onExpandedChange, isDisabled, }) {
|
|
32
|
+
const groupId = useId();
|
|
33
|
+
const [expanded, setExpanded] = useControlledState(isExpanded, defaultExpanded, onExpandedChange);
|
|
34
|
+
return (_jsxs(NavListRow, { children: [_jsxs(RACButton, { className: "cim-nav-list-item", onPress: () => setExpanded(!expanded), "aria-controls": groupId, "aria-expanded": expanded, isDisabled: isDisabled, children: [icon, _jsx(Text, { as: "span", variant: "medium", UNSAFE_className: "cim-nav-list-item-label", children: label }), _jsx(IconChevronDown, { UNSAFE_className: clsx('cim-nav-list-group-icon', expanded && 'cim-nav-list-group-icon-expanded') })] }), _jsx("ul", { id: groupId, className: "cim-nav-list-group-content", hidden: !expanded, children: children })] }));
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=nav-list.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nav-list.js","sourceRoot":"","sources":["../../../../src/components/nav-list/nav-list.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,EAAE,aAAa,EAAE,UAAU,EAAkB,MAAM,OAAO,CAAC;AAClE,OAAO,EAAE,MAAM,IAAI,SAAS,EAAE,IAAI,IAAI,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAC7E,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAC;AAEvD,OAAO,EAAE,IAAI,EAAE,MAAM,uBAAuB,CAAC;AAM7C;;GAEG;AACH,MAAM,UAAU,gBAAgB,CAAC,EAAE,QAAQ,EA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,GAAG,KAAK,EACvB,gBAAgB,EAChB,UAAU,GACiB;IAC3B,MAAM,OAAO,GAAG,KAAK,EAAE,CAAC;IACxB,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,kBAAkB,CAAC,UAAU,EAAE,eAAe,EAAE,gBAAgB,CAAC,CAAC;IAElG,OAAO,CACL,MAAC,UAAU,eACT,MAAC,SAAS,IACR,SAAS,EAAC,mBAAmB,EAC7B,OAAO,EAAE,GAAG,EAAE,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,mBACtB,OAAO,mBACP,QAAQ,EACvB,UAAU,EAAE,UAAU,aAErB,IAAI,EACL,KAAC,IAAI,IAAC,EAAE,EAAC,MAAM,EAAC,OAAO,EAAC,QAAQ,EAAC,gBAAgB,EAAC,yBAAyB,YACxE,KAAK,GACD,EACP,KAAC,eAAe,IACd,gBAAgB,EAAE,IAAI,CAAC,yBAAyB,EAAE,QAAQ,IAAI,kCAAkC,CAAC,GACjG,IACQ,EACZ,aAAI,EAAE,EAAE,OAAO,EAAE,SAAS,EAAC,4BAA4B,EAAC,MAAM,EAAE,CAAC,QAAQ,YACtE,QAAQ,GACN,IACM,CACd,CAAC;AACJ,CAAC","sourcesContent":["'use client';\n\nimport { useId } from '@react-aria/utils';\nimport { useControlledState } from '@react-stately/utils';\nimport clsx from 'clsx';\nimport { createContext, useContext, type ReactNode } from 'react';\nimport { Button as RACButton, Link as RACLink } from 'react-aria-components';\nimport { IconChevronDown } from '../../icons/index.js';\nimport type { Href, NavigationProps, StringLikeChildren } from '../types.js';\nimport { Text } from '../typography/text.js';\n\nexport interface UNSTABLE_NavListProps {\n children: ReactNode;\n}\n\n/**\n * Displays a vertical navigation list.\n */\nexport function UNSTABLE_NavList({ children }: UNSTABLE_NavListProps) {\n return <ul className=\"cim-nav-list\">{children}</ul>;\n}\n\nconst NavListRowContext = createContext<{ depth: number } | null>(null);\n\nfunction NavListRow({ children }: { children: ReactNode }) {\n const navListRowContext = useContext(NavListRowContext);\n const newDepth = navListRowContext == null ? 0 : navListRowContext.depth + 1;\n\n return (\n <NavListRowContext.Provider value={{ depth: newDepth }}>\n <li className=\"cim-nav-list-row\" style={{ '--cim-nav-list-depth': newDepth } as React.CSSProperties}>\n {children}\n </li>\n </NavListRowContext.Provider>\n );\n}\n\nexport interface UNSTABLE_NavListItemProps extends NavigationProps {\n children: StringLikeChildren;\n icon?: ReactNode;\n href?: Href;\n isCurrent?: boolean;\n isDisabled?: boolean;\n}\n\n/**\n * Displays a single navigation item.\n */\nexport function UNSTABLE_NavListItem({\n children,\n icon,\n href,\n isCurrent,\n isDisabled,\n routerOptions,\n ...props\n}: UNSTABLE_NavListItemProps) {\n return (\n <NavListRow>\n <RACLink\n {...props}\n className=\"cim-nav-list-item\"\n href={href}\n routerOptions={routerOptions}\n aria-current={isCurrent ? 'page' : undefined}\n isDisabled={isDisabled}\n data-active={isCurrent || undefined}\n >\n {icon}\n <Text as=\"span\" variant=\"medium\" UNSAFE_className=\"cim-nav-list-item-label\">\n {children}\n </Text>\n </RACLink>\n </NavListRow>\n );\n}\n\nexport interface UNSTABLE_NavListGroupProps {\n children: ReactNode;\n label: StringLikeChildren;\n icon?: ReactNode;\n isExpanded?: boolean;\n defaultExpanded?: boolean;\n onExpandedChange?: (isExpanded: boolean) => void;\n isDisabled?: boolean;\n}\n\n/**\n * Displays an expandable navigation item group.\n */\nexport function UNSTABLE_NavListGroup({\n children,\n label,\n icon,\n isExpanded,\n defaultExpanded = false,\n onExpandedChange,\n isDisabled,\n}: UNSTABLE_NavListGroupProps) {\n const groupId = useId();\n const [expanded, setExpanded] = useControlledState(isExpanded, defaultExpanded, onExpandedChange);\n\n return (\n <NavListRow>\n <RACButton\n className=\"cim-nav-list-item\"\n onPress={() => setExpanded(!expanded)}\n aria-controls={groupId}\n aria-expanded={expanded}\n isDisabled={isDisabled}\n >\n {icon}\n <Text as=\"span\" variant=\"medium\" UNSAFE_className=\"cim-nav-list-item-label\">\n {label}\n </Text>\n <IconChevronDown\n UNSAFE_className={clsx('cim-nav-list-group-icon', expanded && 'cim-nav-list-group-icon-expanded')}\n />\n </RACButton>\n <ul id={groupId} className=\"cim-nav-list-group-content\" hidden={!expanded}>\n {children}\n </ul>\n </NavListRow>\n );\n}\n"]}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { type SwitchProps as RACSwitchProps } from 'react-aria-components';
|
|
2
|
+
import type { AriaLabelingProps, CommonProps, StringLikeChildren } from '../types.js';
|
|
3
|
+
export interface SwitchProps extends CommonProps, AriaLabelingProps, Pick<RACSwitchProps, 'onChange' | 'isSelected' | 'isDisabled' | 'isReadOnly' | 'defaultSelected' | 'autoFocus' | 'form' | 'name' | 'value'> {
|
|
4
|
+
/** The label rendered next to the switch. */
|
|
5
|
+
children?: StringLikeChildren;
|
|
6
|
+
/** A description for the switch. Provides a hint such as specific requirements for which setting to choose. */
|
|
7
|
+
description?: string;
|
|
8
|
+
/**
|
|
9
|
+
* Controls where the label is rendered relative to the switch.
|
|
10
|
+
* @default 'end'
|
|
11
|
+
*/
|
|
12
|
+
labelPosition?: 'top' | 'start' | 'end';
|
|
13
|
+
/**
|
|
14
|
+
* Whether the switch should take up the whole available width. Enabling this option will add space between the switch and its label.
|
|
15
|
+
* @default false
|
|
16
|
+
*/
|
|
17
|
+
fullWidth?: boolean;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Allows users to turn a setting on or off.
|
|
21
|
+
*
|
|
22
|
+
* See [switch usage guidelines](https://ui.cimpress.io/components/switch/).
|
|
23
|
+
*/
|
|
24
|
+
declare const _Switch: (props: SwitchProps & import("react").RefAttributes<HTMLLabelElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
|
|
25
|
+
export { _Switch as Switch };
|
|
26
|
+
//# sourceMappingURL=switch.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"switch.d.ts","sourceRoot":"","sources":["../../../../src/components/switch/switch.tsx"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,WAAW,IAAI,cAAc,EAEnC,MAAM,uBAAuB,CAAC;AAM/B,OAAO,KAAK,EAAE,iBAAiB,EAAE,WAAW,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAGtF,MAAM,WAAW,WACf,SACE,WAAW,EACX,iBAAiB,EACjB,IAAI,CACF,cAAc,EACZ,UAAU,GACV,YAAY,GACZ,YAAY,GACZ,YAAY,GACZ,iBAAiB,GACjB,WAAW,GACX,MAAM,GACN,MAAM,GACN,OAAO,CACV;IACH,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,kBAAkB,CAAC;IAC9B,+GAA+G;IAC/G,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,aAAa,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,KAAK,CAAC;IACxC;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAoED;;;;GAIG;AACH,QAAA,MAAM,OAAO,+JAA+C,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useSlotId } from '@react-aria/utils';
|
|
4
|
+
import clsx from 'clsx';
|
|
5
|
+
import { Provider as RACProvider, Switch as RACSwitch, TextContext as RACTextContext, } from 'react-aria-components';
|
|
6
|
+
import { forwardRef } from '../../forward-ref.js';
|
|
7
|
+
import { IconCheckBold, IconCloseBold } from '../../icons/index.js';
|
|
8
|
+
import { useProductionWarning } from '../../utils/use-production-warning.js';
|
|
9
|
+
import { withStyleProps } from '../../with-style-props.js';
|
|
10
|
+
import { FormFieldDescription } from '../internal/form-field/form-field.js';
|
|
11
|
+
import { Text } from '../typography/text.js';
|
|
12
|
+
function Switch({ children, description, labelPosition = 'end', fullWidth = false, 'aria-describedby': ariaDescribedBy, UNSAFE_className, UNSAFE_style, ...props }, ref) {
|
|
13
|
+
const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
|
|
14
|
+
useProductionWarning(() => {
|
|
15
|
+
if (!children && !ariaLabel && !ariaLabelledBy) {
|
|
16
|
+
console.warn('Switch requires one of children / aria-label / aria-labelledby for accessibility');
|
|
17
|
+
}
|
|
18
|
+
}, [children, ariaLabel, ariaLabelledBy]);
|
|
19
|
+
const descriptionId = useSlotId([Boolean(description)]);
|
|
20
|
+
const label = (_jsx(_Fragment, { children: children && (_jsx(Text, { as: "span", variant: "medium", children: children })) }));
|
|
21
|
+
return (_jsx(RACProvider, { values: [[RACTextContext, { slots: { description: { id: descriptionId } } }]], children: _jsxs("div", { className: clsx('cim-switch', UNSAFE_className), style: UNSAFE_style, "data-label-position": labelPosition, "data-full-width": fullWidth || undefined, children: [_jsxs(RACSwitch, { ...props, className: "cim-switch-control-wrapper", ref: ref, "aria-describedby": descriptionId || ariaDescribedBy ? [descriptionId, ariaDescribedBy].join(' ') : undefined, children: [labelPosition !== 'end' && label, _jsx("div", { className: "cim-switch-track-wrapper", "aria-hidden": true, children: _jsxs("div", { className: "cim-switch-track", children: [_jsx(IconCheckBold, { UNSAFE_className: "cim-switch-icon-on" }), _jsx(IconCloseBold, { UNSAFE_className: "cim-switch-icon-off" }), _jsx("div", { className: "cim-switch-track-head" })] }) }), labelPosition === 'end' && label] }), _jsx(FormFieldDescription, { children: description })] }) }));
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Allows users to turn a setting on or off.
|
|
25
|
+
*
|
|
26
|
+
* See [switch usage guidelines](https://ui.cimpress.io/components/switch/).
|
|
27
|
+
*/
|
|
28
|
+
const _Switch = withStyleProps(forwardRef(Switch), 'Switch');
|
|
29
|
+
export { _Switch as Switch };
|
|
30
|
+
//# sourceMappingURL=switch.js.map
|