@thunderid/react 0.11.4 → 0.13.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/dist/cjs/components/actions/SignInButton/BaseSignInButton.cjs +2 -3
- package/dist/cjs/components/actions/SignInButton/BaseSignInButton.cjs.map +1 -1
- package/dist/cjs/components/actions/SignOutButton/BaseSignOutButton.cjs +2 -3
- package/dist/cjs/components/actions/SignOutButton/BaseSignOutButton.cjs.map +1 -1
- package/dist/cjs/components/actions/SignUpButton/BaseSignUpButton.cjs +2 -3
- package/dist/cjs/components/actions/SignUpButton/BaseSignUpButton.cjs.map +1 -1
- package/dist/cjs/components/adapters/Consent.cjs +34 -27
- package/dist/cjs/components/adapters/Consent.cjs.map +1 -1
- package/dist/cjs/components/adapters/ConsentCheckboxList.cjs +7 -8
- package/dist/cjs/components/adapters/ConsentCheckboxList.cjs.map +1 -1
- package/dist/cjs/components/adapters/ConsentCheckboxList.styles.cjs +8 -9
- package/dist/cjs/components/adapters/ConsentCheckboxList.styles.cjs.map +1 -1
- package/dist/cjs/components/adapters/ImageComponent.cjs +13 -9
- package/dist/cjs/components/adapters/ImageComponent.cjs.map +1 -1
- package/dist/cjs/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.cjs +3 -4
- package/dist/cjs/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.cjs.map +1 -1
- package/dist/cjs/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.cjs +11 -12
- package/dist/cjs/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.cjs.map +1 -1
- package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.cjs +12 -16
- package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.cjs.map +1 -1
- package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.styles.cjs +18 -15
- package/dist/cjs/components/presentation/UserDropdown/BaseUserDropdown.styles.cjs.map +1 -1
- package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.cjs +5 -6
- package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.cjs.map +1 -1
- package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.styles.cjs +25 -26
- package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.styles.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs +25 -42
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.styles.cjs +41 -9
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.styles.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +88 -80
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs +9 -22
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.styles.cjs +22 -9
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.styles.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs +11 -12
- package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs +11 -16
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.styles.cjs +32 -27
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.styles.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs +78 -39
- package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +11 -12
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.styles.cjs +25 -26
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs +6 -7
- package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs.map +1 -1
- package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs +9 -10
- package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Alert/Alert.cjs +6 -7
- package/dist/cjs/components/primitives/Alert/Alert.cjs.map +1 -1
- package/dist/cjs/components/primitives/Alert/Alert.styles.cjs +10 -11
- package/dist/cjs/components/primitives/Alert/Alert.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Avatar/Avatar.cjs +5 -6
- package/dist/cjs/components/primitives/Avatar/Avatar.cjs.map +1 -1
- package/dist/cjs/components/primitives/Avatar/Avatar.styles.cjs +7 -8
- package/dist/cjs/components/primitives/Avatar/Avatar.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Button/Button.cjs +8 -12
- package/dist/cjs/components/primitives/Button/Button.cjs.map +1 -1
- package/dist/cjs/components/primitives/Button/Button.styles.cjs +23 -24
- package/dist/cjs/components/primitives/Button/Button.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Card/Card.cjs +8 -9
- package/dist/cjs/components/primitives/Card/Card.cjs.map +1 -1
- package/dist/cjs/components/primitives/Card/Card.styles.cjs +12 -13
- package/dist/cjs/components/primitives/Card/Card.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Checkbox/Checkbox.cjs +5 -6
- package/dist/cjs/components/primitives/Checkbox/Checkbox.cjs.map +1 -1
- package/dist/cjs/components/primitives/Checkbox/Checkbox.styles.cjs +7 -8
- package/dist/cjs/components/primitives/Checkbox/Checkbox.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/CopyableText/CopyableText.styles.cjs +6 -7
- package/dist/cjs/components/primitives/CopyableText/CopyableText.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/DatePicker/DatePicker.cjs +4 -5
- package/dist/cjs/components/primitives/DatePicker/DatePicker.cjs.map +1 -1
- package/dist/cjs/components/primitives/DatePicker/DatePicker.styles.cjs +5 -6
- package/dist/cjs/components/primitives/DatePicker/DatePicker.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Dialog/Dialog.cjs +7 -8
- package/dist/cjs/components/primitives/Dialog/Dialog.cjs.map +1 -1
- package/dist/cjs/components/primitives/Dialog/Dialog.styles.cjs +8 -9
- package/dist/cjs/components/primitives/Dialog/Dialog.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Divider/Divider.cjs +7 -8
- package/dist/cjs/components/primitives/Divider/Divider.cjs.map +1 -1
- package/dist/cjs/components/primitives/Divider/Divider.styles.cjs +7 -8
- package/dist/cjs/components/primitives/Divider/Divider.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/FormControl/FormControl.cjs +3 -4
- package/dist/cjs/components/primitives/FormControl/FormControl.cjs.map +1 -1
- package/dist/cjs/components/primitives/FormControl/FormControl.styles.cjs +4 -5
- package/dist/cjs/components/primitives/FormControl/FormControl.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/InputLabel/InputLabel.cjs +3 -4
- package/dist/cjs/components/primitives/InputLabel/InputLabel.cjs.map +1 -1
- package/dist/cjs/components/primitives/InputLabel/InputLabel.styles.cjs +6 -7
- package/dist/cjs/components/primitives/InputLabel/InputLabel.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/KeyValueInput/KeyValueInput.cjs +19 -20
- package/dist/cjs/components/primitives/KeyValueInput/KeyValueInput.cjs.map +1 -1
- package/dist/cjs/components/primitives/KeyValueInput/KeyValueInput.styles.cjs +16 -17
- package/dist/cjs/components/primitives/KeyValueInput/KeyValueInput.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Logo/Logo.cjs +3 -4
- package/dist/cjs/components/primitives/Logo/Logo.cjs.map +1 -1
- package/dist/cjs/components/primitives/Logo/Logo.styles.cjs +9 -10
- package/dist/cjs/components/primitives/Logo/Logo.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/MultiInput/MultiInput.cjs +11 -12
- package/dist/cjs/components/primitives/MultiInput/MultiInput.cjs.map +1 -1
- package/dist/cjs/components/primitives/MultiInput/MultiInput.styles.cjs +10 -11
- package/dist/cjs/components/primitives/MultiInput/MultiInput.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/OtpField/OtpField.cjs +4 -5
- package/dist/cjs/components/primitives/OtpField/OtpField.cjs.map +1 -1
- package/dist/cjs/components/primitives/OtpField/OtpField.styles.cjs +5 -6
- package/dist/cjs/components/primitives/OtpField/OtpField.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs +3 -4
- package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs.map +1 -1
- package/dist/cjs/components/primitives/PasswordField/PasswordField.styles.cjs +4 -5
- package/dist/cjs/components/primitives/PasswordField/PasswordField.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Select/Select.cjs +3 -4
- package/dist/cjs/components/primitives/Select/Select.cjs.map +1 -1
- package/dist/cjs/components/primitives/Select/Select.styles.cjs +5 -6
- package/dist/cjs/components/primitives/Select/Select.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Spinner/Spinner.cjs +4 -6
- package/dist/cjs/components/primitives/Spinner/Spinner.cjs.map +1 -1
- package/dist/cjs/components/primitives/Spinner/Spinner.styles.cjs +20 -12
- package/dist/cjs/components/primitives/Spinner/Spinner.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/TextField/TextField.cjs +6 -7
- package/dist/cjs/components/primitives/TextField/TextField.cjs.map +1 -1
- package/dist/cjs/components/primitives/TextField/TextField.styles.cjs +8 -9
- package/dist/cjs/components/primitives/TextField/TextField.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Toggle/Toggle.cjs +7 -8
- package/dist/cjs/components/primitives/Toggle/Toggle.cjs.map +1 -1
- package/dist/cjs/components/primitives/Toggle/Toggle.styles.cjs +7 -8
- package/dist/cjs/components/primitives/Toggle/Toggle.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Tooltip/Tooltip.cjs +4 -5
- package/dist/cjs/components/primitives/Tooltip/Tooltip.cjs.map +1 -1
- package/dist/cjs/components/primitives/Tooltip/Tooltip.styles.cjs +13 -14
- package/dist/cjs/components/primitives/Tooltip/Tooltip.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Typography/Typography.cjs +2 -3
- package/dist/cjs/components/primitives/Typography/Typography.cjs.map +1 -1
- package/dist/cjs/components/primitives/Typography/Typography.styles.cjs +18 -19
- package/dist/cjs/components/primitives/Typography/Typography.styles.cjs.map +1 -1
- package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs +4 -1
- package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
- package/dist/cjs/styles/emotion.cjs +64 -0
- package/dist/cjs/styles/emotion.cjs.map +1 -0
- package/dist/components/actions/SignInButton/BaseSignInButton.d.ts.map +1 -1
- package/dist/components/actions/SignInButton/BaseSignInButton.js +1 -1
- package/dist/components/actions/SignInButton/BaseSignInButton.js.map +1 -1
- package/dist/components/actions/SignOutButton/BaseSignOutButton.d.ts.map +1 -1
- package/dist/components/actions/SignOutButton/BaseSignOutButton.js +1 -1
- package/dist/components/actions/SignOutButton/BaseSignOutButton.js.map +1 -1
- package/dist/components/actions/SignUpButton/BaseSignUpButton.d.ts.map +1 -1
- package/dist/components/actions/SignUpButton/BaseSignUpButton.js +1 -1
- package/dist/components/actions/SignUpButton/BaseSignUpButton.js.map +1 -1
- package/dist/components/adapters/Consent.d.ts.map +1 -1
- package/dist/components/adapters/Consent.js +34 -27
- package/dist/components/adapters/Consent.js.map +1 -1
- package/dist/components/adapters/ConsentCheckboxList.d.ts.map +1 -1
- package/dist/components/adapters/ConsentCheckboxList.js +1 -1
- package/dist/components/adapters/ConsentCheckboxList.js.map +1 -1
- package/dist/components/adapters/ConsentCheckboxList.styles.d.ts.map +1 -1
- package/dist/components/adapters/ConsentCheckboxList.styles.js +1 -1
- package/dist/components/adapters/ConsentCheckboxList.styles.js.map +1 -1
- package/dist/components/adapters/ImageComponent.d.ts.map +1 -1
- package/dist/components/adapters/ImageComponent.js +13 -9
- package/dist/components/adapters/ImageComponent.js.map +1 -1
- package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.d.ts.map +1 -1
- package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.js +1 -1
- package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.js.map +1 -1
- package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.d.ts.map +1 -1
- package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.js +1 -1
- package/dist/components/presentation/LanguageSwitcher/BaseLanguageSwitcher.styles.js.map +1 -1
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.d.ts.map +1 -1
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.js +5 -8
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.js.map +1 -1
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.styles.d.ts.map +1 -1
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.styles.js +5 -1
- package/dist/components/presentation/UserDropdown/BaseUserDropdown.styles.js.map +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts.map +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.js +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.js.map +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.styles.d.ts.map +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.styles.js +1 -1
- package/dist/components/presentation/UserProfile/BaseUserProfile.styles.js.map +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.d.ts.map +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js +23 -39
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js.map +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.styles.d.ts.map +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.styles.js +38 -5
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.styles.js.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.js +82 -73
- package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.d.ts.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js +5 -17
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.styles.d.ts.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.styles.js +19 -5
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.styles.js.map +1 -1
- package/dist/components/presentation/auth/Recovery/BaseRecovery.d.ts.map +1 -1
- package/dist/components/presentation/auth/Recovery/BaseRecovery.js +1 -1
- package/dist/components/presentation/auth/Recovery/BaseRecovery.js.map +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.js +2 -6
- package/dist/components/presentation/auth/SignIn/BaseSignIn.js.map +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.styles.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.styles.js +7 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.styles.js.map +1 -1
- package/dist/components/presentation/auth/SignIn/SignIn.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignIn/SignIn.js +79 -40
- package/dist/components/presentation/auth/SignIn/SignIn.js.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.styles.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.styles.js +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.styles.js.map +1 -1
- package/dist/components/primitives/AffixedField/AffixedField.d.ts.map +1 -1
- package/dist/components/primitives/AffixedField/AffixedField.js +1 -1
- package/dist/components/primitives/AffixedField/AffixedField.js.map +1 -1
- package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts.map +1 -1
- package/dist/components/primitives/AffixedField/AffixedField.styles.js +1 -1
- package/dist/components/primitives/AffixedField/AffixedField.styles.js.map +1 -1
- package/dist/components/primitives/Alert/Alert.d.ts.map +1 -1
- package/dist/components/primitives/Alert/Alert.js +1 -1
- package/dist/components/primitives/Alert/Alert.js.map +1 -1
- package/dist/components/primitives/Alert/Alert.styles.d.ts.map +1 -1
- package/dist/components/primitives/Alert/Alert.styles.js +1 -1
- package/dist/components/primitives/Alert/Alert.styles.js.map +1 -1
- package/dist/components/primitives/Avatar/Avatar.d.ts.map +1 -1
- package/dist/components/primitives/Avatar/Avatar.js +1 -1
- package/dist/components/primitives/Avatar/Avatar.js.map +1 -1
- package/dist/components/primitives/Avatar/Avatar.styles.d.ts.map +1 -1
- package/dist/components/primitives/Avatar/Avatar.styles.js +1 -1
- package/dist/components/primitives/Avatar/Avatar.styles.js.map +1 -1
- package/dist/components/primitives/Button/Button.d.ts.map +1 -1
- package/dist/components/primitives/Button/Button.js +2 -5
- package/dist/components/primitives/Button/Button.js.map +1 -1
- package/dist/components/primitives/Button/Button.styles.d.ts.map +1 -1
- package/dist/components/primitives/Button/Button.styles.js +1 -1
- package/dist/components/primitives/Button/Button.styles.js.map +1 -1
- package/dist/components/primitives/Card/Card.d.ts.map +1 -1
- package/dist/components/primitives/Card/Card.js +1 -1
- package/dist/components/primitives/Card/Card.js.map +1 -1
- package/dist/components/primitives/Card/Card.styles.d.ts.map +1 -1
- package/dist/components/primitives/Card/Card.styles.js +1 -1
- package/dist/components/primitives/Card/Card.styles.js.map +1 -1
- package/dist/components/primitives/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/components/primitives/Checkbox/Checkbox.js +1 -1
- package/dist/components/primitives/Checkbox/Checkbox.js.map +1 -1
- package/dist/components/primitives/Checkbox/Checkbox.styles.d.ts.map +1 -1
- package/dist/components/primitives/Checkbox/Checkbox.styles.js +1 -1
- package/dist/components/primitives/Checkbox/Checkbox.styles.js.map +1 -1
- package/dist/components/primitives/CopyableText/CopyableText.styles.d.ts.map +1 -1
- package/dist/components/primitives/CopyableText/CopyableText.styles.js +1 -1
- package/dist/components/primitives/CopyableText/CopyableText.styles.js.map +1 -1
- package/dist/components/primitives/DatePicker/DatePicker.d.ts.map +1 -1
- package/dist/components/primitives/DatePicker/DatePicker.js +1 -1
- package/dist/components/primitives/DatePicker/DatePicker.js.map +1 -1
- package/dist/components/primitives/DatePicker/DatePicker.styles.d.ts.map +1 -1
- package/dist/components/primitives/DatePicker/DatePicker.styles.js +1 -1
- package/dist/components/primitives/DatePicker/DatePicker.styles.js.map +1 -1
- package/dist/components/primitives/Dialog/Dialog.d.ts.map +1 -1
- package/dist/components/primitives/Dialog/Dialog.js +1 -1
- package/dist/components/primitives/Dialog/Dialog.js.map +1 -1
- package/dist/components/primitives/Dialog/Dialog.styles.d.ts.map +1 -1
- package/dist/components/primitives/Dialog/Dialog.styles.js +1 -1
- package/dist/components/primitives/Dialog/Dialog.styles.js.map +1 -1
- package/dist/components/primitives/Divider/Divider.d.ts.map +1 -1
- package/dist/components/primitives/Divider/Divider.js +1 -1
- package/dist/components/primitives/Divider/Divider.js.map +1 -1
- package/dist/components/primitives/Divider/Divider.styles.d.ts.map +1 -1
- package/dist/components/primitives/Divider/Divider.styles.js +1 -1
- package/dist/components/primitives/Divider/Divider.styles.js.map +1 -1
- package/dist/components/primitives/FormControl/FormControl.d.ts.map +1 -1
- package/dist/components/primitives/FormControl/FormControl.js +1 -1
- package/dist/components/primitives/FormControl/FormControl.js.map +1 -1
- package/dist/components/primitives/FormControl/FormControl.styles.d.ts.map +1 -1
- package/dist/components/primitives/FormControl/FormControl.styles.js +1 -1
- package/dist/components/primitives/FormControl/FormControl.styles.js.map +1 -1
- package/dist/components/primitives/InputLabel/InputLabel.d.ts.map +1 -1
- package/dist/components/primitives/InputLabel/InputLabel.js +1 -1
- package/dist/components/primitives/InputLabel/InputLabel.js.map +1 -1
- package/dist/components/primitives/InputLabel/InputLabel.styles.d.ts.map +1 -1
- package/dist/components/primitives/InputLabel/InputLabel.styles.js +1 -1
- package/dist/components/primitives/InputLabel/InputLabel.styles.js.map +1 -1
- package/dist/components/primitives/KeyValueInput/KeyValueInput.d.ts.map +1 -1
- package/dist/components/primitives/KeyValueInput/KeyValueInput.js +1 -1
- package/dist/components/primitives/KeyValueInput/KeyValueInput.js.map +1 -1
- package/dist/components/primitives/KeyValueInput/KeyValueInput.styles.d.ts.map +1 -1
- package/dist/components/primitives/KeyValueInput/KeyValueInput.styles.js +1 -1
- package/dist/components/primitives/KeyValueInput/KeyValueInput.styles.js.map +1 -1
- package/dist/components/primitives/Logo/Logo.d.ts.map +1 -1
- package/dist/components/primitives/Logo/Logo.js +1 -1
- package/dist/components/primitives/Logo/Logo.js.map +1 -1
- package/dist/components/primitives/Logo/Logo.styles.d.ts.map +1 -1
- package/dist/components/primitives/Logo/Logo.styles.js +1 -1
- package/dist/components/primitives/Logo/Logo.styles.js.map +1 -1
- package/dist/components/primitives/MultiInput/MultiInput.d.ts.map +1 -1
- package/dist/components/primitives/MultiInput/MultiInput.js +1 -1
- package/dist/components/primitives/MultiInput/MultiInput.js.map +1 -1
- package/dist/components/primitives/MultiInput/MultiInput.styles.d.ts.map +1 -1
- package/dist/components/primitives/MultiInput/MultiInput.styles.js +1 -1
- package/dist/components/primitives/MultiInput/MultiInput.styles.js.map +1 -1
- package/dist/components/primitives/OtpField/OtpField.d.ts.map +1 -1
- package/dist/components/primitives/OtpField/OtpField.js +1 -1
- package/dist/components/primitives/OtpField/OtpField.js.map +1 -1
- package/dist/components/primitives/OtpField/OtpField.styles.d.ts.map +1 -1
- package/dist/components/primitives/OtpField/OtpField.styles.js +1 -1
- package/dist/components/primitives/OtpField/OtpField.styles.js.map +1 -1
- package/dist/components/primitives/PasswordField/PasswordField.d.ts.map +1 -1
- package/dist/components/primitives/PasswordField/PasswordField.js +1 -1
- package/dist/components/primitives/PasswordField/PasswordField.js.map +1 -1
- package/dist/components/primitives/PasswordField/PasswordField.styles.d.ts.map +1 -1
- package/dist/components/primitives/PasswordField/PasswordField.styles.js +1 -1
- package/dist/components/primitives/PasswordField/PasswordField.styles.js.map +1 -1
- package/dist/components/primitives/Select/Select.d.ts.map +1 -1
- package/dist/components/primitives/Select/Select.js +1 -1
- package/dist/components/primitives/Select/Select.js.map +1 -1
- package/dist/components/primitives/Select/Select.styles.d.ts.map +1 -1
- package/dist/components/primitives/Select/Select.styles.js +1 -1
- package/dist/components/primitives/Select/Select.styles.js.map +1 -1
- package/dist/components/primitives/Spinner/Spinner.d.ts +5 -3
- package/dist/components/primitives/Spinner/Spinner.d.ts.map +1 -1
- package/dist/components/primitives/Spinner/Spinner.js +4 -5
- package/dist/components/primitives/Spinner/Spinner.js.map +1 -1
- package/dist/components/primitives/Spinner/Spinner.styles.d.ts +4 -1
- package/dist/components/primitives/Spinner/Spinner.styles.d.ts.map +1 -1
- package/dist/components/primitives/Spinner/Spinner.styles.js +16 -7
- package/dist/components/primitives/Spinner/Spinner.styles.js.map +1 -1
- package/dist/components/primitives/TextField/TextField.d.ts.map +1 -1
- package/dist/components/primitives/TextField/TextField.js +1 -1
- package/dist/components/primitives/TextField/TextField.js.map +1 -1
- package/dist/components/primitives/TextField/TextField.styles.d.ts.map +1 -1
- package/dist/components/primitives/TextField/TextField.styles.js +1 -1
- package/dist/components/primitives/TextField/TextField.styles.js.map +1 -1
- package/dist/components/primitives/Toggle/Toggle.d.ts.map +1 -1
- package/dist/components/primitives/Toggle/Toggle.js +1 -1
- package/dist/components/primitives/Toggle/Toggle.js.map +1 -1
- package/dist/components/primitives/Toggle/Toggle.styles.d.ts.map +1 -1
- package/dist/components/primitives/Toggle/Toggle.styles.js +1 -1
- package/dist/components/primitives/Toggle/Toggle.styles.js.map +1 -1
- package/dist/components/primitives/Tooltip/Tooltip.d.ts.map +1 -1
- package/dist/components/primitives/Tooltip/Tooltip.js +1 -1
- package/dist/components/primitives/Tooltip/Tooltip.js.map +1 -1
- package/dist/components/primitives/Tooltip/Tooltip.styles.d.ts.map +1 -1
- package/dist/components/primitives/Tooltip/Tooltip.styles.js +1 -1
- package/dist/components/primitives/Tooltip/Tooltip.styles.js.map +1 -1
- package/dist/components/primitives/Typography/Typography.d.ts.map +1 -1
- package/dist/components/primitives/Typography/Typography.js +1 -1
- package/dist/components/primitives/Typography/Typography.js.map +1 -1
- package/dist/components/primitives/Typography/Typography.styles.d.ts.map +1 -1
- package/dist/components/primitives/Typography/Typography.styles.js +1 -1
- package/dist/components/primitives/Typography/Typography.styles.js.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
- package/dist/contexts/ThunderID/ThunderIDProvider.js +4 -1
- package/dist/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
- package/dist/models/config.d.ts +10 -1
- package/dist/models/config.d.ts.map +1 -1
- package/dist/styles/emotion.d.ts +36 -0
- package/dist/styles/emotion.d.ts.map +1 -0
- package/dist/styles/emotion.js +58 -0
- package/dist/styles/emotion.js.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AffixedField.cjs","names":["AffixedField: FC<AffixedFieldProps>","useTheme","hasError: boolean","prefixList: PrefixOption[]","hasPrefix: boolean","hasFixedPrefix: boolean","styles: Record<string, string>","useStyles","prefixDescriptionId: string","containerClassName: string","inputClassName: string","selectedValue: string","FormControl","InputLabel"],"sources":["../../../../../src/components/primitives/AffixedField/AffixedField.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {
|
|
1
|
+
{"version":3,"file":"AffixedField.cjs","names":["AffixedField: FC<AffixedFieldProps>","useTheme","hasError: boolean","prefixList: PrefixOption[]","hasPrefix: boolean","hasFixedPrefix: boolean","styles: Record<string, string>","useStyles","prefixDescriptionId: string","containerClassName: string","cx","inputClassName: string","selectedValue: string","FormControl","InputLabel"],"sources":["../../../../../src/components/primitives/AffixedField/AffixedField.tsx"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {PrefixOption, bem, withVendorCSSClassPrefix} from '@thunderid/browser';\nimport {ChangeEvent, FC, InputHTMLAttributes, ReactElement, useId} from 'react';\nimport useStyles from './AffixedField.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport {cx} from '../../../styles/emotion';\nimport FormControl from '../FormControl/FormControl';\nimport InputLabel from '../InputLabel/InputLabel';\n\nexport interface AffixedFieldProps extends Omit<InputHTMLAttributes<HTMLInputElement>, 'className' | 'prefix'> {\n /** Additional CSS class names applied to the outer form control. */\n className?: string;\n /** Whether the field is disabled. */\n disabled?: boolean;\n /** Error message to render below the field. */\n error?: string;\n /** Helper text to render below the field. */\n helperText?: string;\n /** Label rendered above the field. */\n label?: string;\n /**\n * Called when the user changes the selected prefix. Only fires when `prefixes` is an\n * array with two or more entries and the user picks a different one.\n */\n onPrefixChange?: (prefixValue: string) => void;\n /**\n * Currently selected prefix `value` (must match one of the resolved prefix entries'\n * `value`). Required when `prefixes` resolves to a non-empty list. Ignored otherwise.\n */\n prefixValue?: string;\n /**\n * Leading affix. `string` renders as a fixed span; `PrefixOption[]` renders as a fixed\n * span (single entry) or dropdown (multiple entries). Empty or undefined renders a\n * plain input with no leading element.\n */\n prefixes?: string | PrefixOption[];\n /** Whether the field is required. */\n required?: boolean;\n}\n\n/**\n * Converts the polymorphic `prefixes` prop into a uniform list. A string is treated\n * as a single fixed entry so the rest of the component can iterate a single shape.\n */\nconst normalizePrefixes = (prefixes: string | PrefixOption[] | undefined): PrefixOption[] => {\n if (typeof prefixes === 'string') {\n return prefixes.length > 0 ? [{label: prefixes, value: prefixes}] : [];\n }\n return prefixes ?? [];\n};\n\nconst AffixedField: FC<AffixedFieldProps> = ({\n label,\n error,\n required,\n className,\n disabled,\n helperText,\n prefixes,\n prefixValue,\n onPrefixChange,\n type = 'text',\n style = {},\n ...rest\n}: AffixedFieldProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const hasError: boolean = !!error;\n const prefixList: PrefixOption[] = normalizePrefixes(prefixes);\n const hasPrefix: boolean = prefixList.length > 0;\n const hasFixedPrefix: boolean = prefixList.length === 1;\n const styles: Record<string, string> = useStyles(theme, colorScheme, disabled ?? false, hasError, hasPrefix);\n // Stable id for the visually-hidden prefix announcement; only referenced when a\n // fixed prefix is present, but generated unconditionally so the hook order is stable.\n const prefixDescriptionId: string = `${useId()}-prefix`;\n\n const containerClassName: string = cx(\n withVendorCSSClassPrefix(bem('affixed-field', 'container')),\n styles['inputContainer'],\n );\n\n const inputClassName: string = cx(withVendorCSSClassPrefix(bem('affixed-field', 'input')), styles['input']);\n\n const renderPrefix = (): ReactElement | null => {\n if (prefixList.length === 0) return null;\n\n if (prefixList.length === 1) {\n return (\n <>\n <span\n className={cx(withVendorCSSClassPrefix(bem('affixed-field', 'prefix-span')), styles['prefixSpan'])}\n aria-hidden=\"true\"\n >\n {prefixList[0].label}\n </span>\n {/* Assistive-tech-only mirror of the fixed prefix; wired to the input via aria-describedby. */}\n <span id={prefixDescriptionId} className={styles['visuallyHidden']}>\n {prefixList[0].label}\n </span>\n </>\n );\n }\n\n const selectedValue: string = prefixValue ?? prefixList[0].value;\n return (\n <select\n className={cx(withVendorCSSClassPrefix(bem('affixed-field', 'prefix-select')), styles['prefixSelect'])}\n value={selectedValue}\n disabled={disabled}\n onChange={(e: ChangeEvent<HTMLSelectElement>): void => onPrefixChange?.(e.target.value)}\n aria-label=\"Prefix\"\n >\n {prefixList.map((p: PrefixOption) => (\n <option key={p.value} value={p.value}>\n {p.label}\n </option>\n ))}\n </select>\n );\n };\n\n return (\n <FormControl\n error={error}\n helperText={helperText}\n className={cx(withVendorCSSClassPrefix(bem('affixed-field')), className)}\n style={style}\n >\n {label && (\n <InputLabel required={required} error={hasError}>\n {label}\n </InputLabel>\n )}\n <div className={containerClassName}>\n {renderPrefix()}\n <input\n className={inputClassName}\n type={type}\n disabled={disabled}\n aria-invalid={hasError}\n aria-required={required}\n {...rest}\n aria-describedby={\n [rest['aria-describedby'], hasFixedPrefix ? prefixDescriptionId : undefined].filter(Boolean).join(' ') ||\n undefined\n }\n />\n </div>\n </FormControl>\n );\n};\n\nexport default AffixedField;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA8CA,MAAM,qBAAqB,aAAkE;AAC3F,KAAI,OAAO,aAAa,SACtB,QAAO,SAAS,SAAS,IAAI,CAAC;EAAC,OAAO;EAAU,OAAO;EAAS,CAAC,GAAG,EAAE;AAExE,QAAO,YAAY,EAAE;;AAGvB,MAAMA,gBAAuC,EAC3C,OACA,OACA,UACA,WACA,UACA,YACA,UACA,aACA,gBACA,OAAO,QACP,QAAQ,EAAE,CACV,GAAG,WACoB;CACvB,MAAM,EAAC,OAAO,gBAA4CC,0BAAU;CACpE,MAAMC,WAAoB,CAAC,CAAC;CAC5B,MAAMC,aAA6B,kBAAkB,SAAS;CAC9D,MAAMC,YAAqB,WAAW,SAAS;CAC/C,MAAMC,iBAA0B,WAAW,WAAW;CACtD,MAAMC,SAAiCC,oCAAU,OAAO,aAAa,YAAY,OAAO,UAAU,UAAU;CAG5G,MAAMC,sBAA8B,qBAAU,CAAC;CAE/C,MAAMC,qBAA6BC,kGACJ,iBAAiB,YAAY,CAAC,EAC3D,OAAO,kBACR;CAED,MAAMC,iBAAyBD,kGAAgC,iBAAiB,QAAQ,CAAC,EAAE,OAAO,SAAS;CAE3G,MAAM,qBAA0C;AAC9C,MAAI,WAAW,WAAW,EAAG,QAAO;AAEpC,MAAI,WAAW,WAAW,EACxB,QACE,qFACE,2CAAC;GACC,WAAWA,kGAAgC,iBAAiB,cAAc,CAAC,EAAE,OAAO,cAAc;GAClG,eAAY;aAEX,WAAW,GAAG;IACV,EAEP,2CAAC;GAAK,IAAI;GAAqB,WAAW,OAAO;aAC9C,WAAW,GAAG;IACV,IACN;EAIP,MAAME,gBAAwB,eAAe,WAAW,GAAG;AAC3D,SACE,2CAAC;GACC,WAAWF,kGAAgC,iBAAiB,gBAAgB,CAAC,EAAE,OAAO,gBAAgB;GACtG,OAAO;GACG;GACV,WAAW,MAA4C,iBAAiB,EAAE,OAAO,MAAM;GACvF,cAAW;aAEV,WAAW,KAAK,MACf,2CAAC;IAAqB,OAAO,EAAE;cAC5B,EAAE;MADQ,EAAE,MAEN,CACT;IACK;;AAIb,QACE,4CAACG;EACQ;EACK;EACZ,WAAWH,kGAAgC,gBAAgB,CAAC,EAAE,UAAU;EACjE;aAEN,SACC,2CAACI;GAAqB;GAAU,OAAO;aACpC;IACU,EAEf,4CAAC;GAAI,WAAW;cACb,cAAc,EACf,2CAAC;IACC,WAAW;IACL;IACI;IACV,gBAAc;IACd,iBAAe;IACf,GAAI;IACJ,oBACE,CAAC,KAAK,qBAAqB,iBAAiB,sBAAsB,OAAU,CAAC,OAAO,QAAQ,CAAC,KAAK,IAAI,IACtG;KAEF;IACE;GACM;;AAIlB,2BAAe"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_emotion = require('../../../styles/emotion.cjs');
|
|
2
3
|
let react = require("react");
|
|
3
4
|
react = require_rolldown_runtime.__toESM(react);
|
|
4
|
-
let __emotion_css = require("@emotion/css");
|
|
5
|
-
__emotion_css = require_rolldown_runtime.__toESM(__emotion_css);
|
|
6
5
|
|
|
7
6
|
//#region src/components/primitives/AffixedField/AffixedField.styles.ts
|
|
8
7
|
/**
|
|
@@ -13,13 +12,13 @@ const useStyles = (theme, colorScheme, disabled, hasError, hasPrefix) => (0, rea
|
|
|
13
12
|
const borderColor = hasError ? theme.vars.colors.error.main : theme.vars.colors.border;
|
|
14
13
|
const focusColor = hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main;
|
|
15
14
|
const borderRadius = theme.vars.components?.Field?.root?.borderRadius ?? theme.vars.borderRadius.medium;
|
|
16
|
-
const inputContainer =
|
|
15
|
+
const inputContainer = require_emotion.css`
|
|
17
16
|
position: relative;
|
|
18
17
|
display: flex;
|
|
19
18
|
align-items: stretch;
|
|
20
19
|
width: 100%;
|
|
21
20
|
`;
|
|
22
|
-
const inputBase =
|
|
21
|
+
const inputBase = require_emotion.css`
|
|
23
22
|
flex: 1;
|
|
24
23
|
min-width: 0;
|
|
25
24
|
padding-block: ${theme.vars.spacing.unit};
|
|
@@ -53,18 +52,18 @@ const useStyles = (theme, colorScheme, disabled, hasError, hasPrefix) => (0, rea
|
|
|
53
52
|
border-color: ${focusColor};
|
|
54
53
|
}
|
|
55
54
|
`;
|
|
56
|
-
const input = hasPrefix ?
|
|
55
|
+
const input = hasPrefix ? require_emotion.css`
|
|
57
56
|
${inputBase};
|
|
58
57
|
border-start-start-radius: 0;
|
|
59
58
|
border-end-start-radius: 0;
|
|
60
59
|
border-start-end-radius: ${borderRadius};
|
|
61
60
|
border-end-end-radius: ${borderRadius};
|
|
62
61
|
border-inline-start: none;
|
|
63
|
-
` :
|
|
62
|
+
` : require_emotion.css`
|
|
64
63
|
${inputBase};
|
|
65
64
|
border-radius: ${borderRadius};
|
|
66
65
|
`;
|
|
67
|
-
const prefixBase =
|
|
66
|
+
const prefixBase = require_emotion.css`
|
|
68
67
|
display: flex;
|
|
69
68
|
align-items: center;
|
|
70
69
|
padding-inline: calc(${theme.vars.spacing.unit} * 1.5);
|
|
@@ -77,7 +76,7 @@ const useStyles = (theme, colorScheme, disabled, hasError, hasPrefix) => (0, rea
|
|
|
77
76
|
font-family: ${theme.vars.typography.fontFamily};
|
|
78
77
|
white-space: nowrap;
|
|
79
78
|
`;
|
|
80
|
-
const prefixSpan =
|
|
79
|
+
const prefixSpan = require_emotion.css`
|
|
81
80
|
${prefixBase};
|
|
82
81
|
user-select: none;
|
|
83
82
|
color: ${theme.vars.colors.text.secondary};
|
|
@@ -85,7 +84,7 @@ const useStyles = (theme, colorScheme, disabled, hasError, hasPrefix) => (0, rea
|
|
|
85
84
|
return {
|
|
86
85
|
input,
|
|
87
86
|
inputContainer,
|
|
88
|
-
prefixSelect:
|
|
87
|
+
prefixSelect: require_emotion.css`
|
|
89
88
|
${prefixBase};
|
|
90
89
|
cursor: pointer;
|
|
91
90
|
appearance: auto;
|
|
@@ -104,7 +103,7 @@ const useStyles = (theme, colorScheme, disabled, hasError, hasPrefix) => (0, rea
|
|
|
104
103
|
}
|
|
105
104
|
`,
|
|
106
105
|
prefixSpan,
|
|
107
|
-
visuallyHidden:
|
|
106
|
+
visuallyHidden: require_emotion.css`
|
|
108
107
|
position: absolute;
|
|
109
108
|
width: 1px;
|
|
110
109
|
height: 1px;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AffixedField.styles.cjs","names":["borderColor: string","focusColor: string","borderRadius: string","inputContainer: string","inputBase: string","input: string","prefixBase: string","prefixSpan: string"],"sources":["../../../../../src/components/primitives/AffixedField/AffixedField.styles.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {
|
|
1
|
+
{"version":3,"file":"AffixedField.styles.cjs","names":["borderColor: string","focusColor: string","borderRadius: string","inputContainer: string","inputBase: string","input: string","prefixBase: string","prefixSpan: string"],"sources":["../../../../../src/components/primitives/AffixedField/AffixedField.styles.ts"],"sourcesContent":["// Copyright 2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\n/**\n * Creates styles for the AffixedField component. The container is a horizontal flex\n * row with a prefix element (span or select) joined to a shared-border input.\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n disabled: boolean,\n hasError: boolean,\n hasPrefix: boolean,\n): Record<string, string> =>\n useMemo(() => {\n const borderColor: string = hasError ? theme.vars.colors.error.main : theme.vars.colors.border;\n const focusColor: string = hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main;\n const borderRadius: string = theme.vars.components?.Field?.root?.borderRadius ?? theme.vars.borderRadius.medium;\n\n const inputContainer: string = css`\n position: relative;\n display: flex;\n align-items: stretch;\n width: 100%;\n `;\n\n const inputBase: string = css`\n flex: 1;\n min-width: 0;\n padding-block: ${theme.vars.spacing.unit};\n padding-inline: calc(${theme.vars.spacing.unit} * 1.5);\n border: 1px solid ${borderColor};\n font-size: ${theme.vars.typography.fontSizes.md};\n font-family: ${theme.vars.typography.fontFamily};\n color: ${theme.vars.colors.text.primary};\n background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};\n outline: none;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease;\n\n &::placeholder {\n color: ${theme.vars.colors.text.secondary};\n opacity: 0.7;\n }\n\n &:focus {\n border-color: ${focusColor};\n box-shadow: 0 0 0 2px ${focusColor}20;\n }\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n &:hover:not(:disabled) {\n border-color: ${focusColor};\n }\n `;\n\n const input: string = hasPrefix\n ? css`\n ${inputBase};\n border-start-start-radius: 0;\n border-end-start-radius: 0;\n border-start-end-radius: ${borderRadius};\n border-end-end-radius: ${borderRadius};\n border-inline-start: none;\n `\n : css`\n ${inputBase};\n border-radius: ${borderRadius};\n `;\n\n const prefixBase: string = css`\n display: flex;\n align-items: center;\n padding-inline: calc(${theme.vars.spacing.unit} * 1.5);\n border: 1px solid ${borderColor};\n border-start-start-radius: ${borderRadius};\n border-end-start-radius: ${borderRadius};\n background-color: ${theme.vars.colors.background.surface};\n color: ${theme.vars.colors.text.primary};\n font-size: ${theme.vars.typography.fontSizes.md};\n font-family: ${theme.vars.typography.fontFamily};\n white-space: nowrap;\n `;\n\n const prefixSpan: string = css`\n ${prefixBase};\n user-select: none;\n color: ${theme.vars.colors.text.secondary};\n `;\n\n const prefixSelect: string = css`\n ${prefixBase};\n cursor: pointer;\n appearance: auto;\n padding-inline-end: calc(${theme.vars.spacing.unit} * 1.5);\n\n &:disabled {\n opacity: 0.6;\n cursor: not-allowed;\n }\n\n &:focus {\n outline: none;\n border-color: ${focusColor};\n box-shadow: 0 0 0 2px ${focusColor}20;\n z-index: 1;\n }\n `;\n\n /**\n * Visually hides content while keeping it discoverable by assistive tech. Used\n * to expose the fixed prefix value to screen readers via `aria-describedby` while\n * the sighted-user span stays `aria-hidden` (decorative).\n */\n const visuallyHidden: string = css`\n position: absolute;\n width: 1px;\n height: 1px;\n padding: 0;\n margin: -1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0);\n white-space: nowrap;\n border: 0;\n `;\n\n return {\n input,\n inputContainer,\n prefixSelect,\n prefixSpan,\n visuallyHidden,\n };\n }, [theme, colorScheme, disabled, hasError, hasPrefix]);\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;AAWA,MAAM,aACJ,OACA,aACA,UACA,UACA,uCAEc;CACZ,MAAMA,cAAsB,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO;CACxF,MAAMC,aAAqB,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,QAAQ;CAC/F,MAAMC,eAAuB,MAAM,KAAK,YAAY,OAAO,MAAM,gBAAgB,MAAM,KAAK,aAAa;CAEzG,MAAMC,iBAAyB,mBAAG;;;;;;CAOlC,MAAMC,YAAoB,mBAAG;;;uBAGV,MAAM,KAAK,QAAQ,KAAK;6BAClB,MAAM,KAAK,QAAQ,KAAK;0BAC3B,YAAY;mBACnB,MAAM,KAAK,WAAW,UAAU,GAAG;qBACjC,MAAM,KAAK,WAAW,WAAW;eACvC,MAAM,KAAK,OAAO,KAAK,QAAQ;0BACpB,WAAW,MAAM,KAAK,OAAO,WAAW,WAAW,MAAM,KAAK,OAAO,WAAW,QAAQ;;;;;;;iBAOjG,MAAM,KAAK,OAAO,KAAK,UAAU;;;;;wBAK1B,WAAW;gCACH,WAAW;;;;;;;;;wBASnB,WAAW;;;CAI/B,MAAMC,QAAgB,YAClB,mBAAG;YACC,UAAU;;;qCAGe,aAAa;mCACf,aAAa;;YAGxC,mBAAG;YACC,UAAU;2BACK,aAAa;;CAGpC,MAAMC,aAAqB,mBAAG;;;6BAGL,MAAM,KAAK,QAAQ,KAAK;0BAC3B,YAAY;mCACH,aAAa;iCACf,aAAa;0BACpB,MAAM,KAAK,OAAO,WAAW,QAAQ;eAChD,MAAM,KAAK,OAAO,KAAK,QAAQ;mBAC3B,MAAM,KAAK,WAAW,UAAU,GAAG;qBACjC,MAAM,KAAK,WAAW,WAAW;;;CAIlD,MAAMC,aAAqB,mBAAG;QAC1B,WAAW;;eAEJ,MAAM,KAAK,OAAO,KAAK,UAAU;;AAuC5C,QAAO;EACL;EACA;EACA,cAvC2B,mBAAG;QAC5B,WAAW;;;iCAGc,MAAM,KAAK,QAAQ,KAAK;;;;;;;;;wBASjC,WAAW;gCACH,WAAW;;;;EA0BrC;EACA,gBAjB6B,mBAAG;;;;;;;;;;;EAkBjC;GACA;CAAC;CAAO;CAAa;CAAU;CAAU;CAAU,CAAC;AAEzD,kCAAe"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_emotion = require('../../../styles/emotion.cjs');
|
|
2
3
|
const require_useTheme = require('../../../contexts/Theme/useTheme.cjs');
|
|
3
4
|
const require_Alert_styles = require('./Alert.styles.cjs');
|
|
4
5
|
const require_CircleAlert = require('../Icons/CircleAlert.cjs');
|
|
@@ -12,8 +13,6 @@ let react = require("react");
|
|
|
12
13
|
react = require_rolldown_runtime.__toESM(react);
|
|
13
14
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
14
15
|
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
15
|
-
let __emotion_css = require("@emotion/css");
|
|
16
|
-
__emotion_css = require_rolldown_runtime.__toESM(__emotion_css);
|
|
17
16
|
|
|
18
17
|
//#region src/components/primitives/Alert/Alert.tsx
|
|
19
18
|
const getDefaultIcon = (variant) => {
|
|
@@ -50,13 +49,13 @@ const Alert = (0, react.forwardRef)(({ variant = "info", showIcon = true, childr
|
|
|
50
49
|
ref,
|
|
51
50
|
role: "alert",
|
|
52
51
|
style,
|
|
53
|
-
className:
|
|
52
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("alert")), styles["alert"], styles["variant"], (0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("alert", null, variant)), className),
|
|
54
53
|
...rest,
|
|
55
54
|
children: [showIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
56
|
-
className:
|
|
55
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("alert", "icon")), styles["icon"]),
|
|
57
56
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(IconComponent, {})
|
|
58
57
|
}), /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
59
|
-
className:
|
|
58
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("alert", "content")), styles["content"]),
|
|
60
59
|
children
|
|
61
60
|
})]
|
|
62
61
|
})
|
|
@@ -74,7 +73,7 @@ const AlertTitle = ({ children, className, style,...rest }) => {
|
|
|
74
73
|
variant: "h6",
|
|
75
74
|
fontWeight: 600,
|
|
76
75
|
style,
|
|
77
|
-
className:
|
|
76
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("alert", "title")), styles["title"], className),
|
|
78
77
|
...filteredRest,
|
|
79
78
|
children
|
|
80
79
|
});
|
|
@@ -90,7 +89,7 @@ const AlertDescription = ({ children, className, style,...rest }) => {
|
|
|
90
89
|
component: "p",
|
|
91
90
|
variant: "body2",
|
|
92
91
|
style,
|
|
93
|
-
className:
|
|
92
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("alert", "description")), styles["description"], className),
|
|
94
93
|
...filteredRest,
|
|
95
94
|
children
|
|
96
95
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.cjs","names":["CircleCheck","CircleAlert","TriangleAlert","Info","AlertVariantContext: Context<AlertVariant>","Alert: ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>>","useTheme","styles: ReturnType<typeof useStyles>","useStyles","IconComponent: FC<SVGProps<SVGSVGElement>>","AlertTitle: FC<AlertTitleProps>","Typography","AlertDescription: FC<AlertDescriptionProps>"],"sources":["../../../../../src/components/primitives/Alert/Alert.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {
|
|
1
|
+
{"version":3,"file":"Alert.cjs","names":["CircleCheck","CircleAlert","TriangleAlert","Info","AlertVariantContext: Context<AlertVariant>","Alert: ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>>","useTheme","styles: ReturnType<typeof useStyles>","useStyles","IconComponent: FC<SVGProps<SVGSVGElement>>","cx","AlertTitle: FC<AlertTitleProps>","Typography","AlertDescription: FC<AlertDescriptionProps>"],"sources":["../../../../../src/components/primitives/Alert/Alert.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {\n Context,\n forwardRef,\n HTMLAttributes,\n ReactNode,\n Ref,\n RefAttributes,\n ForwardRefExoticComponent,\n createContext,\n useContext,\n FC,\n SVGProps,\n} from 'react';\nimport useStyles from './Alert.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport {cx} from '../../../styles/emotion';\nimport CircleAlert from '../Icons/CircleAlert';\nimport CircleCheck from '../Icons/CircleCheck';\nimport Info from '../Icons/Info';\nimport TriangleAlert from '../Icons/TriangleAlert';\nimport Typography from '../Typography/Typography';\n\nexport type AlertVariant = 'success' | 'error' | 'warning' | 'info';\n\nexport interface AlertProps extends HTMLAttributes<HTMLDivElement> {\n /**\n * Alert content\n */\n children?: ReactNode;\n /**\n * Whether to show the default icon for the variant\n */\n showIcon?: boolean;\n /**\n * The visual variant of the alert that determines color scheme and icon\n */\n variant?: AlertVariant;\n}\n\nexport interface AlertTitleProps extends HTMLAttributes<HTMLHeadingElement> {\n /**\n * Title content\n */\n children?: ReactNode;\n}\n\nexport interface AlertDescriptionProps extends HTMLAttributes<HTMLParagraphElement> {\n /**\n * Description content\n */\n children?: ReactNode;\n}\n\nconst getDefaultIcon = (variant: AlertVariant): FC<SVGProps<SVGSVGElement>> => {\n switch (variant) {\n case 'success':\n return CircleCheck;\n case 'error':\n return CircleAlert;\n case 'warning':\n return TriangleAlert;\n case 'info':\n return Info;\n default:\n return Info;\n }\n};\n\nconst AlertVariantContext: Context<AlertVariant> = createContext<AlertVariant>('info');\n\nexport const useAlertVariant = (): AlertVariant => useContext(AlertVariantContext);\n\n/**\n * Alert component that displays important information with different severity levels.\n *\n * @example\n * ```tsx\n * <Alert variant=\"success\" showIcon>\n * <Alert.Title>Success! Your changes have been saved</Alert.Title>\n * <Alert.Description>\n * This is an alert with icon, title and description.\n * </Alert.Description>\n * </Alert>\n * ```\n */\nconst Alert: ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>> = forwardRef<\n HTMLDivElement,\n AlertProps\n>(({variant = 'info', showIcon = true, children, className, style, ...rest}: AlertProps, ref: Ref<HTMLDivElement>) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: ReturnType<typeof useStyles> = useStyles(theme, colorScheme, variant);\n const IconComponent: FC<SVGProps<SVGSVGElement>> = getDefaultIcon(variant);\n\n return (\n <AlertVariantContext.Provider value={variant}>\n <div\n ref={ref}\n role=\"alert\"\n style={style}\n className={cx(\n withVendorCSSClassPrefix(bem('alert')),\n styles['alert'],\n styles['variant'],\n withVendorCSSClassPrefix(bem('alert', null, variant)),\n className,\n )}\n {...rest}\n >\n {showIcon && (\n <div className={cx(withVendorCSSClassPrefix(bem('alert', 'icon')), styles['icon'])}>\n <IconComponent />\n </div>\n )}\n <div className={cx(withVendorCSSClassPrefix(bem('alert', 'content')), styles['content'])}>{children}</div>\n </div>\n </AlertVariantContext.Provider>\n );\n});\n\n/**\n * Alert title component.\n */\nconst AlertTitle: FC<AlertTitleProps> = ({children, className, style, ...rest}: AlertTitleProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const variant: AlertVariant = useAlertVariant();\n const styles: ReturnType<typeof useStyles> = useStyles(theme, colorScheme, variant);\n\n const {color, ...filteredRest} = rest;\n\n return (\n <Typography\n component=\"h3\"\n variant=\"h6\"\n fontWeight={600}\n style={style}\n className={cx(withVendorCSSClassPrefix(bem('alert', 'title')), styles['title'], className)}\n {...filteredRest}\n >\n {children}\n </Typography>\n );\n};\n\n/**\n * Alert description component.\n */\nconst AlertDescription: FC<AlertDescriptionProps> = ({children, className, style, ...rest}: AlertDescriptionProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const variant: AlertVariant = useAlertVariant();\n const styles: ReturnType<typeof useStyles> = useStyles(theme, colorScheme, variant);\n\n const {color, ...filteredRest} = rest;\n\n return (\n <Typography\n component=\"p\"\n variant=\"body2\"\n style={style}\n className={cx(withVendorCSSClassPrefix(bem('alert', 'description')), styles['description'], className)}\n {...filteredRest}\n >\n {children}\n </Typography>\n );\n};\n\nAlert.displayName = 'Alert';\nAlertTitle.displayName = 'Alert.Title';\nAlertDescription.displayName = 'Alert.Description';\n\n(Alert as any).Title = AlertTitle;\n(Alert as any).Description = AlertDescription;\n\nexport interface AlertComponent extends ForwardRefExoticComponent<AlertProps & RefAttributes<HTMLDivElement>> {\n Description: typeof AlertDescription;\n Title: typeof AlertTitle;\n}\n\nexport default Alert as AlertComponent;\nexport {Alert, AlertTitle, AlertDescription};\n"],"mappings":";;;;;;;;;;;;;;;;;AAyDA,MAAM,kBAAkB,YAAuD;AAC7E,SAAQ,SAAR;EACE,KAAK,UACH,QAAOA;EACT,KAAK,QACH,QAAOC;EACT,KAAK,UACH,QAAOC;EACT,KAAK,OACH,QAAOC;EACT,QACE,QAAOA;;;AAIb,MAAMC,+CAAyE,OAAO;AAEtF,MAAa,8CAAiD,oBAAoB;;;;;;;;;;;;;;AAelF,MAAMC,+BAGH,EAAC,UAAU,QAAQ,WAAW,MAAM,UAAU,WAAW,MAAO,GAAG,QAAmB,QAA6B;CACpH,MAAM,EAAC,OAAO,gBAA4CC,0BAAU;CACpE,MAAMC,SAAuCC,6BAAU,OAAO,aAAa,QAAQ;CACnF,MAAMC,gBAA6C,eAAe,QAAQ;AAE1E,QACE,2CAAC,oBAAoB;EAAS,OAAO;YACnC,4CAAC;GACM;GACL,MAAK;GACE;GACP,WAAWC,kGACoB,QAAQ,CAAC,EACtC,OAAO,UACP,OAAO,2FACsB,SAAS,MAAM,QAAQ,CAAC,EACrD,UACD;GACD,GAAI;cAEH,YACC,2CAAC;IAAI,WAAWA,kGAAgC,SAAS,OAAO,CAAC,EAAE,OAAO,QAAQ;cAChF,2CAAC,kBAAgB;KACb,EAER,2CAAC;IAAI,WAAWA,kGAAgC,SAAS,UAAU,CAAC,EAAE,OAAO,WAAW;IAAG;KAAe;IACtG;GACuB;EAEjC;;;;AAKF,MAAMC,cAAmC,EAAC,UAAU,WAAW,MAAO,GAAG,WAA2B;CAClG,MAAM,EAAC,OAAO,gBAA4CL,0BAAU;CAEpE,MAAMC,SAAuCC,6BAAU,OAAO,aADhC,iBAAiB,CACoC;CAEnF,MAAM,EAAC,MAAO,GAAG,iBAAgB;AAEjC,QACE,2CAACI;EACC,WAAU;EACV,SAAQ;EACR,YAAY;EACL;EACP,WAAWF,kGAAgC,SAAS,QAAQ,CAAC,EAAE,OAAO,UAAU,UAAU;EAC1F,GAAI;EAEH;GACU;;;;;AAOjB,MAAMG,oBAA+C,EAAC,UAAU,WAAW,MAAO,GAAG,WAAiC;CACpH,MAAM,EAAC,OAAO,gBAA4CP,0BAAU;CAEpE,MAAMC,SAAuCC,6BAAU,OAAO,aADhC,iBAAiB,CACoC;CAEnF,MAAM,EAAC,MAAO,GAAG,iBAAgB;AAEjC,QACE,2CAACI;EACC,WAAU;EACV,SAAQ;EACD;EACP,WAAWF,kGAAgC,SAAS,cAAc,CAAC,EAAE,OAAO,gBAAgB,UAAU;EACtG,GAAI;EAEH;GACU;;AAIjB,MAAM,cAAc;AACpB,WAAW,cAAc;AACzB,iBAAiB,cAAc;AAE/B,AAAC,MAAc,QAAQ;AACvB,AAAC,MAAc,cAAc;AAO7B,oBAAe"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_emotion = require('../../../styles/emotion.cjs');
|
|
2
3
|
let react = require("react");
|
|
3
4
|
react = require_rolldown_runtime.__toESM(react);
|
|
4
|
-
let __emotion_css = require("@emotion/css");
|
|
5
|
-
__emotion_css = require_rolldown_runtime.__toESM(__emotion_css);
|
|
6
5
|
|
|
7
6
|
//#region src/components/primitives/Alert/Alert.styles.ts
|
|
8
7
|
/**
|
|
@@ -13,7 +12,7 @@ __emotion_css = require_rolldown_runtime.__toESM(__emotion_css);
|
|
|
13
12
|
* @returns Object containing CSS class names for component styling
|
|
14
13
|
*/
|
|
15
14
|
const useStyles = (theme, colorScheme, variant) => (0, react.useMemo)(() => {
|
|
16
|
-
const baseAlert =
|
|
15
|
+
const baseAlert = require_emotion.css`
|
|
17
16
|
padding: calc(${theme.vars.spacing.unit} * 2);
|
|
18
17
|
border-radius: ${theme.vars.borderRadius.medium};
|
|
19
18
|
border: 1px solid;
|
|
@@ -23,41 +22,41 @@ const useStyles = (theme, colorScheme, variant) => (0, react.useMemo)(() => {
|
|
|
23
22
|
align-items: flex-start;
|
|
24
23
|
`;
|
|
25
24
|
const variantStyles = {
|
|
26
|
-
error:
|
|
25
|
+
error: require_emotion.css`
|
|
27
26
|
background-color: color-mix(in srgb, ${theme.vars.colors.error.main} 20%, white);
|
|
28
27
|
border-color: ${theme.vars.colors.error.main};
|
|
29
28
|
color: ${theme.vars.colors.error.main};
|
|
30
29
|
`,
|
|
31
|
-
info:
|
|
30
|
+
info: require_emotion.css`
|
|
32
31
|
background-color: color-mix(in srgb, ${theme.vars.colors.info.main} 20%, white);
|
|
33
32
|
border-color: ${theme.vars.colors.info.main};
|
|
34
33
|
color: ${theme.vars.colors.info.main};
|
|
35
34
|
`,
|
|
36
|
-
success:
|
|
35
|
+
success: require_emotion.css`
|
|
37
36
|
background-color: color-mix(in srgb, ${theme.vars.colors.success.main} 20%, white);
|
|
38
37
|
border-color: ${theme.vars.colors.success.main};
|
|
39
38
|
color: ${theme.vars.colors.success.main};
|
|
40
39
|
`,
|
|
41
|
-
warning:
|
|
40
|
+
warning: require_emotion.css`
|
|
42
41
|
background-color: color-mix(in srgb, ${theme.vars.colors.warning.main} 20%, white);
|
|
43
42
|
border-color: ${theme.vars.colors.warning.main};
|
|
44
43
|
color: ${theme.vars.colors.warning.main};
|
|
45
44
|
`
|
|
46
45
|
};
|
|
47
|
-
const iconStyles =
|
|
46
|
+
const iconStyles = require_emotion.css`
|
|
48
47
|
flex-shrink: 0;
|
|
49
48
|
margin-top: calc(${theme.vars.spacing.unit} * 0.25);
|
|
50
49
|
width: calc(${theme.vars.spacing.unit} * 2.5);
|
|
51
50
|
height: calc(${theme.vars.spacing.unit} * 2.5);
|
|
52
51
|
color: ${theme.vars.colors[variant]?.contrastText};
|
|
53
52
|
`;
|
|
54
|
-
const contentStyles =
|
|
53
|
+
const contentStyles = require_emotion.css`
|
|
55
54
|
flex: 1;
|
|
56
55
|
display: flex;
|
|
57
56
|
flex-direction: column;
|
|
58
57
|
gap: ${theme.vars.spacing.unit};
|
|
59
58
|
`;
|
|
60
|
-
const titleStyles =
|
|
59
|
+
const titleStyles = require_emotion.css`
|
|
61
60
|
margin: 0;
|
|
62
61
|
font-size: ${theme.vars.typography.fontSizes.sm};
|
|
63
62
|
font-weight: 600;
|
|
@@ -67,7 +66,7 @@ const useStyles = (theme, colorScheme, variant) => (0, react.useMemo)(() => {
|
|
|
67
66
|
return {
|
|
68
67
|
alert: baseAlert,
|
|
69
68
|
content: contentStyles,
|
|
70
|
-
description:
|
|
69
|
+
description: require_emotion.css`
|
|
71
70
|
margin: 0;
|
|
72
71
|
font-size: ${theme.vars.typography.fontSizes.sm};
|
|
73
72
|
line-height: 1.4;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Alert.styles.cjs","names":["baseAlert: string","variantStyles: Record<string, string>","iconStyles: string","contentStyles: string","titleStyles: string"],"sources":["../../../../../src/components/primitives/Alert/Alert.styles.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {
|
|
1
|
+
{"version":3,"file":"Alert.styles.cjs","names":["baseAlert: string","variantStyles: Record<string, string>","iconStyles: string","contentStyles: string","titleStyles: string"],"sources":["../../../../../src/components/primitives/Alert/Alert.styles.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\nexport type AlertVariant = 'success' | 'error' | 'warning' | 'info';\n\n/**\n * Creates styles for the Alert component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param variant - The alert variant\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (theme: Theme, colorScheme: string, variant: AlertVariant): Record<string, string> =>\n useMemo(() => {\n const baseAlert: string = css`\n padding: calc(${theme.vars.spacing.unit} * 2);\n border-radius: ${theme.vars.borderRadius.medium};\n border: 1px solid;\n font-family: ${theme.vars.typography.fontFamily};\n display: flex;\n gap: calc(${theme.vars.spacing.unit} * 1.5);\n align-items: flex-start;\n `;\n\n const variantStyles: Record<string, string> = {\n error: css`\n background-color: color-mix(in srgb, ${theme.vars.colors.error.main} 20%, white);\n border-color: ${theme.vars.colors.error.main};\n color: ${theme.vars.colors.error.main};\n `,\n info: css`\n background-color: color-mix(in srgb, ${theme.vars.colors.info.main} 20%, white);\n border-color: ${theme.vars.colors.info.main};\n color: ${theme.vars.colors.info.main};\n `,\n success: css`\n background-color: color-mix(in srgb, ${theme.vars.colors.success.main} 20%, white);\n border-color: ${theme.vars.colors.success.main};\n color: ${theme.vars.colors.success.main};\n `,\n warning: css`\n background-color: color-mix(in srgb, ${theme.vars.colors.warning.main} 20%, white);\n border-color: ${theme.vars.colors.warning.main};\n color: ${theme.vars.colors.warning.main};\n `,\n };\n\n const iconStyles: string = css`\n flex-shrink: 0;\n margin-top: calc(${theme.vars.spacing.unit} * 0.25);\n width: calc(${theme.vars.spacing.unit} * 2.5);\n height: calc(${theme.vars.spacing.unit} * 2.5);\n color: ${theme.vars.colors[variant]?.contrastText};\n `;\n\n const contentStyles: string = css`\n flex: 1;\n display: flex;\n flex-direction: column;\n gap: ${theme.vars.spacing.unit};\n `;\n\n const titleStyles: string = css`\n margin: 0;\n font-size: ${theme.vars.typography.fontSizes.sm};\n font-weight: 600;\n line-height: 1.4;\n color: ${theme.vars.colors[variant]?.contrastText};\n `;\n\n const descriptionStyles: string = css`\n margin: 0;\n font-size: ${theme.vars.typography.fontSizes.sm};\n line-height: 1.4;\n color: ${theme.vars.colors.text.secondary};\n `;\n\n return {\n alert: baseAlert,\n content: contentStyles,\n description: descriptionStyles,\n icon: iconStyles,\n title: titleStyles,\n variant: variantStyles[variant],\n };\n }, [theme, colorScheme, variant]);\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;;;;AAgBA,MAAM,aAAa,OAAc,aAAqB,qCACtC;CACZ,MAAMA,YAAoB,mBAAG;sBACX,MAAM,KAAK,QAAQ,KAAK;uBACvB,MAAM,KAAK,aAAa,OAAO;;qBAEjC,MAAM,KAAK,WAAW,WAAW;;kBAEpC,MAAM,KAAK,QAAQ,KAAK;;;CAItC,MAAMC,gBAAwC;EAC5C,OAAO,mBAAG;+CAC+B,MAAM,KAAK,OAAO,MAAM,KAAK;wBACpD,MAAM,KAAK,OAAO,MAAM,KAAK;iBACpC,MAAM,KAAK,OAAO,MAAM,KAAK;;EAExC,MAAM,mBAAG;+CACgC,MAAM,KAAK,OAAO,KAAK,KAAK;wBACnD,MAAM,KAAK,OAAO,KAAK,KAAK;iBACnC,MAAM,KAAK,OAAO,KAAK,KAAK;;EAEvC,SAAS,mBAAG;+CAC6B,MAAM,KAAK,OAAO,QAAQ,KAAK;wBACtD,MAAM,KAAK,OAAO,QAAQ,KAAK;iBACtC,MAAM,KAAK,OAAO,QAAQ,KAAK;;EAE1C,SAAS,mBAAG;+CAC6B,MAAM,KAAK,OAAO,QAAQ,KAAK;wBACtD,MAAM,KAAK,OAAO,QAAQ,KAAK;iBACtC,MAAM,KAAK,OAAO,QAAQ,KAAK;;EAE3C;CAED,MAAMC,aAAqB,mBAAG;;yBAET,MAAM,KAAK,QAAQ,KAAK;oBAC7B,MAAM,KAAK,QAAQ,KAAK;qBACvB,MAAM,KAAK,QAAQ,KAAK;eAC9B,MAAM,KAAK,OAAO,UAAU,aAAa;;CAGpD,MAAMC,gBAAwB,mBAAG;;;;aAIxB,MAAM,KAAK,QAAQ,KAAK;;CAGjC,MAAMC,cAAsB,mBAAG;;mBAEhB,MAAM,KAAK,WAAW,UAAU,GAAG;;;eAGvC,MAAM,KAAK,OAAO,UAAU,aAAa;;AAUpD,QAAO;EACL,OAAO;EACP,SAAS;EACT,aAVgC,mBAAG;;mBAEtB,MAAM,KAAK,WAAW,UAAU,GAAG;;eAEvC,MAAM,KAAK,OAAO,KAAK,UAAU;;EAO1C,MAAM;EACN,OAAO;EACP,SAAS,cAAc;EACxB;GACA;CAAC;CAAO;CAAa;CAAQ,CAAC;AAEnC,2BAAe"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_emotion = require('../../../styles/emotion.cjs');
|
|
2
3
|
const require_useTheme = require('../../../contexts/Theme/useTheme.cjs');
|
|
3
4
|
const require_Avatar_styles = require('./Avatar.styles.cjs');
|
|
4
5
|
let __thunderid_browser = require("@thunderid/browser");
|
|
@@ -7,8 +8,6 @@ let react = require("react");
|
|
|
7
8
|
react = require_rolldown_runtime.__toESM(react);
|
|
8
9
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
9
10
|
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
10
|
-
let __emotion_css = require("@emotion/css");
|
|
11
|
-
__emotion_css = require_rolldown_runtime.__toESM(__emotion_css);
|
|
12
11
|
|
|
13
12
|
//#region src/components/primitives/Avatar/Avatar.tsx
|
|
14
13
|
const Avatar = ({ alt = "User avatar", background = "random", className = "", imageUrl, name, size = 64, variant = "circular", isLoading = false }) => {
|
|
@@ -54,19 +53,19 @@ const Avatar = ({ alt = "User avatar", background = "random", className = "", im
|
|
|
54
53
|
if (hasImage) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("img", {
|
|
55
54
|
src: resolvedIcon?.imgSrc,
|
|
56
55
|
alt,
|
|
57
|
-
className:
|
|
56
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("avatar", "image")), styles["image"])
|
|
58
57
|
});
|
|
59
58
|
if (name) return getInitials(name);
|
|
60
|
-
if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className:
|
|
59
|
+
if (isLoading) return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", { className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("avatar", "skeleton")), styles["skeleton"]) });
|
|
61
60
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("svg", {
|
|
62
61
|
xmlns: "http://www.w3.org/2000/svg",
|
|
63
62
|
viewBox: "0 0 640 640",
|
|
64
|
-
className:
|
|
63
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("avatar", "icon")), styles["icon"]),
|
|
65
64
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("path", { d: "M240 192C240 147.8 275.8 112 320 112C364.2 112 400 147.8 400 192C400 236.2 364.2 272 320 272C275.8 272 240 236.2 240 192zM448 192C448 121.3 390.7 64 320 64C249.3 64 192 121.3 192 192C192 262.7 249.3 320 320 320C390.7 320 448 262.7 448 192zM144 544C144 473.3 201.3 416 272 416L368 416C438.7 416 496 473.3 496 544L496 552C496 565.3 506.7 576 520 576C533.3 576 544 565.3 544 552L544 544C544 446.8 465.2 368 368 368L272 368C174.8 368 96 446.8 96 544L96 552C96 565.3 106.7 576 120 576C133.3 576 144 565.3 144 552L144 544z" })
|
|
66
65
|
});
|
|
67
66
|
};
|
|
68
67
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
|
|
69
|
-
className:
|
|
68
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("avatar")), styles["avatar"], styles["variant"], (0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("avatar", null, variant)), isDefaultState && (0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("avatar", "default")), className),
|
|
70
69
|
children: renderContent()
|
|
71
70
|
});
|
|
72
71
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.cjs","names":["Avatar: FC<AvatarProps>","useTheme","resolvedIcon: ResolvedLogo | undefined","hasImage: boolean","hash: number","charCode: number","seed: number","hue1: number","hue2: number","saturation: number","styles: ReturnType<typeof useStyles>","useStyles","isDefaultState: boolean"],"sources":["../../../../../src/components/primitives/Avatar/Avatar.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {
|
|
1
|
+
{"version":3,"file":"Avatar.cjs","names":["Avatar: FC<AvatarProps>","useTheme","resolvedIcon: ResolvedLogo | undefined","hasImage: boolean","hash: number","charCode: number","seed: number","hue1: number","hue2: number","saturation: number","styles: ReturnType<typeof useStyles>","useStyles","isDefaultState: boolean","cx"],"sources":["../../../../../src/components/primitives/Avatar/Avatar.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {withVendorCSSClassPrefix, bem, resolveLogoUri, ResolvedLogo} from '@thunderid/browser';\nimport {FC, JSX, useMemo} from 'react';\nimport useStyles from './Avatar.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport {cx} from '../../../styles/emotion';\n\nexport interface AvatarProps {\n /**\n * Alternative text for the avatar image\n */\n alt?: string;\n /**\n * Background generation strategy\n * - 'random': Generate background color based on ASCII values of the name\n * - 'none': Use default theme background\n * - string: Use custom background color\n * @default 'random'\n */\n background?: 'random' | 'none' | string;\n /**\n * Optional className for the avatar\n */\n className?: string;\n /**\n * The avatar image. Accepts a plain URL, or any `resolveLogoUri`-compatible\n * spec (`emoji:<glyph>`, or `avatar:shape=...,variant=...,content=...,colors=...,bg=...`).\n */\n imageUrl?: string;\n /**\n * Loading state of the avatar\n */\n isLoading?: boolean;\n /**\n * The name to use for generating initials when no image is provided\n */\n name?: string;\n /**\n * The size of the avatar in pixels\n */\n size?: number;\n /**\n * The variant of the avatar shape\n * @default 'circular'\n */\n variant?: 'circular' | 'square';\n}\n\nexport const Avatar: FC<AvatarProps> = ({\n alt = 'User avatar',\n background = 'random',\n className = '',\n imageUrl,\n name,\n size = 64,\n variant = 'circular',\n isLoading = false,\n}: AvatarProps): JSX.Element => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n\n const resolvedIcon: ResolvedLogo | undefined = useMemo(\n () => (imageUrl ? resolveLogoUri(imageUrl, name ?? alt) : undefined),\n [imageUrl, name, alt],\n );\n\n const hasImage: boolean = resolvedIcon?.kind !== 'emoji' && Boolean(resolvedIcon?.imgSrc);\n\n const generateBackgroundColor = (inputString: string): string => {\n const hash: number = inputString.split('').reduce((acc: number, char: string) => {\n const charCode: number = char.charCodeAt(0);\n\n return ((acc << 5) - acc + charCode) & 0xffffffff;\n }, 0);\n\n const seed: number = Math.abs(hash);\n\n const generateColor = (offset: number): string => {\n const hue1: number = (seed + offset) % 360;\n const hue2: number = (hue1 + 60 + (seed % 120)) % 360;\n\n const saturation: number = 70 + (seed % 20);\n const lightness1: number = 55 + (seed % 15);\n const lightness2: number = 60 + ((seed + offset) % 15);\n\n return `hsl(${hue1}, ${saturation}%, ${lightness1}%), hsl(${hue2}, ${saturation}%, ${lightness2}%)`;\n };\n\n const angle: number = 45 + (seed % 91);\n\n const colors: string = generateColor(seed);\n return `linear-gradient(${angle}deg, ${colors})`;\n };\n\n const backgroundColor: string | undefined = useMemo(() => {\n if (!name || hasImage) {\n return undefined;\n }\n\n if (background === 'random') {\n return generateBackgroundColor(name);\n }\n\n if (background === 'none') {\n return undefined;\n }\n\n return background;\n }, [background, name, hasImage]);\n\n const styles: ReturnType<typeof useStyles> = useStyles(theme, colorScheme, size, variant, backgroundColor);\n\n // Determine if we're in the default state (no image, no name, not loading)\n const isDefaultState: boolean = !imageUrl && !name && !isLoading;\n\n const getInitials = (fullName: string): string =>\n fullName\n .split(' ')\n .map((part: string) => part[0])\n .slice(0, 2)\n .join('')\n .toUpperCase();\n\n const renderContent = (): JSX.Element | string => {\n if (resolvedIcon?.kind === 'emoji') {\n return (\n <span role=\"img\" aria-label={alt}>\n {resolvedIcon.glyph}\n </span>\n );\n }\n\n if (hasImage) {\n return (\n <img\n src={resolvedIcon?.imgSrc}\n alt={alt}\n className={cx(withVendorCSSClassPrefix(bem('avatar', 'image')), styles['image'])}\n />\n );\n }\n\n if (name) {\n return getInitials(name);\n }\n\n if (isLoading) {\n return <div className={cx(withVendorCSSClassPrefix(bem('avatar', 'skeleton')), styles['skeleton'])} />;\n }\n\n // Default user icon\n return (\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n viewBox=\"0 0 640 640\"\n className={cx(withVendorCSSClassPrefix(bem('avatar', 'icon')), styles['icon'])}\n >\n <path d=\"M240 192C240 147.8 275.8 112 320 112C364.2 112 400 147.8 400 192C400 236.2 364.2 272 320 272C275.8 272 240 236.2 240 192zM448 192C448 121.3 390.7 64 320 64C249.3 64 192 121.3 192 192C192 262.7 249.3 320 320 320C390.7 320 448 262.7 448 192zM144 544C144 473.3 201.3 416 272 416L368 416C438.7 416 496 473.3 496 544L496 552C496 565.3 506.7 576 520 576C533.3 576 544 565.3 544 552L544 544C544 446.8 465.2 368 368 368L272 368C174.8 368 96 446.8 96 544L96 552C96 565.3 106.7 576 120 576C133.3 576 144 565.3 144 552L144 544z\" />\n </svg>\n );\n };\n\n return (\n <div\n className={cx(\n withVendorCSSClassPrefix(bem('avatar')),\n styles['avatar'],\n styles['variant'],\n withVendorCSSClassPrefix(bem('avatar', null, variant)),\n isDefaultState && withVendorCSSClassPrefix(bem('avatar', 'default')),\n className,\n )}\n >\n {renderContent()}\n </div>\n );\n};\n\nexport default Avatar;\n"],"mappings":";;;;;;;;;;;;AAkDA,MAAaA,UAA2B,EACtC,MAAM,eACN,aAAa,UACb,YAAY,IACZ,UACA,MACA,OAAO,IACP,UAAU,YACV,YAAY,YACkB;CAC9B,MAAM,EAAC,OAAO,gBAA4CC,0BAAU;CAEpE,MAAMC,wCACG,mDAA0B,UAAU,QAAQ,IAAI,GAAG,QAC1D;EAAC;EAAU;EAAM;EAAI,CACtB;CAED,MAAMC,WAAoB,cAAc,SAAS,WAAW,QAAQ,cAAc,OAAO;CAEzF,MAAM,2BAA2B,gBAAgC;EAC/D,MAAMC,OAAe,YAAY,MAAM,GAAG,CAAC,QAAQ,KAAa,SAAiB;GAC/E,MAAMC,WAAmB,KAAK,WAAW,EAAE;AAE3C,WAAS,OAAO,KAAK,MAAM,WAAY;KACtC,EAAE;EAEL,MAAMC,OAAe,KAAK,IAAI,KAAK;EAEnC,MAAM,iBAAiB,WAA2B;GAChD,MAAMC,QAAgB,OAAO,UAAU;GACvC,MAAMC,QAAgB,OAAO,KAAM,OAAO,OAAQ;GAElD,MAAMC,aAAqB,KAAM,OAAO;AAIxC,UAAO,OAAO,KAAK,IAAI,WAAW,KAHP,KAAM,OAAO,GAGU,UAAU,KAAK,IAAI,WAAW,KAFrD,MAAO,OAAO,UAAU,GAE6C;;AAMlG,SAAO,mBAHe,KAAM,OAAO,GAGH,OADT,cAAc,KAAK,CACI;;CAmBhD,MAAMC,SAAuCC,8BAAU,OAAO,aAAa,MAAM,kCAhBvB;AACxD,MAAI,CAAC,QAAQ,SACX;AAGF,MAAI,eAAe,SACjB,QAAO,wBAAwB,KAAK;AAGtC,MAAI,eAAe,OACjB;AAGF,SAAO;IACN;EAAC;EAAY;EAAM;EAAS,CAAC,CAE0E;CAG1G,MAAMC,iBAA0B,CAAC,YAAY,CAAC,QAAQ,CAAC;CAEvD,MAAM,eAAe,aACnB,SACG,MAAM,IAAI,CACV,KAAK,SAAiB,KAAK,GAAG,CAC9B,MAAM,GAAG,EAAE,CACX,KAAK,GAAG,CACR,aAAa;CAElB,MAAM,sBAA4C;AAChD,MAAI,cAAc,SAAS,QACzB,QACE,2CAAC;GAAK,MAAK;GAAM,cAAY;aAC1B,aAAa;IACT;AAIX,MAAI,SACF,QACE,2CAAC;GACC,KAAK,cAAc;GACd;GACL,WAAWC,kGAAgC,UAAU,QAAQ,CAAC,EAAE,OAAO,SAAS;IAChF;AAIN,MAAI,KACF,QAAO,YAAY,KAAK;AAG1B,MAAI,UACF,QAAO,2CAAC,SAAI,WAAWA,kGAAgC,UAAU,WAAW,CAAC,EAAE,OAAO,YAAY,GAAI;AAIxG,SACE,2CAAC;GACC,OAAM;GACN,SAAQ;GACR,WAAWA,kGAAgC,UAAU,OAAO,CAAC,EAAE,OAAO,QAAQ;aAE9E,2CAAC,UAAK,GAAE,ygBAAygB;IAC7gB;;AAIV,QACE,2CAAC;EACC,WAAWA,kGACoB,SAAS,CAAC,EACvC,OAAO,WACP,OAAO,2FACsB,UAAU,MAAM,QAAQ,CAAC,EACtD,iGAA+C,UAAU,UAAU,CAAC,EACpE,UACD;YAEA,eAAe;GACZ"}
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_emotion = require('../../../styles/emotion.cjs');
|
|
2
3
|
let react = require("react");
|
|
3
4
|
react = require_rolldown_runtime.__toESM(react);
|
|
4
|
-
let __emotion_css = require("@emotion/css");
|
|
5
|
-
__emotion_css = require_rolldown_runtime.__toESM(__emotion_css);
|
|
6
5
|
|
|
7
6
|
//#region src/components/primitives/Avatar/Avatar.styles.ts
|
|
8
7
|
/**
|
|
@@ -15,7 +14,7 @@ __emotion_css = require_rolldown_runtime.__toESM(__emotion_css);
|
|
|
15
14
|
* @returns Object containing CSS class names for component styling
|
|
16
15
|
*/
|
|
17
16
|
const useStyles = (theme, colorScheme, size, variant, backgroundColor) => (0, react.useMemo)(() => {
|
|
18
|
-
const baseAvatar =
|
|
17
|
+
const baseAvatar = require_emotion.css`
|
|
19
18
|
align-items: center;
|
|
20
19
|
background: ${backgroundColor || theme.vars.colors.background.surface};
|
|
21
20
|
border: ${backgroundColor ? "none" : `1px solid ${theme.vars.colors.border}`};
|
|
@@ -32,19 +31,19 @@ const useStyles = (theme, colorScheme, size, variant, backgroundColor) => (0, re
|
|
|
32
31
|
width: ${size}px;
|
|
33
32
|
`;
|
|
34
33
|
const variantStyles = {
|
|
35
|
-
circular:
|
|
34
|
+
circular: require_emotion.css`
|
|
36
35
|
border-radius: 50%;
|
|
37
36
|
`,
|
|
38
|
-
square:
|
|
37
|
+
square: require_emotion.css`
|
|
39
38
|
border-radius: 8px;
|
|
40
39
|
`
|
|
41
40
|
};
|
|
42
|
-
const imageStyles =
|
|
41
|
+
const imageStyles = require_emotion.css`
|
|
43
42
|
height: 100%;
|
|
44
43
|
object-fit: cover;
|
|
45
44
|
width: 100%;
|
|
46
45
|
`;
|
|
47
|
-
const skeletonStyles =
|
|
46
|
+
const skeletonStyles = require_emotion.css`
|
|
48
47
|
width: 100%;
|
|
49
48
|
height: 100%;
|
|
50
49
|
background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
|
|
@@ -63,7 +62,7 @@ const useStyles = (theme, colorScheme, size, variant, backgroundColor) => (0, re
|
|
|
63
62
|
`;
|
|
64
63
|
return {
|
|
65
64
|
avatar: baseAvatar,
|
|
66
|
-
icon:
|
|
65
|
+
icon: require_emotion.css`
|
|
67
66
|
width: 60%;
|
|
68
67
|
height: 60%;
|
|
69
68
|
fill: ${backgroundColor ? "#ffffff" : theme.vars.colors.text.secondary};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Avatar.styles.cjs","names":["baseAvatar: string","variantStyles: Record<string, string>","imageStyles: string","skeletonStyles: string"],"sources":["../../../../../src/components/primitives/Avatar/Avatar.styles.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {
|
|
1
|
+
{"version":3,"file":"Avatar.styles.cjs","names":["baseAvatar: string","variantStyles: Record<string, string>","imageStyles: string","skeletonStyles: string"],"sources":["../../../../../src/components/primitives/Avatar/Avatar.styles.ts"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\nexport type AvatarVariant = 'circular' | 'square';\n\n/**\n * Creates styles for the Avatar component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param size - The size of the avatar in pixels\n * @param variant - The avatar variant\n * @param backgroundColor - The background color for the avatar\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n size: number,\n variant: AvatarVariant,\n backgroundColor?: string,\n): Record<string, string> =>\n useMemo(() => {\n const baseAvatar: string = css`\n align-items: center;\n background: ${backgroundColor || theme.vars.colors.background.surface};\n border: ${backgroundColor ? 'none' : `1px solid ${theme.vars.colors.border}`};\n border-radius: ${variant === 'circular' ? '50%' : '8px'};\n color: ${backgroundColor ? '#ffffff' : theme.vars.colors.text.primary};\n display: flex;\n font-size: ${size * 0.4}px;\n font-family: ${theme.vars.typography.fontFamily};\n font-weight: 600;\n height: ${size}px;\n justify-content: center;\n overflow: hidden;\n text-shadow: ${backgroundColor ? '0 1px 2px rgba(0, 0, 0, 0.1)' : 'none'};\n width: ${size}px;\n `;\n\n const variantStyles: Record<string, string> = {\n circular: css`\n border-radius: 50%;\n `,\n square: css`\n border-radius: 8px;\n `,\n };\n\n const imageStyles: string = css`\n height: 100%;\n object-fit: cover;\n width: 100%;\n `;\n\n const skeletonStyles: string = css`\n width: 100%;\n height: 100%;\n background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);\n background-size: 200% 100%;\n animation: skeleton-loading 1.5s infinite;\n border-radius: ${variant === 'circular' ? '50%' : '8px'};\n\n @keyframes skeleton-loading {\n 0% {\n background-position: -200% 0;\n }\n 100% {\n background-position: 200% 0;\n }\n }\n `;\n\n const iconStyles: string = css`\n width: 60%;\n height: 60%;\n fill: ${backgroundColor ? '#ffffff' : theme.vars.colors.text.secondary};\n opacity: 0.8;\n `;\n\n return {\n avatar: baseAvatar,\n icon: iconStyles,\n image: imageStyles,\n skeleton: skeletonStyles,\n variant: variantStyles[variant],\n };\n }, [theme, colorScheme, size, variant, backgroundColor]);\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;;;;;;AAkBA,MAAM,aACJ,OACA,aACA,MACA,SACA,6CAEc;CACZ,MAAMA,aAAqB,mBAAG;;oBAEd,mBAAmB,MAAM,KAAK,OAAO,WAAW,QAAQ;gBAC5D,kBAAkB,SAAS,aAAa,MAAM,KAAK,OAAO,SAAS;uBAC5D,YAAY,aAAa,QAAQ,MAAM;eAC/C,kBAAkB,YAAY,MAAM,KAAK,OAAO,KAAK,QAAQ;;mBAEzD,OAAO,GAAI;qBACT,MAAM,KAAK,WAAW,WAAW;;gBAEtC,KAAK;;;qBAGA,kBAAkB,iCAAiC,OAAO;eAChE,KAAK;;CAGhB,MAAMC,gBAAwC;EAC5C,UAAU,mBAAG;;;EAGb,QAAQ,mBAAG;;;EAGZ;CAED,MAAMC,cAAsB,mBAAG;;;;;CAM/B,MAAMC,iBAAyB,mBAAG;;;;;;uBAMf,YAAY,aAAa,QAAQ,MAAM;;;;;;;;;;;AAmB1D,QAAO;EACL,QAAQ;EACR,MATyB,mBAAG;;;cAGpB,kBAAkB,YAAY,MAAM,KAAK,OAAO,KAAK,UAAU;;;EAOvE,OAAO;EACP,UAAU;EACV,SAAS,cAAc;EACxB;GACA;CAAC;CAAO;CAAa;CAAM;CAAS;CAAgB,CAAC;AAE1D,4BAAe"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
const require_rolldown_runtime = require('../../../_virtual/rolldown_runtime.cjs');
|
|
2
|
+
const require_emotion = require('../../../styles/emotion.cjs');
|
|
2
3
|
const require_useTheme = require('../../../contexts/Theme/useTheme.cjs');
|
|
3
4
|
const require_Button_styles = require('./Button.styles.cjs');
|
|
4
5
|
const require_Spinner = require('../Spinner/Spinner.cjs');
|
|
@@ -8,8 +9,6 @@ let react = require("react");
|
|
|
8
9
|
react = require_rolldown_runtime.__toESM(react);
|
|
9
10
|
let react_jsx_runtime = require("react/jsx-runtime");
|
|
10
11
|
react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
|
|
11
|
-
let __emotion_css = require("@emotion/css");
|
|
12
|
-
__emotion_css = require_rolldown_runtime.__toESM(__emotion_css);
|
|
13
12
|
|
|
14
13
|
//#region src/components/primitives/Button/Button.tsx
|
|
15
14
|
const getSpinnerWidth = (sizeVal, spacingUnit) => {
|
|
@@ -55,35 +54,32 @@ const Button = (0, react.forwardRef)(({ color = "primary", variant = "solid", si
|
|
|
55
54
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("button", {
|
|
56
55
|
ref,
|
|
57
56
|
style,
|
|
58
|
-
className:
|
|
57
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button")), (0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button", variant)), (0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button", color)), (0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button", size)), (0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button", shape)), fullWidth ? (0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button", "fullWidth")) : void 0, loading ? (0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button", "loading")) : void 0, disabled || loading ? (0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button", "disabled")) : void 0, styles["button"], styles["size"], styles["variant"], styles["fullWidth"], styles["loading"], styles["shape"], className),
|
|
59
58
|
disabled: disabled || loading,
|
|
60
59
|
...rest,
|
|
61
60
|
children: [
|
|
62
61
|
loading && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
63
|
-
className:
|
|
62
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button", "spinner")), styles["spinner"]),
|
|
64
63
|
children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_Spinner.default, {
|
|
65
64
|
size,
|
|
66
65
|
color: "currentColor",
|
|
67
|
-
|
|
68
|
-
height: spinnerWidth,
|
|
69
|
-
width: spinnerWidth
|
|
70
|
-
}
|
|
66
|
+
widthOverride: spinnerWidth
|
|
71
67
|
})
|
|
72
68
|
}),
|
|
73
69
|
!loading && isIconVariant && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
74
|
-
className:
|
|
70
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button", "icon")), styles["icon"]),
|
|
75
71
|
children: children || startIcon || endIcon
|
|
76
72
|
}),
|
|
77
73
|
!loading && !isIconVariant && startIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
78
|
-
className:
|
|
74
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button", "start-icon")), styles["startIcon"]),
|
|
79
75
|
children: startIcon
|
|
80
76
|
}),
|
|
81
77
|
!isIconVariant && children && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
82
|
-
className:
|
|
78
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button", "content")), styles["content"]),
|
|
83
79
|
children
|
|
84
80
|
}),
|
|
85
81
|
!loading && !isIconVariant && endIcon && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("span", {
|
|
86
|
-
className:
|
|
82
|
+
className: require_emotion.cx((0, __thunderid_browser.withVendorCSSClassPrefix)((0, __thunderid_browser.bem)("button", "end-icon")), styles["endIcon"]),
|
|
87
83
|
children: endIcon
|
|
88
84
|
})
|
|
89
85
|
]
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Button.cjs","names":["Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLButtonElement>>","useTheme","styles: Record<string, string | null>","useStyles","isIconVariant: boolean","spinnerWidth: string","Spinner"],"sources":["../../../../../src/components/primitives/Button/Button.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {
|
|
1
|
+
{"version":3,"file":"Button.cjs","names":["Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLButtonElement>>","useTheme","styles: Record<string, string | null>","useStyles","isIconVariant: boolean","spinnerWidth: string","cx","Spinner"],"sources":["../../../../../src/components/primitives/Button/Button.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {ButtonHTMLAttributes, forwardRef, ReactNode, ForwardRefExoticComponent, RefAttributes, Ref} from 'react';\nimport useStyles from './Button.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport {cx} from '../../../styles/emotion';\nimport Spinner, {SpinnerSize} from '../Spinner/Spinner';\n\nexport type ButtonColor = 'primary' | 'secondary' | 'tertiary' | string;\nexport type ButtonVariant = 'solid' | 'outline' | 'text' | 'icon';\nexport type ButtonSize = 'small' | 'medium' | 'large';\n\nexport interface ButtonProps extends Omit<ButtonHTMLAttributes<HTMLButtonElement>, 'color'> {\n /**\n * The button color that determines the color scheme\n */\n color?: ButtonColor;\n /**\n * Icon to display after the button text\n */\n endIcon?: ReactNode;\n /**\n * Whether the button should take the full width of its container\n */\n fullWidth?: boolean;\n /**\n * Whether the button is in a loading state\n */\n loading?: boolean;\n /**\n * The shape of the button: square or round\n */\n shape?: 'square' | 'round';\n /**\n * The size of the button\n */\n size?: ButtonSize;\n /**\n * Icon to display before the button text\n */\n startIcon?: ReactNode;\n /**\n * The button variant that determines the visual style\n */\n variant?: ButtonVariant;\n}\n\nconst getSpinnerWidth = (sizeVal: ButtonSize, spacingUnit: string): string => {\n if (sizeVal === 'small') {\n return `calc(${spacingUnit} * 1.5)`;\n }\n if (sizeVal === 'medium') {\n return `calc(${spacingUnit} * 2)`;\n }\n return `calc(${spacingUnit} * 2.5)`;\n};\n\n/**\n * Button component with multiple variants and types.\n *\n * @example\n * ```tsx\n * // Primary solid button\n * <Button color=\"primary\" variant=\"solid\">\n * Click me\n * </Button>\n *\n * // Secondary outline button\n * <Button color=\"secondary\" variant=\"outline\" size=\"large\">\n * Cancel\n * </Button>\n *\n * // Text button with loading state\n * <Button color=\"tertiary\" variant=\"text\" loading>\n * Loading...\n * </Button>\n *\n * // Button with icons\n * <Button\n * color=\"primary\"\n * startIcon={<Icon />}\n * endIcon={<Arrow />}\n * >\n * Save and Continue\n * </Button>\n * ```\n */\nconst Button: ForwardRefExoticComponent<ButtonProps & RefAttributes<HTMLButtonElement>> = forwardRef<\n HTMLButtonElement,\n ButtonProps\n>(\n (\n {\n color = 'primary',\n variant = 'solid',\n size = 'medium',\n fullWidth = false,\n loading = false,\n startIcon,\n endIcon,\n children,\n className,\n disabled,\n style,\n shape = 'square',\n ...rest\n }: ButtonProps,\n ref: Ref<HTMLButtonElement>,\n ) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string | null> = useStyles(\n theme,\n colorScheme,\n color,\n variant,\n size,\n fullWidth,\n disabled || false,\n loading,\n shape,\n );\n\n const isIconVariant: boolean = variant === 'icon';\n\n const spinnerWidth: string = getSpinnerWidth(size, theme.vars.spacing.unit);\n\n return (\n <button\n ref={ref}\n style={style}\n className={cx(\n withVendorCSSClassPrefix(bem('button')),\n withVendorCSSClassPrefix(bem('button', variant)),\n withVendorCSSClassPrefix(bem('button', color)),\n withVendorCSSClassPrefix(bem('button', size)),\n withVendorCSSClassPrefix(bem('button', shape)),\n fullWidth ? withVendorCSSClassPrefix(bem('button', 'fullWidth')) : undefined,\n loading ? withVendorCSSClassPrefix(bem('button', 'loading')) : undefined,\n disabled || loading ? withVendorCSSClassPrefix(bem('button', 'disabled')) : undefined,\n styles['button'],\n styles['size'],\n styles['variant'],\n styles['fullWidth'],\n styles['loading'],\n styles['shape'],\n className,\n )}\n disabled={disabled || loading}\n {...rest}\n >\n {loading && (\n <span className={cx(withVendorCSSClassPrefix(bem('button', 'spinner')), styles['spinner'])}>\n <Spinner size={size as SpinnerSize} color=\"currentColor\" widthOverride={spinnerWidth} />\n </span>\n )}\n {!loading && isIconVariant && (\n <span className={cx(withVendorCSSClassPrefix(bem('button', 'icon')), styles['icon'])}>\n {children || startIcon || endIcon}\n </span>\n )}\n {!loading && !isIconVariant && startIcon && (\n <span className={cx(withVendorCSSClassPrefix(bem('button', 'start-icon')), styles['startIcon'])}>\n {startIcon}\n </span>\n )}\n {!isIconVariant && children && (\n <span className={cx(withVendorCSSClassPrefix(bem('button', 'content')), styles['content'])}>{children}</span>\n )}\n {!loading && !isIconVariant && endIcon && (\n <span className={cx(withVendorCSSClassPrefix(bem('button', 'end-icon')), styles['endIcon'])}>{endIcon}</span>\n )}\n </button>\n );\n },\n);\n\nButton.displayName = 'Button';\n\nexport default Button;\n"],"mappings":";;;;;;;;;;;;;AAiDA,MAAM,mBAAmB,SAAqB,gBAAgC;AAC5E,KAAI,YAAY,QACd,QAAO,QAAQ,YAAY;AAE7B,KAAI,YAAY,SACd,QAAO,QAAQ,YAAY;AAE7B,QAAO,QAAQ,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiC7B,MAAMA,gCAKF,EACE,QAAQ,WACR,UAAU,SACV,OAAO,UACP,YAAY,OACZ,UAAU,OACV,WACA,SACA,UACA,WACA,UACA,OACA,QAAQ,SACR,GAAG,QAEL,QACG;CACH,MAAM,EAAC,OAAO,gBAA4CC,0BAAU;CACpE,MAAMC,SAAwCC,8BAC5C,OACA,aACA,OACA,SACA,MACA,WACA,YAAY,OACZ,SACA,MACD;CAED,MAAMC,gBAAyB,YAAY;CAE3C,MAAMC,eAAuB,gBAAgB,MAAM,MAAM,KAAK,QAAQ,KAAK;AAE3E,QACE,4CAAC;EACM;EACE;EACP,WAAWC,kGACoB,SAAS,CAAC,iFACV,UAAU,QAAQ,CAAC,iFACnB,UAAU,MAAM,CAAC,iFACjB,UAAU,KAAK,CAAC,iFAChB,UAAU,MAAM,CAAC,EAC9C,2FAAyC,UAAU,YAAY,CAAC,GAAG,QACnE,yFAAuC,UAAU,UAAU,CAAC,GAAG,QAC/D,YAAY,yFAAuC,UAAU,WAAW,CAAC,GAAG,QAC5E,OAAO,WACP,OAAO,SACP,OAAO,YACP,OAAO,cACP,OAAO,YACP,OAAO,UACP,UACD;EACD,UAAU,YAAY;EACtB,GAAI;;GAEH,WACC,2CAAC;IAAK,WAAWA,kGAAgC,UAAU,UAAU,CAAC,EAAE,OAAO,WAAW;cACxF,2CAACC;KAAc;KAAqB,OAAM;KAAe,eAAe;MAAgB;KACnF;GAER,CAAC,WAAW,iBACX,2CAAC;IAAK,WAAWD,kGAAgC,UAAU,OAAO,CAAC,EAAE,OAAO,QAAQ;cACjF,YAAY,aAAa;KACrB;GAER,CAAC,WAAW,CAAC,iBAAiB,aAC7B,2CAAC;IAAK,WAAWA,kGAAgC,UAAU,aAAa,CAAC,EAAE,OAAO,aAAa;cAC5F;KACI;GAER,CAAC,iBAAiB,YACjB,2CAAC;IAAK,WAAWA,kGAAgC,UAAU,UAAU,CAAC,EAAE,OAAO,WAAW;IAAG;KAAgB;GAE9G,CAAC,WAAW,CAAC,iBAAiB,WAC7B,2CAAC;IAAK,WAAWA,kGAAgC,UAAU,WAAW,CAAC,EAAE,OAAO,WAAW;cAAG;KAAe;;GAExG;EAGd;AAED,OAAO,cAAc;AAErB,qBAAe"}
|