@dktunited-techoff/techoff-suite-ui 1.11.1 → 1.11.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.
@@ -14,11 +14,17 @@
14
14
  .ts-input-container--error input {
15
15
  border: 1px solid #e3262f;
16
16
  }
17
+ .ts-input-container--warning input {
18
+ border: 1px solid #fa9c69;
19
+ }
17
20
  .ts-input-error {
18
21
  display: flex;
19
22
  margin-top: 4px;
20
23
  color: #e3262f;
21
24
  }
25
+ .ts-input-error--warning {
26
+ color: #fa9c69;
27
+ }
22
28
  .ts-input-error--icon {
23
29
  margin-right: 4px;
24
30
  }
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
2
  import { TsInputProps } from './TsInput.types';
3
3
  import './TsInput.css';
4
- export declare const TsInput: ({ byDefault, error, icon, label, value, onChange, ...props }: TsInputProps) => React.JSX.Element;
4
+ export declare const TsInput: ({ byDefault, error, icon, label, value, warning, onChange, ...props }: TsInputProps) => React.JSX.Element;
@@ -1,21 +1,21 @@
1
1
  import * as React from 'react';
2
2
  import { TsIcon } from '../../TsIcon/TsIcon';
3
3
  import './TsInput.css';
4
- export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...props }) => {
4
+ export const TsInput = ({ byDefault, error, icon, label, value, warning, onChange, ...props }) => {
5
5
  // #########
6
6
  // Rendering
7
7
  return (React.createElement("div", { className: `ts-input ${byDefault ? 'ts-input--padding-2' : icon ? 'ts-input--padding-1' : 'ts-input--padding-0'}` },
8
8
  label && React.createElement("div", { className: "ts-input-label" }, label),
9
- React.createElement("div", { className: `ts-input-container ${error && error !== '' ? 'ts-input-container--error' : ''}` },
9
+ React.createElement("div", { className: `ts-input-container ${error || warning ? `ts-input-container--${error ? 'error' : 'warning'}` : ''}` },
10
10
  React.createElement("input", { type: "text", value: value, onChange: e => onChange(e.target.value), ...props }),
11
11
  byDefault && React.createElement("div", { className: "ts-input-tag" },
12
12
  byDefault,
13
13
  " by default"),
14
14
  icon && (React.createElement("div", { className: "ts-input-icon" },
15
15
  React.createElement(TsIcon, { name: icon, size: "16" })))),
16
- error && error !== '' && (React.createElement("div", { className: "ts-input-error" },
16
+ (error || warning) && (React.createElement("div", { className: `ts-input-error ${warning ? 'ts-input-error--warning' : ''}` },
17
17
  React.createElement("div", { className: "ts-input-error--icon" },
18
18
  React.createElement(TsIcon, { name: "alert-circle", size: "16" })),
19
- React.createElement("div", { className: "ts-input-error--label" }, error)))));
19
+ React.createElement("div", { className: "ts-input-error--label" }, error || warning)))));
20
20
  };
21
21
  //# sourceMappingURL=TsInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TsInput.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsInput/TsInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAE7C,OAAO,eAAe,CAAC;AAEvB,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,EAAE,SAAS,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB,EAAE,EAAE;IACpG,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BACE,SAAS,EAAE,YAAY,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,qBAAqB,EAAE;QAEhH,KAAK,IAAI,6BAAK,SAAS,EAAC,gBAAgB,IAAE,KAAK,CAAO;QACvD,6BAAK,SAAS,EAAE,sBAAsB,KAAK,IAAI,KAAK,KAAK,EAAE,CAAC,CAAC,CAAC,2BAA2B,CAAC,CAAC,CAAC,EAAE,EAAE;YAC9F,+BAAO,IAAI,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC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uBAAuB,KAAK,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,EAAE,CAAC,CAAC,CAAC,EAAE,EAAE;YAE/G,+BAAO,IAAI,EAAC,MAAM,EAAC,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAM,KAAK,GAAI;YACtF,SAAS,IAAI,6BAAK,SAAS,EAAC,cAAc;gBAAE,SAAS;8BAAkB;YACvE,IAAI,IAAI,CACP,6BAAK,SAAS,EAAC,eAAe;gBAC5B,oBAAC,MAAM,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,GAAG,CAC5B,CACP,CACG;QAEL,CAAC,KAAK,IAAI,OAAO,CAAC,IAAI,CACrB,6BAAK,SAAS,EAAE,kBAAkB,OAAO,CAAC,CAAC,CAAC,yBAAyB,CAAC,CAAC,CAAC,EAAE,EAAE;YAC1E,6BAAK,SAAS,EAAC,sBAAsB;gBACnC,oBAAC,MAAM,IAAC,IAAI,EAAC,cAAc,EAAC,IAAI,EAAC,IAAI,GAAG,CACpC;YACN,6BAAK,SAAS,EAAC,uBAAuB,IAAE,KAAK,IAAI,OAAO,CAAO,CAC3D,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -3,7 +3,7 @@ import { TsIcon } from '../../TsIcon/TsIcon';
