@dktunited-techoff/techoff-suite-ui 0.8.11 → 0.8.13

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.
@@ -3,6 +3,17 @@
3
3
  align-items: center;
4
4
  cursor: pointer;
5
5
  }
6
+ /* ########## */
7
+ /* DISABLED */
8
+ .checkbox--disabled {
9
+ cursor: not-allowed;
10
+ }
11
+ .checkbox--disabled .checkbox-box {
12
+ color: #999999;
13
+ }
14
+ .checkbox--disabled:hover .checkbox-box {
15
+ background: transparent;
16
+ }
6
17
  /* ##### */
7
18
  /* BOX */
8
19
  .checkbox:hover .checkbox-box {
@@ -1,7 +1,4 @@
1
1
  import * as React from 'react';
2
- import { PropsWithChildren } from 'react';
3
2
  import { CheckboxProps } from './Checkbox.types';
4
3
  import './Checkbox.css';
5
- export declare const CheckboxLabel: ({ children }: PropsWithChildren) => React.JSX.Element;
6
- export declare const CheckboxCaption: ({ children }: PropsWithChildren) => React.JSX.Element;
7
- export declare const Checkbox: ({ children, checked, onChange }: PropsWithChildren<CheckboxProps>) => React.JSX.Element;
4
+ export declare const Checkbox: ({ caption, label, checked, disabled, onChange }: CheckboxProps) => React.JSX.Element;
@@ -1,21 +1,18 @@
1
1
  import * as React from 'react';
2
- import { Children } from 'react';
3
- import { isSuiteElement } from '../../utils/validator.utils';
4
2
  import { Icon } from '../Icon/Icon';
5
3
  import './Checkbox.css';
6
- export const CheckboxLabel = ({ children }) => React.createElement("div", { className: "checkbox-label" }, children);
7
- export const CheckboxCaption = ({ children }) => React.createElement("div", { className: "checkbox-caption" }, children);
8
- export const Checkbox = ({ children, checked, onChange }) => {
9
- const labelElement = Children.toArray(children).find(c => isSuiteElement(c, 'CheckboxLabel'));
10
- const captionElement = Children.toArray(children).find(c => isSuiteElement(c, 'CheckboxCaption'));
4
+ export const Checkbox = ({ caption, label, checked, disabled, onChange }) => {
5
+ // ########
6
+ // Handlers
7
+ const handleChange = () => !disabled && onChange(!checked);
11
8
  // #########
12
9
  // Rendering
13
- return (React.createElement("div", { className: "checkbox", onClick: () => onChange(!checked) },
10
+ return (React.createElement("div", { className: `checkbox ${disabled ? 'checkbox--disabled' : ''}`, onClick: handleChange },
14
11
  React.createElement("div", { className: "checkbox-box" },
15
- checked && React.createElement(Icon, { name: "square-check-filled" }),
12
+ checked && React.createElement(Icon, { name: "check-square-filled" }),
16
13
  !checked && React.createElement(Icon, { name: "square" })),
17
- React.createElement("div", { className: `checkbox-container ${captionElement ? 'checkbox-container--with-caption' : ''}` },
18
- labelElement,
19
- captionElement)));
14
+ React.createElement("div", { className: `checkbox-container ${caption ? 'checkbox-container--with-caption' : ''}` },
15
+ React.createElement("div", { className: "checkbox-label" }, label),
16
+ caption && React.createElement("div", { className: "checkbox-caption" }, caption))));
20
17
  };
21
18
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAE,QAAQ,EAAqB,MAAM,OAAO,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,6BAA6B,CAAC;AAC7D,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;AAEpC,OAAO,gBAAgB,CAAC;AAExB,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,EAAE,QAAQ,EAAqB,EAAE,EAAE,CAAC,6BAAK,SAAS,EAAC,gBAAgB,IAAE,QAAQ,CAAO,CAAC;AACnH,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,EAAE,QAAQ,EAAqB,EAAE,EAAE,CAAC,6BAAK,SAAS,EAAC,kBAAkB,IAAE,QAAQ,CAAO,CAAC;AAEvH,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,EAAE,QAAQ,EAAoC,EAAE,EAAE;IAC5F,MAAM,Y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,YAAY;IACZ,OAAO,CACL,6BAAK,SAAS,EAAE,YAAY,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY;QACvF,6BAAK,SAAS,EAAC,cAAc;YAC1B,OAAO,IAAI,oBAAC,IAAI,IAAC,IAAI,EAAC,qBAAqB,GAAG;YAC9C,CAAC,OAAO,IAAI,oBAAC,IAAI,IAAC,IAAI,EAAC,QAAQ,GAAG,CAC/B;QAEN,6BAAK,SAAS,EAAE,sBAAsB,OAAO,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,EAAE,EAAE;YACvF,6BAAK,SAAS,EAAC,gBAAgB,IAAE,KAAK,CAAO;YAC5C,OAAO,IAAI,6BAAK,SAAS,EAAC,kBAAkB,IAAE,OAAO,CAAO,CACzD,CACF,CACP,CAAC;AACJ,CAAC,CAAC"}
@@ -1,4 +1,7 @@
1
1
  export type CheckboxProps = {
2
+ caption?: string;
3
+ label: string;
2
4
  checked?: boolean;
5
+ disabled?: boolean;
3
6
  onChange: (value: boolean) => void;
4
7
  };
@@ -1,15 +1,28 @@
1
1
  import React from 'react';
2
2
  import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
3
- import { Checkbox, CheckboxLabel, CheckboxCaption } from '../Checkbox';
3
+ import { Checkbox } from '../Checkbox';
4
4
 
5
5
  <Meta title="Components/Checkbox" />
6
6
 
7
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
+ },
8
16
  checked: {
9
17
  control: 'boolean',
10
18
  description: 'State of the checkbox.',
11
19
  table: { defaultValue: { summary: 'false' } },
12
20
  },
21
+ disabled: {
22
+ control: 'boolean',
23
+ description: 'Enable state of the checkbox.',
24
+ table: { defaultValue: { summary: 'false' } },
25
+ },
13
26
  };
