@pagopa/io-app-design-system 6.0.6 → 6.1.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/components/badge/Badge.js +2 -2
- package/lib/commonjs/components/badge/Badge.js.map +1 -1
- package/lib/commonjs/components/badge/__test__/__snapshots__/badge.test.tsx.snap +2 -2
- package/lib/commonjs/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +3 -3
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -6
- package/lib/commonjs/components/index.js +30 -19
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/markdown/CodeBlock.js +36 -0
- package/lib/commonjs/components/markdown/CodeBlock.js.map +1 -0
- package/lib/commonjs/components/markdown/IOMarkdown.js +71 -0
- package/lib/commonjs/components/markdown/IOMarkdown.js.map +1 -0
- package/lib/commonjs/components/markdown/IOMarkdownLite.js +22 -0
- package/lib/commonjs/components/markdown/IOMarkdownLite.js.map +1 -0
- package/lib/commonjs/components/markdown/ImageRenderer.js +53 -0
- package/lib/commonjs/components/markdown/ImageRenderer.js.map +1 -0
- package/lib/commonjs/components/markdown/index.js +20 -0
- package/lib/commonjs/components/markdown/index.js.map +1 -0
- package/lib/commonjs/components/markdown/parser.js +253 -0
- package/lib/commonjs/components/markdown/parser.js.map +1 -0
- package/lib/commonjs/components/markdown/rules.js +324 -0
- package/lib/commonjs/components/markdown/rules.js.map +1 -0
- package/lib/commonjs/components/markdown/types.js +6 -0
- package/lib/commonjs/components/markdown/types.js.map +1 -0
- package/lib/commonjs/components/markdown/utils.js +113 -0
- package/lib/commonjs/components/markdown/utils.js.map +1 -0
- package/lib/commonjs/components/modules/__test__/__snapshots__/ModuleNavigationAlt.test.tsx.snap +2 -2
- package/lib/commonjs/components/otpInput/OTPInput.js +41 -26
- package/lib/commonjs/components/otpInput/OTPInput.js.map +1 -1
- package/lib/commonjs/components/tag/Tag.js +2 -1
- package/lib/commonjs/components/tag/Tag.js.map +1 -1
- package/lib/commonjs/components/toast/ToastProvider.js +3 -3
- package/lib/commonjs/components/toast/ToastProvider.js.map +1 -1
- package/lib/commonjs/components/tooltip/Tooltip.js +3 -3
- package/lib/commonjs/components/tooltip/Tooltip.js.map +1 -1
- package/lib/commonjs/components/typography/BodySmall.js +6 -3
- package/lib/commonjs/components/typography/BodySmall.js.map +1 -1
- package/lib/commonjs/components/typography/IOText.js +2 -3
- package/lib/commonjs/components/typography/IOText.js.map +1 -1
- package/lib/commonjs/utils/pipe.js +29 -0
- package/lib/commonjs/utils/pipe.js.map +1 -0
- package/lib/commonjs/utils/throttle.js +19 -0
- package/lib/commonjs/utils/throttle.js.map +1 -0
- package/lib/module/components/badge/Badge.js +2 -2
- package/lib/module/components/badge/Badge.js.map +1 -1
- package/lib/module/components/badge/__test__/__snapshots__/badge.test.tsx.snap +2 -2
- package/lib/module/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +3 -3
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -6
- package/lib/module/components/index.js +3 -2
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/markdown/CodeBlock.js +31 -0
- package/lib/module/components/markdown/CodeBlock.js.map +1 -0
- package/lib/module/components/markdown/IOMarkdown.js +66 -0
- package/lib/module/components/markdown/IOMarkdown.js.map +1 -0
- package/lib/module/components/markdown/IOMarkdownLite.js +17 -0
- package/lib/module/components/markdown/IOMarkdownLite.js.map +1 -0
- package/lib/module/components/markdown/ImageRenderer.js +48 -0
- package/lib/module/components/markdown/ImageRenderer.js.map +1 -0
- package/lib/module/components/markdown/index.js +5 -0
- package/lib/module/components/markdown/index.js.map +1 -0
- package/lib/module/components/markdown/parser.js +246 -0
- package/lib/module/components/markdown/parser.js.map +1 -0
- package/lib/module/components/markdown/rules.js +319 -0
- package/lib/module/components/markdown/rules.js.map +1 -0
- package/lib/module/components/markdown/types.js +4 -0
- package/lib/module/components/markdown/types.js.map +1 -0
- package/lib/module/components/markdown/utils.js +103 -0
- package/lib/module/components/markdown/utils.js.map +1 -0
- package/lib/module/components/modules/__test__/__snapshots__/ModuleNavigationAlt.test.tsx.snap +2 -2
- package/lib/module/components/otpInput/OTPInput.js +42 -27
- package/lib/module/components/otpInput/OTPInput.js.map +1 -1
- package/lib/module/components/tag/Tag.js +2 -1
- package/lib/module/components/tag/Tag.js.map +1 -1
- package/lib/module/components/toast/ToastProvider.js +1 -1
- package/lib/module/components/toast/ToastProvider.js.map +1 -1
- package/lib/module/components/tooltip/Tooltip.js +3 -3
- package/lib/module/components/tooltip/Tooltip.js.map +1 -1
- package/lib/module/components/typography/BodySmall.js +5 -2
- package/lib/module/components/typography/BodySmall.js.map +1 -1
- package/lib/module/components/typography/IOText.js +3 -4
- package/lib/module/components/typography/IOText.js.map +1 -1
- package/lib/module/utils/pipe.js +25 -0
- package/lib/module/utils/pipe.js.map +1 -0
- package/lib/module/utils/throttle.js +14 -0
- package/lib/module/utils/throttle.js.map +1 -0
- package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +3 -2
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/components/markdown/CodeBlock.d.ts +10 -0
- package/lib/typescript/components/markdown/CodeBlock.d.ts.map +1 -0
- package/lib/typescript/components/markdown/IOMarkdown.d.ts +34 -0
- package/lib/typescript/components/markdown/IOMarkdown.d.ts.map +1 -0
- package/lib/typescript/components/markdown/IOMarkdownLite.d.ts +22 -0
- package/lib/typescript/components/markdown/IOMarkdownLite.d.ts.map +1 -0
- package/lib/typescript/components/markdown/ImageRenderer.d.ts +12 -0
- package/lib/typescript/components/markdown/ImageRenderer.d.ts.map +1 -0
- package/lib/typescript/components/markdown/index.d.ts +6 -0
- package/lib/typescript/components/markdown/index.d.ts.map +1 -0
- package/lib/typescript/components/markdown/parser.d.ts +17 -0
- package/lib/typescript/components/markdown/parser.d.ts.map +1 -0
- package/lib/typescript/components/markdown/rules.d.ts +6 -0
- package/lib/typescript/components/markdown/rules.d.ts.map +1 -0
- package/lib/typescript/components/markdown/types.d.ts +41 -0
- package/lib/typescript/components/markdown/types.d.ts.map +1 -0
- package/lib/typescript/components/markdown/utils.d.ts +27 -0
- package/lib/typescript/components/markdown/utils.d.ts.map +1 -0
- package/lib/typescript/components/otpInput/OTPInput.d.ts +4 -0
- package/lib/typescript/components/otpInput/OTPInput.d.ts.map +1 -1
- package/lib/typescript/components/tag/Tag.d.ts.map +1 -1
- package/lib/typescript/components/toast/ToastProvider.d.ts.map +1 -1
- package/lib/typescript/components/tooltip/Tooltip.d.ts.map +1 -1
- package/lib/typescript/components/typography/BodySmall.d.ts +2 -0
- package/lib/typescript/components/typography/BodySmall.d.ts.map +1 -1
- package/lib/typescript/components/typography/IOText.d.ts.map +1 -1
- package/lib/typescript/utils/pipe.d.ts +25 -0
- package/lib/typescript/utils/pipe.d.ts.map +1 -0
- package/lib/typescript/utils/throttle.d.ts +2 -0
- package/lib/typescript/utils/throttle.d.ts.map +1 -0
- package/package.json +3 -3
- package/src/components/badge/Badge.tsx +2 -2
- package/src/components/badge/__test__/__snapshots__/badge.test.tsx.snap +2 -2
- package/src/components/buttons/IOButton/__test__/__snapshots__/IOButton.test.tsx.snap +3 -3
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +6 -6
- package/src/components/index.tsx +3 -2
- package/src/components/markdown/CodeBlock.tsx +32 -0
- package/src/components/markdown/IOMarkdown.tsx +110 -0
- package/src/components/markdown/IOMarkdownLite.tsx +27 -0
- package/src/components/markdown/ImageRenderer.tsx +52 -0
- package/src/components/markdown/index.ts +7 -0
- package/src/components/markdown/parser.ts +334 -0
- package/src/components/markdown/rules.tsx +366 -0
- package/src/components/markdown/types.ts +81 -0
- package/src/components/markdown/utils.ts +127 -0
- package/src/components/modules/__test__/__snapshots__/ModuleNavigationAlt.test.tsx.snap +2 -2
- package/src/components/otpInput/OTPInput.tsx +57 -32
- package/src/components/tag/Tag.tsx +2 -1
- package/src/components/toast/ToastProvider.tsx +1 -1
- package/src/components/tooltip/Tooltip.tsx +4 -3
- package/src/components/typography/BodySmall.tsx +5 -2
- package/src/components/typography/IOText.tsx +5 -15
- package/src/utils/pipe.ts +55 -0
- package/src/utils/throttle.ts +15 -0
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { IOPictogramsBleed } from "../pictograms";
|
|
2
|
+
import type { MarkdownNode } from "./types";
|
|
3
|
+
/**
|
|
4
|
+
* Returns the bullet glyph used for unordered lists at a given nesting depth.
|
|
5
|
+
*/
|
|
6
|
+
export declare const getUnorderedListBullet: (listDepth: number) => string;
|
|
7
|
+
/**
|
|
8
|
+
* Returns the ordered-list marker for a given item index and nesting depth.
|
|
9
|
+
*/
|
|
10
|
+
export declare const getOrderedListMarker: (value: number, listDepth: number) => string;
|
|
11
|
+
/**
|
|
12
|
+
* Extracts a banner pictogram name from a `[!pictogramName]` prefix.
|
|
13
|
+
*/
|
|
14
|
+
export declare const extractPictogramName: (text: string) => IOPictogramsBleed;
|
|
15
|
+
/**
|
|
16
|
+
* Removes the leading pictogram directive from blockquote content.
|
|
17
|
+
*/
|
|
18
|
+
export declare const stripPictogramPrefix: (text: string) => string;
|
|
19
|
+
/**
|
|
20
|
+
* Recursively collects plain text content from a Markdown AST node.
|
|
21
|
+
*/
|
|
22
|
+
export declare const collectRawText: (node: MarkdownNode) => string;
|
|
23
|
+
/**
|
|
24
|
+
* Returns true when a raw HTML fragment is a `<br>` tag.
|
|
25
|
+
*/
|
|
26
|
+
export declare const isBrTag: (content: string) => boolean;
|
|
27
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../src/components/markdown/utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAClD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAwB5C;;GAEG;AACH,eAAO,MAAM,sBAAsB,GAAI,WAAW,MAAM,KAAG,MAS1D,CAAC;AAuCF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAC/B,OAAO,MAAM,EACb,WAAW,MAAM,KAChB,MASF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,iBAKnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,MAAM,MAAM,KAAG,MAChB,CAAC;AAErC;;GAEG;AACH,eAAO,MAAM,cAAc,GAAI,MAAM,YAAY,KAAG,MAMnD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,OAAO,GAAI,SAAS,MAAM,KAAG,OAGzC,CAAC"}
|
|
@@ -10,6 +10,10 @@ type Props = {
|
|
|
10
10
|
accessibilityLabel?: string;
|
|
11
11
|
deleteButtonAccessibilityLabel?: string;
|
|
12
12
|
accessibilityHint?: string;
|
|
13
|
+
accessibilityValueText?: (params: {
|
|
14
|
+
valueLength: number;
|
|
15
|
+
length: number;
|
|
16
|
+
}) => string;
|
|
13
17
|
inputAccessoryViewID?: string;
|
|
14
18
|
autoFocus?: boolean;
|
|
15
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OTPInput.d.ts","sourceRoot":"","sources":["../../../../src/components/otpInput/OTPInput.tsx"],"names":[],"mappings":"AAQA,OAAO,
|
|
1
|
+
{"version":3,"file":"OTPInput.d.ts","sourceRoot":"","sources":["../../../../src/components/otpInput/OTPInput.tsx"],"names":[],"mappings":"AAQA,OAAO,EAOL,IAAI,EACL,MAAM,cAAc,CAAC;AAWtB,KAAK,KAAK,GAAG;IACX,KAAK,EAAE,MAAM,CAAC;IACd,aAAa,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACvC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,OAA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,CAAC,EAAE,KAAK,CAAC;IACjB,IAAI,CAAC,EAAE,KAAK,CAAC;CACd,GACD;IACE,OAAO,EAAE,QAAQ,CAAC;IAClB,IAAI,EAAE,YAAY,CAAC;CACpB,CACJ,GAAG;IACF,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC;AAkFJ;;GAEG;AACH,eAAO,MAAM,GAAG,GAAI,2FAQjB,GAAG,4CAuEL,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/toast/ToastProvider.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../../src/components/toast/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAA0C,MAAM,OAAO,CAAC;AAkB1E;;;GAGG;AACH,eAAO,MAAM,oBAAoB,IAAI,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,mBAAmB,OAAO,CAAC;AAExC;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,MAAM,CAAC;AAyBvC,KAAK,kBAAkB,GAAG;IACxB,QAAQ,EAAE,SAAS,CAAC;CACrB,CAAC;AAEF,eAAO,MAAM,aAAa,GAAI,cAAc,kBAAkB,4CAuE7D,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/tooltip/Tooltip.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EACjB,YAAY,EAMb,MAAM,OAAO,CAAC;AA4Bf,OAAO,EAEL,aAAa,EACb,SAAS,EAEV,MAAM,eAAe,CAAC;AAmBvB,KAAK,WAAW,GAAG;IACjB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,SAAS,EAAE,OAAO,CAAC;IACnB;;;OAGG;IACH,SAAS,CAAC,EAAE,SAAS,CAAC;IACtB;;;OAGG;IACH,aAAa,CAAC,EAAE,OAAO,CAAC,aAAa,CAAC,CAAC;IACvC;;OAEG;IACH,2BAA2B,EAAE,MAAM,CAAC;IACpC;;;OAGG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IACtC;;OAEG;IACH,OAAO,EAAE,MAAM,IAAI,CAAC;CACrB,CAAC;AACF,KAAK,wBAAwB,GAAG;IAC9B;;OAEG;IACH,yBAAyB,EAAE,IAAI,CAAC;IAChC;;OAEG;IACH,4BAA4B,EAAE,MAAM,CAAC;CACtC,CAAC;AACF,KAAK,8BAA8B,GAAG;IACpC,yBAAyB,CAAC,EAAE,KAAK,CAAC;CACnC,CAAC;AACF,KAAK,KAAK,GAAG,WAAW,GACtB,CAAC,wBAAwB,GAAG,8BAA8B,CAAC,CAAC;AAyC9D;;;;;;;GAOG;AACH,eAAO,MAAM,OAAO,GAAI,mLAWrB,iBAAiB,CAAC,KAAK,CAAC,KAAG,YAqM7B,CAAC"}
|
|
@@ -4,6 +4,8 @@ import { TypographicStyleAsLinkProps, TypographicStyleProps } from "./IOText";
|
|
|
4
4
|
type BodySmallProps = TypographicStyleProps & {
|
|
5
5
|
weight?: Extract<IOFontWeight, "Regular" | "Semibold">;
|
|
6
6
|
} & TypographicStyleAsLinkProps;
|
|
7
|
+
export declare const bodySmallFontSize = 14;
|
|
8
|
+
export declare const bodySmallLineHeight = 21;
|
|
7
9
|
/**
|
|
8
10
|
* `BodySmall` typographic style
|
|
9
11
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BodySmall.d.ts","sourceRoot":"","sources":["../../../../src/components/typography/BodySmall.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,IAAI,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAGL,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAElB,KAAK,cAAc,GAAG,qBAAqB,GAAG;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,SAAS,GAAG,UAAU,CAAC,CAAC;CACxD,GAAG,2BAA2B,CAAC;AAEhC;;GAEG;AACH,eAAO,MAAM,SAAS,iGAyDrB,CAAC"}
|
|
1
|
+
{"version":3,"file":"BodySmall.d.ts","sourceRoot":"","sources":["../../../../src/components/typography/BodySmall.tsx"],"names":[],"mappings":"AACA,OAAO,EAAa,IAAI,EAAE,MAAM,cAAc,CAAC;AAE/C,OAAO,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAGL,2BAA2B,EAC3B,qBAAqB,EACtB,MAAM,UAAU,CAAC;AAElB,KAAK,cAAc,GAAG,qBAAqB,GAAG;IAC5C,MAAM,CAAC,EAAE,OAAO,CAAC,YAAY,EAAE,SAAS,GAAG,UAAU,CAAC,CAAC;CACxD,GAAG,2BAA2B,CAAC;AAEhC,eAAO,MAAM,iBAAiB,KAAK,CAAC;AACpC,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,SAAS,iGAyDrB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IOText.d.ts","sourceRoot":"","sources":["../../../../src/components/typography/IOText.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAuB,MAAM,OAAO,CAAC;AAC5D,OAAO,EACL,iBAAiB,EAEjB,qBAAqB,EACrB,IAAI,EACJ,SAAS,EACT,IAAI,EACL,MAAM,cAAc,CAAC;AAGtB,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EACL,YAAY,EACZ,YAAY,EAGb,MAAM,mBAAmB,CAAC;AAE3B;;;;GAI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CAAC,WAAW,CAAC,CAAC;IACnC,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB,KAAK,CAAC,EAAE,WAAW,CAAC;CACrB,CAAC;AAEF,KAAK,mBAAmB,GAAG,IAAI,CAAC,cAAc,CAAC,OAAO,IAAI,CAAC,EAAE,OAAO,CAAC,CAAC;AAEtE,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,mBAAmB,CAAC;AAEhE;;;GAGG;AACH,MAAM,MAAM,2BAA2B,GACnC;IACE,KAAK,CAAC,EAAE,QAAQ,CAAC;IACjB,MAAM,EAAE,IAAI,CAAC;IACb,cAAc,CAAC,EAAE,IAAI,CAAC;IACtB,OAAO,EAAE,CAAC,KAAK,EAAE,qBAAqB,KAAK,IAAI,CAAC;IAChD,iBAAiB,CAAC,EAAE,OAAO,CAAC,iBAAiB,EAAE,QAAQ,GAAG,MAAM,CAAC,CAAC;CACnE,GACD;IAAE,KAAK,CAAC,EAAE,QAAQ,CAAC;IAAC,MAAM,CAAC,EAAE,KAAK,CAAC;IAAC,cAAc,CAAC,EAAE,KAAK,CAAA;CAAE,CAAC;AAejE;;;;;;GAMG;AACH,eAAO,MAAM,MAAM,wHAuElB,CAAC;AAEF,eAAO,MAAM,cAAc,+SAA2C,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chains functions together, passing the result of each function as input to the next.
|
|
3
|
+
* The first argument is the initial value, followed by any number of transformation functions.
|
|
4
|
+
*
|
|
5
|
+
* @example
|
|
6
|
+
* ```typescript
|
|
7
|
+
* const addOne = (x: number) => x + 1;
|
|
8
|
+
* const double = (x: number) => x * 2;
|
|
9
|
+
* const stringify = (x: number) => `Result: ${x}`;
|
|
10
|
+
*
|
|
11
|
+
* const result = pipe(
|
|
12
|
+
* 10,
|
|
13
|
+
* addOne, // 11
|
|
14
|
+
* double, // 22
|
|
15
|
+
* stringify // "Result: 22"
|
|
16
|
+
* );
|
|
17
|
+
* ```
|
|
18
|
+
*/
|
|
19
|
+
export declare function pipe<T>(value: T): T;
|
|
20
|
+
export declare function pipe<T, R1>(value: T, fn1: (arg: T) => R1): R1;
|
|
21
|
+
export declare function pipe<T, R1, R2>(value: T, fn1: (arg: T) => R1, fn2: (arg: R1) => R2): R2;
|
|
22
|
+
export declare function pipe<T, R1, R2, R3>(value: T, fn1: (arg: T) => R1, fn2: (arg: R1) => R2, fn3: (arg: R2) => R3): R3;
|
|
23
|
+
export declare function pipe<T, R1, R2, R3, R4>(value: T, fn1: (arg: T) => R1, fn2: (arg: R1) => R2, fn3: (arg: R2) => R3, fn4: (arg: R3) => R4): R4;
|
|
24
|
+
export declare function pipe<T, R1, R2, R3, R4, R5>(value: T, fn1: (arg: T) => R1, fn2: (arg: R1) => R2, fn3: (arg: R2) => R3, fn4: (arg: R3) => R4, fn5: (arg: R4) => R5): R5;
|
|
25
|
+
//# sourceMappingURL=pipe.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pipe.d.ts","sourceRoot":"","sources":["../../../src/utils/pipe.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,IAAI,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,GAAG,CAAC,CAAC;AACrC,wBAAgB,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,KAAK,EAAE,CAAC,EAAE,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,CAAC;AAC/D,wBAAgB,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAC5B,KAAK,EAAE,CAAC,EACR,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,EAAE,EACnB,GAAG,EAAE,CAAC,GAAG,EAAE,EAAE,KAAK,EAAE,GACnB,EAAE,CAAC;AACN,wBAAgB,IAAI,CAAC,CAAC,EAAE,EAAE,EAAE,EAAE,EAAE,EAAE,EAChC,KAAK,EAAE,CAAC,EACR,GAAG,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 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pagopa/io-app-design-system",
|
|
3
|
-
"version": "6.0
|
|
3
|
+
"version": "6.1.0",
|
|
4
4
|
"description": "The library defining the core components of the design system of @pagopa/io-app",
|
|
5
5
|
"main": "lib/commonjs/index",
|
|
6
6
|
"module": "lib/module/index",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
"@svgr/plugin-svgo": "^8.1.0",
|
|
69
69
|
"@testing-library/react-native": "^13.2.0",
|
|
70
70
|
"@types/jest": "^29.5.14",
|
|
71
|
-
"@types/
|
|
71
|
+
"@types/markdown-it": "^14.1.2",
|
|
72
72
|
"@types/react": "^19.1.0",
|
|
73
73
|
"@types/react-test-renderer": "19.1.0",
|
|
74
74
|
"babel-jest": "^29.7.0",
|
|
@@ -165,7 +165,7 @@
|
|
|
165
165
|
},
|
|
166
166
|
"dependencies": {
|
|
167
167
|
"auto-changelog": "^2.4.0",
|
|
168
|
-
"
|
|
168
|
+
"markdown-it": "^14.1.0",
|
|
169
169
|
"react-native-easing-gradient": "^1.1.1",
|
|
170
170
|
"react-native-gesture-handler": "^2.25.0",
|
|
171
171
|
"react-native-haptic-feedback": "^2.3.3",
|
|
@@ -40,6 +40,7 @@ const styles = StyleSheet.create({
|
|
|
40
40
|
flexDirection: "row",
|
|
41
41
|
alignItems: "center",
|
|
42
42
|
justifyContent: "center",
|
|
43
|
+
overflow: "hidden",
|
|
43
44
|
borderCurve: "continuous",
|
|
44
45
|
...Platform.select({
|
|
45
46
|
android: {
|
|
@@ -219,8 +220,7 @@ export const Badge = ({
|
|
|
219
220
|
style={{
|
|
220
221
|
alignSelf: "center",
|
|
221
222
|
textTransform: "uppercase",
|
|
222
|
-
letterSpacing: 0.5
|
|
223
|
-
flexShrink: 1
|
|
223
|
+
letterSpacing: 0.5
|
|
224
224
|
}}
|
|
225
225
|
>
|
|
226
226
|
{text}
|
|
@@ -10,6 +10,7 @@ exports[`Test Badge Components - Experimental Enabled Badge Snapshot 1`] = `
|
|
|
10
10
|
"borderCurve": "continuous",
|
|
11
11
|
"flexDirection": "row",
|
|
12
12
|
"justifyContent": "center",
|
|
13
|
+
"overflow": "hidden",
|
|
13
14
|
},
|
|
14
15
|
{
|
|
15
16
|
"borderRadius": 24,
|
|
@@ -40,7 +41,6 @@ exports[`Test Badge Components - Experimental Enabled Badge Snapshot 1`] = `
|
|
|
40
41
|
},
|
|
41
42
|
{
|
|
42
43
|
"alignSelf": "center",
|
|
43
|
-
"flexShrink": 1,
|
|
44
44
|
"letterSpacing": 0.5,
|
|
45
45
|
"textTransform": "uppercase",
|
|
46
46
|
},
|
|
@@ -62,6 +62,7 @@ exports[`Test Badge Components Badge Snapshot 1`] = `
|
|
|
62
62
|
"borderCurve": "continuous",
|
|
63
63
|
"flexDirection": "row",
|
|
64
64
|
"justifyContent": "center",
|
|
65
|
+
"overflow": "hidden",
|
|
65
66
|
},
|
|
66
67
|
{
|
|
67
68
|
"borderRadius": 24,
|
|
@@ -92,7 +93,6 @@ exports[`Test Badge Components Badge Snapshot 1`] = `
|
|
|
92
93
|
},
|
|
93
94
|
{
|
|
94
95
|
"alignSelf": "center",
|
|
95
|
-
"flexShrink": 1,
|
|
96
96
|
"letterSpacing": 0.5,
|
|
97
97
|
"textTransform": "uppercase",
|
|
98
98
|
},
|
|
@@ -196,7 +196,7 @@ exports[`Test Buttons Components IOButton Snapshot · Link variant 1`] = `
|
|
|
196
196
|
[
|
|
197
197
|
{},
|
|
198
198
|
{
|
|
199
|
-
"color":
|
|
199
|
+
"color": undefined,
|
|
200
200
|
"fontFamily": "Titillio",
|
|
201
201
|
"fontSize": 16,
|
|
202
202
|
"fontStyle": "normal",
|
|
@@ -418,7 +418,7 @@ exports[`Test Buttons Components IOButton Snapshot · Outline variant 1`] = `
|
|
|
418
418
|
[
|
|
419
419
|
{},
|
|
420
420
|
{
|
|
421
|
-
"color":
|
|
421
|
+
"color": undefined,
|
|
422
422
|
"fontFamily": "Titillio",
|
|
423
423
|
"fontSize": 16,
|
|
424
424
|
"fontStyle": "normal",
|
|
@@ -638,7 +638,7 @@ exports[`Test Buttons Components IOButton Snapshot · Solid variant 1`] = `
|
|
|
638
638
|
[
|
|
639
639
|
{},
|
|
640
640
|
{
|
|
641
|
-
"color":
|
|
641
|
+
"color": undefined,
|
|
642
642
|
"fontFamily": "Titillio",
|
|
643
643
|
"fontSize": 16,
|
|
644
644
|
"fontStyle": "normal",
|
|
@@ -196,7 +196,7 @@ exports[`Test Buttons Components - Experimental Enabled ButtonLink Snapshot 1`]
|
|
|
196
196
|
[
|
|
197
197
|
{},
|
|
198
198
|
{
|
|
199
|
-
"color":
|
|
199
|
+
"color": undefined,
|
|
200
200
|
"fontFamily": "Titillio",
|
|
201
201
|
"fontSize": 16,
|
|
202
202
|
"fontStyle": "normal",
|
|
@@ -418,7 +418,7 @@ exports[`Test Buttons Components - Experimental Enabled ButtonOutline Snapshot 1
|
|
|
418
418
|
[
|
|
419
419
|
{},
|
|
420
420
|
{
|
|
421
|
-
"color":
|
|
421
|
+
"color": undefined,
|
|
422
422
|
"fontFamily": "Titillio",
|
|
423
423
|
"fontSize": 16,
|
|
424
424
|
"fontStyle": "normal",
|
|
@@ -638,7 +638,7 @@ exports[`Test Buttons Components - Experimental Enabled ButtonSolid Snapshot 1`]
|
|
|
638
638
|
[
|
|
639
639
|
{},
|
|
640
640
|
{
|
|
641
|
-
"color":
|
|
641
|
+
"color": undefined,
|
|
642
642
|
"fontFamily": "Titillio",
|
|
643
643
|
"fontSize": 16,
|
|
644
644
|
"fontStyle": "normal",
|
|
@@ -1352,7 +1352,7 @@ exports[`Test Buttons Components ButtonLink Snapshot 1`] = `
|
|
|
1352
1352
|
[
|
|
1353
1353
|
{},
|
|
1354
1354
|
{
|
|
1355
|
-
"color":
|
|
1355
|
+
"color": undefined,
|
|
1356
1356
|
"fontFamily": "Titillio",
|
|
1357
1357
|
"fontSize": 16,
|
|
1358
1358
|
"fontStyle": "normal",
|
|
@@ -1574,7 +1574,7 @@ exports[`Test Buttons Components ButtonOutline Snapshot 1`] = `
|
|
|
1574
1574
|
[
|
|
1575
1575
|
{},
|
|
1576
1576
|
{
|
|
1577
|
-
"color":
|
|
1577
|
+
"color": undefined,
|
|
1578
1578
|
"fontFamily": "Titillio",
|
|
1579
1579
|
"fontSize": 16,
|
|
1580
1580
|
"fontStyle": "normal",
|
|
@@ -1794,7 +1794,7 @@ exports[`Test Buttons Components ButtonSolid Snapshot 1`] = `
|
|
|
1794
1794
|
[
|
|
1795
1795
|
{},
|
|
1796
1796
|
{
|
|
1797
|
-
"color":
|
|
1797
|
+
"color": undefined,
|
|
1798
1798
|
"fontFamily": "Titillio",
|
|
1799
1799
|
"fontSize": 16,
|
|
1800
1800
|
"fontStyle": "normal",
|
package/src/components/index.tsx
CHANGED
|
@@ -8,13 +8,14 @@ export * from "./checkbox";
|
|
|
8
8
|
export * from "./claimsSelector";
|
|
9
9
|
export * from "./codeInput";
|
|
10
10
|
export * from "./featureInfo";
|
|
11
|
+
export * from "./headers";
|
|
11
12
|
export * from "./icons";
|
|
12
13
|
export * from "./image";
|
|
13
14
|
export * from "./layout";
|
|
14
|
-
export * from "./headers";
|
|
15
15
|
export * from "./listitems";
|
|
16
16
|
export * from "./loadingSpinner";
|
|
17
17
|
export * from "./logos";
|
|
18
|
+
export * from "./markdown";
|
|
18
19
|
export * from "./modules";
|
|
19
20
|
export * from "./numberpad";
|
|
20
21
|
export * from "./otpInput";
|
|
@@ -27,8 +28,8 @@ export * from "./stepper";
|
|
|
27
28
|
export * from "./switch";
|
|
28
29
|
export * from "./tabs";
|
|
29
30
|
export * from "./tag";
|
|
30
|
-
export * from "./textInput";
|
|
31
31
|
export * from "./templates";
|
|
32
|
+
export * from "./textInput";
|
|
32
33
|
export * from "./toast";
|
|
33
34
|
export * from "./tooltip";
|
|
34
35
|
export * from "./typography";
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { View } from "react-native";
|
|
2
|
+
import { useIOTheme } from "../../context";
|
|
3
|
+
import { IOColors } from "../../core";
|
|
4
|
+
import { BodyMonospace } from "../typography/BodyMonospace";
|
|
5
|
+
|
|
6
|
+
type CodeBlockProps = {
|
|
7
|
+
content: string;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Theme-aware code block with a subtle background and border,
|
|
12
|
+
* similar to GitHub's fenced code block styling.
|
|
13
|
+
*/
|
|
14
|
+
export const CodeBlock = ({ content }: CodeBlockProps) => {
|
|
15
|
+
const theme = useIOTheme();
|
|
16
|
+
|
|
17
|
+
return (
|
|
18
|
+
<View
|
|
19
|
+
style={{
|
|
20
|
+
backgroundColor: IOColors[theme["appBackground-secondary"]],
|
|
21
|
+
borderColor: IOColors[theme["cardBorder-default"]],
|
|
22
|
+
borderWidth: 1,
|
|
23
|
+
borderRadius: 4,
|
|
24
|
+
borderCurve: "continuous",
|
|
25
|
+
paddingHorizontal: 16,
|
|
26
|
+
paddingVertical: 12
|
|
27
|
+
}}
|
|
28
|
+
>
|
|
29
|
+
<BodyMonospace>{content}</BodyMonospace>
|
|
30
|
+
</View>
|
|
31
|
+
);
|
|
32
|
+
};
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import { useCallback, useMemo } from "react";
|
|
2
|
+
import { Linking, type TextStyle, View } from "react-native";
|
|
3
|
+
import { useIOTheme } from "../../context";
|
|
4
|
+
import {
|
|
5
|
+
bodyFontSize,
|
|
6
|
+
bodyLineHeight,
|
|
7
|
+
bodySmallFontSize,
|
|
8
|
+
bodySmallLineHeight
|
|
9
|
+
} from "../typography";
|
|
10
|
+
import { parse } from "./parser";
|
|
11
|
+
import { DEFAULT_RULES } from "./rules";
|
|
12
|
+
import type {
|
|
13
|
+
IOMarkdownRenderRules,
|
|
14
|
+
MarkdownNode,
|
|
15
|
+
MarkdownNodeType,
|
|
16
|
+
RenderContext,
|
|
17
|
+
RenderRule
|
|
18
|
+
} from "./types";
|
|
19
|
+
|
|
20
|
+
export type IOMarkdownProps = {
|
|
21
|
+
/** The markdown string to render */
|
|
22
|
+
content: string;
|
|
23
|
+
/** Override default link press behavior. Default: Linking.openURL(url) */
|
|
24
|
+
onLinkPress?: (url: string) => void;
|
|
25
|
+
/** Paragraph alignment. Default: "auto" */
|
|
26
|
+
textAlign?: TextStyle["textAlign"];
|
|
27
|
+
/** Override default text size */
|
|
28
|
+
small?: boolean;
|
|
29
|
+
/** Test ID for the container View */
|
|
30
|
+
testID?: string;
|
|
31
|
+
/** Node types to disable (parser will skip them entirely) */
|
|
32
|
+
disabledRules?: ReadonlyArray<MarkdownNodeType>;
|
|
33
|
+
/** Override individual render rules */
|
|
34
|
+
rules?: IOMarkdownRenderRules;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/**
|
|
38
|
+
* Full-featured markdown component that renders markdown content
|
|
39
|
+
* using design system primitives.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* This component is still experimental. Check that it is correctly
|
|
43
|
+
* formatting your text before proceeding to use it.
|
|
44
|
+
*
|
|
45
|
+
* Supports headings, paragraphs, bold, italic, links, lists,
|
|
46
|
+
* blockquotes (as Banner), images, code, horizontal rules, and HTML breaks.
|
|
47
|
+
*
|
|
48
|
+
* Individual node types can be disabled via `disabledRules`, and
|
|
49
|
+
* render rules can be overridden via the `rules` prop.
|
|
50
|
+
*/
|
|
51
|
+
export const IOMarkdown = ({
|
|
52
|
+
content,
|
|
53
|
+
onLinkPress,
|
|
54
|
+
textAlign,
|
|
55
|
+
small,
|
|
56
|
+
testID,
|
|
57
|
+
disabledRules,
|
|
58
|
+
rules = {}
|
|
59
|
+
}: IOMarkdownProps) => {
|
|
60
|
+
const theme = useIOTheme();
|
|
61
|
+
|
|
62
|
+
const ast = useMemo(
|
|
63
|
+
() => parse(content, disabledRules),
|
|
64
|
+
[content, disabledRules]
|
|
65
|
+
);
|
|
66
|
+
|
|
67
|
+
const handleLinkPress = useCallback(
|
|
68
|
+
(url: string) => {
|
|
69
|
+
if (onLinkPress) {
|
|
70
|
+
onLinkPress(url);
|
|
71
|
+
} else {
|
|
72
|
+
Linking.openURL(url).catch(() => null);
|
|
73
|
+
}
|
|
74
|
+
},
|
|
75
|
+
[onLinkPress]
|
|
76
|
+
);
|
|
77
|
+
|
|
78
|
+
const context = useMemo<RenderContext>(
|
|
79
|
+
() => ({
|
|
80
|
+
onLinkPress: handleLinkPress,
|
|
81
|
+
linkColor: theme["interactiveElem-default"],
|
|
82
|
+
textAlign: textAlign ?? "auto",
|
|
83
|
+
fontSize: small ? bodySmallFontSize : bodyFontSize,
|
|
84
|
+
lineHeight: small ? bodySmallLineHeight : bodyLineHeight
|
|
85
|
+
}),
|
|
86
|
+
[handleLinkPress, textAlign, small, theme]
|
|
87
|
+
);
|
|
88
|
+
|
|
89
|
+
const mergedRules = useMemo<Record<MarkdownNodeType, RenderRule>>(
|
|
90
|
+
() => ({ ...DEFAULT_RULES, ...rules }),
|
|
91
|
+
[rules]
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const renderChildren = useCallback(
|
|
95
|
+
(nodes: ReadonlyArray<MarkdownNode>) =>
|
|
96
|
+
nodes.map(node => {
|
|
97
|
+
const rule = mergedRules[node.type];
|
|
98
|
+
return rule ? rule(node, renderChildren, context) : null;
|
|
99
|
+
}),
|
|
100
|
+
[mergedRules, context]
|
|
101
|
+
);
|
|
102
|
+
|
|
103
|
+
const rendered = renderChildren(ast);
|
|
104
|
+
|
|
105
|
+
return (
|
|
106
|
+
<View style={{ gap: 8 }} testID={testID}>
|
|
107
|
+
{rendered}
|
|
108
|
+
</View>
|
|
109
|
+
);
|
|
110
|
+
};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { TextStyle } from "react-native";
|
|
2
|
+
import { IOMarkdown } from "./IOMarkdown";
|
|
3
|
+
import { LITE_DISABLED_TYPES } from "./parser";
|
|
4
|
+
|
|
5
|
+
export type IOMarkdownLiteProps = {
|
|
6
|
+
/** The markdown string to render */
|
|
7
|
+
content: string;
|
|
8
|
+
/** Override default link press behavior. Default: Linking.openURL(url) */
|
|
9
|
+
onLinkPress?: (url: string) => void;
|
|
10
|
+
/** Paragraph alignment. Default: "auto" */
|
|
11
|
+
textAlign?: TextStyle["textAlign"];
|
|
12
|
+
/** Override default text size */
|
|
13
|
+
small?: boolean;
|
|
14
|
+
/** Test ID for the container View */
|
|
15
|
+
testID?: string;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Lightweight markdown component supporting only paragraphs, bold, italic,
|
|
20
|
+
* links, and line breaks.
|
|
21
|
+
*
|
|
22
|
+
* This is a thin wrapper around `IOMarkdown` with extra node types (headings,
|
|
23
|
+
* lists, blockquotes, images, code, horizontal rules, and HTML) disabled.
|
|
24
|
+
*/
|
|
25
|
+
export const IOMarkdownLite = (props: IOMarkdownLiteProps) => (
|
|
26
|
+
<IOMarkdown {...props} disabledRules={LITE_DISABLED_TYPES} />
|
|
27
|
+
);
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { useLayoutEffect, useState } from "react";
|
|
2
|
+
import { Dimensions, Image } from "react-native";
|
|
3
|
+
import { IOVisualCostants } from "../../core";
|
|
4
|
+
import type { MarkdownNode } from "./types";
|
|
5
|
+
|
|
6
|
+
type ImageRendererProps = {
|
|
7
|
+
node: MarkdownNode;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Stateful component that renders a remote image with auto-sizing.
|
|
12
|
+
* Uses `Image.getSize()` to determine intrinsic dimensions, then
|
|
13
|
+
* constrains width to the available screen width.
|
|
14
|
+
*/
|
|
15
|
+
export const ImageRenderer = ({ node }: ImageRendererProps) => {
|
|
16
|
+
const src = node.attributes?.src ?? "";
|
|
17
|
+
const alt = node.attributes?.alt ?? "";
|
|
18
|
+
|
|
19
|
+
const [imageSize, setImageSize] = useState({
|
|
20
|
+
width: 0,
|
|
21
|
+
aspectRatio: 1
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const screenWidth =
|
|
25
|
+
Dimensions.get("window").width - IOVisualCostants.appMarginDefault * 2;
|
|
26
|
+
|
|
27
|
+
useLayoutEffect(() => {
|
|
28
|
+
if (!src) {
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
Image.getSize(src, (width, height) => {
|
|
32
|
+
const aspectRatio = width / height;
|
|
33
|
+
const constrainedWidth = Math.min(width, screenWidth);
|
|
34
|
+
setImageSize({ width: constrainedWidth, aspectRatio });
|
|
35
|
+
});
|
|
36
|
+
}, [screenWidth, src]);
|
|
37
|
+
|
|
38
|
+
if (!src) {
|
|
39
|
+
return null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return (
|
|
43
|
+
<Image
|
|
44
|
+
key={node.key}
|
|
45
|
+
accessibilityIgnoresInvertColors
|
|
46
|
+
style={imageSize}
|
|
47
|
+
resizeMode="contain"
|
|
48
|
+
accessibilityLabel={alt}
|
|
49
|
+
source={{ uri: src }}
|
|
50
|
+
/>
|
|
51
|
+
);
|
|
52
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type { IOMarkdownRenderRules, MarkdownNodeType } from "./types";
|
|
2
|
+
|
|
3
|
+
export { IOMarkdown } from "./IOMarkdown";
|
|
4
|
+
export type { IOMarkdownProps } from "./IOMarkdown";
|
|
5
|
+
|
|
6
|
+
export { IOMarkdownLite } from "./IOMarkdownLite";
|
|
7
|
+
export type { IOMarkdownLiteProps } from "./IOMarkdownLite";
|