@dktunited-techoff/techoff-suite-ui 1.4.3 → 1.5.0

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 (34) hide show
  1. package/esm/components/TsButton/TsButton.css +43 -13
  2. package/esm/components/TsButton/__stories__/TsButton.stories.mdx +6 -0
  3. package/esm/components/TsCheckbox/TsCheckbox.css +73 -0
  4. package/esm/components/TsCheckbox/TsCheckbox.d.ts +4 -0
  5. package/esm/components/TsCheckbox/TsCheckbox.js +17 -0
  6. package/esm/components/TsCheckbox/TsCheckbox.js.map +1 -0
  7. package/esm/components/TsCheckbox/TsCheckbox.types.d.ts +7 -0
  8. package/esm/components/TsCheckbox/TsCheckbox.types.js +2 -0
  9. package/esm/components/TsCheckbox/TsCheckbox.types.js.map +1 -0
  10. package/esm/components/TsCheckbox/__stories__/TsCheckbox.stories.mdx +56 -0
  11. package/esm/index.d.ts +1 -0
  12. package/esm/index.js +1 -0
  13. package/esm/index.js.map +1 -1
  14. package/lib/components/TsButton/TsButton.css +43 -13
  15. package/lib/components/TsButton/__stories__/TsButton.stories.mdx +6 -0
  16. package/lib/components/TsCheckbox/TsCheckbox.css +73 -0
  17. package/lib/components/TsCheckbox/TsCheckbox.d.ts +4 -0
  18. package/lib/components/TsCheckbox/TsCheckbox.js +21 -0
  19. package/lib/components/TsCheckbox/TsCheckbox.js.map +1 -0
  20. package/lib/components/TsCheckbox/TsCheckbox.types.d.ts +7 -0
  21. package/lib/components/TsCheckbox/TsCheckbox.types.js +3 -0
  22. package/lib/components/TsCheckbox/TsCheckbox.types.js.map +1 -0
  23. package/lib/components/TsCheckbox/__stories__/TsCheckbox.stories.mdx +56 -0
  24. package/lib/index.d.ts +1 -0
  25. package/lib/index.js +1 -0
  26. package/lib/index.js.map +1 -1
  27. package/package.json +1 -1
  28. package/src/components/TsButton/TsButton.css +43 -13
  29. package/src/components/TsButton/__stories__/TsButton.stories.mdx +6 -0
  30. package/src/components/TsCheckbox/TsCheckbox.css +73 -0
  31. package/src/components/TsCheckbox/TsCheckbox.tsx +25 -0
  32. package/src/components/TsCheckbox/TsCheckbox.types.ts +7 -0
  33. package/src/components/TsCheckbox/__stories__/TsCheckbox.stories.mdx +56 -0
  34. package/src/index.ts +1 -0
@@ -15,6 +15,9 @@
15
15
  .ts-button > div:last-child {
16
16
  margin-right: 0px;
17
17
  }
18
+ button:disabled {
19
+ cursor: not-allowed;
20
+ }
18
21
  /* ####### */
19
22
  /* BLOCK */
20
23
  .ts-button--block {
@@ -40,34 +43,61 @@
40
43
  }
41
44
  /* ########## */
42
45
  /* VARIANTS */
