@pagopa/io-app-design-system 1.42.0 → 2.0.0-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/Advice/__test__/__snapshots__/advice.test.tsx.snap +8 -32
- package/lib/commonjs/components/accordion/AccordionItem.js +1 -10
- package/lib/commonjs/components/accordion/AccordionItem.js.map +1 -1
- package/lib/commonjs/components/alert/Alert.js +3 -16
- package/lib/commonjs/components/alert/Alert.js.map +1 -1
- package/lib/commonjs/components/badge/Badge.js +13 -21
- package/lib/commonjs/components/badge/Badge.js.map +1 -1
- package/lib/commonjs/components/badge/__test__/__snapshots__/badge.test.tsx.snap +16 -16
- package/lib/commonjs/components/badge/__test__/badge.test.js.map +1 -1
- package/lib/commonjs/components/banner/__test__/__snapshots__/banner.test.tsx.snap +14 -38
- package/lib/commonjs/components/buttons/ButtonLink.js +10 -24
- package/lib/commonjs/components/buttons/ButtonLink.js.map +1 -1
- package/lib/commonjs/components/buttons/ButtonOutline.js +14 -24
- package/lib/commonjs/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/commonjs/components/buttons/__test__/__snapshots__/button.test.tsx.snap +45 -60
- package/lib/commonjs/components/featureInfo/FeatureInfo.js +6 -7
- package/lib/commonjs/components/featureInfo/FeatureInfo.js.map +1 -1
- package/lib/commonjs/components/layout/HeaderSecondLevel.js +10 -15
- package/lib/commonjs/components/layout/HeaderSecondLevel.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemAction.js +12 -50
- package/lib/commonjs/components/listitems/ListItemAction.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemAmount.js +2 -5
- package/lib/commonjs/components/listitems/ListItemAmount.js.map +1 -1
- package/lib/commonjs/components/listitems/ListItemSwitch.js +2 -2
- package/lib/commonjs/components/listitems/ListItemSwitch.js.map +1 -1
- package/lib/commonjs/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +83 -347
- package/lib/commonjs/components/modules/ModuleIDP.js +13 -20
- package/lib/commonjs/components/modules/ModuleIDP.js.map +1 -1
- package/lib/commonjs/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +30 -150
- package/lib/commonjs/components/searchInput/SearchInput.js +2 -4
- package/lib/commonjs/components/searchInput/SearchInput.js.map +1 -1
- package/lib/commonjs/components/switch/SwitchLabel.js +7 -29
- package/lib/commonjs/components/switch/SwitchLabel.js.map +1 -1
- package/lib/commonjs/components/tabs/TabItem.js +3 -2
- package/lib/commonjs/components/tabs/TabItem.js.map +1 -1
- package/lib/commonjs/components/tag/Tag.js +14 -18
- package/lib/commonjs/components/tag/Tag.js.map +1 -1
- package/lib/commonjs/components/textInput/TextInputBase.js +4 -6
- package/lib/commonjs/components/textInput/TextInputBase.js.map +1 -1
- package/lib/commonjs/components/typography/BaseTypography.js +5 -1
- package/lib/commonjs/components/typography/BaseTypography.js.map +1 -1
- package/lib/commonjs/components/typography/Body.js +34 -26
- package/lib/commonjs/components/typography/Body.js.map +1 -1
- package/lib/commonjs/components/typography/BodyMonospace.js +26 -24
- package/lib/commonjs/components/typography/BodyMonospace.js.map +1 -1
- package/lib/commonjs/components/typography/ButtonText.js +25 -19
- package/lib/commonjs/components/typography/ButtonText.js.map +1 -1
- package/lib/commonjs/components/typography/Caption.js +29 -19
- package/lib/commonjs/components/typography/Caption.js.map +1 -1
- package/lib/commonjs/components/typography/Chip.js +24 -21
- package/lib/commonjs/components/typography/Chip.js.map +1 -1
- package/lib/commonjs/components/typography/Factory.js +1 -0
- package/lib/commonjs/components/typography/Factory.js.map +1 -1
- package/lib/commonjs/components/typography/H1.js +27 -20
- package/lib/commonjs/components/typography/H1.js.map +1 -1
- package/lib/commonjs/components/typography/H2.js +27 -20
- package/lib/commonjs/components/typography/H2.js.map +1 -1
- package/lib/commonjs/components/typography/H3.js +27 -19
- package/lib/commonjs/components/typography/H3.js.map +1 -1
- package/lib/commonjs/components/typography/H4.js +27 -21
- package/lib/commonjs/components/typography/H4.js.map +1 -1
- package/lib/commonjs/components/typography/H5.js +26 -22
- package/lib/commonjs/components/typography/H5.js.map +1 -1
- package/lib/commonjs/components/typography/H6.js +25 -20
- package/lib/commonjs/components/typography/H6.js.map +1 -1
- package/lib/commonjs/components/typography/Hero.js +25 -17
- package/lib/commonjs/components/typography/Hero.js.map +1 -1
- package/lib/commonjs/components/typography/IOText.js +104 -0
- package/lib/commonjs/components/typography/IOText.js.map +1 -0
- package/lib/commonjs/components/typography/Label.js +28 -26
- package/lib/commonjs/components/typography/Label.js.map +1 -1
- package/lib/commonjs/components/typography/LabelMini.js +45 -0
- package/lib/commonjs/components/typography/LabelMini.js.map +1 -0
- package/lib/commonjs/components/typography/LabelSmall.js +30 -30
- package/lib/commonjs/components/typography/LabelSmall.js.map +1 -1
- package/lib/commonjs/components/typography/LabelSmallAlt.js +25 -20
- package/lib/commonjs/components/typography/LabelSmallAlt.js.map +1 -1
- package/lib/commonjs/components/typography/__test__/__snapshots__/typography.test.tsx.snap +86 -551
- package/lib/commonjs/components/typography/__test__/typography.test.js +6 -25
- package/lib/commonjs/components/typography/__test__/typography.test.js.map +1 -1
- package/lib/commonjs/components/typography/index.js +15 -37
- package/lib/commonjs/components/typography/index.js.map +1 -1
- package/lib/commonjs/components/typography/markdown/MdH1.js +27 -16
- package/lib/commonjs/components/typography/markdown/MdH1.js.map +1 -1
- package/lib/commonjs/components/typography/markdown/MdH2.js +28 -18
- package/lib/commonjs/components/typography/markdown/MdH2.js.map +1 -1
- package/lib/commonjs/components/typography/markdown/MdH3.js +26 -16
- package/lib/commonjs/components/typography/markdown/MdH3.js.map +1 -1
- package/lib/commonjs/core/IOColors.js +19 -2
- package/lib/commonjs/core/IOColors.js.map +1 -1
- package/lib/commonjs/core/IOStyles.js +0 -1
- package/lib/commonjs/core/IOStyles.js.map +1 -1
- package/lib/commonjs/utils/accessibility.js +24 -1
- package/lib/commonjs/utils/accessibility.js.map +1 -1
- package/lib/commonjs/utils/fonts.js +72 -40
- package/lib/commonjs/utils/fonts.js.map +1 -1
- package/lib/module/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +8 -32
- package/lib/module/components/accordion/AccordionItem.js +3 -12
- package/lib/module/components/accordion/AccordionItem.js.map +1 -1
- package/lib/module/components/alert/Alert.js +5 -18
- package/lib/module/components/alert/Alert.js.map +1 -1
- package/lib/module/components/badge/Badge.js +15 -23
- package/lib/module/components/badge/Badge.js.map +1 -1
- package/lib/module/components/badge/__test__/__snapshots__/badge.test.tsx.snap +16 -16
- package/lib/module/components/badge/__test__/badge.test.js.map +1 -1
- package/lib/module/components/banner/__test__/__snapshots__/banner.test.tsx.snap +14 -38
- package/lib/module/components/buttons/ButtonLink.js +12 -26
- package/lib/module/components/buttons/ButtonLink.js.map +1 -1
- package/lib/module/components/buttons/ButtonOutline.js +15 -25
- package/lib/module/components/buttons/ButtonOutline.js.map +1 -1
- package/lib/module/components/buttons/__test__/__snapshots__/button.test.tsx.snap +45 -60
- package/lib/module/components/featureInfo/FeatureInfo.js +7 -8
- package/lib/module/components/featureInfo/FeatureInfo.js.map +1 -1
- package/lib/module/components/layout/HeaderSecondLevel.js +10 -15
- package/lib/module/components/layout/HeaderSecondLevel.js.map +1 -1
- package/lib/module/components/listitems/ListItemAction.js +16 -54
- package/lib/module/components/listitems/ListItemAction.js.map +1 -1
- package/lib/module/components/listitems/ListItemAmount.js +2 -5
- package/lib/module/components/listitems/ListItemAmount.js.map +1 -1
- package/lib/module/components/listitems/ListItemSwitch.js +3 -3
- package/lib/module/components/listitems/ListItemSwitch.js.map +1 -1
- package/lib/module/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +83 -347
- package/lib/module/components/modules/ModuleIDP.js +15 -22
- package/lib/module/components/modules/ModuleIDP.js.map +1 -1
- package/lib/module/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +30 -150
- package/lib/module/components/searchInput/SearchInput.js +2 -4
- package/lib/module/components/searchInput/SearchInput.js.map +1 -1
- package/lib/module/components/switch/SwitchLabel.js +9 -31
- package/lib/module/components/switch/SwitchLabel.js.map +1 -1
- package/lib/module/components/tabs/TabItem.js +3 -2
- package/lib/module/components/tabs/TabItem.js.map +1 -1
- package/lib/module/components/tag/Tag.js +16 -20
- package/lib/module/components/tag/Tag.js.map +1 -1
- package/lib/module/components/textInput/TextInputBase.js +4 -6
- package/lib/module/components/textInput/TextInputBase.js.map +1 -1
- package/lib/module/components/typography/BaseTypography.js +5 -1
- package/lib/module/components/typography/BaseTypography.js.map +1 -1
- package/lib/module/components/typography/Body.js +31 -22
- package/lib/module/components/typography/Body.js.map +1 -1
- package/lib/module/components/typography/BodyMonospace.js +25 -23
- package/lib/module/components/typography/BodyMonospace.js.map +1 -1
- package/lib/module/components/typography/ButtonText.js +24 -19
- package/lib/module/components/typography/ButtonText.js.map +1 -1
- package/lib/module/components/typography/Caption.js +28 -19
- package/lib/module/components/typography/Caption.js.map +1 -1
- package/lib/module/components/typography/Chip.js +23 -21
- package/lib/module/components/typography/Chip.js.map +1 -1
- package/lib/module/components/typography/Factory.js +1 -0
- package/lib/module/components/typography/Factory.js.map +1 -1
- package/lib/module/components/typography/H1.js +26 -20
- package/lib/module/components/typography/H1.js.map +1 -1
- package/lib/module/components/typography/H2.js +26 -20
- package/lib/module/components/typography/H2.js.map +1 -1
- package/lib/module/components/typography/H3.js +26 -19
- package/lib/module/components/typography/H3.js.map +1 -1
- package/lib/module/components/typography/H4.js +26 -21
- package/lib/module/components/typography/H4.js.map +1 -1
- package/lib/module/components/typography/H5.js +24 -21
- package/lib/module/components/typography/H5.js.map +1 -1
- package/lib/module/components/typography/H6.js +24 -21
- package/lib/module/components/typography/H6.js.map +1 -1
- package/lib/module/components/typography/Hero.js +24 -17
- package/lib/module/components/typography/Hero.js.map +1 -1
- package/lib/module/components/typography/IOText.js +96 -0
- package/lib/module/components/typography/IOText.js.map +1 -0
- package/lib/module/components/typography/Label.js +27 -26
- package/lib/module/components/typography/Label.js.map +1 -1
- package/lib/module/components/typography/LabelMini.js +36 -0
- package/lib/module/components/typography/LabelMini.js.map +1 -0
- package/lib/module/components/typography/LabelSmall.js +29 -30
- package/lib/module/components/typography/LabelSmall.js.map +1 -1
- package/lib/module/components/typography/LabelSmallAlt.js +24 -20
- package/lib/module/components/typography/LabelSmallAlt.js.map +1 -1
- package/lib/module/components/typography/__test__/__snapshots__/typography.test.tsx.snap +86 -551
- package/lib/module/components/typography/__test__/typography.test.js +6 -25
- package/lib/module/components/typography/__test__/typography.test.js.map +1 -1
- package/lib/module/components/typography/index.js +2 -4
- package/lib/module/components/typography/index.js.map +1 -1
- package/lib/module/components/typography/markdown/MdH1.js +25 -15
- package/lib/module/components/typography/markdown/MdH1.js.map +1 -1
- package/lib/module/components/typography/markdown/MdH2.js +26 -17
- package/lib/module/components/typography/markdown/MdH2.js.map +1 -1
- package/lib/module/components/typography/markdown/MdH3.js +24 -15
- package/lib/module/components/typography/markdown/MdH3.js.map +1 -1
- package/lib/module/core/IOColors.js +17 -1
- package/lib/module/core/IOColors.js.map +1 -1
- package/lib/module/core/IOStyles.js +0 -1
- package/lib/module/core/IOStyles.js.map +1 -1
- package/lib/module/utils/accessibility.js +22 -0
- package/lib/module/utils/accessibility.js.map +1 -1
- package/lib/module/utils/fonts.js +70 -36
- package/lib/module/utils/fonts.js.map +1 -1
- package/lib/typescript/components/accordion/AccordionItem.d.ts.map +1 -1
- package/lib/typescript/components/alert/Alert.d.ts.map +1 -1
- package/lib/typescript/components/badge/Badge.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonLink.d.ts.map +1 -1
- package/lib/typescript/components/buttons/ButtonOutline.d.ts.map +1 -1
- package/lib/typescript/components/featureInfo/FeatureInfo.d.ts +6 -5
- package/lib/typescript/components/featureInfo/FeatureInfo.d.ts.map +1 -1
- package/lib/typescript/components/layout/HeaderSecondLevel.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemAction.d.ts.map +1 -1
- package/lib/typescript/components/listitems/ListItemAmount.d.ts.map +1 -1
- package/lib/typescript/components/modules/ModuleIDP.d.ts.map +1 -1
- package/lib/typescript/components/switch/SwitchLabel.d.ts.map +1 -1
- package/lib/typescript/components/tabs/TabItem.d.ts.map +1 -1
- package/lib/typescript/components/tag/Tag.d.ts.map +1 -1
- package/lib/typescript/components/textInput/TextInputBase.d.ts.map +1 -1
- package/lib/typescript/components/typography/BaseTypography.d.ts +3 -2
- package/lib/typescript/components/typography/BaseTypography.d.ts.map +1 -1
- package/lib/typescript/components/typography/Body.d.ts +5 -10
- package/lib/typescript/components/typography/Body.d.ts.map +1 -1
- package/lib/typescript/components/typography/BodyMonospace.d.ts +7 -7
- package/lib/typescript/components/typography/BodyMonospace.d.ts.map +1 -1
- package/lib/typescript/components/typography/ButtonText.d.ts +9 -10
- package/lib/typescript/components/typography/ButtonText.d.ts.map +1 -1
- package/lib/typescript/components/typography/Caption.d.ts +9 -5
- package/lib/typescript/components/typography/Caption.d.ts.map +1 -1
- package/lib/typescript/components/typography/Chip.d.ts +7 -7
- package/lib/typescript/components/typography/Chip.d.ts.map +1 -1
- package/lib/typescript/components/typography/Factory.d.ts +1 -0
- package/lib/typescript/components/typography/Factory.d.ts.map +1 -1
- package/lib/typescript/components/typography/H1.d.ts +9 -8
- package/lib/typescript/components/typography/H1.d.ts.map +1 -1
- package/lib/typescript/components/typography/H2.d.ts +9 -8
- package/lib/typescript/components/typography/H2.d.ts.map +1 -1
- package/lib/typescript/components/typography/H3.d.ts +9 -8
- package/lib/typescript/components/typography/H3.d.ts.map +1 -1
- package/lib/typescript/components/typography/H4.d.ts +9 -8
- package/lib/typescript/components/typography/H4.d.ts.map +1 -1
- package/lib/typescript/components/typography/H5.d.ts +9 -5
- package/lib/typescript/components/typography/H5.d.ts.map +1 -1
- package/lib/typescript/components/typography/H6.d.ts +9 -10
- package/lib/typescript/components/typography/H6.d.ts.map +1 -1
- package/lib/typescript/components/typography/Hero.d.ts +9 -8
- package/lib/typescript/components/typography/Hero.d.ts.map +1 -1
- package/lib/typescript/components/typography/IOText.d.ts +54 -0
- package/lib/typescript/components/typography/IOText.d.ts.map +1 -0
- package/lib/typescript/components/typography/Label.d.ts +6 -10
- package/lib/typescript/components/typography/Label.d.ts.map +1 -1
- package/lib/typescript/components/typography/LabelMini.d.ts +13 -0
- package/lib/typescript/components/typography/LabelMini.d.ts.map +1 -0
- package/lib/typescript/components/typography/LabelSmall.d.ts +5 -11
- package/lib/typescript/components/typography/LabelSmall.d.ts.map +1 -1
- package/lib/typescript/components/typography/LabelSmallAlt.d.ts +7 -10
- package/lib/typescript/components/typography/LabelSmallAlt.d.ts.map +1 -1
- package/lib/typescript/components/typography/index.d.ts +2 -4
- package/lib/typescript/components/typography/index.d.ts.map +1 -1
- package/lib/typescript/components/typography/markdown/MdH1.d.ts +9 -9
- package/lib/typescript/components/typography/markdown/MdH1.d.ts.map +1 -1
- package/lib/typescript/components/typography/markdown/MdH2.d.ts +9 -9
- package/lib/typescript/components/typography/markdown/MdH2.d.ts.map +1 -1
- package/lib/typescript/components/typography/markdown/MdH3.d.ts +9 -9
- package/lib/typescript/components/typography/markdown/MdH3.d.ts.map +1 -1
- package/lib/typescript/core/IOColors.d.ts +3 -20
- package/lib/typescript/core/IOColors.d.ts.map +1 -1
- package/lib/typescript/core/IOStyles.d.ts +0 -3
- package/lib/typescript/core/IOStyles.d.ts.map +1 -1
- package/lib/typescript/utils/accessibility.d.ts +5 -0
- package/lib/typescript/utils/accessibility.d.ts.map +1 -1
- package/lib/typescript/utils/fonts.d.ts +17 -25
- package/lib/typescript/utils/fonts.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/components/Advice/__test__/__snapshots__/advice.test.tsx.snap +8 -32
- package/src/components/accordion/AccordionItem.tsx +2 -14
- package/src/components/alert/Alert.tsx +5 -18
- package/src/components/badge/Badge.tsx +15 -28
- package/src/components/badge/__test__/__snapshots__/badge.test.tsx.snap +16 -16
- package/src/components/badge/__test__/badge.test.tsx +2 -2
- package/src/components/banner/__test__/__snapshots__/banner.test.tsx.snap +14 -38
- package/src/components/buttons/ButtonLink.tsx +12 -35
- package/src/components/buttons/ButtonOutline.tsx +14 -25
- package/src/components/buttons/__test__/__snapshots__/button.test.tsx.snap +45 -60
- package/src/components/featureInfo/FeatureInfo.tsx +13 -13
- package/src/components/layout/HeaderSecondLevel.tsx +9 -18
- package/src/components/listitems/ListItemAction.tsx +13 -75
- package/src/components/listitems/ListItemAmount.tsx +2 -5
- package/src/components/listitems/ListItemSwitch.tsx +3 -3
- package/src/components/listitems/__test__/__snapshots__/listitem.test.tsx.snap +83 -347
- package/src/components/modules/ModuleIDP.tsx +15 -32
- package/src/components/numberpad/__test__/__snapshots__/NumberPad.test.tsx.snap +30 -150
- package/src/components/searchInput/SearchInput.tsx +14 -6
- package/src/components/switch/SwitchLabel.tsx +6 -32
- package/src/components/tabs/TabItem.tsx +4 -2
- package/src/components/tag/Tag.tsx +22 -24
- package/src/components/textInput/TextInputBase.tsx +21 -8
- package/src/components/typography/BaseTypography.tsx +13 -4
- package/src/components/typography/Body.tsx +43 -38
- package/src/components/typography/BodyMonospace.tsx +24 -37
- package/src/components/typography/ButtonText.tsx +25 -35
- package/src/components/typography/Caption.tsx +31 -33
- package/src/components/typography/Chip.tsx +25 -37
- package/src/components/typography/Factory.tsx +1 -0
- package/src/components/typography/H1.tsx +31 -36
- package/src/components/typography/H2.tsx +31 -36
- package/src/components/typography/H3.tsx +30 -35
- package/src/components/typography/H4.tsx +31 -36
- package/src/components/typography/H5.tsx +26 -32
- package/src/components/typography/H6.tsx +30 -41
- package/src/components/typography/Hero.tsx +30 -33
- package/src/components/typography/IOText.tsx +157 -0
- package/src/components/typography/Label.tsx +41 -48
- package/src/components/typography/LabelMini.tsx +52 -0
- package/src/components/typography/LabelSmall.tsx +41 -63
- package/src/components/typography/LabelSmallAlt.tsx +28 -48
- package/src/components/typography/__test__/__snapshots__/typography.test.tsx.snap +86 -551
- package/src/components/typography/__test__/typography.test.tsx +7 -31
- package/src/components/typography/index.tsx +2 -4
- package/src/components/typography/markdown/MdH1.tsx +26 -28
- package/src/components/typography/markdown/MdH2.tsx +27 -30
- package/src/components/typography/markdown/MdH3.tsx +25 -28
- package/src/core/IOColors.ts +31 -21
- package/src/core/IOStyles.ts +1 -5
- package/src/utils/accessibility.ts +31 -0
- package/src/utils/fonts.ts +93 -51
- package/lib/commonjs/components/typography/LabelHeader.js +0 -44
- package/lib/commonjs/components/typography/LabelHeader.js.map +0 -1
- package/lib/commonjs/components/typography/LabelLink.js +0 -44
- package/lib/commonjs/components/typography/LabelLink.js.map +0 -1
- package/lib/commonjs/components/typography/markdown/MdH4.js +0 -30
- package/lib/commonjs/components/typography/markdown/MdH4.js.map +0 -1
- package/lib/commonjs/components/typography/markdown/MdH5.js +0 -28
- package/lib/commonjs/components/typography/markdown/MdH5.js.map +0 -1
- package/lib/commonjs/components/typography/markdown/MdH6.js +0 -29
- package/lib/commonjs/components/typography/markdown/MdH6.js.map +0 -1
- package/lib/module/components/typography/LabelHeader.js +0 -33
- package/lib/module/components/typography/LabelHeader.js.map +0 -1
- package/lib/module/components/typography/LabelLink.js +0 -33
- package/lib/module/components/typography/LabelLink.js.map +0 -1
- package/lib/module/components/typography/markdown/MdH4.js +0 -23
- package/lib/module/components/typography/markdown/MdH4.js.map +0 -1
- package/lib/module/components/typography/markdown/MdH5.js +0 -21
- package/lib/module/components/typography/markdown/MdH5.js.map +0 -1
- package/lib/module/components/typography/markdown/MdH6.js +0 -22
- package/lib/module/components/typography/markdown/MdH6.js.map +0 -1
- package/lib/typescript/components/typography/LabelHeader.d.ts +0 -18
- package/lib/typescript/components/typography/LabelHeader.d.ts.map +0 -1
- package/lib/typescript/components/typography/LabelLink.d.ts +0 -20
- package/lib/typescript/components/typography/LabelLink.d.ts.map +0 -1
- package/lib/typescript/components/typography/markdown/MdH4.d.ts +0 -13
- package/lib/typescript/components/typography/markdown/MdH4.d.ts.map +0 -1
- package/lib/typescript/components/typography/markdown/MdH5.d.ts +0 -13
- package/lib/typescript/components/typography/markdown/MdH5.d.ts.map +0 -1
- package/lib/typescript/components/typography/markdown/MdH6.d.ts +0 -13
- package/lib/typescript/components/typography/markdown/MdH6.d.ts.map +0 -1
- package/src/components/typography/LabelHeader.tsx +0 -56
- package/src/components/typography/LabelLink.tsx +0 -61
- package/src/components/typography/markdown/MdH4.tsx +0 -34
- package/src/components/typography/markdown/MdH5.tsx +0 -32
- package/src/components/typography/markdown/MdH6.tsx +0 -33
|
@@ -1,49 +1,44 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ForwardedRef, forwardRef } from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { IOTheme,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ExternalTypographyProps, TypographyProps } from "./common";
|
|
3
|
+
import { IOTheme, useIOExperimentalDesign, useIOTheme } from "../../core";
|
|
4
|
+
import { IOFontFamily, IOFontSize, IOFontWeight } from "../../utils/fonts";
|
|
5
|
+
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
type AllowedWeight = Extract<IOFontWeight, "Semibold" | "Regular">;
|
|
7
|
+
const defaultColor: keyof IOTheme = "textHeading-default";
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
TypographyProps<AllowedWeight, AllowedColors>
|
|
13
|
-
>;
|
|
14
|
-
|
|
15
|
-
export const h2FontSize = 26;
|
|
9
|
+
export const h2FontSize: IOFontSize = 26;
|
|
16
10
|
export const h2LineHeight = 39;
|
|
17
|
-
const fontName:
|
|
18
|
-
const
|
|
19
|
-
const defaultWeight: AllowedWeight = "Regular";
|
|
11
|
+
const fontName: IOFontFamily = "ReadexPro";
|
|
12
|
+
const fontWeight: IOFontWeight = "Regular";
|
|
20
13
|
|
|
21
14
|
// TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
|
|
22
|
-
const
|
|
23
|
-
const legacyDefaultWeight: AllowedWeight = "Semibold";
|
|
24
|
-
const legacyH2FontSize = 28;
|
|
15
|
+
const legacyH2FontSize: IOFontSize = 28;
|
|
25
16
|
const legacyH2LineHeight = 40;
|
|
17
|
+
const legacyFontName: IOFontFamily = "TitilliumSansPro";
|
|
18
|
+
const legacyFontWeight: IOFontWeight = "Semibold";
|
|
26
19
|
|
|
27
20
|
/**
|
|
28
21
|
* `H2` typographic style
|
|
29
22
|
*/
|
|
30
|
-
export const H2 =
|
|
31
|
-
|
|
23
|
+
export const H2 = forwardRef<View, TypographicStyleProps>(
|
|
24
|
+
({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
|
|
25
|
+
const theme = useIOTheme();
|
|
26
|
+
const { isExperimental } = useIOExperimentalDesign();
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
{
|
|
28
|
+
const H2Props: IOTextProps = {
|
|
35
29
|
...props,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
defaultColor,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
}
|
|
30
|
+
dynamicTypeRamp: "title1", // iOS only
|
|
31
|
+
font: isExperimental ? fontName : legacyFontName,
|
|
32
|
+
size: isExperimental ? h2FontSize : legacyH2FontSize,
|
|
33
|
+
weight: isExperimental ? fontWeight : legacyFontWeight,
|
|
34
|
+
color: customColor ?? theme[defaultColor],
|
|
35
|
+
lineHeight: isExperimental ? h2LineHeight : legacyH2LineHeight
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<IOText ref={ref} {...H2Props}>
|
|
40
|
+
{props.children}
|
|
41
|
+
</IOText>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
);
|
|
@@ -1,48 +1,43 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ForwardedRef, forwardRef } from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { IOTheme,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ExternalTypographyProps, TypographyProps } from "./common";
|
|
3
|
+
import { IOTheme, useIOExperimentalDesign, useIOTheme } from "../../core";
|
|
4
|
+
import { IOFontFamily, IOFontSize, IOFontWeight } from "../../utils/fonts";
|
|
5
|
+
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
type AllowedWeight = Extract<IOFontWeight, "Semibold" | "Regular">;
|
|
10
|
-
|
|
11
|
-
type H3Props = ExternalTypographyProps<
|
|
12
|
-
TypographyProps<AllowedWeight, AllowedColors>
|
|
13
|
-
>;
|
|
7
|
+
const defaultColor: keyof IOTheme = "textHeading-default";
|
|
14
8
|
|
|
15
9
|
/* Common typographic styles */
|
|
16
|
-
export const h3FontSize = 22;
|
|
10
|
+
export const h3FontSize: IOFontSize = 22;
|
|
17
11
|
export const h3LineHeight = 33;
|
|
18
|
-
const fontName:
|
|
19
|
-
const
|
|
20
|
-
const defaultWeight: AllowedWeight = "Regular";
|
|
12
|
+
const fontName: IOFontFamily = "ReadexPro";
|
|
13
|
+
const fontWeight: IOFontWeight = "Regular";
|
|
21
14
|
|
|
22
15
|
// TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
|
|
23
|
-
const legacyFontName:
|
|
24
|
-
const
|
|
25
|
-
|
|
16
|
+
const legacyFontName: IOFontFamily = "TitilliumSansPro";
|
|
17
|
+
const legacyFontWeight: IOFontWeight = "Semibold";
|
|
18
|
+
|
|
26
19
|
/**
|
|
27
20
|
* `H3` typographic style
|
|
28
21
|
*/
|
|
29
|
-
export const H3 =
|
|
30
|
-
|
|
22
|
+
export const H3 = forwardRef<View, TypographicStyleProps>(
|
|
23
|
+
({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
|
|
24
|
+
const theme = useIOTheme();
|
|
25
|
+
const { isExperimental } = useIOExperimentalDesign();
|
|
31
26
|
|
|
32
|
-
|
|
33
|
-
{
|
|
27
|
+
const H3Props: IOTextProps = {
|
|
34
28
|
...props,
|
|
35
|
-
|
|
36
|
-
maxFontSizeMultiplier: IOVisualCostants.maxFontSizeMultiplier,
|
|
37
|
-
dynamicTypeRamp: "title2" /* iOS only */,
|
|
38
|
-
defaultWeight: isExperimental ? defaultWeight : legacyDefaultWeight,
|
|
39
|
-
defaultColor: isExperimental ? defaultColor : legacyDefaultColor,
|
|
29
|
+
dynamicTypeRamp: "title2", // iOS only
|
|
40
30
|
font: isExperimental ? fontName : legacyFontName,
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
}
|
|
31
|
+
weight: isExperimental ? fontWeight : legacyFontWeight,
|
|
32
|
+
size: h3FontSize,
|
|
33
|
+
lineHeight: h3LineHeight,
|
|
34
|
+
color: customColor ?? theme[defaultColor]
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<IOText ref={ref} {...H3Props}>
|
|
39
|
+
{props.children}
|
|
40
|
+
</IOText>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
@@ -1,47 +1,42 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ForwardedRef, forwardRef } from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { IOTheme,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ExternalTypographyProps, TypographyProps } from "./common";
|
|
3
|
+
import { IOTheme, useIOExperimentalDesign, useIOTheme } from "../../core";
|
|
4
|
+
import { IOFontFamily, IOFontSize, IOFontWeight } from "../../utils/fonts";
|
|
5
|
+
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
type AllowedWeight = Extract<IOFontWeight, "Regular" | "Semibold">;
|
|
7
|
+
const defaultColor: keyof IOTheme = "textHeading-default";
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
TypographyProps<AllowedWeight, AllowedColors>
|
|
13
|
-
>;
|
|
14
|
-
|
|
15
|
-
export const h4FontSize = 20;
|
|
9
|
+
export const h4FontSize: IOFontSize = 20;
|
|
16
10
|
export const h4LineHeight = 24;
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
const defaultWeight: AllowedWeight = "Regular";
|
|
11
|
+
const fontName: IOFontFamily = "ReadexPro";
|
|
12
|
+
const fontWeight: IOFontWeight = "Regular";
|
|
20
13
|
|
|
21
14
|
// TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
|
|
22
|
-
const legacyFontName:
|
|
23
|
-
const
|
|
24
|
-
const legacyDefaultWeight: AllowedWeight = "Semibold";
|
|
15
|
+
const legacyFontName: IOFontFamily = "TitilliumSansPro";
|
|
16
|
+
const legacyFontWeight: IOFontWeight = "Semibold";
|
|
25
17
|
|
|
26
18
|
/**
|
|
27
19
|
* `H4` typographic style
|
|
28
20
|
*/
|
|
29
|
-
export const H4 =
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
{
|
|
21
|
+
export const H4 = forwardRef<View, TypographicStyleProps>(
|
|
22
|
+
({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
|
|
23
|
+
const theme = useIOTheme();
|
|
24
|
+
const { isExperimental } = useIOExperimentalDesign();
|
|
25
|
+
|
|
26
|
+
const H4Props: IOTextProps = {
|
|
33
27
|
...props,
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
}
|
|
28
|
+
dynamicTypeRamp: "title3", // iOS only
|
|
29
|
+
font: isExperimental ? fontName : legacyFontName,
|
|
30
|
+
size: h4FontSize,
|
|
31
|
+
weight: isExperimental ? fontWeight : legacyFontWeight,
|
|
32
|
+
color: customColor ?? theme[defaultColor],
|
|
33
|
+
lineHeight: h4LineHeight
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
return (
|
|
37
|
+
<IOText ref={ref} {...H4Props}>
|
|
38
|
+
{props.children}
|
|
39
|
+
</IOText>
|
|
40
|
+
);
|
|
41
|
+
}
|
|
42
|
+
);
|
|
@@ -1,45 +1,39 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ForwardedRef, forwardRef } from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { IOTheme,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ExternalTypographyProps, TypographyProps } from "./common";
|
|
3
|
+
import { IOTheme, useIOTheme } from "../../core";
|
|
4
|
+
import { IOFontSize } from "../../utils/fonts";
|
|
5
|
+
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
type AllowedWeight = Extract<IOFontWeight, "Semibold">;
|
|
7
|
+
const defaultColor: keyof IOTheme = "textHeading-default";
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
TypographyProps<AllowedWeight, AllowedColors>
|
|
13
|
-
>;
|
|
14
|
-
|
|
15
|
-
export const h5FontSize = 14;
|
|
9
|
+
export const h5FontSize: IOFontSize = 14;
|
|
16
10
|
export const h5LineHeight = 16;
|
|
17
|
-
const font: FontFamily = "TitilliumSansPro";
|
|
18
|
-
const defaultColor: AllowedColors = "black";
|
|
19
|
-
const defaultWeight: AllowedWeight = "Semibold";
|
|
20
11
|
|
|
21
12
|
/**
|
|
22
13
|
* `H5` typographic style
|
|
23
14
|
*/
|
|
24
|
-
export const H5 =
|
|
25
|
-
|
|
15
|
+
export const H5 = forwardRef<View, TypographicStyleProps>(
|
|
16
|
+
({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
|
|
17
|
+
const theme = useIOTheme();
|
|
26
18
|
|
|
27
|
-
|
|
28
|
-
{
|
|
19
|
+
const H5Props: IOTextProps = {
|
|
29
20
|
...props,
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
fontSize: h5FontSize,
|
|
38
|
-
lineHeight: h5LineHeight,
|
|
21
|
+
dynamicTypeRamp: "subheadline", // iOS only
|
|
22
|
+
font: "TitilliumSansPro",
|
|
23
|
+
weight: "Semibold",
|
|
24
|
+
size: h5FontSize,
|
|
25
|
+
lineHeight: h5LineHeight,
|
|
26
|
+
color: customColor ?? theme[defaultColor],
|
|
27
|
+
textStyle: {
|
|
39
28
|
textTransform: "uppercase",
|
|
40
29
|
letterSpacing: 0.5
|
|
41
30
|
}
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
}
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
return (
|
|
34
|
+
<IOText ref={ref} {...H5Props}>
|
|
35
|
+
{props.children}
|
|
36
|
+
</IOText>
|
|
37
|
+
);
|
|
38
|
+
}
|
|
39
|
+
);
|
|
@@ -1,55 +1,44 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ForwardedRef, forwardRef } from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
IOVisualCostants,
|
|
7
|
-
useIOExperimentalDesign
|
|
8
|
-
} from "../../core";
|
|
9
|
-
import { FontFamily, IOFontWeight } from "../../utils/fonts";
|
|
10
|
-
import { useTypographyFactory } from "./Factory";
|
|
11
|
-
import { ExternalTypographyProps, TypographyProps } from "./common";
|
|
3
|
+
import { IOTheme, useIOExperimentalDesign, useIOTheme } from "../../core";
|
|
4
|
+
import { IOFontFamily, IOFontSize, IOFontWeight } from "../../utils/fonts";
|
|
5
|
+
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
12
6
|
|
|
13
|
-
|
|
14
|
-
type AllowedColors = IOTheme["textBody-default"] | "blueIO-850";
|
|
15
|
-
type AllowedWeight = Extract<IOFontWeight, "Regular" | "Semibold">;
|
|
7
|
+
const defaultColor: keyof IOTheme = "textHeading-default";
|
|
16
8
|
|
|
17
|
-
|
|
18
|
-
TypographyProps<AllowedWeight, AllowedColors>
|
|
19
|
-
>;
|
|
20
|
-
|
|
21
|
-
export const h6FontSize = 16;
|
|
9
|
+
export const h6FontSize: IOFontSize = 16;
|
|
22
10
|
export const h6LineHeight = 24;
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
const fontName: FontFamily = "ReadexPro";
|
|
11
|
+
const fontName: IOFontFamily = "ReadexPro";
|
|
12
|
+
const fontWeight: IOFontWeight = "Regular";
|
|
26
13
|
|
|
27
14
|
// TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
|
|
28
|
-
const legacyFontSize = 18;
|
|
15
|
+
const legacyFontSize: IOFontSize = 18;
|
|
29
16
|
const legacyLineHeight = 25;
|
|
30
|
-
const legacyFontName:
|
|
31
|
-
const
|
|
17
|
+
const legacyFontName: IOFontFamily = "TitilliumSansPro";
|
|
18
|
+
const legacyFontWeight: IOFontWeight = "Semibold";
|
|
32
19
|
|
|
33
20
|
/**
|
|
34
21
|
* `H6` typographic style
|
|
35
22
|
*/
|
|
36
|
-
export const H6 =
|
|
37
|
-
|
|
23
|
+
export const H6 = forwardRef<View, TypographicStyleProps>(
|
|
24
|
+
({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
|
|
25
|
+
const theme = useIOTheme();
|
|
26
|
+
const { isExperimental } = useIOExperimentalDesign();
|
|
38
27
|
|
|
39
|
-
|
|
40
|
-
{
|
|
28
|
+
const H6Props: IOTextProps = {
|
|
41
29
|
...props,
|
|
42
|
-
|
|
43
|
-
maxFontSizeMultiplier: IOVisualCostants.maxFontSizeMultiplier,
|
|
44
|
-
dynamicTypeRamp: "headline" /* iOS only */,
|
|
45
|
-
defaultWeight: isExperimental ? h6DefaultWeight : legacyDefaultWeight,
|
|
46
|
-
defaultColor: h6DefaultColor,
|
|
30
|
+
dynamicTypeRamp: "headline", // iOS only
|
|
47
31
|
font: isExperimental ? fontName : legacyFontName,
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
}
|
|
32
|
+
size: isExperimental ? h6FontSize : legacyFontSize,
|
|
33
|
+
lineHeight: isExperimental ? h6LineHeight : legacyLineHeight,
|
|
34
|
+
weight: isExperimental ? fontWeight : legacyFontWeight,
|
|
35
|
+
color: customColor ?? theme[defaultColor]
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
return (
|
|
39
|
+
<IOText ref={ref} {...H6Props}>
|
|
40
|
+
{props.children}
|
|
41
|
+
</IOText>
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
);
|
|
@@ -1,46 +1,43 @@
|
|
|
1
|
-
import React from "react";
|
|
1
|
+
import React, { ForwardedRef, forwardRef } from "react";
|
|
2
2
|
import { View } from "react-native";
|
|
3
|
-
import { useIOExperimentalDesign,
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { ExternalTypographyProps, TypographyProps } from "./common";
|
|
3
|
+
import { IOTheme, useIOExperimentalDesign, useIOTheme } from "../../core";
|
|
4
|
+
import { IOFontFamily, IOFontSize, IOFontWeight } from "../../utils/fonts";
|
|
5
|
+
import { IOText, IOTextProps, TypographicStyleProps } from "./IOText";
|
|
7
6
|
|
|
8
|
-
|
|
9
|
-
type AllowedWeight = Extract<IOFontWeight, "Regular" | "Semibold">;
|
|
7
|
+
const defaultColor: keyof IOTheme = "textHeading-default";
|
|
10
8
|
|
|
11
|
-
|
|
12
|
-
TypographyProps<AllowedWeight, AllowedColors>
|
|
13
|
-
>;
|
|
14
|
-
|
|
15
|
-
export const heroFontSize = 32;
|
|
9
|
+
export const heroFontSize: IOFontSize = 32;
|
|
16
10
|
export const heroLineHeight = 48;
|
|
17
|
-
const fontName:
|
|
18
|
-
const
|
|
19
|
-
const defaultWeight: AllowedWeight = "Regular";
|
|
11
|
+
const fontName: IOFontFamily = "ReadexPro";
|
|
12
|
+
const fontWeight: IOFontWeight = "Regular";
|
|
20
13
|
|
|
21
14
|
// TODO: Remove this when legacy look is deprecated https://pagopa.atlassian.net/browse/IOPLT-153
|
|
22
|
-
const
|
|
23
|
-
const legacyWeight: AllowedWeight = "Semibold";
|
|
24
|
-
const legacyHeroFontSize = 35;
|
|
15
|
+
const legacyHeroFontSize: IOFontSize = 35;
|
|
25
16
|
const legacyHeroLineHeight = 49;
|
|
17
|
+
const legacyFontName: IOFontFamily = "TitilliumSansPro";
|
|
18
|
+
const legacyFontWeight: IOFontWeight = "Semibold";
|
|
26
19
|
|
|
27
20
|
/**
|
|
28
21
|
* `Hero` typographic style
|
|
29
22
|
*/
|
|
30
|
-
export const Hero =
|
|
31
|
-
|
|
23
|
+
export const Hero = forwardRef<View, TypographicStyleProps>(
|
|
24
|
+
({ color: customColor, ...props }, ref?: ForwardedRef<View>) => {
|
|
25
|
+
const theme = useIOTheme();
|
|
26
|
+
const { isExperimental } = useIOExperimentalDesign();
|
|
32
27
|
|
|
33
|
-
|
|
34
|
-
{
|
|
28
|
+
const HeroProps: IOTextProps = {
|
|
35
29
|
...props,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
30
|
+
font: isExperimental ? fontName : legacyFontName,
|
|
31
|
+
weight: isExperimental ? fontWeight : legacyFontWeight,
|
|
32
|
+
size: isExperimental ? heroFontSize : legacyHeroFontSize,
|
|
33
|
+
lineHeight: isExperimental ? heroLineHeight : legacyHeroLineHeight,
|
|
34
|
+
color: customColor ?? theme[defaultColor]
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
return (
|
|
38
|
+
<IOText ref={ref} {...HeroProps}>
|
|
39
|
+
{props.children}
|
|
40
|
+
</IOText>
|
|
41
|
+
);
|
|
42
|
+
}
|
|
43
|
+
);
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import React, { ComponentProps, forwardRef, useMemo } from "react";
|
|
2
|
+
import {
|
|
3
|
+
ColorValue,
|
|
4
|
+
GestureResponderEvent,
|
|
5
|
+
Text,
|
|
6
|
+
TextStyle,
|
|
7
|
+
View
|
|
8
|
+
} from "react-native";
|
|
9
|
+
import { IOColors, useIOExperimentalDesign, useIOTheme } from "../../core";
|
|
10
|
+
import { useBoldTextEnabled } from "../../utils/accessibility";
|
|
11
|
+
import {
|
|
12
|
+
IOFontFamily,
|
|
13
|
+
IOFontSize,
|
|
14
|
+
IOFontWeight,
|
|
15
|
+
makeFontStyleObject
|
|
16
|
+
} from "../../utils/fonts";
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* We exclude all of the following props when we define a new
|
|
20
|
+
* typographic style in which all of these visual attributes
|
|
21
|
+
* are already defined.
|
|
22
|
+
*/
|
|
23
|
+
export type IOTextStyle = Omit<
|
|
24
|
+
TextStyle,
|
|
25
|
+
"fontFamily" | "fontSize" | "fontWeight" | "lineHeight" | "fontStyle"
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
export type TypographicStyleProps = Omit<
|
|
29
|
+
IOTextProps,
|
|
30
|
+
"style" | "font" | "size" | "weight" | "color" | "lineHeight" | "fontStyle"
|
|
31
|
+
> & { textStyle?: IOTextStyle; style?: IOTextStyle } & {
|
|
32
|
+
color?: IOTextBaseProps["color"];
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* The specific properties needed to calculate the font style using {@link makeFontStyleObject} (these information
|
|
37
|
+
* cannot be included in the default StyleProp<TextStyle>
|
|
38
|
+
*/
|
|
39
|
+
type IOTextBaseProps = {
|
|
40
|
+
size?: IOFontSize;
|
|
41
|
+
weight?: IOFontWeight;
|
|
42
|
+
color?: IOColors;
|
|
43
|
+
font?: IOFontFamily;
|
|
44
|
+
lineHeight?: TextStyle["lineHeight"];
|
|
45
|
+
fontStyle?: TextStyle["fontStyle"];
|
|
46
|
+
textStyle?: IOTextStyle;
|
|
47
|
+
style?: IOTextStyle;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
type IOTextExcludedProps = Omit<
|
|
51
|
+
ComponentProps<typeof Text>,
|
|
52
|
+
"allowFontScaling" | "maxFontSizeMultiplier" | "style"
|
|
53
|
+
>;
|
|
54
|
+
|
|
55
|
+
export type IOTextProps = IOTextBaseProps & IOTextExcludedProps;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Extend `TypographicStyleProps` with extra props for styles that
|
|
59
|
+
* can be used as links
|
|
60
|
+
*/
|
|
61
|
+
export type TypographicStyleAsLinkProps =
|
|
62
|
+
| {
|
|
63
|
+
color?: never;
|
|
64
|
+
asLink: true;
|
|
65
|
+
onPress: (event: GestureResponderEvent) => void;
|
|
66
|
+
}
|
|
67
|
+
| { color?: IOColors; asLink?: false };
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Decorate the function {@link makeFontStyleObject} with the additional color calculation.
|
|
71
|
+
* @param color A value key from {@link IOColors}, transformed here in {@link ColorValue}
|
|
72
|
+
* @param args the args of the function {@link makeFontStyleObject}
|
|
73
|
+
*/
|
|
74
|
+
const calculateTextStyle = (
|
|
75
|
+
color: IOColors,
|
|
76
|
+
...args: Parameters<typeof makeFontStyleObject>
|
|
77
|
+
) => ({
|
|
78
|
+
...makeFontStyleObject(...args),
|
|
79
|
+
color: IOColors[color]
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* `IOText` is the core Typography component used to render a text.
|
|
84
|
+
* It accepts all the default text style `StyleProp<TextStyle>` (excluding the ones already applied) in addition with {@link IOTextBaseProps}
|
|
85
|
+
* used to calculate at runtime the platform-dependent styles.
|
|
86
|
+
* @param props
|
|
87
|
+
* @constructor
|
|
88
|
+
*/
|
|
89
|
+
export const IOText = forwardRef<View, IOTextProps>(
|
|
90
|
+
(
|
|
91
|
+
{
|
|
92
|
+
color,
|
|
93
|
+
size,
|
|
94
|
+
font,
|
|
95
|
+
lineHeight,
|
|
96
|
+
weight,
|
|
97
|
+
fontStyle,
|
|
98
|
+
textStyle,
|
|
99
|
+
style,
|
|
100
|
+
children,
|
|
101
|
+
...props
|
|
102
|
+
},
|
|
103
|
+
ref
|
|
104
|
+
) => {
|
|
105
|
+
const theme = useIOTheme();
|
|
106
|
+
const boldEnabled = useBoldTextEnabled();
|
|
107
|
+
|
|
108
|
+
const { isExperimental } = useIOExperimentalDesign();
|
|
109
|
+
|
|
110
|
+
const computedStyleObj = useMemo(
|
|
111
|
+
() =>
|
|
112
|
+
calculateTextStyle(
|
|
113
|
+
color ?? theme["textBody-default"],
|
|
114
|
+
size,
|
|
115
|
+
font,
|
|
116
|
+
lineHeight,
|
|
117
|
+
weight,
|
|
118
|
+
fontStyle,
|
|
119
|
+
boldEnabled
|
|
120
|
+
),
|
|
121
|
+
[color, theme, size, font, lineHeight, weight, fontStyle, boldEnabled]
|
|
122
|
+
);
|
|
123
|
+
|
|
124
|
+
/* In some cases, for example when we use color transitions with
|
|
125
|
+
`reanimated` we need to manage chromatic values as `ColorValue`
|
|
126
|
+
or `string` (not `IOColors`). So we keep a way to override
|
|
127
|
+
the the `color' attribute without giving the ability to
|
|
128
|
+
override all other all other typographic attributes
|
|
129
|
+
through the `style' prop. */
|
|
130
|
+
const fontStyleObj = style?.color
|
|
131
|
+
? [{ ...computedStyleObj, color: style?.color }]
|
|
132
|
+
: computedStyleObj;
|
|
133
|
+
|
|
134
|
+
/* Some typographic styles like `H5` have certain `TextStyle` properties
|
|
135
|
+
like `textTransform` or `letterSpacing` that we want to apply to the text.
|
|
136
|
+
We use the `textStyle` prop to pass these properties to the `IOText`
|
|
137
|
+
component and preserve the ability to define the `style` prop as well.
|
|
138
|
+
The `style` prop is the last one to be applied, so we can properly
|
|
139
|
+
override the `color` attribute.
|
|
140
|
+
*/
|
|
141
|
+
const styleObj = style
|
|
142
|
+
? [textStyle ?? {}, fontStyleObj ?? {}, style]
|
|
143
|
+
: [textStyle ?? {}, fontStyleObj ?? {}];
|
|
144
|
+
|
|
145
|
+
/* Accessible typography based on the `fontScale` parameter */
|
|
146
|
+
const accessibleFontSizeProps: ComponentProps<typeof Text> = {
|
|
147
|
+
allowFontScaling: isExperimental,
|
|
148
|
+
maxFontSizeMultiplier: 1.25
|
|
149
|
+
};
|
|
150
|
+
|
|
151
|
+
return (
|
|
152
|
+
<Text ref={ref} style={styleObj} {...props} {...accessibleFontSizeProps}>
|
|
153
|
+
{children}
|
|
154
|
+
</Text>
|
|
155
|
+
);
|
|
156
|
+
}
|
|
157
|
+
);
|