@dktunited-techoff/techoff-suite-ui 1.9.0 → 1.9.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.
- package/esm/components/TsButton/TsButton.css +8 -0
- package/esm/components/TsButton/TsButton.types.d.ts +1 -1
- package/esm/components/TsButton/__stories__/TsButton.stories.mdx +1 -1
- package/esm/components/TsSwitcher/TsSwitcher.js +5 -2
- package/esm/components/TsSwitcher/TsSwitcher.js.map +1 -1
- package/esm/components/TsSwitcher/__stories__/TsSwitcher.stories.mdx +10 -1
- package/lib/components/TsButton/TsButton.css +8 -0
- package/lib/components/TsButton/TsButton.types.d.ts +1 -1
- package/lib/components/TsButton/__stories__/TsButton.stories.mdx +1 -1
- package/lib/components/TsSwitcher/TsSwitcher.js +4 -1
- package/lib/components/TsSwitcher/TsSwitcher.js.map +1 -1
- package/lib/components/TsSwitcher/__stories__/TsSwitcher.stories.mdx +10 -1
- package/package.json +1 -1
- package/src/components/TsButton/TsButton.css +8 -0
- package/src/components/TsButton/TsButton.types.ts +1 -1
- package/src/components/TsButton/__stories__/TsButton.stories.mdx +1 -1
- package/src/components/TsSwitcher/TsSwitcher.tsx +6 -2
- package/src/components/TsSwitcher/__stories__/TsSwitcher.stories.mdx +10 -1
|
@@ -25,6 +25,14 @@ button:disabled {
|
|
|
25
25
|
}
|
|
26
26
|
/* ####### */
|
|
27
27
|
/* SIZES */
|
|
28
|
+
.ts-button--sm {
|
|
29
|
+
height: 24px;
|
|
30
|
+
padding: 0 12px;
|
|
31
|
+
}
|
|
32
|
+
.ts-button--md.ts-button--icon-only {
|
|
33
|
+
width: 24px;
|
|
34
|
+
padding: 0;
|
|
35
|
+
}
|
|
28
36
|
.ts-button--md {
|
|
29
37
|
height: 32px;
|
|
30
38
|
padding: 0 14px;
|
|
@@ -2,7 +2,7 @@ import { ButtonHTMLAttributes } from 'react';
|
|
|
2
2
|
export type TsButtonProps = {
|
|
3
3
|
icon?: string;
|
|
4
4
|
iconDirection?: 'left' | 'right';
|
|
5
|
-
size?: 'md' | 'lg';
|
|
5
|
+
size?: 'sm' | 'md' | 'lg';
|
|
6
6
|
variant?: 'primary' | 'secondary' | 'success' | 'ghost' | 'shadow';
|
|
7
7
|
block?: boolean;
|
|
8
8
|
rounded?: boolean;
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { TsIcon } from '../TsIcon/TsIcon';
|
|
4
4
|
import './TsSwitcher.css';
|
|
5
5
|
export const TsSwitcher = ({ defaultSwitch, switchs, onChange }) => {
|
|
6
|
-
const [selectedSwitch, setSelectedSwitch] = useState(
|
|
6
|
+
const [selectedSwitch, setSelectedSwitch] = useState();
|
|
7
7
|
// ########
|
|
8
8
|
// Handlers
|
|
9
9
|
const handleChange = (val) => {
|
|
10
10
|
setSelectedSwitch(val);
|
|
11
11
|
onChange(val);
|
|
12
12
|
};
|
|
13
|
+
// ########
|
|
14
|
+
// Watchers
|
|
15
|
+
useEffect(() => setSelectedSwitch(defaultSwitch ?? ''), [defaultSwitch]);
|
|
13
16
|
// #########
|
|
14
17
|
// Rendering
|
|
15
18
|
return (React.createElement("div", { className: "ts-content-switcher" }, switchs.map(s => (React.createElement("div", { key: s.value, className: `ts-switcher ${selectedSwitch === s.value ? 'ts-switcher--selected' : ''}`, onClick: () => handleChange(s.value) },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TsSwitcher.js","sourceRoot":"","sources":["../../../src/components/TsSwitcher/TsSwitcher.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"TsSwitcher.js","sourceRoot":"","sources":["../../../src/components/TsSwitcher/TsSwitcher.tsx"],"names":[],"mappings":"AAAA,OAAO,KAA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AC"}
|
|
@@ -5,7 +5,16 @@ import { TsSwitcher } from '../TsSwitcher';
|
|
|
5
5
|
|
|
6
6
|
<Meta title="Components/Switcher" />
|
|
7
7
|
|
|
8
|
-
export const switcherArgTypes = {
|
|
8
|
+
export const switcherArgTypes = {
|
|
9
|
+
defaultSwitch: {
|
|
10
|
+
control: 'text',
|
|
11
|
+
description: 'Default activated switch value.',
|
|
12
|
+
},
|
|
13
|
+
onChange: {
|
|
14
|
+
control: 'function',
|
|
15
|
+
description: 'The handler called when clicking on a switch (not available on playground).',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
9
18
|
|
|
10
19
|
# Switcher
|
|
11
20
|
|
|
@@ -25,6 +25,14 @@ button:disabled {
|
|
|
25
25
|
}
|
|
26
26
|
/* ####### */
|
|
27
27
|
/* SIZES */
|
|
28
|
+
.ts-button--sm {
|
|
29
|
+
height: 24px;
|
|
30
|
+
padding: 0 12px;
|
|
31
|
+
}
|
|
32
|
+
.ts-button--md.ts-button--icon-only {
|
|
33
|
+
width: 24px;
|
|
34
|
+
padding: 0;
|
|
35
|
+
}
|
|
28
36
|
.ts-button--md {
|
|
29
37
|
height: 32px;
|
|
30
38
|
padding: 0 14px;
|
|
@@ -2,7 +2,7 @@ import { ButtonHTMLAttributes } from 'react';
|
|
|
2
2
|
export type TsButtonProps = {
|
|
3
3
|
icon?: string;
|
|
4
4
|
iconDirection?: 'left' | 'right';
|
|
5
|
-
size?: 'md' | 'lg';
|
|
5
|
+
size?: 'sm' | 'md' | 'lg';
|
|
6
6
|
variant?: 'primary' | 'secondary' | 'success' | 'ghost' | 'shadow';
|
|
7
7
|
block?: boolean;
|
|
8
8
|
rounded?: boolean;
|
|
@@ -6,13 +6,16 @@ const react_1 = require("react");
|
|
|
6
6
|
const TsIcon_1 = require("../TsIcon/TsIcon");
|
|
7
7
|
require("./TsSwitcher.css");
|
|
8
8
|
const TsSwitcher = ({ defaultSwitch, switchs, onChange }) => {
|
|
9
|
-
const [selectedSwitch, setSelectedSwitch] = (0, react_1.useState)(
|
|
9
|
+
const [selectedSwitch, setSelectedSwitch] = (0, react_1.useState)();
|
|
10
10
|
// ########
|
|
11
11
|
// Handlers
|
|
12
12
|
const handleChange = (val) => {
|
|
13
13
|
setSelectedSwitch(val);
|
|
14
14
|
onChange(val);
|
|
15
15
|
};
|
|
16
|
+
// ########
|
|
17
|
+
// Watchers
|
|
18
|
+
(0, react_1.useEffect)(() => setSelectedSwitch(defaultSwitch ?? ''), [defaultSwitch]);
|
|
16
19
|
// #########
|
|
17
20
|
// Rendering
|
|
18
21
|
return (React.createElement("div", { className: "ts-content-switcher" }, switchs.map(s => (React.createElement("div", { key: s.value, className: `ts-switcher ${selectedSwitch === s.value ? 'ts-switcher--selected' : ''}`, onClick: () => handleChange(s.value) },
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TsSwitcher.js","sourceRoot":"","sources":["../../../src/components/TsSwitcher/TsSwitcher.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,
|
|
1
|
+
{"version":3,"file":"TsSwitcher.js","sourceRoot":"","sources":["../../../src/components/TsSwitcher/TsSwitcher.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,iCAA4C;AAC5C,6CAA0C;AAE1C,4BAA0B;AAEnB,MAAM,UAAU,GAAG,CAAC,EAAE,aAAa,EAAE,OAAO,EAAE,QAAQ,EAAmB,EAAE,EAAE;IAClF,MAAM,CAAC,cAAc,EAAE,iBAAiB,CAAC,GAAG,IAAA,gBAAQ,GAAU,CAAC;IAE/D,WAAW;IACX,WAAW;IACX,MAAM,YAAY,GAAG,CAAC,GAAW,EAAE,EAAE;QACnC,iBAAiB,CAAC,GAAG,CAAC,CAAC;QACvB,QAAQ,CAAC,GAAG,CAAC,CAAC;IAChB,CAAC,CAAC;IAEF,WAAW;IACX,WAAW;IACX,IAAA,iBAAS,EAAC,GAAG,EAAE,CAAC,iBAAiB,CAAC,aAAa,IAAI,EAAE,CAAC,EAAE,CAAC,aAAa,CAAC,CAAC,CAAC;IAEzE,YAAY;IACZ,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAC,qBAAqB,IACjC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAChB,6BACE,GAAG,EAAE,CAAC,CAAC,KAAK,EACZ,SAAS,EAAE,eAAe,cAAc,KAAK,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,uBAAuB,CAAC,CAAC,CAAC,EAAE,EAAE,EACrF,OAAO,EAAE,GAAG,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,KAAK,CAAC;QAEnC,CAAC,CAAC,IAAI,IAAI,CACT,6BAAK,SAAS,EAAC,kBAAkB;YAC/B,oBAAC,eAAM,IAAC,IAAI,EAAE,CAAC,CAAC,IAAI,GAAI,CACpB,CACP;QACD,6BAAK,SAAS,EAAC,mBAAmB,IAAE,CAAC,CAAC,KAAK,CAAO,CAC9C,CACP,CAAC,CACE,CACP,CAAC;AACJ,CAAC,CAAC;AAlCW,QAAA,UAAU,cAkCrB"}
|
|
@@ -5,7 +5,16 @@ import { TsSwitcher } from '../TsSwitcher';
|
|
|
5
5
|
|
|
6
6
|
<Meta title="Components/Switcher" />
|
|
7
7
|
|
|
8
|
-
export const switcherArgTypes = {
|
|
8
|
+
export const switcherArgTypes = {
|
|
9
|
+
defaultSwitch: {
|
|
10
|
+
control: 'text',
|
|
11
|
+
description: 'Default activated switch value.',
|
|
12
|
+
},
|
|
13
|
+
onChange: {
|
|
14
|
+
control: 'function',
|
|
15
|
+
description: 'The handler called when clicking on a switch (not available on playground).',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
9
18
|
|
|
10
19
|
# Switcher
|
|
11
20
|
|
package/package.json
CHANGED
|
@@ -25,6 +25,14 @@ button:disabled {
|
|
|
25
25
|
}
|
|
26
26
|
/* ####### */
|
|
27
27
|
/* SIZES */
|
|
28
|
+
.ts-button--sm {
|
|
29
|
+
height: 24px;
|
|
30
|
+
padding: 0 12px;
|
|
31
|
+
}
|
|
32
|
+
.ts-button--md.ts-button--icon-only {
|
|
33
|
+
width: 24px;
|
|
34
|
+
padding: 0;
|
|
35
|
+
}
|
|
28
36
|
.ts-button--md {
|
|
29
37
|
height: 32px;
|
|
30
38
|
padding: 0 14px;
|
|
@@ -3,7 +3,7 @@ import { ButtonHTMLAttributes } from 'react';
|
|
|
3
3
|
export type TsButtonProps = {
|
|
4
4
|
icon?: string;
|
|
5
5
|
iconDirection?: 'left' | 'right';
|
|
6
|
-
size?: 'md' | 'lg';
|
|
6
|
+
size?: 'sm' | 'md' | 'lg';
|
|
7
7
|
variant?: 'primary' | 'secondary' | 'success' | 'ghost' | 'shadow';
|
|
8
8
|
block?: boolean;
|
|
9
9
|
rounded?: boolean;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import { useState } from 'react';
|
|
2
|
+
import { useEffect, useState } from 'react';
|
|
3
3
|
import { TsIcon } from '../TsIcon/TsIcon';
|
|
4
4
|
import { TsSwitcherProps } from './TsSwitcher.types';
|
|
5
5
|
import './TsSwitcher.css';
|
|
6
6
|
|
|
7
7
|
export const TsSwitcher = ({ defaultSwitch, switchs, onChange }: TsSwitcherProps) => {
|
|
8
|
-
const [selectedSwitch, setSelectedSwitch] = useState<string>(
|
|
8
|
+
const [selectedSwitch, setSelectedSwitch] = useState<string>();
|
|
9
9
|
|
|
10
10
|
// ########
|
|
11
11
|
// Handlers
|
|
@@ -14,6 +14,10 @@ export const TsSwitcher = ({ defaultSwitch, switchs, onChange }: TsSwitcherProps
|
|
|
14
14
|
onChange(val);
|
|
15
15
|
};
|
|
16
16
|
|
|
17
|
+
// ########
|
|
18
|
+
// Watchers
|
|
19
|
+
useEffect(() => setSelectedSwitch(defaultSwitch ?? ''), [defaultSwitch]);
|
|
20
|
+
|
|
17
21
|
// #########
|
|
18
22
|
// Rendering
|
|
19
23
|
return (
|
|
@@ -5,7 +5,16 @@ import { TsSwitcher } from '../TsSwitcher';
|
|
|
5
5
|
|
|
6
6
|
<Meta title="Components/Switcher" />
|
|
7
7
|
|
|
8
|
-
export const switcherArgTypes = {
|
|
8
|
+
export const switcherArgTypes = {
|
|
9
|
+
defaultSwitch: {
|
|
10
|
+
control: 'text',
|
|
11
|
+
description: 'Default activated switch value.',
|
|
12
|
+
},
|
|
13
|
+
onChange: {
|
|
14
|
+
control: 'function',
|
|
15
|
+
description: 'The handler called when clicking on a switch (not available on playground).',
|
|
16
|
+
},
|
|
17
|
+
};
|
|
9
18
|
|
|
10
19
|
# Switcher
|
|
11
20
|
|