@lion-npm/ui 0.0.0-stage → 1.0.2

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 (78) hide show
  1. package/.oxlintrc.json +8 -0
  2. package/AGENTS.md +0 -0
  3. package/Dockerfile +7 -0
  4. package/LICENSE +21 -0
  5. package/README.md +31 -2
  6. package/compose.yml +14 -0
  7. package/index.html +15 -0
  8. package/package.json +27 -4
  9. package/public/favicon.svg +1 -0
  10. package/public/icons.svg +24 -0
  11. package/src/App.tsx +84 -0
  12. package/src/assets/css/buttons/buttons-android.css +251 -0
  13. package/src/assets/css/buttons/buttons-ios.css +213 -0
  14. package/src/assets/css/buttons/buttons-web.css +138 -0
  15. package/src/assets/css/custom.css +8 -0
  16. package/src/assets/css/index.css +60 -0
  17. package/src/assets/css/inputs/inputs-android.css +259 -0
  18. package/src/assets/css/inputs/inputs-bootstrap.css +74 -0
  19. package/src/assets/css/inputs/inputs-ios.css +268 -0
  20. package/src/assets/css/loadings/loading-bar.css +86 -0
  21. package/src/assets/css/modals/modals.css +236 -0
  22. package/src/components/buttons/AndroidButton.tsx +43 -0
  23. package/src/components/buttons/BootstrapButton.tsx +50 -0
  24. package/src/components/buttons/IOSButton.tsx +42 -0
  25. package/src/components/buttons/LionButton.tsx +73 -0
  26. package/src/components/inputs/AndroidInput.tsx +158 -0
  27. package/src/components/inputs/BootstrapInput.tsx +106 -0
  28. package/src/components/inputs/IOSInput.tsx +163 -0
  29. package/src/components/inputs/LionInput.tsx +81 -0
  30. package/src/components/loadings/LoadingBar.tsx +21 -0
  31. package/src/components/modals/LionModal.tsx +155 -0
  32. package/src/context/LionUIComponentsContext.tsx +73 -0
  33. package/src/features/Header.tsx +83 -0
  34. package/src/features/VariantList.tsx +19 -0
  35. package/src/features/buttons/ButtonsSection.tsx +7 -0
  36. package/src/features/buttons/components/ButtonsAndroidSection.tsx +79 -0
  37. package/src/features/buttons/components/ButtonsBootstrapSection.tsx +77 -0
  38. package/src/features/buttons/components/ButtonsCustomSection.tsx +234 -0
  39. package/src/features/buttons/components/ButtonsIOSSection.tsx +78 -0
  40. package/src/features/inputs/InputsSection.tsx +7 -0
  41. package/src/features/inputs/components/InputsAndroidSection.tsx +155 -0
  42. package/src/features/inputs/components/InputsBootstrapSection.tsx +154 -0
  43. package/src/features/inputs/components/InputsCustomSection.tsx +234 -0
  44. package/src/features/inputs/components/InputsIOSSection.tsx +156 -0
  45. package/src/features/loadings/LoadingSection.tsx +5 -0
  46. package/src/features/loadings/components/LoadingBarSection.tsx +74 -0
  47. package/src/features/modals/ModalsSection.tsx +5 -0
  48. package/src/features/modals/components/ModalsAndroidSection.tsx +108 -0
  49. package/src/features/modals/components/ModalsDefaultForm.tsx +31 -0
  50. package/src/features/modals/components/ModalsDefaultInput.tsx +22 -0
  51. package/src/features/modals/components/ModalsIOSSection.tsx +106 -0
  52. package/src/features/modals/components/ModalsWebSection.tsx +104 -0
  53. package/src/index.ts +27 -0
  54. package/src/interfaces/LionUIComponentsProviderProps.tsx +7 -0
  55. package/src/interfaces/LionUIContextProps.tsx +6 -0
  56. package/src/interfaces/LionUIState.tsx +13 -0
  57. package/src/main.tsx +9 -0
  58. package/src/types/Android/AndroidInputShapeTypes.tsx +7 -0
  59. package/src/types/Android/AndroidInputStyleTypes.tsx +7 -0
  60. package/src/types/Android/AndroidShapeTypes.tsx +6 -0
  61. package/src/types/Android/AndroidStyleTypes.tsx +9 -0
  62. package/src/types/ButtonTypes.tsx +9 -0
  63. package/src/types/IOS/IOSInputShapeTypes.tsx +9 -0
  64. package/src/types/IOS/IOSInputStyleTypes.tsx +11 -0
  65. package/src/types/IOS/IOSShapeTypes.tsx +7 -0
  66. package/src/types/IOS/IOSStyleTypes.tsx +9 -0
  67. package/src/types/InputTypes.tsx +13 -0
  68. package/src/types/PlatformTypes.tsx +9 -0
  69. package/src/types/SizeTypes.tsx +11 -0
  70. package/src/types/VariantTypes.tsx +19 -0
  71. package/src/types/Web/BootstrapInputShapeTypes.tsx +9 -0
  72. package/src/types/Web/BootstrapInputStyleTypes.tsx +8 -0
  73. package/src/types/Web/BootstrapShapeTypes.tsx +8 -0
  74. package/src/types/Web/BootstrapStyleTypes.tsx +7 -0
  75. package/tsconfig.app.json +26 -0
  76. package/tsconfig.json +7 -0
  77. package/tsconfig.node.json +23 -0
  78. package/vite.config.ts +30 -0
