@hyphen/hyphen-components 7.0.0 → 7.2.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/dist/components/SelectInputNative/SelectInputNative.d.ts +6 -4
- package/dist/css/utilities.css +25 -1
- package/dist/css/variables.css +7 -2
- package/dist/hyphen-components.cjs.development.js +11 -4
- package/dist/hyphen-components.cjs.development.js.map +1 -1
- package/dist/hyphen-components.cjs.production.min.js +1 -1
- package/dist/hyphen-components.cjs.production.min.js.map +1 -1
- package/dist/hyphen-components.esm.js +11 -4
- package/dist/hyphen-components.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/Box/Box.stories.tsx +20 -119
- package/src/components/Box/Box.tsx +19 -1
- package/src/components/Formik/Formik.stories.tsx +1 -0
- package/src/components/SelectInputNative/SelectInputNative.stories.tsx +1 -0
- package/src/components/SelectInputNative/SelectInputNative.test.tsx +15 -1
- package/src/components/SelectInputNative/SelectInputNative.tsx +17 -4
- package/src/components/Sidebar/Sidebar.stories.tsx +2 -7
|
@@ -256,6 +256,7 @@ Component, props, getDefault) {
|
|
|
256
256
|
var styles$z = {"box-transition":"Box-module_box-transition__eQx8C"};
|
|
257
257
|
|
|
258
258
|
var _excluded$R = ["as", "alignItems", "alignContent", "alignSelf", "background", "borderColor", "borderWidth", "children", "childGap", "className", "color", "columnGap", "cursor", "display", "direction", "flex", "fontFamily", "fontSize", "focus", "fontWeight", "gap", "height", "hover", "justifyContent", "margin", "maxHeight", "minHeight", "maxWidth", "minWidth", "overflow", "padding", "position", "radius", "rowGap", "shadow", "style", "textAlign", "textTransform", "textWrap", "wrap", "whiteSpace", "width", "wordBreak", "zIndex"];
|
|
259
|
+
var AUTO_FONT_COLOR_BACKGROUNDS = ['success', 'warning', 'danger', 'info'];
|
|
259
260
|
/**
|
|
260
261
|
* A `<Box>` is a layout component to build UIs with consistent padding and spacing between
|
|
261
262
|
* elements.
|
|
@@ -357,6 +358,10 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
357
358
|
var maxWidthCss = getDimensionCss('mw', maxWidth);
|
|
358
359
|
var minHeightCss = getDimensionCss('minh', minHeight);
|
|
359
360
|
var minWidthCss = getDimensionCss('minw', minWidth);
|
|
361
|
+
// `inverse` background uses a matching `inverse` font color instead of the
|
|
362
|
+
// generic auto-mapped colors in AUTO_FONT_COLOR_BACKGROUNDS, so it is
|
|
363
|
+
// intentionally handled separately here.
|
|
364
|
+
var finalColor = color != null ? color : background === 'inverse' ? 'inverse' : AUTO_FONT_COLOR_BACKGROUNDS.includes(background) ? 'grey' : undefined;
|
|
360
365
|
var isFlexBox = typeof display === 'string' && display.includes('flex');
|
|
361
366
|
var flexDirectionClasses = isFlexBox ? generateResponsiveClasses('flex-direction', direction) : null;
|
|
362
367
|
var cssPropertyMap = {
|
|
@@ -399,7 +404,7 @@ var Box = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
|
399
404
|
var boxClasses = classNames.apply(void 0, [className, cssShorthandToClasses('m', margin), cssShorthandToClasses('p', padding), cssShorthandToClasses('br', radius), cssShorthandToClasses('g', gap), cssShorthandToClasses('cg', columnGap), cssShorthandToClasses('rg', rowGap), heightCss.classes, maxHeightCss.classes, minHeightCss.classes, maxWidthCss.classes, minWidthCss.classes, widthCss.classes, flexDirectionClasses, generateResponsiveClasses('display', display), generateResponsiveClasses('justify-content', justifyContent), generateResponsiveClasses('align-items', alignItems), generateResponsiveClasses('align-content', alignContent), generateResponsiveClasses('align-self', alignSelf), generateResponsiveClasses('font-family', fontFamily), generateResponsiveClasses('font-size', fontSize), generateResponsiveClasses('overflow', overflow), generateResponsiveClasses('shadow', shadow), generateResponsiveClasses('flex', flex), cssShorthandToClasses('bw', borderWidth), generateResponsiveClasses('font-weight', fontWeight), generateResponsiveClasses('text-align', textAlign), generateResponsiveClasses('transform', textTransform), generateResponsiveClasses('text-wrap', textWrap), generateResponsiveClasses('position', position), generateResponsiveClasses('z-index', zIndex), generateResponsiveClasses('whitespace', whiteSpace), generateResponsiveClasses('break', wordBreak)].concat(hoverClasses != null ? hoverClasses : [], focusClasses != null ? focusClasses : [], [(_ref3 = {
|
|
400
405
|
'flex-wrap': isFlexBox && wrap,
|
|
401
406
|
'flex-nowrap': isFlexBox && wrap === false
|
|
402
|
-
}, _ref3["background-color-" + background] = background, _ref3["font-color-" +
|
|
407
|
+
}, _ref3["background-color-" + background] = background, _ref3["font-color-" + finalColor] = finalColor, _ref3["border-color-" + borderColor] = borderColor, _ref3["cursor-" + cursor] = cursor, _ref3[styles$z['box-transition']] = hover || focus, _ref3)]));
|
|
403
408
|
var boxStyles = _extends({}, style, heightCss.styles, maxHeightCss.styles, maxWidthCss.styles, widthCss.styles, minHeightCss.styles, minWidthCss.styles);
|
|
404
409
|
/**
|
|
405
410
|
* Creates an object that maps the flex direction to either `right` or `bottom`
|
|
@@ -2643,9 +2648,10 @@ var SelectInputNative = function SelectInputNative(_ref) {
|
|
|
2643
2648
|
restProps = _objectWithoutPropertiesLoose(_ref, _excluded$o);
|
|
2644
2649
|
var placeholderOption = {
|
|
2645
2650
|
value: '',
|
|
2646
|
-
label: placeholder
|
|
2651
|
+
label: placeholder,
|
|
2652
|
+
disabled: true
|
|
2647
2653
|
};
|
|
2648
|
-
var optionsWithPlaceholder = [
|
|
2654
|
+
var optionsWithPlaceholder = [placeholderOption].concat(options);
|
|
2649
2655
|
var responsiveClasses = generateResponsiveClasses('size', size);
|
|
2650
2656
|
var selectWrapperClasses = classNames.apply(void 0, ['hyphen-components__variables__form-control', styles$g['select-input-native-wrapper']].concat(responsiveClasses.map(function (className) {
|
|
2651
2657
|
return styles$g[className];
|
|
@@ -2675,11 +2681,12 @@ var SelectInputNative = function SelectInputNative(_ref) {
|
|
|
2675
2681
|
id: id,
|
|
2676
2682
|
required: isRequired
|
|
2677
2683
|
}, optionsWithPlaceholder.map(function (option) {
|
|
2684
|
+
var _option$disabled;
|
|
2678
2685
|
return React__default.createElement(Box, {
|
|
2679
2686
|
as: "option",
|
|
2680
2687
|
key: option.value,
|
|
2681
2688
|
value: option.value,
|
|
2682
|
-
disabled: option.
|
|
2689
|
+
disabled: (_option$disabled = option.disabled) != null ? _option$disabled : false,
|
|
2683
2690
|
hidden: option.value === '',
|
|
2684
2691
|
color: option.value === '' ? 'disabled' : 'base'
|
|
2685
2692
|
}, option.label);
|