@snowcone-app/ui 0.8.2 → 0.8.3

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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,14 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.3
4
+
5
+ ### Patch Changes
6
+
7
+ - [#3131](https://github.com/snowcone-app/snowcone-monorepo/pull/3131) [`84f6ac3`](https://github.com/snowcone-app/snowcone-monorepo/commit/84f6ac38e54c57c483ff49c18548cd9ba832d30e) Thanks [@kevinsproles](https://github.com/kevinsproles)! - Realtime `spreadCrops` pieces can carry `part: { index, count }`: a placement cut into strips that sit on different spread artboards is assembled server-side once every strip has arrived.
8
+
9
+ - Updated dependencies [[`84f6ac3`](https://github.com/snowcone-app/snowcone-monorepo/commit/84f6ac38e54c57c483ff49c18548cd9ba832d30e)]:
10
+ - @snowcone-app/sdk@0.24.2
11
+
3
12
  ## 0.8.2
4
13
 
5
14
  ### Patch Changes
package/dist/index.cjs CHANGED
@@ -342,6 +342,7 @@ __export(src_exports, {
342
342
  isWideMonitor: () => isWideMonitor,
343
343
  kbdVariants: () => kbdVariants,
344
344
  linkVariants: () => linkVariants,
345
+ linkedPlacementsLabel: () => linkedPlacementsLabel,
345
346
  listProducts: () => import_sdk11.listProducts,
346
347
  normalizeHex: () => normalizeHex,
347
348
  observe: () => observe,
@@ -5750,6 +5751,11 @@ function PlacementClipShapeSelector() {
5750
5751
  // src/composed/PlacementTabs.tsx
5751
5752
  var import_react21 = require("react");
5752
5753
  var import_jsx_runtime50 = require("react/jsx-runtime");
5754
+ function linkedPlacementsLabel(count) {
5755
+ return count === 2 ? "Both sides" : `All ${count} areas`;
5756
+ }
5757
+ var ACTION_CLASS = "transition-colors duration-200 cursor-pointer text-muted-foreground hover:text-foreground underline underline-offset-4 decoration-muted-foreground/40 hover:decoration-foreground";
5758
+ var PILL_CLASS = "inline-flex items-center rounded-full bg-foreground/[0.08] px-3 py-1 font-medium text-foreground";
5753
5759
  function PlacementTabs({
5754
5760
  placements,
5755
5761
  selectedPlacement,
@@ -5757,7 +5763,13 @@ function PlacementTabs({
5757
5763
  isDesktop = false,
5758
5764
  toolbarPlaceholderId = "toolbar-placeholder",
5759
5765
  toolbarSize = 120,
5760
- className = ""
5766
+ className = "",
5767
+ linked,
5768
+ onSplitAll,
5769
+ onLinkAll,
5770
+ linkedLabel,
5771
+ splitAllLabel = "Customize separately",
5772
+ linkAllLabel = "Use one design for all"
5761
5773
  }) {
5762
5774
  const containerRef = (0, import_react21.useRef)(null);
5763
5775
  const [lineHeight, setLineHeight] = (0, import_react21.useState)(24);
@@ -5774,7 +5786,7 @@ function PlacementTabs({
5774
5786
  if (isDesktop) {
5775
5787
  return null;
5776
5788
  }
5777
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: `flex justify-end w-full ${className}`, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5789
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: `flex justify-end w-full ${className}`, "data-placement-tabs": true, children: /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5778
5790
  "span",
5779
5791
  {
5780
5792
  id: toolbarPlaceholderId,
@@ -5783,16 +5795,68 @@ function PlacementTabs({
5783
5795
  }
5784
5796
  ) });
5785
5797
  }
5798
+ const dataLinked = linked === void 0 ? void 0 : linked ? "true" : "false";
5799
+ const labels = placements.map((p) => p.label);
5800
+ const renderItems = (tabClass) => {
5801
+ if (linked === true) {
5802
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
5803
+ /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5804
+ "span",
5805
+ {
5806
+ className: `${tabClass} ${PILL_CLASS}`,
5807
+ "data-placement-pill": true,
5808
+ title: labels.join(" \xB7 "),
5809
+ "aria-label": `One design on ${labels.join(", ")}`,
5810
+ children: linkedLabel ?? linkedPlacementsLabel(placements.length)
5811
+ }
5812
+ ),
5813
+ onSplitAll && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5814
+ "button",
5815
+ {
5816
+ type: "button",
5817
+ onClick: onSplitAll,
5818
+ className: `${tabClass} ${ACTION_CLASS}`,
5819
+ "data-action": "split-all",
5820
+ children: splitAllLabel
5821
+ }
5822
+ )
5823
+ ] });
5824
+ }
5825
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)(import_jsx_runtime50.Fragment, { children: [
5826
+ placements.map((p) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5827
+ "button",
5828
+ {
5829
+ type: "button",
5830
+ onClick: () => onPlacementChange(p.label),
5831
+ "data-placement-tab": p.label,
5832
+ "aria-pressed": selectedPlacement === p.label,
5833
+ className: `${tabClass} transition-all duration-200 cursor-pointer border-b-2 ${selectedPlacement === p.label ? "text-foreground border-primary" : "text-foreground/70 hover:text-foreground border-muted-foreground/20 hover:border-muted-foreground/40"}`,
5834
+ children: p.label
5835
+ },
5836
+ p.label
5837
+ )),
5838
+ linked === false && onLinkAll && /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5839
+ "button",
5840
+ {
5841
+ type: "button",
5842
+ onClick: onLinkAll,
5843
+ className: `${tabClass} ${ACTION_CLASS}`,
5844
+ "data-action": "link-all",
5845
+ children: linkAllLabel
5846
+ }
5847
+ )
5848
+ ] });
5849
+ };
5786
5850
  if (isDesktop) {
5787
- return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)("div", { className: `flex flex-wrap gap-x-3 text-sm leading-relaxed w-full ${className}`, children: placements.map((p) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5788
- "button",
5851
+ return /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5852
+ "div",
5789
5853
  {
5790
- onClick: () => onPlacementChange(p.label),
5791
- className: `transition-all duration-200 cursor-pointer border-b-2 ${selectedPlacement === p.label ? "text-foreground border-primary" : "text-foreground/70 hover:text-foreground border-muted-foreground/20 hover:border-muted-foreground/40"}`,
5792
- children: p.label
5793
- },
5794
- p.label
5795
- )) });
5854
+ className: `flex flex-wrap items-center gap-x-3 gap-y-1 text-sm leading-relaxed w-full ${className}`,
5855
+ "data-placement-tabs": true,
5856
+ "data-linked": dataLinked,
5857
+ children: renderItems("")
5858
+ }
5859
+ );
5796
5860
  }