@@ -0,0 +1,234 @@
1
+ import VariantList from "../../VariantList.tsx";
2
+ import { PlatformTypes } from "../../../types/PlatformTypes.tsx";
3
+ import { InputTypes } from "../../../types/InputTypes.tsx";
4
+ import { AndroidInputStyleTypes } from "../../../types/Android/AndroidInputStyleTypes.tsx";
5
+ import { IOSInputStyleTypes } from "../../../types/IOS/IOSInputStyleTypes.tsx";
6
+ import { BootstrapInputStyleTypes } from "../../../types/Web/BootstrapInputStyleTypes.tsx";
7
+ import { AndroidInputShapeTypes } from "../../../types/Android/AndroidInputShapeTypes.tsx";
8
+ import { BootstrapInputShapeTypes } from "../../../types/Web/BootstrapInputShapeTypes.tsx";
9
+ import { IOSInputShapeTypes } from "../../../types/IOS/IOSInputShapeTypes.tsx";
10
+ import { Fragment, useState } from "react";
11
+ import LionInput from "../../../components/inputs/LionInput.tsx";
12
+
13
+ const shapesByPlatform = {
14
+ [PlatformTypes.ANDROID]: [
15
+ { label: "Small", value: AndroidInputShapeTypes.SMALL },
16
+ { label: "Normal", value: AndroidInputShapeTypes.NORMAL },
17
+ ],
18
+ [PlatformTypes.IOS]: [
19
+ { label: "Rounded", value: IOSInputShapeTypes.ROUNDED },
20
+ { label: "Pill", value: IOSInputShapeTypes.PILL },
21
+ { label: "Square", value: IOSInputShapeTypes.SQUARE },
22
+ ],
23
+ [PlatformTypes.WEB]: [
24
+ { label: "Rounded", value: BootstrapInputShapeTypes.ROUNDED },
25
+ { label: "Pill", value: BootstrapInputShapeTypes.PILL },
26
+ { label: "Square", value: BootstrapInputShapeTypes.SQUARE },
27
+ ],
28
+ };
29
+
30
+ const stylesByPlatform = {
31
+ [PlatformTypes.ANDROID]: [
32
+ { label: "Outlined", value: AndroidInputStyleTypes.OUTLINED },
33
+ { label: "Filled", value: AndroidInputStyleTypes.FILLED },
34
+ ],
35
+ [PlatformTypes.IOS]: [
36
+ { label: "Form", value: IOSInputStyleTypes.FORM },
37
+ { label: "Rounded Border", value: IOSInputStyleTypes.ROUNDED_BORDER },
38
+ { label: "Filled", value: IOSInputStyleTypes.FILLED },
39
+ { label: "Outlined", value: IOSInputStyleTypes.OUTLINED },
40
+ { label: "Plain", value: IOSInputStyleTypes.PLAIN },
41
+ ],
42
+ [PlatformTypes.WEB]: [
43
+ { label: "Floating", value: BootstrapInputStyleTypes.FLOATING },
44
+ { label: "Standard", value: BootstrapInputStyleTypes.STANDARD },
45
+ ],
46
+ };
47
+
48
+ export default function InputsCustomSection() {
49
+ const [selectedPlatform, setSelectedPlatform] = useState<PlatformTypes>(PlatformTypes.ANDROID);
50
+ const [selectedAndroidShape, setSelectedAndroidShape] = useState<AndroidInputShapeTypes>(AndroidInputShapeTypes.NORMAL);
51
+ const [selectedIOSShape, setSelectedIOSShape] = useState<IOSInputShapeTypes>(IOSInputShapeTypes.ROUNDED);
52
+ const [selectedWebShape, setSelectedWebShape] = useState<BootstrapInputShapeTypes>(BootstrapInputShapeTypes.ROUNDED);
53
+
54
+ const [selectedAndroidStyle, setSelectedAndroidStyle] = useState<AndroidInputStyleTypes>(AndroidInputStyleTypes.OUTLINED);
55
+ const [selectedIOSStyle, setSelectedIOSStyle] = useState<IOSInputStyleTypes>(IOSInputStyleTypes.ROUNDED_BORDER);
56
+ const [selectedWebStyle, setSelectedWebStyle] = useState<BootstrapInputStyleTypes>(BootstrapInputStyleTypes.FLOATING);
57
+
58
+ return (
59
+ <Fragment>
60
+ <h2>Inputs (Custom Cross-Platform Test)</h2>
61
+
62
+ <div className="card p-3 mb-4 bg-light">
63
+ <div className="row g-3">
64
+ <div className="col-md-4">
65
+ <label className="form-label fw-bold">Platform:</label>
66
+ <div className="btn-group w-100" role="group">
67
+ <button
68
+ type="button"
69
+ className={`btn ${selectedPlatform === PlatformTypes.ANDROID ? "btn-primary" : "btn-outline-primary"}`}
70
+ onClick={() => setSelectedPlatform(PlatformTypes.ANDROID)}
71
+ >
72
+ Android
73
+ </button>
74
+ <button
75
+ type="button"
76
+ className={`btn ${selectedPlatform === PlatformTypes.IOS ? "btn-primary" : "btn-outline-primary"}`}
77
+ onClick={() => setSelectedPlatform(PlatformTypes.IOS)}
78
+ >
79
+ iOS
80
+ </button>
81
+ <button
82
+ type="button"
83
+ className={`btn ${selectedPlatform === PlatformTypes.WEB ? "btn-primary" : "btn-outline-primary"}`}
84
+ onClick={() => setSelectedPlatform(PlatformTypes.WEB)}
85
+ >
86
+ Web
87
+ </button>
88
+ </div>
89
+ </div>
90
+
91
+ <div className="col-md-4">
92
+ <label className="form-label fw-bold">Shape:</label>
93
+
94
+ {selectedPlatform === PlatformTypes.ANDROID && (
95
+ <select
96
+ className="form-select"
97
+ value={selectedAndroidShape}
98
+ onChange={(e) => setSelectedAndroidShape(e.target.value as AndroidInputShapeTypes)}
99
+ >
100
+ {shapesByPlatform[PlatformTypes.ANDROID].map((s) => (
101
+ <option key={s.value} value={s.value}>{s.label}</option>
102
+ ))}
103
+ </select>
104
+ )}
105
+
106
+ {selectedPlatform === PlatformTypes.IOS && (
107
+ <select
108
+ className="form-select"
109
+ value={selectedIOSShape}
110
+ onChange={(e) => setSelectedIOSShape(e.target.value as IOSInputShapeTypes)}
111
+ >
112
+ {shapesByPlatform[PlatformTypes.IOS].map((s) => (
113
+ <option key={s.value} value={s.value}>{s.label}</option>
114
+ ))}
115
+ </select>
116
+ )}
117
+
118
+ {selectedPlatform === PlatformTypes.WEB && (
119
+ <select
120
+ className="form-select"
121
+ value={selectedWebShape}
122
+ onChange={(e) => setSelectedWebShape(e.target.value as BootstrapInputShapeTypes)}
123
+ >
124
+ {shapesByPlatform[PlatformTypes.WEB].map((s) => (
125
+ <option key={s.value} value={s.value}>{s.label}</option>
126
+ ))}
127
+ </select>
128
+ )}
129
+ </div>
130
+
131
+ <div className="col-md-4">
132
+ <label className="form-label fw-bold">StyleType:</label>
133
+ {selectedPlatform === PlatformTypes.ANDROID && (
134
+ <select
135
+ className="form-select"
136
+ value={selectedAndroidStyle}
137
+ onChange={(e) => setSelectedAndroidStyle(e.target.value as AndroidInputStyleTypes)}
138
+ >
139
+ {stylesByPlatform[PlatformTypes.ANDROID].map((s) => (
140
+ <option key={s.value} value={s.value}>{s.label}</option>
141
+ ))}
142
+ </select>
143
+ )}
144
+
145
+ {selectedPlatform === PlatformTypes.IOS && (
146
+ <select
147
+ className="form-select"
148
+ value={selectedIOSStyle}
149
+ onChange={(e) => setSelectedIOSStyle(e.target.value as IOSInputStyleTypes)}
150
+ >
151
+ {stylesByPlatform[PlatformTypes.IOS].map((s) => (
152
+ <option key={s.value} value={s.value}>{s.label}</option>
153
+ ))}
154
+ </select>
155
+ )}
156
+
157
+ {selectedPlatform === PlatformTypes.WEB && (
158
+ <select
159
+ className="form-select"
160
+ value={selectedWebStyle}
161
+ onChange={(e) => setSelectedWebStyle(e.target.value as BootstrapInputStyleTypes)}
162
+ >
163
+ {stylesByPlatform[PlatformTypes.WEB].map((s) => (
164
+ <option key={s.value} value={s.value}>{s.label}</option>
165
+ ))}
166
+ </select>
167
+ )}
168
+ </div>
169
+ </div>
170
+ </div>
171
+
172
+ <div className="my-4">
173
+ <div className="ms-3 mb-4">
174
+ {/* Enabled State */}
175
+ <div className="mb-4">
176
+ <span className="text-muted d-block mb-2 small fw-bold">Enabled</span>
177
+ <div className="row g-3">
178
+ {VariantList.map((variant) => (
179
+ <div key={`custom-input-${variant}-enabled`} className="col-md-4">
180
+ <LionInput
181
+ type={InputTypes.TEXT}
182
+ platform={selectedPlatform}
183
+ variant={variant}
184
+ label={`${variant} input`}
185
+ placeholder="Enter text..."
186
+ styleType={{
187
+ android: selectedAndroidStyle,
188
+ ios: selectedIOSStyle,
189
+ web: selectedWebStyle,
190
+ }}
191
+ shape={{
192
+ android: selectedAndroidShape,
193
+ ios: selectedIOSShape,
194
+ web: selectedWebShape,
195
+ }}
196
+ />
197
+ </div>
198
+ ))}
199
+ </div>
200
+ </div>
201
+
202
+ {/* Disabled State */}
203
+ <div>
204
+ <span className="text-muted d-block mb-2 small fw-bold">Disabled</span>
205
+ <div className="row g-3">
206
+ {VariantList.map((variant) => (
207
+ <div key={`custom-input-${variant}-disabled`} className="col-md-4">
208
+ <LionInput
209
+ type={InputTypes.TEXT}
210
+ platform={selectedPlatform}
211
+ variant={variant}
212
+ label={`${variant} input`}
213
+ placeholder="Disabled..."
214
+ disabled={true}
215
+ styleType={{
216
+ android: selectedAndroidStyle,
217
+ ios: selectedIOSStyle,
218
+ web: selectedWebStyle,
219
+ }}
220
+ shape={{
221
+ android: selectedAndroidShape,
222
+ ios: selectedIOSShape,
223
+ web: selectedWebShape,
224
+ }}
225
+ />
226
+ </div>
227
+ ))}
228
+ </div>
229
+ </div>
230
+ </div>
231
+ </div>
232
+ </Fragment>
233
+ );
234
+ }
@@ -0,0 +1,156 @@
1
+ import VariantList from "../../VariantList.tsx";
2
+ import { IOSInputStyleTypes } from "../../../types/IOS/IOSInputStyleTypes.tsx";
3
+ import { IOSInputShapeTypes } from "../../../types/IOS/IOSInputShapeTypes.tsx";
4
+ import { InputTypes } from "../../../types/InputTypes.tsx";
5
+
6
+ import { Fragment, useState } from "react";
7
+ import IOSInput from "../../../components/inputs/IOSInput.tsx";
8
+
9
+ const StyleTypeList: Array<{ label: string; styleType: IOSInputStyleTypes }> = [
10
+ { label: "Form", styleType: IOSInputStyleTypes.FORM },
11
+ { label: "Rounded Border", styleType: IOSInputStyleTypes.ROUNDED_BORDER },
12
+ ];
13
+
14
+ const ShapeList: Array<{ label: string; shape: IOSInputShapeTypes }> = [
15
+ { label: "Rounded Shape", shape: IOSInputShapeTypes.ROUNDED },
16
+ { label: "Pill Shape", shape: IOSInputShapeTypes.PILL },
17
+ { label: "Square Shape", shape: IOSInputShapeTypes.SQUARE },
18
+ ];
19
+
20
+ export default function InputsIOSSection() {
21
+ const [inputValue, setInputValue] = useState<string>("");
22
+
23
+ const handleChange = (e: React.ChangeEvent<HTMLInputElement>) => {
24
+ setInputValue(e.target.value);
25
+ };
26
+
27
+ return (
28
+ <Fragment>
29
+ <h2>Inputs (iOS SwiftUI)</h2>
30
+
31
+ {StyleTypeList.map(({ label: styleLabel, styleType }) => (
32
+ <div key={styleType} className="my-4">
33
+ <h4 className="text-primary mb-3">{styleLabel} Inputs</h4>
34
+
35
+ {ShapeList.map(({ label: shapeLabel, shape }) => (
36
+ <div key={`${styleType}-${shape}`} className="mb-5">
37
+ <div className={"ms-3"}>
38
+ <h6 className="text-secondary mb-3">{shapeLabel}</h6>
39
+ </div>
40
+
41
+ {/* Enabled State */}
42
+ <div className="mb-4">
43
+ <span className="text-muted d-block mb-2 small font-monospace">Enabled</span>
44
+ <div className="row g-3">
45
+ {VariantList.map((variant) => (
46
+ <div key={`${styleType}-${shape}-${variant}-enabled`} className="col-12 col-md-6 col-lg-4">
47
+ <IOSInput
48
+ type={InputTypes.TEXT}
49
+ styleType={styleType}
50
+ shape={shape}
51
+ variant={variant}
52
+ label={`Label (${variant})`}
53
+ helperText="Texto de ayuda opcional"
54
+ required={true}
55
+ placeholder="Custom Placeholder..."
56
+ value={inputValue}
57
+ onChange={handleChange}
58
+ />
59
+ </div>
60
+ ))}
61
+ </div>
62
+ </div>
63
+
64
+ {/* With Value / Floating State */}
65
+ <div className="mb-4">
66
+ <span className="text-muted d-block mb-2 small font-monospace">With Value / Floating</span>
67
+ <div className="row g-3">
68
+ {VariantList.map((variant) => (
69
+ <div key={`${styleType}-${shape}-${variant}-value`} className="col-12 col-md-6 col-lg-4">
70
+ <IOSInput
71
+ type={InputTypes.TEXT}
72
+ styleType={styleType}
73
+ shape={shape}
74
+ variant={variant}
75
+ label="Usuario"
76
+ defaultValue="lion.developer"
77
+ helperText="Campo completado"
78
+ placeholder="Custom Placeholder..."
79
+ autoComplete="off"
80
+ />
81
+ </div>
82
+ ))}
83
+ </div>
84
+ </div>
85
+
86
+ {/* Error State */}
87
+ <div className="mb-4">
88
+ <span className="text-muted d-block mb-2 small font-monospace">Error State</span>
89
+ <div className="row g-3">
90
+ {VariantList.map((variant) => (
91
+ <div key={`${styleType}-${shape}-${variant}-error`} className="col-12 col-md-6 col-lg-4">
92
+ <IOSInput
93
+ type={InputTypes.TEXT}
94
+ styleType={styleType}
95
+ shape={shape}
96
+ variant={variant}
97
+ label="Correo electrónico"
98
+ defaultValue="correo-invalido"
99
+ error="El formato del correo no es válido"
100
+ placeholder="Custom Placeholder..."
101
+ />
102
+ </div>
103
+ ))}
104
+ </div>
105
+ </div>
106
+
107
+ {/* Disabled State */}
108
+ <div className="mb-4">
109
+ <span className="text-muted d-block mb-2 small font-monospace">Disabled</span>
110
+ <div className="row g-3">
111
+ {VariantList.map((variant) => (
112
+ <div key={`${styleType}-${shape}-${variant}-disabled`} className="col-12 col-md-6 col-lg-4">
113
+ <IOSInput
114
+ type={InputTypes.TEXT}
115
+ styleType={styleType}
116
+ shape={shape}
117
+ variant={variant}
118
+ label="Deshabilitado"
119
+ defaultValue="Valor bloqueado"
120
+ disabled={true}
121
+ helperText="No editable"
122
+ placeholder="Custom Placeholder..."
123
+ />
124
+ </div>
125
+ ))}
126
+ </div>
127
+ </div>
128
+
129
+ {/* Readonly State */}
130
+ <div>
131
+ <span className="text-muted d-block mb-2 small font-monospace">ReadOnly</span>
132
+ <div className="row g-3">
133
+ {VariantList.map((variant) => (
134
+ <div key={`${styleType}-${shape}-${variant}-readonly`} className="col-12 col-md-6 col-lg-4">
135
+ <IOSInput
136
+ type={InputTypes.TEXT}
137
+ styleType={styleType}
138
+ shape={shape}
139
+ variant={variant}
140
+ label="ReadOnly"
141
+ defaultValue="Valor bloqueado"
142
+ readOnly={true}
143
+ helperText="No editable"
144
+ placeholder="Custom Placeholder..."
145
+ />
146
+ </div>
147
+ ))}
148
+ </div>
149
+ </div>
150
+ </div>
151
+ ))}
152
+ </div>
153
+ ))}
154
+ </Fragment>
155
+ );
156
+ }
@@ -0,0 +1,5 @@
1
+ import { Outlet } from "react-router-dom";
2
+
3
+ export default function LoadingSection() {
4
+ return <Outlet />
5
+ }
@@ -0,0 +1,74 @@
1
+ import { Fragment, useState } from "react";
2
+ import { ButtonTypes } from "../../../types/ButtonTypes.tsx";
3
+ import { VariantTypes } from "../../../types/VariantTypes.tsx";
4
+ import { PlatformTypes } from "../../../types/PlatformTypes.tsx";
5
+ import { useLionUI } from "../../../context/LionUIComponentsContext.tsx";
6
+ import LionButton from "../../../components/buttons/LionButton.tsx";
7
+ import LoadingBar from "../../../components/loadings/LoadingBar.tsx";
8
+
9
+ const variantsList = [
10
+ { type: VariantTypes.SUCCESS, name: "Success" },
11
+ { type: VariantTypes.INFO, name: "Info" },
12
+ { type: VariantTypes.PRIMARY, name: "Primary" },
13
+ { type: VariantTypes.DANGER, name: "Danger" },
14
+ { type: VariantTypes.WARNING, name: "Warning" },
15
+ { type: VariantTypes.LIGHT, name: "Light" },
16
+ { type: VariantTypes.LINK, name: "Link" },
17
+ { type: VariantTypes.DARK, name: "Dark" },
18
+ { type: VariantTypes.LION_PACKAGES, name: "Lion Packages" },
19
+ { type: VariantTypes.LION_PARKING, name: "Lion Parking" },
20
+ { type: VariantTypes.LION_TECH, name: "Lion Tech" },
21
+ { type: VariantTypes.LION_GLAM, name: "Lion Glam" },
22
+ ];
23
+
24
+ export default function LoadingBarSection() {
25
+ const { updateState } = useLionUI();
26
+
27
+ // Local state exclusively for this section's testing demo
28
+ const [isLoading, setIsLoading] = useState<boolean>(false);
29
+ const [activeVariant, setActiveVariant] = useState<VariantTypes | string>(VariantTypes.PRIMARY);
30
+
31
+ // Trigger local loading state for 5 seconds simulation
32
+ const handleTriggerLoading = (variant: VariantTypes | string) => {
33
+ setActiveVariant(variant);
34
+ setIsLoading(true);
35
+
36
+ // Also update global loading if needed by the LoadingBar component, or handle it locally
37
+ updateState({ loading: true });
38
+
39
+ // Automatically disable loading after 5 seconds
40
+ setTimeout(() => {
41
+ setIsLoading(false);
42
+ updateState({ loading: false });
43
+ }, 5000);
44
+ };
45
+
46
+ return (
47
+ <Fragment>
48
+ <h2>Loading Bar Demonstrations</h2>
49
+ <p className="text-muted">Click any button below to trigger the loading bar for 5 seconds using its respective variant.</p>
50
+
51
+ {/* Top demonstration loading bar container using local state variant */}
52
+ <div className="mb-4" style={{ minHeight: "10px" }}>
53
+ <LoadingBar variant={activeVariant} />
54
+ </div>
55
+
56
+ <div className="d-flex gap-3 flex-wrap">
57
+ {variantsList.map((variantObj) => (
58
+ <LionButton
59
+ key={variantObj.type}
60
+ platform={PlatformTypes.WEB}
61
+ variant={variantObj.type}
62
+ type={ButtonTypes.BUTTON}
63
+ disabled={isLoading}
64
+ onClick={() => handleTriggerLoading(variantObj.type)}
65
+ >
66
+ {isLoading && activeVariant === variantObj.type
67
+ ? "Loading..."
68
+ : `Test ${variantObj.name}`}
69
+ </LionButton>
70
+ ))}
71
+ </div>
72
+ </Fragment>
73
+ );
74
+ }
@@ -0,0 +1,5 @@
1
+ import { Outlet } from "react-router-dom";
2
+
3
+ export default function ModalsSection() {
4
+ return <Outlet />
5
+ }
@@ -0,0 +1,108 @@
1
+ import { Fragment } from "react";
2
+ import { ButtonTypes } from "../../../types/ButtonTypes.tsx";
3
+ import { AndroidShapeTypes } from "../../../types/Android/AndroidShapeTypes.tsx";
4
+ import { AndroidStyleTypes } from "../../../types/Android/AndroidStyleTypes.tsx";
5
+ import { VariantTypes } from "../../../types/VariantTypes.tsx";
6
+ import { PlatformTypes } from "../../../types/PlatformTypes.tsx";
7
+ import { SizeTypes } from "../../../types/SizeTypes.tsx";
8
+ import { useLionUI } from "../../../context/LionUIComponentsContext.tsx";
9
+ import LionModal from "../../../components/modals/LionModal.tsx";
10
+ import ModalsDefaultForm from "./ModalsDefaultForm.tsx";
11
+ import LionButton from "../../../components/buttons/LionButton.tsx";
12
+
13
+ const variantsList = [
14
+ { type: VariantTypes.SUCCESS, name: "Success" },
15
+ { type: VariantTypes.INFO, name: "Info" },
16
+ { type: VariantTypes.PRIMARY, name: "Primary" },
17
+ { type: VariantTypes.DANGER, name: "Danger" },
18
+ { type: VariantTypes.WARNING, name: "Warning" },
19
+ { type: VariantTypes.LIGHT, name: "Light" },
20
+ { type: VariantTypes.LINK, name: "Link" },
21
+ { type: VariantTypes.DARK, name: "Dark" },
22
+ { type: VariantTypes.LION_PACKAGES, name: "Lion Packages" },
23
+ { type: VariantTypes.LION_PARKING, name: "Lion Parking" },
24
+ { type: VariantTypes.LION_TECH, name: "Lion Tech" },
25
+ { type: VariantTypes.LION_GLAM, name: "Lion Glam" },
26
+ ];
27
+
28
+ const sizesList = [
29
+ { size: SizeTypes.SM, label: "SM", titleSuffix: "Small Modal" },
30
+ { size: SizeTypes.LG, label: "LG", titleSuffix: "Large Modal" },
31
+ { size: SizeTypes.XL, label: "XL", titleSuffix: "Extra Large Modal" },
32
+ { size: SizeTypes.LG, label: "Full", titleSuffix: "Fullscreen Modal", fullscreen: true as const },
33
+ ];
34
+
35
+ const modalsConfig = variantsList.flatMap((variantObj) =>
36
+ sizesList.map((sizeObj) => ({
37
+ id: `android-modal-${variantObj.type}-${sizeObj.label.toLowerCase()}`,
38
+ label: sizeObj.label,
39
+ size: sizeObj.size,
40
+ fullscreen: sizeObj.fullscreen,
41
+ variant: variantObj.type,
42
+ title: `Android ${variantObj.name} ${sizeObj.titleSuffix}`,
43
+ }))
44
+ );
45
+
46
+ export default function ModalsAndroidSection() {
47
+ const { updateState } = useLionUI();
48
+
49
+ return (
50
+ <Fragment>
51
+ <h2>Modals (Android)</h2>
52
+
53
+ {variantsList.map((variantObj) => {
54
+ const variantModals = modalsConfig.filter(
55
+ (modal) => modal.variant === variantObj.type
56
+ );
57
+
58
+ return (
59
+ <div key={variantObj.type} className="mb-4">
60
+ <h5 className="text-muted mb-2">{variantObj.name}</h5>
61
+ <div className="d-flex gap-3 flex-wrap">
62
+ {variantModals.map((modal) => (
63
+ <LionButton
64
+ key={modal.id}
65
+ platform={PlatformTypes.ANDROID}
66
+ shape={AndroidShapeTypes.ROUNDED}
67
+ styleType={AndroidStyleTypes.TONAL}
68
+ variant={modal.variant}
69
+ type={ButtonTypes.BUTTON}
70
+ onClick={() => updateState({ modal: modal.id })}
71
+ >
72
+ {modal.label}
73
+ </LionButton>
74
+ ))}
75
+ </div>
76
+ </div>
77
+ );
78
+ })}
79
+
80
+ {modalsConfig.map((modal) => (
81
+ <LionModal
82
+ key={modal.id}
83
+ platform={PlatformTypes.ANDROID}
84
+ modalId={modal.id}
85
+ variant={modal.variant}
86
+ title={modal.title}
87
+ size={modal.size}
88
+ fullscreen={modal.fullscreen}
89
+ body={(
90
+ <ModalsDefaultForm
91
+ platform={PlatformTypes.ANDROID}
92
+ variant={modal.variant}
93
+ />
94
+ )}
95
+ buttons={(
96
+ <LionButton
97
+ variant={VariantTypes.MODAL}
98
+ type={ButtonTypes.BUTTON}
99
+ onClick={() => alert("Clicked")}
100
+ >
101
+ Click
102
+ </LionButton>
103
+ )}
104
+ />
105
+ ))}
106
+ </Fragment>
107
+ );
108
+ }
@@ -0,0 +1,31 @@
1
+ import { Col, Form, Row } from "react-bootstrap";
2
+ import ModalsDefaultInput from "./ModalsDefaultInput.tsx";
3
+
4
+ // @ts-ignore
5
+ export default function ModalsDefaultForm ({ platform, variant }) {
6
+ return (
7
+ <Form>
8
+ <ModalsDefaultInput platform={platform} variant={variant} />
9
+
10
+ <ModalsDefaultInput platform={platform} variant={variant} />
11
+
12
+ <Row>
13
+ <Col xs={12} sm={12} md={12} lg={6} xl={6} xxl={6}>
14
+ <ModalsDefaultInput platform={platform} variant={variant} />
15
+ </Col>
16
+
17
+ <Col xs={12} sm={12} md={12} lg={6} xl={6} xxl={6}>
18
+ <ModalsDefaultInput platform={platform} variant={variant} />
19
+ </Col>
20
+
21
+ <Col xs={12} sm={12} md={12} lg={6} xl={6} xxl={6}>
22
+ <ModalsDefaultInput platform={platform} variant={variant} />
23
+ </Col>
24
+
25
+ <Col xs={12} sm={12} md={12} lg={6} xl={6} xxl={6}>
26
+ <ModalsDefaultInput platform={platform} variant={variant} />
27
+ </Col>
28
+ </Row>
29
+ </Form>
30
+ );
31
+ }
@@ -0,0 +1,22 @@
1
+ import { Form } from "react-bootstrap";
2
+ import { InputTypes } from "../../../types/InputTypes.tsx";
3
+ import AndroidInput from "../../../components/inputs/AndroidInput.tsx";
4
+ import {PlatformTypes} from "../../../types/PlatformTypes.tsx";
5
+ import IOSInput from "../../../components/inputs/IOSInput.tsx";
6
+ import BootstrapInput from "../../../components/inputs/BootstrapInput.tsx";
7
+
8
+ // @ts-ignore
9
+ export default function ModalsDefaultInput({ platform, variant }) {
10
+ const InputComponent = PlatformTypes.IOS === platform ? IOSInput : PlatformTypes.ANDROID === platform ? AndroidInput : BootstrapInput;
11
+
12
+ return (
13
+ <Form.Group className="mb-3">
14
+ <InputComponent
15
+ type={InputTypes.TEXT}
16
+ label="Extra Large input text"
17
+ variant={variant}
18
+ placeholder="Example text..."
19
+ />
20
+ </Form.Group>
21
+ );
22
+ }