@hyphen/hyphen-components 8.0.1 → 9.0.0-beta.1
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/dist/css/utilities.css +1 -1
- package/dist/css/utilities.css.map +1 -1
- package/dist/hyphen-components.cjs.development.js +353 -313
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +2 -2
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +357 -314
- package/dist/hyphen-components.esm.js.map +1 -1
- package/dist/index.d.ts +222 -212
- package/package.json +6 -5
- package/src/components/Alert/Alert.tsx +5 -6
- package/src/components/Badge/Badge.test.tsx +12 -0
- package/src/components/Badge/Badge.tsx +52 -20
- package/src/components/Box/Box.mdx +1 -1
- package/src/components/Box/Box.stories.tsx +1 -1
- package/src/components/Box/Box.test.tsx +24 -1
- package/src/components/Box/Box.tsx +108 -82
- package/src/components/Card/Card.tsx +5 -1
- package/src/components/Card/components/CardFooter/CardFooter.tsx +0 -4
- package/src/components/Card/components/CardHeader/CardHeader.tsx +4 -1
- package/src/components/Card/components/CardSection/CardSection.tsx +4 -5
- package/src/components/CheckboxInput/CheckboxInput.test.tsx +17 -0
- package/src/components/CheckboxInput/CheckboxInput.tsx +15 -4
- package/src/components/CheckboxInput/components/Checkbox.test.tsx +36 -0
- package/src/components/CheckboxInput/components/Checkbox.tsx +8 -2
- package/src/components/Details/Details.test.tsx +8 -0
- package/src/components/Details/Details.tsx +5 -2
- package/src/components/Details/DetailsSummary.tsx +4 -1
- package/src/components/Drawer/Drawer.test.tsx +8 -0
- package/src/components/Drawer/Drawer.tsx +1 -1
- package/src/components/FormLabel/FormLabel.tsx +6 -3
- package/src/components/Formik/FormikCheckboxInput/FormikCheckboxInput.test.tsx +9 -0
- package/src/components/Formik/FormikCheckboxInput/FormikCheckboxInput.tsx +1 -0
- package/src/components/Formik/FormikSelectInput/FormikSelectInput.tsx +21 -11
- package/src/components/Formik/FormikSelectInputNative/FormikSelectInputNative.tsx +1 -1
- package/src/components/Formik/FormikTimePicker/FormikTimePicker.tsx +1 -1
- package/src/components/Heading/Heading.tsx +5 -6
- package/src/components/Icon/Icon.test.tsx +8 -0
- package/src/components/Icon/Icon.tsx +6 -7
- package/src/components/Modal/Modal.test.tsx +31 -1
- package/src/components/Modal/Modal.tsx +13 -7
- package/src/components/Popover/Popover.test.tsx +3 -4
- package/src/components/RadioGroup/RadioGroup.tsx +11 -6
- package/src/components/RadioGroup/RadioInput/RadioInputIcon.tsx +0 -4
- package/src/components/SelectInput/SelectInput.test.tsx +18 -0
- package/src/components/SelectInput/SelectInput.tsx +47 -27
- package/src/components/SelectInputInset/SelectInputInset.tsx +8 -9
- package/src/components/SelectInputNative/SelectInputNative.test.tsx +24 -0
- package/src/components/SelectInputNative/SelectInputNative.tsx +79 -14
- package/src/components/Switch/Switch.tsx +1 -1
- package/src/components/Table/Table.mdx +21 -1
- package/src/components/Table/Table.stories.tsx +5 -1
- package/src/components/Table/Table.tsx +7 -7
- package/src/components/Table/TableBody/TableBody.test.tsx +89 -1
- package/src/components/Table/TableBody/TableBody.tsx +23 -8
- package/src/components/Table/TableHead/TableHead.tsx +6 -6
- package/src/components/Table/TableHead/TableHeaderCell/TableHeaderCell.tsx +6 -6
- package/src/components/Table/common/TableRow/TableRow.test.tsx +17 -1
- package/src/components/Table/common/TableRow/TableRow.tsx +30 -10
- package/src/components/TextInput/TextInput.tsx +10 -8
- package/src/components/TextInputInset/TextInputInset.tsx +5 -6
- package/src/components/TextareaInput/TextareaInput.tsx +4 -5
- package/src/components/TextareaInputInset/TextareaInputInset.tsx +10 -17
- package/src/components/Toast/Toast.stories.tsx +5 -1
- package/src/lib/getColumnKeys.ts +5 -3
- package/src/types/index.ts +6 -7
|
@@ -186,18 +186,6 @@ function getDimensionCss(dimension, value) {
|
|
|
186
186
|
};
|
|
187
187
|
}
|
|
188
188
|
|
|
189
|
-
// src/lib/getElementType.ts
|
|
190
|
-
function getElementType(Component, props, getDefault) {
|
|
191
|
-
const { defaultProps = {} } = Component;
|
|
192
|
-
if (props.as && props.as !== defaultProps.as) return props.as;
|
|
193
|
-
if (getDefault) {
|
|
194
|
-
const computedDefault = getDefault();
|
|
195
|
-
if (computedDefault) return computedDefault;
|
|
196
|
-
}
|
|
197
|
-
if (props.href) return "a";
|
|
198
|
-
return defaultProps.as || "div";
|
|
199
|
-
}
|
|
200
|
-
|
|
201
189
|
// src/components/Box/Box.module.scss
|
|
202
190
|
var Box_module_default = { "box-transition": "box-transition__sKpxg" };
|
|
203
191
|
|
|
@@ -208,9 +196,9 @@ var AUTO_FONT_COLOR_BACKGROUNDS = [
|
|
|
208
196
|
"danger",
|
|
209
197
|
"info"
|
|
210
198
|
];
|
|
211
|
-
var
|
|
212
|
-
|
|
213
|
-
as
|
|
199
|
+
var BoxBaseComponent = (props, ref) => {
|
|
200
|
+
const {
|
|
201
|
+
as,
|
|
214
202
|
alignItems = void 0,
|
|
215
203
|
alignContent = void 0,
|
|
216
204
|
alignSelf = void 0,
|
|
@@ -255,256 +243,259 @@ var Box = forwardRef(
|
|
|
255
243
|
wordBreak = void 0,
|
|
256
244
|
zIndex = void 0,
|
|
257
245
|
...restProps
|
|
258
|
-
}
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
};
|
|
363
|
-
if (typeof direction === "string") {
|
|
364
|
-
childGapDirection = {
|
|
365
|
-
base: getChildGapMarginDirection(direction)
|
|
366
|
-
};
|
|
367
|
-
} else if (typeof direction === "object" && direction !== null) {
|
|
368
|
-
childGapDirection = Object.keys(direction).reduce(
|
|
369
|
-
(acc, curr) => ({
|
|
370
|
-
...acc,
|
|
371
|
-
[curr]: getChildGapMarginDirection(
|
|
372
|
-
direction[curr]
|
|
373
|
-
)
|
|
374
|
-
}),
|
|
375
|
-
{}
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
|
-
return childGapDirection;
|
|
379
|
-
};
|
|
380
|
-
const generateChildGap = () => {
|
|
381
|
-
let childGapObj = {};
|
|
382
|
-
if (typeof childGap === "string") {
|
|
383
|
-
childGapObj = { base: childGap };
|
|
384
|
-
} else if (typeof childGap === "object" && childGap !== null) {
|
|
385
|
-
childGapObj = { ...childGap };
|
|
386
|
-
}
|
|
387
|
-
return childGapObj;
|
|
246
|
+
} = props;
|
|
247
|
+
const heightCss = getDimensionCss("h", height);
|
|
248
|
+
const widthCss = getDimensionCss("w", width);
|
|
249
|
+
const maxHeightCss = getDimensionCss("mh", maxHeight);
|
|
250
|
+
const maxWidthCss = getDimensionCss("mw", maxWidth);
|
|
251
|
+
const minHeightCss = getDimensionCss("minh", minHeight);
|
|
252
|
+
const minWidthCss = getDimensionCss("minw", minWidth);
|
|
253
|
+
const finalColor = color ?? (background === "inverse" ? "inverse" : background && AUTO_FONT_COLOR_BACKGROUNDS.includes(background) ? "grey" : void 0);
|
|
254
|
+
const isFlexBox = typeof display === "string" && display.includes("flex");
|
|
255
|
+
const flexDirectionClasses = isFlexBox ? generateResponsiveClasses("flex-direction", direction) : null;
|
|
256
|
+
const cssPropertyMap = {
|
|
257
|
+
color: {
|
|
258
|
+
classPrefix: "font-color",
|
|
259
|
+
transformer: generateResponsiveClasses
|
|
260
|
+
},
|
|
261
|
+
background: {
|
|
262
|
+
classPrefix: "background-color",
|
|
263
|
+
transformer: generateResponsiveClasses
|
|
264
|
+
},
|
|
265
|
+
borderColor: {
|
|
266
|
+
classPrefix: "border-color",
|
|
267
|
+
transformer: generateResponsiveClasses
|
|
268
|
+
},
|
|
269
|
+
borderWidth: {
|
|
270
|
+
classPrefix: "border-width",
|
|
271
|
+
transformer: cssShorthandToClasses
|
|
272
|
+
},
|
|
273
|
+
shadow: { classPrefix: "shadow", transformer: generateResponsiveClasses },
|
|
274
|
+
fontSize: {
|
|
275
|
+
classPrefix: "font-size",
|
|
276
|
+
transformer: generateResponsiveClasses
|
|
277
|
+
}
|
|
278
|
+
};
|
|
279
|
+
const getStatefulClasses = (stateKey, values) => values ? Object.entries(values).map(
|
|
280
|
+
([key, value]) => cssPropertyMap[key].transformer(
|
|
281
|
+
`${stateKey}:${cssPropertyMap[key].classPrefix}`,
|
|
282
|
+
value
|
|
283
|
+
)
|
|
284
|
+
// eslint-disable-line max-len
|
|
285
|
+
) : void 0;
|
|
286
|
+
const hoverClasses = getStatefulClasses("hover", hover);
|
|
287
|
+
const focusClasses = getStatefulClasses("focus", focus);
|
|
288
|
+
const boxClasses = classNames(
|
|
289
|
+
className,
|
|
290
|
+
cssShorthandToClasses("m", margin),
|
|
291
|
+
cssShorthandToClasses("p", padding),
|
|
292
|
+
cssShorthandToClasses("br", radius),
|
|
293
|
+
cssShorthandToClasses("g", gap),
|
|
294
|
+
cssShorthandToClasses("cg", columnGap),
|
|
295
|
+
cssShorthandToClasses("rg", rowGap),
|
|
296
|
+
heightCss.classes,
|
|
297
|
+
maxHeightCss.classes,
|
|
298
|
+
minHeightCss.classes,
|
|
299
|
+
maxWidthCss.classes,
|
|
300
|
+
minWidthCss.classes,
|
|
301
|
+
widthCss.classes,
|
|
302
|
+
flexDirectionClasses,
|
|
303
|
+
generateResponsiveClasses("display", display),
|
|
304
|
+
generateResponsiveClasses("justify-content", justifyContent),
|
|
305
|
+
generateResponsiveClasses("align-items", alignItems),
|
|
306
|
+
generateResponsiveClasses("align-content", alignContent),
|
|
307
|
+
generateResponsiveClasses("align-self", alignSelf),
|
|
308
|
+
generateResponsiveClasses("font-family", fontFamily),
|
|
309
|
+
generateResponsiveClasses("font-size", fontSize),
|
|
310
|
+
generateResponsiveClasses("overflow", overflow),
|
|
311
|
+
generateResponsiveClasses("shadow", shadow),
|
|
312
|
+
generateResponsiveClasses("flex", flex),
|
|
313
|
+
cssShorthandToClasses("bw", borderWidth),
|
|
314
|
+
generateResponsiveClasses("font-weight", fontWeight),
|
|
315
|
+
generateResponsiveClasses("text-align", textAlign),
|
|
316
|
+
generateResponsiveClasses("transform", textTransform),
|
|
317
|
+
generateResponsiveClasses("text-wrap", textWrap),
|
|
318
|
+
generateResponsiveClasses("position", position),
|
|
319
|
+
generateResponsiveClasses("z-index", zIndex),
|
|
320
|
+
generateResponsiveClasses("whitespace", whiteSpace),
|
|
321
|
+
generateResponsiveClasses("break", wordBreak),
|
|
322
|
+
...hoverClasses ?? [],
|
|
323
|
+
...focusClasses ?? [],
|
|
324
|
+
{
|
|
325
|
+
"flex-wrap": isFlexBox && wrap,
|
|
326
|
+
"flex-nowrap": isFlexBox && wrap === false,
|
|
327
|
+
[`background-color-${background}`]: background,
|
|
328
|
+
[`font-color-${finalColor}`]: finalColor,
|
|
329
|
+
[`border-color-${borderColor}`]: borderColor,
|
|
330
|
+
[`cursor-${cursor}`]: cursor,
|
|
331
|
+
[Box_module_default["box-transition"]]: hover || focus
|
|
332
|
+
}
|
|
333
|
+
);
|
|
334
|
+
const boxStyles = {
|
|
335
|
+
...style,
|
|
336
|
+
...heightCss.styles,
|
|
337
|
+
...maxHeightCss.styles,
|
|
338
|
+
...maxWidthCss.styles,
|
|
339
|
+
...widthCss.styles,
|
|
340
|
+
...minHeightCss.styles,
|
|
341
|
+
...minWidthCss.styles
|
|
342
|
+
};
|
|
343
|
+
const generateChildGapDirection = () => {
|
|
344
|
+
let childGapDirection = {};
|
|
345
|
+
const getChildGapMarginDirection = (d) => {
|
|
346
|
+
let marginDirection = "";
|
|
347
|
+
if (d?.includes("row")) marginDirection = "right";
|
|
348
|
+
else if (d?.includes("column")) marginDirection = "bottom";
|
|
349
|
+
return marginDirection;
|
|
388
350
|
};
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
const childGapValues = generateChildGap();
|
|
393
|
-
const breakpoints = [
|
|
394
|
-
"hd",
|
|
395
|
-
"desktop",
|
|
396
|
-
"tablet",
|
|
397
|
-
"base"
|
|
398
|
-
];
|
|
399
|
-
const findMatchingBreakpoint = (responsiveObj, key) => {
|
|
400
|
-
const index = breakpoints.findIndex((breakpoint) => breakpoint === key);
|
|
401
|
-
let value = "";
|
|
402
|
-
value = responsiveObj[key];
|
|
403
|
-
if (!value)
|
|
404
|
-
return findMatchingBreakpoint(responsiveObj, breakpoints[index + 1]);
|
|
405
|
-
return value;
|
|
351
|
+
if (typeof direction === "string") {
|
|
352
|
+
childGapDirection = {
|
|
353
|
+
base: getChildGapMarginDirection(direction)
|
|
406
354
|
};
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
const oppositeDirection = foundDirection === "bottom" ? "right" : "bottom";
|
|
418
|
-
childGapClasses.push(
|
|
419
|
-
`m-${foundDirection}-${foundChildGap}${classSuffix}`
|
|
420
|
-
);
|
|
421
|
-
childGapClasses.push(`m-${oppositeDirection}-0${classSuffix}`);
|
|
422
|
-
});
|
|
355
|
+
} else if (typeof direction === "object" && direction !== null) {
|
|
356
|
+
childGapDirection = Object.keys(direction).reduce(
|
|
357
|
+
(acc, curr) => ({
|
|
358
|
+
...acc,
|
|
359
|
+
[curr]: getChildGapMarginDirection(
|
|
360
|
+
direction[curr]
|
|
361
|
+
)
|
|
362
|
+
}),
|
|
363
|
+
{}
|
|
364
|
+
);
|
|
423
365
|
}
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
366
|
+
return childGapDirection;
|
|
367
|
+
};
|
|
368
|
+
const generateChildGap = () => {
|
|
369
|
+
let childGapObj = {};
|
|
370
|
+
if (typeof childGap === "string") {
|
|
371
|
+
childGapObj = { base: childGap };
|
|
372
|
+
} else if (typeof childGap === "object" && childGap !== null) {
|
|
373
|
+
childGapObj = { ...childGap };
|
|
374
|
+
}
|
|
375
|
+
return childGapObj;
|
|
376
|
+
};
|
|
377
|
+
const childGapClasses = [];
|
|
378
|
+
if (childGap && direction) {
|
|
379
|
+
const childGapDirection = generateChildGapDirection();
|
|
380
|
+
const childGapValues = generateChildGap();
|
|
381
|
+
const breakpoints = [
|
|
382
|
+
"hd",
|
|
383
|
+
"desktop",
|
|
384
|
+
"tablet",
|
|
385
|
+
"base"
|
|
386
|
+
];
|
|
387
|
+
const findMatchingBreakpoint = (responsiveObj, key) => {
|
|
388
|
+
const index = breakpoints.findIndex((breakpoint) => breakpoint === key);
|
|
389
|
+
let value = "";
|
|
390
|
+
value = responsiveObj[key];
|
|
391
|
+
if (!value)
|
|
392
|
+
return findMatchingBreakpoint(responsiveObj, breakpoints[index + 1]);
|
|
393
|
+
return value;
|
|
435
394
|
};
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
395
|
+
breakpoints.forEach((breakpoint) => {
|
|
396
|
+
const foundDirection = findMatchingBreakpoint(
|
|
397
|
+
childGapDirection,
|
|
398
|
+
breakpoint
|
|
399
|
+
);
|
|
400
|
+
const foundChildGap = findMatchingBreakpoint(
|
|
401
|
+
childGapValues,
|
|
402
|
+
breakpoint
|
|
403
|
+
);
|
|
404
|
+
const classSuffix = breakpoint === "base" ? "" : `-${breakpoint}`;
|
|
405
|
+
const oppositeDirection = foundDirection === "bottom" ? "right" : "bottom";
|
|
406
|
+
childGapClasses.push(
|
|
407
|
+
`m-${foundDirection}-${foundChildGap}${classSuffix}`
|
|
448
408
|
);
|
|
409
|
+
childGapClasses.push(`m-${oppositeDirection}-0${classSuffix}`);
|
|
410
|
+
});
|
|
411
|
+
}
|
|
412
|
+
const decorateChildren = (child, i, array) => {
|
|
413
|
+
if (i === array.length - 1 || !child || typeof child === "string" || typeof child === "number") {
|
|
414
|
+
return child;
|
|
449
415
|
}
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
416
|
+
const childClasses = classNames(child.props?.className, [
|
|
417
|
+
...Array.from(new Set(childGapClasses))
|
|
418
|
+
]);
|
|
419
|
+
return cloneElement(child, {
|
|
420
|
+
className: childClasses,
|
|
421
|
+
key: child.key ?? i
|
|
422
|
+
});
|
|
423
|
+
};
|
|
424
|
+
let decoratedChildren = Children.toArray(children).filter(
|
|
425
|
+
(child) => child !== null
|
|
426
|
+
);
|
|
427
|
+
if (childGapClasses && decoratedChildren.length > 1) {
|
|
428
|
+
decoratedChildren = decoratedChildren.map(
|
|
429
|
+
(value, index, array) => decorateChildren(
|
|
430
|
+
value,
|
|
431
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
432
|
+
index,
|
|
433
|
+
array
|
|
434
|
+
// eslint-disable-line @typescript-eslint/no-explicit-any
|
|
435
|
+
)
|
|
460
436
|
);
|
|
461
437
|
}
|
|
462
|
-
|
|
438
|
+
const element = as ?? "div";
|
|
439
|
+
return createElement(
|
|
440
|
+
element,
|
|
441
|
+
{
|
|
442
|
+
className: boxClasses,
|
|
443
|
+
style: boxStyles,
|
|
444
|
+
ref,
|
|
445
|
+
...restProps
|
|
446
|
+
},
|
|
447
|
+
children !== null && children !== void 0 ? decoratedChildren : null
|
|
448
|
+
);
|
|
449
|
+
};
|
|
450
|
+
var Box = forwardRef(BoxBaseComponent);
|
|
463
451
|
Box.displayName = "Box";
|
|
464
|
-
var
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
452
|
+
var boxPropsKeyMap = {
|
|
453
|
+
as: true,
|
|
454
|
+
alignItems: true,
|
|
455
|
+
alignContent: true,
|
|
456
|
+
alignSelf: true,
|
|
457
|
+
background: true,
|
|
458
|
+
borderColor: true,
|
|
459
|
+
borderWidth: true,
|
|
460
|
+
className: true,
|
|
461
|
+
childGap: true,
|
|
462
|
+
children: true,
|
|
463
|
+
color: true,
|
|
464
|
+
columnGap: true,
|
|
465
|
+
cursor: true,
|
|
466
|
+
direction: true,
|
|
467
|
+
display: true,
|
|
468
|
+
flex: true,
|
|
469
|
+
focus: true,
|
|
470
|
+
fontFamily: true,
|
|
471
|
+
fontSize: true,
|
|
472
|
+
fontWeight: true,
|
|
473
|
+
gap: true,
|
|
474
|
+
height: true,
|
|
475
|
+
hover: true,
|
|
476
|
+
justifyContent: true,
|
|
477
|
+
margin: true,
|
|
478
|
+
maxHeight: true,
|
|
479
|
+
minHeight: true,
|
|
480
|
+
maxWidth: true,
|
|
481
|
+
minWidth: true,
|
|
482
|
+
overflow: true,
|
|
483
|
+
padding: true,
|
|
484
|
+
position: true,
|
|
485
|
+
radius: true,
|
|
486
|
+
rowGap: true,
|
|
487
|
+
shadow: true,
|
|
488
|
+
style: true,
|
|
489
|
+
textAlign: true,
|
|
490
|
+
textTransform: true,
|
|
491
|
+
textWrap: true,
|
|
492
|
+
whiteSpace: true,
|
|
493
|
+
wrap: true,
|
|
494
|
+
width: true,
|
|
495
|
+
wordBreak: true,
|
|
496
|
+
zIndex: true
|
|
497
|
+
};
|
|
498
|
+
var boxPropsKeys = Object.keys(boxPropsKeyMap);
|
|
508
499
|
|
|
509
500
|
// src/components/Icon/Icon.tsx
|
|
510
501
|
import React, { forwardRef as forwardRef2 } from "react";
|
|
@@ -647,7 +638,10 @@ import * as AspectRatioPrimitive from "@radix-ui/react-aspect-ratio";
|
|
|
647
638
|
var AspectRatio = AspectRatioPrimitive.Root;
|
|
648
639
|
|
|
649
640
|
// src/components/Badge/Badge.tsx
|
|
650
|
-
import React3, {
|
|
641
|
+
import React3, {
|
|
642
|
+
Children as Children2,
|
|
643
|
+
forwardRef as forwardRef3
|
|
644
|
+
} from "react";
|
|
651
645
|
import classNames4 from "classnames";
|
|
652
646
|
|
|
653
647
|
// src/components/Badge/Badge.module.scss
|
|
@@ -664,8 +658,8 @@ var renderBadgeChildren = (children) => Children2.map(
|
|
|
664
658
|
children,
|
|
665
659
|
(child) => typeof child === "string" || typeof child === "number" ? /* @__PURE__ */ React3.createElement("span", { className: Badge_module_default.label }, child) : child
|
|
666
660
|
);
|
|
667
|
-
var
|
|
668
|
-
|
|
661
|
+
var BadgeBaseComponent = (props, ref) => {
|
|
662
|
+
const {
|
|
669
663
|
className = "",
|
|
670
664
|
color = "grey",
|
|
671
665
|
radius = "full",
|
|
@@ -673,33 +667,34 @@ var Badge = forwardRef3(
|
|
|
673
667
|
size = "md",
|
|
674
668
|
children,
|
|
675
669
|
...restProps
|
|
676
|
-
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
);
|
|
670
|
+
} = props;
|
|
671
|
+
const responsiveClasses = generateResponsiveClasses("size", size).map(
|
|
672
|
+
(c) => Badge_module_default[c]
|
|
673
|
+
);
|
|
674
|
+
const hue = BADGE_COLOR_ALIASES[color] ?? color;
|
|
675
|
+
const badgeClasses = classNames4(
|
|
676
|
+
Badge_module_default.badge,
|
|
677
|
+
className,
|
|
678
|
+
responsiveClasses,
|
|
679
|
+
Badge_module_default[variant],
|
|
680
|
+
Badge_module_default[`color-${hue}`],
|
|
681
|
+
Badge_module_default[`radius-${radius}`]
|
|
682
|
+
);
|
|
683
|
+
const boxProps = {
|
|
684
|
+
className: badgeClasses,
|
|
685
|
+
display: "inline-flex",
|
|
686
|
+
alignItems: "center",
|
|
687
|
+
direction: "row",
|
|
688
|
+
...restProps
|
|
689
|
+
};
|
|
690
|
+
const badgeChildren = renderBadgeChildren(children);
|
|
691
|
+
if (boxProps.as) {
|
|
692
|
+
const boxPropsWithAs = boxProps;
|
|
693
|
+
return /* @__PURE__ */ React3.createElement(Box, { ref, ...boxPropsWithAs }, badgeChildren);
|
|
701
694
|
}
|
|
702
|
-
);
|
|
695
|
+
return /* @__PURE__ */ React3.createElement(Box, { ref, ...boxProps }, badgeChildren);
|
|
696
|
+
};
|
|
697
|
+
var Badge = forwardRef3(BadgeBaseComponent);
|
|
703
698
|
Badge.displayName = "Badge";
|
|
704
699
|
|
|
705
700
|
// src/components/Button/Button.tsx
|
|
@@ -1072,6 +1067,18 @@ var HEADING_DEFAULT_SIZE_MAP = {
|
|
|
1072
1067
|
// src/components/Heading/Heading.tsx
|
|
1073
1068
|
import classNames8 from "classnames";
|
|
1074
1069
|
|
|
1070
|
+
// src/lib/getElementType.ts
|
|
1071
|
+
function getElementType(Component, props, getDefault) {
|
|
1072
|
+
const { defaultProps = {} } = Component;
|
|
1073
|
+
if (props.as && props.as !== defaultProps.as) return props.as;
|
|
1074
|
+
if (getDefault) {
|
|
1075
|
+
const computedDefault = getDefault();
|
|
1076
|
+
if (computedDefault) return computedDefault;
|
|
1077
|
+
}
|
|
1078
|
+
if (props.href) return "a";
|
|
1079
|
+
return defaultProps.as || "div";
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1075
1082
|
// src/components/Heading/Heading.module.scss
|
|
1076
1083
|
var Heading_module_default = { "heading": "heading__Jti1g" };
|
|
1077
1084
|
|
|
@@ -1255,6 +1262,7 @@ var Checkbox = React12.forwardRef(
|
|
|
1255
1262
|
isChecked,
|
|
1256
1263
|
label,
|
|
1257
1264
|
labelledby,
|
|
1265
|
+
name = void 0,
|
|
1258
1266
|
onChange,
|
|
1259
1267
|
error = false,
|
|
1260
1268
|
isDisabled = false,
|
|
@@ -1288,6 +1296,7 @@ var Checkbox = React12.forwardRef(
|
|
|
1288
1296
|
"aria-labelledby": labelledby,
|
|
1289
1297
|
"aria-required": isRequired,
|
|
1290
1298
|
id,
|
|
1299
|
+
name,
|
|
1291
1300
|
checked: !!isChecked,
|
|
1292
1301
|
disabled: isDisabled,
|
|
1293
1302
|
onBlur: handleBlur,
|
|
@@ -1296,7 +1305,7 @@ var Checkbox = React12.forwardRef(
|
|
|
1296
1305
|
required: isRequired,
|
|
1297
1306
|
type: "checkbox",
|
|
1298
1307
|
ref: inputRef,
|
|
1299
|
-
...value && { value }
|
|
1308
|
+
...value !== void 0 && { value }
|
|
1300
1309
|
};
|
|
1301
1310
|
const responsiveClasses = generateResponsiveClasses("size", size);
|
|
1302
1311
|
const containerClasses = classNames10(
|
|
@@ -1474,10 +1483,12 @@ var CheckboxInput = ({
|
|
|
1474
1483
|
isDisabled = false,
|
|
1475
1484
|
isIndeterminate = false,
|
|
1476
1485
|
isRequired = false,
|
|
1486
|
+
name = void 0,
|
|
1477
1487
|
onBlur = void 0,
|
|
1478
1488
|
onFocus = void 0,
|
|
1479
1489
|
requiredIndicator = " *",
|
|
1480
1490
|
size = "md",
|
|
1491
|
+
value = void 0,
|
|
1481
1492
|
...restProps
|
|
1482
1493
|
}) => {
|
|
1483
1494
|
const handleBlur = (event) => {
|
|
@@ -1494,11 +1505,13 @@ var CheckboxInput = ({
|
|
|
1494
1505
|
isChecked: !!isChecked,
|
|
1495
1506
|
isDisabled,
|
|
1496
1507
|
isIndeterminate,
|
|
1508
|
+
name,
|
|
1497
1509
|
onBlur: handleBlur,
|
|
1498
1510
|
onChange: handleChange,
|
|
1499
1511
|
onFocus: handleFocus,
|
|
1500
1512
|
isRequired,
|
|
1501
1513
|
size,
|
|
1514
|
+
value,
|
|
1502
1515
|
label,
|
|
1503
1516
|
className: classNames14(
|
|
1504
1517
|
"hyphen-components__variables__form-control",
|
|
@@ -2060,6 +2073,7 @@ var FormikCheckboxInput = ({
|
|
|
2060
2073
|
...props,
|
|
2061
2074
|
id,
|
|
2062
2075
|
label,
|
|
2076
|
+
name,
|
|
2063
2077
|
error: getIn(touched, name) && getIn(errors, name),
|
|
2064
2078
|
isChecked: value,
|
|
2065
2079
|
onBlur,
|
|
@@ -2504,6 +2518,8 @@ function SelectInput(props) {
|
|
|
2504
2518
|
placeholder = void 0,
|
|
2505
2519
|
requiredIndicator = " *",
|
|
2506
2520
|
size = "md",
|
|
2521
|
+
cacheOptions,
|
|
2522
|
+
defaultOptions,
|
|
2507
2523
|
...restProps
|
|
2508
2524
|
} = props;
|
|
2509
2525
|
const handleChange = (values) => {
|
|
@@ -2542,7 +2558,11 @@ function SelectInput(props) {
|
|
|
2542
2558
|
};
|
|
2543
2559
|
const ClearIndicator = (props2) => /* @__PURE__ */ React27.createElement(components.ClearIndicator, { ...props2 }, /* @__PURE__ */ React27.createElement(Icon, { name: "remove" }));
|
|
2544
2560
|
const Component = isCreatable && isAsync ? AsyncCreatableSelect : isCreatable ? CreatableSelect : isAsync ? AsyncSelect : Select;
|
|
2545
|
-
const selectOptions = isAsync ? {
|
|
2561
|
+
const selectOptions = isAsync ? {
|
|
2562
|
+
loadOptions: options,
|
|
2563
|
+
cacheOptions,
|
|
2564
|
+
defaultOptions
|
|
2565
|
+
} : { options };
|
|
2546
2566
|
return /* @__PURE__ */ React27.createElement(Box, { width: "100%", className: wrapperClasses }, label && !hideLabel && /* @__PURE__ */ React27.createElement(FormLabel, { ...labelProps }, label), /* @__PURE__ */ React27.createElement(
|
|
2547
2567
|
Component,
|
|
2548
2568
|
{
|
|
@@ -2580,11 +2600,8 @@ var FormikSelectInput = ({
|
|
|
2580
2600
|
field: { name, onBlur, onChange: formikOnChange, value },
|
|
2581
2601
|
form: { touched, errors },
|
|
2582
2602
|
onChange,
|
|
2583
|
-
id,
|
|
2584
|
-
label,
|
|
2585
|
-
options,
|
|
2586
2603
|
error: errorProp,
|
|
2587
|
-
...
|
|
2604
|
+
...selectProps
|
|
2588
2605
|
}) => {
|
|
2589
2606
|
let errorMessage;
|
|
2590
2607
|
const error = errorProp ?? (getIn3(touched, name) && getIn3(errors, name));
|
|
@@ -2596,15 +2613,12 @@ var FormikSelectInput = ({
|
|
|
2596
2613
|
return /* @__PURE__ */ React28.createElement(
|
|
2597
2614
|
SelectInput,
|
|
2598
2615
|
{
|
|
2599
|
-
|
|
2600
|
-
label,
|
|
2601
|
-
options,
|
|
2616
|
+
...selectProps,
|
|
2602
2617
|
name,
|
|
2603
2618
|
onBlur,
|
|
2604
2619
|
onChange: onChange ?? formikOnChange,
|
|
2605
2620
|
value,
|
|
2606
|
-
error: errorMessage
|
|
2607
|
-
...props
|
|
2621
|
+
error: errorMessage
|
|
2608
2622
|
}
|
|
2609
2623
|
);
|
|
2610
2624
|
};
|
|
@@ -2795,8 +2809,7 @@ var TextareaInputInset = forwardRef8(
|
|
|
2795
2809
|
requiredIndicator = " *",
|
|
2796
2810
|
resize = "vertical",
|
|
2797
2811
|
rows = 5,
|
|
2798
|
-
size = "md"
|
|
2799
|
-
type = "text"
|
|
2812
|
+
size = "md"
|
|
2800
2813
|
}, ref) => {
|
|
2801
2814
|
const responsiveClasses = generateResponsiveClasses("size", size);
|
|
2802
2815
|
const inputWrapperClasses = classNames22(
|
|
@@ -2829,7 +2842,6 @@ var TextareaInputInset = forwardRef8(
|
|
|
2829
2842
|
placeholder,
|
|
2830
2843
|
required: isRequired,
|
|
2831
2844
|
rows,
|
|
2832
|
-
type,
|
|
2833
2845
|
value
|
|
2834
2846
|
};
|
|
2835
2847
|
return /* @__PURE__ */ React31.createElement(Box, { width: "100", ref, className }, /* @__PURE__ */ React31.createElement(
|
|
@@ -3055,6 +3067,7 @@ var SelectInputNative = ({
|
|
|
3055
3067
|
helpText,
|
|
3056
3068
|
error,
|
|
3057
3069
|
id,
|
|
3070
|
+
inputProps = {},
|
|
3058
3071
|
isDisabled,
|
|
3059
3072
|
isRequired,
|
|
3060
3073
|
name,
|
|
@@ -3066,6 +3079,15 @@ var SelectInputNative = ({
|
|
|
3066
3079
|
size = "md",
|
|
3067
3080
|
...restProps
|
|
3068
3081
|
}) => {
|
|
3082
|
+
const isBoxProp = (key) => boxPropsKeys.includes(key);
|
|
3083
|
+
const formControlProps = Object.fromEntries(
|
|
3084
|
+
Object.entries(restProps).filter(([key]) => isBoxProp(key))
|
|
3085
|
+
);
|
|
3086
|
+
const selectProps = Object.fromEntries(
|
|
3087
|
+
Object.entries(restProps).filter(([key]) => !isBoxProp(key))
|
|
3088
|
+
);
|
|
3089
|
+
const selectIsDisabled = isDisabled || selectProps.disabled;
|
|
3090
|
+
const selectIsRequired = isRequired || selectProps.required;
|
|
3069
3091
|
const placeholderOption = {
|
|
3070
3092
|
value: "",
|
|
3071
3093
|
label: placeholder,
|
|
@@ -3081,7 +3103,7 @@ var SelectInputNative = ({
|
|
|
3081
3103
|
SelectInputNative_module_default["select-input-native-wrapper"],
|
|
3082
3104
|
...responsiveClasses.map((className) => SelectInputNative_module_default[className]),
|
|
3083
3105
|
{
|
|
3084
|
-
[SelectInputNative_module_default.disabled]:
|
|
3106
|
+
[SelectInputNative_module_default.disabled]: selectIsDisabled,
|
|
3085
3107
|
[SelectInputNative_module_default.error]: error
|
|
3086
3108
|
}
|
|
3087
3109
|
);
|
|
@@ -3093,26 +3115,28 @@ var SelectInputNative = ({
|
|
|
3093
3115
|
id,
|
|
3094
3116
|
error,
|
|
3095
3117
|
helpText,
|
|
3096
|
-
isDisabled,
|
|
3097
|
-
isRequired,
|
|
3118
|
+
isDisabled: selectIsDisabled,
|
|
3119
|
+
isRequired: selectIsRequired,
|
|
3098
3120
|
requiredIndicator,
|
|
3099
|
-
...
|
|
3121
|
+
...formControlProps
|
|
3100
3122
|
},
|
|
3101
3123
|
/* @__PURE__ */ React35.createElement(Box, { className: selectWrapperClasses }, /* @__PURE__ */ React35.createElement(
|
|
3102
3124
|
Box,
|
|
3103
3125
|
{
|
|
3104
3126
|
as: "select",
|
|
3127
|
+
...inputProps,
|
|
3128
|
+
...selectProps,
|
|
3105
3129
|
"aria-label": label,
|
|
3106
3130
|
"aria-labelledby": label && !hideLabel ? `${id}Label` : void 0,
|
|
3107
|
-
"aria-required":
|
|
3131
|
+
"aria-required": selectIsRequired,
|
|
3108
3132
|
value: value ?? "",
|
|
3109
3133
|
onChange,
|
|
3110
3134
|
color: !value ? "disabled" : "base",
|
|
3111
3135
|
autoFocus,
|
|
3112
|
-
disabled:
|
|
3136
|
+
disabled: selectIsDisabled,
|
|
3113
3137
|
name,
|
|
3114
3138
|
id,
|
|
3115
|
-
required:
|
|
3139
|
+
required: selectIsRequired
|
|
3116
3140
|
},
|
|
3117
3141
|
optionsWithPlaceholder.map((option) => /* @__PURE__ */ React35.createElement(
|
|
3118
3142
|
Box,
|
|
@@ -3576,7 +3600,7 @@ var Switch = ({
|
|
|
3576
3600
|
alignItems: helpText ? "flex-start" : "center",
|
|
3577
3601
|
isFieldRequired: isRequired,
|
|
3578
3602
|
requiredIndicator,
|
|
3579
|
-
size
|
|
3603
|
+
...typeof size === "string" && { size }
|
|
3580
3604
|
};
|
|
3581
3605
|
return /* @__PURE__ */ React43.createElement(Box, { className }, /* @__PURE__ */ React43.createElement(Box, { className: wrapperClasses }, /* @__PURE__ */ React43.createElement(FormLabel, { ...labelProps }, /* @__PURE__ */ React43.createElement("input", { ...inputProps }), /* @__PURE__ */ React43.createElement(
|
|
3582
3606
|
"span",
|
|
@@ -3912,14 +3936,14 @@ var ModalBaseComponent = forwardRef12(
|
|
|
3912
3936
|
/* @__PURE__ */ React51.createElement(RemoveScroll2, { allowPinchZoom, enabled: isOpen }, /* @__PURE__ */ React51.createElement(Box, { ref }, /* @__PURE__ */ React51.createElement(
|
|
3913
3937
|
ReactModal2,
|
|
3914
3938
|
{
|
|
3939
|
+
...restProps,
|
|
3915
3940
|
isOpen,
|
|
3916
3941
|
overlayClassName: overlayClassnames,
|
|
3917
3942
|
className: contentClassnames,
|
|
3918
3943
|
onRequestClose: onDismiss,
|
|
3919
3944
|
ariaHideApp: false,
|
|
3920
3945
|
parentSelector: parentElement ? () => parentElement : void 0,
|
|
3921
|
-
style: { content: { ...maxWidthCss.styles, ...style } }
|
|
3922
|
-
...restProps
|
|
3946
|
+
style: { content: { ...maxWidthCss.styles, ...style } }
|
|
3923
3947
|
},
|
|
3924
3948
|
/* @__PURE__ */ React51.createElement(
|
|
3925
3949
|
Box,
|
|
@@ -5133,17 +5157,28 @@ var TableRow = ({
|
|
|
5133
5157
|
{ [TableRow_module_default.hoverable]: isHoverable },
|
|
5134
5158
|
className
|
|
5135
5159
|
);
|
|
5160
|
+
const isRenderableCell = (value) => {
|
|
5161
|
+
if (value === null || value === void 0) return true;
|
|
5162
|
+
const valueType = typeof value;
|
|
5163
|
+
if (valueType === "string" || valueType === "number" || valueType === "boolean") {
|
|
5164
|
+
return true;
|
|
5165
|
+
}
|
|
5166
|
+
if (Array.isArray(value)) return value.every(isRenderableCell);
|
|
5167
|
+
return React61.isValidElement(value);
|
|
5168
|
+
};
|
|
5136
5169
|
const renderCellContent = (column) => {
|
|
5137
5170
|
if (column.render) {
|
|
5138
|
-
const
|
|
5139
|
-
return column.render(
|
|
5171
|
+
const cellValue2 = column.dataKey && row ? row[column.dataKey] : void 0;
|
|
5172
|
+
return column.render(cellValue2, row, rowIndex);
|
|
5140
5173
|
}
|
|
5141
|
-
|
|
5174
|
+
const cellValue = column.dataKey && row ? row[column.dataKey] : null;
|
|
5175
|
+
return isRenderableCell(cellValue) ? cellValue : null;
|
|
5142
5176
|
};
|
|
5143
5177
|
const getCellClassName = (column) => {
|
|
5144
5178
|
if (column.cellClassName) {
|
|
5145
5179
|
if (typeof column.cellClassName === "function") {
|
|
5146
|
-
|
|
5180
|
+
const cellValue = column.dataKey && row ? row[column.dataKey] : void 0;
|
|
5181
|
+
return column.cellClassName(cellValue, row, rowIndex);
|
|
5147
5182
|
}
|
|
5148
5183
|
return column.cellClassName;
|
|
5149
5184
|
}
|
|
@@ -5190,6 +5225,7 @@ var TableRow = ({
|
|
|
5190
5225
|
var TableBody = ({
|
|
5191
5226
|
columns,
|
|
5192
5227
|
rows,
|
|
5228
|
+
rowKey,
|
|
5193
5229
|
align = "left",
|
|
5194
5230
|
className = "",
|
|
5195
5231
|
emptyCellPlaceholder = "",
|
|
@@ -5207,6 +5243,13 @@ var TableBody = ({
|
|
|
5207
5243
|
},
|
|
5208
5244
|
className
|
|
5209
5245
|
);
|
|
5246
|
+
const getRowKey = (row, rowIndex) => {
|
|
5247
|
+
const keyValue = row?.[rowKey];
|
|
5248
|
+
if (typeof keyValue === "string" || typeof keyValue === "number" || typeof keyValue === "bigint") {
|
|
5249
|
+
return `row-key-${String(keyValue)}`;
|
|
5250
|
+
}
|
|
5251
|
+
return `row-index-${rowIndex}`;
|
|
5252
|
+
};
|
|
5210
5253
|
return /* @__PURE__ */ React62.createElement("tbody", { className: tableBodyClasses }, rows.map((row, rowIndex) => /* @__PURE__ */ React62.createElement(
|
|
5211
5254
|
TableRow,
|
|
5212
5255
|
{
|
|
@@ -5214,7 +5257,7 @@ var TableBody = ({
|
|
|
5214
5257
|
row,
|
|
5215
5258
|
rowIndex,
|
|
5216
5259
|
align,
|
|
5217
|
-
key: rowIndex,
|
|
5260
|
+
key: getRowKey(row, rowIndex),
|
|
5218
5261
|
emptyCellPlaceholder,
|
|
5219
5262
|
truncateOverflow,
|
|
5220
5263
|
isBorderless,
|