ferns-ui 0.34.0 → 0.34.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/Common.d.ts CHANGED
@@ -314,6 +314,7 @@ export interface NavigatorProps {
314
314
  config?: any;
315
315
  }
316
316
  export type TooltipDirection = "top" | "bottom" | "left" | "right";
317
+ export type IndicatorDirection = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
317
318
  export interface PillProps {
318
319
  text: string;
319
320
  color: AllColors;
@@ -1 +1 @@
1
- {"version":3,"file":"Common.js","sourceRoot":"","sources":["../src/Common.ts"],"names":[],"mappings":"AAqrDA,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,CAAC;AAqBzB,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAe,EAAE,EAAE;IAClD,OAAO;QACL,EAAE,EAAE,CAAC;QACL,EAAE,EAAE,EAAE;QACN,EAAE,EAAE,EAAE;QACN,EAAE,EAAE,EAAE;QACN,EAAE,EAAE,EAAE;KACP,CAAC,IAAI,IAAI,IAAI,CAAC,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,IAAI,GAAG,EAAE,EAAY,EAAE;IACtD,IAAI,QAAkB,CAAC;IACvB,IAAI,IAAI,GAAG,CAAC,EAAE;QACZ,QAAQ,GAAG,IAAI,CAAC;KACjB;SAAM,IAAI,IAAI,GAAG,EAAE,EAAE;QACpB,QAAQ,GAAG,IAAI,CAAC;KACjB;SAAM,IAAI,IAAI,GAAG,EAAE,EAAE;QACpB,QAAQ,GAAG,IAAI,CAAC;KACjB;SAAM,IAAI,IAAI,GAAG,EAAE,EAAE;QACpB,QAAQ,GAAG,IAAI,CAAC;KACjB;SAAM;QACL,QAAQ,GAAG,IAAI,CAAC;KACjB;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,OAAgE;IAC9F,OAAO,CA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,GAAG,IAAI,CAAC;KACjB;SAAM;QACL,QAAQ,GAAG,IAAI,CAAC;KACjB;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC;AAEF,MAAM,UAAU,eAAe,CAAC,OAAgE;IAC9F,OAAO,CAAC;QACN,SAAS,EAAE,QAAQ;QACnB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,QAAQ;QAChB,KAAK,EAAE,KAAK;QACZ,cAAc,EAAE,KAAK;QACrB,OAAO,EAAE,MAAM;QACf,QAAQ,EAAE,MAAM;KACjB,CAAC,OAAO,CAAC,IAAI,MAAM,CAAU,CAAC;AACjC,CAAC;AAu5BD,MAAM,UAAU,UAAU,CAAC,OAAqB;IAC9C,OAAO,CACL,OAAO;QACP,OAAO,CAAC,KAAK;QACb,CAAC,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,CAAC,CAAC,CACrF,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { ButtonColor, Color, IconName, IconPrefix, IconSize, ThemeColor, TooltipDirection } from "./Common";
2
+ import { AllColors, ButtonColor, Color, IconName, IconPrefix, IconSize, IndicatorDirection, ThemeColor, TooltipDirection } from "./Common";
3
3
  export interface IconButtonProps {
4
4
  prefix?: IconPrefix;
5
5
  icon: IconName;
@@ -17,5 +17,10 @@ export interface IconButtonProps {
17
17
  text: string;
18
18
  idealDirection?: TooltipDirection;
19
19
  };
20
+ indicator?: boolean;
21
+ indicatorStyle?: {
22
+ position: IndicatorDirection;
23
+ color: AllColors;
24
+ };
20
25
  }
21
26
  export declare const IconButton: React.ForwardRefExoticComponent<IconButtonProps & React.RefAttributes<unknown>>;
@@ -1,5 +1,5 @@
1
1
  import React, { forwardRef, useState } from "react";
2
- import { Platform, Pressable } from "react-native";
2
+ import { Platform, Pressable, View } from "react-native";
3
3
  import { iconSizeToNumber, } from "./Common";
4
4
  import { Icon } from "./Icon";
5
5
  import { Modal } from "./Modal";
@@ -7,7 +7,7 @@ import { Text } from "./Text";
7
7
  import { Tooltip } from "./Tooltip";
8
8
  import { Unifier } from "./Unifier";
9
9
  // eslint-disable-next-line react/display-name
10
- export const IconButton = forwardRef(({ prefix, icon, iconColor, onClick, size, bgColor = "transparent", withConfirmation = false, confirmationText = "Are you sure you want to continue?", confirmationHeading = "Confirm", tooltip, }, ref) => {
10
+ export const IconButton = forwardRef(({ prefix, icon, iconColor, onClick, size, bgColor = "transparent", withConfirmation = false, confirmationText = "Are you sure you want to continue?", confirmationHeading = "Confirm", tooltip, indicator, indicatorStyle = { position: "bottomRight", color: "primary" }, }, ref) => {
11
11
  const [showConfirmation, setShowConfirmation] = useState(false);
12
12
  const opacity = 1;
13
13
  let color;
@@ -20,6 +20,13 @@ export const IconButton = forwardRef(({ prefix, icon, iconColor, onClick, size,
20
20
  else {
21
21
  color = Unifier.theme[bgColor];
22
22
  }
23
+ const IndicatorPosition = {
24
+ bottomRight: { bottom: "20%", right: "20%" },
25
+ bottomLeft: { bottom: "20%", left: "20%" },
26
+ topRight: { top: "20%", right: "20%" },
27
+ topLeft: { top: "20%", left: "20%" },
28
+ };
29
+ const indicatorPosition = Object.assign({ position: "absolute" }, IndicatorPosition[indicatorStyle.position]);
23
30
  const renderConfirmation = () => {
24
31
  return (React.createElement(Modal, { heading: confirmationHeading, primaryButtonOnClick: () => {
25
32
  onClick();
@@ -53,7 +60,9 @@ export const IconButton = forwardRef(({ prefix, icon, iconColor, onClick, size,
53
60
  onClick();
54
61
  }
55
62
  } },
56
- React.createElement(Icon, { color: iconColor, name: icon, prefix: prefix || "fas", size: size })),
63
+ React.createElement(Icon, { color: iconColor, name: icon, prefix: prefix || "fas", size: size }),
64
+ indicator && (React.createElement(View, { style: indicatorPosition },
65
+ React.createElement(Icon, { color: indicatorStyle.color, name: "circle", prefix: prefix || "fas", size: "sm" })))),
57
66
  Boolean(withConfirmation) && renderConfirmation()));
58
67
  }
59
68
  // Only add for web. This doesn't make much sense for mobile, since the action would be performed for the button
@@ -1 +1 @@
1
- {"version":3,"file":"IconButton.js","sourceRoot":"","sources":["../src/IconButton.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAC,UAAU,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAClD,OAAO,EAAC,QAAQ,EAAE,SAAS,EAAC,MAAM,cAAc,CAAC;AAEjD,OAAO,EAML,gBAAgB,GAGjB,MAAM,UAAU,CAAC;AAClB,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,KAAK,EAAC,MAAM,SAAS,CAAC;AAC9B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAC5B,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAClC,OAAO,EAAC,OAAO,EAAC,MAAM,WAAW,CAAC;AAqBlC,8CAA8C;AAC9C,MAAM,CAAC,MAAM,UAAU,GAAG,UAAU,CAClC,CACE,EACE,MAAM,EACN,IAAI,EACJ,SAAS,EACT,OAAO,EACP,IAAI,EACJ,OAAO,GAAG,aAAa,EACvB,gBAAgB,GAAG,KAAK,EACxB,gBAAgB,GAAG,oCAAoC,EACvD,mBAAmB,GAAG,SAAS,EAC/B,OAAO,GACS,EAClB,GAAG,EACH,EAAE;IACF,MAAM,CAAC,gBAAgB,EAAE,mBAAmB,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IAEhE,MAAM,OAAO,GAAG,CAAC,CAAC;IAClB,IAAI,KAAa,CAAC;IAClB,IAAI,OAAO,KAAK,qBAAqB,EAAE;QACrC,KAAK,GAAG,oBAAoB,CAAC;KAC9B;SAAM,IAAI,OAAO,KAAK,aAAa,IAAI,CAAC,OAAO,EAAE;QAChD,KAAK,GAAG,oBAAoB,CAAC;KAC9B;SAAM;QACL,KAAK,GAAG,OAAO,CAAC,KAAK,CA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KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,IAAI,KAAK,EAAE,IAAI,EAAE,IAAI,GAAI;gBAC1E,SAAS,IAAI,CACZ,oBAAC,IAAI,IAAC,KAAK,EAAE,iBAA8B;oBACzC,oBAAC,IAAI,IACH,KAAK,EAAE,cAAc,CAAC,KAAK,EAC3B,IAAI,EAAC,QAAQ,EACb,MAAM,EAAE,MAAM,IAAI,KAAK,EACvB,IAAI,EAAC,IAAI,GACT,CACG,CACR,CACS;YAEX,OAAO,CAAC,gBAAgB,CAAC,IAAI,kBAAkB,EAAE,CACjD,CACJ,CAAC;IACJ,CAAC;IAED,gHAAgH;IAChH,oCAAoC;IACpC,mEAAmE;IACnE,IAAI,OAAO,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,EAAE;QACpC,OAAO,CACL,oBAAC,OAAO,IAAC,cAAc,EAAE,OAAO,CAAC,cAAc,EAAE,IAAI,EAAE,OAAO,CAAC,IAAI,IAChE,gBAAgB,EAAE,CACX,CACX,CAAC;KACH;SAAM;QACL,OAAO,gBAAgB,EAAE,CAAC;KAC3B;AACH,CAAC,CACF,CAAC"}
package/dist/Switch.js CHANGED
@@ -3,7 +3,7 @@ import { Switch as NativeSwitch } from "react-native";
3
3
  import { WithLabel } from "./WithLabel";
4
4
  export class Switch extends React.Component {
5
5
  render() {
6
- return (React.createElement(WithLabel, Object.assign({ labelInline: true, labelJustifyContent: "between" }, this.props),
6
+ return (React.createElement(WithLabel, Object.assign({ labelAlignItems: "center", labelInline: true, labelJustifyContent: "between" }, this.props),
7
7
  React.createElement(NativeSwitch, { disabled: this.props.disabled, value: this.props.switched, onValueChange: this.props.onChange })));
8
8
  }
9
9
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Switch.js","sourceRoot":"","sources":["../src/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,IAAI,YAAY,EAAC,MAAM,cAAc,CAAC;AAGpD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,OAAO,MAAO,SAAQ,KAAK,CAAC,SAA0B;IAC1D,MAAM;QACJ,OAAO,CACL,oBAAC,SAAS,kBAAC,WAAW,QAAC,mBAAmB,EAAC,SAAS,IAAK,IAAI,CAAC,KAAK;YACjE,oBAAC,YAAY,IACX,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC1B,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAClC,CACQ,CACb,CAAC;IACJ,CAAC;CACF"}
1
+ {"version":3,"file":"Switch.js","sourceRoot":"","sources":["../src/Switch.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAC,MAAM,IAAI,YAAY,EAAC,MAAM,cAAc,CAAC;AAGpD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,MAAM,OAAO,MAAO,SAAQ,KAAK,CAAC,SAA0B;IAC1D,MAAM;QACJ,OAAO,CACL,oBAAC,SAAS,kBAAC,eAAe,EAAC,QAAQ,EAAC,WAAW,QAAC,mBAAmB,EAAC,SAAS,IAAK,IAAI,CAAC,KAAK;YAC1F,oBAAC,YAAY,IACX,QAAQ,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC7B,KAAK,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,EAC1B,aAAa,EAAE,IAAI,CAAC,KAAK,CAAC,QAAQ,GAClC,CACQ,CACb,CAAC;IACJ,CAAC;CACF"}
@@ -1,5 +1,5 @@
1
1
  import React from "react";
2
- import { AllColors, JustifyContent, ReactChildren, TextSize } from "./Common";
2
+ import { AlignItems, AllColors, JustifyContent, ReactChildren, TextSize } from "./Common";
3
3
  export interface WithLabelProps {
4
4
  children?: ReactChildren;
5
5
  show?: boolean;
@@ -7,7 +7,8 @@ export interface WithLabelProps {
7
7
  labelInline?: boolean;
8
8
  labelColor?: AllColors;
9
9
  labelJustifyContent?: JustifyContent;
10
+ labelAlignItems?: AlignItems;
10
11
  labelPlacement?: "before" | "after";
11
12
  labelSize?: TextSize;
12
13
  }
13
- export declare function WithLabel({ label, labelInline, labelJustifyContent, labelPlacement, labelSize, labelColor, show, children, }: WithLabelProps): React.ReactElement | null;
14
+ export declare function WithLabel({ label, labelInline, labelJustifyContent, labelAlignItems, labelPlacement, labelSize, labelColor, show, children, }: WithLabelProps): React.ReactElement | null;
package/dist/WithLabel.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import React from "react";
2
2
  import { Box } from "./Box";
3
3
  import { Text } from "./Text";
4
- export function WithLabel({ label, labelInline, labelJustifyContent, labelPlacement, labelSize, labelColor, show, children, }) {
4
+ export function WithLabel({ label, labelInline, labelJustifyContent, labelAlignItems, labelPlacement, labelSize, labelColor, show, children, }) {
5
5
  if (!children) {
6
6
  return null;
7
7
  }
8
- return (React.createElement(Box, { direction: labelInline ? "row" : "column", justifyContent: labelJustifyContent, width: "100%" },
8
+ return (React.createElement(Box, { alignItems: labelAlignItems, direction: labelInline ? "row" : "column", justifyContent: labelJustifyContent, width: "100%" },
9
9
  Boolean(label && labelPlacement !== "after") && (React.createElement(Box, { paddingY: 1 },
10
10
  React.createElement(Text, { color: labelColor || "darkGray", size: labelSize, weight: "bold" }, show !== false ? label : " "))),
11
11
  children,
@@ -1 +1 @@
1
- {"version":3,"file":"WithLabel.js","sourceRoot":"","sources":["../src/WithLabel.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,GAAG,EAAC,MAAM,OAAO,CAAC;AAE1B,OAAO,EAAC,IAAI,EAAC,MAAM,QAAQ,CAAC;AAa5B,MAAM,UAAU,SAAS,CAAC,EACxB,KAAK,EACL,WAAW,EACX,mBAAmB,EACnB,cAAc,EACd,SAAS,EACT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;QACb,OAAO,IAAI,CAAC;KACb;IACD,OAAO,CACL,oBAAC,GAAG,IACF,UAAU,EAAE,eAAe,EAC3B,SAAS,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,QAAQ,EACzC,cAAc,EAAE,mBAAmB,EACnC,KAAK,EAAC,MAAM;QAEX,OAAO,CAAC,KAAK,IAAI,cAAc,KAAK,OAAO,CAAC,IAAI,CAC/C,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC;YACd,oBAAC,IAAI,IAAC,KAAK,EAAE,UAAU,IAAI,UAAU,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAC,MAAM,IAClE,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CACxB,CACH,CACP;QACA,QAAQ;QACR,OAAO,CAAC,KAAK,IAAI,cAAc,KAAK,OAAO,CAAC,IAAI,CAC/C,oBAAC,GAAG,IAAC,QAAQ,EAAE,CAAC;YACd,oBAAC,IAAI,IAAC,KAAK,EAAE,UAAU,IAAI,UAAU,EAAE,IAAI,EAAE,SAAS,IACnD,IAAI,KAAK,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,GAAG,CACxB,CACH,CACP,CACG,CACP,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ferns-ui",
3
- "version": "0.34.0",
3
+ "version": "0.34.1",
4
4
  "main": "dist/index.js",
5
5
  "license": "Apache-2.0",
6
6
  "scripts": {
package/src/Common.ts CHANGED
@@ -1997,6 +1997,8 @@ export interface NavigatorProps {
1997
1997
 
1998
1998
  export type TooltipDirection = "top" | "bottom" | "left" | "right";
1999
1999
 
2000
+ export type IndicatorDirection = "topLeft" | "topRight" | "bottomLeft" | "bottomRight";
2001
+
2000
2002
  export interface PillProps {
2001
2003
  text: string;
2002
2004
  color: AllColors;
@@ -1,13 +1,15 @@
1
1
  import React, {forwardRef, useState} from "react";
2
- import {Platform, Pressable} from "react-native";
2
+ import {Platform, Pressable, View, ViewStyle} from "react-native";
3
3
 
4
4
  import {
5
+ AllColors,
5
6
  ButtonColor,
6
7
  Color,
7
8
  IconName,
8
9
  IconPrefix,
9
10
  IconSize,
10
11
  iconSizeToNumber,
12
+ IndicatorDirection,
11
13
  ThemeColor,
12
14
  TooltipDirection,
13
15
  } from "./Common";
@@ -34,6 +36,8 @@ export interface IconButtonProps {
34
36
  text: string;
35
37
  idealDirection?: TooltipDirection;
36
38
  };
39
+ indicator?: boolean;
40
+ indicatorStyle?: {position: IndicatorDirection; color: AllColors};
37
41
  }
38
42
 
39
43
  // eslint-disable-next-line react/display-name
@@ -50,6 +54,8 @@ export const IconButton = forwardRef(
50
54
  confirmationText = "Are you sure you want to continue?",
51
55
  confirmationHeading = "Confirm",
52
56
  tooltip,
57
+ indicator,
58
+ indicatorStyle = {position: "bottomRight", color: "primary"},
53
59
  }: IconButtonProps,
54
60
  ref
55
61
  ) => {
@@ -65,6 +71,15 @@ export const IconButton = forwardRef(
65
71
  color = Unifier.theme[bgColor];
66
72
  }
67
73
 
74
+ const IndicatorPosition = {
75
+ bottomRight: {bottom: "20%", right: "20%"},
76
+ bottomLeft: {bottom: "20%", left: "20%"},
77
+ topRight: {top: "20%", right: "20%"},
78
+ topLeft: {top: "20%", left: "20%"},
79
+ };
80
+
81
+ const indicatorPosition = {position: "absolute", ...IndicatorPosition[indicatorStyle.position]};
82
+
68
83
  const renderConfirmation = () => {
69
84
  return (
70
85
  <Modal
@@ -117,7 +132,18 @@ export const IconButton = forwardRef(
117
132
  }}
118
133
  >
119
134
  <Icon color={iconColor} name={icon} prefix={prefix || "fas"} size={size} />
135
+ {indicator && (
136
+ <View style={indicatorPosition as ViewStyle}>
137
+ <Icon
138
+ color={indicatorStyle.color}
139
+ name="circle"
140
+ prefix={prefix || "fas"}
141
+ size="sm"
142
+ />
143
+ </View>
144
+ )}
120
145
  </Pressable>
146
+
121
147
  {Boolean(withConfirmation) && renderConfirmation()}
122
148
  </>
123
149
  );
package/src/Switch.tsx CHANGED
@@ -7,7 +7,7 @@ import {WithLabel} from "./WithLabel";
7
7
  export class Switch extends React.Component<SwitchProps, {}> {
8
8
  render() {
9
9
  return (
10
- <WithLabel labelInline labelJustifyContent="between" {...this.props}>
10
+ <WithLabel labelAlignItems="center" labelInline labelJustifyContent="between" {...this.props}>
11
11
  <NativeSwitch
12
12
  disabled={this.props.disabled}
13
13
  value={this.props.switched}
package/src/WithLabel.tsx CHANGED
@@ -1,7 +1,7 @@
1
1
  import React from "react";
2
2
 
3
3
  import {Box} from "./Box";
4
- import {AllColors, JustifyContent, ReactChildren, TextSize} from "./Common";
4
+ import {AlignItems, AllColors, JustifyContent, ReactChildren, TextSize} from "./Common";
5
5
  import {Text} from "./Text";
6
6
 
7
7
  export interface WithLabelProps {
@@ -11,6 +11,7 @@ export interface WithLabelProps {
11
11
  labelInline?: boolean;
12
12
  labelColor?: AllColors;
13
13
  labelJustifyContent?: JustifyContent;
14
+ labelAlignItems?: AlignItems;
14
15
  labelPlacement?: "before" | "after";
15
16
  labelSize?: TextSize;
16
17
  }
@@ -19,6 +20,7 @@ export function WithLabel({
19
20
  label,
20
21
  labelInline,
21
22
  labelJustifyContent,
23
+ labelAlignItems,
22
24
  labelPlacement,
23
25
  labelSize,
24
26
  labelColor,
@@ -30,6 +32,7 @@ export function WithLabel({
30
32
  }
31
33
  return (
32
34
  <Box
35
+ alignItems={labelAlignItems}
33
36
  direction={labelInline ? "row" : "column"}
34
37
  justifyContent={labelJustifyContent}
35
38
  width="100%"