@digigov/react-core 2.0.0-d57821ba → 2.0.0-daaf7bdf
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/Base/compat/Input/CheckboxInput.native/index.js +33 -0
- package/Base/compat/Input/CheckboxInput.native/package.json +6 -0
- package/Base/compat/Input/CheckboxInput.native.d.ts +4 -0
- package/Base/compat/Input/CheckboxInput.native.js.map +7 -0
- package/Base/compat/Input/RadioInput.native/index.js +32 -0
- package/Base/compat/Input/RadioInput.native/package.json +6 -0
- package/Base/compat/Input/RadioInput.native.d.ts +4 -0
- package/Base/compat/Input/RadioInput.native.js.map +7 -0
- package/Base/compat/Input/StringInput.native/index.js +99 -0
- package/Base/compat/Input/StringInput.native/package.json +6 -0
- package/Base/compat/Input/StringInput.native.d.ts +7 -0
- package/Base/compat/Input/StringInput.native.js.map +7 -0
- package/Base/compat/Input/index.native/index.js +24 -0
- package/Base/compat/Input/index.native/package.json +6 -0
- package/Base/compat/Input/index.native.d.ts +7 -0
- package/Base/compat/Input/index.native.js.map +7 -0
- package/Base/compat/button.native/index.js +48 -0
- package/Base/compat/button.native/package.json +6 -0
- package/Base/compat/button.native.d.ts +5 -0
- package/Base/compat/button.native.js.map +7 -0
- package/Base/compat/details.native/index.js +40 -0
- package/Base/compat/details.native/package.json +6 -0
- package/Base/compat/details.native.d.ts +8 -0
- package/Base/compat/details.native.js.map +7 -0
- package/Base/compat/li.native/index.js +9 -0
- package/Base/compat/li.native/package.json +6 -0
- package/Base/compat/li.native.d.ts +6 -0
- package/Base/compat/li.native.js.map +7 -0
- package/Base/compat/ol.native/index.js +33 -0
- package/Base/compat/ol.native/package.json +6 -0
- package/Base/compat/ol.native.d.ts +6 -0
- package/Base/compat/ol.native.js.map +7 -0
- package/Base/index.d.ts +2 -95
- package/Base/index.js +3 -98
- package/Base/index.js.map +3 -3
- package/Base/index.native/index.js +160 -0
- package/Base/index.native/package.json +6 -0
- package/Base/index.native.d.ts +7 -0
- package/Base/index.native.js.map +7 -0
- package/Base/index.web/index.js +104 -0
- package/Base/index.web/package.json +6 -0
- package/Base/index.web.d.ts +97 -0
- package/Base/index.web.js.map +7 -0
- package/Base/mapping.native/index.js +34 -0
- package/Base/mapping.native/package.json +6 -0
- package/Base/mapping.native.d.ts +6 -0
- package/Base/mapping.native.js.map +7 -0
- package/Base/utils/index.js +86 -0
- package/Base/utils/package.json +6 -0
- package/Base/utils.d.ts +41 -0
- package/Base/utils.js.map +7 -0
- package/Base/wrap.native/index.js +64 -0
- package/Base/wrap.native/package.json +6 -0
- package/Base/wrap.native.d.ts +2 -0
- package/Base/wrap.native.js.map +7 -0
- package/CallToAction/index.js +1 -1
- package/CallToAction/index.js.map +2 -2
- package/Card/index.js +2 -1
- package/Card/index.js.map +2 -2
- package/CheckboxItem/index.js +4 -16
- package/CheckboxItem/index.js.map +2 -2
- package/CheckboxItemInput/index.d.ts +2 -0
- package/CheckboxItemInput/index.js +6 -0
- package/CheckboxItemInput/index.js.map +7 -0
- package/CheckboxItemInput/index.native/index.js +20 -0
- package/CheckboxItemInput/index.native/package.json +6 -0
- package/CheckboxItemInput/index.native.d.ts +4 -0
- package/CheckboxItemInput/index.native.js.map +7 -0
- package/CheckboxItemInput/index.web/index.js +26 -0
- package/CheckboxItemInput/index.web/package.json +6 -0
- package/CheckboxItemInput/index.web.d.ts +10 -0
- package/CheckboxItemInput/index.web.js.map +7 -0
- package/CheckboxItemInput/package.json +6 -0
- package/Chip/index.js +2 -1
- package/Chip/index.js.map +2 -2
- package/CodeBlockContainer/index.d.ts +1 -9
- package/CodeBlockContainer/index.js +2 -3
- package/CodeBlockContainer/index.js.map +2 -2
- package/CodeBlockContent/index.d.ts +1 -1
- package/CodeBlockContent/index.js +3 -2
- package/CodeBlockContent/index.js.map +2 -2
- package/CodeBlockHeader/index.d.ts +1 -1
- package/CodeBlockHeader/index.js +1 -3
- package/CodeBlockHeader/index.js.map +2 -2
- package/CopyToClipboardContainer/index.d.ts +2 -31
- package/CopyToClipboardContainer/index.js +3 -40
- package/CopyToClipboardContainer/index.js.map +3 -3
- package/CopyToClipboardContainer/index.web/index.js +44 -0
- package/CopyToClipboardContainer/index.web/package.json +6 -0
- package/CopyToClipboardContainer/index.web.d.ts +31 -0
- package/CopyToClipboardContainer/index.web.js.map +7 -0
- package/CopyToClipboardMessage/index.d.ts +2 -18
- package/CopyToClipboardMessage/index.js +3 -21
- package/CopyToClipboardMessage/index.js.map +3 -3
- package/CopyToClipboardMessage/index.native/index.js +18 -0
- package/CopyToClipboardMessage/index.native/package.json +6 -0
- package/CopyToClipboardMessage/index.native.d.ts +6 -0
- package/CopyToClipboardMessage/index.native.js.map +7 -0
- package/CopyToClipboardMessage/index.web/index.js +24 -0
- package/CopyToClipboardMessage/index.web/package.json +6 -0
- package/CopyToClipboardMessage/index.web.d.ts +18 -0
- package/CopyToClipboardMessage/index.web.js.map +7 -0
- package/DateInputItem/index.d.ts +2 -26
- package/DateInputItem/index.js +3 -41
- package/DateInputItem/index.js.map +3 -3
- package/DateInputItem/index.native/index.js +17 -0
- package/DateInputItem/index.native/package.json +6 -0
- package/DateInputItem/index.native.d.ts +4 -0
- package/DateInputItem/index.native.js.map +7 -0
- package/DateInputItem/index.web/index.js +32 -0
- package/DateInputItem/index.web/package.json +6 -0
- package/DateInputItem/index.web.d.ts +26 -0
- package/DateInputItem/index.web.js.map +7 -0
- package/Details/index.d.ts +2 -10
- package/Details/index.js +3 -22
- package/Details/index.js.map +3 -3
- package/Details/index.native/index.js +17 -0
- package/Details/index.native/package.json +6 -0
- package/Details/index.native.d.ts +4 -0
- package/Details/index.native.js.map +7 -0
- package/Details/index.web/index.js +25 -0
- package/Details/index.web/package.json +6 -0
- package/Details/index.web.d.ts +10 -0
- package/Details/index.web.js.map +7 -0
- package/FieldsetLegend/index.js +1 -4
- package/FieldsetLegend/index.js.map +2 -2
- package/LabelTitle/index.js +2 -4
- package/LabelTitle/index.js.map +2 -2
- package/NavListItemActionContainer/index.d.ts +2 -10
- package/NavListItemActionContainer/index.js +3 -20
- package/NavListItemActionContainer/index.js.map +3 -3
- package/NavListItemActionContainer/index.native/index.js +17 -0
- package/NavListItemActionContainer/index.native/package.json +6 -0
- package/NavListItemActionContainer/index.native.d.ts +7 -0
- package/NavListItemActionContainer/index.native.js.map +7 -0
- package/NavListItemActionContainer/index.web/index.js +23 -0
- package/NavListItemActionContainer/index.web/package.json +6 -0
- package/NavListItemActionContainer/index.web.d.ts +10 -0
- package/NavListItemActionContainer/index.web.js.map +7 -0
- package/NotificationBannerLink/index.d.ts +2 -11
- package/NotificationBannerLink/index.js +3 -19
- package/NotificationBannerLink/index.js.map +3 -3
- package/NotificationBannerLink/index.native/index.js +16 -0
- package/NotificationBannerLink/index.native/package.json +6 -0
- package/NotificationBannerLink/index.native.d.ts +8 -0
- package/NotificationBannerLink/index.native.js.map +7 -0
- package/NotificationBannerLink/index.web/index.js +22 -0
- package/NotificationBannerLink/index.web/package.json +6 -0
- package/NotificationBannerLink/index.web.d.ts +11 -0
- package/NotificationBannerLink/index.web.js.map +7 -0
- package/PhaseBanner/index.js +2 -1
- package/PhaseBanner/index.js.map +2 -2
- package/PhaseBannerTag/index.d.ts +2 -2
- package/PhaseBannerTag/index.js +1 -1
- package/PhaseBannerTag/index.js.map +1 -1
- package/PhaseBannerText/index.js +1 -1
- package/PhaseBannerText/index.js.map +2 -2
- package/RadioItem/index.js +2 -1
- package/RadioItem/index.js.map +2 -2
- package/SummaryList/index.d.ts +1 -1
- package/SummaryList/index.js.map +2 -2
- package/SummaryListItemKey/index.d.ts +14 -0
- package/SummaryListItemKey/index.js +5 -2
- package/SummaryListItemKey/index.js.map +2 -2
- package/TextArea/index.d.ts +2 -24
- package/TextArea/index.js +3 -27
- package/TextArea/index.js.map +3 -3
- package/TextArea/index.native/index.js +16 -0
- package/TextArea/index.native/package.json +6 -0
- package/TextArea/index.native.d.ts +4 -0
- package/TextArea/index.native.js.map +7 -0
- package/TextArea/index.web/index.js +30 -0
- package/TextArea/index.web/package.json +6 -0
- package/TextArea/index.web.d.ts +24 -0
- package/TextArea/index.web.js.map +7 -0
- package/TextInput/index.d.ts +2 -46
- package/TextInput/index.js +3 -40
- package/TextInput/index.js.map +3 -3
- package/TextInput/index.native/index.js +19 -0
- package/TextInput/index.native/package.json +6 -0
- package/TextInput/index.native.d.ts +4 -0
- package/TextInput/index.native.js.map +7 -0
- package/TextInput/index.web/index.js +43 -0
- package/TextInput/index.web/package.json +6 -0
- package/TextInput/index.web.d.ts +46 -0
- package/TextInput/index.web.js.map +7 -0
- package/Unpurge/index.js +78 -0
- package/Unpurge/index.js.map +2 -2
- package/WarningText/index.js +7 -12
- package/WarningText/index.js.map +2 -2
- package/WarningTextAssistive/index.d.ts +15 -0
- package/WarningTextAssistive/index.js +23 -0
- package/WarningTextAssistive/index.js.map +7 -0
- package/WarningTextAssistive/package.json +6 -0
- package/cjs/Base/compat/Input/CheckboxInput.native/index.js +66 -0
- package/cjs/Base/compat/Input/CheckboxInput.native.js.map +7 -0
- package/cjs/Base/compat/Input/RadioInput.native/index.js +65 -0
- package/cjs/Base/compat/Input/RadioInput.native.js.map +7 -0
- package/cjs/Base/compat/Input/StringInput.native/index.js +129 -0
- package/cjs/Base/compat/Input/StringInput.native.js.map +7 -0
- package/cjs/Base/compat/Input/index.native/index.js +55 -0
- package/cjs/Base/compat/Input/index.native.js.map +7 -0
- package/cjs/Base/compat/button.native/index.js +81 -0
- package/cjs/Base/compat/button.native.js.map +7 -0
- package/cjs/Base/compat/details.native/index.js +65 -0
- package/cjs/Base/compat/details.native.js.map +7 -0
- package/cjs/Base/compat/li.native/index.js +42 -0
- package/cjs/Base/compat/li.native.js.map +7 -0
- package/cjs/Base/compat/ol.native/index.js +66 -0
- package/cjs/Base/compat/ol.native.js.map +7 -0
- package/cjs/Base/index.js +5 -99
- package/cjs/Base/index.js.map +3 -3
- package/cjs/Base/index.native/index.js +193 -0
- package/cjs/Base/index.native.js.map +7 -0
- package/cjs/Base/index.web/index.js +137 -0
- package/cjs/Base/index.web.js.map +7 -0
- package/cjs/Base/mapping.native/index.js +67 -0
- package/cjs/Base/mapping.native.js.map +7 -0
- package/cjs/Base/utils/index.js +119 -0
- package/cjs/Base/utils.js.map +7 -0
- package/cjs/Base/wrap.native/index.js +97 -0
- package/cjs/Base/wrap.native.js.map +7 -0
- package/cjs/CallToAction/index.js +1 -1
- package/cjs/CallToAction/index.js.map +2 -2
- package/cjs/Card/index.js +2 -1
- package/cjs/Card/index.js.map +2 -2
- package/cjs/CheckboxItem/index.js +4 -16
- package/cjs/CheckboxItem/index.js.map +3 -3
- package/cjs/CheckboxItemInput/index.js +40 -0
- package/cjs/CheckboxItemInput/index.js.map +7 -0
- package/cjs/CheckboxItemInput/index.native/index.js +53 -0
- package/cjs/CheckboxItemInput/index.native.js.map +7 -0
- package/cjs/CheckboxItemInput/index.web/index.js +59 -0
- package/cjs/CheckboxItemInput/index.web.js.map +7 -0
- package/cjs/Chip/index.js +2 -1
- package/cjs/Chip/index.js.map +2 -2
- package/cjs/CodeBlockContainer/index.js +2 -3
- package/cjs/CodeBlockContainer/index.js.map +2 -2
- package/cjs/CodeBlockContent/index.js +3 -2
- package/cjs/CodeBlockContent/index.js.map +2 -2
- package/cjs/CodeBlockHeader/index.js +1 -3
- package/cjs/CodeBlockHeader/index.js.map +2 -2
- package/cjs/CopyToClipboardContainer/index.js +5 -41
- package/cjs/CopyToClipboardContainer/index.js.map +3 -3
- package/cjs/CopyToClipboardContainer/index.web/index.js +77 -0
- package/cjs/CopyToClipboardContainer/index.web.js.map +7 -0
- package/cjs/CopyToClipboardMessage/index.js +5 -22
- package/cjs/CopyToClipboardMessage/index.js.map +3 -3
- package/cjs/CopyToClipboardMessage/index.native/index.js +51 -0
- package/cjs/CopyToClipboardMessage/index.native.js.map +7 -0
- package/cjs/CopyToClipboardMessage/index.web/index.js +57 -0
- package/cjs/CopyToClipboardMessage/index.web.js.map +7 -0
- package/cjs/DateInputItem/index.js +5 -42
- package/cjs/DateInputItem/index.js.map +3 -3
- package/cjs/DateInputItem/index.native/index.js +50 -0
- package/cjs/DateInputItem/index.native.js.map +7 -0
- package/cjs/DateInputItem/index.web/index.js +65 -0
- package/cjs/DateInputItem/index.web.js.map +7 -0
- package/cjs/Details/index.js +5 -23
- package/cjs/Details/index.js.map +3 -3
- package/cjs/Details/index.native/index.js +50 -0
- package/cjs/Details/index.native.js.map +7 -0
- package/cjs/Details/index.web/index.js +58 -0
- package/cjs/Details/index.web.js.map +7 -0
- package/cjs/FieldsetLegend/index.js +1 -4
- package/cjs/FieldsetLegend/index.js.map +2 -2
- package/cjs/LabelTitle/index.js +2 -4
- package/cjs/LabelTitle/index.js.map +2 -2
- package/cjs/NavListItemActionContainer/index.js +5 -21
- package/cjs/NavListItemActionContainer/index.js.map +3 -3
- package/cjs/NavListItemActionContainer/index.native/index.js +50 -0
- package/cjs/NavListItemActionContainer/index.native.js.map +7 -0
- package/cjs/NavListItemActionContainer/index.web/index.js +56 -0
- package/cjs/NavListItemActionContainer/index.web.js.map +7 -0
- package/cjs/NotificationBannerLink/index.js +5 -20
- package/cjs/NotificationBannerLink/index.js.map +3 -3
- package/cjs/NotificationBannerLink/index.native/index.js +49 -0
- package/cjs/NotificationBannerLink/index.native.js.map +7 -0
- package/cjs/NotificationBannerLink/index.web/index.js +55 -0
- package/cjs/NotificationBannerLink/index.web.js.map +7 -0
- package/cjs/PhaseBanner/index.js +2 -1
- package/cjs/PhaseBanner/index.js.map +2 -2
- package/cjs/PhaseBannerTag/index.js +1 -1
- package/cjs/PhaseBannerTag/index.js.map +1 -1
- package/cjs/PhaseBannerText/index.js +1 -1
- package/cjs/PhaseBannerText/index.js.map +2 -2
- package/cjs/RadioItem/index.js +2 -1
- package/cjs/RadioItem/index.js.map +3 -3
- package/cjs/SummaryList/index.js.map +2 -2
- package/cjs/SummaryListItemKey/index.js +5 -2
- package/cjs/SummaryListItemKey/index.js.map +2 -2
- package/cjs/TextArea/index.js +5 -28
- package/cjs/TextArea/index.js.map +3 -3
- package/cjs/TextArea/index.native/index.js +49 -0
- package/cjs/TextArea/index.native.js.map +7 -0
- package/cjs/TextArea/index.web/index.js +63 -0
- package/cjs/TextArea/index.web.js.map +7 -0
- package/cjs/TextInput/index.js +5 -41
- package/cjs/TextInput/index.js.map +3 -3
- package/cjs/TextInput/index.native/index.js +52 -0
- package/cjs/TextInput/index.native.js.map +7 -0
- package/cjs/TextInput/index.web/index.js +76 -0
- package/cjs/TextInput/index.web.js.map +7 -0
- package/cjs/Unpurge/index.js +78 -0
- package/cjs/Unpurge/index.js.map +2 -2
- package/cjs/WarningText/index.js +7 -12
- package/cjs/WarningText/index.js.map +2 -2
- package/cjs/WarningTextAssistive/index.js +56 -0
- package/cjs/WarningTextAssistive/index.js.map +7 -0
- package/cjs/index.js +5 -1
- package/cjs/index.js.map +2 -2
- package/cjs/lazy/index.js +12 -10
- package/cjs/lazy.js.map +2 -2
- package/cjs/registry/index.js +27 -1
- package/cjs/registry.js.map +2 -2
- package/cjs/utils/extend.native/index.js +47 -0
- package/cjs/utils/extend.native.js.map +7 -0
- package/index.d.ts +2 -0
- package/index.js +3 -1
- package/index.js.map +2 -2
- package/lazy/index.js +12 -10
- package/lazy.d.ts +219 -217
- package/lazy.js.map +2 -2
- package/package.json +21 -4
- package/registry/index.js +27 -1
- package/registry.d.ts +13 -0
- package/registry.js.map +2 -2
- package/src/Base/compat/Input/CheckboxInput.native.tsx +40 -0
- package/src/Base/compat/Input/RadioInput.native.tsx +39 -0
- package/src/Base/compat/Input/StringInput.native.tsx +115 -0
- package/src/Base/compat/Input/index.native.tsx +28 -0
- package/src/Base/compat/button.native.tsx +53 -0
- package/src/Base/compat/details.native.tsx +68 -0
- package/src/Base/compat/li.native.tsx +11 -0
- package/src/Base/compat/ol.native.tsx +41 -0
- package/src/Base/index.native.tsx +185 -0
- package/src/Base/index.tsx +2 -257
- package/src/Base/index.web.tsx +259 -0
- package/src/Base/mapping.native.tsx +41 -0
- package/src/Base/utils.ts +84 -0
- package/src/Base/wrap.native.tsx +94 -0
- package/src/CallToAction/index.tsx +2 -2
- package/src/Card/index.tsx +3 -2
- package/src/CheckboxItem/index.tsx +4 -14
- package/src/CheckboxItemInput/index.native.tsx +17 -0
- package/src/CheckboxItemInput/index.tsx +2 -0
- package/src/CheckboxItemInput/index.web.tsx +34 -0
- package/src/Chip/index.tsx +2 -2
- package/src/CodeBlockContainer/index.tsx +3 -16
- package/src/CodeBlockContent/index.tsx +5 -4
- package/src/CodeBlockHeader/index.tsx +2 -4
- package/src/CopyToClipboardContainer/index.tsx +2 -74
- package/src/CopyToClipboardContainer/index.web.tsx +75 -0
- package/src/CopyToClipboardMessage/index.native.tsx +21 -0
- package/src/CopyToClipboardMessage/index.tsx +2 -41
- package/src/CopyToClipboardMessage/index.web.tsx +41 -0
- package/src/DateInputItem/index.native.tsx +12 -0
- package/src/DateInputItem/index.tsx +2 -64
- package/src/DateInputItem/index.web.tsx +53 -0
- package/src/Details/index.native.tsx +14 -0
- package/src/Details/index.tsx +2 -27
- package/src/Details/index.web.tsx +27 -0
- package/src/FieldsetLegend/index.tsx +1 -4
- package/src/LabelTitle/index.tsx +2 -4
- package/src/NavListItemActionContainer/index.native.tsx +18 -0
- package/src/NavListItemActionContainer/index.tsx +2 -28
- package/src/NavListItemActionContainer/index.web.tsx +28 -0
- package/src/NotificationBannerLink/index.native.tsx +22 -0
- package/src/NotificationBannerLink/index.tsx +2 -28
- package/src/NotificationBannerLink/index.web.tsx +28 -0
- package/src/PhaseBanner/index.tsx +2 -2
- package/src/PhaseBannerTag/index.tsx +3 -3
- package/src/PhaseBannerText/__snapshots__/index.test.tsx.snap +1 -1
- package/src/PhaseBannerText/index.tsx +1 -1
- package/src/RadioItem/index.tsx +2 -2
- package/src/SummaryList/index.tsx +7 -5
- package/src/SummaryListItemKey/index.tsx +24 -2
- package/src/TextArea/index.native.tsx +11 -0
- package/src/TextArea/index.tsx +2 -50
- package/src/TextArea/index.web.tsx +50 -0
- package/src/TextInput/index.native.tsx +15 -0
- package/src/TextInput/index.tsx +2 -87
- package/src/TextInput/index.web.tsx +87 -0
- package/src/Unpurge/index.tsx +78 -0
- package/src/WarningText/index.tsx +12 -15
- package/src/WarningTextAssistive/index.tsx +37 -0
- package/src/index.ts +2 -0
- package/src/lazy.js +12 -10
- package/src/registry.js +28 -2
- package/src/utils/extend.native.tsx +36 -0
- package/utils/extend.native/index.js +14 -0
- package/utils/extend.native/package.json +6 -0
- package/utils/extend.native.d.ts +23 -0
- package/utils/extend.native.js.map +7 -0
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { basePropGenerator } from '@digigov/react-core/Base/utils';
|
|
3
|
+
|
|
4
|
+
type AsProp<C extends React.ElementType> = {
|
|
5
|
+
as?: C;
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);
|
|
9
|
+
|
|
10
|
+
// This is the first reusable type utility we built
|
|
11
|
+
type PolymorphicComponentProp<
|
|
12
|
+
C extends React.ElementType,
|
|
13
|
+
Props = Record<string, unknown>,
|
|
14
|
+
> = React.PropsWithChildren<Props & AsProp<C>> &
|
|
15
|
+
Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
|
|
16
|
+
|
|
17
|
+
// This is a new type utitlity with ref!
|
|
18
|
+
type PolymorphicComponentPropWithRef<
|
|
19
|
+
C extends React.ElementType,
|
|
20
|
+
Props = Record<string, unknown>,
|
|
21
|
+
> = PolymorphicComponentProp<C, Props> & { ref?: any };
|
|
22
|
+
|
|
23
|
+
// This is the type for the "ref" only
|
|
24
|
+
type PolymorphicRef<C extends React.ElementType> =
|
|
25
|
+
React.ComponentPropsWithRef<C>['ref'];
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* This is the updated component props using PolymorphicComponentPropWithRef
|
|
29
|
+
*/
|
|
30
|
+
export type BaseProps<C extends React.ElementType> =
|
|
31
|
+
PolymorphicComponentPropWithRef<
|
|
32
|
+
C,
|
|
33
|
+
{
|
|
34
|
+
/** margin is optional. It has not a default value. */
|
|
35
|
+
margin?: spacingValues;
|
|
36
|
+
/** marginTop is optional. It has not a default value. */
|
|
37
|
+
marginTop?: spacingValues;
|
|
38
|
+
/** marginBottom is optional. It has not a default value. */
|
|
39
|
+
marginBottom?: spacingValues;
|
|
40
|
+
/** marginLeft is optional. It has not a default value. */
|
|
41
|
+
marginLeft?: spacingValues;
|
|
42
|
+
/** marginRight is optional. It has not a default value. */
|
|
43
|
+
marginRight?: spacingValues;
|
|
44
|
+
/** Alternative for margin. Margin is optional. It has not a default value. */
|
|
45
|
+
m?: spacingValues;
|
|
46
|
+
/** Alternative for marginTop. MarginTop is optional. It has not a default value. */
|
|
47
|
+
mt?: spacingValues;
|
|
48
|
+
/** Alternative for marginBottom. MarginBottom is optional. It has not a default value. */
|
|
49
|
+
mb?: spacingValues;
|
|
50
|
+
/** Alternative for marginLeft. MarginLeft is optional. It has not a default value. */
|
|
51
|
+
ml?: spacingValues;
|
|
52
|
+
/** Alternative for marginRight. MarginRight is optional. It has not a default value. */
|
|
53
|
+
mr?: spacingValues;
|
|
54
|
+
/** Alternative for marginX. MarginX is optional. It has not a default value. */
|
|
55
|
+
mx?: spacingValues;
|
|
56
|
+
/** Alternative for marginY. MarginY is optional. It has not a default value. */
|
|
57
|
+
my?: spacingValues;
|
|
58
|
+
/** padding is optional. It has not a default value. */
|
|
59
|
+
padding?: spacingValues;
|
|
60
|
+
/** paddingTop is optional. It has not a default value. */
|
|
61
|
+
paddingTop?: spacingValues;
|
|
62
|
+
/** paddingBottom is optional. It has not a default value. */
|
|
63
|
+
paddingBottom?: spacingValues;
|
|
64
|
+
/** paddingLeft is optional. It has not a default value. */
|
|
65
|
+
paddingLeft?: spacingValues;
|
|
66
|
+
/** paddingRight is optional. It has not a default value. */
|
|
67
|
+
paddingRight?: spacingValues;
|
|
68
|
+
/** Alternative for padding. Padding is optional. It has not a default value. */
|
|
69
|
+
p?: spacingValues;
|
|
70
|
+
/** Alternative for paddingTop. PaddingTop is optional. It has not a default value. */
|
|
71
|
+
pt?: spacingValues;
|
|
72
|
+
/** Alternative for paddingBottom. PaddingBottom is optional. It has not a default value. */
|
|
73
|
+
pb?: spacingValues;
|
|
74
|
+
/** Alternative for paddingLeft. PaddingLeft is optional. It has not a default value. */
|
|
75
|
+
pl?: spacingValues;
|
|
76
|
+
/** Alternative for paddingRight. PaddingRight is optional. It has not a default value. */
|
|
77
|
+
pr?: spacingValues;
|
|
78
|
+
/** Alternative for paddingX. PaddingX is optional. It has not a default value. */
|
|
79
|
+
px?: spacingValues;
|
|
80
|
+
/** Alternative for paddingY. PaddingY is optional. It has not a default value. */
|
|
81
|
+
py?: spacingValues;
|
|
82
|
+
/** printHidden is optional. Default value is false. When true, the component is hidden at print. */
|
|
83
|
+
printHidden?: boolean;
|
|
84
|
+
/** printVisible is optional. When block, the component is displayed as block. When inline, the component is displayed as inline.*/
|
|
85
|
+
printVisible?: 'block' | 'inline';
|
|
86
|
+
/** Components will be hidden at all screen sizes. */
|
|
87
|
+
hidden?: boolean;
|
|
88
|
+
/** Components will be hidden from 'xs' screen size and up. */
|
|
89
|
+
xsUpHidden?: boolean;
|
|
90
|
+
/** Components will be hidden from 'sm' screen size and up. */
|
|
91
|
+
smUpHidden?: boolean;
|
|
92
|
+
/** Components will be hidden from 'md' screen size and up. */
|
|
93
|
+
mdUpHidden?: boolean;
|
|
94
|
+
/** Components will be hidden from 'lg' screen size and up. */
|
|
95
|
+
lgUpHidden?: boolean;
|
|
96
|
+
/** Components will be hidden from 'xl' screen size and up. */
|
|
97
|
+
xlUpHidden?: boolean;
|
|
98
|
+
/** Components will be hidden between xs and sm screen size. */
|
|
99
|
+
xsHidden?: boolean;
|
|
100
|
+
/** Components will be hidden between sm and md screen size. */
|
|
101
|
+
smHidden?: boolean;
|
|
102
|
+
/** Components will be hidden between md and lg screen size. */
|
|
103
|
+
mdHidden?: boolean;
|
|
104
|
+
/** Components will be hidden between lg and xl screen size. */
|
|
105
|
+
lgHidden?: boolean;
|
|
106
|
+
/** Components will be hidden between xl and 2xl screen size. */
|
|
107
|
+
xlHidden?: boolean;
|
|
108
|
+
/** display is optional. It has not a default value. */
|
|
109
|
+
display?: 'flex' | 'block' | 'none'
|
|
110
|
+
}
|
|
111
|
+
>;
|
|
112
|
+
|
|
113
|
+
type spacingValues =
|
|
114
|
+
| 0
|
|
115
|
+
| 0.5
|
|
116
|
+
| 1
|
|
117
|
+
| 1.5
|
|
118
|
+
| 2
|
|
119
|
+
| 2.5
|
|
120
|
+
| 3
|
|
121
|
+
| 3.5
|
|
122
|
+
| 4
|
|
123
|
+
| 5
|
|
124
|
+
| 6
|
|
125
|
+
| 7
|
|
126
|
+
| 8
|
|
127
|
+
| 9
|
|
128
|
+
| 10
|
|
129
|
+
| 11
|
|
130
|
+
| 12
|
|
131
|
+
| 14
|
|
132
|
+
| 16
|
|
133
|
+
| 20
|
|
134
|
+
| 24
|
|
135
|
+
| 28
|
|
136
|
+
| 32
|
|
137
|
+
| 36
|
|
138
|
+
| 40
|
|
139
|
+
| 44
|
|
140
|
+
| 48
|
|
141
|
+
| 52
|
|
142
|
+
| 56
|
|
143
|
+
| 60
|
|
144
|
+
| 64
|
|
145
|
+
| 72
|
|
146
|
+
| 80
|
|
147
|
+
| 96;
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* This is the type used in the type annotation for the component
|
|
151
|
+
*/
|
|
152
|
+
type BaseComponent = <C extends React.ElementType = 'span'>(
|
|
153
|
+
props: BaseProps<C>
|
|
154
|
+
) => React.ReactNode | null;
|
|
155
|
+
|
|
156
|
+
export const Base: BaseComponent = React.forwardRef(function Base<
|
|
157
|
+
C extends React.ElementType = 'span',
|
|
158
|
+
>(
|
|
159
|
+
{
|
|
160
|
+
as,
|
|
161
|
+
display,
|
|
162
|
+
margin,
|
|
163
|
+
marginTop,
|
|
164
|
+
marginBottom,
|
|
165
|
+
marginLeft,
|
|
166
|
+
marginRight,
|
|
167
|
+
m,
|
|
168
|
+
mt,
|
|
169
|
+
mb,
|
|
170
|
+
ml,
|
|
171
|
+
mr,
|
|
172
|
+
mx,
|
|
173
|
+
my,
|
|
174
|
+
padding,
|
|
175
|
+
paddingTop,
|
|
176
|
+
paddingBottom,
|
|
177
|
+
paddingLeft,
|
|
178
|
+
paddingRight,
|
|
179
|
+
p,
|
|
180
|
+
pt,
|
|
181
|
+
pb,
|
|
182
|
+
pr,
|
|
183
|
+
pl,
|
|
184
|
+
px,
|
|
185
|
+
py,
|
|
186
|
+
printHidden,
|
|
187
|
+
printVisible,
|
|
188
|
+
hidden,
|
|
189
|
+
xsUpHidden,
|
|
190
|
+
smUpHidden,
|
|
191
|
+
mdUpHidden,
|
|
192
|
+
lgUpHidden,
|
|
193
|
+
xlUpHidden,
|
|
194
|
+
xsHidden,
|
|
195
|
+
smHidden,
|
|
196
|
+
mdHidden,
|
|
197
|
+
lgHidden,
|
|
198
|
+
xlHidden,
|
|
199
|
+
children,
|
|
200
|
+
className,
|
|
201
|
+
...props
|
|
202
|
+
}: BaseProps<C>,
|
|
203
|
+
ref?: PolymorphicRef<C>
|
|
204
|
+
) {
|
|
205
|
+
const Component = as || 'span';
|
|
206
|
+
|
|
207
|
+
return (
|
|
208
|
+
<Component
|
|
209
|
+
as={as}
|
|
210
|
+
className={basePropGenerator({
|
|
211
|
+
display,
|
|
212
|
+
margin,
|
|
213
|
+
marginTop,
|
|
214
|
+
marginBottom,
|
|
215
|
+
marginLeft,
|
|
216
|
+
marginRight,
|
|
217
|
+
m,
|
|
218
|
+
mt,
|
|
219
|
+
mb,
|
|
220
|
+
ml,
|
|
221
|
+
mr,
|
|
222
|
+
mx,
|
|
223
|
+
my,
|
|
224
|
+
padding,
|
|
225
|
+
paddingTop,
|
|
226
|
+
paddingBottom,
|
|
227
|
+
paddingLeft,
|
|
228
|
+
paddingRight,
|
|
229
|
+
p,
|
|
230
|
+
pt,
|
|
231
|
+
pb,
|
|
232
|
+
pr,
|
|
233
|
+
pl,
|
|
234
|
+
px,
|
|
235
|
+
py,
|
|
236
|
+
printHidden,
|
|
237
|
+
printVisible,
|
|
238
|
+
hidden,
|
|
239
|
+
xsUpHidden,
|
|
240
|
+
smUpHidden,
|
|
241
|
+
mdUpHidden,
|
|
242
|
+
lgUpHidden,
|
|
243
|
+
xlUpHidden,
|
|
244
|
+
xsHidden,
|
|
245
|
+
smHidden,
|
|
246
|
+
mdHidden,
|
|
247
|
+
lgHidden,
|
|
248
|
+
xlHidden,
|
|
249
|
+
className,
|
|
250
|
+
})}
|
|
251
|
+
ref={ref}
|
|
252
|
+
{...props}
|
|
253
|
+
>
|
|
254
|
+
{children}
|
|
255
|
+
</Component>
|
|
256
|
+
);
|
|
257
|
+
});
|
|
258
|
+
|
|
259
|
+
export default Base;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { Link } from 'expo-router';
|
|
3
|
+
import { Image, View } from 'react-native';
|
|
4
|
+
import Svg, { Path, Circle, Rect, G, Polygon } from 'react-native-svg';
|
|
5
|
+
import { Button } from '@digigov/react-core/Base/compat/button.native';
|
|
6
|
+
import CompatDetails from '@digigov/react-core/Base/compat/details.native';
|
|
7
|
+
import BaseInput from '@digigov/react-core/Base/compat/Input/index.native';
|
|
8
|
+
import { Ol } from '@digigov/react-core/Base/compat/ol.native';
|
|
9
|
+
import { cssInterop } from 'nativewind'
|
|
10
|
+
export type MapProps<T extends keyof JSX.IntrinsicElements> =
|
|
11
|
+
React.ComponentPropsWithoutRef<T>;
|
|
12
|
+
|
|
13
|
+
// TODO: use MapProps<K> instead of any for props type
|
|
14
|
+
export type MappingType = {
|
|
15
|
+
[K in keyof JSX.IntrinsicElements]?: (
|
|
16
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
17
|
+
props: any
|
|
18
|
+
) => JSX.Element | React.ReactNode;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export const mapping: MappingType = {
|
|
22
|
+
a: ({ children, ...props }) => <Link {...props} asChild ><View>{children}</View></Link>,
|
|
23
|
+
img: (props) => <Image {...props} />,
|
|
24
|
+
button: Button,
|
|
25
|
+
input: BaseInput,
|
|
26
|
+
textarea: BaseInput,
|
|
27
|
+
details: CompatDetails,
|
|
28
|
+
ol: Ol,
|
|
29
|
+
path: (props) => <Path {...props} />,
|
|
30
|
+
// @ts-ignore
|
|
31
|
+
svg: cssInterop(Svg, {
|
|
32
|
+
className: {
|
|
33
|
+
target: "style",
|
|
34
|
+
nativeStyleToProp: { width: true, height: true }
|
|
35
|
+
},
|
|
36
|
+
}),
|
|
37
|
+
rect: (props) => <Rect {...props} />,
|
|
38
|
+
circle: (props) => <Circle {...props} />,
|
|
39
|
+
g: (props) => <G {...props} />,
|
|
40
|
+
polygon: (props) => <Polygon {...props} />,
|
|
41
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import clsx from 'clsx';
|
|
2
|
+
|
|
3
|
+
export const basePropGenerator = ({
|
|
4
|
+
display,
|
|
5
|
+
margin,
|
|
6
|
+
marginTop,
|
|
7
|
+
marginBottom,
|
|
8
|
+
marginLeft,
|
|
9
|
+
marginRight,
|
|
10
|
+
m,
|
|
11
|
+
mt,
|
|
12
|
+
mb,
|
|
13
|
+
ml,
|
|
14
|
+
mr,
|
|
15
|
+
mx,
|
|
16
|
+
my,
|
|
17
|
+
padding,
|
|
18
|
+
paddingTop,
|
|
19
|
+
paddingBottom,
|
|
20
|
+
paddingLeft,
|
|
21
|
+
paddingRight,
|
|
22
|
+
p,
|
|
23
|
+
pt,
|
|
24
|
+
pb,
|
|
25
|
+
pr,
|
|
26
|
+
pl,
|
|
27
|
+
px,
|
|
28
|
+
py,
|
|
29
|
+
printHidden,
|
|
30
|
+
printVisible,
|
|
31
|
+
hidden,
|
|
32
|
+
xsUpHidden,
|
|
33
|
+
smUpHidden,
|
|
34
|
+
mdUpHidden,
|
|
35
|
+
lgUpHidden,
|
|
36
|
+
xlUpHidden,
|
|
37
|
+
xsHidden,
|
|
38
|
+
smHidden,
|
|
39
|
+
mdHidden,
|
|
40
|
+
lgHidden,
|
|
41
|
+
xlHidden,
|
|
42
|
+
className,
|
|
43
|
+
}) =>
|
|
44
|
+
clsx(className, {
|
|
45
|
+
[`ds-display-${display}`]: display !== undefined ? true : undefined,
|
|
46
|
+
[`ds-m-${margin}`]: margin !== undefined ? true : undefined,
|
|
47
|
+
[`ds-mt-${marginTop}`]: marginTop !== undefined ? true : undefined,
|
|
48
|
+
[`ds-mb-${marginBottom}`]: marginBottom !== undefined ? true : undefined,
|
|
49
|
+
[`ds-mr-${marginRight}`]: marginRight !== undefined ? true : undefined,
|
|
50
|
+
[`ds-ml-${marginLeft}`]: marginLeft !== undefined ? true : undefined,
|
|
51
|
+
[`ds-m-${m}`]: m !== undefined ? true : undefined,
|
|
52
|
+
[`ds-mt-${mt}`]: mt !== undefined ? true : undefined,
|
|
53
|
+
[`ds-mb-${mb}`]: mb !== undefined ? true : undefined,
|
|
54
|
+
[`ds-mr-${mr}`]: mr !== undefined ? true : undefined,
|
|
55
|
+
[`ds-ml-${ml}`]: ml !== undefined ? true : undefined,
|
|
56
|
+
[`ds-mx-${mx}`]: mx !== undefined ? true : undefined,
|
|
57
|
+
[`ds-my-${my}`]: my !== undefined ? true : undefined,
|
|
58
|
+
[`ds-p-${padding}`]: padding !== undefined ? true : undefined,
|
|
59
|
+
[`ds-pt-${paddingTop}`]: paddingTop !== undefined ? true : undefined,
|
|
60
|
+
[`ds-pb-${paddingBottom}`]: paddingBottom !== undefined ? true : undefined,
|
|
61
|
+
[`ds-pr-${paddingRight}`]: paddingRight !== undefined ? true : undefined,
|
|
62
|
+
[`ds-pl-${paddingLeft}`]: paddingLeft !== undefined ? true : undefined,
|
|
63
|
+
[`ds-p-${p}`]: p !== undefined ? true : undefined,
|
|
64
|
+
[`ds-pt-${pt}`]: pt !== undefined ? true : undefined,
|
|
65
|
+
[`ds-pb-${pb}`]: pb !== undefined ? true : undefined,
|
|
66
|
+
[`ds-pr-${pr}`]: pr !== undefined ? true : undefined,
|
|
67
|
+
[`ds-pl-${pl}`]: pl !== undefined ? true : undefined,
|
|
68
|
+
[`ds-px-${px}`]: px !== undefined ? true : undefined,
|
|
69
|
+
[`ds-py-${py}`]: py !== undefined ? true : undefined,
|
|
70
|
+
'ds-print-hidden': !!printHidden,
|
|
71
|
+
'ds-print-visible-block': printVisible === 'block',
|
|
72
|
+
'ds-print-visible-inline': printVisible === 'inline',
|
|
73
|
+
'ds-hidden': !!hidden,
|
|
74
|
+
'ds-hidden-xs-up': !!xsUpHidden,
|
|
75
|
+
'ds-hidden-sm-up': !!smUpHidden,
|
|
76
|
+
'ds-hidden-md-up': !!mdUpHidden,
|
|
77
|
+
'ds-hidden-lg-up': !!lgUpHidden,
|
|
78
|
+
'ds-hidden-xl-up': !!xlUpHidden,
|
|
79
|
+
'ds-hidden-xs': !!xsHidden,
|
|
80
|
+
'ds-hidden-sm': !!smHidden,
|
|
81
|
+
'ds-hidden-md': !!mdHidden,
|
|
82
|
+
'ds-hidden-lg': !!lgHidden,
|
|
83
|
+
'ds-hidden-xl': !!xlHidden,
|
|
84
|
+
});
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
import React, { useContext, useMemo, useState } from 'react';
|
|
2
|
+
import { View } from 'react-native';
|
|
3
|
+
|
|
4
|
+
interface WrapperContextType {
|
|
5
|
+
(cls: string): void;
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
const WrapperContext = React.createContext<WrapperContextType>(
|
|
9
|
+
(cls: string) => {
|
|
10
|
+
return cls;
|
|
11
|
+
}
|
|
12
|
+
);
|
|
13
|
+
|
|
14
|
+
const Wrapper = React.memo(({ children }: { children?: React.ReactNode }) => {
|
|
15
|
+
const [className, setClassName] = useState('');
|
|
16
|
+
return (
|
|
17
|
+
<WrapperContext.Provider value={setClassName}>
|
|
18
|
+
<View className={className} focusable={false}>
|
|
19
|
+
{children}
|
|
20
|
+
</View>
|
|
21
|
+
</WrapperContext.Provider>
|
|
22
|
+
);
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
interface WrappedComponentProps {
|
|
26
|
+
className?: string;
|
|
27
|
+
onBlur?: (e: unknown) => void;
|
|
28
|
+
onFocus?: (e: unknown) => void;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export const wrap = (Component: React.ElementType) => {
|
|
32
|
+
const WrappedComponent = React.forwardRef(function InnerComponent(
|
|
33
|
+
{ className, onBlur, onFocus, ...props }: WrappedComponentProps,
|
|
34
|
+
ref
|
|
35
|
+
) {
|
|
36
|
+
const setClassName = useContext(WrapperContext);
|
|
37
|
+
const wrapperClassNames: string[] = [];
|
|
38
|
+
const beforeClassNames: string[] = [];
|
|
39
|
+
const afterClassNames: string[] = [];
|
|
40
|
+
const focusedWrapperClassNames: string[] = [];
|
|
41
|
+
const classNames = useMemo(
|
|
42
|
+
() =>
|
|
43
|
+
(className?.split(' ') || []).filter((cls) => {
|
|
44
|
+
if (cls.endsWith('__wrapper')) {
|
|
45
|
+
wrapperClassNames.push(cls);
|
|
46
|
+
focusedWrapperClassNames.push(`${cls}--focus`);
|
|
47
|
+
return false;
|
|
48
|
+
} else if (cls.endsWith('__before')) {
|
|
49
|
+
beforeClassNames.push(cls);
|
|
50
|
+
return false;
|
|
51
|
+
} else if (cls.endsWith('__after')) {
|
|
52
|
+
afterClassNames.push(cls);
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
return true;
|
|
56
|
+
}),
|
|
57
|
+
[className]
|
|
58
|
+
);
|
|
59
|
+
return (
|
|
60
|
+
<>
|
|
61
|
+
{beforeClassNames.length ? (
|
|
62
|
+
<View focusable={false} className={beforeClassNames.join(' ')} />
|
|
63
|
+
) : (
|
|
64
|
+
''
|
|
65
|
+
)}
|
|
66
|
+
<Component
|
|
67
|
+
ref={ref}
|
|
68
|
+
onFocus={(e: unknown) => {
|
|
69
|
+
setClassName(focusedWrapperClassNames.join(' '));
|
|
70
|
+
onFocus && onFocus(e);
|
|
71
|
+
}}
|
|
72
|
+
onBlur={(e: unknown) => {
|
|
73
|
+
setClassName(wrapperClassNames.join(' '));
|
|
74
|
+
onBlur && onBlur(e);
|
|
75
|
+
}}
|
|
76
|
+
className={classNames.join(' ')}
|
|
77
|
+
{...props}
|
|
78
|
+
/>
|
|
79
|
+
{afterClassNames.length ? (
|
|
80
|
+
<View focusable={false} className={afterClassNames.join(' ')} />
|
|
81
|
+
) : (
|
|
82
|
+
''
|
|
83
|
+
)}
|
|
84
|
+
</>
|
|
85
|
+
);
|
|
86
|
+
});
|
|
87
|
+
return React.forwardRef(function Wrapped(props, ref) {
|
|
88
|
+
const children = useMemo(
|
|
89
|
+
() => <WrappedComponent {...props} ref={ref} />,
|
|
90
|
+
[]
|
|
91
|
+
);
|
|
92
|
+
return <Wrapper>{children}</Wrapper>;
|
|
93
|
+
});
|
|
94
|
+
};
|
|
@@ -3,7 +3,7 @@ import clsx from 'clsx';
|
|
|
3
3
|
import ButtonLink, { ButtonLinkProps } from '@digigov/react-core/ButtonLink';
|
|
4
4
|
import { ChevronIcon } from '@digigov/react-icons';
|
|
5
5
|
|
|
6
|
-
export interface CallToActionProps extends ButtonLinkProps {
|
|
6
|
+
export interface CallToActionProps extends ButtonLinkProps {}
|
|
7
7
|
/**
|
|
8
8
|
* Use this button for the main call to action on your service’s start page.
|
|
9
9
|
*/
|
|
@@ -24,7 +24,7 @@ export const CallToAction = React.forwardRef<
|
|
|
24
24
|
{...props}
|
|
25
25
|
>
|
|
26
26
|
{children}
|
|
27
|
-
<ChevronIcon />
|
|
27
|
+
<ChevronIcon className="ds-btn-cta__icon" />
|
|
28
28
|
</ButtonLink>
|
|
29
29
|
);
|
|
30
30
|
});
|
package/src/Card/index.tsx
CHANGED
|
@@ -71,13 +71,14 @@ export const Card = React.forwardRef<HTMLDivElement, CardProps>(function Card(
|
|
|
71
71
|
})}
|
|
72
72
|
{...props}
|
|
73
73
|
>
|
|
74
|
-
<
|
|
74
|
+
<Base
|
|
75
|
+
as="div"
|
|
75
76
|
className={clsx({
|
|
76
77
|
'ds-card__body': true,
|
|
77
78
|
})}
|
|
78
79
|
>
|
|
79
80
|
{children}
|
|
80
|
-
</
|
|
81
|
+
</Base>
|
|
81
82
|
</Base>
|
|
82
83
|
);
|
|
83
84
|
});
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import Base, { BaseProps } from '@digigov/react-core/Base';
|
|
4
4
|
import ChoiceDividerText from '@digigov/react-core/ChoiceDividerText';
|
|
5
|
+
import CheckboxItemInput from '@digigov/react-core/CheckboxItemInput';
|
|
5
6
|
import LabelContainer from '@digigov/react-core/LabelContainer';
|
|
6
7
|
|
|
7
8
|
export interface CheckboxItemProps extends BaseProps<'input'> {
|
|
@@ -27,7 +28,7 @@ export const CheckboxItem = React.forwardRef<
|
|
|
27
28
|
return (
|
|
28
29
|
<>
|
|
29
30
|
{dividerText && <ChoiceDividerText>{dividerText}</ChoiceDividerText>}
|
|
30
|
-
<div
|
|
31
|
+
<Base as='div'
|
|
31
32
|
className={clsx(className, {
|
|
32
33
|
'ds-checkboxes__item': true,
|
|
33
34
|
})}
|
|
@@ -39,20 +40,9 @@ export const CheckboxItem = React.forwardRef<
|
|
|
39
40
|
})}
|
|
40
41
|
>
|
|
41
42
|
{children}
|
|
42
|
-
<
|
|
43
|
-
as="input"
|
|
44
|
-
ref={ref}
|
|
45
|
-
type="checkbox"
|
|
46
|
-
name={name}
|
|
47
|
-
value={value}
|
|
48
|
-
className={clsx({
|
|
49
|
-
'ds-checkboxes__input': true,
|
|
50
|
-
})}
|
|
51
|
-
disabled={disabled}
|
|
52
|
-
{...props}
|
|
53
|
-
/>
|
|
43
|
+
<CheckboxItemInput ref={ref} name={name} value={value} disabled={disabled} {...props} />
|
|
54
44
|
</LabelContainer>
|
|
55
|
-
</
|
|
45
|
+
</Base>
|
|
56
46
|
</>
|
|
57
47
|
);
|
|
58
48
|
});
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import extend from '@digigov/react-core/utils/extend.native';
|
|
2
|
+
import CoreCheckboxItemInput from '@digigov/react-core/CheckboxItemInput/index.web';
|
|
3
|
+
import clsx from 'clsx';
|
|
4
|
+
|
|
5
|
+
export const CheckboxItemInput = extend(
|
|
6
|
+
CoreCheckboxItemInput,
|
|
7
|
+
({ className, ...props }) => {
|
|
8
|
+
return {
|
|
9
|
+
...props,
|
|
10
|
+
className: clsx(className, {
|
|
11
|
+
'ds-checkboxes__input__wrapper': true,
|
|
12
|
+
}),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
);
|
|
16
|
+
|
|
17
|
+
export default CheckboxItemInput;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import clsx from 'clsx';
|
|
3
|
+
import Base, { BaseProps } from '@digigov/react-core/Base';
|
|
4
|
+
|
|
5
|
+
export interface CheckboxItemInputProps extends BaseProps<'input'> { }
|
|
6
|
+
/**
|
|
7
|
+
* Details for the CheckboxItem.
|
|
8
|
+
* CheckboxItemInput component is the input component for CheckboxItem.
|
|
9
|
+
*/
|
|
10
|
+
export const CheckboxItemInput = React.forwardRef<
|
|
11
|
+
HTMLInputElement,
|
|
12
|
+
CheckboxItemInputProps
|
|
13
|
+
>(function CheckboxItemInput(
|
|
14
|
+
{ name, value, className, disabled, children, ...props },
|
|
15
|
+
ref
|
|
16
|
+
) {
|
|
17
|
+
return (
|
|
18
|
+
<Base
|
|
19
|
+
as="input"
|
|
20
|
+
ref={ref}
|
|
21
|
+
type="checkbox"
|
|
22
|
+
name={name}
|
|
23
|
+
value={value}
|
|
24
|
+
className={clsx({
|
|
25
|
+
'ds-checkboxes__input': true,
|
|
26
|
+
})}
|
|
27
|
+
disabled={disabled}
|
|
28
|
+
{...props}
|
|
29
|
+
/>
|
|
30
|
+
|
|
31
|
+
);
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export default CheckboxItemInput;
|
package/src/Chip/index.tsx
CHANGED
|
@@ -28,7 +28,7 @@ export const Chip = React.forwardRef<HTMLLIElement, ChipProps>(function Chip(
|
|
|
28
28
|
{...props}
|
|
29
29
|
onClick={onClick}
|
|
30
30
|
>
|
|
31
|
-
<div
|
|
31
|
+
<Base as='div'
|
|
32
32
|
role={onClick && 'button'}
|
|
33
33
|
tabIndex={onClick && 0}
|
|
34
34
|
className="ds-chip__content"
|
|
@@ -42,7 +42,7 @@ export const Chip = React.forwardRef<HTMLLIElement, ChipProps>(function Chip(
|
|
|
42
42
|
}}
|
|
43
43
|
/>
|
|
44
44
|
)}
|
|
45
|
-
</
|
|
45
|
+
</Base>
|
|
46
46
|
</Base>
|
|
47
47
|
);
|
|
48
48
|
});
|
|
@@ -2,34 +2,21 @@ import React from 'react';
|
|
|
2
2
|
import clsx from 'clsx';
|
|
3
3
|
import Base, { BaseProps } from '@digigov/react-core/Base';
|
|
4
4
|
|
|
5
|
-
export interface CodeBlockContainerProps extends BaseProps<'div'> {
|
|
6
|
-
/**
|
|
7
|
-
* wrapLines prop is optional.
|
|
8
|
-
* wrapLines prop is used to wrap the lines horizontally over the container.
|
|
9
|
-
* @value true is used to activate the wrapLines styles.
|
|
10
|
-
* @value false is used to deactivate the wrapLines styles.
|
|
11
|
-
* @default false
|
|
12
|
-
*/
|
|
13
|
-
wrapLines?: true | false;
|
|
14
|
-
}
|
|
5
|
+
export interface CodeBlockContainerProps extends BaseProps<'div'> { }
|
|
15
6
|
/**
|
|
16
|
-
* CodeBlockContainer
|
|
7
|
+
* CodeBlockContainer is a component for displaying code.
|
|
17
8
|
*
|
|
18
9
|
*/
|
|
19
10
|
export const CodeBlockContainer = React.forwardRef<
|
|
20
11
|
HTMLDivElement,
|
|
21
12
|
CodeBlockContainerProps
|
|
22
|
-
>(function CodeBlockContainer(
|
|
23
|
-
{ className, wrapLines = false, children, ...props },
|
|
24
|
-
ref
|
|
25
|
-
) {
|
|
13
|
+
>(function CodeBlockContainer({ className, children, ...props }, ref) {
|
|
26
14
|
return (
|
|
27
15
|
<Base
|
|
28
16
|
as="div"
|
|
29
17
|
ref={ref}
|
|
30
18
|
className={clsx(className, {
|
|
31
19
|
'ds-code-block__container': true,
|
|
32
|
-
'ds-code-block__container--wrap-lines': wrapLines,
|
|
33
20
|
})}
|
|
34
21
|
{...props}
|
|
35
22
|
>
|
|
@@ -4,7 +4,7 @@ import Base, { BaseProps } from '@digigov/react-core/Base';
|
|
|
4
4
|
|
|
5
5
|
export interface CodeBlockContentProps extends BaseProps<'pre'> { }
|
|
6
6
|
/**
|
|
7
|
-
* CodeBlockContent can be used as content inside the CodeBlockContainer
|
|
7
|
+
* CodeBlockContent can be used as content inside the CodeBlockContainer.
|
|
8
8
|
*
|
|
9
9
|
*/
|
|
10
10
|
export const CodeBlockContent = React.forwardRef<
|
|
@@ -12,14 +12,15 @@ export const CodeBlockContent = React.forwardRef<
|
|
|
12
12
|
CodeBlockContentProps
|
|
13
13
|
>(function CodeBlockContent({ className, children, ...props }, ref) {
|
|
14
14
|
return (
|
|
15
|
-
<Base as="pre" ref={ref} className={
|
|
16
|
-
<
|
|
15
|
+
<Base as="pre" ref={ref} className={className} {...props}>
|
|
16
|
+
<Base
|
|
17
|
+
as="code"
|
|
17
18
|
className={clsx({
|
|
18
19
|
'ds-code-block__content': true,
|
|
19
20
|
})}
|
|
20
21
|
>
|
|
21
22
|
{children}
|
|
22
|
-
</
|
|
23
|
+
</Base>
|
|
23
24
|
</Base>
|
|
24
25
|
);
|
|
25
26
|
});
|