@dktunited-techoff/techoff-suite-ui 1.4.4 → 1.5.1

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.
Files changed (48) hide show
  1. package/esm/components/TsCheckbox/TsCheckbox.css +73 -0
  2. package/esm/components/TsCheckbox/TsCheckbox.d.ts +4 -0
  3. package/esm/components/TsCheckbox/TsCheckbox.js +17 -0
  4. package/esm/components/TsCheckbox/TsCheckbox.js.map +1 -0
  5. package/esm/components/TsCheckbox/TsCheckbox.types.d.ts +7 -0
  6. package/esm/components/TsCheckbox/TsCheckbox.types.js +2 -0
  7. package/esm/components/TsCheckbox/TsCheckbox.types.js.map +1 -0
  8. package/esm/components/TsCheckbox/__stories__/TsCheckbox.stories.mdx +56 -0
  9. package/esm/components/TsInput/TsInput/TsInput.css +7 -0
  10. package/esm/components/TsInput/TsInput/TsInput.d.ts +1 -1
  11. package/esm/components/TsInput/TsInput/TsInput.js +2 -1
  12. package/esm/components/TsInput/TsInput/TsInput.js.map +1 -1
  13. package/esm/components/TsInput/TsInput/TsInput.tsx +2 -1
  14. package/esm/components/TsInput/TsInput/TsInput.types.d.ts +1 -0
  15. package/esm/components/TsInput/TsInput/TsInput.types.tsx +1 -0
  16. package/esm/components/TsInput/TsInput/__stories__/TsInput.stories.mdx +11 -3
  17. package/esm/index.d.ts +1 -0
  18. package/esm/index.js +1 -0
  19. package/esm/index.js.map +1 -1
  20. package/lib/components/TsCheckbox/TsCheckbox.css +73 -0
  21. package/lib/components/TsCheckbox/TsCheckbox.d.ts +4 -0
  22. package/lib/components/TsCheckbox/TsCheckbox.js +21 -0
  23. package/lib/components/TsCheckbox/TsCheckbox.js.map +1 -0
  24. package/lib/components/TsCheckbox/TsCheckbox.types.d.ts +7 -0
  25. package/lib/components/TsCheckbox/TsCheckbox.types.js +3 -0
  26. package/lib/components/TsCheckbox/TsCheckbox.types.js.map +1 -0
  27. package/lib/components/TsCheckbox/__stories__/TsCheckbox.stories.mdx +56 -0
  28. package/lib/components/TsInput/TsInput/TsInput.css +7 -0
  29. package/lib/components/TsInput/TsInput/TsInput.d.ts +1 -1
  30. package/lib/components/TsInput/TsInput/TsInput.js +2 -1
  31. package/lib/components/TsInput/TsInput/TsInput.js.map +1 -1
  32. package/lib/components/TsInput/TsInput/TsInput.tsx +2 -1
  33. package/lib/components/TsInput/TsInput/TsInput.types.d.ts +1 -0
  34. package/lib/components/TsInput/TsInput/TsInput.types.tsx +1 -0
  35. package/lib/components/TsInput/TsInput/__stories__/TsInput.stories.mdx +11 -3
  36. package/lib/index.d.ts +1 -0
  37. package/lib/index.js +1 -0
  38. package/lib/index.js.map +1 -1
  39. package/package.json +1 -1
  40. package/src/components/TsCheckbox/TsCheckbox.css +73 -0
  41. package/src/components/TsCheckbox/TsCheckbox.tsx +25 -0
  42. package/src/components/TsCheckbox/TsCheckbox.types.ts +7 -0
  43. package/src/components/TsCheckbox/__stories__/TsCheckbox.stories.mdx +56 -0
  44. package/src/components/TsInput/TsInput/TsInput.css +7 -0
  45. package/src/components/TsInput/TsInput/TsInput.tsx +2 -1
  46. package/src/components/TsInput/TsInput/TsInput.types.tsx +1 -0
  47. package/src/components/TsInput/TsInput/__stories__/TsInput.stories.mdx +11 -3
  48. package/src/index.ts +1 -0