3
3
  import { TsInputProps } from './TsInput.types';
4
4
  import './TsInput.css';
5
5
 
6
- export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...props }: TsInputProps) => {
6
+ export const TsInput = ({ byDefault, error, icon, label, value, warning, onChange, ...props }: TsInputProps) => {
7
7
  // #########
8
8
  // Rendering
9
9
  return (
@@ -11,7 +11,9 @@ export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...pro
11
11
  className={`ts-input ${byDefault ? 'ts-input--padding-2' : icon ? 'ts-input--padding-1' : 'ts-input--padding-0'}`}
12
12
  >
13
13
  {label && <div className="ts-input-label">{label}</div>}
14
- <div className={`ts-input-container ${error && error !== '' ? 'ts-input-container--error' : ''}`}>
14
+ <div
15
+ className={`ts-input-container ${error || warning ? `ts-input-container--${error ? 'error' : 'warning'}` : ''}`}
16
+ >
15
17
  <input type="text" value={value} onChange={e => onChange(e.target.value)} {...props} />
16
18
  {byDefault && <div className="ts-input-tag">{byDefault} by default</div>}
17
19
  {icon && (
@@ -21,12 +23,12 @@ export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...pro
21
23
  )}
22
24
  </div>
23
25
 
24
- {error && error !== '' && (
25
- <div className="ts-input-error">
26
+ {(error || warning) && (
27
+ <div className={`ts-input-error ${warning ? 'ts-input-error--warning' : ''}`}>
26
28
  <div className="ts-input-error--icon">
27
29
  <TsIcon name="alert-circle" size="16" />
28
30
  </div>
29
- <div className="ts-input-error--label">{error}</div>
31
+ <div className="ts-input-error--label">{error || warning}</div>
30
32
  </div>
31
33
  )}
32
34
  </div>
@@ -4,5 +4,6 @@ export type TsInputProps = {
4
4
  error?: string;
5
5
  icon?: string;
6
6
  label?: string;
7
+ warning?: string;
7
8
  onChange: (value: string) => void;
8
9
  } & Omit<Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>, 'size'>;
@@ -5,5 +5,6 @@ export type TsInputProps = {
5
5
  error?: string;
6
6
  icon?: string;
7
7
  label?: string;
8
+ warning?: string;
8
9
  onChange: (value: string) => void;
9
10
  } & Omit<Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>, 'size'>;
@@ -31,6 +31,10 @@ export const inputArgTypes = {
31
31
  control: 'text',
32
32
  description: 'Value of the input.',
33
33
  },
34
+ warning: {
35
+ control: 'text',
36
+ description: 'Warning of the input.',
37
+ },
34
38
  disabled: {
35
39
  control: 'boolean',
36
40
  description: 'Enable state of the input.',
@@ -62,6 +66,7 @@ Input allows the user to enter content and data when the expected user input is
62
66
  label: 'Label',
63
67
  placeholder: 'Enter some text',
64
68
  value: '',
69
+ warning: '',
65
70
  disabled: false,
66
71
  onChange: () => {},
67
72
  onValidate: () => {},
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
3
3
  import { TsHeader } from '../TsHeader';
4
4
  import { TsHeaderProfile, TsHeaderProfileItem } from '../TsHeaderProfile';
5
- import { TsHeaderSearch } from '../TsHeaderSearch';
5
+ import { TsSearchHeader, TsSearchHeaderItem } from '../../TsSearchHeader/TsSearchHeader';
6
6
  import { TsButton } from '../../../components/TsButton/TsButton';
7
7
 
8
8
  <Meta title="Layouts/Header" />
@@ -50,12 +50,14 @@ The header will allow users to quickly find the information they need at a glanc
50
50
  ),
51
51
  appName: 'repairability',
52
52
  search: (
53
- <TsHeaderSearch
54
- getItemLabel={item => item.label}
55
- getItemValue={item => item.id}
56
- loadItems={loadItems}
57
- noDataLabel="No item found."
58
- placeholder="Search something in the application"
53
+ <TsSearchHeader
54
+ value=""
55
+ items={[
56
+ <TsSearchHeaderItem id="1" label="Item 1" />,
57
+ <TsSearchHeaderItem id="2" label="Item 2" />,
58
+ <TsSearchHeaderItem id="3" label="Item 3" />,
59
+ <TsSearchHeaderItem id="4" label="Item 4" />,
60
+ ]}
59
61
  onChange={() => {}}
60
62
  />
61
63
  ),
@@ -14,11 +14,17 @@
14
14
  .ts-input-container--error input {
15
15
  border: 1px solid #e3262f;
16
16
  }
17
+ .ts-input-container--warning input {
18
+ border: 1px solid #fa9c69;
19
+ }
17
20
  .ts-input-error {
18
21
  display: flex;
19
22
  margin-top: 4px;
20
23
  color: #e3262f;
21
24
  }
25
+ .ts-input-error--warning {
26
+ color: #fa9c69;
27
+ }
22
28
  .ts-input-error--icon {
23
29
  margin-right: 4px;
24
30
  }
@@ -1,4 +1,4 @@
1
1
  import * as React from 'react';
2
2
  import { TsInputProps } from './TsInput.types';
3
3
  import './TsInput.css';
4
- export declare const TsInput: ({ byDefault, error, icon, label, value, onChange, ...props }: TsInputProps) => React.JSX.Element;
4
+ export declare const TsInput: ({ byDefault, error, icon, label, value, warning, onChange, ...props }: TsInputProps) => React.JSX.Element;
@@ -4,22 +4,22 @@ exports.TsInput = void 0;
4
4
  const React = require("react");
5
5
  const TsIcon_1 = require("../../TsIcon/TsIcon");
6
6
  require("./TsInput.css");
7
- const TsInput = ({ byDefault, error, icon, label, value, onChange, ...props }) => {
7
+ const TsInput = ({ byDefault, error, icon, label, value, warning, onChange, ...props }) => {
8
8
  // #########
9
9
  // Rendering
10
10
  return (React.createElement("div", { className: `ts-input ${byDefault ? 'ts-input--padding-2' : icon ? 'ts-input--padding-1' : 'ts-input--padding-0'}` },
11
11
  label && React.createElement("div", { className: "ts-input-label" }, label),
12
- React.createElement("div", { className: `ts-input-container ${error && error !== '' ? 'ts-input-container--error' : ''}` },
12
+ React.createElement("div", { className: `ts-input-container ${error || warning ? `ts-input-container--${error ? 'error' : 'warning'}` : ''}` },
13
13
  React.createElement("input", { type: "text", value: value, onChange: e => onChange(e.target.value), ...props }),
14
14
  byDefault && React.createElement("div", { className: "ts-input-tag" },
15
15
  byDefault,
16
16
  " by default"),
17
17
  icon && (React.createElement("div", { className: "ts-input-icon" },
18
18
  React.createElement(TsIcon_1.TsIcon, { name: icon, size: "16" })))),
19
- error && error !== '' && (React.createElement("div", { className: "ts-input-error" },
19
+ (error || warning) && (React.createElement("div", { className: `ts-input-error ${warning ? 'ts-input-error--warning' : ''}` },
20
20
  React.createElement("div", { className: "ts-input-error--icon" },
21
21
  React.createElement(TsIcon_1.TsIcon, { name: "alert-circle", size: "16" })),
22
- React.createElement("div", { className: "ts-input-error--label" }, error)))));
22
+ React.createElement("div", { className: "ts-input-error--label" }, error || warning)))));
23
23
  };
24
24
  exports.TsInput = TsInput;
25
25
  //# sourceMappingURL=TsInput.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TsInput.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsInput/TsInput.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,gDAA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B;gBACnC,oBAAC,eAAM,IAAC,IAAI,EAAC,cAAc,EAAC,IAAI,EAAC,IAAI,GAAG,CACpC;YACN,6BAAK,SAAS,EAAC,uBAAuB,IAAE,KAAK,IAAI,OAAO,CAAO,CAC3D,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AA9BW,QAAA,OAAO,WA8BlB"}
@@ -3,7 +3,7 @@ import { TsIcon } from '../../TsIcon/TsIcon';
3
3
  import { TsInputProps } from './TsInput.types';
4
4
  import './TsInput.css';
5
5
 
6
- export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...props }: TsInputProps) => {
6
+ export const TsInput = ({ byDefault, error, icon, label, value, warning, onChange, ...props }: TsInputProps) => {
7
7
  // #########
8
8
  // Rendering
9
9
  return (
@@ -11,7 +11,9 @@ export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...pro
11
11
  className={`ts-input ${byDefault ? 'ts-input--padding-2' : icon ? 'ts-input--padding-1' : 'ts-input--padding-0'}`}
12
12
  >
13
13
  {label && <div className="ts-input-label">{label}</div>}
14
- <div className={`ts-input-container ${error && error !== '' ? 'ts-input-container--error' : ''}`}>
14
+ <div
15
+ className={`ts-input-container ${error || warning ? `ts-input-container--${error ? 'error' : 'warning'}` : ''}`}
16
+ >
15
17
  <input type="text" value={value} onChange={e => onChange(e.target.value)} {...props} />
16
18
  {byDefault && <div className="ts-input-tag">{byDefault} by default</div>}
17
19
  {icon && (
@@ -21,12 +23,12 @@ export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...pro
21
23
  )}
22
24
  </div>
23
25
 
24
- {error && error !== '' && (
25
- <div className="ts-input-error">
26
+ {(error || warning) && (
27
+ <div className={`ts-input-error ${warning ? 'ts-input-error--warning' : ''}`}>
26
28
  <div className="ts-input-error--icon">
27
29
  <TsIcon name="alert-circle" size="16" />
28
30
  </div>
29
- <div className="ts-input-error--label">{error}</div>
31
+ <div className="ts-input-error--label">{error || warning}</div>
30
32
  </div>
31
33
  )}
32
34
  </div>
@@ -4,5 +4,6 @@ export type TsInputProps = {
4
4
  error?: string;
5
5
  icon?: string;
6
6
  label?: string;
7
+ warning?: string;
7
8
  onChange: (value: string) => void;
8
9
  } & Omit<Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>, 'size'>;
@@ -5,5 +5,6 @@ export type TsInputProps = {
5
5
  error?: string;
6
6
  icon?: string;
7
7
  label?: string;
8
+ warning?: string;
8
9
  onChange: (value: string) => void;
9
10
  } & Omit<Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>, 'size'>;
@@ -31,6 +31,10 @@ export const inputArgTypes = {
31
31
  control: 'text',
32
32
  description: 'Value of the input.',
33
33
  },
34
+ warning: {
35
+ control: 'text',
36
+ description: 'Warning of the input.',
37
+ },
34
38
  disabled: {
35
39
  control: 'boolean',
36
40
  description: 'Enable state of the input.',
@@ -62,6 +66,7 @@ Input allows the user to enter content and data when the expected user input is
62
66
  label: 'Label',
63
67
  placeholder: 'Enter some text',
64
68
  value: '',
69
+ warning: '',
65
70
  disabled: false,
66
71
  onChange: () => {},
67
72
  onValidate: () => {},
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
3
3
  import { TsHeader } from '../TsHeader';
4
4
  import { TsHeaderProfile, TsHeaderProfileItem } from '../TsHeaderProfile';
5
- import { TsHeaderSearch } from '../TsHeaderSearch';
5
+ import { TsSearchHeader, TsSearchHeaderItem } from '../../TsSearchHeader/TsSearchHeader';
6
6
  import { TsButton } from '../../../components/TsButton/TsButton';
7
7
 
8
8
  <Meta title="Layouts/Header" />
@@ -50,12 +50,14 @@ The header will allow users to quickly find the information they need at a glanc
50
50
  ),
51
51
  appName: 'repairability',
52
52
  search: (
53
- <TsHeaderSearch
54
- getItemLabel={item => item.label}
55
- getItemValue={item => item.id}
56
- loadItems={loadItems}
57
- noDataLabel="No item found."
58
- placeholder="Search something in the application"
53
+ <TsSearchHeader
54
+ value=""
55
+ items={[
56
+ <TsSearchHeaderItem id="1" label="Item 1" />,
57
+ <TsSearchHeaderItem id="2" label="Item 2" />,
58
+ <TsSearchHeaderItem id="3" label="Item 3" />,
59
+ <TsSearchHeaderItem id="4" label="Item 4" />,
60
+ ]}
59
61
  onChange={() => {}}
60
62
  />
61
63
  ),
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dktunited-techoff/techoff-suite-ui",
3
- "version": "1.11.1",
3
+ "version": "1.11.3",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib",
6
6
  "module": "esm/index.js",
@@ -14,11 +14,17 @@
14
14
  .ts-input-container--error input {
15
15
  border: 1px solid #e3262f;
16
16
  }
17
+ .ts-input-container--warning input {
18
+ border: 1px solid #fa9c69;
19
+ }
17
20
  .ts-input-error {
18
21
  display: flex;
19
22
  margin-top: 4px;
20
23
  color: #e3262f;
21
24
  }
25
+ .ts-input-error--warning {
26
+ color: #fa9c69;
27
+ }
22
28
  .ts-input-error--icon {
23
29
  margin-right: 4px;
24
30
  }
@@ -3,7 +3,7 @@ import { TsIcon } from '../../TsIcon/TsIcon';
3
3
  import { TsInputProps } from './TsInput.types';
4
4
  import './TsInput.css';
5
5
 
6
- export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...props }: TsInputProps) => {
6
+ export const TsInput = ({ byDefault, error, icon, label, value, warning, onChange, ...props }: TsInputProps) => {
7
7
  // #########
8
8
  // Rendering
9
9
  return (
@@ -11,7 +11,9 @@ export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...pro
11
11
  className={`ts-input ${byDefault ? 'ts-input--padding-2' : icon ? 'ts-input--padding-1' : 'ts-input--padding-0'}`}
12
12
  >
13
13
  {label && <div className="ts-input-label">{label}</div>}
14
- <div className={`ts-input-container ${error && error !== '' ? 'ts-input-container--error' : ''}`}>
14
+ <div
15
+ className={`ts-input-container ${error || warning ? `ts-input-container--${error ? 'error' : 'warning'}` : ''}`}
16
+ >
15
17
  <input type="text" value={value} onChange={e => onChange(e.target.value)} {...props} />
16
18
  {byDefault && <div className="ts-input-tag">{byDefault} by default</div>}
17
19
  {icon && (
@@ -21,12 +23,12 @@ export const TsInput = ({ byDefault, error, icon, label, value, onChange, ...pro
21
23
  )}
22
24
  </div>
23
25
 
24
- {error && error !== '' && (
25
- <div className="ts-input-error">
26
+ {(error || warning) && (
27
+ <div className={`ts-input-error ${warning ? 'ts-input-error--warning' : ''}`}>
26
28
  <div className="ts-input-error--icon">
27
29
  <TsIcon name="alert-circle" size="16" />
28
30
  </div>
29
- <div className="ts-input-error--label">{error}</div>
31
+ <div className="ts-input-error--label">{error || warning}</div>
30
32
  </div>
31
33
  )}
32
34
  </div>
@@ -5,5 +5,6 @@ export type TsInputProps = {
5
5
  error?: string;
6
6
  icon?: string;
7
7
  label?: string;
8
+ warning?: string;
8
9
  onChange: (value: string) => void;
9
10
  } & Omit<Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>, 'size'>;
@@ -31,6 +31,10 @@ export const inputArgTypes = {
31
31
  control: 'text',
32
32
  description: 'Value of the input.',
33
33
  },
34
+ warning: {
35
+ control: 'text',
36
+ description: 'Warning of the input.',
37
+ },
34
38
  disabled: {
35
39
  control: 'boolean',
36
40
  description: 'Enable state of the input.',
@@ -62,6 +66,7 @@ Input allows the user to enter content and data when the expected user input is
62
66
  label: 'Label',
63
67
  placeholder: 'Enter some text',
64
68
  value: '',
69
+ warning: '',
65
70
  disabled: false,
66
71
  onChange: () => {},
67
72
  onValidate: () => {},
@@ -2,7 +2,7 @@ import React from 'react';
2
2
  import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
3
3
  import { TsHeader } from '../TsHeader';
4
4
  import { TsHeaderProfile, TsHeaderProfileItem } from '../TsHeaderProfile';
5
- import { TsHeaderSearch } from '../TsHeaderSearch';
5
+ import { TsSearchHeader, TsSearchHeaderItem } from '../../TsSearchHeader/TsSearchHeader';
6
6
  import { TsButton } from '../../../components/TsButton/TsButton';
7
7
 
8
8
  <Meta title="Layouts/Header" />
@@ -50,12 +50,14 @@ The header will allow users to quickly find the information they need at a glanc
50
50
  ),
51
51
  appName: 'repairability',
52
52
  search: (
53
- <TsHeaderSearch
54
- getItemLabel={item => item.label}
55
- getItemValue={item => item.id}
56
- loadItems={loadItems}
57
- noDataLabel="No item found."
58
- placeholder="Search something in the application"
53
+ <TsSearchHeader
54
+ value=""
55
+ items={[
56
+ <TsSearchHeaderItem id="1" label="Item 1" />,
57
+ <TsSearchHeaderItem id="2" label="Item 2" />,
58
+ <TsSearchHeaderItem id="3" label="Item 3" />,
59
+ <TsSearchHeaderItem id="4" label="Item 4" />,
60
+ ]}
59
61
  onChange={() => {}}
60
62
  />
61
63
  ),