@raylang/react 0.11.0 → 0.13.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.
@@ -5,11 +5,11 @@ import { createComponent } from "../create.js";
5
5
 
6
6
  export const RayDatePicker = /*#__PURE__*/ createComponent("ray-date-picker", {
7
7
  displayName: "RayDatePicker",
8
- properties: ["value", "min", "max", "placeholder", "format", "locale", "firstDay", "clearable", "open", "name", "label", "description", "descriptionPosition", "error", "required", "disabled", "size", "radius", "variant"],
8
+ properties: ["value", "min", "max", "placeholder", "format", "locale", "firstDay", "clearable", "open", "native", "name", "label", "description", "descriptionPosition", "error", "required", "disabled", "size", "radius", "variant"],
9
9
  events: { onInput: "input", onChange: "change", onRayOpen: "ray-open", onRayClose: "ray-close" },
10
10
  });
11
11
  export const RayCalendar = /*#__PURE__*/ createComponent("ray-calendar", {
12
12
  displayName: "RayCalendar",
13
- properties: ["value", "min", "max", "locale", "firstDay", "size"],
13
+ properties: ["value", "min", "max", "locale", "firstDay", "size", "dayState"],
14
14
  events: { onChange: "change" },
15
15
  });
@@ -6,5 +6,5 @@ import { createComponent } from "../create.js";
6
6
  export const RayInput = /*#__PURE__*/ createComponent("ray-input", {
7
7
  displayName: "RayInput",
8
8
  properties: ["value", "type", "name", "label", "description", "descriptionPosition", "error", "placeholder", "required", "disabled", "readonly", "size", "radius", "variant", "highlight", "complete", "suggestionsLabel"],
9
- events: { onRayComplete: "ray-complete", onInput: "input", onChange: "change" },
9
+ events: { onRayComplete: "ray-complete", onRayHighlightHover: "ray-highlight-hover", onInput: "input", onChange: "change" },
10
10
  });
@@ -5,7 +5,7 @@ import { createComponent } from "../create.js";
5
5
 
6
6
  export const RayMenu = /*#__PURE__*/ createComponent("ray-menu", {
7
7
  displayName: "RayMenu",
8
- properties: ["open", "placement", "context", "keepOpen", "native", "offset"],
8
+ properties: ["open", "placement", "context", "keepOpen", "native", "anchor", "offset"],
9
9
  events: { onRaySelect: "ray-select", onRayRequestOpen: "ray-request-open", onRayOpen: "ray-open", onRayClose: "ray-close" },
10
10
  });