14
27
 
15
28
  # Checkbox
@@ -22,14 +35,11 @@ Checkboxes are applied when users can select all, several, or none of the option
22
35
  <Story
23
36
  name="Overview"
24
37
  args={{
25
- children: [
26
- <CheckboxLabel>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</CheckboxLabel>,
27
- <CheckboxCaption>
28
- Auctor nisl justo, sed posuere est dignissim nec. Integer ultricies, metus ac imperdiet ullamcorper, est justo
29
- viverra nisl, in posuere dui urna eget quam.
30
- </CheckboxCaption>,
31
- ],
38
+ label: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
39
+ caption:
40
+ 'Auctor nisl justo, sed posuere est dignissim nec. Integer ultricies, metus ac imperdiet ullamcorper, est justo viverra nisl, in posuere dui urna eget quam.',
32
41
  checked: false,
42
+ disabled: false,
33
43
  onChange: () => {},
34
44
  }}
35
45
  argTypes={checkboxArgTypes}
package/esm/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export * from './components/Button/Button';
2
+ export * from './components/Checkbox/Checkbox';
2
3
  export * from './components/Icon/Icon';
4
+ export * from './components/Inputs/BooleanInput/BooleanInput';
5
+ export * from './components/Inputs/TextInput/TextInput';
6
+ export * from './components/Loader/Loader';
3
7
  export * from './layouts/Header/Header';
4
8
  export * from './layouts/Header/HeaderProfile';
5
9
  export * from './layouts/Navigation/Navigation';
package/esm/index.js CHANGED
@@ -1,5 +1,9 @@
1
1
  export * from './components/Button/Button';
2
+ export * from './components/Checkbox/Checkbox';
2
3
  export * from './components/Icon/Icon';
