@trackunit/react-components 0.0.75 → 0.0.78

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.
@@ -0,0 +1,30 @@
1
+ /// <reference types="react" />
2
+ import { CommonProps } from "../../common/CommonProps";
3
+ export interface TimelineProps extends CommonProps {
4
+ children: React.ReactNode;
5
+ }
6
+ /**
7
+ * Timeline - used to contain TimelineElements for building a sequence of timed entries - each rendered on a line
8
+ * - with an indicator (dot)
9
+ * - a header (next to the dot)
10
+ * - and a body.
11
+ *
12
+ * @param {TimelineProps} props - The props for the Timeline component
13
+ * @returns {JSX.Element} Timeline component
14
+ */
15
+ export declare const Timeline: ({ className, dataTestId, children }: TimelineProps) => JSX.Element;
16
+ interface TimeLineElementProps extends CommonProps {
17
+ date: Date;
18
+ header?: React.ReactNode;
19
+ children: React.ReactNode;
20
+ dot?: React.ReactNode;
21
+ }
22
+ /**
23
+ * TimelineElement - entry on a timeline - rendered with an icon on the timeline
24
+ * - a date as the header and the children provided as body.
25
+ *
26
+ * @param {TimeLineElementProps} props the props
27
+ * @returns {JSX.Element} component
28
+ */
29
+ export declare const TimelineElement: ({ date, children, className, dataTestId, dot, header, }: TimeLineElementProps) => JSX.Element;
30
+ export {};
@@ -33,6 +33,7 @@ export * from "./Text";
33
33
  export * from "./TextArea";
34
34
  export * from "./TextField";
35
35
  export * from "./TextInput/TextInput";
36
+ export * from "./Timeline/Timeline";
36
37
  export * from "./Tip";
37
38
  export * from "./Toggle";
38
39
  export * from "./Tooltip";
package/index.js CHANGED
@@ -17,6 +17,7 @@ import ReactAsyncCreatableSelect from 'react-select/async-creatable';
17
17
  import ReactCreatableSelect from 'react-select/creatable';
18
18
  import ReactSelect from 'react-select';
19
19
  import ReactAsyncSelect from 'react-select/async';
20
+ import ReactMoment from 'react-moment';
20
21
 
21
22
  const docs = {
22
23
  source: {
@@ -4179,6 +4180,77 @@ const TextField = React.forwardRef((_a, ref) => {
4179
4180
  }));
4180
4181
  });
4181
4182
 
4183
+ /**
4184
+ * Timeline - used to contain TimelineElements for building a sequence of timed entries - each rendered on a line
4185
+ * - with an indicator (dot)
4186
+ * - a header (next to the dot)
4187
+ * - and a body.
4188
+ *
4189
+ * @param {TimelineProps} props - The props for the Timeline component
4190
+ * @returns {JSX.Element} Timeline component
4191
+ */
4192
+
4193
+ const Timeline = ({
4194
+ className,
4195
+ dataTestId,
4196
+ children
4197
+ }) => {
4198
+ return jsx("ol", Object.assign({
4199
+ className: `${className !== null && className !== void 0 ? className : ""} ${tws`tu-timeline`}`,
4200
+ "data-testid": dataTestId
4201
+ }, {
4202
+ children: children
4203
+ }));
4204
+ };
4205
+ /**
4206
+ * TimelineElement - entry on a timeline - rendered with an icon on the timeline
4207
+ * - a date as the header and the children provided as body.
4208
+ *
4209
+ * @param {TimeLineElementProps} props the props
4210
+ * @returns {JSX.Element} component
4211
+ */
4212
+
4213
+ const TimelineElement = ({
4214
+ date,
4215
+ children,
4216
+ className,
4217
+ dataTestId = "timeline-date",
4218
+ dot = jsx(Indicator$1, {
4219
+ className: tws`mt-[-1px]`,
4220
+ color: "neutral",
4221
+ icon: jsx(Icon$1, {
4222
+ name: "CalendarIcon",
4223
+ size: "large"
4224
+ })
4225
+ }),
4226
+ header = jsx(ReactMoment, Object.assign({
4227
+ format: "LLL",
4228
+ fromNow: true
4229
+ }, {
4230
+ children: date
4231
+ }))
4232
+ }) => {
4233
+ var _a;
4234
+
4235
+ return jsxs("li", Object.assign({
4236
+ className: `${tws`tu-timeline-element`}${(_a = " " + className) !== null && _a !== void 0 ? _a : ""} `,
4237
+ "data-date": `${date}`,
4238
+ "data-testid": `${dataTestId}`
4239
+ }, {
4240
+ children: [jsx("div", Object.assign({
4241
+ className: tws`tu-timeline-element-dot`
4242
+ }, {
4243
+ children: dot
4244
+ })), jsx("div", {
4245
+ children: header
4246
+ }), jsx("div", {}), jsx("div", {
4247
+ children: jsx("div", {
4248
+ children: children
4249
+ })
4250
+ })]
4251
+ }));
4252
+ };
4253
+
4182
4254
  const Toggle = React.forwardRef(({
4183
4255
  toggled = false,
4184
4256
  onChange,
@@ -4379,4 +4451,4 @@ const useTimeout = ({
4379
4451
  };
4380
4452
  };
4381
4453
 
4382
- export { Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$3 as Label, LegendItem, MenuButton, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiRowTableCell, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, TextArea, TextField, TextInput, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, activityColors, colors, criticalityColors, docs, generalColors, intentColors, useContainerProps, useCustomComponents, useCustomStyles, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
4454
+ export { Alert, AnimatedPopover, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, CopyableText, CreatableSelect, DateField, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading, Icon$1 as Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$3 as Label, LegendItem, MenuButton, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MultiRowTableCell, NumberField, NumberInput, PageHeading, PopoverLifecycle, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Select, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text, TextArea, TextField, TextInput, Timeline, TimelineElement, Tip, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, activityColors, colors, criticalityColors, docs, generalColors, intentColors, useContainerProps, useCustomComponents, useCustomStyles, useDebounce, useLocalStorage, useModal, usePopover, usePrompt, useTimeout };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.0.75",
3
+ "version": "0.0.78",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "UNLICENSED",
6
6
  "dependencies": {
@@ -21,7 +21,8 @@
21
21
  "history": "^5.3.0",
22
22
  "react-router-dom": "^6.2.2",
23
23
  "react-select": "^5.2.2",
24
- "faker": "^5.5.3"
24
+ "faker": "^5.5.3",
25
+ "react-moment": "^1.1.2"
25
26
  },
26
27
  "module": "./index.js",
27
28
  "main": "./index.js",