rechtspilot-ui 1.3.1 → 1.4.1
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/chunks-native.cjs +1 -1
- package/dist/chunks-native.js +388 -387
- package/dist/chunks.cjs +1 -1
- package/dist/chunks.js +8 -4
- package/dist/icons.native.cjs +1 -1
- package/dist/icons.native.es.js +1 -1
- package/dist/index.cjs +86 -86
- package/dist/index.d.ts +8 -4
- package/dist/index.es.js +1048 -1048
- package/dist/index.native.cjs +1 -1
- package/dist/index.native.es.js +464 -134
- package/dist/native/components/IconButton/IconButton.native.d.ts +8 -0
- package/dist/native/components/Input/Input.native.d.ts +3 -3
- package/dist/native/components/Select/Select.native.d.ts +13 -0
- package/dist/native/components/Sheet/Sheet.native.d.ts +10 -0
- package/dist/native/components/Spinner/Spinner.native.d.ts +7 -7
- package/dist/native/components/Text/Text.native.d.ts +9 -0
- package/dist/native/index.native.d.ts +10 -0
- package/dist/native/lib/theme.d.ts +8 -4
- package/dist/native/lib/ui/command.d.ts +1 -1
- package/package.json +14 -10
package/dist/index.native.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunks-native.cjs`);let t=require(`react`);t=e.Y(t,1);let n=require(`react-native`),r=require(`react/jsx-runtime`);var i=({size:i=20,color:a=e.q.primary[600],style:o})=>{let s=t.default.useRef(new n.Animated.Value(0)).current;t.default.useEffect(()=>{let e=()=>{s.setValue(0),n.Animated.timing(s,{toValue:1,duration:1e3,easing:n.Easing.linear,useNativeDriver:!0}).start(()=>e())};e()},[s]);let c=s.interpolate({inputRange:[0,1],outputRange:[`0deg`,`360deg`]});return(0,r.jsx)(n.View,{style:[{width:i,height:i},o],children:(0,r.jsx)(n.Animated.View,{style:{width:i,height:i,borderRadius:i/2,borderWidth:2,borderColor:`transparent`,borderTopColor:a,transform:[{rotate:c}]}})})},a=t=>{let n={alignItems:`center`,borderRadius:12,borderWidth:1,flexDirection:`row`,height:48,justifyContent:`center`,paddingHorizontal:16},r={fontSize:15,fontWeight:`500`,textAlign:`center`};switch(t){case`primary`:return{container:{...n,backgroundColor:e.q.primary[500],borderColor:e.q.neutral[`800-A16`]},text:{...r,color:e.q.primary[900]}};case`secondary`:return{container:{...n,backgroundColor:e.q.primary[900],borderColor:e.q.neutral[`800-A16`]},text:{...r,color:e.q.white}};case`tertiary`:return{container:{...n,backgroundColor:e.q.neutral[`800-A04`],borderColor:e.q.neutral[`800-A08`]},text:{...r,color:e.q.primary[900]}};case`destructive`:return{container:{...n,backgroundColor:e.q.fg.accent.error,borderColor:e.q.fg.accent.error},text:{...r,color:e.q.white}};case`destructiveSubtle`:return{container:{...n,backgroundColor:e.q.cream,borderColor:e.q.palePeach},text:{...r,color:e.q.fg.accent.error}}}};function o({variant:t=`primary`,fullWidth:o=!1,children:s,loading:c=!1,disabled:l=!1,onPress:u,...d}){let f=a(t);return(0,r.jsxs)(n.TouchableOpacity,{style:n.StyleSheet.flatten([f.container,o&&{width:`100%`},(l||c)&&{opacity:.4}]),onPress:u,disabled:l||c,activeOpacity:.7,...d,children:[typeof s==`string`?(0,r.jsx)(n.Text,{style:f.text,children:s}):s,c&&(0,r.jsx)(i,{size:16,color:t===`secondary`?e.q.primary[600]:t===`destructiveSubtle`?e.q.fg.accent.error:e.q.white})]})}var s=n.StyleSheet.create({container:{marginBottom:8},fieldContainer:{height:49,paddingHorizontal:12,borderRadius:12,flexDirection:`row`,alignItems:`center`,backgroundColor:e.q.bg.secondary,borderWidth:2,borderColor:e.q.bg.tertiary},fieldContainerError:{borderColor:e.q.fg.accent.error},fieldContainerFocused:{borderColor:e.q.fg.base},fieldContainerFocusedError:{borderColor:e.q.fg.accent.error},formGroup:{position:`relative`,paddingVertical:14,width:`100%`,height:`100%`,justifyContent:`center`},input:{width:`100%`,paddingTop:4,backgroundColor:`transparent`,fontSize:15,fontWeight:`500`,color:e.q.primary[900],paddingBottom:0},label:{position:`absolute`,left:0,fontSize:15,fontWeight:`500`,color:e.q.fg.tertiary},labelFloating:{top:2,fontSize:12,color:e.q.fg.secondary},labelNormal:{top:`50%`,transform:[{translateY:-7.5}]},helper:{marginTop:4,fontSize:12,paddingHorizontal:4},helperError:{color:e.q.fg.accent.error},helperNormal:{color:e.q.fg.secondary}});function c({label:i,value:a=``,onChange:o,error:c,helperText:l,placeholder:u,secureTextEntry:d=!1,keyboardType:f=`default`,autoCapitalize:p=`sentences`,editable:m=!0,multiline:h=!1,numberOfLines:g=1,..._}){let[v,y]=(0,t.useState)(!1),b=a.length>0,x=v||b,S=[s.fieldContainer,c&&s.fieldContainerError,v&&!c&&s.fieldContainerFocused,v&&c&&s.fieldContainerFocusedError],C=[s.label,x?s.labelFloating:s.labelNormal],w=n.StyleSheet.flatten([s.input,h&&{height:g*20,textAlignVertical:`top`}]);return(0,r.jsxs)(n.View,{style:s.container,children:[(0,r.jsx)(n.View,{style:S,children:(0,r.jsxs)(n.View,{style:s.formGroup,children:[(0,r.jsx)(n.TextInput,{style:w,value:a,onChangeText:o,onFocus:()=>y(!0),onBlur:()=>y(!1),placeholder:x?u:``,placeholderTextColor:e.q.fg.tertiary,secureTextEntry:d,keyboardType:f,autoCapitalize:p,editable:m,multiline:h,numberOfLines:g,..._}),(0,r.jsx)(n.Text,{style:C,children:i})]})}),(c||l)&&(0,r.jsx)(n.Text,{style:[s.helper,c?s.helperError:s.helperNormal],children:c||l})]})}var l=()=>{let[e,n]=(0,t.useState)(window.innerWidth<=768),r=(0,t.useRef)(window.innerWidth);return(0,t.useEffect)(()=>{let e=()=>{let e=window.innerWidth;e<=768&&r.current>768?n(!0):e>768&&r.current<=768&&n(!1),r.current=e};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e},u=1,d=1e6,f=0;function p(){return f=(f+1)%(2**53-1),f.toString()}var m=new Map,h=e=>{if(m.has(e))return;let t=setTimeout(()=>{m.delete(e),y({type:`REMOVE_TOAST`,toastId:e})},d);m.set(e,t)},g=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,u)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?h(n):e.toasts.forEach(e=>{h(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},_=[],v={toasts:[]};function y(e){v=g(v,e),_.forEach(e=>{e(v)})}function b({...e}){let t=p(),n=e=>y({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>y({type:`DISMISS_TOAST`,toastId:t});return y({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function x(){let[e,n]=t.useState(v);return t.useEffect(()=>(_.push(n),()=>{let e=_.indexOf(n);e>-1&&_.splice(e,1)}),[e]),{...e,toast:b,dismiss:e=>y({type:`DISMISS_TOAST`,toastId:e})}}exports.Button=o,exports.Input=c,exports.Spinner=i,exports.colors=e.q,Object.defineProperty(exports,`icons`,{enumerable:!0,get:function(){return e.t}}),exports.typography=e.J,exports.useIsMobile=l,exports.useToast=x;
|
|
1
|
+
Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunks-native.cjs`);let t=require(`react`);t=e.Y(t,1);let n=require(`react-native`),r=require(`react-native-svg`),i=require(`react/jsx-runtime`),a=require(`react-native-safe-area-context`);function o({size:a=24,color:o=e.q.fg.primary,trackColor:s=e.q.neutral[`800-A08`],style:c}){let l=(0,t.useRef)(new n.Animated.Value(0)).current;(0,t.useEffect)(()=>{let e=n.Animated.loop(n.Animated.timing(l,{toValue:1,duration:1e3,easing:n.Easing.linear,useNativeDriver:!0}));return e.start(),()=>e.stop()},[l]);let u=l.interpolate({inputRange:[0,1],outputRange:[`0deg`,`360deg`]});return(0,i.jsx)(n.Animated.View,{style:[{width:a,height:a,transform:[{rotate:u}]},c],children:(0,i.jsxs)(r.Svg,{width:a,height:a,viewBox:`0 0 24 24`,fill:`none`,children:[(0,i.jsx)(r.Circle,{cx:`12`,cy:`12`,r:`8`,stroke:s,strokeWidth:3,fill:`none`}),(0,i.jsx)(r.Path,{d:`M12 4C16.4183 4 20 7.58172 20 12C20 14.1304 19.1672 16.0663 17.8095 17.5`,stroke:o,strokeWidth:3,strokeLinecap:`round`,fill:`none`})]})})}var s=t=>{let n={alignItems:`center`,borderRadius:12,borderWidth:1,flexDirection:`row`,height:48,justifyContent:`center`,paddingHorizontal:16},r={fontFamily:e.J.body.fontFamily,fontSize:15,fontWeight:`500`,textAlign:`center`};switch(t){case`primary`:return{container:{...n,backgroundColor:e.q.primary[500],borderColor:e.q.neutral[`800-A16`]},text:{...r,color:e.q.primary[900]}};case`secondary`:return{container:{...n,backgroundColor:e.q.primary[900],borderColor:e.q.neutral[`800-A16`]},text:{...r,color:e.q.white}};case`tertiary`:return{container:{...n,backgroundColor:e.q.neutral[`800-A04`],borderColor:e.q.neutral[`800-A08`]},text:{...r,color:e.q.primary[900]}};case`destructive`:return{container:{...n,backgroundColor:e.q.fg.accent.error,borderColor:e.q.fg.accent.error},text:{...r,color:e.q.white}};case`destructiveSubtle`:return{container:{...n,backgroundColor:e.q.cream,borderColor:e.q.palePeach},text:{...r,color:e.q.fg.accent.error}}}};function c({variant:t=`primary`,fullWidth:r=!1,children:a,loading:c=!1,disabled:l=!1,onPress:u,...d}){let f=s(t);return(0,i.jsxs)(n.TouchableOpacity,{style:n.StyleSheet.flatten([f.container,r&&{width:`100%`},(l||c)&&{opacity:.4}]),onPress:u,disabled:l||c,activeOpacity:.7,...d,children:[typeof a==`string`?(0,i.jsx)(n.Text,{style:f.text,children:a}):a,c&&(0,i.jsx)(o,{size:16,color:t===`secondary`?e.q.primary[600]:t===`destructiveSubtle`?e.q.fg.accent.error:e.q.white})]})}var l={sm:32,md:40,lg:48},u={base:{backgroundColor:e.q.sf.base},primary:{backgroundColor:e.q.primary[`600-A08`]},outline:{borderWidth:1,borderColor:e.q.sf.base}},d={base:{backgroundColor:e.q.neutral[`800-A08`]},primary:{backgroundColor:e.q.primary[50]},outline:{backgroundColor:e.q.sf.tertiaryHover}};function f({children:e,size:t=`md`,variant:r=`base`,disabled:a=!1,hitSlop:o=10,...s}){let c=l[t],f={width:c,height:c,borderRadius:c/2,alignItems:`center`,justifyContent:`center`};return(0,i.jsx)(n.Pressable,{accessibilityRole:`button`,...s,style:({pressed:e})=>[f,u[r],e&&d[r],a&&{opacity:.4}],disabled:a,hitSlop:o,children:e})}var p=n.StyleSheet.create({container:{marginBottom:8},fieldContainer:{height:49,paddingHorizontal:12,borderRadius:12,flexDirection:`row`,alignItems:`center`,backgroundColor:e.q.bg.secondary,borderWidth:2,borderColor:e.q.bg.tertiary},fieldContainerError:{borderColor:e.q.fg.accent.error},fieldContainerFocused:{borderColor:e.q.fg.base},fieldContainerFocusedError:{borderColor:e.q.fg.accent.error},formGroup:{position:`relative`,paddingVertical:14,width:`100%`,height:`100%`,justifyContent:`center`},input:{width:`100%`,paddingTop:4,backgroundColor:`transparent`,fontFamily:e.J.body.fontFamily,fontSize:15,fontWeight:`500`,color:e.q.primary[900],paddingBottom:0},label:{position:`absolute`,left:0,fontFamily:e.J.body.fontFamily,fontSize:15,fontWeight:`500`,color:e.q.fg.tertiary},currencyPrefix:{fontFamily:e.J.body.fontFamily,fontSize:15,fontWeight:`400`,color:e.q.fg.secondary,marginRight:4,alignSelf:`center`},labelFloating:{top:2,fontSize:12,color:e.q.fg.secondary},labelNormal:{top:`50%`,transform:[{translateY:-7.5}]},helper:{marginTop:4,fontSize:12,paddingHorizontal:4},helperError:{color:e.q.fg.accent.error},helperNormal:{color:e.q.fg.secondary}});function m({label:r,value:a=``,onChange:o,error:s,helperText:c,placeholder:l,secureTextEntry:u=!1,keyboardType:d,autoCapitalize:f=`sentences`,editable:m=!0,multiline:h=!1,numberOfLines:g=1,currency:_=!1,...v}){let[y,b]=(0,t.useState)(!1),x=a.length>0,S=y||x||_,C=[p.fieldContainer,s&&p.fieldContainerError,y&&!s&&p.fieldContainerFocused,y&&s&&p.fieldContainerFocusedError],w=[p.label,S?p.labelFloating:p.labelNormal],T=n.StyleSheet.flatten([p.input,h&&{height:g*20,textAlignVertical:`top`}]);return(0,i.jsxs)(n.View,{style:p.container,children:[(0,i.jsxs)(n.View,{style:C,children:[_&&(0,i.jsx)(n.Text,{style:p.currencyPrefix,children:`€`}),(0,i.jsxs)(n.View,{style:p.formGroup,children:[(0,i.jsx)(n.TextInput,{style:T,value:a,onChangeText:o,onFocus:()=>b(!0),onBlur:()=>b(!1),placeholder:S?l:``,placeholderTextColor:e.q.fg.tertiary,secureTextEntry:u,keyboardType:d??(_?`numeric`:`default`),autoCapitalize:f,editable:m,multiline:h,numberOfLines:g,...v}),(0,i.jsx)(n.Text,{style:w,children:r})]})]}),(s||c)&&(0,i.jsx)(n.Text,{style:[p.helper,s?p.helperError:p.helperNormal],children:s||c})]})}function h({label:r,value:a,onChange:o,options:s,error:c,disabled:l=!1}){let[u,d]=(0,t.useState)(!1);(0,t.useEffect)(()=>{s.length===1&&!a&&o(s[0].value)},[s,a]);let f=s.find(e=>e.value===a),p=c?e.q.fg.accent.error:u?e.q.fg.base:e.q.bg.tertiary;return(0,i.jsxs)(i.Fragment,{children:[(0,i.jsxs)(n.View,{style:g.container,children:[(0,i.jsxs)(n.Pressable,{style:[g.trigger,{borderColor:p},l&&g.triggerDisabled],onPress:()=>d(!0),disabled:l,accessibilityRole:`combobox`,accessibilityLabel:r,accessibilityState:{expanded:u,disabled:l},children:[(0,i.jsxs)(n.View,{style:g.triggerContent,children:[(0,i.jsx)(n.Text,{style:[g.labelText,f&&g.labelFloating],children:r}),f&&(0,i.jsx)(n.Text,{style:g.valueText,numberOfLines:1,children:f.text})]}),(0,i.jsx)(e.K,{direction:`down`,color:e.q.fg.secondary,size:`small`})]}),c&&(0,i.jsx)(n.Text,{style:g.errorText,children:c})]}),(0,i.jsx)(n.Modal,{visible:u,transparent:!0,animationType:`fade`,onRequestClose:()=>d(!1),children:(0,i.jsx)(n.Pressable,{style:g.backdrop,onPress:()=>d(!1),children:(0,i.jsxs)(n.View,{style:g.sheet,children:[(0,i.jsx)(n.View,{style:g.sheetHandle}),(0,i.jsx)(n.ScrollView,{bounces:!1,children:s.map(e=>{let t=e.value===a;return(0,i.jsx)(n.Pressable,{style:[g.option,t&&g.optionActive],onPress:()=>{o(e.value),d(!1)},accessibilityRole:`menuitem`,accessibilityState:{selected:t},children:(0,i.jsx)(n.Text,{style:[g.optionText,t&&g.optionTextActive],children:e.text})},e.value)})})]})})})]})}var g=n.StyleSheet.create({container:{marginBottom:8},trigger:{height:50,paddingHorizontal:12,borderRadius:12,flexDirection:`row`,alignItems:`center`,backgroundColor:e.q.bg.secondary,borderWidth:2},triggerDisabled:{opacity:.4},triggerContent:{flex:1,justifyContent:`center`},labelText:{fontFamily:e.J.body.fontFamily,fontSize:15,color:e.q.fg.tertiary},labelFloating:{fontSize:12,color:e.q.fg.secondary,marginBottom:2},valueText:{fontFamily:e.J.body.fontFamily,fontSize:15,fontWeight:`500`,color:e.q.primary[900]},errorText:{marginTop:4,fontSize:12,paddingHorizontal:4,color:e.q.fg.accent.error,fontFamily:e.J.body.fontFamily},backdrop:{flex:1,backgroundColor:`rgba(0,0,0,0.4)`,justifyContent:`flex-end`},sheet:{backgroundColor:e.q.bg.base,borderTopLeftRadius:16,borderTopRightRadius:16,paddingBottom:32,maxHeight:`70%`},sheetHandle:{width:36,height:4,borderRadius:2,backgroundColor:e.q.border.default,alignSelf:`center`,marginTop:8,marginBottom:8},option:{paddingVertical:16,paddingHorizontal:20,borderBottomWidth:1,borderBottomColor:e.q.border.default},optionActive:{backgroundColor:e.q.primary[50]},optionText:{fontFamily:e.J.body.fontFamily,fontSize:15,color:e.q.fg.base},optionTextActive:{color:e.q.primary[900],fontWeight:`500`}}),_={heading:20,title:16,label:13,body:15,caption:12};function v({variant:t=`body`,color:r,style:a,...o}){return(0,i.jsx)(n.Text,{style:[e.J[t],{fontSize:_[t]},r?{color:r}:void 0,a],...o})}function y({open:t,onClose:r,onGoBack:o,title:s,children:c,footer:l}){let u=(0,a.useSafeAreaInsets)();return(0,i.jsx)(n.Modal,{visible:t,animationType:`slide`,presentationStyle:`pageSheet`,onRequestClose:r,children:(0,i.jsx)(n.KeyboardAvoidingView,{style:b.flex,behavior:n.Platform.OS===`ios`?`padding`:void 0,children:(0,i.jsxs)(n.View,{style:[b.container,{paddingTop:Math.max(u.top,16)}],children:[(0,i.jsxs)(n.View,{style:b.header,children:[(0,i.jsx)(n.View,{style:b.headerSide,children:o&&(0,i.jsx)(f,{variant:`base`,size:`md`,accessibilityLabel:`Go back`,onPress:o,children:(0,i.jsx)(e.K,{color:e.q.fg.secondary,direction:`left`})})}),s?(0,i.jsx)(v,{variant:`heading`,style:b.headerTitle,children:s}):(0,i.jsx)(n.View,{style:b.flex}),(0,i.jsx)(n.View,{style:[b.headerSide,b.headerSideRight],children:(0,i.jsx)(f,{variant:`base`,size:`md`,accessibilityLabel:`Close`,onPress:r,children:(0,i.jsx)(e.G,{color:e.q.fg.secondary,size:`small`})})})]}),(0,i.jsx)(n.ScrollView,{style:b.flex,contentContainerStyle:b.body,children:c}),l&&(0,i.jsx)(n.View,{style:b.footer,children:l})]})})})}var b=n.StyleSheet.create({flex:{flex:1},container:{flex:1,backgroundColor:e.q.bg.base},header:{flexDirection:`row`,alignItems:`center`,paddingHorizontal:8,paddingBottom:8,minHeight:52},headerSide:{flex:1},headerSideRight:{alignItems:`flex-end`},headerTitle:{flex:2,textAlign:`center`},body:{paddingHorizontal:20,paddingBottom:20},footer:{paddingHorizontal:20,paddingVertical:24,borderTopWidth:1,borderTopColor:e.q.border.default}}),x=()=>{let[e,n]=(0,t.useState)(window.innerWidth<=768),r=(0,t.useRef)(window.innerWidth);return(0,t.useEffect)(()=>{let e=()=>{let e=window.innerWidth;e<=768&&r.current>768?n(!0):e>768&&r.current<=768&&n(!1),r.current=e};return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]),e},S=1,C=1e6,w=0;function T(){return w=(w+1)%(2**53-1),w.toString()}var E=new Map,D=e=>{if(E.has(e))return;let t=setTimeout(()=>{E.delete(e),j({type:`REMOVE_TOAST`,toastId:e})},C);E.set(e,t)},O=(e,t)=>{switch(t.type){case`ADD_TOAST`:return{...e,toasts:[t.toast,...e.toasts].slice(0,S)};case`UPDATE_TOAST`:return{...e,toasts:e.toasts.map(e=>e.id===t.toast.id?{...e,...t.toast}:e)};case`DISMISS_TOAST`:{let{toastId:n}=t;return n?D(n):e.toasts.forEach(e=>{D(e.id)}),{...e,toasts:e.toasts.map(e=>e.id===n||n===void 0?{...e,open:!1}:e)}}case`REMOVE_TOAST`:return t.toastId===void 0?{...e,toasts:[]}:{...e,toasts:e.toasts.filter(e=>e.id!==t.toastId)}}},k=[],A={toasts:[]};function j(e){A=O(A,e),k.forEach(e=>{e(A)})}function M({...e}){let t=T(),n=e=>j({type:`UPDATE_TOAST`,toast:{...e,id:t}}),r=()=>j({type:`DISMISS_TOAST`,toastId:t});return j({type:`ADD_TOAST`,toast:{...e,id:t,open:!0,onOpenChange:e=>{e||r()}}}),{id:t,dismiss:r,update:n}}function N(){let[e,n]=t.useState(A);return t.useEffect(()=>(k.push(n),()=>{let e=k.indexOf(n);e>-1&&k.splice(e,1)}),[e]),{...e,toast:M,dismiss:e=>j({type:`DISMISS_TOAST`,toastId:e})}}exports.Button=c,exports.IconButton=f,exports.Input=m,exports.Select=h,exports.Sheet=y,exports.Spinner=o,exports.Text=v,exports.colors=e.q,Object.defineProperty(exports,`icons`,{enumerable:!0,get:function(){return e.t}}),exports.typography=e.J,exports.useIsMobile=x,exports.useToast=N;
|