4
+ export * from './components/Inputs/BooleanInput/BooleanInput';
5
+ export * from './components/Inputs/TextInput/TextInput';
6
+ export * from './components/Loader/Loader';
3
7
  export * from './layouts/Header/Header';
4
8
  export * from './layouts/Header/HeaderProfile';
5
9
  export * from './layouts/Navigation/Navigation';
package/esm/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,4BAA4B,CAAC;AAC3C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,wBAAwB,CAAC;AACvC,cAAc,+CAA+C,CAAC;AAC9D,cAAc,yCAAyC,CAAC;AACxD,cAAc,4BAA4B,CAAC;AAC3C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,iCAAiC,CAAC"}
@@ -3,6 +3,17 @@
3
3
  align-items: center;
4
4
  cursor: pointer;
5
5
  }
6
+ /* ########## */
7
+ /* DISABLED */
8
+ .checkbox--disabled {
9
+ cursor: not-allowed;
10
+ }
11
+ .checkbox--disabled .checkbox-box {
12
+ color: #999999;
13
+ }
14
+ .checkbox--disabled:hover .checkbox-box {
15
+ background: transparent;
16
+ }
6
17
  /* ##### */
7
18
  /* BOX */
8
19
  .checkbox:hover .checkbox-box {
@@ -1,7 +1,4 @@
1
1
  import * as React from 'react';
2
- import { PropsWithChildren } from 'react';
3
2
  import { CheckboxProps } from './Checkbox.types';
4
3
  import './Checkbox.css';
5
- export declare const CheckboxLabel: ({ children }: PropsWithChildren) => React.JSX.Element;
6
- export declare const CheckboxCaption: ({ children }: PropsWithChildren) => React.JSX.Element;
7
- export declare const Checkbox: ({ children, checked, onChange }: PropsWithChildren<CheckboxProps>) => React.JSX.Element;
4
+ export declare const Checkbox: ({ caption, label, checked, disabled, onChange }: CheckboxProps) => React.JSX.Element;
@@ -1,27 +1,22 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Checkbox = exports.CheckboxCaption = exports.CheckboxLabel = void 0;
3
+ exports.Checkbox = void 0;
4
4
  const React = require("react");
5
- const react_1 = require("react");
6
- const validator_utils_1 = require("../../utils/validator.utils");
7
5
  const Icon_1 = require("../Icon/Icon");
8
6
  require("./Checkbox.css");
9
- const CheckboxLabel = ({ children }) => React.createElement("div", { className: "checkbox-label" }, children);
10
- exports.CheckboxLabel = CheckboxLabel;
11
- const CheckboxCaption = ({ children }) => React.createElement("div", { className: "checkbox-caption" }, children);
12
- exports.CheckboxCaption = CheckboxCaption;
13
- const Checkbox = ({ children, checked, onChange }) => {
14
- const labelElement = react_1.Children.toArray(children).find(c => (0, validator_utils_1.isSuiteElement)(c, 'CheckboxLabel'));
15
- const captionElement = react_1.Children.toArray(children).find(c => (0, validator_utils_1.isSuiteElement)(c, 'CheckboxCaption'));
7
+ const Checkbox = ({ caption, label, checked, disabled, onChange }) => {
8
+ // ########
9
+ // Handlers
10
+ const handleChange = () => !disabled && onChange(!checked);
16
11
  // #########
17
12
  // Rendering
18
- return (React.createElement("div", { className: "checkbox", onClick: () => onChange(!checked) },
13
+ return (React.createElement("div", { className: `checkbox ${disabled ? 'checkbox--disabled' : ''}`, onClick: handleChange },
19
14
  React.createElement("div", { className: "checkbox-box" },
20
- checked && React.createElement(Icon_1.Icon, { name: "square-check-filled" }),
15
+ checked && React.createElement(Icon_1.Icon, { name: "check-square-filled" }),
21
16
  !checked && React.createElement(Icon_1.Icon, { name: "square" })),
22
- React.createElement("div", { className: `checkbox-container ${captionElement ? 'checkbox-container--with-caption' : ''}` },
23
- labelElement,
24
- captionElement)));
17
+ React.createElement("div", { className: `checkbox-container ${caption ? 'checkbox-container--with-caption' : ''}` },
18
+ React.createElement("div", { className: "checkbox-label" }, label),
19
+ caption && React.createElement("div", { className: "checkbox-caption" }, caption))));
25
20
  };
26
21
  exports.Checkbox = Checkbox;
27
22
  //# sourceMappingURL=Checkbox.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Checkbox.js","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,iCAAoD;AACpD,iEAA6D;AAC7D,uCAAoC;AAEpC,0BAAw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file":"Checkbox.js","sourceRoot":"","sources":["../../../src/components/Checkbox/Checkbox.tsx"],"names":[],"mappings":";;;AAAA,+BAA+B;AAC/B,uCAAoC;AAEpC,0BAAwB;AAEjB,MAAM,QAAQ,GAAG,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAiB,EAAE,EAAE;IACzF,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,YAAY,QAAQ,CAAC,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY;QACvF,6BAAK,SAAS,EAAC,cAAc;YAC1B,OAAO,IAAI,oBAAC,WAAI,IAAC,IAAI,EAAC,qBAAqB,GAAG;YAC9C,CAAC,OAAO,IAAI,oBAAC,WAAI,IAAC,IAAI,EAAC,QAAQ,GAAG,CAC/B;QAEN,6BAAK,SAAS,EAAE,sBAAsB,OAAO,CAAC,CAAC,CAAC,kCAAkC,CAAC,CAAC,CAAC,EAAE,EAAE;YACvF,6BAAK,SAAS,EAAC,gBAAgB,IAAE,KAAK,CAAO;YAC5C,OAAO,IAAI,6BAAK,SAAS,EAAC,kBAAkB,IAAE,OAAO,CAAO,CACzD,CACF,CACP,CAAC;AACJ,CAAC,CAAC;AApBW,QAAA,QAAQ,YAoBnB"}
@@ -1,4 +1,7 @@
1
1
  export type CheckboxProps = {
2
+ caption?: string;
3
+ label: string;
2
4
  checked?: boolean;
5
+ disabled?: boolean;
3
6
  onChange: (value: boolean) => void;
4
7
  };
@@ -1,15 +1,28 @@
1
1
  import React from 'react';
2
2
  import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
3
- import { Checkbox, CheckboxLabel, CheckboxCaption } from '../Checkbox';
3
+ import { Checkbox } from '../Checkbox';
4
4
 
5
5
  <Meta title="Components/Checkbox" />
6
6
 
7
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
+ },
8
16
  checked: {
9
17
  control: 'boolean',
10
18
  description: 'State of the checkbox.',
11
19
  table: { defaultValue: { summary: 'false' } },
12
20
  },
21
+ disabled: {
22
+ control: 'boolean',
23
+ description: 'Enable state of the checkbox.',
24
+ table: { defaultValue: { summary: 'false' } },
25
+ },
13
26
  };
