rechtspilot-ui 1.2.1 → 1.2.2

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.
@@ -1,4 +1,4 @@
1
- Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunks-native.cjs`);let t=require(`react`);t=e.z(t,1);let n=require(`react-native`),r=require(`react/jsx-runtime`),i=require(`styled-components`);var a=({size:i=20,color:a=e.L.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}]}})})},o=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.L.primary[500],borderColor:e.L.neutral[`800-A16`]},text:{...r,color:e.L.primary[900]}};case`secondary`:return{container:{...n,backgroundColor:e.L.primary[900],borderColor:e.L.neutral[`800-A16`]},text:{...r,color:e.L.white}};case`tertiary`:return{container:{...n,backgroundColor:e.L.neutral[`800-A04`],borderColor:e.L.neutral[`800-A08`]},text:{...r,color:e.L.primary[900]}};case`destructive`:return{container:{...n,backgroundColor:e.L.cream,borderColor:e.L.palePeach},text:{...r,color:e.L.fg.accent.error}}}};function s({variant:t=`primary`,fullWidth:i=!1,children:s,loading:c=!1,disabled:l=!1,onPress:u,...d}){let f=o(t);return(0,r.jsxs)(n.TouchableOpacity,{style:n.StyleSheet.flatten([f.container,i&&{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)(a,{size:16,color:t===`secondary`?e.L.primary[600]:e.L.white})]})}var c=n.StyleSheet.create({container:{marginBottom:8},fieldContainer:{height:49,paddingHorizontal:12,borderRadius:12,flexDirection:`row`,alignItems:`center`,backgroundColor:e.L.bg.secondary,borderWidth:2,borderColor:e.L.bg.tertiary},fieldContainerError:{borderColor:e.L.fg.accent.error},fieldContainerFocused:{borderColor:e.L.fg.base},fieldContainerFocusedError:{borderColor:e.L.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.L.primary[900],paddingBottom:0},label:{position:`absolute`,left:0,fontSize:15,fontWeight:`500`,color:e.L.fg.tertiary},labelFloating:{top:2,fontSize:12,color:e.L.fg.secondary},labelNormal:{top:`50%`,transform:[{translateY:-7.5}]},helper:{marginTop:4,fontSize:12,paddingHorizontal:4},helperError:{color:e.L.fg.accent.error},helperNormal:{color:e.L.fg.secondary}});function l({label:i,value:a=``,onChange:o,error:s,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=[c.fieldContainer,s&&c.fieldContainerError,v&&!s&&c.fieldContainerFocused,v&&s&&c.fieldContainerFocusedError],C=[c.label,x?c.labelFloating:c.labelNormal],w=n.StyleSheet.flatten([c.input,h&&{height:g*20,textAlignVertical:`top`}]);return(0,r.jsxs)(n.View,{style:c.container,children:[(0,r.jsx)(n.View,{style:S,children:(0,r.jsxs)(n.View,{style:c.formGroup,children:[(0,r.jsx)(n.TextInput,{style:w,value:a,onChangeText:o,onFocus:()=>y(!0),onBlur:()=>y(!1),placeholder:x?u:``,placeholderTextColor:e.L.fg.tertiary,secureTextEntry:d,keyboardType:f,autoCapitalize:p,editable:m,multiline:h,numberOfLines:g,..._}),(0,r.jsx)(n.Text,{style:C,children:i})]})}),(s||l)&&(0,r.jsx)(n.Text,{style:[c.helper,s?c.helperError:c.helperNormal],children:s||l})]})}var u=i.styled.div`
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});const e=require(`./chunks-native.cjs`);let t=require(`react`);t=e.z(t,1);let n=require(`react-native`),r=require(`react/jsx-runtime`),i=require(`styled-components`);var a=({size:i=20,color:a=e.L.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}]}})})},o=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.L.primary[500],borderColor:e.L.neutral[`800-A16`]},text:{...r,color:e.L.primary[900]}};case`secondary`:return{container:{...n,backgroundColor:e.L.primary[900],borderColor:e.L.neutral[`800-A16`]},text:{...r,color:e.L.white}};case`tertiary`:return{container:{...n,backgroundColor:e.L.neutral[`800-A04`],borderColor:e.L.neutral[`800-A08`]},text:{...r,color:e.L.primary[900]}};case`destructive`:return{container:{...n,backgroundColor:e.L.fg.accent.error,borderColor:e.L.fg.accent.error},text:{...r,color:e.L.white}};case`destructiveSubtle`:return{container:{...n,backgroundColor:e.L.cream,borderColor:e.L.palePeach},text:{...r,color:e.L.fg.accent.error}}}};function s({variant:t=`primary`,fullWidth:i=!1,children:s,loading:c=!1,disabled:l=!1,onPress:u,...d}){let f=o(t);return(0,r.jsxs)(n.TouchableOpacity,{style:n.StyleSheet.flatten([f.container,i&&{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)(a,{size:16,color:t===`secondary`?e.L.primary[600]:t===`destructiveSubtle`?e.L.fg.accent.error:e.L.white})]})}var c=n.StyleSheet.create({container:{marginBottom:8},fieldContainer:{height:49,paddingHorizontal:12,borderRadius:12,flexDirection:`row`,alignItems:`center`,backgroundColor:e.L.bg.secondary,borderWidth:2,borderColor:e.L.bg.tertiary},fieldContainerError:{borderColor:e.L.fg.accent.error},fieldContainerFocused:{borderColor:e.L.fg.base},fieldContainerFocusedError:{borderColor:e.L.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.L.primary[900],paddingBottom:0},label:{position:`absolute`,left:0,fontSize:15,fontWeight:`500`,color:e.L.fg.tertiary},labelFloating:{top:2,fontSize:12,color:e.L.fg.secondary},labelNormal:{top:`50%`,transform:[{translateY:-7.5}]},helper:{marginTop:4,fontSize:12,paddingHorizontal:4},helperError:{color:e.L.fg.accent.error},helperNormal:{color:e.L.fg.secondary}});function l({label:i,value:a=``,onChange:o,error:s,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=[c.fieldContainer,s&&c.fieldContainerError,v&&!s&&c.fieldContainerFocused,v&&s&&c.fieldContainerFocusedError],C=[c.label,x?c.labelFloating:c.labelNormal],w=n.StyleSheet.flatten([c.input,h&&{height:g*20,textAlignVertical:`top`}]);return(0,r.jsxs)(n.View,{style:c.container,children:[(0,r.jsx)(n.View,{style:S,children:(0,r.jsxs)(n.View,{style:c.formGroup,children:[(0,r.jsx)(n.TextInput,{style:w,value:a,onChangeText:o,onFocus:()=>y(!0),onBlur:()=>y(!1),placeholder:x?u:``,placeholderTextColor:e.L.fg.tertiary,secureTextEntry:d,keyboardType:f,autoCapitalize:p,editable:m,multiline:h,numberOfLines:g,..._}),(0,r.jsx)(n.Text,{style:C,children:i})]})}),(s||l)&&(0,r.jsx)(n.Text,{style:[c.helper,s?c.helperError:c.helperNormal],children:s||l})]})}var u=i.styled.div`
2
2
  margin: 0 auto;
3
3
  vertical-align: middle;
4
4
  position: relative;
@@ -86,6 +86,17 @@ var v = ({ size: t = 20, color: n = e.primary[600], style: r }) => {
86
86
  }
87
87
  };
88
88
  case "destructive": return {
89
+ container: {
90
+ ...n,
91
+ backgroundColor: e.fg.accent.error,
92
+ borderColor: e.fg.accent.error
93
+ },
94
+ text: {
95
+ ...r,
96
+ color: e.white
97
+ }
98
+ };
99
+ case "destructiveSubtle": return {
89
100
  container: {
90
101
  ...n,
91
102
  backgroundColor: e.cream,
@@ -115,7 +126,7 @@ function b({ variant: t = "primary", fullWidth: n = !1, children: r, loading: i
115
126
  children: r
116
127
  }) : r, i && /* @__PURE__ */ h(v, {
117
128
  size: 16,
118
- color: t === "secondary" ? e.primary[600] : e.white
129
+ color: t === "secondary" ? e.primary[600] : t === "destructiveSubtle" ? e.fg.accent.error : e.white
119
130
  })]
120
131
  });
121
132
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rechtspilot-ui",
3
- "version": "1.2.1",
3
+ "version": "1.2.2",
4
4
  "type": "module",
5
5
  "description": "Rechtspilot UI Library",
6
6
  "main": "dist/index.cjs",