@cdx-ui/components 0.3.7 → 0.3.9

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.
Files changed (66) hide show
  1. package/docs/components/content.md +2 -1
  2. package/docs/components/country-flag/content.md +3 -3
  3. package/docs/components/currency-flag/content.md +202 -0
  4. package/docs/components/currency-input/content.md +175 -56
  5. package/docs/components/data-grid/content.md +47 -0
  6. package/docs/components/date-range-picker/content.md +62 -1
  7. package/docs/foundations/expressions/icons/content.md +1 -1
  8. package/docs/getting-started/developers/styling/content.md +2 -2
  9. package/docs/llms.txt +6 -3
  10. package/docs/resources/release-notes/0.2.5/content.md +6 -8
  11. package/docs/resources/release-notes/0.3.0/content.md +2 -2
  12. package/docs/resources/release-notes/0.3.1/content.md +3 -3
  13. package/docs/resources/release-notes/0.3.2/content.md +1 -1
  14. package/docs/resources/release-notes/0.3.3/content.md +6 -6
  15. package/docs/resources/release-notes/0.3.4/content.md +5 -5
  16. package/docs/resources/release-notes/0.3.6/content.md +3 -3
  17. package/docs/resources/release-notes/0.3.7/content.md +23 -0
  18. package/docs/resources/release-notes/0.3.8/content.md +21 -0
  19. package/docs/resources/release-notes/content.md +4 -2
  20. package/lib/commonjs/components/CountryFlag/index.js +2 -2
  21. package/lib/commonjs/components/CountryFlag/index.js.map +1 -1
  22. package/lib/commonjs/components/CurrencyFlag/index.js +77 -0
  23. package/lib/commonjs/components/CurrencyFlag/index.js.map +1 -0
  24. package/lib/commonjs/components/CurrencyInput/index.js +3 -1
  25. package/lib/commonjs/components/CurrencyInput/index.js.map +1 -1
  26. package/lib/commonjs/components/CurrencyInput/styles.js +23 -7
  27. package/lib/commonjs/components/CurrencyInput/styles.js.map +1 -1
  28. package/lib/commonjs/components/DateRangePicker/index.js +3 -1
  29. package/lib/commonjs/components/DateRangePicker/index.js.map +1 -1
  30. package/lib/commonjs/components/index.js +12 -0
  31. package/lib/commonjs/components/index.js.map +1 -1
  32. package/lib/commonjs/components/picker/surfaces.js.map +1 -1
  33. package/lib/module/components/CountryFlag/index.js +2 -2
  34. package/lib/module/components/CountryFlag/index.js.map +1 -1
  35. package/lib/module/components/CurrencyFlag/index.js +72 -0
  36. package/lib/module/components/CurrencyFlag/index.js.map +1 -0
  37. package/lib/module/components/CurrencyInput/index.js +3 -1
  38. package/lib/module/components/CurrencyInput/index.js.map +1 -1
  39. package/lib/module/components/CurrencyInput/styles.js +23 -7
  40. package/lib/module/components/CurrencyInput/styles.js.map +1 -1
  41. package/lib/module/components/DateRangePicker/index.js +3 -1
  42. package/lib/module/components/DateRangePicker/index.js.map +1 -1
  43. package/lib/module/components/index.js +1 -0
  44. package/lib/module/components/index.js.map +1 -1
  45. package/lib/module/components/picker/surfaces.js.map +1 -1
  46. package/lib/typescript/components/CountryFlag/index.d.ts +8 -3
  47. package/lib/typescript/components/CountryFlag/index.d.ts.map +1 -1
  48. package/lib/typescript/components/CurrencyFlag/index.d.ts +47 -0
  49. package/lib/typescript/components/CurrencyFlag/index.d.ts.map +1 -0
  50. package/lib/typescript/components/CurrencyInput/index.d.ts.map +1 -1
  51. package/lib/typescript/components/CurrencyInput/styles.d.ts +6 -1
  52. package/lib/typescript/components/CurrencyInput/styles.d.ts.map +1 -1
  53. package/lib/typescript/components/DateRangePicker/index.d.ts +26 -2
  54. package/lib/typescript/components/DateRangePicker/index.d.ts.map +1 -1
  55. package/lib/typescript/components/index.d.ts +1 -0
  56. package/lib/typescript/components/index.d.ts.map +1 -1
  57. package/lib/typescript/components/picker/surfaces.d.ts +1 -1
  58. package/lib/typescript/components/picker/surfaces.d.ts.map +1 -1
  59. package/package.json +5 -5
  60. package/src/components/CountryFlag/index.tsx +8 -3
  61. package/src/components/CurrencyFlag/index.tsx +71 -0
  62. package/src/components/CurrencyInput/index.tsx +2 -1
  63. package/src/components/CurrencyInput/styles.ts +29 -3
  64. package/src/components/DateRangePicker/index.tsx +29 -1
  65. package/src/components/index.ts +1 -0
  66. package/src/components/picker/surfaces.tsx +6 -1
