@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
package/README.md CHANGED
@@ -404,6 +404,23 @@ either. Labels are given **once**, on the provider:
404
404
  seeAll: 'Tümünü gör',
405
405
  },
406
406
  megaMenu: { navigation: 'Kategoriler', menu: 'Menü', seeAll: label => `Tüm ${label}` },
407
+ product: {
408
+ addToCart: 'Sepete ekle',
409
+ quantity: 'Adet',
410
+ vehicleTypes: 'Uyumlu araç tipleri',
411
+ moreVehicleTypes: count => `${count} araç tipi daha`,
412
+ image: 'Görsel',
413
+ partNumber: 'Parça no',
414
+ name: 'Ürün',
415
+ brand: 'Marka',
416
+ stock: 'Stok',
417
+ price: 'Fiyat',
418
+ access: 'Fiyat ve stok',
419
+ action: 'Sepete ekle',
420
+ numberType: 'Tür',
421
+ number: 'Numara',
422
+ },
423
+ searchField: { clear: 'Aramayı temizle', loading: 'Aranıyor…', results: count => `${count} öneri` },
407
424
  rating: {
408
425
  srLabel: (value, count) => `5 üzerinden ${value}${count ? `, ${count} değerlendirme` : ''}`,
409
426
  starCount: star => `${star} yıldız`,
@@ -1015,8 +1032,17 @@ search engines and in-page find; `isHashSynced` keeps the selected tab in `#<id>
1015
1032
  isEveryPanelRendered
1016
1033
  isHashSynced
1017
1034
  items={[
1018
- { id: 'ozellikler', label: 'Teknik özellikler', content: specs },
1019
- { id: 'numaralar', label: 'Parça numaraları', count: 4, content: numbers },
1035
+ {
1036
+ id: 'ozellikler',
1037
+ label: 'Teknik özellikler',
1038
+ content: <SpecTable caption="Teknik özellikler" items={specs} />,
1039
+ },
1040
+ {
1041
+ id: 'numaralar',
1042
+ label: 'Parça numaraları',
1043
+ count: 4,
1044
+ content: <PartNumberList caption="Parça numaraları" items={numbers} />,
1045
+ },
1020
1046
  ]}
1021
1047
  />
1022
1048
  ```
@@ -1031,6 +1057,99 @@ with one flat hover; counts and the selection count are plain secondary figures.
1031
1057
  **Summaries.** `TotalsList` for money totals; `DescriptionList` (`/chat`) takes
1032
1058
  `valueAlign="end"` to set values against the end edge in tabular figures.
1033
1059
 
1060
+ ### Storefront search (3.9)
1061
+
1062
+ `SearchField` is a header's search: a search field (icon, clear button, never a caret) in a GET
1063
+ `<form role="search">` that works without JavaScript — Enter loads `action?name=query` — with
1064
+ grouped suggestions in a raised panel (`shadow-2`) as wide as the field. It is a combobox: ↑/↓ move
1065
+ through every group (`aria-activedescendant`), Enter opens the active suggestion or submits the
1066
+ query, Escape closes the panel and then clears the field, a press outside or leaving it closes.
1067
+ Group labels use the label text style; the matched part of each label is set in semibold
1068
+ (`highlight`, the typed query by default; Turkish case rules). The component does not fetch: the
1069
+ app answers `onQueryChange` (debounced by `debounceMs`) with `groups` and `isLoading`.
1070
+
1071
+ ```tsx
1072
+ <SearchField
1073
+ label="Parça ara"
1074
+ action="/arama"
1075
+ placeholder="Parça no, ürün, kategori, araç tipi"
1076
+ defaultQuery={q}
1077
+ onQueryChange={setQuery}
1078
+ debounceMs={200}
1079
+ groups={[
1080
+ {
1081
+ id: 'numbers',
1082
+ label: 'Parça numaraları',
1083
+ items: [
1084
+ { id: '1', label: '428959612', description: 'Ön far (sol)', href: '/parca/on-far-sol' },
1085
+ ],
1086
+ },
1087
+ { id: 'products', label: 'Ürünler', items: products.map(toItem) },
1088
+ ]}
1089
+ isLoading={isLoading}
1090
+ emptyMessage="Sonuç yok"
1091
+ footer={<TextLink href={`/arama?q=${encodeURIComponent(query)}`}>Tüm sonuçları gör</TextLink>}
1092
+ hasShortcut
1093
+ size="lg"
1094
+ />
1095
+ ```
1096
+
1097
+ ### B2B product parts (3.8)
1098
+
1099
+ A parts catalogue's product in a grid, a list and a table, from the same parts — so a stock state, a
1100
+ price and the add-to-cart row look the same everywhere. Texts come from `labels.product`.
1101
+
1102
+ | Part | What it is |
1103
+ | ----------------- | --------------------------------------------------------------------------------------------------------- |
1104
+ | `ProductCard` | a grid card: 4:3 image (`contain`), brand + badges, name (2 lines), copyable part number, types, foot |
1105
+ | `ProductRow` | the same product on one line outside a table (equivalents, a phone cart): 40px image … add to cart |
1106
+ | `productColumns` | the same columns for `DataTable`; with `signIn` stock and price merge into one visitor column |
1107
+ | `StockStatus` | `available` (cobalt, filled dot) · `limited` (ink, ring) · `unavailable` (red) + words; warehouse tooltip |
1108
+ | `VehicleTypeList` | compatible types on one line: the first `max` (2), then "+N", the whole list in the tooltip |
1109
+ | `AddToCart` | the quantity box and the button on one row; `onAdd(quantity)`; `size="sm"` in a row |
1110
+ | `SpecTable` | key → value specifications in two aligned columns, hairlines, no zebra |
1111
+ | `PartNumberList` | kind · brand · number (mono, copy button) in a table |
1112
+ | `StatusCell` | the status rule: one primary badge per cell, any second state an icon with its words in a tooltip |
1113
+
1114
+ Every card of a grid row is as tall as the row and its foot (stock, price, add to cart) sits at the
1115
+ bottom; the name keeps two lines of room, so part numbers, prices and buttons line up across the row.
1116
+
1117
+ ```tsx
1118
+ <ProductCard
1119
+ name="Ön far (sol) – Stralis / S-Way / Trakker"
1120
+ href="/parca/on-far-sol"
1121
+ partNumber="428959612"
1122
+ image={<Image src={src} alt="" fill />}
1123
+ brand="IVECO"
1124
+ badges={<Badge tone="info" variant="soft">Orijinal</Badge>}
1125
+ vehicleTypes={['Stralis', 'S-Way', 'Trakker']}
1126
+ stock={<StockStatus tone="available" label="Stokta (24)" breakdown={warehouses} />}
1127
+ price={<Price value="1.229,00" listValue="1.450,00" discountPercent={15} />}
1128
+ // a visitor: no `price`, the prompt instead
1129
+ signIn={<TextLink href="/giris?sonra=/parca/on-far-sol">Fiyat için giriş yapın</TextLink>}
1130
+ action={<AddToCart productName="Ön far (sol)" onAdd={quantity => add(id, quantity)} />}
1131
+ />
1132
+
1133
+ <DataTable
1134
+ label="Ürünler"
1135
+ rows={items}
1136
+ getRowKey={item => item.id}
1137
+ columns={productColumns({
1138
+ product: item => ({ name: item.name, href: item.href, partNumber: item.code, image: item.thumb,
1139
+ brand: item.brand, vehicleTypes: item.types, stock: <StockStatus … />, price: <Price … /> }),
1140
+ signIn: isVisitor ? item => <TextLink href={signInHref(item)}>Giriş yapın</TextLink> : undefined,
1141
+ action: item => <AddToCart size="sm" productName={item.name} onAdd={q => add(item.id, q)} />,
1142
+ })}
1143
+ />
1144
+
1145
+ <SpecTable caption="Teknik özellikler" items={[{ label: 'Gerilim', value: '24 V' }]} />
1146
+ <PartNumberList caption="Parça numaraları" items={[{ id: '1', type: 'OEM', brand: 'IVECO', number: '428959612' }]} />
1147
+ <StatusCell
1148
+ status={<Badge tone="info">Onay bekliyor</Badge>}
1149
+ flags={[{ id: 'limit', icon: <ExclamationTriangle />, label: 'Limit aşımı', tone: 'danger' }]}
1150
+ />
1151
+ ```
1152
+
1034
1153
  ### Commerce building blocks (3.4)
1035
1154
 
1036
1155
  A storefront's catalogue, product page and header. Each component has its own
@@ -0,0 +1,2 @@
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),v=require("react"),m=require("../../enums/ui-size.enum.cjs"),h=require("../../enums/ui-variant.enum.cjs"),y=require("../../helpers/class-name.helper.cjs"),C=require("../../helpers/component.helper.cjs"),x=require("../../helpers/label.helper.cjs"),R=require("../../theme/context.cjs"),w=require("../Button/index.cjs"),z=require("../QuantityStepper/index.cjs"),d={default:{"add":"ui-add-dxTL0","add__button":"ui-add__button-zeCuJ","add--sm":"ui-add--sm-DlcD7"}},I=({onAdd:p,quantity:a,onQuantityChange:r,min:n=1,max:T=999,isDisabled:o=!1,isLoading:b=!1,size:u="md",productName:t,label:A,className:M,testId:S})=>{var q,_;const{labels:e}=R.useUi(),[j,$]=v.useState(n),i=a??j,c=x.resolveLabel("AddToCart.label",A,(q=e==null?void 0:e.product)==null?void 0:q.addToCart),l=x.resolveLabel("AddToCart.quantity",void 0,(_=e==null?void 0:e.product)==null?void 0:_.quantity),L=f=>{a===void 0&&$(f),r==null||r(f)};return s.jsxs("div",{className:y.cx(d.default.add,d.default[`add--${u}`],M),"data-testid":S,children:[s.jsx(z.default,{value:i,onChange:L,min:n,max:T,size:"sm",isDisabled:o,label:t?`${t} — ${l}`:l}),s.jsx(w.default,{variant:h.default.PRIMARY,size:u==="sm"?m.default.SMALL:m.default.MEDIUM,isLoading:b,disabled:o,"aria-label":t?`${t} — ${c}`:void 0,className:d.default.add__button,onClick:()=>p(i),children:c})]})},O=v.memo(C.named(I,"AddToCart"));exports.default=O;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/AddToCart/index.tsx"],"sourcesContent":["'use client';\n\nimport { memo, useState } from 'react';\n\nimport UISize from '../../enums/ui-size.enum';\nimport UIVariant from '../../enums/ui-variant.enum';\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\nimport Button from '../Button';\nimport QuantityStepper from '../QuantityStepper';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n /** Called with the chosen quantity. A visitor's call can send them to sign in with it. */\n onAdd: (quantity: number) => void;\n /** Controlled quantity; uncontrolled it starts at `min`. */\n quantity?: number;\n onQuantityChange?: (quantity: number) => void;\n /** Default 1. */\n min?: number;\n /** Default 999. */\n max?: number;\n /** Not orderable: the box and the button are disabled. */\n isDisabled?: boolean;\n /** Adding: the button shows its spinner and is not pressed twice. */\n isLoading?: boolean;\n /** `sm` in a table row, `md` in a card (default) and on a product page. */\n size?: 'sm' | 'md';\n /** The product's name, read with the quantity box and the button (\"Ön far — adet\"). */\n productName?: string;\n /** The button's text; `labels.product.addToCart` by default. */\n label?: string;\n className?: string;\n testId?: string;\n};\n\n/**\n * AddToCart (3.8) — a quantity box and the add-to-cart button on one row: the same control in a\n * product card, a product table row and on the product page.\n * @example <AddToCart productName=\"Ön far (sol)\" onAdd={quantity => addToCart(id, quantity)} />\n */\nconst AddToCart = ({\n onAdd,\n quantity: controlled,\n onQuantityChange,\n min = 1,\n max = 999,\n isDisabled = false,\n isLoading = false,\n size = 'md',\n productName,\n label,\n className,\n testId,\n}: Props) => {\n const { labels } = useUi();\n const [own, setOwn] = useState(min);\n const quantity = controlled ?? own;\n const text = resolveLabel('AddToCart.label', label, labels?.product?.addToCart);\n const quantityText = resolveLabel('AddToCart.quantity', undefined, labels?.product?.quantity);\n\n const change = (next: number) => {\n if (controlled === undefined) setOwn(next);\n onQuantityChange?.(next);\n };\n\n return (\n <div className={cx(styles.add, styles[`add--${size}`], className)} data-testid={testId}>\n <QuantityStepper\n value={quantity}\n onChange={change}\n min={min}\n max={max}\n size=\"sm\"\n isDisabled={isDisabled}\n label={productName ? `${productName} — ${quantityText}` : quantityText}\n />\n <Button\n variant={UIVariant.PRIMARY}\n size={size === 'sm' ? UISize.SMALL : UISize.MEDIUM}\n isLoading={isLoading}\n disabled={isDisabled}\n aria-label={productName ? `${productName} — ${text}` : undefined}\n className={styles.add__button}\n onClick={() => onAdd(quantity)}\n >\n {text}\n </Button>\n </div>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(AddToCart, 'AddToCart')) as typeof AddToCart;\n"],"names":["AddToCart","onAdd","controlled","onQuantityChange","min","max","isDisabled","isLoading","size","productName","label","className","testId","labels","useUi","own","setOwn","useState","quantity","text","resolveLabel","_a","quantityText","_b","change","next","jsxs","cx","styles","jsx","QuantityStepper","Button","UIVariant","UISize","index","memo","named"],"mappings":"0iBA2CMA,EAAY,CAAC,CACjB,MAAAC,EACA,SAAUC,EACV,iBAAAC,EACA,IAAAC,EAAM,EACN,IAAAC,EAAM,IACN,WAAAC,EAAa,GACb,UAAAC,EAAY,GACZ,KAAAC,EAAO,KACP,YAAAC,EACA,MAAAC,EACA,UAAAC,EACA,OAAAC,CACF,IAAa,SACX,KAAM,CAAE,OAAAC,CAAA,EAAWC,QAAA,EACb,CAACC,EAAKC,CAAM,EAAIC,EAAAA,SAASb,CAAG,EAC5Bc,EAAWhB,GAAca,EACzBI,EAAOC,EAAAA,aAAa,kBAAmBV,GAAOW,EAAAR,GAAA,YAAAA,EAAQ,UAAR,YAAAQ,EAAiB,SAAS,EACxEC,EAAeF,EAAAA,aAAa,qBAAsB,QAAWG,EAAAV,GAAA,YAAAA,EAAQ,UAAR,YAAAU,EAAiB,QAAQ,EAEtFC,EAAUC,GAAiB,CAC3BvB,IAAe,QAAWc,EAAOS,CAAI,EACzCtB,GAAA,MAAAA,EAAmBsB,EACrB,EAEA,OACEC,EAAAA,KAAC,MAAA,CAAI,UAAWC,EAAAA,GAAGC,EAAAA,QAAO,IAAKA,EAAAA,QAAO,QAAQpB,CAAI,EAAE,EAAGG,CAAS,EAAG,cAAaC,EAC9E,SAAA,CAAAiB,EAAAA,IAACC,EAAAA,QAAA,CACC,MAAOZ,EACP,SAAUM,EACV,IAAApB,EACA,IAAAC,EACA,KAAK,KACL,WAAAC,EACA,MAAOG,EAAc,GAAGA,CAAW,MAAMa,CAAY,GAAKA,CAAA,CAAA,EAE5DO,EAAAA,IAACE,EAAAA,QAAA,CACC,QAASC,EAAAA,QAAU,QACnB,KAAMxB,IAAS,KAAOyB,EAAAA,QAAO,MAAQA,EAAAA,QAAO,OAC5C,UAAA1B,EACA,SAAUD,EACV,aAAYG,EAAc,GAAGA,CAAW,MAAMU,CAAI,GAAK,OACvD,UAAWS,EAAAA,QAAO,YAClB,QAAS,IAAM3B,EAAMiB,CAAQ,EAE5B,SAAAC,CAAA,CAAA,CACH,EACF,CAEJ,EAEAe,EAA6BC,OAAmBC,EAAAA,MAAMpC,EAAW,WAAW,CAAC"}
@@ -0,0 +1,31 @@
1
+ type Props = {
2
+ /** Called with the chosen quantity. A visitor's call can send them to sign in with it. */
3
+ onAdd: (quantity: number) => void;
4
+ /** Controlled quantity; uncontrolled it starts at `min`. */
5
+ quantity?: number;
6
+ onQuantityChange?: (quantity: number) => void;
7
+ /** Default 1. */
8
+ min?: number;
9
+ /** Default 999. */
10
+ max?: number;
11
+ /** Not orderable: the box and the button are disabled. */
12
+ isDisabled?: boolean;
13
+ /** Adding: the button shows its spinner and is not pressed twice. */
14
+ isLoading?: boolean;
15
+ /** `sm` in a table row, `md` in a card (default) and on a product page. */
16
+ size?: 'sm' | 'md';
17
+ /** The product's name, read with the quantity box and the button ("Ön far — adet"). */
18
+ productName?: string;
19
+ /** The button's text; `labels.product.addToCart` by default. */
20
+ label?: string;
21
+ className?: string;
22
+ testId?: string;
23
+ };
24
+ /**
25
+ * AddToCart (3.8) — a quantity box and the add-to-cart button on one row: the same control in a
26
+ * product card, a product table row and on the product page.
27
+ * @example <AddToCart productName="Ön far (sol)" onAdd={quantity => addToCart(id, quantity)} />
28
+ */
29
+ declare const AddToCart: ({ onAdd, quantity: controlled, onQuantityChange, min, max, isDisabled, isLoading, size, productName, label, className, testId, }: Props) => import("react").JSX.Element;
30
+ declare const _default: typeof AddToCart;
31
+ export default _default;
@@ -0,0 +1,31 @@
1
+ type Props = {
2
+ /** Called with the chosen quantity. A visitor's call can send them to sign in with it. */
3
+ onAdd: (quantity: number) => void;
4
+ /** Controlled quantity; uncontrolled it starts at `min`. */
5
+ quantity?: number;
6
+ onQuantityChange?: (quantity: number) => void;
7
+ /** Default 1. */
8
+ min?: number;
9
+ /** Default 999. */
10
+ max?: number;
11
+ /** Not orderable: the box and the button are disabled. */
12
+ isDisabled?: boolean;
13
+ /** Adding: the button shows its spinner and is not pressed twice. */
14
+ isLoading?: boolean;
15
+ /** `sm` in a table row, `md` in a card (default) and on a product page. */
16
+ size?: 'sm' | 'md';
17
+ /** The product's name, read with the quantity box and the button ("Ön far — adet"). */
18
+ productName?: string;
19
+ /** The button's text; `labels.product.addToCart` by default. */
20
+ label?: string;
21
+ className?: string;
22
+ testId?: string;
23
+ };
24
+ /**
25
+ * AddToCart (3.8) — a quantity box and the add-to-cart button on one row: the same control in a
26
+ * product card, a product table row and on the product page.
27
+ * @example <AddToCart productName="Ön far (sol)" onAdd={quantity => addToCart(id, quantity)} />
28
+ */
29
+ declare const AddToCart: ({ onAdd, quantity: controlled, onQuantityChange, min, max, isDisabled, isLoading, size, productName, label, className, testId, }: Props) => import("react").JSX.Element;
30
+ declare const _default: typeof AddToCart;
31
+ export default _default;
@@ -0,0 +1,62 @@
1
+ "use client";
2
+ import { jsxs as C, jsx as u } from "react/jsx-runtime";
3
+ import { memo as L, useState as b } from "react";
4
+ import v from "../../enums/ui-size.enum.js";
5
+ import j from "../../enums/ui-variant.enum.js";
6
+ import { cx as w } from "../../helpers/class-name.helper.js";
7
+ import { named as z } from "../../helpers/component.helper.js";
8
+ import { resolveLabel as x } from "../../helpers/label.helper.js";
9
+ import { useUi as R } from "../../theme/context.js";
10
+ import _ from "../Button/index.js";
11
+ import k from "../QuantityStepper/index.js";
12
+ const i = {"add":"ui-add-dxTL0","add__button":"ui-add__button-zeCuJ","add--sm":"ui-add--sm-DlcD7"};
13
+ const B = ({
14
+ onAdd: A,
15
+ quantity: d,
16
+ onQuantityChange: r,
17
+ min: a = 1,
18
+ max: T = 999,
19
+ isDisabled: m = !1,
20
+ isLoading: q = !1,
21
+ size: s = "md",
22
+ productName: o,
23
+ label: $,
24
+ className: I,
25
+ testId: M
26
+ }) => {
27
+ var c, p;
28
+ const { labels: t } = R(), [S, U] = b(a), e = d ?? S, f = x("AddToCart.label", $, (c = t == null ? void 0 : t.product) == null ? void 0 : c.addToCart), n = x("AddToCart.quantity", void 0, (p = t == null ? void 0 : t.product) == null ? void 0 : p.quantity), y = (l) => {
29
+ d === void 0 && U(l), r == null || r(l);
30
+ };
31
+ return /* @__PURE__ */ C("div", { className: w(i.add, i[`add--${s}`], I), "data-testid": M, children: [
32
+ /* @__PURE__ */ u(
33
+ k,
34
+ {
35
+ value: e,
36
+ onChange: y,
37
+ min: a,
38
+ max: T,
39
+ size: "sm",
40
+ isDisabled: m,
41
+ label: o ? `${o} — ${n}` : n
42
+ }
43
+ ),
44
+ /* @__PURE__ */ u(
45
+ _,
46
+ {
47
+ variant: j.PRIMARY,
48
+ size: s === "sm" ? v.SMALL : v.MEDIUM,
49
+ isLoading: q,
50
+ disabled: m,
51
+ "aria-label": o ? `${o} — ${f}` : void 0,
52
+ className: i.add__button,
53
+ onClick: () => A(e),
54
+ children: f
55
+ }
56
+ )
57
+ ] });
58
+ }, K = /* @__PURE__ */ L(/* @__PURE__ */ z(B, "AddToCart"));
59
+ export {
60
+ K as default
61
+ };
62
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/AddToCart/index.tsx"],"sourcesContent":["'use client';\n\nimport { memo, useState } from 'react';\n\nimport UISize from '../../enums/ui-size.enum';\nimport UIVariant from '../../enums/ui-variant.enum';\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\nimport Button from '../Button';\nimport QuantityStepper from '../QuantityStepper';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n /** Called with the chosen quantity. A visitor's call can send them to sign in with it. */\n onAdd: (quantity: number) => void;\n /** Controlled quantity; uncontrolled it starts at `min`. */\n quantity?: number;\n onQuantityChange?: (quantity: number) => void;\n /** Default 1. */\n min?: number;\n /** Default 999. */\n max?: number;\n /** Not orderable: the box and the button are disabled. */\n isDisabled?: boolean;\n /** Adding: the button shows its spinner and is not pressed twice. */\n isLoading?: boolean;\n /** `sm` in a table row, `md` in a card (default) and on a product page. */\n size?: 'sm' | 'md';\n /** The product's name, read with the quantity box and the button (\"Ön far — adet\"). */\n productName?: string;\n /** The button's text; `labels.product.addToCart` by default. */\n label?: string;\n className?: string;\n testId?: string;\n};\n\n/**\n * AddToCart (3.8) — a quantity box and the add-to-cart button on one row: the same control in a\n * product card, a product table row and on the product page.\n * @example <AddToCart productName=\"Ön far (sol)\" onAdd={quantity => addToCart(id, quantity)} />\n */\nconst AddToCart = ({\n onAdd,\n quantity: controlled,\n onQuantityChange,\n min = 1,\n max = 999,\n isDisabled = false,\n isLoading = false,\n size = 'md',\n productName,\n label,\n className,\n testId,\n}: Props) => {\n const { labels } = useUi();\n const [own, setOwn] = useState(min);\n const quantity = controlled ?? own;\n const text = resolveLabel('AddToCart.label', label, labels?.product?.addToCart);\n const quantityText = resolveLabel('AddToCart.quantity', undefined, labels?.product?.quantity);\n\n const change = (next: number) => {\n if (controlled === undefined) setOwn(next);\n onQuantityChange?.(next);\n };\n\n return (\n <div className={cx(styles.add, styles[`add--${size}`], className)} data-testid={testId}>\n <QuantityStepper\n value={quantity}\n onChange={change}\n min={min}\n max={max}\n size=\"sm\"\n isDisabled={isDisabled}\n label={productName ? `${productName} — ${quantityText}` : quantityText}\n />\n <Button\n variant={UIVariant.PRIMARY}\n size={size === 'sm' ? UISize.SMALL : UISize.MEDIUM}\n isLoading={isLoading}\n disabled={isDisabled}\n aria-label={productName ? `${productName} — ${text}` : undefined}\n className={styles.add__button}\n onClick={() => onAdd(quantity)}\n >\n {text}\n </Button>\n </div>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(AddToCart, 'AddToCart')) as typeof AddToCart;\n"],"names":["AddToCart","onAdd","controlled","onQuantityChange","min","max","isDisabled","isLoading","size","productName","label","className","testId","labels","useUi","own","setOwn","useState","quantity","text","resolveLabel","_a","quantityText","_b","change","next","jsxs","cx","styles","jsx","QuantityStepper","Button","UIVariant","UISize","index","memo","named"],"mappings":";;;;;;;;;;;;AA2CA,MAAMA,IAAY,CAAC;AAAA,EACjB,OAAAC;AAAA,EACA,UAAUC;AAAA,EACV,kBAAAC;AAAA,EACA,KAAAC,IAAM;AAAA,EACN,KAAAC,IAAM;AAAA,EACN,YAAAC,IAAa;AAAA,EACb,WAAAC,IAAY;AAAA,EACZ,MAAAC,IAAO;AAAA,EACP,aAAAC;AAAA,EACA,OAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AACF,MAAa;;AACX,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAAA,GACb,CAACC,GAAKC,CAAM,IAAIC,EAASb,CAAG,GAC5Bc,IAAWhB,KAAca,GACzBI,IAAOC,EAAa,mBAAmBV,IAAOW,IAAAR,KAAA,gBAAAA,EAAQ,YAAR,gBAAAQ,EAAiB,SAAS,GACxEC,IAAeF,EAAa,sBAAsB,SAAWG,IAAAV,KAAA,gBAAAA,EAAQ,YAAR,gBAAAU,EAAiB,QAAQ,GAEtFC,IAAS,CAACC,MAAiB;AAC/B,IAAIvB,MAAe,UAAWc,EAAOS,CAAI,GACzCtB,KAAA,QAAAA,EAAmBsB;AAAA,EACrB;AAEA,SACE,gBAAAC,EAAC,OAAA,EAAI,WAAWC,EAAGC,EAAO,KAAKA,EAAO,QAAQpB,CAAI,EAAE,GAAGG,CAAS,GAAG,eAAaC,GAC9E,UAAA;AAAA,IAAA,gBAAAiB;AAAA,MAACC;AAAA,MAAA;AAAA,QACC,OAAOZ;AAAA,QACP,UAAUM;AAAA,QACV,KAAApB;AAAA,QACA,KAAAC;AAAA,QACA,MAAK;AAAA,QACL,YAAAC;AAAA,QACA,OAAOG,IAAc,GAAGA,CAAW,MAAMa,CAAY,KAAKA;AAAA,MAAA;AAAA,IAAA;AAAA,IAE5D,gBAAAO;AAAA,MAACE;AAAA,MAAA;AAAA,QACC,SAASC,EAAU;AAAA,QACnB,MAAMxB,MAAS,OAAOyB,EAAO,QAAQA,EAAO;AAAA,QAC5C,WAAA1B;AAAA,QACA,UAAUD;AAAA,QACV,cAAYG,IAAc,GAAGA,CAAW,MAAMU,CAAI,KAAK;AAAA,QACvD,WAAWS,EAAO;AAAA,QAClB,SAAS,MAAM3B,EAAMiB,CAAQ;AAAA,QAE5B,UAAAC;AAAA,MAAA;AAAA,IAAA;AAAA,EACH,GACF;AAEJ,GAEAe,IAA6B,gBAAAC,EAAmB,gBAAAC,EAAMpC,GAAW,WAAW,CAAC;"}
@@ -0,0 +1 @@
1
+ @layer ui{.ui-add-dxTL0{display:flex;align-items:center;gap:var(--hd-space-2);min-width:0}.ui-add__button-zeCuJ{flex:1;min-width:0}.ui-add--sm-DlcD7 .ui-add__button-zeCuJ{flex:0 0 auto}}
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/CodeText/index.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport CodeTextCopy from './CodeTextCopy';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n /** The part, OEM or order number, written as given (\"1K0 615 301 AA\"). */\n code: string;\n /** Adds a small copy button after the code (`labels.copyField` texts). */\n isCopyable?: boolean;\n /** The copy button's name; `labels.copyField.copy(code)` by default. */\n copyLabel?: string;\n /** Its name once copied; `labels.copyField.copied(code)` by default. */\n copiedLabel?: string;\n /** Announced after copying; `labels.copyField.announcement` by default. */\n copiedAnnouncement?: string;\n /** `sm` caption size, `md` small size; without it the code follows the text around it. */\n size?: 'sm' | 'md';\n /** Secondary text colour: an OEM number under a product's name. */\n isMuted?: boolean;\n className?: string;\n testId?: string;\n};\n\n/**\n * A calm inline code (3.4): a part or OEM number inside a sentence, a card or a table cell, in the\n * mono family with tabular figures, no surface — `CodeBadge` is the heavy, ink-filled one. One\n * click selects the whole code; `isCopyable` adds a copy button. Drawn on the server unless copyable.\n */\nconst CodeText = ({\n code,\n isCopyable,\n copyLabel,\n copiedLabel,\n copiedAnnouncement,\n size,\n isMuted,\n className,\n testId,\n}: Props) => {\n const classNames = cx(\n styles.code,\n size && styles[`code--${size}`],\n isMuted && styles['code--muted'],\n className,\n );\n\n if (isCopyable)\n return (\n <CodeTextCopy\n code={code}\n className={classNames}\n copyLabel={copyLabel}\n copiedLabel={copiedLabel}\n copiedAnnouncement={copiedAnnouncement}\n testId={testId}\n />\n );\n\n return (\n <code className={classNames} data-testid={testId}>\n <span className={styles.code__value}>{code}</span>\n </code>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(CodeText, 'CodeText')) as typeof CodeText;\n"],"names":["CodeText","code","isCopyable","copyLabel","copiedLabel","copiedAnnouncement","size","isMuted","className","testId","classNames","cx","styles","jsx","CodeTextCopy","index","memo","named"],"mappings":"0UAgCMA,EAAW,CAAC,CAChB,KAAAC,EACA,WAAAC,EACA,UAAAC,EACA,YAAAC,EACA,mBAAAC,EACA,KAAAC,EACA,QAAAC,EACA,UAAAC,EACA,OAAAC,CACF,IAAa,CACX,MAAMC,EAAaC,EAAAA,GACjBC,EAAAA,QAAO,KACPN,GAAQM,EAAAA,QAAO,SAASN,CAAI,EAAE,EAC9BC,GAAWK,EAAAA,QAAO,aAAa,EAC/BJ,CAAA,EAGF,OAAIN,EAEAW,EAAAA,IAACC,EAAAA,QAAA,CACC,KAAAb,EACA,UAAWS,EACX,UAAAP,EACA,YAAAC,EACA,mBAAAC,EACA,OAAAI,CAAA,CAAA,EAKJI,EAAAA,IAAC,OAAA,CAAK,UAAWH,EAAY,cAAaD,EACxC,SAAAI,EAAAA,IAAC,OAAA,CAAK,UAAWD,EAAAA,QAAO,YAAc,SAAAX,CAAA,CAAK,EAC7C,CAEJ,EAEAc,EAA6BC,OAAmBC,EAAAA,MAAMjB,EAAU,UAAU,CAAC"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/CodeText/index.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport CodeTextCopy from './CodeTextCopy';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n /** The part, OEM or order number, written as given (\"1K0 615 301 AA\"). */\n code: string;\n /** Adds a small copy button after the code (`labels.copyField` texts). */\n isCopyable?: boolean;\n /** The copy button's name; `labels.copyField.copy(code)` by default. */\n copyLabel?: string;\n /** Its name once copied; `labels.copyField.copied(code)` by default. */\n copiedLabel?: string;\n /** Announced after copying; `labels.copyField.announcement` by default. */\n copiedAnnouncement?: string;\n /** `sm` caption size, `md` small size; without it the code follows the text around it. */\n size?: 'sm' | 'md';\n /** Secondary text colour: an OEM number under a product's name. */\n isMuted?: boolean;\n className?: string;\n testId?: string;\n};\n\n/**\n * A calm inline code (3.4): a part or OEM number inside a sentence, a card or a table cell, in the\n * mono family with tabular figures, no surface — `CodeBadge` is the heavy, ink-filled one. One\n * click selects the whole code; `isCopyable` adds a copy button. Drawn on the server unless copyable.\n */\nconst CodeText = ({\n code,\n isCopyable,\n copyLabel,\n copiedLabel,\n copiedAnnouncement,\n size,\n isMuted,\n className,\n testId,\n}: Props) => {\n const classNames = cx(\n styles.code,\n size && styles[`code--${size}`],\n isMuted && styles['code--muted'],\n className,\n );\n\n if (isCopyable)\n return (\n <CodeTextCopy\n code={code}\n className={classNames}\n copyLabel={copyLabel}\n copiedLabel={copiedLabel}\n copiedAnnouncement={copiedAnnouncement}\n testId={testId}\n />\n );\n\n return (\n <code className={classNames} data-testid={testId}>\n <span className={styles.code__value}>{code}</span>\n </code>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(CodeText, 'CodeText')) as typeof CodeText;\n"],"names":["CodeText","code","isCopyable","copyLabel","copiedLabel","copiedAnnouncement","size","isMuted","className","testId","classNames","cx","styles","jsx","CodeTextCopy","memo","named"],"mappings":"0UAgCMA,EAAW,CAAC,CAChB,KAAAC,EACA,WAAAC,EACA,UAAAC,EACA,YAAAC,EACA,mBAAAC,EACA,KAAAC,EACA,QAAAC,EACA,UAAAC,EACA,OAAAC,CACF,IAAa,CACX,MAAMC,EAAaC,EAAAA,GACjBC,EAAAA,QAAO,KACPN,GAAQM,EAAAA,QAAO,SAASN,CAAI,EAAE,EAC9BC,GAAWK,EAAAA,QAAO,aAAa,EAC/BJ,CAAA,EAGF,OAAIN,EAEAW,EAAAA,IAACC,EAAAA,QAAA,CACC,KAAAb,EACA,UAAWS,EACX,UAAAP,EACA,YAAAC,EACA,mBAAAC,EACA,OAAAI,CAAA,CAAA,EAKJI,EAAAA,IAAC,OAAA,CAAK,UAAWH,EAAY,cAAaD,EACxC,SAAAI,EAAAA,IAAC,OAAA,CAAK,UAAWD,EAAAA,QAAO,YAAc,SAAAX,CAAA,CAAK,EAC7C,CAEJ,EAEAD,EAA6Be,OAAmBC,EAAAA,MAAMhB,EAAU,UAAU,CAAC"}
@@ -10,16 +10,16 @@ const C = ({
10
10
  copyLabel: c,
11
11
  copiedLabel: d,
12
12
  copiedAnnouncement: i,
13
- size: r,
14
- isMuted: n,
15
- className: l,
16
- testId: t
13
+ size: t,
14
+ isMuted: l,
15
+ className: n,
16
+ testId: r
17
17
  }) => {
18
18
  const s = f(
19
19
  e.code,
20
- r && e[`code--${r}`],
21
- n && e["code--muted"],
22
- l
20
+ t && e[`code--${t}`],
21
+ l && e["code--muted"],
22
+ n
23
23
  );
24
24
  return a ? /* @__PURE__ */ o(
25
25
  u,
@@ -29,11 +29,11 @@ const C = ({
29
29
  copyLabel: c,
30
30
  copiedLabel: d,
31
31
  copiedAnnouncement: i,
32
- testId: t
32
+ testId: r
33
33
  }
34
- ) : /* @__PURE__ */ o("code", { className: s, "data-testid": t, children: /* @__PURE__ */ o("span", { className: e.code__value, children: m }) });
35
- }, v = /* @__PURE__ */ p(/* @__PURE__ */ x(C, "CodeText"));
34
+ ) : /* @__PURE__ */ o("code", { className: s, "data-testid": r, children: /* @__PURE__ */ o("span", { className: e.code__value, children: m }) });
35
+ }, j = /* @__PURE__ */ p(/* @__PURE__ */ x(C, "CodeText"));
36
36
  export {
37
- v as default
37
+ j as default
38
38
  };
