@keycloakify/keycloak-ui-shared 260305.0.0 → 260500.0.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.
@@ -19,7 +19,7 @@ export type BaseEnvironment = {
19
19
  clientId: string;
20
20
  /** The base URL of the resources. */
21
21
  resourceUrl: string;
22
- /** The source URL for the the logo image. */
22
+ /** The source URL for the logo image. */
23
23
  logo: string;
24
24
  /** The URL to be followed when the logo is clicked. */
25
25
  logoUrl: string;
@@ -58,6 +58,7 @@ export const SwitchControl = <
58
58
  id={props.name}
59
59
  data-testid={debeerify(props.name)}
60
60
  label={labelOn}
61
+ aria-label={props.label}
61
62
  isChecked={stringify ? value === "true" : value}
62
63
  onChange={(e, checked) => {
63
64
  const value = stringify ? checked.toString() : checked;
@@ -262,7 +262,7 @@ function DataTable<T>({
262
262
  rows[index + 1].cells.length === 0
263
263
  ? undefined
264
264
  : {
265
- isExpanded: !!expandedRows[index],
265
+ isExpanded: expandedRows[index] ?? false,
266
266
  rowIndex: index,
267
267
  expandId: "expandable-row-",
268
268
  onToggle: (_, rowIndex, isOpen) => {
@@ -282,7 +282,7 @@ function DataTable<T>({
282
282
  />
283
283
  </Tr>
284
284
  ) : (
285
- <Tr isExpanded={!!expandedRows[index - 1]}>
285
+ <Tr isExpanded={expandedRows[index - 1] ?? false}>
286
286
  <Td />
287
287
  <Td colSpan={columns.length}>
288
288
  <ExpandableRowContent>
@@ -361,7 +361,7 @@ export type DataListProps<T> = Omit<
361
361
  * @param {DataListProps} props - The properties.
362
362
  * @param {string} props.ariaLabelKey - The aria label key i18n key to lookup the label
363
363
  * @param {string} props.searchPlaceholderKey - The i18n key to lookup the placeholder for the search box
364
- * @param {boolean} props.isPaginated - if true the the loader will be called with first, max and search and a pager will be added in the header
364
+ * @param {boolean} props.isPaginated - if true, the loader will be called with first, max and search and a pager will be added in the header
365
365
  * @param {(first?: number, max?: number, search?: string) => Promise<T[]>} props.loader - loader function that will fetch the data to display first, max and search are only applicable when isPaginated = true
366
366
  * @param {Field<T>} props.columns - definition of the columns
367
367
  * @param {Field<T>} props.detailColumns - definition of the columns expandable columns
@@ -22,7 +22,7 @@ export type KeycloakSelectProps = Omit<
22
22
  "name" | "toggle" | "selected" | "onClick" | "onSelect" | "variant"
23
23
  > & {
24
24
  toggleId?: string;
25
- onFilter?: (value: string) => JSX.Element[];
25
+ onFilter?: (value: string) => void;
26
26
  onClear?: () => void;
27
27
  variant?: Variant;
28
28
  isDisabled?: boolean;
@@ -33,6 +33,7 @@ export const MultiInputComponent = ({
33
33
  form={form}
34
34
  aria-label={labelAttribute(t, attribute)}
35
35
  name={fieldName(attribute.name)!}
36
+ defaultValue={[attribute.defaultValue || ""]}
36
37
  addButtonLabel={t("addMultivaluedLabel", {
37
38
  fieldLabel: labelAttribute(t, attribute),
38
39
  })}
@@ -31,7 +31,7 @@ export const OptionComponent = (props: UserProfileFieldProps) => {
31
31
  <Controller
32
32
  name={fieldName(attribute.name)}
33
33
  control={form.control}
34
- defaultValue=""
34
+ defaultValue={attribute.defaultValue}
35
35
  render={({ field }) => (
36
36
  <>
37
37
  {options.map((option) => (
@@ -41,15 +41,15 @@ export const OptionComponent = (props: UserProfileFieldProps) => {
41
41
  data-testid={option}
42
42
  label={label(props.t, optionLabel[option], option, prefix)}
43
43
  value={option}
44
- isChecked={field.value.includes(option)}
44
+ isChecked={field.value?.includes(option)}
45
45
  onChange={() => {
46
46
  if (isMultiSelect) {
47
- if (field.value.includes(option)) {
47
+ if (field.value?.includes(option)) {
48
48
  field.onChange(
49
- field.value.filter((item: string) => item !== option),
49
+ field.value?.filter((item: string) => item !== option),
50
50
  );
51
51
  } else {
52
- field.onChange([...field.value, option]);
52
+ field.onChange([...(field.value || []), option]);
53
53
  }
54
54
  } else {
55
55
  field.onChange([option]);
@@ -70,7 +70,7 @@ export const SelectComponent = (props: UserProfileFieldProps) => {
70
70
  <UserProfileGroup {...props}>
71
71
  <Controller
72
72
  name={fieldName(attribute.name)}
73
- defaultValue=""
73
+ defaultValue={attribute.defaultValue}
74
74
  control={form.control}
75
75
  render={({ field }) => (
76
76
  <KeycloakSelect
@@ -21,6 +21,7 @@ export const TextAreaComponent = (props: UserProfileFieldProps) => {
21
21
  rows={attribute.annotations?.["inputTypeRows"] as number}
22
22
  readOnly={attribute.readOnly}
23
23
  isRequired={isRequired}
24
+ defaultValue={attribute.defaultValue}
24
25
  />
25
26
  </UserProfileGroup>
26
27
  );
@@ -35,6 +35,7 @@ export const TextComponent = (props: UserProfileFieldProps) => {
35
35
  }
36
36
  isDisabled={attribute.readOnly}
37
37
  isRequired={isRequired}
38
+ defaultValue={attribute.defaultValue}
38
39
  {...form.register(fieldName(attribute.name))}
39
40
  />
40
41
  </UserProfileGroup>
@@ -81,9 +81,7 @@ export function setUserProfileServerError<T>(
81
81
  ).forEach((e) => {
82
82
  const params = Object.assign(
83
83
  {},
84
- e.params?.map((p) =>
85
- isBundleKey(p?.toString()) ? t(unWrap(p as string)) : p,
86
- ),
84
+ e.params?.map((p) => (isBundleKey(p) ? t(unWrap(p as string)) : p)),
87
85
  );
88
86
  setError(fieldName(e.field) as keyof T, {
89
87
  message: t(
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@keycloakify/keycloak-ui-shared",
3
- "version": "260305.0.0",
3
+ "version": "260500.0.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git://github.com/keycloakify/keycloak-ui-shared.git"
@@ -13,13 +13,13 @@
13
13
  "@patternfly/react-icons": "^5.4.2",
14
14
  "@patternfly/react-styles": "^5.4.1",
15
15
  "@patternfly/react-table": "^5.4.16",
16
- "i18next": "^25.2.1",
17
- "keycloak-js": "^26.2.0",
18
- "lodash-es": "^4.17.21",
16
+ "i18next": "^25.7.3",
17
+ "keycloak-js": "^26.2.2",
18
+ "lodash-es": "^4.17.22",
19
19
  "react": "^18.3.1",
20
- "react-hook-form": "7.59.0",
21
- "react-i18next": "^15.5.3",
22
- "@keycloak/keycloak-admin-client": "26.3.5",
20
+ "react-hook-form": "7.70.0",
21
+ "react-i18next": "^16.5.1",
22
+ "@keycloak/keycloak-admin-client": "26.5.0",
23
23
  "@types/lodash-es": "^4.17.12",
24
24
  "@types/react": "^18.3.18"
25
25
  },