@commercelayer/app-elements 1.11.3 → 1.12.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/{InputDateComponent-e40e4999.js → InputDateComponent-c6c0c66f.js} +1 -1
- package/dist/{ui/forms/InputCurrency → helpers}/currencies.d.ts +1 -1
- package/dist/helpers/route.d.ts +58 -0
- package/dist/{main-498587b4.js → main-95daeba5.js} +19125 -19157
- package/dist/main.d.ts +3 -2
- package/dist/main.js +99 -97
- package/dist/providers/TokenProvider/types.d.ts +4 -4
- package/dist/style.css +1 -1
- package/dist/tailwind.config.js +174 -0
- package/dist/ui/atoms/Card.d.ts +2 -2
- package/dist/ui/composite/Dropdown/DropdownItem.d.ts +2 -2
- package/dist/ui/forms/InputCurrency/InputCurrency.d.ts +2 -2
- package/dist/ui/forms/InputCurrency/index.d.ts +0 -1
- package/dist/ui/forms/InputCurrency/utils.d.ts +3 -3
- package/dist/ui/forms/InputCurrencyRange.d.ts +4 -7
- package/dist/vendor.css +1 -0
- package/package.json +10 -3
- package/dist/ui/composite/SwitchMode.d.ts +0 -6
- /package/dist/{ui/composite/SwitchMode.test.d.ts → helpers/route.test.d.ts} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { r as O, a as Rn, t as F, b as Ct, c as Te, d as _, g as Mr, _ as Vt, s as He, e as lr, f as ba, h as Y, i as R, j as N, k, l as C, m as I, n as ka, o as dr, p as Ln, q as Ca, u as Ma, v as xa, w as zr, x as Sa, y as Xr, z as Oa, A as Ta, B as _a, C as An, D as ae, E as Ae, F as nt, G as Ft, H as fr, I as xr, J as Ea, K as Gr, L as Pa, M as Na, N as Ia, O as Ya, P as Ht, Q as Ke, R as Ra, S as La, T as Aa, X as Fa } from "./main-
|
|
1
|
+
import { r as O, a as Rn, t as F, b as Ct, c as Te, d as _, g as Mr, _ as Vt, s as He, e as lr, f as ba, h as Y, i as R, j as N, k, l as C, m as I, n as ka, o as dr, p as Ln, q as Ca, u as Ma, v as xa, w as zr, x as Sa, y as Xr, z as Oa, A as Ta, B as _a, C as An, D as ae, E as Ae, F as nt, G as Ft, H as fr, I as xr, J as Ea, K as Gr, L as Pa, M as Na, N as Ia, O as Ya, P as Ht, Q as Ke, R as Ra, S as La, T as Aa, X as Fa } from "./main-95daeba5.js";
|
|
2
2
|
import * as j from "react";
|
|
3
3
|
import v, { createElement as Ha, Component as Ba, createRef as Ua, forwardRef as ja } from "react";
|
|
4
4
|
import * as Wa from "react-dom";
|
|
@@ -6,7 +6,7 @@ export interface Currency {
|
|
|
6
6
|
thousands_separator: string;
|
|
7
7
|
[key: string]: unknown;
|
|
8
8
|
}
|
|
9
|
-
export type CurrencyCode = keyof typeof currencies
|
|
9
|
+
export type CurrencyCode = Uppercase<keyof typeof currencies>;
|
|
10
10
|
export declare const currencies: {
|
|
11
11
|
aed: {
|
|
12
12
|
priority: number;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { Simplify } from 'type-fest';
|
|
2
|
+
/**
|
|
3
|
+
* Create a `Route` given a path. Route has the provided `path` and a `makePath` method that helps making a path.
|
|
4
|
+
* @param path it can be a simple string (e.g. `/` or `/home/`) or a more complex with variables (e.g. `/users/:name/` or `/orders/:id?/`)
|
|
5
|
+
* @returns
|
|
6
|
+
*/
|
|
7
|
+
export declare function createRoute<Path extends `/${string}/` | `/`, Parameters extends Record<string, unknown> = ExtractParameters<Path>>(path: ValidPath<Parameters, Path>): Route<Path, Parameters>;
|
|
8
|
+
/**
|
|
9
|
+
* Create a typed `Route` given a path. Route has the provided `path` and a `makePath` method that helps making a path.
|
|
10
|
+
* @param path it can be a simple string (e.g. `/` or `/home/`) or a more complex with variables (e.g. `/users/:name/` or `/orders/:id?/`)
|
|
11
|
+
* @example
|
|
12
|
+
* ```ts
|
|
13
|
+
* const route = createTypedRoute<{
|
|
14
|
+
* orderNumber: number
|
|
15
|
+
* shipmentCode?: 'IT' | 'US'
|
|
16
|
+
* }>()('/orders/:orderNumber/:shipmentCode?/')
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare const createTypedRoute: <Parameters_1 extends Record<string, any>>() => <Path extends "/" | `/${string}/`>(path: ValidPath<Parameters_1, Path>) => Route<Path, Parameters_1>;
|
|
20
|
+
/**
|
|
21
|
+
* Get params from a `Route`.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* ```ts
|
|
25
|
+
* const route = createRoute('/orders/:id/:name?/')
|
|
26
|
+
*
|
|
27
|
+
* type Params = GetParams<typeof route>
|
|
28
|
+
*
|
|
29
|
+
* // equivalent to
|
|
30
|
+
*
|
|
31
|
+
* type Params = {
|
|
32
|
+
* id: string;
|
|
33
|
+
* name?: string | undefined;
|
|
34
|
+
* }
|
|
35
|
+
* ```
|
|
36
|
+
*/
|
|
37
|
+
export type GetParams<R extends {
|
|
38
|
+
makePath: (...arg: any[]) => string;
|
|
39
|
+
}> = {
|
|
40
|
+
[K in keyof Parameters<R['makePath']>[0]]: string;
|
|
41
|
+
};
|
|
42
|
+
interface Route<Path extends `/${string}/` | `/`, Parameters extends Record<string, unknown> = ExtractParameters<Path>> {
|
|
43
|
+
path: Path extends `/${infer P}/` ? `/${P}` : '/';
|
|
44
|
+
makePath: (parameters: Parameters, searchParams?: string | URLSearchParams) => string;
|
|
45
|
+
}
|
|
46
|
+
type ExtractParameters<Path extends string> = Path extends `${string}:${infer Var}/${infer Rest}` ? Simplify<FixOptional<{
|
|
47
|
+
[key in Var]: string | number | boolean;
|
|
48
|
+
}> & ExtractParameters<Rest>> : {};
|
|
49
|
+
type FixOptional<T extends Record<string, any>> = Omit<T, `${string}?`> & {
|
|
50
|
+
[K in keyof T as K extends `${infer VariableName}?` ? VariableName : never]?: T[K];
|
|
51
|
+
};
|
|
52
|
+
type ErrorParameters<Parameters extends Record<string, any>, Path extends string> = keyof ({
|
|
53
|
+
[key in keyof ExtractParameters<Path> as key extends keyof Parameters ? never : undefined extends ExtractParameters<Path>[key] ? key extends string ? `${key}?` : key : key]-?: 'Is not properly set.';
|
|
54
|
+
} & {
|
|
55
|
+
[key in keyof Parameters as key extends string ? Path extends `${string}/:${key}${undefined extends Parameters[key] ? '?' : ''}/${string}` ? never : undefined extends Parameters[key] ? `${key}?` : key : never]-?: 'Is not properly set.';
|
|
56
|
+
});
|
|
57
|
+
type ValidPath<Parameters extends Record<string, any>, Path extends string> = ErrorParameters<Parameters, Path> extends never ? Path : `Missing variable '${ErrorParameters<Parameters, Path> extends string ? ErrorParameters<Parameters, Path> : 'unknown'}'`;
|
|
58
|
+
export {};
|