@lion-npm/ui 1.0.2 → 1.0.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 (106) hide show
  1. package/dist/components/buttons/AndroidButton.d.ts +16 -0
  2. package/dist/components/buttons/BootstrapButton.d.ts +16 -0
  3. package/dist/components/buttons/IOSButton.d.ts +16 -0
  4. package/dist/components/buttons/LionButton.d.ts +18 -0
  5. package/dist/components/inputs/AndroidInput.d.ts +20 -0
  6. package/dist/components/inputs/BootstrapInput.d.ts +16 -0
  7. package/dist/components/inputs/IOSInput.d.ts +21 -0
  8. package/dist/components/inputs/LionInput.d.ts +27 -0
  9. package/dist/components/loadings/LoadingBar.d.ts +5 -0
  10. package/dist/components/modals/LionModal.d.ts +17 -0
  11. package/dist/context/LionUIComponentsContext.d.ts +5 -0
  12. package/{src/index.ts → dist/index.d.ts} +1 -3
  13. package/dist/index.js +2564 -0
  14. package/{src/interfaces/LionUIComponentsProviderProps.tsx → dist/interfaces/LionUIComponentsProviderProps.d.ts} +1 -2
  15. package/{src/interfaces/LionUIContextProps.tsx → dist/interfaces/LionUIContextProps.d.ts} +1 -2
  16. package/{src/interfaces/LionUIState.tsx → dist/interfaces/LionUIState.d.ts} +2 -3
  17. package/dist/style.css +2 -0
  18. package/dist/types/Android/AndroidInputShapeTypes.d.ts +5 -0
  19. package/dist/types/Android/AndroidInputStyleTypes.d.ts +5 -0
  20. package/dist/types/Android/AndroidShapeTypes.d.ts +5 -0
  21. package/dist/types/Android/AndroidStyleTypes.d.ts +8 -0
  22. package/dist/types/ButtonTypes.d.ts +7 -0
  23. package/dist/types/IOS/IOSInputShapeTypes.d.ts +6 -0
  24. package/dist/types/IOS/IOSInputStyleTypes.d.ts +8 -0
  25. package/dist/types/IOS/IOSShapeTypes.d.ts +5 -0
  26. package/dist/types/IOS/IOSStyleTypes.d.ts +7 -0
  27. package/dist/types/InputTypes.d.ts +11 -0
  28. package/dist/types/PlatformTypes.d.ts +7 -0
  29. package/dist/types/SizeTypes.d.ts +9 -0
  30. package/dist/types/VariantTypes.d.ts +17 -0
  31. package/dist/types/Web/BootstrapInputShapeTypes.d.ts +6 -0
  32. package/dist/types/Web/BootstrapInputStyleTypes.d.ts +5 -0
  33. package/dist/types/Web/BootstrapShapeTypes.d.ts +6 -0
  34. package/dist/types/Web/BootstrapStyleTypes.d.ts +5 -0
  35. package/package.json +19 -2
  36. package/.oxlintrc.json +0 -8
  37. package/AGENTS.md +0 -0
  38. package/Dockerfile +0 -7
  39. package/compose.yml +0 -14
  40. package/index.html +0 -15
  41. package/src/App.tsx +0 -84
  42. package/src/assets/css/buttons/buttons-android.css +0 -251
  43. package/src/assets/css/buttons/buttons-ios.css +0 -213
  44. package/src/assets/css/buttons/buttons-web.css +0 -138
  45. package/src/assets/css/custom.css +0 -8
  46. package/src/assets/css/index.css +0 -60
  47. package/src/assets/css/inputs/inputs-android.css +0 -259
  48. package/src/assets/css/inputs/inputs-bootstrap.css +0 -74
  49. package/src/assets/css/inputs/inputs-ios.css +0 -268
  50. package/src/assets/css/loadings/loading-bar.css +0 -86
  51. package/src/assets/css/modals/modals.css +0 -236
  52. package/src/components/buttons/AndroidButton.tsx +0 -43
  53. package/src/components/buttons/BootstrapButton.tsx +0 -50
  54. package/src/components/buttons/IOSButton.tsx +0 -42
  55. package/src/components/buttons/LionButton.tsx +0 -73
  56. package/src/components/inputs/AndroidInput.tsx +0 -158
  57. package/src/components/inputs/BootstrapInput.tsx +0 -106
  58. package/src/components/inputs/IOSInput.tsx +0 -163
  59. package/src/components/inputs/LionInput.tsx +0 -81
  60. package/src/components/loadings/LoadingBar.tsx +0 -21
  61. package/src/components/modals/LionModal.tsx +0 -155
  62. package/src/context/LionUIComponentsContext.tsx +0 -73
  63. package/src/features/Header.tsx +0 -83
  64. package/src/features/VariantList.tsx +0 -19
  65. package/src/features/buttons/ButtonsSection.tsx +0 -7
  66. package/src/features/buttons/components/ButtonsAndroidSection.tsx +0 -79
  67. package/src/features/buttons/components/ButtonsBootstrapSection.tsx +0 -77
  68. package/src/features/buttons/components/ButtonsCustomSection.tsx +0 -234
  69. package/src/features/buttons/components/ButtonsIOSSection.tsx +0 -78
  70. package/src/features/inputs/InputsSection.tsx +0 -7
  71. package/src/features/inputs/components/InputsAndroidSection.tsx +0 -155
  72. package/src/features/inputs/components/InputsBootstrapSection.tsx +0 -154
  73. package/src/features/inputs/components/InputsCustomSection.tsx +0 -234
  74. package/src/features/inputs/components/InputsIOSSection.tsx +0 -156
  75. package/src/features/loadings/LoadingSection.tsx +0 -5
  76. package/src/features/loadings/components/LoadingBarSection.tsx +0 -74
  77. package/src/features/modals/ModalsSection.tsx +0 -5
  78. package/src/features/modals/components/ModalsAndroidSection.tsx +0 -108
  79. package/src/features/modals/components/ModalsDefaultForm.tsx +0 -31
  80. package/src/features/modals/components/ModalsDefaultInput.tsx +0 -22
  81. package/src/features/modals/components/ModalsIOSSection.tsx +0 -106
  82. package/src/features/modals/components/ModalsWebSection.tsx +0 -104
  83. package/src/main.tsx +0 -9
  84. package/src/types/Android/AndroidInputShapeTypes.tsx +0 -7
  85. package/src/types/Android/AndroidInputStyleTypes.tsx +0 -7
  86. package/src/types/Android/AndroidShapeTypes.tsx +0 -6
  87. package/src/types/Android/AndroidStyleTypes.tsx +0 -9
  88. package/src/types/ButtonTypes.tsx +0 -9
  89. package/src/types/IOS/IOSInputShapeTypes.tsx +0 -9
  90. package/src/types/IOS/IOSInputStyleTypes.tsx +0 -11
  91. package/src/types/IOS/IOSShapeTypes.tsx +0 -7
  92. package/src/types/IOS/IOSStyleTypes.tsx +0 -9
  93. package/src/types/InputTypes.tsx +0 -13
  94. package/src/types/PlatformTypes.tsx +0 -9
  95. package/src/types/SizeTypes.tsx +0 -11
  96. package/src/types/VariantTypes.tsx +0 -19
  97. package/src/types/Web/BootstrapInputShapeTypes.tsx +0 -9
  98. package/src/types/Web/BootstrapInputStyleTypes.tsx +0 -8
  99. package/src/types/Web/BootstrapShapeTypes.tsx +0 -8
  100. package/src/types/Web/BootstrapStyleTypes.tsx +0 -7
  101. package/tsconfig.app.json +0 -26
  102. package/tsconfig.json +0 -7
  103. package/tsconfig.node.json +0 -23
  104. package/vite.config.ts +0 -30
  105. /package/{public → dist}/favicon.svg +0 -0
  106. /package/{public → dist}/icons.svg +0 -0
