@bodynarf/react.components 1.0.2 → 1.1.4

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 (113) hide show
  1. package/{src/components → components}/anchor/anchor.scss +0 -0
  2. package/components/anchor/components/anchorWithIcon/index.d.ts +5 -0
  3. package/components/anchor/components/anchorWithIcon/index.d.ts.map +1 -0
  4. package/components/anchor/components/anchorWithIcon/index.js +16 -0
  5. package/components/anchor/components/simpleAnchor/index.d.ts +5 -0
  6. package/components/anchor/components/simpleAnchor/index.d.ts.map +1 -0
  7. package/components/anchor/components/simpleAnchor/index.js +5 -0
  8. package/components/anchor/index.d.ts +24 -0
  9. package/components/anchor/index.d.ts.map +1 -0
  10. package/components/anchor/index.js +18 -0
  11. package/{src/components/anchor/types.ts → components/anchor/types.d.ts} +3 -9
  12. package/components/anchor/types.d.ts.map +1 -0
  13. package/components/anchor/types.js +1 -0
  14. package/{src/components → components}/button/button.scss +0 -0
  15. package/components/button/components/buttonWithIcon/index.d.ts +5 -0
  16. package/components/button/components/buttonWithIcon/index.d.ts.map +1 -0
  17. package/components/button/components/buttonWithIcon/index.js +19 -0
  18. package/components/button/components/simpleButton/index.d.ts +5 -0
  19. package/components/button/components/simpleButton/index.d.ts.map +1 -0
  20. package/components/button/components/simpleButton/index.js +5 -0
  21. package/components/button/index.d.ts +34 -0
  22. package/components/button/index.d.ts.map +1 -0
  23. package/components/button/index.js +27 -0
  24. package/components/button/types.d.ts +20 -0
  25. package/components/button/types.d.ts.map +1 -0
  26. package/components/button/types.js +1 -0
  27. package/components/dropdown/components/dropdownItem/index.d.ts +15 -0
  28. package/components/dropdown/components/dropdownItem/index.d.ts.map +1 -0
  29. package/components/dropdown/components/dropdownItem/index.js +6 -0
  30. package/components/dropdown/components/dropdownLabel/index.d.ts +16 -0
  31. package/components/dropdown/components/dropdownLabel/index.d.ts.map +1 -0
  32. package/components/dropdown/components/dropdownLabel/index.js +21 -0
  33. package/{src/components → components}/dropdown/dropdown.scss +0 -0
  34. package/components/dropdown/index.d.ts +31 -0
  35. package/components/dropdown/index.d.ts.map +1 -0
  36. package/components/dropdown/index.js +57 -0
  37. package/{src/components/dropdown/types.ts → components/dropdown/types.d.ts} +3 -4
  38. package/components/dropdown/types.d.ts.map +1 -0
  39. package/components/dropdown/types.js +1 -0
  40. package/{src/components → components}/icon/icon.scss +0 -0
  41. package/components/icon/index.d.ts +18 -0
  42. package/components/icon/index.d.ts.map +1 -0
  43. package/components/icon/index.js +15 -0
  44. package/components/primitives/date/index.d.ts +11 -0
  45. package/components/primitives/date/index.d.ts.map +1 -0
  46. package/components/primitives/date/index.js +31 -0
  47. package/components/primitives/index.d.ts +5 -0
  48. package/components/primitives/index.d.ts.map +1 -0
  49. package/components/primitives/index.js +4 -0
  50. package/components/primitives/multiline/components/multilineWithLabel/index.d.ts +6 -0
  51. package/components/primitives/multiline/components/multilineWithLabel/index.d.ts.map +1 -0
  52. package/components/primitives/multiline/components/multilineWithLabel/index.js +29 -0
  53. package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts +6 -0
  54. package/components/primitives/multiline/components/multilineWithoutLabel/index.d.ts.map +1 -0
  55. package/components/primitives/multiline/components/multilineWithoutLabel/index.js +25 -0
  56. package/components/primitives/multiline/index.d.ts +13 -0
  57. package/components/primitives/multiline/index.d.ts.map +1 -0
  58. package/components/primitives/multiline/index.js +14 -0
  59. package/components/primitives/text/components/textWithLabel/index.d.ts +6 -0
  60. package/components/primitives/text/components/textWithLabel/index.d.ts.map +1 -0
  61. package/components/primitives/text/components/textWithLabel/index.js +28 -0
  62. package/components/primitives/text/components/textWithoutLabel/index.d.ts +6 -0
  63. package/components/primitives/text/components/textWithoutLabel/index.d.ts.map +1 -0
  64. package/components/primitives/text/components/textWithoutLabel/index.js +24 -0
  65. package/components/primitives/text/index.d.ts +8 -0
  66. package/components/primitives/text/index.d.ts.map +1 -0
  67. package/components/primitives/text/index.js +14 -0
  68. package/{src/components/primitives/types.ts → components/primitives/types.d.ts} +5 -32
  69. package/components/primitives/types.d.ts.map +1 -0
  70. package/components/primitives/types.js +1 -0
  71. package/components/search/index.d.ts +31 -0
  72. package/components/search/index.d.ts.map +1 -0
  73. package/components/search/index.js +39 -0
  74. package/{src/components → components}/search/search.scss +0 -0
  75. package/{src/components/types.ts → components/types.d.ts} +5 -16
  76. package/components/types.d.ts.map +1 -0
  77. package/components/types.js +1 -0
  78. package/hooks/index.d.ts +2 -0
  79. package/hooks/index.d.ts.map +1 -0
  80. package/hooks/index.js +1 -0
  81. package/hooks/useComponentOutsideClick.d.ts +11 -0
  82. package/hooks/useComponentOutsideClick.d.ts.map +1 -0
  83. package/hooks/useComponentOutsideClick.js +32 -0
  84. package/index.d.ts +10 -0
  85. package/index.d.ts.map +1 -0
  86. package/index.js +9 -0
  87. package/package.json +9 -19
  88. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -25
  89. package/index.html +0 -13
  90. package/src/components/anchor/components/anchorWithIcon/anchorWithIcon.tsx +0 -45
  91. package/src/components/anchor/components/simpleAnchor/simpleAnchor.tsx +0 -16
  92. package/src/components/anchor/index.tsx +0 -64
  93. package/src/components/button/components/buttonWithIcon/buttonWithIcon.tsx +0 -47
  94. package/src/components/button/components/simpleButton/simpleButton.tsx +0 -16
  95. package/src/components/button/index.tsx +0 -83
  96. package/src/components/button/types.ts +0 -40
  97. package/src/components/dropdown/components/dropdownItem/dropdownItem.tsx +0 -30
  98. package/src/components/dropdown/components/dropdownLabel/dropdownLabel.tsx +0 -60
  99. package/src/components/dropdown/index.tsx +0 -141
  100. package/src/components/icon/index.tsx +0 -34
  101. package/src/components/primitives/date/index.tsx +0 -103
  102. package/src/components/primitives/multiline/components/multilineWithLabel/index.tsx +0 -93
  103. package/src/components/primitives/multiline/components/multilineWithoutLabel/index.tsx +0 -51
  104. package/src/components/primitives/multiline/index.tsx +0 -28
  105. package/src/components/primitives/text/components/textWithLabel/index.tsx +0 -92
  106. package/src/components/primitives/text/components/textWithoutLabel/index.tsx +0 -49
  107. package/src/components/primitives/text/index.tsx +0 -21
  108. package/src/components/search/index.tsx +0 -127
  109. package/src/hooks/useComponentOutsideClick.ts +0 -48
  110. package/src/main.tsx +0 -9
  111. package/tsconfig.json +0 -48
  112. package/tsconfig.node.json +0 -8
  113. package/vite.config.ts +0 -14
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { AnchorWithIconProps } from "../../types";
3
+ /** Anchor with icon component */
4
+ export declare const AnchorWithIcon: ({ href, className, onClick, caption, title, target, icon }: AnchorWithIconProps) => JSX.Element;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/anchor/components/anchorWithIcon/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,iCAAiC;AACjC,eAAO,MAAM,cAAc,+DAAgE,mBAAmB,KAAG,WAqChH,CAAC"}
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import utils from '@bodynarf/utils';
3
+ import Icon from '../../../icon';
4
+ /** Anchor with icon component */
5
+ export const AnchorWithIcon = ({ href, className, onClick, caption, title, target, icon }) => {
6
+ const iconPosition = icon.position || 'left';
7
+ const iconClassName = utils.isNullOrEmpty(caption)
8
+ ? icon.className
9
+ : iconPosition === 'left'
10
+ ? `${icon.className} app-icon--left`
11
+ : `${icon.className} app-icon--right`;
12
+ if (iconPosition === 'left') {
13
+ return (_jsxs("a", { href: href, className: className, title: title, target: target, onClick: onClick, children: [_jsx(Icon, { ...icon, className: iconClassName }), caption] }));
14
+ }
15
+ return (_jsxs("a", { href: href, className: className, title: title, target: target, onClick: onClick, children: [caption, _jsx(Icon, { ...icon, className: iconClassName })] }));
16
+ };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { SimpleAnchorProps } from "../../types";
3
+ /** Simple anchor component, without icon */
4
+ export declare const SimpleAnchor: ({ href, className, onClick, caption, title, target }: SimpleAnchorProps) => JSX.Element;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/anchor/components/simpleAnchor/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,4CAA4C;AAC5C,eAAO,MAAM,YAAY,yDAA0D,iBAAiB,KAAG,WAYtG,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /** Simple anchor component, without icon */
3
+ export const SimpleAnchor = ({ href, className, onClick, caption, title, target }) => {
4
+ return (_jsx("a", { className: className, href: href, title: title, target: target, onClick: onClick, children: caption }));
5
+ };
@@ -0,0 +1,24 @@
1
+ /// <reference types="react" />
2
+ import './anchor.scss';
3
+ import { ElementIcon } from '../types';
4
+ export declare type AnchorProps = {
5
+ /** Link destination */
6
+ href?: string;
7
+ /** Link caption */
8
+ caption?: string;
9
+ /** Click handler */
10
+ onClick?: () => void;
11
+ /** Configuration od inner icon */
12
+ icon?: ElementIcon;
13
+ /** Title of anchor */
14
+ title?: string;
15
+ /** Where to open the linked document */
16
+ target?: '_blank' | '_top';
17
+ /** Additional class names */
18
+ className?: string;
19
+ /** Should css hovering effects be disabled */
20
+ disableHovering?: boolean;
21
+ };
22
+ /** Anchor component */
23
+ export default function Anchor(props: AnchorProps): JSX.Element;
24
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/anchor/index.tsx"],"names":[],"mappings":";AAEA,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAKvC,oBAAY,WAAW,GAAG;IACtB,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,kCAAkC;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,wCAAwC;IACxC,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;IAE3B,6BAA6B;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;IAEnB,8CAA8C;IAC9C,eAAe,CAAC,EAAE,OAAO,CAAC;CAC7B,CAAC;AAEF,uBAAuB;AACvB,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CA2B9D"}
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import utils from '@bodynarf/utils';
3
+ import './anchor.scss';
4
+ import { SimpleAnchor } from './components/simpleAnchor';
5
+ import { AnchorWithIcon } from './components/anchorWithIcon';
6
+ /** Anchor component */
7
+ export default function Anchor(props) {
8
+ if (utils.isNullOrUndefined(props.caption) && utils.isNullOrUndefined(props.icon)) {
9
+ throw new Error("No anchor content provided");
10
+ }
11
+ const className = 'app-anchor'
12
+ + (!utils.isNullOrEmpty(props.className) ? ` ${props.className}` : '')
13
+ + (props.disableHovering === true ? ' app-anchor--unhoverable' : '');
14
+ if (utils.isNullOrUndefined(props.icon)) {
15
+ return (_jsx(SimpleAnchor, { ...props, className: className, onClick: props.onClick }));
16
+ }
17
+ return (_jsx(AnchorWithIcon, { ...props, className: className, onClick: props.onClick, icon: props.icon }));
18
+ }
@@ -1,26 +1,20 @@
1
1
  import { ElementIcon } from "../types";
