@longline/aqua-ui 1.0.183 → 1.0.186

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.
Files changed (131) hide show
  1. package/containers/Dock/Dock.d.ts +7 -4
  2. package/containers/Dock/Dock.js +2 -1
  3. package/containers/Dock/Dockable.d.ts +14 -3
  4. package/containers/Dock/Dockable.js +45 -14
  5. package/containers/DragBar/DragBar.d.ts +4 -1
  6. package/containers/DragBar/DragBar.js +1 -0
  7. package/containers/GlassPane/GlassPane.d.ts +16 -4
  8. package/containers/GlassPane/GlassPane.js +41 -8
  9. package/containers/InfoBox/InfoBox.d.ts +23 -2
  10. package/containers/InfoBox/InfoBox.js +40 -2
  11. package/containers/InfoBox/elements/Content.d.ts +4 -1
  12. package/containers/InfoBox/elements/Content.js +1 -0
  13. package/containers/InfoBox/elements/Footer.d.ts +4 -1
  14. package/containers/InfoBox/elements/Footer.js +1 -0
  15. package/containers/InfoBox/elements/Header.d.ts +4 -1
  16. package/containers/InfoBox/elements/Header.js +2 -1
  17. package/containers/List/ListCell.d.ts +4 -1
  18. package/containers/List/ListCell.js +2 -1
  19. package/containers/List/ListRow.d.ts +4 -1
  20. package/containers/List/ListRow.js +2 -1
  21. package/containers/Message/Error.d.ts +4 -1
  22. package/containers/Message/Error.js +1 -0
  23. package/containers/Message/Message.d.ts +13 -3
  24. package/containers/Message/Message.js +2 -1
  25. package/containers/Message/NoData.d.ts +4 -1
  26. package/containers/Message/NoData.js +1 -0
  27. package/containers/Message/NoFilteredData.d.ts +4 -1
  28. package/containers/Message/NoFilteredData.js +1 -0
  29. package/controls/Chip/Chip.d.ts +7 -4
  30. package/controls/Chip/Chip.js +12 -12
  31. package/controls/Dropzone/Dropzone.d.ts +14 -10
  32. package/controls/Dropzone/Dropzone.js +88 -20
  33. package/controls/Fab/Fab.d.ts +7 -5
  34. package/controls/Fab/Fab.js +19 -18
  35. package/controls/FilterButton/FilterButton.d.ts +4 -5
  36. package/controls/FilterButton/FilterButton.js +11 -16
  37. package/controls/Gradient/Gradient.d.ts +8 -2
  38. package/controls/Gradient/Gradient.js +32 -6
  39. package/controls/Gradient/PresetGradients.d.ts +11 -4
  40. package/controls/Gradient/PresetGradients.js +7 -0
  41. package/controls/Icon/Icon.d.ts +7 -4
  42. package/controls/Icon/Icon.js +6 -5
  43. package/controls/Key/Key.d.ts +5 -2
  44. package/controls/Key/Key.js +36 -35
  45. package/controls/LinearChart/LinearChart.d.ts +4 -1
  46. package/controls/LinearChart/LinearChart.js +3 -2
  47. package/controls/ListView/ColumnsManager/ColumnsManager.js +1 -1
  48. package/controls/ListView/ListView.d.ts +2 -1
  49. package/controls/ListView/ListView.js +6 -5
  50. package/controls/ListView/NoData.d.ts +4 -1
  51. package/controls/ListView/NoData.js +1 -0
  52. package/controls/ListView/{Body.d.ts → elements/Body.d.ts} +2 -2
  53. package/controls/ListView/{Body.js → elements/Body.js} +1 -1
  54. package/controls/ListView/elements/Ghost.d.ts +12 -0
  55. package/controls/ListView/{Ghost.js → elements/Ghost.js} +4 -3
  56. package/controls/ListView/{Header.d.ts → elements/Header.d.ts} +2 -2
  57. package/controls/ListView/{Header.js → elements/Header.js} +3 -14
  58. package/controls/ListView/{HeaderButton.d.ts → elements/HeaderButton.d.ts} +4 -1
  59. package/controls/ListView/{HeaderButton.js → elements/HeaderButton.js} +1 -1
  60. package/controls/ListView/{HeaderCell.d.ts → elements/HeaderCell.d.ts} +7 -4
  61. package/controls/ListView/{HeaderCell.js → elements/HeaderCell.js} +5 -3
  62. package/controls/ListView/{SortButton.d.ts → elements/SortButton.d.ts} +1 -1
  63. package/controls/ListView/elements/SortButton.js +27 -0
  64. package/controls/ListView/{Table.d.ts → elements/Table.d.ts} +6 -3
  65. package/controls/ListView/{Table.js → elements/Table.js} +5 -4
  66. package/controls/ListView/{Total.d.ts → elements/Total.d.ts} +5 -1
  67. package/controls/ListView/{Total.js → elements/Total.js} +2 -1
  68. package/controls/Mouse/Mouse.d.ts +8 -3
  69. package/controls/Mouse/Mouse.js +21 -7
  70. package/controls/PrimaryButton/PrimaryButton.d.ts +6 -2
  71. package/controls/PrimaryButton/PrimaryButton.js +14 -9
  72. package/controls/Progress/Progress.d.ts +22 -6
  73. package/controls/Progress/Progress.js +38 -7
  74. package/controls/SecondaryButton/SecondaryButton.d.ts +12 -5
  75. package/controls/SecondaryButton/SecondaryButton.js +29 -19
  76. package/controls/TabBar/Tab.js +1 -1
  77. package/controls/TabBar/TabBar.d.ts +15 -4
  78. package/controls/TabBar/TabBar.js +105 -10
  79. package/controls/TabBar/Underliner.js +2 -1
  80. package/controls/TertiaryButton/TertiaryButton.d.ts +4 -1
  81. package/controls/TertiaryButton/TertiaryButton.js +3 -8
  82. package/controls/View/EllipsizedContent.d.ts +4 -1
  83. package/controls/View/EllipsizedContent.js +14 -1
  84. package/controls/View/ScrollingContent.d.ts +4 -1
  85. package/controls/View/ScrollingContent.js +14 -1
  86. package/controls/View/View.d.ts +6 -1
  87. package/controls/View/View.js +5 -4
  88. package/formatters/DateTime/DateTime.d.ts +46 -8
  89. package/formatters/DateTime/DateTime.js +14 -10
  90. package/formatters/DateTime/elements/Custom.d.ts +6 -17
  91. package/formatters/DateTime/elements/Custom.js +1 -0
  92. package/formatters/DateTime/elements/DistanceDate.d.ts +14 -0
  93. package/formatters/DateTime/elements/{Distance.js → DistanceDate.js} +1 -0
  94. package/formatters/DateTime/elements/LongDate.d.ts +23 -13
  95. package/formatters/DateTime/elements/LongDate.js +31 -5
  96. package/formatters/DateTime/elements/LongDateTime.d.ts +29 -13
  97. package/formatters/DateTime/elements/LongDateTime.js +28 -1
  98. package/formatters/DateTime/elements/LongTime.d.ts +25 -13
  99. package/formatters/DateTime/elements/LongTime.js +23 -1
  100. package/formatters/DateTime/elements/ShortDate.d.ts +27 -13
  101. package/formatters/DateTime/elements/ShortDate.js +28 -1
  102. package/formatters/DateTime/elements/ShortDateTime.d.ts +27 -13
  103. package/formatters/DateTime/elements/ShortDateTime.js +28 -1
  104. package/formatters/DateTime/elements/ShortTime.d.ts +13 -12
  105. package/formatters/DateTime/elements/ShortTime.js +19 -5
  106. package/formatters/DateTime/elements/index.d.ts +8 -0
  107. package/formatters/DateTime/elements/index.js +8 -0
  108. package/formatters/Filesize/Filesize.d.ts +23 -14
  109. package/formatters/Filesize/Filesize.js +33 -42
  110. package/formatters/GIS/Latitude.d.ts +11 -5
  111. package/formatters/GIS/Latitude.js +26 -3
  112. package/formatters/GIS/Longitude.d.ts +9 -5
  113. package/formatters/GIS/Longitude.js +24 -3
  114. package/formatters/Highlight/Highlight.d.ts +21 -6
  115. package/formatters/Highlight/Highlight.js +37 -19
  116. package/formatters/Human/Human.d.ts +18 -7
  117. package/formatters/Human/Human.js +17 -25
  118. package/formatters/Number/Number.d.ts +10 -2
  119. package/formatters/Number/Number.js +13 -7
  120. package/helper/DMS.d.ts +44 -6
  121. package/helper/DMS.js +86 -24
  122. package/package.json +1 -1
  123. package/controls/Dropzone/Dropbox.d.ts +0 -19
  124. package/controls/Dropzone/Dropbox.js +0 -47
  125. package/controls/ListView/Ghost.d.ts +0 -9
  126. package/controls/ListView/SortButton.js +0 -26
  127. package/formatters/DateTime/elements/Distance.d.ts +0 -24
  128. package/formatters/GIS/toDMS.d.ts +0 -2
  129. package/formatters/GIS/toDMS.js +0 -16
  130. /package/controls/ListView/{sortItems.d.ts → elements/sortItems.d.ts} +0 -0
  131. /package/controls/ListView/{sortItems.js → elements/sortItems.js} +0 -0
