@rjsf/chakra-ui 5.15.1 → 5.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rjsf/chakra-ui",
3
- "version": "5.15.1",
3
+ "version": "5.16.0",
4
4
  "description": "Chakra UI theme, fields, and widgets for react-jsonschema-form",
5
5
  "main": "dist/index.js",
6
6
  "module": "lib/index.js",
@@ -55,44 +55,44 @@
55
55
  ],
56
56
  "license": "Apache-2.0",
57
57
  "devDependencies": {
58
- "@babel/core": "^7.22.17",
58
+ "@babel/core": "^7.23.7",
59
59
  "@babel/plugin-proposal-class-properties": "^7.18.6",
60
60
  "@babel/plugin-proposal-optional-chaining": "^7.21.0",
61
- "@babel/preset-env": "^7.22.15",
62
- "@babel/preset-react": "^7.22.15",
63
- "@babel/preset-typescript": "^7.22.15",
61
+ "@babel/preset-env": "^7.23.7",
62
+ "@babel/preset-react": "^7.23.3",
63
+ "@babel/preset-typescript": "^7.23.3",
64
64
  "@chakra-ui/icons": "^1.1.7",
65
65
  "@chakra-ui/react": "^1.8.9",
66
66
  "@chakra-ui/system": "^1.12.1",
67
67
  "@emotion/eslint-plugin": "^11.11.0",
68
68
  "@emotion/jest": "^11.11.0",
69
- "@emotion/react": "^11.11.1",
69
+ "@emotion/react": "^11.11.3",
70
70
  "@emotion/styled": "^11.11.0",
71
- "@rjsf/core": "^5.15.1",
72
- "@rjsf/snapshot-tests": "^5.15.1",
73
- "@rjsf/utils": "^5.15.1",
74
- "@rjsf/validator-ajv8": "^5.15.1",
75
- "@types/jest": "^29.5.7",
76
- "@types/react": "^17.0.65",
77
- "@types/react-dom": "^17.0.20",
78
- "@types/react-test-renderer": "^17.0.3",
79
- "babel-jest": "^29.6.4",
71
+ "@rjsf/core": "^5.16.0",
72
+ "@rjsf/snapshot-tests": "^5.16.0",
73
+ "@rjsf/utils": "^5.16.0",
74
+ "@rjsf/validator-ajv8": "^5.16.0",
75
+ "@types/jest": "^29.5.11",
76
+ "@types/react": "^17.0.74",
77
+ "@types/react-dom": "^17.0.25",
78
+ "@types/react-test-renderer": "^17.0.9",
79
+ "babel-jest": "^29.7.0",
80
80
  "chakra-react-select": "^3.3.9",
81
81
  "esbuild": "^0.18.20",
82
- "eslint": "^8.48.0",
82
+ "eslint": "^8.56.0",
83
83
  "framer-motion": "^5.6.0",
84
- "jest": "^29.6.4",
85
- "jest-environment-jsdom": "^29.6.4",
84
+ "jest": "^29.7.0",
85
+ "jest-environment-jsdom": "^29.7.0",
86
86
  "jest-watch-typeahead": "^2.2.2",
87
87
  "react": "^17.0.2",
88
88
  "react-dom": "^17.0.2",
89
89
  "react-test-renderer": "^17.0.2",
90
- "rimraf": "^5.0.1",
91
- "rollup": "^3.29.0",
90
+ "rimraf": "^5.0.5",
91
+ "rollup": "^3.29.4",
92
92
  "typescript": "^4.9.5"
93
93
  },
94
94
  "dependencies": {
95
- "react-select": "^5.7.4"
95
+ "react-select": "^5.8.0"
96
96
  },
97
- "gitHead": "61dc9b87f52de3402dd369d11a7eb931d666bb6e"
97
+ "gitHead": "c7ed12043fdd91bc1344ffd7c9404deac31374a7"
98
98
  }
@@ -1,8 +1,10 @@
1
1
  import { MouseEvent, useEffect, useState } from 'react';
2
2
  import {
3
3
  ariaDescribedByIds,
4
+ DateElementFormat,
4
5
  DateObject,
5
6
  FormContextType,
7
+ getDateElementProps,
6
8
  pad,
7
9
  parseDateString,
8
10
  RJSFSchema,
@@ -91,30 +93,15 @@ function AltDateWidget<T = any, S extends StrictRJSFSchema = RJSFSchema, F exten
91
93
  onChange(undefined);
92
94
  };
93
95
 
94
- const dateElementProps = () => {
95
- const { year, month, day, hour, minute, second } = state;
96
-
97
- const data: { type: string; range: any; value?: number }[] = [
98
- { type: 'year', range: options.yearsRange, value: year },
99
- { type: 'month', range: [1, 12], value: month },
100
- { type: 'day', range: [1, 31], value: day },
101
- ];
102
-
103
- if (showTime) {
104
- data.push(
105
- { type: 'hour', range: [0, 23], value: hour },
106
- { type: 'minute', range: [0, 59], value: minute },
107
- { type: 'second', range: [0, 59], value: second }
108
- );
109
- }
110
-
111
- return data;
112
- };
113
-
114
96
  return (
115
97
  <Box>
116
98
  <Box display='flex' flexWrap='wrap' alignItems='center'>
117
- {dateElementProps().map((elemProps: any, i) => {
99
+ {getDateElementProps(
100
+ state,
101
+ showTime,
102
+ options.yearsRange as [number, number] | undefined,
103
+ options.format as DateElementFormat | undefined
104
+ ).map((elemProps: any, i) => {
118
105
  const elemId = id + '_' + elemProps.type;
119
106
  return (
120
107
  <Box key={elemId} mr='2' mb='2'>