@dktunited-techoff/techoff-suite-ui 1.8.6 → 1.8.7
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.
- package/esm/components/TsInput/TsBooleanInput/TsBooleanInput.css +55 -0
- package/esm/components/TsInput/TsBooleanInput/TsBooleanInput.d.ts +4 -0
- package/esm/components/TsInput/TsBooleanInput/TsBooleanInput.js +13 -0
- package/esm/components/TsInput/TsBooleanInput/TsBooleanInput.js.map +1 -0
- package/esm/components/TsInput/TsBooleanInput/TsBooleanInput.tsx +24 -0
- package/esm/components/TsInput/TsBooleanInput/TsBooleanInput.types.d.ts +8 -0
- package/esm/components/TsInput/TsBooleanInput/TsBooleanInput.types.js +2 -0
- package/esm/components/TsInput/TsBooleanInput/TsBooleanInput.types.js.map +1 -0
- package/esm/components/TsInput/TsBooleanInput/TsBooleanInput.types.ts +8 -0
- package/esm/components/TsInput/TsBooleanInput/__stories__/TsBooleanInput.stories.mdx +53 -0
- package/esm/components/TsInput/TsInput/TsInput.types.js.map +1 -1
- package/esm/components/TsInput/TsInput/__stories__/TsInput.stories.mdx +1 -1
- package/esm/index.d.ts +1 -0
- package/esm/index.js +1 -0
- package/esm/index.js.map +1 -1
- package/lib/components/TsInput/TsBooleanInput/TsBooleanInput.css +55 -0
- package/lib/components/TsInput/TsBooleanInput/TsBooleanInput.d.ts +4 -0
- package/lib/components/TsInput/TsBooleanInput/TsBooleanInput.js +17 -0
- package/lib/components/TsInput/TsBooleanInput/TsBooleanInput.js.map +1 -0
- package/lib/components/TsInput/TsBooleanInput/TsBooleanInput.tsx +24 -0
- package/lib/components/TsInput/TsBooleanInput/TsBooleanInput.types.d.ts +8 -0
- package/lib/components/TsInput/TsBooleanInput/TsBooleanInput.types.js +3 -0
- package/lib/components/TsInput/TsBooleanInput/TsBooleanInput.types.js.map +1 -0
- package/lib/components/TsInput/TsBooleanInput/TsBooleanInput.types.ts +8 -0
- package/lib/components/TsInput/TsBooleanInput/__stories__/TsBooleanInput.stories.mdx +53 -0
- package/lib/components/TsInput/TsInput/TsInput.types.js.map +1 -1
- package/lib/components/TsInput/TsInput/__stories__/TsInput.stories.mdx +1 -1
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/package.json +1 -1
- package/src/components/TsInput/TsBooleanInput/TsBooleanInput.css +55 -0
- package/src/components/TsInput/TsBooleanInput/TsBooleanInput.tsx +24 -0
- package/src/components/TsInput/TsBooleanInput/TsBooleanInput.types.ts +8 -0
- package/src/components/TsInput/TsBooleanInput/__stories__/TsBooleanInput.stories.mdx +53 -0
- package/src/components/TsInput/TsInput/__stories__/TsInput.stories.mdx +1 -1
- package/src/index.ts +1 -0
- /package/esm/components/TsInput/TsInput/{TsInput.types.tsx → TsInput.types.ts} +0 -0
- /package/lib/components/TsInput/TsInput/{TsInput.types.tsx → TsInput.types.ts} +0 -0
- /package/src/components/TsInput/TsInput/{TsInput.types.tsx → TsInput.types.ts} +0 -0
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.ts-boolean-input {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
}
|
|
5
|
+
.ts-boolean-input > label {
|
|
6
|
+
display: block;
|
|
7
|
+
padding-bottom: 6px;
|
|
8
|
+
}
|
|
9
|
+
.ts-boolean-input-container {
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ts-boolean-input--disabled {
|
|
14
|
+
opacity: 0.5;
|
|
15
|
+
}
|
|
16
|
+
.ts-boolean-input--disabled .ts-boolean-input-content > div {
|
|
17
|
+
cursor: not-allowed;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* ######## */
|
|
21
|
+
/* INPUTS */
|
|
22
|
+
.ts-boolean-input-content {
|
|
23
|
+
display: flex;
|
|
24
|
+
height: 32px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
.ts-boolean-input-content > div {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
min-width: 44px;
|
|
32
|
+
padding: 12px;
|
|
33
|
+
background: #ebecf7;
|
|
34
|
+
color: #3643ba;
|
|
35
|
+
font-weight: 700;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
transition: all ease 0.3s;
|
|
38
|
+
}
|
|
39
|
+
.ts-boolean-input-content > div:first-child {
|
|
40
|
+
border-right: 1px solid #3643ba;
|
|
41
|
+
}
|
|
42
|
+
.ts-boolean-input-content > .ts-boolean-input--selected {
|
|
43
|
+
background: #3643ba;
|
|
44
|
+
color: #ffffff;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* ######### */
|
|
48
|
+
/* GLOBALS */
|
|
49
|
+
* {
|
|
50
|
+
font-size: 14px;
|
|
51
|
+
outline: none;
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
|
54
|
+
'Helvetica Neue', sans-serif;
|
|
55
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import './TsBooleanInput.css';
|
|
3
|
+
export const TsBooleanInput = ({ label, labelFalse, labelTrue, disabled, value, onChange }) => {
|
|
4
|
+
// #########
|
|
5
|
+
// Rendering
|
|
6
|
+
return (React.createElement("div", { className: `ts-boolean-input ${disabled ? 'ts-boolean-input--disabled' : ''}` },
|
|
7
|
+
label && React.createElement("label", null, label),
|
|
8
|
+
React.createElement("div", { className: "ts-boolean-input-container" },
|
|
9
|
+
React.createElement("div", { className: "ts-boolean-input-content" },
|
|
10
|
+
React.createElement("div", { className: value === true ? 'ts-boolean-input--selected' : '', onClick: () => onChange(true) }, labelTrue),
|
|
11
|
+
React.createElement("div", { className: value === false ? 'ts-boolean-input--selected' : '', onClick: () => onChange(false) }, labelFalse)))));
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=TsBooleanInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsBooleanInput.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsBooleanInput/TsBooleanInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,sBAAsB,CAAC;AAE9B,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAuB,EAAE,EAAE;IACjH,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAE,oBAAoB,QAAQ,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/E,KAAK,IAAI,mCAAQ,KAAK,CAAS;QAEhC,6BAAK,SAAS,EAAC,4BAA4B;YACzC,6BAAK,SAAS,EAAC,0BAA0B;gBACvC,6BAAK,SAAS,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAC9F,SAAS,CACN;gBACN,6BAAK,SAAS,EAAE,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAChG,UAAU,CACP,CACF,CACF,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TsBooleanInputProps } from './TsBooleanInput.types';
|
|
3
|
+
import './TsBooleanInput.css';
|
|
4
|
+
|
|
5
|
+
export const TsBooleanInput = ({ label, labelFalse, labelTrue, disabled, value, onChange }: TsBooleanInputProps) => {
|
|
6
|
+
// #########
|
|
7
|
+
// Rendering
|
|
8
|
+
return (
|
|
9
|
+
<div className={`ts-boolean-input ${disabled ? 'ts-boolean-input--disabled' : ''}`}>
|
|
10
|
+
{label && <label>{label}</label>}
|
|
11
|
+
|
|
12
|
+
<div className="ts-boolean-input-container">
|
|
13
|
+
<div className="ts-boolean-input-content">
|
|
14
|
+
<div className={value === true ? 'ts-boolean-input--selected' : ''} onClick={() => onChange(true)}>
|
|
15
|
+
{labelTrue}
|
|
16
|
+
</div>
|
|
17
|
+
<div className={value === false ? 'ts-boolean-input--selected' : ''} onClick={() => onChange(false)}>
|
|
18
|
+
{labelFalse}
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsBooleanInput.types.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsBooleanInput/TsBooleanInput.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
+
import { TsBooleanInput } from '../TsBooleanInput';
|
|
4
|
+
|
|
5
|
+
<Meta title="Components/Inputs/BooleanInput" />
|
|
6
|
+
|
|
7
|
+
export const inputArgType = {
|
|
8
|
+
label: {
|
|
9
|
+
control: 'text',
|
|
10
|
+
description: 'Label of the input.',
|
|
11
|
+
},
|
|
12
|
+
labelFalse: {
|
|
13
|
+
control: 'text',
|
|
14
|
+
description: 'Label of the FALSE value.',
|
|
15
|
+
},
|
|
16
|
+
labelTrue: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Label of the TRUE value.',
|
|
19
|
+
},
|
|
20
|
+
disabled: {
|
|
21
|
+
control: 'boolean',
|
|
22
|
+
description: 'Enable state of the input.',
|
|
23
|
+
table: { defaultValue: { summary: 'false' } },
|
|
24
|
+
},
|
|
25
|
+
value: {
|
|
26
|
+
control: 'boolean',
|
|
27
|
+
description: 'Value of the input (can be undefined).',
|
|
28
|
+
},
|
|
29
|
+
onChange: {
|
|
30
|
+
control: 'function',
|
|
31
|
+
description: 'The handler called when clicking on input.',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
# Boolean Input
|
|
36
|
+
|
|
37
|
+
The Boolean input is used to quickly switch between two possible states. It is commonly used for "yes/no" switches. The input can in some cases have a 3rd state, EMPTY.
|
|
38
|
+
|
|
39
|
+
## Overview
|
|
40
|
+
|
|
41
|
+
<Canvas>
|
|
42
|
+
<Story
|
|
43
|
+
name="Overview"
|
|
44
|
+
args={{ label: 'Label', labelFalse: 'No', labelTrue: 'Yes', disabled: false }}
|
|
45
|
+
argTypes={inputArgType}
|
|
46
|
+
>
|
|
47
|
+
{args => <TsBooleanInput {...args} />}
|
|
48
|
+
</Story>
|
|
49
|
+
</Canvas>
|
|
50
|
+
|
|
51
|
+
## Props
|
|
52
|
+
|
|
53
|
+
<ArgsTable story="Overview" of={TsBooleanInput} />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TsInput.types.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsInput/TsInput.types.
|
|
1
|
+
{"version":3,"file":"TsInput.types.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsInput/TsInput.types.ts"],"names":[],"mappings":""}
|
|
@@ -3,7 +3,7 @@ import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
|
3
3
|
import { TsInput } from '../TsInput';
|
|
4
4
|
import { icons } from '../../../TsIcon/icons';
|
|
5
5
|
|
|
6
|
-
<Meta title="Components/Input" />
|
|
6
|
+
<Meta title="Components/Inputs/Input" />
|
|
7
7
|
|
|
8
8
|
export const inputArgTypes = {
|
|
9
9
|
byDefault: {
|
package/esm/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './components/TsCheckbox/TsCheckbox';
|
|
|
3
3
|
export * from './components/TsDropdowns/TsDropdown/TsDropdown';
|
|
4
4
|
export * from './components/TsDropdowns/TsDropdownFilter/TsDropdownFilter';
|
|
5
5
|
export * from './components/TsIcon/TsIcon';
|
|
6
|
+
export * from './components/TsInput/TsBooleanInput/TsBooleanInput';
|
|
6
7
|
export * from './components/TsInput/TsInput/TsInput';
|
|
7
8
|
export * from './components/TsLoader/TsLoader';
|
|
8
9
|
export * from './components/TsTabs/TsTabs';
|
package/esm/index.js
CHANGED
|
@@ -3,6 +3,7 @@ export * from './components/TsCheckbox/TsCheckbox';
|
|
|
3
3
|
export * from './components/TsDropdowns/TsDropdown/TsDropdown';
|
|
4
4
|
export * from './components/TsDropdowns/TsDropdownFilter/TsDropdownFilter';
|
|
5
5
|
export * from './components/TsIcon/TsIcon';
|
|
6
|
+
export * from './components/TsInput/TsBooleanInput/TsBooleanInput';
|
|
6
7
|
export * from './components/TsInput/TsInput/TsInput';
|
|
7
8
|
export * from './components/TsLoader/TsLoader';
|
|
8
9
|
export * from './components/TsTabs/TsTabs';
|
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,oCAAoC,CAAC;AACnD,cAAc,gDAAgD,CAAC;AAC/D,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4BAA4B,CAAC;AAC3C,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,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,gDAAgD,CAAC;AAC/D,cAAc,4DAA4D,CAAC;AAC3E,cAAc,4BAA4B,CAAC;AAC3C,cAAc,oDAAoD,CAAC;AACnE,cAAc,sCAAsC,CAAC;AACrD,cAAc,gCAAgC,CAAC;AAC/C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,6BAA6B,CAAC;AAC5C,cAAc,oCAAoC,CAAC;AACnD,cAAc,qCAAqC,CAAC"}
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.ts-boolean-input {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
}
|
|
5
|
+
.ts-boolean-input > label {
|
|
6
|
+
display: block;
|
|
7
|
+
padding-bottom: 6px;
|
|
8
|
+
}
|
|
9
|
+
.ts-boolean-input-container {
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ts-boolean-input--disabled {
|
|
14
|
+
opacity: 0.5;
|
|
15
|
+
}
|
|
16
|
+
.ts-boolean-input--disabled .ts-boolean-input-content > div {
|
|
17
|
+
cursor: not-allowed;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* ######## */
|
|
21
|
+
/* INPUTS */
|
|
22
|
+
.ts-boolean-input-content {
|
|
23
|
+
display: flex;
|
|
24
|
+
height: 32px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
.ts-boolean-input-content > div {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
min-width: 44px;
|
|
32
|
+
padding: 12px;
|
|
33
|
+
background: #ebecf7;
|
|
34
|
+
color: #3643ba;
|
|
35
|
+
font-weight: 700;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
transition: all ease 0.3s;
|
|
38
|
+
}
|
|
39
|
+
.ts-boolean-input-content > div:first-child {
|
|
40
|
+
border-right: 1px solid #3643ba;
|
|
41
|
+
}
|
|
42
|
+
.ts-boolean-input-content > .ts-boolean-input--selected {
|
|
43
|
+
background: #3643ba;
|
|
44
|
+
color: #ffffff;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* ######### */
|
|
48
|
+
/* GLOBALS */
|
|
49
|
+
* {
|
|
50
|
+
font-size: 14px;
|
|
51
|
+
outline: none;
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
|
54
|
+
'Helvetica Neue', sans-serif;
|
|
55
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TsBooleanInput = void 0;
|
|
4
|
+
const React = require("react");
|
|
5
|
+
require("./TsBooleanInput.css");
|
|
6
|
+
const TsBooleanInput = ({ label, labelFalse, labelTrue, disabled, value, onChange }) => {
|
|
7
|
+
// #########
|
|
8
|
+
// Rendering
|
|
9
|
+
return (React.createElement("div", { className: `ts-boolean-input ${disabled ? 'ts-boolean-input--disabled' : ''}` },
|
|
10
|
+
label && React.createElement("label", null, label),
|
|
11
|
+
React.createElement("div", { className: "ts-boolean-input-container" },
|
|
12
|
+
React.createElement("div", { className: "ts-boolean-input-content" },
|
|
13
|
+
React.createElement("div", { className: value === true ? 'ts-boolean-input--selected' : '', onClick: () => onChange(true) }, labelTrue),
|
|
14
|
+
React.createElement("div", { className: value === false ? 'ts-boolean-input--selected' : '', onClick: () => onChange(false) }, labelFalse)))));
|
|
15
|
+
};
|
|
16
|
+
exports.TsBooleanInput = TsBooleanInput;
|
|
17
|
+
//# sourceMappingURL=TsBooleanInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsBooleanInput.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsBooleanInput/TsBooleanInput.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAE/B,gCAA8B;AAEvB,MAAM,cAAc,GAAG,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAuB,EAAE,EAAE;IACjH,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAE,oBAAoB,QAAQ,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,EAAE;QAC/E,KAAK,IAAI,mCAAQ,KAAK,CAAS;QAEhC,6BAAK,SAAS,EAAC,4BAA4B;YACzC,6BAAK,SAAS,EAAC,0BAA0B;gBACvC,6BAAK,SAAS,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,IAC9F,SAAS,CACN;gBACN,6BAAK,SAAS,EAAE,KAAK,KAAK,KAAK,CAAC,CAAC,CAAC,4BAA4B,CAAC,CAAC,CAAC,EAAE,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,KAAK,CAAC,IAChG,UAAU,CACP,CACF,CACF,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AAnBW,QAAA,cAAc,kBAmBzB"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TsBooleanInputProps } from './TsBooleanInput.types';
|
|
3
|
+
import './TsBooleanInput.css';
|
|
4
|
+
|
|
5
|
+
export const TsBooleanInput = ({ label, labelFalse, labelTrue, disabled, value, onChange }: TsBooleanInputProps) => {
|
|
6
|
+
// #########
|
|
7
|
+
// Rendering
|
|
8
|
+
return (
|
|
9
|
+
<div className={`ts-boolean-input ${disabled ? 'ts-boolean-input--disabled' : ''}`}>
|
|
10
|
+
{label && <label>{label}</label>}
|
|
11
|
+
|
|
12
|
+
<div className="ts-boolean-input-container">
|
|
13
|
+
<div className="ts-boolean-input-content">
|
|
14
|
+
<div className={value === true ? 'ts-boolean-input--selected' : ''} onClick={() => onChange(true)}>
|
|
15
|
+
{labelTrue}
|
|
16
|
+
</div>
|
|
17
|
+
<div className={value === false ? 'ts-boolean-input--selected' : ''} onClick={() => onChange(false)}>
|
|
18
|
+
{labelFalse}
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TsBooleanInput.types.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsBooleanInput/TsBooleanInput.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
+
import { TsBooleanInput } from '../TsBooleanInput';
|
|
4
|
+
|
|
5
|
+
<Meta title="Components/Inputs/BooleanInput" />
|
|
6
|
+
|
|
7
|
+
export const inputArgType = {
|
|
8
|
+
label: {
|
|
9
|
+
control: 'text',
|
|
10
|
+
description: 'Label of the input.',
|
|
11
|
+
},
|
|
12
|
+
labelFalse: {
|
|
13
|
+
control: 'text',
|
|
14
|
+
description: 'Label of the FALSE value.',
|
|
15
|
+
},
|
|
16
|
+
labelTrue: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Label of the TRUE value.',
|
|
19
|
+
},
|
|
20
|
+
disabled: {
|
|
21
|
+
control: 'boolean',
|
|
22
|
+
description: 'Enable state of the input.',
|
|
23
|
+
table: { defaultValue: { summary: 'false' } },
|
|
24
|
+
},
|
|
25
|
+
value: {
|
|
26
|
+
control: 'boolean',
|
|
27
|
+
description: 'Value of the input (can be undefined).',
|
|
28
|
+
},
|
|
29
|
+
onChange: {
|
|
30
|
+
control: 'function',
|
|
31
|
+
description: 'The handler called when clicking on input.',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
# Boolean Input
|
|
36
|
+
|
|
37
|
+
The Boolean input is used to quickly switch between two possible states. It is commonly used for "yes/no" switches. The input can in some cases have a 3rd state, EMPTY.
|
|
38
|
+
|
|
39
|
+
## Overview
|
|
40
|
+
|
|
41
|
+
<Canvas>
|
|
42
|
+
<Story
|
|
43
|
+
name="Overview"
|
|
44
|
+
args={{ label: 'Label', labelFalse: 'No', labelTrue: 'Yes', disabled: false }}
|
|
45
|
+
argTypes={inputArgType}
|
|
46
|
+
>
|
|
47
|
+
{args => <TsBooleanInput {...args} />}
|
|
48
|
+
</Story>
|
|
49
|
+
</Canvas>
|
|
50
|
+
|
|
51
|
+
## Props
|
|
52
|
+
|
|
53
|
+
<ArgsTable story="Overview" of={TsBooleanInput} />
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TsInput.types.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsInput/TsInput.types.
|
|
1
|
+
{"version":3,"file":"TsInput.types.js","sourceRoot":"","sources":["../../../../src/components/TsInput/TsInput/TsInput.types.ts"],"names":[],"mappings":""}
|
|
@@ -3,7 +3,7 @@ import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
|
3
3
|
import { TsInput } from '../TsInput';
|
|
4
4
|
import { icons } from '../../../TsIcon/icons';
|
|
5
5
|
|
|
6
|
-
<Meta title="Components/Input" />
|
|
6
|
+
<Meta title="Components/Inputs/Input" />
|
|
7
7
|
|
|
8
8
|
export const inputArgTypes = {
|
|
9
9
|
byDefault: {
|
package/lib/index.d.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './components/TsCheckbox/TsCheckbox';
|
|
|
3
3
|
export * from './components/TsDropdowns/TsDropdown/TsDropdown';
|
|
4
4
|
export * from './components/TsDropdowns/TsDropdownFilter/TsDropdownFilter';
|
|
5
5
|
export * from './components/TsIcon/TsIcon';
|
|
6
|
+
export * from './components/TsInput/TsBooleanInput/TsBooleanInput';
|
|
6
7
|
export * from './components/TsInput/TsInput/TsInput';
|
|
7
8
|
export * from './components/TsLoader/TsLoader';
|
|
8
9
|
export * from './components/TsTabs/TsTabs';
|
package/lib/index.js
CHANGED
|
@@ -19,6 +19,7 @@ __exportStar(require("./components/TsCheckbox/TsCheckbox"), exports);
|
|
|
19
19
|
__exportStar(require("./components/TsDropdowns/TsDropdown/TsDropdown"), exports);
|
|
20
20
|
__exportStar(require("./components/TsDropdowns/TsDropdownFilter/TsDropdownFilter"), exports);
|
|
21
21
|
__exportStar(require("./components/TsIcon/TsIcon"), exports);
|
|
22
|
+
__exportStar(require("./components/TsInput/TsBooleanInput/TsBooleanInput"), exports);
|
|
22
23
|
__exportStar(require("./components/TsInput/TsInput/TsInput"), exports);
|
|
23
24
|
__exportStar(require("./components/TsLoader/TsLoader"), exports);
|
|
24
25
|
__exportStar(require("./components/TsTabs/TsTabs"), 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,qEAAmD;AACnD,iFAA+D;AAC/D,6FAA2E;AAC3E,6DAA2C;AAC3C,uEAAqD;AACrD,iEAA+C;AAC/C,6DAA2C;AAC3C,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,iFAA+D;AAC/D,6FAA2E;AAC3E,6DAA2C;AAC3C,qFAAmE;AACnE,uEAAqD;AACrD,iEAA+C;AAC/C,6DAA2C;AAC3C,8DAA4C;AAC5C,qEAAmD;AACnD,sEAAoD"}
|
package/package.json
CHANGED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
.ts-boolean-input {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
}
|
|
5
|
+
.ts-boolean-input > label {
|
|
6
|
+
display: block;
|
|
7
|
+
padding-bottom: 6px;
|
|
8
|
+
}
|
|
9
|
+
.ts-boolean-input-container {
|
|
10
|
+
display: flex;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
.ts-boolean-input--disabled {
|
|
14
|
+
opacity: 0.5;
|
|
15
|
+
}
|
|
16
|
+
.ts-boolean-input--disabled .ts-boolean-input-content > div {
|
|
17
|
+
cursor: not-allowed;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
/* ######## */
|
|
21
|
+
/* INPUTS */
|
|
22
|
+
.ts-boolean-input-content {
|
|
23
|
+
display: flex;
|
|
24
|
+
height: 32px;
|
|
25
|
+
overflow: hidden;
|
|
26
|
+
}
|
|
27
|
+
.ts-boolean-input-content > div {
|
|
28
|
+
display: flex;
|
|
29
|
+
align-items: center;
|
|
30
|
+
justify-content: center;
|
|
31
|
+
min-width: 44px;
|
|
32
|
+
padding: 12px;
|
|
33
|
+
background: #ebecf7;
|
|
34
|
+
color: #3643ba;
|
|
35
|
+
font-weight: 700;
|
|
36
|
+
cursor: pointer;
|
|
37
|
+
transition: all ease 0.3s;
|
|
38
|
+
}
|
|
39
|
+
.ts-boolean-input-content > div:first-child {
|
|
40
|
+
border-right: 1px solid #3643ba;
|
|
41
|
+
}
|
|
42
|
+
.ts-boolean-input-content > .ts-boolean-input--selected {
|
|
43
|
+
background: #3643ba;
|
|
44
|
+
color: #ffffff;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/* ######### */
|
|
48
|
+
/* GLOBALS */
|
|
49
|
+
* {
|
|
50
|
+
font-size: 14px;
|
|
51
|
+
outline: none;
|
|
52
|
+
box-sizing: border-box;
|
|
53
|
+
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans',
|
|
54
|
+
'Helvetica Neue', sans-serif;
|
|
55
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { TsBooleanInputProps } from './TsBooleanInput.types';
|
|
3
|
+
import './TsBooleanInput.css';
|
|
4
|
+
|
|
5
|
+
export const TsBooleanInput = ({ label, labelFalse, labelTrue, disabled, value, onChange }: TsBooleanInputProps) => {
|
|
6
|
+
// #########
|
|
7
|
+
// Rendering
|
|
8
|
+
return (
|
|
9
|
+
<div className={`ts-boolean-input ${disabled ? 'ts-boolean-input--disabled' : ''}`}>
|
|
10
|
+
{label && <label>{label}</label>}
|
|
11
|
+
|
|
12
|
+
<div className="ts-boolean-input-container">
|
|
13
|
+
<div className="ts-boolean-input-content">
|
|
14
|
+
<div className={value === true ? 'ts-boolean-input--selected' : ''} onClick={() => onChange(true)}>
|
|
15
|
+
{labelTrue}
|
|
16
|
+
</div>
|
|
17
|
+
<div className={value === false ? 'ts-boolean-input--selected' : ''} onClick={() => onChange(false)}>
|
|
18
|
+
{labelFalse}
|
|
19
|
+
</div>
|
|
20
|
+
</div>
|
|
21
|
+
</div>
|
|
22
|
+
</div>
|
|
23
|
+
);
|
|
24
|
+
};
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
3
|
+
import { TsBooleanInput } from '../TsBooleanInput';
|
|
4
|
+
|
|
5
|
+
<Meta title="Components/Inputs/BooleanInput" />
|
|
6
|
+
|
|
7
|
+
export const inputArgType = {
|
|
8
|
+
label: {
|
|
9
|
+
control: 'text',
|
|
10
|
+
description: 'Label of the input.',
|
|
11
|
+
},
|
|
12
|
+
labelFalse: {
|
|
13
|
+
control: 'text',
|
|
14
|
+
description: 'Label of the FALSE value.',
|
|
15
|
+
},
|
|
16
|
+
labelTrue: {
|
|
17
|
+
control: 'text',
|
|
18
|
+
description: 'Label of the TRUE value.',
|
|
19
|
+
},
|
|
20
|
+
disabled: {
|
|
21
|
+
control: 'boolean',
|
|
22
|
+
description: 'Enable state of the input.',
|
|
23
|
+
table: { defaultValue: { summary: 'false' } },
|
|
24
|
+
},
|
|
25
|
+
value: {
|
|
26
|
+
control: 'boolean',
|
|
27
|
+
description: 'Value of the input (can be undefined).',
|
|
28
|
+
},
|
|
29
|
+
onChange: {
|
|
30
|
+
control: 'function',
|
|
31
|
+
description: 'The handler called when clicking on input.',
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
# Boolean Input
|
|
36
|
+
|
|
37
|
+
The Boolean input is used to quickly switch between two possible states. It is commonly used for "yes/no" switches. The input can in some cases have a 3rd state, EMPTY.
|
|
38
|
+
|
|
39
|
+
## Overview
|
|
40
|
+
|
|
41
|
+
<Canvas>
|
|
42
|
+
<Story
|
|
43
|
+
name="Overview"
|
|
44
|
+
args={{ label: 'Label', labelFalse: 'No', labelTrue: 'Yes', disabled: false }}
|
|
45
|
+
argTypes={inputArgType}
|
|
46
|
+
>
|
|
47
|
+
{args => <TsBooleanInput {...args} />}
|
|
48
|
+
</Story>
|
|
49
|
+
</Canvas>
|
|
50
|
+
|
|
51
|
+
## Props
|
|
52
|
+
|
|
53
|
+
<ArgsTable story="Overview" of={TsBooleanInput} />
|
|
@@ -3,7 +3,7 @@ import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
|
|
|
3
3
|
import { TsInput } from '../TsInput';
|
|
4
4
|
import { icons } from '../../../TsIcon/icons';
|
|
5
5
|
|
|
6
|
-
<Meta title="Components/Input" />
|
|
6
|
+
<Meta title="Components/Inputs/Input" />
|
|
7
7
|
|
|
8
8
|
export const inputArgTypes = {
|
|
9
9
|
byDefault: {
|
package/src/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './components/TsCheckbox/TsCheckbox';
|
|
|
3
3
|
export * from './components/TsDropdowns/TsDropdown/TsDropdown';
|
|
4
4
|
export * from './components/TsDropdowns/TsDropdownFilter/TsDropdownFilter';
|
|
5
5
|
export * from './components/TsIcon/TsIcon';
|
|
6
|
+
export * from './components/TsInput/TsBooleanInput/TsBooleanInput';
|
|
6
7
|
export * from './components/TsInput/TsInput/TsInput';
|
|
7
8
|
export * from './components/TsLoader/TsLoader';
|
|
8
9
|
export * from './components/TsTabs/TsTabs';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|