@veridid/workflow-ui 0.1.0 → 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.
package/README.md CHANGED
@@ -45,7 +45,7 @@ DigiCred wallet, in English, with a simulated device.
45
45
  |---|---|---|---|
46
46
  | `WorkflowThemeProvider` | Colours, host `styles` (`fieldContainer`, `label`, `input`, `button`, …), credential-card colours. Props passed to a control still win. | its palette (defaults are the wallet's) | the same wallet look, whatever the dashboard theme |
47
47
  | `WorkflowI18nProvider` | `translate(key, english, params)`; keys match the wallet's (`Workflow.*`, `Global.*`) | `(k, d, p) => t(k, { defaultValue: d, ...p })` | English (default) |
48
- | `WorkflowIconProvider` | `renderIcon({ name, set, size, color })` | none (vector icons) | optional, to avoid loading icon fonts |
48
+ | `WorkflowIconProvider` | `renderIcon({ name, set, size, color })` | none (vector icons on native, font glyphs on web) | optional, to use the app's own icon set |
49
49
  | `WalletAdapterProvider` | device, links, alerts, credential/proof exchanges (below) | real adapter | `createSimulatedWalletAdapter({ onEvent })` |
50
50
  | `ResponsiveProvider size` | the screen to lay out for | none (window) | the phone frame, e.g. `{ width: 390, height: 844 }` |
51
51
  | `WorkflowModalHost` | where popups open | none (RN `Modal`) | around the phone frame |
@@ -139,7 +139,8 @@ the child's path.
139
139
 
140
140
  `pnpm vitest run --project workflow-ui` renders every component through
141
141
  react-native-web in jsdom (the designer's path). Native rendering is covered by
142
- the wallet's own tests. Icons are stubbed in tests; the carousel needs real
142
+ the wallet's own tests. `icons.test.tsx` checks that every icon a control uses
143
+ has a web glyph. The carousel needs real
143
144
  layout, so it is only checked for mounting here.
144
145
 
145
146
  ### Form children
@@ -165,6 +166,19 @@ The build (react-native-builder-bob) transforms each file separately and keeps
165
166
  `./PhotoContent` imports unchanged, so each bundler picks its own file. Web
166
167
  consumers must list `.web.*` extensions first (CrMS `vite.config.ts` does).
167
168
 
169
+ ### Icons on the web
170
+
171
+ `react-native-vector-icons` cannot load in a browser (Flow source, and a native
172
+ module lookup at import time), so `icons/VectorIcon.web.tsx` draws the icons the
173
+ controls use as text in the same fonts. The web page loads the fonts once:
174
+
175
+ ```css
176
+ @font-face { font-family: 'MaterialIcons'; src: url('react-native-vector-icons/Fonts/MaterialIcons.ttf'); }
177
+ @font-face { font-family: 'MaterialCommunityIcons'; src: url('react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf'); }
178
+ ```
179
+
180
+ When a control starts using a new icon, add its codepoint to `WEB_GLYPHS`.
181
+
168
182
  ## Rules (enforced by biome)
169
183
 
170
184
  - No `react-dom` or DOM globals (`window`, `document`, …) outside `*.web.*` files.
@@ -181,7 +195,8 @@ yarn add @veridid/workflow-ui react-native-svg react-native-vector-icons \
181
195
  @react-native-community/datetimepicker @react-native-community/slider
182
196
 
183
197
  # Web (the CrMS designer)
184
- npm install @veridid/workflow-ui react-dom react-native-web react-native-svg react-native-vector-icons
198
+ npm install @veridid/workflow-ui react-dom react-native-web react-native-svg
199
+ # plus react-native-vector-icons, only for its .ttf fonts (see Icons on the web)
185
200
  ```
186
201
 
187
202
  | Peer | Needed by | Why |
@@ -190,7 +205,7 @@ npm install @veridid/workflow-ui react-dom react-native-web react-native-svg rea
190
205
  | `react-native` ≥ 0.79 | native apps (optional) | web apps alias it to `react-native-web` instead |
191
206
  | `react-native-web` ≥ 0.21 | web apps (optional) | |
192
207
  | `react-native-svg` ≥ 15 | everyone | charts, gauge, dial (imported directly) |
193
- | `react-native-vector-icons` ≥ 10 | everyone | default icons (replace them with `WorkflowIconProvider`, but the import stays) |
208
+ | `react-native-vector-icons` ≥ 10 | native apps (optional) | default icons on native; the web draws the same glyphs from the fonts |
194
209
  | `@react-native-community/datetimepicker` ≥ 8 | native apps (optional) | only `DateField.native.tsx`; the web date field is a text input |
195
210
  | `@react-native-community/slider` ≥ 5 | native apps (optional) | only `SliderField.native.tsx`; the web slider is the browser's range input |
196
211
 
@@ -6,7 +6,8 @@ import WorkflowText from "../components/WorkflowText.js";
6
6
  import { ContentRegistry } from "../registries/ContentRegistry.js";
7
7
  import { useResponsive } from "../responsive/index.js";
8
8
  import { resolveItemSurfaceStyle } from "../style/resolveDisplayHintStyle.js";
9
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
9
+ import { coerceToChipRowItem } from "./ChipRowContent.js";
10
+ import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
10
11
  const resolveChildLabel = child => {
11
12
  const candidates = [child.text, child.title, child.label, child.subtitle];
12
13
  for (const value of candidates) {
@@ -16,16 +17,17 @@ const resolveChildLabel = child => {
16
17
  }
17
18
  return undefined;
18
19
  };
19
- const ListContent = ({
20
- item,
21
- styles,
22
- colors,
23
- onAction,
24
- formData,
25
- onFieldChange,
26
- FormFieldRegistry,
27
- buttonVariant
28
- }) => {
20
+ const ListContent = props => {
21
+ const {
22
+ item,
23
+ styles,
24
+ colors,
25
+ onAction,
26
+ formData,
27
+ onFieldChange,
28
+ FormFieldRegistry,
29
+ buttonVariant
30
+ } = props;
29
31
  const {
30
32
  s,
31
33
  ms
@@ -33,6 +35,18 @@ const ListContent = ({
33
35
  const listItems = Array.isArray(item.items) ? item.items : [];
34
36
  const children = Array.isArray(item.children) ? item.children : [];
35
37
  if (listItems.length === 0 && children.length === 0) return null;
38
+
39
+ // A list of only chips (3+) is a chip row, like row / section / grid. The
40
+ // wallet used to apply this to every top-level item before rendering.
41
+ const chipRowItem = coerceToChipRowItem(item);
42
+ if (chipRowItem && ContentRegistry.has('chip-row')) {
43
+ return /*#__PURE__*/_jsx(_Fragment, {
44
+ children: ContentRegistry.render('chip-row', {
45
+ ...props,
46
+ item: chipRowItem
47
+ })
48
+ });
49
+ }
36
50
  const bulletRow = (key, body) => /*#__PURE__*/_jsxs(View, {
37
51
  style: {
38
52
  flexDirection: 'row',
@@ -1 +1 @@
1
- {"version":3,"names":["React","View","WorkflowText","ContentRegistry","useResponsive","resolveItemSurfaceStyle","jsx","_jsx","jsxs","_jsxs","resolveChildLabel","child","candidates","text","title","label","subtitle","value","trim","length","undefined","ListContent","item","styles","colors","onAction","formData","onFieldChange","FormFieldRegistry","buttonVariant","s","ms","listItems","Array","isArray","items","children","bulletRow","key","body","style","flexDirection","alignItems","marginBottom","minWidth","width","variant","size","color","marginRight","marginTop","flex","fieldContainer","maxWidth","map","i","lineHeight","String","_id","isPlainText","includes","type","has","render","register"],"sourceRoot":"../../../src","sources":["content/ListContent.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAA0B,OAAO;AAC7C,SAASC,IAAI,QAAQ,cAAc;AACnC,OAAOC,YAAY,MAAM,+BAA4B;AACrD,SAA4BC,eAAe,QAAQ,kCAA+B;AAClF,SAASC,aAAa,QAAQ,wBAAe;AAC7C,SAASC,uBAAuB,QAAQ,qCAAkC;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAE1E,MAAMC,iBAAiB,GAAIC,KAA2B,IAAyB;EAC7E,MAAMC,UAAU,GAAG,CAACD,KAAK,CAACE,IAAI,EAAEF,KAAK,CAACG,KAAK,EAAEH,KAAK,CAACI,KAAK,EAAEJ,KAAK,CAACK,QAAQ,CAAC;EACzE,KAAK,MAAMC,KAAK,IAAIL,UAAU,EAAE;IAC9B,IAAI,OAAOK,KAAK,KAAK,QAAQ,IAAIA,KAAK,CAACC,IAAI,CAAC,CAAC,CAACC,MAAM,GAAG,CAAC,EAAE;MACxD,OAAOF,KAAK,CAACC,IAAI,CAAC,CAAC;IACrB;EACF;EACA,OAAOE,SAAS;AAClB,CAAC;AAED,MAAMC,WAAmC,GAAGA,CAAC;EAC3CC,IAAI;EACJC,MAAM;EACNC,MAAM;EACNC,QAAQ;EACRC,QAAQ;EACRC,aAAa;EACbC,iBAAiB;EACjBC;AACF,CAAC,KAAK;EACJ,MAAM;IAAEC,CAAC;IAAEC;EAAG,CAAC,GAAG3B,aAAa,CAAC,CAAC;EACjC,MAAM4B,SAAmB,GAAGC,KAAK,CAACC,OAAO,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ACXc,QAAQ;QACRF,MAAM;QACNC,MAAM;QACNE,QAAQ;QACRC,aAAa;QACbC,iBAAiB;QACjBC;MACF,CAAC,CACH,CAAC;IACH,CAAC,CAAC;EAAA,CACE,CAAC;AAEX,CAAC;AAED1B,eAAe,CAAC6D,QAAQ,CAAC,MAAM,EAAE3C,WAAW,CAAC;AAE7C,eAAeA,WAAW","ignoreList":[]}
1
+ {"version":3,"names":["React","View","WorkflowText","ContentRegistry","useResponsive","resolveItemSurfaceStyle","coerceToChipRowItem","Fragment","_Fragment","jsx","_jsx","jsxs","_jsxs","resolveChildLabel","child","candidates","text","title","label","subtitle","value","trim","length","undefined","ListContent","props","item","styles","colors","onAction","formData","onFieldChange","FormFieldRegistry","buttonVariant","s","ms","listItems","Array","isArray","items","children","chipRowItem","has","render","bulletRow","key","body","style","flexDirection","alignItems","marginBottom","minWidth","width","variant","size","color","marginRight","marginTop","flex","fieldContainer","maxWidth","map","i","lineHeight","String","_id","isPlainText","includes","type","register"],"sourceRoot":"../../../src","sources":["content/ListContent.tsx"],"mappings":";;AAAA,OAAOA,KAAK,MAA0B,OAAO;AAC7C,SAASC,IAAI,QAAQ,cAAc;AACnC,OAAOC,YAAY,MAAM,+BAA4B;AACrD,SAA4BC,eAAe,QAAQ,kCAA+B;AAClF,SAASC,aAAa,QAAQ,wBAAe;AAC7C,SAASC,uBAAuB,QAAQ,qCAAkC;AAC1E,SAASC,mBAAmB,QAAQ,qBAAkB;AAAA,SAAAC,QAAA,IAAAC,SAAA,EAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAEtD,MAAMC,iBAAiB,GAAIC,KAA2B,IAAyB;EAC7E,MAAMC,UAAU,GAAG,CAACD,KAAK,CAACE,IAAI,EAAEF,KAAK,CAACG,KAAK,EAAEH,KAAK,CAACI,KAAK,EAAEJ,KAAK,CAACK,QAAQ,CAAC;EACzE,KAAK,MAAMC,KAAK,IAAIL,UAAU,EAAE;IAC9B,IAAI,OAAOK,KA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AAGmB,MAAM,CAAClD,KAAK,CAACmD,GAAG,IAAI,SAASH,CAAC,EAAE,CAAC;MAC7C,MAAM5C,KAAK,GAAGL,iBAAiB,CAACC,KAAK,CAAC;MACtC,MAAMoD,WAAW,GAAG,CAAC,MAAM,EAAE,OAAO,CAAC,CAACC,QAAQ,CAACH,MAAM,CAAClD,KAAK,CAACsD,IAAI,CAAC,CAAC,IAAI,CAAC,CAAClD,KAAK;MAE7E,IAAIgD,WAAW,EAAE;QACf,OAAOtB,SAAS,CACdC,GAAG,eACHnC,IAAA,CAACR,YAAY;UAACmD,OAAO,EAAC,MAAM;UAACC,IAAI,EAAE,EAAG;UAACP,KAAK,EAAE;YAAEQ,KAAK,EAAE3B,MAAM,CAACZ,IAAI;YAAE+C,UAAU,EAAE5B,EAAE,CAAC,EAAE;UAAE,CAAE;UAAAK,QAAA,EACtFtB;QAAK,CACM,CAChB,CAAC;MACH;MAEA,IAAI,CAACf,eAAe,CAACuC,GAAG,CAAC5B,KAAK,CAACsD,IAAI,CAAC,EAAE,OAAO,IAAI;MAEjD,OAAOxB,SAAS,CACdC,GAAG,EACH1C,eAAe,CAACwC,MAAM,CAAC7B,KAAK,CAACsD,IAAI,EAAE;QACjC1C,IAAI,EAAEZ,KAAK;QACXe,QAAQ;QACRF,MAAM;QACNC,MAAM;QACNE,QAAQ;QACRC,aAAa;QACbC,iBAAiB;QACjBC;MACF,CAAC,CACH,CAAC;IACH,CAAC,CAAC;EAAA,CACE,CAAC;AAEX,CAAC;AAED9B,eAAe,CAACkE,QAAQ,CAAC,MAAM,EAAE7C,WAAW,CAAC;AAE7C,eAAeA,WAAW","ignoreList":[]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+
3
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
4
+ import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
5
+ import { jsx as _jsx } from "react/jsx-runtime";
6
+ /** Native: the vector-icon fonts the wallet already bundles. */
7
+ export function VectorIcon({
8
+ set = 'material',
9
+ name,
10
+ size,
11
+ color,
12
+ style
13
+ }) {
14
+ const Family = set === 'material-community' ? MaterialCommunityIcons : MaterialIcons;
15
+ // vector-icons' typings use the old @types/react-native StyleProp; same runtime shape.
16
+ return /*#__PURE__*/_jsx(Family, {
17
+ name: name,
18
+ size: size,
19
+ color: color,
20
+ style: style
21
+ });
22
+ }
23
+ //# sourceMappingURL=VectorIcon.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["MaterialCommunityIcons","MaterialIcons","jsx","_jsx","VectorIcon","set","name","size","color","style","Family"],"sourceRoot":"../../../src","sources":["icons/VectorIcon.tsx"],"mappings":";;AAAA,OAAOA,sBAAsB,MAAM,kDAAkD;AACrF,OAAOC,aAAa,MAAM,yCAAyC;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGnE;AACA,OAAO,SAASC,UAAUA,CAAC;EAAEC,GAAG,GAAG,UAAU;EAAEC,IAAI;EAAEC,IAAI;EAAEC,KAAK;EAAEC;AAAyB,CAAC,EAAE;EAC5F,MAAMC,MAAM,GAAGL,GAAG,KAAK,oBAAoB,GAAGL,sBAAsB,GAAGC,aAAa;EACpF;EACA,oBAAOE,IAAA,CAACO,MAAM;IAACJ,IAAI,EAAEA,IAAK;IAACC,IAAI,EAAEA,IAAK;IAACC,KAAK,EAAEA,KAAM;IAACC,KAAK,EAAEA;EAAe,CAAE,CAAC;AAChF","ignoreList":[]}
@@ -0,0 +1,62 @@
1
+ "use strict";
2
+
3
+ import { Text } from 'react-native';
4
+ import { jsx as _jsx } from "react/jsx-runtime";
5
+ /**
6
+ * Web: `react-native-vector-icons` can't load in a browser (Flow source and a
7
+ * native TurboModule lookup at import time), so the glyphs the controls use are
8
+ * drawn as text in the same fonts. The host page loads the fonts once:
9
+ *
10
+ * @font-face { font-family: 'MaterialIcons'; src: url(react-native-vector-icons/Fonts/MaterialIcons.ttf); }
11
+ * @font-face { font-family: 'MaterialCommunityIcons'; src: url(react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf); }
12
+ *
13
+ * Or replace icons entirely with `WorkflowIconProvider`. Names not listed here
14
+ * draw nothing; add a codepoint when a control starts using a new icon
15
+ * (`icons.test.tsx` checks every name the controls use).
16
+ */
17
+ export const WEB_GLYPHS = {
18
+ material: {
19
+ phone: 57549,
20
+ share: 59405,
21
+ check: 58826,
22
+ info: 59534,
23
+ warning: 57346,
24
+ error: 57344,
25
+ 'check-circle': 59500,
26
+ cancel: 58825
27
+ },
28
+ 'material-community': {
29
+ 'qrcode-scan': 984115,
30
+ 'image-off-outline': 987601,
31
+ 'camera-retake-outline': 986650,
32
+ 'camera-outline': 986461
33
+ }
34
+ };
35
+ const FONT_FAMILY = {
36
+ material: 'MaterialIcons',
37
+ 'material-community': 'MaterialCommunityIcons'
38
+ };
39
+ export function VectorIcon({
40
+ set = 'material',
41
+ name,
42
+ size,
43
+ color,
44
+ style
45
+ }) {
46
+ const codepoint = WEB_GLYPHS[set][name];
47
+ if (codepoint === undefined) return null;
48
+ return /*#__PURE__*/_jsx(Text, {
49
+ selectable: false,
50
+ style: [{
51
+ fontSize: size,
52
+ color,
53
+ lineHeight: size
54
+ }, style, {
55
+ fontFamily: FONT_FAMILY[set],
56
+ fontWeight: 'normal',
57
+ fontStyle: 'normal'
58
+ }],
59
+ children: String.fromCodePoint(codepoint)
60
+ });
61
+ }
62
+ //# sourceMappingURL=VectorIcon.web.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["Text","jsx","_jsx","WEB_GLYPHS","material","phone","share","check","info","warning","error","cancel","FONT_FAMILY","VectorIcon","set","name","size","color","style","codepoint","undefined","selectable","fontSize","lineHeight","fontFamily","fontWeight","fontStyle","children","String","fromCodePoint"],"sourceRoot":"../../../src","sources":["icons/VectorIcon.web.tsx"],"mappings":";;AAAA,SAASA,IAAI,QAAQ,cAAc;AAAA,SAAAC,GAAA,IAAAC,IAAA;AAGnC;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,MAAMC,UAA2D,GAAG;EACzEC,QAAQ,EAAE;IACRC,KAAK,EAAE,KAAK;IACZC,KAAK,EAAE,KAAK;IACZC,KAAK,EAAE,KAAK;IACZC,IAAI,EAAE,KAAK;IACXC,OAAO,EAAE,KAAK;IACdC,KAAK,EAAE,KAAK;IACZ,cAAc,EAAE,KAAK;IACrBC,MAAM,EAAE;EACV,CAAC;EACD,oBAAoB,EAAE;IACpB,aAAa,EAAE,MAAM;IACrB,mBAAmB,EAAE,MAAM;IAC3B,uBAAuB,EAAE,MAAM;IAC/B,gBAAgB,EAAE;EACpB;AACF,CAAC;AAED,MAAMC,WAA4C,GAAG;EACnDR,QAAQ,EAAE,eAAe;EACzB,oBAAoB,EAAE;AACxB,CAAC;AAED,OAAO,SAASS,UAAUA,CAAC;EAAEC,GAAG,GAAG,UAAU;EAAEC,IAAI;EAAEC,IAAI;EAAEC,KAAK;EAAEC;AAAyB,CAAC,EAAE;EAC5F,MAAMC,SAAS,GAAGhB,UAAU,CAACW,GAAG,CAAC,CAACC,IAAI,CAAC;EACvC,IAAII,SAAS,KAAKC,SAAS,EAAE,OAAO,IAAI;EACxC,oBACElB,IAAA,CAACF,IAAI;IACHqB,UAAU,EAAE,KAAM;IAClBH,KAAK,EAAE,CACL;MAAEI,QAAQ,EAAEN,IAAI;MAAEC,KAAK;MAAEM,UAAU,EAAEP;IAAK,CAAC,EAC3CE,KAAK,EACL;MAAEM,UAAU,EAAEZ,WAAW,CAACE,GAAG,CAAC;MAAEW,UAAU,EAAE,QAAQ;MAAEC,SAAS,EAAE;IAAS,CAAC,CAC3E;IAAAC,QAAA,EAEDC,MAAM,CAACC,aAAa,CAACV,SAAS;EAAC,CAC5B,CAAC;AAEX","ignoreList":[]}
@@ -1,18 +1,16 @@
1
1
  "use strict";
2
2
 
3
3
  import { createContext, useContext } from 'react';
4
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
5
- import MaterialIcons from 'react-native-vector-icons/MaterialIcons';
6
-
7
- /** Icon families the controls use (names are the vector-icons names). */
4
+ import { VectorIcon } from './VectorIcon';
8
5
 
9
6
  /** Draws one icon. Return `null` to fall back to the built-in vector icons. */
10
7
  import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
11
8
  const WorkflowIconContext = /*#__PURE__*/createContext(null);
12
9
  /**
13
10
  * Replaces the icons every control draws (e.g. the designer can use its own
14
- * icon set instead of loading the vector-icon fonts). Without it, controls use
15
- * `react-native-vector-icons`, like the wallet.
11
+ * icon set). Without it, controls use `react-native-vector-icons` on native,
12
+ * like the wallet, and the same fonts drawn as text on the web (the page loads
13
+ * the fonts; see `VectorIcon.web.tsx`).
16
14
  */
17
15
  export function WorkflowIconProvider({
18
16
  renderIcon,
@@ -31,20 +29,8 @@ export function WorkflowIcon(props) {
31
29
  if (custom != null) return /*#__PURE__*/_jsx(_Fragment, {
32
30
  children: custom
33
31
  });
34
- const {
35
- set = 'material',
36
- name,
37
- size,
38
- color,
39
- style
40
- } = props;
41
- const Family = set === 'material-community' ? MaterialCommunityIcons : MaterialIcons;
42
- // vector-icons' typings use the old @types/react-native StyleProp; same runtime shape.
43
- return /*#__PURE__*/_jsx(Family, {
44
- name: name,
45
- size: size,
46
- color: color,
47
- style: style
32
+ return /*#__PURE__*/_jsx(VectorIcon, {
33
+ ...props
48
34
  });
49
35
  }
50
36
  //# sourceMappingURL=WorkflowIcon.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["createContext","useContext","MaterialCommunityIcons","MaterialIcons","jsx","_jsx","Fragment","_Fragment","WorkflowIconContext","WorkflowIconProvider","renderIcon","children","Provider","value","WorkflowIcon","props","custom","set","name","size","color","style","Family"],"sourceRoot":"../../../src","sources":["icons/WorkflowIcon.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAkBC,UAAU,QAAQ,OAAO;AAEjE,OAAOC,sBAAsB,MAAM,kDAAkD;AACrF,OAAOC,aAAa,MAAM,yCAAyC;;AAEnE;;AAYA;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA;AAGA,MAAMC,mBAAmB,gBAAGR,aAAa,CAA8B,IAAI,CAAC;AAI5E;AACA;AACA;AACA;AACA;AACA,OAAO,SAASS,oBAAoBA,CAAC;EAAEC,UAAU;EAAEC;AAAoC,CAAC,EAAE;EACxF,oBAAON,IAAA,CAACG,mBAAmB,CAACI,QAAQ;IAACC,KAAK,EAAEH,UAAW;IAAAC,QAAA,EAAEA;EAAQ,CAA+B,CAAC;AACnG;;AAEA;AACA,OAAO,SAASG,YAAYA,CAACC,KAAwB,EAAE;EACrD,MAAML,UAAU,GAAGT,UAAU,CAACO,mBAAmB,CAAC;EAClD,MAAMQ,MAAM,GAAGN,UAAU,GAAGK,KAAK,CAAC;EAClC,IAAIC,MAAM,IAAI,IAAI,EAAE,oBAAOX,IAAA,CAAAE,SAAA;IAAAI,QAAA,EAAGK;EAAM,CAAG,CAAC;EACxC,MAAM;IAAEC,GAAG,GAAG,UAAU;IAAEC,IAAI;IAAEC,IAAI;IAAEC,KAAK;IAAEC;EAAM,CAAC,GAAGN,KAAK;EAC5D,MAAMO,MAAM,GAAGL,GAAG,KAAK,oBAAoB,GAAGf,sBAAsB,GAAGC,aAAa;EACpF;EACA,oBAAOE,IAAA,CAACiB,MAAM;IAACJ,IAAI,EAAEA,IAAK;IAACC,IAAI,EAAEA,IAAK;IAACC,KAAK,EAAEA,KAAM;IAACC,KAAK,EAAEA;EAAe,CAAE,CAAC;AAChF","ignoreList":[]}
1
+ {"version":3,"names":["createContext","useContext","VectorIcon","jsx","_jsx","Fragment","_Fragment","WorkflowIconContext","WorkflowIconProvider","renderIcon","children","Provider","value","WorkflowIcon","props","custom"],"sourceRoot":"../../../src","sources":["icons/WorkflowIcon.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAkBC,UAAU,QAAQ,OAAO;AAEjE,SAASC,UAAU,QAAQ,cAAc;;AAIzC;AAAA,SAAAC,GAAA,IAAAC,IAAA,EAAAC,QAAA,IAAAC,SAAA;AAGA,MAAMC,mBAAmB,gBAAGP,aAAa,CAA8B,IAAI,CAAC;AAI5E;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASQ,oBAAoBA,CAAC;EAAEC,UAAU;EAAEC;AAAoC,CAAC,EAAE;EACxF,oBAAON,IAAA,CAACG,mBAAmB,CAACI,QAAQ;IAACC,KAAK,EAAEH,UAAW;IAAAC,QAAA,EAAEA;EAAQ,CAA+B,CAAC;AACnG;;AAEA;AACA,OAAO,SAASG,YAAYA,CAACC,KAAwB,EAAE;EACrD,MAAML,UAAU,GAAGR,UAAU,CAACM,mBAAmB,CAAC;EAClD,MAAMQ,MAAM,GAAGN,UAAU,GAAGK,KAAK,CAAC;EAClC,IAAIC,MAAM,IAAI,IAAI,EAAE,oBAAOX,IAAA,CAAAE,SAAA;IAAAI,QAAA,EAAGK;EAAM,CAAG,CAAC;EACxC,oBAAOX,IAAA,CAACF,UAAU;IAAA,GAAKY;EAAK,CAAG,CAAC;AAClC","ignoreList":[]}
@@ -0,0 +1,4 @@
1
+ "use strict";
2
+
3
+ export {};
4
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":[],"sourceRoot":"../../../src","sources":["icons/types.ts"],"mappings":"","ignoreList":[]}
@@ -20,6 +20,7 @@ export { default as WorkflowButtonLabel } from "./components/WorkflowButtonLabel
20
20
  // Building blocks for host-rendered controls
21
21
 
22
22
  export { default as WorkflowText, WORKFLOW_TEXT_BASE_SIZES } from "./components/WorkflowText.js";
23
+ export { coerceToChipRowItem } from "./content/ChipRowContent.js";
23
24
  export { isFormFieldChild } from "./content/FormContent.js";
24
25
  export { DEFAULT_WORKFLOW_STRINGS, useWorkflowT, WorkflowI18nProvider } from "./i18n/WorkflowI18n.js";
25
26
  export { WorkflowIcon, WorkflowIconProvider } from "./icons/WorkflowIcon.js";
@@ -1 +1 @@
1
- {"version":3,"names":["CONTRACT_VERSION","createSimulatedWalletAdapter","SIMULATED_LOCATION","SIMULATED_PHOTO_URI","useWalletAdapter","WalletAdapterProvider","default","WorkflowButtonLabel","WorkflowText","WORKFLOW_TEXT_BASE_SIZES","isFormFieldChild","DEFAULT_WORKFLOW_STRINGS","useWorkflowT","WorkflowI18nProvider","WorkflowIcon","WorkflowIconProvider","clearImageUriCache","prefetchImageUri","useModalPosition","WorkflowModal","WorkflowModalHost","platformName","clearControlSnapshots","ContentRegistry","FormFieldRegistry","deriveNode","resolveNode","RenderTree","WorkflowRenderProvider","ResponsiveProvider","ResponsiveRule","useDigiCredStyles","useResponsive","DEFAULT_WORKFLOW_THEME","mergeWorkflowTheme","useWorkflowTheme","WorkflowThemeProvider","useRegisterTitleGroupScale","useWorkflowTitleScale","WorkflowFontScaleProvider"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,wBAAwB;AACzD;;AAeA,SACEC,4BAA4B,EAC5BC,kBAAkB,EAClBC,mBAAmB,EACnBC,gBAAgB,EAChBC,qBAAqB,QAChB,4BAAyB;AAChC,SAASC,OAAO,IAAIC,mBAAmB,QAAQ,qCAAkC;AACjF;;AAEA,SAASD,OAAO,IAAIE,YAAY,EAAEC,wBAAwB,QAAQ,8BAA2B;AAC7F,SAASC,gBAAgB,QAAQ,0BAAuB;AAExD,SAASC,wBAAwB,EAAEC,YAAY,EAAEC,oBAAoB,QAAQ,wBAAqB;AAOlG,SAASC,YAAY,EAAEC,oBAAoB,QAAQ,yBAAsB;AACzE,SAASC,kBAAkB,EAAEC,gBAAgB,QAAQ,oBAAiB;AAEtE,SAASC,gBAAgB,EAAEC,aAAa,EAAEC,iBAAiB,QAAQ,0BAAuB;AAC1F,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,qBAAqB,QAAQ,oCAAiC;AACvE;;AAEA,SAASC,eAAe,QAAQ,iCAA8B;AAE9D,SAASC,iBAAiB,QAAQ,mCAAgC;AAClE;;AAEA,SAASC,UAAU,EAAEC,WAAW,QAAQ,mBAAgB;AAExD,SAASC,UAAU,QAAQ,wBAAqB;AAMhD,SAASC,sBAAsB,QAAQ,mCAAgC;AACvE;;AAEA,SAASC,kBAAkB,EAAEC,cAAc,EAAEC,iBAAiB,EAAEC,aAAa,QAAQ,uBAAc;AACnG,cAAc,oCAAiC;AAQ/C,SACEC,sBAAsB,EACtBC,kBAAkB,EAClBC,gBAAgB,EAChBC,qBAAqB,QAChB,0BAAuB;AAC9B,SACEC,0BAA0B,EAC1BC,qBAAqB,EACrBC,yBAAyB,QACpB,+BAA4B;;AAEnC;AACA,OAAO,wBAAe;AACtB,OAAO,oBAAW","ignoreList":[]}
1
+ {"version":3,"names":["CONTRACT_VERSION","createSimulatedWalletAdapter","SIMULATED_LOCATION","SIMULATED_PHOTO_URI","useWalletAdapter","WalletAdapterProvider","default","WorkflowButtonLabel","WorkflowText","WORKFLOW_TEXT_BASE_SIZES","coerceToChipRowItem","isFormFieldChild","DEFAULT_WORKFLOW_STRINGS","useWorkflowT","WorkflowI18nProvider","WorkflowIcon","WorkflowIconProvider","clearImageUriCache","prefetchImageUri","useModalPosition","WorkflowModal","WorkflowModalHost","platformName","clearControlSnapshots","ContentRegistry","FormFieldRegistry","deriveNode","resolveNode","RenderTree","WorkflowRenderProvider","ResponsiveProvider","ResponsiveRule","useDigiCredStyles","useResponsive","DEFAULT_WORKFLOW_THEME","mergeWorkflowTheme","useWorkflowTheme","WorkflowThemeProvider","useRegisterTitleGroupScale","useWorkflowTitleScale","WorkflowFontScaleProvider"],"sourceRoot":"../../src","sources":["index.ts"],"mappings":";;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,SAASA,gBAAgB,QAAQ,wBAAwB;AACzD;;AAeA,SACEC,4BAA4B,EAC5BC,kBAAkB,EAClBC,mBAAmB,EACnBC,gBAAgB,EAChBC,qBAAqB,QAChB,4BAAyB;AAChC,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K,CAAC,EAAE,CAAC,YAAY,CA4EvC,CAAA;AAID,eAAe,WAAW,CAAA"}
1
+ {"version":3,"file":"ListContent.d.ts","sourceRoot":"","sources":["../../../src/content/ListContent.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAyB,MAAM,OAAO,CAAA;AAG7C,OAAO,EAAE,KAAK,YAAY,EAAmB,MAAM,kCAA+B,CAAA;AAelF,QAAA,MAAM,WAAW,EAAE,KAAK,CAAC,EAAE,CAAC,YAAY,CA2EvC,CAAA;AAID,eAAe,WAAW,CAAA"}
@@ -0,0 +1,4 @@
1
+ import type { WorkflowIconProps } from './types.js';
2
+ /** Native: the vector-icon fonts the wallet already bundles. */
3
+ export declare function VectorIcon({ set, name, size, color, style }: WorkflowIconProps): import("react").JSX.Element;
4
+ //# sourceMappingURL=VectorIcon.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VectorIcon.d.ts","sourceRoot":"","sources":["../../../src/icons/VectorIcon.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAS,CAAA;AAEhD,gEAAgE;AAChE,wBAAgB,UAAU,CAAC,EAAE,GAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,iBAAiB,+BAI3F"}
@@ -0,0 +1,16 @@
1
+ import type { WorkflowIconProps, WorkflowIconSet } from './types.js';
2
+ /**
3
+ * Web: `react-native-vector-icons` can't load in a browser (Flow source and a
4
+ * native TurboModule lookup at import time), so the glyphs the controls use are
5
+ * drawn as text in the same fonts. The host page loads the fonts once:
6
+ *
7
+ * @font-face { font-family: 'MaterialIcons'; src: url(react-native-vector-icons/Fonts/MaterialIcons.ttf); }
8
+ * @font-face { font-family: 'MaterialCommunityIcons'; src: url(react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf); }
9
+ *
10
+ * Or replace icons entirely with `WorkflowIconProvider`. Names not listed here
11
+ * draw nothing; add a codepoint when a control starts using a new icon
12
+ * (`icons.test.tsx` checks every name the controls use).
13
+ */
14
+ export declare const WEB_GLYPHS: Record<WorkflowIconSet, Record<string, number>>;
15
+ export declare function VectorIcon({ set, name, size, color, style }: WorkflowIconProps): import("react").JSX.Element | null;
16
+ //# sourceMappingURL=VectorIcon.web.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"VectorIcon.web.d.ts","sourceRoot":"","sources":["../../../src/icons/VectorIcon.web.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAS,CAAA;AAEjE;;;;;;;;;;;GAWG;AACH,eAAO,MAAM,UAAU,EAAE,MAAM,CAAC,eAAe,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAiBtE,CAAA;AAOD,wBAAgB,UAAU,CAAC,EAAE,GAAgB,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,iBAAiB,sCAe3F"}
@@ -1,15 +1,6 @@
1
1
  import { type ReactNode } from 'react';
2
- import type { StyleProp, TextStyle } from 'react-native';
3
- /** Icon families the controls use (names are the vector-icons names). */
4
- export type WorkflowIconSet = 'material' | 'material-community';
5
- export type WorkflowIconProps = {
6
- name: string;
7
- /** Default `material`. */
8
- set?: WorkflowIconSet;
9
- size: number;
10
- color: string;
11
- style?: StyleProp<TextStyle>;
12
- };
2
+ import type { WorkflowIconProps } from './types.js';
3
+ export type { WorkflowIconProps, WorkflowIconSet } from './types.js';
13
4
  /** Draws one icon. Return `null` to fall back to the built-in vector icons. */
14
5
  export type WorkflowIconRenderer = (props: WorkflowIconProps) => ReactNode | null;
15
6
  export type WorkflowIconProviderProps = {
@@ -18,8 +9,9 @@ export type WorkflowIconProviderProps = {
18
9
  };
19
10
  /**
20
11
  * Replaces the icons every control draws (e.g. the designer can use its own
21
- * icon set instead of loading the vector-icon fonts). Without it, controls use
22
- * `react-native-vector-icons`, like the wallet.
12
+ * icon set). Without it, controls use `react-native-vector-icons` on native,
13
+ * like the wallet, and the same fonts drawn as text on the web (the page loads
14
+ * the fonts; see `VectorIcon.web.tsx`).
23
15
  */
24
16
  export declare function WorkflowIconProvider({ renderIcon, children }: WorkflowIconProviderProps): import("react").JSX.Element;
25
17
  /** The one place controls draw icons. */
@@ -1 +1 @@
1
- {"version":3,"file":"WorkflowIcon.d.ts","sourceRoot":"","sources":["../../../src/icons/WorkflowIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AACjE,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAIxD,yEAAyE;AACzE,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,oBAAoB,CAAA;AAE/D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,0BAA0B;IAC1B,GAAG,CAAC,EAAE,eAAe,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC7B,CAAA;AAED,+EAA+E;AAC/E,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,SAAS,GAAG,IAAI,CAAA;AAIjF,MAAM,MAAM,yBAAyB,GAAG;IAAE,UAAU,EAAE,oBAAoB,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,CAAA;AAElG;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,yBAAyB,+BAEvF;AAED,yCAAyC;AACzC,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,+BAQpD"}
1
+ {"version":3,"file":"WorkflowIcon.d.ts","sourceRoot":"","sources":["../../../src/icons/WorkflowIcon.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAiB,KAAK,SAAS,EAAc,MAAM,OAAO,CAAA;AACjE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAS,CAAA;AAGhD,YAAY,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,YAAS,CAAA;AAEjE,+EAA+E;AAC/E,MAAM,MAAM,oBAAoB,GAAG,CAAC,KAAK,EAAE,iBAAiB,KAAK,SAAS,GAAG,IAAI,CAAA;AAIjF,MAAM,MAAM,yBAAyB,GAAG;IAAE,UAAU,EAAE,oBAAoB,CAAC;IAAC,QAAQ,CAAC,EAAE,SAAS,CAAA;CAAE,CAAA;AAElG;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAAC,EAAE,UAAU,EAAE,QAAQ,EAAE,EAAE,yBAAyB,+BAEvF;AAED,yCAAyC;AACzC,wBAAgB,YAAY,CAAC,KAAK,EAAE,iBAAiB,+BAKpD"}
@@ -0,0 +1,12 @@
1
+ import type { StyleProp, TextStyle } from 'react-native';
2
+ /** Icon families the controls use (names are the vector-icons names). */
3
+ export type WorkflowIconSet = 'material' | 'material-community';
4
+ export type WorkflowIconProps = {
5
+ name: string;
6
+ /** Default `material`. */
7
+ set?: WorkflowIconSet;
8
+ size: number;
9
+ color: string;
10
+ style?: StyleProp<TextStyle>;
11
+ };
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/icons/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAExD,yEAAyE;AACzE,MAAM,MAAM,eAAe,GAAG,UAAU,GAAG,oBAAoB,CAAA;AAE/D,MAAM,MAAM,iBAAiB,GAAG;IAC9B,IAAI,EAAE,MAAM,CAAA;IACZ,0BAA0B;IAC1B,GAAG,CAAC,EAAE,eAAe,CAAA;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAC7B,CAAA"}
@@ -16,6 +16,7 @@ export { createSimulatedWalletAdapter, SIMULATED_LOCATION, SIMULATED_PHOTO_URI,
16
16
  export { default as WorkflowButtonLabel } from './components/WorkflowButtonLabel.js';
17
17
  export type { WorkflowTextProps } from './components/WorkflowText.js';
18
18
  export { default as WorkflowText, WORKFLOW_TEXT_BASE_SIZES } from './components/WorkflowText.js';
19
+ export { coerceToChipRowItem } from './content/ChipRowContent.js';
19
20
  export { isFormFieldChild } from './content/FormContent.js';
20
21
  export type { WorkflowI18nProviderProps, WorkflowStringKey, WorkflowTranslate } from './i18n/WorkflowI18n.js';
21
22
  export { DEFAULT_WORKFLOW_STRINGS, useWorkflowT, WorkflowI18nProvider } from './i18n/WorkflowI18n.js';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,gBAAgB,EAAE,MAAM,wBAAwB,CAAA;AAEzD,YAAY,EACV,aAAa,EACb,WAAW,EACX,qBAAqB,EACrB,iBAAiB,EACjB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,aAAa,EACb,0BAA0B,GAC3B,MAAM,4BAAyB,CAAA;AAChC,OAAO,EACL,4BAA4B,EAC5B,kBAAkB,EAClB,mBAAmB,EACnB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,4BAAyB,CAAA;AAChC,OAAO,EAAE,OAAO,IAAI,mBAAmB,EAAE,MAAM,qCAAkC,CAAA;AAEjF,YAAY,EAAE,iBAAiB,EAAE,MAAM,8BAA2B,CAAA;AAClE,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,wBAAwB,EAAE,MAAM,8BAA2B,CAAA;AAC7F,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAAuB,CAAA;AACxD,YAAY,EAAE,yBAAyB,EAAE,iBAAi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AAE,MAAM,mCAAgC,CAAA;AAEvE,YAAY,EAAE,iBAAiB,EAAE,uBAAuB,EAAE,UAAU,EAAE,MAAM,uBAAc,CAAA;AAC1F,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,iBAAiB,EAAE,aAAa,EAAE,MAAM,uBAAc,CAAA;AACnG,cAAc,oCAAiC,CAAA;AAC/C,YAAY,EACV,kBAAkB,EAClB,cAAc,EACd,aAAa,EACb,sBAAsB,EACtB,0BAA0B,GAC3B,MAAM,0BAAuB,CAAA;AAC9B,OAAO,EACL,sBAAsB,EACtB,kBAAkB,EAClB,gBAAgB,EAChB,qBAAqB,GACtB,MAAM,0BAAuB,CAAA;AAC9B,OAAO,EACL,0BAA0B,EAC1B,qBAAqB,EACrB,yBAAyB,GAC1B,MAAM,+BAA4B,CAAA;AAGnC,OAAO,wBAAe,CAAA;AACtB,OAAO,oBAAW,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@veridid/workflow-ui",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "React Native components for workflow display hints. Rendered natively by the DigiCred wallet and through react-native-web by the CrMS designer.",
5
5
  "files": [
6
6
  "build",
@@ -33,7 +33,7 @@
33
33
  "directory": "packages/workflow-ui"
34
34
  },
35
35
  "dependencies": {
36
- "@veridid/workflow-core": "0.1.0"
36
+ "@veridid/workflow-core": "0.1.1"
37
37
  },
38
38
  "peerDependencies": {
39
39
  "@react-native-community/datetimepicker": ">=8.0.0",
@@ -54,6 +54,9 @@
54
54
  "react-native": {
55
55
  "optional": true
56
56
  },
57
+ "react-native-vector-icons": {
58
+ "optional": true
59
+ },
57
60
  "react-native-web": {
58
61
  "optional": true
59
62
  }
@@ -4,6 +4,7 @@ import WorkflowText from '../components/WorkflowText'
4
4
  import { type ContentProps, ContentRegistry } from '../registries/ContentRegistry'
5
5
  import { useResponsive } from '../responsive'
6
6
  import { resolveItemSurfaceStyle } from '../style/resolveDisplayHintStyle'
7
+ import { coerceToChipRowItem } from './ChipRowContent'
7
8
 
8
9
  const resolveChildLabel = (child: ContentProps['item']): string | undefined => {
9
10
  const candidates = [child.text, child.title, child.label, child.subtitle]
@@ -15,22 +16,21 @@ const resolveChildLabel = (child: ContentProps['item']): string | undefined => {
15
16
  return undefined
16
17
  }
17
18
 
18
- const ListContent: React.FC<ContentProps> = ({
19
- item,
20
- styles,
21
- colors,
22
- onAction,
23
- formData,
24
- onFieldChange,
25
- FormFieldRegistry,
26
- buttonVariant,
27
- }) => {
19
+ const ListContent: React.FC<ContentProps> = (props) => {
20
+ const { item, styles, colors, onAction, formData, onFieldChange, FormFieldRegistry, buttonVariant } = props
28
21
  const { s, ms } = useResponsive()
29
22
  const listItems: string[] = Array.isArray(item.items) ? item.items : []
30
23
  const children: ContentProps['item'][] = Array.isArray(item.children) ? item.children : []
31
24
 
32
25
  if (listItems.length === 0 && children.length === 0) return null
33
26
 
27
+ // A list of only chips (3+) is a chip row, like row / section / grid. The
28
+ // wallet used to apply this to every top-level item before rendering.
29
+ const chipRowItem = coerceToChipRowItem(item)
30
+ if (chipRowItem && ContentRegistry.has('chip-row')) {
31
+ return <>{ContentRegistry.render('chip-row', { ...props, item: chipRowItem })}</>
32
+ }
33
+
34
34
  const bulletRow = (key: string, body: ReactNode) => (
35
35
  <View
36
36
  key={key}
@@ -0,0 +1,10 @@
1
+ import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
2
+ import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
3
+ import type { WorkflowIconProps } from './types'
4
+
5
+ /** Native: the vector-icon fonts the wallet already bundles. */
6
+ export function VectorIcon({ set = 'material', name, size, color, style }: WorkflowIconProps) {
7
+ const Family = set === 'material-community' ? MaterialCommunityIcons : MaterialIcons
8
+ // vector-icons' typings use the old @types/react-native StyleProp; same runtime shape.
9
+ return <Family name={name} size={size} color={color} style={style as never} />
10
+ }
@@ -0,0 +1,55 @@
1
+ import { Text } from 'react-native'
2
+ import type { WorkflowIconProps, WorkflowIconSet } from './types'
3
+
4
+ /**
5
+ * Web: `react-native-vector-icons` can't load in a browser (Flow source and a
6
+ * native TurboModule lookup at import time), so the glyphs the controls use are
7
+ * drawn as text in the same fonts. The host page loads the fonts once:
8
+ *
9
+ * @font-face { font-family: 'MaterialIcons'; src: url(react-native-vector-icons/Fonts/MaterialIcons.ttf); }
10
+ * @font-face { font-family: 'MaterialCommunityIcons'; src: url(react-native-vector-icons/Fonts/MaterialCommunityIcons.ttf); }
11
+ *
12
+ * Or replace icons entirely with `WorkflowIconProvider`. Names not listed here
13
+ * draw nothing; add a codepoint when a control starts using a new icon
14
+ * (`icons.test.tsx` checks every name the controls use).
15
+ */
16
+ export const WEB_GLYPHS: Record<WorkflowIconSet, Record<string, number>> = {
17
+ material: {
18
+ phone: 57549,
19
+ share: 59405,
20
+ check: 58826,
21
+ info: 59534,
22
+ warning: 57346,
23
+ error: 57344,
24
+ 'check-circle': 59500,
25
+ cancel: 58825,
26
+ },
27
+ 'material-community': {
28
+ 'qrcode-scan': 984115,
29
+ 'image-off-outline': 987601,
30
+ 'camera-retake-outline': 986650,
31
+ 'camera-outline': 986461,
32
+ },
33
+ }
34
+
35
+ const FONT_FAMILY: Record<WorkflowIconSet, string> = {
36
+ material: 'MaterialIcons',
37
+ 'material-community': 'MaterialCommunityIcons',
38
+ }
39
+
40
+ export function VectorIcon({ set = 'material', name, size, color, style }: WorkflowIconProps) {
41
+ const codepoint = WEB_GLYPHS[set][name]
42
+ if (codepoint === undefined) return null
43
+ return (
44
+ <Text
45
+ selectable={false}
46
+ style={[
47
+ { fontSize: size, color, lineHeight: size },
48
+ style,
49
+ { fontFamily: FONT_FAMILY[set], fontWeight: 'normal', fontStyle: 'normal' },
50
+ ]}
51
+ >
52
+ {String.fromCodePoint(codepoint)}
53
+ </Text>
54
+ )
55
+ }
@@ -1,19 +1,8 @@
1
1
  import { createContext, type ReactNode, useContext } from 'react'
2
- import type { StyleProp, TextStyle } from 'react-native'
3
- import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons'
4
- import MaterialIcons from 'react-native-vector-icons/MaterialIcons'
2
+ import type { WorkflowIconProps } from './types'
3
+ import { VectorIcon } from './VectorIcon'
5
4
 
6
- /** Icon families the controls use (names are the vector-icons names). */
7
- export type WorkflowIconSet = 'material' | 'material-community'
8
-
9
- export type WorkflowIconProps = {
10
- name: string
11
- /** Default `material`. */
12
- set?: WorkflowIconSet
13
- size: number
14
- color: string
15
- style?: StyleProp<TextStyle>
16
- }
5
+ export type { WorkflowIconProps, WorkflowIconSet } from './types'
17
6
 
18
7
  /** Draws one icon. Return `null` to fall back to the built-in vector icons. */
19
8
  export type WorkflowIconRenderer = (props: WorkflowIconProps) => ReactNode | null
@@ -24,8 +13,9 @@ export type WorkflowIconProviderProps = { renderIcon: WorkflowIconRenderer; chil
24
13
 
25
14
  /**
26
15
  * Replaces the icons every control draws (e.g. the designer can use its own
27
- * icon set instead of loading the vector-icon fonts). Without it, controls use
28
- * `react-native-vector-icons`, like the wallet.
16
+ * icon set). Without it, controls use `react-native-vector-icons` on native,
17
+ * like the wallet, and the same fonts drawn as text on the web (the page loads
18
+ * the fonts; see `VectorIcon.web.tsx`).
29
19
  */
30
20
  export function WorkflowIconProvider({ renderIcon, children }: WorkflowIconProviderProps) {
31
21
  return <WorkflowIconContext.Provider value={renderIcon}>{children}</WorkflowIconContext.Provider>
@@ -36,8 +26,5 @@ export function WorkflowIcon(props: WorkflowIconProps) {
36
26
  const renderIcon = useContext(WorkflowIconContext)
37
27
  const custom = renderIcon?.(props)
38
28
  if (custom != null) return <>{custom}</>
39
- const { set = 'material', name, size, color, style } = props
40
- const Family = set === 'material-community' ? MaterialCommunityIcons : MaterialIcons
41
- // vector-icons' typings use the old @types/react-native StyleProp; same runtime shape.
42
- return <Family name={name} size={size} color={color} style={style as never} />
29
+ return <VectorIcon {...props} />
43
30
  }
@@ -0,0 +1,13 @@
1
+ import type { StyleProp, TextStyle } from 'react-native'
2
+
3
+ /** Icon families the controls use (names are the vector-icons names). */
4
+ export type WorkflowIconSet = 'material' | 'material-community'
5
+
6
+ export type WorkflowIconProps = {
7
+ name: string
8
+ /** Default `material`. */
9
+ set?: WorkflowIconSet
10
+ size: number
11
+ color: string
12
+ style?: StyleProp<TextStyle>
13
+ }
package/src/index.ts CHANGED
@@ -37,6 +37,7 @@ export { default as WorkflowButtonLabel } from './components/WorkflowButtonLabel
37
37
  // Building blocks for host-rendered controls
38
38
  export type { WorkflowTextProps } from './components/WorkflowText'
39
39
  export { default as WorkflowText, WORKFLOW_TEXT_BASE_SIZES } from './components/WorkflowText'
40
+ export { coerceToChipRowItem } from './content/ChipRowContent'
40
41
  export { isFormFieldChild } from './content/FormContent'
41
42
  export type { WorkflowI18nProviderProps, WorkflowStringKey, WorkflowTranslate } from './i18n/WorkflowI18n'
42
43
  export { DEFAULT_WORKFLOW_STRINGS, useWorkflowT, WorkflowI18nProvider } from './i18n/WorkflowI18n'