@haus-storefront-react/currency-picker 0.1.1

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.
@@ -0,0 +1,48 @@
1
+ import { ReactNode } from 'react';
2
+ import { Scope, WebButtonProps } from '@haus-storefront-react/common-utils';
3
+ import { AsChildProps, ChildrenProps } from '@haus-storefront-react/shared-types';
4
+ import { UseCurrencyPickerProps } from './use-currency-picker';
5
+ type ScopedProps<P> = P & {
6
+ __scopeCurrencyPicker?: Scope;
7
+ };
8
+ export type CurrencyPickerContextValue = UseCurrencyPickerProps;
9
+ interface RootProps {
10
+ children?: ChildrenProps<CurrencyPickerContextValue>;
11
+ }
12
+ interface TriggerProps extends AsChildProps<ChildrenProps<{
13
+ selectedCurrency: string;
14
+ }>>, Omit<WebButtonProps, 'children'> {
15
+ __scopeCurrencyPicker?: Scope;
16
+ }
17
+ interface OptionProps extends AsChildProps, WebButtonProps {
18
+ value: string;
19
+ }
20
+ interface OptionsProps extends AsChildProps {
21
+ children?: ReactNode;
22
+ }
23
+ interface ValueProps extends AsChildProps {
24
+ children?: ReactNode;
25
+ }
26
+ export declare const CurrencyPicker: {
27
+ Root: {
28
+ ({ children, __scopeCurrencyPicker }: ScopedProps<RootProps>): import("react/jsx-runtime").JSX.Element;
29
+ displayName: string;
30
+ };
31
+ Trigger: {
32
+ ({ children, __scopeCurrencyPicker, asChild, ...props }: ScopedProps<TriggerProps>): import("react/jsx-runtime").JSX.Element | null;
33
+ displayName: string;
34
+ };
35
+ Options: {
36
+ ({ children, __scopeCurrencyPicker, asChild, ...props }: ScopedProps<OptionsProps>): import("react/jsx-runtime").JSX.Element;
37
+ displayName: string;
38
+ };
39
+ Option: {
40
+ ({ value, children, __scopeCurrencyPicker, asChild, ...props }: ScopedProps<OptionProps>): import("react/jsx-runtime").JSX.Element;
41
+ displayName: string;
42
+ };
43
+ Value: {
44
+ ({ children, __scopeCurrencyPicker, asChild, ...props }: ScopedProps<ValueProps>): import("react/jsx-runtime").JSX.Element | null;
45
+ displayName: string;
46
+ };
47
+ };
48
+ export {};
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Hook to provide the props needed by the CurrencyPicker component
3
+ */
4
+ export interface UseCurrencyPickerProps {
5
+ currencyCode: string | undefined;
6
+ availableCurrencyCodes: string[];
7
+ isLoading: boolean;
8
+ error: Error | null;
9
+ selectedCurrency: string | undefined;
10
+ setSelectedCurrency: (value: string) => Promise<void>;
11
+ }
12
+ export declare const useCurrencyPicker: () => UseCurrencyPickerProps;
package/package.json ADDED
@@ -0,0 +1,19 @@
1
+ {
2
+ "name": "@haus-storefront-react/currency-picker",
3
+ "version": "0.1.1",
4
+ "main": "./index.js",
5
+ "types": "./index.d.ts",
6
+ "exports": {
7
+ ".": {
8
+ "types": "./index.d.ts",
9
+ "import": "./index.mjs",
10
+ "require": "./index.js"
11
+ }
12
+ },
13
+ "dependencies": {
14
+ "@haus-storefront-react/common-utils": "0.0.49",
15
+ "@haus-storefront-react/core": "0.0.49",
16
+ "@haus-storefront-react/hooks": "0.0.49",
17
+ "@haus-storefront-react/shared-types": "0.0.49"
18
+ }
19
+ }