@ornikar/kitt-universal 4.6.1 → 5.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/definitions/Button/AnimatedButtonPressable.web.d.ts +3 -4
  2. package/dist/definitions/Button/AnimatedButtonPressable.web.d.ts.map +1 -1
  3. package/dist/definitions/forms/DatePicker/DatePicker.android.d.ts +4 -0
  4. package/dist/definitions/forms/DatePicker/DatePicker.android.d.ts.map +1 -0
  5. package/dist/definitions/forms/DatePicker/DatePicker.d.ts +2 -28
  6. package/dist/definitions/forms/DatePicker/DatePicker.d.ts.map +1 -1
  7. package/dist/definitions/forms/DatePicker/DatePicker.web.d.ts +4 -0
  8. package/dist/definitions/forms/DatePicker/DatePicker.web.d.ts.map +1 -0
  9. package/dist/definitions/forms/DatePicker/DatePickerInputs.d.ts +9 -0
  10. package/dist/definitions/forms/DatePicker/DatePickerInputs.d.ts.map +1 -0
  11. package/dist/definitions/forms/DatePicker/types.d.ts +34 -0
  12. package/dist/definitions/forms/DatePicker/types.d.ts.map +1 -0
  13. package/dist/definitions/index.d.ts +1 -1
  14. package/dist/definitions/index.d.ts.map +1 -1
  15. package/dist/index-browser-all.es.android.js +634 -735
  16. package/dist/index-browser-all.es.android.js.map +1 -1
  17. package/dist/index-browser-all.es.ios.js +150 -140
  18. package/dist/index-browser-all.es.ios.js.map +1 -1
  19. package/dist/index-browser-all.es.js +150 -140
  20. package/dist/index-browser-all.es.js.map +1 -1
  21. package/dist/index-browser-all.es.web.js +528 -666
  22. package/dist/index-browser-all.es.web.js.map +1 -1
  23. package/dist/index-node-14.17.cjs.js +99 -93
  24. package/dist/index-node-14.17.cjs.js.map +1 -1
  25. package/dist/index-node-14.17.cjs.web.css +1 -1
  26. package/dist/index-node-14.17.cjs.web.js +408 -524
  27. package/dist/index-node-14.17.cjs.web.js.map +1 -1
  28. package/dist/styles.css +1 -1
  29. package/dist/tsbuildinfo +1 -1
  30. package/package.json +4 -4
@@ -1624,6 +1624,84 @@ function DatePickerInputPart({
1624
1624
  });
1625
1625
  }
1626
1626
 
