@kaizen/components 1.70.24 → 1.71.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.
@@ -26,36 +26,49 @@ var CalendarPopover = function (_a) {
26
26
  var _b = React.useState(null),
27
27
  floatingElement = _b[0],
28
28
  setFloatingElement = _b[1];
29
- var floatingStyles = reactDom.useFloating(tslib.__assign({
30
- placement: 'bottom-start',
31
- elements: {
32
- reference: referenceElement,
33
- floating: floatingElement
34
- },
35
- strategy: 'fixed',
36
- middleware: [reactDom.size({
37
- apply: function (_a) {
38
- var availableHeight = _a.availableHeight,
39
- availableWidth = _a.availableWidth,
40
- elements = _a.elements;
41
- Object.assign(elements.floating.style, {
42
- // 155 is enough of a minimum to cut off half of the second row of dates.
43
- // This indicates to users that there is more content that is scrollable
44
- maxHeight: "".concat(Math.max(availableHeight - 25, 155), "px"),
45
- maxWidth: "".concat(availableWidth, "px")
46
- });
47
- }
48
- }), reactDom.offset(15), reactDom.autoPlacement({
49
- allowedPlacements: ['bottom-start', 'bottom', 'top-start', 'top']
50
- })],
51
- whileElementsMounted: reactDom.autoUpdate
52
- }, floatingOptions)).floatingStyles;
29
+ var _c = reactDom.useFloating(tslib.__assign({
30
+ placement: 'bottom-start',
31
+ elements: {
32
+ reference: referenceElement,
33
+ floating: floatingElement
34
+ },
35
+ strategy: 'fixed',
36
+ middleware: [reactDom.size({
37
+ apply: function (_a) {
38
+ var availableHeight = _a.availableHeight,
39
+ availableWidth = _a.availableWidth,
40
+ elements = _a.elements;
41
+ Object.assign(elements.floating.style, {
42
+ // 155 is enough of a minimum to cut off half of the second row of dates.
43
+ // This indicates to users that there is more content that is scrollable
44
+ maxHeight: "".concat(Math.max(availableHeight - 25, 155), "px"),
45
+ maxWidth: "".concat(availableWidth, "px")
46
+ });
47
+ }
48
+ }), reactDom.offset(15), reactDom.autoPlacement({
49
+ allowedPlacements: ['bottom-start', 'bottom', 'top-start', 'top']
50
+ })],
51
+ whileElementsMounted: reactDom.autoUpdate
52
+ }, floatingOptions)),
53
+ floatingStyles = _c.floatingStyles,
54
+ update = _c.update;
55
+ React.useEffect(function () {
56
+ var _a;
57
+ if (floatingElement && referenceElement) {
58
+ // @ts-expect-error this can be removed when we update to react 19
59
+ referenceElement.popoverTargetElement = floatingElement;
60
+ (_a = floatingElement.showPopover) === null || _a === undefined ? undefined : _a.call(floatingElement);
61
+ update();
62
+ }
63
+ }, [referenceElement, floatingElement, update]);
53
64
  return React__default.default.createElement("div", tslib.__assign({
54
65
  ref: setFloatingElement,
55
66
  style: floatingStyles,
56
67
  className: classnames__default.default(CalendarPopover_module.calendarPopover, classNameOverride),
57
68
  role: "dialog",
58
- "aria-modal": "true"
69
+ "aria-modal": "true",
70
+ // @ts-expect-error this can be removed when we update to react 19
71
+ popover: "manual"
59
72
  }, restProps), children);
60
73
  };
61
74
  CalendarPopover.displayName = 'CalendarPopover';
@@ -1,5 +1,5 @@
1
1
  import { __rest, __assign } from 'tslib';
2
- import React, { useState } from 'react';
2
+ import React, { useState, useEffect } from 'react';
3
3
  import { useFloating, size, offset, autoPlacement, autoUpdate } from '@floating-ui/react-dom';
4
4
  import classnames from 'classnames';
5
5
  import styles from './CalendarPopover.module.scss.mjs';
