mautourco-components 0.2.39 → 0.2.40

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.
@@ -1,4 +1,16 @@
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
+ };
1
12
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useState } from 'react';
2
14
  import Button from '../../atoms/Button/Button';
3
15
  import DropdownInput from '../../atoms/Inputs/DropdownInput/DropdownInput';
4
16
  import Input from '../../atoms/Inputs/Input/Input';
@@ -21,10 +33,13 @@ var filterConfig = {
21
33
  };
22
34
  export function QuoteHeader(props) {
23
35
  var _a = props.current, current = _a === void 0 ? 'quotation' : _a, onNavigate = props.onNavigate, onNewQuote = props.onNewQuote, onFilterChange = props.onFilterChange;
36
+ var _b = useState({}), currentValue = _b[0], setCurrentValue = _b[1];
24
37
  return (_jsxs("div", { className: "quote-header", children: [_jsx(Heading, { level: 4, as: "h1", className: "quote-header__title", color: "accent", children: "Quotation & Booking" }), _jsxs("div", { className: "flex gap-4", children: [_jsx(Button, { variant: current === 'quotation' ? 'primary' : 'outline-primary', className: "quote-header__button", onClick: function () { return onNavigate('quotation'); }, children: "Quotation" }), _jsx(Button, { variant: current === 'booking' ? 'primary' : 'outline-primary', className: "quote-header__button", onClick: function () { return onNavigate('booking'); }, children: "Booking" })] }), _jsxs("div", { className: "quote-header__search-container", children: [_jsx(Input, { placeholder: "Search", icon: "search", iconPosition: "leading", className: "quote-header__search" }), _jsx(Button, { variant: "primary", leadingIcon: "plus-circle", iconSize: "md", size: "sm", onClick: onNewQuote, children: "New quote" })] }), _jsx("div", { className: "quote-header__filters", children: Object.entries(filterConfig).map(function (_a) {
25
38
  var key = _a[0], value = _a[1];
26
- return (_jsx(DropdownInput, { placeholder: value.placeholder, options: value.options, onSelect: function (value) {
27
- return onFilterChange(key, value);
39
+ return (_jsx(DropdownInput, { placeholder: value.placeholder, options: value.options, value: currentValue[key], onSelect: function (value) {
40
+ var _a;
41
+ onFilterChange === null || onFilterChange === void 0 ? void 0 : onFilterChange(key, value);
42
+ setCurrentValue(__assign(__assign({}, currentValue), (_a = {}, _a[key] = value, _a)));
28
43
  } }, key));
29
44
  }) })] }));
30
45
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mautourco-components",
3
- "version": "0.2.39",
3
+ "version": "0.2.40",
4
4
  "private": false,
5
5
  "description": "Bibliothèque de composants Motorco pour le redesign",
6
6
  "main": "dist/index.js",
@@ -1,3 +1,4 @@
1
+ import { useState } from 'react';
1
2
  import Button from '../../atoms/Button/Button';
2
3
  import DropdownInput from '../../atoms/Inputs/DropdownInput/DropdownInput';
3
4
  import Input from '../../atoms/Inputs/Input/Input';
@@ -39,6 +40,7 @@ const filterConfig = {
39
40
 
40
41
  export function QuoteHeader(props: QuoteHeaderProps) {
41
42
  const { current = 'quotation', onNavigate, onNewQuote, onFilterChange } = props;
43
+ const [currentValue, setCurrentValue] = useState<Record<string, string>>({});
42
44
 
43
45
  return (
44
46
  <div className="quote-header">
@@ -81,9 +83,11 @@ export function QuoteHeader(props: QuoteHeaderProps) {
81
83
  key={key}
82
84
  placeholder={value.placeholder}
83
85
  options={value.options}
84
- onSelect={(value) =>
85
- onFilterChange(key as 'date' | 'clientType' | 'fileStatus', value)
86
- }
86
+ value={currentValue[key]}
87
+ onSelect={(value) => {
88
+ onFilterChange?.(key as 'date' | 'clientType' | 'fileStatus', value);
89
+ setCurrentValue({ ...currentValue, [key]: value });
90
+ }}
87
91
  />
88
92
  ))}
89
93
  </div>