UNPKG

@unicity/design-system

Version:

A comprehensive React component library built on Material-UI with advanced theming capabilities including neumorphism design support

2 lines (1 loc) 12.9 kB
var __defProp=Object.defineProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const index=require("./index-2aYpps03.cjs"),material=require("@mui/material"),iconsMaterial=require("@mui/icons-material"),reactI18next=require("react-i18next"),AudioAlerts=__name(({compact=!1,onEvent})=>{const{t}=reactI18next.useTranslation(),{settings,updateSettings,resolvedMode}=index.useTheme(),audioAlerts=settings.audioAlerts,accessibilityMode=settings.accessibilityMode,isDarkModeHighContrast=resolvedMode==="dark"&&accessibilityMode==="high-contrast",onAudioAlertsChange=__name((field,value)=>{updateSettings({...settings,audioAlerts:{...audioAlerts,[field]:value}})},"onAudioAlertsChange");return index.jsxs(index.Box,{children:[index.jsxs(index.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",borderColor:"divider",borderRadius:1,backgroundColor:"background.paper",mb:3,gap:1.5},children:[index.jsx(index.Box,{sx:__name(theme=>({p:.75,borderRadius:1,backgroundColor:"primary.main",color:"primary.contrastText",display:"flex",alignItems:"center",justifyContent:"center","& .MuiSvgIcon-root":{fill:`${theme.palette.primary.contrastText} !important`,color:`${theme.palette.primary.contrastText} !important`,filter:isDarkModeHighContrast?"brightness(0)":resolvedMode==="dark"?"brightness(0) invert(0)":"brightness(0) invert(1)"}}),"sx"),children:index.jsx(iconsMaterial.VolumeUp,{fontSize:"small"})}),index.jsxs(index.Box,{sx:{flex:1},children:[index.jsx(index.Typography,{sx:{fontSize:"calc(14px * var(--unicity-font-scale, 1))"},fontWeight:600,children:t("audio_alerts.title")}),index.jsx(index.Typography,{sx:{fontSize:"calc(12px * var(--unicity-font-scale, 1))",color:"text.secondary"},children:t("audio_alerts.description")})]}),index.jsx(index.Tooltip,{title:t("audio_alerts.tooltip"),placement:"left",arrow:!0,children:index.jsx(index.IconButton,{size:"small",sx:{alignSelf:"flex-start"},children:index.jsx(iconsMaterial.Info,{fontSize:"small"})})})]}),index.jsx(index.Box,{sx:{p:3,border:"1px solid",borderColor:"divider",borderRadius:1,backgroundColor:"background.paper",boxShadow:"0 1px 3px rgba(0, 0, 0, 0.08)",mb:3},children:index.jsxs(material.Stack,{spacing:2.5,children:[index.jsxs(index.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2},children:[index.jsxs(index.Box,{sx:{flex:1},children:[index.jsx(index.Typography,{variant:"body2",fontWeight:500,children:t("common.sound_effects")}),index.jsx(index.Typography,{variant:"caption",color:"textSecondary",children:t("audio_alerts.audio_feedback")})]}),index.jsx(index.Switch,{checked:audioAlerts.soundEnabled,onChange:__name(checked=>onAudioAlertsChange("soundEnabled",checked),"onChange")})]}),audioAlerts.soundEnabled&&index.jsxs(index.Box,{children:[index.jsxs(index.Typography,{variant:"body2",fontWeight:500,mb:1,children:[t("audio_alerts.volume"),": ",audioAlerts.volume===0?t("audio_alerts.volume_labels.off"):audioAlerts.volume===.5?t("audio_alerts.volume_labels.medium"):audioAlerts.volume===1?t("audio_alerts.volume_labels.full"):t("common.custom")]}),index.jsx(index.Slider,{value:audioAlerts.volume,onChange:__name(value=>onAudioAlertsChange("volume",value),"onChange"),min:0,max:1,step:.1,marks:[{value:0,label:t("audio_alerts.volume_labels.off")},{value:.5,label:t("audio_alerts.volume_labels.medium")},{value:1,label:t("audio_alerts.volume_labels.full")}],sx:{"& .MuiSlider-markLabel":{fontSize:"0.75rem",'&[data-index="0"]':{transform:"translateX(0%)",textAlign:"left"},'&[data-index="2"]':{transform:"translateX(-100%)",textAlign:"right"}}}})]}),index.jsxs(index.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2},children:[index.jsxs(index.Box,{sx:{flex:1},children:[index.jsx(index.Typography,{variant:"body2",fontWeight:500,children:t("audio_alerts.visual_alerts")}),index.jsx(index.Typography,{variant:"caption",color:"textSecondary",children:t("audio_alerts.visual_description")})]}),index.jsx(index.Switch,{checked:audioAlerts.visualAlerts,onChange:__name(checked=>onAudioAlertsChange("visualAlerts",checked),"onChange")})]}),index.jsxs(index.Box,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:2},children:[index.jsxs(index.Box,{sx:{flex:1},children:[index.jsx(index.Typography,{variant:"body2",fontWeight:500,children:t("audio_alerts.vibration")}),index.jsx(index.Typography,{variant:"caption",color:"textSecondary",children:t("audio_alerts.haptic_feedback_devices")})]}),index.jsx(index.Switch,{checked:audioAlerts.vibration,onChange:__name(checked=>onAudioAlertsChange("vibration",checked),"onChange")})]})]})}),!compact&&index.jsxs(index.Box,{mt:2,p:2,children:[index.jsx(index.Typography,{variant:"caption",fontWeight:500,mb:1.5,color:"textSecondary",sx:{fontSize:"0.75rem"},children:t("audio_alerts.preview_guidelines")}),index.jsxs(index.Box,{mb:3,children:[index.jsxs(index.Typography,{variant:"body2",fontWeight:500,mb:1.5,children:[t("common.sound_effects")," Demonstration"]}),index.jsxs(index.Box,{sx:{p:2,backgroundColor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:1},children:[index.jsxs(index.Box,{sx:{display:"flex",gap:2,flexWrap:"wrap",alignItems:"center",mb:2},children:[index.jsxs(index.Button,{variant:"contained",size:"small",disabled:!audioAlerts.soundEnabled,onClick:__name(()=>{if(audioAlerts.soundEnabled)try{const audio=new Audio("data:audio/wav;base64,UklGRnoGAABXQVZFZm10IBAAAAABAAEAQB8AAEAfAAABAAgAZGF0YQoGAACBhYqFbF1fdJivrJBhNjVgodDbq2EcBj+a2/LDciUFLIHO8tiJNwgZaLvt559NEAxQp+PwtmMcBjiR1/LMeSwFJHfH8N2QQAoUXrTp66hVFApGn+DyvmwhCzON2vHGdCAFoH3M8duPQwsaZbfm7qZSEQxTqePusW0gCCmG1O7AfR0Gk4DN9dyOQQkZY7Tm8qZRFAuCgNH14HshDTyQ2PS2dBkFjnXG8dyRQAkVXLzh+6BVFguBgNH06XshCzSD1vLHeSIFI3/L8dyRQQoQYrjl9aBWFQwuTsrX67lwJgUuQjvW87xtLgO5h8zzz54kBSxy1+Hyz3siBD1cw+vyz3wjBDxr0/TwzX4jBT1v1/ffyn4kBzxl2PXrynsjBUJq2vPucCEEp3fG8N2RPgoUXbTj7axUFAxQpuPwtmMcBjiS1/LNeiwFJHfH8N2QQAUZYrXh6qNQFglOquHysW0dBlGt4u2uWBUIhn/M8t2PQQcRZL/h7aBYFwpQqeDytmMeCjuS1/LNeiwFJ3/L8t2PQQoQYrjl9aBWFQwuT8rX67lwJgUuQjvW87xtLgO5h8zzz54kBSxy1+Hyz3siBD1cw+vyz3wjBDxr0/TwzX4jBT1v1/ffyn4kBzxl2PXrynsjBUJq2vPucCEEp3fG8N2RPgoUXbTj7axUFAxQpuPwtmMcBjiS1/LNeiwFJHfH8N2QQAoQYrjl9aBWFQwu");audio.volume=audioAlerts.volume,audio.play().catch(()=>{})}catch{}},"onClick"),sx:{opacity:audioAlerts.soundEnabled?1:.5},children:["🔊 ",t("audio_alerts.test_sound")]}),index.jsx(index.Typography,{variant:"body2",color:"textSecondary",children:audioAlerts.soundEnabled?t("audio_alerts.volume_display",{volume:Math.round(audioAlerts.volume*100)}):t("audio_alerts.sound_effects_disabled_label")})]}),audioAlerts.soundEnabled&&index.jsxs(index.Box,{sx:{display:"flex",alignItems:"center",gap:1,mb:2},children:[index.jsxs(index.Typography,{variant:"caption",sx:{minWidth:60},children:[t("audio_alerts.volume"),":"]}),index.jsx(index.Box,{sx:{flex:1,display:"flex",alignItems:"center",gap:.5},children:[...Array(10)].map((_,i)=>index.jsx(index.Box,{sx:{width:4,height:(i+1)*2+8,backgroundColor:i<audioAlerts.volume*10?"success.main":"action.disabled",borderRadius:.5}},i))}),index.jsxs(index.Typography,{variant:"caption",sx:{minWidth:40},children:[Math.round(audioAlerts.volume*100),"%"]})]}),index.jsx(index.Typography,{variant:"body2",color:"textSecondary",children:t("audio_alerts.sound_effects_description")})]})]}),index.jsxs(index.Box,{mb:3,children:[index.jsx(index.Typography,{variant:"body2",fontWeight:500,mb:1.5,children:t("audio_alerts.visual_demo")}),index.jsxs(index.Box,{sx:{p:2,backgroundColor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:1},children:[index.jsx(index.Typography,{variant:"body2",mb:2,children:t("audio_alerts.visual_alerts_complement")}),index.jsxs(material.Stack,{spacing:2,children:[index.jsxs(index.Box,{sx:{p:1.5,backgroundColor:"success.light",border:audioAlerts.visualAlerts?"2px solid":"1px solid",borderColor:audioAlerts.visualAlerts?"success.main":"success.light",borderRadius:1,display:"flex",alignItems:"center",gap:1,opacity:audioAlerts.visualAlerts?1:.7},children:[index.jsx(index.Box,{sx:{width:8,height:8,borderRadius:"50%",backgroundColor:"success.main",...audioAlerts.visualAlerts&&{animation:"pulse 1s infinite","@keyframes pulse":{"0%":{transform:"scale(1)",opacity:1},"50%":{transform:"scale(1.2)",opacity:.7},"100%":{transform:"scale(1)",opacity:1}}}}}),index.jsxs(index.Typography,{variant:"body2",children:["✅ ",t("audio_alerts.success_message")]})]}),index.jsxs(index.Box,{sx:{p:1.5,backgroundColor:"warning.light",border:audioAlerts.visualAlerts?"2px solid":"1px solid",borderColor:audioAlerts.visualAlerts?"warning.main":"warning.light",borderRadius:1,display:"flex",alignItems:"center",gap:1,opacity:audioAlerts.visualAlerts?1:.7},children:[index.jsx(index.Box,{sx:{width:8,height:8,borderRadius:"50%",backgroundColor:"warning.main",...audioAlerts.visualAlerts&&{animation:"pulse 1s infinite 0.3s"}}}),index.jsxs(index.Typography,{variant:"body2",children:["⚠️ ",t("audio_alerts.warning_message")]})]}),index.jsxs(index.Box,{sx:{p:1.5,backgroundColor:"error.light",border:audioAlerts.visualAlerts?"2px solid":"1px solid",borderColor:audioAlerts.visualAlerts?"error.main":"error.light",borderRadius:1,display:"flex",alignItems:"center",gap:1,opacity:audioAlerts.visualAlerts?1:.7},children:[index.jsx(index.Box,{sx:{width:8,height:8,borderRadius:"50%",backgroundColor:"error.main",...audioAlerts.visualAlerts&&{animation:"pulse 1s infinite 0.6s"}}}),index.jsxs(index.Typography,{variant:"body2",children:["❌ ",t("audio_alerts.error_message")]})]})]}),index.jsx(index.Typography,{variant:"caption",color:"textSecondary",sx:{mt:2,display:"block"},children:audioAlerts.visualAlerts?"Visual alerts are enhanced with pulsing animations and stronger borders":t("audio_alerts.visual_alerts_subtle")})]})]}),audioAlerts.vibration&&index.jsxs(index.Box,{mb:3,children:[index.jsx(index.Typography,{variant:"body2",fontWeight:500,mb:1.5,children:t("audio_alerts.haptic_feedback_mobile")}),index.jsxs(index.Box,{sx:{p:2,backgroundColor:"background.paper",border:"1px solid",borderColor:"divider",borderRadius:1},children:[index.jsxs(index.Button,{variant:"outlined",size:"small",onClick:__name(()=>{"vibrate"in navigator&&navigator.vibrate(200)},"onClick"),sx:{mb:2},children:["📳 ",t("audio_alerts.test_vibration")]}),index.jsx(index.Typography,{variant:"body2",color:"textSecondary",children:t("audio_alerts.haptic_feedback_info")})]})]}),index.jsxs(index.Box,{mb:2,children:[index.jsx(index.Typography,{variant:"body2",fontWeight:500,mb:1.5,children:t("common.audio_alert_guidelines")}),index.jsxs(index.Box,{sx:{pl:1},children:[!audioAlerts.soundEnabled&&!audioAlerts.visualAlerts&&!audioAlerts.vibration&&index.jsx(index.Alert,{severity:"warning",sx:{mb:1},children:index.jsx(index.Typography,{variant:"body2",children:t("audio_alerts.no_methods_warning")})}),audioAlerts.visualAlerts&&index.jsx(index.Alert,{severity:"success",sx:{mb:1},children:index.jsx(index.Typography,{variant:"body2",children:t("audio_alerts.visual_alerts_active")})}),audioAlerts.vibration&&index.jsx(index.Alert,{severity:"success",sx:{mb:1},children:index.jsx(index.Typography,{variant:"body2",children:t("audio_alerts.haptic_feedback_active")})}),audioAlerts.soundEnabled&&audioAlerts.volume<.3&&index.jsx(index.Alert,{severity:"info",sx:{mb:1},children:index.jsx(index.Typography,{variant:"body2",children:t("audio_alerts.low_volume_label",{percent:Math.round(audioAlerts.volume*100)})})}),index.jsxs(index.Typography,{variant:"caption",color:"textSecondary",children:[index.jsx("strong",{children:"Audio & Alert Guidelines:"}),index.jsx("br",{}),"• ",t("audio_alerts.multiple_methods_guideline"),index.jsx("br",{}),"• ",t("audio_alerts.user_control_guideline"),index.jsx("br",{}),"• ",t("audio_alerts.visual_alerts_guideline"),index.jsx("br",{}),"• ",t("audio_alerts.haptic_feedback_guideline"),index.jsx("br",{}),"• ",t("audio_alerts.sound_effects_guideline")]})]})]}),index.jsxs(index.Typography,{variant:"caption",color:"textSecondary",sx:{display:"block"},children:[index.jsxs("strong",{children:[t("common.current_settings"),":"]})," ",t("common.sound"),": ",audioAlerts.soundEnabled?t("common.on"):t("common.off"),audioAlerts.soundEnabled&&` (${Math.round(audioAlerts.volume*100)}%)`," •",t("common.visual_alerts"),": ",audioAlerts.visualAlerts?t("common.on"):t("common.off")," •",t("common.vibration"),": ",audioAlerts.vibration?t("common.on"):t("common.off")," •",index.jsxs("strong",{children:[t("common.accessibility"),":"]})," ",audioAlerts.soundEnabled||audioAlerts.visualAlerts||audioAlerts.vibration?audioAlerts.visualAlerts&&(audioAlerts.soundEnabled||audioAlerts.vibration)?t("common.excellent"):t("common.good"):t("audio_alerts.needs_improvement")]})]})]})},"AudioAlerts");exports.AudioAlerts=AudioAlerts;exports.default=AudioAlerts;