@multiplatform.one/components 4.0.1 → 4.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/forms/Input/FieldInput.stories.js +4 -4
- package/dist/cjs/forms/Input/FieldInput.stories.js.map +1 -1
- package/dist/cjs/forms/Input/FieldInput.stories.native.js +6 -6
- package/dist/cjs/forms/Input/FieldInput.stories.native.js.map +2 -2
- package/dist/cjs/forms/Slider/FieldSlider.stories.js +16 -10
- package/dist/cjs/forms/Slider/FieldSlider.stories.js.map +2 -2
- package/dist/cjs/forms/Slider/FieldSlider.stories.native.js +70 -14
- package/dist/cjs/forms/Slider/FieldSlider.stories.native.js.map +2 -2
- package/dist/cjs/forms/Switch/FieldSwitch.stories.js +1 -3
- package/dist/cjs/forms/Switch/FieldSwitch.stories.js.map +1 -1
- package/dist/cjs/forms/Switch/FieldSwitch.stories.native.js +1 -3
- package/dist/cjs/forms/Switch/FieldSwitch.stories.native.js.map +2 -2
- package/dist/cjs/forms/TextArea/FieldTextArea.stories.js +1 -4
- package/dist/cjs/forms/TextArea/FieldTextArea.stories.js.map +1 -1
- package/dist/cjs/forms/TextArea/FieldTextArea.stories.native.js +2 -4
- package/dist/cjs/forms/TextArea/FieldTextArea.stories.native.js.map +2 -2
- package/dist/cjs/organize/SimpleInput/index.js.map +1 -1
- package/dist/cjs/organize/SimpleInput/index.native.js.map +1 -1
- package/dist/cjs/organize/SimpleParagraph/SimpleParagraph.stories.js +32 -0
- package/dist/cjs/organize/SimpleParagraph/SimpleParagraph.stories.js.map +6 -0
- package/dist/cjs/organize/SimpleParagraph/SimpleParagraph.stories.native.js +43 -0
- package/dist/cjs/organize/SimpleParagraph/SimpleParagraph.stories.native.js.map +6 -0
- package/dist/cjs/organize/SimpleParagraph/index.js +45 -0
- package/dist/cjs/organize/SimpleParagraph/index.js.map +6 -0
- package/dist/cjs/organize/SimpleParagraph/index.native.js +124 -0
- package/dist/cjs/organize/SimpleParagraph/index.native.js.map +6 -0
- package/dist/cjs/organize/index.js +1 -0
- package/dist/cjs/organize/index.js.map +1 -1
- package/dist/cjs/organize/index.native.js +3 -1
- package/dist/cjs/organize/index.native.js.map +1 -1
- package/dist/esm/forms/Input/FieldInput.stories.js +4 -4
- package/dist/esm/forms/Input/FieldInput.stories.js.map +1 -1
- package/dist/esm/forms/Input/FieldInput.stories.mjs +6 -6
- package/dist/esm/forms/Input/FieldInput.stories.native.js +6 -6
- package/dist/esm/forms/Input/FieldInput.stories.native.js.map +2 -2
- package/dist/esm/forms/Slider/FieldSlider.stories.js +7 -8
- package/dist/esm/forms/Slider/FieldSlider.stories.js.map +1 -1
- package/dist/esm/forms/Slider/FieldSlider.stories.mjs +21 -20
- package/dist/esm/forms/Slider/FieldSlider.stories.native.js +61 -13
- package/dist/esm/forms/Slider/FieldSlider.stories.native.js.map +2 -2
- package/dist/esm/forms/Switch/FieldSwitch.stories.js +1 -3
- package/dist/esm/forms/Switch/FieldSwitch.stories.js.map +1 -1
- package/dist/esm/forms/Switch/FieldSwitch.stories.mjs +1 -3
- package/dist/esm/forms/Switch/FieldSwitch.stories.native.js +1 -3
- package/dist/esm/forms/Switch/FieldSwitch.stories.native.js.map +2 -2
- package/dist/esm/forms/TextArea/FieldTextArea.stories.js +1 -4
- package/dist/esm/forms/TextArea/FieldTextArea.stories.js.map +1 -1
- package/dist/esm/forms/TextArea/FieldTextArea.stories.mjs +1 -3
- package/dist/esm/forms/TextArea/FieldTextArea.stories.native.js +2 -4
- package/dist/esm/forms/TextArea/FieldTextArea.stories.native.js.map +2 -2
- package/dist/esm/organize/SimpleInput/index.js.map +1 -1
- package/dist/esm/organize/SimpleInput/index.native.js.map +1 -1
- package/dist/esm/organize/SimpleParagraph/SimpleParagraph.stories.js +18 -0
- package/dist/esm/organize/SimpleParagraph/SimpleParagraph.stories.js.map +6 -0
- package/dist/esm/organize/SimpleParagraph/SimpleParagraph.stories.mjs +20 -0
- package/dist/esm/organize/SimpleParagraph/SimpleParagraph.stories.native.js +26 -0
- package/dist/esm/organize/SimpleParagraph/SimpleParagraph.stories.native.js.map +6 -0
- package/dist/esm/organize/SimpleParagraph/index.js +31 -0
- package/dist/esm/organize/SimpleParagraph/index.js.map +6 -0
- package/dist/esm/organize/SimpleParagraph/index.mjs +54 -0
- package/dist/esm/organize/SimpleParagraph/index.native.js +107 -0
- package/dist/esm/organize/SimpleParagraph/index.native.js.map +6 -0
- package/dist/esm/organize/index.js +1 -0
- package/dist/esm/organize/index.js.map +1 -1
- package/dist/esm/organize/index.mjs +2 -1
- package/dist/esm/organize/index.native.js +1 -0
- package/dist/esm/organize/index.native.js.map +1 -1
- package/dist/jsx/forms/Input/FieldInput.stories.js +4 -4
- package/dist/jsx/forms/Input/FieldInput.stories.js.map +1 -1
- package/dist/jsx/forms/Input/FieldInput.stories.mjs +6 -6
- package/dist/jsx/forms/Input/FieldInput.stories.native.js +6 -6
- package/dist/jsx/forms/Input/FieldInput.stories.native.js.map +2 -2
- package/dist/jsx/forms/Slider/FieldSlider.stories.js +7 -8
- package/dist/jsx/forms/Slider/FieldSlider.stories.js.map +1 -1
- package/dist/jsx/forms/Slider/FieldSlider.stories.mjs +21 -20
- package/dist/jsx/forms/Slider/FieldSlider.stories.native.js +61 -13
- package/dist/jsx/forms/Slider/FieldSlider.stories.native.js.map +2 -2
- package/dist/jsx/forms/Switch/FieldSwitch.stories.js +1 -3
- package/dist/jsx/forms/Switch/FieldSwitch.stories.js.map +1 -1
- package/dist/jsx/forms/Switch/FieldSwitch.stories.mjs +1 -3
- package/dist/jsx/forms/Switch/FieldSwitch.stories.native.js +1 -3
- package/dist/jsx/forms/Switch/FieldSwitch.stories.native.js.map +2 -2
- package/dist/jsx/forms/TextArea/FieldTextArea.stories.js +1 -4
- package/dist/jsx/forms/TextArea/FieldTextArea.stories.js.map +1 -1
- package/dist/jsx/forms/TextArea/FieldTextArea.stories.mjs +1 -3
- package/dist/jsx/forms/TextArea/FieldTextArea.stories.native.js +2 -4
- package/dist/jsx/forms/TextArea/FieldTextArea.stories.native.js.map +2 -2
- package/dist/jsx/organize/SimpleInput/index.js.map +1 -1
- package/dist/jsx/organize/SimpleInput/index.native.js.map +1 -1
- package/dist/jsx/organize/SimpleParagraph/SimpleParagraph.stories.js +18 -0
- package/dist/jsx/organize/SimpleParagraph/SimpleParagraph.stories.js.map +6 -0
- package/dist/jsx/organize/SimpleParagraph/SimpleParagraph.stories.mjs +20 -0
- package/dist/jsx/organize/SimpleParagraph/SimpleParagraph.stories.native.js +26 -0
- package/dist/jsx/organize/SimpleParagraph/SimpleParagraph.stories.native.js.map +6 -0
- package/dist/jsx/organize/SimpleParagraph/index.js +31 -0
- package/dist/jsx/organize/SimpleParagraph/index.js.map +6 -0
- package/dist/jsx/organize/SimpleParagraph/index.mjs +54 -0
- package/dist/jsx/organize/SimpleParagraph/index.native.js +107 -0
- package/dist/jsx/organize/SimpleParagraph/index.native.js.map +6 -0
- package/dist/jsx/organize/index.js +1 -0
- package/dist/jsx/organize/index.js.map +1 -1
- package/dist/jsx/organize/index.mjs +2 -1
- package/dist/jsx/organize/index.native.js +1 -0
- package/dist/jsx/organize/index.native.js.map +1 -1
- package/package.json +3 -3
- package/src/forms/Input/FieldInput.stories.tsx +4 -4
- package/src/forms/Slider/FieldSlider.stories.tsx +7 -7
- package/src/forms/Switch/FieldSwitch.stories.tsx +1 -3
- package/src/forms/TextArea/FieldTextArea.stories.tsx +1 -4
- package/src/organize/SimpleInput/index.tsx +1 -0
- package/src/organize/SimpleParagraph/SimpleParagraph.stories.tsx +17 -0
- package/src/organize/SimpleParagraph/index.tsx +84 -0
- package/src/organize/index.ts +1 -0
- package/types/forms/Switch/FieldSwitch.stories.d.ts.map +1 -1
- package/types/forms/TextArea/FieldTextArea.stories.d.ts +0 -1
- package/types/forms/TextArea/FieldTextArea.stories.d.ts.map +1 -1
- package/types/organize/SimpleInput/index.d.ts.map +1 -1
- package/types/organize/SimpleParagraph/SimpleParagraph.stories.d.ts +13 -0
- package/types/organize/SimpleParagraph/SimpleParagraph.stories.d.ts.map +1 -0
- package/types/organize/SimpleParagraph/index.d.ts +7 -0
- package/types/organize/SimpleParagraph/index.d.ts.map +1 -0
- package/types/organize/index.d.ts +1 -0
- package/types/organize/index.d.ts.map +1 -1
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import "react";
|
|
3
|
+
import { YStack, XStack, Paragraph, Text, ScrollView } from "tamagui";
|
|
4
|
+
import { CodeBlock } from "../../code";
|
|
5
|
+
function _define_property(obj, key, value) {
|
|
6
|
+
return key in obj ? Object.defineProperty(obj, key, {
|
|
7
|
+
value,
|
|
8
|
+
enumerable: !0,
|
|
9
|
+
configurable: !0,
|
|
10
|
+
writable: !0
|
|
11
|
+
}) : obj[key] = value, obj;
|
|
12
|
+
}
|
|
13
|
+
function _object_spread(target) {
|
|
14
|
+
for (var i = 1; i < arguments.length; i++) {
|
|
15
|
+
var source = arguments[i] != null ? arguments[i] : {}, ownKeys2 = Object.keys(source);
|
|
16
|
+
typeof Object.getOwnPropertySymbols == "function" && (ownKeys2 = ownKeys2.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
17
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
18
|
+
}))), ownKeys2.forEach(function(key) {
|
|
19
|
+
_define_property(target, key, source[key]);
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
return target;
|
|
23
|
+
}
|
|
24
|
+
function ownKeys(object, enumerableOnly) {
|
|
25
|
+
var keys = Object.keys(object);
|
|
26
|
+
if (Object.getOwnPropertySymbols) {
|
|
27
|
+
var symbols = Object.getOwnPropertySymbols(object);
|
|
28
|
+
enumerableOnly && (symbols = symbols.filter(function(sym) {
|
|
29
|
+
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
|
|
30
|
+
})), keys.push.apply(keys, symbols);
|
|
31
|
+
}
|
|
32
|
+
return keys;
|
|
33
|
+
}
|
|
34
|
+
function _object_spread_props(target, source) {
|
|
35
|
+
return source = source ?? {}, Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function(key) {
|
|
36
|
+
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
|
|
37
|
+
}), target;
|
|
38
|
+
}
|
|
39
|
+
function _object_without_properties(source, excluded) {
|
|
40
|
+
if (source == null) return {};
|
|
41
|
+
var target = _object_without_properties_loose(source, excluded), key, i;
|
|
42
|
+
if (Object.getOwnPropertySymbols) {
|
|
43
|
+
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
|
|
44
|
+
for (i = 0; i < sourceSymbolKeys.length; i++)
|
|
45
|
+
key = sourceSymbolKeys[i], !(excluded.indexOf(key) >= 0) && Object.prototype.propertyIsEnumerable.call(source, key) && (target[key] = source[key]);
|
|
46
|
+
}
|
|
47
|
+
return target;
|
|
48
|
+
}
|
|
49
|
+
function _object_without_properties_loose(source, excluded) {
|
|
50
|
+
if (source == null) return {};
|
|
51
|
+
var target = {}, sourceKeys = Object.keys(source), key, i;
|
|
52
|
+
for (i = 0; i < sourceKeys.length; i++)
|
|
53
|
+
key = sourceKeys[i], !(excluded.indexOf(key) >= 0) && (target[key] = source[key]);
|
|
54
|
+
return target;
|
|
55
|
+
}
|
|
56
|
+
var SimpleParagraph = function(_param) {
|
|
57
|
+
var parseContent = function(data) {
|
|
58
|
+
var regex = /```(.*?)\n([\s\S]*?)```|[\s\S]+?(?=```|$)/g, boldTextRegex = /\*\*(.*?)\*\*/g, segments = data == null ? void 0 : data.match(regex), parsedSegments2 = [];
|
|
59
|
+
return segments == null || segments.forEach(function(segment) {
|
|
60
|
+
var codeMatch = segment.match(/```(.*?)\n([\s\S]*?)```/);
|
|
61
|
+
codeMatch ? parsedSegments2.push({
|
|
62
|
+
type: "code",
|
|
63
|
+
language: codeMatch[1],
|
|
64
|
+
code: codeMatch[2].trim()
|
|
65
|
+
}) : segment.split(`
|
|
66
|
+
`).forEach(function(line) {
|
|
67
|
+
var content = [], lastIndex = 0;
|
|
68
|
+
line.replace(boldTextRegex, function(match, p1, offset) {
|
|
69
|
+
return offset > lastIndex && content.push(line.substring(lastIndex, offset)), content.push(/* @__PURE__ */ _jsx(Text, {
|
|
70
|
+
fontWeight: "bold",
|
|
71
|
+
children: p1
|
|
72
|
+
})), lastIndex = offset + match.length, match;
|
|
73
|
+
}), lastIndex < line.length && content.push(line.substring(lastIndex)), parsedSegments2.push({
|
|
74
|
+
type: "text",
|
|
75
|
+
content: content.length === 1 ? content[0] : content,
|
|
76
|
+
isBold: !1
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
}), parsedSegments2;
|
|
80
|
+
}, children = _param.children, props = _object_without_properties(_param, [
|
|
81
|
+
"children"
|
|
82
|
+
]);
|
|
83
|
+
if (typeof children != "string") return null;
|
|
84
|
+
var parsedSegments = parseContent(children);
|
|
85
|
+
return /* @__PURE__ */ _jsx(YStack, _object_spread_props(_object_spread({}, props), {
|
|
86
|
+
children: parsedSegments.map(function(segment, index) {
|
|
87
|
+
return segment.type === "text" ? /* @__PURE__ */ _jsx(XStack, {
|
|
88
|
+
children: /* @__PURE__ */ _jsx(Paragraph, {
|
|
89
|
+
overflow: "hidden",
|
|
90
|
+
fontSize: props.fontSize,
|
|
91
|
+
color: props.color,
|
|
92
|
+
children: segment.content
|
|
93
|
+
})
|
|
94
|
+
}, index) : segment.type === "code" ? /* @__PURE__ */ _jsx(ScrollView, {
|
|
95
|
+
flexShrink: 1,
|
|
96
|
+
scrollEnabled: !0,
|
|
97
|
+
children: /* @__PURE__ */ _jsx(CodeBlock, {
|
|
98
|
+
children: segment.code
|
|
99
|
+
})
|
|
100
|
+
}, index) : null;
|
|
101
|
+
})
|
|
102
|
+
}));
|
|
103
|
+
};
|
|
104
|
+
export {
|
|
105
|
+
SimpleParagraph
|
|
106
|
+
};
|
|
107
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/organize/SimpleParagraph/home/dharmendraboddeda/Projects/bitspur/multiplatform.one/multiplatform.one/packages/components/src/organize/SimpleParagraph/index.tsx"],
|
|
4
|
+
"mappings": ";AAAA,OAAkB;AAClB,SAASA,QAAQC,QAAQC,WAAWC,MAAMC,kBAAkB;AAC5D,SAASC,iBAAiB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAOnB,IAAMC,kBAAkB,SAAA,QAAA;MAGpBC,eAAT,SAAsBC,MAAI;AACxB,QAAMC,QAAQ,8CACRC,gBAAgB,kBAChBC,WAAWH,QAAAA,OAAAA,SAAAA,KAAMI,MAAMH,KAAAA,GACvBI,kBAMA,CAAA;AAENF,uBAAAA,QAAAA,SAAUG,QAAQ,SAACC,SAAAA;AACjB,UAAMC,YAAYD,QAAQH,MAAM,yBAAA;AAChC,MAAII,YACFH,gBAAeI,KAAK;QAClBC,MAAM;QACNC,UAAUH,UAAU,CAAA;QACpBI,MAAMJ,UAAU,CAAA,EAAGK,KAAI;MACzB,CAAA,IAGAN,QAAQO,MAAM;CAAA,EAAMR,QAAQ,SAACS,MAAAA;AAC3B,YAAIC,UAA6B,CAAA,GAC7BC,YAAY;AAChBF,aAAKG,QAAQhB,eAAe,SAACE,OAAOe,IAAIC,QAAAA;AACtC,iBAAIA,SAASH,aACXD,QAAQP,KAAKM,KAAKM,UAAUJ,WAAWG,MAAAA,CAAAA,GAEzCJ,QAAQP,KAAK,qBAACd,MAAAA;YAAK2B,YAAW;sBAAQH;eACtCF,YAAYG,SAAShB,MAAMmB,QACpBnB;QACT,CAAA,GACIa,YAAYF,KAAKQ,UACnBP,QAAQP,KAAKM,KAAKM,UAAUJ,SAAAA,CAAAA,GAE9BZ,gBAAeI,KAAK;UAClBC,MAAM;UACNM,SAASA,QAAQO,WAAW,IAAIP,QAAQ,CAAA,IAAKA;UAC7CQ,QAAQ;QACV,CAAA;MACF,CAAA;IAEJ,CAAA,GACOnB;EACT,GAhDgCoB,WAAAA,OAAAA,UAAaC,QAAAA,2BAAAA,QAAAA;IAAbD;;AAChC,MAAI,OAAOA,YAAa,SAAU,QAAO;AAiDzC,MAAMpB,iBAAiBN,aAAa0B,QAAAA;AAEpC,SACE,qBAACjC,QAAAA,qBAAAA,eAAAA,CAAAA,GAAWkC,KAAAA,GAAAA;cACTrB,eAAesB,IAAI,SAACpB,SAASqB,OAAAA;AAC5B,aAAIrB,QAAQG,SAAS,SAEjB,qBAACjB,QAAAA;kBACC,qBAACC,WAAAA;UAAUmC,UAAS;UAASC,UAAUJ,MAAMI;UAAUC,OAAOL,MAAMK;oBACjExB,QAAQS;;SAFAY,KAAAA,IAMNrB,QAAQG,SAAS,SAExB,qBAACd,YAAAA;QAAuBoC,YAAY;QAAGC,eAAa;kBAClD,qBAACpC,WAAAA;oBAAWU,QAAQK;;SADLgB,KAAAA,IAKd;IACT,CAAA;;AAGN;",
|
|
5
|
+
"names": ["YStack", "XStack", "Paragraph", "Text", "ScrollView", "CodeBlock", "SimpleParagraph", "parseContent", "data", "regex", "boldTextRegex", "segments", "match", "parsedSegments", "forEach", "segment", "codeMatch", "push", "type", "language", "code", "trim", "split", "line", "content", "lastIndex", "replace", "p1", "offset", "substring", "fontWeight", "length", "isBold", "children", "props", "map", "index", "overflow", "fontSize", "color", "flexShrink", "scrollEnabled"]
|
|
6
|
+
}
|
|
@@ -2,4 +2,5 @@ export * from "./SimpleAccordion/index.mjs";
|
|
|
2
2
|
export * from "./SimpleCarousel/index.mjs";
|
|
3
3
|
export * from "./SimpleInput/index.mjs";
|
|
4
4
|
export * from "./SimpleListItem/index.mjs";
|
|
5
|
-
export * from "./SimpleTabs/index.mjs";
|
|
5
|
+
export * from "./SimpleTabs/index.mjs";
|
|
6
|
+
export * from "./SimpleParagraph/index.mjs";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../../../src/organize/home/dharmendraboddeda/Projects/bitspur/multiplatform.one/multiplatform.one/packages/components/src/organize/index.ts"],
|
|
4
|
-
"mappings": "AAqBA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
4
|
+
"mappings": "AAqBA,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;",
|
|
5
5
|
"names": []
|
|
6
6
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@multiplatform.one/components",
|
|
3
|
-
"version": "4.0.
|
|
3
|
+
"version": "4.0.3",
|
|
4
4
|
"sideEffects": [
|
|
5
5
|
"*.css"
|
|
6
6
|
],
|
|
@@ -37,7 +37,7 @@
|
|
|
37
37
|
"dependencies": {
|
|
38
38
|
"@mdx-js/mdx": "^3.0.1",
|
|
39
39
|
"@mdx-js/react": "^3.0.1",
|
|
40
|
-
"@multiplatform.one/locales": "1.0.
|
|
40
|
+
"@multiplatform.one/locales": "1.0.33",
|
|
41
41
|
"@tamagui/font-inter": "^1.100.3",
|
|
42
42
|
"@tamagui/logo": "^1.100.3",
|
|
43
43
|
"@tamagui/react-native-media-driver": "^1.100.3",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
"gray-matter": "^4.0.3",
|
|
51
51
|
"hast-util-to-html": "8.0.4",
|
|
52
52
|
"immer": "^10.1.1",
|
|
53
|
-
"multiplatform.one": "1.0.
|
|
53
|
+
"multiplatform.one": "1.0.33",
|
|
54
54
|
"parse-numeric-range": "^1.3.0",
|
|
55
55
|
"react-native-svg": "15.2.0",
|
|
56
56
|
"refractor": "^4.8.1",
|
|
@@ -48,8 +48,8 @@ main.args = mainArgs;
|
|
|
48
48
|
export const form = () => {
|
|
49
49
|
const form = useForm({
|
|
50
50
|
defaultValues: {
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
firstName: '',
|
|
52
|
+
lastName: '',
|
|
53
53
|
},
|
|
54
54
|
onSubmit: async ({ value }) => {
|
|
55
55
|
action('onSubmit')(value);
|
|
@@ -57,8 +57,8 @@ export const form = () => {
|
|
|
57
57
|
});
|
|
58
58
|
return (
|
|
59
59
|
<YStack>
|
|
60
|
-
<FieldInput label="
|
|
61
|
-
<FieldInput label="
|
|
60
|
+
<FieldInput label="FIRST NAME" name="firstName" form={form} />
|
|
61
|
+
<FieldInput label="LAST NAME" name="lastName" form={form} />
|
|
62
62
|
<Button onPress={form.handleSubmit}>Submit</Button>
|
|
63
63
|
</YStack>
|
|
64
64
|
);
|
|
@@ -41,7 +41,7 @@
|
|
|
41
41
|
*/
|
|
42
42
|
|
|
43
43
|
import React from 'react';
|
|
44
|
-
import { Button, YStack } from 'tamagui';
|
|
44
|
+
import { Button, Text, YStack } from 'tamagui';
|
|
45
45
|
import { FieldSlider } from './FieldSlider';
|
|
46
46
|
import { action } from '@storybook/addon-actions';
|
|
47
47
|
import { useForm } from '@tanstack/react-form';
|
|
@@ -65,20 +65,20 @@ const mainArgs: FieldSliderProps = {
|
|
|
65
65
|
main.args = mainArgs;
|
|
66
66
|
|
|
67
67
|
export const form = () => {
|
|
68
|
+
const [sliderValue, setSliderValue] = React.useState<number[]>([0]);
|
|
69
|
+
|
|
68
70
|
const form = useForm({
|
|
69
71
|
defaultValues: {
|
|
70
|
-
|
|
71
|
-
auto: true,
|
|
72
|
-
slider: [],
|
|
72
|
+
sliderValue: [0],
|
|
73
73
|
},
|
|
74
74
|
onSubmit: async ({ value }) => {
|
|
75
75
|
action('onSubmit')(value);
|
|
76
76
|
},
|
|
77
77
|
});
|
|
78
78
|
return (
|
|
79
|
-
<YStack
|
|
80
|
-
<
|
|
81
|
-
<FieldSlider form={form} name="
|
|
79
|
+
<YStack padding="$4" justifyContent="center" space>
|
|
80
|
+
<Text>{[sliderValue]}</Text>
|
|
81
|
+
<FieldSlider form={form} name="sliderValue" label="formSlider" onValueChange={(e) => setSliderValue(e)} />
|
|
82
82
|
<Button onPress={form.handleSubmit}>Submit</Button>
|
|
83
83
|
</YStack>
|
|
84
84
|
);
|
|
@@ -46,8 +46,6 @@ main.args = mainArgs;
|
|
|
46
46
|
export const form = () => {
|
|
47
47
|
const form = useForm({
|
|
48
48
|
defaultValues: {
|
|
49
|
-
firstName: '',
|
|
50
|
-
isChecked: false,
|
|
51
49
|
switch: false,
|
|
52
50
|
},
|
|
53
51
|
onSubmit: async ({ value }) => {
|
|
@@ -56,7 +54,7 @@ export const form = () => {
|
|
|
56
54
|
});
|
|
57
55
|
return (
|
|
58
56
|
<YStack>
|
|
59
|
-
<FieldSwitch form={form} name="switch" label="
|
|
57
|
+
<FieldSwitch form={form} name="switch" label="Switch" />
|
|
60
58
|
<Button onPress={form.handleSubmit}>Submit</Button>
|
|
61
59
|
</YStack>
|
|
62
60
|
);
|
|
@@ -39,8 +39,6 @@ export const main = () => (
|
|
|
39
39
|
export const form = (args: FieldTextAreaProps) => {
|
|
40
40
|
const form = useForm({
|
|
41
41
|
defaultValues: {
|
|
42
|
-
firstName: '',
|
|
43
|
-
isChecked: false,
|
|
44
42
|
textArea: '',
|
|
45
43
|
},
|
|
46
44
|
onSubmit: async ({ value }) => {
|
|
@@ -49,7 +47,7 @@ export const form = (args: FieldTextAreaProps) => {
|
|
|
49
47
|
});
|
|
50
48
|
return (
|
|
51
49
|
<YStack>
|
|
52
|
-
<FieldTextArea form={form} {...args} />
|
|
50
|
+
<FieldTextArea form={form} name="textArea" {...args} />
|
|
53
51
|
<Button onPress={form.handleSubmit}>Submit</Button>
|
|
54
52
|
</YStack>
|
|
55
53
|
);
|
|
@@ -57,7 +55,6 @@ export const form = (args: FieldTextAreaProps) => {
|
|
|
57
55
|
|
|
58
56
|
form.args = {
|
|
59
57
|
label: 'Sample Text Area',
|
|
60
|
-
name: 'sampleTextArea',
|
|
61
58
|
defaultValue: 'This is a sample text area',
|
|
62
59
|
onChangeText: action('onChangeText'),
|
|
63
60
|
textAreaProps: {
|
|
@@ -22,6 +22,7 @@ export function SimpleInput({ inputType = 'TEXT', xStackProps, buttonProps, ...p
|
|
|
22
22
|
const handleInputChange = (text: string) => {
|
|
23
23
|
if (inputType === 'EMAIL') {
|
|
24
24
|
const emailPattern = /^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$/;
|
|
25
|
+
// const emailPattern = /^[\w+\.]+@\w+(\.\w+)+$/;
|
|
25
26
|
if (!emailPattern.test(text)) {
|
|
26
27
|
setIsValidText(false);
|
|
27
28
|
return;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SimpleParagraph } from '.';
|
|
3
|
+
|
|
4
|
+
export default {
|
|
5
|
+
title: 'Components/SimpleParagraph',
|
|
6
|
+
component: SimpleParagraph,
|
|
7
|
+
parameters: { status: { type: 'beta' } },
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export const main = () => (
|
|
11
|
+
<SimpleParagraph>{`
|
|
12
|
+
function helloWorld() {
|
|
13
|
+
console.log("Hello, World!");
|
|
14
|
+
console.log(${new Date().getTime().toString()})
|
|
15
|
+
}
|
|
16
|
+
`}</SimpleParagraph>
|
|
17
|
+
);
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { YStack, XStack, Paragraph, Text, ScrollView } from 'tamagui';
|
|
3
|
+
import { CodeBlock } from '../../code';
|
|
4
|
+
import type { YStackProps, ParagraphProps } from 'tamagui';
|
|
5
|
+
|
|
6
|
+
export interface SimpleParagraphProps extends YStackProps, Pick<ParagraphProps, 'color' | 'fontSize'> {
|
|
7
|
+
children: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export const SimpleParagraph = ({ children, ...props }: SimpleParagraphProps) => {
|
|
11
|
+
if (typeof children !== 'string') return null;
|
|
12
|
+
|
|
13
|
+
function parseContent(data) {
|
|
14
|
+
const regex = /```(.*?)\n([\s\S]*?)```|[\s\S]+?(?=```|$)/g;
|
|
15
|
+
const boldTextRegex = /\*\*(.*?)\*\*/g;
|
|
16
|
+
const segments = data?.match(regex);
|
|
17
|
+
const parsedSegments: {
|
|
18
|
+
type: string;
|
|
19
|
+
content?: React.ReactNode;
|
|
20
|
+
language?: string;
|
|
21
|
+
code?: string;
|
|
22
|
+
isBold?: boolean;
|
|
23
|
+
}[] = [];
|
|
24
|
+
|
|
25
|
+
segments?.forEach((segment) => {
|
|
26
|
+
const codeMatch = segment.match(/```(.*?)\n([\s\S]*?)```/);
|
|
27
|
+
if (codeMatch) {
|
|
28
|
+
parsedSegments.push({
|
|
29
|
+
type: 'code',
|
|
30
|
+
language: codeMatch[1],
|
|
31
|
+
code: codeMatch[2].trim(),
|
|
32
|
+
});
|
|
33
|
+
} else {
|
|
34
|
+
// Splitting the text segment by new lines and treating each new line as a separate text segment
|
|
35
|
+
segment.split('\n').forEach((line) => {
|
|
36
|
+
let content: React.ReactNode[] = [];
|
|
37
|
+
let lastIndex = 0;
|
|
38
|
+
line.replace(boldTextRegex, (match, p1, offset) => {
|
|
39
|
+
if (offset > lastIndex) {
|
|
40
|
+
content.push(line.substring(lastIndex, offset));
|
|
41
|
+
}
|
|
42
|
+
content.push(<Text fontWeight="bold">{p1}</Text>);
|
|
43
|
+
lastIndex = offset + match.length;
|
|
44
|
+
return match; // This return is not used but necessary for replace function
|
|
45
|
+
});
|
|
46
|
+
if (lastIndex < line.length) {
|
|
47
|
+
content.push(line.substring(lastIndex));
|
|
48
|
+
}
|
|
49
|
+
parsedSegments.push({
|
|
50
|
+
type: 'text',
|
|
51
|
+
content: content.length === 1 ? content[0] : content,
|
|
52
|
+
isBold: false,
|
|
53
|
+
});
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
return parsedSegments;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const parsedSegments = parseContent(children);
|
|
61
|
+
|
|
62
|
+
return (
|
|
63
|
+
<YStack {...props}>
|
|
64
|
+
{parsedSegments.map((segment, index) => {
|
|
65
|
+
if (segment.type === 'text') {
|
|
66
|
+
return (
|
|
67
|
+
<XStack key={index}>
|
|
68
|
+
<Paragraph overflow="hidden" fontSize={props.fontSize} color={props.color}>
|
|
69
|
+
{segment.content}
|
|
70
|
+
</Paragraph>
|
|
71
|
+
</XStack>
|
|
72
|
+
);
|
|
73
|
+
} else if (segment.type === 'code') {
|
|
74
|
+
return (
|
|
75
|
+
<ScrollView key={index} flexShrink={1} scrollEnabled>
|
|
76
|
+
<CodeBlock>{segment.code}</CodeBlock>
|
|
77
|
+
</ScrollView>
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
return null;
|
|
81
|
+
})}
|
|
82
|
+
</YStack>
|
|
83
|
+
);
|
|
84
|
+
};
|
package/src/organize/index.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldSwitch.stories.d.ts","sourceRoot":"","sources":["../../../src/forms/Switch/FieldSwitch.stories.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;;;;;;;;;;AAK5C,wBAME;AAEF,eAAO,MAAM,IAAI;;;CAAkF,CAAC;AASpG,eAAO,MAAM,IAAI,
|
|
1
|
+
{"version":3,"file":"FieldSwitch.stories.d.ts","sourceRoot":"","sources":["../../../src/forms/Switch/FieldSwitch.stories.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AACtD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;;;;;;;;;;AAK5C,wBAME;AAEF,eAAO,MAAM,IAAI;;;CAAkF,CAAC;AASpG,eAAO,MAAM,IAAI,yBAehB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FieldTextArea.stories.d.ts","sourceRoot":"","sources":["../../../src/forms/TextArea/FieldTextArea.stories.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;;;;;;;;;;AAIhD,wBAIE;AAEF,eAAO,MAAM,IAAI,yBAEhB,CAAC;AAEF,eAAO,MAAM,IAAI;WAAU,kBAAkB
|
|
1
|
+
{"version":3,"file":"FieldTextArea.stories.d.ts","sourceRoot":"","sources":["../../../src/forms/TextArea/FieldTextArea.stories.tsx"],"names":[],"mappings":"AAqBA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAE1D,OAAO,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;;;;;;;;;;AAIhD,wBAIE;AAEF,eAAO,MAAM,IAAI,yBAEhB,CAAC;AAEF,eAAO,MAAM,IAAI;WAAU,kBAAkB;;;;;;;;;;CAe5C,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organize/SimpleInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAIpE,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG;IAC1C,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;IAC1C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,SAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organize/SimpleInput/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAoB,MAAM,OAAO,CAAC;AACzC,OAAO,KAAK,EAAE,WAAW,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAIpE,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG;IAC1C,SAAS,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,UAAU,CAAC;IAC1C,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,WAAW,CAAC;CAC3B,CAAC;AAEF,wBAAgB,WAAW,CAAC,EAAE,SAAkB,EAAE,WAAW,EAAE,WAAW,EAAE,GAAG,KAAK,EAAE,EAAE,gBAAgB,qBAmCvG"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
declare const _default: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: ({ children, ...props }: import(".").SimpleParagraphProps) => React.JSX.Element | null;
|
|
5
|
+
parameters: {
|
|
6
|
+
status: {
|
|
7
|
+
type: string;
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
};
|
|
11
|
+
export default _default;
|
|
12
|
+
export declare const main: () => React.JSX.Element;
|
|
13
|
+
//# sourceMappingURL=SimpleParagraph.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SimpleParagraph.stories.d.ts","sourceRoot":"","sources":["../../../src/organize/SimpleParagraph/SimpleParagraph.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;;;;;;;;;;AAG1B,wBAIE;AAEF,eAAO,MAAM,IAAI,yBAOhB,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import type { YStackProps, ParagraphProps } from 'tamagui';
|
|
3
|
+
export interface SimpleParagraphProps extends YStackProps, Pick<ParagraphProps, 'color' | 'fontSize'> {
|
|
4
|
+
children: string;
|
|
5
|
+
}
|
|
6
|
+
export declare const SimpleParagraph: ({ children, ...props }: SimpleParagraphProps) => React.JSX.Element | null;
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/organize/SimpleParagraph/index.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,KAAK,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE3D,MAAM,WAAW,oBAAqB,SAAQ,WAAW,EAAE,IAAI,CAAC,cAAc,EAAE,OAAO,GAAG,UAAU,CAAC;IACnG,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,eAAO,MAAM,eAAe,2BAA4B,oBAAoB,6BA0E3E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/organize/index.ts"],"names":[],"mappings":"AAqBA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/organize/index.ts"],"names":[],"mappings":"AAqBA,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC;AACjC,cAAc,eAAe,CAAC;AAC9B,cAAc,kBAAkB,CAAC;AACjC,cAAc,cAAc,CAAC;AAC7B,cAAc,mBAAmB,CAAC"}
|