opus-toolkit-components 1.4.9 → 1.5.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.
|
@@ -802,50 +802,51 @@ const getDataCy = function () {
|
|
|
802
802
|
return name || '';
|
|
803
803
|
};
|
|
804
804
|
;// ./src/components/Text/Text.jsx
|
|
805
|
-
const _excluded = ["variant", "as", "className", "children", "name", "dataCy"];
|
|
805
|
+
const _excluded = ["variant", "as", "className", "color", "children", "name", "dataCy"];
|
|
806
806
|
function _extends() { return _extends = Object.assign ? Object.assign.bind() : function (n) { for (var e = 1; e < arguments.length; e++) { var t = arguments[e]; for (var r in t) ({}).hasOwnProperty.call(t, r) && (n[r] = t[r]); } return n; }, _extends.apply(null, arguments); }
|
|
807
807
|
function _objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = _objectWithoutPropertiesLoose(e, t); if (Object.getOwnPropertySymbols) { var n = Object.getOwnPropertySymbols(e); for (r = 0; r < n.length; r++) o = n[r], -1 === t.indexOf(o) && {}.propertyIsEnumerable.call(e, o) && (i[o] = e[o]); } return i; }
|
|
808
808
|
function _objectWithoutPropertiesLoose(r, e) { if (null == r) return {}; var t = {}; for (var n in r) if ({}.hasOwnProperty.call(r, n)) { if (-1 !== e.indexOf(n)) continue; t[n] = r[n]; } return t; }
|
|
809
809
|
|
|
810
810
|
|
|
811
811
|
const variantMap = {
|
|
812
|
-
h1:
|
|
813
|
-
h2:
|
|
814
|
-
h3:
|
|
815
|
-
h4:
|
|
816
|
-
h5:
|
|
817
|
-
h6:
|
|
818
|
-
body:
|
|
819
|
-
small:
|
|
820
|
-
caption:
|
|
821
|
-
label:
|
|
812
|
+
h1: "text-4xl font-bold leading-tight",
|
|
813
|
+
h2: "text-3xl leading-snug",
|
|
814
|
+
h3: "text-2xl font-semibold leading-snug",
|
|
815
|
+
h4: "text-xl font-medium",
|
|
816
|
+
h5: "text-lg font-medium",
|
|
817
|
+
h6: "text-base font-medium",
|
|
818
|
+
body: "text-base",
|
|
819
|
+
small: "text-sm",
|
|
820
|
+
caption: "text-xs",
|
|
821
|
+
label: "text-md"
|
|
822
822
|
};
|
|
823
823
|
const elementMap = {
|
|
824
|
-
h1:
|
|
825
|
-
h2:
|
|
826
|
-
h3:
|
|
827
|
-
h4:
|
|
828
|
-
h5:
|
|
829
|
-
h6:
|
|
830
|
-
body:
|
|
831
|
-
small:
|
|
832
|
-
caption:
|
|
833
|
-
label:
|
|
824
|
+
h1: "h1",
|
|
825
|
+
h2: "h2",
|
|
826
|
+
h3: "h3",
|
|
827
|
+
h4: "h4",
|
|
828
|
+
h5: "h5",
|
|
829
|
+
h6: "h6",
|
|
830
|
+
body: "p",
|
|
831
|
+
small: "small",
|
|
832
|
+
caption: "span",
|
|
833
|
+
label: "label"
|
|
834
834
|
};
|
|
835
835
|
function Text(_ref) {
|
|
836
836
|
let {
|
|
837
|
-
variant =
|
|
837
|
+
variant = "body",
|
|
838
838
|
as,
|
|
839
|
-
className =
|
|
839
|
+
className = "",
|
|
840
|
+
color = "text-[--color-text-strong]",
|
|
840
841
|
children,
|
|
841
842
|
name,
|
|
842
843
|
dataCy
|
|
843
844
|
} = _ref,
|
|
844
845
|
rest = _objectWithoutProperties(_ref, _excluded);
|
|
845
|
-
const Component = as || elementMap[variant] ||
|
|
846
|
+
const Component = as || elementMap[variant] || "p";
|
|
846
847
|
const variantClass = variantMap[variant] || variantMap.body;
|
|
847
848
|
return /*#__PURE__*/external_react_default().createElement(Component, _extends({
|
|
848
|
-
className: "".concat(variantClass, " ").concat(className),
|
|
849
|
+
className: "".concat(variantClass, " ").concat(color, " ").concat(className),
|
|
849
850
|
"data-cy": getDataCy({
|
|
850
851
|
name,
|
|
851
852
|
dataCy
|
|
@@ -4121,24 +4122,24 @@ const RadioButton = _ref => {
|
|
|
4121
4122
|
let {
|
|
4122
4123
|
label,
|
|
4123
4124
|
options = [{
|
|
4124
|
-
value:
|
|
4125
|
-
label:
|
|
4125
|
+
value: "single",
|
|
4126
|
+
label: "Single"
|
|
4126
4127
|
}, {
|
|
4127
|
-
value:
|
|
4128
|
-
label:
|
|
4128
|
+
value: "married",
|
|
4129
|
+
label: "Married / Living with Partner"
|
|
4129
4130
|
}, {
|
|
4130
|
-
value:
|
|
4131
|
-
label:
|
|
4131
|
+
value: "divorced",
|
|
4132
|
+
label: "Divorced"
|
|
4132
4133
|
}, {
|
|
4133
|
-
value:
|
|
4134
|
-
label:
|
|
4134
|
+
value: "other",
|
|
4135
|
+
label: "Other"
|
|
4135
4136
|
}],
|
|
4136
4137
|
name,
|
|
4137
4138
|
value,
|
|
4138
4139
|
onChange,
|
|
4139
|
-
className =
|
|
4140
|
-
tabIndex =
|
|
4141
|
-
title =
|
|
4140
|
+
className = "",
|
|
4141
|
+
tabIndex = "",
|
|
4142
|
+
title = "",
|
|
4142
4143
|
isValid = true,
|
|
4143
4144
|
errorMessage = "".concat(label, " is required"),
|
|
4144
4145
|
required = false,
|
|
@@ -4157,15 +4158,15 @@ const RadioButton = _ref => {
|
|
|
4157
4158
|
onChange === null || onChange === void 0 || onChange(event);
|
|
4158
4159
|
};
|
|
4159
4160
|
return /*#__PURE__*/external_react_default().createElement("div", {
|
|
4160
|
-
className: "flex flex-col
|
|
4161
|
+
className: "mb-4 flex flex-col ".concat(className)
|
|
4161
4162
|
}, /*#__PURE__*/external_react_default().createElement(Text, {
|
|
4162
4163
|
as: "label",
|
|
4163
4164
|
variant: "label",
|
|
4164
|
-
className: "text-[--color-text-strong]
|
|
4165
|
+
className: "mb-2 flex items-center text-[--color-text-strong]"
|
|
4165
4166
|
}, label, required && /*#__PURE__*/external_react_default().createElement(Text, {
|
|
4166
4167
|
as: "span",
|
|
4167
4168
|
variant: "small",
|
|
4168
|
-
className: "text-[--color-util-red]
|
|
4169
|
+
className: "ml-1 text-[--color-util-red]"
|
|
4169
4170
|
}, "*")), /*#__PURE__*/external_react_default().createElement("div", {
|
|
4170
4171
|
className: "flex flex-wrap gap-4 md:flex-nowrap md:gap-0 md:space-x-4"
|
|
4171
4172
|
}, options.map(option => {
|
|
@@ -4173,7 +4174,7 @@ const RadioButton = _ref => {
|
|
|
4173
4174
|
return /*#__PURE__*/external_react_default().createElement("label", {
|
|
4174
4175
|
key: option.value,
|
|
4175
4176
|
htmlFor: id,
|
|
4176
|
-
className: "
|
|
4177
|
+
className: "mb-1 flex items-center whitespace-break-spaces rounded-lg border px-4 py-2 text-center transition duration-200 hover:border-[--color-primary-btn] ".concat(selectedValue === option.value ? "border-[--color-stroke] bg-[--color-primary-btn] text-[--color-white]" : "bg-[--color-input-bg] text-[--color-text-strong] ".concat(!isValid && selectedValue === "" ? "border-[--color-util-red]" : "border-[--color-stroke]"), " ").concat(disabled ? "cursor-not-allowed opacity-50" : "cursor-pointer")
|
|
4177
4178
|
}, /*#__PURE__*/external_react_default().createElement("input", {
|
|
4178
4179
|
id: id,
|
|
4179
4180
|
type: "radio",
|
|
@@ -4199,7 +4200,7 @@ const RadioButton = _ref => {
|
|
|
4199
4200
|
className: "text-[--color-util-red]"
|
|
4200
4201
|
}, errorMessage));
|
|
4201
4202
|
};
|
|
4202
|
-
RadioButton.displayName =
|
|
4203
|
+
RadioButton.displayName = "RadioButton";
|
|
4203
4204
|
/* harmony default export */ const Radios_RadioButton = (RadioButton);
|
|
4204
4205
|
;// ./src/components/Forms/Checkbox/Checkbox.jsx
|
|
4205
4206
|
|