@@ -7,5 +7,8 @@ interface IProps {
7
7
  /** If set, add a margin around the message box. */
8
8
  margin?: boolean;
9
9
  }
10
- declare const NoFilteredData: (props: IProps) => React.JSX.Element;
10
+ declare const NoFilteredData: {
11
+ (props: IProps): React.JSX.Element;
12
+ displayName: string;
13
+ };
11
14
  export { NoFilteredData, IProps };
@@ -6,4 +6,5 @@ var NoFilteredData = function (props) {
6
6
  return React.createElement(Message, { margin: props.margin }, (_a = props.children) !== null && _a !== void 0 ? _a : "No records found. Your query may be too restrictive.",
7
7
  props.onClear && React.createElement(TertiaryButton, { onClick: props.onClear }, "CLEAR FILTER"));
8
8
  };
9
+ NoFilteredData.displayName = "Message.NoFilteredData";
9
10
  export { NoFilteredData };
@@ -12,10 +12,10 @@ interface IProps {
12
12
  */
13
13
  disabled?: boolean;
14
14
  /**
15
- * Triggered when the X button on the `Chip` is clicked, or when Delete is
16
- * pressed while the `Chip` has focus.
15
+ * Triggered when the X button on the `Chip` is clicked, or when
16
+ * Delete/Backspace is pressed while the `Chip` has focus.
17
17
  */
18
- onClick?: () => void;
18
+ onClick: (e?: React.MouseEvent | React.KeyboardEvent) => void;
19
19
  }
20
20
  /**
21
21
  * A set of `Chip` instances show consecutive user inputs and are individually
@@ -31,5 +31,8 @@ interface IProps {
31
31
  * is not a string but JSX. If `verticalAlign` is enabled, the Chip
32
32
  * content is no longer ellipsized.
33
33
  */
34
- declare const Chip: ({ disabled, ...props }: IProps) => React.JSX.Element;
34
+ declare const Chip: {
35
+ ({ disabled, ...props }: IProps): React.JSX.Element;
36
+ displayName: string;
37
+ };
35
38
  export { Chip, IProps };
@@ -29,23 +29,22 @@ import styled, { css } from 'styled-components';
29
29
  import { SVG } from '../../svg';