39
39
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/CodeText/index.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport CodeTextCopy from './CodeTextCopy';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n /** The part, OEM or order number, written as given (\"1K0 615 301 AA\"). */\n code: string;\n /** Adds a small copy button after the code (`labels.copyField` texts). */\n isCopyable?: boolean;\n /** The copy button's name; `labels.copyField.copy(code)` by default. */\n copyLabel?: string;\n /** Its name once copied; `labels.copyField.copied(code)` by default. */\n copiedLabel?: string;\n /** Announced after copying; `labels.copyField.announcement` by default. */\n copiedAnnouncement?: string;\n /** `sm` caption size, `md` small size; without it the code follows the text around it. */\n size?: 'sm' | 'md';\n /** Secondary text colour: an OEM number under a product's name. */\n isMuted?: boolean;\n className?: string;\n testId?: string;\n};\n\n/**\n * A calm inline code (3.4): a part or OEM number inside a sentence, a card or a table cell, in the\n * mono family with tabular figures, no surface — `CodeBadge` is the heavy, ink-filled one. One\n * click selects the whole code; `isCopyable` adds a copy button. Drawn on the server unless copyable.\n */\nconst CodeText = ({\n code,\n isCopyable,\n copyLabel,\n copiedLabel,\n copiedAnnouncement,\n size,\n isMuted,\n className,\n testId,\n}: Props) => {\n const classNames = cx(\n styles.code,\n size && styles[`code--${size}`],\n isMuted && styles['code--muted'],\n className,\n );\n\n if (isCopyable)\n return (\n <CodeTextCopy\n code={code}\n className={classNames}\n copyLabel={copyLabel}\n copiedLabel={copiedLabel}\n copiedAnnouncement={copiedAnnouncement}\n testId={testId}\n />\n );\n\n return (\n <code className={classNames} data-testid={testId}>\n <span className={styles.code__value}>{code}</span>\n </code>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(CodeText, 'CodeText')) as typeof CodeText;\n"],"names":["CodeText","code","isCopyable","copyLabel","copiedLabel","copiedAnnouncement","size","isMuted","className","testId","classNames","cx","styles","jsx","CodeTextCopy","index","memo","named"],"mappings":";;;;;;AAgCA,MAAMA,IAAW,CAAC;AAAA,EAChB,MAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AACF,MAAa;AACX,QAAMC,IAAaC;AAAA,IACjBC,EAAO;AAAA,IACPN,KAAQM,EAAO,SAASN,CAAI,EAAE;AAAA,IAC9BC,KAAWK,EAAO,aAAa;AAAA,IAC/BJ;AAAA,EAAA;AAGF,SAAIN,IAEA,gBAAAW;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAb;AAAA,MACA,WAAWS;AAAA,MACX,WAAAP;AAAA,MACA,aAAAC;AAAA,MACA,oBAAAC;AAAA,MACA,QAAAI;AAAA,IAAA;AAAA,EAAA,IAKJ,gBAAAI,EAAC,QAAA,EAAK,WAAWH,GAAY,eAAaD,GACxC,UAAA,gBAAAI,EAAC,QAAA,EAAK,WAAWD,EAAO,aAAc,UAAAX,EAAA,CAAK,GAC7C;AAEJ,GAEAc,IAA6B,gBAAAC,EAAmB,gBAAAC,EAAMjB,GAAU,UAAU,CAAC;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/CodeText/index.tsx"],"sourcesContent":["import { memo } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport CodeTextCopy from './CodeTextCopy';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n /** The part, OEM or order number, written as given (\"1K0 615 301 AA\"). */\n code: string;\n /** Adds a small copy button after the code (`labels.copyField` texts). */\n isCopyable?: boolean;\n /** The copy button's name; `labels.copyField.copy(code)` by default. */\n copyLabel?: string;\n /** Its name once copied; `labels.copyField.copied(code)` by default. */\n copiedLabel?: string;\n /** Announced after copying; `labels.copyField.announcement` by default. */\n copiedAnnouncement?: string;\n /** `sm` caption size, `md` small size; without it the code follows the text around it. */\n size?: 'sm' | 'md';\n /** Secondary text colour: an OEM number under a product's name. */\n isMuted?: boolean;\n className?: string;\n testId?: string;\n};\n\n/**\n * A calm inline code (3.4): a part or OEM number inside a sentence, a card or a table cell, in the\n * mono family with tabular figures, no surface — `CodeBadge` is the heavy, ink-filled one. One\n * click selects the whole code; `isCopyable` adds a copy button. Drawn on the server unless copyable.\n */\nconst CodeText = ({\n code,\n isCopyable,\n copyLabel,\n copiedLabel,\n copiedAnnouncement,\n size,\n isMuted,\n className,\n testId,\n}: Props) => {\n const classNames = cx(\n styles.code,\n size && styles[`code--${size}`],\n isMuted && styles['code--muted'],\n className,\n );\n\n if (isCopyable)\n return (\n <CodeTextCopy\n code={code}\n className={classNames}\n copyLabel={copyLabel}\n copiedLabel={copiedLabel}\n copiedAnnouncement={copiedAnnouncement}\n testId={testId}\n />\n );\n\n return (\n <code className={classNames} data-testid={testId}>\n <span className={styles.code__value}>{code}</span>\n </code>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(CodeText, 'CodeText')) as typeof CodeText;\n"],"names":["CodeText","code","isCopyable","copyLabel","copiedLabel","copiedAnnouncement","size","isMuted","className","testId","classNames","cx","styles","jsx","CodeTextCopy","CodeText$1","memo","named"],"mappings":";;;;;;AAgCA,MAAMA,IAAW,CAAC;AAAA,EAChB,MAAAC;AAAA,EACA,YAAAC;AAAA,EACA,WAAAC;AAAA,EACA,aAAAC;AAAA,EACA,oBAAAC;AAAA,EACA,MAAAC;AAAA,EACA,SAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AACF,MAAa;AACX,QAAMC,IAAaC;AAAA,IACjBC,EAAO;AAAA,IACPN,KAAQM,EAAO,SAASN,CAAI,EAAE;AAAA,IAC9BC,KAAWK,EAAO,aAAa;AAAA,IAC/BJ;AAAA,EAAA;AAGF,SAAIN,IAEA,gBAAAW;AAAA,IAACC;AAAA,IAAA;AAAA,MACC,MAAAb;AAAA,MACA,WAAWS;AAAA,MACX,WAAAP;AAAA,MACA,aAAAC;AAAA,MACA,oBAAAC;AAAA,MACA,QAAAI;AAAA,IAAA;AAAA,EAAA,IAKJ,gBAAAI,EAAC,QAAA,EAAK,WAAWH,GAAY,eAAaD,GACxC,UAAA,gBAAAI,EAAC,QAAA,EAAK,WAAWD,EAAO,aAAc,UAAAX,EAAA,CAAK,GAC7C;AAEJ,GAEAc,IAA6B,gBAAAC,EAAmB,gBAAAC,EAAMjB,GAAU,UAAU,CAAC;"}
@@ -1,2 +1,2 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),l=require("react"),m=require("../../helpers/class-name.helper.cjs"),g=require("../../helpers/component.helper.cjs"),x=require("../../helpers/text.helper.cjs"),t={default:{"heading":"ui-heading-Jzj8r","heading--xl":"ui-heading--xl-cET5u","heading--lg":"ui-heading--lg-C2PYU","heading--md":"ui-heading--md-SW2DJ","heading--sm":"ui-heading--sm-sYxwY","heading--xs":"ui-heading--xs-wXibD","heading--clamp-1":"ui-heading--clamp-1-9XGfX","heading--clamp-2":"ui-heading--clamp-2-KqnI5","heading--clamp-3":"ui-heading--clamp-3-rdti-"}},_={1:"xl",2:"md",3:"sm",4:"xs",5:"xs",6:"xs"},p=({children:s,level:r=2,size:n,maxLines:e,title:a,id:o,className:d,testId:i})=>{const u=`h${r}`;return c.jsx(u,{id:o,className:m.cx(t.default.heading,t.default[`heading--${n??_[r]}`],e!==void 0&&t.default[`heading--clamp-${e}`],d),title:e===void 0?a:x.clampTitle(s,a),"data-testid":i,children:s})},h=l.memo(g.named(p,"Heading"));exports.default=h;
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("react/jsx-runtime"),l=require("react"),m=require("../../helpers/class-name.helper.cjs"),g=require("../../helpers/component.helper.cjs"),_=require("../../helpers/text.helper.cjs"),t={default:{"heading":"ui-heading-Jzj8r","heading--xl":"ui-heading--xl-cET5u","heading--lg":"ui-heading--lg-C2PYU","heading--md":"ui-heading--md-SW2DJ","heading--sm":"ui-heading--sm-sYxwY","heading--xs":"ui-heading--xs-wXibD","heading--clamp-1":"ui-heading--clamp-1-9XGfX","heading--clamp-2":"ui-heading--clamp-2-KqnI5","heading--clamp-3":"ui-heading--clamp-3-rdti-"}},p={1:"xl",2:"md",3:"sm",4:"xs",5:"xs",6:"xs"},x=({children:s,level:a=2,size:n,maxLines:e,title:r,id:o,className:d,testId:i})=>{const u=`h${a}`;return c.jsx(u,{id:o,className:m.cx(t.default.heading,t.default[`heading--${n??p[a]}`],e!==void 0&&t.default[`heading--clamp-${e}`],d),title:e===void 0?r:_.clampTitle(s,r),"data-testid":i,children:s})},h=l.memo(g.named(x,"Heading"));exports.default=h;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/Heading/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { clampTitle } from '../../helpers/text.helper';\n\nimport styles from './index.module.scss';\n\n/** The semantic level: `<h1>` … `<h6>`. */\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * The visual size, independent of the level: `xl` 32px (the page title), `lg` 28px (a product\n * title), `md` 22px (a section), `sm` 18px (a sub-section), `xs` 15px (a block inside a surface).\n */\nexport type HeadingSize = 'xl' | 'lg' | 'md' | 'sm' | 'xs';\n\ntype Props = {\n children: ReactNode;\n /** The element: `1` is `<h1>`. One visible `<h1>` per page. Default `2`. */\n level?: HeadingLevel;\n /** The look; follows the level by default (1 `xl` · 2 `md` · 3 `sm` · 4–6 `xs`). */\n size?: HeadingSize;\n /**\n * Cut after this many lines with an ellipsis; a string title is shown in full in `title`.\n * Titles of cards and rows use `2`.\n */\n maxLines?: 1 | 2 | 3;\n /** The full text for the tooltip when `children` is not a string. */\n title?: string;\n id?: string;\n className?: string;\n testId?: string;\n};\n\nconst SIZE_OF_LEVEL: Record<HeadingLevel, HeadingSize> = {\n 1: 'xl',\n 2: 'md',\n 3: 'sm',\n 4: 'xs',\n 5: 'xs',\n 6: 'xs',\n};\n\n/**\n * Heading (3.7) — a heading whose look is chosen apart from its level: a product title is an\n * `<h1>` drawn at 28px, a card title an `<h3>` at 15px. Archivo 600 at its normal width, from\n * the design's `title-*` roles; a page never writes a raw `<h1>`–`<h6>` with its own size.\n * @example <Heading level={1} size=\"lg\" maxLines={2}>Ön far (sol)</Heading>\n */\nconst Heading: FC<Props> = ({\n children,\n level = 2,\n size,\n maxLines,\n title,\n id,\n className,\n testId,\n}) => {\n const Tag = `h${level}` as const;\n\n return (\n <Tag\n id={id}\n className={cx(\n styles.heading,\n styles[`heading--${size ?? SIZE_OF_LEVEL[level]}`],\n maxLines !== undefined && styles[`heading--clamp-${maxLines}`],\n className,\n )}\n title={maxLines === undefined ? title : clampTitle(children, title)}\n data-testid={testId}\n >\n {children}\n </Tag>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Heading, 'Heading')) as typeof Heading;\n"],"names":["SIZE_OF_LEVEL","Heading","children","level","size","maxLines","title","id","className","testId","Tag","jsx","cx","styles","clampTitle","index","memo","named"],"mappings":"qVAmCMA,EAAmD,CACvD,EAAG,KACH,EAAG,KACH,EAAG,KACH,EAAG,KACH,EAAG,KACH,EAAG,IACL,EAQMC,EAAqB,CAAC,CAC1B,SAAAC,EACA,MAAAC,EAAQ,EACR,KAAAC,EACA,SAAAC,EACA,MAAAC,EACA,GAAAC,EACA,UAAAC,EACA,OAAAC,CACF,IAAM,CACJ,MAAMC,EAAM,IAAIP,CAAK,GAErB,OACEQ,EAAAA,IAACD,EAAA,CACC,GAAAH,EACA,UAAWK,EAAAA,GACTC,EAAAA,QAAO,QACPA,EAAAA,QAAO,YAAYT,GAAQJ,EAAcG,CAAK,CAAC,EAAE,EACjDE,IAAa,QAAaQ,EAAAA,QAAO,kBAAkBR,CAAQ,EAAE,EAC7DG,CAAA,EAEF,MAAOH,IAAa,OAAYC,EAAQQ,EAAAA,WAAWZ,EAAUI,CAAK,EAClE,cAAaG,EAEZ,SAAAP,CAAA,CAAA,CAGP,EAEAa,EAA6BC,OAAmBC,EAAAA,MAAMhB,EAAS,SAAS,CAAC"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/Heading/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { clampTitle } from '../../helpers/text.helper';\n\nimport styles from './index.module.scss';\n\n/** The semantic level: `<h1>` … `<h6>`. */\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * The visual size, independent of the level: `xl` 32px (the page title), `lg` 28px (a product\n * title), `md` 22px (a section), `sm` 18px (a sub-section), `xs` 15px (a block inside a surface).\n */\nexport type HeadingSize = 'xl' | 'lg' | 'md' | 'sm' | 'xs';\n\ntype Props = {\n children: ReactNode;\n /** The element: `1` is `<h1>`. One visible `<h1>` per page. Default `2`. */\n level?: HeadingLevel;\n /** The look; follows the level by default (1 `xl` · 2 `md` · 3 `sm` · 4–6 `xs`). */\n size?: HeadingSize;\n /**\n * Cut after this many lines with an ellipsis; a string title is shown in full in `title`.\n * Titles of cards and rows use `2`.\n */\n maxLines?: 1 | 2 | 3;\n /** The full text for the tooltip when `children` is not a string. */\n title?: string;\n id?: string;\n className?: string;\n testId?: string;\n};\n\nconst SIZE_OF_LEVEL: Record<HeadingLevel, HeadingSize> = {\n 1: 'xl',\n 2: 'md',\n 3: 'sm',\n 4: 'xs',\n 5: 'xs',\n 6: 'xs',\n};\n\n/**\n * Heading (3.7) — a heading whose look is chosen apart from its level: a product title is an\n * `<h1>` drawn at 28px, a card title an `<h3>` at 15px. Archivo 600 at its normal width, from\n * the design's `title-*` roles; a page never writes a raw `<h1>`–`<h6>` with its own size.\n * @example <Heading level={1} size=\"lg\" maxLines={2}>Ön far (sol)</Heading>\n */\nconst Heading: FC<Props> = ({\n children,\n level = 2,\n size,\n maxLines,\n title,\n id,\n className,\n testId,\n}) => {\n const Tag = `h${level}` as const;\n\n return (\n <Tag\n id={id}\n className={cx(\n styles.heading,\n styles[`heading--${size ?? SIZE_OF_LEVEL[level]}`],\n maxLines !== undefined && styles[`heading--clamp-${maxLines}`],\n className,\n )}\n title={maxLines === undefined ? title : clampTitle(children, title)}\n data-testid={testId}\n >\n {children}\n </Tag>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Heading, 'Heading')) as typeof Heading;\n"],"names":["SIZE_OF_LEVEL","Heading","children","level","size","maxLines","title","id","className","testId","Tag","jsx","cx","styles","clampTitle","memo","named"],"mappings":"qVAmCMA,EAAmD,CACvD,EAAG,KACH,EAAG,KACH,EAAG,KACH,EAAG,KACH,EAAG,KACH,EAAG,IACL,EAQMC,EAAqB,CAAC,CAC1B,SAAAC,EACA,MAAAC,EAAQ,EACR,KAAAC,EACA,SAAAC,EACA,MAAAC,EACA,GAAAC,EACA,UAAAC,EACA,OAAAC,CACF,IAAM,CACJ,MAAMC,EAAM,IAAIP,CAAK,GAErB,OACEQ,EAAAA,IAACD,EAAA,CACC,GAAAH,EACA,UAAWK,EAAAA,GACTC,EAAAA,QAAO,QACPA,EAAAA,QAAO,YAAYT,GAAQJ,EAAcG,CAAK,CAAC,EAAE,EACjDE,IAAa,QAAaQ,EAAAA,QAAO,kBAAkBR,CAAQ,EAAE,EAC7DG,CAAA,EAEF,MAAOH,IAAa,OAAYC,EAAQQ,EAAAA,WAAWZ,EAAUI,CAAK,EAClE,cAAaG,EAEZ,SAAAP,CAAA,CAAA,CAGP,EAEAD,EAA6Bc,OAAmBC,EAAAA,MAAMf,EAAS,SAAS,CAAC"}
@@ -11,33 +11,33 @@ const l = {
11
11
  4: "xs",
12
12
  5: "xs",
13
13
  6: "xs"
14
- }, h = ({
14
+ }, $ = ({
15
15
  children: t,
16
- level: r = 2,
16
+ level: a = 2,
17
17
  size: i,
18
18
  maxLines: o,
19
- title: a,
19
+ title: r,
20
20
  id: s,
21
21
  className: d,
22
22
  testId: e
23
23
  }) => {
24
- const n = `h${r}`;
24
+ const n = `h${a}`;
25
25
  return /* @__PURE__ */ p(
26
26
  n,
27
27
  {
28
28
  id: s,
29
29
  className: f(
30
30
  m.heading,
31
- m[`heading--${i ?? l[r]}`],
31
+ m[`heading--${i ?? l[a]}`],
32
32
  o !== void 0 && m[`heading--clamp-${o}`],
33
33
  d
34
34
  ),
35
- title: o === void 0 ? a : x(t, a),
35
+ title: o === void 0 ? r : x(t, r),
36
36
  "data-testid": e,
37
37
  children: t
38
38
  }
39
39
  );
40
- }, j = /* @__PURE__ */ c(/* @__PURE__ */ g(h, "Heading"));
40
+ }, j = /* @__PURE__ */ c(/* @__PURE__ */ g($, "Heading"));
41
41
  export {
42
42
  j as default
43
43
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/Heading/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { clampTitle } from '../../helpers/text.helper';\n\nimport styles from './index.module.scss';\n\n/** The semantic level: `<h1>` … `<h6>`. */\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * The visual size, independent of the level: `xl` 32px (the page title), `lg` 28px (a product\n * title), `md` 22px (a section), `sm` 18px (a sub-section), `xs` 15px (a block inside a surface).\n */\nexport type HeadingSize = 'xl' | 'lg' | 'md' | 'sm' | 'xs';\n\ntype Props = {\n children: ReactNode;\n /** The element: `1` is `<h1>`. One visible `<h1>` per page. Default `2`. */\n level?: HeadingLevel;\n /** The look; follows the level by default (1 `xl` · 2 `md` · 3 `sm` · 4–6 `xs`). */\n size?: HeadingSize;\n /**\n * Cut after this many lines with an ellipsis; a string title is shown in full in `title`.\n * Titles of cards and rows use `2`.\n */\n maxLines?: 1 | 2 | 3;\n /** The full text for the tooltip when `children` is not a string. */\n title?: string;\n id?: string;\n className?: string;\n testId?: string;\n};\n\nconst SIZE_OF_LEVEL: Record<HeadingLevel, HeadingSize> = {\n 1: 'xl',\n 2: 'md',\n 3: 'sm',\n 4: 'xs',\n 5: 'xs',\n 6: 'xs',\n};\n\n/**\n * Heading (3.7) — a heading whose look is chosen apart from its level: a product title is an\n * `<h1>` drawn at 28px, a card title an `<h3>` at 15px. Archivo 600 at its normal width, from\n * the design's `title-*` roles; a page never writes a raw `<h1>`–`<h6>` with its own size.\n * @example <Heading level={1} size=\"lg\" maxLines={2}>Ön far (sol)</Heading>\n */\nconst Heading: FC<Props> = ({\n children,\n level = 2,\n size,\n maxLines,\n title,\n id,\n className,\n testId,\n}) => {\n const Tag = `h${level}` as const;\n\n return (\n <Tag\n id={id}\n className={cx(\n styles.heading,\n styles[`heading--${size ?? SIZE_OF_LEVEL[level]}`],\n maxLines !== undefined && styles[`heading--clamp-${maxLines}`],\n className,\n )}\n title={maxLines === undefined ? title : clampTitle(children, title)}\n data-testid={testId}\n >\n {children}\n </Tag>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Heading, 'Heading')) as typeof Heading;\n"],"names":["SIZE_OF_LEVEL","Heading","children","level","size","maxLines","title","id","className","testId","Tag","jsx","cx","styles","clampTitle","index","memo","named"],"mappings":";;;;;;AAmCA,MAAMA,IAAmD;AAAA,EACvD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL,GAQMC,IAAqB,CAAC;AAAA,EAC1B,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AACF,MAAM;AACJ,QAAMC,IAAM,IAAIP,CAAK;AAErB,SACE,gBAAAQ;AAAA,IAACD;AAAA,IAAA;AAAA,MACC,IAAAH;AAAA,MACA,WAAWK;AAAA,QACTC,EAAO;AAAA,QACPA,EAAO,YAAYT,KAAQJ,EAAcG,CAAK,CAAC,EAAE;AAAA,QACjDE,MAAa,UAAaQ,EAAO,kBAAkBR,CAAQ,EAAE;AAAA,QAC7DG;AAAA,MAAA;AAAA,MAEF,OAAOH,MAAa,SAAYC,IAAQQ,EAAWZ,GAAUI,CAAK;AAAA,MAClE,eAAaG;AAAA,MAEZ,UAAAP;AAAA,IAAA;AAAA,EAAA;AAGP,GAEAa,IAA6B,gBAAAC,EAAmB,gBAAAC,EAAMhB,GAAS,SAAS,CAAC;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/Heading/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { clampTitle } from '../../helpers/text.helper';\n\nimport styles from './index.module.scss';\n\n/** The semantic level: `<h1>` … `<h6>`. */\nexport type HeadingLevel = 1 | 2 | 3 | 4 | 5 | 6;\n\n/**\n * The visual size, independent of the level: `xl` 32px (the page title), `lg` 28px (a product\n * title), `md` 22px (a section), `sm` 18px (a sub-section), `xs` 15px (a block inside a surface).\n */\nexport type HeadingSize = 'xl' | 'lg' | 'md' | 'sm' | 'xs';\n\ntype Props = {\n children: ReactNode;\n /** The element: `1` is `<h1>`. One visible `<h1>` per page. Default `2`. */\n level?: HeadingLevel;\n /** The look; follows the level by default (1 `xl` · 2 `md` · 3 `sm` · 4–6 `xs`). */\n size?: HeadingSize;\n /**\n * Cut after this many lines with an ellipsis; a string title is shown in full in `title`.\n * Titles of cards and rows use `2`.\n */\n maxLines?: 1 | 2 | 3;\n /** The full text for the tooltip when `children` is not a string. */\n title?: string;\n id?: string;\n className?: string;\n testId?: string;\n};\n\nconst SIZE_OF_LEVEL: Record<HeadingLevel, HeadingSize> = {\n 1: 'xl',\n 2: 'md',\n 3: 'sm',\n 4: 'xs',\n 5: 'xs',\n 6: 'xs',\n};\n\n/**\n * Heading (3.7) — a heading whose look is chosen apart from its level: a product title is an\n * `<h1>` drawn at 28px, a card title an `<h3>` at 15px. Archivo 600 at its normal width, from\n * the design's `title-*` roles; a page never writes a raw `<h1>`–`<h6>` with its own size.\n * @example <Heading level={1} size=\"lg\" maxLines={2}>Ön far (sol)</Heading>\n */\nconst Heading: FC<Props> = ({\n children,\n level = 2,\n size,\n maxLines,\n title,\n id,\n className,\n testId,\n}) => {\n const Tag = `h${level}` as const;\n\n return (\n <Tag\n id={id}\n className={cx(\n styles.heading,\n styles[`heading--${size ?? SIZE_OF_LEVEL[level]}`],\n maxLines !== undefined && styles[`heading--clamp-${maxLines}`],\n className,\n )}\n title={maxLines === undefined ? title : clampTitle(children, title)}\n data-testid={testId}\n >\n {children}\n </Tag>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Heading, 'Heading')) as typeof Heading;\n"],"names":["SIZE_OF_LEVEL","Heading","children","level","size","maxLines","title","id","className","testId","Tag","jsx","cx","styles","clampTitle","Heading$1","memo","named"],"mappings":";;;;;;AAmCA,MAAMA,IAAmD;AAAA,EACvD,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AAAA,EACH,GAAG;AACL,GAQMC,IAAqB,CAAC;AAAA,EAC1B,UAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AACF,MAAM;AACJ,QAAMC,IAAM,IAAIP,CAAK;AAErB,SACE,gBAAAQ;AAAA,IAACD;AAAA,IAAA;AAAA,MACC,IAAAH;AAAA,MACA,WAAWK;AAAA,QACTC,EAAO;AAAA,QACPA,EAAO,YAAYT,KAAQJ,EAAcG,CAAK,CAAC,EAAE;AAAA,QACjDE,MAAa,UAAaQ,EAAO,kBAAkBR,CAAQ,EAAE;AAAA,QAC7DG;AAAA,MAAA;AAAA,MAEF,OAAOH,MAAa,SAAYC,IAAQQ,EAAWZ,GAAUI,CAAK;AAAA,MAClE,eAAaG;AAAA,MAEZ,UAAAP;AAAA,IAAA;AAAA,EAAA;AAGP,GAEAa,IAA6B,gBAAAC,EAAmB,gBAAAC,EAAMhB,GAAS,SAAS,CAAC;"}
@@ -0,0 +1,2 @@
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),o=require("react"),h=require("../../helpers/class-name.helper.cjs"),m=require("../../helpers/component.helper.cjs"),x=require("../../helpers/label.helper.cjs"),_=require("../../theme/context.cjs"),b=require("../CodeText/index.cjs"),s={default:{"list":"ui-list-11FlO","list__type":"ui-list__type-KKVWQ","list__brand":"ui-list__brand-Z7-n1","list__number":"ui-list__number-kF8I2","srOnly":"ui-srOnly-tjFuj"}},j=({items:c,caption:d,labels:r,className:i,testId:u})=>{const{labels:n}=_.useUi();if(c.length===0)return null;const l=t=>{var a;return x.resolveLabel(`PartNumberList.labels.${t}`,r==null?void 0:r[t],(a=n==null?void 0:n.product)==null?void 0:a[t])};return e.jsxs("table",{className:h.cx(s.default.list,i),"data-testid":u,children:[e.jsx("caption",{className:s.default.srOnly,children:d}),e.jsx("thead",{children:e.jsxs("tr",{children:[e.jsx("th",{scope:"col",className:s.default.list__type,children:l("numberType")}),e.jsx("th",{scope:"col",className:s.default.list__brand,children:l("brand")}),e.jsx("th",{scope:"col",children:l("number")})]})}),e.jsx("tbody",{children:c.map(t=>e.jsxs("tr",{children:[e.jsx("td",{className:s.default.list__type,children:t.type}),e.jsx("td",{className:s.default.list__brand,children:t.brand}),e.jsx("td",{className:s.default.list__number,children:e.jsx(b.default,{code:t.number,isCopyable:!0,size:"md"})})]},t.id))})]})},p=o.memo(m.named(j,"PartNumberList"));exports.default=p;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/PartNumberList/index.tsx"],"sourcesContent":["'use client';\n\nimport { memo } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\nimport CodeText from '../CodeText';\n\nimport styles from './index.module.scss';\n\n/** One cross-reference: \"OEM\" · \"IVECO\" · \"428959612\". */\nexport type PartNumberItem = {\n id: string;\n /** The kind of number (\"OEM\", \"Muadil\", \"Üretici\"). */\n type: string;\n brand: string;\n number: string;\n};\n\ntype Props = {\n items: readonly PartNumberItem[];\n /** The table's name (\"Parça numaraları\"), read by a screen reader. */\n caption: string;\n /** Headings instead of `labels.product` (`numberType`, `brand`, `number`). */\n labels?: Partial<{ numberType: string; brand: string; number: string }>;\n className?: string;\n testId?: string;\n};\n\n/**\n * PartNumberList (3.8) — the part numbers of a product in a table: kind · brand · number, the number\n * in mono with a copy button. The kind is plain text (no \"——\" prefix, no ink pill): the three\n * columns line up down the list, so OEM and equivalent numbers are told apart by reading.\n * @example <PartNumberList caption=\"Parça numaraları\" items={[{ id: '1', type: 'OEM', brand: 'IVECO', number: '428959612' }]} />\n */\nconst PartNumberList = ({ items, caption, labels: labelProps, className, testId }: Props) => {\n const { labels } = useUi();\n if (items.length === 0) return null;\n\n const heading = (field: 'numberType' | 'brand' | 'number') =>\n resolveLabel(`PartNumberList.labels.${field}`, labelProps?.[field], labels?.product?.[field]);\n\n return (\n <table className={cx(styles.list, className)} data-testid={testId}>\n <caption className={styles.srOnly}>{caption}</caption>\n <thead>\n <tr>\n <th scope=\"col\" className={styles.list__type}>\n {heading('numberType')}\n </th>\n <th scope=\"col\" className={styles.list__brand}>\n {heading('brand')}\n </th>\n <th scope=\"col\">{heading('number')}</th>\n </tr>\n </thead>\n <tbody>\n {items.map(item => (\n <tr key={item.id}>\n <td className={styles.list__type}>{item.type}</td>\n <td className={styles.list__brand}>{item.brand}</td>\n <td className={styles.list__number}>\n <CodeText code={item.number} isCopyable size=\"md\" />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(PartNumberList, 'PartNumberList'),\n) as typeof PartNumberList;\n"],"names":["PartNumberList","items","caption","labelProps","className","testId","labels","useUi","heading","field","resolveLabel","_a","jsxs","cx","styles","jsx","item","CodeText","index","memo","named"],"mappings":"2aAoCMA,EAAiB,CAAC,CAAE,MAAAC,EAAO,QAAAC,EAAS,OAAQC,EAAY,UAAAC,EAAW,OAAAC,KAAoB,CAC3F,KAAM,CAAE,OAAAC,CAAA,EAAWC,QAAA,EACnB,GAAIN,EAAM,SAAW,EAAG,OAAO,KAE/B,MAAMO,EAAWC,GAAA,OACfC,OAAAA,EAAAA,aAAa,yBAAyBD,CAAK,GAAIN,GAAA,YAAAA,EAAaM,IAAQE,EAAAL,GAAA,YAAAA,EAAQ,UAAR,YAAAK,EAAkBF,EAAM,GAE9F,OACEG,OAAC,SAAM,UAAWC,EAAAA,GAAGC,EAAAA,QAAO,KAAMV,CAAS,EAAG,cAAaC,EACzD,SAAA,CAAAU,EAAAA,IAAC,UAAA,CAAQ,UAAWD,EAAAA,QAAO,OAAS,SAAAZ,EAAQ,EAC5Ca,EAAAA,IAAC,QAAA,CACC,SAAAH,EAAAA,KAAC,KAAA,CACC,SAAA,CAAAG,EAAAA,IAAC,KAAA,CAAG,MAAM,MAAM,UAAWD,UAAO,WAC/B,SAAAN,EAAQ,YAAY,CAAA,CACvB,EACAO,EAAAA,IAAC,MAAG,MAAM,MAAM,UAAWD,UAAO,YAC/B,SAAAN,EAAQ,OAAO,CAAA,CAClB,QACC,KAAA,CAAG,MAAM,MAAO,SAAAA,EAAQ,QAAQ,CAAA,CAAE,CAAA,CAAA,CACrC,CAAA,CACF,QACC,QAAA,CACE,SAAAP,EAAM,IAAIe,UACR,KAAA,CACC,SAAA,CAAAD,MAAC,KAAA,CAAG,UAAWD,EAAAA,QAAO,WAAa,WAAK,KAAK,QAC5C,KAAA,CAAG,UAAWA,EAAAA,QAAO,YAAc,WAAK,MAAM,EAC/CC,EAAAA,IAAC,KAAA,CAAG,UAAWD,EAAAA,QAAO,aACpB,SAAAC,MAACE,EAAAA,QAAA,CAAS,KAAMD,EAAK,OAAQ,WAAU,GAAC,KAAK,KAAK,CAAA,CACpD,CAAA,GALOA,EAAK,EAMd,CACD,CAAA,CACH,CAAA,EACF,CAEJ,EAEAE,EAA6BC,EAAAA,KACbC,EAAAA,MAAMpB,EAAgB,gBAAgB,CACtD"}
@@ -0,0 +1,30 @@
1
+ /** One cross-reference: "OEM" · "IVECO" · "428959612". */
2
+ export type PartNumberItem = {
3
+ id: string;
4
+ /** The kind of number ("OEM", "Muadil", "Üretici"). */
5
+ type: string;
6
+ brand: string;
7
+ number: string;
8
+ };
9
+ type Props = {
10
+ items: readonly PartNumberItem[];
11
+ /** The table's name ("Parça numaraları"), read by a screen reader. */
12
+ caption: string;
13
+ /** Headings instead of `labels.product` (`numberType`, `brand`, `number`). */
14
+ labels?: Partial<{
15
+ numberType: string;
16
+ brand: string;
17
+ number: string;
18
+ }>;
19
+ className?: string;
20
+ testId?: string;
21
+ };
22
+ /**
23
+ * PartNumberList (3.8) — the part numbers of a product in a table: kind · brand · number, the number
24
+ * in mono with a copy button. The kind is plain text (no "——" prefix, no ink pill): the three
25
+ * columns line up down the list, so OEM and equivalent numbers are told apart by reading.
26
+ * @example <PartNumberList caption="Parça numaraları" items={[{ id: '1', type: 'OEM', brand: 'IVECO', number: '428959612' }]} />
27
+ */
28
+ declare const PartNumberList: ({ items, caption, labels: labelProps, className, testId }: Props) => import("react").JSX.Element | null;
29
+ declare const _default: typeof PartNumberList;
30
+ export default _default;
@@ -0,0 +1,30 @@
1
+ /** One cross-reference: "OEM" · "IVECO" · "428959612". */
2
+ export type PartNumberItem = {
3
+ id: string;
4
+ /** The kind of number ("OEM", "Muadil", "Üretici"). */
5
+ type: string;
6
+ brand: string;
7
+ number: string;
8
+ };
9
+ type Props = {
10
+ items: readonly PartNumberItem[];
11
+ /** The table's name ("Parça numaraları"), read by a screen reader. */
12
+ caption: string;
13
+ /** Headings instead of `labels.product` (`numberType`, `brand`, `number`). */
14
+ labels?: Partial<{
15
+ numberType: string;
16
+ brand: string;
17
+ number: string;
18
+ }>;
19
+ className?: string;
20
+ testId?: string;
21
+ };
22
+ /**
23
+ * PartNumberList (3.8) — the part numbers of a product in a table: kind · brand · number, the number
24
+ * in mono with a copy button. The kind is plain text (no "——" prefix, no ink pill): the three
25
+ * columns line up down the list, so OEM and equivalent numbers are told apart by reading.
26
+ * @example <PartNumberList caption="Parça numaraları" items={[{ id: '1', type: 'OEM', brand: 'IVECO', number: '428959612' }]} />
27
+ */
28
+ declare const PartNumberList: ({ items, caption, labels: labelProps, className, testId }: Props) => import("react").JSX.Element | null;
29
+ declare const _default: typeof PartNumberList;
30
+ export default _default;
@@ -0,0 +1,36 @@
1
+ "use client";
2
+ import { jsxs as i, jsx as e } from "react/jsx-runtime";
3
+ import { memo as h } from "react";
4
+ import { cx as p } from "../../helpers/class-name.helper.js";
5
+ import { named as u } from "../../helpers/component.helper.js";
6
+ import { resolveLabel as b } from "../../helpers/label.helper.js";
7
+ import { useUi as N } from "../../theme/context.js";
8
+ import _ from "../CodeText/index.js";
9
+ const t = {"list":"ui-list-11FlO","list__type":"ui-list__type-KKVWQ","list__brand":"ui-list__brand-Z7-n1","list__number":"ui-list__number-kF8I2","srOnly":"ui-srOnly-tjFuj"};
10
+ const f = ({ items: l, caption: o, labels: s, className: a, testId: d }) => {
11
+ const { labels: c } = N();
12
+ if (l.length === 0) return null;
13
+ const n = (r) => {
14
+ var m;
15
+ return b(`PartNumberList.labels.${r}`, s == null ? void 0 : s[r], (m = c == null ? void 0 : c.product) == null ? void 0 : m[r]);
16
+ };
17
+ return /* @__PURE__ */ i("table", { className: p(t.list, a), "data-testid": d, children: [
18
+ /* @__PURE__ */ e("caption", { className: t.srOnly, children: o }),
19
+ /* @__PURE__ */ e("thead", { children: /* @__PURE__ */ i("tr", { children: [
20
+ /* @__PURE__ */ e("th", { scope: "col", className: t.list__type, children: n("numberType") }),
21
+ /* @__PURE__ */ e("th", { scope: "col", className: t.list__brand, children: n("brand") }),
22
+ /* @__PURE__ */ e("th", { scope: "col", children: n("number") })
23
+ ] }) }),
24
+ /* @__PURE__ */ e("tbody", { children: l.map((r) => /* @__PURE__ */ i("tr", { children: [
25
+ /* @__PURE__ */ e("td", { className: t.list__type, children: r.type }),
26
+ /* @__PURE__ */ e("td", { className: t.list__brand, children: r.brand }),
27
+ /* @__PURE__ */ e("td", { className: t.list__number, children: /* @__PURE__ */ e(_, { code: r.number, isCopyable: !0, size: "md" }) })
28
+ ] }, r.id)) })
29
+ ] });
30
+ }, z = /* @__PURE__ */ h(
31
+ /* @__PURE__ */ u(f, "PartNumberList")
32
+ );
33
+ export {
34
+ z as default
35
+ };
36
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/PartNumberList/index.tsx"],"sourcesContent":["'use client';\n\nimport { memo } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\nimport CodeText from '../CodeText';\n\nimport styles from './index.module.scss';\n\n/** One cross-reference: \"OEM\" · \"IVECO\" · \"428959612\". */\nexport type PartNumberItem = {\n id: string;\n /** The kind of number (\"OEM\", \"Muadil\", \"Üretici\"). */\n type: string;\n brand: string;\n number: string;\n};\n\ntype Props = {\n items: readonly PartNumberItem[];\n /** The table's name (\"Parça numaraları\"), read by a screen reader. */\n caption: string;\n /** Headings instead of `labels.product` (`numberType`, `brand`, `number`). */\n labels?: Partial<{ numberType: string; brand: string; number: string }>;\n className?: string;\n testId?: string;\n};\n\n/**\n * PartNumberList (3.8) — the part numbers of a product in a table: kind · brand · number, the number\n * in mono with a copy button. The kind is plain text (no \"——\" prefix, no ink pill): the three\n * columns line up down the list, so OEM and equivalent numbers are told apart by reading.\n * @example <PartNumberList caption=\"Parça numaraları\" items={[{ id: '1', type: 'OEM', brand: 'IVECO', number: '428959612' }]} />\n */\nconst PartNumberList = ({ items, caption, labels: labelProps, className, testId }: Props) => {\n const { labels } = useUi();\n if (items.length === 0) return null;\n\n const heading = (field: 'numberType' | 'brand' | 'number') =>\n resolveLabel(`PartNumberList.labels.${field}`, labelProps?.[field], labels?.product?.[field]);\n\n return (\n <table className={cx(styles.list, className)} data-testid={testId}>\n <caption className={styles.srOnly}>{caption}</caption>\n <thead>\n <tr>\n <th scope=\"col\" className={styles.list__type}>\n {heading('numberType')}\n </th>\n <th scope=\"col\" className={styles.list__brand}>\n {heading('brand')}\n </th>\n <th scope=\"col\">{heading('number')}</th>\n </tr>\n </thead>\n <tbody>\n {items.map(item => (\n <tr key={item.id}>\n <td className={styles.list__type}>{item.type}</td>\n <td className={styles.list__brand}>{item.brand}</td>\n <td className={styles.list__number}>\n <CodeText code={item.number} isCopyable size=\"md\" />\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(PartNumberList, 'PartNumberList'),\n) as typeof PartNumberList;\n"],"names":["PartNumberList","items","caption","labelProps","className","testId","labels","useUi","heading","field","resolveLabel","_a","jsxs","cx","styles","jsx","item","CodeText","index","memo","named"],"mappings":";;;;;;;;;AAoCA,MAAMA,IAAiB,CAAC,EAAE,OAAAC,GAAO,SAAAC,GAAS,QAAQC,GAAY,WAAAC,GAAW,QAAAC,QAAoB;AAC3F,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAAA;AACnB,MAAIN,EAAM,WAAW,EAAG,QAAO;AAE/B,QAAMO,IAAU,CAACC,MAAA;;AACf,WAAAC,EAAa,yBAAyBD,CAAK,IAAIN,KAAA,gBAAAA,EAAaM,KAAQE,IAAAL,KAAA,gBAAAA,EAAQ,YAAR,gBAAAK,EAAkBF,EAAM;AAAA;AAE9F,SACE,gBAAAG,EAAC,WAAM,WAAWC,EAAGC,EAAO,MAAMV,CAAS,GAAG,eAAaC,GACzD,UAAA;AAAA,IAAA,gBAAAU,EAAC,WAAA,EAAQ,WAAWD,EAAO,QAAS,UAAAZ,GAAQ;AAAA,IAC5C,gBAAAa,EAAC,SAAA,EACC,UAAA,gBAAAH,EAAC,MAAA,EACC,UAAA;AAAA,MAAA,gBAAAG,EAAC,MAAA,EAAG,OAAM,OAAM,WAAWD,EAAO,YAC/B,UAAAN,EAAQ,YAAY,EAAA,CACvB;AAAA,MACA,gBAAAO,EAAC,QAAG,OAAM,OAAM,WAAWD,EAAO,aAC/B,UAAAN,EAAQ,OAAO,EAAA,CAClB;AAAA,wBACC,MAAA,EAAG,OAAM,OAAO,UAAAA,EAAQ,QAAQ,EAAA,CAAE;AAAA,IAAA,EAAA,CACrC,EAAA,CACF;AAAA,sBACC,SAAA,EACE,UAAAP,EAAM,IAAI,CAAAe,wBACR,MAAA,EACC,UAAA;AAAA,MAAA,gBAAAD,EAAC,MAAA,EAAG,WAAWD,EAAO,YAAa,YAAK,MAAK;AAAA,wBAC5C,MAAA,EAAG,WAAWA,EAAO,aAAc,YAAK,OAAM;AAAA,MAC/C,gBAAAC,EAAC,MAAA,EAAG,WAAWD,EAAO,cACpB,UAAA,gBAAAC,EAACE,GAAA,EAAS,MAAMD,EAAK,QAAQ,YAAU,IAAC,MAAK,MAAK,EAAA,CACpD;AAAA,IAAA,KALOA,EAAK,EAMd,CACD,EAAA,CACH;AAAA,EAAA,GACF;AAEJ,GAEAE,IAA6B,gBAAAC;AAAA,EACb,gBAAAC,EAAMpB,GAAgB,gBAAgB;AACtD;"}
@@ -0,0 +1 @@
1
+ @layer ui{.ui-list-11FlO{width:100%;border-collapse:collapse;font-size:var(--hd-type-small-size)}.ui-list-11FlO th,.ui-list-11FlO td{padding:var(--hd-space-2) var(--hd-space-3);border-block-end:1px solid var(--hd-border);text-align:start;vertical-align:middle}.ui-list-11FlO th:first-child,.ui-list-11FlO td:first-child{padding-inline-start:0}.ui-list-11FlO th{font-family:var(--ui-overline-font, var(--hd-font-body));font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-semibold);line-height:var(--hd-type-h4-line-height);letter-spacing:var(--ui-overline-tracking, normal);text-transform:var(--ui-overline-transform, none);color:var(--hd-text-2);font-size:var(--hd-type-caption-size);white-space:nowrap}.ui-list-11FlO tbody tr:last-child td{border-block-end:none}.ui-list__type-KKVWQ{width:1%;white-space:nowrap;color:var(--hd-text-2)}.ui-list__brand-Z7-n1{width:30%;color:var(--hd-text);overflow-wrap:anywhere}.ui-list__number-kF8I2{min-width:0}.ui-srOnly-tjFuj{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}}