@photoroom/ui 0.1.228 → 0.1.229

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,7 +1,19 @@
1
1
  export type PillProps = React.ComponentProps<"div">;
2
2
  export declare const Pill: {
3
3
  ({ className, ...props }: PillProps): import("react/jsx-runtime").JSX.Element;
4
- Button: import("react").ForwardRefExoticComponent<Omit<import("./PillButton").PillButtonProps, "ref"> & import("react").RefAttributes<HTMLButtonElement>>;
4
+ Button: import("react").ForwardRefExoticComponent<(Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children"> & {
5
+ chevron?: boolean;
6
+ } & {
7
+ label: string;
8
+ icon?: React.ReactNode;
9
+ tooltip?: string;
10
+ }, "ref"> | Omit<Omit<import("react").DetailedHTMLProps<import("react").ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "children"> & {
11
+ chevron?: boolean;
12
+ } & {
13
+ icon: React.ReactNode;
14
+ label?: never;
15
+ tooltip: string;
16
+ }, "ref">) & import("react").RefAttributes<HTMLButtonElement>>;
5
17
  Divider: {
6
18
  ({ className, ...props }: import("./PillDivider").PillDividerProps): import("react/jsx-runtime").JSX.Element;
7
19
  displayName: string;
@@ -1 +1 @@
1
- {"version":3,"file":"Pill.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/Pill/Pill.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAEpD,eAAO,MAAM,IAAI;8BAA6B,SAAS;;;;;;;CAYtD,CAAC"}
1
+ {"version":3,"file":"Pill.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/Pill/Pill.tsx"],"names":[],"mappings":"AAMA,MAAM,MAAM,SAAS,GAAG,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;AAEpD,eAAO,MAAM,IAAI;8BAA6B,SAAS;;;;;;;;;;;;;;;;;;;CAYtD,CAAC"}
@@ -1,8 +1,24 @@
1
1
  import React from "react";
