opus-toolkit-components 0.3.1 → 0.3.3
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.
|
@@ -27,7 +27,7 @@ return /******/ (() => { // webpackBootstrap
|
|
|
27
27
|
|
|
28
28
|
var ___CSS_LOADER_EXPORT___ = _node_modules_css_loader_dist_runtime_api_js__WEBPACK_IMPORTED_MODULE_1___default()((_node_modules_css_loader_dist_runtime_sourceMaps_js__WEBPACK_IMPORTED_MODULE_0___default()));
|
|
29
29
|
// Module
|
|
30
|
-
___CSS_LOADER_EXPORT___.push([module.id,
|
|
30
|
+
___CSS_LOADER_EXPORT___.push([module.id, ``, "",{"version":3,"sources":[],"names":[],"mappings":"","sourceRoot":""}]);
|
|
31
31
|
// Exports
|
|
32
32
|
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (___CSS_LOADER_EXPORT___);
|
|
33
33
|
|
|
@@ -588,7 +588,7 @@ const Accordion = _ref => {
|
|
|
588
588
|
return /*#__PURE__*/external_react_default().createElement("div", {
|
|
589
589
|
className: "accordion rounded-md"
|
|
590
590
|
}, /*#__PURE__*/external_react_default().createElement("div", {
|
|
591
|
-
className: "accordion-item
|
|
591
|
+
className: "accordion-item rounded-lg",
|
|
592
592
|
key: index
|
|
593
593
|
}, /*#__PURE__*/external_react_default().createElement("div", {
|
|
594
594
|
className: "accordion-header flex justify-between p-2",
|
|
@@ -657,26 +657,48 @@ var update = injectStylesIntoStyleTag_default()(Buttons_button/* default */.A, o
|
|
|
657
657
|
function Button(_ref) {
|
|
658
658
|
let {
|
|
659
659
|
type = 'button',
|
|
660
|
-
cat = 'c247',
|
|
661
|
-
// c247, neutral, destructive, inverse
|
|
662
660
|
rank = 'primary',
|
|
663
|
-
// Primary, secondary, tertiary
|
|
664
661
|
state = 'default',
|
|
665
|
-
// default, hover, disabled
|
|
666
662
|
text = 'Example Button',
|
|
667
663
|
size = 'md',
|
|
668
664
|
isFullWidth = false,
|
|
665
|
+
icon: Icon,
|
|
666
|
+
// Icon as a React component
|
|
667
|
+
iconPosition = 'right',
|
|
668
|
+
// Icon position: 'left' or 'right'
|
|
669
|
+
isIconAnimated = false,
|
|
670
|
+
// Optional animation for icon hover
|
|
671
|
+
className = '',
|
|
672
|
+
// Accepts additional custom class
|
|
669
673
|
onClick
|
|
670
674
|
} = _ref;
|
|
671
|
-
// Define
|
|
675
|
+
// Define styles for button ranks
|
|
672
676
|
const rankStyles = {
|
|
673
|
-
primary: 'bg-
|
|
674
|
-
|
|
675
|
-
|
|
677
|
+
primary: 'bg-brandPink600 hover:bg-brandPink700 text-greyBaseLight',
|
|
678
|
+
secondary: 'bg-greyBaseDark900 hover:bg-brandPink700 text-greyBaseLight',
|
|
679
|
+
outline: 'bg-greyLight50 border-solid border-2 border-greyLight100 hover:border-greyLight700 hover:greyLight100 text-greyLight700',
|
|
680
|
+
neutral: 'bg-greyLight50 hover:bg-greyLight100 text-greyLight700',
|
|
681
|
+
destructive: 'bg-utilRed1000 hover:bg-utilRed800 text-greyBaseLight'
|
|
676
682
|
};
|
|
683
|
+
|
|
684
|
+
// Disabled styles for button
|
|
685
|
+
const disabledStyles = 'bg-greyLight100 text-greyLight500 cursor-not-allowed';
|
|
686
|
+
|
|
687
|
+
// Icon animation style (if applicable)
|
|
688
|
+
const iconClassNames = `
|
|
689
|
+
inline-block
|
|
690
|
+
transition-transform
|
|
691
|
+
ease-in-out
|
|
692
|
+
duration-200
|
|
693
|
+
h-5 w-5
|
|
694
|
+
${iconPosition === 'right' ? 'ml-2' : 'mr-2'}
|
|
695
|
+
${isIconAnimated ? 'group-hover:translate-x-1' : ''}
|
|
696
|
+
`;
|
|
697
|
+
|
|
698
|
+
// Main button class names
|
|
677
699
|
const classNames = `
|
|
678
|
-
${rankStyles[rank] || rankStyles.primary}
|
|
679
|
-
|
|
700
|
+
${state === 'disabled' ? disabledStyles : rankStyles[rank] || rankStyles.primary}
|
|
701
|
+
group
|
|
680
702
|
transition
|
|
681
703
|
ease-in-out
|
|
682
704
|
duration-700
|
|
@@ -684,13 +706,23 @@ function Button(_ref) {
|
|
|
684
706
|
px-6
|
|
685
707
|
py-2
|
|
686
708
|
text-${size}
|
|
709
|
+
flex
|
|
710
|
+
items-center
|
|
711
|
+
justify-center
|
|
712
|
+
whitespace-nowrap // Prevents text wrapping
|
|
687
713
|
${isFullWidth ? 'w-full' : ''}
|
|
714
|
+
${className}
|
|
688
715
|
`;
|
|
689
716
|
return /*#__PURE__*/external_react_default().createElement("button", {
|
|
690
717
|
type: type,
|
|
691
718
|
className: classNames,
|
|
692
|
-
onClick: onClick
|
|
693
|
-
|
|
719
|
+
onClick: state === 'disabled' ? null : onClick,
|
|
720
|
+
disabled: state === 'disabled'
|
|
721
|
+
}, iconPosition === 'left' && Icon && /*#__PURE__*/external_react_default().createElement(Icon, {
|
|
722
|
+
className: iconClassNames
|
|
723
|
+
}), text, iconPosition === 'right' && Icon && /*#__PURE__*/external_react_default().createElement(Icon, {
|
|
724
|
+
className: iconClassNames
|
|
725
|
+
}));
|
|
694
726
|
}
|
|
695
727
|
// EXTERNAL MODULE: ./node_modules/css-loader/dist/cjs.js!./node_modules/sass-loader/dist/cjs.js!./src/components/Cards/card.scss
|
|
696
728
|
var card = __webpack_require__(865);
|
|
@@ -727,9 +759,10 @@ var card_update = injectStylesIntoStyleTag_default()(card/* default */.A, card_o
|
|
|
727
759
|
function Card(_ref) {
|
|
728
760
|
let {
|
|
729
761
|
mode = 'light',
|
|
762
|
+
className = '',
|
|
730
763
|
children
|
|
731
764
|
} = _ref;
|
|
732
|
-
const cardClasses = `p-5 ${mode}-card rounded-lg shadow-lg`;
|
|
765
|
+
const cardClasses = `p-5 ${mode}-card rounded-lg shadow-lg border-solid border-2 border-greyLight100 ${className}`;
|
|
733
766
|
return /*#__PURE__*/external_react_default().createElement("div", {
|
|
734
767
|
className: cardClasses
|
|
735
768
|
}, children);
|
|
@@ -745,12 +778,15 @@ const Input = /*#__PURE__*/(0,external_react_.forwardRef)((_ref, ref) => {
|
|
|
745
778
|
isValid = true,
|
|
746
779
|
errorMessage = `${label} is required`,
|
|
747
780
|
onChange,
|
|
781
|
+
className = '',
|
|
748
782
|
value
|
|
749
783
|
} = _ref;
|
|
750
|
-
const inputClasses =
|
|
784
|
+
const inputClasses = `${className} rounded-md bg-white border border-greyLight500 px-4 py-3 text-md font-normal text-gray-900 ${isValid ? 'border-greyLight500' : 'border-utilRed1000'}`;
|
|
751
785
|
return /*#__PURE__*/external_react_default().createElement("div", {
|
|
752
786
|
className: "flex flex-col mb-4"
|
|
753
|
-
}, /*#__PURE__*/external_react_default().createElement("label",
|
|
787
|
+
}, /*#__PURE__*/external_react_default().createElement("label", {
|
|
788
|
+
className: "text-greyLight1000"
|
|
789
|
+
}, label), /*#__PURE__*/external_react_default().createElement("input", {
|
|
754
790
|
ref: ref,
|
|
755
791
|
className: inputClasses,
|
|
756
792
|
type: type,
|
|
@@ -759,7 +795,7 @@ const Input = /*#__PURE__*/(0,external_react_.forwardRef)((_ref, ref) => {
|
|
|
759
795
|
onChange: onChange,
|
|
760
796
|
value: value
|
|
761
797
|
}), !isValid && /*#__PURE__*/external_react_default().createElement("span", {
|
|
762
|
-
className: "text-
|
|
798
|
+
className: "text-utilRed1000 text-sm"
|
|
763
799
|
}, errorMessage));
|
|
764
800
|
});
|
|
765
801
|
/* harmony default export */ const Inputs_Input = (Input);
|
|
@@ -9035,20 +9071,23 @@ const ForwardRef = /*#__PURE__*/ external_react_.forwardRef(ChevronDownIcon);
|
|
|
9035
9071
|
function Dropdown(_ref) {
|
|
9036
9072
|
let {
|
|
9037
9073
|
items,
|
|
9038
|
-
label =
|
|
9074
|
+
label = 'Test Label',
|
|
9039
9075
|
isValid = true,
|
|
9040
|
-
placeholder =
|
|
9076
|
+
placeholder = 'Example Placeholder',
|
|
9041
9077
|
name,
|
|
9078
|
+
className = '',
|
|
9042
9079
|
onChange,
|
|
9043
|
-
value
|
|
9080
|
+
value,
|
|
9081
|
+
Icon // Left-aligned icon
|
|
9044
9082
|
} = _ref;
|
|
9045
9083
|
const initialSelectedItem = items.find(item => item.value === value) || null;
|
|
9046
9084
|
const [selectedItem, setSelectedItem] = (0,external_react_.useState)(initialSelectedItem);
|
|
9085
|
+
const [isOpen, setIsOpen] = (0,external_react_.useState)(false);
|
|
9047
9086
|
(0,external_react_.useEffect)(() => {
|
|
9048
9087
|
const newSelectedItem = items.find(item => item.value === value) || null;
|
|
9049
9088
|
setSelectedItem(newSelectedItem);
|
|
9050
9089
|
}, [value, items]);
|
|
9051
|
-
const inputClasses = `inline-flex w-full justify-
|
|
9090
|
+
const inputClasses = `inline-flex w-full justify-between items-center rounded-md bg-white text-md font-normal border px-4 py-2 text-greyLight700 ${isValid ? 'border-greyLight500' : 'border-utilRed'} ${className}`;
|
|
9052
9091
|
const handleSelect = item => {
|
|
9053
9092
|
setSelectedItem(item);
|
|
9054
9093
|
const event = {
|
|
@@ -9065,18 +9104,18 @@ function Dropdown(_ref) {
|
|
|
9065
9104
|
name: name
|
|
9066
9105
|
}, /*#__PURE__*/external_react_default().createElement("label", null, label), /*#__PURE__*/external_react_default().createElement("div", null, /*#__PURE__*/external_react_default().createElement(It, {
|
|
9067
9106
|
className: inputClasses,
|
|
9068
|
-
|
|
9069
|
-
|
|
9070
|
-
|
|
9071
|
-
},
|
|
9107
|
+
onClick: () => setIsOpen(prev => !prev)
|
|
9108
|
+
}, /*#__PURE__*/external_react_default().createElement("div", {
|
|
9109
|
+
className: "flex items-center gap-2"
|
|
9110
|
+
}, Icon && /*#__PURE__*/external_react_default().createElement(Icon, {
|
|
9111
|
+
className: "h-5 w-5 text-greyLight700"
|
|
9112
|
+
}), " ", /*#__PURE__*/external_react_default().createElement("span", null, selectedItem ? selectedItem.label : placeholder)), /*#__PURE__*/external_react_default().createElement(esm_ChevronDownIcon, {
|
|
9072
9113
|
"aria-hidden": "true",
|
|
9073
|
-
className:
|
|
9114
|
+
className: `-mr-1 h-5 w-5 text-greyLight700 transition-transform duration-200 ${isOpen ? 'rotate-180' : 'rotate-0'}`
|
|
9074
9115
|
}))), /*#__PURE__*/external_react_default().createElement(gt, {
|
|
9075
9116
|
transition: true,
|
|
9076
|
-
className: "absolute right-0 z-10 mt-2 w-56 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 transition focus:outline-none",
|
|
9077
|
-
|
|
9078
|
-
backgroundColor: 'white'
|
|
9079
|
-
}
|
|
9117
|
+
className: "absolute right-0 z-10 mt-2 w-56 origin-top-right rounded-md bg-white shadow-lg ring-1 ring-black ring-opacity-5 transition focus:outline-none max-h-48 overflow-y-auto",
|
|
9118
|
+
onClick: () => setIsOpen(false)
|
|
9080
9119
|
}, /*#__PURE__*/external_react_default().createElement("div", {
|
|
9081
9120
|
className: "py-1"
|
|
9082
9121
|
}, items.map((item, index) => /*#__PURE__*/external_react_default().createElement(Et, {
|
|
@@ -9088,10 +9127,10 @@ function Dropdown(_ref) {
|
|
|
9088
9127
|
return /*#__PURE__*/external_react_default().createElement("button", {
|
|
9089
9128
|
type: "button",
|
|
9090
9129
|
onClick: () => handleSelect(item),
|
|
9091
|
-
className: `block w-full px-4 py-2 text-left text-sm text-
|
|
9130
|
+
className: `block w-full px-4 py-2 text-left text-sm text-greyLight700 ${active ? 'bg-greyLight100 text-greyLight700' : ''} hover:bg-greyLight100`
|
|
9092
9131
|
}, item.label);
|
|
9093
9132
|
})))), !isValid && /*#__PURE__*/external_react_default().createElement("span", {
|
|
9094
|
-
className: "text-
|
|
9133
|
+
className: "text-utilRed text-sm"
|
|
9095
9134
|
}, "Please select a valid option"));
|
|
9096
9135
|
}
|
|
9097
9136
|
;// ./src/index.js
|
|
@@ -9107,4 +9146,4 @@ function Dropdown(_ref) {
|
|
|
9107
9146
|
/******/ })()
|
|
9108
9147
|
;
|
|
9109
9148
|
});
|
|
9110
|
-
//# sourceMappingURL=main.
|
|
9149
|
+
//# sourceMappingURL=main.5f4fb2e84b8e3334491d.js.map
|