@@ -18,36 +18,49 @@ const CalendarPopover = /*#__PURE__*/function () {
18
18
  var _b = useState(null),
19
19
  floatingElement = _b[0],
20
20
  setFloatingElement = _b[1];
21
- var floatingStyles = useFloating(__assign({
22
- placement: 'bottom-start',
23
- elements: {
24
- reference: referenceElement,
25
- floating: floatingElement
26
- },
27
- strategy: 'fixed',
28
- middleware: [size({
29
- apply: function (_a) {
30
- var availableHeight = _a.availableHeight,
31
- availableWidth = _a.availableWidth,
32
- elements = _a.elements;
33
- Object.assign(elements.floating.style, {
34
- // 155 is enough of a minimum to cut off half of the second row of dates.
35
- // This indicates to users that there is more content that is scrollable
36
- maxHeight: "".concat(Math.max(availableHeight - 25, 155), "px"),
37
- maxWidth: "".concat(availableWidth, "px")
38
- });
39
- }
40
- }), offset(15), autoPlacement({
41
- allowedPlacements: ['bottom-start', 'bottom', 'top-start', 'top']
42
- })],
43
- whileElementsMounted: autoUpdate
44
- }, floatingOptions)).floatingStyles;
21
+ var _c = useFloating(__assign({
22
+ placement: 'bottom-start',
23
+ elements: {
24
+ reference: referenceElement,
25
+ floating: floatingElement
26
+ },
27
+ strategy: 'fixed',
28
+ middleware: [size({
29
+ apply: function (_a) {
30
+ var availableHeight = _a.availableHeight,
31
+ availableWidth = _a.availableWidth,
32
+ elements = _a.elements;
33
+ Object.assign(elements.floating.style, {
34
+ // 155 is enough of a minimum to cut off half of the second row of dates.
35
+ // This indicates to users that there is more content that is scrollable
36
+ maxHeight: "".concat(Math.max(availableHeight - 25, 155), "px"),
37
+ maxWidth: "".concat(availableWidth, "px")
38
+ });
39
+ }
40
+ }), offset(15), autoPlacement({
41
+ allowedPlacements: ['bottom-start', 'bottom', 'top-start', 'top']
42
+ })],
43
+ whileElementsMounted: autoUpdate
44
+ }, floatingOptions)),
45
+ floatingStyles = _c.floatingStyles,
46
+ update = _c.update;
47
+ useEffect(function () {
48
+ var _a;
49
+ if (floatingElement && referenceElement) {
50
+ // @ts-expect-error this can be removed when we update to react 19
51
+ referenceElement.popoverTargetElement = floatingElement;
52
+ (_a = floatingElement.showPopover) === null || _a === undefined ? undefined : _a.call(floatingElement);
53
+ update();
54
+ }
55
+ }, [referenceElement, floatingElement, update]);
45
56
  return /*#__PURE__*/React.createElement("div", __assign({
46
57
  ref: setFloatingElement,
47
58
  style: floatingStyles,
48
59
  className: classnames(styles.calendarPopover, classNameOverride),
49
60
  role: "dialog",
50
- "aria-modal": "true"
61
+ "aria-modal": "true",
62
+ // @ts-expect-error this can be removed when we update to react 19
63
+ popover: "manual"
51
64
  }, restProps), children);
52
65
  };
53
66
  CalendarPopover.displayName = 'CalendarPopover';
package/dist/styles.css CHANGED
@@ -3173,6 +3173,12 @@ input[type=range].InputRange-module_ratingScaleRange__gI-rs::-ms-thumb:not(:disa
3173
3173
  padding: var(--spacing-24, 1.5rem);
3174
3174
  }
3175
3175
  }
3176
+
3177
+ .CalendarPopover-module_calendarPopover__p2xp9[popover]:popover-open {
3178
+ z-index: unset;
3179
+ margin: 0;
3180
+ inset: unset;
3181
+ }
3176
3182
  /** THIS IS AN AUTOGENERATED FILE **/
3177
3183
  /** THIS IS AN AUTOGENERATED FILE **/
3178
3184
  /** THIS IS AN AUTOGENERATED FILE **/
@@ -10848,7 +10854,6 @@ input[type=range].InputRange-module_ratingScaleRange__gI-rs::-ms-thumb:not(:disa
10848
10854
  display: flex;
10849
10855
  align-items: center;
10850
10856
  min-width: 0;
10851
- z-index: 1000;
10852
10857
  transform: translateY(-0.0833em);
10853
10858
  }