@@ -0,0 +1,47 @@
1
+ import { type FlagCode } from '@cdx-ui/icons/flags';
2
+ import { type IconProps } from '../Icon';
3
+ export interface CurrencyFlagProps extends Omit<IconProps, 'as' | 'filled' | 'color'> {
4
+ /** ISO 4217 alphabetic currency code, such as `USD` or `EUR`. */
5
+ code: string;
6
+ }
7
+ /**
8
+ * Returns the flag code for the country or union that issues an ISO 4217 currency.
9
+ *
10
+ * National codes start with the issuer's ISO 3166-1 alpha-2 code (`DKK` → `DK`), so a
11
+ * currency shared by several countries resolves to its issuer. `EUR` resolves to `EU`.
12
+ * `X` codes (`XOF`, `XCD`, `XAU`) have no single issuer and resolve to `undefined`, as
13
+ * do malformed codes.
14
+ */
15
+ export declare function currencyFlagCode(code: string): FlagCode | undefined;
16
+ /**
17
+ * Renders the flag of the country or union that issues an ISO 4217 currency.
18
+ *
19
+ * The flag shows the issuer, not the user's country: `DKK` renders Denmark's flag for
20
+ * accounts in Greenland too. Use `CountryFlag` with a country code when the flag should
21
+ * show where the user is. Codes with no single issuer, such as `XOF` and `XCD`, render
22
+ * nothing and log a warning in development.
23
+ *
24
+ * The flag is drawn through `Icon`, so `className` sizing and `asChild` icon slots
25
+ * apply. Flag artwork keeps its own colors. The flag is decorative unless
26
+ * `accessibilityLabel` is set.
27
+ *
28
+ * @component
29
+ * @example
30
+ * ```tsx
31
+ * import { CurrencyFlag } from '@cdx-ui/components';
32
+ *
33
+ * <CurrencyFlag code="USD" />
34
+ * <CurrencyFlag code="EUR" className="size-6" accessibilityLabel="Euro" />
35
+ * ```
36
+ *
37
+ * @param {string} code - ISO 4217 alphabetic currency code.
38
+ * @param {string} className - Utility classes for size and placement, merged after the default `size-5` box.
39
+ * @param {string} accessibilityLabel - When set, the flag is announced as an image with this name.
40
+ * @param {object} style - Style overrides passed through to the icon.
41
+ * @param {string} data-testid - Test identifier forwarded to the rendered icon.
42
+ */
43
+ export declare function CurrencyFlag({ code, className, ...props }: CurrencyFlagProps): import("react/jsx-runtime").JSX.Element | null;
44
+ export declare namespace CurrencyFlag {
45
+ var displayName: string;
46
+ }
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/CurrencyFlag/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAS,KAAK,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAG3D,OAAO,EAAQ,KAAK,SAAS,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,SAAS,EAAE,IAAI,GAAG,QAAQ,GAAG,OAAO,CAAC;IACnF,iEAAiE;IACjE,IAAI,EAAE,MAAM,CAAC;CACd;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,SAAS,CAOnE;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;GA0BG;AACH,wBAAgB,YAAY,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,kDAc5E;yBAde,YAAY"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/CurrencyInput/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACzF,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,KAAK,yBAAyB,EAI/B,MAAM,UAAU,CAAC;AAqBlB,MAAM,WAAW,kBACf,SACE,gBAAgB,EAChB,yBAAyB,EACzB,IAAI,CACF,cAAc,EACd,oBAAoB,GAAG,mBAAmB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,eAAe,CAC/F;IACH,wGAAwG;IACxG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uGAAuG;IACvG,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,aAAa,0GA+JzB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/CurrencyInput/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAQ,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACzF,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,KAAK,yBAAyB,EAI/B,MAAM,UAAU,CAAC;AAqBlB,MAAM,WAAW,kBACf,SACE,gBAAgB,EAChB,yBAAyB,EACzB,IAAI,CACF,cAAc,EACd,oBAAoB,GAAG,mBAAmB,GAAG,QAAQ,GAAG,SAAS,GAAG,QAAQ,GAAG,eAAe,CAC/F;IACH,wGAAwG;IACxG,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,uGAAuG;IACvG,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC;;;OAGG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;CAC5B;AAED,eAAO,MAAM,aAAa,0GAgKzB,CAAC"}
@@ -11,9 +11,14 @@ export interface CurrencyInputVariantProps {
11
11
  * @default 'default'
12
12
  */
13
13
  size?: 'default' | 'small';
14
+ /**
15
+ * Horizontal alignment of the amount. Defaults to `center` on `ghost`. On `outline`, the amount
16
+ * stays at the start of the field until `align` is set.
17
+ */
18
+ align?: 'center' | 'end';
14
19
  }