43
- .ts-button--primary {
46
+ .ts-button--primary:not(:disabled) {
44
47
  background: #3643ba;
45
48
  color: #ffffff;
46
49
  }
47
- /* .ts-button--primary:hover {
48
- background: #00689d;
49
- } */
50
- .ts-button--secondary {
50
+ .ts-button--primary:not(:disabled):hover {
51
+ background: #2e3998;
52
+ }
53
+ .ts-button--primary:not(:disabled):active {
54
+ background: #272f76;
55
+ }
56
+ .ts-button--primary:disabled {
57
+ background: #3643ba61;
58
+ color: #ffffff;
59
+ }
60
+ .ts-button--secondary:not(:disabled) {
51
61
  background: #ebecf7;
52
62
  color: #3643ba;
53
63
  }
54
- /* .ts-button--secondary:hover {
55
- background: #bedeef;
56
- } */
57
- .ts-button--success {
64
+ .ts-button--secondary:not(:disabled):hover {
65
+ background: #e3e3f4;
66
+ }
67
+ .ts-button--secondary:not(:disabled):active {
68
+ background: #d7daf1;
69
+ }
70
+ .ts-button--secondary:disabled {
71
+ background: #3643ba0d;
72
+ color: #3643ba80;
73
+ }
74
+ .ts-button--success:not(:disabled) {
58
75
  background: #02be8a;
59
76
  color: #ffffff;
60
77
  }
61
- .ts-button--success:hover {
78
+ .ts-button--success:not(:disabled):hover {
62
79
  background: #029e73;
80
+ }
81
+ .ts-button--success:not(:disabled):active {
82
+ background: #017f5c;
83
+ }
84
+ .ts-button--success:disabled {
85
+ background: #02be8a61;
63
86
  color: #ffffff;
64
87
  }
65
- .ts-button--ghost {
88
+ .ts-button--ghost:not(:disabled) {
66
89
  background: #ffffff;
67
90
  color: #1d1d1b;
68
91
  }
69
- .ts-button--ghost:hover {
70
- background: #ebecf7;
92
+ .ts-button--ghost:not(:disabled):hover {
93
+ background: #ebecf8;
94
+ }
95
+ .ts-button--ghost:not(:disabled):active {
96
+ background: #d7daf1;
97
+ }
98
+ .ts-button--ghost:disabled {
99
+ background: #ffffff61;
100
+ color: #1d1d1b61;
71
101
  }
72
102
  .ts-button--shadow {
73
103
  box-shadow: 0px 12px 12px 0px #00537d1a;
@@ -38,6 +38,11 @@ export const buttonArgTypes = {
38
38
  description: 'Define if the button is full width',
39
39
  table: { defaultValue: { summary: 'false' } },
40
40
  },
41
+ disabled: {
42
+ control: 'boolean',
43
+ description: 'Define if the button is disabled',
44
+ table: { defaultValue: { summary: 'false' } },
45
+ },
41
46
  rounded: {
42
47
  control: 'boolean',
43
48
  description: 'Define if the button has its corner full rounded',
@@ -60,6 +65,7 @@ Buttons express what action will occur when the users clicks. Buttons are used t
60
65
  size: 'md',
61
66
  variant: 'primary',
62
67
  block: false,
68
+ disabled: false,
63
69
  rounded: false,
64
70
  onClick: () => {},
65
71
  }}
@@ -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} />
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"}
@@ -15,6 +15,9 @@
15
15
  .ts-button > div:last-child {
16
16
  margin-right: 0px;
17
17
  }
18
+ button:disabled {
19
+ cursor: not-allowed;
20
+ }
18
21
  /* ####### */
19
22
  /* BLOCK */
20
23
  .ts-button--block {
@@ -40,34 +43,61 @@
40
43
  }
41
44
  /* ########## */
42
45
  /* VARIANTS */
43
- .ts-button--primary {
46
+ .ts-button--primary:not(:disabled) {
44
47
  background: #3643ba;
45
48
  color: #ffffff;
46
49
  }
47
- /* .ts-button--primary:hover {
48
- background: #00689d;
49
- } */
50
- .ts-button--secondary {
50
+ .ts-button--primary:not(:disabled):hover {
51
+ background: #2e3998;
52
+ }
53
+ .ts-button--primary:not(:disabled):active {
54
+ background: #272f76;
55
+ }
56
+ .ts-button--primary:disabled {
57
+ background: #3643ba61;
58
+ color: #ffffff;
59
+ }
60
+ .ts-button--secondary:not(:disabled) {
51
61
  background: #ebecf7;
52
62
  color: #3643ba;
53
63
  }
54
- /* .ts-button--secondary:hover {
55
- background: #bedeef;
56
- } */
57
- .ts-button--success {
64
+ .ts-button--secondary:not(:disabled):hover {
65
+ background: #e3e3f4;
66
+ }
67
+ .ts-button--secondary:not(:disabled):active {
68
+ background: #d7daf1;
69
+ }
70
+ .ts-button--secondary:disabled {
71
+ background: #3643ba0d;
72
+ color: #3643ba80;
73
+ }
74
+ .ts-button--success:not(:disabled) {
58
75
  background: #02be8a;
59
76
  color: #ffffff;
60
77
  }
61
- .ts-button--success:hover {
78
+ .ts-button--success:not(:disabled):hover {
62
79
  background: #029e73;
80
+ }
81
+ .ts-button--success:not(:disabled):active {
82
+ background: #017f5c;
83
+ }
84
+ .ts-button--success:disabled {
85
+ background: #02be8a61;
63
86
  color: #ffffff;
64
87
  }
65
- .ts-button--ghost {
88
+ .ts-button--ghost:not(:disabled) {
66
89
  background: #ffffff;
67
90
  color: #1d1d1b;
68
91
  }
69
- .ts-button--ghost:hover {
70
- background: #ebecf7;
92
+ .ts-button--ghost:not(:disabled):hover {
93
+ background: #ebecf8;
94
+ }
95
+ .ts-button--ghost:not(:disabled):active {
96
+ background: #d7daf1;
97
+ }
98
+ .ts-button--ghost:disabled {
99
+ background: #ffffff61;
100
+ color: #1d1d1b61;
71
101
  }
72
102
  .ts-button--shadow {
73
103
  box-shadow: 0px 12px 12px 0px #00537d1a;
@@ -38,6 +38,11 @@ export const buttonArgTypes = {
38
38
  description: 'Define if the button is full width',
39
39
  table: { defaultValue: { summary: 'false' } },
40
40
  },
41
+ disabled: {
42
+ control: 'boolean',
43
+ description: 'Define if the button is disabled',
44
+ table: { defaultValue: { summary: 'false' } },
45
+ },
41
46
  rounded: {
42
47
  control: 'boolean',
43
48
  description: 'Define if the button has its corner full rounded',
@@ -60,6 +65,7 @@ Buttons express what action will occur when the users clicks. Buttons are used t
60
65
  size: 'md',
61
66
  variant: 'primary',
62
67
  block: false,
68
+ disabled: false,
63
69
  rounded: false,
64
70
  onClick: () => {},
65
71
  }}
@@ -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} />
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.3",
3
+ "version": "1.5.0",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib",
6
6
  "module": "esm/index.js",
@@ -15,6 +15,9 @@
15
15
  .ts-button > div:last-child {
16
16
  margin-right: 0px;
17
17
  }
18
+ button:disabled {
19
+ cursor: not-allowed;
20
+ }
18
21
  /* ####### */
19
22
  /* BLOCK */
20
23
  .ts-button--block {
@@ -40,34 +43,61 @@
40
43
  }
41
44
  /* ########## */
42
45
  /* VARIANTS */
43
- .ts-button--primary {
46
+ .ts-button--primary:not(:disabled) {
44
47
  background: #3643ba;
45
48
  color: #ffffff;
46
49
  }
47
- /* .ts-button--primary:hover {
48
- background: #00689d;
49
- } */
50
- .ts-button--secondary {
50
+ .ts-button--primary:not(:disabled):hover {
51
+ background: #2e3998;
52
+ }
53
+ .ts-button--primary:not(:disabled):active {
54
+ background: #272f76;
55
+ }
56
+ .ts-button--primary:disabled {
57
+ background: #3643ba61;
58
+ color: #ffffff;
59
+ }
60
+ .ts-button--secondary:not(:disabled) {
51
61
  background: #ebecf7;
52
62
  color: #3643ba;
53
63
  }
54
- /* .ts-button--secondary:hover {
55
- background: #bedeef;
56
- } */
57
- .ts-button--success {
64
+ .ts-button--secondary:not(:disabled):hover {
65
+ background: #e3e3f4;
66
+ }
67
+ .ts-button--secondary:not(:disabled):active {
68
+ background: #d7daf1;
69
+ }
70
+ .ts-button--secondary:disabled {
71
+ background: #3643ba0d;
72
+ color: #3643ba80;
73
+ }
74
+ .ts-button--success:not(:disabled) {
58
75
  background: #02be8a;
59
76
  color: #ffffff;
60
77
  }
61
- .ts-button--success:hover {
78
+ .ts-button--success:not(:disabled):hover {
62
79
  background: #029e73;
80
+ }
81
+ .ts-button--success:not(:disabled):active {
82
+ background: #017f5c;
83
+ }
84
+ .ts-button--success:disabled {
85
+ background: #02be8a61;
63
86
  color: #ffffff;
64
87
  }
65
- .ts-button--ghost {
88
+ .ts-button--ghost:not(:disabled) {
66
89
  background: #ffffff;
67
90
  color: #1d1d1b;
68
91
  }
69
- .ts-button--ghost:hover {
70
- background: #ebecf7;
92
+ .ts-button--ghost:not(:disabled):hover {
93
+ background: #ebecf8;
94
+ }
95
+ .ts-button--ghost:not(:disabled):active {
96
+ background: #d7daf1;
97
+ }
98
+ .ts-button--ghost:disabled {
99
+ background: #ffffff61;
100
+ color: #1d1d1b61;
71
101
  }
72
102
  .ts-button--shadow {
73
103
  box-shadow: 0px 12px 12px 0px #00537d1a;
@@ -38,6 +38,11 @@ export const buttonArgTypes = {
38
38
  description: 'Define if the button is full width',
39
39
  table: { defaultValue: { summary: 'false' } },
40
40
  },
41
+ disabled: {
42
+ control: 'boolean',
43
+ description: 'Define if the button is disabled',
44
+ table: { defaultValue: { summary: 'false' } },
45
+ },
41
46
  rounded: {
42
47
  control: 'boolean',
43
48
  description: 'Define if the button has its corner full rounded',
@@ -60,6 +65,7 @@ Buttons express what action will occur when the users clicks. Buttons are used t
60
65
  size: 'md',
61
66
  variant: 'primary',
62
67
  block: false,
68
+ disabled: false,
63
69
  rounded: false,
64
70
  onClick: () => {},
65
71
  }}
@@ -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} />
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';