@speakapbv/dough-component-library 9.27.0 → 9.28.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.
@@ -35,7 +35,9 @@ export interface DropMenuProps {
35
35
  size?: Sizes.LARGE | Sizes.NORMAL | Sizes.SMALL | Sizes.XS;
36
36
  innerButtonSize?: Sizes.NORMAL | Sizes.SMALL;
37
37
  rightShift?: number;
38
+ topShift?: number;
38
39
  overlaySelector?: string;
39
40
  customClickHandler?: (e: MouseEvent) => void;
41
+ alwaysTop?: boolean;
40
42
  }
41
43
  export declare const DropMenu: React.ForwardRefExoticComponent<DropMenuProps & React.RefAttributes<DoughDropMenuRef>>;
@@ -8,6 +8,7 @@ export interface InputWrapperProps {
8
8
  width?: string;
9
9
  borderless?: boolean;
10
10
  filled?: boolean;
11
+ active?: boolean;
11
12
  disabled?: boolean;
12
13
  startElement?: ReactNode;
13
14
  endElement?: ReactNode;
package/dist/index.es.js CHANGED
@@ -1332,9 +1332,9 @@ var TOP_MARGIN = 4;
1332
1332
  var TOUP = "to-up";
1333
1333
  var TODOWN = "to-down";
1334
1334
  var DropArea = function (props) {
1335
- var _a = props.rightShift, rightShift = _a === void 0 ? 0 : _a, _b = props.closeOnClickOutside, closeOnClickOutside = _b === void 0 ? true : _b, _c = props.closeOnEscape, closeOnEscape = _c === void 0 ? true : _c;
1335
+ var _a = props.rightShift, rightShift = _a === void 0 ? 0 : _a, _b = props.topShift, topShift = _b === void 0 ? 0 : _b, _c = props.closeOnClickOutside, closeOnClickOutside = _c === void 0 ? true : _c, _d = props.closeOnEscape, closeOnEscape = _d === void 0 ? true : _d;
1336
1336
  var scrollLockId = useState(generateUID)[0];
1337
- var _d = useState(null), showDropArea = _d[0], setShowDropArea = _d[1];
1337
+ var _e = useState(null), showDropArea = _e[0], setShowDropArea = _e[1];
1338
1338
  var dropAreaWrapperRef = useRef(null);
1339
1339
  var dropAreaArrowRef = useRef(null);
1340
1340
  var dropAreaContainerRef = useRef(null);
@@ -1384,9 +1384,19 @@ var DropArea = function (props) {
1384
1384
  overlayRect.width - (rect.left + rect.width + rightShift);
1385
1385
  }
1386
1386
  var widthPercentage = (rect.width * 100) / overlayRect.width;
1387
- var topPosition = rect.top + rect.height + TOP_MARGIN + (props.showCaret ? 8 : 0);
1387
+ var topPosition = props.alwaysTop
1388
+ ? rect.top - dropAreaContentHeight - TOP_MARGIN + topShift
1389
+ : rect.top +
1390
+ topShift +
1391
+ rect.height +
1392
+ TOP_MARGIN +
1393
+ (props.showCaret ? 8 : 0);
1388
1394
  var bottomPosition = void 0;
1389
- if (topPosition + dropAreaContentHeight > overlayRect.height) {
1395
+ if (props.alwaysTop) {
1396
+ setDirection(TOUP);
1397
+ }
1398
+ else if (topPosition + dropAreaContentHeight >
1399
+ overlayRect.height) {
1390
1400
  bottomPosition =
1391
1401
  overlayRect.height -
1392
1402
  rect.top +
@@ -1528,9 +1538,9 @@ var css_248z$c = "/* COLORS */\n/* Typography*/\n/*Dennis should provide medium
1528
1538
  styleInject(css_248z$c);
1529
1539
 
1530
1540
  var DropMenu = forwardRef(function (_a, ref) {
1531
- var _b = _a.alignIconRight, alignIconRight = _b === void 0 ? false : _b, _c = _a.color, color = _c === void 0 ? Colors.TRANSPARENT : _c, _d = _a.closeOnClickOutside, closeOnClickOutside = _d === void 0 ? true : _d, _e = _a.closeOnEscape, closeOnEscape = _e === void 0 ? true : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.showCaret, showCaret = _g === void 0 ? true : _g, _h = _a.rightShift, rightShift = _h === void 0 ? 0 : _h, _j = _a.shadow, shadow = _j === void 0 ? false : _j, _k = _a.show, show = _k === void 0 ? false : _k, _l = _a.rounded, rounded = _l === void 0 ? true : _l, _m = _a.icon, icon = _m === void 0 ? React.createElement(EllipsisVIcon, null) : _m, _o = _a.size, size = _o === void 0 ? Sizes.SMALL : _o, _p = _a.innerButtonSize, innerButtonSize = _p === void 0 ? Sizes.NORMAL : _p, ButtonComponent = _a.ButtonComponent, className = _a.className, onOpen = _a.onOpen, onClose = _a.onClose, children = _a.children, asInvisibleLine = _a.asInvisibleLine, alignFromRight = _a.alignFromRight, alignToCenter = _a.alignToCenter, dataAttributes = _a.dataAttributes, padding = _a.padding, label = _a.label, fullWidth = _a.fullWidth, strictToReferenceWidth = _a.strictToReferenceWidth, buttonClassName = _a.buttonClassName, overlaySelector = _a.overlaySelector, overlayWidth = _a.overlayWidth, customClickHandler = _a.customClickHandler;
1541
+ var _b = _a.alignIconRight, alignIconRight = _b === void 0 ? false : _b, _c = _a.color, color = _c === void 0 ? Colors.TRANSPARENT : _c, _d = _a.closeOnClickOutside, closeOnClickOutside = _d === void 0 ? true : _d, _e = _a.closeOnEscape, closeOnEscape = _e === void 0 ? true : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.showCaret, showCaret = _g === void 0 ? true : _g, _h = _a.rightShift, rightShift = _h === void 0 ? 0 : _h, _j = _a.topShift, topShift = _j === void 0 ? 0 : _j, _k = _a.shadow, shadow = _k === void 0 ? false : _k, _l = _a.show, show = _l === void 0 ? false : _l, _m = _a.rounded, rounded = _m === void 0 ? true : _m, _o = _a.icon, icon = _o === void 0 ? React.createElement(EllipsisVIcon, null) : _o, _p = _a.size, size = _p === void 0 ? Sizes.SMALL : _p, _q = _a.innerButtonSize, innerButtonSize = _q === void 0 ? Sizes.NORMAL : _q, ButtonComponent = _a.ButtonComponent, className = _a.className, onOpen = _a.onOpen, onClose = _a.onClose, children = _a.children, asInvisibleLine = _a.asInvisibleLine, alignFromRight = _a.alignFromRight, alignToCenter = _a.alignToCenter, dataAttributes = _a.dataAttributes, padding = _a.padding, label = _a.label, fullWidth = _a.fullWidth, strictToReferenceWidth = _a.strictToReferenceWidth, buttonClassName = _a.buttonClassName, overlaySelector = _a.overlaySelector, overlayWidth = _a.overlayWidth, customClickHandler = _a.customClickHandler, alwaysTop = _a.alwaysTop;
1532
1542
  var componentRef = useRef(null);
1533
- var _q = useState(false), showDropArea = _q[0], setShowDropArea = _q[1];
1543
+ var _r = useState(false), showDropArea = _r[0], setShowDropArea = _r[1];
1534
1544
  var openDropArea = function (e) {
1535
1545
  var _a, _b;
1536
1546
  cancelEvent(e);
@@ -1626,7 +1636,7 @@ var DropMenu = forwardRef(function (_a, ref) {
1626
1636
  "dough-dropmenu-full-width": fullWidth,
1627
1637
  }), ref: componentRef }, dataAttributes),
1628
1638
  asInvisibleLine !== true && renderButtonComponent(),
1629
- React.createElement(DropArea, { overlaySelector: overlaySelector, rightShift: rightShift, alignFromRight: alignFromRight, alignToCenter: alignToCenter, closeOnClickOutside: closeOnClickOutside, closeOnEscape: closeOnEscape, onHide: closeDropArea, referenceElement: componentRef, show: showDropArea, showCaret: showCaret, strictToReferenceWidth: strictToReferenceWidth, width: overlayWidth || "auto" },
1639
+ React.createElement(DropArea, { overlaySelector: overlaySelector, rightShift: rightShift, topShift: topShift, alignFromRight: alignFromRight, alignToCenter: alignToCenter, closeOnClickOutside: closeOnClickOutside, closeOnEscape: closeOnEscape, onHide: closeDropArea, referenceElement: componentRef, show: showDropArea, showCaret: showCaret, strictToReferenceWidth: strictToReferenceWidth, alwaysTop: alwaysTop, width: overlayWidth || "auto" },
1630
1640
  React.createElement(LayoutContainer, { className: cn("dough-drop-menu-buttons-container", className), layoutType: Direction.VERTICAL, dataAttributes: dataAttributes }, getButtons()))));
1631
1641
  });
1632
1642
  DropMenu.displayName = "DropMenu";
@@ -1696,6 +1706,7 @@ var InputWrapper = function (props) {
1696
1706
  React.createElement("span", { onClick: props.onClick, className: cn("dough-input-element", "dough-color-input-border", "dough-text-input", "with-fields", {
1697
1707
  "dough-input-wrapper-clickable": props.onClick,
1698
1708
  filled: props.filled,
1709
+ active: props.active,
1699
1710
  "validation-error": props.validationResult &&
1700
1711
  !props.validationResult.valid,
1701
1712
  }) },
package/dist/index.js CHANGED
@@ -1317,9 +1317,9 @@ var TOP_MARGIN = 4;
1317
1317
  var TOUP = "to-up";
1318
1318
  var TODOWN = "to-down";
1319
1319
  var DropArea = function (props) {
1320
- var _a = props.rightShift, rightShift = _a === void 0 ? 0 : _a, _b = props.closeOnClickOutside, closeOnClickOutside = _b === void 0 ? true : _b, _c = props.closeOnEscape, closeOnEscape = _c === void 0 ? true : _c;
1320
+ var _a = props.rightShift, rightShift = _a === void 0 ? 0 : _a, _b = props.topShift, topShift = _b === void 0 ? 0 : _b, _c = props.closeOnClickOutside, closeOnClickOutside = _c === void 0 ? true : _c, _d = props.closeOnEscape, closeOnEscape = _d === void 0 ? true : _d;
1321
1321
  var scrollLockId = React.useState(generateUID)[0];
1322
- var _d = React.useState(null), showDropArea = _d[0], setShowDropArea = _d[1];
1322
+ var _e = React.useState(null), showDropArea = _e[0], setShowDropArea = _e[1];
1323
1323
  var dropAreaWrapperRef = React.useRef(null);
1324
1324
  var dropAreaArrowRef = React.useRef(null);
1325
1325
  var dropAreaContainerRef = React.useRef(null);
@@ -1369,9 +1369,19 @@ var DropArea = function (props) {
1369
1369
  overlayRect.width - (rect.left + rect.width + rightShift);
1370
1370
  }
1371
1371
  var widthPercentage = (rect.width * 100) / overlayRect.width;
1372
- var topPosition = rect.top + rect.height + TOP_MARGIN + (props.showCaret ? 8 : 0);
1372
+ var topPosition = props.alwaysTop
1373
+ ? rect.top - dropAreaContentHeight - TOP_MARGIN + topShift
1374
+ : rect.top +
1375
+ topShift +
1376
+ rect.height +
1377
+ TOP_MARGIN +
1378
+ (props.showCaret ? 8 : 0);
1373
1379
  var bottomPosition = void 0;
1374
- if (topPosition + dropAreaContentHeight > overlayRect.height) {
1380
+ if (props.alwaysTop) {
1381
+ setDirection(TOUP);
1382
+ }
1383
+ else if (topPosition + dropAreaContentHeight >
1384
+ overlayRect.height) {
1375
1385
  bottomPosition =
1376
1386
  overlayRect.height -
1377
1387
  rect.top +
@@ -1513,9 +1523,9 @@ var css_248z$c = "/* COLORS */\n/* Typography*/\n/*Dennis should provide medium
1513
1523
  styleInject(css_248z$c);
1514
1524
 
1515
1525
  var DropMenu = React.forwardRef(function (_a, ref) {
1516
- var _b = _a.alignIconRight, alignIconRight = _b === void 0 ? false : _b, _c = _a.color, color = _c === void 0 ? exports.Colors.TRANSPARENT : _c, _d = _a.closeOnClickOutside, closeOnClickOutside = _d === void 0 ? true : _d, _e = _a.closeOnEscape, closeOnEscape = _e === void 0 ? true : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.showCaret, showCaret = _g === void 0 ? true : _g, _h = _a.rightShift, rightShift = _h === void 0 ? 0 : _h, _j = _a.shadow, shadow = _j === void 0 ? false : _j, _k = _a.show, show = _k === void 0 ? false : _k, _l = _a.rounded, rounded = _l === void 0 ? true : _l, _m = _a.icon, icon = _m === void 0 ? React__default.createElement(EllipsisVIcon, null) : _m, _o = _a.size, size = _o === void 0 ? exports.Sizes.SMALL : _o, _p = _a.innerButtonSize, innerButtonSize = _p === void 0 ? exports.Sizes.NORMAL : _p, ButtonComponent = _a.ButtonComponent, className = _a.className, onOpen = _a.onOpen, onClose = _a.onClose, children = _a.children, asInvisibleLine = _a.asInvisibleLine, alignFromRight = _a.alignFromRight, alignToCenter = _a.alignToCenter, dataAttributes = _a.dataAttributes, padding = _a.padding, label = _a.label, fullWidth = _a.fullWidth, strictToReferenceWidth = _a.strictToReferenceWidth, buttonClassName = _a.buttonClassName, overlaySelector = _a.overlaySelector, overlayWidth = _a.overlayWidth, customClickHandler = _a.customClickHandler;
1526
+ var _b = _a.alignIconRight, alignIconRight = _b === void 0 ? false : _b, _c = _a.color, color = _c === void 0 ? exports.Colors.TRANSPARENT : _c, _d = _a.closeOnClickOutside, closeOnClickOutside = _d === void 0 ? true : _d, _e = _a.closeOnEscape, closeOnEscape = _e === void 0 ? true : _e, _f = _a.disabled, disabled = _f === void 0 ? false : _f, _g = _a.showCaret, showCaret = _g === void 0 ? true : _g, _h = _a.rightShift, rightShift = _h === void 0 ? 0 : _h, _j = _a.topShift, topShift = _j === void 0 ? 0 : _j, _k = _a.shadow, shadow = _k === void 0 ? false : _k, _l = _a.show, show = _l === void 0 ? false : _l, _m = _a.rounded, rounded = _m === void 0 ? true : _m, _o = _a.icon, icon = _o === void 0 ? React__default.createElement(EllipsisVIcon, null) : _o, _p = _a.size, size = _p === void 0 ? exports.Sizes.SMALL : _p, _q = _a.innerButtonSize, innerButtonSize = _q === void 0 ? exports.Sizes.NORMAL : _q, ButtonComponent = _a.ButtonComponent, className = _a.className, onOpen = _a.onOpen, onClose = _a.onClose, children = _a.children, asInvisibleLine = _a.asInvisibleLine, alignFromRight = _a.alignFromRight, alignToCenter = _a.alignToCenter, dataAttributes = _a.dataAttributes, padding = _a.padding, label = _a.label, fullWidth = _a.fullWidth, strictToReferenceWidth = _a.strictToReferenceWidth, buttonClassName = _a.buttonClassName, overlaySelector = _a.overlaySelector, overlayWidth = _a.overlayWidth, customClickHandler = _a.customClickHandler, alwaysTop = _a.alwaysTop;
1517
1527
  var componentRef = React.useRef(null);
1518
- var _q = React.useState(false), showDropArea = _q[0], setShowDropArea = _q[1];
1528
+ var _r = React.useState(false), showDropArea = _r[0], setShowDropArea = _r[1];
1519
1529
  var openDropArea = function (e) {
1520
1530
  var _a, _b;
1521
1531
  cancelEvent(e);
@@ -1611,7 +1621,7 @@ var DropMenu = React.forwardRef(function (_a, ref) {
1611
1621
  "dough-dropmenu-full-width": fullWidth,
1612
1622
  }), ref: componentRef }, dataAttributes),
1613
1623
  asInvisibleLine !== true && renderButtonComponent(),
1614
- React__default.createElement(DropArea, { overlaySelector: overlaySelector, rightShift: rightShift, alignFromRight: alignFromRight, alignToCenter: alignToCenter, closeOnClickOutside: closeOnClickOutside, closeOnEscape: closeOnEscape, onHide: closeDropArea, referenceElement: componentRef, show: showDropArea, showCaret: showCaret, strictToReferenceWidth: strictToReferenceWidth, width: overlayWidth || "auto" },
1624
+ React__default.createElement(DropArea, { overlaySelector: overlaySelector, rightShift: rightShift, topShift: topShift, alignFromRight: alignFromRight, alignToCenter: alignToCenter, closeOnClickOutside: closeOnClickOutside, closeOnEscape: closeOnEscape, onHide: closeDropArea, referenceElement: componentRef, show: showDropArea, showCaret: showCaret, strictToReferenceWidth: strictToReferenceWidth, alwaysTop: alwaysTop, width: overlayWidth || "auto" },
1615
1625
  React__default.createElement(LayoutContainer, { className: cn("dough-drop-menu-buttons-container", className), layoutType: exports.Direction.VERTICAL, dataAttributes: dataAttributes }, getButtons()))));
1616
1626
  });
1617
1627
  DropMenu.displayName = "DropMenu";
@@ -1681,6 +1691,7 @@ var InputWrapper = function (props) {
1681
1691
  React__default.createElement("span", { onClick: props.onClick, className: cn("dough-input-element", "dough-color-input-border", "dough-text-input", "with-fields", {
1682
1692
  "dough-input-wrapper-clickable": props.onClick,
1683
1693
  filled: props.filled,
1694
+ active: props.active,
1684
1695
  "validation-error": props.validationResult &&
1685
1696
  !props.validationResult.valid,
1686
1697
  }) },
@@ -14,7 +14,9 @@ export interface DropAreaProps {
14
14
  showCaret?: boolean;
15
15
  width?: number | string;
16
16
  rightShift?: number;
17
+ topShift?: number;
17
18
  overlaySelector?: string;
19
+ alwaysTop?: boolean;
18
20
  }
19
21
  export declare const DropArea: {
20
22
  (props: DropAreaProps): JSX.Element;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@speakapbv/dough-component-library",
3
- "version": "9.27.0",
3
+ "version": "9.28.0",
4
4
  "description": "DOUGH: Speakap React Component Library",
5
5
  "author": "Speakap",
6
6
  "license": "MIT",