All Downloads are FREE. Search and download functionalities are using the official Maven repository.

theme.keycloak.v2.admin.resources.assets.ClientSelect-BTkwOwGP.js.map Maven / Gradle / Ivy

There is a newer version: 26.0.7
Show newest version
{"version":3,"file":"ClientSelect-BTkwOwGP.js","sources":["../../src/components/client/ClientSelect.tsx"],"sourcesContent":["import type ClientRepresentation from \"@keycloak/keycloak-admin-client/lib/defs/clientRepresentation\";\nimport type { ClientQuery } from \"@keycloak/keycloak-admin-client/lib/resources/clients\";\nimport { SelectControl, SelectVariant } from \"@keycloak/keycloak-ui-shared\";\nimport { useState } from \"react\";\nimport { useTranslation } from \"react-i18next\";\nimport { useAdminClient } from \"../../admin-client\";\nimport { useFetch } from \"../../utils/useFetch\";\nimport type { ComponentProps } from \"../dynamic/components\";\n\ntype ClientSelectProps = ComponentProps & { variant?: `${SelectVariant}` };\n\nexport const ClientSelect = ({\n  name,\n  label,\n  helpText,\n  defaultValue,\n  isDisabled = false,\n  required = false,\n  variant = \"typeahead\",\n}: ClientSelectProps) => {\n  const { adminClient } = useAdminClient();\n\n  const { t } = useTranslation();\n\n  const [clients, setClients] = useState([]);\n  const [search, setSearch] = useState(\"\");\n\n  useFetch(\n    () => {\n      const params: ClientQuery = {\n        max: 20,\n      };\n      if (search) {\n        params.clientId = search;\n        params.search = true;\n      }\n      return adminClient.clients.find(params);\n    },\n    (clients) => setClients(clients),\n    [search],\n  );\n\n  return (\n     setSearch(value)}\n      variant={variant}\n      isDisabled={isDisabled}\n      options={clients.map(({ id, clientId }) => ({\n        key: id!,\n        value: clientId!,\n      }))}\n    />\n  );\n};\n"],"names":["ClientSelect","name","label","helpText","defaultValue","isDisabled","required","variant","adminClient","useAdminClient","useTranslation","clients","setClients","useState","search","setSearch","useFetch","params","jsx","SelectControl","value","id","clientId"],"mappings":"sIAWO,MAAMA,EAAe,CAAC,CAC3B,KAAAC,EACA,MAAAC,EACA,SAAAC,EACA,aAAAC,EACA,WAAAC,EAAa,GACb,SAAAC,EAAW,GACX,QAAAC,EAAU,WACZ,IAAyB,CACjB,KAAA,CAAE,YAAAC,GAAgBC,IAElB,CAAE,GAAMC,IAER,CAACC,EAASC,CAAU,EAAIC,EAAiC,CAAE,CAAA,EAC3D,CAACC,EAAQC,CAAS,EAAIF,EAAS,EAAE,EAEvC,OAAAG,EACE,IAAM,CACJ,MAAMC,EAAsB,CAC1B,IAAK,EAAA,EAEP,OAAIH,IACFG,EAAO,SAAWH,EAClBG,EAAO,OAAS,IAEXT,EAAY,QAAQ,KAAKS,CAAM,CACxC,EACCN,GAAYC,EAAWD,CAAO,EAC/B,CAACG,CAAM,CAAA,EAIPI,EAACC,EAAA,CACC,KAAAlB,EACA,MAAO,EAAEC,CAAM,EACf,UAAW,EAAEC,CAAS,EACtB,WAAY,CACV,aAAcC,GAAgB,GAC9B,MAAO,CACL,SAAU,CACR,MAAOE,EACP,QAAS,EAAE,UAAU,CACvB,CACF,CACF,EACA,SAAWc,GAAUL,EAAUK,CAAK,EACpC,QAAAb,EACA,WAAAF,EACA,QAASM,EAAQ,IAAI,CAAC,CAAE,GAAAU,EAAI,SAAAC,MAAgB,CAC1C,IAAKD,EACL,MAAOC,CAAA,EACP,CAAA,CAAA,CAGR"}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy