@cimpress-ui/react 1.7.1 → 1.8.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/app-header/side-nav.d.ts +4 -5
- package/dist/commonjs/components/app-header/side-nav.d.ts.map +1 -1
- package/dist/commonjs/components/app-header/side-nav.js +3 -2
- package/dist/commonjs/components/app-header/side-nav.js.map +1 -1
- package/dist/commonjs/components/combo-box/combo-box.d.ts +16 -4
- package/dist/commonjs/components/combo-box/combo-box.d.ts.map +1 -1
- package/dist/commonjs/components/combo-box/combo-box.js +9 -4
- package/dist/commonjs/components/combo-box/combo-box.js.map +1 -1
- package/dist/commonjs/components/copy/copy-button.d.ts +13 -0
- package/dist/commonjs/components/copy/copy-button.d.ts.map +1 -0
- package/dist/commonjs/components/copy/copy-button.js +33 -0
- package/dist/commonjs/components/copy/copy-button.js.map +1 -0
- package/dist/commonjs/components/copy/inline-copy.d.ts +12 -0
- package/dist/commonjs/components/copy/inline-copy.d.ts.map +1 -0
- package/dist/commonjs/components/copy/inline-copy.js +33 -0
- package/dist/commonjs/components/copy/inline-copy.js.map +1 -0
- package/dist/commonjs/components/copy/use-copy.d.ts +10 -0
- package/dist/commonjs/components/copy/use-copy.d.ts.map +1 -0
- package/dist/commonjs/components/copy/use-copy.js +30 -0
- package/dist/commonjs/components/copy/use-copy.js.map +1 -0
- package/dist/commonjs/components/date-picker/date-picker.d.ts +7 -2
- package/dist/commonjs/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/commonjs/components/date-picker/date-picker.js +6 -2
- package/dist/commonjs/components/date-picker/date-picker.js.map +1 -1
- package/dist/commonjs/components/disclosure/disclosure-group.d.ts +4 -2
- package/dist/commonjs/components/disclosure/disclosure-group.d.ts.map +1 -1
- package/dist/commonjs/components/disclosure/disclosure-group.js.map +1 -1
- package/dist/commonjs/components/disclosure/disclosure.d.ts +4 -2
- package/dist/commonjs/components/disclosure/disclosure.d.ts.map +1 -1
- package/dist/commonjs/components/disclosure/disclosure.js.map +1 -1
- package/dist/commonjs/components/link-tabs/link-tabs.d.ts.map +1 -1
- package/dist/commonjs/components/link-tabs/link-tabs.js +1 -1
- package/dist/commonjs/components/link-tabs/link-tabs.js.map +1 -1
- package/dist/commonjs/components/menu/menu.d.ts +5 -3
- package/dist/commonjs/components/menu/menu.d.ts.map +1 -1
- package/dist/commonjs/components/menu/menu.js.map +1 -1
- package/dist/commonjs/components/number-field/number-field.d.ts +9 -2
- package/dist/commonjs/components/number-field/number-field.d.ts.map +1 -1
- package/dist/commonjs/components/number-field/number-field.js +8 -2
- package/dist/commonjs/components/number-field/number-field.js.map +1 -1
- package/dist/commonjs/components/select/select.d.ts +14 -4
- package/dist/commonjs/components/select/select.d.ts.map +1 -1
- package/dist/commonjs/components/select/select.js +9 -3
- package/dist/commonjs/components/select/select.js.map +1 -1
- package/dist/commonjs/components/spacing/types.d.ts.map +1 -1
- package/dist/commonjs/components/spacing/types.js +6 -4
- package/dist/commonjs/components/spacing/types.js.map +1 -1
- package/dist/commonjs/components/stepper/context.d.ts +2 -0
- package/dist/commonjs/components/stepper/context.d.ts.map +1 -1
- package/dist/commonjs/components/stepper/context.js +2 -0
- package/dist/commonjs/components/stepper/context.js.map +1 -1
- package/dist/commonjs/components/stepper/stepper-item.d.ts.map +1 -1
- package/dist/commonjs/components/stepper/stepper-item.js +3 -2
- package/dist/commonjs/components/stepper/stepper-item.js.map +1 -1
- package/dist/commonjs/components/stepper/stepper.d.ts.map +1 -1
- package/dist/commonjs/components/stepper/stepper.js +14 -8
- package/dist/commonjs/components/stepper/stepper.js.map +1 -1
- package/dist/commonjs/components/tabs/tabs.d.ts +3 -1
- package/dist/commonjs/components/tabs/tabs.d.ts.map +1 -1
- package/dist/commonjs/components/tabs/tabs.js.map +1 -1
- package/dist/commonjs/components/tag-field/tag-field-input.js +2 -2
- package/dist/commonjs/components/tag-field/tag-field-input.js.map +1 -1
- package/dist/commonjs/components/tag-field/tag-field.d.ts +14 -4
- package/dist/commonjs/components/tag-field/tag-field.d.ts.map +1 -1
- package/dist/commonjs/components/tag-field/tag-field.js +6 -2
- package/dist/commonjs/components/tag-field/tag-field.js.map +1 -1
- package/dist/commonjs/components/text-inputs/search-field.d.ts +9 -2
- package/dist/commonjs/components/text-inputs/search-field.d.ts.map +1 -1
- package/dist/commonjs/components/text-inputs/search-field.js +5 -1
- package/dist/commonjs/components/text-inputs/search-field.js.map +1 -1
- package/dist/commonjs/components/text-inputs/text-area.d.ts +15 -5
- package/dist/commonjs/components/text-inputs/text-area.d.ts.map +1 -1
- package/dist/commonjs/components/text-inputs/text-area.js.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.d.ts +2 -5
- package/dist/commonjs/components/text-inputs/text-field.d.ts.map +1 -1
- package/dist/commonjs/components/text-inputs/text-field.js.map +1 -1
- package/dist/commonjs/components/top-nav/top-nav.d.ts +12 -0
- package/dist/commonjs/components/top-nav/top-nav.d.ts.map +1 -0
- package/dist/commonjs/components/top-nav/top-nav.js +18 -0
- package/dist/commonjs/components/top-nav/top-nav.js.map +1 -0
- package/dist/commonjs/components/types.d.ts +6 -1
- package/dist/commonjs/components/types.d.ts.map +1 -1
- package/dist/commonjs/components/types.js.map +1 -1
- package/dist/commonjs/index.d.ts +3 -0
- package/dist/commonjs/index.d.ts.map +1 -1
- package/dist/commonjs/index.js +3 -0
- package/dist/commonjs/index.js.map +1 -1
- package/dist/commonjs/utils/string-like-children-to-string.d.ts +3 -0
- package/dist/commonjs/utils/string-like-children-to-string.d.ts.map +1 -0
- package/dist/commonjs/utils/string-like-children-to-string.js +7 -0
- package/dist/commonjs/utils/string-like-children-to-string.js.map +1 -0
- package/dist/esm/components/app-header/side-nav.d.ts +4 -5
- package/dist/esm/components/app-header/side-nav.d.ts.map +1 -1
- package/dist/esm/components/app-header/side-nav.js +3 -2
- package/dist/esm/components/app-header/side-nav.js.map +1 -1
- package/dist/esm/components/combo-box/combo-box.d.ts +16 -4
- package/dist/esm/components/combo-box/combo-box.d.ts.map +1 -1
- package/dist/esm/components/combo-box/combo-box.js +10 -5
- package/dist/esm/components/combo-box/combo-box.js.map +1 -1
- package/dist/esm/components/copy/copy-button.d.ts +13 -0
- package/dist/esm/components/copy/copy-button.d.ts.map +1 -0
- package/dist/esm/components/copy/copy-button.js +30 -0
- package/dist/esm/components/copy/copy-button.js.map +1 -0
- package/dist/esm/components/copy/inline-copy.d.ts +12 -0
- package/dist/esm/components/copy/inline-copy.d.ts.map +1 -0
- package/dist/esm/components/copy/inline-copy.js +27 -0
- package/dist/esm/components/copy/inline-copy.js.map +1 -0
- package/dist/esm/components/copy/use-copy.d.ts +10 -0
- package/dist/esm/components/copy/use-copy.d.ts.map +1 -0
- package/dist/esm/components/copy/use-copy.js +27 -0
- package/dist/esm/components/copy/use-copy.js.map +1 -0
- package/dist/esm/components/date-picker/date-picker.d.ts +7 -2
- package/dist/esm/components/date-picker/date-picker.d.ts.map +1 -1
- package/dist/esm/components/date-picker/date-picker.js +7 -3
- package/dist/esm/components/date-picker/date-picker.js.map +1 -1
- package/dist/esm/components/disclosure/disclosure-group.d.ts +4 -2
- package/dist/esm/components/disclosure/disclosure-group.d.ts.map +1 -1
- package/dist/esm/components/disclosure/disclosure-group.js.map +1 -1
- package/dist/esm/components/disclosure/disclosure.d.ts +4 -2
- package/dist/esm/components/disclosure/disclosure.d.ts.map +1 -1
- package/dist/esm/components/disclosure/disclosure.js.map +1 -1
- package/dist/esm/components/link-tabs/link-tabs.d.ts.map +1 -1
- package/dist/esm/components/link-tabs/link-tabs.js +1 -1
- package/dist/esm/components/link-tabs/link-tabs.js.map +1 -1
- package/dist/esm/components/menu/menu.d.ts +5 -3
- package/dist/esm/components/menu/menu.d.ts.map +1 -1
- package/dist/esm/components/menu/menu.js.map +1 -1
- package/dist/esm/components/number-field/number-field.d.ts +9 -2
- package/dist/esm/components/number-field/number-field.d.ts.map +1 -1
- package/dist/esm/components/number-field/number-field.js +8 -2
- package/dist/esm/components/number-field/number-field.js.map +1 -1
- package/dist/esm/components/select/select.d.ts +14 -4
- package/dist/esm/components/select/select.d.ts.map +1 -1
- package/dist/esm/components/select/select.js +9 -3
- package/dist/esm/components/select/select.js.map +1 -1
- package/dist/esm/components/spacing/types.d.ts.map +1 -1
- package/dist/esm/components/spacing/types.js +6 -4
- package/dist/esm/components/spacing/types.js.map +1 -1
- package/dist/esm/components/stepper/context.d.ts +2 -0
- package/dist/esm/components/stepper/context.d.ts.map +1 -1
- package/dist/esm/components/stepper/context.js +2 -0
- package/dist/esm/components/stepper/context.js.map +1 -1
- package/dist/esm/components/stepper/stepper-item.d.ts.map +1 -1
- package/dist/esm/components/stepper/stepper-item.js +3 -2
- package/dist/esm/components/stepper/stepper-item.js.map +1 -1
- package/dist/esm/components/stepper/stepper.d.ts.map +1 -1
- package/dist/esm/components/stepper/stepper.js +15 -9
- package/dist/esm/components/stepper/stepper.js.map +1 -1
- package/dist/esm/components/tabs/tabs.d.ts +3 -1
- package/dist/esm/components/tabs/tabs.d.ts.map +1 -1
- package/dist/esm/components/tabs/tabs.js.map +1 -1
- package/dist/esm/components/tag-field/tag-field-input.js +2 -2
- package/dist/esm/components/tag-field/tag-field-input.js.map +1 -1
- package/dist/esm/components/tag-field/tag-field.d.ts +14 -4
- package/dist/esm/components/tag-field/tag-field.d.ts.map +1 -1
- package/dist/esm/components/tag-field/tag-field.js +7 -3
- package/dist/esm/components/tag-field/tag-field.js.map +1 -1
- package/dist/esm/components/text-inputs/search-field.d.ts +9 -2
- package/dist/esm/components/text-inputs/search-field.d.ts.map +1 -1
- package/dist/esm/components/text-inputs/search-field.js +6 -2
- package/dist/esm/components/text-inputs/search-field.js.map +1 -1
- package/dist/esm/components/text-inputs/text-area.d.ts +15 -5
- package/dist/esm/components/text-inputs/text-area.d.ts.map +1 -1
- package/dist/esm/components/text-inputs/text-area.js +1 -1
- package/dist/esm/components/text-inputs/text-area.js.map +1 -1
- package/dist/esm/components/text-inputs/text-field.d.ts +2 -5
- package/dist/esm/components/text-inputs/text-field.d.ts.map +1 -1
- package/dist/esm/components/text-inputs/text-field.js.map +1 -1
- package/dist/esm/components/top-nav/top-nav.d.ts +12 -0
- package/dist/esm/components/top-nav/top-nav.d.ts.map +1 -0
- package/dist/esm/components/top-nav/top-nav.js +11 -0
- package/dist/esm/components/top-nav/top-nav.js.map +1 -0
- package/dist/esm/components/types.d.ts +6 -1
- package/dist/esm/components/types.d.ts.map +1 -1
- package/dist/esm/components/types.js.map +1 -1
- package/dist/esm/index.d.ts +3 -0
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +3 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/utils/string-like-children-to-string.d.ts +3 -0
- package/dist/esm/utils/string-like-children-to-string.d.ts.map +1 -0
- package/dist/esm/utils/string-like-children-to-string.js +4 -0
- package/dist/esm/utils/string-like-children-to-string.js.map +1 -0
- package/dist-styles/core.css +1 -1
- package/dist-styles/styles.css +1 -1
- package/package.json +2 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type ReactNode } from 'react';
|
|
2
2
|
import { type DisclosureGroupProps as RACDisclosureGroupProps } from 'react-aria-components';
|
|
3
|
-
import type { CommonProps } from '../types.js';
|
|
3
|
+
import type { CommonProps, Key } from '../types.js';
|
|
4
4
|
import { type DisclosureSize, type DisclosureVariant } from './context.js';
|
|
5
|
-
export interface DisclosureGroupProps extends CommonProps, Pick<RACDisclosureGroupProps, 'isDisabled' | 'allowsMultipleExpanded' | 'defaultExpandedKeys' | 'expandedKeys'
|
|
5
|
+
export interface DisclosureGroupProps extends CommonProps, Pick<RACDisclosureGroupProps, 'isDisabled' | 'allowsMultipleExpanded' | 'defaultExpandedKeys' | 'expandedKeys'> {
|
|
6
6
|
/** The disclosures to group together. */
|
|
7
7
|
children: ReactNode;
|
|
8
8
|
/**
|
|
@@ -15,6 +15,8 @@ export interface DisclosureGroupProps extends CommonProps, Pick<RACDisclosureGro
|
|
|
15
15
|
* @default 'medium'
|
|
16
16
|
*/
|
|
17
17
|
size?: DisclosureSize;
|
|
18
|
+
/** Handler that is called when any disclosure in this group is expanded or collapsed. */
|
|
19
|
+
onExpandedChange?: (keys: Set<Key>) => void;
|
|
18
20
|
}
|
|
19
21
|
/**
|
|
20
22
|
* Displays a grouping of related disclosures.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disclosure-group.d.ts","sourceRoot":"","sources":["../../../../src/components/disclosure/disclosure-group.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,EAEL,KAAK,oBAAoB,IAAI,uBAAuB,EACrD,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"disclosure-group.d.ts","sourceRoot":"","sources":["../../../../src/components/disclosure/disclosure-group.tsx"],"names":[],"mappings":"AAGA,OAAO,EAA8B,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AACnE,OAAO,EAEL,KAAK,oBAAoB,IAAI,uBAAuB,EACrD,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,WAAW,EAAE,GAAG,EAAE,MAAM,aAAa,CAAC;AACpD,OAAO,EAGL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,cAAc,CAAC;AAEtB,MAAM,WAAW,oBACf,SAAQ,WAAW,EACjB,IAAI,CAAC,uBAAuB,EAAE,YAAY,GAAG,wBAAwB,GAAG,qBAAqB,GAAG,cAAc,CAAC;IACjH,yCAAyC;IACzC,QAAQ,EAAE,SAAS,CAAC;IACpB;;;OAGG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;OAGG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,yFAAyF;IACzF,gBAAgB,CAAC,EAAE,CAAC,IAAI,EAAE,GAAG,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC;CAC7C;AA4BD;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,sKAAiE,CAAC;AAExF,OAAO,EAAE,gBAAgB,IAAI,eAAe,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disclosure-group.js","sourceRoot":"","sources":["../../../../src/components/disclosure/disclosure-group.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AACxB,iCAAmE;AACnE,iEAG+B;AAC/B,yDAAkD;AAClD,mEAA2D;AAE3D,6CAKsB;
|
|
1
|
+
{"version":3,"file":"disclosure-group.js","sourceRoot":"","sources":["../../../../src/components/disclosure/disclosure-group.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AACxB,iCAAmE;AACnE,iEAG+B;AAC/B,yDAAkD;AAClD,mEAA2D;AAE3D,6CAKsB;AAqBtB,SAAS,eAAe,CACtB,EAAE,QAAQ,EAAE,OAAO,GAAG,MAAM,EAAE,IAAI,GAAG,QAAQ,EAAE,gBAAgB,EAAE,YAAY,EAAE,GAAG,KAAK,EAAwB,EAC/G,GAAiC;IAEjC,MAAM,iBAAiB,GAA2B,IAAA,eAAO,EACvD,GAAG,EAAE,CAAC,CAAC;QACL,OAAO;QACP,IAAI;KACL,CAAC,EACF,CAAC,OAAO,EAAE,IAAI,CAAC,CAChB,CAAC;IAEF,OAAO,CACL,uBAAC,uCAAkB,OACb,KAAK,EACT,GAAG,EAAE,GAAG,EACR,SAAS,EAAE,IAAA,cAAI,EAAC,sBAAsB,EAAE,gBAAgB,CAAC,EACzD,KAAK,EAAE,YAAY,kBACL,OAAO,eACV,IAAI,YAEf,uBAAC,8BAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,iBAAiB,YAAG,QAAQ,GAA8B,GAC1E,CACtB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,gBAAgB,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,eAAe,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAE3D,2CAAe","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { useMemo, type ForwardedRef, type ReactNode } from 'react';\nimport {\n DisclosureGroup as RACDisclosureGroup,\n type DisclosureGroupProps as RACDisclosureGroupProps,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type { CommonProps, Key } from '../types.js';\nimport {\n DisclosureContext,\n type DisclosureContextValue,\n type DisclosureSize,\n type DisclosureVariant,\n} from './context.js';\n\nexport interface DisclosureGroupProps\n extends CommonProps,\n Pick<RACDisclosureGroupProps, 'isDisabled' | 'allowsMultipleExpanded' | 'defaultExpandedKeys' | 'expandedKeys'> {\n /** The disclosures to group together. */\n children: ReactNode;\n /**\n * Determines the visual appearance of disclosures within this group.\n * @default 'base'\n */\n variant?: DisclosureVariant;\n /**\n * Determines the size of disclosures within this group.\n * @default 'medium'\n */\n size?: DisclosureSize;\n /** Handler that is called when any disclosure in this group is expanded or collapsed. */\n onExpandedChange?: (keys: Set<Key>) => void;\n}\n\nfunction DisclosureGroup(\n { children, variant = 'base', size = 'medium', UNSAFE_className, UNSAFE_style, ...props }: DisclosureGroupProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const disclosureContext: DisclosureContextValue = useMemo(\n () => ({\n variant,\n size,\n }),\n [variant, size],\n );\n\n return (\n <RACDisclosureGroup\n {...props}\n ref={ref}\n className={clsx('cim-disclosure-group', UNSAFE_className)}\n style={UNSAFE_style}\n data-variant={variant}\n data-size={size}\n >\n <DisclosureContext.Provider value={disclosureContext}>{children}</DisclosureContext.Provider>\n </RACDisclosureGroup>\n );\n}\n\n/**\n * Displays a grouping of related disclosures.\n *\n * See [disclosure usage guidelines](https://ui.cimpress.io/components/disclosure/).\n */\nconst _DisclosureGroup = withStyleProps(forwardRef(DisclosureGroup), 'DisclosureGroup');\n\nexport { _DisclosureGroup as DisclosureGroup };\n"]}
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { type JSX, type ReactNode } from 'react';
|
|
2
2
|
import { type DisclosureProps as RACDisclosureProps } from 'react-aria-components';
|
|
3
|
-
import type { CommonProps } from '../types.js';
|
|
3
|
+
import type { CommonProps, Key } from '../types.js';
|
|
4
4
|
import { type DisclosureSize, type DisclosureVariant } from './context.js';
|
|
5
|
-
export interface DisclosureProps extends Omit<CommonProps, 'id'>, Pick<RACDisclosureProps, '
|
|
5
|
+
export interface DisclosureProps extends Omit<CommonProps, 'id'>, Pick<RACDisclosureProps, 'isDisabled' | 'defaultExpanded' | 'isExpanded' | 'onExpandedChange'> {
|
|
6
|
+
/** A unique ID for the disclosure when used within a `DisclosureGroup`. */
|
|
7
|
+
id?: Key;
|
|
6
8
|
/** The content to display when the disclosure is expanded. */
|
|
7
9
|
children: ReactNode;
|
|
8
10
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../../../../src/components/disclosure/disclosure.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,GAAG,EAAiC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAKL,KAAK,eAAe,IAAI,kBAAkB,EAC3C,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EAAE,WAAW,EAAa,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"disclosure.d.ts","sourceRoot":"","sources":["../../../../src/components/disclosure/disclosure.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,KAAK,GAAG,EAAiC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAKL,KAAK,eAAe,IAAI,kBAAkB,EAC3C,MAAM,uBAAuB,CAAC;AAI/B,OAAO,KAAK,EAAE,WAAW,EAAa,GAAG,EAAE,MAAM,aAAa,CAAC;AAE/D,OAAO,EAAqB,KAAK,cAAc,EAAE,KAAK,iBAAiB,EAAE,MAAM,cAAc,CAAC;AAO9F,MAAM,WAAW,eACf,SAAQ,IAAI,CAAC,WAAW,EAAE,IAAI,CAAC,EAC7B,IAAI,CAAC,kBAAkB,EAAE,YAAY,GAAG,iBAAiB,GAAG,YAAY,GAAG,kBAAkB,CAAC;IAChG,2EAA2E;IAC3E,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,8DAA8D;IAC9D,QAAQ,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;;OAIG;IACH,IAAI,CAAC,EAAE,cAAc,CAAC;IACtB,iEAAiE;IACjE,KAAK,EAAE,MAAM,CAAC;IACd;;;;OAIG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;;OAIG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB;;;;OAIG;IACH,KAAK,CAAC,EAAE,SAAS,CAAC;IAClB,sDAAsD;IACtD,OAAO,CAAC,EAAE,SAAS,CAAC;CACrB;AA8DD;;;;GAIG;AACH,QAAA,MAAM,WAAW,iJAAuD,CAAC;AAEzE,OAAO,EAAE,WAAW,IAAI,UAAU,EAAE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disclosure.js","sourceRoot":"","sources":["../../../../src/components/disclosure/disclosure.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AACxB,iCAAgF;AAChF,iEAM+B;AAC/B,yDAAkD;AAClD,mDAA8E;AAC9E,mEAA2D;AAE3D,mDAA6C;AAC7C,6CAA8F;AAE9F,MAAM,OAAO,GAA8D;IACzE,MAAM,EAAE,2BAAgB;IACxB,KAAK,EAAE,+BAAoB;CAC5B,CAAC;
|
|
1
|
+
{"version":3,"file":"disclosure.js","sourceRoot":"","sources":["../../../../src/components/disclosure/disclosure.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AACxB,iCAAgF;AAChF,iE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C,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,QAAQ,YACpD,KAAK,GACD,EACN,YAAY,IAAI,OAAO,EAEvB,YAAY,IAAI,KAAK,IAAI,gCAAK,SAAS,EAAC,sBAAsB,YAAE,KAAK,GAAO,IACnE,GACD,EAEZ,OAAO,IAAI,gCAAK,SAAS,EAAC,wBAAwB,YAAE,OAAO,GAAO,IAC/D,EAEN,uBAAC,uCAAkB,IAAC,SAAS,EAAC,sBAAsB,YAClD,gCAAK,SAAS,EAAC,8BAA8B,YAE3C,uBAAC,8BAAiB,CAAC,QAAQ,IAAC,KAAK,EAAE,IAAI,YAAG,QAAQ,GAA8B,GAC5E,GACa,IACP,CACjB,CAAC;AACJ,CAAC;AAED;;;;GAIG;AACH,MAAM,WAAW,GAAG,IAAA,oCAAc,EAAC,IAAA,2BAAU,EAAC,UAAU,CAAC,EAAE,YAAY,CAAC,CAAC;AAEjD,iCAAU","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { type JSX, useContext, type ForwardedRef, type ReactNode } from 'react';\nimport {\n Disclosure as RACDisclosure,\n Button as RACButton,\n Heading as RACHeading,\n DisclosurePanel as RACDisclosurePanel,\n type DisclosureProps as RACDisclosureProps,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { IconChevronRight, IconChevronRightBold } from '../../icons/index.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type { CommonProps, IconProps, Key } from '../types.js';\nimport { Text } from '../typography/text.js';\nimport { DisclosureContext, type DisclosureSize, type DisclosureVariant } from './context.js';\n\nconst iconMap: Record<DisclosureSize, (props: IconProps) => JSX.Element> = {\n medium: IconChevronRight,\n small: IconChevronRightBold,\n};\n\nexport interface DisclosureProps\n extends Omit<CommonProps, 'id'>,\n Pick<RACDisclosureProps, 'isDisabled' | 'defaultExpanded' | 'isExpanded' | 'onExpandedChange'> {\n /** A unique ID for the disclosure when used within a `DisclosureGroup`. */\n id?: Key;\n /** The content to display when the disclosure is expanded. */\n children: ReactNode;\n /**\n * Determines the visual appearance of the disclosure.\n * If the disclosure is part of a group, this prop has no effect - provide `variant` to `DisclosureGroup` instead.\n * @default 'base'\n */\n variant?: DisclosureVariant;\n /**\n * Determines the size of the disclosure.\n * If the disclosure is part of a group, this prop has no effect - provide `size` to `DisclosureGroup` instead.\n * @default 'medium'\n */\n size?: DisclosureSize;\n /** The title that is always visible in the disclosure header. */\n title: string;\n /**\n * An icon displayed before the disclosure title.\n *\n * Should not be used when size is set to `'small'` as icons won't be displayed at this size.\n */\n iconStart?: ReactNode;\n /**\n * An icon displayed after the disclosure title.\n *\n * Should not be used when size is set to `'small'` as icons won't be displayed at this size.\n */\n iconEnd?: ReactNode;\n /**\n * The badge displayed in the disclosure header.\n *\n * Should not be used when size is set to `'small'` as the badge won't be displayed at this size.\n */\n badge?: ReactNode;\n /** The actions displayed in the disclosure header. */\n actions?: ReactNode;\n}\n\nfunction Disclosure(\n {\n children,\n variant: ownVariant = 'base',\n size: ownSize = 'medium',\n title,\n iconStart,\n iconEnd,\n badge,\n actions,\n UNSAFE_className,\n UNSAFE_style,\n ...props\n }: DisclosureProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const disclosureContext = useContext(DisclosureContext);\n const variant = disclosureContext?.variant ?? ownVariant;\n const size = disclosureContext?.size ?? ownSize;\n const isMediumSize = size === 'medium';\n\n const Icon = iconMap[size];\n\n return (\n <RACDisclosure\n {...props}\n ref={ref}\n className={clsx('cim-disclosure', UNSAFE_className)}\n style={UNSAFE_style}\n data-variant={variant}\n data-size={size}\n >\n <div className=\"cim-disclosure-heading-wrapper\">\n <RACHeading className=\"cim-disclosure-heading\">\n <RACButton className=\"cim-disclosure-button\" slot=\"trigger\">\n <Icon size={isMediumSize ? 32 : 16} UNSAFE_className=\"cim-disclosure-icon\" />\n\n {isMediumSize && iconStart}\n <Text as=\"h3\" variant={isMediumSize ? 'body' : 'medium'}>\n {title}\n </Text>\n {isMediumSize && iconEnd}\n\n {isMediumSize && badge && <div className=\"cim-disclosure-badge\">{badge}</div>}\n </RACButton>\n </RACHeading>\n\n {actions && <div className=\"cim-disclosure-actions\">{actions}</div>}\n </div>\n\n <RACDisclosurePanel className=\"cim-disclosure-panel\">\n <div className=\"cim-disclosure-panel-content\">\n {/* Reset disclosure context to allow nesting disclosures */}\n <DisclosureContext.Provider value={null}>{children}</DisclosureContext.Provider>\n </div>\n </RACDisclosurePanel>\n </RACDisclosure>\n );\n}\n\n/**\n * Displays a collapsible section of content.\n *\n * See [disclosure usage guidelines](https://ui.cimpress.io/components/disclosure/).\n */\nconst _Disclosure = withStyleProps(forwardRef(Disclosure), 'Disclosure');\n\nexport { _Disclosure as Disclosure };\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-tabs.d.ts","sourceRoot":"","sources":["../../../../src/components/link-tabs/link-tabs.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,SAAS,EAA0C,MAAM,OAAO,CAAC;AAC/E,OAAO,EAAmB,KAAK,SAAS,IAAI,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAIxF,OAAO,KAAK,EACV,iBAAiB,EACjB,WAAW,EACX,IAAI,EACJ,eAAe,EACf,kBAAkB,EAClB,YAAY,EACb,MAAM,aAAa,CAAC;AAIrB,MAAM,WAAW,aAAc,SAAQ,WAAW,EAAE,iBAAiB;IACnE,wCAAwC;IACxC,QAAQ,EAAE,SAAS,CAAC;IACpB,0CAA0C;IAC1C,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,iEAAiE;IACjE,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,iEAAiE;IACjE,WAAW,CAAC,EAAE,IAAI,GAAG,IAAI,CAAC;IAC1B,yDAAyD;IACzD,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,IAAI,GAAG,IAAI,KAAK,IAAI,CAAC;CAC5C;
|
|
1
|
+
{"version":3,"file":"link-tabs.d.ts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gB,EAChB,YAAY,EACZ,UAAU,EACV,GAAG,KAAK,EACT,EAAE,YAAY,2CA8Bd;yBAvCe,OAAO"}
|
|
@@ -31,7 +31,7 @@ function LinkTabs({ children, currentHref, defaultHref, onHrefChange, UNSAFE_cla
|
|
|
31
31
|
currentHref: href,
|
|
32
32
|
setCurrentHref: setHref,
|
|
33
33
|
}), [isDisabled, href, setHref]);
|
|
34
|
-
return ((0, jsx_runtime_1.jsx)("nav", { ...props, ref: ref, id: linkTabsId,
|
|
34
|
+
return ((0, jsx_runtime_1.jsx)("nav", { ...props, ref: ref, id: linkTabsId, className: (0, clsx_1.default)('cim-link-tabs', UNSAFE_className), children: (0, jsx_runtime_1.jsx)("ul", { style: UNSAFE_style, "aria-labelledby": linkTabsId, "data-disabled": isDisabled, className: "cim-tab-list", children: (0, jsx_runtime_1.jsx)(context_js_1.LinkTabsContext.Provider, { value: linkTabsContext, children: children }) }) }));
|
|
35
35
|
}
|
|
36
36
|
/**
|
|
37
37
|
* Displays a list of tabs to help users navigate through a website.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"link-tabs.js","sourceRoot":"","sources":["../../../../src/components/link-tabs/link-tabs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;
|
|
1
|
+
{"version":3,"file":"link-tabs.js","sourceRoot":"","sources":["../../../../src/components/link-tabs/link-tabs.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AAmGb,0BAuCC;;AAxID,6CAA0C;AAC1C,gDAA0D;AAC1D,gDAAwB;AACxB,iCAA+E;AAC/E,iEAAwF;AACxF,yDAAkD;AAClD,qFAA6E;AAC7E,mEAA2D;AAS3D,mDAA6C;AAC7C,6CAA0E;AAe1E,SAAS,QAAQ,CACf,EACE,QAAQ,EACR,WAAW,EACX,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,YAAY,EACZ,EAAE,EACF,UAAU,EACV,GAAG,KAAK,EACM,EAChB,GAAiC;IAEjC,MAA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,EACL,gBAAgB,EAChB,YAAY,EACZ,UAAU,EACV,GAAG,KAAK,EACK;IACb,MAAM,eAAe,GAAG,IAAA,kBAAU,EAAC,4BAAe,CAAC,CAAC;IACpD,IAAI,CAAC,eAAe,EAAE,CAAC;QACrB,MAAM,IAAI,KAAK,CAAC,0CAA0C,CAAC,CAAC;IAC9D,CAAC;IAED,MAAM,EAAE,UAAU,EAAE,eAAe,EAAE,WAAW,EAAE,cAAc,EAAE,GAAG,eAAe,CAAC;IAErF,MAAM,SAAS,GAAG,IAAI,KAAK,WAAW,CAAC;IAEvC,OAAO,CACL,yCACE,wBAAC,4BAAO,OACF,KAAK,EACT,SAAS,EAAE,IAAA,cAAI,EAAC,cAAc,EAAE,mBAAmB,EAAE,gBAAgB,CAAC,EACtE,KAAK,EAAE,YAAY,EACnB,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,GAAG,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,kBACrB,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,mBAC7B,SAAS,IAAI,SAAS,EACrC,UAAU,EAAE,UAAU,IAAI,eAAe,aAExC,SAAS,EACV,uBAAC,cAAI,IAAC,EAAE,EAAC,MAAM,EAAC,OAAO,EAAC,iBAAiB,EAAC,SAAS,EAAC,QAAQ,YACzD,QAAQ,GACJ,EACN,KAAK,IACE,GACP,CACN,CAAC;AACJ,CAAC;AAED,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC","sourcesContent":["'use client';\n\nimport { useId } from '@react-aria/utils';\nimport { useControlledState } from '@react-stately/utils';\nimport clsx from 'clsx';\nimport { type ReactNode, type ForwardedRef, useMemo, useContext } from 'react';\nimport { Link as RACLink, type LinkProps as RACLinkProps } from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport type {\n AriaLabelingProps,\n CommonProps,\n Href,\n NavigationProps,\n StringLikeChildren,\n WithRequired,\n} from '../types.js';\nimport { Text } from '../typography/text.js';\nimport { LinkTabsContext, type LinkTabsContextValue } from './context.js';\n\nexport interface LinkTabsProps extends CommonProps, AriaLabelingProps {\n /** Link tabs belonging to the group. */\n children: ReactNode;\n /** Whether the link tabs are disabled. */\n isDisabled?: boolean;\n /** The currently selected key in the collection (controlled). */\n currentHref?: Href | null;\n /** The initial selected key in the collection (uncontrolled). */\n defaultHref?: Href | null;\n /** Handler that is called when the selection changes. */\n onHrefChange?: (href: Href | null) => void;\n}\n\nfunction LinkTabs(\n {\n children,\n currentHref,\n defaultHref,\n onHrefChange,\n UNSAFE_className,\n UNSAFE_style,\n id,\n isDisabled,\n ...props\n }: LinkTabsProps,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!ariaLabel && !ariaLabelledBy) {\n console.warn('LinkTabs requires one of aria-label / aria-labelledby for accessibility');\n }\n }, [ariaLabel, ariaLabelledBy]);\n\n const linkTabsId = useId(id);\n const [href, setHref] = useControlledState(currentHref, defaultHref ?? null, onHrefChange);\n\n const linkTabsContext: LinkTabsContextValue = useMemo(\n () => ({\n isDisabled,\n currentHref: href,\n setCurrentHref: setHref,\n }),\n [isDisabled, href, setHref],\n );\n\n return (\n <nav {...props} ref={ref} id={linkTabsId} className={clsx('cim-link-tabs', UNSAFE_className)}>\n <ul style={UNSAFE_style} aria-labelledby={linkTabsId} data-disabled={isDisabled} className=\"cim-tab-list\">\n <LinkTabsContext.Provider value={linkTabsContext}>{children}</LinkTabsContext.Provider>\n </ul>\n </nav>\n );\n}\n\n/**\n * Displays a list of tabs to help users navigate through a website.\n *\n * See [tabs usage guidelines](https://ui.cimpress.io/components/tabs/).\n */\nconst _LinkTabs = withStyleProps(forwardRef(LinkTabs), 'LinkTabs');\n\nexport { _LinkTabs as LinkTabs };\n\nexport interface LinkTabProps\n extends Omit<CommonProps, 'id'>,\n WithRequired<NavigationProps, 'href'>,\n Pick<RACLinkProps, 'children' | 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {\n /** The text to display as the tab title. */\n children: StringLikeChildren;\n /** An icon displayed before the tab title. */\n iconStart?: ReactNode;\n /** A badge displayed after the tab title. */\n badge?: ReactNode;\n}\n\n/** Renders a single tab within `LinkTabs`. */\nexport function LinkTab({\n children,\n href,\n iconStart,\n badge,\n UNSAFE_className,\n UNSAFE_style,\n isDisabled,\n ...props\n}: LinkTabProps) {\n const linkTabsContext = useContext(LinkTabsContext);\n if (!linkTabsContext) {\n throw new Error('Cannot use link tab outside of link tabs');\n }\n\n const { isDisabled: isGroupDisabled, currentHref, setCurrentHref } = linkTabsContext;\n\n const isCurrent = href === currentHref;\n\n return (\n <li>\n <RACLink\n {...props}\n className={clsx('cim-tab-item', 'cim-link-tab-item', UNSAFE_className)}\n style={UNSAFE_style}\n href={href}\n onPress={() => setCurrentHref(href)}\n aria-current={isCurrent ? 'page' : undefined}\n data-selected={isCurrent || undefined}\n isDisabled={isDisabled || isGroupDisabled}\n >\n {iconStart}\n <Text as=\"span\" variant=\"medium-semibold\" alignment=\"center\">\n {children}\n </Text>\n {badge}\n </RACLink>\n </li>\n );\n}\n\nLinkTab.displayName = 'LinkTab';\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import type { ReactNode } from 'react';
|
|
2
|
-
import { type MenuItemProps as RACMenuItemProps, type
|
|
1
|
+
import type { ReactNode, UIEventHandler } from 'react';
|
|
2
|
+
import { type MenuItemProps as RACMenuItemProps, type MenuTriggerProps as RACMenuTriggerProps } from 'react-aria-components';
|
|
3
3
|
import type { CollectionItem, CollectionProps, Key, NavigationProps, StringLikeChildren } from '../types.js';
|
|
4
4
|
export interface MenuRootProps extends Pick<RACMenuTriggerProps, 'onOpenChange' | 'isOpen' | 'defaultOpen'> {
|
|
5
5
|
/** The menu trigger with its associated menu. Provide the trigger as the first child, and the menu as the second child. */
|
|
@@ -14,9 +14,11 @@ export declare function MenuRoot(props: MenuRootProps): import("react/jsx-runtim
|
|
|
14
14
|
export declare namespace MenuRoot {
|
|
15
15
|
var displayName: string;
|
|
16
16
|
}
|
|
17
|
-
export interface MenuProps<T extends CollectionItem = CollectionItem> extends CollectionProps<T
|
|
17
|
+
export interface MenuProps<T extends CollectionItem = CollectionItem> extends CollectionProps<T> {
|
|
18
18
|
/** Handler that is called when an item is selected. When using `onAction`, all items must have an `id` prop defined. */
|
|
19
19
|
onAction?: (key: Key) => void;
|
|
20
|
+
/** Handler that is called when the list of items is scrolled. */
|
|
21
|
+
onScroll?: UIEventHandler<HTMLDivElement>;
|
|
20
22
|
}
|
|
21
23
|
/** Displays a collapsible list of options and actions that users can choose from. */
|
|
22
24
|
export declare function Menu<T extends CollectionItem>(props: MenuProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"menu.d.ts","sourceRoot":"","sources":["../../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AACvD,OAAO,EAKL,KAAK,aAAa,IAAI,gBAAgB,EAGtC,KAAK,gBAAgB,IAAI,mBAAmB,EAE7C,MAAM,uBAAuB,CAAC;AAG/B,OAAO,KAAK,EAAE,cAAc,EAAE,eAAe,EAAE,GAAG,EAAE,eAAe,EAAE,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAG7G,MAAM,WAAW,aAAc,SAAQ,IAAI,CAAC,mBAAmB,EAAE,cAAc,GAAG,QAAQ,GAAG,aAAa,CAAC;IACzG,2HAA2H;IAC3H,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;;GAIG;AACH,wBA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I,EAAE,GAAG,KAAK,EAAE,EAAE,aAAa,2CA4BhF;yBA5Be,QAAQ"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;
|
|
1
|
+
{"version":3,"file":"menu.js","sourceRoot":"","sources":["../../../../src/components/menu/menu.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AA8Bb,4BAEC;AAYD,oBAcC;AAYD,kCAaC;AAkBD,4BA4BC;;AA/HD,gDAAwB;AAExB,iEAU+B;AAC/B,mEAA4D;AAC5D,0FAAmF;AAEnF,qDAAmD;AAOnD;;;;GAIG;AACH,SAAgB,QAAQ,CAAC,KAAoB;IAC3C,OAAO,uBAAC,mCAAc,OAAK,KAAK,GAAI,CAAC;AACvC,CAAC;AAED,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC;AASlC,qFAAqF;AACrF,SAAgB,IAAI,CAA2B,KAAmB;IAChE,IAAI,CAAC,IAAA,+BAAY,GAAE,IAAI,KAAK,CAAC,KAAK,IAAI,IAAI,IAAI,OAAO,KAAK,CAAC,QAAQ,KAAK,UAAU,EAAE,CAAC;QACnF,OAAO,CAAC,IAAI,CAAC,qEAAqE,CAAC,CAAC;IACtF,CAAC;IAED,OAAO,CACL,uBAAC,qCAAe,IACd,SAAS,EAAC,cAAc,EACxB,MAAM,EAAE,CAAC,EACT,SAAS,EAAE,GAAG,YAEd,uBAAC,4BAAO,OAAK,KAAK,EAAE,SAAS,EAAC,UAAU,GAAG,GAC3B,CACnB,CAAC;AACJ,CAAC;AAED,IAAI,CAAC,WAAW,GAAG,MAAM,CAAC;AAS1B,sDAAsD;AACtD,SAAgB,WAAW,CAA2B,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAuB;IAC7G,IAAI,CAAC,IAAA,+BAAY,GAAE,IAAI,KAAK,IAAI,IAAI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AAI,CACd,uBAAC,4BAAO,IACN,IAAI,EAAC,aAAa,EAClB,SAAS,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,YAEhF,WAAW,GACJ,CACX,IACG,IACL,CACJ,GACW,CACf,CAAC;AACJ,CAAC;AAED,QAAQ,CAAC,WAAW,GAAG,UAAU,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ReactNode, UIEventHandler } from 'react';\nimport {\n Collection as RACCollection,\n Header as RACHeader,\n Menu as RACMenu,\n MenuItem as RACMenuItem,\n type MenuItemProps as RACMenuItemProps,\n MenuSection as RACMenuSection,\n MenuTrigger as RACMenuTrigger,\n type MenuTriggerProps as RACMenuTriggerProps,\n Text as RACText,\n} from 'react-aria-components';\nimport { isProduction } from '../../utils/is-production.js';\nimport { CollapsibleList } from '../internal/collapsible-list/collapsible-list.js';\nimport type { CollectionItem, CollectionProps, Key, NavigationProps, StringLikeChildren } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface MenuRootProps extends Pick<RACMenuTriggerProps, 'onOpenChange' | 'isOpen' | 'defaultOpen'> {\n /** The menu trigger with its associated menu. Provide the trigger as the first child, and the menu as the second child. */\n children: ReactNode;\n}\n\n/**\n * Encapsulates a menu trigger and its associated menu. The trigger can be any Cimpress UI button, and the menu will be displayed when the trigger is activated.\n *\n * See [menu usage guidelines](https://ui.cimpress.io/components/menu/).\n */\nexport function MenuRoot(props: MenuRootProps) {\n return <RACMenuTrigger {...props} />;\n}\n\nMenuRoot.displayName = 'MenuRoot';\n\nexport interface MenuProps<T extends CollectionItem = CollectionItem> extends CollectionProps<T> {\n /** Handler that is called when an item is selected. When using `onAction`, all items must have an `id` prop defined. */\n onAction?: (key: Key) => void;\n /** Handler that is called when the list of items is scrolled. */\n onScroll?: UIEventHandler<HTMLDivElement>;\n}\n\n/** Displays a collapsible list of options and actions that users can choose from. */\nexport function Menu<T extends CollectionItem>(props: MenuProps<T>) {\n if (!isProduction() && props.items != null && typeof props.children !== 'function') {\n console.warn('`Menu` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <CollapsibleList\n placement=\"bottom start\"\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n <RACMenu {...props} className=\"cim-menu\" />\n </CollapsibleList>\n );\n}\n\nMenu.displayName = 'Menu';\n\nexport interface MenuSectionProps<T extends CollectionItem = CollectionItem> extends CollectionProps<T> {\n /** The ID of the section. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the section title. */\n title: string;\n}\n\n/** Groups list items within `Menu` into a section. */\nexport function MenuSection<T extends CollectionItem>({ title, children, items, ...props }: MenuSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`MenuSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACMenuSection {...props} className=\"cim-menu-section\">\n <RACHeader className={clsx('cim-menu-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}>\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACMenuSection>\n );\n}\n\nMenuSection.displayName = 'MenuSection';\n\nexport interface MenuItemProps\n extends NavigationProps,\n Pick<RACMenuItemProps, 'isDisabled' | 'onAction' | 'onHoverStart' | 'onHoverEnd'> {\n /** The ID of the item. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the label. */\n children: StringLikeChildren;\n /** Additional description for the menu item. */\n description?: string;\n /** An icon representing the menu item. */\n icon?: ReactNode;\n}\n\n/** Renders a single list item within `Menu`. */\nexport function MenuItem({ children, description, icon, ...props }: MenuItemProps) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACMenuItem {...props} className=\"cim-menu-item\" textValue={textValue}>\n {({ isDisabled }) => (\n <>\n {icon}\n\n <div className=\"cim-menu-item-text\">\n <RACText slot=\"label\" className={textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n\n {description && (\n <RACText\n slot=\"description\"\n className={textStyle({ variant: 'small', tone: isDisabled ? 'muted' : 'subtle' })}\n >\n {description}\n </RACText>\n )}\n </div>\n </>\n )}\n </RACMenuItem>\n );\n}\n\nMenuItem.displayName = 'MenuItem';\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type NumberFieldProps as RACNumberFieldProps } from 'react-aria-components';
|
|
2
|
-
import type { CommonProps, FieldWithPlaceholderProps } from '../types.js';
|
|
3
|
-
export interface NumberFieldProps extends CommonProps, FieldWithPlaceholderProps<number>, Pick<RACNumberFieldProps, 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'autoFocus' | 'minValue' | 'maxValue' | 'step' | 'formatOptions' | 'onFocus' | 'onBlur' | 'onKeyDown'> {
|
|
2
|
+
import type { ApiProps, CommonProps, FieldWithPlaceholderProps } from '../types.js';
|
|
3
|
+
export interface NumberFieldProps extends CommonProps, FieldWithPlaceholderProps<number>, ApiProps<NumberFieldApi>, Pick<RACNumberFieldProps, 'isDisabled' | 'isRequired' | 'isInvalid' | 'isReadOnly' | 'autoFocus' | 'minValue' | 'maxValue' | 'step' | 'formatOptions' | 'onFocus' | 'onBlur' | 'onKeyDown'> {
|
|
4
4
|
/** The current value (controlled). A `null` value means an empty field. */
|
|
5
5
|
value?: number | null;
|
|
6
6
|
/** The default value (uncontrolled). A `null` value means an empty field. */
|
|
@@ -8,6 +8,13 @@ export interface NumberFieldProps extends CommonProps, FieldWithPlaceholderProps
|
|
|
8
8
|
/** Handler that is called when the value changes. A `null` value means an empty field. */
|
|
9
9
|
onChange?: (value: number | null) => void;
|
|
10
10
|
}
|
|
11
|
+
/** The imperative API exposed by the `NumberField` component. */
|
|
12
|
+
export interface NumberFieldApi {
|
|
13
|
+
/** Focuses the input field. */
|
|
14
|
+
focus: () => void;
|
|
15
|
+
/** Selects the contents of the input field. */
|
|
16
|
+
select: () => void;
|
|
17
|
+
}
|
|
11
18
|
/**
|
|
12
19
|
* Allows users to edit a number with a keyboard or increment/decrement buttons.
|
|
13
20
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-field.d.ts","sourceRoot":"","sources":["../../../../src/components/number-field/number-field.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,KAAK,gBAAgB,IAAI,mBAAmB,EAE7C,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,WAAW,EAAE,yBAAyB,EAAE,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"number-field.d.ts","sourceRoot":"","sources":["../../../../src/components/number-field/number-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,SAAQ,WAAW,EACjB,yBAAyB,CAAC,MAAM,CAAC,EACjC,QAAQ,CAAC,cAAc,CAAC,EACxB,IAAI,CACF,mBAAmB,EACjB,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,YAAY,GACZ,WAAW,GACX,UAAU,GACV,UAAU,GACV,MAAM,GACN,eAAe,GACf,SAAS,GACT,QAAQ,GACR,WAAW,CACd;IACH,2EAA2E;IAC3E,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,6EAA6E;IAC7E,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAC7B,0FAA0F;IAC1F,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,KAAK,IAAI,CAAC;CAC3C;AAED,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;AAqFD;;;;GAIG;AACH,QAAA,MAAM,YAAY,kKAAyD,CAAC;AAE5E,OAAO,EAAE,YAAY,IAAI,WAAW,EAAE,CAAC"}
|
|
@@ -7,6 +7,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.NumberField = void 0;
|
|
8
8
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
9
9
|
const clsx_1 = __importDefault(require("clsx"));
|
|
10
|
+
const react_1 = require("react");
|
|
10
11
|
const react_aria_components_1 = require("react-aria-components");
|
|
11
12
|
const forward_ref_js_1 = require("../../forward-ref.js");
|
|
12
13
|
const index_js_1 = require("../../i18n/index.js");
|
|
@@ -16,7 +17,8 @@ const with_style_props_js_1 = require("../../with-style-props.js");
|
|
|
16
17
|
const icon_button_js_1 = require("../button/icon-button.js");
|
|
17
18
|
const form_field_js_1 = require("../internal/form-field/form-field.js");
|
|
18
19
|
const utils_js_1 = require("../typography/utils.js");
|
|
19
|
-
function NumberField({ label, description, error: errorMessage, placeholder, UNSAFE_className, UNSAFE_style, value, defaultValue, onChange, ...props }, ref) {
|
|
20
|
+
function NumberField({ label, description, error: errorMessage, placeholder, UNSAFE_className, UNSAFE_style, value, defaultValue, onChange, apiRef, ...props }, ref) {
|
|
21
|
+
const inputRef = (0, react_1.useRef)(null);
|
|
20
22
|
const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
|
|
21
23
|
(0, use_production_warning_js_1.useProductionWarning)(() => {
|
|
22
24
|
if (!label && !ariaLabel && !ariaLabelledBy) {
|
|
@@ -24,11 +26,15 @@ function NumberField({ label, description, error: errorMessage, placeholder, UNS
|
|
|
24
26
|
}
|
|
25
27
|
}, [label, ariaLabel, ariaLabelledBy]);
|
|
26
28
|
const messages = (0, index_js_1.useLocalizedMessages)('numberField');
|
|
29
|
+
(0, react_1.useImperativeHandle)(apiRef, () => ({
|
|
30
|
+
focus: () => inputRef.current?.focus(),
|
|
31
|
+
select: () => inputRef.current?.select(),
|
|
32
|
+
}), []);
|
|
27
33
|
return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.NumberField, { ...props, ref: ref, className: (0, clsx_1.default)('cim-number-field', UNSAFE_className), style: UNSAFE_style,
|
|
28
34
|
// NumberField uses `NaN` to signify an empty value, which is unintuitive
|
|
29
35
|
// https://github.com/adobe/react-spectrum/issues/5524
|
|
30
36
|
// https://github.com/adobe/react-spectrum/issues/6971
|
|
31
|
-
value: value === null ? Number.NaN : value, defaultValue: defaultValue === null ? Number.NaN : defaultValue, onChange: onChange ? (value) => onChange(Number.isNaN(value) ? null : value) : undefined, 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-number-field-input-group", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Input, { className: (0, clsx_1.default)('cim-number-field-input', (0, utils_js_1.textStyle)({ variant: 'body' })), placeholder: placeholder }), (0, jsx_runtime_1.jsxs)("div", { className: "cim-number-field-spinner", children: [(0, jsx_runtime_1.jsx)(icon_button_js_1.IconButton, { slot: "decrement", icon: (0, jsx_runtime_1.jsx)(index_js_2.IconSubtract, {}), "aria-label": messages.format('decrement'), variant: "tertiary", size: "small" }), (0, jsx_runtime_1.jsx)("div", { className: "cim-number-field-spinner-separator" }), (0, jsx_runtime_1.jsx)(icon_button_js_1.IconButton, { slot: "increment", icon: (0, jsx_runtime_1.jsx)(index_js_2.IconAdd, {}), "aria-label": messages.format('increment'), variant: "tertiary", size: "small" })] })] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: errorMessage }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description })] }));
|
|
37
|
+
value: value === null ? Number.NaN : value, defaultValue: defaultValue === null ? Number.NaN : defaultValue, onChange: onChange ? (value) => onChange(Number.isNaN(value) ? null : value) : undefined, 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-number-field-input-group", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Input, { ref: inputRef, className: (0, clsx_1.default)('cim-number-field-input', (0, utils_js_1.textStyle)({ variant: 'body' })), placeholder: placeholder }), (0, jsx_runtime_1.jsxs)("div", { className: "cim-number-field-spinner", children: [(0, jsx_runtime_1.jsx)(icon_button_js_1.IconButton, { slot: "decrement", icon: (0, jsx_runtime_1.jsx)(index_js_2.IconSubtract, {}), "aria-label": messages.format('decrement'), variant: "tertiary", size: "small" }), (0, jsx_runtime_1.jsx)("div", { className: "cim-number-field-spinner-separator" }), (0, jsx_runtime_1.jsx)(icon_button_js_1.IconButton, { slot: "increment", icon: (0, jsx_runtime_1.jsx)(index_js_2.IconAdd, {}), "aria-label": messages.format('increment'), variant: "tertiary", size: "small" })] })] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: errorMessage }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description })] }));
|
|
32
38
|
}
|
|
33
39
|
/**
|
|
34
40
|
* Allows users to edit a number with a keyboard or increment/decrement buttons.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"number-field.js","sourceRoot":"","sources":["../../../../src/components/number-field/number-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;
|
|
1
|
+
{"version":3,"file":"number-field.js","sourceRoot":"","sources":["../../../../src/components/number-field/number-field.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;;AAEb,gDAAwB;AACxB,iCAAuE;AACvE,iEAK+B;AAC/B,yDAAkD;AAClD,kDAA2D;AAC3D,mDAA6D;AAC7D,qFAA6E;AAC7E,mEAA2D;AAC3D,6DAAsD;AACtD,wEAA4G;AAE5G,qDAAmD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,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 NumberField as RACNumberField,\n type NumberFieldProps as RACNumberFieldProps,\n Group as RACGroup,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconAdd, IconSubtract } from '../../icons/index.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { IconButton } from '../button/icon-button.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport type { ApiProps, CommonProps, FieldWithPlaceholderProps } from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nexport interface NumberFieldProps\n extends CommonProps,\n FieldWithPlaceholderProps<number>,\n ApiProps<NumberFieldApi>,\n Pick<\n RACNumberFieldProps,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'isReadOnly'\n | 'autoFocus'\n | 'minValue'\n | 'maxValue'\n | 'step'\n | 'formatOptions'\n | 'onFocus'\n | 'onBlur'\n | 'onKeyDown'\n > {\n /** The current value (controlled). A `null` value means an empty field. */\n value?: number | null;\n /** The default value (uncontrolled). A `null` value means an empty field. */\n defaultValue?: number | null;\n /** Handler that is called when the value changes. A `null` value means an empty field. */\n onChange?: (value: number | null) => void;\n}\n\n/** The imperative API exposed by the `NumberField` component. */\nexport interface NumberFieldApi {\n /** Focuses the input field. */\n focus: () => void;\n /** Selects the contents of the input field. */\n select: () => void;\n}\n\nfunction NumberField(\n {\n label,\n description,\n error: errorMessage,\n placeholder,\n UNSAFE_className,\n UNSAFE_style,\n value,\n defaultValue,\n onChange,\n apiRef,\n ...props\n }: NumberFieldProps,\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('NumberField requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n const messages = useLocalizedMessages('numberField');\n\n useImperativeHandle(\n apiRef,\n () => ({\n focus: () => inputRef.current?.focus(),\n select: () => inputRef.current?.select(),\n }),\n [],\n );\n\n return (\n <RACNumberField\n {...props}\n ref={ref}\n className={clsx('cim-number-field', UNSAFE_className)}\n style={UNSAFE_style}\n // NumberField uses `NaN` to signify an empty value, which is unintuitive\n // https://github.com/adobe/react-spectrum/issues/5524\n // https://github.com/adobe/react-spectrum/issues/6971\n value={value === null ? Number.NaN : value}\n defaultValue={defaultValue === null ? Number.NaN : defaultValue}\n onChange={onChange ? (value) => onChange(Number.isNaN(value) ? null : value) : undefined}\n >\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACGroup className=\"cim-number-field-input-group\">\n <RACInput\n ref={inputRef}\n className={clsx('cim-number-field-input', textStyle({ variant: 'body' }))}\n placeholder={placeholder}\n />\n <div className=\"cim-number-field-spinner\">\n <IconButton\n slot=\"decrement\"\n icon={<IconSubtract />}\n aria-label={messages.format('decrement')}\n variant=\"tertiary\"\n size=\"small\"\n />\n <div className=\"cim-number-field-spinner-separator\" />\n <IconButton\n slot=\"increment\"\n icon={<IconAdd />}\n aria-label={messages.format('increment')}\n variant=\"tertiary\"\n size=\"small\"\n />\n </div>\n </RACGroup>\n <FormFieldError>{errorMessage}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n </RACNumberField>\n );\n}\n\n/**\n * Allows users to edit a number with a keyboard or increment/decrement buttons.\n *\n * See [number field usage guidelines](https://ui.cimpress.io/components/number-field/).\n */\nconst _NumberField = withStyleProps(forwardRef(NumberField), 'NumberField');\n\nexport { _NumberField as NumberField };\n"]}
|
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
import { type
|
|
2
|
-
import type
|
|
3
|
-
|
|
1
|
+
import { type UIEventHandler } from 'react';
|
|
2
|
+
import { type ListBoxItemProps as RACListBoxItemProps, type SelectProps as RACSelectProps } from 'react-aria-components';
|
|
3
|
+
import type { ApiProps, AsyncItemLoadingProps, CollectionItem, CollectionProps, CommonProps, FieldProps, Key, StringLikeChildren } from '../types.js';
|
|
4
|
+
export interface SelectProps<T extends CollectionItem = CollectionItem> extends CommonProps, FieldProps<Key>, CollectionProps<T>, AsyncItemLoadingProps, ApiProps<SelectApi>, Pick<RACSelectProps<T>, 'isDisabled' | 'isRequired' | 'isInvalid' | 'selectedKey' | 'defaultSelectedKey' | 'autoComplete' | 'autoFocus' | 'onSelectionChange' | 'placeholder' | 'onFocus' | 'onBlur' | 'onOpenChange'> {
|
|
4
5
|
/**
|
|
5
6
|
* Whether the list of options should be virtualized. Use this as a performance optimization for large lists.
|
|
6
7
|
* @default false
|
|
7
8
|
*/
|
|
8
9
|
isVirtualized?: boolean;
|
|
10
|
+
/** Handler that is called when the list of items is scrolled. */
|
|
11
|
+
onScroll?: UIEventHandler<HTMLDivElement>;
|
|
12
|
+
}
|
|
13
|
+
/** The imperative API exposed by the `Select` component. */
|
|
14
|
+
export interface SelectApi {
|
|
15
|
+
/** Focuses the trigger button and opens the list of items. */
|
|
16
|
+
focus: () => void;
|
|
9
17
|
}
|
|
10
18
|
/**
|
|
11
19
|
* Allows users to select one item from a collapsible list.
|
|
@@ -14,7 +22,9 @@ export interface SelectProps<T extends CollectionItem = CollectionItem> extends
|
|
|
14
22
|
*/
|
|
15
23
|
declare const _Select: <T extends CollectionItem>(props: SelectProps<T> & import("react").RefAttributes<HTMLDivElement> & import("../../with-style-props.js").StyleProps) => import("react").JSX.Element | null;
|
|
16
24
|
export { _Select as Select };
|
|
17
|
-
export interface SelectItemProps extends Pick<RACListBoxItemProps, '
|
|
25
|
+
export interface SelectItemProps extends Pick<RACListBoxItemProps, 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {
|
|
26
|
+
/** The ID of the item. Has to be unique across all sections and items. */
|
|
27
|
+
id?: Key;
|
|
18
28
|
/** The content to display as the label. */
|
|
19
29
|
children: StringLikeChildren;
|
|
20
30
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAqB,KAAK,cAAc,EAA+B,MAAM,OAAO,CAAC;AAC5F,OAAO,EAaL,KAAK,gBAAgB,IAAI,mBAAmB,EAC5C,KAAK,WAAW,IAAI,cAAc,EAEnC,MAAM,uBAAuB,CAAC;AAW/B,OAAO,KAAK,EACV,QAAQ,EACR,qBAAqB,EACrB,cAAc,EACd,eAAe,EACf,WAAW,EACX,UAAU,EACV,GAAG,EACH,kBAAkB,EACnB,MAAM,aAAa,CAAC;AAWrB,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,cAAc,GAAG,cAAc,CACpE,SAAQ,WAAW,EACjB,UAAU,CAAC,GAAG,CAAC,EACf,eAAe,CAAC,CAAC,CAAC,EAClB,qBAAqB,EACrB,QAAQ,CAAC,SAAS,CAAC,EACnB,IAAI,CACF,cAAc,CAAC,CAAC,CAAC,EACf,YAAY,GACZ,YAAY,GACZ,WAAW,GACX,aAAa,GACb,oBAAoB,GACpB,cAAc,GACd,WAAW,GACX,mBAAmB,GACnB,aAAa,GACb,SAAS,GACT,QAAQ,GACR,cAAc,CACjB;IACH;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,iEAAiE;IACjE,QAAQ,CAAC,EAAE,cAAc,CAAC,cAAc,CAAC,CAAC;CAC3C;AAED,4DAA4D;AAC5D,MAAM,WAAW,SAAS;IACxB,8DAA8D;IAC9D,KAAK,EAAE,MAAM,IAAI,CAAC;CACnB;AA0FD;;;;GAIG;AACH,QAAA,MAAM,OAAO,GA7FG,CAAC,SAAS,cAAc,+JA6FoB,CAAC;AAE7D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,CAAC;AAE7B,MAAM,WAAW,eAAgB,SAAQ,IAAI,CAAC,mBAAmB,EAAE,YAAY,GAAG,cAAc,GAAG,YAAY,CAAC;IAC9G,0EAA0E;IAC1E,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,2CAA2C;IAC3C,QAAQ,EAAE,kBAAkB,CAAC;CAC9B;AAED,kDAAkD;AAClD,wBAAgB,UAAU,CAAC,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,EAAE,eAAe,2CAgBjE;yBAhBe,UAAU;;;AAoB1B,MAAM,WAAW,kBAAkB,CAAC,CAAC,SAAS,cAAc,CAAE,SAAQ,eAAe,CAAC,CAAC,CAAC;IACtF,6EAA6E;IAC7E,EAAE,CAAC,EAAE,GAAG,CAAC;IACT,mDAAmD;IACnD,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wDAAwD;AACxD,wBAAgB,aAAa,CAAC,CAAC,SAAS,cAAc,EAAE,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,GAAG,KAAK,EAAE,EAAE,kBAAkB,CAAC,CAAC,CAAC,2CAelH;yBAfe,aAAa"}
|
|
@@ -9,11 +9,13 @@ exports.SelectItem = SelectItem;
|
|
|
9
9
|
exports.SelectSection = SelectSection;
|
|
10
10
|
const jsx_runtime_1 = require("react/jsx-runtime");
|
|
11
11
|
const clsx_1 = __importDefault(require("clsx"));
|
|
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");
|
|
14
15
|
const index_js_1 = require("../../i18n/index.js");
|
|
15
16
|
const index_js_2 = require("../../icons/index.js");
|
|
16
17
|
const is_production_js_1 = require("../../utils/is-production.js");
|
|
18
|
+
const string_like_children_to_string_js_1 = require("../../utils/string-like-children-to-string.js");
|
|
17
19
|
const use_production_warning_js_1 = require("../../utils/use-production-warning.js");
|
|
18
20
|
const with_style_props_js_1 = require("../../with-style-props.js");
|
|
19
21
|
const collapsible_list_js_1 = require("../internal/collapsible-list/collapsible-list.js");
|
|
@@ -27,7 +29,8 @@ const VIRTUAL_LAYOUT_OPTIONS = {
|
|
|
27
29
|
padding: 0,
|
|
28
30
|
gap: 0,
|
|
29
31
|
};
|
|
30
|
-
function Select({ children, items, label, description, error, UNSAFE_className, UNSAFE_style, onScroll, isVirtualized = false, UNSTABLE_isLoading: isLoading, UNSTABLE_onLoadMore: onLoadMore, ...props }, ref) {
|
|
32
|
+
function Select({ children, items, label, description, error, UNSAFE_className, UNSAFE_style, onScroll, isVirtualized = false, apiRef, UNSTABLE_isLoading: isLoading, UNSTABLE_onLoadMore: onLoadMore, ...props }, ref) {
|
|
33
|
+
const triggerRef = (0, react_1.useRef)(null);
|
|
31
34
|
const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;
|
|
32
35
|
(0, use_production_warning_js_1.useProductionWarning)(() => {
|
|
33
36
|
if (!label && !ariaLabel && !ariaLabelledBy) {
|
|
@@ -38,8 +41,11 @@ function Select({ children, items, label, description, error, UNSAFE_className,
|
|
|
38
41
|
console.warn('`Select` requires `children` to be a function when using `items` prop');
|
|
39
42
|
}
|
|
40
43
|
const collectionMessages = (0, index_js_1.useLocalizedMessages)('UNSTABLE_collection');
|
|
44
|
+
(0, react_1.useImperativeHandle)(apiRef, () => ({
|
|
45
|
+
focus: () => triggerRef.current?.focus(),
|
|
46
|
+
}), []);
|
|
41
47
|
const listBox = ((0, jsx_runtime_1.jsxs)(react_aria_components_1.ListBox, { className: "cim-select-listbox", onScroll: onScroll, renderEmptyState: () => isLoading ? (0, jsx_runtime_1.jsx)(spinner_js_1.Spinner, { "aria-label": collectionMessages.format('loading'), size: "small", marginY: 8 }) : null, children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.Collection, { items: items, children: children }), (0, jsx_runtime_1.jsx)(react_aria_components_1.ListBoxLoadMoreItem, { onLoadMore: onLoadMore, isLoading: isLoading, children: (0, jsx_runtime_1.jsx)(spinner_js_1.Spinner, { "aria-label": collectionMessages.format('loadingMore'), size: "small", marginY: 8 }) })] }));
|
|
42
|
-
return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.Select, { ...props, ref: ref, className: (0, clsx_1.default)('cim-select', UNSAFE_className), style: UNSAFE_style, 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.Button, { className: "cim-select-button", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.SelectValue, { className: (values) => (0, clsx_1.default)(values.defaultClassName, (0, utils_js_1.textStyle)({ variant: 'body', alignment: 'start' })), children: ({ selectedText }) => selectedText }), (0, jsx_runtime_1.jsx)(index_js_2.IconChevronDown, {})] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: error }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description }), (0, jsx_runtime_1.jsx)(collapsible_list_js_1.CollapsibleList, { offset: 5, maxHeight: 315, children: isVirtualized ? ((0, jsx_runtime_1.jsx)(react_aria_components_1.Virtualizer, { layout: react_aria_components_1.ListLayout, layoutOptions: VIRTUAL_LAYOUT_OPTIONS, children: listBox })) : (listBox) })] }));
|
|
48
|
+
return ((0, jsx_runtime_1.jsxs)(react_aria_components_1.Select, { ...props, ref: ref, className: (0, clsx_1.default)('cim-select', UNSAFE_className), style: UNSAFE_style, 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.Button, { ref: triggerRef, className: "cim-select-button", children: [(0, jsx_runtime_1.jsx)(react_aria_components_1.SelectValue, { className: (values) => (0, clsx_1.default)(values.defaultClassName, (0, utils_js_1.textStyle)({ variant: 'body', alignment: 'start' })), children: ({ selectedText }) => selectedText }), (0, jsx_runtime_1.jsx)(index_js_2.IconChevronDown, {})] }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldError, { children: error }), (0, jsx_runtime_1.jsx)(form_field_js_1.FormFieldDescription, { children: description }), (0, jsx_runtime_1.jsx)(collapsible_list_js_1.CollapsibleList, { offset: 5, maxHeight: 315, children: isVirtualized ? ((0, jsx_runtime_1.jsx)(react_aria_components_1.Virtualizer, { layout: react_aria_components_1.ListLayout, layoutOptions: VIRTUAL_LAYOUT_OPTIONS, children: listBox })) : (listBox) })] }));
|
|
43
49
|
}
|
|
44
50
|
/**
|
|
45
51
|
* Allows users to select one item from a collapsible list.
|
|
@@ -50,7 +56,7 @@ const _Select = (0, with_style_props_js_1.withStyleProps)((0, forward_ref_js_1.f
|
|
|
50
56
|
exports.Select = _Select;
|
|
51
57
|
/** Renders a single list item within `Select`. */
|
|
52
58
|
function SelectItem({ children, ...props }) {
|
|
53
|
-
const textValue =
|
|
59
|
+
const textValue = (0, string_like_children_to_string_js_1.stringLikeChildrenToString)(children);
|
|
54
60
|
return ((0, jsx_runtime_1.jsx)(react_aria_components_1.ListBoxItem, { ...props, className: "cim-select-item", textValue: textValue, children: ({ isDisabled }) => ((0, jsx_runtime_1.jsxs)(jsx_runtime_1.Fragment, { children: [(0, jsx_runtime_1.jsx)(index_js_2.IconCheck, {}), (0, jsx_runtime_1.jsx)(react_aria_components_1.Text, { slot: "label", className: (0, utils_js_1.textStyle)({ variant: 'body', tone: isDisabled ? 'muted' : 'base' }), children: children })] })) }));
|
|
55
61
|
}
|
|
56
62
|
SelectItem.displayName = 'SelectItem';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AA2Kb,gCAiBC;AAYD,sCAeC;;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I,KAAK,IAAI,IAAI,IAAI,OAAO,QAAQ,KAAK,UAAU,EAAE,CAAC;QACvE,OAAO,CAAC,IAAI,CAAC,8EAA8E,CAAC,CAAC;IAC/F,CAAC;IAED,OAAO,CACL,wBAAC,sCAAiB,OAAK,KAAK,EAAE,SAAS,EAAC,oBAAoB,aAC1D,uBAAC,8BAAS,IACR,SAAS,EAAE,IAAA,cAAI,EAAC,2BAA2B,EAAE,IAAA,oBAAS,EAAC,EAAE,OAAO,EAAE,gBAAgB,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC,YAErG,KAAK,GACI,EACZ,uBAAC,kCAAa,IAAC,KAAK,EAAE,KAAK,YAAG,QAAQ,GAAiB,IACrC,CACrB,CAAC;AACJ,CAAC;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport type { ForwardedRef } from 'react';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n Header as RACHeader,\n ListBox as RACListBox,\n type ListBoxProps as RACListBoxProps,\n ListBoxLoadMoreItem as RACListBoxLoadMoreItem,\n ListBoxItem as RACListBoxItem,\n ListBoxSection as RACListBoxSection,\n ListLayout as RACListLayout,\n type ListLayoutOptions as RACListLayoutOptions,\n Select as RACSelect,\n SelectValue as RACSelectValue,\n Text as RACText,\n type ListBoxItemProps as RACListBoxItemProps,\n type SelectProps as RACSelectProps,\n Virtualizer as RACVirtualizer,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconCheck, IconChevronDown } from '../../icons/index.js';\nimport { isProduction } from '../../utils/is-production.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { CollapsibleList } from '../internal/collapsible-list/collapsible-list.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport { Spinner } from '../spinner/spinner.js';\nimport type {\n AsyncItemLoadingProps,\n CollectionItem,\n CollectionProps,\n CommonProps,\n FieldProps,\n Key,\n StringLikeChildren,\n} from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nconst VIRTUAL_LAYOUT_OPTIONS: RACListLayoutOptions = {\n rowHeight: 40,\n headingHeight: 32,\n loaderHeight: 40,\n padding: 0,\n gap: 0,\n};\n\nexport interface SelectProps<T extends CollectionItem = CollectionItem>\n extends CommonProps,\n FieldProps<Key>,\n CollectionProps<T>,\n AsyncItemLoadingProps,\n Pick<\n RACSelectProps<T>,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'selectedKey'\n | 'defaultSelectedKey'\n | 'autoComplete'\n | 'autoFocus'\n | 'onSelectionChange'\n | 'placeholder'\n | 'onFocus'\n | 'onBlur'\n | 'onOpenChange'\n >,\n Pick<RACListBoxProps<T>, 'onScroll'> {\n /**\n * Whether the list of options should be virtualized. Use this as a performance optimization for large lists.\n * @default false\n */\n isVirtualized?: boolean;\n}\n\nfunction Select<T extends CollectionItem>(\n {\n children,\n items,\n label,\n description,\n error,\n UNSAFE_className,\n UNSAFE_style,\n onScroll,\n isVirtualized = false,\n UNSTABLE_isLoading: isLoading,\n UNSTABLE_onLoadMore: onLoadMore,\n ...props\n }: SelectProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('Select requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`Select` requires `children` to be a function when using `items` prop');\n }\n\n const collectionMessages = useLocalizedMessages('UNSTABLE_collection');\n\n const listBox = (\n <RACListBox\n className=\"cim-select-listbox\"\n onScroll={onScroll}\n renderEmptyState={() =>\n isLoading ? <Spinner aria-label={collectionMessages.format('loading')} size=\"small\" marginY={8} /> : null\n }\n >\n <RACCollection items={items}>{children}</RACCollection>\n <RACListBoxLoadMoreItem onLoadMore={onLoadMore} isLoading={isLoading}>\n <Spinner aria-label={collectionMessages.format('loadingMore')} size=\"small\" marginY={8} />\n </RACListBoxLoadMoreItem>\n </RACListBox>\n );\n\n return (\n <RACSelect {...props} ref={ref} className={clsx('cim-select', UNSAFE_className)} style={UNSAFE_style}>\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACButton className=\"cim-select-button\">\n <RACSelectValue\n className={(values) => clsx(values.defaultClassName, textStyle({ variant: 'body', alignment: 'start' }))}\n >\n {({ selectedText }) => selectedText}\n </RACSelectValue>\n <IconChevronDown />\n </RACButton>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <CollapsibleList\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n {isVirtualized ? (\n <RACVirtualizer layout={RACListLayout} layoutOptions={VIRTUAL_LAYOUT_OPTIONS}>\n {listBox}\n </RACVirtualizer>\n ) : (\n listBox\n )}\n </CollapsibleList>\n </RACSelect>\n );\n}\n\n/**\n * Allows users to select one item from a collapsible list.\n *\n * See [select usage guidelines](https://ui.cimpress.io/components/select/).\n */\nconst _Select = withStyleProps(forwardRef(Select), 'Select');\n\nexport { _Select as Select };\n\nexport interface SelectItemProps\n extends Pick<RACListBoxItemProps, 'id' | 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {\n /** The content to display as the label. */\n children: StringLikeChildren;\n}\n\n/** Renders a single list item within `Select`. */\nexport function SelectItem({ children, ...props }: SelectItemProps) {\n const textValue =\n typeof children === 'string' ? children : typeof children === 'number' ? String(children) : children.join('');\n\n return (\n <RACListBoxItem {...props} className=\"cim-select-item\" textValue={textValue}>\n {({ isDisabled }) => (\n <>\n <IconCheck />\n\n <RACText slot=\"label\" className={textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n </>\n )}\n </RACListBoxItem>\n );\n}\n\nSelectItem.displayName = 'SelectItem';\n\nexport interface SelectSectionProps<T extends CollectionItem> extends CollectionProps<T> {\n /** The ID of the section. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the section title. */\n title: string;\n}\n\n/** Groups list items within `Select` into a section. */\nexport function SelectSection<T extends CollectionItem>({ title, children, items, ...props }: SelectSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`SelectSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACListBoxSection {...props} className=\"cim-select-section\">\n <RACHeader\n className={clsx('cim-select-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}\n >\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACListBoxSection>\n );\n}\n\nSelectSection.displayName = 'SelectSection';\n"]}
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../../src/components/select/select.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;;AAgMb,gCAgBC;AAYD,sCAeC;;AAzOD,gDAAwB;AACxB,iCAA4F;AAC5F,iEAgB+B;AAC/B,yDAAkD;AAClD,kDAA2D;AAC3D,mDAAkE;AAClE,mEAA4D;AAC5D,qGAA2F;AAC3F,qFAA6E;AAC7E,mEAA2D;AAC3D,0FAAmF;AACnF,wEAA4G;AAC5G,sDAAgD;AAWhD,qDAAmD;AAEnD,MAAM,sBAAsB,GAAyB;IACnD,SAAS,EAAE,EAAE;IACb,aAAa,EAAE,EAAE;IACjB,YAAY,EAAE,EAAE;IAChB,OAAO,EAAE,CAAC;IACV,GAAG,EAAE,CAAC;CACP,CAAC;AAsCF,SAAS,MAAM,CACb,EACE,QAAQ,EACR,KAAK,EACL,KAAK,EACL,WAAW,EACX,KAAK,EACL,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,aAAa,GAAG,KAAK,EACrB,MAAM,EACN,kBAAkB,EAAE,SAAS,EAC7B,m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,QAAQ,GAAiB,IACrC,CACrB,CAAC;AACJ,CAAC;AAED,aAAa,CAAC,WAAW,GAAG,eAAe,CAAC","sourcesContent":["'use client';\n\nimport clsx from 'clsx';\nimport { type ForwardedRef, type UIEventHandler, useImperativeHandle, useRef } from 'react';\nimport {\n Button as RACButton,\n Collection as RACCollection,\n Header as RACHeader,\n ListBox as RACListBox,\n ListBoxLoadMoreItem as RACListBoxLoadMoreItem,\n ListBoxItem as RACListBoxItem,\n ListBoxSection as RACListBoxSection,\n ListLayout as RACListLayout,\n type ListLayoutOptions as RACListLayoutOptions,\n Select as RACSelect,\n SelectValue as RACSelectValue,\n Text as RACText,\n type ListBoxItemProps as RACListBoxItemProps,\n type SelectProps as RACSelectProps,\n Virtualizer as RACVirtualizer,\n} from 'react-aria-components';\nimport { forwardRef } from '../../forward-ref.js';\nimport { useLocalizedMessages } from '../../i18n/index.js';\nimport { IconCheck, IconChevronDown } from '../../icons/index.js';\nimport { isProduction } from '../../utils/is-production.js';\nimport { stringLikeChildrenToString } from '../../utils/string-like-children-to-string.js';\nimport { useProductionWarning } from '../../utils/use-production-warning.js';\nimport { withStyleProps } from '../../with-style-props.js';\nimport { CollapsibleList } from '../internal/collapsible-list/collapsible-list.js';\nimport { FormFieldDescription, FormFieldError, FormFieldLabel } from '../internal/form-field/form-field.js';\nimport { Spinner } from '../spinner/spinner.js';\nimport type {\n ApiProps,\n AsyncItemLoadingProps,\n CollectionItem,\n CollectionProps,\n CommonProps,\n FieldProps,\n Key,\n StringLikeChildren,\n} from '../types.js';\nimport { textStyle } from '../typography/utils.js';\n\nconst VIRTUAL_LAYOUT_OPTIONS: RACListLayoutOptions = {\n rowHeight: 40,\n headingHeight: 32,\n loaderHeight: 40,\n padding: 0,\n gap: 0,\n};\n\nexport interface SelectProps<T extends CollectionItem = CollectionItem>\n extends CommonProps,\n FieldProps<Key>,\n CollectionProps<T>,\n AsyncItemLoadingProps,\n ApiProps<SelectApi>,\n Pick<\n RACSelectProps<T>,\n | 'isDisabled'\n | 'isRequired'\n | 'isInvalid'\n | 'selectedKey'\n | 'defaultSelectedKey'\n | 'autoComplete'\n | 'autoFocus'\n | 'onSelectionChange'\n | 'placeholder'\n | 'onFocus'\n | 'onBlur'\n | 'onOpenChange'\n > {\n /**\n * Whether the list of options should be virtualized. Use this as a performance optimization for large lists.\n * @default false\n */\n isVirtualized?: boolean;\n /** Handler that is called when the list of items is scrolled. */\n onScroll?: UIEventHandler<HTMLDivElement>;\n}\n\n/** The imperative API exposed by the `Select` component. */\nexport interface SelectApi {\n /** Focuses the trigger button and opens the list of items. */\n focus: () => void;\n}\n\nfunction Select<T extends CollectionItem>(\n {\n children,\n items,\n label,\n description,\n error,\n UNSAFE_className,\n UNSAFE_style,\n onScroll,\n isVirtualized = false,\n apiRef,\n UNSTABLE_isLoading: isLoading,\n UNSTABLE_onLoadMore: onLoadMore,\n ...props\n }: SelectProps<T>,\n ref: ForwardedRef<HTMLDivElement>,\n) {\n const triggerRef = useRef<HTMLButtonElement>(null);\n\n const { 'aria-label': ariaLabel, 'aria-labelledby': ariaLabelledBy } = props;\n\n useProductionWarning(() => {\n if (!label && !ariaLabel && !ariaLabelledBy) {\n console.warn('Select requires one of label / aria-label / aria-labelledby for accessibility');\n }\n }, [label, ariaLabel, ariaLabelledBy]);\n\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`Select` requires `children` to be a function when using `items` prop');\n }\n\n const collectionMessages = useLocalizedMessages('UNSTABLE_collection');\n\n useImperativeHandle(\n apiRef,\n () => ({\n focus: () => triggerRef.current?.focus(),\n }),\n [],\n );\n\n const listBox = (\n <RACListBox\n className=\"cim-select-listbox\"\n onScroll={onScroll}\n renderEmptyState={() =>\n isLoading ? <Spinner aria-label={collectionMessages.format('loading')} size=\"small\" marginY={8} /> : null\n }\n >\n <RACCollection items={items}>{children}</RACCollection>\n <RACListBoxLoadMoreItem onLoadMore={onLoadMore} isLoading={isLoading}>\n <Spinner aria-label={collectionMessages.format('loadingMore')} size=\"small\" marginY={8} />\n </RACListBoxLoadMoreItem>\n </RACListBox>\n );\n\n return (\n <RACSelect {...props} ref={ref} className={clsx('cim-select', UNSAFE_className)} style={UNSAFE_style}>\n <FormFieldLabel isRequired={props.isRequired} isDisabled={props.isDisabled}>\n {label}\n </FormFieldLabel>\n <RACButton ref={triggerRef} className=\"cim-select-button\">\n <RACSelectValue\n className={(values) => clsx(values.defaultClassName, textStyle({ variant: 'body', alignment: 'start' }))}\n >\n {({ selectedText }) => selectedText}\n </RACSelectValue>\n <IconChevronDown />\n </RACButton>\n <FormFieldError>{error}</FormFieldError>\n <FormFieldDescription>{description}</FormFieldDescription>\n <CollapsibleList\n offset={5} // 1px border + 4px actual offset\n maxHeight={315}\n >\n {isVirtualized ? (\n <RACVirtualizer layout={RACListLayout} layoutOptions={VIRTUAL_LAYOUT_OPTIONS}>\n {listBox}\n </RACVirtualizer>\n ) : (\n listBox\n )}\n </CollapsibleList>\n </RACSelect>\n );\n}\n\n/**\n * Allows users to select one item from a collapsible list.\n *\n * See [select usage guidelines](https://ui.cimpress.io/components/select/).\n */\nconst _Select = withStyleProps(forwardRef(Select), 'Select');\n\nexport { _Select as Select };\n\nexport interface SelectItemProps extends Pick<RACListBoxItemProps, 'isDisabled' | 'onHoverStart' | 'onHoverEnd'> {\n /** The ID of the item. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the label. */\n children: StringLikeChildren;\n}\n\n/** Renders a single list item within `Select`. */\nexport function SelectItem({ children, ...props }: SelectItemProps) {\n const textValue = stringLikeChildrenToString(children);\n\n return (\n <RACListBoxItem {...props} className=\"cim-select-item\" textValue={textValue}>\n {({ isDisabled }) => (\n <>\n <IconCheck />\n\n <RACText slot=\"label\" className={textStyle({ variant: 'body', tone: isDisabled ? 'muted' : 'base' })}>\n {children}\n </RACText>\n </>\n )}\n </RACListBoxItem>\n );\n}\n\nSelectItem.displayName = 'SelectItem';\n\nexport interface SelectSectionProps<T extends CollectionItem> extends CollectionProps<T> {\n /** The ID of the section. Has to be unique across all sections and items. */\n id?: Key;\n /** The content to display as the section title. */\n title: string;\n}\n\n/** Groups list items within `Select` into a section. */\nexport function SelectSection<T extends CollectionItem>({ title, children, items, ...props }: SelectSectionProps<T>) {\n if (!isProduction() && items != null && typeof children !== 'function') {\n console.warn('`SelectSection` requires `children` to be a function when using `items` prop');\n }\n\n return (\n <RACListBoxSection {...props} className=\"cim-select-section\">\n <RACHeader\n className={clsx('cim-select-section-header', textStyle({ variant: 'small-semibold', tone: 'subtle' }))}\n >\n {title}\n </RACHeader>\n <RACCollection items={items}>{children}</RACCollection>\n </RACListBoxSection>\n );\n}\n\nSelectSection.displayName = 'SelectSection';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/spacing/types.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE5E,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnD,yEAAyE;AACzE,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;AAEjG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,EACxE,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,YAAY,CAAC,EAAE,CAAC,GACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../../src/components/spacing/types.ts"],"names":[],"mappings":"AAAA,kEAAkE;AAClE,MAAM,MAAM,OAAO,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,CAAC;AAE5E,iEAAiE;AACjE,MAAM,MAAM,UAAU,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAAC;AAEnD,yEAAyE;AACzE,MAAM,MAAM,UAAU,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,IAAI,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,CAAC;AAEjG;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,wBAAgB,sBAAsB,CAAC,CAAC,SAAS,MAAM,GAAG,MAAM,GAAG,OAAO,EACxE,gBAAgB,EAAE,MAAM,EACxB,gBAAgB,EAAE,MAAM,EACxB,IAAI,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC,EACpB,YAAY,CAAC,EAAE,CAAC,GACf,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,SAAS,CAwBpC"}
|
|
@@ -34,10 +34,12 @@ function getResponsiveVariables(targetTokenGroup, sourceTokenGroup, data, defaul
|
|
|
34
34
|
[`--cim-${targetTokenGroup}-sm`]: `var(--cim-${sourceTokenGroup}-${data ?? defaultValue})`,
|
|
35
35
|
};
|
|
36
36
|
}
|
|
37
|
-
const result =
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
37
|
+
const result = defaultValue !== undefined
|
|
38
|
+
? {
|
|
39
|
+
// Default value in case the smallest breakpoint isn't defined
|
|
40
|
+
[`--cim-${targetTokenGroup}-sm`]: `var(--cim-${sourceTokenGroup}-${defaultValue})`,
|
|
41
|
+
}
|
|
42
|
+
: {};
|
|
41
43
|
Object.entries(data).forEach(([breakpoint, value]) => {
|
|
42
44
|
result[`--cim-${targetTokenGroup}-${breakpoint}`] = `var(--cim-${sourceTokenGroup}-${value})`;
|
|
43
45
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/spacing/types.ts"],"names":[],"mappings":";;AAiCA,
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/components/spacing/types.ts"],"names":[],"mappings":";;AAiCA,wDA6BC;AArDD;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AACH,SAAgB,sBAAsB,CACpC,gBAAwB,EACxB,gBAAwB,EACxB,IAAoB,EACpB,YAAgB;IAEhB,IAAI,IAAI,KAAK,SAAS,IAAI,YAAY,KAAK,SAAS,EAAE,CAAC;QACrD,OAAO,SAAS,CAAC;IACnB,CAAC;IAED,IAAI,OAAO,IAAI,KAAK,QAAQ,EAAE,CAAC;QAC7B,OAAO;YACL,CAAC,SAAS,gBAAgB,KAAK,CAAC,EAAE,aAAa,gBAAgB,IAAI,IAAI,IAAI,YAAY,GAAG;SAC3F,CAAC;IACJ,CAAC;IAED,MAAM,MAAM,GACV,YAAY,KAAK,SAAS;QACxB,CAAC,CAAC;YACE,8DAA8D;YAC9D,CAAC,SAAS,gBAAgB,KAAK,CAAC,EAAE,aAAa,gBAAgB,IAAI,YAAY,GAAG;SACnF;QACH,CAAC,CAAC,EAAE,CAAC;IAET,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,UAAU,EAAE,KAAK,CAAC,EAAE,EAAE;QACnD,MAAM,CAAC,SAAS,gBAAgB,IAAI,UAAU,EAAE,CAAC,GAAG,aAAa,gBAAgB,IAAI,KAAK,GAAG,CAAC;IAChG,CAAC,CAAC,CAAC;IAEH,OAAO,MAAM,CAAC;AAChB,CAAC","sourcesContent":["/** Represents a valid spacing amount within the design system. */\nexport type Spacing = 0 | 2 | 4 | 8 | 12 | 16 | 24 | 32 | 40 | 48 | 64 | 96;\n\n/** Represents a screen size breakpoint for responsive design. */\nexport type Breakpoint = 'sm' | 'md' | 'lg' | 'xl';\n\n/** Represents a primitive value that can change based on screen size. */\nexport type Responsive<T extends string | number | boolean> = T | Partial<Record<Breakpoint, T>>;\n\n/**\n * Given params like so:\n *\n * ```ts\n * (\n * 'box-ml',\n * 'space',\n * {\n * sm: 4,\n * lg: 6,\n * }\n * )\n * ```\n *\n * Creates an object like so:\n *\n * ```ts\n * {\n * '--cim-box-ml-sm': 'var(--cim-space-4)',\n * '--cim-box-ml-lg': 'var(--cim-space-6)',\n * }\n * ```\n *\n */\nexport function getResponsiveVariables<T extends string | number | boolean>(\n targetTokenGroup: string,\n sourceTokenGroup: string,\n data?: Responsive<T>,\n defaultValue?: T,\n): Record<string, string> | undefined {\n if (data === undefined && defaultValue === undefined) {\n return undefined;\n }\n\n if (typeof data !== 'object') {\n return {\n [`--cim-${targetTokenGroup}-sm`]: `var(--cim-${sourceTokenGroup}-${data ?? defaultValue})`,\n };\n }\n\n const result: Record<string, string> =\n defaultValue !== undefined\n ? {\n // Default value in case the smallest breakpoint isn't defined\n [`--cim-${targetTokenGroup}-sm`]: `var(--cim-${sourceTokenGroup}-${defaultValue})`,\n }\n : {};\n\n Object.entries(data).forEach(([breakpoint, value]) => {\n result[`--cim-${targetTokenGroup}-${breakpoint}`] = `var(--cim-${sourceTokenGroup}-${value})`;\n });\n\n return result;\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/components/stepper/context.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;iBACT,MAAM;eACR,MAAM;eACN,MAAM,IAAI;
|
|
1
|
+
{"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../../../src/components/stepper/context.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,WAAW;iBACT,UAAU,GAAG,YAAY;eAC3B,MAAM;iBACJ,MAAM;eACR,MAAM;eACN,MAAM,IAAI;EAMrB,CAAC"}
|
|
@@ -3,6 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.StepContext = void 0;
|
|
4
4
|
const react_1 = require("react");
|
|
5
5
|
exports.StepContext = (0, react_1.createContext)({
|
|
6
|
+
orientation: 'horizontal',
|
|
7
|
+
stepCount: 0,
|
|
6
8
|
currentStep: 0,
|
|
7
9
|
stepIndex: 0,
|
|
8
10
|
});
|