@wix/editor-react-components 1.2856.0 → 1.2858.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.
@@ -1,6 +1,7 @@
1
1
  import { a as ACTIONS, E as ELEMENTS, N as NativeStateType, C as CSS_PROPERTIES, I as INTERACTIONS, D as DATA, L as LAYOUT, A as Archetype } from "../chunks/chunk-LDITHLYN.js";
2
2
  import { D as DesignStates, b as DisplayNames, c as DEFAULT_ICON_POSITION, C as COMPONENT_TYPE } from "../chunks/constants21.js";
3
3
  import { b as manifestFocusable, d as manifestMouseHover, e as manifestClickable } from "../chunks/manifestSdkMixins.js";
4
+ import { B as BACKDROP_FILTER_SPEC } from "../chunks/specs.js";
4
5
  const displayConfig = {
5
6
  displayValues: ["none", "block"]
6
7
  };
@@ -81,6 +82,23 @@ const manifest = {
81
82
  disablePositioning: false
82
83
  },
83
84
  cssProperties: {
85
+ backdropFilter: {
86
+ spec: BACKDROP_FILTER_SPEC,
87
+ backdropFilter: {
88
+ filterFunctions: [
89
+ CSS_PROPERTIES.FILTER_FUNCTION.blur,
90
+ CSS_PROPERTIES.FILTER_FUNCTION.brightness,
91
+ CSS_PROPERTIES.FILTER_FUNCTION.contrast,
92
+ CSS_PROPERTIES.FILTER_FUNCTION.dropShadow,
93
+ CSS_PROPERTIES.FILTER_FUNCTION.grayscale,
94
+ CSS_PROPERTIES.FILTER_FUNCTION.hueRotate,
95
+ CSS_PROPERTIES.FILTER_FUNCTION.invert,
96
+ CSS_PROPERTIES.FILTER_FUNCTION.opacity,
97
+ CSS_PROPERTIES.FILTER_FUNCTION.sepia,
98
+ CSS_PROPERTIES.FILTER_FUNCTION.saturate
99
+ ]
100
+ }
101
+ },
84
102
  background: {},
85
103
  boxShadow: {},
86
104
  borderInlineStart: {},
@@ -1,4 +1,5 @@
1
1
  import { A11y, Direction } from '@wix/editor-react-types';
2
+ import { SdkFunctionFocusableProps, SdkFunctionKeyboardProps } from '../../../utils/functions/sdkFunctionCallbackProps';
2
3
  /** A `localDate` data value: an ISO `YYYY-MM-DD` calendar date with no time or zone. */
3
4
  export type LocalDate = string;
4
5
  export type DatePickerElementProps = {
@@ -30,7 +31,7 @@ export type DatePickerElementProps = {
30
31
  className?: string;
31
32
  };
32
33
  };
33
- export type DatePickerProps = {
34
+ export type DatePickerProps = SdkFunctionFocusableProps & SdkFunctionKeyboardProps<HTMLElement> & {
34
35
  /** DOM `id` on the root `.datePicker` wrapper. */
35
36
  id: string;
36
37
  /** Appended to the root `.datePicker`. Use this for CSS-variable and per-element overrides. */
@@ -39,6 +40,8 @@ export type DatePickerProps = {
39
40
  value?: LocalDate;
40
41
  /** Fires with the date the visitor picked, or `undefined` when they cleared it. */
41
42
  onValueChange?: (value: LocalDate | undefined) => void;
43
+ /** Fires when the calendar popover opens or closes. */
44
+ onOpenChange?: (open: boolean) => void;
42
45
  /** Optional text label rendered above the field. */
43
46
  label?: string;
44
47
  /** Site-facing helper text rendered under the field. */
@@ -4158,6 +4158,7 @@ const DatePickerField = ({
4158
4158
  const keepOpen = () => false;
4159
4159
  const DatePickerCalendar = ({
4160
4160
  portalContainer,
4161
+ popoverRef,
4161
4162
  isPreviewOpen,
4162
4163
  elementProps
4163
4164
  }) => {
@@ -4247,6 +4248,7 @@ const DatePickerCalendar = ({
4247
4248
  /* @__PURE__ */ jsx(
4248
4249
  $07b14b47974efb58$export$5b6b19405a83ff9d,
4249
4250
  {
4251
+ ref: popoverRef,
4250
4252
  className: styles.positioner,
4251
4253
  containerPadding: 0,
4252
4254
  UNSTABLE_portalContainer: portalContainer ?? void 0,
@@ -4257,6 +4259,78 @@ const DatePickerCalendar = ({
4257
4259
  )
4258
4260
  );
4259
4261
  };
4262
+ const useFocusUnitEvents = ({
4263
+ root: root2,
4264
+ onFocus,
4265
+ onBlur,
4266
+ onOpenChange
4267
+ }) => {
4268
+ const popover2 = useRef(null);
4269
+ const popoverRef = (element) => {
4270
+ if (element) {
4271
+ popover2.current = element;
4272
+ }
4273
+ };
4274
+ const isFocused = useRef(false);
4275
+ const isCalendarOpen = useRef(false);
4276
+ const pendingBlur = useRef(null);
4277
+ const reportBlur = (event) => {
4278
+ isFocused.current = false;
4279
+ onBlur == null ? void 0 : onBlur(event);
4280
+ };
4281
+ const pendingCheck = useRef({});
4282
+ const cancelPendingCheck = () => {
4283
+ cancelAnimationFrame(pendingCheck.current.frame ?? 0);
4284
+ clearTimeout(pendingCheck.current.timeout);
4285
+ };
4286
+ const checkPendingBlur = () => {
4287
+ cancelPendingCheck();
4288
+ pendingCheck.current.frame = requestAnimationFrame(() => {
4289
+ pendingCheck.current.timeout = window.setTimeout(() => {
4290
+ const pending = pendingBlur.current;
4291
+ pendingBlur.current = null;
4292
+ if (pending && isFocused.current && !(root2 == null ? void 0 : root2.contains(root2.ownerDocument.activeElement))) {
4293
+ reportBlur(pending);
4294
+ }
4295
+ });
4296
+ });
4297
+ };
4298
+ useEffect(() => cancelPendingCheck, []);
4299
+ const handleFocus = (event) => {
4300
+ pendingBlur.current = null;
4301
+ if (isFocused.current) {
4302
+ return;
4303
+ }
4304
+ isFocused.current = true;
4305
+ onFocus == null ? void 0 : onFocus(event);
4306
+ };
4307
+ const handleBlur = (event) => {
4308
+ var _a;
4309
+ if (!isFocused.current || event.currentTarget.contains(event.relatedTarget)) {
4310
+ return;
4311
+ }
4312
+ if (event.relatedTarget === null && ((_a = popover2.current) == null ? void 0 : _a.contains(event.target))) {
4313
+ pendingBlur.current = event;
4314
+ if (!isCalendarOpen.current) {
4315
+ checkPendingBlur();
4316
+ }
4317
+ return;
4318
+ }
4319
+ reportBlur(event);
4320
+ };
4321
+ const handleOpenChange = (open) => {
4322
+ isCalendarOpen.current = open;
4323
+ if (!open && pendingBlur.current) {
4324
+ checkPendingBlur();
4325
+ }
4326
+ onOpenChange == null ? void 0 : onOpenChange(open);
4327
+ };
4328
+ return {
4329
+ focusProps: { onFocus: handleFocus, onBlur: handleBlur },
4330
+ onOpenChange: handleOpenChange,
4331
+ popoverRef
4332
+ };
4333
+ };
4260
4334
  const noop = () => {
4261
4335
  };
4262
4336
  function DatePicker2(props) {
@@ -4278,6 +4352,11 @@ function DatePicker2(props) {
4278
4352
  a11y,
4279
4353
  previewCalendarOpen,
4280
4354
  onValueChange = noop,
4355
+ onOpenChange,
4356
+ onKeyDown,
4357
+ onKeyUp,
4358
+ onFocus,
4359
+ onBlur,
4281
4360
  wix,
4282
4361
  elementProps
4283
4362
  } = props;
@@ -4289,6 +4368,19 @@ function DatePicker2(props) {
4289
4368
  const handleChange = (date) => {
4290
4369
  onValueChange(toLocalDate(date));
4291
4370
  };
4371
+ const handleKeyDown = onKeyDown && ((event) => {
4372
+ const wasPrevented = event.defaultPrevented;
4373
+ onKeyDown(event);
4374
+ if (!wasPrevented && event.defaultPrevented) {
4375
+ event.stopPropagation();
4376
+ }
4377
+ });
4378
+ const focusUnit = useFocusUnitEvents({
4379
+ root: portalContainer,
4380
+ onFocus,
4381
+ onBlur,
4382
+ onOpenChange
4383
+ });
4292
4384
  return /* @__PURE__ */ jsx(
4293
4385
  "div",
4294
4386
  {
@@ -4309,6 +4401,9 @@ function DatePicker2(props) {
4309
4401
  dir: direction || void 0,
4310
4402
  lang: language,
4311
4403
  "data-testid": TestIds.root,
4404
+ onKeyDownCapture: handleKeyDown,
4405
+ onKeyUpCapture: onKeyUp,
4406
+ ...focusUnit.focusProps,
4312
4407
  children: /* @__PURE__ */ jsx($2eb8e6d23f3d0cb0$export$a54013f0d02a8f82, { locale, children: /* @__PURE__ */ jsxs(
4313
4408
  $06d5b8ec9ee5d538$export$5109c6dd95d8fb00,
4314
4409
  {
@@ -4320,6 +4415,7 @@ function DatePicker2(props) {
4320
4415
  isInvalid: !!errorMessage2,
4321
4416
  "aria-label": ariaLabel,
4322
4417
  isOpen: previewCalendarOpen || void 0,
4418
+ onOpenChange: focusUnit.onOpenChange,
4323
4419
  children: [
4324
4420
  label2 ? /* @__PURE__ */ jsx(
4325
4421
  $01b77f81d0f07f68$export$b04be29aa201d4f5,
@@ -4368,6 +4464,7 @@ function DatePicker2(props) {
4368
4464
  DatePickerCalendar,
4369
4465
  {
4370
4466
  portalContainer,
4467
+ popoverRef: focusUnit.popoverRef,
4371
4468
  isPreviewOpen: previewCalendarOpen,
4372
4469
  elementProps
4373
4470
  }
@@ -1,7 +1,8 @@
1
1
  import { default as React } from 'react';
2
2
  import { DatePickerElementProps } from '../DatePicker.types';
3
- export declare const DatePickerCalendar: ({ portalContainer, isPreviewOpen, elementProps, }: {
3
+ export declare const DatePickerCalendar: ({ portalContainer, popoverRef, isPreviewOpen, elementProps, }: {
4
4
  portalContainer: HTMLElement | null;
5
+ popoverRef?: React.Ref<HTMLElement>;
5
6
  isPreviewOpen?: boolean;
6
7
  elementProps?: DatePickerElementProps;
7
8
  }) => React.JSX.Element;
@@ -5,6 +5,9 @@ export declare const DisplayNames: {
5
5
  data: {
6
6
  value: string;
7
7
  onValueChange: string;
8
+ onOpenChange: string;
9
+ onKeyDown: string;
10
+ onKeyUp: string;
8
11
  label: string;
9
12
  helperText: string;
10
13
  errorMessage: string;
@@ -41,6 +44,8 @@ export declare const Descriptions: {
41
44
  value: string;
42
45
  helperText: string;
43
46
  errorMessage: string;
47
+ onKeyDown: string;
48
+ onKeyUp: string;
44
49
  };
45
50
  };
46
51
  };
@@ -1,6 +1,8 @@
1
+ import { D as DomEventType } from "../chunks/types.impl.js";
1
2
  import { C as CSS_PROPERTIES, N as NativeStateType, b as DISPLAY_GROUPS, D as DATA, E as ELEMENTS, L as LAYOUT, A as Archetype } from "../chunks/chunk-LDITHLYN.js";
2
3
  import { P as PREVIEW_CALENDAR_OPEN, D as DesignStates, d as defaultValues, b as DisplayNames, c as Descriptions, e as PREVIEW_ERROR_MESSAGE, C as COMPONENT_TYPE, s as selectors } from "../chunks/constants37.js";
3
4
  import { T as TEXT_PROP_STATIC_VALUE_MAX_LENGTH, g as getSelector } from "../chunks/manifest.js";
5
+ import { b as manifestFocusable } from "../chunks/manifestSdkMixins.js";
4
6
  const basePresetName = "baseDatePicker";
5
7
  const presetFont = (size) => ({
6
8
  defaultValue: `normal normal 400 ${size}/1.3em 'Wix Madefor Text', sans-serif`
@@ -319,6 +321,30 @@ const manifest = {
319
321
  parameters: [{ dataType: DATA.DATA_TYPE.localDate }]
320
322
  }
321
323
  },
324
+ onOpenChange: {
325
+ dataType: DATA.DATA_TYPE.function,
326
+ displayName: DisplayNames.root.data.onOpenChange,
327
+ [DATA.DATA_TYPE.function]: {
328
+ parameters: [{ dataType: DATA.DATA_TYPE.booleanValue }]
329
+ }
330
+ },
331
+ onKeyDown: {
332
+ dataType: DATA.DATA_TYPE.function,
333
+ displayName: DisplayNames.root.data.onKeyDown,
334
+ description: Descriptions.root.data.onKeyDown,
335
+ [DATA.DATA_TYPE.function]: {
336
+ parameters: [{ domEvent: DomEventType.KEYBOARD }]
337
+ }
338
+ },
339
+ onKeyUp: {
340
+ dataType: DATA.DATA_TYPE.function,
341
+ displayName: DisplayNames.root.data.onKeyUp,
342
+ description: Descriptions.root.data.onKeyUp,
343
+ [DATA.DATA_TYPE.function]: {
344
+ parameters: [{ domEvent: DomEventType.KEYBOARD }]
345
+ }
346
+ },
347
+ ...manifestFocusable(),
322
348
  label: {
323
349
  dataType: DATA.DATA_TYPE.text,
324
350
  displayName: DisplayNames.root.data.label,
@@ -394,6 +420,19 @@ const manifest = {
394
420
  "disabled"
395
421
  ]
396
422
  }
423
+ },
424
+ orderedEventsGroup: {
425
+ groupType: DISPLAY_GROUPS.GROUP_TYPE.data,
426
+ data: {
427
+ items: [
428
+ "onValueChange",
429
+ "onOpenChange",
430
+ "onKeyDown",
431
+ "onKeyUp",
432
+ "onFocus",
433
+ "onBlur"
434
+ ]
435
+ }
397
436
  }
398
437
  },
399
438
  // Only Disabled at the root: hover and focus are per part (Date input,
@@ -0,0 +1,16 @@
1
+ import { default as React } from 'react';
2
+ type FocusHandler = (event: React.FocusEvent<HTMLElement>) => void;
3
+ export declare const useFocusUnitEvents: ({ root, onFocus, onBlur, onOpenChange, }: {
4
+ root: HTMLElement | null;
5
+ onFocus?: FocusHandler;
6
+ onBlur?: FocusHandler;
7
+ onOpenChange?: (open: boolean) => void;
8
+ }) => {
9
+ focusProps: {
10
+ onFocus: (event: React.FocusEvent<HTMLElement>) => void;
11
+ onBlur: (event: React.FocusEvent<HTMLElement>) => void;
12
+ };
13
+ onOpenChange: (open: boolean) => void;
14
+ popoverRef: (element: HTMLElement | null) => void;
15
+ };
16
+ export {};
@@ -11,6 +11,7 @@ import { C as ConfigurationDefinition } from "../chunks/index15.js";
11
11
  import { d as defineService } from "../chunks/index11.js";
12
12
  import { T as TranslationsDefinition } from "../chunks/index4.js";
13
13
  import { A as ALLOWED_PROTOCOLS, C as COMPONENT_TYPE, H as HTML_COMPONENT_TITLE_KEY, a as ARIA_LABEL_NAMESPACE, L as LEGACY_HTML_COMPONENT_TITLE_KEY, b as HTML_COMPONENT_TITLE_DEFAULT, D as DEFAULT_CONSENT_POLICY, S as SANDBOX, c as ConsentTranslations } from "../chunks/constants35.js";
14
+ import { C as CLASS_NAME_ON_COMPONENT_ROOT_EXPERIMENT, M as MOVE_PREVIEW_IDENTITY_CLASSES_TO_ROOT_EXPERIMENT } from "../chunks/specs.js";
14
15
  const isBrowser = () => typeof window !== "undefined";
15
16
  function useIFrame({
16
17
  reducer = () => ({}),
@@ -173,8 +174,6 @@ const setProtocol = (url, staticHTMLComponentUrl) => {
173
174
  const link = url.split("//")[1];
174
175
  return alreadySet ? url : `${protocol}//${link}`;
175
176
  };
176
- const CLASS_NAME_ON_COMPONENT_ROOT_EXPERIMENT = "classNameOnComponentRoot";
177
- const MOVE_PREVIEW_IDENTITY_CLASSES_TO_ROOT_EXPERIMENT = "movePreviewIdentityClassesToRoot";
178
177
  const useHTMLComponentProps = ({
179
178
  props,
180
179
  isPreview,
@@ -1,6 +1,7 @@
1
1
  import { E as ELEMENTS, C as CSS_PROPERTIES, b as DISPLAY_GROUPS, N as NativeStateType, a as ACTIONS, D as DATA, L as LAYOUT, I as INTERACTIONS, A as Archetype } from "../chunks/chunk-LDITHLYN.js";
2
2
  import { g as getTranslationResources } from "../chunks/translationResources.js";
3
3
  import { c as DesignStates, f as DisplayNames, s as selectors, g as DropdownAnchorPositions, h as DropdownAppliedStyleProperties, i as elementKeys, j as customActionKeys, k as MENU_ANIMATED_ICON_SPEC, m as states, p as presets, n as menuBuiltInActions, C as COMPONENT_TYPE } from "../chunks/constants27.js";
4
+ import { B as BACKDROP_FILTER_SPEC } from "../chunks/specs.js";
4
5
  import { d as manifestMouseHover } from "../chunks/manifestSdkMixins.js";
5
6
  const dropdownItemConfig = {
6
7
  elementType: ELEMENTS.ELEMENT_TYPE.inlineElement,
@@ -689,6 +690,23 @@ const navbarConfig = {
689
690
  selectable: false
690
691
  },
691
692
  cssProperties: {
693
+ backdropFilter: {
694
+ spec: BACKDROP_FILTER_SPEC,
695
+ backdropFilter: {
696
+ filterFunctions: [
697
+ CSS_PROPERTIES.FILTER_FUNCTION.blur,
698
+ CSS_PROPERTIES.FILTER_FUNCTION.brightness,
699
+ CSS_PROPERTIES.FILTER_FUNCTION.contrast,
700
+ CSS_PROPERTIES.FILTER_FUNCTION.dropShadow,
701
+ CSS_PROPERTIES.FILTER_FUNCTION.grayscale,
702
+ CSS_PROPERTIES.FILTER_FUNCTION.hueRotate,
703
+ CSS_PROPERTIES.FILTER_FUNCTION.invert,
704
+ CSS_PROPERTIES.FILTER_FUNCTION.opacity,
705
+ CSS_PROPERTIES.FILTER_FUNCTION.sepia,
706
+ CSS_PROPERTIES.FILTER_FUNCTION.saturate
707
+ ]
708
+ }
709
+ },
692
710
  background: {},
693
711
  boxShadow: {},
694
712
  borderTop: {},
@@ -5,6 +5,9 @@ const DisplayNames = {
5
5
  data: {
6
6
  value: "Selected date",
7
7
  onValueChange: "On Value Change",
8
+ onOpenChange: "On Open Change",
9
+ onKeyDown: "On Key Down",
10
+ onKeyUp: "On Key Up",
8
11
  label: "Label",
9
12
  helperText: "Helper text",
10
13
  errorMessage: "Error message",
@@ -40,7 +43,9 @@ const Descriptions = {
40
43
  data: {
41
44
  value: "This field's current value. Connect it to your context to save the data your visitors provide. A value typed in this panel stays fixed.",
42
45
  helperText: "A hint shown under this field, like a format example. It's always visible, so keep it short.",
43
- errorMessage: "The message shown when this field is invalid. Connect it to your context so it appears only when something's wrong. A message typed in this panel always shows."
46
+ errorMessage: "The message shown when this field is invalid. Connect it to your context so it appears only when something's wrong. A message typed in this panel always shows.",
47
+ onKeyDown: "Fires before the date picker handles the key, also while the calendar is open. preventDefault() cancels that handling. Cancelling Escape or Tab can trap keyboard focus. Cancelling arrows, Page Up/Down, Home, End, Backspace, Delete or digits stops visitors editing the date by keyboard.",
48
+ onKeyUp: "Fires when a key is released, including while the calendar is open. It only reports the key: calling preventDefault() doesn't change how the date picker responds."
44
49
  }
45
50
  }
46
51
  };
@@ -0,0 +1,8 @@
1
+ const CLASS_NAME_ON_COMPONENT_ROOT_EXPERIMENT = "classNameOnComponentRoot";
2
+ const MOVE_PREVIEW_IDENTITY_CLASSES_TO_ROOT_EXPERIMENT = "movePreviewIdentityClassesToRoot";
3
+ const BACKDROP_FILTER_SPEC = "sp.erc.ManifestBackdropFilter";
4
+ export {
5
+ BACKDROP_FILTER_SPEC as B,
6
+ CLASS_NAME_ON_COMPONENT_ROOT_EXPERIMENT as C,
7
+ MOVE_PREVIEW_IDENTITY_CLASSES_TO_ROOT_EXPERIMENT as M
8
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@wix/editor-react-components",
3
- "version": "1.2856.0",
3
+ "version": "1.2858.0",
4
4
  "description": "React components for the Wix Editor",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -228,5 +228,5 @@
228
228
  "registry": "https://registry.npmjs.org/",
229
229
  "access": "public"
230
230
  },
231
- "falconPackageHash": "286a3052bd87963bf707d00f61bf83f33271aee5670f458c6fc20e85"
231
+ "falconPackageHash": "dabb3565265fe981f03e390bfe38f554cb30b110144b6651420bba77"
232
232
  }