mautourco-components 0.2.39 → 0.2.41

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.
@@ -2161,7 +2161,7 @@
2161
2161
  }
2162
2162
 
2163
2163
  .quote-header__filters {
2164
- .dropdown-container {
2164
+ .mtc-dropdown-container {
2165
2165
  width: 139px;
2166
2166
  }
2167
2167
  }
@@ -6,6 +6,6 @@ export interface QuoteHeaderProps {
6
6
  onNavigate: (tab: 'quotation' | 'booking') => void;
7
7
  /** Callback to create a new quote */
8
8
  onNewQuote: () => void;
9
- onFilterChange: (filter: 'date' | 'clientType' | 'fileStatus', value: string) => void;
9
+ onFilterChange?: (filter: 'date' | 'clientType' | 'fileStatus', value: string) => void;
10
10
  }
11
11
  export declare function QuoteHeader(props: QuoteHeaderProps): import("react/jsx-runtime").JSX.Element;
@@ -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.41",
4
4
  "private": false,
5
5
  "description": "Bibliothèque de composants Motorco pour le redesign",
6
6
  "main": "dist/index.js",
@@ -29,7 +29,7 @@
29
29
 
30
30
  .quote-header__filters {
31
31
  @apply flex gap-3 my-8;
32
- .dropdown-container {
32
+ .mtc-dropdown-container {
33
33
  width: 139px;
34
34
  }
35
35
  }
@@ -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';
@@ -19,7 +20,7 @@ export interface QuoteHeaderProps {
19
20
  /** Callback to create a new quote */
20
21
  onNewQuote: () => void;
21
22
 
22
- onFilterChange: (filter: 'date' | 'clientType' | 'fileStatus', value: string) => void;
23
+ onFilterChange?: (filter: 'date' | 'clientType' | 'fileStatus', value: string) => void;
23
24
  }
24
25
 
25
26
  const filterConfig = {
@@ -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>