@hbuesing/ui-library 3.0.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/dist/bundle.js +2 -0
  2. package/dist/bundle.js.map +1 -0
  3. package/dist/components/button/customButton.d.ts +10 -0
  4. package/dist/components/button/index.d.ts +1 -0
  5. package/dist/components/checkbox/customCheckbox.d.ts +10 -0
  6. package/dist/components/checkbox/index.d.ts +1 -0
  7. package/dist/components/images/index.d.ts +1 -0
  8. package/dist/components/images/svgIcon.d.ts +9 -0
  9. package/dist/components/input/baseInput.d.ts +11 -0
  10. package/dist/components/input/customInput.d.ts +8 -0
  11. package/dist/components/input/index.d.ts +2 -0
  12. package/dist/components/input/passwordInput.d.ts +18 -0
  13. package/dist/components/modal/baseModal.d.ts +16 -0
  14. package/dist/components/modal/index.d.ts +2 -0
  15. package/dist/components/modal/notifyModal.d.ts +11 -0
  16. package/dist/components/modal/questionModal.d.ts +10 -0
  17. package/dist/components/radio/customRadio.d.ts +17 -0
  18. package/dist/components/radio/index.d.ts +1 -0
  19. package/dist/enums/index.d.ts +1 -0
  20. package/dist/enums/modalType.d.ts +6 -0
  21. package/dist/enums/passwordRuleTypes.d.ts +8 -0
  22. package/dist/hooks/clickOutside.d.ts +1 -0
  23. package/dist/hooks/getColor.d.ts +1 -0
  24. package/{src/hooks/index.ts → dist/hooks/index.d.ts} +1 -1
  25. package/dist/index.d.ts +8 -0
  26. package/dist/utils/generateKey.d.ts +1 -0
  27. package/dist/utils/useInjectStyles.d.ts +2 -0
  28. package/package.json +9 -4
  29. package/src/components/button/button.scss +0 -25
  30. package/src/components/button/customButton.tsx +0 -84
  31. package/src/components/button/index.ts +0 -1
  32. package/src/components/checkbox/checkbox.scss +0 -13
  33. package/src/components/checkbox/customCheckBox.tsx +0 -35
  34. package/src/components/checkbox/index.ts +0 -1
  35. package/src/components/global.scss +0 -60
  36. package/src/components/images/images.scss +0 -12
  37. package/src/components/images/index.ts +0 -1
  38. package/src/components/images/svgIcon.tsx +0 -39
  39. package/src/components/input/baseInput.tsx +0 -48
  40. package/src/components/input/customInput.tsx +0 -54
  41. package/src/components/input/index.ts +0 -2
  42. package/src/components/input/input.scss +0 -142
  43. package/src/components/input/passwordInput.tsx +0 -118
  44. package/src/components/modal/baseModal.tsx +0 -105
  45. package/src/components/modal/index.ts +0 -2
  46. package/src/components/modal/modal.scss +0 -125
  47. package/src/components/modal/notifyModal.tsx +0 -24
  48. package/src/components/modal/questionModal.tsx +0 -23
  49. package/src/components/radio/customRadio.tsx +0 -72
  50. package/src/components/radio/index.ts +0 -1
  51. package/src/components/radio/radio.scss +0 -28
  52. package/src/components/variables.scss +0 -61
  53. package/src/enums/index.ts +0 -1
  54. package/src/enums/modalType.ts +0 -6
  55. package/src/enums/passwordRuleTypes.ts +0 -8
  56. package/src/hooks/clickOutside.ts +0 -25
  57. package/src/hooks/getColor.ts +0 -16
  58. package/src/index.ts +0 -9
  59. package/src/utils/generateKey.ts +0 -3
  60. package/src/utils/styles.scss +0 -7
  61. package/src/utils/styles.scss.d.ts +0 -2
  62. package/src/utils/useInjectStyles.ts +0 -19
  63. package/tsconfig.json +0 -24