1627
+ function prefixWithZero(value) {
1628
+ return `${value}`.padStart(2, '0');
1629
+ }
1630
+
1631
+ const PartContainer = /*#__PURE__*/styled__default.View.withConfig({
1632
+ displayName: "DatePickerInputs__PartContainer",
1633
+ componentId: "kitt-universal__sc-j9hin5-0"
1634
+ })(["margin-right:", ";", ";"], ({
1635
+ theme,
1636
+ $isLast
1637
+ }) => !$isLast ? `${theme.kitt.spacing * 2}px` : 0, ({
1638
+ $isStretch
1639
+ }) => $isStretch ? styled.css(["flex:0.33;flex-grow:1;"]) : undefined);
1640
+ const DatePickerPressable = /*#__PURE__*/styled__default.Pressable.withConfig({
1641
+ displayName: "DatePickerInputs__DatePickerPressable",
1642
+ componentId: "kitt-universal__sc-j9hin5-1"
1643
+ })(["display:flex;flex-direction:row;", ";"], ({
1644
+ $isStretch
1645
+ }) => {
1646
+ if ($isStretch) {
1647
+ return styled.css(["width:100%;"]);
1648
+ }
1649
+
1650
+ return styled.css(["align-self:baseline;"]);
1651
+ });
1652
+ function DatePickerInputs({
1653
+ state,
1654
+ internalForceState,
1655
+ isFocused,
1656
+ disabled,
1657
+ stretch,
1658
+ id,
1659
+ testID,
1660
+ handleModalOpen,
1661
+ currentValue,
1662
+ placeholder
1663
+ }) {
1664
+ const currentState = internalForceState || getInputUIState({
1665
+ isFocused,
1666
+ isDisabled: Boolean(disabled),
1667
+ formState: state
1668
+ });
1669
+ const sharedPartProps = {
1670
+ disabled,
1671
+ $state: currentState
1672
+ };
1673
+ return /*#__PURE__*/jsxRuntime.jsxs(DatePickerPressable, {
1674
+ $isStretch: stretch,
1675
+ nativeID: id,
1676
+ disabled: disabled,
1677
+ testID: testID,
1678
+ onPress: handleModalOpen,
1679
+ children: [/*#__PURE__*/jsxRuntime.jsx(PartContainer, {
1680
+ $isStretch: stretch,
1681
+ children: /*#__PURE__*/jsxRuntime.jsx(DatePickerInputPart, { ...sharedPartProps,
1682
+ partName: "day",
1683
+ value: currentValue ? prefixWithZero(currentValue.getDate()) : undefined,
1684
+ placeholder: placeholder?.day
1685
+ })
1686
+ }), /*#__PURE__*/jsxRuntime.jsx(PartContainer, {
1687
+ $isStretch: stretch,
1688
+ children: /*#__PURE__*/jsxRuntime.jsx(DatePickerInputPart, { ...sharedPartProps,
1689
+ partName: "month",
1690
+ value: currentValue ? prefixWithZero(currentValue.getMonth() + 1) : undefined,
1691
+ placeholder: placeholder?.month
1692
+ })
1693
+ }), /*#__PURE__*/jsxRuntime.jsx(PartContainer, {
1694
+ $isLast: true,
1695
+ $isStretch: stretch,
1696
+ children: /*#__PURE__*/jsxRuntime.jsx(DatePickerInputPart, { ...sharedPartProps,
1697
+ partName: "year",
1698
+ value: currentValue ? currentValue.getFullYear() : undefined,
1699
+ placeholder: placeholder?.year
1700
+ })
1701
+ })]
1702
+ });
1703
+ }
1704
+
1627
1705
  // Don't use styled.Pressable here - babel-plugin-styled-components-react-native-web only supports tagged templates
