@caseparts-org/caseblocks 0.0.297 → 0.0.299

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,19 +1,20 @@
1
- import { jsxs as p, Fragment as C, jsx as i } from "react/jsx-runtime";
2
- import { useState as g } from "react";
3
- import { MainNav as b } from "./MainNav.js";
4
- import { Text as h } from "../../atoms/Text/Text.js";
5
- import { Link as y } from "../../atoms/Link/Link.js";
6
- import { Button as S } from "../../atoms/Button/Button.js";
7
- import { CartSlideInPanel as v } from "../../molecules/Cart/CartSlideInPanel.js";
8
- const P = {
1
+ import { jsxs as y, Fragment as S, jsx as a } from "react/jsx-runtime";
2
+ import { useState as u } from "react";
3
+ import { MainNav as g } from "./MainNav.js";
4
+ import { Text as v } from "../../atoms/Text/Text.js";
5
+ import { Link as f } from "../../atoms/Link/Link.js";
6
+ import { Button as I } from "../../atoms/Button/Button.js";
7
+ import { CartSlideInPanel as R } from "../../molecules/Cart/CartSlideInPanel.js";
8
+ import { AddToCartPart as q } from "../../molecules/AddToCartPart/AddToCartPart.js";
9
+ const O = {
9
10
  title: "Case Parts/Organisms/MainNav",
10
- component: b,
11
+ component: g,
11
12
  parameters: {
12
13
  // Optional parameter to center the component in the Canvas. More info: https://storybook.js.org/docs/configure/story-layout
13
14
  layout: "fullscreen"
14
15
  }
15
16
  // tags: ["autodocs"],
16
- }, c = [
17
+ }, m = [
17
18
  {
18
19
  id: 0,
19
20
  label: "Shop by Brands",
@@ -106,7 +107,7 @@ const P = {
106
107
  route: "#",
107
108
  children: []
108
109
  }
109
- ], a = "https://m.media-amazon.com/images/I/216+JEttsYL._UF1000,1000_QL80_.jpg", I = {
110
+ ], t = "https://m.media-amazon.com/images/I/216+JEttsYL._UF1000,1000_QL80_.jpg", U = {
110
111
  terms: [
111
112
  { name: "gasket", url: "/search/gasket" },
112
113
  { name: "gasket strip", url: "/search/gasket-strip" },
@@ -124,62 +125,62 @@ const P = {
124
125
  { id: "heater", label: "Bent Heaters", url: "/custom/heater", icon: "fa-kit fa-coils" }
125
126
  ],
126
127
  items: [
127
- { itemKey: 13503, itemId: "GASKET-RING", description: "Gasket Sample Ring", image: a, url: "/part/GASKET-RING" },
128
- { itemKey: 13968, itemId: "810719", description: "26-5/8 x 54-1/4 Door Gasket For True", image: a, url: "/part/810719" },
129
- { itemKey: 14853, itemId: "932588", description: "23-3/8 x 26-3/4 Door Gasket For True", image: a, url: "/part/932588" },
130
- { itemKey: 435, itemId: "810803", description: "25-5/8 x 54-1/8 Door Gasket For True", image: a, url: "/part/810803" },
131
- { itemKey: 14622, itemId: "932587", description: "26-3/4 x 26-3/4 Door Gasket For True", image: a, url: "/part/932587" }
128
+ { itemKey: 13503, itemId: "GASKET-RING", description: "Gasket Sample Ring", image: t, url: "/part/GASKET-RING" },
129
+ { itemKey: 13968, itemId: "810719", description: "26-5/8 x 54-1/4 Door Gasket For True", image: t, url: "/part/810719" },
130
+ { itemKey: 14853, itemId: "932588", description: "23-3/8 x 26-3/4 Door Gasket For True", image: t, url: "/part/932588" },
131
+ { itemKey: 435, itemId: "810803", description: "25-5/8 x 54-1/8 Door Gasket For True", image: t, url: "/part/810803" },
132
+ { itemKey: 14622, itemId: "932587", description: "26-3/4 x 26-3/4 Door Gasket For True", image: t, url: "/part/932587" }
132
133
  ]
133
- }, f = [
134
+ }, $ = [
134
135
  { term: "door gasket", url: "/search/door-gasket" },
135
136
  { term: "walk-in cooler", url: "/search/walk-in-cooler" },
136
137
  { term: "thermostat", url: "/search/thermostat" }
137
138
  ], s = {
138
139
  items: [
139
- { id: 1, itemId: "1094-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
140
- { id: 2, itemId: "810810", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
141
- { id: 3, itemId: "MG064", description: '36" x 79" 3-Sided Dart-to-Dart Gasket', price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
142
- { id: 4, itemId: "MG064-B", description: '36" x 79" 3-Sided Dart-to-Dart Gasket', price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
143
- { id: 5, itemId: "Warmer Wire", description: '228" 7.0 OHMS 115V', price: "$99.99", quantity: 1, imageUrl: a, availability: "", availabilityId: "available" },
144
- { id: 6, itemId: "810803", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
145
- { id: 7, itemId: "ABG-12114-PF", description: "Adhesive Sponge Gasket 1/4", price: "$99.99", quantity: 10, imageUrl: a, availability: "In Stock", availabilityId: "available" },
146
- { id: 8, itemId: "ABG-12138-PF", description: "Adhesive Sponge Gasket 3/8", price: "$99.99", quantity: 10, imageUrl: a, availability: "In Stock", availabilityId: "available" },
147
- { id: 9, itemId: "1094-C1", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
148
- { id: 10, itemId: "1094-02", description: "Kason Door Closer - Offset", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
149
- { id: 11, itemId: "1092-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" },
150
- { id: 12, itemId: "1092-02", description: "Kason Door Closer - Offset", price: "$99.99", quantity: 1, imageUrl: a, availability: "In Stock", availabilityId: "available" }
140
+ { id: 1, itemId: "1094-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
141
+ { id: 2, itemId: "810810", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
142
+ { id: 3, itemId: "MG064", description: '36" x 79" 3-Sided Dart-to-Dart Gasket', price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
143
+ { id: 4, itemId: "MG064-B", description: '36" x 79" 3-Sided Dart-to-Dart Gasket', price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
144
+ { id: 5, itemId: "Warmer Wire", description: '228" 7.0 OHMS 115V', price: "$99.99", quantity: 1, imageUrl: t, availability: "", availabilityId: "available" },
145
+ { id: 6, itemId: "810803", description: "True Door Gasket", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
146
+ { id: 7, itemId: "ABG-12114-PF", description: "Adhesive Sponge Gasket 1/4", price: "$99.99", quantity: 10, imageUrl: t, availability: "In Stock", availabilityId: "available" },
147
+ { id: 8, itemId: "ABG-12138-PF", description: "Adhesive Sponge Gasket 3/8", price: "$99.99", quantity: 10, imageUrl: t, availability: "In Stock", availabilityId: "available" },
148
+ { id: 9, itemId: "1094-C1", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
149
+ { id: 10, itemId: "1094-02", description: "Kason Door Closer - Offset", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
150
+ { id: 11, itemId: "1092-01", description: "Kason Door Closer - Flush", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" },
151
+ { id: 12, itemId: "1092-02", description: "Kason Door Closer - Offset", price: "$99.99", quantity: 1, imageUrl: t, availability: "In Stock", availabilityId: "available" }
151
152
  ]
152
153
  };
153
- function R(e) {
154
+ function h(e) {
154
155
  return `$${e.items.reduce(
155
- (t, r) => t + (parseFloat(r.price.replace(/[^0-9.]/g, "")) || 0) * r.quantity,
156
+ (o, i) => o + (parseFloat(i.price.replace(/[^0-9.]/g, "")) || 0) * i.quantity,
156
157
  0
157
158
  ).toFixed(2)}`;
158
159
  }
159
- const d = /* @__PURE__ */ p("div", { style: { display: "flex", flexDirection: "column", gap: 8, minWidth: 220 }, children: [
160
- /* @__PURE__ */ i(h, { size: "sm", weight: "semibold", children: "Account" }),
161
- /* @__PURE__ */ i(h, { size: "xs", children: "Signed in as Ringo" }),
162
- /* @__PURE__ */ i(y, { href: "/account", "data-popover-close": "true", children: "View Account" }),
163
- /* @__PURE__ */ i(y, { href: "/orders", "data-popover-close": "true", children: "Quotes & Orders" }),
164
- /* @__PURE__ */ i(S, { size: "sm", variant: "secondary", "data-popover-close": "true", onClick: () => alert("Sign out"), children: "Sign Out" })
165
- ] }), m = (e) => {
166
- const [o, t] = g(!1);
167
- return /* @__PURE__ */ p(C, { children: [
168
- /* @__PURE__ */ i(
169
- b,
160
+ const b = /* @__PURE__ */ y("div", { style: { display: "flex", flexDirection: "column", gap: 8, minWidth: 220 }, children: [
161
+ /* @__PURE__ */ a(v, { size: "sm", weight: "semibold", children: "Account" }),
162
+ /* @__PURE__ */ a(v, { size: "xs", children: "Signed in as Ringo" }),
163
+ /* @__PURE__ */ a(f, { href: "/account", "data-popover-close": "true", children: "View Account" }),
164
+ /* @__PURE__ */ a(f, { href: "/orders", "data-popover-close": "true", children: "Quotes & Orders" }),
165
+ /* @__PURE__ */ a(I, { size: "sm", variant: "secondary", "data-popover-close": "true", onClick: () => alert("Sign out"), children: "Sign Out" })
166
+ ] }), C = (e) => {
167
+ const [r, o] = u(!1);
168
+ return /* @__PURE__ */ y(S, { children: [
169
+ /* @__PURE__ */ a(
170
+ g,
170
171
  {
171
172
  ...e,
172
- open: o,
173
- onCartClick: () => t((r) => !r)
173
+ open: r,
174
+ onCartClick: () => o((i) => !i)
174
175
  }
175
176
  ),
176
- /* @__PURE__ */ i(
177
- v,
177
+ /* @__PURE__ */ a(
178
+ R,
178
179
  {
179
- open: o,
180
- onClose: () => t(!1),
180
+ open: r,
181
+ onClose: () => o(!1),
181
182
  cart: e.cart,
182
- subtotal: R(e.cart),
183
+ subtotal: h(e.cart),
183
184
  itemPriceLabel: "List Price",
184
185
  onItemQtyChange: () => alert("Qty Change"),
185
186
  onItemDelete: () => alert("Delete"),
@@ -187,32 +188,84 @@ const d = /* @__PURE__ */ p("div", { style: { display: "flex", flexDirection: "c
187
188
  }
188
189
  )
189
190
  ] });
190
- }, G = (e) => {
191
- const [o, t] = g(""), [r, k] = g(f);
192
- return /* @__PURE__ */ i(
193
- b,
191
+ }, L = (e) => {
192
+ const [r, o] = u(!1), [i, p] = u(0), [l, n] = u("closed"), c = s.items[(i - 1) % 2], D = s.items.reduce((d, G) => d + G.quantity, 0) + i;
193
+ function k() {
194
+ n("dismissed"), window.setTimeout(() => {
195
+ n((d) => d === "dismissed" ? "closed" : d);
196
+ }, 1e3);
197
+ }
198
+ return /* @__PURE__ */ y(S, { children: [
199
+ /* @__PURE__ */ a("div", { style: { position: "sticky", top: 0, zIndex: 20, background: "white" }, children: /* @__PURE__ */ a(
200
+ g,
201
+ {
202
+ ...e,
203
+ cart: { items: [...s.items, ...i ? [{ ...s.items[0], quantity: i }] : []] },
204
+ open: r,
205
+ onCartClick: () => o(!0),
206
+ cartConfirmationKey: l !== "closed" ? i : void 0,
207
+ cartConfirmationVisible: l === "open",
208
+ onCartConfirmationDismiss: k,
209
+ cartConfirmation: l !== "closed" && c && /* @__PURE__ */ a(
210
+ q,
211
+ {
212
+ title: c.description,
213
+ titleHref: "#part",
214
+ imageUrl: c.imageUrl,
215
+ partNumber: c.itemId,
216
+ quantity: 1,
217
+ price: c.price,
218
+ cartCount: D,
219
+ subtotal: `$${(parseFloat(h(s).slice(1)) + i * 99.99).toFixed(2)}`,
220
+ checkoutHref: "/checkout",
221
+ onDismiss: k
222
+ }
223
+ )
224
+ }
225
+ ) }),
226
+ /* @__PURE__ */ a("div", { style: { padding: 24, paddingTop: 240, minHeight: "200vh" }, children: /* @__PURE__ */ a(I, { size: "md", variant: "cta-primary", onClick: () => {
227
+ p((d) => d + 1), n("open");
228
+ }, children: "Add sample part" }) }),
229
+ /* @__PURE__ */ a(
230
+ R,
231
+ {
232
+ open: r,
233
+ onClose: () => o(!1),
234
+ cart: e.cart,
235
+ subtotal: h(e.cart),
236
+ itemPriceLabel: "List Price",
237
+ onItemQtyChange: () => alert("Qty Change"),
238
+ onItemDelete: () => alert("Delete"),
239
+ onCheckout: () => alert("checkout")
240
+ }
241
+ )
242
+ ] });
243
+ }, P = (e) => {
244
+ const [r, o] = u(""), [i, p] = u($);
245
+ return /* @__PURE__ */ a(
246
+ g,
194
247
  {
195
248
  ...e,
196
- searchValue: o,
197
- onSearchValueChange: t,
198
- onClearSearch: () => t(""),
249
+ searchValue: r,
250
+ onSearchValueChange: o,
251
+ onClearSearch: () => o(""),
199
252
  onSearch: (l) => alert(`Search for ${l}`),
200
- searchSuggestions: o ? I : void 0,
201
- recentSearches: r,
253
+ searchSuggestions: r ? U : void 0,
254
+ recentSearches: i,
202
255
  onClearRecentSearch: (l) => {
203
- k((n) => n.filter((u) => u.url !== l.url));
256
+ p((n) => n.filter((c) => c.url !== l.url));
204
257
  },
205
258
  searchInputProps: {
206
259
  ...e.searchInputProps,
207
- value: o,
260
+ value: r,
208
261
  onChange: (l) => {
209
- var n, u;
210
- (u = (n = e.searchInputProps) == null ? void 0 : n.onChange) == null || u.call(n, l), t(l.target.value);
262
+ var n, c;
263
+ (c = (n = e.searchInputProps) == null ? void 0 : n.onChange) == null || c.call(n, l), o(l.target.value);
211
264
  }
212
265
  }
213
266
  }
214
267
  );
215
- }, x = {
268
+ }, B = {
216
269
  args: {
217
270
  account: { name: "Ringo", initials: "RS", number: "123456789012" },
218
271
  cart: s,
@@ -233,11 +286,11 @@ const d = /* @__PURE__ */ p("div", { style: { display: "flex", flexDirection: "c
233
286
  onCartClick: () => {
234
287
  },
235
288
  // placeholder required by component
236
- categories: c,
237
- accountPopoverContent: d
289
+ categories: m,
290
+ accountPopoverContent: b
238
291
  },
239
- render: m
240
- }, A = {
292
+ render: C
293
+ }, V = {
241
294
  args: {
242
295
  account: { name: "Ringo", initials: "RS", number: "123456789012" },
243
296
  cart: s,
@@ -257,11 +310,11 @@ const d = /* @__PURE__ */ p("div", { style: { display: "flex", flexDirection: "c
257
310
  },
258
311
  onCartClick: () => {
259
312
  },
260
- categories: c,
261
- accountPopoverContent: d
313
+ categories: m,
314
+ accountPopoverContent: b
262
315
  },
263
- render: m
264
- }, F = {
316
+ render: L
317
+ }, z = {
265
318
  args: {
266
319
  account: { name: "Ringo", initials: "RS", number: "123456789012" },
267
320
  cart: s,
@@ -281,11 +334,11 @@ const d = /* @__PURE__ */ p("div", { style: { display: "flex", flexDirection: "c
281
334
  },
282
335
  onCartClick: () => {
283
336
  },
284
- categories: c,
285
- accountPopoverContent: d
337
+ categories: m,
338
+ accountPopoverContent: b
286
339
  },
287
- render: G
288
- }, w = {
340
+ render: P
341
+ }, Q = {
289
342
  args: {
290
343
  cart: s,
291
344
  homeRoute: "/",
@@ -304,10 +357,10 @@ const d = /* @__PURE__ */ p("div", { style: { display: "flex", flexDirection: "c
304
357
  },
305
358
  onCartClick: () => {
306
359
  },
307
- categories: c
360
+ categories: m
308
361
  },
309
- render: m
310
- }, T = {
362
+ render: C
363
+ }, W = {
311
364
  args: {
312
365
  account: { name: "Ringo", initials: "RS", number: "123456789012" },
313
366
  cart: s,
@@ -327,18 +380,18 @@ const d = /* @__PURE__ */ p("div", { style: { display: "flex", flexDirection: "c
327
380
  },
328
381
  onCartClick: () => {
329
382
  },
330
- categories: c,
331
- accountPopoverContent: d,
383
+ categories: m,
384
+ accountPopoverContent: b,
332
385
  isAccountLoading: !0,
333
386
  isCategoriesLoading: !0
334
387
  },
335
- render: m
388
+ render: C
336
389
  };
337
390
  export {
338
- x as Authenticated,
339
- T as Loading,
340
- w as Unauthenticated,
341
- A as WithCartItems,
342
- F as WithSearchSuggestions,
343
- P as default
391
+ B as Authenticated,
392
+ W as Loading,
393
+ Q as Unauthenticated,
394
+ V as WithCartItems,
395
+ z as WithSearchSuggestions,
396
+ O as default
344
397
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@caseparts-org/caseblocks",
3
3
  "private": false,
4
- "version": "0.0.297",
4
+ "version": "0.0.299",
5
5
  "type": "module",
6
6
  "module": "dist/main.js",
7
7
  "types": "dist/main.d.ts",
@@ -1,38 +0,0 @@
1
- import './assets/Cart.css';const t = "_cartIconButton_9rzdh_2", n = "_count_9rzdh_15", o = "_cartContainer_9rzdh_33", e = "_headerWrapper_9rzdh_45", a = "_header_9rzdh_45", r = "_cartItems_9rzdh_63", i = "_cartItem_9rzdh_63", _ = "_cartItemContent_9rzdh_82", c = "_carItemSeparator_9rzdh_94", d = "_itemContainer_9rzdh_98", m = "_topRow_9rzdh_102", s = "_itemInfo_9rzdh_109", I = "_unitDetails_9rzdh_115", h = "_editUnit_9rzdh_119", l = "_purchaseInformation_9rzdh_135", z = "_availabilitySlot_9rzdh_141", p = "_priceSlot_9rzdh_148", g = "_itemManagement_9rzdh_150", u = "_itemImage_9rzdh_163", A = "_removeItem_9rzdh_166", C = "_cartItemAdmonitionsPanel_9rzdh_175", v = "_admonitionsPanelCollapsed_9rzdh_180", R = "_cartItemAdmonitionsTrigger_9rzdh_185", S = "_cartItemAdmonitionHeader_9rzdh_197", T = "_admonitionsReveal_9rzdh_205", x = "_admonitionsRevealExpanded_9rzdh_210", b = "_cartItemAdmonitions_9rzdh_175", f = "_admonitionTriggerIconExpanded_9rzdh_216", B = "_admonitionTriggerIcon_9rzdh_216", E = "_cartItemAdmonitionContent_9rzdh_229", P = "_noItems_9rzdh_239", y = "_subtotal_9rzdh_246", k = "_checkoutButton_9rzdh_253", w = {
2
- cartIconButton: t,
3
- count: n,
4
- cartContainer: o,
5
- headerWrapper: e,
6
- header: a,
7
- cartItems: r,
8
- cartItem: i,
9
- cartItemContent: _,
10
- carItemSeparator: c,
11
- itemContainer: d,
12
- topRow: m,
13
- itemInfo: s,
14
- unitDetails: I,
15
- editUnit: h,
16
- purchaseInformation: l,
17
- availabilitySlot: z,
18
- priceSlot: p,
19
- itemManagement: g,
20
- itemImage: u,
21
- removeItem: A,
22
- cartItemAdmonitionsPanel: C,
23
- admonitionsPanelCollapsed: v,
24
- cartItemAdmonitionsTrigger: R,
25
- cartItemAdmonitionHeader: S,
26
- admonitionsReveal: T,
27
- admonitionsRevealExpanded: x,
28
- cartItemAdmonitions: b,
29
- admonitionTriggerIconExpanded: f,
30
- admonitionTriggerIcon: B,
31
- cartItemAdmonitionContent: E,
32
- noItems: P,
33
- subtotal: y,
34
- checkoutButton: k
35
- };
36
- export {
37
- w as s
38
- };