15
20
  export declare const currencyInputRootVariants: ({ variant, size, }?: CurrencyInputVariantProps) => string;
16
- export declare const currencyInputFieldVariants: ({ variant, size, }?: CurrencyInputVariantProps) => string;
21
+ export declare const currencyInputFieldVariants: ({ variant, size, align, }?: CurrencyInputVariantProps) => string;
17
22
  export declare const currencyInputPrefixVariants: (props?: ({
18
23
  size?: "small" | "default" | null | undefined;
19
24
  } & import("class-variance-authority/types").ClassProp) | undefined) => string;
@@ -1 +1 @@
1
- {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/CurrencyInput/styles.ts"],"names":[],"mappings":"AAIA,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;CAC5B;AA6CD,eAAO,MAAM,yBAAyB,GAAI,qBAGvC,yBAA8B,KAAG,MAGU,CAAC;AAE/C,eAAO,MAAM,0BAA0B,GAAI,qBAGxC,yBAA8B,KAAG,MAC8D,CAAC;AAGnG,eAAO,MAAM,2BAA2B;;8EAavC,CAAC"}
1
+ {"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/CurrencyInput/styles.ts"],"names":[],"mappings":"AAKA,MAAM,WAAW,yBAAyB;IACxC;;;;;OAKG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAC9B;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,CAAC;IAC3B;;;OAGG;IACH,KAAK,CAAC,EAAE,QAAQ,GAAG,KAAK,CAAC;CAC1B;AAwDD,eAAO,MAAM,yBAAyB,GAAI,qBAGvC,yBAA8B,KAAG,MAGU,CAAC;AAE/C,eAAO,MAAM,0BAA0B,GAAI,4BAIxC,yBAA8B,KAAG,MASnC,CAAC;AAGF,eAAO,MAAM,2BAA2B;;8EAavC,CAAC"}
@@ -1,6 +1,7 @@
1
1
  import { type ReactNode } from 'react';
2
2
  import { View, type ViewProps } from 'react-native';
3
3
  import { type DateRangePickerRootProps as DateRangePickerRootPrimitiveProps } from '@cdx-ui/primitives';
4
+ import type { BottomSheetModalProps } from '../BottomSheet';
4
5
  import { type RangeCalendarProps } from '../RangeCalendar';
5
6
  import { type PickerTriggerProps } from '../picker/PickerTrigger';
6
7
  export type { DateRangeValue } from '@cdx-ui/primitives';
@@ -25,9 +26,32 @@ declare const DateRangePickerCalendar: import("react").ForwardRefExoticComponent
25
26
  declare function DateRangePickerDialog({ children }: {
26
27
  children: ReactNode;
27
28
  }): import("react/jsx-runtime").JSX.Element;
