@xqmsg/ui-core 0.23.3 → 0.24.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/components/input/InputTypes.d.ts +1 -1
- package/dist/components/input/index.d.ts +3 -3
- package/dist/components/select/index.d.ts +6 -5
- package/dist/components/text/index.d.ts +2 -2
- package/dist/theme/components/button.d.ts +64 -0
- package/dist/ui-core.cjs.development.js +57 -19
- package/dist/ui-core.cjs.development.js.map +1 -1
- package/dist/ui-core.cjs.production.min.js +1 -1
- package/dist/ui-core.cjs.production.min.js.map +1 -1
- package/dist/ui-core.esm.js +57 -19
- package/dist/ui-core.esm.js.map +1 -1
- package/package.json +2 -2
- package/src/components/button/Button.stories.tsx +27 -0
- package/src/components/input/InputTypes.ts +7 -1
- package/src/components/input/StackedSelect/index.tsx +1 -1
- package/src/components/input/index.tsx +17 -16
- package/src/components/select/index.tsx +18 -19
- package/src/components/text/index.tsx +2 -2
- package/src/theme/components/button.ts +49 -0
package/dist/ui-core.esm.js
CHANGED
|
@@ -1161,9 +1161,7 @@ var StackedSelect = /*#__PURE__*/React__default.forwardRef(function (_ref2, _ref
|
|
|
1161
1161
|
}))), isFocussed && /*#__PURE__*/React__default.createElement(Dropdown, {
|
|
1162
1162
|
position: position,
|
|
1163
1163
|
dropdownRef: dropdownMenuRef,
|
|
1164
|
-
onSelectItem:
|
|
1165
|
-
return handleOnSelectItem(option);
|
|
1166
|
-
},
|
|
1164
|
+
onSelectItem: handleOnSelectItem,
|
|
1167
1165
|
options: options,
|
|
1168
1166
|
optionIndex: optionIndex
|
|
1169
1167
|
}));
|
|
@@ -1894,7 +1892,7 @@ function Input(_ref) {
|
|
|
1894
1892
|
setError = _ref.setError,
|
|
1895
1893
|
clearErrors = _ref.clearErrors,
|
|
1896
1894
|
separators = _ref.separators;
|
|
1897
|
-
|
|
1895
|
+
function selectedInputField(onChange, onBlur, ref, value) {
|
|
1898
1896
|
switch (inputType) {
|
|
1899
1897
|
case 'text':
|
|
1900
1898
|
return /*#__PURE__*/React__default.createElement(StackedInput, {
|
|
@@ -2038,7 +2036,7 @@ function Input(_ref) {
|
|
|
2038
2036
|
default:
|
|
2039
2037
|
return null;
|
|
2040
2038
|
}
|
|
2041
|
-
}
|
|
2039
|
+
}
|
|
2042
2040
|
var nonLabeledInputs = ['checkbox'];
|
|
2043
2041
|
return /*#__PURE__*/React__default.createElement(Controller, {
|
|
2044
2042
|
control: control,
|
|
@@ -3016,7 +3014,7 @@ var _excluded$4 = ["label", "ariaLabel", "className", "placeholder", "name", "he
|
|
|
3016
3014
|
/**
|
|
3017
3015
|
* A functional React component utilized to render the `SelectNative` component.
|
|
3018
3016
|
*/
|
|
3019
|
-
|
|
3017
|
+
function SelectNative(_ref) {
|
|
3020
3018
|
var name = _ref.name,
|
|
3021
3019
|
helperText = _ref.helperText,
|
|
3022
3020
|
options = _ref.options,
|
|
@@ -3045,26 +3043,21 @@ var SelectNative = function SelectNative(_ref) {
|
|
|
3045
3043
|
borderLeft: 'none',
|
|
3046
3044
|
borderRight: 'none'
|
|
3047
3045
|
};
|
|
3048
|
-
var handleOnSelectItem = function handleOnSelectItem(
|
|
3046
|
+
var handleOnSelectItem = function handleOnSelectItem(e) {
|
|
3047
|
+
var selectedValue = e.target.value;
|
|
3049
3048
|
var selectedOption = options == null ? void 0 : options.find(function (_ref2) {
|
|
3050
3049
|
var val = _ref2.value;
|
|
3051
3050
|
return selectedValue === val;
|
|
3052
3051
|
});
|
|
3053
3052
|
if (selectedOption) {
|
|
3054
3053
|
if (onChange) {
|
|
3055
|
-
onChange(
|
|
3054
|
+
onChange(e);
|
|
3056
3055
|
}
|
|
3057
3056
|
setValue(name, selectedOption.value);
|
|
3058
3057
|
} else {
|
|
3059
3058
|
setValue(name, selectedValue);
|
|
3060
3059
|
}
|
|
3061
3060
|
};
|
|
3062
|
-
useEffect(function () {
|
|
3063
|
-
if (defaultValue) {
|
|
3064
|
-
handleOnSelectItem(defaultValue);
|
|
3065
|
-
}
|
|
3066
|
-
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
3067
|
-
}, [defaultValue]);
|
|
3068
3061
|
return /*#__PURE__*/React__default.createElement(Controller, {
|
|
3069
3062
|
control: control,
|
|
3070
3063
|
name: name,
|
|
@@ -3086,9 +3079,8 @@ var SelectNative = function SelectNative(_ref) {
|
|
|
3086
3079
|
ref: ref,
|
|
3087
3080
|
value: value,
|
|
3088
3081
|
disabled: disabled != null ? disabled : false,
|
|
3089
|
-
onChange:
|
|
3090
|
-
|
|
3091
|
-
},
|
|
3082
|
+
onChange: handleOnSelectItem,
|
|
3083
|
+
defaultValue: defaultValue,
|
|
3092
3084
|
style: style
|
|
3093
3085
|
}), options && options.map(function (i) {
|
|
3094
3086
|
return /*#__PURE__*/React__default.createElement("option", {
|
|
@@ -3098,7 +3090,7 @@ var SelectNative = function SelectNative(_ref) {
|
|
|
3098
3090
|
})), isInvalid ? /*#__PURE__*/React__default.createElement(FormErrorMessage, null, errorText) : helperText && /*#__PURE__*/React__default.createElement(FormHelperText, null, helperText));
|
|
3099
3091
|
}
|
|
3100
3092
|
});
|
|
3101
|
-
}
|
|
3093
|
+
}
|
|
3102
3094
|
|
|
3103
3095
|
/**
|
|
3104
3096
|
* A functional React component utilized to render the `BorderedBox` component
|
|
@@ -3776,6 +3768,28 @@ var variantTertiary = function variantTertiary() {
|
|
|
3776
3768
|
}
|
|
3777
3769
|
});
|
|
3778
3770
|
};
|
|
3771
|
+
var variantDanger = function variantDanger() {
|
|
3772
|
+
return _extends$6({}, baseStyle$2, {
|
|
3773
|
+
fontWeight: '400',
|
|
3774
|
+
color: colors.label.primary.dark,
|
|
3775
|
+
bg: colors.label.error,
|
|
3776
|
+
_hover: {
|
|
3777
|
+
bg: colors.label.error
|
|
3778
|
+
},
|
|
3779
|
+
_active: {
|
|
3780
|
+
color: colors.label.primary.dark,
|
|
3781
|
+
bg: colors.label.error
|
|
3782
|
+
},
|
|
3783
|
+
_focus: {
|
|
3784
|
+
color: colors.label.primary.dark,
|
|
3785
|
+
bg: colors.label.error
|
|
3786
|
+
},
|
|
3787
|
+
_disabled: {
|
|
3788
|
+
backgroundColor: colors.label.error,
|
|
3789
|
+
color: colors.label.secondary.light
|
|
3790
|
+
}
|
|
3791
|
+
});
|
|
3792
|
+
};
|
|
3779
3793
|
var variantPrimaryFlat = function variantPrimaryFlat() {
|
|
3780
3794
|
return _extends$6({}, baseStyle$2, {
|
|
3781
3795
|
bg: colors.fill.action,
|
|
@@ -3835,13 +3849,37 @@ var variantTertiaryFlat = function variantTertiaryFlat() {
|
|
|
3835
3849
|
}
|
|
3836
3850
|
});
|
|
3837
3851
|
};
|
|
3852
|
+
var variantDangerFlat = function variantDangerFlat() {
|
|
3853
|
+
return _extends$6({}, variantPrimaryFlat(), {
|
|
3854
|
+
fontWeight: '400',
|
|
3855
|
+
color: colors.label.primary.dark,
|
|
3856
|
+
bg: colors.label.error,
|
|
3857
|
+
_hover: {
|
|
3858
|
+
bg: colors.label.error
|
|
3859
|
+
},
|
|
3860
|
+
_active: {
|
|
3861
|
+
color: colors.label.primary.dark,
|
|
3862
|
+
bg: colors.label.error
|
|
3863
|
+
},
|
|
3864
|
+
_focus: {
|
|
3865
|
+
color: colors.label.primary.dark,
|
|
3866
|
+
bg: colors.label.error
|
|
3867
|
+
},
|
|
3868
|
+
_disabled: {
|
|
3869
|
+
backgroundColor: colors.label.error,
|
|
3870
|
+
color: colors.label.secondary.light
|
|
3871
|
+
}
|
|
3872
|
+
});
|
|
3873
|
+
};
|
|
3838
3874
|
var variants$2 = {
|
|
3839
3875
|
primary: /*#__PURE__*/variantPrimary(),
|
|
3840
3876
|
secondary: /*#__PURE__*/variantSecondary(),
|
|
3841
3877
|
tertiary: /*#__PURE__*/variantTertiary(),
|
|
3878
|
+
danger: /*#__PURE__*/variantDanger(),
|
|
3842
3879
|
'flat-primary': /*#__PURE__*/variantPrimaryFlat(),
|
|
3843
3880
|
'flat-secondary': /*#__PURE__*/variantSecondaryFlat(),
|
|
3844
|
-
'flat-tertiary': /*#__PURE__*/variantTertiaryFlat()
|
|
3881
|
+
'flat-tertiary': /*#__PURE__*/variantTertiaryFlat(),
|
|
3882
|
+
'flat-danger': /*#__PURE__*/variantDangerFlat()
|
|
3845
3883
|
};
|
|
3846
3884
|
var defaultProps$2 = {
|
|
3847
3885
|
variant: 'primary'
|