@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.
- package/dist/components/buttons/AndroidButton.d.ts +16 -0
- package/dist/components/buttons/BootstrapButton.d.ts +16 -0
- package/dist/components/buttons/IOSButton.d.ts +16 -0
- package/dist/components/buttons/LionButton.d.ts +18 -0
- package/dist/components/inputs/AndroidInput.d.ts +20 -0
- package/dist/components/inputs/BootstrapInput.d.ts +16 -0
- package/dist/components/inputs/IOSInput.d.ts +21 -0
- package/dist/components/inputs/LionInput.d.ts +27 -0
- package/dist/components/loadings/LoadingBar.d.ts +5 -0
- package/dist/components/modals/LionModal.d.ts +17 -0
- package/dist/context/LionUIComponentsContext.d.ts +5 -0
- package/{src/index.ts → dist/index.d.ts} +1 -3
- package/dist/index.js +2564 -0
- package/{src/interfaces/LionUIComponentsProviderProps.tsx → dist/interfaces/LionUIComponentsProviderProps.d.ts} +1 -2
- package/{src/interfaces/LionUIContextProps.tsx → dist/interfaces/LionUIContextProps.d.ts} +1 -2
- package/{src/interfaces/LionUIState.tsx → dist/interfaces/LionUIState.d.ts} +2 -3
- package/dist/style.css +2 -0
- package/dist/types/Android/AndroidInputShapeTypes.d.ts +5 -0
- package/dist/types/Android/AndroidInputStyleTypes.d.ts +5 -0
- package/dist/types/Android/AndroidShapeTypes.d.ts +5 -0
- package/dist/types/Android/AndroidStyleTypes.d.ts +8 -0
- package/dist/types/ButtonTypes.d.ts +7 -0
- package/dist/types/IOS/IOSInputShapeTypes.d.ts +6 -0
- package/dist/types/IOS/IOSInputStyleTypes.d.ts +8 -0
- package/dist/types/IOS/IOSShapeTypes.d.ts +5 -0
- package/dist/types/IOS/IOSStyleTypes.d.ts +7 -0
- package/dist/types/InputTypes.d.ts +11 -0
- package/dist/types/PlatformTypes.d.ts +7 -0
- package/dist/types/SizeTypes.d.ts +9 -0
- package/dist/types/VariantTypes.d.ts +17 -0
- package/dist/types/Web/BootstrapInputShapeTypes.d.ts +6 -0
- package/dist/types/Web/BootstrapInputStyleTypes.d.ts +5 -0
- package/dist/types/Web/BootstrapShapeTypes.d.ts +6 -0
- package/dist/types/Web/BootstrapStyleTypes.d.ts +5 -0
- package/package.json +19 -2
- package/.oxlintrc.json +0 -8
- package/AGENTS.md +0 -0
- package/Dockerfile +0 -7
- package/compose.yml +0 -14
- package/index.html +0 -15
- package/src/App.tsx +0 -84
- package/src/assets/css/buttons/buttons-android.css +0 -251
- package/src/assets/css/buttons/buttons-ios.css +0 -213
- package/src/assets/css/buttons/buttons-web.css +0 -138
- package/src/assets/css/custom.css +0 -8
- package/src/assets/css/index.css +0 -60
- package/src/assets/css/inputs/inputs-android.css +0 -259
- package/src/assets/css/inputs/inputs-bootstrap.css +0 -74
- package/src/assets/css/inputs/inputs-ios.css +0 -268
- package/src/assets/css/loadings/loading-bar.css +0 -86
- package/src/assets/css/modals/modals.css +0 -236
- package/src/components/buttons/AndroidButton.tsx +0 -43
- package/src/components/buttons/BootstrapButton.tsx +0 -50
- package/src/components/buttons/IOSButton.tsx +0 -42
- package/src/components/buttons/LionButton.tsx +0 -73
- package/src/components/inputs/AndroidInput.tsx +0 -158
- package/src/components/inputs/BootstrapInput.tsx +0 -106
- package/src/components/inputs/IOSInput.tsx +0 -163
- package/src/components/inputs/LionInput.tsx +0 -81
- package/src/components/loadings/LoadingBar.tsx +0 -21
- package/src/components/modals/LionModal.tsx +0 -155
- package/src/context/LionUIComponentsContext.tsx +0 -73
- package/src/features/Header.tsx +0 -83
- package/src/features/VariantList.tsx +0 -19
- package/src/features/buttons/ButtonsSection.tsx +0 -7
- package/src/features/buttons/components/ButtonsAndroidSection.tsx +0 -79
- package/src/features/buttons/components/ButtonsBootstrapSection.tsx +0 -77
- package/src/features/buttons/components/ButtonsCustomSection.tsx +0 -234
- package/src/features/buttons/components/ButtonsIOSSection.tsx +0 -78
- package/src/features/inputs/InputsSection.tsx +0 -7
- package/src/features/inputs/components/InputsAndroidSection.tsx +0 -155
- package/src/features/inputs/components/InputsBootstrapSection.tsx +0 -154
- package/src/features/inputs/components/InputsCustomSection.tsx +0 -234
- package/src/features/inputs/components/InputsIOSSection.tsx +0 -156
- package/src/features/loadings/LoadingSection.tsx +0 -5
- package/src/features/loadings/components/LoadingBarSection.tsx +0 -74
- package/src/features/modals/ModalsSection.tsx +0 -5
- package/src/features/modals/components/ModalsAndroidSection.tsx +0 -108
- package/src/features/modals/components/ModalsDefaultForm.tsx +0 -31
- package/src/features/modals/components/ModalsDefaultInput.tsx +0 -22
- package/src/features/modals/components/ModalsIOSSection.tsx +0 -106
- package/src/features/modals/components/ModalsWebSection.tsx +0 -104
- package/src/main.tsx +0 -9
- package/src/types/Android/AndroidInputShapeTypes.tsx +0 -7
- package/src/types/Android/AndroidInputStyleTypes.tsx +0 -7
- package/src/types/Android/AndroidShapeTypes.tsx +0 -6
- package/src/types/Android/AndroidStyleTypes.tsx +0 -9
- package/src/types/ButtonTypes.tsx +0 -9
- package/src/types/IOS/IOSInputShapeTypes.tsx +0 -9
- package/src/types/IOS/IOSInputStyleTypes.tsx +0 -11
- package/src/types/IOS/IOSShapeTypes.tsx +0 -7
- package/src/types/IOS/IOSStyleTypes.tsx +0 -9
- package/src/types/InputTypes.tsx +0 -13
- package/src/types/PlatformTypes.tsx +0 -9
- package/src/types/SizeTypes.tsx +0 -11
- package/src/types/VariantTypes.tsx +0 -19
- package/src/types/Web/BootstrapInputShapeTypes.tsx +0 -9
- package/src/types/Web/BootstrapInputStyleTypes.tsx +0 -8
- package/src/types/Web/BootstrapShapeTypes.tsx +0 -8
- package/src/types/Web/BootstrapStyleTypes.tsx +0 -7
- package/tsconfig.app.json +0 -26
- package/tsconfig.json +0 -7
- package/tsconfig.node.json +0 -23
- package/vite.config.ts +0 -30
- /package/{public → dist}/favicon.svg +0 -0
- /package/{public → dist}/icons.svg +0 -0
|
@@ -1,236 +0,0 @@
|
|
|
1
|
-
/* ==========================================
|
|
2
|
-
GLOBAL BACKDROP ADJUSTMENT (Exclusive for modals)
|
|
3
|
-
========================================== */
|
|
4
|
-
.modal-backdrop.web-modal-backdrop,
|
|
5
|
-
.modal-backdrop.ios-modal-backdrop,
|
|
6
|
-
.modal-backdrop.android-modal-backdrop,
|
|
7
|
-
.web-modal ~ .modal-backdrop,
|
|
8
|
-
.ios-modal ~ .modal-backdrop,
|
|
9
|
-
.android-modal ~ .modal-backdrop {
|
|
10
|
-
opacity: 0.45;
|
|
11
|
-
backdrop-filter: blur(3px);
|
|
12
|
-
-webkit-backdrop-filter: blur(3px);
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
/* ==========================================
|
|
17
|
-
1. WEB & BASE MODAL STYLES (.web-modal)
|
|
18
|
-
========================================== */
|
|
19
|
-
|
|
20
|
-
.web-modal .modal-content {
|
|
21
|
-
border: 1px solid rgba(0, 0, 0, 0.08) !important;
|
|
22
|
-
border-radius: 12px !important;
|
|
23
|
-
box-shadow: 0 12px 32px rgba(0, 0, 0, 0.1) !important;
|
|
24
|
-
overflow: hidden;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
.web-modal .custom-modal-title {
|
|
28
|
-
font-size: 1.15rem;
|
|
29
|
-
color: #212529;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.web-modal .custom-btn-group .btn-modal {
|
|
33
|
-
width: auto;
|
|
34
|
-
flex: 1 1 0;
|
|
35
|
-
text-align: center;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
.web-modal .custom-btn-group .btn-modal:not(:first-child)::before {
|
|
39
|
-
content: "";
|
|
40
|
-
position: absolute;
|
|
41
|
-
top: 0;
|
|
42
|
-
bottom: 0;
|
|
43
|
-
left: -1px;
|
|
44
|
-
width: 1px;
|
|
45
|
-
height: auto;
|
|
46
|
-
background-color: var(--bs-modal-footer-border-color);
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
/* Specific and encapsulated base button for Web Modal */
|
|
50
|
-
.web-modal .btn-modal {
|
|
51
|
-
background-color: transparent !important;
|
|
52
|
-
border: none !important;
|
|
53
|
-
box-shadow: none !important;
|
|
54
|
-
outline: none !important;
|
|
55
|
-
color: inherit !important;
|
|
56
|
-
width: 100%;
|
|
57
|
-
padding: 12px 10px;
|
|
58
|
-
font-size: 16px;
|
|
59
|
-
position: relative;
|
|
60
|
-
box-sizing: border-box;
|
|
61
|
-
-webkit-tap-highlight-color: rgba(0, 0, 0, 0.15);
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
.web-modal .btn-modal:hover {
|
|
65
|
-
background-color: rgba(0, 0, 0, 0.04) !important;
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
.web-modal .btn-modal:active {
|
|
69
|
-
background-color: rgba(0, 0, 0, 0.08) !important;
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
.web-modal .btn-modal:focus,
|
|
73
|
-
.web-modal .btn-modal:focus-visible,
|
|
74
|
-
.web-modal .btn-modal:focus-within {
|
|
75
|
-
background-color: transparent !important;
|
|
76
|
-
box-shadow: none !important;
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
/* ==========================================
|
|
81
|
-
2. iOS STYLE DESIGN (.ios-modal)
|
|
82
|
-
========================================== */
|
|
83
|
-
|
|
84
|
-
.ios-modal .modal-content {
|
|
85
|
-
border: none !important;
|
|
86
|
-
border-radius: 22px !important;
|
|
87
|
-
backdrop-filter: blur(20px) saturate(180%);
|
|
88
|
-
-webkit-backdrop-filter: blur(20px) saturate(180%);
|
|
89
|
-
box-shadow: 0 20px 40px rgba(0, 0, 0, 0.18), 0 0 1px rgba(0, 0, 0, 0.2) !important;
|
|
90
|
-
overflow: hidden;
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
.ios-modal .custom-modal-header {
|
|
94
|
-
border-bottom: 1px solid rgba(60, 60, 67, 0.12) !important;
|
|
95
|
-
position: relative;
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
.ios-modal .custom-modal-title {
|
|
99
|
-
font-size: 1.1rem;
|
|
100
|
-
letter-spacing: -0.2px;
|
|
101
|
-
color: var(--lion-black, #000);
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
.ios-modal .custom-modal-header .btn-close {
|
|
105
|
-
position: absolute;
|
|
106
|
-
right: 16px;
|
|
107
|
-
top: 50%;
|
|
108
|
-
transform: translateY(-50%) !important;
|
|
109
|
-
margin: 0 !important;
|
|
110
|
-
padding: 8px !important;
|
|
111
|
-
background-size: 10px;
|
|
112
|
-
border-radius: 50%;
|
|
113
|
-
opacity: 0.8 !important;
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
.ios-modal .custom-modal-body {
|
|
117
|
-
font-size: 0.95rem;
|
|
118
|
-
line-height: 1.5;
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
.ios-modal .custom-modal-footer {
|
|
122
|
-
border-top: 1px solid rgba(60, 60, 67, 0.12) !important;
|
|
123
|
-
background-color: transparent !important;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
.ios-modal .custom-btn-group .btn-modal {
|
|
127
|
-
flex: 1 1 0;
|
|
128
|
-
padding: 14px 10px;
|
|
129
|
-
font-size: 1rem;
|
|
130
|
-
font-weight: 400;
|
|
131
|
-
text-align: center;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
.ios-modal .btn-modal-cancel {
|
|
135
|
-
font-weight: 600;
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
.ios-modal .custom-btn-group .btn-modal:not(:first-child)::before {
|
|
139
|
-
content: "";
|
|
140
|
-
position: absolute;
|
|
141
|
-
top: 0;
|
|
142
|
-
bottom: 0;
|
|
143
|
-
left: 0;
|
|
144
|
-
width: 1px;
|
|
145
|
-
background-color: rgba(60, 60, 67, 0.12);
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
.ios-modal .btn-modal {
|
|
149
|
-
background-color: transparent !important;
|
|
150
|
-
border: none !important;
|
|
151
|
-
box-shadow: none !important;
|
|
152
|
-
outline: none !important;
|
|
153
|
-
position: relative;
|
|
154
|
-
box-sizing: border-box;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
.ios-modal .btn-modal:hover {
|
|
158
|
-
background-color: rgba(0, 0, 0, 0.04) !important;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
.ios-modal .btn-modal:active {
|
|
162
|
-
background-color: rgba(0, 0, 0, 0.08) !important;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
/* ==========================================
|
|
167
|
-
3. ANDROID / MATERIAL DESIGN STYLE (.android-modal)
|
|
168
|
-
========================================== */
|
|
169
|
-
|
|
170
|
-
.android-modal .modal-content {
|
|
171
|
-
border: none !important;
|
|
172
|
-
border-radius: 28px !important;
|
|
173
|
-
box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15) !important;
|
|
174
|
-
overflow: hidden;
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
.android-modal .custom-modal-header {
|
|
178
|
-
border-bottom: none !important;
|
|
179
|
-
padding-top: 24px;
|
|
180
|
-
padding-bottom: 8px;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
.android-modal .custom-modal-title {
|
|
184
|
-
font-size: 1.35rem;
|
|
185
|
-
color: #1d1b20;
|
|
186
|
-
font-weight: 500 !important;
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
.android-modal .custom-modal-body {
|
|
190
|
-
font-size: 0.95rem;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
.android-modal .custom-modal-footer {
|
|
194
|
-
border-top: 1px solid rgba(0, 0, 0, 0.08) !important;
|
|
195
|
-
padding: 0 !important;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.android-modal .custom-btn-group .btn-modal {
|
|
199
|
-
flex: 1 1 0;
|
|
200
|
-
padding: 14px 10px;
|
|
201
|
-
font-size: 0.9rem;
|
|
202
|
-
font-weight: 500;
|
|
203
|
-
text-transform: uppercase;
|
|
204
|
-
letter-spacing: 0.5px;
|
|
205
|
-
text-align: center;
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.android-modal .custom-btn-group .btn-modal:not(:first-child)::before {
|
|
209
|
-
content: "";
|
|
210
|
-
position: absolute;
|
|
211
|
-
top: 0;
|
|
212
|
-
bottom: 0;
|
|
213
|
-
left: -1px;
|
|
214
|
-
width: 1px;
|
|
215
|
-
height: auto;
|
|
216
|
-
background-color: rgba(0, 0, 0, 0.08);
|
|
217
|
-
}
|
|
218
|
-
|
|
219
|
-
.android-modal .btn-modal {
|
|
220
|
-
background-color: transparent !important;
|
|
221
|
-
border: none !important;
|
|
222
|
-
box-shadow: none !important;
|
|
223
|
-
outline: none !important;
|
|
224
|
-
position: relative;
|
|
225
|
-
box-sizing: border-box;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
.android-modal .btn-modal:hover {
|
|
229
|
-
background-color: rgba(103, 80, 164, 0.08) !important;
|
|
230
|
-
color: var(--lion-black);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
.android-modal .btn-modal:active {
|
|
234
|
-
background-color: rgba(103, 80, 164, 0.12) !important;
|
|
235
|
-
color: var(--lion-black);
|
|
236
|
-
}
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
// components/buttons/AndroidButton.tsx
|
|
2
|
-
import {type ButtonHTMLAttributes, type ReactNode } from 'react';
|
|
3
|
-
import { VariantTypes } from '../../types/VariantTypes';
|
|
4
|
-
import { SizeTypes } from '../../types/SizeTypes';
|
|
5
|
-
import { ButtonTypes } from '../../types/ButtonTypes';
|
|
6
|
-
import { AndroidStyleTypes } from '../../types/Android/AndroidStyleTypes';
|
|
7
|
-
import { AndroidShapeTypes } from '../../types/Android/AndroidShapeTypes';
|
|
8
|
-
|
|
9
|
-
export interface AndroidButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'type' | 'size'> {
|
|
10
|
-
children?: ReactNode;
|
|
11
|
-
variant?: VariantTypes;
|
|
12
|
-
styleType?: AndroidStyleTypes;
|
|
13
|
-
shape?: AndroidShapeTypes;
|
|
14
|
-
size?: SizeTypes;
|
|
15
|
-
type?: ButtonTypes;
|
|
16
|
-
className?: string;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
export default function AndroidButton({
|
|
20
|
-
children,
|
|
21
|
-
variant = VariantTypes.PRIMARY,
|
|
22
|
-
styleType = AndroidStyleTypes.FILLED,
|
|
23
|
-
shape = AndroidShapeTypes.PILL,
|
|
24
|
-
size = SizeTypes.MD,
|
|
25
|
-
type = ButtonTypes.BUTTON,
|
|
26
|
-
className = "",
|
|
27
|
-
...props
|
|
28
|
-
}: AndroidButtonProps) {
|
|
29
|
-
const styleClass = `android-btn-${styleType}`;
|
|
30
|
-
const shapeClass = `android-btn-${shape}`;
|
|
31
|
-
const variantClass = variant ? `btn-${variant}` : "";
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<button
|
|
35
|
-
type={type}
|
|
36
|
-
className={`android-btn android-btn-${size} ${styleClass} ${shapeClass} ${variantClass} ${className}`.trim()}
|
|
37
|
-
{...props}
|
|
38
|
-
>
|
|
39
|
-
{children}
|
|
40
|
-
<span className="ripple" />
|
|
41
|
-
</button>
|
|
42
|
-
);
|
|
43
|
-
}
|
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
import { type ButtonHTMLAttributes, type ReactNode } from "react";
|
|
2
|
-
import { VariantTypes } from "../../types/VariantTypes.tsx";
|
|
3
|
-
import { SizeTypes } from "../../types/SizeTypes.tsx";
|
|
4
|
-
import { ButtonTypes } from "../../types/ButtonTypes.tsx";
|
|
5
|
-
import { BootstrapStyleTypes } from "../../types/Web/BootstrapStyleTypes.tsx";
|
|
6
|
-
import { BootstrapShapeTypes } from "../../types/Web/BootstrapShapeTypes.tsx";
|
|
7
|
-
|
|
8
|
-
export interface BootstrapButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type" | "size"> {
|
|
9
|
-
children?: ReactNode;
|
|
10
|
-
variant?: VariantTypes;
|
|
11
|
-
styleType?: BootstrapStyleTypes;
|
|
12
|
-
shape?: BootstrapShapeTypes;
|
|
13
|
-
size?: SizeTypes;
|
|
14
|
-
type?: ButtonTypes;
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default function BootstrapButton({
|
|
19
|
-
children,
|
|
20
|
-
variant = "primary" as VariantTypes,
|
|
21
|
-
styleType = BootstrapStyleTypes.FILLED,
|
|
22
|
-
shape = BootstrapShapeTypes.STANDARD,
|
|
23
|
-
size = "md" as SizeTypes,
|
|
24
|
-
type = "button" as ButtonTypes,
|
|
25
|
-
className = "",
|
|
26
|
-
...props
|
|
27
|
-
}: BootstrapButtonProps) {
|
|
28
|
-
// Construct standard Bootstrap button classes
|
|
29
|
-
const stylePrefix = styleType === BootstrapStyleTypes.OUTLINED ? "btn-outline-" : "btn-";
|
|
30
|
-
const variantClass = variant ? `${stylePrefix}${variant}` : "";
|
|
31
|
-
const sizeClass = size && size !== "md" ? `btn-${size}` : "";
|
|
32
|
-
|
|
33
|
-
// Mapping custom shape types to Bootstrap utilities or extended CSS
|
|
34
|
-
const shapeClass =
|
|
35
|
-
shape === BootstrapShapeTypes.PILL
|
|
36
|
-
? "rounded-pill"
|
|
37
|
-
: shape === BootstrapShapeTypes.SQUARE
|
|
38
|
-
? "rounded-0"
|
|
39
|
-
: "";
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<button
|
|
43
|
-
type={type}
|
|
44
|
-
className={`btn ${variantClass} ${sizeClass} ${shapeClass} ${className}`.trim()}
|
|
45
|
-
{...props}
|
|
46
|
-
>
|
|
47
|
-
{children}
|
|
48
|
-
</button>
|
|
49
|
-
);
|
|
50
|
-
}
|
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
import { type ButtonHTMLAttributes, type ReactNode } from "react";
|
|
2
|
-
import { VariantTypes } from "../../types/VariantTypes";
|
|
3
|
-
import { SizeTypes } from "../../types/SizeTypes";
|
|
4
|
-
import { ButtonTypes } from "../../types/ButtonTypes";
|
|
5
|
-
import { IOSStyleTypes } from "../../types/IOS/IOSStyleTypes";
|
|
6
|
-
import { IOSShapeTypes } from "../../types/IOS/IOSShapeTypes";
|
|
7
|
-
|
|
8
|
-
export interface IOSButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, "type" | "size"> {
|
|
9
|
-
children?: ReactNode;
|
|
10
|
-
variant?: VariantTypes;
|
|
11
|
-
styleType?: IOSStyleTypes;
|
|
12
|
-
shape?: IOSShapeTypes;
|
|
13
|
-
size?: SizeTypes;
|
|
14
|
-
type?: ButtonTypes;
|
|
15
|
-
className?: string;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export default function IOSButton({
|
|
19
|
-
children,
|
|
20
|
-
variant = VariantTypes.PRIMARY,
|
|
21
|
-
styleType = IOSStyleTypes.FILLED,
|
|
22
|
-
shape = IOSShapeTypes.ROUNDED,
|
|
23
|
-
size = SizeTypes.MD,
|
|
24
|
-
type = ButtonTypes.BUTTON,
|
|
25
|
-
className = "",
|
|
26
|
-
...props
|
|
27
|
-
}: IOSButtonProps) {
|
|
28
|
-
// Construct dynamic iOS class names
|
|
29
|
-
const styleClass = `ios-btn-${styleType}`;
|
|
30
|
-
const shapeClass = `ios-btn-${shape}`;
|
|
31
|
-
const variantClass = variant ? `btn-${variant}` : "";
|
|
32
|
-
|
|
33
|
-
return (
|
|
34
|
-
<button
|
|
35
|
-
type={type}
|
|
36
|
-
className={`ios-btn ios-btn-${size} ${styleClass} ${shapeClass} ${variantClass} ${className}`.trim()}
|
|
37
|
-
{...props}
|
|
38
|
-
>
|
|
39
|
-
<span className="ios-btn-content">{children}</span>
|
|
40
|
-
</button>
|
|
41
|
-
);
|
|
42
|
-
}
|
|
@@ -1,73 +0,0 @@
|
|
|
1
|
-
import { type ButtonHTMLAttributes, type ReactNode } from 'react';
|
|
2
|
-
import { useLionUI } from '../../context/LionUIComponentsContext.tsx';
|
|
3
|
-
import { PlatformTypes } from "../../types/PlatformTypes.tsx";
|
|
4
|
-
// @ts-ignore
|
|
5
|
-
import { SizeTypes } from "../../types/SizeTypes.tsx";
|
|
6
|
-
import type { AndroidStyleTypes } from "../../types/Android/AndroidStyleTypes.tsx";
|
|
7
|
-
import type { AndroidShapeTypes } from "../../types/Android/AndroidShapeTypes.tsx";
|
|
8
|
-
import type { BootstrapShapeTypes } from "../../types/Web/BootstrapShapeTypes.tsx";
|
|
9
|
-
import type { BootstrapStyleTypes } from "../../types/Web/BootstrapStyleTypes.tsx";
|
|
10
|
-
import type { IOSShapeTypes } from "../../types/IOS/IOSShapeTypes.tsx";
|
|
11
|
-
import type { IOSStyleTypes } from "../../types/IOS/IOSStyleTypes.tsx";
|
|
12
|
-
import AndroidButton from "./AndroidButton.tsx";
|
|
13
|
-
import IOSButton from "./IOSButton.tsx";
|
|
14
|
-
import BootstrapButton from "./BootstrapButton.tsx";
|
|
15
|
-
|
|
16
|
-
type PlatformMapping<T> = {
|
|
17
|
-
[PlatformTypes.ANDROID]?: T;
|
|
18
|
-
[PlatformTypes.IOS]?: T;
|
|
19
|
-
[PlatformTypes.WEB]?: T;
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
export type LionButtonProps = ButtonHTMLAttributes<HTMLButtonElement> & {
|
|
23
|
-
children: ReactNode;
|
|
24
|
-
variant?: string;
|
|
25
|
-
platform?: string;
|
|
26
|
-
// @ts-ignore
|
|
27
|
-
size?: SizeTypes.SM | SizeTypes.MD | SizeTypes.LG;
|
|
28
|
-
shape?: BootstrapShapeTypes | AndroidShapeTypes | IOSShapeTypes | string | PlatformMapping<BootstrapShapeTypes | AndroidShapeTypes | IOSShapeTypes | string>;
|
|
29
|
-
styleType?: BootstrapStyleTypes | AndroidStyleTypes | IOSStyleTypes | string | PlatformMapping<BootstrapStyleTypes | AndroidStyleTypes | IOSStyleTypes | string>;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
export default function LionButton({
|
|
33
|
-
children,
|
|
34
|
-
shape,
|
|
35
|
-
styleType,
|
|
36
|
-
// @ts-ignore
|
|
37
|
-
platform = null,
|
|
38
|
-
...props
|
|
39
|
-
}: LionButtonProps) {
|
|
40
|
-
const { state } = useLionUI();
|
|
41
|
-
|
|
42
|
-
const activePlatform = platform ?? state.platform;
|
|
43
|
-
|
|
44
|
-
const resolvePlatformProp = <T,>(propValue?: T | PlatformMapping<T>): T | undefined => {
|
|
45
|
-
if (typeof propValue === 'object' && propValue !== null) {
|
|
46
|
-
const map = propValue as PlatformMapping<T>;
|
|
47
|
-
return map[activePlatform as keyof PlatformMapping<T>] ?? map[activePlatform.toLowerCase() as keyof PlatformMapping<T>];
|
|
48
|
-
}
|
|
49
|
-
return propValue as T;
|
|
50
|
-
};
|
|
51
|
-
|
|
52
|
-
const resolvedShape = resolvePlatformProp(shape);
|
|
53
|
-
const resolvedStyleType = resolvePlatformProp(styleType);
|
|
54
|
-
|
|
55
|
-
const buttonProps = {
|
|
56
|
-
...props,
|
|
57
|
-
...(resolvedShape !== undefined && { shape: resolvedShape }),
|
|
58
|
-
...(resolvedStyleType !== undefined && { styleType: resolvedStyleType }),
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
switch (activePlatform) {
|
|
62
|
-
case PlatformTypes.ANDROID:
|
|
63
|
-
return <AndroidButton {...(buttonProps as any)}>{children}</AndroidButton>;
|
|
64
|
-
|
|
65
|
-
case PlatformTypes.IOS:
|
|
66
|
-
return <IOSButton {...(buttonProps as any)}>{children}</IOSButton>;
|
|
67
|
-
|
|
68
|
-
case PlatformTypes.WEB:
|
|
69
|
-
case PlatformTypes.DESKTOP:
|
|
70
|
-
default:
|
|
71
|
-
return <BootstrapButton {...(buttonProps as any)}>{children}</BootstrapButton>;
|
|
72
|
-
}
|
|
73
|
-
}
|
|
@@ -1,158 +0,0 @@
|
|
|
1
|
-
import { InputTypes } from "../../types/InputTypes";
|
|
2
|
-
import { AndroidInputStyleTypes } from "../../types/Android/AndroidInputStyleTypes.tsx";
|
|
3
|
-
import { AndroidInputShapeTypes } from "../../types/Android/AndroidInputShapeTypes.tsx";
|
|
4
|
-
import {type ChangeEvent, type InputHTMLAttributes, type ReactNode, useId, useState} from "react";
|
|
5
|
-
|
|
6
|
-
export interface AndroidInputProps
|
|
7
|
-
extends Omit<InputHTMLAttributes<HTMLInputElement>, "type" | "shape"> {
|
|
8
|
-
type?: InputTypes;
|
|
9
|
-
styleType?: AndroidInputStyleTypes;
|
|
10
|
-
shape?: AndroidInputShapeTypes;
|
|
11
|
-
variant?: string;
|
|
12
|
-
label?: string;
|
|
13
|
-
required?: boolean;
|
|
14
|
-
helperText?: string;
|
|
15
|
-
error?: boolean | string;
|
|
16
|
-
startIcon?: ReactNode;
|
|
17
|
-
endIcon?: ReactNode;
|
|
18
|
-
prefixText?: string;
|
|
19
|
-
suffixText?: string;
|
|
20
|
-
counter?: boolean | number;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export default function AndroidInput({
|
|
24
|
-
type = InputTypes.TEXT,
|
|
25
|
-
styleType = AndroidInputStyleTypes.OUTLINED,
|
|
26
|
-
shape = AndroidInputShapeTypes.NORMAL,
|
|
27
|
-
variant = "primary",
|
|
28
|
-
label,
|
|
29
|
-
required = false,
|
|
30
|
-
helperText,
|
|
31
|
-
error,
|
|
32
|
-
startIcon,
|
|
33
|
-
endIcon,
|
|
34
|
-
prefixText,
|
|
35
|
-
suffixText,
|
|
36
|
-
counter,
|
|
37
|
-
disabled = false,
|
|
38
|
-
readOnly = false,
|
|
39
|
-
value,
|
|
40
|
-
defaultValue,
|
|
41
|
-
onChange,
|
|
42
|
-
onFocus,
|
|
43
|
-
onBlur,
|
|
44
|
-
id,
|
|
45
|
-
className = "",
|
|
46
|
-
maxLength,
|
|
47
|
-
placeholder = " ",
|
|
48
|
-
...rest
|
|
49
|
-
}: AndroidInputProps) {
|
|
50
|
-
const generatedId = useId();
|
|
51
|
-
const inputId = id || generatedId;
|
|
52
|
-
|
|
53
|
-
const [isFocused, setIsFocused] = useState(false);
|
|
54
|
-
const [internalValue, setInternalValue] = useState(value ?? defaultValue ?? "");
|
|
55
|
-
|
|
56
|
-
const hasError = Boolean(error);
|
|
57
|
-
const errorMessage = typeof error === "string" ? error : undefined;
|
|
58
|
-
|
|
59
|
-
const normalizedStyle = String(styleType).toLowerCase().replace(/_/g, "-");
|
|
60
|
-
const normalizedShape = String(shape).toLowerCase();
|
|
61
|
-
|
|
62
|
-
const containerClasses = [
|
|
63
|
-
"android-input-container",
|
|
64
|
-
`android-variant-${variant}`,
|
|
65
|
-
className,
|
|
66
|
-
].filter(Boolean).join(" ");
|
|
67
|
-
|
|
68
|
-
const wrapperClasses = [
|
|
69
|
-
"android-input-field-wrapper",
|
|
70
|
-
`android-style-${normalizedStyle}`,
|
|
71
|
-
`android-size-${normalizedShape}`,
|
|
72
|
-
isFocused ? "is-focused" : "",
|
|
73
|
-
hasError ? "has-error" : "",
|
|
74
|
-
disabled ? "is-disabled" : "",
|
|
75
|
-
readOnly ? "is-readonly" : "",
|
|
76
|
-
].filter(Boolean).join(" ");
|
|
77
|
-
|
|
78
|
-
const inputClasses = [
|
|
79
|
-
"android-input-element",
|
|
80
|
-
hasError ? "is-invalid" : "",
|
|
81
|
-
].filter(Boolean).join(" ");
|
|
82
|
-
|
|
83
|
-
const handleChange = (e: ChangeEvent<HTMLInputElement>) => {
|
|
84
|
-
setInternalValue(e.target.value);
|
|
85
|
-
if (onChange) onChange(e);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
const handleFocus = (e: FocusEvent) => {
|
|
89
|
-
setIsFocused(true);
|
|
90
|
-
if (onFocus) { // @ts-ignore
|
|
91
|
-
onFocus(e);
|
|
92
|
-
}
|
|
93
|
-
};
|
|
94
|
-
|
|
95
|
-
const handleBlur = (e: FocusEvent) => {
|
|
96
|
-
setIsFocused(false);
|
|
97
|
-
if (onBlur) { // @ts-ignore
|
|
98
|
-
onBlur(e);
|
|
99
|
-
}
|
|
100
|
-
};
|
|
101
|
-
|
|
102
|
-
const currentValue = value !== undefined ? value : internalValue;
|
|
103
|
-
const currentLength = String(currentValue || "").length;
|
|
104
|
-
const maxLen = typeof counter === "number" ? counter : maxLength;
|
|
105
|
-
|
|
106
|
-
return (
|
|
107
|
-
<div className={containerClasses}>
|
|
108
|
-
<div className={wrapperClasses}>
|
|
109
|
-
{startIcon && <div className="android-input-start-icon">{startIcon}</div>}
|
|
110
|
-
{prefixText && <span className="android-input-prefix">{prefixText}</span>}
|
|
111
|
-
|
|
112
|
-
<input
|
|
113
|
-
id={inputId}
|
|
114
|
-
type={type}
|
|
115
|
-
value={currentValue}
|
|
116
|
-
required={required}
|
|
117
|
-
disabled={disabled}
|
|
118
|
-
readOnly={readOnly}
|
|
119
|
-
maxLength={maxLen}
|
|
120
|
-
placeholder={placeholder}
|
|
121
|
-
onChange={handleChange}
|
|
122
|
-
// @ts-ignore
|
|
123
|
-
onFocus={handleFocus}
|
|
124
|
-
// @ts-ignore
|
|
125
|
-
onBlur={handleBlur}
|
|
126
|
-
className={inputClasses}
|
|
127
|
-
{...rest}
|
|
128
|
-
/>
|
|
129
|
-
|
|
130
|
-
{label && (
|
|
131
|
-
<label htmlFor={inputId} className="android-input-label">
|
|
132
|
-
{label}
|
|
133
|
-
{required && <span className="text-danger ms-1">*</span>}
|
|
134
|
-
</label>
|
|
135
|
-
)}
|
|
136
|
-
|
|
137
|
-
{suffixText && <span className="android-input-suffix">{suffixText}</span>}
|
|
138
|
-
{endIcon && <div className="android-input-end-icon">{endIcon}</div>}
|
|
139
|
-
</div>
|
|
140
|
-
|
|
141
|
-
{(helperText || errorMessage || counter) && (
|
|
142
|
-
<div className="android-input-subtext-container">
|
|
143
|
-
{hasError ? (
|
|
144
|
-
<div className="android-input-error-text">{errorMessage}</div>
|
|
145
|
-
) : helperText ? (
|
|
146
|
-
<div className="android-input-helper-text">{helperText}</div>
|
|
147
|
-
) : <div />}
|
|
148
|
-
|
|
149
|
-
{counter && (
|
|
150
|
-
<span className="android-input-counter">
|
|
151
|
-
{currentLength}{maxLen ? `/${maxLen}` : ""}
|
|
152
|
-
</span>
|
|
153
|
-
)}
|
|
154
|
-
</div>
|
|
155
|
-
)}
|
|
156
|
-
</div>
|
|
157
|
-
);
|
|
158
|
-
}
|