5797
5861
  const linesForToolbar = Math.ceil(toolbarSize / lineHeight);
5798
5862
  const shapeInsetPx = linesForToolbar * lineHeight;
@@ -5801,6 +5865,8 @@ function PlacementTabs({
5801
5865
  {
5802
5866
  ref: containerRef,
5803
5867
  className: `flex overflow-hidden text-sm leading-relaxed w-full ${className}`,
5868
+ "data-placement-tabs": true,
5869
+ "data-linked": dataLinked,
5804
5870
  children: /* @__PURE__ */ (0, import_jsx_runtime50.jsxs)("p", { className: "m-0 w-full", children: [
5805
5871
  /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5806
5872
  "span",
@@ -5819,15 +5885,7 @@ function PlacementTabs({
5819
5885
  )
5820
5886
  }
5821
5887
  ),
5822
- placements.map((p) => /* @__PURE__ */ (0, import_jsx_runtime50.jsx)(
5823
- "button",
5824
- {
5825
- onClick: () => onPlacementChange(p.label),
5826
- className: `inline transition-all duration-200 cursor-pointer mr-3 border-b-2 ${selectedPlacement === p.label ? "text-foreground border-primary" : "text-foreground/70 hover:text-foreground border-muted-foreground/20 hover:border-muted-foreground/40"}`,
5827
- children: p.label
5828
- },
5829
- p.label
5830
- ))
5888
+ renderItems("inline mr-3")
5831
5889
  ] })
5832
5890
  }
5833
5891
  );
@@ -16554,6 +16612,7 @@ function usePersonalizationShimmer(containerRef, safetyTimeoutMs = 1e4) {
16554
16612
  isWideMonitor,
16555
16613
  kbdVariants,
16556
16614
  linkVariants,
16615
+ linkedPlacementsLabel,
16557
16616
  listProducts,
16558
16617
  normalizeHex,
16559
16618
  observe,