opus-toolkit-components 1.3.4 → 1.3.5
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.
|
@@ -790,10 +790,73 @@ const Pill = _ref => {
|
|
|
790
790
|
}), text);
|
|
791
791
|
};
|
|
792
792
|
/* harmony default export */ const Pills_Pill = (Pill);
|
|
793
|
+
;// ./src/utils/getDataCy.js
|
|
794
|
+
const getDataCy = function () {
|
|
795
|
+
let {
|
|
796
|
+
name,
|
|
797
|
+
value,
|
|
798
|
+
dataCy
|
|
799
|
+
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
800
|
+
if (dataCy) return dataCy;
|
|
801
|
+
if (name && value) return "".concat(name, "-").concat(value);
|
|
802
|
+
return name || '';
|
|
803
|
+
};
|
|
804
|
+
;// ./src/components/Text/Text.jsx
|
|
805
|
+
const _excluded = ["variant", "as", "className", "children", "name", "dataCy"];
|
|
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
|
+
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
|
+
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
|
+
|
|
810
|
+
|
|
811
|
+
const variantMap = {
|
|
812
|
+
h1: 'text-4xl font-bold leading-tight text-[--color-text-strong]',
|
|
813
|
+
h2: 'text-3xl leading-snug text-[--color-text-strong]',
|
|
814
|
+
h3: 'text-2xl font-semibold leading-snug text-[--color-text-strong]',
|
|
815
|
+
h4: 'text-xl font-medium text-[--color-text-strong]',
|
|
816
|
+
h5: 'text-lg font-medium text-[--color-text-strong]',
|
|
817
|
+
h6: 'text-base font-medium text-[--color-text-strong]',
|
|
818
|
+
body: 'text-base text-[--color-text-strong]',
|
|
819
|
+
small: 'text-sm text-[--color-text-strong]',
|
|
820
|
+
caption: 'text-xs text-[--color-text-strong]',
|
|
821
|
+
label: 'text-md text-[--color-text-weak]'
|
|
822
|
+
};
|
|
823
|
+
const elementMap = {
|
|
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
|
+
};
|
|
835
|
+
function Text(_ref) {
|
|
836
|
+
let {
|
|
837
|
+
variant = 'body',
|
|
838
|
+
as,
|
|
839
|
+
className = '',
|
|
840
|
+
children,
|
|
841
|
+
name,
|
|
842
|
+
dataCy
|
|
843
|
+
} = _ref,
|
|
844
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
|
845
|
+
const Component = as || elementMap[variant] || 'p';
|
|
846
|
+
const variantClass = variantMap[variant] || variantMap.body;
|
|
847
|
+
return /*#__PURE__*/external_react_default().createElement(Component, _extends({
|
|
848
|
+
className: "".concat(variantClass, " ").concat(className),
|
|
849
|
+
"data-cy": getDataCy({
|
|
850
|
+
name,
|
|
851
|
+
dataCy
|
|
852
|
+
})
|
|
853
|
+
}, rest), children);
|
|
854
|
+
}
|
|
793
855
|
;// ./src/components/Accordions/Accordion.jsx
|
|
794
856
|
|
|
795
857
|
|
|
796
858
|
|
|
859
|
+
|
|
797
860
|
const Accordion = _ref => {
|
|
798
861
|
let {
|
|
799
862
|
title,
|
|
@@ -801,6 +864,7 @@ const Accordion = _ref => {
|
|
|
801
864
|
activeIndex,
|
|
802
865
|
index,
|
|
803
866
|
isPreview,
|
|
867
|
+
isLocked,
|
|
804
868
|
onExitPreview = () => {},
|
|
805
869
|
content,
|
|
806
870
|
preview,
|
|
@@ -837,29 +901,31 @@ const Accordion = _ref => {
|
|
|
837
901
|
className: "accordion-item",
|
|
838
902
|
key: index
|
|
839
903
|
}, /*#__PURE__*/external_react_default().createElement("div", {
|
|
840
|
-
className: "\n accordion-header\n flex justify-between items-center
|
|
904
|
+
className: "\n accordion-header\n flex \n justify-between \n items-center \n bg-[--color-accordion-header]\n rounded-t-lg\n rounded-b-lg\n "
|
|
841
905
|
}, /*#__PURE__*/external_react_default().createElement("div", {
|
|
842
|
-
className: "flex items-center gap-2 justify-between
|
|
843
|
-
}, /*#__PURE__*/external_react_default().createElement(
|
|
906
|
+
className: "flex items-center gap-2 justify-between"
|
|
907
|
+
}, /*#__PURE__*/external_react_default().createElement(Text, {
|
|
908
|
+
as: "h2",
|
|
909
|
+
variant: "h2",
|
|
844
910
|
className: "my-2 mx-4 text-h4 text-[--color-text-strong]"
|
|
845
911
|
}, title)), /*#__PURE__*/external_react_default().createElement("div", {
|
|
846
912
|
className: "flex items-center gap-4"
|
|
847
|
-
}, isPill
|
|
913
|
+
}, isPill && /*#__PURE__*/external_react_default().createElement(Pills_Pill, {
|
|
848
914
|
text: pillText,
|
|
849
915
|
status: pillStatus,
|
|
850
916
|
icon: pillIcon
|
|
851
|
-
})
|
|
852
|
-
className: "border-0 border-l-2 border-solid border-[--color-stroke] p-4",
|
|
853
|
-
onClick: toggle
|
|
854
|
-
}, isPreview ? /*#__PURE__*/external_react_default().createElement(esm_PencilSquareIcon, {
|
|
917
|
+
}), /*#__PURE__*/external_react_default().createElement("div", {
|
|
918
|
+
className: "border-0 ".concat(!isLocked && 'border-l-2 cursor-pointer', " border-solid border-[--color-stroke] p-4"),
|
|
919
|
+
onClick: !isLocked ? toggle : null // toggle only here
|
|
920
|
+
}, isPreview && !isLocked ? /*#__PURE__*/external_react_default().createElement(esm_PencilSquareIcon, {
|
|
855
921
|
className: "w-5 h-5 text-[--color-text-strong]",
|
|
856
922
|
onClick: e => {
|
|
857
|
-
e.stopPropagation(); // prevent
|
|
858
|
-
onExitPreview(); // trigger exit
|
|
923
|
+
e.stopPropagation(); // prevent toggle from firing on pencil click
|
|
924
|
+
onExitPreview(); // trigger exit preview
|
|
859
925
|
}
|
|
860
|
-
}) : /*#__PURE__*/external_react_default().createElement(esm_ChevronDownIcon, {
|
|
926
|
+
}) : !isLocked ? /*#__PURE__*/external_react_default().createElement(esm_ChevronDownIcon, {
|
|
861
927
|
className: "w-4 h-4 text-[--color-text-strong] transition-transform transform ".concat(isActive ? 'rotate-180' : 'rotate-0')
|
|
862
|
-
}))))), isActive && /*#__PURE__*/external_react_default().createElement("div", {
|
|
928
|
+
}) : null)))), isActive && /*#__PURE__*/external_react_default().createElement("div", {
|
|
863
929
|
className: "accordion-body rounded-b-lg text-[--color-text-weak] bg-[--color-accordion-body] border-0 border-t-2 border-solid border-[--color-stroke] p-3"
|
|
864
930
|
}, content), isPreview && activeIndex !== index && /*#__PURE__*/external_react_default().createElement("div", {
|
|
865
931
|
className: "accordion-body rounded-b-lg bg-[--color-accordion-body] text-[--color-text-weak] border-0 border-t-2 border-solid border-[--color-stroke] p-3"
|
|
@@ -1144,10 +1210,10 @@ var DefaultContext = {
|
|
|
1144
1210
|
};
|
|
1145
1211
|
var IconContext = external_react_.createContext && /*#__PURE__*/external_react_.createContext(DefaultContext);
|
|
1146
1212
|
;// ./node_modules/react-icons/lib/iconBase.mjs
|
|
1147
|
-
var
|
|
1148
|
-
function
|
|
1149
|
-
function
|
|
1150
|
-
function
|
|
1213
|
+
var iconBase_excluded = ["attr", "size", "title"];
|
|
1214
|
+
function iconBase_objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = iconBase_objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
1215
|
+
function iconBase_objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } } return target; }
|
|
1216
|
+
function iconBase_extends() { iconBase_extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return iconBase_extends.apply(this, arguments); }
|
|
1151
1217
|
function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
1152
1218
|
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
1153
1219
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
@@ -1161,7 +1227,7 @@ function Tree2Element(tree) {
|
|
|
1161
1227
|
}, node.attr), Tree2Element(node.child)));
|
|
1162
1228
|
}
|
|
1163
1229
|
function iconBase_GenIcon(data) {
|
|
1164
|
-
return props => /*#__PURE__*/external_react_.createElement(IconBase,
|
|
1230
|
+
return props => /*#__PURE__*/external_react_.createElement(IconBase, iconBase_extends({
|
|
1165
1231
|
attr: _objectSpread({}, data.attr)
|
|
1166
1232
|
}, props), Tree2Element(data.child));
|
|
1167
1233
|
}
|
|
@@ -1172,12 +1238,12 @@ function IconBase(props) {
|
|
|
1172
1238
|
size,
|
|
1173
1239
|
title
|
|
1174
1240
|
} = props,
|
|
1175
|
-
svgProps =
|
|
1241
|
+
svgProps = iconBase_objectWithoutProperties(props, iconBase_excluded);
|
|
1176
1242
|
var computedSize = size || conf.size || "1em";
|
|
1177
1243
|
var className;
|
|
1178
1244
|
if (conf.className) className = conf.className;
|
|
1179
1245
|
if (props.className) className = (className ? className + " " : "") + props.className;
|
|
1180
|
-
return /*#__PURE__*/external_react_.createElement("svg",
|
|
1246
|
+
return /*#__PURE__*/external_react_.createElement("svg", iconBase_extends({
|
|
1181
1247
|
stroke: "currentColor",
|
|
1182
1248
|
fill: "currentColor",
|
|
1183
1249
|
strokeWidth: "0"
|
|
@@ -3694,17 +3760,6 @@ function AiTwotoneWarning (props) {
|
|
|
3694
3760
|
return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 1024 1024"},"child":[{"tag":"path","attr":{"fill":"#333","d":"M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zm-783.5-27.9L512 239.9l339.8 588.2H172.2z"},"child":[]},{"tag":"path","attr":{"fill":"#E6E6E6","d":"M172.2 828.1h679.6L512 239.9 172.2 828.1zM560 720a48.01 48.01 0 0 1-96 0 48.01 48.01 0 0 1 96 0zm-16-304v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8z"},"child":[]},{"tag":"path","attr":{"fill":"#333","d":"M464 720a48 48 0 1 0 96 0 48 48 0 1 0-96 0zm16-304v184c0 4.4 3.6 8 8 8h48c4.4 0 8-3.6 8-8V416c0-4.4-3.6-8-8-8h-48c-4.4 0-8 3.6-8 8z"},"child":[]}]})(props);
|
|
3695
3761
|
};
|
|
3696
3762
|
|
|
3697
|
-
;// ./src/utils/getDataCy.js
|
|
3698
|
-
const getDataCy = function () {
|
|
3699
|
-
let {
|
|
3700
|
-
name,
|
|
3701
|
-
value,
|
|
3702
|
-
dataCy
|
|
3703
|
-
} = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
|
3704
|
-
if (dataCy) return dataCy;
|
|
3705
|
-
if (name && value) return "".concat(name, "-").concat(value);
|
|
3706
|
-
return name || '';
|
|
3707
|
-
};
|
|
3708
3763
|
;// ./src/components/Buttons/Button.js
|
|
3709
3764
|
|
|
3710
3765
|
|
|
@@ -3803,57 +3858,6 @@ function Card(_ref) {
|
|
|
3803
3858
|
className: cardClasses
|
|
3804
3859
|
}, children);
|
|
3805
3860
|
}
|
|
3806
|
-
;// ./src/components/Text/Text.jsx
|
|
3807
|
-
const Text_excluded = ["variant", "as", "className", "children", "name", "dataCy"];
|
|
3808
|
-
function Text_extends() { return Text_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; }, Text_extends.apply(null, arguments); }
|
|
3809
|
-
function Text_objectWithoutProperties(e, t) { if (null == e) return {}; var o, r, i = Text_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; }
|
|
3810
|
-
function Text_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; }
|
|
3811
|
-
|
|
3812
|
-
|
|
3813
|
-
const variantMap = {
|
|
3814
|
-
h1: 'text-4xl font-bold leading-tight text-[--color-text-strong]',
|
|
3815
|
-
h2: 'text-3xl font-semibold leading-snug text-[--color-text-strong]',
|
|
3816
|
-
h3: 'text-2xl font-semibold leading-snug text-[--color-text-strong]',
|
|
3817
|
-
h4: 'text-xl font-medium text-[--color-text-strong]',
|
|
3818
|
-
h5: 'text-lg font-medium text-[--color-text-strong]',
|
|
3819
|
-
h6: 'text-base font-medium text-[--color-text-strong]',
|
|
3820
|
-
body: 'text-base text-[--color-text-strong]',
|
|
3821
|
-
small: 'text-sm text-[--color-text-strong]',
|
|
3822
|
-
caption: 'text-xs text-[--color-text-strong]',
|
|
3823
|
-
label: 'text-md text-[--color-text-weak]'
|
|
3824
|
-
};
|
|
3825
|
-
const elementMap = {
|
|
3826
|
-
h1: 'h1',
|
|
3827
|
-
h2: 'h2',
|
|
3828
|
-
h3: 'h3',
|
|
3829
|
-
h4: 'h4',
|
|
3830
|
-
h5: 'h5',
|
|
3831
|
-
h6: 'h6',
|
|
3832
|
-
body: 'p',
|
|
3833
|
-
small: 'small',
|
|
3834
|
-
caption: 'span',
|
|
3835
|
-
label: 'label'
|
|
3836
|
-
};
|
|
3837
|
-
function Text(_ref) {
|
|
3838
|
-
let {
|
|
3839
|
-
variant = 'body',
|
|
3840
|
-
as,
|
|
3841
|
-
className = '',
|
|
3842
|
-
children,
|
|
3843
|
-
name,
|
|
3844
|
-
dataCy
|
|
3845
|
-
} = _ref,
|
|
3846
|
-
rest = Text_objectWithoutProperties(_ref, Text_excluded);
|
|
3847
|
-
const Component = as || elementMap[variant] || 'p';
|
|
3848
|
-
const variantClass = variantMap[variant] || variantMap.body;
|
|
3849
|
-
return /*#__PURE__*/external_react_default().createElement(Component, Text_extends({
|
|
3850
|
-
className: "".concat(variantClass, " ").concat(className),
|
|
3851
|
-
"data-cy": getDataCy({
|
|
3852
|
-
name,
|
|
3853
|
-
dataCy
|
|
3854
|
-
})
|
|
3855
|
-
}, rest), children);
|
|
3856
|
-
}
|
|
3857
3861
|
;// ./src/components/Forms/Inputs/Input.jsx
|
|
3858
3862
|
function Input_ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
3859
3863
|
function Input_objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? Input_ownKeys(Object(t), !0).forEach(function (r) { Input_defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : Input_ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
|