11
11
  export const RayMenuItem = /*#__PURE__*/ createComponent("ray-menu-item", {
@@ -6,5 +6,5 @@ import { createComponent } from "../create.js";
6
6
  export const RayModeInput = /*#__PURE__*/ createComponent("ray-mode-input", {
7
7
  displayName: "RayModeInput",
8
8
  properties: ["mode", "options", "display", "position", "menuLabel", "nativeMenu", "value", "type", "name", "label", "description", "descriptionPosition", "error", "placeholder", "required", "disabled", "readonly", "size", "radius", "variant", "highlight", "complete", "suggestionsLabel"],
9
- events: { onRayModeChange: "ray-mode-change", onRayComplete: "ray-complete", onInput: "input", onChange: "change" },
9
+ events: { onRayModeChange: "ray-mode-change", onRayComplete: "ray-complete", onRayHighlightHover: "ray-highlight-hover", onInput: "input", onChange: "change" },
10
10
  });
@@ -6,5 +6,5 @@ import { createComponent } from "../create.js";
6
6
  export const RayPasswordInput = /*#__PURE__*/ createComponent("ray-password-input", {
7
7
  displayName: "RayPasswordInput",
8
8
  properties: ["visible", "showLabel", "hideLabel", "value", "type", "name", "label", "description", "descriptionPosition", "error", "placeholder", "required", "disabled", "readonly", "size", "radius", "variant", "highlight", "complete", "suggestionsLabel"],
9
- events: { onRayVisibilityChange: "ray-visibility-change", onRayComplete: "ray-complete", onInput: "input", onChange: "change" },
9
+ events: { onRayVisibilityChange: "ray-visibility-change", onRayComplete: "ray-complete", onRayHighlightHover: "ray-highlight-hover", onInput: "input", onChange: "change" },
10
10
  });
@@ -6,5 +6,5 @@ import { createComponent } from "../create.js";
6
6
  export const RayPathInput = /*#__PURE__*/ createComponent("ray-path-input", {
7
7
  displayName: "RayPathInput",
8
8
  properties: ["mode", "accept", "browseLabel", "dialogTitle", "value", "type", "name", "label", "description", "descriptionPosition", "error", "placeholder", "required", "disabled", "readonly", "size", "radius", "variant", "highlight", "complete", "suggestionsLabel"],
9
- events: { onChange: "change", onRayError: "ray-error", onRayComplete: "ray-complete", onInput: "input" },
9
+ events: { onChange: "change", onRayError: "ray-error", onRayComplete: "ray-complete", onRayHighlightHover: "ray-highlight-hover", onInput: "input" },
10
10
  });
@@ -5,6 +5,6 @@ import { createComponent } from "../create.js";
5
5
 
6
6
  export const RayPopover = /*#__PURE__*/ createComponent("ray-popover", {
7
7
  displayName: "RayPopover",
8
- properties: ["open", "placement", "offset", "width", "matchWidth", "padding", "trapFocus"],
8
+ properties: ["open", "placement", "offset", "anchor", "width", "matchWidth", "padding", "trapFocus"],
9
9
  events: { onRayOpen: "ray-open", onRayClose: "ray-close" },
10
10
  });
@@ -6,5 +6,5 @@ import { createComponent } from "../create.js";
6
6
  export const RayTextarea = /*#__PURE__*/ createComponent("ray-textarea", {
7
7
  displayName: "RayTextarea",
8
8
  properties: ["value", "rows", "autosize", "maxRows", "name", "label", "description", "descriptionPosition", "error", "required", "disabled", "readonly", "size", "variant", "highlight", "complete", "suggestionsLabel", "radius"],
9
- events: { onRayComplete: "ray-complete", onInput: "input", onChange: "change" },
9
+ events: { onRayComplete: "ray-complete", onRayHighlightHover: "ray-highlight-hover", onInput: "input", onChange: "change" },
10
10
  });
package/index.d.ts CHANGED
@@ -388,6 +388,8 @@ export interface RayDatePickerOwnProps {
388
388
  clearable?: boolean;
389
389
  /** The calendar dropdown is shown. */
390
390
  open?: boolean;
391
+ /** Which picker the trigger opens: the system's (the native date input's, the usual one on a phone) or the calendar dropdown. auto: the system's on a touch screen (pointer: coarse), else the calendar. A date picked in the system's picker is the value like one picked in the calendar. */
392
+ native?: "auto" | "always" | "never";
391
393
  /** Form field name. */
392
394
  name?: string;
393
395
  /** Visible label (also the accessible name). */
@@ -434,6 +436,8 @@ export interface RayCalendarOwnProps {
434
436
  firstDay?: number;
435
437
  /** Day cell size and font size. */
436
438
  size?: "xs" | "sm" | "md" | "lg" | "xl";
439
+ /** Marks days: called with each day's ISO date on every render, it returns a state name (letters, digits, - and _) or nothing. The day button gets data-state and the part day-<state>, so ::part(day-taken) (or ::part(day-missed)::after for a dot) styles it from outside. Call refresh() when what it marks changed but the month did not. */
440
+ dayState?: ((date: string) => string | null | undefined) | null;
437
441
  /** A day was selected (read `value`). */
438
442
  onChange?: (event: Event) => void;
439
443
  }
@@ -494,8 +498,8 @@ export declare const RayFileUpload: React.ForwardRefExoticComponent<RayFileUploa
494
498
  export interface RayInputOwnProps {
495
499
  /** Current value. The value attribute is the initial value (restored on form reset). */
496
500
  value?: string;
497
- /** Input type. */
498
- type?: "text" | "email" | "password" | "search" | "number" | "url" | "tel";
501
+ /** Input type. time, date and datetime-local show the browser's picker (the native one on phones); value is what the input gives: "HH:MM", "YYYY-MM-DD", "YYYY-MM-DDTHH:MM". */
502
+ type?: "text" | "email" | "password" | "search" | "number" | "url" | "tel" | "time" | "date" | "datetime-local";
499
503
  /** Form field name. */
500
504
  name?: string;
501
505
  /** Visible label (also the accessible name). */
@@ -550,6 +554,8 @@ export interface RayInputOwnProps {
550
554
  list?: string;
551
555
  /** A suggestion was accepted (the text already has it). */
552
556
  onRayComplete?: (event: CustomEvent<{ item: Ray.CompletionItem; from: number; to: number }>) => void;
557
+ /** The highlight range under the pointer changed: the range and the box of the line of it the pointer is on, or null on leaving a range. Anchor a ray-popover to rect (its anchor property) to show more than the title. */
558
+ onRayHighlightHover?: (event: CustomEvent<{ range: Ray.HighlightRange | null; rect: DOMRect | null }>) => void;
553
559
  /** On every edit (value already updated). */
554
560
  onInput?: (event: Event) => void;
555
561
  /** When an edit is committed (blur, Enter). */
@@ -574,8 +580,8 @@ export interface RayModeInputOwnProps {
574
580
  nativeMenu?: boolean;
575
581
  /** Current value. The value attribute is the initial value (restored on form reset). */
576
582
  value?: string;
577
- /** Input type. */
578
- type?: "text" | "email" | "password" | "search" | "number" | "url" | "tel";
583
+ /** Input type. time, date and datetime-local show the browser's picker (the native one on phones); value is what the input gives: "HH:MM", "YYYY-MM-DD", "YYYY-MM-DDTHH:MM". */
584
+ type?: "text" | "email" | "password" | "search" | "number" | "url" | "tel" | "time" | "date" | "datetime-local";
579
585
  /** Form field name. */
580
586
  name?: string;
581
587
  /** Visible label (also the accessible name). */
@@ -632,6 +638,8 @@ export interface RayModeInputOwnProps {
632
638
  onRayModeChange?: (event: CustomEvent<{ mode: string; previous: string | null; option: Ray.ModeOption }>) => void;
633
639
  /** A suggestion was accepted (the text already has it). */
634
640
  onRayComplete?: (event: CustomEvent<{ item: Ray.CompletionItem; from: number; to: number }>) => void;
641
+ /** The highlight range under the pointer changed: the range and the box of the line of it the pointer is on, or null on leaving a range. Anchor a ray-popover to rect (its anchor property) to show more than the title. */
642
+ onRayHighlightHover?: (event: CustomEvent<{ range: Ray.HighlightRange | null; rect: DOMRect | null }>) => void;
635
643
  /** On every edit (value already updated). */
636
644
  onInput?: (event: Event) => void;
637
645
  /** When an edit is committed (blur, Enter). */
@@ -708,8 +716,8 @@ export interface RayPasswordInputOwnProps {
708
716
  hideLabel?: string;
709
717
  /** Current value. The value attribute is the initial value (restored on form reset). */
710
718
  value?: string;
711
- /** Input type. */
712
- type?: "text" | "email" | "password" | "search" | "number" | "url" | "tel";
719
+ /** Input type. time, date and datetime-local show the browser's picker (the native one on phones); value is what the input gives: "HH:MM", "YYYY-MM-DD", "YYYY-MM-DDTHH:MM". */
720
+ type?: "text" | "email" | "password" | "search" | "number" | "url" | "tel" | "time" | "date" | "datetime-local";
713
721
  /** Form field name. */
714
722
  name?: string;
715
723
  /** Visible label (also the accessible name). */
@@ -766,6 +774,8 @@ export interface RayPasswordInputOwnProps {
766
774
  onRayVisibilityChange?: (event: CustomEvent<{ visible: boolean }>) => void;
767
775
  /** A suggestion was accepted (the text already has it). */
768
776
  onRayComplete?: (event: CustomEvent<{ item: Ray.CompletionItem; from: number; to: number }>) => void;
777
+ /** The highlight range under the pointer changed: the range and the box of the line of it the pointer is on, or null on leaving a range. Anchor a ray-popover to rect (its anchor property) to show more than the title. */
778
+ onRayHighlightHover?: (event: CustomEvent<{ range: Ray.HighlightRange | null; rect: DOMRect | null }>) => void;
769
779
  /** On every edit (value already updated). */
770
780
  onInput?: (event: Event) => void;
771
781
  /** When an edit is committed (blur, Enter). */
@@ -786,8 +796,8 @@ export interface RayPathInputOwnProps {
786
796
  dialogTitle?: string;
787
797
  /** Current value. The value attribute is the initial value (restored on form reset). */
788
798
  value?: string;
789
- /** Input type. */
790
- type?: "text" | "email" | "password" | "search" | "number" | "url" | "tel";
799
+ /** Input type. time, date and datetime-local show the browser's picker (the native one on phones); value is what the input gives: "HH:MM", "YYYY-MM-DD", "YYYY-MM-DDTHH:MM". */
800
+ type?: "text" | "email" | "password" | "search" | "number" | "url" | "tel" | "time" | "date" | "datetime-local";
791
801
  /** Form field name. */
792
802
  name?: string;
793
803
  /** Visible label (also the accessible name). */
@@ -846,6 +856,8 @@ export interface RayPathInputOwnProps {
846
856
  onRayError?: (event: CustomEvent<{ error: Error }>) => void;
847
857
  /** A suggestion was accepted (the text already has it). */
848
858
  onRayComplete?: (event: CustomEvent<{ item: Ray.CompletionItem; from: number; to: number }>) => void;
859
+ /** The highlight range under the pointer changed: the range and the box of the line of it the pointer is on, or null on leaving a range. Anchor a ray-popover to rect (its anchor property) to show more than the title. */
860
+ onRayHighlightHover?: (event: CustomEvent<{ range: Ray.HighlightRange | null; rect: DOMRect | null }>) => void;
849
861
  /** On every edit (value already updated). */
850
862
  onInput?: (event: Event) => void;
851
863
  }
@@ -1174,6 +1186,8 @@ export interface RayTextareaOwnProps {
1174
1186
  wrap?: string;
1175
1187
  /** A suggestion was accepted (the text already has it). */
1176
1188
  onRayComplete?: (event: CustomEvent<{ item: Ray.CompletionItem; from: number; to: number }>) => void;
1189
+ /** The highlight range under the pointer changed: the range and the box of the line of it the pointer is on, or null on leaving a range. Anchor a ray-popover to rect (its anchor property) to show more than the title. */
1190
+ onRayHighlightHover?: (event: CustomEvent<{ range: Ray.HighlightRange | null; rect: DOMRect | null }>) => void;
1177
1191
  /** On every edit. */
1178
1192
  onInput?: (event: Event) => void;
1179
1193
  /** When an edit is committed. */
@@ -1564,8 +1578,8 @@ export interface RayDrawerOwnProps {
1564
1578
  description?: string;
1565
1579
  /** The edge it slides from: start/end follow the writing direction; left/right are sides of the screen. */
1566
1580
  position?: "end" | "start" | "right" | "left" | "top" | "bottom";
1567
- /** Width (left/right) or height (top/bottom): xs…xl, full, or any CSS length. */
1568
- size?: "xs" | "sm" | "md" | "lg" | "xl" | "full" | (string & {});
1581
+ /** Width (left/right) or height (top/bottom): xs…xl, full, content (as big as what it holds, up to the viewport: a bottom sheet) or any CSS length. */
1582
+ size?: "xs" | "sm" | "md" | "lg" | "xl" | "full" | "content" | (string & {});
1569
1583
  /** No backdrop nor scroll lock: the page stays interactive (a side panel). */
1570
1584
  modeless?: boolean;
1571
1585
  /** Detached from the edge, with rounded corners. */
@@ -1598,6 +1612,8 @@ export interface RayMenuOwnProps {
1598
1612
  keepOpen?: boolean;
1599
1613
  /** With a native host (ray-elements/core/raylang.js in a std/ui window), opens as the system's context menu at the pointer: items and dividers, same ray-select. */
1600
1614
  native?: boolean;
1615
+ /** What the panel is placed against instead of the trigger: an element, a DOMRect or a function returning one (a text range, the pointer; read again on every reposition). The trigger still opens it. */
1616
+ anchor?: Element | DOMRect | (() => DOMRect) | null;
1601
1617
  /** Gap to the anchor in px. */
1602
1618
  offset?: number;
1603
1619
  /** An item was chosen; detail: { value, item }. */
@@ -1650,6 +1666,8 @@ export interface RayPopoverOwnProps {
1650
1666
  placement?: "bottom" | "bottom-start" | "bottom-end" | "top" | "top-start" | "top-end" | "left" | "left-start" | "left-end" | "right" | "right-start" | "right-end";
1651
1667
  /** Gap to the trigger in px. */
1652
1668
  offset?: number;
1669
+ /** What the panel is placed against instead of the trigger: an element, a DOMRect or a function returning one (a text range, the pointer; read again on every reposition). The trigger still opens it. */
1670
+ anchor?: Element | DOMRect | (() => DOMRect) | null;
1653
1671
  /** Panel width (px number or CSS length). Default: its content. */
1654
1672
  width?: string;
1655
1673
  /** At least as wide as the trigger. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raylang/react",
3
- "version": "0.11.0",
3
+ "version": "0.13.0",
4
4
  "description": "React wrappers of the ray-elements web components",
5
5
  "license": "Apache-2.0",
6
6
  "keywords": ["web-components", "design-system", "ui", "raylang", "react"],
@@ -28,7 +28,7 @@
28
28
  },
29
29
  "sideEffects": false,
30
30
  "peerDependencies": {
31
- "@raylang/elements": "^0.11.0",
31
+ "@raylang/elements": "^0.13.0",
32
32
  "react": ">=18"
33
33
  }
34
34
  }