@cdx-ui/components 0.0.1-beta.75 → 0.0.1-beta.77
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/lib/commonjs/components/BottomSheet/index.js +68 -25
- package/lib/commonjs/components/BottomSheet/index.js.map +1 -1
- package/lib/commonjs/components/BottomSheet/styles.js +5 -42
- package/lib/commonjs/components/BottomSheet/styles.js.map +1 -1
- package/lib/commonjs/components/CurrencyInput/index.js +157 -0
- package/lib/commonjs/components/CurrencyInput/index.js.map +1 -0
- package/lib/commonjs/components/CurrencyInput/styles.js +31 -0
- package/lib/commonjs/components/CurrencyInput/styles.js.map +1 -0
- package/lib/commonjs/components/Link/styles.js +1 -1
- package/lib/commonjs/components/Select/styles.js +1 -1
- package/lib/commonjs/components/Select/styles.js.map +1 -1
- package/lib/commonjs/components/index.js +12 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/metro/withForgeMetroConfig.js +50 -1
- package/lib/commonjs/metro/withForgeMetroConfig.js.map +1 -1
- package/lib/commonjs/styles.css +0 -5
- package/lib/module/components/BottomSheet/index.js +70 -27
- package/lib/module/components/BottomSheet/index.js.map +1 -1
- package/lib/module/components/BottomSheet/styles.js +4 -42
- package/lib/module/components/BottomSheet/styles.js.map +1 -1
- package/lib/module/components/CurrencyInput/index.js +154 -0
- package/lib/module/components/CurrencyInput/index.js.map +1 -0
- package/lib/module/components/CurrencyInput/styles.js +27 -0
- package/lib/module/components/CurrencyInput/styles.js.map +1 -0
- package/lib/module/components/Link/styles.js +1 -1
- package/lib/module/components/Select/styles.js +1 -1
- package/lib/module/components/Select/styles.js.map +1 -1
- package/lib/module/components/index.js +1 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/metro/withForgeMetroConfig.js +49 -1
- package/lib/module/metro/withForgeMetroConfig.js.map +1 -1
- package/lib/module/styles.css +0 -5
- package/lib/typescript/components/BottomSheet/index.d.ts.map +1 -1
- package/lib/typescript/components/BottomSheet/styles.d.ts +0 -5
- package/lib/typescript/components/BottomSheet/styles.d.ts.map +1 -1
- package/lib/typescript/components/CurrencyInput/index.d.ts +15 -0
- package/lib/typescript/components/CurrencyInput/index.d.ts.map +1 -0
- package/lib/typescript/components/CurrencyInput/styles.d.ts +9 -0
- package/lib/typescript/components/CurrencyInput/styles.d.ts.map +1 -0
- package/lib/typescript/components/Select/styles.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/metro/withForgeMetroConfig.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/components/BottomSheet/index.tsx +99 -42
- package/src/components/BottomSheet/styles.ts +7 -47
- package/src/components/CurrencyInput/index.tsx +192 -0
- package/src/components/CurrencyInput/styles.ts +44 -0
- package/src/components/Link/styles.ts +1 -1
- package/src/components/Select/styles.ts +0 -2
- package/src/components/index.ts +1 -0
- package/src/metro/withForgeMetroConfig.ts +54 -1
- package/src/styles.css +0 -5
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { cva } from 'class-variance-authority';
|
|
4
|
+
import { DISABLED_CURSOR } from '../../styles/primitives';
|
|
5
|
+
export const currencyInputRootVariants = cva(['w-full items-center justify-center', 'data-[disabled=true]:opacity-[var(--opacity-disabled)]', DISABLED_CURSOR, 'data-[readonly=true]:cursor-default'], {
|
|
6
|
+
variants: {
|
|
7
|
+
size: {
|
|
8
|
+
default: 'py-1',
|
|
9
|
+
small: 'py-0.5'
|
|
10
|
+
}
|
|
11
|
+
},
|
|
12
|
+
defaultVariants: {
|
|
13
|
+
size: 'default'
|
|
14
|
+
}
|
|
15
|
+
});
|
|
16
|
+
export const currencyInputFieldVariants = cva(['w-full bg-transparent p-0 text-center', 'placeholder:text-content-tertiary', 'web:outline-none', 'data-[invalid=true]:text-content-danger'], {
|
|
17
|
+
variants: {
|
|
18
|
+
size: {
|
|
19
|
+
default: 'heading-xl',
|
|
20
|
+
small: 'heading-lg'
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
defaultVariants: {
|
|
24
|
+
size: 'default'
|
|
25
|
+
}
|
|
26
|
+
});
|
|
27
|
+
//# sourceMappingURL=styles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["cva","DISABLED_CURSOR","currencyInputRootVariants","variants","size","default","small","defaultVariants","currencyInputFieldVariants"],"sourceRoot":"../../../../src","sources":["components/CurrencyInput/styles.ts"],"mappings":";;AAAA,SAASA,GAAG,QAA2B,0BAA0B;AACjE,SAASC,eAAe,QAAQ,yBAAyB;AAEzD,OAAO,MAAMC,yBAAyB,GAAGF,GAAG,CAC1C,CACE,oCAAoC,EACpC,wDAAwD,EACxDC,eAAe,EACf,qCAAqC,CACtC,EACD;EACEE,QAAQ,EAAE;IACRC,IAAI,EAAE;MACJC,OAAO,EAAE,MAAM;MACfC,KAAK,EAAE;IACT;EACF,CAAC;EACDC,eAAe,EAAE;IACfH,IAAI,EAAE;EACR;AACF,CACF,CAAC;AAED,OAAO,MAAMI,0BAA0B,GAAGR,GAAG,CAC3C,CACE,uCAAuC,EACvC,mCAAmC,EACnC,kBAAkB,EAClB,yCAAyC,CAC1C,EACD;EACEG,QAAQ,EAAE;IACRC,IAAI,EAAE;MACJC,OAAO,EAAE,YAAY;MACrBC,KAAK,EAAE;IACT;EACF,CAAC;EACDC,eAAe,EAAE;IACfH,IAAI,EAAE;EACR;AACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -41,7 +41,7 @@ export const linkNativeUnderlineVariants = cva(['border-b border-content-link pb
|
|
|
41
41
|
}
|
|
42
42
|
});
|
|
43
43
|
export const linkIconVariants = cva(['size-4', Platform.select({
|
|
44
|
-
web: 'text-
|
|
44
|
+
web: 'text-current',
|
|
45
45
|
default: 'text-content-link'
|
|
46
46
|
})], {
|
|
47
47
|
variants: {
|
|
@@ -6,7 +6,7 @@ import { DISABLED_CURSOR, TRANSITION_COLORS } from '../../styles/primitives';
|
|
|
6
6
|
|
|
7
7
|
// ── Trigger ─────────────────────────────────────────────────
|
|
8
8
|
|
|
9
|
-
export const selectTriggerVariants = cva(['flex w-full min-w-0 flex-row items-center justify-between text-start', 'bg-surface-primary', 'border border-stroke-primary', 'rounded-[var(--border-radius-default)]', TRANSITION_COLORS, 'data-[disabled=true]:bg-surface-secondary', 'data-[disabled=true]:opacity-[var(--opacity-disabled)]', DISABLED_CURSOR, 'data-[readonly=true]:cursor-default', 'data-[readonly=true]:bg-surface-secondary', 'web:hover:data-[focus=false]:data-[invalid=false]:border-stroke-hover', 'data-[focus=true]:border-[length:var(--border-width-focused)]', 'data-[focus=true]:data-[invalid=false]:border-stroke-action', 'data-[
|
|
9
|
+
export const selectTriggerVariants = cva(['flex w-full min-w-0 flex-row items-center justify-between text-start', 'bg-surface-primary', 'border border-stroke-primary', 'rounded-[var(--border-radius-default)]', TRANSITION_COLORS, 'data-[disabled=true]:bg-surface-secondary', 'data-[disabled=true]:opacity-[var(--opacity-disabled)]', DISABLED_CURSOR, 'data-[readonly=true]:cursor-default', 'data-[readonly=true]:bg-surface-secondary', 'web:hover:data-[focus=false]:data-[invalid=false]:border-stroke-hover', 'data-[focus=true]:border-[length:var(--border-width-focused)]', 'data-[focus=true]:data-[invalid=false]:border-stroke-action', 'data-[state=open]:border-[length:var(--border-width-focused)]', 'data-[state=open]:data-[invalid=false]:border-stroke-action', 'data-[invalid=true]:border-stroke-danger'], {
|
|
10
10
|
variants: {
|
|
11
11
|
variant: {
|
|
12
12
|
outline: []
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Platform","cva","DISABLED_CURSOR","TRANSITION_COLORS","selectTriggerVariants","variants","variant","outline","size","default","small","defaultVariants","selectValueVariants","selectIconVariants","selectContentVariants","select","web","selectItemVariants","selectItemLabelVariants"],"sourceRoot":"../../../../src","sources":["components/Select/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAA2B,0BAA0B;AACjE,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,yBAAyB;;AAE5E;;AAEA,OAAO,MAAMC,qBAAqB,GAAGH,GAAG,CACtC,CACE,sEAAsE,EACtE,oBAAoB,EACpB,8BAA8B,EAC9B,wCAAwC,EACxCE,iBAAiB,EACjB,2CAA2C,EAC3C,wDAAwD,EACxDD,eAAe,EACf,qCAAqC,EACrC,2CAA2C,EAC3C,uEAAuE,EACvE,+DAA+D,EAC/D,6DAA6D,EAC7D
|
|
1
|
+
{"version":3,"names":["Platform","cva","DISABLED_CURSOR","TRANSITION_COLORS","selectTriggerVariants","variants","variant","outline","size","default","small","defaultVariants","selectValueVariants","selectIconVariants","selectContentVariants","select","web","selectItemVariants","selectItemLabelVariants"],"sourceRoot":"../../../../src","sources":["components/Select/styles.ts"],"mappings":";;AAAA,SAASA,QAAQ,QAAQ,cAAc;AACvC,SAASC,GAAG,QAA2B,0BAA0B;AACjE,SAASC,eAAe,EAAEC,iBAAiB,QAAQ,yBAAyB;;AAE5E;;AAEA,OAAO,MAAMC,qBAAqB,GAAGH,GAAG,CACtC,CACE,sEAAsE,EACtE,oBAAoB,EACpB,8BAA8B,EAC9B,wCAAwC,EACxCE,iBAAiB,EACjB,2CAA2C,EAC3C,wDAAwD,EACxDD,eAAe,EACf,qCAAqC,EACrC,2CAA2C,EAC3C,uEAAuE,EACvE,+DAA+D,EAC/D,6DAA6D,EAC7D,+DAA+D,EAC/D,6DAA6D,EAC7D,0CAA0C,CAC3C,EACD;EACEG,QAAQ,EAAE;IACRC,OAAO,EAAE;MACPC,OAAO,EAAE;IACX,CAAC;IACDC,IAAI,EAAE;MACJC,OAAO,EAAE,CACP,+BAA+B,EAC/B,iEAAiE,EACjE,iEAAiE,EACjE,iEAAiE,EACjE,iEAAiE,CAClE;MACDC,KAAK,EAAE,CACL,+BAA+B,EAC/B,iEAAiE,EACjE,iEAAiE,EACjE,iEAAiE,EACjE,iEAAiE;IAErE;EACF,CA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,CAAC;;AAED;;AAEA,OAAO,MAAMU,uBAAuB,GAAGjB,GAAG,CACxC,CAAC,sBAAsB,EAAE,kCAAkC,CAAC,EAC5D;EACEI,QAAQ,EAAE;IACRG,IAAI,EAAE;MACJC,OAAO,EAAE,iBAAiB;MAC1BC,KAAK,EAAE;IACT;EACF,CAAC;EACDC,eAAe,EAAE;IACfH,IAAI,EAAE;EACR;AACF,CACF,CAAC","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HStack","VStack"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,OAAO;AACrB,cAAc,UAAU;AACxB,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,qBAAqB;AACnC,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,mBAAmB;AACjC,cAAc,UAAU;AACxB,cAAc,QAAQ;AACtB,SAASA,MAAM,EAAEC,MAAM,QAAQ,SAAS;AACxC,cAAc,WAAW;AACzB,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,cAAc;AAC5B,cAAc,qBAAqB","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":["HStack","VStack"],"sourceRoot":"../../../src","sources":["components/index.ts"],"mappings":";;AAAA,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,eAAe;AAC7B,cAAc,OAAO;AACrB,cAAc,UAAU;AACxB,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,iBAAiB;AAC/B,cAAc,UAAU;AACxB,cAAc,WAAW;AACzB,cAAc,SAAS;AACvB,cAAc,QAAQ;AACtB,cAAc,SAAS;AACvB,cAAc,SAAS;AACvB,cAAc,YAAY;AAC1B,cAAc,QAAQ;AACtB,cAAc,YAAY;AAC1B,cAAc,eAAe;AAC7B,cAAc,YAAY;AAC1B,cAAc,qBAAqB;AACnC,cAAc,SAAS;AACvB,cAAc,eAAe;AAC7B,cAAc,UAAU;AACxB,cAAc,mBAAmB;AACjC,cAAc,UAAU;AACxB,cAAc,QAAQ;AACtB,SAASA,MAAM,EAAEC,MAAM,QAAQ,SAAS;AACxC,cAAc,WAAW;AACzB,cAAc,QAAQ;AACtB,cAAc,QAAQ;AACtB,cAAc,cAAc;AAC5B,cAAc,qBAAqB","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import path from 'node:path';
|
|
3
4
|
import { withUniwindConfig } from 'uniwind/metro';
|
|
4
5
|
/**
|
|
5
6
|
* Wraps a Metro config with Forge UI's styling-layer configuration.
|
|
@@ -12,9 +13,56 @@ import { withUniwindConfig } from 'uniwind/metro';
|
|
|
12
13
|
* like `withStorybook`).
|
|
13
14
|
*/
|
|
14
15
|
export function withForgeMetroConfig(config, options) {
|
|
15
|
-
|
|
16
|
+
const withUniwind = withUniwindConfig(config, {
|
|
16
17
|
cssEntryFile: options.cssEntryFile,
|
|
17
18
|
dtsFile: options.generatedTypesFile
|
|
18
19
|
});
|
|
20
|
+
return withUniwindMultiCopyFix(withUniwind);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Fixes Uniwind 1.9's nativeResolver in pnpm monorepos with multiple Uniwind copies.
|
|
25
|
+
*
|
|
26
|
+
* Uniwind decides whether to wrap a `react-native` import by comparing
|
|
27
|
+
* `originModulePath` against a cached internal base path resolved via
|
|
28
|
+
* `require.resolve('uniwind/package.json')`. In pnpm, the Metro config loaded
|
|
29
|
+
* by Node and the Uniwind copy bundled for the app may resolve to different
|
|
30
|
+
* physical paths (different peer-dep hashes in the virtual store), so the
|
|
31
|
+
* `isInternal` check returns false for Uniwind-internal code. The
|
|
32
|
+
* nativeResolver then re-routes `react-native` to `uniwind/components`, which
|
|
33
|
+
* re-exports from `react-native` — a circular `get NativeModules` getter that
|
|
34
|
+
* overflows the stack at runtime.
|
|
35
|
+
*
|
|
36
|
+
* Fix: intercept `react-native` requests originating from inside any Uniwind
|
|
37
|
+
* copy and resolve them from the app's `projectRoot`, bypassing the broken
|
|
38
|
+
* `isInternal` check entirely.
|
|
39
|
+
*/
|
|
40
|
+
function withUniwindMultiCopyFix(config) {
|
|
41
|
+
const resolver = config.resolver;
|
|
42
|
+
if (!resolver) return config;
|
|
43
|
+
const innerResolveRequest = resolver.resolveRequest;
|
|
44
|
+
const uniwindPathFragment = `${path.sep}node_modules${path.sep}uniwind${path.sep}`;
|
|
45
|
+
const projectRoot = config.projectRoot;
|
|
46
|
+
const appOriginModulePath = projectRoot ? path.join(projectRoot, 'package.json') : undefined;
|
|
47
|
+
return {
|
|
48
|
+
...config,
|
|
49
|
+
resolver: {
|
|
50
|
+
...resolver,
|
|
51
|
+
resolveRequest: (context, moduleName, platform) => {
|
|
52
|
+
const fromUniwind = context.originModulePath?.includes(uniwindPathFragment) ?? false;
|
|
53
|
+
if (fromUniwind && (moduleName === 'react-native' || moduleName.startsWith('react-native/'))) {
|
|
54
|
+
const rewrittenContext = appOriginModulePath ? {
|
|
55
|
+
...context,
|
|
56
|
+
originModulePath: appOriginModulePath
|
|
57
|
+
} : context;
|
|
58
|
+
return context.resolveRequest(rewrittenContext, moduleName, platform);
|
|
59
|
+
}
|
|
60
|
+
if (innerResolveRequest) {
|
|
61
|
+
return innerResolveRequest(context, moduleName, platform);
|
|
62
|
+
}
|
|
63
|
+
return context.resolveRequest(context, moduleName, platform);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
19
67
|
}
|
|
20
68
|
//# sourceMappingURL=withForgeMetroConfig.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["withUniwindConfig","withForgeMetroConfig","config","options","cssEntryFile","dtsFile","generatedTypesFile"],"sourceRoot":"../../../src","sources":["metro/withForgeMetroConfig.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["path","withUniwindConfig","withForgeMetroConfig","config","options","withUniwind","cssEntryFile","dtsFile","generatedTypesFile","withUniwindMultiCopyFix","resolver","innerResolveRequest","resolveRequest","uniwindPathFragment","sep","projectRoot","appOriginModulePath","join","undefined","context","moduleName","platform","fromUniwind","originModulePath","includes","startsWith","rewrittenContext"],"sourceRoot":"../../../src","sources":["metro/withForgeMetroConfig.ts"],"mappings":";;AAAA,OAAOA,IAAI,MAAM,WAAW;AAE5B,SAASC,iBAAiB,QAAQ,eAAe;AASjD;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,oBAAoBA,CAClCC,MAAS,EACTC,OAAgC,EAC7B;EACH,MAAMC,WAAW,GAAGJ,iBAAiB,CAACE,MAAM,EAAE;IAC5CG,YAAY,EAAEF,OAAO,CAACE,YAAY;IAClCC,OAAO,EAAEH,OAAO,CAACI;EACnB,CAAC,CAAM;EAEP,OAAOC,uBAAuB,CAACJ,WAAW,CAAC;AAC7C;;AAEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASI,uBAAuBA,CAAwBN,MAAS,EAAK;EACpE,MAAMO,QAAQ,GAAGP,MAAM,CAACO,QAAQ;EAChC,IAAI,CAACA,QAAQ,EAAE,OAAOP,MAAM;EAE5B,MAAMQ,mBAAmB,GAAGD,QAAQ,CAACE,cAAc;EACnD,MAAMC,mBAAmB,GAAG,GAAGb,IAAI,CAACc,GAAG,eAAed,IAAI,CAACc,GAAG,UAAUd,IAAI,CAACc,GAAG,EAAE;EAClF,MAAMC,WAAW,GAAGZ,MAAM,CAACY,WAAW;EACtC,MAAMC,mBAAmB,GAAGD,WAAW,GAAGf,IAAI,CAACiB,IAAI,CAACF,WAAW,EAAE,cAAc,CAAC,GAAGG,SAAS;EAE5F,OAAO;IACL,GAAGf,MAAM;IACTO,QAAQ,EAAE;MACR,GAAGA,QAAQ;MACXE,cAAc,EAAEA,CAACO,OAAO,EAAEC,UAAU,EAAEC,QAAQ,KAAK;QACjD,MAAMC,WAAW,GAAGH,OAAO,CAACI,gBAAgB,EAAEC,QAAQ,CAACX,mBAAmB,CAAC,IAAI,KAAK;QACpF,IACES,WAAW,KACVF,UAAU,KAAK,cAAc,IAAIA,UAAU,CAACK,UAAU,CAAC,eAAe,CAAC,CAAC,EACzE;UACA,MAAMC,gBAAgB,GAAGV,mBAAmB,GACxC;YAAE,GAAGG,OAAO;YAAEI,gBAAgB,EAAEP;UAAoB,CAAC,GACrDG,OAAO;UACX,OAAOA,OAAO,CAACP,cAAc,CAACc,gBAAgB,EAAEN,UAAU,EAAEC,QAAQ,CAAC;QACvE;QACA,IAAIV,mBAAmB,EAAE;UACvB,OAAOA,mBAAmB,CAACQ,OAAO,EAAEC,UAAU,EAAEC,QAAQ,CAAC;QAC3D;QACA,OAAOF,OAAO,CAACP,cAAc,CAACO,OAAO,EAAEC,UAAU,EAAEC,QAAQ,CAAC;MAC9D;IACF;EACF,CAAC;AACH","ignoreList":[]}
|
package/lib/module/styles.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/BottomSheet/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAmC,KAAK,SAAS,EAAE,MAAM,OAAO,CAAC;AAC/E,OAAO,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/BottomSheet/index.tsx"],"names":[],"mappings":"AAAA,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;IACxB,qHAAqH;IACrH,MAAM,CAAC,EAAE,SAAS,CAAC;CACpB;AA2BD,QAAA,MAAM,sBAAsB,yGA+C1B,CAAC;AAQH,iBAAS,2BAA2B,CAAC,EACnC,4BAAmC,EACnC,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,wBAAwB,CAAC,OAAO,qBAAqB,CAAC,2CAM9D;kBAVQ,2BAA2B;;;AAkBpC,iBAAS,qBAAqB,CAAC,EAC7B,4BAAmC,EACnC,QAAQ,EACR,GAAG,IAAI,EACR,EAAE,KAAK,CAAC,wBAAwB,CAAC,OAAO,eAAe,CAAC,2CAMxD;kBAVQ,qBAAqB;;;AAsB9B,UAAU,mBAAmB;IAC3B,KAAK,EAAE,OAAO,sBAAsB,CAAC;IACrC,MAAM,EAAE,OAAO,iBAAiB,CAAC;IACjC,OAAO,EAAE,OAAO,kBAAkB,CAAC;IACnC,MAAM,EAAE,OAAO,iBAAiB,CAAC;IACjC,QAAQ,EAAE,OAAO,wBAAwB,CAAC;IAC1C,UAAU,EAAE,OAAO,2BAA2B,CAAC;IAC/C,IAAI,EAAE,OAAO,qBAAqB,CAAC;CACpC;AAED,eAAO,MAAM,WAAW,EAQnB,mBAAmB,CAAC;AAIzB,wBAAgB,cAAc;;;;EAG7B"}
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { type ViewStyle } from 'react-native';
|
|
2
1
|
import { type VariantProps } from 'class-variance-authority';
|
|
3
2
|
export declare const bottomSheetContainerVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
4
3
|
export declare const bottomSheetHeaderVariants: (props?: ({
|
|
@@ -6,11 +5,7 @@ export declare const bottomSheetHeaderVariants: (props?: ({
|
|
|
6
5
|
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
7
6
|
export declare const bottomSheetContentVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
8
7
|
export declare const bottomSheetFooterVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
9
|
-
export declare const bottomSheetSubtitleVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
10
|
-
export declare const bottomSheetBackButtonVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
11
8
|
export declare const bottomSheetBackIconVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
12
|
-
export declare const bottomSheetCloseButtonVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
13
9
|
export declare const bottomSheetCloseIconVariants: (props?: import("class-variance-authority/types").ClassProp | undefined) => string;
|
|
14
|
-
export declare const handleIndicatorStyle: ViewStyle;
|
|
15
10
|
export type BottomSheetHeaderVariants = VariantProps<typeof bottomSheetHeaderVariants>;
|
|
16
11
|
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/BottomSheet/styles.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/BottomSheet/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAElE,eAAO,MAAM,4BAA4B,oFAGvC,CAAC;AAEH,eAAO,MAAM,yBAAyB;;8EAiBrC,CAAC;AAEF,eAAO,MAAM,0BAA0B,oFAA0C,CAAC;AAElF,eAAO,MAAM,yBAAyB,oFAIpC,CAAC;AAEH,eAAO,MAAM,2BAA2B,oFAAiC,CAAC;AAE1E,eAAO,MAAM,4BAA4B,oFAAiC,CAAC;AAE3E,MAAM,MAAM,yBAAyB,GAAG,YAAY,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { type TextInput, type TextInputProps, type ViewProps } from 'react-native';
|
|
2
|
+
import { type IInputFieldProps } from '@cdx-ui/primitives';
|
|
3
|
+
import { type CurrencyInputVariantProps } from './styles';
|
|
4
|
+
export interface CurrencyInputProps extends IInputFieldProps, CurrencyInputVariantProps, Pick<TextInputProps, 'accessibilityLabel' | 'accessibilityHint' | 'testID' | 'onFocus' | 'onBlur'> {
|
|
5
|
+
/** Current numeric value. Renders formatted zero when undefined or null. */
|
|
6
|
+
value?: number;
|
|
7
|
+
/** Called with the parsed number when the user changes the amount. */
|
|
8
|
+
onChangeValue?: (value: number) => void;
|
|
9
|
+
/** Currency symbol rendered as an inline prefix. Defaults to `"$"`. */
|
|
10
|
+
currencySymbol?: string;
|
|
11
|
+
className?: string;
|
|
12
|
+
style?: ViewProps['style'];
|
|
13
|
+
}
|
|
14
|
+
export declare const CurrencyInput: import("react").ForwardRefExoticComponent<CurrencyInputProps & import("react").RefAttributes<TextInput>>;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/CurrencyInput/index.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,SAAS,EAAE,KAAK,cAAc,EAAE,KAAK,SAAS,EAAE,MAAM,cAAc,CAAC;AACnF,OAAO,EAIL,KAAK,gBAAgB,EACtB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EACL,KAAK,yBAAyB,EAG/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,CAC7E;IACH,4EAA4E;IAC5E,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,sEAAsE;IACtE,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,uEAAuE;IACvE,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,0GAyIzB,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { type VariantProps } from 'class-variance-authority';
|
|
2
|
+
export declare const currencyInputRootVariants: (props?: ({
|
|
3
|
+
size?: "small" | "default" | null | undefined;
|
|
4
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
5
|
+
export declare const currencyInputFieldVariants: (props?: ({
|
|
6
|
+
size?: "small" | "default" | null | undefined;
|
|
7
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
8
|
+
export type CurrencyInputVariantProps = VariantProps<typeof currencyInputRootVariants>;
|
|
9
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/CurrencyInput/styles.ts"],"names":[],"mappings":"AAAA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE,eAAO,MAAM,yBAAyB;;8EAkBrC,CAAC;AAEF,eAAO,MAAM,0BAA0B;;8EAkBtC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG,YAAY,CAAC,OAAO,yBAAyB,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,eAAO,MAAM,qBAAqB;;;
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../../../../src/components/Select/styles.ts"],"names":[],"mappings":"AACA,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAKlE,eAAO,MAAM,qBAAqB;;;8EA8CjC,CAAC;AAIF,eAAO,MAAM,mBAAmB;;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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,eAAe,CAAC;AAC9B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,iBAAiB,CAAC;AAChC,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC;AAC1B,cAAc,SAAS,CAAC;AACxB,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,YAAY,CAAC;AAC3B,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,YAAY,CAAC;AAC3B,cAAc,qBAAqB,CAAC;AACpC,cAAc,SAAS,CAAC;AACxB,cAAc,eAAe,CAAC;AAC9B,cAAc,UAAU,CAAC;AACzB,cAAc,mBAAmB,CAAC;AAClC,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACzC,cAAc,WAAW,CAAC;AAC1B,cAAc,QAAQ,CAAC;AACvB,cAAc,QAAQ,CAAC;AACvB,cAAc,cAAc,CAAC;AAC7B,cAAc,qBAAqB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"withForgeMetroConfig.d.ts","sourceRoot":"","sources":["../../../src/metro/withForgeMetroConfig.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"withForgeMetroConfig.d.ts","sourceRoot":"","sources":["../../../src/metro/withForgeMetroConfig.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAGhD,MAAM,WAAW,uBAAuB;IACtC,2DAA2D;IAC3D,YAAY,EAAE,MAAM,CAAC;IACrB,wEAAwE;IACxE,kBAAkB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,CAAC,SAAS,WAAW,EACxD,MAAM,EAAE,CAAC,EACT,OAAO,EAAE,uBAAuB,GAC/B,CAAC,CAOH"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cdx-ui/components",
|
|
3
|
-
"version": "0.0.1-beta.
|
|
3
|
+
"version": "0.0.1-beta.77",
|
|
4
4
|
"main": "lib/commonjs/index.js",
|
|
5
5
|
"module": "lib/module/index.js",
|
|
6
6
|
"react-native": "src/index.ts",
|
|
@@ -66,10 +66,10 @@
|
|
|
66
66
|
"dependencies": {
|
|
67
67
|
"@gorhom/bottom-sheet": "^5.2.6",
|
|
68
68
|
"class-variance-authority": "^0.7.1",
|
|
69
|
-
"uniwind": "1.
|
|
70
|
-
"@cdx-ui/
|
|
71
|
-
"@cdx-ui/
|
|
72
|
-
"@cdx-ui/
|
|
69
|
+
"uniwind": "1.10.0",
|
|
70
|
+
"@cdx-ui/utils": "0.0.1-beta.77",
|
|
71
|
+
"@cdx-ui/primitives": "0.0.1-beta.77",
|
|
72
|
+
"@cdx-ui/icons": "0.0.1-beta.77"
|
|
73
73
|
},
|
|
74
74
|
"devDependencies": {
|
|
75
75
|
"@react-navigation/bottom-tabs": "*",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { forwardRef, useCallback, useRef, type ReactNode } from 'react';
|
|
2
|
-
import { Dimensions,
|
|
2
|
+
import { Dimensions, View, ViewStyle } from 'react-native';
|
|
3
3
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
4
|
+
import { useResolveClassNames } from 'uniwind';
|
|
4
5
|
import {
|
|
5
6
|
BottomSheetModal,
|
|
6
7
|
BottomSheetModalProvider,
|
|
@@ -12,21 +13,15 @@ import {
|
|
|
12
13
|
type BottomSheetFooterProps as GorhomBottomSheetFooterProps,
|
|
13
14
|
} from '@gorhom/bottom-sheet';
|
|
14
15
|
import { cn } from '@cdx-ui/utils';
|
|
15
|
-
import {
|
|
16
|
+
import { ArrowBack, Close } from '@cdx-ui/icons';
|
|
16
17
|
import { Heading } from '../Heading';
|
|
17
|
-
import {
|
|
18
|
+
import { IconButton } from '../IconButton';
|
|
18
19
|
import { Text } from '../Text';
|
|
19
20
|
import {
|
|
20
|
-
bottomSheetBackButtonVariants,
|
|
21
|
-
bottomSheetBackIconVariants,
|
|
22
|
-
bottomSheetCloseButtonVariants,
|
|
23
|
-
bottomSheetCloseIconVariants,
|
|
24
21
|
bottomSheetContainerVariants,
|
|
25
22
|
bottomSheetContentVariants,
|
|
26
23
|
bottomSheetFooterVariants,
|
|
27
24
|
bottomSheetHeaderVariants,
|
|
28
|
-
bottomSheetSubtitleVariants,
|
|
29
|
-
handleIndicatorStyle,
|
|
30
25
|
} from './styles';
|
|
31
26
|
|
|
32
27
|
/** Ref type for BottomSheet; forwards the @gorhom modal ref (present, dismiss, snapToIndex, minimize, restore, etc.). */
|
|
@@ -61,36 +56,35 @@ function BottomSheetHeaderComponent(
|
|
|
61
56
|
const computedClassName = cn(bottomSheetHeaderVariants({ hasTitle: hasContent }), className);
|
|
62
57
|
return (
|
|
63
58
|
<View ref={ref} className={computedClassName}>
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
>
|
|
72
|
-
<Icon as={ArrowBackIosNew} className={bottomSheetBackIconVariants()} />
|
|
73
|
-
</Pressable>
|
|
74
|
-
)}
|
|
59
|
+
<BottomSheetBackButton
|
|
60
|
+
className={cn(!onBack && 'opacity-0')}
|
|
61
|
+
onPress={onBack}
|
|
62
|
+
{...(backAccessibilityLabel !== undefined && {
|
|
63
|
+
accessibilityLabel: backAccessibilityLabel,
|
|
64
|
+
})}
|
|
65
|
+
/>
|
|
75
66
|
<View className="flex-1">
|
|
76
67
|
{children ??
|
|
77
68
|
(hasTitle ? (
|
|
78
69
|
<View>
|
|
79
|
-
<Heading size="
|
|
70
|
+
<Heading size="md" className="text-center">
|
|
80
71
|
{title}
|
|
81
72
|
</Heading>
|
|
82
|
-
{subtitle ?
|
|
73
|
+
{subtitle ? (
|
|
74
|
+
<Text size="sm" className="text-center text-content-secondary">
|
|
75
|
+
{subtitle}
|
|
76
|
+
</Text>
|
|
77
|
+
) : null}
|
|
83
78
|
</View>
|
|
84
79
|
) : null)}
|
|
85
80
|
</View>
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
)}
|
|
81
|
+
<BottomSheetCloseButton
|
|
82
|
+
className={cn(!onClose && 'opacity-0')}
|
|
83
|
+
onPress={onClose}
|
|
84
|
+
{...(closeAccessibilityLabel !== undefined && {
|
|
85
|
+
accessibilityLabel: closeAccessibilityLabel,
|
|
86
|
+
})}
|
|
87
|
+
/>
|
|
94
88
|
</View>
|
|
95
89
|
);
|
|
96
90
|
}
|
|
@@ -100,11 +94,41 @@ BottomSheetHeaderComponent.displayName = 'BottomSheet.Header';
|
|
|
100
94
|
const BottomSheetHeader = forwardRef<View, BottomSheetHeaderProps>(BottomSheetHeaderComponent);
|
|
101
95
|
BottomSheetHeader.displayName = 'BottomSheet.Header';
|
|
102
96
|
|
|
97
|
+
// =============================================================================
|
|
98
|
+
// BACKBUTTON
|
|
99
|
+
// =============================================================================
|
|
100
|
+
interface BottomSheetBackButtonProps {
|
|
101
|
+
onPress?: () => void;
|
|
102
|
+
className?: string;
|
|
103
|
+
accessibilityLabel?: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function BottomSheetBackButton({
|
|
107
|
+
onPress,
|
|
108
|
+
className,
|
|
109
|
+
accessibilityLabel = 'Go back',
|
|
110
|
+
}: Readonly<BottomSheetBackButtonProps>) {
|
|
111
|
+
return (
|
|
112
|
+
<IconButton
|
|
113
|
+
as={ArrowBack}
|
|
114
|
+
variant="solid"
|
|
115
|
+
color="neutral"
|
|
116
|
+
size="default"
|
|
117
|
+
onPress={onPress}
|
|
118
|
+
hitSlop={12}
|
|
119
|
+
accessibilityLabel={accessibilityLabel}
|
|
120
|
+
className={className}
|
|
121
|
+
/>
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
BottomSheetBackButton.displayName = 'BottomSheet.BackButton';
|
|
126
|
+
|
|
103
127
|
// =============================================================================
|
|
104
128
|
// CLOSEBUTTON
|
|
105
129
|
// =============================================================================
|
|
106
130
|
interface BottomSheetCloseButtonProps {
|
|
107
|
-
onPress
|
|
131
|
+
onPress?: () => void;
|
|
108
132
|
className?: string;
|
|
109
133
|
accessibilityLabel?: string;
|
|
110
134
|
}
|
|
@@ -113,17 +137,18 @@ function BottomSheetCloseButton({
|
|
|
113
137
|
onPress,
|
|
114
138
|
className,
|
|
115
139
|
accessibilityLabel = 'Close',
|
|
116
|
-
}: BottomSheetCloseButtonProps) {
|
|
140
|
+
}: Readonly<BottomSheetCloseButtonProps>) {
|
|
117
141
|
return (
|
|
118
|
-
<
|
|
142
|
+
<IconButton
|
|
143
|
+
as={Close}
|
|
144
|
+
variant="solid"
|
|
145
|
+
color="neutral"
|
|
146
|
+
size="default"
|
|
119
147
|
onPress={onPress}
|
|
120
148
|
hitSlop={12}
|
|
121
|
-
accessibilityRole="button"
|
|
122
149
|
accessibilityLabel={accessibilityLabel}
|
|
123
|
-
className={
|
|
124
|
-
|
|
125
|
-
<Icon as={Close} className={bottomSheetCloseIconVariants()} />
|
|
126
|
-
</Pressable>
|
|
150
|
+
className={className}
|
|
151
|
+
/>
|
|
127
152
|
);
|
|
128
153
|
}
|
|
129
154
|
|
|
@@ -202,6 +227,13 @@ export interface BottomSheetModalProps extends React.ComponentPropsWithoutRef<
|
|
|
202
227
|
|
|
203
228
|
const MAX_DYNAMIC_CONTENT_SIZE = Dimensions.get('window').height * 0.9;
|
|
204
229
|
|
|
230
|
+
const SHEET_BORDER_RADIUS = 24;
|
|
231
|
+
const sheetContainerStyle: ViewStyle = {
|
|
232
|
+
overflow: 'hidden',
|
|
233
|
+
borderTopLeftRadius: SHEET_BORDER_RADIUS,
|
|
234
|
+
borderTopRightRadius: SHEET_BORDER_RADIUS,
|
|
235
|
+
};
|
|
236
|
+
|
|
205
237
|
const CustomBackdrop = (props: BottomSheetBackdropProps) => {
|
|
206
238
|
return (
|
|
207
239
|
<BottomSheetBackdrop
|
|
@@ -214,10 +246,14 @@ const CustomBackdrop = (props: BottomSheetBackdropProps) => {
|
|
|
214
246
|
);
|
|
215
247
|
};
|
|
216
248
|
|
|
249
|
+
const CustomBackground = (props: React.ComponentPropsWithoutRef<typeof View>) => (
|
|
250
|
+
<View {...props} className={cn(bottomSheetContainerVariants())} />
|
|
251
|
+
);
|
|
252
|
+
|
|
217
253
|
const BottomSheetModalStyled = forwardRef<
|
|
218
254
|
React.ComponentRef<typeof BottomSheetModal>,
|
|
219
255
|
BottomSheetModalProps
|
|
220
|
-
>(({ handleVisible = true, footer, ...rest }, ref) => {
|
|
256
|
+
>(({ handleVisible = true, footer, onDismiss, onChange, ...rest }, ref) => {
|
|
221
257
|
const renderFooter = useCallback(
|
|
222
258
|
(props: GorhomBottomSheetFooterProps) => (
|
|
223
259
|
<GorhomBottomSheetFooter {...props}>{footer}</GorhomBottomSheetFooter>
|
|
@@ -225,18 +261,39 @@ const BottomSheetModalStyled = forwardRef<
|
|
|
225
261
|
[footer],
|
|
226
262
|
);
|
|
227
263
|
|
|
264
|
+
const dismissedRef = useRef(false);
|
|
265
|
+
|
|
266
|
+
const handleDismiss = useCallback(() => {
|
|
267
|
+
if (dismissedRef.current) return;
|
|
268
|
+
dismissedRef.current = true;
|
|
269
|
+
onDismiss?.();
|
|
270
|
+
}, [onDismiss]);
|
|
271
|
+
|
|
272
|
+
const handleChange = useCallback(
|
|
273
|
+
(...args: Parameters<NonNullable<BottomSheetModalProps['onChange']>>) => {
|
|
274
|
+
dismissedRef.current = false;
|
|
275
|
+
onChange?.(...args);
|
|
276
|
+
},
|
|
277
|
+
[onChange],
|
|
278
|
+
);
|
|
279
|
+
|
|
280
|
+
const handleIndicatorStyle = useResolveClassNames(
|
|
281
|
+
'bg-surface-neutral-subtle w-9 h-1 rounded-full',
|
|
282
|
+
);
|
|
283
|
+
|
|
228
284
|
return (
|
|
229
285
|
<BottomSheetModal
|
|
230
286
|
ref={ref}
|
|
231
287
|
enableDynamicSizing
|
|
232
288
|
maxDynamicContentSize={MAX_DYNAMIC_CONTENT_SIZE}
|
|
289
|
+
style={sheetContainerStyle}
|
|
233
290
|
handleComponent={handleVisible ? undefined : null}
|
|
234
291
|
handleIndicatorStyle={handleVisible ? handleIndicatorStyle : undefined}
|
|
235
292
|
backdropComponent={CustomBackdrop}
|
|
236
|
-
backgroundComponent={
|
|
237
|
-
<View {...backgroundProps} className={cn(bottomSheetContainerVariants())} />
|
|
238
|
-
)}
|
|
293
|
+
backgroundComponent={CustomBackground}
|
|
239
294
|
{...rest}
|
|
295
|
+
onDismiss={handleDismiss}
|
|
296
|
+
onChange={handleChange}
|
|
240
297
|
{...(footer != null && { footerComponent: renderFooter })}
|
|
241
298
|
/>
|
|
242
299
|
);
|
|
@@ -1,27 +1,15 @@
|
|
|
1
|
-
import { type ViewStyle } from 'react-native';
|
|
2
1
|
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import {
|
|
4
|
-
COLOR_BG_PRIMARY,
|
|
5
|
-
COLOR_BORDER_DEFAULT,
|
|
6
|
-
COLOR_TEXT_PRIMARY,
|
|
7
|
-
COLOR_TEXT_SECONDARY,
|
|
8
|
-
} from '../../styles/primitives';
|
|
9
|
-
|
|
10
|
-
// ── Container ──────────────────────────────────────────────
|
|
11
2
|
|
|
12
3
|
export const bottomSheetContainerVariants = cva([
|
|
13
|
-
'rounded-t-3xl
|
|
14
|
-
|
|
15
|
-
COLOR_BORDER_DEFAULT,
|
|
4
|
+
'rounded-t-3xl overflow-hidden',
|
|
5
|
+
'bg-surface-primary',
|
|
16
6
|
]);
|
|
17
7
|
|
|
18
|
-
// ── Header ─────────────────────────────────────────────────
|
|
19
|
-
|
|
20
8
|
export const bottomSheetHeaderVariants = cva(
|
|
21
9
|
[
|
|
22
10
|
'flex-row items-center justify-between min-h-12 px-4 pt-3 pb-2',
|
|
23
|
-
|
|
24
|
-
|
|
11
|
+
'bg-surface-primary',
|
|
12
|
+
'text-content-primary',
|
|
25
13
|
],
|
|
26
14
|
{
|
|
27
15
|
variants: {
|
|
@@ -36,44 +24,16 @@ export const bottomSheetHeaderVariants = cva(
|
|
|
36
24
|
},
|
|
37
25
|
);
|
|
38
26
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
export const bottomSheetContentVariants = cva([COLOR_BG_PRIMARY, 'px-4 pb-6']);
|
|
42
|
-
|
|
43
|
-
// ── Footer ─────────────────────────────────────────────────
|
|
27
|
+
export const bottomSheetContentVariants = cva(['bg-surface-primary', 'p-5 pb-6']);
|
|
44
28
|
|
|
45
29
|
export const bottomSheetFooterVariants = cva([
|
|
46
30
|
'px-4 pt-3 pb-4 border-t',
|
|
47
|
-
|
|
48
|
-
|
|
31
|
+
'bg-surface-primary',
|
|
32
|
+
'border-stroke-secondary',
|
|
49
33
|
]);
|
|
50
34
|
|
|
51
|
-
// ── Subtitle ────────────────────────────────────────────────
|
|
52
|
-
|
|
53
|
-
export const bottomSheetSubtitleVariants = cva(['text-sm', COLOR_TEXT_SECONDARY]);
|
|
54
|
-
|
|
55
|
-
// ── Back Button ─────────────────────────────────────────────
|
|
56
|
-
|
|
57
|
-
export const bottomSheetBackButtonVariants = cva(['p-1 -m-1 mr-2 rounded-full active:opacity-70']);
|
|
58
|
-
|
|
59
35
|
export const bottomSheetBackIconVariants = cva(['size-5 text-slate-500']);
|
|
60
36
|
|
|
61
|
-
// ── Close Button ───────────────────────────────────────────
|
|
62
|
-
|
|
63
|
-
export const bottomSheetCloseButtonVariants = cva(['p-1 -m-1 rounded-full active:opacity-70']);
|
|
64
|
-
|
|
65
|
-
// ── Close Icon ─────────────────────────────────────────────
|
|
66
|
-
|
|
67
37
|
export const bottomSheetCloseIconVariants = cva(['size-5 text-slate-500']);
|
|
68
38
|
|
|
69
|
-
// ── Handle indicator ────────────────────────────────────────
|
|
70
|
-
// Plain ViewStyle — gorhom's handleIndicatorStyle doesn't accept classNames.
|
|
71
|
-
// slate-300 (#cbd5e1) maps to COLOR_BORDER_STRONG; update when raw token palette is available (TODO).
|
|
72
|
-
export const handleIndicatorStyle: ViewStyle = {
|
|
73
|
-
backgroundColor: '#cbd5e1',
|
|
74
|
-
width: 36,
|
|
75
|
-
height: 4,
|
|
76
|
-
borderRadius: 2,
|
|
77
|
-
};
|
|
78
|
-
|
|
79
39
|
export type BottomSheetHeaderVariants = VariantProps<typeof bottomSheetHeaderVariants>;
|