@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,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TouchableOpacity, View } from "react-native";
|
|
3
|
+
const CheckboxInput = React.forwardRef(function CheckboxInput2({ checked, value, onChange, ...props }, ref) {
|
|
4
|
+
const handlePress = () => {
|
|
5
|
+
if (onChange) {
|
|
6
|
+
const syntheticEvent = {
|
|
7
|
+
currentTarget: {
|
|
8
|
+
value,
|
|
9
|
+
checked: !checked
|
|
10
|
+
}
|
|
11
|
+
};
|
|
12
|
+
onChange(syntheticEvent);
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
return (
|
|
16
|
+
// @ts-ignore
|
|
17
|
+
/* @__PURE__ */ React.createElement(
|
|
18
|
+
TouchableOpacity,
|
|
19
|
+
{
|
|
20
|
+
ref,
|
|
21
|
+
onPress: handlePress,
|
|
22
|
+
...props
|
|
23
|
+
},
|
|
24
|
+
checked && /* @__PURE__ */ React.createElement(View, { className: "ds-checkboxes__input--checked" })
|
|
25
|
+
)
|
|
26
|
+
);
|
|
27
|
+
});
|
|
28
|
+
var CheckboxInput_native_default = CheckboxInput;
|
|
29
|
+
export {
|
|
30
|
+
CheckboxInput,
|
|
31
|
+
CheckboxInput_native_default as default
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=CheckboxInput.native.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React, { DetailedHTMLProps, InputHTMLAttributes } from 'react';
|
|
2
|
+
export type CheckboxInputProps = Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, 'ref'>;
|
|
3
|
+
export declare const CheckboxInput: React.ForwardRefExoticComponent<CheckboxInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
4
|
+
export default CheckboxInput;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/Base/compat/Input/CheckboxInput.native.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, {\n DetailedHTMLProps,\n InputHTMLAttributes,\n LegacyRef,\n} from 'react';\nimport { TouchableOpacity, View } from 'react-native';\n\nexport type CheckboxInputProps = Omit<\n DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>,\n 'ref'\n>;\n\nexport const CheckboxInput = React.forwardRef<\n HTMLInputElement,\n CheckboxInputProps\n>(function CheckboxInput({ checked, value, onChange, ...props }, ref) {\n const handlePress = () => {\n if (onChange) {\n const syntheticEvent = {\n currentTarget: {\n value,\n checked: !checked,\n },\n } as React.ChangeEvent<HTMLInputElement>;\n onChange(syntheticEvent);\n }\n };\n return (\n // @ts-ignore\n <TouchableOpacity\n ref={ref as LegacyRef<TouchableOpacity>}\n onPress={handlePress}\n {...props}\n >\n {checked && <View className=\"ds-checkboxes__input--checked\" />}\n </TouchableOpacity>\n );\n});\n\nexport default CheckboxInput;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAIA;AACP,SAAS,kBAAkB,YAAY;AAOhC,MAAM,gBAAgB,MAAM,WAGjC,SAASA,eAAc,EAAE,SAAS,OAAO,UAAU,GAAG,MAAM,GAAG,KAAK;AACpE,QAAM,cAAc,MAAM;AACxB,QAAI,UAAU;AACZ,YAAM,iBAAiB;AAAA,QACrB,eAAe;AAAA,UACb;AAAA,UACA,SAAS,CAAC;AAAA,QACZ;AAAA,MACF;AACA,eAAS,cAAc;AAAA,IACzB;AAAA,EACF;AACA;AAAA;AAAA,IAEE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,SAAS;AAAA,QACR,GAAG;AAAA;AAAA,MAEH,WAAW,oCAAC,QAAK,WAAU,iCAAgC;AAAA,IAC9D;AAAA;AAEJ,CAAC;AAED,IAAO,+BAAQ;",
|
|
6
|
+
"names": ["CheckboxInput"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { TouchableOpacity, View } from "react-native";
|
|
3
|
+
const RadioInput = React.forwardRef(
|
|
4
|
+
function RadioInput2({ value, checked, onChange, ...props }, ref) {
|
|
5
|
+
const handlePress = () => {
|
|
6
|
+
if (onChange) {
|
|
7
|
+
const syntheticEvent = {
|
|
8
|
+
target: {
|
|
9
|
+
value,
|
|
10
|
+
checked: true
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
onChange(syntheticEvent);
|
|
14
|
+
}
|
|
15
|
+
};
|
|
16
|
+
return /* @__PURE__ */ React.createElement(
|
|
17
|
+
TouchableOpacity,
|
|
18
|
+
{
|
|
19
|
+
ref,
|
|
20
|
+
onPress: handlePress,
|
|
21
|
+
...props
|
|
22
|
+
},
|
|
23
|
+
checked && /* @__PURE__ */ React.createElement(View, { className: "ds-radios__input--checked" })
|
|
24
|
+
);
|
|
25
|
+
}
|
|
26
|
+
);
|
|
27
|
+
var RadioInput_native_default = RadioInput;
|
|
28
|
+
export {
|
|
29
|
+
RadioInput,
|
|
30
|
+
RadioInput_native_default as default
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=RadioInput.native.js.map
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import React, { DetailedHTMLProps, InputHTMLAttributes } from 'react';
|
|
2
|
+
export type RadioInputProps = Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, 'ref'>;
|
|
3
|
+
export declare const RadioInput: React.ForwardRefExoticComponent<RadioInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
4
|
+
export default RadioInput;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/Base/compat/Input/RadioInput.native.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, {\n DetailedHTMLProps,\n InputHTMLAttributes,\n LegacyRef,\n} from 'react';\nimport { TouchableOpacity, View } from 'react-native';\n\nexport type RadioInputProps = Omit<\n DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>,\n 'ref'\n>;\n\nexport const RadioInput = React.forwardRef<HTMLInputElement, RadioInputProps>(\n function RadioInput({ value, checked, onChange, ...props }, ref) {\n const handlePress = () => {\n if (onChange) {\n const syntheticEvent = {\n target: {\n value: value,\n checked: true,\n },\n } as React.ChangeEvent<HTMLInputElement>;\n onChange(syntheticEvent);\n }\n };\n\n return (\n <TouchableOpacity\n ref={ref as LegacyRef<typeof TouchableOpacity>}\n onPress={handlePress}\n {...(props as any)}\n >\n {checked && <View className=\"ds-radios__input--checked\" />}\n </TouchableOpacity>\n );\n }\n);\n\nexport default RadioInput;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAIA;AACP,SAAS,kBAAkB,YAAY;AAOhC,MAAM,aAAa,MAAM;AAAA,EAC9B,SAASA,YAAW,EAAE,OAAO,SAAS,UAAU,GAAG,MAAM,GAAG,KAAK;AAC/D,UAAM,cAAc,MAAM;AACxB,UAAI,UAAU;AACZ,cAAM,iBAAiB;AAAA,UACrB,QAAQ;AAAA,YACN;AAAA,YACA,SAAS;AAAA,UACX;AAAA,QACF;AACA,iBAAS,cAAc;AAAA,MACzB;AAAA,IACF;AAEA,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,SAAS;AAAA,QACR,GAAI;AAAA;AAAA,MAEJ,WAAW,oCAAC,QAAK,WAAU,6BAA4B;AAAA,IAC1D;AAAA,EAEJ;AACF;AAEA,IAAO,4BAAQ;",
|
|
6
|
+
"names": ["RadioInput"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useEffect,
|
|
3
|
+
useMemo
|
|
4
|
+
} from "react";
|
|
5
|
+
import { TextInput } from "react-native";
|
|
6
|
+
const StringInput = React.forwardRef(
|
|
7
|
+
function StringInput2({
|
|
8
|
+
"data-type": dataType,
|
|
9
|
+
onChange,
|
|
10
|
+
onBlur,
|
|
11
|
+
onFocus,
|
|
12
|
+
value,
|
|
13
|
+
maxLength,
|
|
14
|
+
multiline,
|
|
15
|
+
rows,
|
|
16
|
+
disabled,
|
|
17
|
+
...props
|
|
18
|
+
}, ref) {
|
|
19
|
+
const [currentValue, setValue] = React.useState(value);
|
|
20
|
+
const keyboardType = useMemo(() => {
|
|
21
|
+
switch (dataType) {
|
|
22
|
+
case "afm":
|
|
23
|
+
return "number-pad";
|
|
24
|
+
case "phone_number":
|
|
25
|
+
return "phone-pad";
|
|
26
|
+
case "mobile_phone":
|
|
27
|
+
return "phone-pad";
|
|
28
|
+
case "postal_code":
|
|
29
|
+
return "number-pad";
|
|
30
|
+
case "int":
|
|
31
|
+
return "numeric";
|
|
32
|
+
case "email":
|
|
33
|
+
return "email-address";
|
|
34
|
+
default:
|
|
35
|
+
return "default";
|
|
36
|
+
}
|
|
37
|
+
}, [dataType]);
|
|
38
|
+
useEffect(() => {
|
|
39
|
+
if (currentValue !== value) {
|
|
40
|
+
handleChange();
|
|
41
|
+
}
|
|
42
|
+
}, [currentValue]);
|
|
43
|
+
useEffect(() => {
|
|
44
|
+
if (currentValue !== value) {
|
|
45
|
+
setValue(value);
|
|
46
|
+
}
|
|
47
|
+
}, [value]);
|
|
48
|
+
const handleChange = () => {
|
|
49
|
+
if (onChange) {
|
|
50
|
+
const syntheticEvent = {
|
|
51
|
+
target: {
|
|
52
|
+
value: currentValue
|
|
53
|
+
}
|
|
54
|
+
};
|
|
55
|
+
onChange(syntheticEvent);
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
const handleBlur = () => {
|
|
59
|
+
if (onBlur) {
|
|
60
|
+
const syntheticEvent = {
|
|
61
|
+
target: {
|
|
62
|
+
value: currentValue
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
onBlur(syntheticEvent);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const handleFocus = () => {
|
|
69
|
+
if (onFocus) {
|
|
70
|
+
const syntheticEvent = {
|
|
71
|
+
target: {
|
|
72
|
+
value: currentValue
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
onFocus(syntheticEvent);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
return /* @__PURE__ */ React.createElement(
|
|
79
|
+
TextInput,
|
|
80
|
+
{
|
|
81
|
+
ref,
|
|
82
|
+
onChangeText: setValue,
|
|
83
|
+
onBlur: handleBlur,
|
|
84
|
+
onFocus: handleFocus,
|
|
85
|
+
value: currentValue,
|
|
86
|
+
multiline,
|
|
87
|
+
rows,
|
|
88
|
+
editable: !disabled,
|
|
89
|
+
maxLength: Number(maxLength) || void 0,
|
|
90
|
+
keyboardType,
|
|
91
|
+
...props
|
|
92
|
+
}
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
);
|
|
96
|
+
export {
|
|
97
|
+
StringInput
|
|
98
|
+
};
|
|
99
|
+
//# sourceMappingURL=StringInput.native.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React, { DetailedHTMLProps, InputHTMLAttributes } from 'react';
|
|
2
|
+
export interface StringInputProps extends Omit<DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, 'ref'> {
|
|
3
|
+
'data-type'?: string;
|
|
4
|
+
multiline?: boolean;
|
|
5
|
+
rows?: number;
|
|
6
|
+
}
|
|
7
|
+
export declare const StringInput: React.ForwardRefExoticComponent<StringInputProps & React.RefAttributes<HTMLInputElement>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/Base/compat/Input/StringInput.native.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, {\n DetailedHTMLProps,\n InputHTMLAttributes,\n useEffect,\n useMemo,\n} from 'react';\nimport { TextInput } from 'react-native';\n\nexport interface StringInputProps\n extends Omit<\n DetailedHTMLProps<InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>,\n 'ref'\n > {\n 'data-type'?: string;\n multiline?: boolean;\n rows?: number;\n}\n\nexport const StringInput = React.forwardRef<HTMLInputElement, StringInputProps>(\n function StringInput(\n {\n 'data-type': dataType,\n onChange,\n onBlur,\n onFocus,\n value,\n maxLength,\n multiline,\n rows,\n disabled,\n ...props\n }: StringInputProps,\n ref\n ) {\n const [currentValue, setValue] = React.useState(value);\n\n const keyboardType = useMemo(() => {\n switch (dataType) {\n case 'afm':\n return 'number-pad';\n case 'phone_number':\n return 'phone-pad';\n case 'mobile_phone':\n return 'phone-pad';\n case 'postal_code':\n return 'number-pad';\n case 'int':\n return 'numeric';\n case 'email':\n return 'email-address';\n default:\n return 'default';\n }\n }, [dataType]);\n\n useEffect(() => {\n if (currentValue !== value) {\n handleChange();\n }\n }, [currentValue]);\n useEffect(() => {\n if (currentValue !== value) {\n setValue(value);\n }\n }, [value]);\n\n const handleChange = () => {\n if (onChange) {\n const syntheticEvent = {\n target: {\n value: currentValue,\n },\n } as React.ChangeEvent<HTMLInputElement>;\n onChange(syntheticEvent);\n }\n };\n\n const handleBlur = () => {\n if (onBlur) {\n const syntheticEvent = {\n target: {\n value: currentValue,\n },\n } as React.FocusEvent<HTMLInputElement>;\n onBlur(syntheticEvent);\n }\n };\n\n const handleFocus = () => {\n if (onFocus) {\n const syntheticEvent = {\n target: {\n value: currentValue,\n },\n } as React.FocusEvent<HTMLInputElement>;\n onFocus(syntheticEvent);\n }\n };\n return (\n <TextInput\n ref={ref}\n onChangeText={setValue}\n onBlur={handleBlur}\n onFocus={handleFocus}\n value={currentValue}\n multiline={multiline}\n rows={rows}\n editable={!disabled}\n maxLength={Number(maxLength) || undefined}\n keyboardType={keyboardType}\n {...(props as any)}\n />\n );\n }\n);\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO;AAAA,EAGL;AAAA,EACA;AAAA,OACK;AACP,SAAS,iBAAiB;AAYnB,MAAM,cAAc,MAAM;AAAA,EAC/B,SAASA,aACP;AAAA,IACE,aAAa;AAAA,IACb;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GACA,KACA;AACA,UAAM,CAAC,cAAc,QAAQ,IAAI,MAAM,SAAS,KAAK;AAErD,UAAM,eAAe,QAAQ,MAAM;AACjC,cAAQ,UAAU;AAAA,QAChB,KAAK;AACH,iBAAO;AAAA,QACT,KAAK;AACH,iBAAO;AAAA,QACT,KAAK;AACH,iBAAO;AAAA,QACT,KAAK;AACH,iBAAO;AAAA,QACT,KAAK;AACH,iBAAO;AAAA,QACT,KAAK;AACH,iBAAO;AAAA,QACT;AACE,iBAAO;AAAA,MACX;AAAA,IACF,GAAG,CAAC,QAAQ,CAAC;AAEb,cAAU,MAAM;AACd,UAAI,iBAAiB,OAAO;AAC1B,qBAAa;AAAA,MACf;AAAA,IACF,GAAG,CAAC,YAAY,CAAC;AACjB,cAAU,MAAM;AACd,UAAI,iBAAiB,OAAO;AAC1B,iBAAS,KAAK;AAAA,MAChB;AAAA,IACF,GAAG,CAAC,KAAK,CAAC;AAEV,UAAM,eAAe,MAAM;AACzB,UAAI,UAAU;AACZ,cAAM,iBAAiB;AAAA,UACrB,QAAQ;AAAA,YACN,OAAO;AAAA,UACT;AAAA,QACF;AACA,iBAAS,cAAc;AAAA,MACzB;AAAA,IACF;AAEA,UAAM,aAAa,MAAM;AACvB,UAAI,QAAQ;AACV,cAAM,iBAAiB;AAAA,UACrB,QAAQ;AAAA,YACN,OAAO;AAAA,UACT;AAAA,QACF;AACA,eAAO,cAAc;AAAA,MACvB;AAAA,IACF;AAEA,UAAM,cAAc,MAAM;AACxB,UAAI,SAAS;AACX,cAAM,iBAAiB;AAAA,UACrB,QAAQ;AAAA,YACN,OAAO;AAAA,UACT;AAAA,QACF;AACA,gBAAQ,cAAc;AAAA,MACxB;AAAA,IACF;AACA,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACA,cAAc;AAAA,QACd,QAAQ;AAAA,QACR,SAAS;AAAA,QACT,OAAO;AAAA,QACP;AAAA,QACA;AAAA,QACA,UAAU,CAAC;AAAA,QACX,WAAW,OAAO,SAAS,KAAK;AAAA,QAChC;AAAA,QACC,GAAI;AAAA;AAAA,IACP;AAAA,EAEJ;AACF;",
|
|
6
|
+
"names": ["StringInput"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import CheckboxInput from "@digigov/react-core/Base/compat/Input/CheckboxInput.native";
|
|
3
|
+
import RadioInput from "@digigov/react-core/Base/compat/Input/RadioInput.native";
|
|
4
|
+
import {
|
|
5
|
+
StringInput
|
|
6
|
+
} from "@digigov/react-core/Base/compat/Input/StringInput.native";
|
|
7
|
+
const BaseInput = React.forwardRef(
|
|
8
|
+
function BaseInput2(props, ref) {
|
|
9
|
+
switch (props.type) {
|
|
10
|
+
case "radio":
|
|
11
|
+
return /* @__PURE__ */ React.createElement(RadioInput, { ref, ...props });
|
|
12
|
+
case "checkbox":
|
|
13
|
+
return /* @__PURE__ */ React.createElement(CheckboxInput, { ref, ...props });
|
|
14
|
+
default:
|
|
15
|
+
return /* @__PURE__ */ React.createElement(StringInput, { ref, ...props });
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
);
|
|
19
|
+
var index_native_default = BaseInput;
|
|
20
|
+
export {
|
|
21
|
+
BaseInput,
|
|
22
|
+
index_native_default as default
|
|
23
|
+
};
|
|
24
|
+
//# sourceMappingURL=index.native.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { CheckboxInputProps } from '@digigov/react-core/Base/compat/Input/CheckboxInput.native';
|
|
3
|
+
import { RadioInputProps } from '@digigov/react-core/Base/compat/Input/RadioInput.native';
|
|
4
|
+
import { StringInputProps } from '@digigov/react-core/Base/compat/Input/StringInput.native';
|
|
5
|
+
type InputProps = RadioInputProps | CheckboxInputProps | StringInputProps;
|
|
6
|
+
export declare const BaseInput: React.ForwardRefExoticComponent<InputProps & React.RefAttributes<HTMLInputElement>>;
|
|
7
|
+
export default BaseInput;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../../src/Base/compat/Input/index.native.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport CheckboxInput, {\n CheckboxInputProps,\n} from '@digigov/react-core/Base/compat/Input/CheckboxInput.native';\nimport RadioInput, {\n RadioInputProps,\n} from '@digigov/react-core/Base/compat/Input/RadioInput.native';\nimport {\n StringInput,\n StringInputProps,\n} from '@digigov/react-core/Base/compat/Input/StringInput.native';\n\ntype InputProps = RadioInputProps | CheckboxInputProps | StringInputProps;\n\nexport const BaseInput = React.forwardRef<HTMLInputElement, InputProps>(\n function BaseInput(props, ref) {\n switch (props.type) {\n case 'radio':\n return <RadioInput ref={ref} {...props} />;\n case 'checkbox':\n return <CheckboxInput ref={ref} {...props} />;\n default:\n return <StringInput ref={ref} {...props} />;\n }\n }\n);\n\nexport default BaseInput;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAClB,OAAO,mBAEA;AACP,OAAO,gBAEA;AACP;AAAA,EACE;AAAA,OAEK;AAIA,MAAM,YAAY,MAAM;AAAA,EAC7B,SAASA,WAAU,OAAO,KAAK;AAC7B,YAAQ,MAAM,MAAM;AAAA,MAClB,KAAK;AACH,eAAO,oCAAC,cAAW,KAAW,GAAG,OAAO;AAAA,MAC1C,KAAK;AACH,eAAO,oCAAC,iBAAc,KAAW,GAAG,OAAO;AAAA,MAC7C;AACE,eAAO,oCAAC,eAAY,KAAW,GAAG,OAAO;AAAA,IAC7C;AAAA,EACF;AACF;AAEA,IAAO,uBAAQ;",
|
|
6
|
+
"names": ["BaseInput"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useContext
|
|
3
|
+
} from "react";
|
|
4
|
+
import { Pressable } from "react-native";
|
|
5
|
+
import { FormContext } from "@digigov/form/FormContext";
|
|
6
|
+
const FormButton = React.forwardRef(
|
|
7
|
+
function FormButton2({ onClick, ...props }, ref) {
|
|
8
|
+
const formContext = useContext(FormContext);
|
|
9
|
+
return /* @__PURE__ */ React.createElement(
|
|
10
|
+
CompatButton,
|
|
11
|
+
{
|
|
12
|
+
ref,
|
|
13
|
+
...props,
|
|
14
|
+
onClick: () => {
|
|
15
|
+
onClick && onClick({});
|
|
16
|
+
if (props.type) formContext?.[props.type]();
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
);
|
|
22
|
+
const CompatButton = React.forwardRef(
|
|
23
|
+
function CompatButton2({ onClick, ...props }, ref) {
|
|
24
|
+
return /* @__PURE__ */ React.createElement(
|
|
25
|
+
Pressable,
|
|
26
|
+
{
|
|
27
|
+
onPress: onClick,
|
|
28
|
+
ref,
|
|
29
|
+
hitSlop: 10,
|
|
30
|
+
...props
|
|
31
|
+
}
|
|
32
|
+
);
|
|
33
|
+
}
|
|
34
|
+
);
|
|
35
|
+
const Button = React.forwardRef(
|
|
36
|
+
function Button2(props, ref) {
|
|
37
|
+
if (props.type && ["submit", "reset"].includes(props.type)) {
|
|
38
|
+
return /* @__PURE__ */ React.createElement(FormButton, { ref, ...props });
|
|
39
|
+
}
|
|
40
|
+
return /* @__PURE__ */ React.createElement(CompatButton, { ref, ...props });
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
export {
|
|
44
|
+
Button,
|
|
45
|
+
CompatButton,
|
|
46
|
+
FormButton
|
|
47
|
+
};
|
|
48
|
+
//# sourceMappingURL=button.native.js.map
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import React, { ButtonHTMLAttributes, DetailedHTMLProps } from 'react';
|
|
2
|
+
export type ButtonProps = Omit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, 'ref'>;
|
|
3
|
+
export declare const FormButton: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<unknown>>;
|
|
4
|
+
export declare const CompatButton: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<unknown>>;
|
|
5
|
+
export declare const Button: React.ForwardRefExoticComponent<ButtonProps & React.RefAttributes<unknown>>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/Base/compat/button.native.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, {\n ButtonHTMLAttributes,\n DetailedHTMLProps,\n useContext,\n} from 'react';\nimport { Pressable } from 'react-native';\n// @ts-expect-error - `@digigov/form` is to be removed as a dependency\nimport { FormContext } from '@digigov/form/FormContext';\n\n// TODO: Fix `ButtonProps` type\nexport type ButtonProps = Omit<\n DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>,\n 'ref'\n>;\n\nexport const FormButton = React.forwardRef<unknown, ButtonProps>(\n function FormButton({ onClick, ...props }, ref) {\n const formContext = useContext(FormContext);\n return (\n <CompatButton\n ref={ref}\n {...props}\n onClick={() => {\n onClick && onClick({} as React.MouseEvent<HTMLButtonElement>);\n if (props.type) formContext?.[props.type]();\n }}\n />\n );\n }\n);\n\n// TODO: Fix `ref` type\nexport const CompatButton = React.forwardRef<unknown, ButtonProps>(\n function CompatButton({ onClick, ...props }, ref) {\n return (\n <Pressable\n onPress={onClick as any}\n ref={ref as any}\n hitSlop={10}\n {...(props as any)}\n />\n );\n }\n);\n\nexport const Button = React.forwardRef<unknown, ButtonProps>(\n function Button(props, ref) {\n if (props.type && ['submit', 'reset'].includes(props.type)) {\n return <FormButton ref={ref} {...props} />;\n }\n return <CompatButton ref={ref} {...props} />;\n }\n);\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO;AAAA,EAGL;AAAA,OACK;AACP,SAAS,iBAAiB;AAE1B,SAAS,mBAAmB;AAQrB,MAAM,aAAa,MAAM;AAAA,EAC9B,SAASA,YAAW,EAAE,SAAS,GAAG,MAAM,GAAG,KAAK;AAC9C,UAAM,cAAc,WAAW,WAAW;AAC1C,WACE;AAAA,MAAC;AAAA;AAAA,QACC;AAAA,QACC,GAAG;AAAA,QACJ,SAAS,MAAM;AACb,qBAAW,QAAQ,CAAC,CAAwC;AAC5D,cAAI,MAAM,KAAM,eAAc,MAAM,IAAI,EAAE;AAAA,QAC5C;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAGO,MAAM,eAAe,MAAM;AAAA,EAChC,SAASC,cAAa,EAAE,SAAS,GAAG,MAAM,GAAG,KAAK;AAChD,WACE;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT;AAAA,QACA,SAAS;AAAA,QACR,GAAI;AAAA;AAAA,IACP;AAAA,EAEJ;AACF;AAEO,MAAM,SAAS,MAAM;AAAA,EAC1B,SAASC,QAAO,OAAO,KAAK;AAC1B,QAAI,MAAM,QAAQ,CAAC,UAAU,OAAO,EAAE,SAAS,MAAM,IAAI,GAAG;AAC1D,aAAO,oCAAC,cAAW,KAAW,GAAG,OAAO;AAAA,IAC1C;AACA,WAAO,oCAAC,gBAAa,KAAW,GAAG,OAAO;AAAA,EAC5C;AACF;",
|
|
6
|
+
"names": ["FormButton", "CompatButton", "Button"]
|
|
7
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React, {
|
|
2
|
+
useEffect,
|
|
3
|
+
useState,
|
|
4
|
+
Children
|
|
5
|
+
} from "react";
|
|
6
|
+
import { View, Text, TouchableOpacity, StyleSheet } from "react-native";
|
|
7
|
+
const CompatDetails = ({
|
|
8
|
+
children,
|
|
9
|
+
open = false,
|
|
10
|
+
placement,
|
|
11
|
+
closeIcon,
|
|
12
|
+
openIcon,
|
|
13
|
+
...props
|
|
14
|
+
}) => {
|
|
15
|
+
const [isExpanded, setIsExpanded] = useState(open);
|
|
16
|
+
useEffect(() => {
|
|
17
|
+
setIsExpanded(open);
|
|
18
|
+
}, [open]);
|
|
19
|
+
const toggleExpand = () => {
|
|
20
|
+
setIsExpanded(!isExpanded);
|
|
21
|
+
};
|
|
22
|
+
const [summaryContent, ...detailsContent] = Children.toArray(children);
|
|
23
|
+
const toggleIcon = closeIcon && openIcon ? /* @__PURE__ */ React.createElement(Text, null, isExpanded ? openIcon : closeIcon) : null;
|
|
24
|
+
return (
|
|
25
|
+
// TODO: Fix `props` type
|
|
26
|
+
// @ts-expect-error - `props` type is not compatible with `View` props
|
|
27
|
+
/* @__PURE__ */ React.createElement(View, { ...props }, /* @__PURE__ */ React.createElement(TouchableOpacity, { onPress: toggleExpand, style: styles.summaryContainer }, placement === "before" && toggleIcon, summaryContent, placement === "after" && toggleIcon), isExpanded && /* @__PURE__ */ React.createElement(View, null, detailsContent))
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
const styles = StyleSheet.create({
|
|
31
|
+
summaryContainer: {
|
|
32
|
+
flexDirection: "row",
|
|
33
|
+
alignItems: "center"
|
|
34
|
+
}
|
|
35
|
+
});
|
|
36
|
+
var details_native_default = CompatDetails;
|
|
37
|
+
export {
|
|
38
|
+
details_native_default as default
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=details.native.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import React, { DetailedHTMLProps, DetailsHTMLAttributes } from 'react';
|
|
2
|
+
type HTMLElementProps = Omit<DetailedHTMLProps<DetailsHTMLAttributes<HTMLDetailsElement>, HTMLDetailsElement>, 'ref'> & {
|
|
3
|
+
closeIcon?: string;
|
|
4
|
+
openIcon?: string;
|
|
5
|
+
placement?: 'before' | 'after';
|
|
6
|
+
};
|
|
7
|
+
declare const CompatDetails: ({ children, open, placement, closeIcon, openIcon, ...props }: HTMLElementProps) => React.JSX.Element;
|
|
8
|
+
export default CompatDetails;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/Base/compat/details.native.tsx"],
|
|
4
|
+
"sourcesContent": ["import React, {\n useEffect,\n useState,\n Children,\n DetailedHTMLProps,\n DetailsHTMLAttributes,\n} from 'react';\nimport { View, Text, TouchableOpacity, StyleSheet } from 'react-native';\n\ntype HTMLElementProps = Omit<\n DetailedHTMLProps<\n DetailsHTMLAttributes<HTMLDetailsElement>,\n HTMLDetailsElement\n >,\n 'ref'\n> & {\n closeIcon?: string;\n openIcon?: string;\n placement?: 'before' | 'after';\n};\n\nconst CompatDetails = ({\n children,\n open = false,\n placement,\n closeIcon,\n openIcon,\n ...props\n}: HTMLElementProps) => {\n const [isExpanded, setIsExpanded] = useState(open);\n\n useEffect(() => {\n setIsExpanded(open);\n }, [open]);\n\n const toggleExpand = () => {\n setIsExpanded(!isExpanded);\n };\n\n const [summaryContent, ...detailsContent] = Children.toArray(children);\n\n const toggleIcon =\n closeIcon && openIcon ? (\n <Text>{isExpanded ? openIcon : closeIcon}</Text>\n ) : null;\n\n return (\n // TODO: Fix `props` type\n // @ts-expect-error - `props` type is not compatible with `View` props\n <View {...props}>\n <TouchableOpacity onPress={toggleExpand} style={styles.summaryContainer}>\n {placement === 'before' && toggleIcon}\n {summaryContent}\n {placement === 'after' && toggleIcon}\n </TouchableOpacity>\n {isExpanded && <View>{detailsContent}</View>}\n </View>\n );\n};\n\nconst styles = StyleSheet.create({\n summaryContainer: {\n flexDirection: 'row',\n alignItems: 'center',\n },\n});\n\nexport default CompatDetails;\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO;AAAA,EACL;AAAA,EACA;AAAA,EACA;AAAA,OAGK;AACP,SAAS,MAAM,MAAM,kBAAkB,kBAAkB;AAczD,MAAM,gBAAgB,CAAC;AAAA,EACrB;AAAA,EACA,OAAO;AAAA,EACP;AAAA,EACA;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAwB;AACtB,QAAM,CAAC,YAAY,aAAa,IAAI,SAAS,IAAI;AAEjD,YAAU,MAAM;AACd,kBAAc,IAAI;AAAA,EACpB,GAAG,CAAC,IAAI,CAAC;AAET,QAAM,eAAe,MAAM;AACzB,kBAAc,CAAC,UAAU;AAAA,EAC3B;AAEA,QAAM,CAAC,gBAAgB,GAAG,cAAc,IAAI,SAAS,QAAQ,QAAQ;AAErE,QAAM,aACJ,aAAa,WACX,oCAAC,YAAM,aAAa,WAAW,SAAU,IACvC;AAEN;AAAA;AAAA;AAAA,IAGE,oCAAC,QAAM,GAAG,SACR,oCAAC,oBAAiB,SAAS,cAAc,OAAO,OAAO,oBACpD,cAAc,YAAY,YAC1B,gBACA,cAAc,WAAW,UAC5B,GACC,cAAc,oCAAC,YAAM,cAAe,CACvC;AAAA;AAEJ;AAEA,MAAM,SAAS,WAAW,OAAO;AAAA,EAC/B,kBAAkB;AAAA,IAChB,eAAe;AAAA,IACf,YAAY;AAAA,EACd;AACF,CAAC;AAED,IAAO,yBAAQ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/Base/compat/li.native.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { View } from 'react-native';\n\n// TODO: Fix `props` type\ninterface LiProps {\n [key: string]: any;\n}\n\nexport const Li = (props: LiProps) => {\n return <View {...props} />;\n};\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,YAAY;AAOd,MAAM,KAAK,CAAC,UAAmB;AACpC,SAAO,oCAAC,QAAM,GAAG,OAAO;AAC1B;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { View, Text } from "react-native";
|
|
3
|
+
const Ol = ({ children, className, ...props }) => {
|
|
4
|
+
let listStyle = "none";
|
|
5
|
+
if (className.includes("ds-list--bullet")) {
|
|
6
|
+
listStyle = "bullet";
|
|
7
|
+
}
|
|
8
|
+
if (className.includes("ds-list--number")) {
|
|
9
|
+
listStyle = "number";
|
|
10
|
+
}
|
|
11
|
+
return /* @__PURE__ */ React.createElement(View, { ...props, className }, Array.isArray(children) ? children.map((child, index) => {
|
|
12
|
+
const counter = listStyle === "number" ? index + 1 : listStyle === "bullet" ? "\u2022" : null;
|
|
13
|
+
return /* @__PURE__ */ React.createElement(
|
|
14
|
+
View,
|
|
15
|
+
{
|
|
16
|
+
key: index,
|
|
17
|
+
style: {
|
|
18
|
+
display: "flex",
|
|
19
|
+
flexDirection: "row",
|
|
20
|
+
flexWrap: "nowrap",
|
|
21
|
+
gap: 8,
|
|
22
|
+
width: "100%"
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
/* @__PURE__ */ React.createElement(Text, null, counter),
|
|
26
|
+
child
|
|
27
|
+
);
|
|
28
|
+
}) : children);
|
|
29
|
+
};
|
|
30
|
+
export {
|
|
31
|
+
Ol
|
|
32
|
+
};
|
|
33
|
+
//# sourceMappingURL=ol.native.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../../src/Base/compat/ol.native.tsx"],
|
|
4
|
+
"sourcesContent": ["import React from 'react';\nimport { View, Text } from 'react-native';\n\nexport const Ol = ({ children, className, ...props }) => {\n let listStyle = 'none';\n if (className.includes('ds-list--bullet')) {\n listStyle = 'bullet';\n }\n if (className.includes('ds-list--number')) {\n listStyle = 'number';\n }\n return (\n <View {...props} className={className}>\n {Array.isArray(children)\n ? children.map((child, index) => {\n const counter =\n listStyle === 'number'\n ? index + 1\n : listStyle === 'bullet'\n ? '\u2022'\n : null;\n return (\n <View\n key={index}\n style={{\n display: 'flex',\n flexDirection: 'row',\n flexWrap: 'nowrap',\n gap: 8,\n width: '100%',\n }}\n >\n <Text>{counter}</Text>\n {child}\n </View>\n );\n })\n : children}\n </View>\n );\n};\n"],
|
|
5
|
+
"mappings": "AAAA,OAAO,WAAW;AAClB,SAAS,MAAM,YAAY;AAEpB,MAAM,KAAK,CAAC,EAAE,UAAU,WAAW,GAAG,MAAM,MAAM;AACvD,MAAI,YAAY;AAChB,MAAI,UAAU,SAAS,iBAAiB,GAAG;AACzC,gBAAY;AAAA,EACd;AACA,MAAI,UAAU,SAAS,iBAAiB,GAAG;AACzC,gBAAY;AAAA,EACd;AACA,SACE,oCAAC,QAAM,GAAG,OAAO,aACd,MAAM,QAAQ,QAAQ,IACnB,SAAS,IAAI,CAAC,OAAO,UAAU;AAC7B,UAAM,UACJ,cAAc,WACV,QAAQ,IACR,cAAc,WACZ,WACA;AACR,WACE;AAAA,MAAC;AAAA;AAAA,QACC,KAAK;AAAA,QACL,OAAO;AAAA,UACL,SAAS;AAAA,UACT,eAAe;AAAA,UACf,UAAU;AAAA,UACV,KAAK;AAAA,UACL,OAAO;AAAA,QACT;AAAA;AAAA,MAEA,oCAAC,YAAM,OAAQ;AAAA,MACd;AAAA,IACH;AAAA,EAEJ,CAAC,IACD,QACN;AAEJ;",
|
|
6
|
+
"names": []
|
|
7
|
+
}
|
package/Base/index.d.ts
CHANGED
|
@@ -1,95 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
as?: C;
|
|
4
|
-
};
|
|
5
|
-
type PropsToOmit<C extends React.ElementType, P> = keyof (AsProp<C> & P);
|
|
6
|
-
type PolymorphicComponentProp<C extends React.ElementType, Props = Record<string, unknown>> = React.PropsWithChildren<Props & AsProp<C>> & Omit<React.ComponentPropsWithoutRef<C>, PropsToOmit<C, Props>>;
|
|
7
|
-
type PolymorphicComponentPropWithRef<C extends React.ElementType, Props = Record<string, unknown>> = PolymorphicComponentProp<C, Props> & {
|
|
8
|
-
ref?: any;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* This is the updated component props using PolymorphicComponentPropWithRef
|
|
12
|
-
*/
|
|
13
|
-
export type BaseProps<C extends React.ElementType> = PolymorphicComponentPropWithRef<C, {
|
|
14
|
-
/** margin is optional. It has not a default value. */
|
|
15
|
-
margin?: spacingValues;
|
|
16
|
-
/** marginTop is optional. It has not a default value. */
|
|
17
|
-
marginTop?: spacingValues;
|
|
18
|
-
/** marginBottom is optional. It has not a default value. */
|
|
19
|
-
marginBottom?: spacingValues;
|
|
20
|
-
/** marginLeft is optional. It has not a default value. */
|
|
21
|
-
marginLeft?: spacingValues;
|
|
22
|
-
/** marginRight is optional. It has not a default value. */
|
|
23
|
-
marginRight?: spacingValues;
|
|
24
|
-
/** Alternative for margin. Margin is optional. It has not a default value. */
|
|
25
|
-
m?: spacingValues;
|
|
26
|
-
/** Alternative for marginTop. MarginTop is optional. It has not a default value. */
|
|
27
|
-
mt?: spacingValues;
|
|
28
|
-
/** Alternative for marginBottom. MarginBottom is optional. It has not a default value. */
|
|
29
|
-
mb?: spacingValues;
|
|
30
|
-
/** Alternative for marginLeft. MarginLeft is optional. It has not a default value. */
|
|
31
|
-
ml?: spacingValues;
|
|
32
|
-
/** Alternative for marginRight. MarginRight is optional. It has not a default value. */
|
|
33
|
-
mr?: spacingValues;
|
|
34
|
-
/** Alternative for marginX. MarginX is optional. It has not a default value. */
|
|
35
|
-
mx?: spacingValues;
|
|
36
|
-
/** Alternative for marginY. MarginY is optional. It has not a default value. */
|
|
37
|
-
my?: spacingValues;
|
|
38
|
-
/** padding is optional. It has not a default value. */
|
|
39
|
-
padding?: spacingValues;
|
|
40
|
-
/** paddingTop is optional. It has not a default value. */
|
|
41
|
-
paddingTop?: spacingValues;
|
|
42
|
-
/** paddingBottom is optional. It has not a default value. */
|
|
43
|
-
paddingBottom?: spacingValues;
|
|
44
|
-
/** paddingLeft is optional. It has not a default value. */
|
|
45
|
-
paddingLeft?: spacingValues;
|
|
46
|
-
/** paddingRight is optional. It has not a default value. */
|
|
47
|
-
paddingRight?: spacingValues;
|
|
48
|
-
/** Alternative for padding. Padding is optional. It has not a default value. */
|
|
49
|
-
p?: spacingValues;
|
|
50
|
-
/** Alternative for paddingTop. PaddingTop is optional. It has not a default value. */
|
|
51
|
-
pt?: spacingValues;
|
|
52
|
-
/** Alternative for paddingBottom. PaddingBottom is optional. It has not a default value. */
|
|
53
|
-
pb?: spacingValues;
|
|
54
|
-
/** Alternative for paddingLeft. PaddingLeft is optional. It has not a default value. */
|
|
55
|
-
pl?: spacingValues;
|
|
56
|
-
/** Alternative for paddingRight. PaddingRight is optional. It has not a default value. */
|
|
57
|
-
pr?: spacingValues;
|
|
58
|
-
/** Alternative for paddingX. PaddingX is optional. It has not a default value. */
|
|
59
|
-
px?: spacingValues;
|
|
60
|
-
/** Alternative for paddingY. PaddingY is optional. It has not a default value. */
|
|
61
|
-
py?: spacingValues;
|
|
62
|
-
/** printHidden is optional. Default value is false. When true, the component is hidden at print. */
|
|
63
|
-
printHidden?: boolean;
|
|
64
|
-
/** printVisible is optional. When block, the component is displayed as block. When inline, the component is displayed as inline.*/
|
|
65
|
-
printVisible?: 'block' | 'inline';
|
|
66
|
-
/** Components will be hidden at all screen sizes. */
|
|
67
|
-
hidden?: boolean;
|
|
68
|
-
/** Components will be hidden from 'xs' screen size and up. */
|
|
69
|
-
xsUpHidden?: boolean;
|
|
70
|
-
/** Components will be hidden from 'sm' screen size and up. */
|
|
71
|
-
smUpHidden?: boolean;
|
|
72
|
-
/** Components will be hidden from 'md' screen size and up. */
|
|
73
|
-
mdUpHidden?: boolean;
|
|
74
|
-
/** Components will be hidden from 'lg' screen size and up. */
|
|
75
|
-
lgUpHidden?: boolean;
|
|
76
|
-
/** Components will be hidden from 'xl' screen size and up. */
|
|
77
|
-
xlUpHidden?: boolean;
|
|
78
|
-
/** Components will be hidden between xs and sm screen size. */
|
|
79
|
-
xsHidden?: boolean;
|
|
80
|
-
/** Components will be hidden between sm and md screen size. */
|
|
81
|
-
smHidden?: boolean;
|
|
82
|
-
/** Components will be hidden between md and lg screen size. */
|
|
83
|
-
mdHidden?: boolean;
|
|
84
|
-
/** Components will be hidden between lg and xl screen size. */
|
|
85
|
-
lgHidden?: boolean;
|
|
86
|
-
/** Components will be hidden between xl and 2xl screen size. */
|
|
87
|
-
xlHidden?: boolean;
|
|
88
|
-
}>;
|
|
89
|
-
type spacingValues = 0 | 0.5 | 1 | 1.5 | 2 | 2.5 | 3 | 3.5 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 14 | 16 | 20 | 24 | 28 | 32 | 36 | 40 | 44 | 48 | 52 | 56 | 60 | 64 | 72 | 80 | 96;
|
|
90
|
-
/**
|
|
91
|
-
* This is the type used in the type annotation for the component
|
|
92
|
-
*/
|
|
93
|
-
type BaseComponent = <C extends React.ElementType = 'span'>(props: BaseProps<C>) => React.ReactNode | null;
|
|
94
|
-
export declare const Base: BaseComponent;
|
|
95
|
-
export default Base;
|
|
1
|
+
export * from '@digigov/react-core/Base/index.web';
|
|
2
|
+
export { default as default } from '@digigov/react-core/Base/index.web';
|