30
30
  var ChipBase = function (props) {
31
31
  var handleKeyDown = function (e) {
32
+ // A disable chip doesn't listen to the keyboard.
32
33
  if (props.disabled)
33
34
  return;
34
- if (e.key == 'Delete') {
35
+ // Pressing Delete or Backspace fires the onClick event.
36
+ if (e.key == 'Delete' || e.key == 'Backspace') {
35
37
  e.stopPropagation();
36
- if (props.onClick)
37
- props.onClick();
38
+ props.onClick(e);
38
39
  }
39
40
  };
40
- return (
41
- // "".chip" class is used, in the CSS, to check whether the previous
42
- // sibling is also a Chip.
43
- React.createElement("div", { className: "".concat(props.className, " chip"), tabIndex: 0, onKeyDown: handleKeyDown },
44
- React.createElement("div", { tabIndex: -1 }, props.children),
45
- React.createElement("svg", { onClick: props.onClick },
46
- React.createElement("use", { xlinkHref: SVG.Icons.Cross }))));
41
+ return (React.createElement("div", { className: props.className, tabIndex: 0, onKeyDown: handleKeyDown, "aria-disabled": props.disabled },
42
+ React.createElement("span", { className: "inner", tabIndex: -1 }, props.children),
43
+ React.createElement("button", { type: "button", onClick: props.onClick, "aria-label": "Remove chip", disabled: props.disabled, "aria-disabled": props.disabled },
44
+ React.createElement("svg", null,
45
+ React.createElement("use", { xlinkHref: SVG.Icons.Cross })))));
47
46
  };
48
- var ChipStyled = styled(ChipBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n // Dimensions:\n min-width: 80px;\n max-width: 150px;\n width: auto;\n height: 24px;\n padding: 0 3px 0 12px;\n\n // Appearance:\n background-color: ", ";\n border: none;\n color: ", ";\n border-radius: 12px;\n user-select: none;\n outline: none;\n\n display: inline-flex;\n align-items: center;\n gap: 4px; // Gap between content and \"X\".\n margin-right: 2px; \n\n // Spacing from previous Chip.\n .chip + & {\n margin-left: 2px;\n }\n\n font: ", ";\n\n & > div {\n flex: 1;\n overflow-x: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n pointer-events: none;\n }\n\n & > svg {\n transition: fill ", "ms ease-in-out,\n background-color ", "ms ease-in-out;\n fill: ", ";\n box-sizing: border-box;\n width: 18px;\n height: 18px;\n padding: 2px;\n border-radius: 50%;\n cursor: pointer;\n }\n\n &:focus {\n outline: solid 2px ", ";;\n }\n\n // When Chip is hovered, svg is colored.\n &:hover {\n & > svg {\n background-color: ", ";\n fill: ", ";\n }\n }\n\n & > svg:active {\n background-color: ", ";\n fill: ", ";\n }\n\n ", "\n"], ["\n // Dimensions:\n min-width: 80px;\n max-width: 150px;\n width: auto;\n height: 24px;\n padding: 0 3px 0 12px;\n\n // Appearance:\n background-color: ", ";\n border: none;\n color: ", ";\n border-radius: 12px;\n user-select: none;\n outline: none;\n\n display: inline-flex;\n align-items: center;\n gap: 4px; // Gap between content and \"X\".\n margin-right: 2px; \n\n // Spacing from previous Chip.\n .chip + & {\n margin-left: 2px;\n }\n\n font: ", ";\n\n & > div {\n flex: 1;\n overflow-x: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n pointer-events: none;\n }\n\n & > svg {\n transition: fill ", "ms ease-in-out,\n background-color ", "ms ease-in-out;\n fill: ", ";\n box-sizing: border-box;\n width: 18px;\n height: 18px;\n padding: 2px;\n border-radius: 50%;\n cursor: pointer;\n }\n\n &:focus {\n outline: solid 2px ", ";;\n }\n\n // When Chip is hovered, svg is colored.\n &:hover {\n & > svg {\n background-color: ", ";\n fill: ", ";\n }\n }\n\n & > svg:active {\n background-color: ", ";\n fill: ", ";\n }\n\n ", "\n"
47
+ var ChipStyled = styled(ChipBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n // Dimensions:\n min-width: 80px;\n max-width: 150px;\n width: auto;\n height: 24px;\n padding: 0 3px 0 12px;\n\n // Appearance:\n background-color: ", ";\n border: none;\n color: ", ";\n border-radius: 12px;\n user-select: none;\n outline: none;\n\n display: inline-flex;\n align-items: center;\n gap: 4px; // Gap between content and \"X\".\n margin-right: 2px; \n\n // Spacing from previous Chip.\n & + & {\n margin-left: 2px;\n }\n\n font: ", ";\n\n span.inner {\n flex: 1;\n overflow-x: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n pointer-events: none;\n }\n\n & > button {\n border: none;\n background: transparent;\n outline: none;\n padding: none;\n margin: none;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n\n & > button {\n svg {\n transition: fill ", "ms ease-in-out,\n background-color ", "ms ease-in-out;\n fill: ", ";\n box-sizing: border-box;\n width: 18px;\n height: 18px;\n padding: 2px;\n border-radius: 50%;\n cursor: pointer;\n }\n }\n\n &:focus {\n outline: solid 2px ", ";;\n }\n\n // When Chip is hovered, svg is colored.\n &:hover {\n & button > svg {\n background-color: ", ";\n fill: ", ";\n }\n }\n\n & > button svg:active {\n background-color: ", ";\n fill: ", ";\n }\n\n ", "\n"], ["\n // Dimensions:\n min-width: 80px;\n max-width: 150px;\n width: auto;\n height: 24px;\n padding: 0 3px 0 12px;\n\n // Appearance:\n background-color: ", ";\n border: none;\n color: ", ";\n border-radius: 12px;\n user-select: none;\n outline: none;\n\n display: inline-flex;\n align-items: center;\n gap: 4px; // Gap between content and \"X\".\n margin-right: 2px; \n\n // Spacing from previous Chip.\n & + & {\n margin-left: 2px;\n }\n\n font: ", ";\n\n span.inner {\n flex: 1;\n overflow-x: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n pointer-events: none;\n }\n\n & > button {\n border: none;\n background: transparent;\n outline: none;\n padding: none;\n margin: none;\n height: 100%;\n display: flex;\n flex-direction: column;\n justify-content: center;\n }\n\n & > button {\n svg {\n transition: fill ", "ms ease-in-out,\n background-color ", "ms ease-in-out;\n fill: ", ";\n box-sizing: border-box;\n width: 18px;\n height: 18px;\n padding: 2px;\n border-radius: 50%;\n cursor: pointer;\n }\n }\n\n &:focus {\n outline: solid 2px ", ";;\n }\n\n // When Chip is hovered, svg is colored.\n &:hover {\n & button > svg {\n background-color: ", ";\n fill: ", ";\n }\n }\n\n & > button svg:active {\n background-color: ", ";\n fill: ", ";\n }\n\n ", "\n"
49
48
  /**
50
49
  * A set of `Chip` instances show consecutive user inputs and are individually
51
50
  * deselected. The "X" on a `Chip` is clickable. A `Chip` can have keyboard focus:
@@ -60,7 +59,7 @@ var ChipStyled = styled(ChipBase)(templateObject_2 || (templateObject_2 = __make
60
59
  * is not a string but JSX. If `verticalAlign` is enabled, the Chip
61
60
  * content is no longer ellipsized.
62
61
  */
63
- ])), function (p) { return p.theme.colors.neutral[10]; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.theme.font.labelSmall; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.colors.neutral[50]; }, function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.theme.colors.primary[2]; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.disabled && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n pointer-events: none;\n cursor: auto;\n background-color: ", ";\n color: ", ";\n & > svg {\n fill: ", ";\n }\n "], ["\n pointer-events: none;\n cursor: auto;\n background-color: ", ";\n color: ", ";\n & > svg {\n fill: ", ";\n }\n "])), function (p) { return p.theme.colors.neutral[50]; }, function (p) { return p.theme.colors.primary[3]; }, function (p) { return p.theme.colors.primary[3]; }); });
62
+ ])), function (p) { return p.theme.colors.neutral[10]; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.theme.font.labelSmall; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.colors.neutral[50]; }, function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.theme.colors.primary[2]; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.disabled && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n pointer-events: none;\n cursor: auto;\n background-color: ", ";\n color: ", ";\n & > button svg {\n fill: ", ";\n }\n "], ["\n pointer-events: none;\n cursor: auto;\n background-color: ", ";\n color: ", ";\n & > button svg {\n fill: ", ";\n }\n "])), function (p) { return p.theme.colors.neutral[50]; }, function (p) { return p.theme.colors.primary[3]; }, function (p) { return p.theme.colors.primary[3]; }); });
64
63
  /**
65
64
  * A set of `Chip` instances show consecutive user inputs and are individually
66
65
  * deselected. The "X" on a `Chip` is clickable. A `Chip` can have keyboard focus:
@@ -79,5 +78,6 @@ var Chip = function (_a) {
79
78
  var _b = _a.disabled, disabled = _b === void 0 ? false : _b, props = __rest(_a, ["disabled"]);
80
79
  return React.createElement(ChipStyled, __assign({ disabled: disabled }, props));
81
80
  };
81
+ Chip.displayName = "Chip";
82
82
  export { Chip };
83
83
  var templateObject_1, templateObject_2;
@@ -1,9 +1,7 @@
1
1
  import * as React from 'react';
2
- interface IDropzoneProps {
2
+ interface IProps {
3
3
  /** @ignore */
4
4
  className?: string;
5
- /** @ignore */
6
- children?: React.ReactNode;
7
5
  /**
8
6
  * If set, allows a file filter, e.g. `.xls,.xlsx`.
9
7
  * This does _not_ prevent the user to upload another kind of file.
@@ -15,21 +13,27 @@ interface IDropzoneProps {
15
13
  */
16
14
  onAddFiles: (files: File[]) => void;
17
15
  /**
18
- * Optional translation override for Dropzone message.
16
+ * Optional translation override for Dropzone message. This can be JSX.
19
17
  */
20
18
  message?: React.ReactNode;
19
+ /**
20
+ * A `Dropzone` can be disabled and will not accept files.
21
+ */
22
+ disabled?: boolean;
21
23
  }