28
- declare function DateRangePickerBottomSheet({ children }: {
29
+ export interface DateRangePickerBottomSheetProps {
29
30
  children: ReactNode;
30
- }): import("react/jsx-runtime").JSX.Element;
31
+ /**
32
+ * Heights the sheet snaps to, as percentages of the screen or pixel values.
33
+ * @default ['70%', '90%']
34
+ */
35
+ snapPoints?: BottomSheetModalProps['snapPoints'];
36
+ /**
37
+ * Sizes the sheet to its content and adds that height as a snap point.
38
+ * @default false
39
+ */
40
+ enableDynamicSizing?: BottomSheetModalProps['enableDynamicSizing'];
41
+ /**
42
+ * How the sheet opens over a sheet that is already presented: `push` keeps that sheet
43
+ * underneath, `switch` minimizes it until this sheet closes, and `replace` dismisses it.
44
+ * @default 'switch'
45
+ */
46
+ stackBehavior?: BottomSheetModalProps['stackBehavior'];
47
+ /**
48
+ * Lays the children out in a container that fills the sheet, so a fixed header can sit above a
49
+ * `BottomSheet.ScrollView`. By default the children size a `BottomSheet.View`.
50
+ * @default false
51
+ */
52
+ fill?: boolean;
53
+ }
54
+ declare function DateRangePickerBottomSheet({ children, ...sheetProps }: DateRangePickerBottomSheetProps): import("react/jsx-runtime").JSX.Element;
31
55
  declare function DateRangePickerPopover({ children, className, }: {
32
56
  children: ReactNode;
33
57
  className?: string;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/DateRangePicker/index.tsx"],"names":[],"mappings":"A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74
74
  export * from './Icon';
75
75
  export * from './CountryFlag';
76
+ export * from './CurrencyFlag';
76
77
  export * from './IconButton';
77
78
  export * from './QuickActionButton';
78
79
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,OAAO,EAAE,WAAW,EAAE,KAAK,gBAAgB,EAAE,KAAK,uBAAuB,EAAE,MAAM,eAAe,CAAC;AACjG,cAAc,qBAAqB,CAAC;AACpC,cAAc,iBAAiB,CAAC;AAChC,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CAAC;AAChC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC;AAClC,cAAc,eAAe,CAAC;AAC9B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,kBAAkB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,oBAAoB,CAAC;AACnC,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,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C;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,mBAAmB,CAAC;AAClC,YAAY,EACV,qBAAqB,EACrB,oBAAoB,EACpB,6BAA6B,GAC9B,MAAM,yBAAyB,CAAC;AACjC,cAAc,UAAU,CAAC;AACzB,cAAc,eAAe,CAAC;AAC9B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC"}
@@ -18,7 +18,7 @@ type PickerBottomSheetSurfaceProps = {
18
18
  */
19
19
  fill?: boolean;
20
20
  children: ReactNode;
21
- } & Pick<BottomSheetModalProps, 'snapPoints' | 'enableDynamicSizing' | 'keyboardBehavior' | 'keyboardBlurBehavior' | 'accessible'>;
21
+ } & Pick<BottomSheetModalProps, 'snapPoints' | 'enableDynamicSizing' | 'stackBehavior' | 'keyboardBehavior' | 'keyboardBlurBehavior' | 'accessible'>;
22
22
  /**
23
23
  * Text input for a picker sheet. It registers with the sheet's keyboard handling, which moves
24
24
  * the sheet for a focused `BottomSheetTextInput` only; a plain `TextInput` stays under the
@@ -1 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EACR,KAAgB,GACjB,EAAE,yBAAyB,kDA+D3B"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cdx-ui/components",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "license": "MIT",
5
5
  "repository": {
6
6
  "type": "git",
@@ -106,10 +106,10 @@
106
106
  "@marceloterreiro/flash-calendar": "2.0.0",
107
107
  "react-native-reanimated-carousel": "5.0.0-beta.5",
108
108
  "uniwind": "1.10.0",
109
- "@cdx-ui/formatters": "0.3.7",
110
- "@cdx-ui/icons": "0.3.7",
111
- "@cdx-ui/utils": "0.3.7",
112
- "@cdx-ui/primitives": "0.3.7"
109
+ "@cdx-ui/formatters": "0.3.9",
110
+ "@cdx-ui/icons": "0.3.9",
111
+ "@cdx-ui/primitives": "0.3.9",
112
+ "@cdx-ui/utils": "0.3.9"
113
113
  },
114
114
  "devDependencies": {
115
115
  "@dnd-kit/core": "6.3.1",
@@ -6,12 +6,17 @@ import { Icon, type IconProps } from '../Icon';
6
6
  export type { FlagCode };
7
7
 
8
8
  export interface CountryFlagProps extends Omit<IconProps, 'as' | 'filled' | 'color'> {
9
- /** ISO 3166-1 alpha-2 country code. */
9
+ /**
10
+ * Code from the country-flag-icons 3x2 set. Includes officially assigned
11
+ * ISO 3166-1 alpha-2 codes, the unofficial codes that package ships for
12
+ * libphonenumber-js, and its subdivision codes. Subdivision codes keep
13
+ * their hyphen (`GB-ENG`).
14
+ */
10
15
  code: FlagCode;
11
16
  }