@@ -1,72 +0,0 @@
1
- import React, {useEffect, useRef} from 'react';
2
- import generateKey from 'utils/generateKey';
3
- import useInjectStyleSheet from "utils/useInjectStyles";
4
-
5
- interface ICustomRadio {
6
- options : RadioOption[];
7
- value : string;
8
- valueChanged: (value: string) => void;
9
- checkColor? : string;
10
- disabled? : boolean;
11
- label? : string;
12
- }
13
-
14
- export interface RadioOption {
15
- label : string;
16
- value : string;
17
- checked? : boolean;
18
- disabled?: boolean;
19
- }
20
-
21
- export function CustomRadio(props: ICustomRadio) {
22
- const {
23
- checkColor,
24
- disabled,
25
- label,
26
- options,
27
- value,
28
- valueChanged,
29
- } = props;
30
-
31
- const nodeRef = useRef<HTMLDivElement>(null);
32
- useInjectStyleSheet(nodeRef);
33
-
34
- useEffect(() => {
35
- // prevents multiple radio options being checked at the same time
36
- options.forEach(option => {
37
- if (option.checked) handleRadioChange(option.value);
38
- });
39
- },[]);
40
-
41
- function handleRadioChange(newValue: string) {
42
- if (value === newValue) return;
43
-
44
- valueChanged(newValue);
45
- }
46
-
47
- return (
48
- <div ref={nodeRef}>
49
- {label && <div className={'uil-radio-title'}>{label}</div>}
50
-
51
- <div className={'uil-radio-wrapper'}>
52
- {options.map((option, idx) =>
53
- <div key={generateKey(idx)} className={'uil-radio-option'}>
54
- <label className={'uil-radio uil-check'}>
55
- <input
56
- name={option.label}
57
- type={'radio'}
58
- value={option.value}
59
- checked={value === option.value || value === '' && option.checked}
60
- onChange={() => handleRadioChange(option.value)}
61
- disabled={disabled? disabled : option.disabled}
62
- />
63
- <div className={'uil-checkmark uil-radio-check'} style={{backgroundColor: checkColor}}/>
64
- </label>
65
-
66
- <span className={'uil-font-base'}>{option.label}</span>
67
- </div>
68
- )}
69
- </div>
70
- </div>
71
- );
72
- }
@@ -1 +0,0 @@
1
- export * from './customRadio';
@@ -1,28 +0,0 @@
1
- @use "../variables" as *;
2
-
3
- .uil-radio-title {
4
- display: block;
5
- font-size: var(--uil-xl);
6
- line-height: var(--uil-xl);
7
- margin-bottom: var(--uil-m);
8
- }
9
-
10
- .uil-radio-wrapper {
11
- display: flex;
12
- flex-direction: column;
13
- gap: var(--uil-m);
14
-
15
- .uil-radio-option {
16
- display: flex;
17
- align-items: center;
18
- gap: .25rem;
19
-
20
- .uil-radio {
21
- border-radius: 50%;
22
-
23
- .uil-radio-check {
24
- border-radius: 50%;
25
- }
26
- }
27
- }
28
- }
@@ -1,61 +0,0 @@
1
- :root {
2
- --uil-black: #000000;
3
- --uil-black-alt: #222222;
4
-
5
- --uil-white: #ffffff;
6
-
7
- --uil-grey: #f3f3f3;
8
- --uil-grey-alt: #cfcfcf;
9
- --uil-grey-dark: #878787;
10
-
11
- --uil-outline-focus: #1E90FFFF;
12
- --uil-outline-disabled: #8B0000FF;
13
-
14
- --uil-success: #006A4E;
15
- --uil-error: #800020;
16
- --uil-question: #00416A;
17
- --uil-warning: #FFD700;
18
-
19
- --uil-xxxs: .125rem;
20
- --uil-xxs: .25rem;
21
- --uil-xs: .5rem;
22
- --uil-s: .75rem;
23
- --uil-m: 1rem;
24
- --uil-l: 1.25rem;
25
- --uil-xl: 1.5rem;
26
- --uil-xxl: 1.75rem;
27
- --uil-xxxl: 2rem;
28
-
29
- --uil-font-base: var(--uil-l);
30
- --uil-font-small: var(--uil-m);
31
- }
32
-
33
- @mixin uil-mobile {
34
- @media (max-width: 1024px) {
35
- @content
36
- }
37
- }
38
-
39
- @mixin uil-tablet {
40
- @media (min-width: 760px) {
41
- @content
42
- }
43
- }
44
-
45
- @mixin uil-desktop {
46
- @media (min-width: 1025px) {
47
- @content
48
- }
49
- }
50
-
51
- @mixin uil-widescreen {
52
- @media (min-width: 1250px) {
53
- @content
54
- }
55
- }
56
-
57
- @mixin uil-fullHD {
58
- @media (min-width: 1920px) {
59
- @content
60
- }
61
- }
@@ -1 +0,0 @@
1
- export * from './passwordRuleTypes';
@@ -1,6 +0,0 @@
1
- export enum ModalType {
2
- error = 'error',
3
- question = 'question',
4
- success = 'success',
5
- warning = 'warning',
6
- }
@@ -1,8 +0,0 @@
1
- export enum PasswordRuleTypes {
2
- minLength = 1,
3
- maxLength,
4
- letters,
5
- numbers,
6
- special,
7
- upper
8
- }
@@ -1,25 +0,0 @@
1
- import {useEffect, useRef} from 'react';
2
-
3
- export function useClickOutsideRef<T extends HTMLElement>(callback: () => void) {
4
- const ref = useRef<T>(null);
5
-
6
- useEffect(() => {
7
- if (!ref.current) return;
8
-
9
- function handleClickOutside (event: MouseEvent | TouchEvent) {
10
- if (ref.current && !ref.current.contains(event.target as Node)) {
11
- callback();
12
- }
13
- }
14
-
15
- document.addEventListener('click', handleClickOutside);
16
- document.addEventListener('touchend', handleClickOutside);
17
-
18
- return () => {
19
- document.removeEventListener('click', handleClickOutside);
20
- document.removeEventListener('touchend', handleClickOutside);
21
- };
22
- }, [callback]);
23
-
24
- return ref;
25
- }
@@ -1,16 +0,0 @@
1
- export function useGetColor(backgroundColor: string) {
2
- if (backgroundColor.length !== 7) throw new Error('provided hex color must be 7 characters (including #) long');
3
-
4
- backgroundColor = backgroundColor.substring(1, 7);
5
- const uiColors = [
6
- parseInt(backgroundColor.substring(0, 2), 16) / 255,
7
- parseInt(backgroundColor.substring(2, 4), 16) / 255,
8
- parseInt(backgroundColor.substring(4, 6), 16) / 255
9
- ];
10
- const c = uiColors.map(col => {
11
- return col <= 0.03928? (col / 12.92) : Math.pow((col + 0.055) / 1.055, 2.4);
12
- });
13
- const contrast = (0.2126 * c[0]) + (0.7152 * c[1]) + (0.0722 * c[2]);
14
-
15
- return contrast > 0.179 ? '#000000' : '#ffffff';
16
- }
package/src/index.ts DELETED
@@ -1,9 +0,0 @@
1
- export {CustomButton} from './components/button/index';
2
- export {CustomCheckBox} from './components/checkbox/index';
3
- export {SVG} from './components/images/index';
4
- export {CustomInput, PasswordInput, PasswordRule} from './components/input/index';
5
- export {NotifyModal, QuestionModal} from './components/modal/index';
6
- export {CustomRadio, RadioOption} from './components/radio/index';
7
-
8
- export {useClickOutsideRef, useGetColor} from './hooks/index';
9
- export {PasswordRuleTypes} from './enums/index';
@@ -1,3 +0,0 @@
1
- export default function generateKey(prefix: string | number) {
2
- return `${prefix}-${new Date().getTime()}`;
3
- }
@@ -1,7 +0,0 @@
1
- @use "../components/button/button";
2
- @use "../components/checkbox/checkbox";
3
- @use "../components/images/images";
4
- @use "../components/input/input";
5
- @use "../components/modal/modal";
6
- @use "../components/radio/radio";
7
- @use "../components/global";
@@ -1,2 +0,0 @@
1
- declare const cssString: string;
2
- export default cssString;
@@ -1,19 +0,0 @@
1
- import {RefObject, useEffect} from "react";
2
- import styles from "./styles.scss";
3
-
4
- const injectedStyles: Document[] = [];
5
-
6
- export default function useInjectStyleSheet(nodeRef: RefObject<HTMLElement>): void {
7
- useEffect(() => {
8
- const parentDocument = nodeRef.current ? nodeRef.current.ownerDocument : document;
9
-
10
- if (typeof parentDocument !== "undefined" && !injectedStyles.includes(parentDocument)) {
11
- const styleElement = parentDocument.createElement("style");
12
-
13
- styleElement.innerHTML = styles;
14
- injectedStyles.push(parentDocument);
15
-
16
- parentDocument.head.appendChild(styleElement);
17
- }
18
- }, []);
19
- }
package/tsconfig.json DELETED
@@ -1,24 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "outDir": "./dist/",
4
- "sourceMap": true,
5
- "module": "ESNext",
6
- "target": "ESNext",
7
- "moduleResolution": "Node",
8
- "jsx": "react",
9
- "jsxFactory": "",
10
- "jsxFragmentFactory": "",
11
- "noImplicitAny": true,
12
- "noImplicitReturns": true,
13
- "noUnusedParameters": true,
14
- "noFallthroughCasesInSwitch": true,
15
- "allowSyntheticDefaultImports": true,
16
- "strictNullChecks": true,
17
- "exactOptionalPropertyTypes": true,
18
- "declaration": true,
19
- "baseUrl": "./src"
20
- },
21
- "include": [
22
- "./src/**/*"
23
- ]
24
- }