22
24
  /**
23
- * A `Dropzone` accepts files, either by dragging them into the zone or by clicking the
24
- * zone and selection files. Multiple files may be dragged or selected at the same
25
- * time. When files are selected, Dropzone fires `onAddFiles` with a `Files[]` argument.
25
+ * A `Dropzone` accepts files, either by dragging them into the zone or by
26
+ * clicking the dropzone and selecting files from a dialog box. Multiple
27
+ * files may be dragged or selected at the same time. When files are selected,
28
+ * Dropzone fires `onAddFiles` with a `Files[]` argument.
26
29
  *
27
30
  * @example
28
31
  * <Dropzone
29
32
  * onAddFiles={(files: File[]) => console.log("Files dropped", files)}
30
33
  * />
31
- *
32
- * @link https://henck.github.io/typeui/?path=/story/controls-dropzone--properties
33
34
  */
34
- declare const Dropzone: (props: IDropzoneProps) => React.JSX.Element;
35
+ declare const Dropzone: {
36
+ ({ disabled, ...props }: IProps): React.JSX.Element;
37
+ displayName: string;
38
+ };
35
39
  export { Dropzone };
@@ -1,30 +1,98 @@
1
+ var __makeTemplateObject = (this && this.__makeTemplateObject) || function (cooked, raw) {
2
+ if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
3
+ return cooked;
4
+ };
5
+ var __assign = (this && this.__assign) || function () {
6
+ __assign = Object.assign || function(t) {
7
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
8
+ s = arguments[i];
9
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
10
+ t[p] = s[p];
11
+ }
12
+ return t;
13
+ };
14
+ return __assign.apply(this, arguments);
15
+ };
16
+ var __rest = (this && this.__rest) || function (s, e) {
17
+ var t = {};
18
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
19
+ t[p] = s[p];
20
+ if (s != null && typeof Object.getOwnPropertySymbols === "function")
21
+ for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
22
+ if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
23
+ t[p[i]] = s[p[i]];
24
+ }
25
+ return t;
26
+ };
1
27
  import * as React from 'react';