14
27
 
15
28
  # Checkbox
@@ -22,14 +35,11 @@ Checkboxes are applied when users can select all, several, or none of the option
22
35
  <Story
23
36
  name="Overview"
24
37
  args={{
25
- children: [
26
- <CheckboxLabel>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</CheckboxLabel>,
27
- <CheckboxCaption>
28
- Auctor nisl justo, sed posuere est dignissim nec. Integer ultricies, metus ac imperdiet ullamcorper, est justo
29
- viverra nisl, in posuere dui urna eget quam.
30
- </CheckboxCaption>,
31
- ],
38
+ label: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
39
+ caption:
40
+ 'Auctor nisl justo, sed posuere est dignissim nec. Integer ultricies, metus ac imperdiet ullamcorper, est justo viverra nisl, in posuere dui urna eget quam.',
32
41
  checked: false,
42
+ disabled: false,
33
43
  onChange: () => {},
34
44
  }}
35
45
  argTypes={checkboxArgTypes}
package/lib/index.d.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export * from './components/Button/Button';
2
+ export * from './components/Checkbox/Checkbox';
2
3
  export * from './components/Icon/Icon';
4
+ export * from './components/Inputs/BooleanInput/BooleanInput';
5
+ export * from './components/Inputs/TextInput/TextInput';
6
+ export * from './components/Loader/Loader';
3
7
  export * from './layouts/Header/Header';
