@majoo-ui/react 2.4.7 → 2.4.9

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.
@@ -23,7 +23,6 @@ const ProductList = props => {
23
23
  return jsx(Tooltip, {
24
24
  label: tooltipLabel(name, variants),
25
25
  children: jsxs(Box, {
26
- gap: 2,
27
26
  css: Object.assign({
28
27
  display: 'flex',
29
28
  alignItems: 'center',
@@ -229,7 +229,16 @@ const CloseButton = styled(DialogPrimitive.Close, {
229
229
  backgroundColor: '#FAFAFA'
230
230
  }
231
231
  });
232
- const DrawerContent = ({
232
+ const DrawerContent = (
233
+ /**
234
+ * @type {{
235
+ * children?: import('react').ReactNode,
236
+ * side?: 'top' | 'left' | 'bottom' | 'right',
237
+ * showOverlay?: boolean,
238
+ * [key: string]: any,
239
+ * }}
240
+ */
241
+ {
233
242
  children,
234
243
  showOverlay,
235
244
  ...props
@@ -310,7 +319,6 @@ Drawer.propTypes = {
310
319
  };
311
320
  DrawerContent.propTypes = {
312
321
  side: PropTypes.oneOf(['top', 'left', 'bottom', 'right']),
313
- isMobile: PropTypes.bool,
314
322
  showOverlay: PropTypes.bool
315
323
  };
316
324
  DrawerContent.defaultProps = {
@@ -259,7 +259,15 @@ const setRef = (ref, node) => {
259
259
 
260
260
  // forwardRef because DropdownMenuPortal renders its child through Radix's `Portal asChild`,
261
261
  // which hands that child a ref; a plain function component would drop it with a warning.
262
- const DropdownMenuContentContext = /*#__PURE__*/React__default.forwardRef(({
262
+ // Cast rather than a JSDoc @param on the render function, which forwardRef would flatten (see InputText).
263
+ const DropdownMenuContentContext =
264
+ /*#__PURE__*/
265
+ /**
266
+ * @type {React.ForwardRefExoticComponent<
267
+ * { theme?: string, [key: string]: any } & React.RefAttributes<HTMLDivElement>
268
+ * >}
269
+ */
270
+ React__default.forwardRef(({
263
271
  theme = 'default',
264
272
  ...props
265
273
  }, forwardedRef) => {
@@ -295,7 +303,14 @@ DropdownMenuContentContext.propTypes = {
295
303
  };
296
304
 
297
305
  // Radix positions submenus itself, so this only carries the theme class across the portal.
298
- const DropdownMenuSubContentContext = /*#__PURE__*/React__default.forwardRef(({
306
+ const DropdownMenuSubContentContext =
307
+ /*#__PURE__*/
308
+ /**
309
+ * @type {React.ForwardRefExoticComponent<
310
+ * { theme?: string, children?: React.ReactNode, [key: string]: any } & React.RefAttributes<HTMLDivElement>
311
+ * >}
312
+ */
313
+ React__default.forwardRef(({
299
314
  theme = 'default',
300
315
  children,
301
316
  ...props
@@ -186,7 +186,28 @@ function getMaxValueLength(maxValue, prefix = '', suffix = '', thousandSeparator
186
186
  const tsLength = thousandSeparator ? countThousandSeparatorsByLength(maxValue) : 0;
187
187
  return maxValue + prefix?.length + suffix?.length + tsLength;
188
188
  }
189
- const InputNumber = /*#__PURE__*/React__default.forwardRef(({
189
+
190
+ // Cast rather than a JSDoc @param on the render function, which forwardRef would flatten (see InputText).
191
+ // The ref reaches the NumberFormat instance, not the <input> (that is getInputRef), so it stays untyped.
192
+ const InputNumber =
193
+ /*#__PURE__*/
194
+ /**
195
+ * @type {React.ForwardRefExoticComponent<{
196
+ * placeholder?: string,
197
+ * value?: string | number,
198
+ * size?: 'sm' | 'md' | 'lg',
199
+ * isInvalid?: boolean,
200
+ * readOnly?: boolean,
201
+ * disabled?: boolean,
202
+ * control?: object,
203
+ * name?: string,
204
+ * maxValueLength?: number,
205
+ * maxLength?: number,
206
+ * thousandSeparator?: boolean | string,
207
+ * [key: string]: any,
208
+ * } & React.RefAttributes<unknown>>}
209
+ */
210
+ React__default.forwardRef(({
190
211
  placeholder,
191
212
  value,
192
213
  size,
@@ -232,7 +253,7 @@ const InputNumber = /*#__PURE__*/React__default.forwardRef(({
232
253
  InputNumber.propTypes = {
233
254
  placeholder: PropTypes.string,
234
255
  value: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
235
- size: PropTypes.oneOf(['sm', 'lg']),
256
+ size: PropTypes.oneOf(['sm', 'md', 'lg']),
236
257
  isInvalid: PropTypes.bool,
237
258
  readOnly: PropTypes.bool,
238
259
  disabled: PropTypes.bool
@@ -21,12 +21,12 @@ const InputRadioGroup = /*#__PURE__*/React__default.forwardRef(function InputRad
21
21
  children: /*#__PURE__*/jsx(RadioGroup, {
22
22
  ref: ref,
23
23
  ...groupProps,
24
- children: React__default.Children.map(children, child => /*#__PURE__*/React__default.cloneElement(child, {
24
+ children: React__default.Children.map(children, child => /*#__PURE__*/React__default.isValidElement(child) ? /*#__PURE__*/React__default.cloneElement(child, {
25
25
  style: {
26
26
  ...child.props.style,
27
27
  opacity: 1
28
28
  }
29
- }))
29
+ }) : child)
30
30
  })
31
31
  });
32
32
  });
@@ -13,7 +13,26 @@ import { jsxs, jsx } from 'react/jsx-runtime';
13
13
  const {
14
14
  colors
15
15
  } = foundations;
16
- const InputSearchbox = ({
16
+ const InputSearchbox = (
17
+ /**
18
+ * @type {{
19
+ * placeholder?: string,
20
+ * value?: string,
21
+ * size?: 'sm' | 'lg',
22
+ * isInvalid?: boolean,
23
+ * readOnly?: boolean,
24
+ * disabled?: boolean,
25
+ * onChange?: Function,
26
+ * withDebounce?: boolean,
27
+ * defaultValue?: string,
28
+ * mobileOnly?: boolean,
29
+ * desktopOnly?: boolean,
30
+ * css?: object,
31
+ * localeText?: Partial<import('./locale').InputSearchboxLocaleText>,
32
+ * [key: string]: any,
33
+ * }}
34
+ */
35
+ {
17
36
  size,
18
37
  onChange,
19
38
  css,
@@ -170,7 +170,19 @@ const StyledInput = styled('input', {
170
170
  size: 'lg'
171
171
  }
172
172
  });
173
- const InputText = /*#__PURE__*/React__default.forwardRef(({
173
+
174
+ // Untyped forwardRef render props make TS call sites accept nothing but `ref`, and a JSDoc @param on the
175
+ // render function does not help: forwardRef's PropsWithoutRef flattens a props type with an index signature
176
+ // to `{ [key: string]: any }`. Casting the result keeps disabled/readOnly checked and the rest open, matching
177
+ // the spread onto StyledInput.
178
+ const InputText =
179
+ /*#__PURE__*/
180
+ /**
181
+ * @type {React.ForwardRefExoticComponent<
182
+ * { disabled?: boolean, readOnly?: boolean, [key: string]: any } & React.RefAttributes<HTMLInputElement>
183
+ * >}
184
+ */
185
+ React__default.forwardRef(({
174
186
  disabled,
175
187
  readOnly,
176
188
  ...props
@@ -40,7 +40,25 @@ const StyledImage = styled('img', {
40
40
  }
41
41
  }
42
42
  });
43
- function Image({
43
+ function Image(
44
+ /**
45
+ * @type {{
46
+ * className?: string,
47
+ * src?: string,
48
+ * alt?: string,
49
+ * css?: object,
50
+ * cssFallback?: object,
51
+ * width?: string | number,
52
+ * height?: string | number,
53
+ * rounded?: boolean,
54
+ * objectFit?: string,
55
+ * fallback?: string,
56
+ * fallbackTitle?: string,
57
+ * localeText?: Partial<import('./locale').ImageLocaleText>,
58
+ * [key: string]: any,
59
+ * }}
60
+ */
61
+ {
44
62
  className,
45
63
  src,
46
64
  alt,
@@ -145,7 +145,17 @@ Popover.propTypes = {
145
145
  onOpenChange: PropTypes.func,
146
146
  placement: PropTypes.oneOf(['top', 'top-start', 'top-end', 'right', 'right-start', 'right-end', 'bottom', 'bottom-start', 'bottom-end', 'left', 'left-start', 'left-end']),
147
147
  sideOffset: PropTypes.number,
148
- hideOnScroll: PropTypes.bool
148
+ hideOnScroll: PropTypes.bool,
149
+ flip: PropTypes.bool,
150
+ onClose: PropTypes.func
151
+ };
152
+ PopoverTrigger.propTypes = {
153
+ disabled: PropTypes.bool
154
+ };
155
+ PopoverContent.propTypes = {
156
+ isMobile: PropTypes.bool,
157
+ style: PropTypes.object,
158
+ portalled: PropTypes.bool
149
159
  };
150
160
  Popover.displayName = 'Popover';
151
161
 
@@ -229,7 +229,17 @@ function TableOfContent({
229
229
  const StyledPage = styled(Box, {
230
230
  maxWidth: 982
231
231
  });
232
- const Page = /*#__PURE__*/forwardRef((props, ref) => /*#__PURE__*/jsx(StyledPage, {
232
+
233
+ // ScrollSpy's props pass straight through; index.tsx documents them as ScrollSpyProps. Cast rather than a
234
+ // JSDoc @param on the render function, which forwardRef would flatten (see InputText).
235
+ const Page =
236
+ /*#__PURE__*/
237
+ /**
238
+ * @type {React.ForwardRefExoticComponent<
239
+ * { children?: React.ReactNode, [key: string]: any } & React.RefAttributes<HTMLDivElement>
240
+ * >}
241
+ */
242
+ forwardRef((props, ref) => /*#__PURE__*/jsx(StyledPage, {
233
243
  ref: ref,
234
244
  children: /*#__PURE__*/jsx(ScrollSpy, {
235
245
  ...props
@@ -99,7 +99,26 @@ const StyledIconLeft = styled('div', {
99
99
  alignItems: 'center',
100
100
  color: 'inherit'
101
101
  });
102
- const Tag = /*#__PURE__*/React__default.forwardRef(({
102
+
103
+ // Cast rather than a JSDoc @param on the render function, which forwardRef would flatten (see InputText).
104
+ const Tag =
105
+ /*#__PURE__*/
106
+ /**
107
+ * @type {React.ForwardRefExoticComponent<{
108
+ * className?: string,
109
+ * children?: React.ReactNode,
110
+ * onClick?: Function,
111
+ * size?: string,
112
+ * icon?: React.ReactNode,
113
+ * isRemovable?: boolean,
114
+ * disabled?: boolean,
115
+ * type?: string,
116
+ * onRemove?: Function,
117
+ * readOnly?: boolean,
118
+ * [key: string]: any,
119
+ * } & React.RefAttributes<HTMLDivElement>>}
120
+ */
121
+ React__default.forwardRef(({
103
122
  className,
104
123
  children,
105
124
  onClick,
@@ -109,7 +109,22 @@ const darkArrow = {
109
109
  const lightArrow = {
110
110
  fill: foundations.colors.bgWhite
111
111
  };
112
- const Tooltip = ({
112
+ // The props are typed on the parameter: Storybook shows a /** */ block above a component as its description.
113
+ const Tooltip = (
114
+ /**
115
+ * @type {{
116
+ * children?: import('react').ReactNode,
117
+ * label?: import('react').ReactNode,
118
+ * color?: string,
119
+ * css?: object,
120
+ * withClick?: boolean,
121
+ * side?: 'top' | 'bottom' | 'right' | 'left',
122
+ * align?: 'start' | 'center' | 'end',
123
+ * delayDuration?: number,
124
+ * [key: string]: any,
125
+ * }}
126
+ */
127
+ {
113
128
  children,
114
129
  label,
115
130
  color,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@majoo-ui/react",
3
- "version": "2.4.7",
3
+ "version": "2.4.9",
4
4
  "main": "./index.esm.js",
5
5
  "sideEffects": [
6
6
  "*.css",
@@ -36,7 +36,7 @@
36
36
  "dependencies": {
37
37
  "@floating-ui/react": "^0.19.2",
38
38
  "@majoo-ui/core": "1.32.0",
39
- "@majoo-ui/helpers": "1.30.9",
39
+ "@majoo-ui/helpers": "1.30.10",
40
40
  "@majoo-ui/icons": "1.40.5",
41
41
  "@monsonjeremy/react-leaflet": "^3.2.2",
42
42
  "@radix-ui/react-accordion": "^1.0.0",