@asgardeo/javascript 0.1.8 → 0.1.10
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/cjs/index.js +174 -48
- package/dist/cjs/index.js.map +3 -3
- package/dist/index.d.ts +2 -0
- package/dist/index.js +172 -48
- package/dist/index.js.map +3 -3
- package/dist/models/i18n.d.ts +2 -0
- package/dist/theme/types.d.ts +90 -0
- package/dist/utils/bem.d.ts +46 -0
- package/dist/utils/formatDate.d.ts +33 -0
- package/package.json +1 -1
package/dist/models/i18n.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export interface I18nTranslations {
|
|
|
47
47
|
'username.password.submit.button': string;
|
|
48
48
|
'username.password.title': string;
|
|
49
49
|
'username.password.subtitle': string;
|
|
50
|
+
'user.profile.title': string;
|
|
51
|
+
'user.profile.update.generic.error': string;
|
|
50
52
|
'organization.switcher.select.organization': string;
|
|
51
53
|
'organization.switcher.switch.organization': string;
|
|
52
54
|
'organization.switcher.loading.organizations': string;
|
package/dist/theme/types.d.ts
CHANGED
|
@@ -55,35 +55,85 @@ export interface ThemeColors {
|
|
|
55
55
|
background: {
|
|
56
56
|
body: {
|
|
57
57
|
main: string;
|
|
58
|
+
dark?: string;
|
|
58
59
|
};
|
|
59
60
|
disabled: string;
|
|
60
61
|
surface: string;
|
|
62
|
+
dark?: string;
|
|
61
63
|
};
|
|
62
64
|
border: string;
|
|
63
65
|
error: {
|
|
64
66
|
contrastText: string;
|
|
65
67
|
main: string;
|
|
68
|
+
dark?: string;
|
|
69
|
+
};
|
|
70
|
+
info: {
|
|
71
|
+
contrastText: string;
|
|
72
|
+
main: string;
|
|
73
|
+
dark?: string;
|
|
66
74
|
};
|
|
67
75
|
primary: {
|
|
68
76
|
contrastText: string;
|
|
69
77
|
main: string;
|
|
78
|
+
dark?: string;
|
|
70
79
|
};
|
|
71
80
|
secondary: {
|
|
72
81
|
contrastText: string;
|
|
73
82
|
main: string;
|
|
83
|
+
dark?: string;
|
|
74
84
|
};
|
|
75
85
|
success: {
|
|
76
86
|
contrastText: string;
|
|
77
87
|
main: string;
|
|
88
|
+
dark?: string;
|
|
78
89
|
};
|
|
79
90
|
text: {
|
|
80
91
|
primary: string;
|
|
81
92
|
secondary: string;
|
|
93
|
+
dark?: string;
|
|
82
94
|
};
|
|
83
95
|
warning: {
|
|
84
96
|
contrastText: string;
|
|
85
97
|
main: string;
|
|
98
|
+
dark?: string;
|
|
99
|
+
};
|
|
100
|
+
}
|
|
101
|
+
export interface ThemeComponentStyleOverrides {
|
|
102
|
+
/**
|
|
103
|
+
* Style overrides for the root element or slots.
|
|
104
|
+
* Example: { root: { borderRadius: '8px' } }
|
|
105
|
+
*/
|
|
106
|
+
root?: Record<string, any>;
|
|
107
|
+
[slot: string]: Record<string, any> | undefined;
|
|
108
|
+
}
|
|
109
|
+
export interface ThemeComponents {
|
|
110
|
+
Button?: {
|
|
111
|
+
styleOverrides?: {
|
|
112
|
+
root?: {
|
|
113
|
+
borderRadius?: string;
|
|
114
|
+
[key: string]: any;
|
|
115
|
+
};
|
|
116
|
+
[slot: string]: Record<string, any> | undefined;
|
|
117
|
+
};
|
|
118
|
+
defaultProps?: Record<string, any>;
|
|
119
|
+
variants?: Array<Record<string, any>>;
|
|
120
|
+
};
|
|
121
|
+
Field?: {
|
|
122
|
+
styleOverrides?: {
|
|
123
|
+
root?: {
|
|
124
|
+
borderRadius?: string;
|
|
125
|
+
[key: string]: any;
|
|
126
|
+
};
|
|
127
|
+
[slot: string]: Record<string, any> | undefined;
|
|
128
|
+
};
|
|
129
|
+
defaultProps?: Record<string, any>;
|
|
130
|
+
variants?: Array<Record<string, any>>;
|
|
86
131
|
};
|
|
132
|
+
[componentName: string]: {
|
|
133
|
+
styleOverrides?: ThemeComponentStyleOverrides;
|
|
134
|
+
defaultProps?: Record<string, any>;
|
|
135
|
+
variants?: Array<Record<string, any>>;
|
|
136
|
+
} | undefined;
|
|
87
137
|
}
|
|
88
138
|
export interface ThemeConfig {
|
|
89
139
|
borderRadius: {
|
|
@@ -132,6 +182,29 @@ export interface ThemeConfig {
|
|
|
132
182
|
* @default 'asgardeo' (from VendorConstants.VENDOR_PREFIX)
|
|
133
183
|
*/
|
|
134
184
|
cssVarPrefix?: string;
|
|
185
|
+
/**
|
|
186
|
+
* Component style overrides
|
|
187
|
+
*/
|
|
188
|
+
components?: ThemeComponents;
|
|
189
|
+
}
|
|
190
|
+
export interface ThemeComponentVars {
|
|
191
|
+
Button?: {
|
|
192
|
+
root?: {
|
|
193
|
+
borderRadius?: string;
|
|
194
|
+
[key: string]: any;
|
|
195
|
+
};
|
|
196
|
+
[slot: string]: Record<string, any> | undefined;
|
|
197
|
+
};
|
|
198
|
+
Field?: {
|
|
199
|
+
root?: {
|
|
200
|
+
borderRadius?: string;
|
|
201
|
+
[key: string]: any;
|
|
202
|
+
};
|
|
203
|
+
[slot: string]: Record<string, any> | undefined;
|
|
204
|
+
};
|
|
205
|
+
[componentName: string]: {
|
|
206
|
+
[slot: string]: Record<string, any> | undefined;
|
|
207
|
+
} | undefined;
|
|
135
208
|
}
|
|
136
209
|
export interface ThemeVars {
|
|
137
210
|
colors: {
|
|
@@ -151,33 +224,46 @@ export interface ThemeVars {
|
|
|
151
224
|
primary: {
|
|
152
225
|
main: string;
|
|
153
226
|
contrastText: string;
|
|
227
|
+
dark?: string;
|
|
154
228
|
};
|
|
155
229
|
secondary: {
|
|
156
230
|
main: string;
|
|
157
231
|
contrastText: string;
|
|
232
|
+
dark?: string;
|
|
158
233
|
};
|
|
159
234
|
background: {
|
|
160
235
|
surface: string;
|
|
161
236
|
disabled: string;
|
|
237
|
+
dark?: string;
|
|
162
238
|
body: {
|
|
163
239
|
main: string;
|
|
240
|
+
dark?: string;
|
|
164
241
|
};
|
|
165
242
|
};
|
|
166
243
|
error: {
|
|
167
244
|
main: string;
|
|
168
245
|
contrastText: string;
|
|
246
|
+
dark?: string;
|
|
247
|
+
};
|
|
248
|
+
info: {
|
|
249
|
+
contrastText: string;
|
|
250
|
+
main: string;
|
|
251
|
+
dark?: string;
|
|
169
252
|
};
|
|
170
253
|
success: {
|
|
171
254
|
main: string;
|
|
172
255
|
contrastText: string;
|
|
256
|
+
dark?: string;
|
|
173
257
|
};
|
|
174
258
|
warning: {
|
|
175
259
|
main: string;
|
|
176
260
|
contrastText: string;
|
|
261
|
+
dark?: string;
|
|
177
262
|
};
|
|
178
263
|
text: {
|
|
179
264
|
primary: string;
|
|
180
265
|
secondary: string;
|
|
266
|
+
dark?: string;
|
|
181
267
|
};
|
|
182
268
|
border: string;
|
|
183
269
|
};
|
|
@@ -234,6 +320,10 @@ export interface ThemeVars {
|
|
|
234
320
|
alt?: string;
|
|
235
321
|
} | undefined;
|
|
236
322
|
};
|
|
323
|
+
/**
|
|
324
|
+
* Component CSS variable references (e.g., for overrides)
|
|
325
|
+
*/
|
|
326
|
+
components?: ThemeComponentVars;
|
|
237
327
|
}
|
|
238
328
|
export interface Theme extends ThemeConfig {
|
|
239
329
|
cssVariables: Record<string, string>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Creates a BEM-style class name by combining a base class with element and/or modifier
|
|
20
|
+
*
|
|
21
|
+
* @param baseClass - The base CSS class string (usually from emotion's css function)
|
|
22
|
+
* @param element - The BEM element name (optional)
|
|
23
|
+
* @param modifier - The BEM modifier name (optional)
|
|
24
|
+
* @returns The combined class name string
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```tsx
|
|
28
|
+
* const baseClass = css`
|
|
29
|
+
* display: flex;
|
|
30
|
+
* &__element {
|
|
31
|
+
* color: red;
|
|
32
|
+
* }
|
|
33
|
+
* &--modifier {
|
|
34
|
+
* background: blue;
|
|
35
|
+
* }
|
|
36
|
+
* `;
|
|
37
|
+
*
|
|
38
|
+
* import bem from './utils/bem';
|
|
39
|
+
*
|
|
40
|
+
* const elementClass = bem(baseClass, 'element');
|
|
41
|
+
* const modifierClass = bem(baseClass, null, 'modifier');
|
|
42
|
+
* const elementWithModifierClass = bem(baseClass, 'element', 'modifier');
|
|
43
|
+
* ```
|
|
44
|
+
*/
|
|
45
|
+
declare const bem: (baseClass: string, element?: string | null, modifier?: string | null) => string;
|
|
46
|
+
export default bem;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Formats a date string to a human-readable format.
|
|
20
|
+
*
|
|
21
|
+
* @param dateString - The date string to format (optional)
|
|
22
|
+
* @returns A formatted date string in 'Month Day, Year' format, or '-' if no date is provided, or the original string if parsing fails
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* formatDate('2025-07-09T10:30:00Z'); // Returns "July 9, 2025"
|
|
27
|
+
* formatDate(''); // Returns "-"
|
|
28
|
+
* formatDate(undefined); // Returns "-"
|
|
29
|
+
* formatDate('invalid-date'); // Returns "invalid-date"
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
declare const formatDate: (dateString?: string) => string;
|
|
33
|
+
export default formatDate;
|