2
- // Other controls
3
- import { Dropbox } from './Dropbox';
28
+ import styled, { css } from 'styled-components';
29
+ import { SVG } from '../../svg';
30
+ var DropzoneBase = function (props) {
31
+ var _a;
32
+ var _b = React.useState(false), hover = _b[0], setHover = _b[1];
33
+ var inputElement = React.useRef(null);
34
+ var handleClick = function () {
35
+ inputElement.current.click();
36
+ };
37
+ var handleAddFile = function (e) {
38
+ props.onAddFiles(Array.from(e.target.files));
39
+ };
40
+ // DragOver and DragLeave add a hover effect.
41
+ var handleDragOver = function (e) {
42
+ // Limit event to files only:
43
+ if (!e.dataTransfer.types.includes("Files"))
44
+ return;
45
+ setHover(true);
46
+ e.preventDefault();
47
+ };
48
+ var handleDragLeave = function (e) {
49
+ setHover(false);
50
+ };
51
+ var handleDrop = function (e) {
52
+ e.preventDefault();
53
+ setHover(false);
54
+ props.onAddFiles(Array.from(e.dataTransfer.files));
55
+ };
56
+ return (React.createElement("button", { type: "button", className: "".concat(props.className, " ").concat(hover ? 'hover' : ''), onClick: handleClick, onDragOver: handleDragOver, onDragLeave: handleDragLeave, onDrop: handleDrop, onKeyDown: function (e) {
57
+ if (e.key === 'Enter' || e.key === ' ') {
58
+ e.preventDefault();
59
+ handleClick();
60
+ }
61
+ }, disabled: props.disabled, "aria-label": "File upload dropzone" },
62
+ React.createElement("div", { className: "message" }, (_a = props.message) !== null && _a !== void 0 ? _a : "Drop a file here to upload, or click to select."),
63
+ React.createElement("svg", { "aria-hidden": "true", focusable: "false" },
64
+ React.createElement("use", { xlinkHref: SVG.Other.CloudUpload })),
65
+ React.createElement("input", { ref: inputElement, type: "file", accept: props.accept, multiple: true, onChange: handleAddFile })));
66
+ };
67
+ var DropzoneStyled = styled(DropzoneBase)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n position: relative;\n border: dashed 2px ", ";\n border-radius: ", "px;\n cursor: ", ";\n width: 100%;\n text-align: center;\n background-color: transparent;\n transition: \n border-color ease-in-out 75ms, \n background-color ease-in-out 75ms;\n\n & > div.message {\n margin-top: 8px;\n font-weight: 500;\n color: ", ";\n transition: color ease-in-out 75ms;\n }\n\n & > svg {\n display: block;\n margin: 8px;\n width: 100%;\n height: 150px;\n fill: ", ";\n\n transition: fill ease-in-out 75ms, transform ease-in-out 500ms;\n }\n\n ", "\n\n & > input {\n display: none;\n }\n"], ["\n position: relative;\n border: dashed 2px ", ";\n border-radius: ", "px;\n cursor: ", ";\n width: 100%;\n text-align: center;\n background-color: transparent;\n transition: \n border-color ease-in-out 75ms, \n background-color ease-in-out 75ms;\n\n & > div.message {\n margin-top: 8px;\n font-weight: 500;\n color: ", ";\n transition: color ease-in-out 75ms;\n }\n\n & > svg {\n display: block;\n margin: 8px;\n width: 100%;\n height: 150px;\n fill: ", ";\n\n transition: fill ease-in-out 75ms, transform ease-in-out 500ms;\n }\n\n ", "\n\n & > input {\n display: none;\n }\n"
68
+ /**
69
+ * A `Dropzone` accepts files, either by dragging them into the zone or by
70
+ * clicking the dropzone and selecting files from a dialog box. Multiple
71
+ * files may be dragged or selected at the same time. When files are selected,
72
+ * Dropzone fires `onAddFiles` with a `Files[]` argument.
73
+ *
74
+ * @example
75
+ * <Dropzone
76
+ * onAddFiles={(files: File[]) => console.log("Files dropped", files)}
77
+ * />
78
+ */
79
+ ])), function (p) { return p.theme.colors.neutral[80]; }, function (p) { return p.theme.radius.normal; }, function (p) { return p.disabled ? 'auto' : 'pointer'; }, function (p) { return p.theme.colors.neutral[80]; }, function (p) { return p.disabled ? p.theme.colors.neutral[50] : p.theme.colors.primary[2]; }, function (p) { return !p.disabled && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &.hover, &:hover {\n background-color: ", ";\n border-color: ", ";\n & > div.message {\n color: ", ";\n }\n & > svg {\n fill: ", ";\n transform: translateY(-8px);\n }\n }\n "], ["\n &.hover, &:hover {\n background-color: ", ";\n border-color: ", ";\n & > div.message {\n color: ", ";\n }\n & > svg {\n fill: ", ";\n transform: translateY(-8px);\n }\n }\n "])), p.theme.colors.primary[3], p.theme.colors.neutral[100], p.theme.colors.neutral[100], p.theme.colors.primary[1]); });
4
80
  /**
5
- * A `Dropzone` accepts files, either by dragging them into the zone or by clicking the
6
- * zone and selection files. Multiple files may be dragged or selected at the same
7
- * time. When files are selected, Dropzone fires `onAddFiles` with a `Files[]` argument.
81
+ * A `Dropzone` accepts files, either by dragging them into the zone or by
82
+ * clicking the dropzone and selecting files from a dialog box. Multiple
83
+ * files may be dragged or selected at the same time. When files are selected,
84
+ * Dropzone fires `onAddFiles` with a `Files[]` argument.
8
85
  *
9
86
  * @example
10
87
  * <Dropzone
11
88
  * onAddFiles={(files: File[]) => console.log("Files dropped", files)}
12
89
  * />
13
- *
14
- * @link https://henck.github.io/typeui/?path=/story/controls-dropzone--properties
15
90
  */
16
- var Dropzone = function (props) {
17
- var _a = React.useState(false), hover = _a[0], setHover = _a[1];
18
- var handleAddFiles = function (files) {
19
- props.onAddFiles(files);
20
- setHover(false);
21
- };
22
- var handleDragOver = function () {
23
- setHover(true);
24
- };
25
- var handleDragLeave = function () {
26
- setHover(false);
27
- };
28
- return (React.createElement(Dropbox, { hover: hover, message: props.message, accept: props.accept, onDragover: handleDragOver, onDragLeave: handleDragLeave, onAddFiles: handleAddFiles }));
91
+ var Dropzone = function (_a) {
92
+ var _b = _a.disabled, disabled = _b === void 0 ? false : _b, props = __rest(_a, ["disabled"]);
93
+ return React.createElement(DropzoneStyled, __assign({ disabled: disabled }, props));
29
94
  };
95
+ // For React DevTools:
96
+ Dropzone.displayName = "Dropzone";
30
97
  export { Dropzone };
98
+ var templateObject_1, templateObject_2;
@@ -13,8 +13,7 @@ interface IProps {
13
13
  */
14
14
  icon: string | IIconProps;
15
15
  /**
16
- * A disabled button cannot be interacted with. This is implemented using
17
- * `pointer-events: none`.
16
+ * A disabled button cannot be interacted with.
18
17
  * @default false
19
18
  */
20
19
  disabled?: boolean;
@@ -49,10 +48,10 @@ interface IProps {
49
48
  /**
50
49
  * Fired when the button is clicked.
51
50
  */
52
- onClick: (e?: React.MouseEvent) => void;
51
+ onClick: (e?: React.MouseEvent<HTMLButtonElement>) => void;
53
52
  }
54
53
  /**
55
- * Floating action buttons (FABs) help people take primary ations and are used
54
+ * Floating action buttons (FABs) help people take primary actions and are used
56
55
  * to represent the most important action on a screen. A FAB renders as a
57
56
  * `<button>` element.
58
57
  *
@@ -70,5 +69,8 @@ interface IProps {
70
69
  * * The FAB can be in a `disabled` state where it cannot be clicked.
71
70
  * * The FAB can be in an `active` state where it appears depressed.
72
71
  */
73
- declare const Fab: ({ disabled, positive, negative, active, ...props }: IProps) => React.JSX.Element;
72
+ declare const Fab: {
73
+ ({ disabled, positive, negative, active, ...props }: IProps): React.JSX.Element;
74
+ displayName: string;
75
+ };
74
76
  export { Fab, IProps };
@@ -28,28 +28,28 @@ import * as React from 'react';
28
28
  import styled, { css } from 'styled-components';
29
29
  import { Icon } from '../Icon';
30
30
  var FabBase = function (props) {
31
- var handleClick = function (e) {
32
- if (props.disabled)
33
- return;
34
- if (props.onClick)
35
- props.onClick(e);
36
- };
37
- return (React.createElement("button", { tabIndex: props.disabled ? -1 : 0, className: props.className, onClick: handleClick, title: props.title },
38
- typeof props.icon == "string" && React.createElement(Icon, { url: props.icon }),
39
- typeof props.icon != "string" && React.createElement(Icon, __assign({}, props.icon)),
40
- props.children));
31
+ return React.createElement("button", { type: "button", className: props.className, onClick: props.onClick, title: props.title, disabled: props.disabled, "aria-disabled": props.disabled },
32
+ React.createElement(Icon, __assign({}, (typeof props.icon === 'string' ? { url: props.icon } : props.icon))),
33
+ props.children);
34
+ };
35
+ var getIconColor = function (p) {
36
+ if (p.disabled)
37
+ return p.theme.colors.primary[2];
38
+ if (p.positive)
39
+ return p.theme.colors.positive;
40
+ if (p.negative)
41
+ return p.theme.colors.negative;
42
+ if (p.color)
43
+ return p.color;
44
+ return p.theme.colors.primary[3];
41
45
  };
42
46
  var FabStyled = styled(FabBase).attrs(function (p) {
43
47
  return {
44
- iconColor: p.disabled ? p.theme.colors.primary[2]
45
- : p.positive ? p.theme.colors.positive
46
- : p.negative ? p.theme.colors.negative
47
- : p.color ? p.color
48
- : p.theme.colors.primary[3]
48
+ $iconColor: getIconColor(p)
49
49
  };
50
50
  })(templateObject_4 || (templateObject_4 = __makeTemplateObject([" \n // Size:\n height: 56px;\n padding-left: 16px;\n padding-right: 16px;\n\n // Font:\n font: ", ";\n color: ", ";\n\n // Presentation:\n background-color: ", ";\n transition: \n background-color ease-in-out ", "ms, \n box-shadow ease-in-out ", "ms, \n color ease-in-out ", "ms;\n border-radius: ", "px;\n border: none;\n cursor: pointer;\n user-select: none;\n outline: none;\n box-shadow: ", ";\n\n ", "\n\n &:focus {\n outline: solid 2px ", ";\n }\n\n // Content alignment:\n display: flex;\n flex-direction: row;\n justify-content: start;\n align-items: center;\n white-space: nowrap;\n flex-wrap: nowrap;\n gap: 12px;\n\n svg {\n fill: ", ";\n width: 24px !important;\n max-width: 24px;\n height: 24px !important;\n max-height: 24px;\n } \n\n // Special active state overrides other states:\n ", "\n\n ", "\n"], [" \n // Size:\n height: 56px;\n padding-left: 16px;\n padding-right: 16px;\n\n // Font:\n font: ", ";\n color: ", ";\n\n // Presentation:\n background-color: ", ";\n transition: \n background-color ease-in-out ", "ms, \n box-shadow ease-in-out ", "ms, \n color ease-in-out ", "ms;\n border-radius: ", "px;\n border: none;\n cursor: pointer;\n user-select: none;\n outline: none;\n box-shadow: ", ";\n\n ", "\n\n &:focus {\n outline: solid 2px ", ";\n }\n\n // Content alignment:\n display: flex;\n flex-direction: row;\n justify-content: start;\n align-items: center;\n white-space: nowrap;\n flex-wrap: nowrap;\n gap: 12px;\n\n svg {\n fill: ", ";\n width: 24px !important;\n max-width: 24px;\n height: 24px !important;\n max-height: 24px;\n } \n\n // Special active state overrides other states:\n ", "\n\n ", "\n"
51
51
  /**
52
- * Floating action buttons (FABs) help people take primary ations and are used
52
+ * Floating action buttons (FABs) help people take primary actions and are used
53
53
  * to represent the most important action on a screen. A FAB renders as a
54
54
  * `<button>` element.
55
55
  *
@@ -67,9 +67,9 @@ var FabStyled = styled(FabBase).attrs(function (p) {
67
67
  * * The FAB can be in a `disabled` state where it cannot be clicked.
68
68
  * * The FAB can be in an `active` state where it appears depressed.
69
69
  */
70
- ])), function (p) { return p.theme.font.labelLarge; }, function (p) { return p.theme.colors.primary[3]; }, function (p) { return p.theme.colors.neutral[95]; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.radius.strong; }, function (p) { return p.theme.shadows.medium; }, function (p) { return !p.active && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:hover {\n background-color: ", ";\n box-shadow: ", ";\n }\n &:active {\n background-color: ", ";\n box-shadow: none;\n }\n "], ["\n &:hover {\n background-color: ", ";\n box-shadow: ", ";\n }\n &:active {\n background-color: ", ";\n box-shadow: none;\n }\n "])), function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.theme.shadows.large; }, function (p) { return p.theme.colors.neutral[100]; }); }, function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.iconColor; }, function (p) { return p.active && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n svg { fill: ", "; }\n box-shadow: ", ";\n "], ["\n background-color: ", ";\n color: ", ";\n svg { fill: ", "; }\n box-shadow: ", ";\n "])), p.theme.colors.primary[4], p.theme.colors.accent, p.theme.colors.accent, p.theme.shadows.inner); }, function (p) { return p.disabled && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n cursor: auto;\n pointer-events: none;\n color: ", ";\n background-color: ", ";\n box-shadow: none;\n svg {\n fill: ", ";\n }\n "], ["\n cursor: auto;\n pointer-events: none;\n color: ", ";\n background-color: ", ";\n box-shadow: none;\n svg {\n fill: ", ";\n }\n "])), p.theme.colors.primary[3], p.theme.colors.neutral[50], p.theme.colors.primary[3]); });
70
+ ])), function (p) { return p.theme.font.labelLarge; }, function (p) { return p.theme.colors.primary[3]; }, function (p) { return p.theme.colors.neutral[95]; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.radius.strong; }, function (p) { return p.theme.shadows.medium; }, function (p) { return !p.active && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n &:hover {\n background-color: ", ";\n box-shadow: ", ";\n }\n &:active {\n background-color: ", ";\n box-shadow: none;\n }\n "], ["\n &:hover {\n background-color: ", ";\n box-shadow: ", ";\n }\n &:active {\n background-color: ", ";\n box-shadow: none;\n }\n "])), function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.theme.shadows.large; }, function (p) { return p.theme.colors.neutral[100]; }); }, function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.$iconColor; }, function (p) { return p.active && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", ";\n color: ", ";\n svg { fill: ", "; }\n box-shadow: ", ";\n "], ["\n background-color: ", ";\n color: ", ";\n svg { fill: ", "; }\n box-shadow: ", ";\n "])), p.theme.colors.primary[4], p.theme.colors.accent, p.theme.colors.accent, p.theme.shadows.inner); }, function (p) { return p.disabled && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n cursor: auto;\n color: ", ";\n background-color: ", ";\n box-shadow: none;\n svg {\n fill: ", ";\n }\n "], ["\n cursor: auto;\n color: ", ";\n background-color: ", ";\n box-shadow: none;\n svg {\n fill: ", ";\n }\n "])), p.theme.colors.primary[3], p.theme.colors.neutral[50], p.theme.colors.primary[3]); });
71
71
  /**
72
- * Floating action buttons (FABs) help people take primary ations and are used
72
+ * Floating action buttons (FABs) help people take primary actions and are used
73
73
  * to represent the most important action on a screen. A FAB renders as a
74
74
  * `<button>` element.
75
75
  *
@@ -91,5 +91,6 @@ var Fab = function (_a) {
91
91
  var _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.positive, positive = _c === void 0 ? false : _c, _d = _a.negative, negative = _d === void 0 ? false : _d, _e = _a.active, active = _e === void 0 ? false : _e, props = __rest(_a, ["disabled", "positive", "negative", "active"]);
92
92
  return React.createElement(FabStyled, __assign({ disabled: disabled, positive: positive, negative: negative, active: active }, props));
93
93
  };
94
+ Fab.displayName = "Fab";
94
95
  export { Fab };
95
96
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -3,8 +3,7 @@ interface IProps {
3
3
  /** @ignore */
4
4
  className?: string;
5
5
  /**
6
- * A disabled button cannot be interacted with. This is implemented using
7
- * `pointer-events: none`.
6
+ * A disabled button cannot be interacted with.
8
7
  * @default false
9
8
  */
10
9
  disabled?: boolean;
@@ -28,9 +27,9 @@ interface IProps {
28
27
  onClick: (e?: React.MouseEvent) => void;
29
28
  }
30
29
  /**
31
- * A `FilterButton` is a button that can be in a depressed state, in order
32
- * to show that a filter is currently active. It should be combined with
33
- * a pane to select filter options.
30
+ * A `FilterButton` indicates whether a filter is active. It supports
31
+ * "depressed" and "highlighted" states to reflect UI status. It should be
32
+ * combined with a pane to select filter options.
34
33
  */
35
34
  declare const FilterButton: React.ForwardRefExoticComponent<IProps & React.RefAttributes<HTMLButtonElement>>;
36
35
  export { FilterButton, IProps };
@@ -29,35 +29,30 @@ import styled, { css } from 'styled-components';
29
29
  import { Icon } from '../Icon';
30
30
  import { SVG } from '../../svg';
31
31
  var FilterButtonBase = React.forwardRef(function (props, ref) {
32
- var handleClick = function (e) {
33
- if (props.disabled)
34
- return;
35
- if (props.onClick)
36
- props.onClick(e);
37
- };
38
- return (React.createElement("button", { ref: ref, tabIndex: props.disabled ? -1 : 0, className: props.className, onClick: handleClick, title: props.title },
39
- React.createElement(Icon, { url: SVG.Icons.Filter })));
32
+ return React.createElement("button", { className: props.className, ref: ref, type: "button", onClick: props.onClick, title: props.title, disabled: props.disabled, "aria-pressed": props.active, "aria-expanded": props.open, "aria-disabled": props.disabled },
33
+ React.createElement(Icon, { url: SVG.Icons.Filter }));
40
34
  });
41
35
  var FilterButtonStyled = styled(FilterButtonBase).attrs(function (p) {
42
36
  return {
43
- iconColor: p.disabled ? p.theme.colors.primary[2]
37
+ $iconColor: p.disabled ? p.theme.colors.primary[2]
44
38
  : p.theme.colors.neutral[100]
45
39
  };
46
40
  })(templateObject_4 || (templateObject_4 = __makeTemplateObject([" \n position: relative;\n // Size:\n height: 34px;\n\n // Presentation:\n background-color: ", ";\n transition: \n background-color ease-in-out ", "ms, \n box-shadow ease-in-out ", "ms;\n border-radius: ", "px;\n border: none;\n cursor: pointer;\n user-select: none;\n outline: none;\n box-shadow: ", ";\n\n &:hover {\n box-shadow: ", ";\n }\n &:active {\n background-color: ", " !important;\n box-shadow: ", ", ", ";\n }\n\n &:focus {\n outline: solid 2px ", ";\n }\n\n // Content alignment:\n display: flex;\n flex-direction: row;\n justify-content: start;\n align-items: center;\n\n svg {\n fill: ", ";\n width: 24px !important;\n max-width: 24px;\n height: 24px !important;\n max-height: 24px;\n } \n\n // Special active state overrides other states:\n ", "\n\n // Special open state overrides other states:\n ", " \n\n ", "\n"], [" \n position: relative;\n // Size:\n height: 34px;\n\n // Presentation:\n background-color: ", ";\n transition: \n background-color ease-in-out ", "ms, \n box-shadow ease-in-out ", "ms;\n border-radius: ", "px;\n border: none;\n cursor: pointer;\n user-select: none;\n outline: none;\n box-shadow: ", ";\n\n &:hover {\n box-shadow: ", ";\n }\n &:active {\n background-color: ", " !important;\n box-shadow: ", ", ", ";\n }\n\n &:focus {\n outline: solid 2px ", ";\n }\n\n // Content alignment:\n display: flex;\n flex-direction: row;\n justify-content: start;\n align-items: center;\n\n svg {\n fill: ", ";\n width: 24px !important;\n max-width: 24px;\n height: 24px !important;\n max-height: 24px;\n } \n\n // Special active state overrides other states:\n ", "\n\n // Special open state overrides other states:\n ", " \n\n ", "\n"
47
41
  /**
48
- * A `FilterButton` is a button that can be in a depressed state, in order
49
- * to show that a filter is currently active. It should be combined with
50
- * a pane to select filter options.
42
+ * A `FilterButton` indicates whether a filter is active. It supports
43
+ * "depressed" and "highlighted" states to reflect UI status. It should be
44
+ * combined with a pane to select filter options.
51
45
  */
52
- ])), function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.radius.normal; }, function (p) { return p.theme.shadows.large; }, function (p) { return p.theme.shadows.medium; }, function (p) { return p.theme.colors.primary[4]; }, function (p) { return function (p) { return p.theme.shadows.inner; }; }, function (p) { return p.theme.shadows.medium; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.iconColor; }, function (p) { return p.active && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n svg { fill: ", "; }\n "], ["\n background-color: ", ";\n svg { fill: ", "; }\n "])), p.theme.colors.accent, p.theme.colors.neutral[100]); }, function (p) { return p.open && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", " !important;\n box-shadow: ", ";\n &:hover {\n box-shadow: ", ";\n }\n "], ["\n background-color: ", " !important;\n box-shadow: ", ";\n &:hover {\n box-shadow: ", ";\n }\n "])), function (p) { return p.theme.colors.primary[4]; }, function (p) { return p.theme.shadows.inner; }, function (p) { return p.theme.shadows.inner; }); }, function (p) { return p.disabled && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n cursor: auto;\n pointer-events: none;\n background-color: ", ";\n box-shadow: none;\n svg {\n fill: ", ";\n }\n "], ["\n cursor: auto;\n pointer-events: none;\n background-color: ", ";\n box-shadow: none;\n svg {\n fill: ", ";\n }\n "])), p.theme.colors.neutral[50], p.theme.colors.primary[3]); });
46
+ ])), function (p) { return p.theme.colors.primary[1]; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.animation.duration; }, function (p) { return p.theme.radius.normal; }, function (p) { return p.theme.shadows.large; }, function (p) { return p.theme.shadows.medium; }, function (p) { return p.theme.colors.primary[4]; }, function (p) { return p.theme.shadows.inner; }, function (p) { return p.theme.shadows.medium; }, function (p) { return p.theme.colors.neutral[100]; }, function (p) { return p.$iconColor; }, function (p) { return p.active && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background-color: ", ";\n svg { fill: ", "; }\n "], ["\n background-color: ", ";\n svg { fill: ", "; }\n "])), p.theme.colors.accent, p.theme.colors.neutral[100]); }, function (p) { return p.open && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background-color: ", " !important;\n box-shadow: ", ";\n &:hover {\n box-shadow: ", ";\n }\n "], ["\n background-color: ", " !important;\n box-shadow: ", ";\n &:hover {\n box-shadow: ", ";\n }\n "])), function (p) { return p.theme.colors.primary[4]; }, function (p) { return p.theme.shadows.inner; }, function (p) { return p.theme.shadows.inner; }); }, function (p) { return p.disabled && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n cursor: auto;\n background-color: ", ";\n box-shadow: none;\n svg {\n fill: ", ";\n }\n "], ["\n cursor: auto;\n background-color: ", ";\n box-shadow: none;\n svg {\n fill: ", ";\n }\n "])), p.theme.colors.neutral[50], p.theme.colors.primary[3]); });
53
47
  /**
54
- * A `FilterButton` is a button that can be in a depressed state, in order
55
- * to show that a filter is currently active. It should be combined with
56
- * a pane to select filter options.
48
+ * A `FilterButton` indicates whether a filter is active. It supports
49
+ * "depressed" and "highlighted" states to reflect UI status. It should be
50
+ * combined with a pane to select filter options.
57
51
  */
58
52
  var FilterButton = React.forwardRef(function (_a, ref) {
59
53
  var _b = _a.disabled, disabled = _b === void 0 ? false : _b, _c = _a.active, active = _c === void 0 ? false : _c, props = __rest(_a, ["disabled", "active"]);
60
54
  return React.createElement(FilterButtonStyled, __assign({ ref: ref, disabled: disabled, active: active }, props));
61
55
  });
56
+ FilterButton.displayName = "FilterButton";
62
57
  export { FilterButton };
63
58
  var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
@@ -25,7 +25,13 @@ interface IProps {
25
25
  checkered?: boolean;
26
26
  }
27
27
  /**
28
- * A `Gradient` draws a bar filled with a horizontal gradient, defined as an array of `IGradientStop`.
28
+ * A `Gradient` renders a horizontal color gradient bar.
29
+ * It accepts an array of `IGradientStop`, which defines colors and positions.
30
+ * Optional props control height, rounding, and transparency background
31
+ * visualization.
29
32
  */
30
- declare const Gradient: ({ thickness, checkered, ...props }: IProps) => React.JSX.Element;
33
+ declare const Gradient: {
34
+ ({ thickness, checkered, ...props }: IProps): React.JSX.Element;
35
+ displayName: string;
36
+ };
31
37
  export { Gradient };
@@ -25,21 +25,47 @@ var __rest = (this && this.__rest) || function (s, e) {
25
25
  return t;
26
26
  };
27
27
  import * as React from 'react';
28
- import styled, { css } from 'styled-components';
28
+ import styled from 'styled-components';
29
29
  var GradientBase = function (props) {
30
+ // Runtime guard:
31
+ if (!Array.isArray(props.gradientStops) || props.gradientStops.length === 0) {
32
+ console.warn("Gradient: Missing or invalid 'gradientStops'");
33
+ return null;
34
+ }
30
35
  return React.createElement("div", { className: props.className });
31
36
  };
32
- var GradientStyled = styled(GradientBase)(templateObject_4 || (templateObject_4 = __makeTemplateObject(["\n position: relative;\n height: ", "px;\n ", "\n ", "\n ", "\n"], ["\n position: relative;\n height: ", "px;\n ", "\n ", "\n ", "\n"
37
+ var generateGradient = function (stops) {
38
+ return "linear-gradient(to right, ".concat(stops.map(function (gs) { return "".concat(gs.color, " ").concat(gs.pos * 100, "%"); }).join(', '), ")");
39
+ };
40
+ var GradientStyled = styled(GradientBase).attrs(function (p) {
41
+ var _a;
42
+ var thickness = (_a = p.thickness) !== null && _a !== void 0 ? _a : 5;
43
+ var background = p.checkered
44
+ ? "".concat(generateGradient(p.gradientStops), ", repeating-conic-gradient(#808080 0% 25%, #fff 0% 50%) 50% / 10px 10px")
45
+ : generateGradient(p.gradientStops);
46
+ return {
47
+ $background: background,
48
+ $borderRadius: p.rounded ? "".concat(thickness / 2, "px") : undefined,
49
+ $height: "".concat(thickness, "px"),
50
+ };
51
+ })(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n position: relative;\n background: ", ";\n border-radius: ", ";\n height: ", ";\n"], ["\n position: relative;\n background: ", ";\n border-radius: ", ";\n height: ", ";\n"
33
52
  /**
34
- * A `Gradient` draws a bar filled with a horizontal gradient, defined as an array of `IGradientStop`.
53
+ * A `Gradient` renders a horizontal color gradient bar.
54
+ * It accepts an array of `IGradientStop`, which defines colors and positions.
55
+ * Optional props control height, rounding, and transparency background
56
+ * visualization.
35
57
  */
36
- ])), function (p) { return p.thickness; }, function (p) { return p.checkered && css(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n background: \n linear-gradient(to right, ", "),\n repeating-conic-gradient(#808080 0% 25%, #fff 0% 50%) 50% / 10px 10px;\n "], ["\n background: \n linear-gradient(to right, ", "),\n repeating-conic-gradient(#808080 0% 25%, #fff 0% 50%) 50% / 10px 10px;\n "])), p.gradientStops.map(function (gs) { return "".concat(gs.color, " ").concat(gs.pos * 100, "%"); }).join(', ')); }, function (p) { return !p.checkered && css(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n background: \n linear-gradient(to right, ", ");\n "], ["\n background: \n linear-gradient(to right, ", ");\n "])), p.gradientStops.map(function (gs) { return "".concat(gs.color, " ").concat(gs.pos * 100, "%"); }).join(', ')); }, function (p) { return p.rounded && css(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n border-radius: ", "px;\n "], ["\n border-radius: ", "px;\n "])), p.thickness / 2); });
58
+ ])), function (p) { return p.$background; }, function (p) { return p.$borderRadius; }, function (p) { return p.$height; });
37
59
  /**
38
- * A `Gradient` draws a bar filled with a horizontal gradient, defined as an array of `IGradientStop`.
60
+ * A `Gradient` renders a horizontal color gradient bar.
61
+ * It accepts an array of `IGradientStop`, which defines colors and positions.
62
+ * Optional props control height, rounding, and transparency background
63
+ * visualization.
39
64
  */
40
65
  var Gradient = function (_a) {
41
66
  var _b = _a.thickness, thickness = _b === void 0 ? 5 : _b, _c = _a.checkered, checkered = _c === void 0 ? false : _c, props = __rest(_a, ["thickness", "checkered"]);
42
67
  return React.createElement(GradientStyled, __assign({ thickness: thickness, checkered: checkered }, props));
43
68
  };
69
+ Gradient.displayName = "Gradient";
44
70
  export { Gradient };
45
- var templateObject_1, templateObject_2, templateObject_3, templateObject_4;
71
+ var templateObject_1;
@@ -1,8 +1,15 @@
1
1
  import { IGradientStop } from "../../Types";
2
+ /**
3
+ * PresetGradients contains predefined gradient stops for common colors.
4
+ */
2
5
  declare class PresetGradients {
3
- static Green: IGradientStop[];
4
- static Blue: IGradientStop[];
5
- static Red: IGradientStop[];
6
- static Rainbow: IGradientStop[];
6
+ /** Green gradient from light lime to dark teal */
7
+ static readonly Green: readonly IGradientStop[];
8
+ /** Blue gradient from pale cyan to deep navy */
9
+ static readonly Blue: readonly IGradientStop[];
10
+ /** Red gradient from dark maroon to bright red */
11
+ static readonly Red: readonly IGradientStop[];
12
+ /** Rainbow gradient from teal to yellow */
13
+ static readonly Rainbow: readonly IGradientStop[];
7
14
  }
8
15
  export { PresetGradients };
@@ -1,6 +1,10 @@
1
+ /**
2
+ * PresetGradients contains predefined gradient stops for common colors.
3
+ */
1
4
  var PresetGradients = /** @class */ (function () {
2
5
  function PresetGradients() {
3
6
  }
7
+ /** Green gradient from light lime to dark teal */
4
8
  PresetGradients.Green = [
5
9
  { pos: 0.00, color: '#cae170' },
6
10
  { pos: 0.25, color: '#7bca5d' },
@@ -8,6 +12,7 @@ var PresetGradients = /** @class */ (function () {
8
12
  { pos: 0.75, color: '#307c63' },
9
13
  { pos: 1.00, color: '#1a454f' },
10
14
  ];
15
+ /** Blue gradient from pale cyan to deep navy */
11
16
  PresetGradients.Blue = [
12
17
  { pos: 0.00, color: '#acf0f2' },
13
18
  { pos: 0.25, color: '#72bacc' },
@@ -15,6 +20,7 @@ var PresetGradients = /** @class */ (function () {
15
20
  { pos: 0.75, color: '#1a517e' },
16
21
  { pos: 1.00, color: '#002253' },
17
22
  ];
23
+ /** Red gradient from dark maroon to bright red */
18
24
  PresetGradients.Red = [
19
25
  { pos: 0.00, color: '#450003' },
20
26
  { pos: 0.25, color: '#6f111a' },
@@ -22,6 +28,7 @@ var PresetGradients = /** @class */ (function () {
22
28
  { pos: 0.75, color: '#cd3c3f' },
23
29
  { pos: 1.00, color: '#ff5252' },
24
30
  ];
31
+ /** Rainbow gradient from teal to yellow */
25
32
  PresetGradients.Rainbow = [
26
33
  { pos: 0.00, color: '#00796b' },
27
34
  { pos: 0.25, color: '#3993cb' },
@@ -67,10 +67,10 @@ interface IIconProps {
67
67
  }
68
68
  declare const IconBase: (props: IIconProps) => React.JSX.Element;
69
69
  interface IStyledProps {
70
- realSize?: string;
71
- color?: string;
70
+ $realSize: string;
71
+ $color: string;
72
72
  }
73
- declare const IconStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<IIconProps, IIconProps>, IStyledProps>, IIconProps>> & string & Omit<(props: IIconProps) => React.JSX.Element, keyof React.Component<any, {}, any>>;
73
+ declare const IconStyled: import("styled-components/dist/types").IStyledComponentBase<"web", import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<import("styled-components/dist/types").Substitute<IIconProps, IIconProps>, IIconProps & Partial<IStyledProps>>, IIconProps>> & string & Omit<(props: IIconProps) => React.JSX.Element, keyof React.Component<any, {}, any>>;
74
74
  /**
75
75
  * Displays an icon. An `Icon` is an SVG symbol taken from a sprite sheet,
76
76
  * with an URL of the form `spritesheet.svg#my-icon`.
@@ -94,5 +94,8 @@ declare const IconStyled: import("styled-components/dist/types").IStyledComponen
94
94
  * For exact sizing, `size` also accepts a size in pixels. An icon is always
95
95
  * square.
96
96
  */
97
- declare const Icon: ({ size, disabled, flipped, mirrored, animated, padded, circle, ...props }: IIconProps) => React.JSX.Element;
97
+ declare const Icon: {
98
+ ({ size, disabled, flipped, mirrored, animated, padded, circle, ...props }: IIconProps): React.JSX.Element;
99
+ displayName: string;
100
+ };
98
101
  export { IconBase, Icon, IconStyled, IIconProps };