10854
10859
  @media (max-width: 1365px) {
@@ -11162,7 +11167,7 @@ input[type=range].InputRange-module_ratingScaleRange__gI-rs::-ms-thumb:not(:disa
11162
11167
  width: 3.75rem;
11163
11168
  height: 3.75rem;
11164
11169
  background: linear-gradient(0deg, var(--color-purple-600, #5f3361), rgba(var(--color-purple-600-rgb, 95, 51, 97), 0));
11165
- z-index: 1020;
11170
+ z-index: 1;
11166
11171
  }
11167
11172
  }
11168
11173
  @media (max-width: 767px) {
@@ -11227,7 +11232,6 @@ input[type=range].InputRange-module_ratingScaleRange__gI-rs::-ms-thumb:not(:disa
11227
11232
  cursor: pointer;
11228
11233
  display: flex;
11229
11234
  position: absolute;
11230
- z-index: 1020;
11231
11235
  align-items: center;
11232
11236
  top: 50%;
11233
11237
  transform: translateY(-50%);
@@ -11275,7 +11279,6 @@ input[type=range].InputRange-module_ratingScaleRange__gI-rs::-ms-thumb:not(:disa
11275
11279
  position: absolute;
11276
11280
  white-space: nowrap;
11277
11281
  width: 1px;
11278
- z-index: 1019;
11279
11282
  inset-inline-end: auto;
11280
11283
  inset-inline-start: -3rem;
11281
11284
  position: absolute;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@kaizen/components",
3
- "version": "1.70.24",
3
+ "version": "1.71.0",
4
4
  "description": "Kaizen component library",
5
5
  "author": "Geoffrey Chong <geoff.chong@cultureamp.com>",
6
6
  "homepage": "https://cultureamp.design",
@@ -17,3 +17,11 @@
17
17
  padding: $spacing-24;
18
18
  }
19
19
  }
20
+
21
+ // Overrides for if the browser supports popovers. The inset unset is to fix a bug with RTL positioning https://github.com/floating-ui/floating-ui/issues/3221
22
+ // Margin 0 because default styling for [popover] is margin: auto to center it.
23
+ .calendarPopover[popover]:popover-open {
24
+ z-index: unset;
25
+ margin: 0;
26
+ inset: unset;
27
+ }
@@ -1,4 +1,4 @@
1
- import React, { useState, type HTMLAttributes } from 'react'
1
+ import React, { useEffect, useState, type HTMLAttributes } from 'react'
2
2
  import {
3
3
  autoPlacement,
4
4
  autoUpdate,
@@ -30,7 +30,7 @@ export const CalendarPopover = ({
30
30
  }: CalendarPopoverProps): JSX.Element => {
31
31
  const [floatingElement, setFloatingElement] = useState<HTMLDivElement | null>(null)
32
32
 
33
- const { floatingStyles } = useFloating({
33
+ const { floatingStyles, update } = useFloating({
34
34
  placement: 'bottom-start',
35
35
  elements: {
36
36
  reference: referenceElement,
@@ -57,6 +57,15 @@ export const CalendarPopover = ({
57
57
  ...floatingOptions,
58
58
  })
59
59
 
60
+ useEffect(() => {
61
+ if (floatingElement && referenceElement) {
62
+ // @ts-expect-error this can be removed when we update to react 19
63
+ referenceElement.popoverTargetElement = floatingElement
64
+ floatingElement.showPopover?.()
65
+ update()
66
+ }
67
+ }, [referenceElement, floatingElement, update])
68
+
60
69
  return (
61
70
  <div
62
71
  ref={setFloatingElement}
@@ -64,6 +73,8 @@ export const CalendarPopover = ({
64
73
  className={classnames(styles.calendarPopover, classNameOverride)}
65
74
  role="dialog"
66
75
  aria-modal="true"
76
+ // @ts-expect-error this can be removed when we update to react 19
77
+ popover="manual"
67
78
  {...restProps}
68
79
  >
69
80
  {children}
@@ -1,7 +1,6 @@
1
1
  import React from 'react'
2
2
  import { autoPlacement, offset, size } from '@floating-ui/react-dom'
3
3
  import { type Meta } from '@storybook/react'
4
- import { Text } from '~components/Text'
5
4
  import { StickerSheet, type StickerSheetStory } from '~storybook/components/StickerSheet'
6
5
  import { CalendarRange } from '../../CalendarRange'
7
6
  import { CalendarSingle } from '../../CalendarSingle'
@@ -150,56 +149,3 @@ export const StickerSheetRTL: StickerSheetStory = {
150
149
  textDirection: 'rtl',
151
150
  },
152
151
  }
153
-
154
- export const StickerSheetResponsive: StickerSheetStory = {
155
- name: 'Sticker Sheet (Responsive)',
156
- render: () => (
157
- <>
158
- <Text variant="intro-lede" classNameOverride="mb-12 ">
159
- CalendarSingle scaled to availableHeight
160
- </Text>
161
- <div className="h-[250px] p-12 bg-purple-100 overflow-hidden relative">
162
- <CalendarPopoverExample strategy="absolute">
163
- <CalendarSingle selected={new Date('2022-02-19')} />
164
- </CalendarPopoverExample>
165
- </div>
166
- <Text variant="intro-lede" classNameOverride="mb-12 ">
167
- CalendarRange scaled to availableHeight
168
- </Text>
169
- <div className="h-[250px] p-12 bg-purple-100 overflow-hidden relative">
170
- <CalendarPopoverExample strategy="absolute">
171
- <CalendarRange
172
- selected={{
173
- from: new Date('2022-02-19'),
174
- to: new Date('2022-03-04'),
175
- }}
176
- hasDivider
177
- />
178
- </CalendarPopoverExample>
179
- </div>
180
- <Text variant="intro-lede" classNameOverride="mb-12 mt-24">
181
- CalendarSingle scaled to availableWidth
182
- </Text>
183
- <div className="h-[250px] p-12 bg-purple-100 overflow-hidden relative w-[250px]">
184
- <CalendarPopoverExample strategy="absolute">
185
- <CalendarSingle selected={new Date('2022-03-19')} />
186
- </CalendarPopoverExample>
187
- </div>
188
- <Text variant="intro-lede" classNameOverride="mb-12 mt-24">
189
- CalendarRanger scaled to availableWidth
190
- </Text>
191
- <div className="h-[250px] p-12 bg-purple-100 overflow-hidden relative w-[250px]">
192
- <CalendarPopoverExample strategy="absolute">
193
- <CalendarRange
194
- data-testid="sb-final-calendar"
195
- selected={{
196
- from: new Date('2022-02-19'),
197
- to: new Date('2022-03-04'),
198
- }}
199
- hasDivider
200
- />
201
- </CalendarPopoverExample>
202
- </div>
203
- </>
204
- ),
205
- }
@@ -114,7 +114,6 @@ $tab-container-height-medium-and-small-collapsed: 0;
114
114
  display: flex;
115
115
  align-items: center;
116
116
  min-width: 0; // this is an important trick to prevent flexbox items from overflowing
117
- z-index: $ca-z-index-dropdown; // this ensures the page switcher dropdown sits over nav tabs
118
117
  transform: translateY(-0.0833em);
119
118
 
120
119
  .hasSubtitle & {
@@ -434,7 +433,7 @@ $tab-container-height-medium-and-small-collapsed: 0;
434
433
  width: $tab-container-height-small;
435
434
  height: $tab-container-height-small;
436
435
  background: linear-gradient(0deg, $color-purple-600, rgba($color-purple-600-rgb, 0));
437
- z-index: $ca-z-index-sticky;
436
+ z-index: 1;
438
437
  }
439
438
 
440
439
  .adminVariant & {
@@ -503,7 +502,6 @@ $tab-container-height-medium-and-small-collapsed: 0;
503
502
  cursor: pointer;
504
503
  display: flex;
505
504
  position: absolute;
506
- z-index: $ca-z-index-sticky;
507
505
  align-items: center;
508
506
  top: 50%;
509
507
  transform: translateY(-50%);
@@ -573,9 +571,6 @@ $tab-container-height-medium-and-small-collapsed: 0;
573
571
  // We are using visually hidden here instead of display:none so that a screen reader
574
572
  // navigating via 'read mode' (which doesn't trigger hover/focus) will still hear this link name
575
573
  @include visually-hidden;
576
-
577
- z-index: $ca-z-index-sticky - 1;
578
-
579
574
  @include ca-position($start: -2 * $ca-grid);
580
575
 
581
576
  position: absolute;