2
- export type PillButtonProps = Omit<React.ComponentProps<"button">, "children"> & {
3
- icon?: React.ReactNode;
4
- label?: string;
2
+ type PillButtonBaseProps = Omit<React.ComponentProps<"button">, "children"> & {
5
3
  chevron?: boolean;
6
4
  };
7
- export declare const PillButton: React.ForwardRefExoticComponent<Omit<PillButtonProps, "ref"> & React.RefAttributes<HTMLButtonElement>>;
5
+ type LabelledPillButtonProps = PillButtonBaseProps & {
6
+ /** Visible text label. When present, `tooltip` is optional. */
7
+ label: string;
8
+ icon?: React.ReactNode;
9
+ /** Optional tooltip. Renders via the DS Tooltip when provided. */
10
+ tooltip?: string;
11
+ };
12
+ type IconOnlyPillButtonProps = PillButtonBaseProps & {
13
+ icon: React.ReactNode;
14
+ label?: never;
15
+ /**
16
+ * Required for icon-only buttons: renders via the DS Tooltip and feeds the
17
+ * accessible name (`aria-label`), unless an explicit `aria-label` is also passed.
18
+ */
19
+ tooltip: string;
20
+ };
21
+ export type PillButtonProps = LabelledPillButtonProps | IconOnlyPillButtonProps;
22
+ export declare const PillButton: React.ForwardRefExoticComponent<(Omit<LabelledPillButtonProps, "ref"> | Omit<IconOnlyPillButtonProps, "ref">) & React.RefAttributes<HTMLButtonElement>>;
23
+ export {};
8
24
  //# sourceMappingURL=PillButton.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PillButton.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/Pill/PillButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAE1C,MAAM,MAAM,eAAe,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IAC/E,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,eAAO,MAAM,UAAU,wGA4DtB,CAAC"}
1
+ {"version":3,"file":"PillButton.d.ts","sourceRoot":"","sources":["../../../../src/components/editor/Pill/PillButton.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAqB,MAAM,OAAO,CAAC;AAI1C,KAAK,mBAAmB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,UAAU,CAAC,GAAG;IAC5E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,KAAK,uBAAuB,GAAG,mBAAmB,GAAG;IACnD,+DAA+D;IAC/D,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB,kEAAkE;IAClE,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,KAAK,uBAAuB,GAAG,mBAAmB,GAAG;IACnD,IAAI,EAAE,KAAK,CAAC,SAAS,CAAC;IACtB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd;;;OAGG;IACH,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG,uBAAuB,GAAG,uBAAuB,CAAC;AAEhF,eAAO,MAAM,UAAU,yJAuEtB,CAAC"}
@@ -10,6 +10,12 @@ export type TooltipProps = Readonly<{
10
10
  defaultOpen?: boolean;
11
11
  triggerTabIndex?: number;
12
12
  sideOffset?: number;
13
+ /**
14
+ * Never open the tooltip from focus, only from hover (or tap on mobile). Prevents it
15
+ * flashing when a focus scope (e.g. a Dialog) autofocuses the trigger on mount. Pair
16
+ * with an explicit `aria-label` on the trigger so the accessible name is preserved.
17
+ */
18
+ disableFocusOpen?: boolean;
13
19
  }>;
14
20
  /**
15
21
  * Creating our own API by abstracting the primitive parts into our own component.
@@ -17,5 +23,5 @@ export type TooltipProps = Readonly<{
17
23
  *
18
24
  * ⚠️ The component that is passed as a trigger MUST forward the ref
19
25
  */
20
- export declare const Tooltip: ({ children, content, isTriggerDisabled, className, triggerClassName, withPortal, side, defaultOpen, triggerTabIndex, sideOffset, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
26
+ export declare const Tooltip: ({ children, content, isTriggerDisabled, className, triggerClassName, withPortal, side, defaultOpen, triggerTabIndex, sideOffset, disableFocusOpen, ...props }: TooltipProps) => import("react/jsx-runtime").JSX.Element;
21
27
  //# sourceMappingURL=Tooltip.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/unsorted/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAM5D,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB,CAAC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,6IAYrB,YAAY,4CA8Ed,CAAC"}
1
+ {"version":3,"file":"Tooltip.d.ts","sourceRoot":"","sources":["../../../../src/components/unsorted/Tooltip/Tooltip.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,gBAAgB,MAAM,yBAAyB,CAAC;AAM5D,MAAM,MAAM,YAAY,GAAG,QAAQ,CAAC;IAClC,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B,OAAO,EAAE,KAAK,CAAC,SAAS,CAAC;IACzB,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,IAAI,CAAC,EAAE,gBAAgB,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC;IACpD,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;;;OAIG;IACH,gBAAgB,CAAC,EAAE,OAAO,CAAC;CAC5B,CAAC,CAAC;AAEH;;;;;GAKG;AACH,eAAO,MAAM,OAAO,GAAI,+JAarB,YAAY,4CAmGd,CAAC"}
package/index.mjs CHANGED
@@ -5559,32 +5559,44 @@ var Vo = ho, Ho = yo, Uo = xo, Wo = To, Go = Do, Ko = Po, qo = /* @__PURE__ */ F
5559
5559
  _(i), b(i), y(i), x(i), L(r) || ue(), P(r);
5560
5560
  var me = g(i) || ue();
5561
5561
  m(i), h(i) || ue(), v(i), v(i), T(o), O(o), k(o) || ue(), M(r), N(r), ee(r), te(r), ne(r), A(o), j(o), ie(r), ae(r), z(r), S(i), C(i), oe(a), se(a), pe(s), F(r) || B(s), I(r), w(i), le(), ue(), de(), fe(), ce(), B(s), F(r) && B(s), E(o), D(o), re(r), R(r), e.isMobile = me;
5562
- })))(), Yo = ({ children: e, content: t, isTriggerDisabled: n, className: r, triggerClassName: a, withPortal: o = !0, side: s = "bottom", defaultOpen: c = !1, triggerTabIndex: l = 0, sideOffset: u, ...d }) => {
5563
- let f = g(), [p, m] = C(c), h = o ? Wo : i;
5562
+ })))(), Yo = ({ children: e, content: t, isTriggerDisabled: n, className: r, triggerClassName: a, withPortal: o = !0, side: s = "bottom", defaultOpen: c = !1, triggerTabIndex: l = 0, sideOffset: u, disableFocusOpen: d = !1, ...f }) => {
5563
+ let p = g(), [m, h] = C(c), _ = S(!1), v = o ? Wo : i, y = d ? () => {
5564
+ _.current = !0, queueMicrotask(() => {
5565
+ _.current = !1;
5566
+ });
5567
+ } : void 0;
5564
5568
  return /* @__PURE__ */ E(Vo, { children: /* @__PURE__ */ D(Ho, {
5565
5569
  delayDuration: 0,
5566
- open: p,
5567
- onOpenChange: m,
5570
+ open: m,
5571
+ onOpenChange: (e) => {
5572
+ if (e && _.current) {
5573
+ _.current = !1;
5574
+ return;
5575
+ }
5576
+ h(e);
5577
+ },
5568
5578
  defaultOpen: c,
5569
5579
  children: [/* @__PURE__ */ E(Uo, {
5570
5580
  asChild: !0,
5571
5581
  children: n ? /* @__PURE__ */ E("span", {
5572
5582
  className: H("inline-block", a),
5573
- "aria-describedby": f,
5583
+ "aria-describedby": p,
5574
5584
  tabIndex: l,
5585
+ onFocusCapture: y,
5575
5586
  children: e
5576
5587
  }) : /* @__PURE__ */ E("span", {
5577
5588
  className: H("inline-block", a),
5578
- "aria-describedby": f,
5579
- onClick: () => Jo.isMobile && m(!0),
5589
+ "aria-describedby": p,
5590
+ onFocusCapture: y,
5591
+ onClick: () => Jo.isMobile && h(!0),
5580
5592
  children: e
5581
5593
  })
5582
- }), t && /* @__PURE__ */ E(h, { children: /* @__PURE__ */ D(Go, {
5594
+ }), t && /* @__PURE__ */ E(v, { children: /* @__PURE__ */ D(Go, {
5583
5595
  side: s,
5584
5596
  sideOffset: u,
5585
5597
  className: H("component-400 rounded-250 bg-background-tooltip z-50 px-1.5 pt-[5px] pb-1.5 [word-break:break-word] text-white", "max-w-[100vw]", "[&_strong]:component-400 [&_strong]:bg-white-alpha-3 [&_strong]:rounded-[2px] [&_strong]:px-[2px]", "[&_b]:component-400 [&_b]:bg-white-alpha-3 [&_b]:rounded-[2px] [&_b]:px-[2px]", "[&_a]:underline", s === "bottom" && "animate-tooltip-slide-down", s === "top" && "animate-tooltip-slide-up", s === "left" && "animate-tooltip-slide-left", s === "right" && "animate-tooltip-slide-right", r),
5586
- id: f,
5587
- ...d,
5598
+ id: p,
5599
+ ...f,
5588
5600
  children: [t, /* @__PURE__ */ E(Ko, {
5589
5601
  className: "fill-background-tooltip",
5590
5602
  asChild: !0,
@@ -36528,27 +36540,34 @@ var nY = l(({ label: e, labelTestId: t, subtitle: n, isHidden: r, defaultIsHidde
36528
36540
  nY.displayName = "ObjectItem";
36529
36541
  //#endregion
36530
36542
  //#region src/components/editor/Pill/PillButton.tsx
36531
- var rY = l(({ icon: e, label: t, className: n, chevron: r = !1, ...i }, a) => {
36532
- let o = e && !t, s = !e && t, c = e && t, l = /* @__PURE__ */ D(T, { children: [!!e && /* @__PURE__ */ E("span", {
36543
+ var rY = l(({ icon: e, label: t, className: n, chevron: r = !1, tooltip: i, ...a }, o) => {
36544
+ let s = !!e && !t, c = !e && !!t, l = !!e && !!t, u = /* @__PURE__ */ D(T, { children: [!!e && /* @__PURE__ */ E("span", {
36533
36545
  role: "presentation",
36534
36546
  className: "icon-size-500",
36535
36547
  children: e
36536
36548
  }), !!t && /* @__PURE__ */ E("span", {
36537
36549
  className: "component-500",
36538
36550
  children: t
36539
- })] });
36540
- return /* @__PURE__ */ E("button", {
36541
- ...i,
36542
- ref: a,
36543
- className: V("group shrink-0 cursor-pointer outline-hidden", "inline-flex items-center justify-center", "rounded-300", "hover:bg-background-subdued-hover", "active:bg-background-subdued-down", "focus-visible:bg-background-subdued-hover", "focus-visible:ring-misc-focus-indicator focus-visible:misc-border-size-focus-ring", "text-content-primary", "disabled:cursor-not-allowed disabled:opacity-30", "interaction-transition transition-all", o && !r && "size-400", o && r && "size-h-400 content-to-edge-ps-250 content-to-edge-pe-150 gap-1", s && !r && "content-to-edge-px-400 size-h-400", s && r && "content-to-edge-ps-400 content-to-edge-pe-250 size-h-400 gap-1", c && !r && "content-to-edge-pe-400 icon-to-edge-ps-400 size-h-400 gap-2", c && r && "icon-to-edge-ps-400 content-to-edge-pe-250 size-h-400 gap-1", n),
36551
+ })] }), d = /* @__PURE__ */ E("button", {
36552
+ ...a,
36553
+ ref: o,
36554
+ "aria-label": a["aria-label"] ?? (s ? i : void 0),
36555
+ className: V("group shrink-0 cursor-pointer outline-hidden", "inline-flex items-center justify-center", "rounded-300", "hover:bg-background-subdued-hover", "active:bg-background-subdued-down", "focus-visible:bg-background-subdued-hover", "focus-visible:ring-misc-focus-indicator focus-visible:misc-border-size-focus-ring", "text-content-primary", "disabled:cursor-not-allowed disabled:opacity-30", "interaction-transition transition-all", s && !r && "size-400", s && r && "size-h-400 content-to-edge-ps-250 content-to-edge-pe-150 gap-1", c && !r && "content-to-edge-px-400 size-h-400", c && r && "content-to-edge-ps-400 content-to-edge-pe-250 size-h-400 gap-1", l && !r && "content-to-edge-pe-400 icon-to-edge-ps-400 size-h-400 gap-2", l && r && "icon-to-edge-ps-400 content-to-edge-pe-250 size-h-400 gap-1", n),
36544
36556
  children: r ? /* @__PURE__ */ D(T, { children: [/* @__PURE__ */ E("span", {
36545
36557
  className: "flex items-center gap-2",
36546
- children: l
36558
+ children: u
36547
36559
  }), /* @__PURE__ */ E(L, {
36548
36560
  "aria-hidden": !0,
36549
36561
  className: "icon-size-400"
36550
- })] }) : l
36562
+ })] }) : u
36551
36563
  });
36564
+ return i ? /* @__PURE__ */ E(Yo, {
36565
+ content: i,
36566
+ side: "top",
36567
+ isTriggerDisabled: a.disabled,
36568
+ disableFocusOpen: !0,
36569
+ children: d
36570
+ }) : d;
36552
36571
  });
36553
36572
  rY.displayName = "PillButton";
36554
36573
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@photoroom/ui",
3
- "version": "0.1.228",
3
+ "version": "0.1.229",
4
4
  "private": false,
5
5
  "description": "Photoroom design system components",
6
6
  "sideEffects": [