mautourco-components 0.2.14 → 0.2.15

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.
@@ -0,0 +1,12 @@
1
+ import React from 'react';
2
+ interface PlusCircleIconProps {
3
+ size?: 'xs' | 'sm' | 'md' | 'lg' | 'xl';
4
+ className?: string;
5
+ color?: string;
6
+ /**
7
+ * Couleur par défaut si aucune couleur n'est spécifiée
8
+ */
9
+ defaultColor?: string;
10
+ }
11
+ declare const PlusCircleIcon: React.FC<PlusCircleIconProps>;
12
+ export default PlusCircleIcon;
@@ -0,0 +1,36 @@
1
+ var __assign = (this && this.__assign) || function () {
2
+ __assign = Object.assign || function(t) {
3
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
4
+ s = arguments[i];
5
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
6
+ t[p] = s[p];
7
+ }
8
+ return t;
9
+ };
10
+ return __assign.apply(this, arguments);
11
+ };
12
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ var PlusCircleIcon = function (_a) {
14
+ var _b = _a.size, size = _b === void 0 ? 'md' : _b, _c = _a.className, className = _c === void 0 ? '' : _c, color = _a.color;
15
+ var getSizeClasses = function () {
16
+ switch (size) {
17
+ case 'xs':
18
+ return 'w-3 h-3';
19
+ case 'sm':
20
+ return 'w-4 h-4';
21
+ case 'md':
22
+ return 'w-5 h-5';
23
+ case 'lg':
24
+ return 'w-6 h-6';
25
+ case 'xl':
26
+ return 'w-8 h-8';
27
+ default:
28
+ return 'w-5 h-5';
29
+ }
30
+ };
31
+ var sizeClasses = getSizeClasses();
32
+ var colorClass = color ? "text-".concat(color) : 'text-current';
33
+ var classes = "".concat(sizeClasses, " ").concat(colorClass, " ").concat(className);
34
+ return (_jsxs("svg", __assign({ className: classes, viewBox: "0 0 16 16", fill: "none", xmlns: "http://www.w3.org/2000/svg" }, { children: [_jsx("g", __assign({ "clip-path": "url(#clip0_7074_66340)" }, { children: _jsx("path", { d: "M13.915 8.00098C13.915 4.7334 11.2666 2.08416 7.99902 2.08398C4.73134 2.08398 2.08203 4.73329 2.08203 8.00098C2.08221 11.2685 4.73145 13.917 7.99902 13.917C11.2664 13.9168 13.9149 11.2684 13.915 8.00098ZM7.24902 10.667V8.75098H5.33203C4.91793 8.75098 4.58221 8.41504 4.58203 8.00098C4.58203 7.58676 4.91782 7.25098 5.33203 7.25098H7.24902V5.33398C7.24902 4.91977 7.58481 4.58398 7.99902 4.58398C8.41309 4.58416 8.74902 4.91988 8.74902 5.33398V7.25098H10.665L10.7422 7.25488C11.1203 7.29337 11.415 7.61271 11.415 8.00098C11.4149 8.38912 11.1202 8.70862 10.7422 8.74707L10.665 8.75098H8.74902V10.667C8.74902 11.0811 8.41309 11.4168 7.99902 11.417C7.58481 11.417 7.24902 11.0812 7.24902 10.667ZM15.415 8.00098C15.4149 12.0968 12.0949 15.4168 7.99902 15.417C3.90302 15.417 0.582208 12.0969 0.582031 8.00098C0.582031 3.90487 3.90291 0.583984 7.99902 0.583984C12.095 0.584161 15.415 3.90497 15.415 8.00098Z", fill: "white" }) })), _jsx("defs", { children: _jsx("clipPath", __assign({ id: "clip0_7074_66340" }, { children: _jsx("rect", { width: "16", height: "16", fill: "white" }) })) })] })));
35
+ };
36
+ export default PlusCircleIcon;
@@ -63,5 +63,6 @@ export declare const ICONS: {
63
63
  readonly bus: IconComponent;
64
64
  readonly map: IconComponent;
65
65
  readonly wallet: IconComponent;
66
+ readonly 'plus-circle': IconComponent;
66
67
  };