4
8
  export * from './layouts/Header/HeaderProfile';
5
9
  export * from './layouts/Navigation/Navigation';
package/lib/index.js CHANGED
@@ -15,7 +15,11 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./components/Button/Button"), exports);
18
+ __exportStar(require("./components/Checkbox/Checkbox"), exports);
18
19
  __exportStar(require("./components/Icon/Icon"), exports);
20
+ __exportStar(require("./components/Inputs/BooleanInput/BooleanInput"), exports);
21
+ __exportStar(require("./components/Inputs/TextInput/TextInput"), exports);
22
+ __exportStar(require("./components/Loader/Loader"), exports);
19
23
  __exportStar(require("./layouts/Header/Header"), exports);
20
24
  __exportStar(require("./layouts/Header/HeaderProfile"), exports);
21
25
  __exportStar(require("./layouts/Navigation/Navigation"), exports);
package/lib/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,yDAAuC;AACvC,0DAAwC;AACxC,iEAA+C;AAC/C,kEAAgD"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6DAA2C;AAC3C,iEAA+C;AAC/C,yDAAuC;AACvC,gFAA8D;AAC9D,0EAAwD;AACxD,6DAA2C;AAC3C,0DAAwC;AACxC,iEAA+C;AAC/C,kEAAgD"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dktunited-techoff/techoff-suite-ui",
3
- "version": "0.8.11",
3
+ "version": "0.8.13",
4
4
  "main": "lib/index.js",
5
5
  "types": "./lib",
6
6
  "module": "esm/index.js",
@@ -3,6 +3,17 @@
3
3
  align-items: center;
4
4
  cursor: pointer;
5
5
  }
6
+ /* ########## */
7
+ /* DISABLED */
8
+ .checkbox--disabled {
9
+ cursor: not-allowed;
10
+ }
11
+ .checkbox--disabled .checkbox-box {
12
+ color: #999999;
13
+ }
14
+ .checkbox--disabled:hover .checkbox-box {
15
+ background: transparent;
16
+ }
6
17
  /* ##### */
7
18
  /* BOX */
