🚀 Socket Launch Week Day 4:Socket MCP Adds Org Alerts, Threat Feed Review, and Package Inspection.Learn more
Sign In

@isoftdata/svelte-user-configuration

Package Overview
Dependencies
Maintainers
12
Versions
59
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@isoftdata/svelte-user-configuration

latest
npmnpm
Version
2.4.0
Version published
Weekly downloads
216
31.71%
Maintainers
12
Weekly downloads
 
Created
Source

Svelte UserConfiguration

This Svelte component provides a user configuration interface, including user account details, site access, group membership, and permissions.

Screenshot of the attachment component Screenshot of the attachment component

Install

pnpm i @isoftdata/svelte-user-configuration

Breaking changes

2.0.0

  • Require Svelte 5
  • Slots -> Snippets
  • Events -> Callbacks

Props

User Account Properties

PropTypeRequiredDefaultDescription
userAccountUserAccount-The user account information.
canToggleActivebooleantrueWhether the user can be activated/deactivated.
canEditAccountInfobooleantrueWhether account details can be edited.
doSendPasswordRecoveryTokenbooleanfalseWhether to allow sending password recovery tokens.
hasPermissionToChangePasswordbooleanfalseWhether the user has permission to change passwords.
myAccountModebooleanfalseWhen true, admin controls will be hidden/disabled. This is designed to be used when using the user account info component standalone so the current session user can edit their own account info, including first & last name, password recovery email, & password.
passwordValidationRulesvalidationRules of the PasswordFields componentundefinedPasswords rules to be enforced during password change.

The passwordValidationRules prop will be used during password setting when hasPermissionToChangePassword or myAccountMode are true .

Site Access Properties

PropTypeRequiredDefaultDescription
userSitesUserSites-List of sites the user has access to.
canEditSiteAccessbooleantrueWhether site access can be edited.

Group Membership Properties

PropTypeRequiredDefaultDescription
groupMembershipGroupMembership-The user's group membership information.
canEditGroupMembershipbooleantrueWhether group memberships can be edited.

Permission List Properties

PropTypeRequiredDefaultDescription
permissionsPermissions-The list of permissions for the user.
permissionValueMapPermissionValueMapnew SvelteMap()A mapping of permissions to their values. Note this must be a SvelteMap or reactivity will not work.
groupPermissionValueMapGroupPermissionValueMapundefinedA mapping of group-based permissions.

Other Properties

PropTypeRequiredDefaultDescription
siteLabelSiteLabel"Site"Label for the site.
showSiteAccessbooleantrueWhether the site access section is shown.
userAccountInfoIconIconName"user"Icon for the user account section.
groupMembershipIconIconName"users"Icon for the group membership section.
permissionListIconIconName"user-lock"Icon for the permission list section.
userSiteAccessIconIconName"industry-windows"Icon for the site access section.
permissionListCardHeaderTitlePermissionListCardHeaderTitle"Permissions"Title for the permission list card header.
usernameInputHTMLInputElement | undefinedundefinedReference to the username input element.

Callbacks

PropTypeDescription
errorErrorFnCallback for handling errors.
successSuccessFnCallback for handling success messages.
deactivateUserDeactivateUserFnFunction to deactivate a user.
confirmPasswordSetConfirmPasswordSetFnFunction called when a password is set.
accountInfoChangedAccountInfoChangedFnFunction called when account info changes.
sendPasswordRecoveryTokenSendPasswordRecoveryTokenFnFunction to send password recovery token.
generateNewActivationPINGenerateNewActivationPINFnFunction to generate a new activation PIN.
permissionValueChangePermissionValueChangeFnFunction called when permissions change.
siteAccessChangeSiteAccessChangeFnFunction called when site access is changed.
groupMembershipChangeGroupMembershipChangeFnFunction called when group membership changes.

Snippets

This component provides snippets for injecting additional content.

Snippet NameDescription
userAccountInfoSlot at the end of the userAccountInfo component's card body
siteAccessSlot at the end of the siteAccess component's card body
userGroupMembershipSlot at the end of the userGroupMembership component's card body
permissionListSlot at the end of the permissionList component's card body

Usage Example in Svelte 5 w/ Runes

<script lang="ts">
	import { UserConfiguration, getGroupHighestPermissionValueMap } from '@isoftdata/svelte-user-configuration'

	interface Props {
		plants: PlantsForDropdown$result['plants']['data']
		groups: Array<Group>
		permissions: UserConfigurationData$result['permissions']['data']
		userAccount: UserAccount
		permissionValueMap?: PermissionValueMap
		groupPermissionMap?: GroupPermissionMap
		authorizedSitesSet?: any
		groupMembershipSet?: any
	}

	let {
		plants,
		groups,
		permissions,
		userAccount = $bindable(),
		permissionValueMap = $bindable(new SvelteMap()),
		groupPermissionMap = new SvelteMap(),
		authorizedSitesSet = $bindable(new SvelteSet<number>()),
		groupMembershipSet = $bindable(new SvelteSet<number>()),
	}: Props = $props()

	let userSites = $derived(
		plants.map(({ id, code, name }) => {
			return { id, code, name, isAuthorized: authorizedSitesSet.has(id) }
		}),
	)
	let groupMembership = $derived(
		groups.map(({ id, name }) => {
			return { id, name, isMember: groupMembershipSet.has(id) }
		}),
	)
	let groupPermissionValueMap = $derived(getGroupHighestPermissionValueMap(groupMembershipSet, groupPermissionMap))
</script>

<UserConfiguration
	siteLabel="Plant"
	bind:userAccount
	bind:usernameInput
	bind:doSendPasswordRecoveryToken={sendPasswordRecoveryToken}
	{userSites}
	{groupMembership}
	{permissions}
	{permissionValueMap}
	{groupPermissionValueMap}
	siteAccessChange={async site => {
		site.isAuthorized ? authorizedSitesSet.add(site.id) : authorizedSitesSet.delete(site.id)
		authorizedSitesSet = new Set(authorizedSitesSet)
	}}
	groupMembershipChange={async ({ id, isMember }) => {
		isMember ? groupMembershipSet.add(id) : groupMembershipSet.delete(id)
		groupMembershipSet = new Set(groupMembershipSet)
	}}
	permissionValueChange={async ({ permissionIds, value }) => {
		for (const id of permissionIds) {
			permissionValueMap.set(id, value)
		}
		permissionValueMap = new SvelteMap(permissionValueMap)
	}}
/>

FAQs

Package last updated on 29 May 2026

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts