@hzblj/kara-components 0.3.0 → 0.4.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.
- package/CHANGELOG.md +28 -0
- package/lib/module/atoms/h-stack/h-stack.android.js +2 -5
- package/lib/module/atoms/h-stack/h-stack.android.js.map +1 -1
- package/lib/module/atoms/v-stack/v-stack.android.js +2 -5
- package/lib/module/atoms/v-stack/v-stack.android.js.map +1 -1
- package/lib/module/atoms/z-stack/z-stack.android.js +2 -5
- package/lib/module/atoms/z-stack/z-stack.android.js.map +1 -1
- package/lib/module/molecules/index.js +1 -0
- package/lib/module/molecules/index.js.map +1 -1
- package/lib/module/molecules/labeled-content/labeled-content.js +2 -0
- package/lib/module/molecules/labeled-content/labeled-content.js.map +1 -1
- package/lib/module/molecules/list-item/list-item.js +12 -1
- package/lib/module/molecules/list-item/list-item.js.map +1 -1
- package/lib/module/molecules/rn-list-item/index.js +5 -0
- package/lib/module/molecules/rn-list-item/index.js.map +1 -0
- package/lib/module/molecules/rn-list-item/rn-list-item.js +71 -0
- package/lib/module/molecules/rn-list-item/rn-list-item.js.map +1 -0
- package/lib/module/molecules/rn-list-item/rn-list-item.types.js +4 -0
- package/lib/module/molecules/rn-list-item/rn-list-item.types.js.map +1 -0
- package/lib/module/organisms/context-menu/context-menu.android.js +83 -38
- package/lib/module/organisms/context-menu/context-menu.android.js.map +1 -1
- package/lib/module/ripple-clip.js +36 -0
- package/lib/module/ripple-clip.js.map +1 -0
- package/lib/module/use-stack-modifiers.js +35 -0
- package/lib/module/use-stack-modifiers.js.map +1 -0
- package/lib/typescript/molecules/index.d.ts +1 -0
- package/lib/typescript/molecules/labeled-content/labeled-content.types.d.ts +3 -0
- package/lib/typescript/molecules/list-item/list-item.types.d.ts +6 -0
- package/lib/typescript/molecules/rn-list-item/index.d.ts +2 -0
- package/lib/typescript/molecules/rn-list-item/rn-list-item.d.ts +2 -0
- package/lib/typescript/molecules/rn-list-item/rn-list-item.types.d.ts +10 -0
- package/lib/typescript/organisms/context-menu/context-menu.types.d.ts +2 -1
- package/lib/typescript/ripple-clip.d.ts +12 -0
- package/lib/typescript/use-stack-modifiers.d.ts +8 -0
- package/package.json +4 -4
- package/src/atoms/h-stack/h-stack.android.tsx +2 -8
- package/src/atoms/v-stack/v-stack.android.tsx +2 -8
- package/src/atoms/z-stack/z-stack.android.tsx +2 -8
- package/src/molecules/index.ts +1 -0
- package/src/molecules/labeled-content/labeled-content.tsx +2 -1
- package/src/molecules/labeled-content/labeled-content.types.ts +3 -0
- package/src/molecules/list-item/list-item.tsx +12 -4
- package/src/molecules/list-item/list-item.types.ts +6 -0
- package/src/molecules/rn-list-item/index.ts +2 -0
- package/src/molecules/rn-list-item/rn-list-item.tsx +48 -0
- package/src/molecules/rn-list-item/rn-list-item.types.ts +13 -0
- package/src/organisms/context-menu/context-menu.android.tsx +63 -38
- package/src/organisms/context-menu/context-menu.types.ts +2 -1
- package/src/ripple-clip.ts +47 -0
- package/src/use-stack-modifiers.ts +24 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,33 @@
|
|
|
1
1
|
# @hzblj/kara-components
|
|
2
2
|
|
|
3
|
+
## 0.4.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`d14bdd3`](https://github.com/hzblj/kara-ui/commit/d14bdd37bede9fef80f4d3af4621ea5d60b2b16b)]:
|
|
8
|
+
- @hzblj/kara-native@0.4.1
|
|
9
|
+
- @hzblj/kara-theme@0.4.1
|
|
10
|
+
- @hzblj/kara-sx@0.4.1
|
|
11
|
+
|
|
12
|
+
## 0.4.0
|
|
13
|
+
|
|
14
|
+
### Minor Changes
|
|
15
|
+
|
|
16
|
+
- [`6e7903a`](https://github.com/hzblj/kara-ui/commit/6e7903afa3d3442e04a48a6e24399f9f03559a03) Thanks [@hzblj](https://github.com/hzblj)! - Android polish, and a new `RnListItem`.
|
|
17
|
+
|
|
18
|
+
- `ContextMenu` on Android is a proper long-press menu: a ripple and the long-press haptic, then a Material dropdown where the finger is, with the actions' icons and the trigger highlighted while it is open. The ripple and highlight stay inside rounded corners.
|
|
19
|
+
- A pressable `HStack`, `VStack` or `ZStack` ripples across its whole shape, padding included; `ListItem` and `LabeledContent` take `px` so a row in a card can carry the card's padding inside its press area.
|
|
20
|
+
- `ListItem` keeps its chevron when the subtitle fills the line.
|
|
21
|
+
- `Tabs` take the theme's colours: on Android the bar, active indicator, icons, labels and ripple come from tokens instead of the wallpaper scheme; on iOS the selected item takes the accent.
|
|
22
|
+
- New `RnListItem`: `ListItem`'s row in the React Native tier, cheap to mount by the dozen, with a full-row ripple on Android and a highlight on iOS.
|
|
23
|
+
|
|
24
|
+
### Patch Changes
|
|
25
|
+
|
|
26
|
+
- Updated dependencies []:
|
|
27
|
+
- @hzblj/kara-theme@0.4.0
|
|
28
|
+
- @hzblj/kara-sx@0.4.0
|
|
29
|
+
- @hzblj/kara-native@0.4.0
|
|
30
|
+
|
|
3
31
|
## 0.3.0
|
|
4
32
|
|
|
5
33
|
### Minor Changes
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Row } from '@expo/ui/jetpack-compose';
|
|
4
|
-
import { clickable, testID as testIdModifier } from '@expo/ui/jetpack-compose/modifiers';
|
|
5
|
-
import { useSxModifiers } from '@hzblj/kara-sx';
|
|
6
4
|
import { spacing } from '@hzblj/kara-theme';
|
|
7
|
-
import { useMemo } from 'react';
|
|
8
5
|
import { useHostGuard } from "../../host-context.js";
|
|
6
|
+
import { useStackModifiers } from "../../use-stack-modifiers.js";
|
|
9
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
8
|
const ALIGNMENT = {
|
|
11
9
|
center: 'center',
|
|
@@ -21,8 +19,7 @@ export const HStack = ({
|
|
|
21
19
|
...sx
|
|
22
20
|
}) => {
|
|
23
21
|
useHostGuard('HStack');
|
|
24
|
-
const
|
|
25
|
-
const modifiers = useMemo(() => [...sxModifiers, ...(testID ? [testIdModifier(testID)] : []), ...(onPress ? [clickable(onPress)] : [])], [onPress, sxModifiers, testID]);
|
|
22
|
+
const modifiers = useStackModifiers(sx, onPress, testID);
|
|
26
23
|
return /*#__PURE__*/_jsx(Row, {
|
|
27
24
|
verticalAlignment: ALIGNMENT[align],
|
|
28
25
|
horizontalArrangement: gap === undefined ? undefined : {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Row","
|
|
1
|
+
{"version":3,"names":["Row","spacing","useHostGuard","useStackModifiers","jsx","_jsx","ALIGNMENT","center","end","start","HStack","align","children","onPress","gap","testID","sx","modifiers","verticalAlignment","horizontalArrangement","undefined","spacedBy"],"sourceRoot":"../../../../src","sources":["atoms/h-stack/h-stack.android.tsx"],"mappings":";;AAAA,SAAQA,GAAG,QAAO,0BAA0B;AAC5C,SAAQC,OAAO,QAAO,mBAAmB;AACzC,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,iBAAiB,QAAO,8BAA2B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAG3D,MAAMC,SAAS,GAAG;EAChBC,MAAM,EAAE,QAAQ;EAChBC,GAAG,EAAE,QAAQ;EACbC,KAAK,EAAE;AACT,CAAgD;AAEhD,OAAO,MAAMC,MAAuB,GAAGA,CAAC;EACtCC,KAAK,GAAG,OAAO;EACfC,QAAQ;EACRC,OAAO;EACPZ,OAAO,EAAEa,GAAG;EACZC,MAAM;EACN,GAAGC;AACQ,CAAC,KAAK;EACjBd,YAAY,CAAC,QAAQ,CAAC;EACtB,MAAMe,SAAS,GAAGd,iBAAiB,CAACa,EAAE,EAAEH,OAAO,EAAEE,MAAM,CAAC;EAExD,oBACEV,IAAA,CAACL,GAAG;IACFkB,iBAAiB,EAAEZ,SAAS,CAACK,KAAK,CAAE;IACpCQ,qBAAqB,EAAEL,GAAG,KAAKM,SAAS,GAAGA,SAAS,GAAG;MAACC,QAAQ,EAAEpB,OAAO,CAACa,GAAG;IAAC,CAAE;IAChFG,SAAS,EAAEA,SAAU;IAAAL,QAAA,EAEpBA;EAAQ,CACN,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Column } from '@expo/ui/jetpack-compose';
|
|
4
|
-
import { clickable, testID as testIdModifier } from '@expo/ui/jetpack-compose/modifiers';
|
|
5
|
-
import { useSxModifiers } from '@hzblj/kara-sx';
|
|
6
4
|
import { spacing } from '@hzblj/kara-theme';
|
|
7
|
-
import { useMemo } from 'react';
|
|
8
5
|
import { useHostGuard } from "../../host-context.js";
|
|
6
|
+
import { useStackModifiers } from "../../use-stack-modifiers.js";
|
|
9
7
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
10
8
|
const ALIGNMENT = {
|
|
11
9
|
center: 'center',
|
|
@@ -21,8 +19,7 @@ export const VStack = ({
|
|
|
21
19
|
...sx
|
|
22
20
|
}) => {
|
|
23
21
|
useHostGuard('VStack');
|
|
24
|
-
const
|
|
25
|
-
const modifiers = useMemo(() => [...sxModifiers, ...(testID ? [testIdModifier(testID)] : []), ...(onPress ? [clickable(onPress)] : [])], [onPress, sxModifiers, testID]);
|
|
22
|
+
const modifiers = useStackModifiers(sx, onPress, testID);
|
|
26
23
|
return /*#__PURE__*/_jsx(Column, {
|
|
27
24
|
horizontalAlignment: ALIGNMENT[align],
|
|
28
25
|
verticalArrangement: gap === undefined ? undefined : {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Column","
|
|
1
|
+
{"version":3,"names":["Column","spacing","useHostGuard","useStackModifiers","jsx","_jsx","ALIGNMENT","center","end","start","VStack","align","children","onPress","gap","testID","sx","modifiers","horizontalAlignment","verticalArrangement","undefined","spacedBy"],"sourceRoot":"../../../../src","sources":["atoms/v-stack/v-stack.android.tsx"],"mappings":";;AAAA,SAAQA,MAAM,QAAO,0BAA0B;AAC/C,SAAQC,OAAO,QAAO,mBAAmB;AACzC,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,iBAAiB,QAAO,8BAA2B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAG3D,MAAMC,SAAS,GAAG;EAChBC,MAAM,EAAE,QAAQ;EAChBC,GAAG,EAAE,KAAK;EACVC,KAAK,EAAE;AACT,CAAgD;AAEhD,OAAO,MAAMC,MAAuB,GAAGA,CAAC;EACtCC,KAAK,GAAG,OAAO;EACfC,QAAQ;EACRC,OAAO;EACPZ,OAAO,EAAEa,GAAG;EACZC,MAAM;EACN,GAAGC;AACQ,CAAC,KAAK;EACjBd,YAAY,CAAC,QAAQ,CAAC;EACtB,MAAMe,SAAS,GAAGd,iBAAiB,CAACa,EAAE,EAAEH,OAAO,EAAEE,MAAM,CAAC;EAExD,oBACEV,IAAA,CAACL,MAAM;IACLkB,mBAAmB,EAAEZ,SAAS,CAACK,KAAK,CAAE;IACtCQ,mBAAmB,EAAEL,GAAG,KAAKM,SAAS,GAAGA,SAAS,GAAG;MAACC,QAAQ,EAAEpB,OAAO,CAACa,GAAG;IAAC,CAAE;IAC9EG,SAAS,EAAEA,SAAU;IAAAL,QAAA,EAEpBA;EAAQ,CACH,CAAC;AAEb,CAAC","ignoreList":[]}
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
import { Box } from '@expo/ui/jetpack-compose';
|
|
4
|
-
import { clickable, testID as testIdModifier } from '@expo/ui/jetpack-compose/modifiers';
|
|
5
|
-
import { useSxModifiers } from '@hzblj/kara-sx';
|
|
6
|
-
import { useMemo } from 'react';
|
|
7
4
|
import { useHostGuard } from "../../host-context.js";
|
|
5
|
+
import { useStackModifiers } from "../../use-stack-modifiers.js";
|
|
8
6
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
9
7
|
const ALIGNMENT = {
|
|
10
8
|
bottom: 'bottomCenter',
|
|
@@ -19,8 +17,7 @@ export const ZStack = ({
|
|
|
19
17
|
...sx
|
|
20
18
|
}) => {
|
|
21
19
|
useHostGuard('ZStack');
|
|
22
|
-
const
|
|
23
|
-
const modifiers = useMemo(() => [...sxModifiers, ...(testID ? [testIdModifier(testID)] : []), ...(onPress ? [clickable(onPress)] : [])], [onPress, sxModifiers, testID]);
|
|
20
|
+
const modifiers = useStackModifiers(sx, onPress, testID);
|
|
24
21
|
return /*#__PURE__*/_jsx(Box, {
|
|
25
22
|
contentAlignment: ALIGNMENT[align],
|
|
26
23
|
modifiers: modifiers,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Box","
|
|
1
|
+
{"version":3,"names":["Box","useHostGuard","useStackModifiers","jsx","_jsx","ALIGNMENT","bottom","center","top","ZStack","align","children","onPress","testID","sx","modifiers","contentAlignment"],"sourceRoot":"../../../../src","sources":["atoms/z-stack/z-stack.android.tsx"],"mappings":";;AAAA,SAAQA,GAAG,QAAO,0BAA0B;AAC5C,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,iBAAiB,QAAO,8BAA2B;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAG3D,MAAMC,SAAS,GAAG;EAChBC,MAAM,EAAE,cAAc;EACtBC,MAAM,EAAE,QAAQ;EAChBC,GAAG,EAAE;AACP,CAAgD;AAEhD,OAAO,MAAMC,MAAuB,GAAGA,CAAC;EAACC,KAAK,GAAG,QAAQ;EAAEC,QAAQ;EAAEC,OAAO;EAAEC,MAAM;EAAE,GAAGC;AAAe,CAAC,KAAK;EAC5Gb,YAAY,CAAC,QAAQ,CAAC;EACtB,MAAMc,SAAS,GAAGb,iBAAiB,CAACY,EAAE,EAAEF,OAAO,EAAEC,MAAM,CAAC;EAExD,oBACET,IAAA,CAACJ,GAAG;IAACgB,gBAAgB,EAAEX,SAAS,CAACK,KAAK,CAAE;IAACK,SAAS,EAAEA,SAAU;IAAAJ,QAAA,EAC3DA;EAAQ,CACN,CAAC;AAEV,CAAC","ignoreList":[]}
|
|
@@ -9,6 +9,7 @@ export * from "./list-item/index.js";
|
|
|
9
9
|
export * from "./navigation-bar/index.js";
|
|
10
10
|
export * from "./pager/index.js";
|
|
11
11
|
export * from "./radio-group/index.js";
|
|
12
|
+
export * from "./rn-list-item/index.js";
|
|
12
13
|
export * from "./rn-tooltip/index.js";
|
|
13
14
|
export * from "./scroll-edge-container/index.js";
|
|
14
15
|
export * from "./search-bar/index.js";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["molecules/index.ts"],"mappings":";;AAAA,cAAc,wBAAe;AAC7B,cAAc,wBAAe;AAC7B,cAAc,kBAAS;AACvB,cAAc,4BAAmB;AACjC,cAAc,iBAAQ;AACtB,cAAc,sBAAa;AAC3B,cAAc,2BAAkB;AAChC,cAAc,kBAAS;AACvB,cAAc,wBAAe;AAC7B,cAAc,uBAAc;AAC5B,cAAc,kCAAyB;AACvC,cAAc,uBAAc;AAC5B,cAAc,oBAAW;AACzB,cAAc,oBAAW","ignoreList":[]}
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../src","sources":["molecules/index.ts"],"mappings":";;AAAA,cAAc,wBAAe;AAC7B,cAAc,wBAAe;AAC7B,cAAc,kBAAS;AACvB,cAAc,4BAAmB;AACjC,cAAc,iBAAQ;AACtB,cAAc,sBAAa;AAC3B,cAAc,2BAAkB;AAChC,cAAc,kBAAS;AACvB,cAAc,wBAAe;AAC7B,cAAc,yBAAgB;AAC9B,cAAc,uBAAc;AAC5B,cAAc,kCAAyB;AACvC,cAAc,uBAAc;AAC5B,cAAc,oBAAW;AACzB,cAAc,oBAAW","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HStack","Icon","Spacer","Text","Glyph","jsx","_jsx","jsxs","_jsxs","TrailingValue","value","color","variant","children","LabeledContent","icon","label","onPress","testID","align","py","spacing","wide","name","size","undefined"],"sourceRoot":"../../../../src","sources":["molecules/labeled-content/labeled-content.tsx"],"mappings":";;AAAA,SAAQA,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,MAAM,QAAO,6BAAoB;AACzC,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,KAAK,QAAO,sBAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGjC,MAAMC,aAAa,GAAGA,CAAC;EAACC;AAAsB,CAAC,kBAC7CJ,IAAA,CAACH,IAAI;EAACQ,KAAK,EAAC,mBAAmB;EAACC,OAAO,EAAC,MAAM;EAAAC,QAAA,EAC3CH;AAAK,CACF,CACP;AAED,OAAO,MAAMI,cAAuC,GAAGA,CAAC;EACtDD,QAAQ;EACRE,IAAI;EACJC,KAAK;EACLC,OAAO;EACPC,MAAM;
|
|
1
|
+
{"version":3,"names":["HStack","Icon","Spacer","Text","Glyph","jsx","_jsx","jsxs","_jsxs","TrailingValue","value","color","variant","children","LabeledContent","icon","label","onPress","px","testID","align","py","spacing","wide","name","size","undefined"],"sourceRoot":"../../../../src","sources":["molecules/labeled-content/labeled-content.tsx"],"mappings":";;AAAA,SAAQA,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,MAAM,QAAO,6BAAoB;AACzC,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,KAAK,QAAO,sBAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGjC,MAAMC,aAAa,GAAGA,CAAC;EAACC;AAAsB,CAAC,kBAC7CJ,IAAA,CAACH,IAAI;EAACQ,KAAK,EAAC,mBAAmB;EAACC,OAAO,EAAC,MAAM;EAAAC,QAAA,EAC3CH;AAAK,CACF,CACP;AAED,OAAO,MAAMI,cAAuC,GAAGA,CAAC;EACtDD,QAAQ;EACRE,IAAI;EACJC,KAAK;EACLC,OAAO;EACPC,EAAE;EACFC,MAAM;EACNT;AACmB,CAAC,kBACpBF,KAAA,CAACR,MAAM;EAACoB,KAAK,EAAC,QAAQ;EAACH,OAAO,EAAEA,OAAQ;EAACC,EAAE,EAAEA,EAAG;EAACG,EAAE,EAAC,IAAI;EAACC,OAAO,EAAC,KAAK;EAACH,MAAM,EAAEA,MAAO;EAACI,IAAI;EAAAV,QAAA,GACxFE,IAAI,gBAAGT,IAAA,CAACL,IAAI;IAACU,KAAK,EAAC,mBAAmB;IAACa,IAAI,EAAET,IAAK;IAACU,IAAI,EAAC;EAAK,CAAE,CAAC,GAAG,IAAI,eACxEnB,IAAA,CAACH,IAAI;IAACS,OAAO,EAAC,MAAM;IAAAC,QAAA,EAAEG;EAAK,CAAO,CAAC,eACnCV,IAAA,CAACJ,MAAM,IAAE,CAAC,EACTW,QAAQ,KAAKH,KAAK,KAAKgB,SAAS,GAAG,IAAI,gBAAGpB,IAAA,CAACG,aAAa;IAACC,KAAK,EAAEA;EAAM,CAAE,CAAC,CAAC,EAC1EO,OAAO,gBAAGX,IAAA,CAACF,KAAK;IAACO,KAAK,EAAC,oBAAoB;IAACa,IAAI,EAAC,cAAc;IAACC,IAAI,EAAC;EAAK,CAAE,CAAC,GAAG,IAAI;AAAA,CAC/E,CACT","ignoreList":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
import { Platform } from 'react-native';
|
|
3
4
|
import { HStack } from "../../atoms/h-stack/index.js";
|
|
4
5
|
import { Icon } from "../../atoms/icon/index.js";
|
|
5
6
|
import { Spacer } from "../../atoms/spacer/index.js";
|
|
@@ -7,15 +8,24 @@ import { Text } from "../../atoms/text/index.js";
|
|
|
7
8
|
import { VStack } from "../../atoms/v-stack/index.js";
|
|
8
9
|
import { Glyph } from "../../glyph/index.js";
|
|
9
10
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
/**
|
|
12
|
+
* Compose measures a row's children in order, so a text column that fills the line leaves the chevron no room. With a
|
|
13
|
+
* weight it is measured last and takes only what is left; SwiftUI shares the line by itself, with a `Spacer`.
|
|
14
|
+
*/
|
|
15
|
+
const TEXT_FILLS_ROW = {
|
|
16
|
+
weight: 1
|
|
17
|
+
};
|
|
10
18
|
export const ListItem = ({
|
|
11
19
|
icon,
|
|
12
20
|
onPress,
|
|
21
|
+
px,
|
|
13
22
|
subtitle,
|
|
14
23
|
testID,
|
|
15
24
|
title
|
|
16
25
|
}) => /*#__PURE__*/_jsxs(HStack, {
|
|
17
26
|
align: "center",
|
|
18
27
|
onPress: onPress,
|
|
28
|
+
px: px,
|
|
19
29
|
py: "s8",
|
|
20
30
|
spacing: "s12",
|
|
21
31
|
testID: testID,
|
|
@@ -25,6 +35,7 @@ export const ListItem = ({
|
|
|
25
35
|
name: icon,
|
|
26
36
|
size: "s20"
|
|
27
37
|
}) : null, /*#__PURE__*/_jsxs(VStack, {
|
|
38
|
+
android: TEXT_FILLS_ROW,
|
|
28
39
|
spacing: "s2",
|
|
29
40
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
30
41
|
variant: "body",
|
|
@@ -34,7 +45,7 @@ export const ListItem = ({
|
|
|
34
45
|
variant: "footnote",
|
|
35
46
|
children: subtitle
|
|
36
47
|
}) : null]
|
|
37
|
-
}), /*#__PURE__*/_jsx(Spacer, {}), onPress ? /*#__PURE__*/_jsx(Glyph, {
|
|
48
|
+
}), Platform.OS === 'ios' ? /*#__PURE__*/_jsx(Spacer, {}) : null, onPress ? /*#__PURE__*/_jsx(Glyph, {
|
|
38
49
|
color: "content.quaternary",
|
|
39
50
|
name: "chevronRight",
|
|
40
51
|
size: "s16"
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["HStack","Icon","Spacer","Text","VStack","Glyph","jsx","_jsx","jsxs","_jsxs","ListItem","icon","onPress","subtitle","testID","title","align","py","spacing","wide","children","color","name","size","variant"],"sourceRoot":"../../../../src","sources":["molecules/list-item/list-item.tsx"],"mappings":";;AAAA,SAAQA,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,MAAM,QAAO,6BAAoB;AACzC,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,KAAK,QAAO,sBAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGjC,OAAO,MAAMC,QAA2B,GAAGA,CAAC;EAACC,IAAI;EAAEC,OAAO;EAAEC,QAAQ;EAAEC,MAAM;EAAEC;AAAoB,CAAC,
|
|
1
|
+
{"version":3,"names":["Platform","HStack","Icon","Spacer","Text","VStack","Glyph","jsx","_jsx","jsxs","_jsxs","TEXT_FILLS_ROW","weight","ListItem","icon","onPress","px","subtitle","testID","title","align","py","spacing","wide","children","color","name","size","android","variant","OS"],"sourceRoot":"../../../../src","sources":["molecules/list-item/list-item.tsx"],"mappings":";;AAAA,SAAQA,QAAQ,QAAO,cAAc;AAErC,SAAQC,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,MAAM,QAAO,6BAAoB;AACzC,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,KAAK,QAAO,sBAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGjC;AACA;AACA;AACA;AACA,MAAMC,cAAc,GAAG;EAACC,MAAM,EAAE;AAAC,CAAC;AAElC,OAAO,MAAMC,QAA2B,GAAGA,CAAC;EAACC,IAAI;EAAEC,OAAO;EAAEC,EAAE;EAAEC,QAAQ;EAAEC,MAAM;EAAEC;AAAoB,CAAC,kBACrGT,KAAA,CAACT,MAAM;EAACmB,KAAK,EAAC,QAAQ;EAACL,OAAO,EAAEA,OAAQ;EAACC,EAAE,EAAEA,EAAG;EAACK,EAAE,EAAC,IAAI;EAACC,OAAO,EAAC,KAAK;EAACJ,MAAM,EAAEA,MAAO;EAACK,IAAI;EAAAC,QAAA,GACxFV,IAAI,gBAAGN,IAAA,CAACN,IAAI;IAACuB,KAAK,EAAC,mBAAmB;IAACC,IAAI,EAAEZ,IAAK;IAACa,IAAI,EAAC;EAAK,CAAE,CAAC,GAAG,IAAI,eACxEjB,KAAA,CAACL,MAAM;IAACuB,OAAO,EAAEjB,cAAe;IAACW,OAAO,EAAC,IAAI;IAAAE,QAAA,gBAC3ChB,IAAA,CAACJ,IAAI;MAACyB,OAAO,EAAC,MAAM;MAAAL,QAAA,EAAEL;IAAK,CAAO,CAAC,EAClCF,QAAQ,gBACPT,IAAA,CAACJ,IAAI;MAACqB,KAAK,EAAC,mBAAmB;MAACI,OAAO,EAAC,UAAU;MAAAL,QAAA,EAC/CP;IAAQ,CACL,CAAC,GACL,IAAI;EAAA,CACF,CAAC,EACRjB,QAAQ,CAAC8B,EAAE,KAAK,KAAK,gBAAGtB,IAAA,CAACL,MAAM,IAAE,CAAC,GAAG,IAAI,EACzCY,OAAO,gBAAGP,IAAA,CAACF,KAAK;IAACmB,KAAK,EAAC,oBAAoB;IAACC,IAAI,EAAC,cAAc;IAACC,IAAI,EAAC;EAAK,CAAE,CAAC,GAAG,IAAI;AAAA,CAC/E,CACT","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["molecules/rn-list-item/index.ts"],"mappings":";;AAAA,cAAc,mBAAgB;AAC9B,cAAc,yBAAsB","ignoreList":[]}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { useAppTheme } from '@hzblj/kara-theme';
|
|
4
|
+
import { useMemo } from 'react';
|
|
5
|
+
import { Platform, Pressable } from 'react-native';
|
|
6
|
+
import { Box } from "../../atoms/box/index.js";
|
|
7
|
+
import { RnIcon } from "../../atoms/rn-icon/index.js";
|
|
8
|
+
import { RnText } from "../../atoms/rn-text/index.js";
|
|
9
|
+
import { RnGlyph } from "../../glyph/index.js";
|
|
10
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
11
|
+
export const RnListItem = ({
|
|
12
|
+
icon,
|
|
13
|
+
onPress,
|
|
14
|
+
px,
|
|
15
|
+
subtitle,
|
|
16
|
+
testID,
|
|
17
|
+
title
|
|
18
|
+
}) => {
|
|
19
|
+
const theme = useAppTheme();
|
|
20
|
+
const pressedColor = theme.color('fill.tertiary');
|
|
21
|
+
const ripple = useMemo(() => ({
|
|
22
|
+
color: pressedColor
|
|
23
|
+
}), [pressedColor]);
|
|
24
|
+
const highlight = useMemo(() => Platform.OS === 'ios' ? ({
|
|
25
|
+
pressed
|
|
26
|
+
}) => pressed ? {
|
|
27
|
+
backgroundColor: pressedColor
|
|
28
|
+
} : null : undefined, [pressedColor]);
|
|
29
|
+
const row = /*#__PURE__*/_jsxs(Box, {
|
|
30
|
+
align: "center",
|
|
31
|
+
flexDirection: "row",
|
|
32
|
+
gap: "s12",
|
|
33
|
+
px: px,
|
|
34
|
+
py: "s12",
|
|
35
|
+
children: [icon ? /*#__PURE__*/_jsx(RnIcon, {
|
|
36
|
+
color: "content.secondary",
|
|
37
|
+
name: icon,
|
|
38
|
+
size: "s20"
|
|
39
|
+
}) : null, /*#__PURE__*/_jsxs(Box, {
|
|
40
|
+
flex: 1,
|
|
41
|
+
gap: "s2",
|
|
42
|
+
children: [/*#__PURE__*/_jsx(RnText, {
|
|
43
|
+
variant: "body",
|
|
44
|
+
children: title
|
|
45
|
+
}), subtitle ? /*#__PURE__*/_jsx(RnText, {
|
|
46
|
+
color: "content.secondary",
|
|
47
|
+
variant: "footnote",
|
|
48
|
+
children: subtitle
|
|
49
|
+
}) : null]
|
|
50
|
+
}), onPress ? /*#__PURE__*/_jsx(RnGlyph, {
|
|
51
|
+
color: "content.quaternary",
|
|
52
|
+
name: "chevronRight",
|
|
53
|
+
size: "s16"
|
|
54
|
+
}) : null]
|
|
55
|
+
});
|
|
56
|
+
if (!onPress) {
|
|
57
|
+
return /*#__PURE__*/_jsx(Box, {
|
|
58
|
+
testID: testID,
|
|
59
|
+
children: row
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
return /*#__PURE__*/_jsx(Pressable, {
|
|
63
|
+
accessibilityRole: "button",
|
|
64
|
+
android_ripple: ripple,
|
|
65
|
+
onPress: onPress,
|
|
66
|
+
style: highlight,
|
|
67
|
+
testID: testID,
|
|
68
|
+
children: row
|
|
69
|
+
});
|
|
70
|
+
};
|
|
71
|
+
//# sourceMappingURL=rn-list-item.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["useAppTheme","useMemo","Platform","Pressable","Box","RnIcon","RnText","RnGlyph","jsx","_jsx","jsxs","_jsxs","RnListItem","icon","onPress","px","subtitle","testID","title","theme","pressedColor","color","ripple","highlight","OS","pressed","backgroundColor","undefined","row","align","flexDirection","gap","py","children","name","size","flex","variant","accessibilityRole","android_ripple","style"],"sourceRoot":"../../../../src","sources":["molecules/rn-list-item/rn-list-item.tsx"],"mappings":";;AAAA,SAAQA,WAAW,QAAO,mBAAmB;AAC7C,SAAQC,OAAO,QAAO,OAAO;AAC7B,SAAQC,QAAQ,EAAEC,SAAS,QAAwC,cAAc;AAEjF,SAAQC,GAAG,QAAO,0BAAiB;AACnC,SAAQC,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,MAAM,QAAO,8BAAqB;AAC1C,SAAQC,OAAO,QAAO,sBAAa;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAGnC,OAAO,MAAMC,UAA+B,GAAGA,CAAC;EAACC,IAAI;EAAEC,OAAO;EAAEC,EAAE;EAAEC,QAAQ;EAAEC,MAAM;EAAEC;AAAsB,CAAC,KAAK;EAChH,MAAMC,KAAK,GAAGnB,WAAW,CAAC,CAAC;EAC3B,MAAMoB,YAAY,GAAGD,KAAK,CAACE,KAAK,CAAC,eAAe,CAAC;EAEjD,MAAMC,MAA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AgB,QAAA,EAAEL;IAAG,CAAM,CAAC;EACzC;EAEA,oBACEnB,IAAA,CAACN,SAAS;IAACmC,iBAAiB,EAAC,QAAQ;IAACC,cAAc,EAAEjB,MAAO;IAACR,OAAO,EAAEA,OAAQ;IAAC0B,KAAK,EAAEjB,SAAU;IAACN,MAAM,EAAEA,MAAO;IAAAgB,QAAA,EAC9GL;EAAG,CACK,CAAC;AAEhB,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":[],"sourceRoot":"../../../../src","sources":["molecules/rn-list-item/rn-list-item.types.ts"],"mappings":"","ignoreList":[]}
|
|
@@ -3,18 +3,17 @@
|
|
|
3
3
|
import { Text as ComposeText, DropdownMenu, DropdownMenuItem, Host } from '@expo/ui/jetpack-compose';
|
|
4
4
|
import { useSx } from '@hzblj/kara-sx';
|
|
5
5
|
import { useAppTheme } from '@hzblj/kara-theme';
|
|
6
|
-
import
|
|
6
|
+
import * as Haptics from 'expo-haptics';
|
|
7
|
+
import { useCallback, useMemo, useRef, useState } from 'react';
|
|
7
8
|
import { Pressable, StyleSheet, View } from 'react-native';
|
|
9
|
+
import { Icon } from "../../atoms/icon/index.js";
|
|
10
|
+
import { HostBoundary } from "../../host-context.js";
|
|
11
|
+
import { splitForRipple } from "../../ripple-clip.js";
|
|
8
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
9
|
-
/**
|
|
10
|
-
* The menu's anchor: a point at the trigger's bottom start, so the dropdown opens just under it. The host lies outside
|
|
11
|
-
* the touch path — the dropdown is a popup window of its own, which takes its touches regardless.
|
|
12
|
-
*/
|
|
13
13
|
const styles = StyleSheet.create({
|
|
14
|
+
/** A point under the finger: the dropdown opens from it. The menu is a popup window, so nothing clips it. */
|
|
14
15
|
anchor: {
|
|
15
|
-
bottom: 0,
|
|
16
16
|
height: 1,
|
|
17
|
-
left: 0,
|
|
18
17
|
position: 'absolute',
|
|
19
18
|
width: 1
|
|
20
19
|
}
|
|
@@ -25,26 +24,34 @@ const MenuRow = ({
|
|
|
25
24
|
onDismiss
|
|
26
25
|
}) => {
|
|
27
26
|
const theme = useAppTheme();
|
|
27
|
+
const color = action.destructive ? 'content.destructive' : 'content.primary';
|
|
28
28
|
const onClick = useCallback(() => {
|
|
29
29
|
onDismiss();
|
|
30
30
|
action.onPress();
|
|
31
31
|
}, [action, onDismiss]);
|
|
32
|
-
return /*#__PURE__*/
|
|
32
|
+
return /*#__PURE__*/_jsxs(DropdownMenuItem, {
|
|
33
33
|
onClick: onClick,
|
|
34
|
-
children: /*#__PURE__*/_jsx(DropdownMenuItem.Text, {
|
|
34
|
+
children: [/*#__PURE__*/_jsx(DropdownMenuItem.Text, {
|
|
35
35
|
children: /*#__PURE__*/_jsx(ComposeText, {
|
|
36
|
-
color: theme.colorString(
|
|
36
|
+
color: theme.colorString(color),
|
|
37
37
|
style: theme.typography.body,
|
|
38
38
|
children: action.label
|
|
39
39
|
})
|
|
40
|
-
})
|
|
40
|
+
}), action.icon ? /*#__PURE__*/_jsx(DropdownMenuItem.LeadingIcon, {
|
|
41
|
+
children: /*#__PURE__*/_jsx(Icon, {
|
|
42
|
+
color: color,
|
|
43
|
+
name: action.icon,
|
|
44
|
+
size: "s20"
|
|
45
|
+
})
|
|
46
|
+
}) : null]
|
|
41
47
|
});
|
|
42
48
|
};
|
|
43
49
|
|
|
44
50
|
/**
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
*
|
|
51
|
+
* Android's own take on a context menu, since Material has no lifted preview: a long press ripples the trigger, ticks
|
|
52
|
+
* the long-press haptic, and opens a Material dropdown where the finger is — the trigger stays highlighted while the
|
|
53
|
+
* menu is up. The host behind the menu mounts on the first long press and stays, so a list of triggers that are only
|
|
54
|
+
* scrolled past never builds one. `preview` and `onPreviewPress` are iOS-only.
|
|
48
55
|
*/
|
|
49
56
|
const ContextMenuRoot = ({
|
|
50
57
|
actions,
|
|
@@ -58,34 +65,72 @@ const ContextMenuRoot = ({
|
|
|
58
65
|
...sx
|
|
59
66
|
} = props;
|
|
60
67
|
const theme = useAppTheme();
|
|
61
|
-
const
|
|
62
|
-
const
|
|
68
|
+
const resolved = useSx(sx);
|
|
69
|
+
const trigger = useRef(null);
|
|
70
|
+
const [anchor, setAnchor] = useState(null);
|
|
63
71
|
const [expanded, setExpanded] = useState(false);
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
72
|
+
|
|
73
|
+
// The shape clips on an outer view, so the ripple and the highlight follow the trigger's rounded corners.
|
|
74
|
+
const {
|
|
75
|
+
inner,
|
|
76
|
+
outer
|
|
77
|
+
} = useMemo(() => splitForRipple(resolved), [resolved]);
|
|
78
|
+
const ripple = useMemo(() => ({
|
|
79
|
+
color: theme.color('fill.tertiary')
|
|
80
|
+
}), [theme]);
|
|
81
|
+
const highlight = useMemo(() => ({
|
|
82
|
+
backgroundColor: theme.color('fill.tertiary')
|
|
83
|
+
}), [theme]);
|
|
84
|
+
const open = useCallback(event => {
|
|
85
|
+
const {
|
|
86
|
+
pageX,
|
|
87
|
+
pageY
|
|
88
|
+
} = event.nativeEvent;
|
|
89
|
+
Haptics.performAndroidHapticsAsync(Haptics.AndroidHaptics.Long_Press).catch(() => undefined);
|
|
90
|
+
// The touch in the trigger's own coordinates: `locationX/Y` are relative to whichever child was touched.
|
|
91
|
+
trigger.current?.measure((_x, _y, _width, _height, left, top) => {
|
|
92
|
+
setAnchor({
|
|
93
|
+
x: pageX - left,
|
|
94
|
+
y: pageY - top
|
|
95
|
+
});
|
|
96
|
+
setExpanded(true);
|
|
97
|
+
});
|
|
67
98
|
}, []);
|
|
68
99
|
const dismiss = useCallback(() => setExpanded(false), []);
|
|
69
|
-
return /*#__PURE__*/
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
100
|
+
return /*#__PURE__*/_jsx(View, {
|
|
101
|
+
style: outer,
|
|
102
|
+
children: /*#__PURE__*/_jsxs(Pressable, {
|
|
103
|
+
android_ripple: ripple,
|
|
104
|
+
onLongPress: open,
|
|
105
|
+
ref: trigger,
|
|
106
|
+
style: inner,
|
|
107
|
+
testID: testID,
|
|
108
|
+
children: [expanded ? /*#__PURE__*/_jsx(View, {
|
|
109
|
+
pointerEvents: "none",
|
|
110
|
+
style: [StyleSheet.absoluteFill, highlight]
|
|
111
|
+
}) : null, children, anchor ? /*#__PURE__*/_jsx(Host, {
|
|
112
|
+
colorScheme: theme.dark ? 'dark' : 'light',
|
|
113
|
+
pointerEvents: "none",
|
|
114
|
+
seedColor: theme.materialSeed,
|
|
115
|
+
style: [styles.anchor, {
|
|
116
|
+
left: anchor.x,
|
|
117
|
+
top: anchor.y
|
|
118
|
+
}],
|
|
119
|
+
children: /*#__PURE__*/_jsx(HostBoundary, {
|
|
120
|
+
children: /*#__PURE__*/_jsx(DropdownMenu, {
|
|
121
|
+
color: theme.color('surface.primary'),
|
|
122
|
+
expanded: expanded,
|
|
123
|
+
onDismissRequest: dismiss,
|
|
124
|
+
children: /*#__PURE__*/_jsx(DropdownMenu.Items, {
|
|
125
|
+
children: actions.map(action => /*#__PURE__*/_jsx(MenuRow, {
|
|
126
|
+
action: action,
|
|
127
|
+
onDismiss: dismiss
|
|
128
|
+
}, action.label))
|
|
129
|
+
})
|
|
130
|
+
})
|
|
86
131
|
})
|
|
87
|
-
})
|
|
88
|
-
})
|
|
132
|
+
}) : null]
|
|
133
|
+
})
|
|
89
134
|
});
|
|
90
135
|
};
|
|
91
136
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["Text","ComposeText","DropdownMenu","DropdownMenuItem","Host","useSx","useAppTheme","useCallback","useState","Pressable","StyleSheet","View","jsx","_jsx","jsxs","_jsxs","styles","create","anchor","
|
|
1
|
+
{"version":3,"names":["Text","ComposeText","DropdownMenu","DropdownMenuItem","Host","useSx","useAppTheme","Haptics","useCallback","useMemo","useRef","useState","Pressable","StyleSheet","View","Icon","HostBoundary","splitForRipple","jsx","_jsx","jsxs","_jsxs","styles","create","anchor","height","position","width","MenuRow","action","onDismiss","theme","color","destructive","onClick","onPress","children","colorString","style","typography","body","label","icon","LeadingIcon","name","size","ContextMenuRoot","actions","testID","props","onPreviewPress","_onPreviewPress","preview","_preview","sx","resolved","trigger","setAnchor","expanded","setExpanded","inner","outer","ripple","highlight","backgroundColor","open","event","pageX","pageY","nativeEvent","performAndroidHapticsAsync","AndroidHaptics","Long_Press","catch","undefined","current","measure","_x","_y","_width","_height","left","top","x","y","dismiss","android_ripple","onLongPress","ref","pointerEvents","absoluteFill","colorScheme","dark","seedColor","materialSeed","onDismissRequest","Items","map","Exclusion","ContextMenu","Object","assign"],"sourceRoot":"../../../../src","sources":["organisms/context-menu/context-menu.android.tsx"],"mappings":";;AAAA,SAAQA,IAAI,IAAIC,WAAW,EAAEC,YAAY,EAAEC,gBAAgB,EAAEC,IAAI,QAAO,0BAA0B;AAClG,SAAQC,KAAK,QAAO,gBAAgB;AACpC,SAAQC,WAAW,QAAO,mBAAmB;AAC7C,OAAO,KAAKC,OAAO,MAAM,cAAc;AACvC,SAAQC,WAAW,EAAEC,OAAO,EAAEC,MAAM,EAAEC,QAAQ,QAAO,OAAO;AAC5D,SAAoCC,SAAS,EAAEC,UAAU,EAAEC,IAAI,QAAO,cAAc;AACpF,SAAQC,IAAI,QAAO,2BAAkB;AACrC,SAAQC,YAAY,QAAO,uBAAoB;AAC/C,SAAQC,cAAc,QAAO,sBAAmB;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAMhD,MAAMC,MAAM,GAAGT,UAAU,CAACU,MAAM,CAAC;EAC/B;EACAC,MAAM,EAAE;IAACC,MAAM,EAAE,CAAC;IAAEC,QAAQ,EAAE,UAAU;IAAEC,KAAK,EAA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MAAM,iBACjBV,IAAA,CAACS,OAAO;gBAACC,MAAM,EAAEA,MAAO;gBAAoBC,SAAS,EAAEuD;cAAQ,GAAjCxD,MAAM,CAACY,KAA4B,CAClE;YAAC,CACgB;UAAC,CACT;QAAC,CACH;MAAC,CACX,CAAC,GACL,IAAI;IAAA,CACC;EAAC,CACR,CAAC;AAEX,CAAC;;AAED;AACA,MAAMyD,SAAS,GAAGA,CAAC;EAAC9D;AAAmC,CAAC,kBAAKjB,IAAA,CAACL,IAAI;EAAAsB,QAAA,EAAEA;AAAQ,CAAO,CAAC;AAEpF,OAAO,MAAM+D,WAAiC,GAAGC,MAAM,CAACC,MAAM,CAACvD,eAAe,EAAE;EAACoD;AAAS,CAAC,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { StyleSheet } from 'react-native';
|
|
4
|
+
|
|
5
|
+
/** What lays out a view's children — it goes on the pressable inside, so the content sits where the caller put it. */
|
|
6
|
+
const CONTENT_KEYS = new Set(['alignContent', 'alignItems', 'columnGap', 'flexDirection', 'flexWrap', 'gap', 'justifyContent', 'padding', 'paddingBottom', 'paddingEnd', 'paddingHorizontal', 'paddingLeft', 'paddingRight', 'paddingStart', 'paddingTop', 'paddingVertical', 'rowGap']);
|
|
7
|
+
const FILL = {
|
|
8
|
+
flexGrow: 1
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Splits a resolved style for a pressable with an Android ripple. The ripple is drawn as the pressable's foreground,
|
|
13
|
+
* which its own `overflow: hidden` does not clip — so it would spill past rounded corners. A parent clips its
|
|
14
|
+
* children's foregrounds, though: the outer view takes the shape, background, border and outer layout and clips; the
|
|
15
|
+
* pressable inside takes the padding and the content layout and fills it, so the ripple covers the whole card and
|
|
16
|
+
* stops at its corners.
|
|
17
|
+
*/
|
|
18
|
+
export const splitForRipple = style => {
|
|
19
|
+
const flat = StyleSheet.flatten(style) ?? {};
|
|
20
|
+
const outer = {
|
|
21
|
+
overflow: 'hidden'
|
|
22
|
+
};
|
|
23
|
+
const inner = {};
|
|
24
|
+
for (const [key, value] of Object.entries(flat)) {
|
|
25
|
+
if (CONTENT_KEYS.has(key)) {
|
|
26
|
+
inner[key] = value;
|
|
27
|
+
} else if (key !== 'overflow') {
|
|
28
|
+
outer[key] = value;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return {
|
|
32
|
+
inner: [FILL, inner],
|
|
33
|
+
outer: outer
|
|
34
|
+
};
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=ripple-clip.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["StyleSheet","CONTENT_KEYS","Set","FILL","flexGrow","splitForRipple","style","flat","flatten","outer","overflow","inner","key","value","Object","entries","has"],"sourceRoot":"../../src","sources":["ripple-clip.ts"],"mappings":";;AAAA,SAAQA,UAAU,QAAuB,cAAc;;AAEvD;AACA,MAAMC,YAAY,GAAG,IAAIC,GAAG,CAAS,CACnC,cAAc,EACd,YAAY,EACZ,WAAW,EACX,eAAe,EACf,UAAU,EACV,KAAK,EACL,gBAAgB,EAChB,SAAS,EACT,eAAe,EACf,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,cAAc,EACd,YAAY,EACZ,iBAAiB,EACjB,QAAQ,CACT,CAAC;AAEF,MAAMC,IAAe,GAAG;EAACC,QAAQ,EAAE;AAAC,CAAC;;AAErC;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,cAAc,GAAIC,KAA4B,IAA6C;EACtG,MAAMC,IAAI,GAAGP,UAAU,CAACQ,OAAO,CAACF,KAAK,CAAC,IAAI,CAAC,CAAC;EAC5C,MAAMG,KAA8B,GAAG;IAACC,QAAQ,EAAE;EAAQ,CAAC;EAC3D,MAAMC,KAA8B,GAAG,CAAC,CAAC;EAEzC,KAAK,MAAM,CAACC,GAAG,EAAEC,KAAK,CAAC,IAAIC,MAAM,CAACC,OAAO,CAACR,IAAI,CAAC,EAAE;IAC/C,IAAIN,YAAY,CAACe,GAAG,CAACJ,GAAG,CAAC,EAAE;MACzBD,KAAK,CAACC,GAAG,CAAC,GAAGC,KAAK;IACpB,CAAC,MAAM,IAAID,GAAG,KAAK,UAAU,EAAE;MAC7BH,KAAK,CAACG,GAAG,CAAC,GAAGC,KAAK;IACpB;EACF;EAEA,OAAO;IAACF,KAAK,EAAE,CAACR,IAAI,EAAEQ,KAAK,CAAc;IAAEF,KAAK,EAAEA;EAAkB,CAAC;AACvE,CAAC","ignoreList":[]}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { clickable, testID as testIdModifier } from '@expo/ui/jetpack-compose/modifiers';
|
|
4
|
+
import { useSxModifiers } from '@hzblj/kara-sx';
|
|
5
|
+
import { useMemo } from 'react';
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* A Compose stack's modifiers in the order a pressable one needs: its frame, shape and background, then the press,
|
|
9
|
+
* then its padding. Compose clips a `clickable` to what comes after it, so with the padding first the ripple would stop
|
|
10
|
+
* at the padding and a row pressed by its edge would light up only in the middle.
|
|
11
|
+
*/
|
|
12
|
+
export const useStackModifiers = (sx, onPress, testID) => {
|
|
13
|
+
const {
|
|
14
|
+
p,
|
|
15
|
+
pb,
|
|
16
|
+
pl,
|
|
17
|
+
pr,
|
|
18
|
+
pt,
|
|
19
|
+
px,
|
|
20
|
+
py,
|
|
21
|
+
...frame
|
|
22
|
+
} = sx;
|
|
23
|
+
const frameModifiers = useSxModifiers(frame);
|
|
24
|
+
const paddingModifiers = useSxModifiers({
|
|
25
|
+
p,
|
|
26
|
+
pb,
|
|
27
|
+
pl,
|
|
28
|
+
pr,
|
|
29
|
+
pt,
|
|
30
|
+
px,
|
|
31
|
+
py
|
|
32
|
+
});
|
|
33
|
+
return useMemo(() => [...frameModifiers, ...(testID ? [testIdModifier(testID)] : []), ...(onPress ? [clickable(onPress)] : []), ...paddingModifiers], [frameModifiers, onPress, paddingModifiers, testID]);
|
|
34
|
+
};
|
|
35
|
+
//# sourceMappingURL=use-stack-modifiers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["clickable","testID","testIdModifier","useSxModifiers","useMemo","useStackModifiers","sx","onPress","p","pb","pl","pr","pt","px","py","frame","frameModifiers","paddingModifiers"],"sourceRoot":"../../src","sources":["use-stack-modifiers.ts"],"mappings":";;AAAA,SAAQA,SAAS,EAAuBC,MAAM,IAAIC,cAAc,QAAO,oCAAoC;AAC3G,SAA2BC,cAAc,QAAO,gBAAgB;AAChE,SAAQC,OAAO,QAAO,OAAO;;AAE7B;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,iBAAiB,GAAGA,CAACC,EAAgB,EAAEC,OAAoB,EAAEN,MAAe,KAAuB;EAC9G,MAAM;IAACO,CAAC;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;IAAE,GAAGC;EAAK,CAAC,GAAGT,EAAE;EAChD,MAAMU,cAAc,GAAGb,cAAc,CAACY,KAAK,CAAC;EAC5C,MAAME,gBAAgB,GAAGd,cAAc,CAAC;IAACK,CAAC;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;IAAEC,EAAE;IAAEC;EAAE,CAAC,CAAC;EAEpE,OAAOV,OAAO,CACZ,MAAM,CACJ,GAAGY,cAAc,EACjB,IAAIf,MAAM,GAAG,CAACC,cAAc,CAACD,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,EAC3C,IAAIM,OAAO,GAAG,CAACP,SAAS,CAACO,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EACxC,GAAGU,gBAAgB,CACpB,EACD,CAACD,cAAc,EAAET,OAAO,EAAEU,gBAAgB,EAAEhB,MAAM,CACpD,CAAC;AACH,CAAC","ignoreList":[]}
|
|
@@ -7,6 +7,7 @@ export * from './list-item';
|
|
|
7
7
|
export * from './navigation-bar';
|
|
8
8
|
export * from './pager';
|
|
9
9
|
export * from './radio-group';
|
|
10
|
+
export * from './rn-list-item';
|
|
10
11
|
export * from './rn-tooltip';
|
|
11
12
|
export * from './scroll-edge-container';
|
|
12
13
|
export * from './search-bar';
|