@flexmatch-dev/react-ui 0.0.1 → 0.0.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.
- package/cjs/assets/icon-check.d.ts +7 -0
- package/cjs/assets/icon-check.d.ts.map +1 -0
- package/cjs/assets/icon-check.js +28 -0
- package/cjs/assets/icon-close.d.ts +3 -0
- package/cjs/assets/icon-close.d.ts.map +1 -0
- package/cjs/assets/icon-close.js +24 -0
- package/cjs/assets/icon-selectbox-arrow.d.ts +7 -0
- package/cjs/assets/icon-selectbox-arrow.d.ts.map +1 -0
- package/cjs/assets/icon-selectbox-arrow.js +28 -0
- package/cjs/assets/index.d.ts +4 -0
- package/cjs/assets/index.d.ts.map +1 -0
- package/cjs/assets/index.js +27 -0
- package/cjs/components/Input/Chip/InputChipButton.d.ts +5 -0
- package/cjs/components/Input/Chip/InputChipButton.d.ts.map +1 -0
- package/cjs/components/Input/Chip/InputChipButton.js +31 -0
- package/cjs/components/Input/Chip/InputChipRow.d.ts +13 -0
- package/cjs/components/Input/Chip/InputChipRow.d.ts.map +1 -0
- package/cjs/components/Input/Chip/InputChipRow.js +96 -0
- package/cjs/components/Input/Chip/InputTextbox.d.ts +5 -0
- package/cjs/components/Input/Chip/InputTextbox.d.ts.map +1 -0
- package/cjs/components/Input/Chip/InputTextbox.js +30 -0
- package/cjs/components/Input/Chip/index.d.ts +15 -0
- package/cjs/components/Input/Chip/index.d.ts.map +1 -0
- package/cjs/components/Input/Chip/index.js +17 -0
- package/cjs/components/Input/Selectable/InputButtonMultiSelect.d.ts +14 -0
- package/cjs/components/Input/Selectable/InputButtonMultiSelect.d.ts.map +1 -0
- package/cjs/components/Input/Selectable/InputButtonMultiSelect.js +96 -0
- package/cjs/components/Input/Selectable/InputButtonSelect.d.ts +14 -0
- package/cjs/components/Input/Selectable/InputButtonSelect.d.ts.map +1 -0
- package/cjs/components/Input/Selectable/InputButtonSelect.js +65 -0
- package/cjs/components/Input/Selectable/InputButtonSelectButton.d.ts +14 -0
- package/cjs/components/Input/Selectable/InputButtonSelectButton.d.ts.map +1 -0
- package/cjs/components/Input/Selectable/InputButtonSelectButton.js +78 -0
- package/cjs/components/Input/Selectable/InputCardSelect.d.ts +14 -0
- package/cjs/components/Input/Selectable/InputCardSelect.d.ts.map +1 -0
- package/cjs/components/Input/Selectable/InputCardSelect.js +65 -0
- package/cjs/components/Input/Selectable/InputCardSelectButton.d.ts +14 -0
- package/cjs/components/Input/Selectable/InputCardSelectButton.d.ts.map +1 -0
- package/cjs/components/Input/Selectable/InputCardSelectButton.js +85 -0
- package/cjs/components/Input/Selectable/InputCheckbox.d.ts +11 -0
- package/cjs/components/Input/Selectable/InputCheckbox.d.ts.map +1 -0
- package/cjs/components/Input/Selectable/InputCheckbox.js +43 -0
- package/cjs/components/Input/Selectable/InputOptionSwitch.d.ts.map +1 -1
- package/cjs/components/Input/Selectable/InputOptionSwitch.js +5 -2
- package/cjs/components/Input/Selectable/InputOptionSwitchButton.d.ts +2 -1
- package/cjs/components/Input/Selectable/InputOptionSwitchButton.d.ts.map +1 -1
- package/cjs/components/Input/Selectable/InputOptionSwitchButton.js +5 -1
- package/cjs/components/Input/Selectable/InputRadiobutton.d.ts +10 -0
- package/cjs/components/Input/Selectable/InputRadiobutton.d.ts.map +1 -0
- package/cjs/components/Input/Selectable/InputRadiobutton.js +45 -0
- package/cjs/components/Input/Selectable/InputSelectbox.d.ts +12 -0
- package/cjs/components/Input/Selectable/InputSelectbox.d.ts.map +1 -0
- package/cjs/components/Input/Selectable/InputSelectbox.js +92 -0
- package/cjs/components/atoms/button.ui.d.ts +6 -0
- package/cjs/components/atoms/button.ui.d.ts.map +1 -0
- package/cjs/components/atoms/button.ui.js +31 -0
- package/cjs/components/atoms/card-select.ui.d.ts +14 -0
- package/cjs/components/atoms/card-select.ui.d.ts.map +1 -0
- package/cjs/components/atoms/card-select.ui.js +72 -0
- package/cjs/components/atoms/checkbox.ui.d.ts +9 -0
- package/cjs/components/atoms/checkbox.ui.d.ts.map +1 -0
- package/cjs/components/atoms/checkbox.ui.js +86 -0
- package/cjs/components/atoms/chip.ui.d.ts +10 -0
- package/cjs/components/atoms/chip.ui.d.ts.map +1 -0
- package/cjs/components/atoms/chip.ui.js +35 -0
- package/cjs/components/atoms/index.d.ts +9 -0
- package/cjs/components/atoms/index.d.ts.map +1 -0
- package/cjs/components/atoms/index.js +62 -0
- package/cjs/components/atoms/info-card.ui.d.ts +7 -0
- package/cjs/components/atoms/info-card.ui.d.ts.map +1 -0
- package/cjs/components/atoms/info-card.ui.js +36 -0
- package/cjs/components/atoms/radio.ui.d.ts +14 -0
- package/cjs/components/atoms/radio.ui.d.ts.map +1 -0
- package/cjs/components/atoms/radio.ui.js +52 -0
- package/cjs/components/atoms/select.ui.d.ts +19 -0
- package/cjs/components/atoms/select.ui.d.ts.map +1 -0
- package/cjs/components/atoms/select.ui.js +87 -0
- package/cjs/components/atoms/textarea.ui.d.ts +5 -0
- package/cjs/components/atoms/textarea.ui.d.ts.map +1 -0
- package/cjs/components/atoms/textarea.ui.js +33 -0
- package/cjs/components/atoms/textbox.ui.d.ts +6 -1
- package/cjs/components/atoms/textbox.ui.d.ts.map +1 -1
- package/cjs/components/atoms/textbox.ui.js +54 -7
- package/cjs/constant/chip.constant.d.ts +5 -0
- package/cjs/constant/chip.constant.d.ts.map +1 -0
- package/cjs/constant/chip.constant.js +10 -0
- package/cjs/context/Input.d.ts +15 -0
- package/cjs/context/Input.d.ts.map +1 -1
- package/cjs/index.d.ts +12 -1
- package/cjs/index.d.ts.map +1 -1
- package/cjs/index.js +77 -16
- package/dist/index.css +1083 -3
- package/lib/assets/icon-check.d.ts +7 -0
- package/lib/assets/icon-check.d.ts.map +1 -0
- package/lib/assets/icon-check.js +22 -0
- package/lib/assets/icon-close.d.ts +3 -0
- package/lib/assets/icon-close.d.ts.map +1 -0
- package/lib/assets/icon-close.js +18 -0
- package/lib/assets/icon-selectbox-arrow.d.ts +7 -0
- package/lib/assets/icon-selectbox-arrow.d.ts.map +1 -0
- package/lib/assets/icon-selectbox-arrow.js +22 -0
- package/lib/assets/index.d.ts +4 -0
- package/lib/assets/index.d.ts.map +1 -0
- package/lib/assets/index.js +3 -0
- package/lib/components/Input/Chip/InputChipButton.d.ts +5 -0
- package/lib/components/Input/Chip/InputChipButton.d.ts.map +1 -0
- package/lib/components/Input/Chip/InputChipButton.js +24 -0
- package/lib/components/Input/Chip/InputChipRow.d.ts +13 -0
- package/lib/components/Input/Chip/InputChipRow.d.ts.map +1 -0
- package/lib/components/Input/Chip/InputChipRow.js +89 -0
- package/lib/components/Input/Chip/InputTextbox.d.ts +5 -0
- package/lib/components/Input/Chip/InputTextbox.d.ts.map +1 -0
- package/lib/components/Input/Chip/InputTextbox.js +23 -0
- package/lib/components/Input/Chip/index.d.ts +15 -0
- package/lib/components/Input/Chip/index.d.ts.map +1 -0
- package/lib/components/Input/Chip/index.js +10 -0
- package/lib/components/Input/Selectable/InputButtonMultiSelect.d.ts +14 -0
- package/lib/components/Input/Selectable/InputButtonMultiSelect.d.ts.map +1 -0
- package/lib/components/Input/Selectable/InputButtonMultiSelect.js +89 -0
- package/lib/components/Input/Selectable/InputButtonSelect.d.ts +14 -0
- package/lib/components/Input/Selectable/InputButtonSelect.d.ts.map +1 -0
- package/lib/components/Input/Selectable/InputButtonSelect.js +58 -0
- package/lib/components/Input/Selectable/InputButtonSelectButton.d.ts +14 -0
- package/lib/components/Input/Selectable/InputButtonSelectButton.d.ts.map +1 -0
- package/lib/components/Input/Selectable/InputButtonSelectButton.js +71 -0
- package/lib/components/Input/Selectable/InputCardSelect.d.ts +14 -0
- package/lib/components/Input/Selectable/InputCardSelect.d.ts.map +1 -0
- package/lib/components/Input/Selectable/InputCardSelect.js +58 -0
- package/lib/components/Input/Selectable/InputCardSelectButton.d.ts +14 -0
- package/lib/components/Input/Selectable/InputCardSelectButton.d.ts.map +1 -0
- package/lib/components/Input/Selectable/InputCardSelectButton.js +78 -0
- package/lib/components/Input/Selectable/InputCheckbox.d.ts +11 -0
- package/lib/components/Input/Selectable/InputCheckbox.d.ts.map +1 -0
- package/lib/components/Input/Selectable/InputCheckbox.js +37 -0
- package/lib/components/Input/Selectable/InputOptionSwitch.d.ts.map +1 -1
- package/lib/components/Input/Selectable/InputOptionSwitch.js +6 -2
- package/lib/components/Input/Selectable/InputOptionSwitchButton.d.ts +2 -1
- package/lib/components/Input/Selectable/InputOptionSwitchButton.d.ts.map +1 -1
- package/lib/components/Input/Selectable/InputOptionSwitchButton.js +4 -1
- package/lib/components/Input/Selectable/InputRadiobutton.d.ts +10 -0
- package/lib/components/Input/Selectable/InputRadiobutton.d.ts.map +1 -0
- package/lib/components/Input/Selectable/InputRadiobutton.js +38 -0
- package/lib/components/Input/Selectable/InputSelectbox.d.ts +12 -0
- package/lib/components/Input/Selectable/InputSelectbox.d.ts.map +1 -0
- package/lib/components/Input/Selectable/InputSelectbox.js +85 -0
- package/lib/components/atoms/button.ui.d.ts +6 -0
- package/lib/components/atoms/button.ui.d.ts.map +1 -0
- package/lib/components/atoms/button.ui.js +24 -0
- package/lib/components/atoms/card-select.ui.d.ts +14 -0
- package/lib/components/atoms/card-select.ui.d.ts.map +1 -0
- package/lib/components/atoms/card-select.ui.js +65 -0
- package/lib/components/atoms/checkbox.ui.d.ts +9 -0
- package/lib/components/atoms/checkbox.ui.d.ts.map +1 -0
- package/lib/components/atoms/checkbox.ui.js +79 -0
- package/lib/components/atoms/chip.ui.d.ts +10 -0
- package/lib/components/atoms/chip.ui.d.ts.map +1 -0
- package/lib/components/atoms/chip.ui.js +28 -0
- package/lib/components/atoms/index.d.ts +9 -0
- package/lib/components/atoms/index.d.ts.map +1 -0
- package/lib/components/atoms/index.js +8 -0
- package/lib/components/atoms/info-card.ui.d.ts +7 -0
- package/lib/components/atoms/info-card.ui.d.ts.map +1 -0
- package/lib/components/atoms/info-card.ui.js +29 -0
- package/lib/components/atoms/radio.ui.d.ts +14 -0
- package/lib/components/atoms/radio.ui.d.ts.map +1 -0
- package/lib/components/atoms/radio.ui.js +45 -0
- package/lib/components/atoms/select.ui.d.ts +19 -0
- package/lib/components/atoms/select.ui.d.ts.map +1 -0
- package/lib/components/atoms/select.ui.js +80 -0
- package/lib/components/atoms/textarea.ui.d.ts +5 -0
- package/lib/components/atoms/textarea.ui.d.ts.map +1 -0
- package/lib/components/atoms/textarea.ui.js +26 -0
- package/lib/components/atoms/textbox.ui.d.ts +6 -1
- package/lib/components/atoms/textbox.ui.d.ts.map +1 -1
- package/lib/components/atoms/textbox.ui.js +56 -9
- package/lib/constant/chip.constant.d.ts +5 -0
- package/lib/constant/chip.constant.d.ts.map +1 -0
- package/lib/constant/chip.constant.js +4 -0
- package/lib/context/Input.d.ts +15 -0
- package/lib/context/Input.d.ts.map +1 -1
- package/lib/index.d.ts +12 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +17 -3
- package/package.json +1 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-check.d.ts","sourceRoot":"","sources":["../../src/assets/icon-check.tsx"],"names":[],"mappings":"AAAA,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AACD,QAAA,MAAM,SAAS,GAAI,iBAAuC,cAAc,4CAkBvE,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
var IconCheck = function IconCheck(_ref) {
|
|
3
|
+
var _ref$color = _ref.color,
|
|
4
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
5
|
+
_ref$size = _ref.size,
|
|
6
|
+
size = _ref$size === void 0 ? 20 : _ref$size;
|
|
7
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
8
|
+
width: size,
|
|
9
|
+
height: size,
|
|
10
|
+
viewBox: "0 0 16 16",
|
|
11
|
+
fill: "none",
|
|
12
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
13
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
14
|
+
d: "M12.6667 4L5.33333 11.3333L2.66667 8.66667",
|
|
15
|
+
stroke: color,
|
|
16
|
+
strokeWidth: "1.5",
|
|
17
|
+
strokeLinecap: "round",
|
|
18
|
+
strokeLinejoin: "round"
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export default IconCheck;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-close.d.ts","sourceRoot":"","sources":["../../src/assets/icon-close.tsx"],"names":[],"mappings":"AAAA,QAAA,MAAM,SAAS,+CAYd,CAAC;AACF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
var IconClose = function IconClose() {
|
|
3
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
4
|
+
width: "12",
|
|
5
|
+
height: "12",
|
|
6
|
+
viewBox: "0 0 12 12",
|
|
7
|
+
fill: "none",
|
|
8
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
9
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
10
|
+
d: "M9 3L3 9M3 3L9 9",
|
|
11
|
+
stroke: "currentColor",
|
|
12
|
+
strokeWidth: "1.5",
|
|
13
|
+
strokeLinecap: "round",
|
|
14
|
+
strokeLinejoin: "round"
|
|
15
|
+
})
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
export default IconClose;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
interface IconSelectboxArrowProps {
|
|
2
|
+
color?: string;
|
|
3
|
+
size?: number;
|
|
4
|
+
}
|
|
5
|
+
declare const IconSelectboxArrow: ({ color, size }: IconSelectboxArrowProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
|
+
export default IconSelectboxArrow;
|
|
7
|
+
//# sourceMappingURL=icon-selectbox-arrow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icon-selectbox-arrow.d.ts","sourceRoot":"","sources":["../../src/assets/icon-selectbox-arrow.tsx"],"names":[],"mappings":"AAAA,UAAU,uBAAuB;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AACD,QAAA,MAAM,kBAAkB,GAAI,iBAAuC,uBAAuB,4CAgBzF,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
var IconSelectboxArrow = function IconSelectboxArrow(_ref) {
|
|
3
|
+
var _ref$color = _ref.color,
|
|
4
|
+
color = _ref$color === void 0 ? 'currentColor' : _ref$color,
|
|
5
|
+
_ref$size = _ref.size,
|
|
6
|
+
size = _ref$size === void 0 ? 20 : _ref$size;
|
|
7
|
+
return /*#__PURE__*/_jsx("svg", {
|
|
8
|
+
width: size,
|
|
9
|
+
height: size,
|
|
10
|
+
viewBox: "0 0 24 24",
|
|
11
|
+
fill: "none",
|
|
12
|
+
stroke: color,
|
|
13
|
+
strokeWidth: "2",
|
|
14
|
+
strokeLinecap: "round",
|
|
15
|
+
strokeLinejoin: "round",
|
|
16
|
+
className: "lucide lucide-chevron-down",
|
|
17
|
+
children: /*#__PURE__*/_jsx("path", {
|
|
18
|
+
d: "M6 9l6 6 6-6"
|
|
19
|
+
})
|
|
20
|
+
});
|
|
21
|
+
};
|
|
22
|
+
export default IconSelectboxArrow;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/assets/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC;AACpD,OAAO,EAAE,OAAO,IAAI,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AACvE,OAAO,EAAE,OAAO,IAAI,SAAS,EAAE,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { ButtonHTMLAttributes } from 'react';
|
|
2
|
+
type InputChipButtonProps = ButtonHTMLAttributes<HTMLButtonElement>;
|
|
3
|
+
declare const InputChipButton: ({ onClick, ...props }: InputChipButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
4
|
+
export default InputChipButton;
|
|
5
|
+
//# sourceMappingURL=InputChipButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputChipButton.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/Chip/InputChipButton.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAE7C,KAAK,oBAAoB,GAAG,oBAAoB,CAAC,iBAAiB,CAAC,CAAC;AACpE,QAAA,MAAM,eAAe,GAAI,uBAAuB,oBAAoB,4CAMnE,CAAC;AAEF,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["onClick"];
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
import ButtonUI from "../../atoms/button.ui";
|
|
11
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
12
|
+
var InputChipButton = function InputChipButton(_ref) {
|
|
13
|
+
var onClick = _ref.onClick,
|
|
14
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
15
|
+
return /*#__PURE__*/_jsx(ButtonUI, _objectSpread(_objectSpread({
|
|
16
|
+
variant: "chip-add",
|
|
17
|
+
onClick: onClick
|
|
18
|
+
}, props), {}, {
|
|
19
|
+
children: /*#__PURE__*/_jsx("span", {
|
|
20
|
+
children: "\uCD94\uAC00"
|
|
21
|
+
})
|
|
22
|
+
}));
|
|
23
|
+
};
|
|
24
|
+
export default InputChipButton;
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { HTMLAttributes } from 'react';
|
|
2
|
+
export interface InputChipRowProps extends Omit<HTMLAttributes<HTMLDivElement>, 'onChange'> {
|
|
3
|
+
placeholder?: string;
|
|
4
|
+
values: string[];
|
|
5
|
+
onChange: (values: string[]) => void;
|
|
6
|
+
limit?: number;
|
|
7
|
+
}
|
|
8
|
+
declare const InputChipRow: {
|
|
9
|
+
({ values, onChange, placeholder, className, limit, ...props }: InputChipRowProps): import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
displayName: string;
|
|
11
|
+
};
|
|
12
|
+
export default InputChipRow;
|
|
13
|
+
//# sourceMappingURL=InputChipRow.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputChipRow.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/Chip/InputChipRow.tsx"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAyB,MAAM,OAAO,CAAC;AAY9D,MAAM,WAAW,iBAAkB,SAAQ,IAAI,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC;IACzF,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,QAAQ,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,KAAK,IAAI,CAAC;IACrC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,QAAA,MAAM,YAAY;oEAOf,iBAAiB;;CAiEnB,CAAC;AAGF,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["values", "onChange", "placeholder", "className", "limit"];
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
9
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
11
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
12
|
+
function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
|
|
13
|
+
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
14
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
15
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
16
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
17
|
+
function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
18
|
+
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; }
|
|
19
|
+
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; }
|
|
20
|
+
import clsx from 'clsx';
|
|
21
|
+
import { useCallback, useState } from 'react';
|
|
22
|
+
import { CHIP_REGEX_DOUBLE_SPACES, CHIP_REGEX_WHITELIST, CHIP_REGEX_BLACKLIST, CHIP_REGEX_SINGLE_SPACE } from "../../../constant/chip.constant";
|
|
23
|
+
import InputChipButton from "./InputChipButton";
|
|
24
|
+
import InputChipTextbox from "./InputTextbox";
|
|
25
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
26
|
+
var InputChipRow = function InputChipRow(_ref) {
|
|
27
|
+
var values = _ref.values,
|
|
28
|
+
onChange = _ref.onChange,
|
|
29
|
+
placeholder = _ref.placeholder,
|
|
30
|
+
className = _ref.className,
|
|
31
|
+
limit = _ref.limit,
|
|
32
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
33
|
+
var _useState = useState(false),
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
isExceededLimit = _useState2[0],
|
|
36
|
+
setIsExceededLimit = _useState2[1];
|
|
37
|
+
var _useState3 = useState(''),
|
|
38
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
|
+
inputValue = _useState4[0],
|
|
40
|
+
setInputValue = _useState4[1];
|
|
41
|
+
var handleChange = useCallback(function (value) {
|
|
42
|
+
var trimmedInput = value.trim().replace(CHIP_REGEX_DOUBLE_SPACES, ' ');
|
|
43
|
+
var isAvailable = trimmedInput && CHIP_REGEX_WHITELIST.test(trimmedInput);
|
|
44
|
+
var isUnavailable = !trimmedInput || CHIP_REGEX_BLACKLIST.test(trimmedInput);
|
|
45
|
+
if (isAvailable) {
|
|
46
|
+
if (limit && values.length >= limit) {
|
|
47
|
+
setIsExceededLimit(true);
|
|
48
|
+
} else {
|
|
49
|
+
setInputValue('');
|
|
50
|
+
onChange([].concat(_toConsumableArray(values.filter(function (value) {
|
|
51
|
+
return value.toLowerCase().replace(CHIP_REGEX_SINGLE_SPACE, '') !== trimmedInput.toLowerCase().replace(CHIP_REGEX_SINGLE_SPACE, '');
|
|
52
|
+
})), [trimmedInput]));
|
|
53
|
+
}
|
|
54
|
+
} else if (isUnavailable) {
|
|
55
|
+
var newInput = trimmedInput.replace(CHIP_REGEX_BLACKLIST, '');
|
|
56
|
+
setInputValue(newInput);
|
|
57
|
+
}
|
|
58
|
+
}, [values, limit, onChange]);
|
|
59
|
+
var handleButtonClick = useCallback(function () {
|
|
60
|
+
handleChange(inputValue);
|
|
61
|
+
}, [inputValue, handleChange]);
|
|
62
|
+
var handleKeyDown = useCallback(function (e) {
|
|
63
|
+
if (e.key === 'Enter' && e.nativeEvent.isComposing === false) {
|
|
64
|
+
e.preventDefault();
|
|
65
|
+
handleChange(inputValue);
|
|
66
|
+
}
|
|
67
|
+
}, [inputValue, handleChange]);
|
|
68
|
+
return /*#__PURE__*/_jsxs("div", _objectSpread(_objectSpread({
|
|
69
|
+
className: clsx('flex flex-row gap-2 items-center', isExceededLimit && 'flexmatch-chip-row-buzz', className)
|
|
70
|
+
}, props), {}, {
|
|
71
|
+
children: [/*#__PURE__*/_jsx(InputChipTextbox, {
|
|
72
|
+
value: inputValue,
|
|
73
|
+
error: isExceededLimit,
|
|
74
|
+
onFocus: function onFocus() {
|
|
75
|
+
return limit && setIsExceededLimit(false);
|
|
76
|
+
},
|
|
77
|
+
onChange: function onChange(e) {
|
|
78
|
+
var _e$target$value;
|
|
79
|
+
return setInputValue((_e$target$value = e.target.value) !== null && _e$target$value !== void 0 ? _e$target$value : '');
|
|
80
|
+
},
|
|
81
|
+
onKeyDown: handleKeyDown,
|
|
82
|
+
placeholder: placeholder
|
|
83
|
+
}), /*#__PURE__*/_jsx(InputChipButton, {
|
|
84
|
+
onClick: handleButtonClick
|
|
85
|
+
})]
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
88
|
+
InputChipRow.displayName = 'InputChipRow';
|
|
89
|
+
export default InputChipRow;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
declare const InputChipTextbox: import("react").ForwardRefExoticComponent<import("react").InputHTMLAttributes<HTMLInputElement> & {
|
|
2
|
+
error?: boolean;
|
|
3
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
4
|
+
export default InputChipTextbox;
|
|
5
|
+
//# sourceMappingURL=InputTextbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputTextbox.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/Chip/InputTextbox.tsx"],"names":[],"mappings":"AAQA,QAAA,MAAM,gBAAgB;YAHZ,OAAO;oDAOhB,CAAC;AAGF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["error"];
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
import { forwardRef } from 'react';
|
|
11
|
+
import TextboxUI from "../../atoms/textbox.ui";
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
var InputChipTextbox = /*#__PURE__*/forwardRef(function (_ref, ref) {
|
|
14
|
+
var error = _ref.error,
|
|
15
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
16
|
+
return /*#__PURE__*/_jsx(TextboxUI, _objectSpread(_objectSpread({
|
|
17
|
+
ref: ref
|
|
18
|
+
}, props), {}, {
|
|
19
|
+
error: error
|
|
20
|
+
}));
|
|
21
|
+
});
|
|
22
|
+
InputChipTextbox.displayName = 'InputTextboxChip';
|
|
23
|
+
export default InputChipTextbox;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare const InputChip: {
|
|
2
|
+
({ values, onChange, placeholder, className, limit, ...props }: import("./InputChipRow").InputChipRowProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
displayName: string;
|
|
4
|
+
} & {
|
|
5
|
+
Chip: {
|
|
6
|
+
({ className, onDelete, ...props }: import("../../atoms/chip.ui").ChipUIProps): import("react/jsx-runtime").JSX.Element;
|
|
7
|
+
displayName: string;
|
|
8
|
+
};
|
|
9
|
+
Textbox: import("react").ForwardRefExoticComponent<import("react").InputHTMLAttributes<HTMLInputElement> & {
|
|
10
|
+
error?: boolean;
|
|
11
|
+
} & import("react").RefAttributes<HTMLInputElement>>;
|
|
12
|
+
Button: ({ onClick, ...props }: import("react").ButtonHTMLAttributes<HTMLButtonElement>) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
export default InputChip;
|
|
15
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/Chip/index.tsx"],"names":[],"mappings":"AAMA,QAAA,MAAM,SAAS;;;;;;;;;;;;CAIb,CAAC;AACH,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChipUI } from "../../atoms";
|
|
2
|
+
import InputChipButton from "./InputChipButton";
|
|
3
|
+
import InputChipRow from "./InputChipRow";
|
|
4
|
+
import InputChipTextbox from "./InputTextbox";
|
|
5
|
+
var InputChip = Object.assign(InputChipRow, {
|
|
6
|
+
Chip: ChipUI,
|
|
7
|
+
Textbox: InputChipTextbox,
|
|
8
|
+
Button: InputChipButton
|
|
9
|
+
});
|
|
10
|
+
export default InputChip;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InputMultiSelectableProps, InputSelectableExtraOption } from '@/context/Input';
|
|
2
|
+
export interface InputButtonMultiSelectProps<T> extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>, InputMultiSelectableProps<T> {
|
|
3
|
+
id?: string | undefined;
|
|
4
|
+
title?: string | undefined;
|
|
5
|
+
description?: string | undefined;
|
|
6
|
+
extraOptions: InputSelectableExtraOption<T>[];
|
|
7
|
+
size?: 'small' | 'normal';
|
|
8
|
+
}
|
|
9
|
+
declare const InputButtonMultiSelect: {
|
|
10
|
+
<T>({ id, className, options, size, value, onChange, title, description, extraOptions, ...props }: InputButtonMultiSelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export default InputButtonMultiSelect;
|
|
14
|
+
//# sourceMappingURL=InputButtonMultiSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputButtonMultiSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/Selectable/InputButtonMultiSelect.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,yBAAyB,EAAE,0BAA0B,EAAE,MAAM,iBAAiB,CAAC;AAIxF,MAAM,WAAW,2BAA2B,CAAC,CAAC,CAC5C,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,EAAE,yBAAyB,CAAC,CAAC,CAAC;IAC5F,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,EAAE,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9C,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC3B;AACD,QAAA,MAAM,sBAAsB;KAAI,CAAC,iGAW9B,2BAA2B,CAAC,CAAC,CAAC;;CAqDhC,CAAC;AAEF,eAAe,sBAAsB,CAAC"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["id", "className", "options", "size", "value", "onChange", "title", "description", "extraOptions"];
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
function _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }
|
|
9
|
+
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
10
|
+
function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
|
|
11
|
+
function _iterableToArray(r) { if ("undefined" != typeof Symbol && null != r[Symbol.iterator] || null != r["@@iterator"]) return Array.from(r); }
|
|
12
|
+
function _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }
|
|
13
|
+
function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
|
|
14
|
+
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; }
|
|
15
|
+
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; }
|
|
16
|
+
import clsx from 'clsx';
|
|
17
|
+
import { useCallback, useMemo } from 'react';
|
|
18
|
+
import InputButtonSelectButton from "./InputButtonSelectButton";
|
|
19
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
20
|
+
var InputButtonMultiSelect = function InputButtonMultiSelect(_ref) {
|
|
21
|
+
var id = _ref.id,
|
|
22
|
+
className = _ref.className,
|
|
23
|
+
options = _ref.options,
|
|
24
|
+
_ref$size = _ref.size,
|
|
25
|
+
size = _ref$size === void 0 ? 'normal' : _ref$size,
|
|
26
|
+
value = _ref.value,
|
|
27
|
+
onChange = _ref.onChange,
|
|
28
|
+
title = _ref.title,
|
|
29
|
+
description = _ref.description,
|
|
30
|
+
extraOptions = _ref.extraOptions,
|
|
31
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
32
|
+
var trueOptions = useMemo(function () {
|
|
33
|
+
return options.filter(function (option) {
|
|
34
|
+
return option.value !== '*';
|
|
35
|
+
}).map(function (_ref2) {
|
|
36
|
+
var value = _ref2.value;
|
|
37
|
+
return value;
|
|
38
|
+
});
|
|
39
|
+
}, [options]);
|
|
40
|
+
var handleSelect = useCallback(function (eventKey) {
|
|
41
|
+
if (eventKey !== null) {
|
|
42
|
+
var option = options.find(function (opt) {
|
|
43
|
+
return String(opt.value) === String(eventKey);
|
|
44
|
+
});
|
|
45
|
+
if (option && onChange) {
|
|
46
|
+
if (option.value === '*') {
|
|
47
|
+
if ((value === null || value === void 0 ? void 0 : value.length) === trueOptions.length) {
|
|
48
|
+
onChange([]);
|
|
49
|
+
} else {
|
|
50
|
+
onChange(trueOptions);
|
|
51
|
+
}
|
|
52
|
+
} else {
|
|
53
|
+
var isSelected = value === null || value === void 0 ? void 0 : value.includes(option.value);
|
|
54
|
+
if (isSelected) {
|
|
55
|
+
var _value$filter;
|
|
56
|
+
onChange((_value$filter = value === null || value === void 0 ? void 0 : value.filter(function (v) {
|
|
57
|
+
return v !== option.value;
|
|
58
|
+
})) !== null && _value$filter !== void 0 ? _value$filter : []);
|
|
59
|
+
} else {
|
|
60
|
+
onChange([].concat(_toConsumableArray(value !== null && value !== void 0 ? value : []), [option.value]));
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}, [options, onChange, value, trueOptions]);
|
|
66
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
67
|
+
id: id,
|
|
68
|
+
className: clsx(className, 'flexmatch-button-select-container')
|
|
69
|
+
}, props), {}, {
|
|
70
|
+
children: options.map(function (option) {
|
|
71
|
+
var extraOption = extraOptions.find(function (opt) {
|
|
72
|
+
return opt.value === option.value;
|
|
73
|
+
});
|
|
74
|
+
var isSelected = option.value === '*' ? (value === null || value === void 0 ? void 0 : value.length) === trueOptions.length : value === null || value === void 0 ? void 0 : value.includes(option.value);
|
|
75
|
+
return /*#__PURE__*/_jsx(InputButtonSelectButton, {
|
|
76
|
+
size: size,
|
|
77
|
+
disabled: option.disabled,
|
|
78
|
+
isSelected: isSelected,
|
|
79
|
+
eventKey: String(option.value),
|
|
80
|
+
onSelect: handleSelect,
|
|
81
|
+
title: option.label,
|
|
82
|
+
description: extraOption === null || extraOption === void 0 ? void 0 : extraOption.description,
|
|
83
|
+
icon: extraOption === null || extraOption === void 0 ? void 0 : extraOption.icon
|
|
84
|
+
}, String(option.value));
|
|
85
|
+
})
|
|
86
|
+
}));
|
|
87
|
+
};
|
|
88
|
+
InputButtonMultiSelect.displayName = 'InputButtonMultiSelect';
|
|
89
|
+
export default InputButtonMultiSelect;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { InputSelectableExtraOption, InputSelectableProps } from '@/context/Input';
|
|
2
|
+
export interface InputButtonSelectProps<T> extends Omit<React.HTMLAttributes<HTMLDivElement>, 'onChange'>, InputSelectableProps<T> {
|
|
3
|
+
id?: string | undefined;
|
|
4
|
+
title?: string | undefined;
|
|
5
|
+
description?: string | undefined;
|
|
6
|
+
extraOptions: InputSelectableExtraOption<T>[];
|
|
7
|
+
size?: 'small' | 'normal';
|
|
8
|
+
}
|
|
9
|
+
declare const InputButtonSelect: {
|
|
10
|
+
<T>({ id, className, options, size, value, onChange, title, description, extraOptions, ...props }: InputButtonSelectProps<T>): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
displayName: string;
|
|
12
|
+
};
|
|
13
|
+
export default InputButtonSelect;
|
|
14
|
+
//# sourceMappingURL=InputButtonSelect.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputButtonSelect.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/Selectable/InputButtonSelect.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AAInF,MAAM,WAAW,sBAAsB,CAAC,CAAC,CACvC,SAAQ,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,cAAc,CAAC,EAAE,UAAU,CAAC,EAAE,oBAAoB,CAAC,CAAC,CAAC;IACvF,EAAE,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,EAAE,0BAA0B,CAAC,CAAC,CAAC,EAAE,CAAC;IAC9C,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;CAC3B;AACD,QAAA,MAAM,iBAAiB;KAAI,CAAC,iGAWzB,sBAAsB,CAAC,CAAC,CAAC;;CAiC3B,CAAC;AAEF,eAAe,iBAAiB,CAAC"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["id", "className", "options", "size", "value", "onChange", "title", "description", "extraOptions"];
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
import clsx from 'clsx';
|
|
11
|
+
import { useCallback } from 'react';
|
|
12
|
+
import InputButtonSelectButton from "./InputButtonSelectButton";
|
|
13
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
14
|
+
var InputButtonSelect = function InputButtonSelect(_ref) {
|
|
15
|
+
var id = _ref.id,
|
|
16
|
+
className = _ref.className,
|
|
17
|
+
options = _ref.options,
|
|
18
|
+
_ref$size = _ref.size,
|
|
19
|
+
size = _ref$size === void 0 ? 'normal' : _ref$size,
|
|
20
|
+
value = _ref.value,
|
|
21
|
+
onChange = _ref.onChange,
|
|
22
|
+
title = _ref.title,
|
|
23
|
+
description = _ref.description,
|
|
24
|
+
extraOptions = _ref.extraOptions,
|
|
25
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
26
|
+
var handleSelect = useCallback(function (eventKey) {
|
|
27
|
+
if (eventKey !== null) {
|
|
28
|
+
var option = options.find(function (opt) {
|
|
29
|
+
return String(opt.value) === String(eventKey);
|
|
30
|
+
});
|
|
31
|
+
if (option && onChange) {
|
|
32
|
+
onChange(option.value);
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}, [options, onChange]);
|
|
36
|
+
return /*#__PURE__*/_jsx("div", _objectSpread(_objectSpread({
|
|
37
|
+
id: id,
|
|
38
|
+
className: clsx(className, 'flexmatch-button-select-container')
|
|
39
|
+
}, props), {}, {
|
|
40
|
+
children: options.map(function (option) {
|
|
41
|
+
var extraOption = extraOptions.find(function (opt) {
|
|
42
|
+
return opt.value === option.value;
|
|
43
|
+
});
|
|
44
|
+
return /*#__PURE__*/_jsx(InputButtonSelectButton, {
|
|
45
|
+
size: size,
|
|
46
|
+
disabled: option.disabled,
|
|
47
|
+
isSelected: option.value === value,
|
|
48
|
+
eventKey: String(option.value),
|
|
49
|
+
onSelect: handleSelect,
|
|
50
|
+
title: option.label,
|
|
51
|
+
description: extraOption === null || extraOption === void 0 ? void 0 : extraOption.description,
|
|
52
|
+
icon: extraOption === null || extraOption === void 0 ? void 0 : extraOption.icon
|
|
53
|
+
}, String(option.value));
|
|
54
|
+
})
|
|
55
|
+
}));
|
|
56
|
+
};
|
|
57
|
+
InputButtonSelect.displayName = 'InputButtonSelect';
|
|
58
|
+
export default InputButtonSelect;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface InputButtonSelectButtonProps extends Omit<React.HTMLAttributes<HTMLButtonElement>, 'onSelect'> {
|
|
2
|
+
size?: 'small' | 'normal';
|
|
3
|
+
title?: string | undefined;
|
|
4
|
+
icon?: React.ReactNode | undefined;
|
|
5
|
+
description?: string | undefined;
|
|
6
|
+
disabled?: boolean | undefined;
|
|
7
|
+
isSelected?: boolean | undefined;
|
|
8
|
+
eventKey?: string | number | null | undefined;
|
|
9
|
+
onSelect?: ((eventKey: string | number | null, event: React.SyntheticEvent<HTMLButtonElement>) => void) | undefined;
|
|
10
|
+
onClick?: React.MouseEventHandler<HTMLButtonElement> | undefined;
|
|
11
|
+
}
|
|
12
|
+
declare const InputButtonSelectButton: ({ title, size, icon, description, disabled, isSelected, eventKey, onSelect, onClick, children, className, ...props }: InputButtonSelectButtonProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export default InputButtonSelectButton;
|
|
14
|
+
//# sourceMappingURL=InputButtonSelectButton.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InputButtonSelectButton.d.ts","sourceRoot":"","sources":["../../../../src/components/Input/Selectable/InputButtonSelectButton.tsx"],"names":[],"mappings":"AAKA,UAAU,4BAA6B,SAAQ,IAAI,CACjD,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,EACvC,UAAU,CACX;IACC,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAE1B,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAE3B,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,GAAG,SAAS,CAAC;IAEnC,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAEjC,QAAQ,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAE/B,UAAU,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAEjC,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IAE9C,QAAQ,CAAC,EACL,CAAC,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAC,GAC5F,SAAS,CAAC;IAEd,OAAO,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,iBAAiB,CAAC,GAAG,SAAS,CAAC;CAClE;AAED,QAAA,MAAM,uBAAuB,GAAI,sHAa9B,4BAA4B,4CAgE9B,CAAC;AACF,eAAe,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
2
|
+
var _excluded = ["title", "size", "icon", "description", "disabled", "isSelected", "eventKey", "onSelect", "onClick", "children", "className"];
|
|
3
|
+
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; }
|
|
4
|
+
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; }
|
|
5
|
+
function _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }
|
|
6
|
+
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : i + ""; }
|
|
7
|
+
function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
|
8
|
+
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; }
|
|
9
|
+
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; }
|
|
10
|
+
import clsx from 'clsx';
|
|
11
|
+
import { useCallback } from 'react';
|
|
12
|
+
import { ButtonUI } from "../../atoms";
|
|
13
|
+
import { jsxs as _jsxs } from "react/jsx-runtime";
|
|
14
|
+
var InputButtonSelectButton = function InputButtonSelectButton(_ref) {
|
|
15
|
+
var title = _ref.title,
|
|
16
|
+
_ref$size = _ref.size,
|
|
17
|
+
size = _ref$size === void 0 ? 'normal' : _ref$size,
|
|
18
|
+
icon = _ref.icon,
|
|
19
|
+
description = _ref.description,
|
|
20
|
+
disabled = _ref.disabled,
|
|
21
|
+
isSelected = _ref.isSelected,
|
|
22
|
+
eventKey = _ref.eventKey,
|
|
23
|
+
onSelect = _ref.onSelect,
|
|
24
|
+
onClick = _ref.onClick,
|
|
25
|
+
children = _ref.children,
|
|
26
|
+
className = _ref.className,
|
|
27
|
+
props = _objectWithoutProperties(_ref, _excluded);
|
|
28
|
+
var handleClick = useCallback(function (e) {
|
|
29
|
+
if (disabled) {
|
|
30
|
+
e.preventDefault();
|
|
31
|
+
e.stopPropagation();
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (onClick) {
|
|
35
|
+
onClick(e);
|
|
36
|
+
}
|
|
37
|
+
if (!e.defaultPrevented) {
|
|
38
|
+
if (onSelect) {
|
|
39
|
+
onSelect(eventKey !== null && eventKey !== void 0 ? eventKey : null, e);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
}, [disabled, onClick, onSelect, eventKey]);
|
|
43
|
+
var handleKeyDown = useCallback(function (e) {
|
|
44
|
+
if (disabled) {
|
|
45
|
+
e.preventDefault();
|
|
46
|
+
e.stopPropagation();
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
if (e.key === 'Enter' || e.key === ' ') {
|
|
50
|
+
e.preventDefault();
|
|
51
|
+
if (onClick) {
|
|
52
|
+
onClick(e);
|
|
53
|
+
}
|
|
54
|
+
if (!e.defaultPrevented) {
|
|
55
|
+
if (onSelect) {
|
|
56
|
+
onSelect(eventKey !== null && eventKey !== void 0 ? eventKey : null, e);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}, [disabled, onClick, onSelect, eventKey]);
|
|
61
|
+
return /*#__PURE__*/_jsxs(ButtonUI, _objectSpread(_objectSpread({
|
|
62
|
+
className: clsx('flexmatch-button-select-button-container', className, isSelected && 'selected', size === 'small' && 'small', size === 'normal' && 'normal'),
|
|
63
|
+
onClick: handleClick,
|
|
64
|
+
onKeyDown: handleKeyDown,
|
|
65
|
+
tabIndex: disabled ? -1 : 0,
|
|
66
|
+
"aria-disabled": disabled
|
|
67
|
+
}, props), {}, {
|
|
68
|
+
children: [icon, title]
|
|
69
|
+
}));
|
|
70
|
+
};
|
|
71
|
+
export default InputButtonSelectButton;
|