67
68
  export type IconName = keyof typeof ICONS;
@@ -45,6 +45,7 @@ import NightIcon from './NightIcon';
45
45
  import PlaneIcon from './PlaneIcon';
46
46
  import PlaneLandingOutlineIcon from './PlaneLandingOutlineIcon';
47
47
  import PlaneTakeoffOutlineIcon from './PlaneTakeoffOutlineIcon';
48
+ import PlusCircleIcon from './PlusCircleIcon';
48
49
  import PlusIcon from './PlusIcon';
49
50
  import QuotationIcon from './QuotationIcon';
50
51
  import Search from './Search';
@@ -120,4 +121,5 @@ export var ICONS = {
120
121
  bus: BusIcon,
121
122
  map: MapIcon,
122
123
  wallet: WalletIcon,
124
+ 'plus-circle': PlusCircleIcon,
123
125
  };
@@ -10,12 +10,13 @@ var __assign = (this && this.__assign) || function () {
10
10
  return __assign.apply(this, arguments);
11
11
  };
12
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
- import { useState } from 'react';
13
+ import { useEffect, useRef, useState } from 'react';
14
14
  import Icon from '../../Icon/Icon';
15
15
  import Spinner from '../../Spinner/Spinner';
16
16
  var DropdownInput = function (_a) {
17
17
  var _b = _a.placeholder, placeholder = _b === void 0 ? 'Select item name' : _b, value = _a.value, _c = _a.state, state = _c === void 0 ? 'default' : _c, onClick = _a.onClick, _d = _a.className, className = _d === void 0 ? '' : _d, _e = _a.options, options = _e === void 0 ? [] : _e, onSelect = _a.onSelect;
18
18
  var _f = useState(false), isOpen = _f[0], setIsOpen = _f[1];
19
+ var dropdownRef = useRef(null);
19
20
  var handleClick = function () {
20
21
  if (state === 'disabled' || state === 'loading')
21
22
  return;
@@ -47,7 +48,18 @@ var DropdownInput = function (_a) {
47
48
  }
48
49
  return (_jsx(Icon, { name: isOpen ? 'chevron-up' : 'chevron-down', size: "sm", className: "dropdown-input__icon dropdown-input__icon--chevron" }));
49
50
  };
50
- var displayText = state === 'loading' ? 'Loading...' : (value || placeholder);
51
- return (_jsxs("div", __assign({ className: "dropdown-container ".concat(className) }, { children: [_jsxs("div", __assign({ className: "dropdown-input ".concat(getStateClasses()), onClick: handleClick }, { children: [_jsx("span", __assign({ className: "dropdown-input__text" }, { children: displayText })), getIcon()] })), isOpen && options.length > 0 && (_jsx("div", __assign({ className: "dropdown-menu" }, { children: options.map(function (option, index) { return (_jsx("div", __assign({ className: "dropdown-option", onClick: function () { return handleOptionSelect(option); } }, { children: option }), index)); }) })))] })));
51
+ var displayText = state === 'loading' ? 'Loading...' : value || placeholder;
52
+ useEffect(function () {
53
+ var handleClickOutside = function (event) {
54
+ if (dropdownRef.current && !dropdownRef.current.contains(event.target)) {
55
+ setIsOpen(false);
56
+ }
57
+ };
58
+ document.addEventListener('mousedown', handleClickOutside);
59
+ return function () {
60
+ document.removeEventListener('mousedown', handleClickOutside);
61
+ };
62
+ }, []);
63
+ return (_jsxs("div", __assign({ ref: dropdownRef, className: "dropdown-container ".concat(className) }, { children: [_jsxs("div", __assign({ className: "dropdown-input ".concat(getStateClasses()), onClick: handleClick }, { children: [_jsx("span", __assign({ className: "dropdown-input__text" }, { children: displayText })), getIcon()] })), isOpen && options.length > 0 && (_jsx("div", __assign({ className: "dropdown-menu" }, { children: options.map(function (option, index) { return (_jsx("div", __assign({ className: "dropdown-option", onClick: function () { return handleOptionSelect(option); } }, { children: option }), index)); }) })))] })));
52
64
  };
53
65
  export default DropdownInput;