@okta/odyssey-react-mui 1.1.1 → 1.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +42 -0
- package/README.md +1 -1
- package/dist/Autocomplete.js +13 -1
- package/dist/Autocomplete.js.map +1 -1
- package/dist/Breadcrumbs.js +146 -0
- package/dist/Breadcrumbs.js.map +1 -0
- package/dist/Link.js +3 -1
- package/dist/Link.js.map +1 -1
- package/dist/MenuButton.js.map +1 -1
- package/dist/OdysseyCacheProvider.js +4 -1
- package/dist/OdysseyCacheProvider.js.map +1 -1
- package/dist/OdysseyProvider.js +5 -1
- package/dist/OdysseyProvider.js.map +1 -1
- package/dist/OdysseyThemeProvider.js +5 -1
- package/dist/OdysseyThemeProvider.js.map +1 -1
- package/dist/OdysseyTranslationProvider.js +1 -1
- package/dist/OdysseyTranslationProvider.js.map +1 -1
- package/dist/PasswordField.js +11 -3
- package/dist/PasswordField.js.map +1 -1
- package/dist/Select.js +34 -33
- package/dist/Select.js.map +1 -1
- package/dist/Tabs.js +8 -6
- package/dist/Tabs.js.map +1 -1
- package/dist/Typography.js +0 -22
- package/dist/Typography.js.map +1 -1
- package/dist/createShadowDom.js +26 -0
- package/dist/createShadowDom.js.map +1 -0
- package/dist/{OdysseyI18n.js → i18n.js} +3 -2
- package/dist/i18n.js.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -1
- package/dist/labs/GroupPicker.js +190 -0
- package/dist/labs/GroupPicker.js.map +1 -0
- package/dist/labs/datePickerTheme.js +4 -2
- package/dist/labs/datePickerTheme.js.map +1 -1
- package/dist/labs/index.js +1 -0
- package/dist/labs/index.js.map +1 -1
- package/dist/properties/ts/odyssey-react-mui.js +4 -0
- package/dist/properties/ts/odyssey-react-mui.js.map +1 -1
- package/dist/src/Autocomplete.d.ts +23 -3
- package/dist/src/Autocomplete.d.ts.map +1 -1
- package/dist/src/Breadcrumbs.d.ts +31 -0
- package/dist/src/Breadcrumbs.d.ts.map +1 -0
- package/dist/src/Link.d.ts +6 -1
- package/dist/src/Link.d.ts.map +1 -1
- package/dist/src/MenuButton.d.ts +1 -1
- package/dist/src/MenuButton.d.ts.map +1 -1
- package/dist/src/OdysseyCacheProvider.d.ts +6 -1
- package/dist/src/OdysseyCacheProvider.d.ts.map +1 -1
- package/dist/src/OdysseyProvider.d.ts +1 -1
- package/dist/src/OdysseyProvider.d.ts.map +1 -1
- package/dist/src/OdysseyThemeProvider.d.ts +2 -1
- package/dist/src/OdysseyThemeProvider.d.ts.map +1 -1
- package/dist/src/OdysseyTranslationProvider.d.ts +1 -1
- package/dist/src/OdysseyTranslationProvider.d.ts.map +1 -1
- package/dist/src/PasswordField.d.ts +8 -0
- package/dist/src/PasswordField.d.ts.map +1 -1
- package/dist/src/Select.d.ts +1 -54
- package/dist/src/Select.d.ts.map +1 -1
- package/dist/src/Tabs.d.ts +7 -2
- package/dist/src/Tabs.d.ts.map +1 -1
- package/dist/src/Typography.d.ts +11 -15
- package/dist/src/Typography.d.ts.map +1 -1
- package/dist/src/createShadowDom.d.ts +16 -0
- package/dist/src/createShadowDom.d.ts.map +1 -0
- package/dist/src/{OdysseyI18n.d.ts → i18n.d.ts} +7 -2
- package/dist/src/i18n.d.ts.map +1 -0
- package/dist/src/index.d.ts +2 -0
- package/dist/src/index.d.ts.map +1 -1
- package/dist/src/labs/GroupPicker.d.ts +25 -0
- package/dist/src/labs/GroupPicker.d.ts.map +1 -0
- package/dist/src/labs/index.d.ts +1 -0
- package/dist/src/labs/index.d.ts.map +1 -1
- package/dist/src/properties/ts/odyssey-react-mui.d.ts +4 -0
- package/dist/src/properties/ts/odyssey-react-mui.d.ts.map +1 -1
- package/dist/src/theme/components.d.ts +4 -1
- package/dist/src/theme/components.d.ts.map +1 -1
- package/dist/src/theme/createOdysseyMuiTheme.d.ts +23 -0
- package/dist/src/theme/createOdysseyMuiTheme.d.ts.map +1 -0
- package/dist/src/theme/mixins.d.ts +3 -1
- package/dist/src/theme/mixins.d.ts.map +1 -1
- package/dist/src/theme/palette.d.ts +3 -1
- package/dist/src/theme/palette.d.ts.map +1 -1
- package/dist/src/theme/shape.d.ts +3 -1
- package/dist/src/theme/shape.d.ts.map +1 -1
- package/dist/src/theme/spacing.d.ts +3 -1
- package/dist/src/theme/spacing.d.ts.map +1 -1
- package/dist/src/theme/theme.d.ts +1 -8
- package/dist/src/theme/theme.d.ts.map +1 -1
- package/dist/src/theme/typography.d.ts +3 -1
- package/dist/src/theme/typography.d.ts.map +1 -1
- package/dist/theme/components.js +112 -67
- package/dist/theme/components.js.map +1 -1
- package/dist/theme/createOdysseyMuiTheme.js +51 -0
- package/dist/theme/createOdysseyMuiTheme.js.map +1 -0
- package/dist/theme/mixins.js +4 -1
- package/dist/theme/mixins.js.map +1 -1
- package/dist/theme/palette.js +4 -1
- package/dist/theme/palette.js.map +1 -1
- package/dist/theme/shape.js +4 -1
- package/dist/theme/shape.js.map +1 -1
- package/dist/theme/spacing.js +4 -1
- package/dist/theme/spacing.js.map +1 -1
- package/dist/theme/theme.js +1 -20
- package/dist/theme/theme.js.map +1 -1
- package/dist/theme/typography.js +4 -1
- package/dist/theme/typography.js.map +1 -1
- package/dist/tsconfig.production.tsbuildinfo +1 -1
- package/package.json +4 -4
- package/scripts/properties-to-ts.js +1 -1
- package/src/Autocomplete.tsx +47 -3
- package/src/Breadcrumbs.tsx +199 -0
- package/src/Link.tsx +7 -1
- package/src/MenuButton.tsx +2 -3
- package/src/OdysseyCacheProvider.tsx +9 -1
- package/src/OdysseyProvider.tsx +9 -2
- package/src/OdysseyThemeProvider.tsx +8 -2
- package/src/OdysseyTranslationProvider.test.tsx +2 -2
- package/src/OdysseyTranslationProvider.tsx +1 -1
- package/src/PasswordField.tsx +24 -8
- package/src/Select.tsx +147 -152
- package/src/Tabs.tsx +24 -12
- package/src/Typography.tsx +0 -26
- package/src/createShadowDom.ts +46 -0
- package/src/{OdysseyI18n.ts → i18n.ts} +2 -2
- package/src/index.ts +2 -0
- package/src/labs/GroupPicker.tsx +241 -0
- package/src/labs/README.md +1 -1
- package/src/labs/datePickerTheme.tsx +2 -2
- package/src/labs/index.ts +1 -0
- package/src/properties/odyssey-react-mui.properties +4 -0
- package/src/properties/ts/odyssey-react-mui.ts +1 -1
- package/src/theme/components.tsx +61 -13
- package/src/theme/createOdysseyMuiTheme.ts +47 -0
- package/src/theme/mixins.ts +5 -1
- package/src/theme/palette.ts +5 -3
- package/src/theme/shape.ts +5 -1
- package/src/theme/spacing.ts +5 -3
- package/src/theme/theme.ts +1 -26
- package/src/theme/typography.ts +5 -3
- package/dist/OdysseyI18n.js.map +0 -1
- package/dist/src/OdysseyI18n.d.ts.map +0 -1
package/src/Select.tsx
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import { ReactNode,
|
|
13
|
+
import { ReactNode, memo, useCallback, useMemo, useState } from "react";
|
|
14
14
|
import {
|
|
15
15
|
Box,
|
|
16
16
|
Chip,
|
|
@@ -100,173 +100,168 @@ export type SelectProps = {
|
|
|
100
100
|
* - { text: string, type: "heading" } — Used to display a group heading with the text
|
|
101
101
|
*/
|
|
102
102
|
|
|
103
|
-
const Select =
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
// or an empty array (if it's a multi-select)
|
|
125
|
-
if (typeof value === "undefined") {
|
|
126
|
-
value = isMultiSelect ? [] : "";
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
const [selectedValue, setSelectedValue] = useState<string | string[]>(
|
|
130
|
-
value
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
const onChange = useCallback(
|
|
134
|
-
(event: SelectChangeEvent<string | string[]>, child: ReactNode) => {
|
|
135
|
-
const {
|
|
136
|
-
target: { value },
|
|
137
|
-
} = event;
|
|
103
|
+
const Select = ({
|
|
104
|
+
errorMessage,
|
|
105
|
+
hint,
|
|
106
|
+
id: idOverride,
|
|
107
|
+
isDisabled = false,
|
|
108
|
+
isMultiSelect = false,
|
|
109
|
+
isOptional = false,
|
|
110
|
+
label,
|
|
111
|
+
name: nameOverride,
|
|
112
|
+
onBlur,
|
|
113
|
+
onChange: onChangeProp,
|
|
114
|
+
onFocus,
|
|
115
|
+
value,
|
|
116
|
+
testId,
|
|
117
|
+
options,
|
|
118
|
+
}: SelectProps) => {
|
|
119
|
+
// If there's no value set, we set it to a blank string (if it's a single-select)
|
|
120
|
+
// or an empty array (if it's a multi-select)
|
|
121
|
+
if (typeof value === "undefined") {
|
|
122
|
+
value = isMultiSelect ? [] : "";
|
|
123
|
+
}
|
|
138
124
|
|
|
139
|
-
|
|
140
|
-
// for multi-selects
|
|
141
|
-
if (isMultiSelect) {
|
|
142
|
-
setSelectedValue(
|
|
143
|
-
typeof value === "string" ? value.split(",") : value
|
|
144
|
-
);
|
|
145
|
-
} else {
|
|
146
|
-
setSelectedValue(value);
|
|
147
|
-
}
|
|
125
|
+
const [selectedValue, setSelectedValue] = useState<string | string[]>(value);
|
|
148
126
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
[isMultiSelect, onChangeProp, setSelectedValue]
|
|
155
|
-
);
|
|
127
|
+
const onChange = useCallback(
|
|
128
|
+
(event: SelectChangeEvent<string | string[]>, child: ReactNode) => {
|
|
129
|
+
const {
|
|
130
|
+
target: { value },
|
|
131
|
+
} = event;
|
|
156
132
|
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
value: option.value || option.text,
|
|
164
|
-
type: option.type === "heading" ? "heading" : "option",
|
|
165
|
-
};
|
|
133
|
+
// Set the field value, with some additional logic to handle array values
|
|
134
|
+
// for multi-selects
|
|
135
|
+
if (isMultiSelect) {
|
|
136
|
+
setSelectedValue(typeof value === "string" ? value.split(",") : value);
|
|
137
|
+
} else {
|
|
138
|
+
setSelectedValue(value);
|
|
166
139
|
}
|
|
167
140
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
if (typeof selected === "string") {
|
|
176
|
-
return undefined;
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// Convert the selected options array into <Chip>s
|
|
180
|
-
const renderedChips = selected
|
|
181
|
-
.map((item: string) => {
|
|
182
|
-
const selectedOption = normalizedOptions.find(
|
|
183
|
-
(option) => option.value === item
|
|
184
|
-
);
|
|
141
|
+
// Trigger the onChange event, if one has been passed
|
|
142
|
+
if (onChangeProp) {
|
|
143
|
+
onChangeProp(event, child);
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
[isMultiSelect, onChangeProp, setSelectedValue]
|
|
147
|
+
);
|
|
185
148
|
|
|
186
|
-
|
|
187
|
-
|
|
149
|
+
// Normalize the options array to accommodate the various
|
|
150
|
+
// data types that might be passed
|
|
151
|
+
const normalizedOptions = useMemo(
|
|
152
|
+
() =>
|
|
153
|
+
options.map((option) =>
|
|
154
|
+
typeof option === "object"
|
|
155
|
+
? {
|
|
156
|
+
text: option.text,
|
|
157
|
+
value: option.value || option.text,
|
|
158
|
+
type: option.type === "heading" ? "heading" : "option",
|
|
188
159
|
}
|
|
160
|
+
: { text: option, value: option, type: "option" }
|
|
161
|
+
),
|
|
162
|
+
[options]
|
|
163
|
+
);
|
|
189
164
|
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
165
|
+
const renderValue = useCallback(
|
|
166
|
+
(selected: string | string[]) => {
|
|
167
|
+
// If the selected value isn't an array, then we don't need to display
|
|
168
|
+
// chips and should fall back to the default render behavior
|
|
169
|
+
if (typeof selected === "string") {
|
|
170
|
+
return undefined;
|
|
171
|
+
}
|
|
193
172
|
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
173
|
+
// Convert the selected options array into <Chip>s
|
|
174
|
+
const renderedChips = selected
|
|
175
|
+
.map((item: string) => {
|
|
176
|
+
const selectedOption = normalizedOptions.find(
|
|
177
|
+
(option) => option.value === item
|
|
178
|
+
);
|
|
197
179
|
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
},
|
|
202
|
-
[normalizedOptions]
|
|
203
|
-
);
|
|
180
|
+
if (!selectedOption) {
|
|
181
|
+
return null;
|
|
182
|
+
}
|
|
204
183
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
184
|
+
return <Chip key={item} label={selectedOption.text} />;
|
|
185
|
+
})
|
|
186
|
+
.filter(Boolean);
|
|
187
|
+
|
|
188
|
+
if (renderedChips.length === 0) {
|
|
189
|
+
return null;
|
|
210
190
|
}
|
|
211
191
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
</MenuItem>
|
|
219
|
-
);
|
|
220
|
-
});
|
|
192
|
+
// We need the <Box> to surround the <Chip>s for
|
|
193
|
+
// proper styling
|
|
194
|
+
return <Box>{renderedChips}</Box>;
|
|
195
|
+
},
|
|
196
|
+
[normalizedOptions]
|
|
197
|
+
);
|
|
221
198
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
onBlur={onBlur}
|
|
231
|
-
onChange={onChange}
|
|
232
|
-
onFocus={onFocus}
|
|
233
|
-
ref={ref}
|
|
234
|
-
renderValue={isMultiSelect ? renderValue : undefined}
|
|
235
|
-
value={selectedValue}
|
|
236
|
-
labelId={label}
|
|
237
|
-
/>
|
|
238
|
-
),
|
|
239
|
-
[
|
|
240
|
-
children,
|
|
241
|
-
idOverride,
|
|
242
|
-
isMultiSelect,
|
|
243
|
-
label,
|
|
244
|
-
nameOverride,
|
|
245
|
-
onBlur,
|
|
246
|
-
onChange,
|
|
247
|
-
onFocus,
|
|
248
|
-
ref,
|
|
249
|
-
renderValue,
|
|
250
|
-
selectedValue,
|
|
251
|
-
testId,
|
|
252
|
-
]
|
|
253
|
-
);
|
|
199
|
+
// Convert the options into the ReactNode children
|
|
200
|
+
// that will populate the <Select>
|
|
201
|
+
const children = useMemo(
|
|
202
|
+
() =>
|
|
203
|
+
normalizedOptions.map((option) => {
|
|
204
|
+
if (option.type === "heading") {
|
|
205
|
+
return <ListSubheader key={option.text}>{option.text}</ListSubheader>;
|
|
206
|
+
}
|
|
254
207
|
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
208
|
+
return (
|
|
209
|
+
<MenuItem key={option.value} value={option.value}>
|
|
210
|
+
{isMultiSelect && (
|
|
211
|
+
<MuiCheckbox checked={selectedValue.includes(option.value)} />
|
|
212
|
+
)}
|
|
213
|
+
{option.text}
|
|
214
|
+
</MenuItem>
|
|
215
|
+
);
|
|
216
|
+
}),
|
|
217
|
+
[isMultiSelect, normalizedOptions, selectedValue]
|
|
218
|
+
);
|
|
219
|
+
|
|
220
|
+
const renderFieldComponent = useCallback(
|
|
221
|
+
({ ariaDescribedBy, id }) => (
|
|
222
|
+
<MuiSelect
|
|
223
|
+
aria-describedby={ariaDescribedBy}
|
|
224
|
+
children={children}
|
|
225
|
+
data-se={testId}
|
|
226
|
+
id={id}
|
|
227
|
+
labelId={label}
|
|
228
|
+
multiple={isMultiSelect}
|
|
229
|
+
name={nameOverride ?? id}
|
|
230
|
+
onBlur={onBlur}
|
|
231
|
+
onChange={onChange}
|
|
232
|
+
onFocus={onFocus}
|
|
233
|
+
renderValue={isMultiSelect ? renderValue : undefined}
|
|
234
|
+
value={selectedValue}
|
|
266
235
|
/>
|
|
267
|
-
)
|
|
268
|
-
|
|
269
|
-
|
|
236
|
+
),
|
|
237
|
+
[
|
|
238
|
+
children,
|
|
239
|
+
isMultiSelect,
|
|
240
|
+
label,
|
|
241
|
+
nameOverride,
|
|
242
|
+
onBlur,
|
|
243
|
+
onChange,
|
|
244
|
+
onFocus,
|
|
245
|
+
renderValue,
|
|
246
|
+
selectedValue,
|
|
247
|
+
testId,
|
|
248
|
+
]
|
|
249
|
+
);
|
|
250
|
+
|
|
251
|
+
return (
|
|
252
|
+
<Field
|
|
253
|
+
errorMessage={errorMessage}
|
|
254
|
+
fieldType="single"
|
|
255
|
+
hasVisibleLabel
|
|
256
|
+
hint={hint}
|
|
257
|
+
id={idOverride}
|
|
258
|
+
isDisabled={isDisabled}
|
|
259
|
+
isOptional={isOptional}
|
|
260
|
+
label={label}
|
|
261
|
+
renderFieldComponent={renderFieldComponent}
|
|
262
|
+
/>
|
|
263
|
+
);
|
|
264
|
+
};
|
|
270
265
|
|
|
271
266
|
const MemoizedSelect = memo(Select);
|
|
272
267
|
MemoizedSelect.displayName = "Select";
|
package/src/Tabs.tsx
CHANGED
|
@@ -10,7 +10,14 @@
|
|
|
10
10
|
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
|
-
import
|
|
13
|
+
import {
|
|
14
|
+
TabContext as MuiTabContext,
|
|
15
|
+
TabList as MuiTabList,
|
|
16
|
+
TabListProps as MuiTabListProps,
|
|
17
|
+
TabPanel as MuiTabPanel,
|
|
18
|
+
} from "@mui/lab";
|
|
19
|
+
import { Tab as MuiTab } from "@mui/material";
|
|
20
|
+
import {
|
|
14
21
|
ReactElement,
|
|
15
22
|
ReactNode,
|
|
16
23
|
memo,
|
|
@@ -18,12 +25,6 @@ import React, {
|
|
|
18
25
|
useEffect,
|
|
19
26
|
useState,
|
|
20
27
|
} from "react";
|
|
21
|
-
import { Tab as MuiTab } from "@mui/material";
|
|
22
|
-
import {
|
|
23
|
-
TabList as MuiTabList,
|
|
24
|
-
TabPanel as MuiTabPanel,
|
|
25
|
-
TabContext as MuiTabContext,
|
|
26
|
-
} from "@mui/lab";
|
|
27
28
|
import { SeleniumProps } from "./SeleniumProps";
|
|
28
29
|
|
|
29
30
|
export type TabItemProps = {
|
|
@@ -67,16 +68,27 @@ export type TabsProps = {
|
|
|
67
68
|
* Identifier for the selected tab.
|
|
68
69
|
*/
|
|
69
70
|
value?: string;
|
|
71
|
+
/**
|
|
72
|
+
* Callback fired when the active tab is changed.
|
|
73
|
+
*/
|
|
74
|
+
onChange?: MuiTabListProps["onChange"];
|
|
70
75
|
};
|
|
71
76
|
|
|
72
|
-
const Tabs = ({
|
|
77
|
+
const Tabs = ({
|
|
78
|
+
ariaLabel,
|
|
79
|
+
initialValue,
|
|
80
|
+
tabs,
|
|
81
|
+
value,
|
|
82
|
+
onChange: onChangeProp,
|
|
83
|
+
}: TabsProps) => {
|
|
73
84
|
const [tabState, setTabState] = useState(initialValue ?? value ?? "0");
|
|
74
85
|
|
|
75
|
-
const onChange = useCallback(
|
|
76
|
-
(
|
|
77
|
-
setTabState(
|
|
86
|
+
const onChange = useCallback<NonNullable<MuiTabListProps["onChange"]>>(
|
|
87
|
+
(event, value: string) => {
|
|
88
|
+
setTabState(value);
|
|
89
|
+
onChangeProp?.(event, value);
|
|
78
90
|
},
|
|
79
|
-
[]
|
|
91
|
+
[onChangeProp]
|
|
80
92
|
);
|
|
81
93
|
|
|
82
94
|
useEffect(() => {
|
package/src/Typography.tsx
CHANGED
|
@@ -70,10 +70,6 @@ export type TypographyProps = {
|
|
|
70
70
|
* The text content of the component.
|
|
71
71
|
*/
|
|
72
72
|
children: ReactNode;
|
|
73
|
-
/**
|
|
74
|
-
* Additional classes to add to the component.
|
|
75
|
-
*/
|
|
76
|
-
classes?: object;
|
|
77
73
|
/**
|
|
78
74
|
* The color of the text.
|
|
79
75
|
*/
|
|
@@ -93,7 +89,6 @@ const Typography = ({
|
|
|
93
89
|
ariaLabel,
|
|
94
90
|
ariaLabelledBy,
|
|
95
91
|
children,
|
|
96
|
-
classes,
|
|
97
92
|
color,
|
|
98
93
|
component: componentProp,
|
|
99
94
|
testId,
|
|
@@ -118,7 +113,6 @@ const Typography = ({
|
|
|
118
113
|
aria-label={ariaLabel}
|
|
119
114
|
aria-labelledby={ariaLabelledBy}
|
|
120
115
|
children={children}
|
|
121
|
-
classes={classes}
|
|
122
116
|
color={color}
|
|
123
117
|
component={component}
|
|
124
118
|
data-se={testId}
|
|
@@ -135,7 +129,6 @@ const Heading1 = ({
|
|
|
135
129
|
ariaLabel,
|
|
136
130
|
ariaLabelledBy,
|
|
137
131
|
children,
|
|
138
|
-
classes,
|
|
139
132
|
color,
|
|
140
133
|
component,
|
|
141
134
|
testId,
|
|
@@ -145,7 +138,6 @@ const Heading1 = ({
|
|
|
145
138
|
ariaLabel={ariaLabel}
|
|
146
139
|
ariaLabelledBy={ariaLabelledBy}
|
|
147
140
|
children={children}
|
|
148
|
-
classes={classes}
|
|
149
141
|
color={color}
|
|
150
142
|
component={component}
|
|
151
143
|
data-se={testId}
|
|
@@ -161,7 +153,6 @@ const Heading2 = ({
|
|
|
161
153
|
ariaLabel,
|
|
162
154
|
ariaLabelledBy,
|
|
163
155
|
children,
|
|
164
|
-
classes,
|
|
165
156
|
color,
|
|
166
157
|
component,
|
|
167
158
|
testId,
|
|
@@ -171,7 +162,6 @@ const Heading2 = ({
|
|
|
171
162
|
ariaLabel={ariaLabel}
|
|
172
163
|
ariaLabelledBy={ariaLabelledBy}
|
|
173
164
|
children={children}
|
|
174
|
-
classes={classes}
|
|
175
165
|
color={color}
|
|
176
166
|
component={component}
|
|
177
167
|
data-se={testId}
|
|
@@ -187,7 +177,6 @@ const Heading3 = ({
|
|
|
187
177
|
ariaLabel,
|
|
188
178
|
ariaLabelledBy,
|
|
189
179
|
children,
|
|
190
|
-
classes,
|
|
191
180
|
color,
|
|
192
181
|
component,
|
|
193
182
|
testId,
|
|
@@ -197,7 +186,6 @@ const Heading3 = ({
|
|
|
197
186
|
ariaLabel={ariaLabel}
|
|
198
187
|
ariaLabelledBy={ariaLabelledBy}
|
|
199
188
|
children={children}
|
|
200
|
-
classes={classes}
|
|
201
189
|
color={color}
|
|
202
190
|
component={component}
|
|
203
191
|
data-se={testId}
|
|
@@ -213,7 +201,6 @@ const Heading4 = ({
|
|
|
213
201
|
ariaLabel,
|
|
214
202
|
ariaLabelledBy,
|
|
215
203
|
children,
|
|
216
|
-
classes,
|
|
217
204
|
color,
|
|
218
205
|
component,
|
|
219
206
|
testId,
|
|
@@ -223,7 +210,6 @@ const Heading4 = ({
|
|
|
223
210
|
ariaLabel={ariaLabel}
|
|
224
211
|
ariaLabelledBy={ariaLabelledBy}
|
|
225
212
|
children={children}
|
|
226
|
-
classes={classes}
|
|
227
213
|
color={color}
|
|
228
214
|
component={component}
|
|
229
215
|
data-se={testId}
|
|
@@ -239,7 +225,6 @@ const Heading5 = ({
|
|
|
239
225
|
ariaLabel,
|
|
240
226
|
ariaLabelledBy,
|
|
241
227
|
children,
|
|
242
|
-
classes,
|
|
243
228
|
color,
|
|
244
229
|
component,
|
|
245
230
|
testId,
|
|
@@ -249,7 +234,6 @@ const Heading5 = ({
|
|
|
249
234
|
ariaLabel={ariaLabel}
|
|
250
235
|
ariaLabelledBy={ariaLabelledBy}
|
|
251
236
|
children={children}
|
|
252
|
-
classes={classes}
|
|
253
237
|
color={color}
|
|
254
238
|
component={component}
|
|
255
239
|
data-se={testId}
|
|
@@ -265,7 +249,6 @@ const Heading6 = ({
|
|
|
265
249
|
ariaLabel,
|
|
266
250
|
ariaLabelledBy,
|
|
267
251
|
children,
|
|
268
|
-
classes,
|
|
269
252
|
color,
|
|
270
253
|
component,
|
|
271
254
|
testId,
|
|
@@ -275,7 +258,6 @@ const Heading6 = ({
|
|
|
275
258
|
ariaLabel={ariaLabel}
|
|
276
259
|
ariaLabelledBy={ariaLabelledBy}
|
|
277
260
|
children={children}
|
|
278
|
-
classes={classes}
|
|
279
261
|
color={color}
|
|
280
262
|
component={component}
|
|
281
263
|
data-se={testId}
|
|
@@ -291,7 +273,6 @@ const Paragraph = ({
|
|
|
291
273
|
ariaLabel,
|
|
292
274
|
ariaLabelledBy,
|
|
293
275
|
children,
|
|
294
|
-
classes,
|
|
295
276
|
color,
|
|
296
277
|
component,
|
|
297
278
|
testId,
|
|
@@ -301,7 +282,6 @@ const Paragraph = ({
|
|
|
301
282
|
ariaLabel={ariaLabel}
|
|
302
283
|
ariaLabelledBy={ariaLabelledBy}
|
|
303
284
|
children={children}
|
|
304
|
-
classes={classes}
|
|
305
285
|
color={color}
|
|
306
286
|
component={component}
|
|
307
287
|
data-se={testId}
|
|
@@ -317,7 +297,6 @@ const Subordinate = ({
|
|
|
317
297
|
ariaLabel,
|
|
318
298
|
ariaLabelledBy,
|
|
319
299
|
children,
|
|
320
|
-
classes,
|
|
321
300
|
color,
|
|
322
301
|
component,
|
|
323
302
|
testId,
|
|
@@ -327,7 +306,6 @@ const Subordinate = ({
|
|
|
327
306
|
ariaLabel={ariaLabel}
|
|
328
307
|
ariaLabelledBy={ariaLabelledBy}
|
|
329
308
|
children={children}
|
|
330
|
-
classes={classes}
|
|
331
309
|
color={color}
|
|
332
310
|
component={component}
|
|
333
311
|
data-se={testId}
|
|
@@ -343,7 +321,6 @@ const Support = ({
|
|
|
343
321
|
ariaLabel,
|
|
344
322
|
ariaLabelledBy,
|
|
345
323
|
children,
|
|
346
|
-
classes,
|
|
347
324
|
color,
|
|
348
325
|
component,
|
|
349
326
|
testId,
|
|
@@ -353,7 +330,6 @@ const Support = ({
|
|
|
353
330
|
ariaLabel={ariaLabel}
|
|
354
331
|
ariaLabelledBy={ariaLabelledBy}
|
|
355
332
|
children={children}
|
|
356
|
-
classes={classes}
|
|
357
333
|
color={color}
|
|
358
334
|
component={component}
|
|
359
335
|
data-se={testId}
|
|
@@ -369,7 +345,6 @@ const Legend = ({
|
|
|
369
345
|
ariaLabel,
|
|
370
346
|
ariaLabelledBy,
|
|
371
347
|
children,
|
|
372
|
-
classes,
|
|
373
348
|
color,
|
|
374
349
|
component,
|
|
375
350
|
testId,
|
|
@@ -379,7 +354,6 @@ const Legend = ({
|
|
|
379
354
|
ariaLabel={ariaLabel}
|
|
380
355
|
ariaLabelledBy={ariaLabelledBy}
|
|
381
356
|
children={children}
|
|
382
|
-
classes={classes}
|
|
383
357
|
color={color}
|
|
384
358
|
component={component}
|
|
385
359
|
data-se={testId}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) 2023-present, Okta, Inc. and/or its affiliates. All rights reserved.
|
|
3
|
+
* The Okta software accompanied by this notice is provided pursuant to the Apache License, Version 2.0 (the "License.")
|
|
4
|
+
*
|
|
5
|
+
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0.
|
|
6
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
7
|
+
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
8
|
+
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
9
|
+
*
|
|
10
|
+
* See the License for the specific language governing permissions and limitations under the License.
|
|
11
|
+
*/
|
|
12
|
+
|
|
13
|
+
export const createShadowDom = (containerElement: HTMLElement) => {
|
|
14
|
+
const shadowContainer = containerElement.attachShadow({ mode: "open" });
|
|
15
|
+
const emotionRootElement = document.createElement("style");
|
|
16
|
+
const shadowRootElement = document.createElement("div");
|
|
17
|
+
|
|
18
|
+
shadowContainer.appendChild(emotionRootElement);
|
|
19
|
+
shadowContainer.appendChild(shadowRootElement);
|
|
20
|
+
|
|
21
|
+
return {
|
|
22
|
+
emotionRootElement,
|
|
23
|
+
shadowRootElement,
|
|
24
|
+
};
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
// --DOCS--
|
|
28
|
+
|
|
29
|
+
// const {
|
|
30
|
+
// emotionRootElement,
|
|
31
|
+
// shadowRootElement,
|
|
32
|
+
// } = (
|
|
33
|
+
// createShadowDom(
|
|
34
|
+
// document.querySelector('#root') as HTMLElement
|
|
35
|
+
// )
|
|
36
|
+
// )
|
|
37
|
+
|
|
38
|
+
// ReactDOM
|
|
39
|
+
// .createRoot(
|
|
40
|
+
// shadowRootElement
|
|
41
|
+
// )
|
|
42
|
+
// .render(
|
|
43
|
+
// <OdysseyProvider emotionRootElement={emotionRootElement} shadowRootElement={shadowRootElement}>
|
|
44
|
+
// <App />
|
|
45
|
+
// </OdysseyProvider>
|
|
46
|
+
// )
|
|
@@ -103,5 +103,5 @@ Object.entries(resources).forEach(([locale, property]) => {
|
|
|
103
103
|
i18n.addResourceBundle(locale, defaultNS, property);
|
|
104
104
|
});
|
|
105
105
|
|
|
106
|
-
|
|
107
|
-
export
|
|
106
|
+
export const odysseyTranslate = i18n.t.bind(i18n);
|
|
107
|
+
export { i18n };
|
package/src/index.ts
CHANGED
|
@@ -59,6 +59,7 @@ export { useOdysseyDesignTokens } from "./OdysseyDesignTokensContext";
|
|
|
59
59
|
export * from "./Autocomplete";
|
|
60
60
|
export * from "./Banner";
|
|
61
61
|
export * from "./Box";
|
|
62
|
+
export * from "./Breadcrumbs";
|
|
62
63
|
export * from "./Button";
|
|
63
64
|
export * from "./Callout";
|
|
64
65
|
export * from "./Checkbox";
|
|
@@ -74,6 +75,7 @@ export * from "./MenuItem";
|
|
|
74
75
|
export * from "./NativeSelect";
|
|
75
76
|
export * from "./NullElement";
|
|
76
77
|
export * from "./OdysseyCacheProvider";
|
|
78
|
+
export { odysseyTranslate } from "./i18n";
|
|
77
79
|
export * from "./OdysseyProvider";
|
|
78
80
|
export * from "./OdysseyThemeProvider";
|
|
79
81
|
export * from "./OdysseyTranslationProvider";
|