2
-
3
- export type SimpleAnchorProps = {
2
+ export declare type SimpleAnchorProps = {
4
3
  /** Link destination */
5
4
  href?: string;
6
-
7
5
  /** Class names */
8
6
  className: string;
9
-
10
7
  /** Click handler */
11
8
  onClick?: () => void;
12
-
13
9
  /** Link caption */
14
10
  caption?: string;
15
-
16
11
  /** Title of anchor */
17
12
  title?: string;
18
-
19
13
  /** Where to open the linked document */
20
14
  target?: '_blank' | '_top';
21
15
  };
22
-
23
- export type AnchorWithIconProps = SimpleAnchorProps & {
16
+ export declare type AnchorWithIconProps = SimpleAnchorProps & {
24
17
  /** Configuration of icon */
25
18
  icon: ElementIcon;
26
19
  };
20
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/anchor/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,oBAAY,iBAAiB,GAAG;IAC5B,uBAAuB;IACvB,IAAI,CAAC,EAAE,MAAM,CAAC;IAEd,kBAAkB;IAClB,SAAS,EAAE,MAAM,CAAC;IAElB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,oBAAoB;IACpB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,sBAAsB;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,wCAAwC;IACxC,MAAM,CAAC,EAAE,QAAQ,GAAG,MAAM,CAAC;CAC9B,CAAC;AAEF,oBAAY,mBAAmB,GAAG,iBAAiB,GAAG;IAClD,4BAA4B;IAC5B,IAAI,EAAE,WAAW,CAAC;CACrB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { ButtonWithIconProps } from '../../types';
3
+ /** Button with icon component */
4
+ export declare const ButtonWithIcon: ({ className, disabled, onClick, caption, title, icon }: ButtonWithIconProps) => JSX.Element;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/components/buttonWithIcon/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAElD,iCAAiC;AACjC,eAAO,MAAM,cAAc,2DAA4D,mBAAmB,KAAG,WAsC5G,CAAC"}
@@ -0,0 +1,19 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import utils from '@bodynarf/utils';
3
+ import Icon from '../../../icon';
4
+ /** Button with icon component */
5
+ export const ButtonWithIcon = ({ className, disabled, onClick, caption, title, icon }) => {
6
+ const iconPosition = icon.position || 'left';
7
+ const iconClassName = utils.isNullOrEmpty(caption)
8
+ ? icon.className
9
+ : iconPosition === 'left'
10
+ ? `${icon.className} app-icon--left`
11
+ : `${icon.className} app-icon--right`;
12
+ className = utils.isNullOrEmpty(caption)
13
+ ? `${className} button--icon-only`
14
+ : className;
15
+ if (iconPosition === 'left') {
16
+ return (_jsxs("button", { className: className, disabled: disabled, onClick: onClick, title: title, children: [_jsx(Icon, { ...icon, className: iconClassName }), caption] }));
17
+ }
18
+ return (_jsxs("button", { className: className, disabled: disabled, onClick: onClick, title: title, children: [caption, _jsx(Icon, { ...icon, className: iconClassName })] }));
19
+ };
@@ -0,0 +1,5 @@
1
+ /// <reference types="react" />
2
+ import { SimpleButtonProps } from '../../types';
3
+ /** Simple button component, without icon */
4
+ export declare const SimpleButton: ({ className, disabled, onClick, caption, title }: SimpleButtonProps) => JSX.Element;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/button/components/simpleButton/index.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAEhD,4CAA4C;AAC5C,eAAO,MAAM,YAAY,qDAAsD,iBAAiB,KAAG,WAWlG,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /** Simple button component, without icon */
3
+ export const SimpleButton = ({ className, disabled, onClick, caption, title }) => {
4
+ return (_jsx("button", { className: className, disabled: disabled, onClick: onClick, title: title, children: caption }));
5
+ };
@@ -0,0 +1,34 @@
1
+ /// <reference types="react" />
2
+ import './button.scss';
3
+ import { ElementIcon, IconSize } from '../types';
4
+ import { ButtonType } from './types';
5
+ export declare type ButtonProps = {
6
+ /** Button displaying text */
7
+ caption?: string;
8
+ /** Type of button (color) */
9
+ type: ButtonType;
10
+ /** Configuration of inner icon */
11
+ icon?: ElementIcon;
12
+ /** Button size */
13
+ size?: IconSize;
14
+ /** Title on hover */
15
+ title?: string;
16
+ /** Is button uses light version of color */
17
+ light?: boolean;
18
+ /** Is button outlined */
19
+ outlined?: boolean;
20
+ /** Should button corners be rounded */
21
+ rounded?: boolean;
22
+ /** Display loading icon */
23
+ isLoading?: boolean;
24
+ /** Is button disabled */
25
+ disabled?: boolean;
26
+ /** Click action handler */
27
+ onClick?: () => void;
28
+ };
29
+ /**
30
+ * Button component
31
+ * @throws Caption is not defined and icon configuration is not defined at the same time
32
+ */
33
+ export default function Button(props: ButtonProps): JSX.Element;
34
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/button/index.tsx"],"names":[],"mappings":";AAEA,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,WAAW,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEjD,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAIrC,oBAAY,WAAW,GAAG;IACtB,6BAA6B;IAC7B,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,8BAA8B;IAC9B,IAAI,EAAE,UAAU,CAAC;IAEjB,kCAAkC;IAClC,IAAI,CAAC,EAAE,WAAW,CAAC;IAEnB,mBAAmB;IACnB,IAAI,CAAC,EAAE,QAAQ,CAAC;IAEhB,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,6CAA6C;IAC7C,KAAK,CAAC,EAAE,OAAO,CAAC;IAEhB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,wCAAwC;IACxC,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB,2BAA2B;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB,yBAAyB;IACzB,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB,CAAC;AAEF;;;GAGG;AACH,MAAM,CAAC,OAAO,UAAU,MAAM,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,CAAC,OAAO,CAiC9D"}
@@ -0,0 +1,27 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import utils from '@bodynarf/utils';
3
+ import './button.scss';
4
+ import { ButtonWithIcon } from './components/buttonWithIcon';
5
+ import { SimpleButton } from './components/simpleButton';
6
+ /**
7
+ * Button component
8
+ * @throws Caption is not defined and icon configuration is not defined at the same time
9
+ */
10
+ export default function Button(props) {
11
+ if ((utils.isNullOrEmpty(props.caption))
12
+ && (utils.isNullOrUndefined(props.icon) || utils.isStringEmpty(props.icon?.className))) {
13
+ throw new Error("No button content provided.");
14
+ }
15
+ const className = `button is-${props.type}`
16
+ + (props.light === true ? ' is-light' : '')
17
+ + (!utils.isNullOrUndefined(props.size) ? ` is-${props.size}` : '')
18
+ + (props.outlined === true ? ' is-outlined' : '')
19
+ + (props.rounded === true ? ' is-rounded' : '')
20
+ + (props.isLoading === true ? ' is-loading' : '');
21
+ if (!utils.isNullOrUndefined(props.icon)) {
22
+ return (_jsx(ButtonWithIcon, { ...props, className: className, onClick: props.onClick, icon: props.icon }));
23
+ }
24
+ else {
25
+ return (_jsx(SimpleButton, { ...props, className: className, onClick: props.onClick }));
26
+ }
27
+ }
@@ -0,0 +1,20 @@
1
+ import { ElementIcon } from "../types";
2
+ /** Button types according to Bulma framework */
3
+ export declare type ButtonType = 'default' /** color: transparent */ | 'primary' /** color: seawave green */ | 'link' /** color: blue-violet */ | 'info' /** color: sky-blue */ | 'success' /** color: green */ | 'warning' /** color: yellow */ | 'danger' /** color: red */ | 'white' /** color: white */ | 'light' /** color: light-gray */ | 'dark' /** color: dark-gray */ | 'black' /** color: black */ | 'text' /** Underline text with color: gray */ | 'ghost' /** Blue underline text with color: transparent */;
4
+ export declare type SimpleButtonProps = {
5
+ /** Button class name*/
6
+ className: string;
7
+ /** Button click handler */
8
+ onClick?: () => void;
9
+ /** Button caption */
10
+ caption?: string;
11
+ /** Disabled attribute value*/
12
+ disabled?: boolean;
13
+ /** Title on hover */
14
+ title?: string;
15
+ };
16
+ export declare type ButtonWithIconProps = SimpleButtonProps & {
17
+ /** Icon configuration */
18
+ icon: ElementIcon;
19
+ };
20
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/button/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAEvC,gDAAgD;AAChD,oBAAY,UAAU,GAClB,SAAS,CAAC,yBAAyB,GACjC,SAAS,CAAC,2BAA2B,GACrC,MAAM,CAAC,yBAAyB,GAChC,MAAM,CAAC,sBAAsB,GAC7B,SAAS,CAAC,mBAAmB,GAC7B,SAAS,CAAC,oBAAoB,GAC9B,QAAQ,CAAC,iBAAiB,GAC1B,OAAO,CAAC,mBAAmB,GAC3B,OAAO,CAAC,wBAAwB,GAChC,MAAM,CAAC,uBAAuB,GAC9B,OAAO,CAAC,mBAAmB,GAC3B,MAAM,CAAC,sCAAsC,GAC7C,OAAO,CAAC,kDAAkD,CAC3D;AAEL,oBAAY,iBAAiB,GAAG;IAC5B,uBAAuB;IACvB,SAAS,EAAE,MAAM,CAAC;IAElB,2BAA2B;IAC3B,OAAO,CAAC,EAAE,MAAM,IAAI,CAAC;IAErB,qBAAqB;IACrB,OAAO,CAAC,EAAE,MAAM,CAAC;IAEjB,8BAA8B;IAC9B,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB,qBAAqB;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,oBAAY,mBAAmB,GAAG,iBAAiB,GAAG;IAClD,yBAAyB;IACzB,IAAI,EAAE,WAAW,CAAC;CACrB,CAAC"}
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,15 @@
1
+ /// <reference types="react" />
2
+ import { SelectableItem } from "../../types";
3
+ /** Dropdown item props */
4
+ interface DropdownItemProps {
5
+ /** Item to present in dropdown */
6
+ item: SelectableItem;
7
+ /** Is item selected*/
8
+ selected: boolean;
9
+ /** Item click handler */
10
+ onClick: (event: React.MouseEvent<HTMLLIElement>) => void;
11
+ }
12
+ /** Single item in dropdown component */
13
+ declare const DropdownItem: ({ item, selected, onClick }: DropdownItemProps) => JSX.Element;
14
+ export default DropdownItem;
15
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/dropdownItem/index.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,0BAA0B;AAC1B,UAAU,iBAAiB;IACvB,kCAAkC;IAClC,IAAI,EAAE,cAAc,CAAC;IAErB,sBAAsB;IACtB,QAAQ,EAAE,OAAO,CAAC;IAElB,yBAAyB;IACzB,OAAO,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,aAAa,CAAC,KAAK,IAAI,CAAC;CAC7D;AAED,wCAAwC;AACxC,QAAA,MAAM,YAAY,gCAAiC,iBAAiB,KAAG,WAYtE,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ /** Single item in dropdown component */
3
+ const DropdownItem = ({ item, selected, onClick }) => {
4
+ return (_jsx("li", { className: `app-dropdown-item dropdown-item${selected ? " is-active" : ""}`, onClick: onClick, "data-dropdown-item-value": item.value, title: item.displayValue, children: item.displayValue }, item.id));
5
+ };
6
+ export default DropdownItem;
@@ -0,0 +1,16 @@
1
+ import { MouseEvent } from 'react';
2
+ import { SelectableItem } from "../../types";
3
+ interface DropdownLabelProps {
4
+ /** Caption when no items selected */
5
+ caption: string;
6
+ /** Can user deselect */
7
+ deselectable: boolean;
8
+ /** Selected item */
9
+ selectedItem?: SelectableItem;
10
+ /** Click handler*/
11
+ onClick: (event: MouseEvent<HTMLLabelElement>) => void;
12
+ }
13
+ /** Label component */
14
+ declare const DropdownLabel: ({ caption, selectedItem, onClick, deselectable }: DropdownLabelProps) => JSX.Element;
15
+ export default DropdownLabel;
16
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/dropdown/components/dropdownLabel/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,OAAO,CAAC;AAMnC,OAAO,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAE7C,UAAU,kBAAkB;IACxB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;IAEhB,wBAAwB;IACxB,YAAY,EAAE,OAAO,CAAC;IAEtB,oBAAoB;IACpB,YAAY,CAAC,EAAE,cAAc,CAAC;IAE9B,mBAAmB;IACnB,OAAO,EAAE,CAAC,KAAK,EAAE,UAAU,CAAC,gBAAgB,CAAC,KAAK,IAAI,CAAC;CAC1D;AAED,sBAAsB;AACtB,QAAA,MAAM,aAAa,qDAAsD,kBAAkB,KAAG,WAkC7F,CAAC;AAEF,eAAe,aAAa,CAAC"}
@@ -0,0 +1,21 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import utils from "@bodynarf/utils";
3
+ import Icon from '../../../icon';
4
+ /** Label component */
5
+ const DropdownLabel = ({ caption, selectedItem, onClick, deselectable }) => {
6
+ const itemSelected = !utils.isNullOrUndefined(selectedItem);
7
+ const text = itemSelected
8
+ ? selectedItem?.displayValue
9
+ : caption;
10
+ const deselectVisible = deselectable && itemSelected;
11
+ const className = [
12
+ "dropdown-trigger",
13
+ "app-dropdown__label",
14
+ itemSelected ? "" : "app-dropdown__label--default",
15
+ "button"
16
+ ].filter(x => !utils.isNullOrEmpty(x))
17
+ .join(" ");
18
+ return (_jsxs("label", { className: className, onClick: onClick, children: [deselectVisible &&
19
+ _jsx(Icon, { className: "plus-lg" }), _jsx("span", { className: deselectVisible ? "mx-2" : "mr-2", title: itemSelected ? text : undefined, children: text }), _jsx(Icon, { className: "arrow-up" })] }));
20
+ };
21
+ export default DropdownLabel;
@@ -0,0 +1,31 @@
1
+ /// <reference types="react" />
2
+ import './dropdown.scss';
3
+ import { SelectableItem } from './types';
4
+ import { BaseElementProps } from '../types';
5
+ export declare type DropdownProps = BaseElementProps & {
6
+ /** Items which can be selected */
7
+ items: Array<SelectableItem>;
8
+ /**
9
+ * Selected value.
10
+ * Must be stored outside
11
+ */
12
+ value?: SelectableItem;
13
+ /**
14
+ * Action to update selected value,
15
+ * which stored outside
16
+ */
17
+ onSelect: (item?: SelectableItem) => void;
18
+ /**
19
+ * Caption.
20
+ * Appears only no element selected
21
+ */
22
+ caption: string;
23
+ /** Hide dropdown list when its opened and user click outside */
24
+ hideOnOuterClick: boolean;
25
+ /** Can user deselect */
26
+ deselectable?: boolean;
27
+ };
28
+ /** Dropdown component */
29
+ declare const Dropdown: ({ value, items, onSelect, caption, deselectable, className, hideOnOuterClick }: DropdownProps) => JSX.Element;
30
+ export default Dropdown;
31
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/index.tsx"],"names":[],"mappings":";AAIA,OAAO,iBAAiB,CAAC;AAIzB,OAAO,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AACzC,OAAO,EAAE,gBAAgB,EAAE,MAAM,UAAU,CAAC;AAK5C,oBAAY,aAAa,GAAG,gBAAgB,GAAG;IAC3C,kCAAkC;IAClC,KAAK,EAAE,KAAK,CAAC,cAAc,CAAC,CAAC;IAE7B;;;MAGE;IACF,KAAK,CAAC,EAAE,cAAc,CAAC;IAEvB;;;OAGG;IACH,QAAQ,EAAE,CAAC,IAAI,CAAC,EAAE,cAAc,KAAK,IAAI,CAAC;IAE1C;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;IAEhB,gEAAgE;IAChE,gBAAgB,EAAE,OAAO,CAAC;IAE1B,wBAAwB;IACxB,YAAY,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAA;AAED,yBAAyB;AACzB,QAAA,MAAM,QAAQ,mFAAoF,aAAa,KAAG,WA6FjH,CAAC;AAEF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,57 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback, useId, useState } from 'react';
3
+ import utils from '@bodynarf/utils';
4
+ import './dropdown.scss';
5
+ import { useComponentOutsideClick } from '../../hooks/useComponentOutsideClick';
6
+ import DropdownItem from './components/dropdownItem';
7
+ import DropdownLabel from './components/dropdownLabel';
8
+ /** Dropdown component */
9
+ const Dropdown = ({ value, items, onSelect, caption, deselectable, className, hideOnOuterClick }) => {
10
+ const id = useId();
11
+ const [isListVisible, setListVisible] = useState(false);
12
+ const onItemClick = useCallback((event) => {
13
+ const target = event.target;
14
+ if (utils.isNullOrUndefined(target)) {
15
+ return;
16
+ }
17
+ const dataValue = target.dataset['dropdownItemValue'];
18
+ if (utils.isNullOrEmpty(dataValue)) {
19
+ return;
20
+ }
21
+ const item = items.find(x => x.value === dataValue);
22
+ if (utils.isNullOrUndefined(item)) {
23
+ return;
24
+ }
25
+ if (value === item) {
26
+ setListVisible(false);
27
+ return;
28
+ }
29
+ onSelect(item);
30
+ setListVisible(false);
31
+ }, [setListVisible, value, items, onSelect]);
32
+ const onLabelClick = useCallback((event) => {
33
+ const target = event.target;
34
+ if (utils.isNullOrUndefined(target)) {
35
+ return;
36
+ }
37
+ if (target.classList.contains("bi-plus-lg")) {
38
+ onSelect(undefined);
39
+ }
40
+ else {
41
+ setListVisible(state => !state);
42
+ }
43
+ }, [onSelect, setListVisible]);
44
+ useComponentOutsideClick(`[data-dropdown-id="${id}"]`, isListVisible, () => setListVisible(false), hideOnOuterClick);
45
+ const classNames = [
46
+ "app-dropdown",
47
+ isListVisible ? "is-active" : "",
48
+ className,
49
+ "dropdown"
50
+ ]
51
+ .filter(x => !utils.isNullOrEmpty(x))
52
+ .join(" ");
53
+ return (_jsxs("div", { className: classNames, "data-dropdown-id": id, children: [_jsx(DropdownLabel, { caption: caption, deselectable: deselectable === true, selectedItem: value, onClick: onLabelClick }), _jsx("div", { className: "dropdown-menu", children: items.length > 0
54
+ ? _jsx("ul", { className: "dropdown-content", children: items.map(item => _jsx(DropdownItem, { item: item, selected: value?.value === item.value, onClick: onItemClick }, item.id)) })
55
+ : _jsx("span", { className: "dropdown-content dropdown-item", children: "No items found" }) })] }, id));
56
+ };
57
+ export default Dropdown;
@@ -1,11 +1,10 @@
1
1
  /** Dropdown item */
2
- export type SelectableItem = {
2
+ export declare type SelectableItem = {
3
3
  /** Unique item identifier */
4
4
  id: string;
5
-
6
5
  /** Item value */
7
6
  value: string;
8
-
9
7
  /** Displaying text */
10
8
  displayValue: string;
11
- }
9
+ };
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/components/dropdown/types.ts"],"names":[],"mappings":"AAAA,oBAAoB;AACpB,oBAAY,cAAc,GAAG;IACzB,6BAA6B;IAC7B,EAAE,EAAE,MAAM,CAAC;IAEX,iBAAiB;IACjB,KAAK,EAAE,MAAM,CAAC;IAEd,sBAAsB;IACtB,YAAY,EAAE,MAAM,CAAC;CACxB,CAAA"}
@@ -0,0 +1 @@
1
+ export {};
File without changes
@@ -0,0 +1,18 @@
1
+ /// <reference types="react" />
2
+ import './icon.scss';
3
+ import { IconSize } from '../types';
4
+ /** Icon component props */
5
+ export declare type IconProps = {
6
+ /**
7
+ * Class name for icon.
8
+ * Used to display icon from bootstrap-icons
9
+ */
10
+ className: string;
11
+ /** Icon size */
12
+ size?: IconSize;
13
+ };
14
+ /**
15
+ * Icon component. Based on bootstrap icons
16
+ */
17
+ export default function Icon(props: IconProps): JSX.Element;
18
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/icon/index.tsx"],"names":[],"mappings":";AAAA,OAAO,aAAa,CAAC;AAErB,OAAO,EAAE,QAAQ,EAAE,MAAM,UAAU,CAAC;AAEpC,2BAA2B;AAC3B,oBAAY,SAAS,GAAG;IACpB;;;MAGE;IACF,SAAS,EAAE,MAAM,CAAC;IAElB,gBAAgB;IAChB,IAAI,CAAC,EAAE,QAAQ,CAAC;CACnB,CAAA;AAQD;;GAEG;AACH,MAAM,CAAC,OAAO,UAAU,IAAI,CAAC,KAAK,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,CAQ1D"}
@@ -0,0 +1,15 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import './icon.scss';
3
+ const sizeToClassMap = new Map([
4
+ ['small', ' app-icon--smal'],
5
+ ['medium', ''],
6
+ ['large', ' app-icon--large']
7
+ ]);
8
+ /**
9
+ * Icon component. Based on bootstrap icons
10
+ */
11
+ export default function Icon(props) {
12
+ const size = props.size || 'medium';
13
+ const className = `app-icon bi bi-${props.className}${sizeToClassMap.get(size)}`;
14
+ return (_jsx("i", { className: className }));
15
+ }
@@ -0,0 +1,11 @@
1
+ /// <reference types="react" />
2
+ import { BaseInputElementProps, InputLabel } from '../types';
3
+ /** Date input conponent props type */
4
+ export declare type DateProps = Omit<BaseInputElementProps<Date | undefined>, 'placeholder'> & {
5
+ /** Label configuration */
6
+ label: InputLabel;
7
+ };
8
+ /** Date input component */
9
+ declare const DatePicker: (props: DateProps) => JSX.Element;
10
+ export default DatePicker;
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/date/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,UAAU,CAAC;AAE7D,sCAAsC;AACtC,oBAAY,SAAS,GAAG,IAAI,CAAC,qBAAqB,CAAC,IAAI,GAAG,SAAS,CAAC,EAAE,aAAa,CAAC,GAAG;IACnF,0BAA0B;IAC1B,KAAK,EAAE,UAAU,CAAC;CACrB,CAAA;AAED,2BAA2B;AAC3B,QAAA,MAAM,UAAU,UAAW,SAAS,KAAG,WAqFtC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -0,0 +1,31 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useCallback } from 'react';
3
+ import utils from '@bodynarf/utils';
4
+ /** Date input component */
5
+ const DatePicker = (props) => {
6
+ const onValueChange = useCallback((event) => props.onValueChange(utils.isStringEmpty(event.target.value)
7
+ ? undefined
8
+ : new Date(event.target.value)),
9
+ // eslint-disable-next-line react-hooks/exhaustive-deps
10
+ [props.onValueChange]);
11
+ const id = props.name || utils.generateGuid();
12
+ const size = `is-${(props.size || 'normal')}`;
13
+ const className = utils.getClassName([
14
+ props.className,
15
+ size,
16
+ props.rounded === true ? 'is-rounded' : '',
17
+ "input",
18
+ ]);
19
+ const inputContainerClassName = utils.getClassName([
20
+ "control",
21
+ props.loading === true ? 'is-loading' : '',
22
+ (props.style || 'default') === 'default' ? '' : `is-${props.style}`
23
+ ]);
24
+ const label = props.label;
25
+ const defaultValue = props.defaultValue?.toISOString().split("T")[0];
26
+ if (label.horizontal === true) {
27
+ return (_jsxs("div", { className: "app-input field is-horizontal", children: [_jsx("div", { className: `field-label ${size}`, children: _jsx("label", { className: "label", htmlFor: id, children: label.caption }) }), _jsx("div", { className: "field-body", children: _jsx("div", { className: "field", children: _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "date", className: className, readOnly: props.readonly, disabled: props.disabled, defaultValue: defaultValue, onChange: onValueChange, name: id, id: id }) }) }) })] }));
28
+ }
29
+ return (_jsxs("div", { className: "app-input field", children: [_jsx("label", { className: `label ${size}`, htmlFor: id, children: label.caption }), _jsx("div", { className: inputContainerClassName, children: _jsx("input", { type: "date", className: className, readOnly: props.readonly, disabled: props.disabled, defaultValue: props.defaultValue?.toLocaleDateString(), onChange: onValueChange, name: id, id: id }) })] }));
30
+ };
31
+ export default DatePicker;
@@ -0,0 +1,5 @@
1
+ export * from './date';
2
+ export * from './multiline';
3
+ export * from './text';
4
+ export * from './types';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/components/primitives/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,aAAa,CAAC;AAC5B,cAAc,QAAQ,CAAC;AACvB,cAAc,SAAS,CAAC"}
@@ -0,0 +1,4 @@
1
+ export * from './date';
2
+ export * from './multiline';
3
+ export * from './text';
4
+ export * from './types';
@@ -0,0 +1,6 @@
1
+ /// <reference types="react" />
2
+ import { MultilineProps } from '../..';
3
+ /** Multiline textual input component with describing label */
4
+ declare const MultilineWithLabel: (props: MultilineProps) => JSX.Element;
5
+ export default MultilineWithLabel;
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../../src/components/primitives/multiline/components/multilineWithLabel/index.tsx"],"names":[],"mappings":";AAIA,OAAO,EAAE,cAAc,EAAE,MAAM,OAAO,CAAC;AAEvC,8DAA8D;AAC9D,QAAA,MAAM,kBAAkB,UAAW,cAAc,KAAG,WAkFnD,CAAC;AAEF,eAAe,kBAAkB,CAAC"}