12
17
 
13
18
  /**
14
- * Renders the country flag for an ISO 3166-1 alpha-2 code.
19
+ * Renders the flag for a country-flag-icons code, including unofficial libphonenumber-js codes.
15
20
  *
16
21
  * The flag is drawn through `Icon`, so `className` sizing and `asChild` icon slots
17
22
  * apply. Flag artwork keeps its own colors. The flag is decorative unless
@@ -27,7 +32,7 @@ export interface CountryFlagProps extends Omit<IconProps, 'as' | 'filled' | 'col
27
32
  * <CountryFlag code="US" className="size-6" accessibilityLabel="United States" />
28
33
  * ```
29
34
  *
30
- * @param {FlagCode} code - ISO 3166-1 alpha-2 country code.
35
+ * @param {FlagCode} code - Code from the country-flag-icons 3x2 set. Subdivision codes keep their hyphen (`GB-ENG`).
31
36
  * @param {string} className - Utility classes for size and placement, merged after the default `size-5` box.
32
37
  * @param {string} accessibilityLabel - When set, the flag is announced as an image with this name.
33
38
  * @param {object} style - Style overrides passed through to the icon.
@@ -0,0 +1,71 @@
1
+ import { flags, type FlagCode } from '@cdx-ui/icons/flags';
2
+ import { dataAttributes, mergeDataAttributes } from '@cdx-ui/primitives';
3
+ import { cn } from '@cdx-ui/utils';
4
+ import { Icon, type IconProps } from '../Icon';
5
+
6
+ export interface CurrencyFlagProps extends Omit<IconProps, 'as' | 'filled' | 'color'> {
7
+ /** ISO 4217 alphabetic currency code, such as `USD` or `EUR`. */
8
+ code: string;
9
+ }
10
+
11
+ /**
12
+ * Returns the flag code for the country or union that issues an ISO 4217 currency.
13
+ *
14
+ * National codes start with the issuer's ISO 3166-1 alpha-2 code (`DKK` → `DK`), so a
15
+ * currency shared by several countries resolves to its issuer. `EUR` resolves to `EU`.
16
+ * `X` codes (`XOF`, `XCD`, `XAU`) have no single issuer and resolve to `undefined`, as
17
+ * do malformed codes.
18
+ */
19
+ export function currencyFlagCode(code: string): FlagCode | undefined {
20
+ if (!/^[A-Z]{3}$/.test(code)) return undefined;
21
+ if (code === 'EUR') return 'EU';
22
+ // `X` prefixes would otherwise hit user-assigned flags (`XAF` → `XA`, `XCD` → `XC`).
23
+ if (code.startsWith('X')) return undefined;
24
+ const region = code.slice(0, 2);
25
+ return Object.prototype.hasOwnProperty.call(flags, region) ? (region as FlagCode) : undefined;
26
+ }
27
+
28
+ /**
29
+ * Renders the flag of the country or union that issues an ISO 4217 currency.
30
+ *
31
+ * The flag shows the issuer, not the user's country: `DKK` renders Denmark's flag for
32
+ * accounts in Greenland too. Use `CountryFlag` with a country code when the flag should
33
+ * show where the user is. Codes with no single issuer, such as `XOF` and `XCD`, render
34
+ * nothing and log a warning in development.
35
+ *
36
+ * The flag is drawn through `Icon`, so `className` sizing and `asChild` icon slots
37
+ * apply. Flag artwork keeps its own colors. The flag is decorative unless
38
+ * `accessibilityLabel` is set.
39
+ *
40
+ * @component
41
+ * @example
42
+ * ```tsx
43
+ * import { CurrencyFlag } from '@cdx-ui/components';
44
+ *
45
+ * <CurrencyFlag code="USD" />
46
+ * <CurrencyFlag code="EUR" className="size-6" accessibilityLabel="Euro" />
47
+ * ```
48
+ *
49
+ * @param {string} code - ISO 4217 alphabetic currency code.
50
+ * @param {string} className - Utility classes for size and placement, merged after the default `size-5` box.
51
+ * @param {string} accessibilityLabel - When set, the flag is announced as an image with this name.
52
+ * @param {object} style - Style overrides passed through to the icon.
53
+ * @param {string} data-testid - Test identifier forwarded to the rendered icon.
54
+ */
55
+ export function CurrencyFlag({ code, className, ...props }: CurrencyFlagProps) {
56
+ const flagCode = currencyFlagCode(code);
57
+ if (!flagCode) {
58
+ if (__DEV__) console.warn(`CurrencyFlag: no flag for currency "${code}"`);
59
+ return null;
60
+ }
61
+ return (
62
+ <Icon
63
+ as={flags[flagCode]}
64
+ className={cn('size-5', className)}
65
+ {...props}
66
+ {...mergeDataAttributes(props, dataAttributes({ slot: 'currency-flag' }))}
67
+ />
68
+ );
69
+ }
70
+
71
+ CurrencyFlag.displayName = 'CurrencyFlag';
@@ -62,6 +62,7 @@ export const CurrencyInput = forwardRef<TextInput, CurrencyInputProps>(
62
62
  currencySymbol = '$',
63
63
  variant = 'ghost',
64
64
  size = 'default',
65
+ align,
65
66
  isDisabled,
66
67
  isInvalid,
67
68
  isReadOnly,
@@ -206,7 +207,7 @@ export const CurrencyInput = forwardRef<TextInput, CurrencyInputProps>(
206
207
  onFocus={handleFocus}
207
208
  onBlur={handleBlur}
208
209
  className={cn(
209
- currencyInputFieldVariants({ variant, size }),
210
+ currencyInputFieldVariants({ variant, size, align }),
210
211
  isEmpty ? 'text-content-tertiary' : 'text-content-primary',
211
212
  )}
212
213
  />
@@ -1,3 +1,4 @@
1
+ import { Platform } from 'react-native';
1
2
  import { cn, cva } from '@cdx-ui/utils';
2
3
  import { DISABLED_CURSOR } from '../../styles/constants';
3
4
  import { inputFieldVariants, inputRootVariants } from '../Input/styles';
@@ -15,6 +16,11 @@ export interface CurrencyInputVariantProps {
15
16
  * @default 'default'
16
17
  */
17
18
  size?: 'default' | 'small';
19
+ /**
20
+ * Horizontal alignment of the amount. Defaults to `center` on `ghost`. On `outline`, the amount
21
+ * stays at the start of the field until `align` is set.
22
+ */
23
+ align?: 'center' | 'end';
18
24
  }
19
25
 
20
26
  const currencyInputGhostRootVariants = cva(
@@ -37,9 +43,20 @@ const currencyInputGhostRootVariants = cva(
37
43
  },
38
44
  );
39
45
 
46
+ // TextInput only accepts textAlign left, center, and right. `text-end` is valid CSS, so web
47
+ // uses it, but native ignores it and the amount stays at the start in LTR. Direction
48
+ // variants compile to left/right, matching Table's native text alignment.
49
+ const currencyInputAlignClass = {
50
+ center: 'text-center',
51
+ end: Platform.select({
52
+ web: 'text-end',
53
+ default: 'ltr:text-right rtl:text-left',
54
+ }),
55
+ } as const;
56
+
40
57
  const currencyInputGhostFieldVariants = cva(
41
58
  [
42
- 'w-full bg-transparent p-0 text-center',
59
+ 'w-full bg-transparent p-0',
43
60
  'placeholder:text-content-tertiary',
44
61
  'web:outline-none',
45
62
  'data-[invalid=true]:text-content-danger',
@@ -71,8 +88,17 @@ export const currencyInputRootVariants = ({
71
88
  export const currencyInputFieldVariants = ({
72
89
  variant = 'ghost',
73
90
  size = 'default',
74
- }: CurrencyInputVariantProps = {}): string =>
75
- variant === 'outline' ? inputFieldVariants({ size }) : currencyInputGhostFieldVariants({ size });
91
+ align,
92
+ }: CurrencyInputVariantProps = {}): string => {
93
+ const resolvedAlign = align ?? (variant === 'outline' ? undefined : 'center');
94
+
95
+ return cn(
96
+ variant === 'outline'
97
+ ? inputFieldVariants({ size })
98
+ : currencyInputGhostFieldVariants({ size }),
99
+ resolvedAlign ? currencyInputAlignClass[resolvedAlign] : undefined,
100
+ );
101
+ };
76
102
 
77
103
  // Figma keeps the symbol at body-md on every viewport; only the amount grows to 16px on web <600px.
78
104
  export const currencyInputPrefixVariants = cva(
@@ -10,6 +10,7 @@ import {
10
10
  type DateRangePickerRootProps as DateRangePickerRootPrimitiveProps,
11
11
  } from '@cdx-ui/primitives';
12
12
  import { cn, ParentContext, useParentContext } from '@cdx-ui/utils';
13
+ import type { BottomSheetModalProps } from '../BottomSheet';
13
14
  import { Dialog } from '../Dialog';
14
15
  import { Icon } from '../Icon';
15
16
  import { RangeCalendar, type RangeCalendarProps } from '../RangeCalendar';
@@ -146,13 +147,40 @@ function DateRangePickerDialog({ children }: { children: ReactNode }) {
146
147
  );
147
148
  }
148
149
 
149
- function DateRangePickerBottomSheet({ children }: { children: ReactNode }) {
150
+ export interface DateRangePickerBottomSheetProps {
151
+ children: ReactNode;
152
+ /**
153
+ * Heights the sheet snaps to, as percentages of the screen or pixel values.
154
+ * @default ['70%', '90%']
155
+ */
156
+ snapPoints?: BottomSheetModalProps['snapPoints'];
157
+ /**
158
+ * Sizes the sheet to its content and adds that height as a snap point.
159
+ * @default false
160
+ */
161
+ enableDynamicSizing?: BottomSheetModalProps['enableDynamicSizing'];
162
+ /**
163
+ * How the sheet opens over a sheet that is already presented: `push` keeps that sheet
164
+ * underneath, `switch` minimizes it until this sheet closes, and `replace` dismisses it.
165
+ * @default 'switch'
166
+ */
167
+ stackBehavior?: BottomSheetModalProps['stackBehavior'];
168
+ /**
169
+ * Lays the children out in a container that fills the sheet, so a fixed header can sit above a
170
+ * `BottomSheet.ScrollView`. By default the children size a `BottomSheet.View`.
171
+ * @default false
172
+ */
173
+ fill?: boolean;
174
+ }
175
+
176
+ function DateRangePickerBottomSheet({ children, ...sheetProps }: DateRangePickerBottomSheetProps) {
150
177
  const ctx = useDateRangePickerContext();
151
178
  return (
152
179
  <PickerBottomSheetSurface
153
180
  open={ctx.open}
154
181
  setOpen={ctx.setOpen}
155
182
  registerSurface={ctx.registerSurface}
183
+ {...sheetProps}
156
184
  >
157
185
  <DateRangePickerContext.Provider value={ctx}>{children}</DateRangePickerContext.Provider>
158
186
  </PickerBottomSheetSurface>
@@ -77,5 +77,6 @@ export * from './Heading';
77
77
  export * from './Text';
78
78
  export * from './Icon';
79
79
  export * from './CountryFlag';
80
+ export * from './CurrencyFlag';
80
81
  export * from './IconButton';
81
82
  export * from './QuickActionButton';
@@ -51,7 +51,12 @@ type PickerBottomSheetSurfaceProps = {
51
51
  children: ReactNode;
52
52
  } & Pick<
53
53
  BottomSheetModalProps,
54
- 'snapPoints' | 'enableDynamicSizing' | 'keyboardBehavior' | 'keyboardBlurBehavior' | 'accessible'
54
+ | 'snapPoints'
55
+ | 'enableDynamicSizing'
56
+ | 'stackBehavior'
57
+ | 'keyboardBehavior'
58
+ | 'keyboardBlurBehavior'
59
+ | 'accessible'
55
60
  >;
56
61
 
57
62
  /**