@oxy.so/services 14.11.0 → 14.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonjs/assets/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/commonjs/assets/assets/fonts/icons/manifest.json +5 -4
- package/lib/commonjs/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/commonjs/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/commonjs/assets/fonts/icons/manifest.json +5 -4
- package/lib/commonjs/ui/icons/subsetGlyphMaps.js +1 -0
- package/lib/commonjs/ui/icons/subsetGlyphMaps.js.map +1 -1
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js +16 -63
- package/lib/commonjs/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/commonjs/ui/screens/ProfileLinkForm.js +125 -0
- package/lib/commonjs/ui/screens/ProfileLinkForm.js.map +1 -0
- package/lib/commonjs/ui/screens/ProfileLinksEditor.js +85 -0
- package/lib/commonjs/ui/screens/ProfileLinksEditor.js.map +1 -0
- package/lib/commonjs/ui/screens/linkFormat.js +22 -10
- package/lib/commonjs/ui/screens/linkFormat.js.map +1 -1
- package/lib/module/assets/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/module/assets/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/module/assets/assets/fonts/icons/manifest.json +5 -4
- package/lib/module/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/lib/module/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/lib/module/assets/fonts/icons/manifest.json +5 -4
- package/lib/module/ui/icons/subsetGlyphMaps.js +1 -0
- package/lib/module/ui/icons/subsetGlyphMaps.js.map +1 -1
- package/lib/module/ui/screens/EditProfileFieldScreen.js +17 -65
- package/lib/module/ui/screens/EditProfileFieldScreen.js.map +1 -1
- package/lib/module/ui/screens/ProfileLinkForm.js +121 -0
- package/lib/module/ui/screens/ProfileLinkForm.js.map +1 -0
- package/lib/module/ui/screens/ProfileLinksEditor.js +81 -0
- package/lib/module/ui/screens/ProfileLinksEditor.js.map +1 -0
- package/lib/module/ui/screens/linkFormat.js +21 -9
- package/lib/module/ui/screens/linkFormat.js.map +1 -1
- package/lib/typescript/commonjs/ui/icons/Ionicons.d.ts +1 -1
- package/lib/typescript/commonjs/ui/icons/Ionicons.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/icons/subsetGlyphMaps.d.ts +1 -0
- package/lib/typescript/commonjs/ui/icons/subsetGlyphMaps.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
- package/lib/typescript/commonjs/ui/screens/ProfileLinkForm.d.ts +18 -0
- package/lib/typescript/commonjs/ui/screens/ProfileLinkForm.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/ProfileLinksEditor.d.ts +14 -0
- package/lib/typescript/commonjs/ui/screens/ProfileLinksEditor.d.ts.map +1 -0
- package/lib/typescript/commonjs/ui/screens/linkFormat.d.ts +14 -2
- package/lib/typescript/commonjs/ui/screens/linkFormat.d.ts.map +1 -1
- package/lib/typescript/module/ui/icons/Ionicons.d.ts +1 -1
- package/lib/typescript/module/ui/icons/Ionicons.d.ts.map +1 -1
- package/lib/typescript/module/ui/icons/subsetGlyphMaps.d.ts +1 -0
- package/lib/typescript/module/ui/icons/subsetGlyphMaps.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/EditProfileFieldScreen.d.ts.map +1 -1
- package/lib/typescript/module/ui/screens/ProfileLinkForm.d.ts +18 -0
- package/lib/typescript/module/ui/screens/ProfileLinkForm.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/ProfileLinksEditor.d.ts +14 -0
- package/lib/typescript/module/ui/screens/ProfileLinksEditor.d.ts.map +1 -0
- package/lib/typescript/module/ui/screens/linkFormat.d.ts +14 -2
- package/lib/typescript/module/ui/screens/linkFormat.d.ts.map +1 -1
- package/package.json +5 -5
- package/src/assets/fonts/icons/OxyServicesIonicons.ttf +0 -0
- package/src/assets/fonts/icons/OxyServicesMaterialCommunityIcons.ttf +0 -0
- package/src/assets/fonts/icons/manifest.json +5 -4
- package/src/ui/icons/subsetGlyphMaps.ts +1 -0
- package/src/ui/screens/EditProfileFieldScreen.tsx +19 -85
- package/src/ui/screens/ProfileLinkForm.tsx +131 -0
- package/src/ui/screens/ProfileLinksEditor.tsx +98 -0
- package/src/ui/screens/__tests__/linkFormat.test.ts +51 -8
- package/src/ui/screens/linkFormat.ts +28 -9
- package/lib/commonjs/ui/screens/LinkListEditor.js +0 -105
- package/lib/commonjs/ui/screens/LinkListEditor.js.map +0 -1
- package/lib/module/ui/screens/LinkListEditor.js +0 -99
- package/lib/module/ui/screens/LinkListEditor.js.map +0 -1
- package/lib/typescript/commonjs/ui/screens/LinkListEditor.d.ts +0 -25
- package/lib/typescript/commonjs/ui/screens/LinkListEditor.d.ts.map +0 -1
- package/lib/typescript/module/ui/screens/LinkListEditor.d.ts +0 -25
- package/lib/typescript/module/ui/screens/LinkListEditor.d.ts.map +0 -1
- package/src/ui/screens/LinkListEditor.tsx +0 -113
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import React, { useCallback } from 'react';
|
|
4
|
-
import { View } from 'react-native';
|
|
5
|
-
import { Button } from '@oxy.so/bloom/button';
|
|
6
|
-
import { TextField, TextFieldInput, TextFieldLabel } from '@oxy.so/bloom/text-field';
|
|
7
|
-
import { Text } from '@oxy.so/bloom/typography';
|
|
8
|
-
import { useTheme } from '@oxy.so/bloom/theme';
|
|
9
|
-
import { PROFILE_LINK_TITLE_MAX } from '@oxy.so/contracts/client';
|
|
10
|
-
import Ionicons from "../icons/Ionicons.js";
|
|
11
|
-
import { clampLinkTitle, moveLinkItem } from "./linkFormat.js";
|
|
12
|
-
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
13
|
-
/**
|
|
14
|
-
* The profile's ordered link list. Each link has an editable title and can move
|
|
15
|
-
* up or down; order is the profile's display order, and the server stores it as
|
|
16
|
-
* the array's index. Reordering uses buttons rather than drag: a drag gesture
|
|
17
|
-
* would not reach a screen reader, and a button does.
|
|
18
|
-
*/
|
|
19
|
-
export function LinkListEditor({
|
|
20
|
-
items,
|
|
21
|
-
onChange,
|
|
22
|
-
disabled,
|
|
23
|
-
labels
|
|
24
|
-
}) {
|
|
25
|
-
const bloomTheme = useTheme();
|
|
26
|
-
const setTitle = useCallback((id, title) => {
|
|
27
|
-
onChange(items.map(item => item.id === id ? {
|
|
28
|
-
...item,
|
|
29
|
-
title: clampLinkTitle(title)
|
|
30
|
-
} : item));
|
|
31
|
-
}, [items, onChange]);
|
|
32
|
-
const move = useCallback((index, delta) => onChange(moveLinkItem(items, index, delta)), [items, onChange]);
|
|
33
|
-
const remove = useCallback(id => onChange(items.filter(item => item.id !== id)), [items, onChange]);
|
|
34
|
-
return /*#__PURE__*/_jsx(View, {
|
|
35
|
-
className: "gap-space-12",
|
|
36
|
-
children: items.map((item, index) => {
|
|
37
|
-
const shownTitle = item.title || item.url;
|
|
38
|
-
return /*#__PURE__*/_jsxs(View, {
|
|
39
|
-
className: "gap-space-8 pb-space-12 border-b border-border",
|
|
40
|
-
children: [/*#__PURE__*/_jsxs(TextField, {
|
|
41
|
-
disabled: disabled,
|
|
42
|
-
children: [/*#__PURE__*/_jsx(TextFieldLabel, {
|
|
43
|
-
children: labels.title
|
|
44
|
-
}), /*#__PURE__*/_jsx(TextFieldInput, {
|
|
45
|
-
label: labels.title,
|
|
46
|
-
value: item.title,
|
|
47
|
-
onChangeText: value => setTitle(item.id, value),
|
|
48
|
-
maxLength: PROFILE_LINK_TITLE_MAX,
|
|
49
|
-
autoCorrect: true
|
|
50
|
-
})]
|
|
51
|
-
}), /*#__PURE__*/_jsxs(View, {
|
|
52
|
-
className: "flex-row items-center gap-space-8",
|
|
53
|
-
children: [/*#__PURE__*/_jsx(Text, {
|
|
54
|
-
className: "flex-1 text-muted-foreground",
|
|
55
|
-
numberOfLines: 1,
|
|
56
|
-
children: item.url
|
|
57
|
-
}), /*#__PURE__*/_jsx(Button, {
|
|
58
|
-
onPress: () => move(index, -1),
|
|
59
|
-
disabled: disabled || index === 0,
|
|
60
|
-
accessibilityLabel: labels.moveUp,
|
|
61
|
-
icon: /*#__PURE__*/_jsx(Ionicons, {
|
|
62
|
-
name: "chevron-up",
|
|
63
|
-
size: 18,
|
|
64
|
-
color: bloomTheme.colors.textSecondary
|
|
65
|
-
}),
|
|
66
|
-
iconOnly: true,
|
|
67
|
-
tone: "neutral",
|
|
68
|
-
appearance: "plain"
|
|
69
|
-
}), /*#__PURE__*/_jsx(Button, {
|
|
70
|
-
onPress: () => move(index, 1),
|
|
71
|
-
disabled: disabled || index === items.length - 1,
|
|
72
|
-
accessibilityLabel: labels.moveDown,
|
|
73
|
-
icon: /*#__PURE__*/_jsx(Ionicons, {
|
|
74
|
-
name: "chevron-down",
|
|
75
|
-
size: 18,
|
|
76
|
-
color: bloomTheme.colors.textSecondary
|
|
77
|
-
}),
|
|
78
|
-
iconOnly: true,
|
|
79
|
-
tone: "neutral",
|
|
80
|
-
appearance: "plain"
|
|
81
|
-
}), /*#__PURE__*/_jsx(Button, {
|
|
82
|
-
onPress: () => remove(item.id),
|
|
83
|
-
disabled: disabled,
|
|
84
|
-
accessibilityLabel: labels.removeNamed(shownTitle),
|
|
85
|
-
icon: /*#__PURE__*/_jsx(Ionicons, {
|
|
86
|
-
name: "trash-outline",
|
|
87
|
-
size: 18,
|
|
88
|
-
color: bloomTheme.colors.negative
|
|
89
|
-
}),
|
|
90
|
-
iconOnly: true,
|
|
91
|
-
tone: "danger",
|
|
92
|
-
appearance: "plain"
|
|
93
|
-
})]
|
|
94
|
-
})]
|
|
95
|
-
}, item.id);
|
|
96
|
-
})
|
|
97
|
-
});
|
|
98
|
-
}
|
|
99
|
-
//# sourceMappingURL=LinkListEditor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","useCallback","View","Button","TextField","TextFieldInput","TextFieldLabel","Text","useTheme","PROFILE_LINK_TITLE_MAX","Ionicons","clampLinkTitle","moveLinkItem","jsx","_jsx","jsxs","_jsxs","LinkListEditor","items","onChange","disabled","labels","bloomTheme","setTitle","id","title","map","item","move","index","delta","remove","filter","className","children","shownTitle","url","label","value","onChangeText","maxLength","autoCorrect","numberOfLines","onPress","accessibilityLabel","moveUp","icon","name","size","color","colors","textSecondary","iconOnly","tone","appearance","length","moveDown","removeNamed","negative"],"sourceRoot":"../../../../src","sources":["ui/screens/LinkListEditor.tsx"],"mappings":";;AAAA,OAAOA,KAAK,IAAIC,WAAW,QAAQ,OAAO;AAC1C,SAASC,IAAI,QAAQ,cAAc;AACnC,SAASC,MAAM,QAAQ,sBAAsB;AAC7C,SAASC,SAAS,EAAEC,cAAc,EAAEC,cAAc,QAAQ,0BAA0B;AACpF,SAASC,IAAI,QAAQ,0BAA0B;AAC/C,SAASC,QAAQ,QAAQ,qBAAqB;AAC9C,SAASC,sBAAsB,QAAQ,0BAA0B;AACjE,OAAOC,QAAQ,MAAM,sBAAmB;AACxC,SAASC,cAAc,EAAEC,YAAY,QAA2B,iBAAc;AAAC,SAAAC,GAAA,IAAAC,IAAA,EAAAC,IAAA,IAAAC,KAAA;AAiB/E;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,cAAcA,CAAC;EAAEC,KAAK;EAAEC,QAAQ;EAAEC,QAAQ;EAAEC;AAA4B,CAAC,EAAE;EACzF,MAAMC,UAAU,GAAGd,QAAQ,CAAC,CAAC;EAE7B,MAAMe,QAAQ,GAAGtB,WAAW,CAC1B,CAACuB,EAAU,EAAEC,KAAa,KAAK;IAC7BN,QAAQ,CACND,KAAK,CAACQ,GAAG,CAAEC,IAAI,IAAMA,IAAI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A,QAAS;YACnBwB,kBAAkB,EAAEvB,MAAM,CAACoC,WAAW,CAACtB,UAAU,CAAE;YACnDW,IAAI,eACFhC,IAAA,CAACJ,QAAQ;cAACqC,IAAI,EAAC,eAAe;cAACC,IAAI,EAAE,EAAG;cAACC,KAAK,EAAE3B,UAAU,CAAC4B,MAAM,CAACQ;YAAS,CAAE,CAC9E;YACDN,QAAQ;YACRC,IAAI,EAAC,QAAQ;YACbC,UAAU,EAAC;UAAO,CACnB,CAAC;QAAA,CACE,CAAC;MAAA,GAhDE3B,IAAI,CAACH,EAiDV,CAAC;IAEX,CAAC;EAAC,CACE,CAAC;AAEX","ignoreList":[]}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type LinkListItem } from './linkFormat';
|
|
3
|
-
interface LinkListEditorProps {
|
|
4
|
-
items: LinkListItem[];
|
|
5
|
-
onChange: (items: LinkListItem[]) => void;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
/** Visible and accessible strings, resolved by the caller. */
|
|
8
|
-
labels: {
|
|
9
|
-
title: string;
|
|
10
|
-
moveUp: string;
|
|
11
|
-
moveDown: string;
|
|
12
|
-
remove: string;
|
|
13
|
-
/** `{{title}}` is replaced with the link's title. */
|
|
14
|
-
removeNamed: (title: string) => string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The profile's ordered link list. Each link has an editable title and can move
|
|
19
|
-
* up or down; order is the profile's display order, and the server stores it as
|
|
20
|
-
* the array's index. Reordering uses buttons rather than drag: a drag gesture
|
|
21
|
-
* would not reach a screen reader, and a button does.
|
|
22
|
-
*/
|
|
23
|
-
export declare function LinkListEditor({ items, onChange, disabled, labels }: LinkListEditorProps): React.JSX.Element;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=LinkListEditor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LinkListEditor.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/LinkListEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAQ3C,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,cAAc,CAAC;AAE/E,UAAU,mBAAmB;IAC3B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,qDAAqD;QACrD,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;KACxC,CAAC;CACH;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,mBAAmB,qBAiFxF"}
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { type LinkListItem } from './linkFormat.js';
|
|
3
|
-
interface LinkListEditorProps {
|
|
4
|
-
items: LinkListItem[];
|
|
5
|
-
onChange: (items: LinkListItem[]) => void;
|
|
6
|
-
disabled?: boolean;
|
|
7
|
-
/** Visible and accessible strings, resolved by the caller. */
|
|
8
|
-
labels: {
|
|
9
|
-
title: string;
|
|
10
|
-
moveUp: string;
|
|
11
|
-
moveDown: string;
|
|
12
|
-
remove: string;
|
|
13
|
-
/** `{{title}}` is replaced with the link's title. */
|
|
14
|
-
removeNamed: (title: string) => string;
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
/**
|
|
18
|
-
* The profile's ordered link list. Each link has an editable title and can move
|
|
19
|
-
* up or down; order is the profile's display order, and the server stores it as
|
|
20
|
-
* the array's index. Reordering uses buttons rather than drag: a drag gesture
|
|
21
|
-
* would not reach a screen reader, and a button does.
|
|
22
|
-
*/
|
|
23
|
-
export declare function LinkListEditor({ items, onChange, disabled, labels }: LinkListEditorProps): React.JSX.Element;
|
|
24
|
-
export {};
|
|
25
|
-
//# sourceMappingURL=LinkListEditor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"LinkListEditor.d.ts","sourceRoot":"","sources":["../../../../../src/ui/screens/LinkListEditor.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAsB,MAAM,OAAO,CAAC;AAQ3C,OAAO,EAAgC,KAAK,YAAY,EAAE,MAAM,iBAAc,CAAC;AAE/E,UAAU,mBAAmB;IAC3B,KAAK,EAAE,YAAY,EAAE,CAAC;IACtB,QAAQ,EAAE,CAAC,KAAK,EAAE,YAAY,EAAE,KAAK,IAAI,CAAC;IAC1C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,8DAA8D;IAC9D,MAAM,EAAE;QACN,KAAK,EAAE,MAAM,CAAC;QACd,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,EAAE,MAAM,CAAC;QACjB,MAAM,EAAE,MAAM,CAAC;QACf,qDAAqD;QACrD,WAAW,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;KACxC,CAAC;CACH;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,EAAE,KAAK,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,EAAE,EAAE,mBAAmB,qBAiFxF"}
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import React, { useCallback } from 'react';
|
|
2
|
-
import { View } from 'react-native';
|
|
3
|
-
import { Button } from '@oxy.so/bloom/button';
|
|
4
|
-
import { TextField, TextFieldInput, TextFieldLabel } from '@oxy.so/bloom/text-field';
|
|
5
|
-
import { Text } from '@oxy.so/bloom/typography';
|
|
6
|
-
import { useTheme } from '@oxy.so/bloom/theme';
|
|
7
|
-
import { PROFILE_LINK_TITLE_MAX } from '@oxy.so/contracts/client';
|
|
8
|
-
import Ionicons from '../icons/Ionicons';
|
|
9
|
-
import { clampLinkTitle, moveLinkItem, type LinkListItem } from './linkFormat';
|
|
10
|
-
|
|
11
|
-
interface LinkListEditorProps {
|
|
12
|
-
items: LinkListItem[];
|
|
13
|
-
onChange: (items: LinkListItem[]) => void;
|
|
14
|
-
disabled?: boolean;
|
|
15
|
-
/** Visible and accessible strings, resolved by the caller. */
|
|
16
|
-
labels: {
|
|
17
|
-
title: string;
|
|
18
|
-
moveUp: string;
|
|
19
|
-
moveDown: string;
|
|
20
|
-
remove: string;
|
|
21
|
-
/** `{{title}}` is replaced with the link's title. */
|
|
22
|
-
removeNamed: (title: string) => string;
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
/**
|
|
27
|
-
* The profile's ordered link list. Each link has an editable title and can move
|
|
28
|
-
* up or down; order is the profile's display order, and the server stores it as
|
|
29
|
-
* the array's index. Reordering uses buttons rather than drag: a drag gesture
|
|
30
|
-
* would not reach a screen reader, and a button does.
|
|
31
|
-
*/
|
|
32
|
-
export function LinkListEditor({ items, onChange, disabled, labels }: LinkListEditorProps) {
|
|
33
|
-
const bloomTheme = useTheme();
|
|
34
|
-
|
|
35
|
-
const setTitle = useCallback(
|
|
36
|
-
(id: string, title: string) => {
|
|
37
|
-
onChange(
|
|
38
|
-
items.map((item) => (item.id === id ? { ...item, title: clampLinkTitle(title) } : item)),
|
|
39
|
-
);
|
|
40
|
-
},
|
|
41
|
-
[items, onChange],
|
|
42
|
-
);
|
|
43
|
-
|
|
44
|
-
const move = useCallback(
|
|
45
|
-
(index: number, delta: -1 | 1) => onChange(moveLinkItem(items, index, delta)),
|
|
46
|
-
[items, onChange],
|
|
47
|
-
);
|
|
48
|
-
|
|
49
|
-
const remove = useCallback(
|
|
50
|
-
(id: string) => onChange(items.filter((item) => item.id !== id)),
|
|
51
|
-
[items, onChange],
|
|
52
|
-
);
|
|
53
|
-
|
|
54
|
-
return (
|
|
55
|
-
<View className="gap-space-12">
|
|
56
|
-
{items.map((item, index) => {
|
|
57
|
-
const shownTitle = item.title || item.url;
|
|
58
|
-
return (
|
|
59
|
-
<View key={item.id} className="gap-space-8 pb-space-12 border-b border-border">
|
|
60
|
-
<TextField disabled={disabled}>
|
|
61
|
-
<TextFieldLabel>{labels.title}</TextFieldLabel>
|
|
62
|
-
<TextFieldInput
|
|
63
|
-
label={labels.title}
|
|
64
|
-
value={item.title}
|
|
65
|
-
onChangeText={(value) => setTitle(item.id, value)}
|
|
66
|
-
maxLength={PROFILE_LINK_TITLE_MAX}
|
|
67
|
-
autoCorrect
|
|
68
|
-
/>
|
|
69
|
-
</TextField>
|
|
70
|
-
<View className="flex-row items-center gap-space-8">
|
|
71
|
-
<Text className="flex-1 text-muted-foreground" numberOfLines={1}>
|
|
72
|
-
{item.url}
|
|
73
|
-
</Text>
|
|
74
|
-
<Button
|
|
75
|
-
onPress={() => move(index, -1)}
|
|
76
|
-
disabled={disabled || index === 0}
|
|
77
|
-
accessibilityLabel={labels.moveUp}
|
|
78
|
-
icon={
|
|
79
|
-
<Ionicons name="chevron-up" size={18} color={bloomTheme.colors.textSecondary} />
|
|
80
|
-
}
|
|
81
|
-
iconOnly
|
|
82
|
-
tone="neutral"
|
|
83
|
-
appearance="plain"
|
|
84
|
-
/>
|
|
85
|
-
<Button
|
|
86
|
-
onPress={() => move(index, 1)}
|
|
87
|
-
disabled={disabled || index === items.length - 1}
|
|
88
|
-
accessibilityLabel={labels.moveDown}
|
|
89
|
-
icon={
|
|
90
|
-
<Ionicons name="chevron-down" size={18} color={bloomTheme.colors.textSecondary} />
|
|
91
|
-
}
|
|
92
|
-
iconOnly
|
|
93
|
-
tone="neutral"
|
|
94
|
-
appearance="plain"
|
|
95
|
-
/>
|
|
96
|
-
<Button
|
|
97
|
-
onPress={() => remove(item.id)}
|
|
98
|
-
disabled={disabled}
|
|
99
|
-
accessibilityLabel={labels.removeNamed(shownTitle)}
|
|
100
|
-
icon={
|
|
101
|
-
<Ionicons name="trash-outline" size={18} color={bloomTheme.colors.negative} />
|
|
102
|
-
}
|
|
103
|
-
iconOnly
|
|
104
|
-
tone="danger"
|
|
105
|
-
appearance="plain"
|
|
106
|
-
/>
|
|
107
|
-
</View>
|
|
108
|
-
</View>
|
|
109
|
-
);
|
|
110
|
-
})}
|
|
111
|
-
</View>
|
|
112
|
-
);
|
|
113
|
-
}
|