@equinor/mad-dfw 0.0.16 → 0.1.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/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # @equinor/mad-dfw
2
2
 
3
+ ## 0.1.0
4
+
5
+ ### Minor Changes
6
+
7
+ - 583968f: Add textcolor support for propertyrow and workordercell and add requiredEnd prop to
8
+ workordercell
9
+
10
+ ### Patch Changes
11
+
12
+ - Updated dependencies [a8cc142]
13
+ - @equinor/mad-components@0.14.3
14
+
3
15
  ## 0.0.16
4
16
 
5
17
  ### Patch Changes
@@ -41,7 +41,17 @@ import {
41
41
  } from "@equinor/mad-components";
42
42
  import { View } from "react-native";
43
43
  var PropertyRow = (_a) => {
44
- var _b = _a, { label, value, iconName } = _b, rest = __objRest(_b, ["label", "value", "iconName"]);
44
+ var _b = _a, {
45
+ label,
46
+ value,
47
+ iconName,
48
+ textColor = "textTertiary"
49
+ } = _b, rest = __objRest(_b, [
50
+ "label",
51
+ "value",
52
+ "iconName",
53
+ "textColor"
54
+ ]);
45
55
  const breakpoint = useBreakpoint();
46
56
  const styles = useStyles(themeStyles, { breakpoint });
47
57
  const renderIcon = () => iconName && /* @__PURE__ */ React.createElement(Icon, { name: iconName, size: 20, style: styles.iconStyle, color: "textTertiary" });
@@ -51,7 +61,7 @@ var PropertyRow = (_a) => {
51
61
  {
52
62
  group: "paragraph",
53
63
  variant: "body_short",
54
- color: "textTertiary",
64
+ color: textColor,
55
65
  numberOfLines: 1
56
66
  },
57
67
  value
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  PropertyRow,
3
3
  __objRest
4
- } from "./chunk-N532LWDH.js";
4
+ } from "./chunk-EATHXFY2.js";
5
5
 
6
6
  // src/dfwcomponents/WorkOrderCell/WorkOrderCell.tsx
7
7
  import React, { useMemo } from "react";
@@ -24,6 +24,7 @@ var WorkOrderLabelMap = {
24
24
  activeStatusIds: "Active Status IDs",
25
25
  basicStartDate: "Basic Start Date",
26
26
  basicEndDate: "Basic End Date",
27
+ requiredEnd: "Required End",
27
28
  workCenterId: "Work Center ID"
28
29
  };