@@ -0,0 +1,73 @@
1
+ .ts-checkbox {
2
+ display: flex;
3
+ align-items: center;
4
+ cursor: pointer;
5
+ }
6
+ /* ########## */
7
+ /* DISABLED */
8
+ .ts-checkbox--disabled {
9
+ cursor: not-allowed;
10
+ }
11
+ .ts-checkbox--disabled .ts-checkbox-box {
12
+ color: #d7daf1;
13
+ }
14
+ .ts-checkbox--disabled:hover .ts-checkbox-box {
15
+ background: transparent;
16
+ }
17
+ /* ##### */
18
+ /* BOX */
19
+ .ts-checkbox:not(.ts-checkbox--disabled):hover .ts-checkbox-box {
20
+ background: #e1e3f5;
21
+ }
22
+ .ts-checkbox-box {
23
+ position: relative;
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ width: 24px;
28
+ min-width: 24px;
29
+ height: 24px;
30
+ min-height: 24px;
31
+ border-radius: 6px;
32
+ color: #3643ba;
33
+ transition: all ease 0.3s;
34
+ }
35
+ .ts-checkbox-box::before {
36
+ content: '';
37
+ position: absolute;
38
+ width: 12px;
39
+ height: 12px;
40
+ border-radius: 6px;
41
+ background: #ffffff;
42
+ z-index: 10;
43
+ }
44
+ .ts-checkbox-box .ts-icon {
45
+ z-index: 20;
46
+ }
47
+
48
+ /* ################# */
49
+ /* LABEL / CAPTION */
50
+ .ts-checkbox-container {
51
+ width: 100%;
52
+ padding: 4px 8px;
53
+ border-radius: 6px;
54
+ }
55
+ .ts-checkbox-container--with-caption .ts-checkbox-label {
56
+ color: #3643ba;
57
+ font-weight: 700;
58
+ }
59
+ .ts-checkbox-caption {
60
+ color: #404040;
61
+ font-size: 12px;
62
+ font-style: italic;
63
+ }
64
+
65
+ /* ######### */
66
+ /* GLOBALS */
67
+ * {
68
+ font-size: 14px;
69
+ outline: none;
70
+ box-sizing: border-box;
71
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
72
+ 'Helvetica Neue', sans-serif;
73
+ }
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { TsCheckboxProps } from './TsCheckbox.types';
3
+ import './TsCheckbox.css';
4
+ export declare const TsCheckbox: ({ caption, label, checked, disabled, onChange }: TsCheckboxProps) => React.JSX.Element;
@@ -0,0 +1,17 @@
1
+ import * as React from 'react';
2
+ import { TsIcon } from '../TsIcon/TsIcon';
3
+ import './TsCheckbox.css';
4
+ export const TsCheckbox = ({ caption, label, checked, disabled, onChange }) => {
5
+ // ########
6
+ // Handlers
7
+ const handleChange = () => !disabled && onChange(!checked);
8
+ // #########
9
+ // Rendering
10
+ return (React.createElement("div", { className: `ts-checkbox ${disabled ? 'ts-checkbox--disabled' : ''}`, onClick: handleChange },
11
+ React.createElement("div", { className: "ts-checkbox-box" },
12
+ React.createElement(TsIcon, { name: checked ? 'check-square-filled' : 'square' })),
13
+ React.createElement("div", { className: `ts-checkbox-container ${caption ? 'ts-checkbox-container--with-caption' : ''}` },
14
+ React.createElement("div", { className: "ts-checkbox-label" }, label),
15
+ caption && React.createElement("div", { className: "ts-checkbox-caption" }, caption))));
16
+ };
17
+ //# sourceMappingURL=TsCheckbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TsCheckbox.js","sourceRoot":"","sources":["../../../src/components/TsCheckbox/TsCheckbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAE1C,OAAO,kBAAkB,CAAC;AAE1B,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAmB,EAAE,EAAE;IAC7F,WAAW;IACX,WAAW;IACX,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;IAE3D,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAE,eAAe,QAAQ,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY;QAC7F,6BAAK,SAAS,EAAC,iBAAiB;YAC9B,oBAAC,MAAM,IAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,QAAQ,GAAI,CACxD;QAEN,6BAAK,SAAS,EAAE,yBAAyB,OAAO,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,EAAE,EAAE;YAC7F,6BAAK,SAAS,EAAC,mBAAmB,IAAE,KAAK,CAAO;YAC/C,OAAO,IAAI,6BAAK,SAAS,EAAC,qBAAqB,IAAE,OAAO,CAAO,CAC5D,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,7 @@
1
+ export type TsCheckboxProps = {
2
+ caption?: string;
3
+ label: string;
4
+ checked?: boolean;
5
+ disabled?: boolean;
6
+ onChange: (value: boolean) => void;
7
+ };
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=TsCheckbox.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TsCheckbox.types.js","sourceRoot":"","sources":["../../../src/components/TsCheckbox/TsCheckbox.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
3
+ import { TsCheckbox } from '../TsCheckbox';
4
+
5
+ <Meta title="Components/Checkbox" />
6
+
7
+ export const checkboxArgTypes = {
8
+ caption: {
9
+ control: 'text',
10
+ description: 'Caption of the checkbox.',
11
+ },
12
+ label: {
13
+ control: 'text',
14
+ description: 'Label of the checkbox.',
15
+ },
16
+ checked: {
17
+ control: 'boolean',
18
+ description: 'State of the checkbox.',
19
+ table: { defaultValue: { summary: 'false' } },
20
+ },
21
+ disabled: {
22
+ control: 'boolean',
23
+ description: 'Enable state of the checkbox.',
24
+ table: { defaultValue: { summary: 'false' } },
25
+ },
26
+ onChange: {
27
+ control: 'function',
28
+ description: 'The handler called when clicking on the checkbox.',
29
+ },
30
+ };
31
+
32
+ # Checkbox
33
+
34
+ Checkboxes are applied when users can select all, several, or none of the options from a given list.
35
+
36
+ ## Overview
37
+
38
+ <Canvas>
39
+ <Story
40
+ name="Overview"
41
+ args={{
42
+ label: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
43
+ caption:
44
+ 'Auctor nisl justo, sed posuere est dignissim nec. Integer ultricies, metus ac imperdiet ullamcorper, est justo viverra nisl, in posuere dui urna eget quam.',
45
+ checked: false,
46
+ disabled: false,
47
+ }}
48
+ argTypes={checkboxArgTypes}
49
+ >
50
+ {args => <TsCheckbox {...args}>{args.children}</TsCheckbox>}
51
+ </Story>
52
+ </Canvas>
53
+
54
+ ## Props
55
+
56
+ <ArgsTable story="Overview" of={TsCheckbox} />
@@ -19,6 +19,13 @@ input:focus {
19
19
  .ts-input--padding-1 input {
20
20
  padding: 0 30px 0 10px;
21
21
  }
22
+ /* ####### */
23
+ /* LABEL */
24
+ .ts-input-label {
25
+ padding-bottom: 10px;
26
+ }
27
+ /* ###### */
28
+ /* ICON */
22
29
  .ts-input-icon {
23
30
  position: absolute;
24
31
  top: 0;
@@ -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: ({ icon, value, onChange, ...props }: TsInputProps) => React.JSX.Element;
4
+ export declare const TsInput: ({ icon, label, value, onChange, ...props }: TsInputProps) => React.JSX.Element;
@@ -1,10 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { TsIcon } from '../../TsIcon/TsIcon';
3
3
  import './TsInput.css';
4
- export const TsInput = ({ icon, value, onChange, ...props }) => {
4
+ export const TsInput = ({ icon, label, value, onChange, ...props }) => {
5
5
  // #########
6
6
  // Rendering
7
7
  return (React.createElement("div", { className: `ts-input ${icon ? 'ts-input--padding-1' : ''}` },
8
+ label && React.createElement("div", { className: "ts-input-label" }, label),
8
9
  React.createElement("input", { type: "text", value: value, onChange: e => onChange(e.target.value), ...props }),
9
10
  icon && (React.createElement("div", { className: "ts-input-icon" },
10
11
  React.createElement(TsIcon, { name: icon, size: "16" })))));
@@ -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,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB,EAAE,EAAE;IAC3E,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAE,YAAY,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7D,+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;QACtF,IAAI,IAAI,CACP,6BAAK,SAAS,EAAC,eAAe;YAC5B,oBAAC,MAAM,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,GAAG,CAC5B,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC"}
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,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB,EAAE,EAAE;IAClF,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAE,YAAY,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE;QAC5D,KAAK,IAAI,6BAAK,SAAS,EAAC,gBAAgB,IAAE,KAAK,CAAO;QACvD,+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;QACtF,IAAI,IAAI,CACP,6BAAK,SAAS,EAAC,eAAe;YAC5B,oBAAC,MAAM,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,GAAG,CAC5B,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -3,11 +3,12 @@ import { TsIcon } from '../../TsIcon/TsIcon';
3
3
  import { TsInputProps } from './TsInput.types';
4
4
  import './TsInput.css';
5
5
 
6
- export const TsInput = ({ icon, value, onChange, ...props }: TsInputProps) => {
6
+ export const TsInput = ({ icon, label, value, onChange, ...props }: TsInputProps) => {
7
7
  // #########
8
8
  // Rendering
9
9
  return (
10
10
  <div className={`ts-input ${icon ? 'ts-input--padding-1' : ''}`}>
11
+ {label && <div className="ts-input-label">{label}</div>}
11
12
  <input type="text" value={value} onChange={e => onChange(e.target.value)} {...props} />
12
13
  {icon && (
13
14
  <div className="ts-input-icon">
@@ -1,5 +1,6 @@
1
1
  import { InputHTMLAttributes } from 'react';
2
2
  export type TsInputProps = {
3
3
  icon?: string;
4
+ label?: string;
4
5
  onChange: (value: string) => void;
5
6
  } & Omit<Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>, 'size'>;
@@ -2,5 +2,6 @@ import { InputHTMLAttributes } from 'react';
2
2
 
3
3
  export type TsInputProps = {
4
4
  icon?: string;
5
+ label?: string;
5
6
  onChange: (value: string) => void;
6
7
  } & Omit<Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>, 'size'>;
@@ -9,11 +9,15 @@ export const inputArgTypes = {
9
9
  icon: {
10
10
  control: 'select',
11
11
  options: Object.keys(icons),
12
- description: 'Icon of the button.',
12
+ description: 'Icon of the input.',
13
+ },
14
+ label: {
15
+ control: 'text',
16
+ description: 'label of the input.',
13
17
  },
14
18
  placeholder: {
15
19
  control: 'text',
16
- description: 'Placeholder of the button.',
20
+ description: 'Placeholder of the input.',
17
21
  },
18
22
  };
19
23
 
@@ -24,7 +28,11 @@ Input allows the user to enter content and data when the expected user input is
24
28
  ## Overview
25
29
 
26
30
  <Canvas>
27
- <Story name="Overview" args={{ onChange: () => {} }} argTypes={inputArgTypes}>
31
+ <Story
32
+ name="Overview"
33
+ args={{ label: '', placeholder: 'Enter some text', onChange: () => {} }}
34
+ argTypes={inputArgTypes}
35
+ >
28
36
  {args => <TsInput {...args} />}
29
37
  </Story>
30
38
  </Canvas>
package/esm/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './components/TsButton/TsButton';
2
+ export * from './components/TsCheckbox/TsCheckbox';
2
3
  export * from './components/TsIcon/TsIcon';
3
4
  export * from './components/TsInput/TsInput/TsInput';
4
5
  export * from './components/TsLoader/TsLoader';
package/esm/index.js CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './components/TsButton/TsButton';
2
+ export * from './components/TsCheckbox/TsCheckbox';
2
3
  export * from './components/TsIcon/TsIcon';
3
4
  export * from './components/TsInput/TsInput/TsInput';
4
5
  export * from './components/TsLoader/TsLoader';
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,gCAAgC,CAAC;AAC/C,cAAc,oCAAoC,CAAC;AACnD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC"}
@@ -0,0 +1,73 @@
1
+ .ts-checkbox {
2
+ display: flex;
3
+ align-items: center;
4
+ cursor: pointer;
5
+ }
6
+ /* ########## */
7
+ /* DISABLED */
8
+ .ts-checkbox--disabled {
9
+ cursor: not-allowed;
10
+ }
11
+ .ts-checkbox--disabled .ts-checkbox-box {
12
+ color: #d7daf1;
13
+ }
14
+ .ts-checkbox--disabled:hover .ts-checkbox-box {
15
+ background: transparent;
16
+ }
17
+ /* ##### */
18
+ /* BOX */
19
+ .ts-checkbox:not(.ts-checkbox--disabled):hover .ts-checkbox-box {
20
+ background: #e1e3f5;
21
+ }
22
+ .ts-checkbox-box {
23
+ position: relative;
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ width: 24px;
28
+ min-width: 24px;
29
+ height: 24px;
30
+ min-height: 24px;
31
+ border-radius: 6px;
32
+ color: #3643ba;
33
+ transition: all ease 0.3s;
34
+ }
35
+ .ts-checkbox-box::before {
36
+ content: '';
37
+ position: absolute;
38
+ width: 12px;
39
+ height: 12px;
40
+ border-radius: 6px;
41
+ background: #ffffff;
42
+ z-index: 10;
43
+ }
44
+ .ts-checkbox-box .ts-icon {
45
+ z-index: 20;
46
+ }
47
+
48
+ /* ################# */
49
+ /* LABEL / CAPTION */
50
+ .ts-checkbox-container {
51
+ width: 100%;
52
+ padding: 4px 8px;
53
+ border-radius: 6px;
54
+ }
55
+ .ts-checkbox-container--with-caption .ts-checkbox-label {
56
+ color: #3643ba;
57
+ font-weight: 700;
58
+ }
59
+ .ts-checkbox-caption {
60
+ color: #404040;
61
+ font-size: 12px;
62
+ font-style: italic;
63
+ }
64
+
65
+ /* ######### */
66
+ /* GLOBALS */
67
+ * {
68
+ font-size: 14px;
69
+ outline: none;
70
+ box-sizing: border-box;
71
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
72
+ 'Helvetica Neue', sans-serif;
73
+ }
@@ -0,0 +1,4 @@
1
+ import * as React from 'react';
2
+ import { TsCheckboxProps } from './TsCheckbox.types';
3
+ import './TsCheckbox.css';
4
+ export declare const TsCheckbox: ({ caption, label, checked, disabled, onChange }: TsCheckboxProps) => React.JSX.Element;
@@ -0,0 +1,21 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.TsCheckbox = void 0;
4
+ const React = require("react");
5
+ const TsIcon_1 = require("../TsIcon/TsIcon");
6
+ require("./TsCheckbox.css");
7
+ const TsCheckbox = ({ caption, label, checked, disabled, onChange }) => {
8
+ // ########
9
+ // Handlers
10
+ const handleChange = () => !disabled && onChange(!checked);
11
+ // #########
12
+ // Rendering
13
+ return (React.createElement("div", { className: `ts-checkbox ${disabled ? 'ts-checkbox--disabled' : ''}`, onClick: handleChange },
14
+ React.createElement("div", { className: "ts-checkbox-box" },
15
+ React.createElement(TsIcon_1.TsIcon, { name: checked ? 'check-square-filled' : 'square' })),
16
+ React.createElement("div", { className: `ts-checkbox-container ${caption ? 'ts-checkbox-container--with-caption' : ''}` },
17
+ React.createElement("div", { className: "ts-checkbox-label" }, label),
18
+ caption && React.createElement("div", { className: "ts-checkbox-caption" }, caption))));
19
+ };
20
+ exports.TsCheckbox = TsCheckbox;
21
+ //# sourceMappingURL=TsCheckbox.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TsCheckbox.js","sourceRoot":"","sources":["../../../src/components/TsCheckbox/TsCheckbox.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,6CAA0C;AAE1C,4BAA0B;AAEnB,MAAM,UAAU,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAmB,EAAE,EAAE;IAC7F,WAAW;IACX,WAAW;IACX,MAAM,YAAY,GAAG,GAAG,EAAE,CAAC,CAAC,QAAQ,IAAI,QAAQ,CAAC,CAAC,OAAO,CAAC,CAAC;IAE3D,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAE,eAAe,QAAQ,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY;QAC7F,6BAAK,SAAS,EAAC,iBAAiB;YAC9B,oBAAC,eAAM,IAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,QAAQ,GAAI,CACxD;QAEN,6BAAK,SAAS,EAAE,yBAAyB,OAAO,CAAC,CAAC,CAAC,qCAAqC,CAAC,CAAC,CAAC,EAAE,EAAE;YAC7F,6BAAK,SAAS,EAAC,mBAAmB,IAAE,KAAK,CAAO;YAC/C,OAAO,IAAI,6BAAK,SAAS,EAAC,qBAAqB,IAAE,OAAO,CAAO,CAC5D,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,UAAU,cAmBrB"}
@@ -0,0 +1,7 @@
1
+ export type TsCheckboxProps = {
2
+ caption?: string;
3
+ label: string;
4
+ checked?: boolean;
5
+ disabled?: boolean;
6
+ onChange: (value: boolean) => void;
7
+ };
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=TsCheckbox.types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"TsCheckbox.types.js","sourceRoot":"","sources":["../../../src/components/TsCheckbox/TsCheckbox.types.ts"],"names":[],"mappings":""}
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
3
+ import { TsCheckbox } from '../TsCheckbox';
4
+
5
+ <Meta title="Components/Checkbox" />
6
+
7
+ export const checkboxArgTypes = {
8
+ caption: {
9
+ control: 'text',
10
+ description: 'Caption of the checkbox.',
11
+ },
12
+ label: {
13
+ control: 'text',
14
+ description: 'Label of the checkbox.',
15
+ },
16
+ checked: {
17
+ control: 'boolean',
18
+ description: 'State of the checkbox.',
19
+ table: { defaultValue: { summary: 'false' } },
20
+ },
21
+ disabled: {
22
+ control: 'boolean',
23
+ description: 'Enable state of the checkbox.',
24
+ table: { defaultValue: { summary: 'false' } },
25
+ },
26
+ onChange: {
27
+ control: 'function',
28
+ description: 'The handler called when clicking on the checkbox.',
29
+ },
30
+ };
31
+
32
+ # Checkbox
33
+
34
+ Checkboxes are applied when users can select all, several, or none of the options from a given list.
35
+
36
+ ## Overview
37
+
38
+ <Canvas>
39
+ <Story
40
+ name="Overview"
41
+ args={{
42
+ label: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
43
+ caption:
44
+ 'Auctor nisl justo, sed posuere est dignissim nec. Integer ultricies, metus ac imperdiet ullamcorper, est justo viverra nisl, in posuere dui urna eget quam.',
45
+ checked: false,
46
+ disabled: false,
47
+ }}
48
+ argTypes={checkboxArgTypes}
49
+ >
50
+ {args => <TsCheckbox {...args}>{args.children}</TsCheckbox>}
51
+ </Story>
52
+ </Canvas>
53
+
54
+ ## Props
55
+
56
+ <ArgsTable story="Overview" of={TsCheckbox} />
@@ -19,6 +19,13 @@ input:focus {
19
19
  .ts-input--padding-1 input {
20
20
  padding: 0 30px 0 10px;
21
21
  }
22
+ /* ####### */
23
+ /* LABEL */
24
+ .ts-input-label {
25
+ padding-bottom: 10px;
26
+ }
27
+ /* ###### */
28
+ /* ICON */
22
29
  .ts-input-icon {
23
30
  position: absolute;
24
31
  top: 0;
@@ -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: ({ icon, value, onChange, ...props }: TsInputProps) => React.JSX.Element;
4
+ export declare const TsInput: ({ icon, label, value, onChange, ...props }: TsInputProps) => React.JSX.Element;
@@ -4,10 +4,11 @@ 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 = ({ icon, value, onChange, ...props }) => {
7
+ const TsInput = ({ icon, label, value, onChange, ...props }) => {
8
8
  // #########
9
9
  // Rendering
10
10
  return (React.createElement("div", { className: `ts-input ${icon ? 'ts-input--padding-1' : ''}` },
11
+ label && React.createElement("div", { className: "ts-input-label" }, label),
11
12
  React.createElement("input", { type: "text", value: value, onChange: e => onChange(e.target.value), ...props }),
12
13
  icon && (React.createElement("div", { className: "ts-input-icon" },
13
14
  React.createElement(TsIcon_1.TsIcon, { name: icon, size: "16" })))));
@@ -1 +1 @@
1
- {"version":3,"file":"TsInput.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsInput/TsInput.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,gDAA6C;AAE7C,yBAAuB;AAEhB,MAAM,OAAO,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB,EAAE,EAAE;IAC3E,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAE,YAAY,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE;QAC7D,+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;QACtF,IAAI,IAAI,CACP,6BAAK,SAAS,EAAC,eAAe;YAC5B,oBAAC,eAAM,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,GAAG,CAC5B,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAbW,QAAA,OAAO,WAalB"}
1
+ {"version":3,"file":"TsInput.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsInput/TsInput.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,gDAA6C;AAE7C,yBAAuB;AAEhB,MAAM,OAAO,GAAG,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAgB,EAAE,EAAE;IAClF,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAE,YAAY,IAAI,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,EAAE,EAAE;QAC5D,KAAK,IAAI,6BAAK,SAAS,EAAC,gBAAgB,IAAE,KAAK,CAAO;QACvD,+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;QACtF,IAAI,IAAI,CACP,6BAAK,SAAS,EAAC,eAAe;YAC5B,oBAAC,eAAM,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAC,IAAI,GAAG,CAC5B,CACP,CACG,CACP,CAAC;AACJ,CAAC,CAAC;AAdW,QAAA,OAAO,WAclB"}
@@ -3,11 +3,12 @@ import { TsIcon } from '../../TsIcon/TsIcon';
3
3
  import { TsInputProps } from './TsInput.types';
4
4
  import './TsInput.css';
5
5
 
6
- export const TsInput = ({ icon, value, onChange, ...props }: TsInputProps) => {
6
+ export const TsInput = ({ icon, label, value, onChange, ...props }: TsInputProps) => {
7
7
  // #########
8
8
  // Rendering
9
9
  return (
10
10
  <div className={`ts-input ${icon ? 'ts-input--padding-1' : ''}`}>
11
+ {label && <div className="ts-input-label">{label}</div>}
11
12
  <input type="text" value={value} onChange={e => onChange(e.target.value)} {...props} />
12
13
  {icon && (
13
14
  <div className="ts-input-icon">
@@ -1,5 +1,6 @@
1
1
  import { InputHTMLAttributes } from 'react';
2
2
  export type TsInputProps = {
3
3
  icon?: string;
4
+ label?: string;
4
5
  onChange: (value: string) => void;
5
6
  } & Omit<Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>, 'size'>;
@@ -2,5 +2,6 @@ import { InputHTMLAttributes } from 'react';
2
2
 
3
3
  export type TsInputProps = {
4
4
  icon?: string;
5
+ label?: string;
5
6
  onChange: (value: string) => void;
6
7
  } & Omit<Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>, 'size'>;
@@ -9,11 +9,15 @@ export const inputArgTypes = {
9
9
  icon: {
10
10
  control: 'select',
11
11
  options: Object.keys(icons),
12
- description: 'Icon of the button.',
12
+ description: 'Icon of the input.',
13
+ },
14
+ label: {
15
+ control: 'text',
16
+ description: 'label of the input.',
13
17
  },
14
18
  placeholder: {
15
19
  control: 'text',
16
- description: 'Placeholder of the button.',
20
+ description: 'Placeholder of the input.',
17
21
  },
18
22
  };
19
23
 
@@ -24,7 +28,11 @@ Input allows the user to enter content and data when the expected user input is
24
28
  ## Overview
25
29
 
26
30
  <Canvas>
27
- <Story name="Overview" args={{ onChange: () => {} }} argTypes={inputArgTypes}>
31
+ <Story
32
+ name="Overview"
33
+ args={{ label: '', placeholder: 'Enter some text', onChange: () => {} }}
34
+ argTypes={inputArgTypes}
35
+ >
28
36
  {args => <TsInput {...args} />}
29
37
  </Story>
30
38
  </Canvas>
package/lib/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './components/TsButton/TsButton';
2
+ export * from './components/TsCheckbox/TsCheckbox';
2
3
  export * from './components/TsIcon/TsIcon';
3
4
  export * from './components/TsInput/TsInput/TsInput';
4
5
  export * from './components/TsLoader/TsLoader';
package/lib/index.js CHANGED
@@ -15,6 +15,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./components/TsButton/TsButton"), exports);
18
+ __exportStar(require("./components/TsCheckbox/TsCheckbox"), exports);
18
19
  __exportStar(require("./components/TsIcon/TsIcon"), exports);
19
20
  __exportStar(require("./components/TsInput/TsInput/TsInput"), exports);
20
21
  __exportStar(require("./components/TsLoader/TsLoader"), exports);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,6DAA2C;AAC3C,uEAAqD;AACrD,iEAA+C;AAC/C,8DAA4C;AAC5C,qEAAmD;AACnD,sEAAoD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,iEAA+C;AAC/C,qEAAmD;AACnD,6DAA2C;AAC3C,uEAAqD;AACrD,iEAA+C;AAC/C,8DAA4C;AAC5C,qEAAmD;AACnD,sEAAoD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dktunited-techoff/techoff-suite-ui",
3
- "version": "1.4.4",
3
+ "version": "1.5.1",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib",
6
6
  "module": "esm/index.js",
@@ -0,0 +1,73 @@
1
+ .ts-checkbox {
2
+ display: flex;
3
+ align-items: center;
4
+ cursor: pointer;
5
+ }
6
+ /* ########## */
7
+ /* DISABLED */
8
+ .ts-checkbox--disabled {
9
+ cursor: not-allowed;
10
+ }
11
+ .ts-checkbox--disabled .ts-checkbox-box {
12
+ color: #d7daf1;
13
+ }
14
+ .ts-checkbox--disabled:hover .ts-checkbox-box {
15
+ background: transparent;
16
+ }
17
+ /* ##### */
18
+ /* BOX */
19
+ .ts-checkbox:not(.ts-checkbox--disabled):hover .ts-checkbox-box {
20
+ background: #e1e3f5;
21
+ }
22
+ .ts-checkbox-box {
23
+ position: relative;
24
+ display: flex;
25
+ align-items: center;
26
+ justify-content: center;
27
+ width: 24px;
28
+ min-width: 24px;
29
+ height: 24px;
30
+ min-height: 24px;
31
+ border-radius: 6px;
32
+ color: #3643ba;
33
+ transition: all ease 0.3s;
34
+ }
35
+ .ts-checkbox-box::before {
36
+ content: '';
37
+ position: absolute;
38
+ width: 12px;
39
+ height: 12px;
40
+ border-radius: 6px;
41
+ background: #ffffff;
42
+ z-index: 10;
43
+ }
44
+ .ts-checkbox-box .ts-icon {
45
+ z-index: 20;
46
+ }
47
+
48
+ /* ################# */
49
+ /* LABEL / CAPTION */
50
+ .ts-checkbox-container {
51
+ width: 100%;
52
+ padding: 4px 8px;
53
+ border-radius: 6px;
54
+ }
55
+ .ts-checkbox-container--with-caption .ts-checkbox-label {
56
+ color: #3643ba;
57
+ font-weight: 700;
58
+ }
59
+ .ts-checkbox-caption {
60
+ color: #404040;
61
+ font-size: 12px;
62
+ font-style: italic;
63
+ }
64
+
65
+ /* ######### */
66
+ /* GLOBALS */
67
+ * {
68
+ font-size: 14px;
69
+ outline: none;
70
+ box-sizing: border-box;
71
+ font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
72
+ 'Helvetica Neue', sans-serif;
73
+ }
@@ -0,0 +1,25 @@
1
+ import * as React from 'react';
2
+ import { TsIcon } from '../TsIcon/TsIcon';
3
+ import { TsCheckboxProps } from './TsCheckbox.types';
4
+ import './TsCheckbox.css';
5
+
6
+ export const TsCheckbox = ({ caption, label, checked, disabled, onChange }: TsCheckboxProps) => {
7
+ // ########
8
+ // Handlers
9
+ const handleChange = () => !disabled && onChange(!checked);
10
+
11
+ // #########
12
+ // Rendering
13
+ return (
14
+ <div className={`ts-checkbox ${disabled ? 'ts-checkbox--disabled' : ''}`} onClick={handleChange}>
15
+ <div className="ts-checkbox-box">
16
+ <TsIcon name={checked ? 'check-square-filled' : 'square'} />
17
+ </div>
18
+
19
+ <div className={`ts-checkbox-container ${caption ? 'ts-checkbox-container--with-caption' : ''}`}>
20
+ <div className="ts-checkbox-label">{label}</div>
21
+ {caption && <div className="ts-checkbox-caption">{caption}</div>}
22
+ </div>
23
+ </div>
24
+ );
25
+ };
@@ -0,0 +1,7 @@
1
+ export type TsCheckboxProps = {
2
+ caption?: string;
3
+ label: string;
4
+ checked?: boolean;
5
+ disabled?: boolean;
6
+ onChange: (value: boolean) => void;
7
+ };
@@ -0,0 +1,56 @@
1
+ import React from 'react';
2
+ import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
3
+ import { TsCheckbox } from '../TsCheckbox';
4
+
5
+ <Meta title="Components/Checkbox" />
6
+
7
+ export const checkboxArgTypes = {
8
+ caption: {
9
+ control: 'text',
10
+ description: 'Caption of the checkbox.',
11
+ },
12
+ label: {
13
+ control: 'text',
14
+ description: 'Label of the checkbox.',
15
+ },
16
+ checked: {
17
+ control: 'boolean',
18
+ description: 'State of the checkbox.',
19
+ table: { defaultValue: { summary: 'false' } },
20
+ },
21
+ disabled: {
22
+ control: 'boolean',
23
+ description: 'Enable state of the checkbox.',
24
+ table: { defaultValue: { summary: 'false' } },
25
+ },
26
+ onChange: {
27
+ control: 'function',
28
+ description: 'The handler called when clicking on the checkbox.',
29
+ },
30
+ };
31
+
32
+ # Checkbox
33
+
34
+ Checkboxes are applied when users can select all, several, or none of the options from a given list.
35
+
36
+ ## Overview
37
+
38
+ <Canvas>
39
+ <Story
40
+ name="Overview"
41
+ args={{
42
+ label: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
43
+ caption:
44
+ 'Auctor nisl justo, sed posuere est dignissim nec. Integer ultricies, metus ac imperdiet ullamcorper, est justo viverra nisl, in posuere dui urna eget quam.',
45
+ checked: false,
46
+ disabled: false,
47
+ }}
48
+ argTypes={checkboxArgTypes}
49
+ >
50
+ {args => <TsCheckbox {...args}>{args.children}</TsCheckbox>}
51
+ </Story>
52
+ </Canvas>
53
+
54
+ ## Props
55
+
56
+ <ArgsTable story="Overview" of={TsCheckbox} />
@@ -19,6 +19,13 @@ input:focus {
19
19
  .ts-input--padding-1 input {
20
20
  padding: 0 30px 0 10px;
21
21
  }
22
+ /* ####### */
23
+ /* LABEL */
24
+ .ts-input-label {
25
+ padding-bottom: 10px;
26
+ }
27
+ /* ###### */
28
+ /* ICON */
22
29
  .ts-input-icon {
23
30
  position: absolute;
24
31
  top: 0;
@@ -3,11 +3,12 @@ import { TsIcon } from '../../TsIcon/TsIcon';
3
3
  import { TsInputProps } from './TsInput.types';
4
4
  import './TsInput.css';
5
5
 
6
- export const TsInput = ({ icon, value, onChange, ...props }: TsInputProps) => {
6
+ export const TsInput = ({ icon, label, value, onChange, ...props }: TsInputProps) => {
7
7
  // #########
8
8
  // Rendering
9
9
  return (
10
10
  <div className={`ts-input ${icon ? 'ts-input--padding-1' : ''}`}>
11
+ {label && <div className="ts-input-label">{label}</div>}
11
12
  <input type="text" value={value} onChange={e => onChange(e.target.value)} {...props} />
12
13
  {icon && (
13
14
  <div className="ts-input-icon">
@@ -2,5 +2,6 @@ import { InputHTMLAttributes } from 'react';
2
2
 
3
3
  export type TsInputProps = {
4
4
  icon?: string;
5
+ label?: string;
5
6
  onChange: (value: string) => void;
6
7
  } & Omit<Omit<InputHTMLAttributes<HTMLInputElement>, 'onChange'>, 'size'>;
@@ -9,11 +9,15 @@ export const inputArgTypes = {
9
9
  icon: {
10
10
  control: 'select',
11
11
  options: Object.keys(icons),
12
- description: 'Icon of the button.',
12
+ description: 'Icon of the input.',
13
+ },
14
+ label: {
15
+ control: 'text',
16
+ description: 'label of the input.',
13
17
  },
14
18
  placeholder: {
15
19
  control: 'text',
16
- description: 'Placeholder of the button.',
20
+ description: 'Placeholder of the input.',
17
21
  },
18
22
  };
19
23
 
@@ -24,7 +28,11 @@ Input allows the user to enter content and data when the expected user input is
24
28
  ## Overview
25
29
 
26
30
  <Canvas>
27
- <Story name="Overview" args={{ onChange: () => {} }} argTypes={inputArgTypes}>
31
+ <Story
32
+ name="Overview"
33
+ args={{ label: '', placeholder: 'Enter some text', onChange: () => {} }}
34
+ argTypes={inputArgTypes}
35
+ >
28
36
  {args => <TsInput {...args} />}
29
37
  </Story>
30
38
  </Canvas>
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './components/TsButton/TsButton';
2
+ export * from './components/TsCheckbox/TsCheckbox';
2
3
  export * from './components/TsIcon/TsIcon';
3
4
  export * from './components/TsInput/TsInput/TsInput';
4
5
  export * from './components/TsLoader/TsLoader';