@hyphen/hyphen-components 7.3.3 → 7.3.4
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/hyphen-components.cjs.development.js +158 -0
- 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 +115 -0
- package/dist/hyphen-components.esm.js.map +1 -1
- package/dist/index.d.ts +109 -3
- package/package.json +1 -1
- package/src/index.ts +2 -0
|
@@ -288,6 +288,15 @@ var src_exports = {};
|
|
|
288
288
|
__export(src_exports, {
|
|
289
289
|
Alert: () => Alert,
|
|
290
290
|
AspectRatio: () => AspectRatio,
|
|
291
|
+
BACKGROUND_COLOR_OPTIONS: () => BACKGROUND_COLOR_OPTIONS,
|
|
292
|
+
BASE_COLOR_NAMES: () => BASE_COLOR_NAMES,
|
|
293
|
+
BASE_COLOR_OPTIONS: () => BASE_COLOR_OPTIONS,
|
|
294
|
+
BORDER_COLOR_OPTIONS: () => BORDER_COLOR_OPTIONS,
|
|
295
|
+
BORDER_RADIUS_OPTIONS: () => BORDER_RADIUS_OPTIONS,
|
|
296
|
+
BORDER_SIZE_OPTIONS: () => BORDER_SIZE_OPTIONS,
|
|
297
|
+
BOX_SHADOW_OPTIONS: () => BOX_SHADOW_OPTIONS,
|
|
298
|
+
BREAKPOINTS: () => BREAKPOINTS,
|
|
299
|
+
BREAKPOINT_OPTIONS: () => BREAKPOINT_OPTIONS,
|
|
291
300
|
Badge: () => Badge,
|
|
292
301
|
Box: () => Box,
|
|
293
302
|
Button: () => Button,
|
|
@@ -322,6 +331,10 @@ __export(src_exports, {
|
|
|
322
331
|
DropdownMenuSubContent: () => DropdownMenuSubContent,
|
|
323
332
|
DropdownMenuSubTrigger: () => DropdownMenuSubTrigger,
|
|
324
333
|
DropdownMenuTrigger: () => DropdownMenuTrigger,
|
|
334
|
+
FONT_COLOR_OPTIONS: () => FONT_COLOR_OPTIONS,
|
|
335
|
+
FONT_FAMILY_OPTIONS: () => FONT_FAMILY_OPTIONS,
|
|
336
|
+
FONT_SIZE_OPTIONS: () => FONT_SIZE_OPTIONS,
|
|
337
|
+
FONT_WEIGHT_OPTIONS: () => FONT_WEIGHT_OPTIONS,
|
|
325
338
|
FormControl: () => FormControl,
|
|
326
339
|
FormLabel: () => FormLabel,
|
|
327
340
|
FormikCheckboxInput: () => FormikCheckboxInput,
|
|
@@ -338,8 +351,12 @@ __export(src_exports, {
|
|
|
338
351
|
FormikTimePickerNative: () => FormikTimePickerNative,
|
|
339
352
|
FormikToggleGroup: () => FormikToggleGroup,
|
|
340
353
|
FormikToggleGroupMulti: () => FormikToggleGroupMulti,
|
|
354
|
+
HEADING_SIZE_OPTIONS: () => HEADING_SIZE_OPTIONS,
|
|
355
|
+
HEIGHT_OPTIONS: () => HEIGHT_OPTIONS,
|
|
341
356
|
Heading: () => Heading,
|
|
357
|
+
ICON_NAMES: () => ICON_NAMES,
|
|
342
358
|
Icon: () => Icon,
|
|
359
|
+
LINE_HEIGHT_OPTIONS: () => LINE_HEIGHT_OPTIONS,
|
|
343
360
|
Modal: () => Modal,
|
|
344
361
|
ModalBaseComponent: () => ModalBaseComponent,
|
|
345
362
|
Pagination: () => Pagination,
|
|
@@ -352,6 +369,7 @@ __export(src_exports, {
|
|
|
352
369
|
RangeInput: () => RangeInput,
|
|
353
370
|
ResponsiveContext: () => ResponsiveContext,
|
|
354
371
|
ResponsiveProvider: () => ResponsiveProvider,
|
|
372
|
+
SPACING_OPTIONS: () => SPACING_OPTIONS,
|
|
355
373
|
SelectInput: () => SelectInput,
|
|
356
374
|
SelectInputInset: () => SelectInputInset,
|
|
357
375
|
SelectInputNative: () => SelectInputNative,
|
|
@@ -393,8 +411,33 @@ __export(src_exports, {
|
|
|
393
411
|
TooltipPortal: () => TooltipPortal,
|
|
394
412
|
TooltipProvider: () => TooltipProvider,
|
|
395
413
|
TooltipTrigger: () => TooltipTrigger,
|
|
414
|
+
WIDTH_OPTIONS: () => WIDTH_OPTIONS,
|
|
415
|
+
Z_INDEX_OPTIONS: () => Z_INDEX_OPTIONS,
|
|
416
|
+
Z_INDEX_VALUES: () => Z_INDEX_VALUES,
|
|
396
417
|
boxPropsKeys: () => boxPropsKeys,
|
|
397
418
|
createRectRef: () => createRectRef,
|
|
419
|
+
cssShorthandToClasses: () => cssShorthandToClasses,
|
|
420
|
+
doesStringIncludeCssUnit: () => doesStringIncludeCssUnit,
|
|
421
|
+
filter: () => filter,
|
|
422
|
+
generateBaseClasses: () => generateBaseClasses,
|
|
423
|
+
generateResponsiveClasses: () => generateResponsiveClasses,
|
|
424
|
+
getAutoCompleteValue: () => getAutoCompleteValue,
|
|
425
|
+
getColumnKeys: () => getColumnKeys,
|
|
426
|
+
getDimensionClasses: () => getDimensionClasses,
|
|
427
|
+
getDimensionCss: () => getDimensionCss,
|
|
428
|
+
getDimensionStyles: () => getDimensionStyles,
|
|
429
|
+
getElementType: () => getElementType,
|
|
430
|
+
getFlexClasses: () => getFlexClasses,
|
|
431
|
+
getFlexCss: () => getFlexCss,
|
|
432
|
+
getFlexStyles: () => getFlexStyles,
|
|
433
|
+
handleReactRouterClick: () => handleReactRouterClick,
|
|
434
|
+
isFunction: () => isFunction,
|
|
435
|
+
isModifiedEvent: () => isModifiedEvent,
|
|
436
|
+
isValidSpacingValue: () => isValidSpacingValue,
|
|
437
|
+
mergeRefs: () => mergeRefs,
|
|
438
|
+
parsePropertyValue: () => parsePropertyValue,
|
|
439
|
+
prefersReducedMotion: () => prefersReducedMotion,
|
|
440
|
+
resolveValue: () => resolveValue,
|
|
398
441
|
toast: () => toast,
|
|
399
442
|
useBreakpoint: () => useBreakpoint,
|
|
400
443
|
useDrawer: () => useDrawer,
|
|
@@ -2642,9 +2685,65 @@ var getColumnKeys = (columns) => {
|
|
|
2642
2685
|
return columnKeys;
|
|
2643
2686
|
};
|
|
2644
2687
|
|
|
2688
|
+
// src/lib/getFlexCss.ts
|
|
2689
|
+
var flexValues = ["initial", "auto", "unset", "none", "inherit"];
|
|
2690
|
+
function parsePropertyValue(value) {
|
|
2691
|
+
return Number.isNaN(Number(value)) ? value : Number(value);
|
|
2692
|
+
}
|
|
2693
|
+
function getFlexStyles(value) {
|
|
2694
|
+
if (value === void 0) return value;
|
|
2695
|
+
const styles37 = {};
|
|
2696
|
+
if (!value.includes(" ") && !flexValues.includes(value)) {
|
|
2697
|
+
styles37.flex = value;
|
|
2698
|
+
return styles37;
|
|
2699
|
+
}
|
|
2700
|
+
if (value.includes(" ")) {
|
|
2701
|
+
const flexProps = value.split(" ");
|
|
2702
|
+
styles37.flexGrow = parsePropertyValue(flexProps[0]);
|
|
2703
|
+
if (flexProps.length === 2) {
|
|
2704
|
+
if (doesStringIncludeCssUnit(flexProps[1])) {
|
|
2705
|
+
styles37.flexBasis = parsePropertyValue(flexProps[1]);
|
|
2706
|
+
} else {
|
|
2707
|
+
styles37.flexShrink = parsePropertyValue(flexProps[1]);
|
|
2708
|
+
}
|
|
2709
|
+
} else if (flexProps.length === 3) {
|
|
2710
|
+
styles37.flexShrink = parsePropertyValue(flexProps[1]);
|
|
2711
|
+
styles37.flexBasis = parsePropertyValue(flexProps[2]);
|
|
2712
|
+
}
|
|
2713
|
+
}
|
|
2714
|
+
return styles37;
|
|
2715
|
+
}
|
|
2716
|
+
function getFlexClasses(value) {
|
|
2717
|
+
if (value === void 0 || value.split(" ").length > 1) return [];
|
|
2718
|
+
const classes = [];
|
|
2719
|
+
if (typeof value === "string" && !doesStringIncludeCssUnit(value) && Number.isNaN(Number(value))) {
|
|
2720
|
+
classes.push(`flex-${value}`);
|
|
2721
|
+
}
|
|
2722
|
+
return classes;
|
|
2723
|
+
}
|
|
2724
|
+
function getFlexCss(value) {
|
|
2725
|
+
return {
|
|
2726
|
+
styles: getFlexStyles(value),
|
|
2727
|
+
classes: getFlexClasses(value)
|
|
2728
|
+
};
|
|
2729
|
+
}
|
|
2730
|
+
|
|
2645
2731
|
// src/lib/isFunction.ts
|
|
2646
2732
|
var isFunction = (valOrFunction) => typeof valOrFunction === "function";
|
|
2647
2733
|
|
|
2734
|
+
// src/lib/mergeRefs.ts
|
|
2735
|
+
function mergeRefs(refs) {
|
|
2736
|
+
return (value) => {
|
|
2737
|
+
refs.forEach((ref) => {
|
|
2738
|
+
if (typeof ref === "function") {
|
|
2739
|
+
ref(value);
|
|
2740
|
+
} else if (ref != null) {
|
|
2741
|
+
ref.current = value;
|
|
2742
|
+
}
|
|
2743
|
+
});
|
|
2744
|
+
};
|
|
2745
|
+
}
|
|
2746
|
+
|
|
2648
2747
|
// src/lib/prefersReducedMotion.ts
|
|
2649
2748
|
var prefersReducedMotion = /* @__PURE__ */ (() => {
|
|
2650
2749
|
let shouldReduceMotion;
|
|
@@ -2657,15 +2756,31 @@ var prefersReducedMotion = /* @__PURE__ */ (() => {
|
|
|
2657
2756
|
};
|
|
2658
2757
|
})();
|
|
2659
2758
|
|
|
2759
|
+
// src/lib/reactRouterClickHandler.ts
|
|
2760
|
+
var isModifiedEvent = (e) => !!(e.metaKey || e.altKey || e.ctrlKey || e.shiftKey);
|
|
2761
|
+
var handleReactRouterClick = (event, onClick, target, navigate) => {
|
|
2762
|
+
if (onClick) onClick(event);
|
|
2763
|
+
if (!event.defaultPrevented && // onClick prevented default
|
|
2764
|
+
event.button === 0 && // ignore everything but left clicks
|
|
2765
|
+
(!target || target === "_self") && // let browser handle "target=_blank" etc.
|
|
2766
|
+
!isModifiedEvent(event) && // ignore clicks with modifier keys
|
|
2767
|
+
navigate) {
|
|
2768
|
+
event.preventDefault();
|
|
2769
|
+
navigate();
|
|
2770
|
+
}
|
|
2771
|
+
};
|
|
2772
|
+
|
|
2660
2773
|
// src/lib/resolveValue.ts
|
|
2661
2774
|
var resolveValue = (valOrFunction, arg) => isFunction(valOrFunction) ? valOrFunction(arg) : valOrFunction;
|
|
2662
2775
|
|
|
2663
2776
|
// src/lib/react-children-utilities/filter.ts
|
|
2664
2777
|
var import_react30 = require("react");
|
|
2778
|
+
var filter = (children, filterFn) => import_react30.Children.toArray(children).filter(filterFn);
|
|
2665
2779
|
|
|
2666
2780
|
// src/lib/tokens.ts
|
|
2667
2781
|
var import_variables = __toESM(require("@hyphen/hyphen-design-tokens/build/json/variables"));
|
|
2668
2782
|
var import_icons = require("@hyphen/hyphen-design-tokens/build/assets/icons");
|
|
2783
|
+
var ICON_NAMES = import_icons.ICON_NAMES;
|
|
2669
2784
|
var BORDER_RADIUS_OPTIONS = Object.keys(
|
|
2670
2785
|
import_variables.default.size["border-radius"]
|
|
2671
2786
|
);
|
|
@@ -6230,6 +6345,15 @@ var useTheme = () => {
|
|
|
6230
6345
|
0 && (module.exports = {
|
|
6231
6346
|
Alert,
|
|
6232
6347
|
AspectRatio,
|
|
6348
|
+
BACKGROUND_COLOR_OPTIONS,
|
|
6349
|
+
BASE_COLOR_NAMES,
|
|
6350
|
+
BASE_COLOR_OPTIONS,
|
|
6351
|
+
BORDER_COLOR_OPTIONS,
|
|
6352
|
+
BORDER_RADIUS_OPTIONS,
|
|
6353
|
+
BORDER_SIZE_OPTIONS,
|
|
6354
|
+
BOX_SHADOW_OPTIONS,
|
|
6355
|
+
BREAKPOINTS,
|
|
6356
|
+
BREAKPOINT_OPTIONS,
|
|
6233
6357
|
Badge,
|
|
6234
6358
|
Box,
|
|
6235
6359
|
Button,
|
|
@@ -6264,6 +6388,10 @@ var useTheme = () => {
|
|
|
6264
6388
|
DropdownMenuSubContent,
|
|
6265
6389
|
DropdownMenuSubTrigger,
|
|
6266
6390
|
DropdownMenuTrigger,
|
|
6391
|
+
FONT_COLOR_OPTIONS,
|
|
6392
|
+
FONT_FAMILY_OPTIONS,
|
|
6393
|
+
FONT_SIZE_OPTIONS,
|
|
6394
|
+
FONT_WEIGHT_OPTIONS,
|
|
6267
6395
|
FormControl,
|
|
6268
6396
|
FormLabel,
|
|
6269
6397
|
FormikCheckboxInput,
|
|
@@ -6280,8 +6408,12 @@ var useTheme = () => {
|
|
|
6280
6408
|
FormikTimePickerNative,
|
|
6281
6409
|
FormikToggleGroup,
|
|
6282
6410
|
FormikToggleGroupMulti,
|
|
6411
|
+
HEADING_SIZE_OPTIONS,
|
|
6412
|
+
HEIGHT_OPTIONS,
|
|
6283
6413
|
Heading,
|
|
6414
|
+
ICON_NAMES,
|
|
6284
6415
|
Icon,
|
|
6416
|
+
LINE_HEIGHT_OPTIONS,
|
|
6285
6417
|
Modal,
|
|
6286
6418
|
ModalBaseComponent,
|
|
6287
6419
|
Pagination,
|
|
@@ -6294,6 +6426,7 @@ var useTheme = () => {
|
|
|
6294
6426
|
RangeInput,
|
|
6295
6427
|
ResponsiveContext,
|
|
6296
6428
|
ResponsiveProvider,
|
|
6429
|
+
SPACING_OPTIONS,
|
|
6297
6430
|
SelectInput,
|
|
6298
6431
|
SelectInputInset,
|
|
6299
6432
|
SelectInputNative,
|
|
@@ -6335,8 +6468,33 @@ var useTheme = () => {
|
|
|
6335
6468
|
TooltipPortal,
|
|
6336
6469
|
TooltipProvider,
|
|
6337
6470
|
TooltipTrigger,
|
|
6471
|
+
WIDTH_OPTIONS,
|
|
6472
|
+
Z_INDEX_OPTIONS,
|
|
6473
|
+
Z_INDEX_VALUES,
|
|
6338
6474
|
boxPropsKeys,
|
|
6339
6475
|
createRectRef,
|
|
6476
|
+
cssShorthandToClasses,
|
|
6477
|
+
doesStringIncludeCssUnit,
|
|
6478
|
+
filter,
|
|
6479
|
+
generateBaseClasses,
|
|
6480
|
+
generateResponsiveClasses,
|
|
6481
|
+
getAutoCompleteValue,
|
|
6482
|
+
getColumnKeys,
|
|
6483
|
+
getDimensionClasses,
|
|
6484
|
+
getDimensionCss,
|
|
6485
|
+
getDimensionStyles,
|
|
6486
|
+
getElementType,
|
|
6487
|
+
getFlexClasses,
|
|
6488
|
+
getFlexCss,
|
|
6489
|
+
getFlexStyles,
|
|
6490
|
+
handleReactRouterClick,
|
|
6491
|
+
isFunction,
|
|
6492
|
+
isModifiedEvent,
|
|
6493
|
+
isValidSpacingValue,
|
|
6494
|
+
mergeRefs,
|
|
6495
|
+
parsePropertyValue,
|
|
6496
|
+
prefersReducedMotion,
|
|
6497
|
+
resolveValue,
|
|
6340
6498
|
toast,
|
|
6341
6499
|
useBreakpoint,
|
|
6342
6500
|
useDrawer,
|