1628
1706
  const OverlayPressable = /*#__PURE__*/styled__default(reactNative.Pressable).withConfig({
1629
1707
  displayName: "Overlay__OverlayPressable",
@@ -2154,47 +2232,16 @@ function ModalPlatformDateTimePicker({
2154
2232
  });
2155
2233
  }
2156
2234
 
2157
- function prefixWithZero(value) {
2158
- return `${value}`.padStart(2, '0');
2159
- }
2160
-
2161
- const PartContainer = /*#__PURE__*/styled__default.View.withConfig({
2162
- displayName: "DatePicker__PartContainer",
2163
- componentId: "kitt-universal__sc-ebllsn-0"
2164
- })(["margin-right:", ";", ";"], ({
2165
- theme,
2166
- $isLast
2167
- }) => !$isLast ? `${theme.kitt.spacing * 2}px` : 0, ({
2168
- $isStretch
2169
- }) => $isStretch ? styled.css(["flex:0.33;flex-grow:1;"]) : undefined);
2170
- const DatePickerPressable = /*#__PURE__*/styled__default.Pressable.withConfig({
2171
- displayName: "DatePicker__DatePickerPressable",
2172
- componentId: "kitt-universal__sc-ebllsn-1"
2173
- })(["display:flex;flex-direction:row;", ";"], ({
2174
- $isStretch
2175
- }) => {
2176
- if ($isStretch) {
2177
- return styled.css(["width:100%;"]);
2178
- }
2179
-
2180
- return styled.css(["align-self:baseline;"]);
2181
- });
2182
2235
  function DatePicker({
2183
2236
  value,
2184
- id,
2185
- disabled,
2186
- placeholder,
2187
- state,
2188
- internalForceState,
2189
- testID,
2190
- stretch,
2191
- pickerDefaultDate,
2192
2237
  pickerUITestID,
2193
2238
  pickerUITitle,
2194
2239
  pickerUIValidateButtonLabel,
2195
2240
  onChange,
2196
2241
  onFocus,
2197
- onBlur
2242
+ onBlur,
2243
+ pickerDefaultDate,
2244
+ ...props
2198
2245
  }) {
2199
2246
  const [isPickerUIVisible, setIsPickerUIVisible] = react.useState(false);
2200
2247
  const [isFocused, setIsFocused] = react.useState(false);
@@ -2206,70 +2253,29 @@ function DatePicker({
2206
2253
  setIsFocused(false);
2207
2254
  };
2208
2255
 
2209
- const handleChange = newDate => {
2210
- setCurrentValue(newDate);
2211
- onChange(newDate);
2212
- handleModalClose();
2213
- };
2214
-
2215
- const currentState = internalForceState || getInputUIState({
2216
- isFocused,
2217
- isDisabled: Boolean(disabled),
2218
- formState: state
2219
- });
2220
- const sharedPickerProps = {
2221
- testID: pickerUITestID,
2222
- value: currentValue,
2223
- onChange: handleChange
2224
- };
2225
- const sharedPartProps = {
2226
- disabled,
2227
- $state: currentState,
2228
- defaultDate: pickerDefaultDate
2229
- };
2230
2256
  return /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2231
- children: [/*#__PURE__*/jsxRuntime.jsxs(DatePickerPressable, {
2232
- $isStretch: stretch,
2233
- nativeID: id,
2234
- disabled: disabled,
2235
- testID: testID,
2236
- onPress: () => {
2257
+ children: [/*#__PURE__*/jsxRuntime.jsx(DatePickerInputs, {
2258
+ handleModalOpen: () => {
2237
2259
  if (onFocus) onFocus();
2238
2260
  setIsPickerUIVisible(true);
2239
2261
  setIsFocused(true);
2240
2262
  },
2241
- children: [/*#__PURE__*/jsxRuntime.jsx(PartContainer, {
2242
- $isStretch: stretch,
2243
- children: /*#__PURE__*/jsxRuntime.jsx(DatePickerInputPart, { ...sharedPartProps,
2244
- partName: "day",
2245
- value: currentValue ? prefixWithZero(currentValue.getDate()) : undefined,
2246
- placeholder: placeholder?.day
2247
- })
2248
- }), /*#__PURE__*/jsxRuntime.jsx(PartContainer, {
2249
- $isStretch: stretch,
2250
- children: /*#__PURE__*/jsxRuntime.jsx(DatePickerInputPart, { ...sharedPartProps,
2251
- partName: "month",
2252
- value: currentValue ? prefixWithZero(currentValue.getMonth() + 1) : undefined,
2253
- placeholder: placeholder?.month
2254
- })
2255
- }), /*#__PURE__*/jsxRuntime.jsx(PartContainer, {
2256
- $isLast: true,
2257
- $isStretch: stretch,
2258
- children: /*#__PURE__*/jsxRuntime.jsx(DatePickerInputPart, { ...sharedPartProps,
2259
- partName: "year",
2260
- value: currentValue ? currentValue.getFullYear() : undefined,
2261
- placeholder: placeholder?.year
2262
- })
2263
- })]
2264
- }), /*#__PURE__*/jsxRuntime.jsxs(jsxRuntime.Fragment, {
2265
- children: [reactNative.Platform.OS === 'android' && isPickerUIVisible ? /*#__PURE__*/jsxRuntime.jsx(PlatformDateTimePicker, { ...sharedPickerProps
2266
- }) : null, reactNative.Platform.OS !== 'android' ? /*#__PURE__*/jsxRuntime.jsx(ModalPlatformDateTimePicker, { ...sharedPickerProps,
2267
- isVisible: isPickerUIVisible,
2268
- title: pickerUITitle,
2269
- validateButtonLabel: pickerUIValidateButtonLabel,
2270
- onClose: handleModalClose,
2271
- onChange: handleChange
2272
- }) : null]
2263
+ currentValue: currentValue,
2264
+ isFocused: isFocused,
2265
+ ...props
2266
+ }), /*#__PURE__*/jsxRuntime.jsx(ModalPlatformDateTimePicker, {
2267
+ testID: pickerUITestID,
2268
+ value: currentValue,
2269
+ isVisible: isPickerUIVisible,
2270
+ title: pickerUITitle,
2271
+ validateButtonLabel: pickerUIValidateButtonLabel,
2272
+ defaultDate: pickerDefaultDate,
2273
+ onClose: handleModalClose,
2274
+ onChange: newDate => {
2275
+ setCurrentValue(newDate);
2276
+ onChange(newDate);
2277
+ handleModalClose();
2278
+ }
2273
2279
  })]
2274
2280
  });
2275
2281
  }