@@ -1,106 +0,0 @@
1
- import { type InputHTMLAttributes, useId } from "react";
2
- import { InputTypes } from "../../types/InputTypes";
3
- import { BootstrapInputShapeTypes } from "../../types/Web/BootstrapInputShapeTypes.tsx";
4
- import { BootstrapInputStyleTypes } from "../../types/Web/BootstrapInputStyleTypes.tsx";
5
-
6
- export interface BootstrapInputProps
7
- extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "shape"> {
8
- type?: InputTypes;
9
- styleType?: BootstrapInputStyleTypes;
10
- shape?: BootstrapInputShapeTypes;
11
- variant?: string;
12
- sizeType?: "sm" | "md" | "lg";
13
- label?: string;
14
- required?: boolean;
15
- helperText?: string;
16
- error?: boolean | string;
17
- }
18
-
19
- export default function BootstrapInput({
20
- type = InputTypes.TEXT,
21
- styleType = BootstrapInputStyleTypes.FLOATING,
22
- shape = BootstrapInputShapeTypes.ROUNDED,
23
- variant = "primary",
24
- sizeType = "md",
25
- label,
26
- required = false,
27
- helperText,
28
- error,
29
- disabled = false,
30
- readOnly = false,
31
- id,
32
- className = "",
33
- placeholder = " ",
34
- ...rest
35
- }: BootstrapInputProps) {
36
- const generatedId = useId();
37
- const inputId = id || generatedId;
38
-
39
- const hasError = Boolean(error);
40
- const errorMessage = typeof error === "string" ? error : undefined;
41
-
42
- const sizeClass = sizeType === "sm" ? "form-control-sm" : sizeType === "lg" ? "form-control-lg" : "";
43
- const variantClass = `bootstrap-variant-${variant}`;
44
-
45
- const inputClasses = [
46
- "form-control",
47
- shape,
48
- sizeClass,
49
- variantClass,
50
- hasError ? "is-invalid" : "",
51
- className,
52
- ]
53
- .filter(Boolean)
54
- .join(" ");
55
-
56
- const isFloating = styleType === BootstrapInputStyleTypes.FLOATING;
57
-
58
- return (
59
- <div className="mb-3 w-100">
60
- {!isFloating && label && (
61
- <label htmlFor={inputId} className="form-label">
62
- {label}
63
- {required && <span className="text-danger ms-1">*</span>}
64
- </label>
65
- )}
66
-
67
- {isFloating ? (
68
- <div className="form-floating">
69
- <input
70
- id={inputId}
71
- type={type}
72
- className={inputClasses}
73
- placeholder={placeholder}
74
- disabled={disabled}
75
- readOnly={readOnly}
76
- required={required}
77
- {...rest}
78
- />
79
- {label && (
80
- <label htmlFor={inputId}>
81
- {label}
82
- {required && <span className="text-danger ms-1">*</span>}
83
- </label>
84
- )}
85
- </div>
86
- ) : (
87
- <input
88
- id={inputId}
89
- type={type}
90
- className={inputClasses}
91
- placeholder={placeholder}
92
- disabled={disabled}
93
- readOnly={readOnly}
94
- required={required}
95
- {...rest}
96
- />
97
- )}
98
-
99
- {hasError ? (
100
- <div className="invalid-feedback d-block">{errorMessage}</div>
101
- ) : helperText ? (
102
- <div className="form-text">{helperText}</div>
103
- ) : null}
104
- </div>
105
- );
106
- }
@@ -1,163 +0,0 @@
1
- import React, { useId, useState } from "react";
2
- import { InputTypes } from "../../types/InputTypes";
3
- import { IOSInputStyleTypes } from "../../types/IOS/IOSInputStyleTypes.tsx";
4
- import { IOSInputShapeTypes } from "../../types/IOS/IOSInputShapeTypes.tsx";
5
-
6
- export interface IOSInputProps
7
- extends Omit<React.InputHTMLAttributes<HTMLInputElement>, "type" | "shape"> {
8
- type?: InputTypes;
9
- styleType?: IOSInputStyleTypes;
10
- shape?: IOSInputShapeTypes;
11
- variant?: string;
12
- sizeType?: "sx" | "sm" | "md" | "lg";
13
- label?: string;
14
- required?: boolean;
15
- helperText?: string;
16
- error?: boolean | string;
17
- startIcon?: React.ReactNode;
18
- endIcon?: React.ReactNode;
19
- prefixText?: string;
20
- suffixText?: string;
21
- clearable?: boolean;
22
- }
23
-
24
- export default function IOSInput({
25
- type = InputTypes.TEXT,
26
- styleType = IOSInputStyleTypes.ROUNDED_BORDER,
27
- shape = IOSInputShapeTypes.ROUNDED,
28
- variant = "primary",
29
- sizeType = "md",
30
- label,
31
- required = false,
32
- helperText,
33
- error,
34
- startIcon,
35
- endIcon,
36
- prefixText,
37
- suffixText,
38
- clearable = false,
39
- disabled = false,
40
- readOnly = false,
41
- value,
42
- defaultValue,
43
- onChange,
44
- onFocus,
45
- onBlur,
46
- id,
47
- className = "",
48
- maxLength,
49
- placeholder,
50
- ...rest
51
- }: IOSInputProps) {
52
- const generatedId = useId();
53
- const inputId = id || generatedId;
54
-
55
- const [isFocused, setIsFocused] = useState(false);
56
- const [internalValue, setInternalValue] = useState(value ?? defaultValue ?? "");
57
-
58
- const hasError = Boolean(error);
59
- const errorMessage = typeof error === "string" ? error : undefined;
60
-
61
- const normalizedStyle = String(styleType).toLowerCase().replace(/_/g, "-");
62
- const normalizedShape = String(shape).toLowerCase();
63
-
64
- const containerClasses = [
65
- "ios-input-container",
66
- `ios-variant-${variant}`,
67
- className,
68
- ]
69
- .filter(Boolean)
70
- .join(" ");
71
-
72
- const wrapperClasses = [
73
- "ios-input-wrapper",
74
- `ios-style-${normalizedStyle}`,
75
- `ios-shape-${normalizedShape}`,
76
- `ios-size-${sizeType}`,
77
- isFocused ? "is-focused" : "",
78
- hasError ? "has-error" : "",
79
- disabled ? "is-disabled" : "",
80
- readOnly ? "is-readonly" : "",
81
- ]
82
- .filter(Boolean)
83
- .join(" ");
84
-
85
- const handleFocus = (e: React.FocusEvent<HTMLInputElement>) => {
86
- setIsFocused(true);
87
- if (onFocus) onFocus(e);
88
- };
89
-
90
- const handleBlur = (e: React.FocusEvent<HTMLInputElement>) => {
91
- setIsFocused(false);
92
- if (onBlur) onBlur(e);
93
- };
94
-
95
- const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
96
- setInternalValue(e.target.value);
97
- if (onChange) onChange(e);
98
- };
99
-
100
- const handleClear = () => {
101
- setInternalValue("");
102
- if (onChange) {
103
- const event = {
104
- target: { value: "" },
105
- } as React.ChangeEvent<HTMLInputElement>;
106
- onChange(event);
107
- }
108
- };
109
-
110
- const currentValue = value !== undefined ? value : internalValue;
111
-
112
- return (
113
- <div className={containerClasses}>
114
- {label && (
115
- <label htmlFor={inputId} className="ios-input-label">
116
- {label}
117
- {required && <span className="text-danger ms-1">*</span>}
118
- </label>
119
- )}
120
-
121
- <div className={wrapperClasses}>
122
- {startIcon && <div className="ios-input-icon-left">{startIcon}</div>}
123
- {prefixText && <span className="input-prefix">{prefixText}</span>}
124
-
125
- <input
126
- id={inputId}
127
- type={type}
128
- value={currentValue}
129
- required={required}
130
- disabled={disabled}
131
- readOnly={readOnly}
132
- maxLength={maxLength}
133
- placeholder={placeholder}
134
- onChange={handleChange}
135
- onFocus={handleFocus}
136
- onBlur={handleBlur}
137
- className="ios-input-element"
138
- {...rest}
139
- />
140
-
141
- {clearable && Boolean(currentValue) && !disabled && !readOnly && (
142
- <button
143
- type="button"
144
- className="ios-clear-button"
145
- onClick={handleClear}
146
- tabIndex={-1}
147
- >
148
- <i className="bi bi-x"></i>
149
- </button>
150
- )}
151
-
152
- {suffixText && <span className="input-suffix">{suffixText}</span>}
153
- {endIcon && <div className="ios-input-icon-right">{endIcon}</div>}
154
- </div>
155
-
156
- {hasError ? (
157
- <div className="ios-input-error-text">{errorMessage}</div>
158
- ) : helperText ? (
159
- <div className="ios-input-helper-text">{helperText}</div>
160
- ) : null}
161
- </div>
162
- );
163
- }
@@ -1,81 +0,0 @@
1
- import { type InputHTMLAttributes, type ReactNode } from "react";
2
- import { useLionUI } from "../../context/LionUIComponentsContext.tsx";
3
- import { PlatformTypes } from "../../types/PlatformTypes.tsx";
4
- import type { AndroidStyleTypes } from "../../types/Android/AndroidStyleTypes.tsx";
5
- import type { AndroidShapeTypes } from "../../types/Android/AndroidShapeTypes.tsx";
6
- import type { BootstrapShapeTypes } from "../../types/Web/BootstrapShapeTypes.tsx";
7
- import type { BootstrapStyleTypes } from "../../types/Web/BootstrapStyleTypes.tsx";
8
- import type { IOSShapeTypes } from "../../types/IOS/IOSShapeTypes.tsx";
9
- import type { IOSStyleTypes } from "../../types/IOS/IOSStyleTypes.tsx";
10
- import AndroidInput from "./AndroidInput.tsx";
11
- import IOSInput from "./IOSInput.tsx";
12
- import BootstrapInput from "./BootstrapInput.tsx";
13
-
14
- type PlatformMapping<T> = {
15
- [PlatformTypes.ANDROID]?: T;
16
- [PlatformTypes.IOS]?: T;
17
- [PlatformTypes.WEB]?: T;
18
- };
19
-
20
- export type LionInputProps = Omit<InputHTMLAttributes<HTMLInputElement>, "shape"> & {
21
- variant?: string;
22
- platform?: string;
23
- sizeType?: string;
24
- shape?: BootstrapShapeTypes | AndroidShapeTypes | IOSShapeTypes | string | PlatformMapping<BootstrapShapeTypes | AndroidShapeTypes | IOSShapeTypes | string>;
25
- styleType?: BootstrapStyleTypes | AndroidStyleTypes | IOSStyleTypes | string | PlatformMapping<BootstrapStyleTypes | AndroidStyleTypes | IOSStyleTypes | string>;
26
- label?: string;
27
- required?: boolean;
28
- helperText?: string;
29
- error?: boolean | string;
30
- startIcon?: ReactNode;
31
- endIcon?: ReactNode;
32
- prefixText?: string;
33
- suffixText?: string;
34
- counter?: boolean | number;
35
- clearable?: boolean;
36
- };
37
-
38
- export default function LionInput({
39
- shape,
40
- styleType,
41
- // @ts-ignore
42
- platform = null,
43
- ...props
44
- }: LionInputProps) {
45
- const { state } = useLionUI();
46
-
47
- // Resolve active platform from props or global context
48
- const activePlatform = platform ?? state.platform;
49
-
50
- // Helper function to resolve platform-specific property mappings
51
- const resolvePlatformProp = <T,>(propValue?: T | PlatformMapping<T>): T | undefined => {
52
- if (typeof propValue === "object" && propValue !== null) {
53
- const map = propValue as PlatformMapping<T>;
54
- return map[activePlatform as keyof PlatformMapping<T>] ?? map[activePlatform.toLowerCase() as keyof PlatformMapping<T>];
55
- }
56
- return propValue as T;
57
- };
58
-
59
- const resolvedShape = resolvePlatformProp(shape);
60
- const resolvedStyleType = resolvePlatformProp(styleType);
61
-
62
- const inputProps = {
63
- ...props,
64
- ...(resolvedShape !== undefined && { shape: resolvedShape }),
65
- ...(resolvedStyleType !== undefined && { styleType: resolvedStyleType }),
66
- };
67
-
68
- // Render the appropriate input component based on the active platform
69
- switch (activePlatform) {
70
- case PlatformTypes.ANDROID:
71
- return <AndroidInput {...(inputProps as any)} />;
72
-
73
- case PlatformTypes.IOS:
74
- return <IOSInput {...(inputProps as any)} />;
75
-
76
- case PlatformTypes.WEB:
77
- case PlatformTypes.DESKTOP:
78
- default:
79
- return <BootstrapInput {...(inputProps as any)} />;
80
- }
81
- }
@@ -1,21 +0,0 @@
1
- import {useLionUI} from "../../context/LionUIComponentsContext.tsx";
2
- import {VariantTypes} from "../../types/VariantTypes.tsx";
3
-
4
- export interface LoadingBarProps {
5
- variant?: VariantTypes | string;
6
- }
7
-
8
- export default function LoadingBar({ variant = VariantTypes.PRIMARY }: LoadingBarProps) {
9
- const { state } = useLionUI();
10
-
11
- const normalizedVariant = String(variant).toLowerCase().replace(/_/g, "-");
12
- const variantClass = variant ? `loading-variant-${normalizedVariant}` : "";
13
-
14
- return state.loading ? (
15
- <div className="sticky-top">
16
- <div className={`custom-progress-bar ${variantClass}`}>
17
- <div className="indeterminate"></div>
18
- </div>
19
- </div>
20
- ) : null;
21
- }
@@ -1,155 +0,0 @@
1
- import type { FC, ReactNode } from "react";
2
- import { Button, Modal } from "react-bootstrap";
3
- import { VariantTypes } from "../../types/VariantTypes.tsx";
4
- import { PlatformTypes } from "../../types/PlatformTypes.tsx";
5
- import { ButtonTypes } from "../../types/ButtonTypes.tsx";
6
- import { SizeTypes } from "../../types/SizeTypes.tsx";
7
- import { useLionUI } from "../../context/LionUIComponentsContext.tsx";
8
-
9
- export interface LionModalProps {
10
- modalId: string;
11
- title: string;
12
- body: ReactNode;
13
- buttons?: ReactNode;
14
- backdrop?: string;
15
- fullscreen?: true | "sm" | "md" | "lg" | "xl" | "xxl" | "sm-down" | "md-down" | "lg-down" | "xl-down" | "xxl-down";
16
- // @ts-ignore
17
- size?: SizeTypes.SM | SizeTypes.LG | SizeTypes.XL;
18
- variant?: VariantTypes | string;
19
- platform?: PlatformTypes | string;
20
- cancelButtonIcon?: ReactNode;
21
- cancelButtonText?: string;
22
- }
23
-
24
- export default function LionModal({
25
- modalId,
26
- title,
27
- body,
28
- buttons,
29
- backdrop = "static",
30
- fullscreen = "sm-down",
31
- size = SizeTypes.LG,
32
- variant = VariantTypes.LIGHT,
33
- platform = undefined,
34
- cancelButtonIcon = null,
35
- cancelButtonText = "Cancel",
36
- }: LionModalProps) {
37
- const { state, updateState } = useLionUI();
38
- const platformDefined = platform || state.platform;
39
- const isIOS = platformDefined === PlatformTypes.IOS;
40
- const isAndroid = platformDefined === PlatformTypes.ANDROID;
41
-
42
- const modalPlatformClass = isIOS
43
- ? "ios-modal"
44
- : isAndroid
45
- ? "android-modal"
46
- : "web-modal";
47
-
48
- const getHeaderTextColor = (variantType: VariantTypes | string | undefined): string => {
49
- switch (variantType) {
50
- case VariantTypes.LIGHT:
51
- case VariantTypes.LINK:
52
- case VariantTypes.WARNING:
53
- case VariantTypes.INFO:
54
- return "text-dark";
55
- case VariantTypes.PRIMARY:
56
- case VariantTypes.SECONDARY:
57
- case VariantTypes.SUCCESS:
58
- case VariantTypes.DANGER:
59
- case VariantTypes.DARK:
60
- case VariantTypes.LION_GLAM:
61
- case VariantTypes.LION_TECH:
62
- case VariantTypes.LION_PACKAGES:
63
- case VariantTypes.LION_PARKING:
64
- default:
65
- return "text-white";
66
- }
67
- };
68
-
69
- const getCancelButtonTextColor = (variantType: VariantTypes | string | undefined): string => {
70
- switch (variantType) {
71
- case VariantTypes.LIGHT:
72
- case VariantTypes.LINK:
73
- case VariantTypes.DARK:
74
- case VariantTypes.MODAL:
75
- return "text-dark";
76
- case VariantTypes.WARNING:
77
- return "text-warning";
78
- case VariantTypes.PRIMARY:
79
- return "text-primary";
80
- case VariantTypes.INFO:
81
- return "text-info";
82
- case VariantTypes.SECONDARY:
83
- return "text-secondary";
84
- case VariantTypes.DANGER:
85
- return "text-danger";
86
- case VariantTypes.SUCCESS:
87
- return "text-success";
88
- case VariantTypes.LION_PARKING:
89
- case VariantTypes.LION_PACKAGES:
90
- return "text-lion-packages";
91
- case VariantTypes.LION_TECH:
92
- return "text-lion-tech";
93
- case VariantTypes.LION_GLAM:
94
- return "text-lion-glam";
95
- default:
96
- return "text-white";
97
- }
98
- };
99
-
100
- const textColorClass = getHeaderTextColor(variant);
101
- const cancelTextColorClass = getCancelButtonTextColor(variant);
102
-
103
- const CancelButton: FC = () => (
104
- <Button
105
- // @ts-ignore
106
- type={ButtonTypes.BUTTON}
107
- variant={VariantTypes.MODAL}
108
- id={"modal-cancel-button"}
109
- className={`btn-modal btn-modal-cancel ${cancelTextColorClass}`}
110
- onClick={() => updateState({ modal: null })}
111
- disabled={state.reload || state.loading}
112
- >
113
- {cancelButtonIcon ?? cancelButtonText}
114
- </Button>
115
- );
116
-
117
- return (
118
- <Modal
119
- // @ts-ignore
120
- backdrop={backdrop}
121
- id={modalId}
122
- show={modalId === state.modal}
123
- fullscreen={fullscreen}
124
- onHide={() => updateState({ modal: null })}
125
- size={size}
126
- scrollable
127
- centered
128
- className={modalPlatformClass}
129
- >
130
- <Modal.Header
131
- closeButton={!state.reload || !state.loading}
132
- className={`custom-modal-header py-3 px-4 bg-${variant} ${textColorClass}`}
133
- >
134
- <Modal.Title
135
- className={`custom-modal-title w-100 ${textColorClass} ${
136
- isIOS ? "text-center fw-semibold" : "text-start fw-bold"
137
- }`}
138
- >
139
- {title}
140
- </Modal.Title>
141
- </Modal.Header>
142
-
143
- <Modal.Body className="custom-modal-body px-4 py-3">
144
- {modalId === state.modal ? body : null}
145
- </Modal.Body>
146
-
147
- <Modal.Footer className="custom-modal-footer p-0">
148
- <div className="custom-btn-group w-100 d-flex align-items-stretch">
149
- <CancelButton />
150
- {buttons}
151
- </div>
152
- </Modal.Footer>
153
- </Modal>
154
- );
155
- }
@@ -1,73 +0,0 @@
1
- import { createContext, type FC, useContext, useEffect, useState } from 'react';
2
- import { Capacitor } from '@capacitor/core';
3
- import { PlatformTypes } from "../types/PlatformTypes.tsx";
4
- import type { LionUIContextProps } from "../interfaces/LionUIContextProps.tsx";
5
- import type { LionUIComponentsProviderProps } from "../interfaces/LionUIComponentsProviderProps.tsx";
6
- import type { LionUIState } from "../interfaces/LionUIState.tsx";
7
-
8
- const LionUIComponentsContext = createContext<LionUIContextProps | undefined>(undefined);
9
-
10
- export const LionUIComponentsProvider: FC<LionUIComponentsProviderProps> = ({
11
- children,
12
- defaultPlatform,
13
- }) => {
14
- const [state, setState] = useState<LionUIState>(() => {
15
- let initialPlatform: PlatformTypes = PlatformTypes.WEB;
16
-
17
- if (defaultPlatform) {
18
- initialPlatform = defaultPlatform;
19
- } else {
20
- const capPlatform = Capacitor.getPlatform();
21
- if (capPlatform === PlatformTypes.IOS || capPlatform === PlatformTypes.ANDROID) {
22
- initialPlatform = capPlatform as PlatformTypes;
23
- }
24
- }
25
-
26
- return {
27
- platform: initialPlatform,
28
- loading: false,
29
- reload: false,
30
- booting: false,
31
- sidebar: false,
32
- version: null,
33
- modal: null,
34
- logo: null,
35
- background: null,
36
- };
37
- });
38
-
39
- const updateState = (partial: Partial<LionUIState>) => {
40
- setState((prev) => ({ ...prev, ...partial }));
41
- };
42
-
43
- useEffect(() => {
44
- if (!defaultPlatform) {
45
- const capPlatform = Capacitor.getPlatform();
46
-
47
- const detected: PlatformTypes =
48
- capPlatform === PlatformTypes.IOS || capPlatform === PlatformTypes.ANDROID
49
- ? (capPlatform as PlatformTypes)
50
- : PlatformTypes.WEB;
51
-
52
- if (detected !== state.platform) {
53
- setState((prev) => ({ ...prev, platform: detected }));
54
- }
55
- }
56
- }, [defaultPlatform, state.platform]);
57
-
58
- return (
59
- <LionUIComponentsContext.Provider value={{ state, updateState }}>
60
- {children}
61
- </LionUIComponentsContext.Provider>
62
- );
63
- };
64
-
65
- export const useLionUI = (): LionUIContextProps => {
66
- const context = useContext(LionUIComponentsContext);
67
-
68
- if (!context) {
69
- throw new Error('useLionUI debe ser utilizado dentro de un LionUIComponentsProvider');
70
- }
71
-
72
- return context;
73
- };
@@ -1,83 +0,0 @@
1
- import Container from 'react-bootstrap/Container';
2
- import Nav from 'react-bootstrap/Nav';
3
- import Navbar from 'react-bootstrap/Navbar';
4
- import NavDropdown from 'react-bootstrap/NavDropdown';
5
- import {Link} from "react-router-dom";
6
-
7
- export default function Header() {
8
- return (
9
- <Navbar expand="lg" className="bg-body-tertiary">
10
- <Container>
11
- <Navbar.Brand as={Link} to={"/"} href={"#"}>
12
- Lion-UI
13
- </Navbar.Brand>
14
-
15
- <Navbar.Toggle aria-controls="lion-ui-navbar-nav" />
16
-
17
- <Navbar.Collapse id="lion-ui-navbar-nav">
18
- <Nav className="ms-auto">
19
- <NavDropdown title="Buttons" id="buttons-nav-dropdown">
20
- <NavDropdown.Item as={Link} to={"/buttons/custom"} href={"#"}>
21
- Custom
22
- </NavDropdown.Item>
23
-
24
- <NavDropdown.Divider />
25
-
26
- <NavDropdown.Item as={Link} to={"/buttons/android"} href={"#"}>
27
- Android
28
- </NavDropdown.Item>
29
-
30
- <NavDropdown.Item as={Link} to={"/buttons/ios"} href={"#"}>
31
- IOS
32
- </NavDropdown.Item>
33
-
34
- <NavDropdown.Item as={Link} to={"/buttons/web"} href={"#"}>
35
- Web
36
- </NavDropdown.Item>
37
- </NavDropdown>
38
-
39
- <NavDropdown title="Inputs" id="inputs-nav-dropdown">
40
- <NavDropdown.Item as={Link} to={"/inputs/custom"} href={"#"}>
41
- Custom
42
- </NavDropdown.Item>
43
-
44
- <NavDropdown.Divider />
45
-
46
- <NavDropdown.Item as={Link} to={"/inputs/android"} href={"#"}>
47
- Android
48
- </NavDropdown.Item>
49
-
50
- <NavDropdown.Item as={Link} to={"/inputs/ios"} href={"#"}>
51
- IOS
52
- </NavDropdown.Item>
53
-
54
- <NavDropdown.Item as={Link} to={"/inputs/web"} href={"#"}>
55
- Web
56
- </NavDropdown.Item>
57
- </NavDropdown>
58
-
59
- <NavDropdown title="Modals" id="modals-nav-dropdown">
60
- <NavDropdown.Item as={Link} to={"/modals/android"} href={"#"}>
61
- Android
62
- </NavDropdown.Item>
63
-
64
- <NavDropdown.Item as={Link} to={"/modals/ios"} href={"#"}>
65
- IOS
66
- </NavDropdown.Item>
67
-
68
- <NavDropdown.Item as={Link} to={"/modals/web"} href={"#"}>
69
- Web
70
- </NavDropdown.Item>
71
- </NavDropdown>
72
-
73
- <NavDropdown title="Loadings" id="loadings-nav-dropdown">
74
- <NavDropdown.Item as={Link} to={"/loadings/bar"} href={"#"}>
75
- Bar
76
- </NavDropdown.Item>
77
- </NavDropdown>
78
- </Nav>
79
- </Navbar.Collapse>
80
- </Container>
81
- </Navbar>
82
- );
83
- }