@trackunit/react-components 0.1.35 → 0.1.39

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/index.css CHANGED
@@ -258,7 +258,8 @@
258
258
 
259
259
  &__wrapper {
260
260
  @apply flex
261
- gap-2;
261
+ gap-2
262
+ items-center;
262
263
  }
263
264
 
264
265
  &--checked {
@@ -309,7 +310,6 @@
309
310
  @apply bg-white;
310
311
  }
311
312
 
312
-
313
313
  &__label-container {
314
314
  @apply gap-y-1
315
315
  grid;
package/index.js CHANGED
@@ -7,7 +7,7 @@ import EChart from 'echarts-for-react';
7
7
  import { v4 } from 'uuid';
8
8
  import { useMeasure, useCopyToClipboard } from 'react-use';
9
9
  import { format, formatDistance } from 'date-fns';
10
- import { useFloating, offset, shift, flip, autoUpdate, useInteractions, useClick, useHover, useRole, useDismiss, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
10
+ import { useFloating, offset, flip, shift, size, autoUpdate, useInteractions, useClick, useHover, useRole, useDismiss, FloatingPortal, FloatingFocusManager } from '@floating-ui/react';
11
11
  import { Link, UNSAFE_NavigationContext } from 'react-router-dom';
12
12
  import { DayPicker as DayPicker$1 } from 'react-day-picker';
13
13
  import { enGB, enUS, da, de, cs, nl, fr, fi, hu, it, nb, pl, pt, ru, ro, es, sv, ja, th } from 'date-fns/locale';
@@ -955,7 +955,20 @@ const Popover = ({ children, render, placement, activation = { click: true, hove
955
955
  const { x, y, reference, floating, strategy, context } = useFloating({
956
956
  open,
957
957
  onOpenChange: setOpen,
958
- middleware: [offset(8), shift(), flip({ crossAxis: true, fallbackPlacements: ["top", "bottom", "left", "right"] })],
958
+ middleware: [
959
+ offset(8),
960
+ flip({ fallbackPlacements: ["top", "bottom", "right", "left"] }),
961
+ shift(),
962
+ size({
963
+ padding: 8,
964
+ apply({ availableWidth, availableHeight, elements }) {
965
+ Object.assign(elements.floating.style, {
966
+ maxWidth: `${availableWidth}px`,
967
+ maxHeight: `${availableHeight}px`,
968
+ });
969
+ },
970
+ }),
971
+ ],
959
972
  placement,
960
973
  whileElementsMounted: autoUpdate,
961
974
  });
@@ -972,6 +985,7 @@ const Popover = ({ children, render, placement, activation = { click: true, hove
972
985
  position: strategy,
973
986
  top: y !== null && y !== void 0 ? y : 0,
974
987
  left: x !== null && x !== void 0 ? x : 0,
988
+ display: "flex",
975
989
  } }, getFloatingProps(), { children: render({
976
990
  close: () => {
977
991
  setOpen(false);
@@ -1258,6 +1272,25 @@ const Overlay = tw.div `
1258
1272
  ${({ $open }) => $open && tws `tu-drawer__overlay--open`}
1259
1273
  `;
1260
1274
 
1275
+ /**
1276
+ * A Email Input component is used for input of the type Email.
1277
+ *
1278
+ * It has an ActionButton which sends an email to the specified address using "mailto:" link.
1279
+ *
1280
+ * Extends props of BaseInput.
1281
+ *
1282
+ * A reference to the input element is provided as the `ref` prop.
1283
+ * For specific input types make sure to use the corresponding input component.
1284
+ */
1285
+ const EmailInput = React.forwardRef((_a, ref) => {
1286
+ var { fieldSize = "medium", disableAction = false, dataTestId } = _a, rest = __rest(_a, ["fieldSize", "disableAction", "dataTestId"]);
1287
+ const [email, setEmail] = React.useState("");
1288
+ const sendEmail = () => {
1289
+ return window.open(`mailto:${email}`);
1290
+ };
1291
+ return (jsx(BaseInput, Object.assign({ dataTestId: dataTestId, fieldSize: fieldSize, ref: ref, type: "email", placeholder: rest.placeholder || "mail@example.com", onChange: e => setEmail(e.target.value) }, rest, { actions: !disableAction && (jsx(ActionButton, { value: email, type: "EMAIL", onClick: sendEmail, dataTestId: dataTestId && `${dataTestId}-emailIcon`, iconSize: fieldSize })) })));
1292
+ });
1293
+
1261
1294
  /**
1262
1295
  * The external link component is used to link to an external page outside the Trackunit Manager.
1263
1296
  *
@@ -1781,6 +1814,25 @@ const PageInput = tw.input `
1781
1814
  [-moz-appearance:textfield]
1782
1815
  `;
1783
1816
 
1817
+ /**
1818
+ * A Phone Input component is used for input of the type tel.
1819
+ *
1820
+ * It has an ActionButton which sends an phone call to the specified number using "tel:" link.
1821
+ *
1822
+ * Extends props of BaseInput.
1823
+ *
1824
+ * A reference to the input element is provided as the `ref` prop.
1825
+ * For specific input types make sure to use the corresponding input component.
1826
+ */
1827
+ const PhoneInput = React.forwardRef((_a, ref) => {
1828
+ var { dataTestId, fieldSize = "medium", disableAction = false } = _a, rest = __rest(_a, ["dataTestId", "fieldSize", "disableAction"]);
1829
+ const [phoneNumber, setPhoneNumber] = React.useState("");
1830
+ const callNumber = () => {
1831
+ return window.open(`tel:${phoneNumber}`);
1832
+ };
1833
+ return (jsx(BaseInput, Object.assign({ ref: ref, dataTestId: dataTestId, fieldSize: fieldSize, type: "tel", onChange: e => setPhoneNumber(e.target.value), actions: !disableAction && (jsx(ActionButton, { value: phoneNumber, type: "PHONE_NUMBER", onClick: callNumber, dataTestId: dataTestId && `${dataTestId}-phoneIcon`, iconSize: fieldSize })) }, rest)));
1834
+ });
1835
+
1784
1836
  /**
1785
1837
  * Create a PieChart with legends based on our current Chart component
1786
1838
  *
@@ -3134,4 +3186,4 @@ const Layout = tw.div `
3134
3186
  tu-layout-TwoColumnLayout
3135
3187
  `;
3136
3188
 
3137
- export { ActionButton, Alert, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, ContentGridArea, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, ExternalLink, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading$1 as Heading, Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$2 as Label, LegendItem, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MoreMenu, MultiSelectMenuItem, NavGridArea, NumberField, NumberInput, PageHeader, Pagination, PieChart, Popover, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Search, SectionHeader, Select, SelectPrefix, Sidebar, SingleSelectMenuItem, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, TextArea, TextAreaField, TextField, TextInput, Timeline, TimelineElement, Tip, TitleGridArea, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, ValueBar, docs, getDevicePixelRatio, getOrderedOptions, getValueBarColorByValue, isMultiValue, useContainerProps, useCustomComponents, useDebounce, useDevicePixelRatio, useLocalStorage, useModal, usePrompt, useTimeout };
3189
+ export { ActionButton, Alert, Badge, BaseInput, Button, Card, CardBody, CardFooter, CardHeader, Chart, Checkbox, Collapse, ContentGridArea, CopyableText, CreatableSelect, DateField, DateInput, DayPicker, DayPickerPopover, DayRangePicker, DensityContainer, Drawer, EmailInput, ExternalLink, FilterListMapLayout, FormGroup, FullWidthRepeatingLayout, GridArea, Heading$1 as Heading, Icon, IconButton, Indicator$1 as Indicator, IntrinsicallyResponsiveGrid, Label$2 as Label, LegendItem, MenuItem, MenuList, MinTopFullContentLayout, Modal, ModalBackdrop, MoreMenu, MultiSelectMenuItem, NavGridArea, NumberField, NumberInput, PageHeader, Pagination, PhoneInput, PieChart, Popover, PopoverList, PopoverListItem, PopoverTitle, Prompt, ROLE_CARD, RadioGroup, RadioItem, Search, SectionHeader, Select, SelectPrefix, Sidebar, SingleSelectMenuItem, SkeletonLines, Spacer, Spinner, StarButton, Tag, Text$1 as Text, TextArea, TextAreaField, TextField, TextInput, Timeline, TimelineElement, Tip, TitleGridArea, TitleNavContentLayout, Toggle, Tooltip, TwoColumnLayout, ValueBar, docs, getDevicePixelRatio, getOrderedOptions, getValueBarColorByValue, isMultiValue, useContainerProps, useCustomComponents, useDebounce, useDevicePixelRatio, useLocalStorage, useModal, usePrompt, useTimeout };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-components",
3
- "version": "0.1.35",
3
+ "version": "0.1.39",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "dependencies": {
@@ -8,7 +8,7 @@
8
8
  "@trackunit/tailwind-styled-components": "0.0.51",
9
9
  "react": "18.2.0",
10
10
  "@trackunit/ui-design-tokens": "0.0.53",
11
- "@trackunit/react-core-contexts-test": "0.1.22",
11
+ "@trackunit/react-core-contexts-test": "0.1.23",
12
12
  "echarts": "5.4.0",
13
13
  "echarts-for-react": "3.0.2",
14
14
  "uuid": "8.3.2",
@@ -0,0 +1 @@
1
+ export * from "./EmailInput";
@@ -0,0 +1 @@
1
+ export * from "./PhoneInput";
@@ -12,6 +12,7 @@ export * from "./DateField/DateField";
12
12
  export * from "./DateInput/DateInput";
13
13
  export * from "./DayPicker";
14
14
  export * from "./Drawer/Drawer";
15
+ export * from "./EmailInput";
15
16
  export * from "./ExternalLink/ExternalLink";
16
17
  export * from "./FormGroup/FormGroup";
17
18
  export * from "./Heading";
@@ -25,6 +26,7 @@ export * from "./NumberField/NumberField";
25
26
  export * from "./NumberInput/NumberInput";
26
27
  export * from "./PageHeader";
27
28
  export * from "./Pagination/Pagination";
29
+ export * from "./PhoneInput";
28
30
  export * from "./PieChart";
29
31
  export * from "./Popover";
30
32
  export * from "./Popover/Popover";