8
19
  .checkbox:hover .checkbox-box {
@@ -1,29 +1,25 @@
1
1
  import * as React from 'react';
2
- import { Children, PropsWithChildren } from 'react';
3
- import { isSuiteElement } from '../../utils/validator.utils';
4
2
  import { Icon } from '../Icon/Icon';
5
3
  import { CheckboxProps } from './Checkbox.types';
6
4
  import './Checkbox.css';
7
5
 
8
- export const CheckboxLabel = ({ children }: PropsWithChildren) => <div className="checkbox-label">{children}</div>;
9
- export const CheckboxCaption = ({ children }: PropsWithChildren) => <div className="checkbox-caption">{children}</div>;
10
-
11
- export const Checkbox = ({ children, checked, onChange }: PropsWithChildren<CheckboxProps>) => {
12
- const labelElement = Children.toArray(children).find(c => isSuiteElement(c, 'CheckboxLabel'));
13
- const captionElement = Children.toArray(children).find(c => isSuiteElement(c, 'CheckboxCaption'));
6
+ export const Checkbox = ({ caption, label, checked, disabled, onChange }: CheckboxProps) => {
7
+ // ########
8
+ // Handlers
9
+ const handleChange = () => !disabled && onChange(!checked);
14
10
 
15
11
  // #########
16
12
  // Rendering
17
13
  return (
18
- <div className="checkbox" onClick={() => onChange(!checked)}>
14
+ <div className={`checkbox ${disabled ? 'checkbox--disabled' : ''}`} onClick={handleChange}>
19
15
  <div className="checkbox-box">
20
- {checked && <Icon name="square-check-filled" />}
16
+ {checked && <Icon name="check-square-filled" />}
21
17
  {!checked && <Icon name="square" />}
22
18
  </div>
23
19
 
24
- <div className={`checkbox-container ${captionElement ? 'checkbox-container--with-caption' : ''}`}>
25
- {labelElement}
26
- {captionElement}
20
+ <div className={`checkbox-container ${caption ? 'checkbox-container--with-caption' : ''}`}>
21
+ <div className="checkbox-label">{label}</div>
22
+ {caption && <div className="checkbox-caption">{caption}</div>}
27
23
  </div>
28
24
  </div>
29
25
  );
@@ -1 +1,7 @@
1
- export type CheckboxProps = { checked?: boolean; onChange: (value: boolean) => void };
1
+ export type CheckboxProps = {
2
+ caption?: string;
3
+ label: string;
4
+ checked?: boolean;
5
+ disabled?: boolean;
6
+ onChange: (value: boolean) => void;
7
+ };
@@ -1,15 +1,28 @@
1
1
  import React from 'react';
2
2
  import { ArgsTable, Canvas, Meta, Story } from '@storybook/blocks';
3
- import { Checkbox, CheckboxLabel, CheckboxCaption } from '../Checkbox';
3
+ import { Checkbox } from '../Checkbox';
4
4
 
5
5
  <Meta title="Components/Checkbox" />
6
6
 
7
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
+ },
8
16
  checked: {
9
17
  control: 'boolean',
10
18
  description: 'State of the checkbox.',
11
19
  table: { defaultValue: { summary: 'false' } },
12
20
  },
21
+ disabled: {
22
+ control: 'boolean',
23
+ description: 'Enable state of the checkbox.',
24
+ table: { defaultValue: { summary: 'false' } },
25
+ },
13
26
  };
14
27
 
15
28
  # Checkbox
@@ -22,14 +35,11 @@ Checkboxes are applied when users can select all, several, or none of the option
22
35
  <Story
23
36
  name="Overview"
24
37
  args={{
25
- children: [
26
- <CheckboxLabel>Lorem ipsum dolor sit amet, consectetur adipiscing elit.</CheckboxLabel>,
27
- <CheckboxCaption>
28
- Auctor nisl justo, sed posuere est dignissim nec. Integer ultricies, metus ac imperdiet ullamcorper, est justo
29
- viverra nisl, in posuere dui urna eget quam.
30
- </CheckboxCaption>,
31
- ],
38
+ label: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit',
39
+ caption:
40
+ 'Auctor nisl justo, sed posuere est dignissim nec. Integer ultricies, metus ac imperdiet ullamcorper, est justo viverra nisl, in posuere dui urna eget quam.',
32
41
  checked: false,
42
+ disabled: false,
33
43
  onChange: () => {},
34
44
  }}
35
45
  argTypes={checkboxArgTypes}
package/src/index.ts CHANGED
@@ -1,5 +1,9 @@
1
1
  export * from './components/Button/Button';
2
+ export * from './components/Checkbox/Checkbox';
2
3
  export * from './components/Icon/Icon';
4
+ export * from './components/Inputs/BooleanInput/BooleanInput';
5
+ export * from './components/Inputs/TextInput/TextInput';
6
+ export * from './components/Loader/Loader';
3
7
  export * from './layouts/Header/Header';
4
8
  export * from './layouts/Header/HeaderProfile';
5
9
  export * from './layouts/Navigation/Navigation';