@handijitcom/ui 3.7.0 → 3.9.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.
Files changed (102) hide show
  1. package/README.md +121 -2
  2. package/build/components/AddToCart/index.cjs +2 -0
  3. package/build/components/AddToCart/index.cjs.map +1 -0
  4. package/build/components/AddToCart/index.d.cts +31 -0
  5. package/build/components/AddToCart/index.d.ts +31 -0
  6. package/build/components/AddToCart/index.js +62 -0
  7. package/build/components/AddToCart/index.js.map +1 -0
  8. package/build/components/AddToCart/style.css +1 -0
  9. package/build/components/CodeText/index.cjs.map +1 -1
  10. package/build/components/CodeText/index.js +11 -11
  11. package/build/components/CodeText/index.js.map +1 -1
  12. package/build/components/Heading/index.cjs +1 -1
  13. package/build/components/Heading/index.cjs.map +1 -1
  14. package/build/components/Heading/index.js +7 -7
  15. package/build/components/Heading/index.js.map +1 -1
  16. package/build/components/PartNumberList/index.cjs +2 -0
  17. package/build/components/PartNumberList/index.cjs.map +1 -0
  18. package/build/components/PartNumberList/index.d.cts +30 -0
  19. package/build/components/PartNumberList/index.d.ts +30 -0
  20. package/build/components/PartNumberList/index.js +36 -0
  21. package/build/components/PartNumberList/index.js.map +1 -0
  22. package/build/components/PartNumberList/style.css +1 -0
  23. package/build/components/ProductCard/index.cjs +2 -0
  24. package/build/components/ProductCard/index.cjs.map +1 -0
  25. package/build/components/ProductCard/index.d.cts +55 -0
  26. package/build/components/ProductCard/index.d.ts +55 -0
  27. package/build/components/ProductCard/index.js +58 -0
  28. package/build/components/ProductCard/index.js.map +1 -0
  29. package/build/components/ProductCard/style.css +1 -0
  30. package/build/components/ProductRow/columns.cjs +2 -0
  31. package/build/components/ProductRow/columns.cjs.map +1 -0
  32. package/build/components/ProductRow/columns.d.cts +27 -0
  33. package/build/components/ProductRow/columns.d.ts +27 -0
  34. package/build/components/ProductRow/columns.js +83 -0
  35. package/build/components/ProductRow/columns.js.map +1 -0
  36. package/build/components/ProductRow/index.cjs +2 -0
  37. package/build/components/ProductRow/index.cjs.map +1 -0
  38. package/build/components/ProductRow/index.d.cts +25 -0
  39. package/build/components/ProductRow/index.d.ts +25 -0
  40. package/build/components/ProductRow/index.js +43 -0
  41. package/build/components/ProductRow/index.js.map +1 -0
  42. package/build/components/ProductRow/parts.cjs +2 -0
  43. package/build/components/ProductRow/parts.cjs.map +1 -0
  44. package/build/components/ProductRow/parts.d.cts +32 -0
  45. package/build/components/ProductRow/parts.d.ts +32 -0
  46. package/build/components/ProductRow/parts.js +31 -0
  47. package/build/components/ProductRow/parts.js.map +1 -0
  48. package/build/components/ProductRow/style.css +1 -0
  49. package/build/components/QuantityStepper/index.cjs +1 -1
  50. package/build/components/QuantityStepper/index.cjs.map +1 -1
  51. package/build/components/QuantityStepper/index.js +28 -28
  52. package/build/components/QuantityStepper/index.js.map +1 -1
  53. package/build/components/SearchField/index.cjs +2 -0
  54. package/build/components/SearchField/index.cjs.map +1 -0
  55. package/build/components/SearchField/index.d.cts +84 -0
  56. package/build/components/SearchField/index.d.ts +84 -0
  57. package/build/components/SearchField/index.js +209 -0
  58. package/build/components/SearchField/index.js.map +1 -0
  59. package/build/components/SearchField/style.css +1 -0
  60. package/build/components/SpecTable/index.cjs +2 -0
  61. package/build/components/SpecTable/index.cjs.map +1 -0
  62. package/build/components/SpecTable/index.d.cts +25 -0
  63. package/build/components/SpecTable/index.d.ts +25 -0
  64. package/build/components/SpecTable/index.js +25 -0
  65. package/build/components/SpecTable/index.js.map +1 -0
  66. package/build/components/SpecTable/style.css +1 -0
  67. package/build/components/StatusCell/index.cjs +2 -0
  68. package/build/components/StatusCell/index.cjs.map +1 -0
  69. package/build/components/StatusCell/index.d.cts +28 -0
  70. package/build/components/StatusCell/index.d.ts +28 -0
  71. package/build/components/StatusCell/index.js +24 -0
  72. package/build/components/StatusCell/index.js.map +1 -0
  73. package/build/components/StatusCell/style.css +1 -0
  74. package/build/components/StockStatus/index.cjs +2 -0
  75. package/build/components/StockStatus/index.cjs.map +1 -0
  76. package/build/components/StockStatus/index.d.cts +28 -0
  77. package/build/components/StockStatus/index.d.ts +28 -0
  78. package/build/components/StockStatus/index.js +36 -0
  79. package/build/components/StockStatus/index.js.map +1 -0
  80. package/build/components/StockStatus/style.css +1 -0
  81. package/build/components/Tooltip/index.cjs +1 -1
  82. package/build/components/Tooltip/index.cjs.map +1 -1
  83. package/build/components/Tooltip/index.js +27 -27
  84. package/build/components/Tooltip/index.js.map +1 -1
  85. package/build/components/VehicleTypeList/index.cjs +2 -0
  86. package/build/components/VehicleTypeList/index.cjs.map +1 -0
  87. package/build/components/VehicleTypeList/index.d.cts +17 -0
  88. package/build/components/VehicleTypeList/index.d.ts +17 -0
  89. package/build/components/VehicleTypeList/index.js +47 -0
  90. package/build/components/VehicleTypeList/index.js.map +1 -0
  91. package/build/components/VehicleTypeList/style.css +1 -0
  92. package/build/index.cjs +1 -1
  93. package/build/index.d.cts +9 -0
  94. package/build/index.d.ts +9 -0
  95. package/build/index.js +143 -123
  96. package/build/index.js.map +1 -1
  97. package/build/styles.css +22 -0
  98. package/build/types/theme.type.d.cts +34 -0
  99. package/build/types/theme.type.d.ts +34 -0
  100. package/build/types/types/theme.type.d.cts +34 -0
  101. package/build/types/types/theme.type.d.ts +34 -0
  102. package/package.json +91 -1
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),N=require("react"),p=require("../../helpers/class-name.helper.cjs"),q=require("../../helpers/component.helper.cjs"),v=require("../CodeText/index.cjs"),y=require("../Heading/index.cjs"),n=require("../Link/index.cjs"),C=require("../VehicleTypeList/index.cjs"),a={default:{"card":"ui-card-TTAoP","card__media":"ui-card__media-tPiQl","card__body":"ui-card__body-ziNkF","card__meta":"ui-card__meta-XekAt","card__brand":"ui-card__brand-LC7g0","card__badges":"ui-card__badges-QTBfN","card__name":"ui-card__name-Uh0c0","card__link":"ui-card__link-jZICj","card__code":"ui-card__code-mUbX4","card__foot":"ui-card__foot-c9WvK","card__price":"ui-card__price-M3q0R","card__action":"ui-card__action-g2OI6"}},b=({name:c,href:t,linkProps:l,partNumber:u,image:_,brand:d,badges:s,vehicleTypes:o=[],stock:r,price:m,signIn:x,action:i,headingLevel:f=3,className:j,testId:h})=>e.jsxs("article",{className:p.cx(a.default.card,j),"data-testid":h,children:[e.jsx(n.default,{...l,href:t,className:a.default.card__media,tabIndex:-1,"aria-hidden":!0,children:_}),e.jsxs("div",{className:a.default.card__body,children:[(d||s)&&e.jsxs("div",{className:a.default.card__meta,children:[d&&e.jsx("span",{className:a.default.card__brand,children:d}),s&&e.jsx("span",{className:a.default.card__badges,children:s})]}),e.jsx(y.default,{level:f,size:"xs",maxLines:2,title:c,className:a.default.card__name,children:e.jsx(n.default,{...l,href:t,className:a.default.card__link,children:c})}),e.jsx(v.default,{code:u,isCopyable:!0,size:"sm",isMuted:!0,className:a.default.card__code}),e.jsx(C.default,{types:o}),e.jsxs("div",{className:a.default.card__foot,children:[r&&e.jsx("div",{className:a.default.card__stock,children:r}),e.jsx("div",{className:a.default.card__price,children:m??x}),i&&e.jsx("div",{className:a.default.card__action,children:i})]})]})]}),M=N.memo(q.named(b,"ProductCard"));exports.default=M;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/ProductCard/index.tsx"],"sourcesContent":["import { memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport type { UiLinkExtraProps } from '../../types/link.type';\nimport CodeText from '../CodeText';\nimport Heading from '../Heading';\nimport UiLink from '../Link';\nimport VehicleTypeList from '../VehicleTypeList';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n /** The product's name; two lines at most, the rest in its tooltip. */\n name: string;\n /** The product page. The image and the name link to it; the card itself is not one link. */\n href: string;\n linkProps?: UiLinkExtraProps;\n /** The part number, mono and copyable (\"428959612\"). */\n partNumber: string;\n /** The image (`<img alt=\"\">` or the framework's image), drawn `contain` in a fixed-ratio box. */\n image?: ReactNode;\n /** The brand line over the name (\"IVECO\"), with room for a mark. */\n brand?: ReactNode;\n /** Small badges beside the brand (\"Orijinal\", \"Muadil\"): one line. */\n badges?: ReactNode;\n /** Compatible vehicle types; the first two, then \"+N\". */\n vehicleTypes?: readonly string[];\n /** The stock line: a `StockStatus`. */\n stock?: ReactNode;\n /**\n * The price block: a `Price` with `listValue` and `discountPercent` for net / list / discount.\n * Without it the card shows `signIn`.\n */\n price?: ReactNode;\n /** What a visitor sees instead of the price (\"Fiyat için giriş yapın\" + a link). */\n signIn?: ReactNode;\n /** The action row at the card's foot: an `AddToCart`. */\n action?: ReactNode;\n /** The name's heading level in the page's outline; default 3. */\n headingLevel?: 2 | 3 | 4;\n className?: string;\n testId?: string;\n};\n\n/**\n * ProductCard (3.8) — a B2B product in a grid: a fixed-ratio image, the brand and badges, the name\n * (two lines), the copyable part number, the vehicle types (two + \"+N\"), then at the foot the stock,\n * the price (or the visitor's sign-in prompt) and the add-to-cart row. Every card of a row is as\n * tall as the row and its foot sits at the bottom, so prices and buttons line up across the grid.\n * @example\n * <ProductCard\n * name=\"Ön far (sol) – Stralis / S-Way\"\n * href=\"/parca/on-far-sol\"\n * partNumber=\"428959612\"\n * image={<img src={url} alt=\"\" />}\n * brand=\"IVECO\"\n * vehicleTypes={['Stralis', 'S-Way', 'Trakker']}\n * stock={<StockStatus tone=\"available\" label=\"Stokta (24)\" />}\n * price={<Price value=\"1.229,00\" listValue=\"1.450,00\" discountPercent={15} />}\n * action={<AddToCart productName=\"Ön far (sol)\" onAdd={add} />}\n * />\n */\nconst ProductCard = ({\n name,\n href,\n linkProps,\n partNumber,\n image,\n brand,\n badges,\n vehicleTypes = [],\n stock,\n price,\n signIn,\n action,\n headingLevel = 3,\n className,\n testId,\n}: Props) => (\n <article className={cx(styles.card, className)} data-testid={testId}>\n {/* The name is the link a screen reader meets; the image repeats it for the pointer only. */}\n <UiLink {...linkProps} href={href} className={styles.card__media} tabIndex={-1} aria-hidden>\n {image}\n </UiLink>\n\n <div className={styles.card__body}>\n {(brand || badges) && (\n <div className={styles.card__meta}>\n {brand && <span className={styles.card__brand}>{brand}</span>}\n {badges && <span className={styles.card__badges}>{badges}</span>}\n </div>\n )}\n\n <Heading\n level={headingLevel}\n size=\"xs\"\n maxLines={2}\n title={name}\n className={styles.card__name}\n >\n <UiLink {...linkProps} href={href} className={styles.card__link}>\n {name}\n </UiLink>\n </Heading>\n\n <CodeText code={partNumber} isCopyable size=\"sm\" isMuted className={styles.card__code} />\n\n <VehicleTypeList types={vehicleTypes} />\n\n <div className={styles.card__foot}>\n {stock && <div className={styles.card__stock}>{stock}</div>}\n <div className={styles.card__price}>{price ?? signIn}</div>\n {action && <div className={styles.card__action}>{action}</div>}\n </div>\n </div>\n </article>\n);\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(ProductCard, 'ProductCard'),\n) as typeof ProductCard;\n"],"names":["ProductCard","name","href","linkProps","partNumber","image","brand","badges","vehicleTypes","stock","price","signIn","action","headingLevel","className","testId","jsxs","cx","styles","jsx","UiLink","Heading","CodeText","VehicleTypeList","index","memo","named"],"mappings":"wbA+DMA,EAAc,CAAC,CACnB,KAAAC,EACA,KAAAC,EACA,UAAAC,EACA,WAAAC,EACA,MAAAC,EACA,MAAAC,EACA,OAAAC,EACA,aAAAC,EAAe,CAAA,EACf,MAAAC,EACA,MAAAC,EACA,OAAAC,EACA,OAAAC,EACA,aAAAC,EAAe,EACf,UAAAC,EACA,OAAAC,CACF,IACEC,OAAC,WAAQ,UAAWC,EAAAA,GAAGC,EAAAA,QAAO,KAAMJ,CAAS,EAAG,cAAaC,EAE3D,SAAA,CAAAI,EAAAA,IAACC,EAAAA,QAAA,CAAQ,GAAGjB,EAAW,KAAAD,EAAY,UAAWgB,EAAAA,QAAO,YAAa,SAAU,GAAI,cAAW,GACxF,SAAAb,CAAA,CACH,EAEAW,EAAAA,KAAC,MAAA,CAAI,UAAWE,EAAAA,QAAO,WACnB,SAAA,EAAAZ,GAASC,IACTS,OAAC,MAAA,CAAI,UAAWE,EAAAA,QAAO,WACpB,SAAA,CAAAZ,GAASa,EAAAA,IAAC,OAAA,CAAK,UAAWD,EAAAA,QAAO,YAAc,SAAAZ,EAAM,EACrDC,GAAUY,EAAAA,IAAC,OAAA,CAAK,UAAWD,EAAAA,QAAO,aAAe,SAAAX,CAAA,CAAO,CAAA,EAC3D,EAGFY,EAAAA,IAACE,EAAAA,QAAA,CACC,MAAOR,EACP,KAAK,KACL,SAAU,EACV,MAAOZ,EACP,UAAWiB,EAAAA,QAAO,WAElB,SAAAC,EAAAA,IAACC,WAAQ,GAAGjB,EAAW,KAAAD,EAAY,UAAWgB,EAAAA,QAAO,WAClD,SAAAjB,CAAA,CACH,CAAA,CAAA,EAGFkB,EAAAA,IAACG,EAAAA,QAAA,CAAS,KAAMlB,EAAY,WAAU,GAAC,KAAK,KAAK,QAAO,GAAC,UAAWc,EAAAA,QAAO,UAAA,CAAY,EAEvFC,EAAAA,IAACI,EAAAA,QAAA,CAAgB,MAAOf,CAAA,CAAc,EAEtCQ,EAAAA,KAAC,MAAA,CAAI,UAAWE,EAAAA,QAAO,WACpB,SAAA,CAAAT,GAASU,EAAAA,IAAC,MAAA,CAAI,UAAWD,EAAAA,QAAO,YAAc,SAAAT,EAAM,QACpD,MAAA,CAAI,UAAWS,EAAAA,QAAO,YAAc,YAASP,EAAO,EACpDC,GAAUO,EAAAA,IAAC,MAAA,CAAI,UAAWD,EAAAA,QAAO,aAAe,SAAAN,CAAA,CAAO,CAAA,CAAA,CAC1D,CAAA,CAAA,CACF,CAAA,EACF,EAGFY,EAA6BC,EAAAA,KACbC,EAAAA,MAAM1B,EAAa,aAAa,CAChD"}
@@ -0,0 +1,55 @@
1
+ import { ReactNode } from 'react';
2
+ import { UiLinkExtraProps } from '../../types/link.type.cjs';
3
+ type Props = {
4
+ /** The product's name; two lines at most, the rest in its tooltip. */
5
+ name: string;
6
+ /** The product page. The image and the name link to it; the card itself is not one link. */
7
+ href: string;
8
+ linkProps?: UiLinkExtraProps;
9
+ /** The part number, mono and copyable ("428959612"). */
10
+ partNumber: string;
11
+ /** The image (`<img alt="">` or the framework's image), drawn `contain` in a fixed-ratio box. */
12
+ image?: ReactNode;
13
+ /** The brand line over the name ("IVECO"), with room for a mark. */
14
+ brand?: ReactNode;
15
+ /** Small badges beside the brand ("Orijinal", "Muadil"): one line. */
16
+ badges?: ReactNode;
17
+ /** Compatible vehicle types; the first two, then "+N". */
18
+ vehicleTypes?: readonly string[];
19
+ /** The stock line: a `StockStatus`. */
20
+ stock?: ReactNode;
21
+ /**
22
+ * The price block: a `Price` with `listValue` and `discountPercent` for net / list / discount.
23
+ * Without it the card shows `signIn`.
24
+ */
25
+ price?: ReactNode;
26
+ /** What a visitor sees instead of the price ("Fiyat için giriş yapın" + a link). */
27
+ signIn?: ReactNode;
28
+ /** The action row at the card's foot: an `AddToCart`. */
29
+ action?: ReactNode;
30
+ /** The name's heading level in the page's outline; default 3. */
31
+ headingLevel?: 2 | 3 | 4;
32
+ className?: string;
33
+ testId?: string;
34
+ };
35
+ /**
36
+ * ProductCard (3.8) — a B2B product in a grid: a fixed-ratio image, the brand and badges, the name
37
+ * (two lines), the copyable part number, the vehicle types (two + "+N"), then at the foot the stock,
38
+ * the price (or the visitor's sign-in prompt) and the add-to-cart row. Every card of a row is as
39
+ * tall as the row and its foot sits at the bottom, so prices and buttons line up across the grid.
40
+ * @example
41
+ * <ProductCard
42
+ * name="Ön far (sol) – Stralis / S-Way"
43
+ * href="/parca/on-far-sol"
44
+ * partNumber="428959612"
45
+ * image={<img src={url} alt="" />}
46
+ * brand="IVECO"
47
+ * vehicleTypes={['Stralis', 'S-Way', 'Trakker']}
48
+ * stock={<StockStatus tone="available" label="Stokta (24)" />}
49
+ * price={<Price value="1.229,00" listValue="1.450,00" discountPercent={15} />}
50
+ * action={<AddToCart productName="Ön far (sol)" onAdd={add} />}
51
+ * />
52
+ */
53
+ declare const ProductCard: ({ name, href, linkProps, partNumber, image, brand, badges, vehicleTypes, stock, price, signIn, action, headingLevel, className, testId, }: Props) => import("react").JSX.Element;
54
+ declare const _default: typeof ProductCard;
55
+ export default _default;
@@ -0,0 +1,55 @@
1
+ import { ReactNode } from 'react';
2
+ import { UiLinkExtraProps } from '../../types/link.type.js';
3
+ type Props = {
4
+ /** The product's name; two lines at most, the rest in its tooltip. */
5
+ name: string;
6
+ /** The product page. The image and the name link to it; the card itself is not one link. */
7
+ href: string;
8
+ linkProps?: UiLinkExtraProps;
9
+ /** The part number, mono and copyable ("428959612"). */
10
+ partNumber: string;
11
+ /** The image (`<img alt="">` or the framework's image), drawn `contain` in a fixed-ratio box. */
12
+ image?: ReactNode;
13
+ /** The brand line over the name ("IVECO"), with room for a mark. */
14
+ brand?: ReactNode;
15
+ /** Small badges beside the brand ("Orijinal", "Muadil"): one line. */
16
+ badges?: ReactNode;
17
+ /** Compatible vehicle types; the first two, then "+N". */
18
+ vehicleTypes?: readonly string[];
19
+ /** The stock line: a `StockStatus`. */
20
+ stock?: ReactNode;
21
+ /**
22
+ * The price block: a `Price` with `listValue` and `discountPercent` for net / list / discount.
23
+ * Without it the card shows `signIn`.
24
+ */
25
+ price?: ReactNode;
26
+ /** What a visitor sees instead of the price ("Fiyat için giriş yapın" + a link). */
27
+ signIn?: ReactNode;
28
+ /** The action row at the card's foot: an `AddToCart`. */
29
+ action?: ReactNode;
30
+ /** The name's heading level in the page's outline; default 3. */
31
+ headingLevel?: 2 | 3 | 4;
32
+ className?: string;
33
+ testId?: string;
34
+ };
35
+ /**
36
+ * ProductCard (3.8) — a B2B product in a grid: a fixed-ratio image, the brand and badges, the name
37
+ * (two lines), the copyable part number, the vehicle types (two + "+N"), then at the foot the stock,
38
+ * the price (or the visitor's sign-in prompt) and the add-to-cart row. Every card of a row is as
39
+ * tall as the row and its foot sits at the bottom, so prices and buttons line up across the grid.
40
+ * @example
41
+ * <ProductCard
42
+ * name="Ön far (sol) – Stralis / S-Way"
43
+ * href="/parca/on-far-sol"
44
+ * partNumber="428959612"
45
+ * image={<img src={url} alt="" />}
46
+ * brand="IVECO"
47
+ * vehicleTypes={['Stralis', 'S-Way', 'Trakker']}
48
+ * stock={<StockStatus tone="available" label="Stokta (24)" />}
49
+ * price={<Price value="1.229,00" listValue="1.450,00" discountPercent={15} />}
50
+ * action={<AddToCart productName="Ön far (sol)" onAdd={add} />}
51
+ * />
52
+ */
53
+ declare const ProductCard: ({ name, href, linkProps, partNumber, image, brand, badges, vehicleTypes, stock, price, signIn, action, headingLevel, className, testId, }: Props) => import("react").JSX.Element;
54
+ declare const _default: typeof ProductCard;
55
+ export default _default;
@@ -0,0 +1,58 @@
1
+ import { jsxs as r, jsx as a } from "react/jsx-runtime";
2
+ import { memo as v } from "react";
3
+ import { cx as y } from "../../helpers/class-name.helper.js";
4
+ import { named as C } from "../../helpers/component.helper.js";
5
+ import L from "../CodeText/index.js";
6
+ import j from "../Heading/index.js";
7
+ import o from "../Link/index.js";
8
+ import z from "../VehicleTypeList/index.js";
9
+ const e = {"card":"ui-card-TTAoP","card__media":"ui-card__media-tPiQl","card__body":"ui-card__body-ziNkF","card__meta":"ui-card__meta-XekAt","card__brand":"ui-card__brand-LC7g0","card__badges":"ui-card__badges-QTBfN","card__name":"ui-card__name-Uh0c0","card__link":"ui-card__link-jZICj","card__code":"ui-card__code-mUbX4","card__foot":"ui-card__foot-c9WvK","card__price":"ui-card__price-M3q0R","card__action":"ui-card__action-g2OI6"};
10
+ const T = ({
11
+ name: i,
12
+ href: s,
13
+ linkProps: m,
14
+ partNumber: _,
15
+ image: n,
16
+ brand: c,
17
+ badges: d,
18
+ vehicleTypes: p = [],
19
+ stock: l,
20
+ price: h,
21
+ signIn: N,
22
+ action: t,
23
+ headingLevel: f = 3,
24
+ className: x,
25
+ testId: u
26
+ }) => /* @__PURE__ */ r("article", { className: y(e.card, x), "data-testid": u, children: [
27
+ /* @__PURE__ */ a(o, { ...m, href: s, className: e.card__media, tabIndex: -1, "aria-hidden": !0, children: n }),
28
+ /* @__PURE__ */ r("div", { className: e.card__body, children: [
29
+ (c || d) && /* @__PURE__ */ r("div", { className: e.card__meta, children: [
30
+ c && /* @__PURE__ */ a("span", { className: e.card__brand, children: c }),
31
+ d && /* @__PURE__ */ a("span", { className: e.card__badges, children: d })
32
+ ] }),
33
+ /* @__PURE__ */ a(
34
+ j,
35
+ {
36
+ level: f,
37
+ size: "xs",
38
+ maxLines: 2,
39
+ title: i,
40
+ className: e.card__name,
41
+ children: /* @__PURE__ */ a(o, { ...m, href: s, className: e.card__link, children: i })
42
+ }
43
+ ),
44
+ /* @__PURE__ */ a(L, { code: _, isCopyable: !0, size: "sm", isMuted: !0, className: e.card__code }),
45
+ /* @__PURE__ */ a(z, { types: p }),
46
+ /* @__PURE__ */ r("div", { className: e.card__foot, children: [
47
+ l && /* @__PURE__ */ a("div", { className: e.card__stock, children: l }),
48
+ /* @__PURE__ */ a("div", { className: e.card__price, children: h ?? N }),
49
+ t && /* @__PURE__ */ a("div", { className: e.card__action, children: t })
50
+ ] })
51
+ ] })
52
+ ] }), q = /* @__PURE__ */ v(
53
+ /* @__PURE__ */ C(T, "ProductCard")
54
+ );
55
+ export {
56
+ q as default
57
+ };
58
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/ProductCard/index.tsx"],"sourcesContent":["import { memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport type { UiLinkExtraProps } from '../../types/link.type';\nimport CodeText from '../CodeText';\nimport Heading from '../Heading';\nimport UiLink from '../Link';\nimport VehicleTypeList from '../VehicleTypeList';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n /** The product's name; two lines at most, the rest in its tooltip. */\n name: string;\n /** The product page. The image and the name link to it; the card itself is not one link. */\n href: string;\n linkProps?: UiLinkExtraProps;\n /** The part number, mono and copyable (\"428959612\"). */\n partNumber: string;\n /** The image (`<img alt=\"\">` or the framework's image), drawn `contain` in a fixed-ratio box. */\n image?: ReactNode;\n /** The brand line over the name (\"IVECO\"), with room for a mark. */\n brand?: ReactNode;\n /** Small badges beside the brand (\"Orijinal\", \"Muadil\"): one line. */\n badges?: ReactNode;\n /** Compatible vehicle types; the first two, then \"+N\". */\n vehicleTypes?: readonly string[];\n /** The stock line: a `StockStatus`. */\n stock?: ReactNode;\n /**\n * The price block: a `Price` with `listValue` and `discountPercent` for net / list / discount.\n * Without it the card shows `signIn`.\n */\n price?: ReactNode;\n /** What a visitor sees instead of the price (\"Fiyat için giriş yapın\" + a link). */\n signIn?: ReactNode;\n /** The action row at the card's foot: an `AddToCart`. */\n action?: ReactNode;\n /** The name's heading level in the page's outline; default 3. */\n headingLevel?: 2 | 3 | 4;\n className?: string;\n testId?: string;\n};\n\n/**\n * ProductCard (3.8) — a B2B product in a grid: a fixed-ratio image, the brand and badges, the name\n * (two lines), the copyable part number, the vehicle types (two + \"+N\"), then at the foot the stock,\n * the price (or the visitor's sign-in prompt) and the add-to-cart row. Every card of a row is as\n * tall as the row and its foot sits at the bottom, so prices and buttons line up across the grid.\n * @example\n * <ProductCard\n * name=\"Ön far (sol) – Stralis / S-Way\"\n * href=\"/parca/on-far-sol\"\n * partNumber=\"428959612\"\n * image={<img src={url} alt=\"\" />}\n * brand=\"IVECO\"\n * vehicleTypes={['Stralis', 'S-Way', 'Trakker']}\n * stock={<StockStatus tone=\"available\" label=\"Stokta (24)\" />}\n * price={<Price value=\"1.229,00\" listValue=\"1.450,00\" discountPercent={15} />}\n * action={<AddToCart productName=\"Ön far (sol)\" onAdd={add} />}\n * />\n */\nconst ProductCard = ({\n name,\n href,\n linkProps,\n partNumber,\n image,\n brand,\n badges,\n vehicleTypes = [],\n stock,\n price,\n signIn,\n action,\n headingLevel = 3,\n className,\n testId,\n}: Props) => (\n <article className={cx(styles.card, className)} data-testid={testId}>\n {/* The name is the link a screen reader meets; the image repeats it for the pointer only. */}\n <UiLink {...linkProps} href={href} className={styles.card__media} tabIndex={-1} aria-hidden>\n {image}\n </UiLink>\n\n <div className={styles.card__body}>\n {(brand || badges) && (\n <div className={styles.card__meta}>\n {brand && <span className={styles.card__brand}>{brand}</span>}\n {badges && <span className={styles.card__badges}>{badges}</span>}\n </div>\n )}\n\n <Heading\n level={headingLevel}\n size=\"xs\"\n maxLines={2}\n title={name}\n className={styles.card__name}\n >\n <UiLink {...linkProps} href={href} className={styles.card__link}>\n {name}\n </UiLink>\n </Heading>\n\n <CodeText code={partNumber} isCopyable size=\"sm\" isMuted className={styles.card__code} />\n\n <VehicleTypeList types={vehicleTypes} />\n\n <div className={styles.card__foot}>\n {stock && <div className={styles.card__stock}>{stock}</div>}\n <div className={styles.card__price}>{price ?? signIn}</div>\n {action && <div className={styles.card__action}>{action}</div>}\n </div>\n </div>\n </article>\n);\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(ProductCard, 'ProductCard'),\n) as typeof ProductCard;\n"],"names":["ProductCard","name","href","linkProps","partNumber","image","brand","badges","vehicleTypes","stock","price","signIn","action","headingLevel","className","testId","jsxs","cx","styles","jsx","UiLink","Heading","CodeText","VehicleTypeList","index","memo","named"],"mappings":";;;;;;;;;AA+DA,MAAMA,IAAc,CAAC;AAAA,EACnB,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC,IAAe,CAAA;AAAA,EACf,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,cAAAC,IAAe;AAAA,EACf,WAAAC;AAAA,EACA,QAAAC;AACF,MACE,gBAAAC,EAAC,aAAQ,WAAWC,EAAGC,EAAO,MAAMJ,CAAS,GAAG,eAAaC,GAE3D,UAAA;AAAA,EAAA,gBAAAI,EAACC,GAAA,EAAQ,GAAGjB,GAAW,MAAAD,GAAY,WAAWgB,EAAO,aAAa,UAAU,IAAI,eAAW,IACxF,UAAAb,EAAA,CACH;AAAA,EAEA,gBAAAW,EAAC,OAAA,EAAI,WAAWE,EAAO,YACnB,UAAA;AAAA,KAAAZ,KAASC,MACT,gBAAAS,EAAC,OAAA,EAAI,WAAWE,EAAO,YACpB,UAAA;AAAA,MAAAZ,KAAS,gBAAAa,EAAC,QAAA,EAAK,WAAWD,EAAO,aAAc,UAAAZ,GAAM;AAAA,MACrDC,KAAU,gBAAAY,EAAC,QAAA,EAAK,WAAWD,EAAO,cAAe,UAAAX,EAAA,CAAO;AAAA,IAAA,GAC3D;AAAA,IAGF,gBAAAY;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,OAAOR;AAAA,QACP,MAAK;AAAA,QACL,UAAU;AAAA,QACV,OAAOZ;AAAA,QACP,WAAWiB,EAAO;AAAA,QAElB,UAAA,gBAAAC,EAACC,KAAQ,GAAGjB,GAAW,MAAAD,GAAY,WAAWgB,EAAO,YAClD,UAAAjB,EAAA,CACH;AAAA,MAAA;AAAA,IAAA;AAAA,IAGF,gBAAAkB,EAACG,GAAA,EAAS,MAAMlB,GAAY,YAAU,IAAC,MAAK,MAAK,SAAO,IAAC,WAAWc,EAAO,WAAA,CAAY;AAAA,IAEvF,gBAAAC,EAACI,GAAA,EAAgB,OAAOf,EAAA,CAAc;AAAA,IAEtC,gBAAAQ,EAAC,OAAA,EAAI,WAAWE,EAAO,YACpB,UAAA;AAAA,MAAAT,KAAS,gBAAAU,EAAC,OAAA,EAAI,WAAWD,EAAO,aAAc,UAAAT,GAAM;AAAA,wBACpD,OAAA,EAAI,WAAWS,EAAO,aAAc,eAASP,GAAO;AAAA,MACpDC,KAAU,gBAAAO,EAAC,OAAA,EAAI,WAAWD,EAAO,cAAe,UAAAN,EAAA,CAAO;AAAA,IAAA,EAAA,CAC1D;AAAA,EAAA,EAAA,CACF;AAAA,GACF,GAGFY,IAA6B,gBAAAC;AAAA,EACb,gBAAAC,EAAM1B,GAAa,aAAa;AAChD;"}
@@ -0,0 +1 @@
1
+ @layer ui{.ui-card-TTAoP{display:flex;flex-direction:column;height:100%;min-width:0;overflow:hidden;border:1px solid var(--hd-border);border-radius:var(--hd-radius-md);background-color:var(--hd-bg-surface);transition:border-color var(--hd-duration-fast) var(--hd-ease-standard)}.ui-card-TTAoP:hover{border-color:var(--hd-border-strong)}@media (prefers-reduced-motion: reduce){.ui-card-TTAoP{transition:none}}.ui-card__media-tPiQl{display:flex;align-items:center;justify-content:center;aspect-ratio:4/3;padding:var(--hd-space-3);background-color:var(--hd-bg-raised)}.ui-card__media-tPiQl>img,.ui-card__media-tPiQl>picture,.ui-card__media-tPiQl>svg{width:100%;height:100%;object-fit:contain}.ui-card__body-ziNkF{display:flex;flex:1;flex-direction:column;gap:var(--hd-space-2);min-width:0;padding:var(--hd-space-4)}.ui-card__meta-XekAt{display:flex;align-items:center;gap:var(--hd-space-2);min-width:0;min-height:1lh;font-size:var(--hd-type-caption-size);line-height:var(--hd-type-h4-line-height)}.ui-card__brand-LC7g0{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;display:block;font-weight:var(--hd-font-weight-semibold);color:var(--hd-text-2)}.ui-card__badges-QTBfN{display:inline-flex;flex-shrink:0;gap:var(--hd-space-1);margin-inline-start:auto}.ui-card__name-Uh0c0{min-height:2lh}.ui-card__link-jZICj{color:var(--hd-text);text-decoration:none;border-radius:var(--hd-radius-xs)}.ui-card__link-jZICj:hover{color:var(--hd-primary-text);text-decoration:underline;text-underline-offset:2px}.ui-card__link-jZICj:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, 2px)}.ui-card__code-mUbX4{align-self:flex-start;max-width:100%}.ui-card__foot-c9WvK{display:flex;flex-direction:column;gap:var(--hd-space-2);margin-top:auto;padding-top:var(--hd-space-2)}.ui-card__price-M3q0R{min-height:1.75rem;min-width:0}.ui-card__action-g2OI6{padding-top:var(--hd-space-1)}}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),m=require("../CodeText/index.cjs"),a={default:{"row":"ui-row-hRssp","row__main":"ui-row__main-9U8-X","row__brand":"ui-row__brand-FPANJ","row__stock":"ui-row__stock-R0vkG","row__price":"ui-row__price-Xc0rY","row__access":"ui-row__access-90GUv","row__action":"ui-row__action-BLUhd","thumb":"ui-thumb-keewu","identity":"ui-identity-KJkMD","identity__name":"ui-identity__name-HOwle","truncate":"ui-truncate-5ux8b","column__image":"ui-column__image-80B8g","column__code":"ui-column__code-WqdqI","column__name":"ui-column__name-XArN-","column__brand":"ui-column__brand-kZOvm","column__stock":"ui-column__stock-TFp2x","column__price":"ui-column__price-O6HlG","column__access":"ui-column__access-anXj-","column__action":"ui-column__action-v67xi","srOnly":"ui-srOnly-tMxZI"}},n=require("./parts.cjs"),o=({product:s,signIn:t,action:u,labels:d={},omit:i=[]})=>{const l=(e,c=!1)=>r.jsx(n.ProductColumnLabel,{field:e,text:d[e],isHidden:c});return[{field:"image",key:"image",label:l("image",!0),className:a.default.column__image,render:e=>r.jsx(n.ProductThumb,{image:s(e).image})},{field:"partNumber",key:"partNumber",label:l("partNumber"),isAlwaysVisible:!0,className:a.default.column__code,render:e=>r.jsx(m.default,{code:s(e).partNumber,isCopyable:!0,size:"sm"})},{field:"name",key:"name",label:l("name"),className:a.default.column__name,render:e=>r.jsx(n.ProductIdentity,{...s(e)})},{field:"brand",key:"brand",label:l("brand"),className:a.default.column__brand,render:e=>r.jsx("span",{className:a.default.truncate,children:s(e).brand})},...t?[{field:"access",key:"access",label:l("access"),className:a.default.column__access,render:e=>t(e)}]:[{field:"stock",key:"stock",label:l("stock"),className:a.default.column__stock,render:e=>s(e).stock},{field:"price",key:"price",label:l("price"),isNumeric:!0,className:a.default.column__price,render:e=>s(e).price}],...u?[{field:"action",key:"action",label:l("action",!0),align:"end",className:a.default.column__action,render:e=>u(e)}]:[]].filter(e=>!i.includes(e.field)).map(({field:e,...c})=>c)};exports.default=o;
2
+ //# sourceMappingURL=columns.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columns.cjs","sources":["../../../src/components/ProductRow/columns.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\n\nimport CodeText from '../CodeText';\nimport type { DataTableColumn } from '../DataTable';\n\nimport styles from './index.module.scss';\nimport {\n type ProductField,\n ProductColumnLabel,\n ProductIdentity,\n type ProductRowData,\n ProductThumb,\n} from './parts';\n\nexport type ProductColumnsOptions<T> = {\n /** The product of a row. */\n product: (row: T) => ProductRowData;\n /**\n * A visitor's table: the stock and price columns become ONE column with this cell (\"Fiyat ve\n * stok için giriş yapın\"). Leave it out for a dealer.\n */\n signIn?: (row: T) => ReactNode;\n /** The last column: an `AddToCart size=\"sm\"`. */\n action?: (row: T) => ReactNode;\n /** Headings instead of `labels.product`. */\n labels?: Partial<Record<ProductField, string>>;\n /** Columns to leave out (\"brand\" in a one-brand catalogue). */\n omit?: readonly ProductField[];\n};\n\n/**\n * productColumns (3.8) — the B2B product table's columns for `DataTable`: image 40px · part number\n * (mono, copyable, never hidden) · name and vehicle types · brand · stock · price (end, tabular) ·\n * add to cart. With `signIn` (a visitor) stock and price merge into one sign-in column, so a\n * visitor and a dealer see the same table.\n * @example <DataTable rows={items} rowKey={item => item.id} columns={productColumns({ product: toRow, action: item => <AddToCart size=\"sm\" onAdd={…} /> })} />\n */\nconst productColumns = <T,>({\n product,\n signIn,\n action,\n labels = {},\n omit = [],\n}: ProductColumnsOptions<T>): DataTableColumn<T>[] => {\n const heading = (field: ProductField, isHidden = false) => (\n <ProductColumnLabel field={field} text={labels[field]} isHidden={isHidden} />\n );\n\n const columns: (DataTableColumn<T> & { field: ProductField })[] = [\n {\n field: 'image',\n key: 'image',\n label: heading('image', true),\n className: styles.column__image,\n render: row => <ProductThumb image={product(row).image} />,\n },\n {\n field: 'partNumber',\n key: 'partNumber',\n label: heading('partNumber'),\n isAlwaysVisible: true,\n className: styles.column__code,\n render: row => <CodeText code={product(row).partNumber} isCopyable size=\"sm\" />,\n },\n {\n field: 'name',\n key: 'name',\n label: heading('name'),\n className: styles.column__name,\n render: row => <ProductIdentity {...product(row)} />,\n },\n {\n field: 'brand',\n key: 'brand',\n label: heading('brand'),\n className: styles.column__brand,\n render: row => <span className={styles.truncate}>{product(row).brand}</span>,\n },\n ...(signIn\n ? [\n {\n field: 'access' as const,\n key: 'access',\n label: heading('access'),\n className: styles.column__access,\n render: (row: T) => signIn(row),\n },\n ]\n : [\n {\n field: 'stock' as const,\n key: 'stock',\n label: heading('stock'),\n className: styles.column__stock,\n render: (row: T) => product(row).stock,\n },\n {\n field: 'price' as const,\n key: 'price',\n label: heading('price'),\n isNumeric: true,\n className: styles.column__price,\n render: (row: T) => product(row).price,\n },\n ]),\n ...(action\n ? [\n {\n field: 'action' as const,\n key: 'action',\n label: heading('action', true),\n align: 'end' as const,\n className: styles.column__action,\n render: (row: T) => action(row),\n },\n ]\n : []),\n ];\n\n return columns\n .filter(column => !omit.includes(column.field))\n .map(({ field: _field, ...column }) => column);\n};\n\nexport default productColumns;\n"],"names":["productColumns","product","signIn","action","labels","omit","heading","field","isHidden","jsx","ProductColumnLabel","styles","ProductThumb","row","CodeText","ProductIdentity","column","_field"],"mappings":"kPAqCMA,EAAiB,CAAK,CAC1B,QAAAC,EACA,OAAAC,EACA,OAAAC,EACA,OAAAC,EAAS,CAAA,EACT,KAAAC,EAAO,CAAA,CACT,IAAsD,CACpD,MAAMC,EAAU,CAACC,EAAqBC,EAAW,KAC/CC,EAAAA,IAACC,EAAAA,mBAAA,CAAmB,MAAAH,EAAc,KAAMH,EAAOG,CAAK,EAAG,SAAAC,CAAA,CAAoB,EA0E7E,MAvEkE,CAChE,CACE,MAAO,QACP,IAAK,QACL,MAAOF,EAAQ,QAAS,EAAI,EAC5B,UAAWK,EAAAA,QAAO,cAClB,UAAeF,EAAAA,IAACG,EAAAA,aAAA,CAAa,MAAOX,EAAQY,CAAG,EAAE,KAAA,CAAO,CAAA,EAE1D,CACE,MAAO,aACP,IAAK,aACL,MAAOP,EAAQ,YAAY,EAC3B,gBAAiB,GACjB,UAAWK,EAAAA,QAAO,aAClB,OAAQE,GAAOJ,EAAAA,IAACK,EAAAA,QAAA,CAAS,KAAMb,EAAQY,CAAG,EAAE,WAAY,WAAU,GAAC,KAAK,IAAA,CAAK,CAAA,EAE/E,CACE,MAAO,OACP,IAAK,OACL,MAAOP,EAAQ,MAAM,EACrB,UAAWK,EAAAA,QAAO,aAClB,OAAQE,GAAOJ,EAAAA,IAACM,EAAAA,iBAAiB,GAAGd,EAAQY,CAAG,CAAA,CAAG,CAAA,EAEpD,CACE,MAAO,QACP,IAAK,QACL,MAAOP,EAAQ,OAAO,EACtB,UAAWK,EAAAA,QAAO,cAClB,OAAQE,GAAOJ,MAAC,OAAA,CAAK,UAAWE,UAAO,SAAW,SAAAV,EAAQY,CAAG,EAAE,KAAA,CAAM,CAAA,EAEvE,GAAIX,EACA,CACE,CACE,MAAO,SACP,IAAK,SACL,MAAOI,EAAQ,QAAQ,EACvB,UAAWK,EAAAA,QAAO,eAClB,OAASE,GAAWX,EAAOW,CAAG,CAAA,CAChC,EAEF,CACE,CACE,MAAO,QACP,IAAK,QACL,MAAOP,EAAQ,OAAO,EACtB,UAAWK,EAAAA,QAAO,cAClB,OAASE,GAAWZ,EAAQY,CAAG,EAAE,KAAA,EAEnC,CACE,MAAO,QACP,IAAK,QACL,MAAOP,EAAQ,OAAO,EACtB,UAAW,GACX,UAAWK,EAAAA,QAAO,cAClB,OAASE,GAAWZ,EAAQY,CAAG,EAAE,KAAA,CACnC,EAEN,GAAIV,EACA,CACE,CACE,MAAO,SACP,IAAK,SACL,MAAOG,EAAQ,SAAU,EAAI,EAC7B,MAAO,MACP,UAAWK,EAAAA,QAAO,eAClB,OAASE,GAAWV,EAAOU,CAAG,CAAA,CAChC,EAEF,CAAA,CAAC,EAIJ,OAAOG,GAAU,CAACX,EAAK,SAASW,EAAO,KAAK,CAAC,EAC7C,IAAI,CAAC,CAAE,MAAOC,EAAQ,GAAGD,CAAA,IAAaA,CAAM,CACjD"}
@@ -0,0 +1,27 @@
1
+ import { ReactNode } from 'react';
2
+ import { DataTableColumn } from '../DataTable/index.cjs';
3
+ import { ProductField, ProductRowData } from './parts.cjs';
4
+ export type ProductColumnsOptions<T> = {
5
+ /** The product of a row. */
6
+ product: (row: T) => ProductRowData;
7
+ /**
8
+ * A visitor's table: the stock and price columns become ONE column with this cell ("Fiyat ve
9
+ * stok için giriş yapın"). Leave it out for a dealer.
10
+ */
11
+ signIn?: (row: T) => ReactNode;
12
+ /** The last column: an `AddToCart size="sm"`. */
13
+ action?: (row: T) => ReactNode;
14
+ /** Headings instead of `labels.product`. */
15
+ labels?: Partial<Record<ProductField, string>>;
16
+ /** Columns to leave out ("brand" in a one-brand catalogue). */
17
+ omit?: readonly ProductField[];
18
+ };
19
+ /**
20
+ * productColumns (3.8) — the B2B product table's columns for `DataTable`: image 40px · part number
21
+ * (mono, copyable, never hidden) · name and vehicle types · brand · stock · price (end, tabular) ·
22
+ * add to cart. With `signIn` (a visitor) stock and price merge into one sign-in column, so a
23
+ * visitor and a dealer see the same table.
24
+ * @example <DataTable rows={items} rowKey={item => item.id} columns={productColumns({ product: toRow, action: item => <AddToCart size="sm" onAdd={…} /> })} />
25
+ */
26
+ declare const productColumns: <T>({ product, signIn, action, labels, omit, }: ProductColumnsOptions<T>) => DataTableColumn<T>[];
27
+ export default productColumns;
@@ -0,0 +1,27 @@
1
+ import { ReactNode } from 'react';
2
+ import { DataTableColumn } from '../DataTable/index.js';
3
+ import { ProductField, ProductRowData } from './parts.js';
4
+ export type ProductColumnsOptions<T> = {
5
+ /** The product of a row. */
6
+ product: (row: T) => ProductRowData;
7
+ /**
8
+ * A visitor's table: the stock and price columns become ONE column with this cell ("Fiyat ve
9
+ * stok için giriş yapın"). Leave it out for a dealer.
10
+ */
11
+ signIn?: (row: T) => ReactNode;
12
+ /** The last column: an `AddToCart size="sm"`. */
13
+ action?: (row: T) => ReactNode;
14
+ /** Headings instead of `labels.product`. */
15
+ labels?: Partial<Record<ProductField, string>>;
16
+ /** Columns to leave out ("brand" in a one-brand catalogue). */
17
+ omit?: readonly ProductField[];
18
+ };
19
+ /**
20
+ * productColumns (3.8) — the B2B product table's columns for `DataTable`: image 40px · part number
21
+ * (mono, copyable, never hidden) · name and vehicle types · brand · stock · price (end, tabular) ·
22
+ * add to cart. With `signIn` (a visitor) stock and price merge into one sign-in column, so a
23
+ * visitor and a dealer see the same table.
24
+ * @example <DataTable rows={items} rowKey={item => item.id} columns={productColumns({ product: toRow, action: item => <AddToCart size="sm" onAdd={…} /> })} />
25
+ */
26
+ declare const productColumns: <T>({ product, signIn, action, labels, omit, }: ProductColumnsOptions<T>) => DataTableColumn<T>[];
27
+ export default productColumns;
@@ -0,0 +1,83 @@
1
+ import { jsx as s } from "react/jsx-runtime";
2
+ import t from "../CodeText/index.js";
3
+ const a = {"row":"ui-row-hRssp","row__main":"ui-row__main-9U8-X","row__brand":"ui-row__brand-FPANJ","row__stock":"ui-row__stock-R0vkG","row__price":"ui-row__price-Xc0rY","row__access":"ui-row__access-90GUv","row__action":"ui-row__action-BLUhd","thumb":"ui-thumb-keewu","identity":"ui-identity-KJkMD","identity__name":"ui-identity__name-HOwle","truncate":"ui-truncate-5ux8b","column__image":"ui-column__image-80B8g","column__code":"ui-column__code-WqdqI","column__name":"ui-column__name-XArN-","column__brand":"ui-column__brand-kZOvm","column__stock":"ui-column__stock-TFp2x","column__price":"ui-column__price-O6HlG","column__access":"ui-column__access-anXj-","column__action":"ui-column__action-v67xi","srOnly":"ui-srOnly-tMxZI"};
4
+ import { ProductThumb as d, ProductIdentity as u, ProductColumnLabel as b } from "./parts.js";
5
+ const y = ({
6
+ product: r,
7
+ signIn: m,
8
+ action: n,
9
+ labels: i = {},
10
+ omit: o = []
11
+ }) => {
12
+ const l = (e, c = !1) => /* @__PURE__ */ s(b, { field: e, text: i[e], isHidden: c });
13
+ return [
14
+ {
15
+ field: "image",
16
+ key: "image",
17
+ label: l("image", !0),
18
+ className: a.column__image,
19
+ render: (e) => /* @__PURE__ */ s(d, { image: r(e).image })
20
+ },
21
+ {
22
+ field: "partNumber",
23
+ key: "partNumber",
24
+ label: l("partNumber"),
25
+ isAlwaysVisible: !0,
26
+ className: a.column__code,
27
+ render: (e) => /* @__PURE__ */ s(t, { code: r(e).partNumber, isCopyable: !0, size: "sm" })
28
+ },
29
+ {
30
+ field: "name",
31
+ key: "name",
32
+ label: l("name"),
33
+ className: a.column__name,
34
+ render: (e) => /* @__PURE__ */ s(u, { ...r(e) })
35
+ },
36
+ {
37
+ field: "brand",
38
+ key: "brand",
39
+ label: l("brand"),
40
+ className: a.column__brand,
41
+ render: (e) => /* @__PURE__ */ s("span", { className: a.truncate, children: r(e).brand })
42
+ },
43
+ ...m ? [
44
+ {
45
+ field: "access",
46
+ key: "access",
47
+ label: l("access"),
48
+ className: a.column__access,
49
+ render: (e) => m(e)
50
+ }
51
+ ] : [
52
+ {
53
+ field: "stock",
54
+ key: "stock",
55
+ label: l("stock"),
56
+ className: a.column__stock,
57
+ render: (e) => r(e).stock
58
+ },
59
+ {
60
+ field: "price",
61
+ key: "price",
62
+ label: l("price"),
63
+ isNumeric: !0,
64
+ className: a.column__price,
65
+ render: (e) => r(e).price
66
+ }
67
+ ],
68
+ ...n ? [
69
+ {
70
+ field: "action",
71
+ key: "action",
72
+ label: l("action", !0),
73
+ align: "end",
74
+ className: a.column__action,
75
+ render: (e) => n(e)
76
+ }
77
+ ] : []
78
+ ].filter((e) => !o.includes(e.field)).map(({ field: e, ...c }) => c);
79
+ };
80
+ export {
81
+ y as default
82
+ };
83
+ //# sourceMappingURL=columns.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"columns.js","sources":["../../../src/components/ProductRow/columns.tsx"],"sourcesContent":["import { type ReactNode } from 'react';\n\nimport CodeText from '../CodeText';\nimport type { DataTableColumn } from '../DataTable';\n\nimport styles from './index.module.scss';\nimport {\n type ProductField,\n ProductColumnLabel,\n ProductIdentity,\n type ProductRowData,\n ProductThumb,\n} from './parts';\n\nexport type ProductColumnsOptions<T> = {\n /** The product of a row. */\n product: (row: T) => ProductRowData;\n /**\n * A visitor's table: the stock and price columns become ONE column with this cell (\"Fiyat ve\n * stok için giriş yapın\"). Leave it out for a dealer.\n */\n signIn?: (row: T) => ReactNode;\n /** The last column: an `AddToCart size=\"sm\"`. */\n action?: (row: T) => ReactNode;\n /** Headings instead of `labels.product`. */\n labels?: Partial<Record<ProductField, string>>;\n /** Columns to leave out (\"brand\" in a one-brand catalogue). */\n omit?: readonly ProductField[];\n};\n\n/**\n * productColumns (3.8) — the B2B product table's columns for `DataTable`: image 40px · part number\n * (mono, copyable, never hidden) · name and vehicle types · brand · stock · price (end, tabular) ·\n * add to cart. With `signIn` (a visitor) stock and price merge into one sign-in column, so a\n * visitor and a dealer see the same table.\n * @example <DataTable rows={items} rowKey={item => item.id} columns={productColumns({ product: toRow, action: item => <AddToCart size=\"sm\" onAdd={…} /> })} />\n */\nconst productColumns = <T,>({\n product,\n signIn,\n action,\n labels = {},\n omit = [],\n}: ProductColumnsOptions<T>): DataTableColumn<T>[] => {\n const heading = (field: ProductField, isHidden = false) => (\n <ProductColumnLabel field={field} text={labels[field]} isHidden={isHidden} />\n );\n\n const columns: (DataTableColumn<T> & { field: ProductField })[] = [\n {\n field: 'image',\n key: 'image',\n label: heading('image', true),\n className: styles.column__image,\n render: row => <ProductThumb image={product(row).image} />,\n },\n {\n field: 'partNumber',\n key: 'partNumber',\n label: heading('partNumber'),\n isAlwaysVisible: true,\n className: styles.column__code,\n render: row => <CodeText code={product(row).partNumber} isCopyable size=\"sm\" />,\n },\n {\n field: 'name',\n key: 'name',\n label: heading('name'),\n className: styles.column__name,\n render: row => <ProductIdentity {...product(row)} />,\n },\n {\n field: 'brand',\n key: 'brand',\n label: heading('brand'),\n className: styles.column__brand,\n render: row => <span className={styles.truncate}>{product(row).brand}</span>,\n },\n ...(signIn\n ? [\n {\n field: 'access' as const,\n key: 'access',\n label: heading('access'),\n className: styles.column__access,\n render: (row: T) => signIn(row),\n },\n ]\n : [\n {\n field: 'stock' as const,\n key: 'stock',\n label: heading('stock'),\n className: styles.column__stock,\n render: (row: T) => product(row).stock,\n },\n {\n field: 'price' as const,\n key: 'price',\n label: heading('price'),\n isNumeric: true,\n className: styles.column__price,\n render: (row: T) => product(row).price,\n },\n ]),\n ...(action\n ? [\n {\n field: 'action' as const,\n key: 'action',\n label: heading('action', true),\n align: 'end' as const,\n className: styles.column__action,\n render: (row: T) => action(row),\n },\n ]\n : []),\n ];\n\n return columns\n .filter(column => !omit.includes(column.field))\n .map(({ field: _field, ...column }) => column);\n};\n\nexport default productColumns;\n"],"names":["productColumns","product","signIn","action","labels","omit","heading","field","isHidden","jsx","ProductColumnLabel","styles","ProductThumb","row","CodeText","ProductIdentity","column","_field"],"mappings":";;;;AAqCA,MAAMA,IAAiB,CAAK;AAAA,EAC1B,SAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC,IAAS,CAAA;AAAA,EACT,MAAAC,IAAO,CAAA;AACT,MAAsD;AACpD,QAAMC,IAAU,CAACC,GAAqBC,IAAW,OAC/C,gBAAAC,EAACC,GAAA,EAAmB,OAAAH,GAAc,MAAMH,EAAOG,CAAK,GAAG,UAAAC,EAAA,CAAoB;AA0E7E,SAvEkE;AAAA,IAChE;AAAA,MACE,OAAO;AAAA,MACP,KAAK;AAAA,MACL,OAAOF,EAAQ,SAAS,EAAI;AAAA,MAC5B,WAAWK,EAAO;AAAA,MAClB,QAAQ,OAAO,gBAAAF,EAACG,GAAA,EAAa,OAAOX,EAAQY,CAAG,EAAE,MAAA,CAAO;AAAA,IAAA;AAAA,IAE1D;AAAA,MACE,OAAO;AAAA,MACP,KAAK;AAAA,MACL,OAAOP,EAAQ,YAAY;AAAA,MAC3B,iBAAiB;AAAA,MACjB,WAAWK,EAAO;AAAA,MAClB,QAAQ,CAAAE,MAAO,gBAAAJ,EAACK,GAAA,EAAS,MAAMb,EAAQY,CAAG,EAAE,YAAY,YAAU,IAAC,MAAK,KAAA,CAAK;AAAA,IAAA;AAAA,IAE/E;AAAA,MACE,OAAO;AAAA,MACP,KAAK;AAAA,MACL,OAAOP,EAAQ,MAAM;AAAA,MACrB,WAAWK,EAAO;AAAA,MAClB,QAAQ,CAAAE,MAAO,gBAAAJ,EAACM,KAAiB,GAAGd,EAAQY,CAAG,EAAA,CAAG;AAAA,IAAA;AAAA,IAEpD;AAAA,MACE,OAAO;AAAA,MACP,KAAK;AAAA,MACL,OAAOP,EAAQ,OAAO;AAAA,MACtB,WAAWK,EAAO;AAAA,MAClB,QAAQ,CAAAE,MAAO,gBAAAJ,EAAC,QAAA,EAAK,WAAWE,EAAO,UAAW,UAAAV,EAAQY,CAAG,EAAE,MAAA,CAAM;AAAA,IAAA;AAAA,IAEvE,GAAIX,IACA;AAAA,MACE;AAAA,QACE,OAAO;AAAA,QACP,KAAK;AAAA,QACL,OAAOI,EAAQ,QAAQ;AAAA,QACvB,WAAWK,EAAO;AAAA,QAClB,QAAQ,CAACE,MAAWX,EAAOW,CAAG;AAAA,MAAA;AAAA,IAChC,IAEF;AAAA,MACE;AAAA,QACE,OAAO;AAAA,QACP,KAAK;AAAA,QACL,OAAOP,EAAQ,OAAO;AAAA,QACtB,WAAWK,EAAO;AAAA,QAClB,QAAQ,CAACE,MAAWZ,EAAQY,CAAG,EAAE;AAAA,MAAA;AAAA,MAEnC;AAAA,QACE,OAAO;AAAA,QACP,KAAK;AAAA,QACL,OAAOP,EAAQ,OAAO;AAAA,QACtB,WAAW;AAAA,QACX,WAAWK,EAAO;AAAA,QAClB,QAAQ,CAACE,MAAWZ,EAAQY,CAAG,EAAE;AAAA,MAAA;AAAA,IACnC;AAAA,IAEN,GAAIV,IACA;AAAA,MACE;AAAA,QACE,OAAO;AAAA,QACP,KAAK;AAAA,QACL,OAAOG,EAAQ,UAAU,EAAI;AAAA,QAC7B,OAAO;AAAA,QACP,WAAWK,EAAO;AAAA,QAClB,QAAQ,CAACE,MAAWV,EAAOU,CAAG;AAAA,MAAA;AAAA,IAChC,IAEF,CAAA;AAAA,EAAC,EAIJ,OAAO,CAAAG,MAAU,CAACX,EAAK,SAASW,EAAO,KAAK,CAAC,EAC7C,IAAI,CAAC,EAAE,OAAOC,GAAQ,GAAGD,EAAA,MAAaA,CAAM;AACjD;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),h=require("react"),a=require("../../helpers/class-name.helper.cjs"),w=require("../../helpers/component.helper.cjs"),q=require("../CodeText/index.cjs"),s={default:{"row":"ui-row-hRssp","row__main":"ui-row__main-9U8-X","row__brand":"ui-row__brand-FPANJ","row__stock":"ui-row__stock-R0vkG","row__price":"ui-row__price-Xc0rY","row__access":"ui-row__access-90GUv","row__action":"ui-row__action-BLUhd","thumb":"ui-thumb-keewu","identity":"ui-identity-KJkMD","identity__name":"ui-identity__name-HOwle","truncate":"ui-truncate-5ux8b","column__image":"ui-column__image-80B8g","column__code":"ui-column__code-WqdqI","column__name":"ui-column__name-XArN-","column__brand":"ui-column__brand-kZOvm","column__stock":"ui-column__stock-TFp2x","column__price":"ui-column__price-O6HlG","column__access":"ui-column__access-anXj-","column__action":"ui-column__action-v67xi","srOnly":"ui-srOnly-tMxZI"}},c=require("./parts.cjs"),N=require("./columns.cjs"),b=({name:o,href:d,linkProps:n,partNumber:l,image:u,brand:i,vehicleTypes:m,stock:_,price:x,signIn:r,action:t,as:p="article",className:j,testId:f})=>e.jsxs(p,{className:a.cx(s.default.row,j),"data-testid":f,children:[e.jsx(c.ProductThumb,{image:u}),e.jsxs("span",{className:s.default.row__main,children:[e.jsx(q.default,{code:l,isCopyable:!0,size:"sm",isMuted:!0}),e.jsx(c.ProductIdentity,{name:o,href:d,linkProps:n,vehicleTypes:m})]}),e.jsx("span",{className:a.cx(s.default.row__brand,s.default.truncate),children:i}),r===void 0?e.jsxs(e.Fragment,{children:[e.jsx("span",{className:s.default.row__stock,children:_}),e.jsx("span",{className:s.default.row__price,children:x})]}):e.jsx("span",{className:s.default.row__access,children:r}),t&&e.jsx("span",{className:s.default.row__action,children:t})]}),P=h.memo(w.named(b,"ProductRow"));exports.productColumns=N.default;exports.default=P;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/ProductRow/index.tsx"],"sourcesContent":["import { memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport CodeText from '../CodeText';\n\nimport styles from './index.module.scss';\nimport { ProductIdentity, type ProductRowData, ProductThumb } from './parts';\n\nexport type { ProductRowData } from './parts';\nexport { default as productColumns, type ProductColumnsOptions } from './columns';\nexport type { ProductField } from './parts';\n\ntype Props = ProductRowData & {\n /** A visitor's row: this replaces the stock and the price (\"Fiyat için giriş yapın\"). */\n signIn?: ReactNode;\n /** The row's end: an `AddToCart size=\"sm\"`. */\n action?: ReactNode;\n /** The element: `li` inside a list (default `article`). */\n as?: 'article' | 'li' | 'div';\n className?: string;\n testId?: string;\n};\n\n/**\n * ProductRow (3.8) — one product on one line outside a table (equivalents, a cart on a phone, a\n * quick order list): image 40px · part number and name with its vehicle types · brand · stock ·\n * price · add to cart, in the columns of `productColumns`. A visitor's row puts `signIn` where the\n * stock and price are. On a phone the row stacks under its image.\n * @example <ProductRow as=\"li\" name=\"Fren balatası\" href=\"/parca/fren\" partNumber=\"2995815\" stock={<StockStatus … />} price={<Price value=\"845,00\" />} action={<AddToCart size=\"sm\" onAdd={add} />} />\n */\nconst ProductRow = ({\n name,\n href,\n linkProps,\n partNumber,\n image,\n brand,\n vehicleTypes,\n stock,\n price,\n signIn,\n action,\n as: Tag = 'article',\n className,\n testId,\n}: Props) => (\n <Tag className={cx(styles.row, className)} data-testid={testId}>\n <ProductThumb image={image} />\n <span className={styles.row__main}>\n <CodeText code={partNumber} isCopyable size=\"sm\" isMuted />\n <ProductIdentity name={name} href={href} linkProps={linkProps} vehicleTypes={vehicleTypes} />\n </span>\n <span className={cx(styles.row__brand, styles.truncate)}>{brand}</span>\n {signIn === undefined ? (\n <>\n <span className={styles.row__stock}>{stock}</span>\n <span className={styles.row__price}>{price}</span>\n </>\n ) : (\n <span className={styles.row__access}>{signIn}</span>\n )}\n {action && <span className={styles.row__action}>{action}</span>}\n </Tag>\n);\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(ProductRow, 'ProductRow'),\n) as typeof ProductRow;\n"],"names":["ProductRow","name","href","linkProps","partNumber","image","brand","vehicleTypes","stock","price","signIn","action","Tag","className","testId","jsxs","cx","styles","jsx","ProductThumb","CodeText","ProductIdentity","Fragment","index","memo","named"],"mappings":"iYA+BMA,EAAa,CAAC,CAClB,KAAAC,EACA,KAAAC,EACA,UAAAC,EACA,WAAAC,EACA,MAAAC,EACA,MAAAC,EACA,aAAAC,EACA,MAAAC,EACA,MAAAC,EACA,OAAAC,EACA,OAAAC,EACA,GAAIC,EAAM,UACV,UAAAC,EACA,OAAAC,CACF,IACEC,OAACH,GAAI,UAAWI,EAAAA,GAAGC,EAAAA,QAAO,IAAKJ,CAAS,EAAG,cAAaC,EACtD,SAAA,CAAAI,MAACC,EAAAA,cAAa,MAAAd,EAAc,EAC5BU,EAAAA,KAAC,OAAA,CAAK,UAAWE,EAAAA,QAAO,UACtB,SAAA,CAAAC,EAAAA,IAACE,EAAAA,QAAA,CAAS,KAAMhB,EAAY,WAAU,GAAC,KAAK,KAAK,QAAO,EAAA,CAAC,EACzDc,EAAAA,IAACG,EAAAA,gBAAA,CAAgB,KAAApB,EAAY,KAAAC,EAAY,UAAAC,EAAsB,aAAAI,CAAA,CAA4B,CAAA,EAC7F,EACAW,EAAAA,IAAC,QAAK,UAAWF,EAAAA,GAAGC,EAAAA,QAAO,WAAYA,EAAAA,QAAO,QAAQ,EAAI,SAAAX,CAAA,CAAM,EAC/DI,IAAW,OACVK,EAAAA,KAAAO,EAAAA,SAAA,CACE,SAAA,CAAAJ,EAAAA,IAAC,OAAA,CAAK,UAAWD,EAAAA,QAAO,WAAa,SAAAT,EAAM,EAC3CU,EAAAA,IAAC,OAAA,CAAK,UAAWD,EAAAA,QAAO,WAAa,SAAAR,CAAA,CAAM,CAAA,EAC7C,EAEAS,MAAC,OAAA,CAAK,UAAWD,EAAAA,QAAO,YAAc,SAAAP,EAAO,EAE9CC,GAAUO,EAAAA,IAAC,OAAA,CAAK,UAAWD,EAAAA,QAAO,YAAc,SAAAN,CAAA,CAAO,CAAA,EAC1D,EAGFY,EAA6BC,EAAAA,KACbC,EAAAA,MAAMzB,EAAY,YAAY,CAC9C"}
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ import { ProductRowData } from './parts.cjs';
3
+ export type { ProductRowData } from './parts.cjs';
4
+ export { default as productColumns, type ProductColumnsOptions } from './columns.cjs';
5
+ export type { ProductField } from './parts.cjs';
6
+ type Props = ProductRowData & {
7
+ /** A visitor's row: this replaces the stock and the price ("Fiyat için giriş yapın"). */
8
+ signIn?: ReactNode;
9
+ /** The row's end: an `AddToCart size="sm"`. */
10
+ action?: ReactNode;
11
+ /** The element: `li` inside a list (default `article`). */
12
+ as?: 'article' | 'li' | 'div';
13
+ className?: string;
14
+ testId?: string;
15
+ };
16
+ /**
17
+ * ProductRow (3.8) — one product on one line outside a table (equivalents, a cart on a phone, a
18
+ * quick order list): image 40px · part number and name with its vehicle types · brand · stock ·
19
+ * price · add to cart, in the columns of `productColumns`. A visitor's row puts `signIn` where the
20
+ * stock and price are. On a phone the row stacks under its image.
21
+ * @example <ProductRow as="li" name="Fren balatası" href="/parca/fren" partNumber="2995815" stock={<StockStatus … />} price={<Price value="845,00" />} action={<AddToCart size="sm" onAdd={add} />} />
22
+ */
23
+ declare const ProductRow: ({ name, href, linkProps, partNumber, image, brand, vehicleTypes, stock, price, signIn, action, as: Tag, className, testId, }: Props) => import("react").JSX.Element;
24
+ declare const _default: typeof ProductRow;
25
+ export default _default;
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ import { ProductRowData } from './parts.js';
3
+ export type { ProductRowData } from './parts.js';
4
+ export { default as productColumns, type ProductColumnsOptions } from './columns.js';
5
+ export type { ProductField } from './parts.js';
6
+ type Props = ProductRowData & {
7
+ /** A visitor's row: this replaces the stock and the price ("Fiyat için giriş yapın"). */
8
+ signIn?: ReactNode;
9
+ /** The row's end: an `AddToCart size="sm"`. */
10
+ action?: ReactNode;
11
+ /** The element: `li` inside a list (default `article`). */
12
+ as?: 'article' | 'li' | 'div';
13
+ className?: string;
14
+ testId?: string;
15
+ };
16
+ /**
17
+ * ProductRow (3.8) — one product on one line outside a table (equivalents, a cart on a phone, a
18
+ * quick order list): image 40px · part number and name with its vehicle types · brand · stock ·
19
+ * price · add to cart, in the columns of `productColumns`. A visitor's row puts `signIn` where the
20
+ * stock and price are. On a phone the row stacks under its image.
21
+ * @example <ProductRow as="li" name="Fren balatası" href="/parca/fren" partNumber="2995815" stock={<StockStatus … />} price={<Price value="845,00" />} action={<AddToCart size="sm" onAdd={add} />} />
22
+ */
23
+ declare const ProductRow: ({ name, href, linkProps, partNumber, image, brand, vehicleTypes, stock, price, signIn, action, as: Tag, className, testId, }: Props) => import("react").JSX.Element;
24
+ declare const _default: typeof ProductRow;
25
+ export default _default;
@@ -0,0 +1,43 @@
1
+ import { jsxs as e, jsx as r, Fragment as x } from "react/jsx-runtime";
2
+ import { memo as N } from "react";
3
+ import { cx as t } from "../../helpers/class-name.helper.js";
4
+ import { named as P } from "../../helpers/component.helper.js";
5
+ import b from "../CodeText/index.js";
6
+ const o = {"row":"ui-row-hRssp","row__main":"ui-row__main-9U8-X","row__brand":"ui-row__brand-FPANJ","row__stock":"ui-row__stock-R0vkG","row__price":"ui-row__price-Xc0rY","row__access":"ui-row__access-90GUv","row__action":"ui-row__action-BLUhd","thumb":"ui-thumb-keewu","identity":"ui-identity-KJkMD","identity__name":"ui-identity__name-HOwle","truncate":"ui-truncate-5ux8b","column__image":"ui-column__image-80B8g","column__code":"ui-column__code-WqdqI","column__name":"ui-column__name-XArN-","column__brand":"ui-column__brand-kZOvm","column__stock":"ui-column__stock-TFp2x","column__price":"ui-column__price-O6HlG","column__access":"ui-column__access-anXj-","column__action":"ui-column__action-v67xi","srOnly":"ui-srOnly-tMxZI"};
7
+ import { ProductThumb as y, ProductIdentity as C } from "./parts.js";
8
+ import { default as B } from "./columns.js";
9
+ const j = ({
10
+ name: c,
11
+ href: m,
12
+ linkProps: d,
13
+ partNumber: i,
14
+ image: n,
15
+ brand: l,
16
+ vehicleTypes: p,
17
+ stock: u,
18
+ price: _,
19
+ signIn: s,
20
+ action: a,
21
+ as: f = "article",
22
+ className: h,
23
+ testId: w
24
+ }) => /* @__PURE__ */ e(f, { className: t(o.row, h), "data-testid": w, children: [
25
+ /* @__PURE__ */ r(y, { image: n }),
26
+ /* @__PURE__ */ e("span", { className: o.row__main, children: [
27
+ /* @__PURE__ */ r(b, { code: i, isCopyable: !0, size: "sm", isMuted: !0 }),
28
+ /* @__PURE__ */ r(C, { name: c, href: m, linkProps: d, vehicleTypes: p })
29
+ ] }),
30
+ /* @__PURE__ */ r("span", { className: t(o.row__brand, o.truncate), children: l }),
31
+ s === void 0 ? /* @__PURE__ */ e(x, { children: [
32
+ /* @__PURE__ */ r("span", { className: o.row__stock, children: u }),
33
+ /* @__PURE__ */ r("span", { className: o.row__price, children: _ })
34
+ ] }) : /* @__PURE__ */ r("span", { className: o.row__access, children: s }),
35
+ a && /* @__PURE__ */ r("span", { className: o.row__action, children: a })
36
+ ] }), g = /* @__PURE__ */ N(
37
+ /* @__PURE__ */ P(j, "ProductRow")
38
+ );
39
+ export {
40
+ g as default,
41
+ B as productColumns
42
+ };
43
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/ProductRow/index.tsx"],"sourcesContent":["import { memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport CodeText from '../CodeText';\n\nimport styles from './index.module.scss';\nimport { ProductIdentity, type ProductRowData, ProductThumb } from './parts';\n\nexport type { ProductRowData } from './parts';\nexport { default as productColumns, type ProductColumnsOptions } from './columns';\nexport type { ProductField } from './parts';\n\ntype Props = ProductRowData & {\n /** A visitor's row: this replaces the stock and the price (\"Fiyat için giriş yapın\"). */\n signIn?: ReactNode;\n /** The row's end: an `AddToCart size=\"sm\"`. */\n action?: ReactNode;\n /** The element: `li` inside a list (default `article`). */\n as?: 'article' | 'li' | 'div';\n className?: string;\n testId?: string;\n};\n\n/**\n * ProductRow (3.8) — one product on one line outside a table (equivalents, a cart on a phone, a\n * quick order list): image 40px · part number and name with its vehicle types · brand · stock ·\n * price · add to cart, in the columns of `productColumns`. A visitor's row puts `signIn` where the\n * stock and price are. On a phone the row stacks under its image.\n * @example <ProductRow as=\"li\" name=\"Fren balatası\" href=\"/parca/fren\" partNumber=\"2995815\" stock={<StockStatus … />} price={<Price value=\"845,00\" />} action={<AddToCart size=\"sm\" onAdd={add} />} />\n */\nconst ProductRow = ({\n name,\n href,\n linkProps,\n partNumber,\n image,\n brand,\n vehicleTypes,\n stock,\n price,\n signIn,\n action,\n as: Tag = 'article',\n className,\n testId,\n}: Props) => (\n <Tag className={cx(styles.row, className)} data-testid={testId}>\n <ProductThumb image={image} />\n <span className={styles.row__main}>\n <CodeText code={partNumber} isCopyable size=\"sm\" isMuted />\n <ProductIdentity name={name} href={href} linkProps={linkProps} vehicleTypes={vehicleTypes} />\n </span>\n <span className={cx(styles.row__brand, styles.truncate)}>{brand}</span>\n {signIn === undefined ? (\n <>\n <span className={styles.row__stock}>{stock}</span>\n <span className={styles.row__price}>{price}</span>\n </>\n ) : (\n <span className={styles.row__access}>{signIn}</span>\n )}\n {action && <span className={styles.row__action}>{action}</span>}\n </Tag>\n);\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(ProductRow, 'ProductRow'),\n) as typeof ProductRow;\n"],"names":["ProductRow","name","href","linkProps","partNumber","image","brand","vehicleTypes","stock","price","signIn","action","Tag","className","testId","jsxs","cx","styles","jsx","ProductThumb","CodeText","ProductIdentity","Fragment","index","memo","named"],"mappings":";;;;;;;;AA+BA,MAAMA,IAAa,CAAC;AAAA,EAClB,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,cAAAC;AAAA,EACA,OAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,IAAIC,IAAM;AAAA,EACV,WAAAC;AAAA,EACA,QAAAC;AACF,MACE,gBAAAC,EAACH,KAAI,WAAWI,EAAGC,EAAO,KAAKJ,CAAS,GAAG,eAAaC,GACtD,UAAA;AAAA,EAAA,gBAAAI,EAACC,KAAa,OAAAd,GAAc;AAAA,EAC5B,gBAAAU,EAAC,QAAA,EAAK,WAAWE,EAAO,WACtB,UAAA;AAAA,IAAA,gBAAAC,EAACE,GAAA,EAAS,MAAMhB,GAAY,YAAU,IAAC,MAAK,MAAK,SAAO,GAAA,CAAC;AAAA,IACzD,gBAAAc,EAACG,GAAA,EAAgB,MAAApB,GAAY,MAAAC,GAAY,WAAAC,GAAsB,cAAAI,EAAA,CAA4B;AAAA,EAAA,GAC7F;AAAA,EACA,gBAAAW,EAAC,UAAK,WAAWF,EAAGC,EAAO,YAAYA,EAAO,QAAQ,GAAI,UAAAX,EAAA,CAAM;AAAA,EAC/DI,MAAW,SACV,gBAAAK,EAAAO,GAAA,EACE,UAAA;AAAA,IAAA,gBAAAJ,EAAC,QAAA,EAAK,WAAWD,EAAO,YAAa,UAAAT,GAAM;AAAA,IAC3C,gBAAAU,EAAC,QAAA,EAAK,WAAWD,EAAO,YAAa,UAAAR,EAAA,CAAM;AAAA,EAAA,GAC7C,IAEA,gBAAAS,EAAC,QAAA,EAAK,WAAWD,EAAO,aAAc,UAAAP,GAAO;AAAA,EAE9CC,KAAU,gBAAAO,EAAC,QAAA,EAAK,WAAWD,EAAO,aAAc,UAAAN,EAAA,CAAO;AAAA,GAC1D,GAGFY,IAA6B,gBAAAC;AAAA,EACb,gBAAAC,EAAMzB,GAAY,YAAY;AAC9C;"}
@@ -0,0 +1,2 @@
1
+ "use client";"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),o=require("../../helpers/class-name.helper.cjs"),i=require("../../helpers/label.helper.cjs"),d=require("../../theme/context.cjs"),a=require("../Link/index.cjs"),m=require("../VehicleTypeList/index.cjs"),n={default:{"row":"ui-row-hRssp","row__main":"ui-row__main-9U8-X","row__brand":"ui-row__brand-FPANJ","row__stock":"ui-row__stock-R0vkG","row__price":"ui-row__price-Xc0rY","row__access":"ui-row__access-90GUv","row__action":"ui-row__action-BLUhd","thumb":"ui-thumb-keewu","identity":"ui-identity-KJkMD","identity__name":"ui-identity__name-HOwle","truncate":"ui-truncate-5ux8b","column__image":"ui-column__image-80B8g","column__code":"ui-column__code-WqdqI","column__name":"ui-column__name-XArN-","column__brand":"ui-column__brand-kZOvm","column__stock":"ui-column__stock-TFp2x","column__price":"ui-column__price-O6HlG","column__access":"ui-column__access-anXj-","column__action":"ui-column__action-v67xi","srOnly":"ui-srOnly-tMxZI"}},h=({image:e})=>s.jsx("span",{"aria-hidden":!0,className:n.default.thumb,children:e}),p=({name:e,href:r,linkProps:c,vehicleTypes:t=[]})=>s.jsxs("span",{className:n.default.identity,children:[s.jsx(a.default,{...c,href:r,title:e,className:n.default.identity__name,children:e}),s.jsx(m.default,{types:t})]}),x=({field:e,text:r,isHidden:c})=>{var u;const{labels:t}=d.useUi(),l=i.resolveLabel(`productColumns.labels.${e}`,r,(u=t==null?void 0:t.product)==null?void 0:u[e]);return s.jsx("span",{className:o.cx(c&&n.default.srOnly),children:l})};exports.ProductColumnLabel=x;exports.ProductIdentity=p;exports.ProductThumb=h;
2
+ //# sourceMappingURL=parts.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parts.cjs","sources":["../../../src/components/ProductRow/parts.tsx"],"sourcesContent":["'use client';\n\nimport { type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\nimport type { UiLinkExtraProps } from '../../types/link.type';\nimport UiLink from '../Link';\nimport VehicleTypeList from '../VehicleTypeList';\n\nimport styles from './index.module.scss';\n\n/** What a product row and a product table cell show of one product (3.8). */\nexport type ProductRowData = {\n name: string;\n href: string;\n linkProps?: UiLinkExtraProps;\n /** Mono and copyable. */\n partNumber: string;\n /** A 40px thumbnail: `<img alt=\"\">` or the framework's image. */\n image?: ReactNode;\n brand?: ReactNode;\n vehicleTypes?: readonly string[];\n /** A `StockStatus`, its breakdown in the tooltip. */\n stock?: ReactNode;\n /** A `Price`. */\n price?: ReactNode;\n};\n\n/** The 40px image box of a row: the photo drawn whole on a sunken ground. */\nexport const ProductThumb = ({ image }: { image?: ReactNode }) => (\n <span aria-hidden className={styles.thumb}>\n {image}\n </span>\n);\n\n/** The name (one line, its tooltip the full name) over the vehicle types. */\nexport const ProductIdentity = ({\n name,\n href,\n linkProps,\n vehicleTypes = [],\n}: Pick<ProductRowData, 'name' | 'href' | 'linkProps' | 'vehicleTypes'>) => (\n <span className={styles.identity}>\n <UiLink {...linkProps} href={href} title={name} className={styles.identity__name}>\n {name}\n </UiLink>\n <VehicleTypeList types={vehicleTypes} />\n </span>\n);\n\n/** The columns of a product table; each heading comes from `labels.product`. */\nexport type ProductField =\n 'image' | 'partNumber' | 'name' | 'brand' | 'stock' | 'price' | 'access' | 'action';\n\n/** A column heading read from the provider; `isHidden` keeps it for a screen reader only. */\nexport const ProductColumnLabel = ({\n field,\n text,\n isHidden,\n}: {\n field: ProductField;\n text?: string;\n isHidden: boolean;\n}) => {\n const { labels } = useUi();\n const label = resolveLabel(`productColumns.labels.${field}`, text, labels?.product?.[field]);\n\n return <span className={cx(isHidden && styles.srOnly)}>{label}</span>;\n};\n"],"names":["ProductThumb","image","jsx","styles","ProductIdentity","name","href","linkProps","vehicleTypes","jsxs","UiLink","VehicleTypeList","ProductColumnLabel","field","text","isHidden","labels","useUi","label","resolveLabel","_a","cx"],"mappings":"kXA8BaA,EAAe,CAAC,CAAE,MAAAC,KAC7BC,EAAAA,IAAC,OAAA,CAAK,cAAW,GAAC,UAAWC,EAAAA,QAAO,MACjC,SAAAF,CAAA,CACH,EAIWG,EAAkB,CAAC,CAC9B,KAAAC,EACA,KAAAC,EACA,UAAAC,EACA,aAAAC,EAAe,CAAA,CACjB,IACEC,EAAAA,KAAC,OAAA,CAAK,UAAWN,EAAAA,QAAO,SACtB,SAAA,CAAAD,EAAAA,IAACQ,EAAAA,QAAA,CAAQ,GAAGH,EAAW,KAAAD,EAAY,MAAOD,EAAM,UAAWF,EAAAA,QAAO,eAC/D,SAAAE,CAAA,CACH,EACAH,EAAAA,IAACS,EAAAA,QAAA,CAAgB,MAAOH,CAAA,CAAc,CAAA,CAAA,CACxC,EAQWI,EAAqB,CAAC,CACjC,MAAAC,EACA,KAAAC,EACA,SAAAC,CACF,IAIM,OACJ,KAAM,CAAE,OAAAC,CAAA,EAAWC,QAAA,EACbC,EAAQC,EAAAA,aAAa,yBAAyBN,CAAK,GAAIC,GAAMM,EAAAJ,GAAA,YAAAA,EAAQ,UAAR,YAAAI,EAAkBP,EAAM,EAE3F,OAAOX,MAAC,QAAK,UAAWmB,EAAAA,GAAGN,GAAYZ,EAAAA,QAAO,MAAM,EAAI,SAAAe,CAAA,CAAM,CAChE"}
@@ -0,0 +1,32 @@
1
+ import { ReactNode } from 'react';
2
+ import { UiLinkExtraProps } from '../../types/link.type.cjs';
3
+ /** What a product row and a product table cell show of one product (3.8). */
4
+ export type ProductRowData = {
5
+ name: string;
6
+ href: string;
7
+ linkProps?: UiLinkExtraProps;
8
+ /** Mono and copyable. */
9
+ partNumber: string;
10
+ /** A 40px thumbnail: `<img alt="">` or the framework's image. */
11
+ image?: ReactNode;
12
+ brand?: ReactNode;
13
+ vehicleTypes?: readonly string[];
14
+ /** A `StockStatus`, its breakdown in the tooltip. */
15
+ stock?: ReactNode;
16
+ /** A `Price`. */
17
+ price?: ReactNode;
18
+ };
19
+ /** The 40px image box of a row: the photo drawn whole on a sunken ground. */
20
+ export declare const ProductThumb: ({ image }: {
21
+ image?: ReactNode;
22
+ }) => import("react").JSX.Element;
23
+ /** The name (one line, its tooltip the full name) over the vehicle types. */
24
+ export declare const ProductIdentity: ({ name, href, linkProps, vehicleTypes, }: Pick<ProductRowData, "name" | "href" | "linkProps" | "vehicleTypes">) => import("react").JSX.Element;
25
+ /** The columns of a product table; each heading comes from `labels.product`. */
26
+ export type ProductField = 'image' | 'partNumber' | 'name' | 'brand' | 'stock' | 'price' | 'access' | 'action';
27
+ /** A column heading read from the provider; `isHidden` keeps it for a screen reader only. */
28
+ export declare const ProductColumnLabel: ({ field, text, isHidden, }: {
29
+ field: ProductField;
30
+ text?: string;
31
+ isHidden: boolean;
32
+ }) => import("react").JSX.Element;