29
30
  var getStatusIconConfig = (status) => {
@@ -59,23 +60,25 @@ var WorkOrderCell = (_a) => {
59
60
  onStartButtonPress,
60
61
  onCompleteButtonPress,
61
62
  onPress,
62
- showSymbols
63
+ showSymbols,
64
+ valueColor = "textTertiary"
63
65
  } = _b, rest = __objRest(_b, [
64
66
  "title",
65
67
  "maintenanceType",
66
68
  "onStartButtonPress",
67
69
  "onCompleteButtonPress",
68
70
  "onPress",
69
- "showSymbols"
71
+ "showSymbols",
72
+ "valueColor"
70
73
  ]);
71
74
  var _a2;
72
75
  const styles = useStyles(themeStyles);
73
76
  const activeStatuses = (_a2 = rest.activeStatusIds) == null ? void 0 : _a2.split(" ");
77
+ const currentDate = /* @__PURE__ */ new Date();
78
+ const requiredEnd = rest.requiredEnd ? new Date(rest.requiredEnd) : null;
74
79
  const iconsAndLabels = useMemo(() => {
75
- const currentDate = /* @__PURE__ */ new Date();
76
- const endDate = rest.basicEndDate ? new Date(rest.basicEndDate) : null;
77
80
  const result = [];
78
- if (endDate && currentDate > endDate) {
81
+ if (requiredEnd && currentDate > requiredEnd) {
79
82
  result.push({
80
83
  icon: "alarm",
81
84
  label: "Required end overdue",
@@ -90,7 +93,7 @@ var WorkOrderCell = (_a) => {
90
93
  }
91
94
  });
92
95
  return result;
93
- }, [activeStatuses, rest.basicEndDate]);
96
+ }, [activeStatuses, rest.requiredEnd]);
94
97
  const isStartDisabled = !!(activeStatuses == null ? void 0 : activeStatuses.includes("STRT")) || !!(activeStatuses == null ? void 0 : activeStatuses.includes("RDOP"));
95
98
  const isCompleteDisabled = !(activeStatuses == null ? void 0 : activeStatuses.includes("STRT")) || (activeStatuses == null ? void 0 : activeStatuses.includes("RDOP"));
96
99
  return /* @__PURE__ */ React.createElement(
@@ -112,16 +115,21 @@ var WorkOrderCell = (_a) => {
112
115
  if (value) {
113
116
  const label = WorkOrderLabelMap[key];
114
117
  let displayValue = value;
115
- if (key === "basicStartDate" || key === "basicEndDate") {
118
+ let requiredEndColor = valueColor;
119
+ if (key === "basicStartDate" || key === "basicEndDate" || key === "requiredEnd") {
116
120
  displayValue = value ? new Date(value).toLocaleDateString() : "";
117
121
  }
122
+ if (key === "requiredEnd" && requiredEnd && currentDate > requiredEnd) {
123
+ requiredEndColor = "danger";
124
+ }
118
125
  return /* @__PURE__ */ React.createElement(
119
126
  PropertyRow,
120
127
  {
121
128
  key: index,
122
129
  label,
123
130
  value: displayValue,
124
- style: { marginBottom: 8 }
131
+ style: { marginBottom: 8 },
132
+ textColor: requiredEndColor
125
133
  }
126
134
  );
127
135
  }
@@ -1,9 +1,10 @@
1
1
  import React from "react";
2
- import { IconName } from "@equinor/mad-components";
2
+ import { IconName, Color } from "@equinor/mad-components";
3
3
  import { ViewProps } from "react-native";
4
4
  export type PropertyRowProps = {
5
5
  label: string;
6
6
  value: string;
7
7
  iconName?: IconName;
8
+ textColor?: Color;
8
9
  } & ViewProps;
9
- export declare const PropertyRow: ({ label, value, iconName, ...rest }: PropertyRowProps) => React.JSX.Element;
10
+ export declare const PropertyRow: ({ label, value, iconName, textColor, ...rest }: PropertyRowProps) => React.JSX.Element;
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PropertyRow
3
- } from "../../chunk-N532LWDH.js";
3
+ } from "../../chunk-EATHXFY2.js";
4
4
  export {
5
5
  PropertyRow
6
6
  };
@@ -1,7 +1,7 @@
1
1
  import "../../chunk-2JQRYR7Z.js";
2
2
  import {
3
3
  PropertyRow
4
- } from "../../chunk-N532LWDH.js";
4
+ } from "../../chunk-EATHXFY2.js";
5
5
  export {
6
6
  PropertyRow
7
7
  };
@@ -1,4 +1,5 @@
1
1
  import React from "react";
2
+ import { Color } from "@equinor/mad-components";
2
3
  export type WorkOrder = {
3
4
  title: string;
4
5
  workOrderId: string;
@@ -8,6 +9,7 @@ export type WorkOrder = {
8
9
  activeStatusIds?: string;
9
10
  basicStartDate?: string;
10
11
  basicEndDate?: string;
12
+ requiredEnd?: string;
11
13
  workCenterId?: string;
12
14
  };
13
15
  export type WorkOrderCellProps = {
@@ -15,5 +17,6 @@ export type WorkOrderCellProps = {
15
17
  onCompleteButtonPress?: () => void;
16
18
  onPress?: () => void;
17
19
  showSymbols?: boolean;
20
+ valueColor?: Color;
18
21
  } & WorkOrder;
19
- export declare const WorkOrderCell: ({ title, maintenanceType, onStartButtonPress, onCompleteButtonPress, onPress, showSymbols, ...rest }: WorkOrderCellProps) => React.JSX.Element;
22
+ export declare const WorkOrderCell: ({ title, maintenanceType, onStartButtonPress, onCompleteButtonPress, onPress, showSymbols, valueColor, ...rest }: WorkOrderCellProps) => React.JSX.Element;
@@ -1,8 +1,8 @@
1
1
  import {
2
2
  WorkOrderCell
3
- } from "../../chunk-T7JOTKYK.js";
3
+ } from "../../chunk-ZDARIMJV.js";
4
4
  import "../../chunk-2JQRYR7Z.js";
5
- import "../../chunk-N532LWDH.js";
5
+ import "../../chunk-EATHXFY2.js";
6
6
  export {
7
7
  WorkOrderCell
8
8
  };
@@ -1,9 +1,9 @@
1
1
  import "../../chunk-RW7P2LMK.js";
2
2
  import {
3
3
  WorkOrderCell
4
- } from "../../chunk-T7JOTKYK.js";
4
+ } from "../../chunk-ZDARIMJV.js";
5
5
  import "../../chunk-2JQRYR7Z.js";
6
- import "../../chunk-N532LWDH.js";
6
+ import "../../chunk-EATHXFY2.js";
7
7
  export {
8
8
  WorkOrderCell
9
9
  };
package/dist/index.js CHANGED
@@ -1,11 +1,11 @@
1
1
  import "./chunk-RW7P2LMK.js";
2
2
  import {
3
3
  WorkOrderCell
4
- } from "./chunk-T7JOTKYK.js";
4
+ } from "./chunk-ZDARIMJV.js";
5
5
  import "./chunk-2JQRYR7Z.js";
6
6
  import {
7
7
  PropertyRow
8
- } from "./chunk-N532LWDH.js";
8
+ } from "./chunk-EATHXFY2.js";
9
9
  export {
10
10
  PropertyRow,
11
11
  WorkOrderCell
package/package.json CHANGED
@@ -1,48 +1,48 @@
1
1
  {
2
- "name": "@equinor/mad-dfw",
3
- "version": "0.0.16",
4
- "description": "A React Native component library for the Digital Field Worker applications.",
5
- "type": "module",
6
- "keywords": [
7
- "react native",
8
- "ui",
9
- "typescript",
10
- "equinor",
11
- "notifications",
12
- "inspection",
13
- "work order"
14
- ],
15
- "author": {
16
- "name": "Equinor Mobile App Delivery team (MAD)"
17
- },
18
- "license": "MIT",
19
- "bugs": {
20
- "url": "https://github.com/equinor/mad/issues"
21
- },
22
- "homepage": "https://github.com/equinor/mad/",
23
- "main": "./dist/index.js",
24
- "types": "./dist/index.d.ts",
25
- "peerDependencies": {
26
- "react": ">=18.0",
27
- "react-native": ">=0.70"
28
- },
29
- "dependencies": {
30
- "@equinor/mad-components": "0.13.0"
31
- },
32
- "devDependencies": {
33
- "@equinor/eslint-config-mad": "0.3.1"
34
- },
35
- "files": [
36
- "CODE_OF_CONDUCT.md",
37
- "LICENSE",
38
- "CHANGELOG.md",
39
- "dist"
40
- ],
41
- "scripts": {
42
- "build": "tsup-node && echo '\n ⚙️ Generating typescript declarations..' && tsc --project tsconfig.json --emitDeclarationOnly --declaration",
43
- "test": "jest",
44
- "dev": "tsup-node --watch --clean=false",
45
- "lint": "eslint src/",
46
- "clean": "rm -rf node_modules/ && rm -rf dist/"
47
- }
2
+ "name": "@equinor/mad-dfw",
3
+ "version": "0.1.0",
4
+ "description": "A React Native component library for the Digital Field Worker applications.",
5
+ "type": "module",
6
+ "scripts": {
7
+ "build": "tsup-node && echo '\n ⚙️ Generating typescript declarations..' && tsc --project tsconfig.json --emitDeclarationOnly --declaration",
8
+ "test": "jest",
9
+ "dev": "tsup-node --watch --clean=false",
10
+ "lint": "eslint src/",
11
+ "clean": "rm -rf node_modules/ && rm -rf dist/"
12
+ },
13
+ "keywords": [
14
+ "react native",
15
+ "ui",
16
+ "typescript",
17
+ "equinor",
18
+ "notifications",
19
+ "inspection",
20
+ "work order"
21
+ ],
22
+ "author": {
23
+ "name": "Equinor Mobile App Delivery team (MAD)"
24
+ },
25
+ "license": "MIT",
26
+ "bugs": {
27
+ "url": "https://github.com/equinor/mad/issues"
28
+ },
29
+ "homepage": "https://github.com/equinor/mad/",
30
+ "main": "./dist/index.js",
31
+ "types": "./dist/index.d.ts",
32
+ "peerDependencies": {
33
+ "react": ">=18.0",
34
+ "react-native": ">=0.70"
35
+ },
36
+ "dependencies": {
37
+ "@equinor/mad-components": "*"
38
+ },
39
+ "devDependencies": {
40
+ "@equinor/eslint-config-mad": "*"
41
+ },
42
+ "files": [
43
+ "CODE_OF_CONDUCT.md",
44
+ "LICENSE",
45
+ "CHANGELOG.md",
46
+ "dist"
47
+ ]
48
48
  }