@handijitcom/ui 3.7.0 → 3.8.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 (95) hide show
  1. package/README.md +83 -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/SpecTable/index.cjs +2 -0
  54. package/build/components/SpecTable/index.cjs.map +1 -0
  55. package/build/components/SpecTable/index.d.cts +25 -0
  56. package/build/components/SpecTable/index.d.ts +25 -0
  57. package/build/components/SpecTable/index.js +25 -0
  58. package/build/components/SpecTable/index.js.map +1 -0
  59. package/build/components/SpecTable/style.css +1 -0
  60. package/build/components/StatusCell/index.cjs +2 -0
  61. package/build/components/StatusCell/index.cjs.map +1 -0
  62. package/build/components/StatusCell/index.d.cts +28 -0
  63. package/build/components/StatusCell/index.d.ts +28 -0
  64. package/build/components/StatusCell/index.js +24 -0
  65. package/build/components/StatusCell/index.js.map +1 -0
  66. package/build/components/StatusCell/style.css +1 -0
  67. package/build/components/StockStatus/index.cjs +2 -0
  68. package/build/components/StockStatus/index.cjs.map +1 -0
  69. package/build/components/StockStatus/index.d.cts +28 -0
  70. package/build/components/StockStatus/index.d.ts +28 -0
  71. package/build/components/StockStatus/index.js +36 -0
  72. package/build/components/StockStatus/index.js.map +1 -0
  73. package/build/components/StockStatus/style.css +1 -0
  74. package/build/components/Tooltip/index.cjs +1 -1
  75. package/build/components/Tooltip/index.cjs.map +1 -1
  76. package/build/components/Tooltip/index.js +27 -27
  77. package/build/components/Tooltip/index.js.map +1 -1
  78. package/build/components/VehicleTypeList/index.cjs +2 -0
  79. package/build/components/VehicleTypeList/index.cjs.map +1 -0
  80. package/build/components/VehicleTypeList/index.d.cts +17 -0
  81. package/build/components/VehicleTypeList/index.d.ts +17 -0
  82. package/build/components/VehicleTypeList/index.js +47 -0
  83. package/build/components/VehicleTypeList/index.js.map +1 -0
  84. package/build/components/VehicleTypeList/style.css +1 -0
  85. package/build/index.cjs +1 -1
  86. package/build/index.d.cts +8 -0
  87. package/build/index.d.ts +8 -0
  88. package/build/index.js +130 -112
  89. package/build/index.js.map +1 -1
  90. package/build/styles.css +20 -0
  91. package/build/types/theme.type.d.cts +25 -0
  92. package/build/types/theme.type.d.ts +25 -0
  93. package/build/types/types/theme.type.d.cts +25 -0
  94. package/build/types/types/theme.type.d.ts +25 -0
  95. package/package.json +81 -1
@@ -0,0 +1,31 @@
1
+ "use client";
2
+ import { jsx as e, jsxs as c } from "react/jsx-runtime";
3
+ import { cx as l } from "../../helpers/class-name.helper.js";
4
+ import { resolveLabel as a } from "../../helpers/label.helper.js";
5
+ import { useUi as p } from "../../theme/context.js";
6
+ import d from "../Link/index.js";
7
+ import u from "../VehicleTypeList/index.js";
8
+ 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"};
9
+ const P = ({ image: t }) => /* @__PURE__ */ e("span", { "aria-hidden": !0, className: o.thumb, children: t }), j = ({
10
+ name: t,
11
+ href: s,
12
+ linkProps: i,
13
+ vehicleTypes: r = []
14
+ }) => /* @__PURE__ */ c("span", { className: o.identity, children: [
15
+ /* @__PURE__ */ e(d, { ...i, href: s, title: t, className: o.identity__name, children: t }),
16
+ /* @__PURE__ */ e(u, { types: r })
17
+ ] }), C = ({
18
+ field: t,
19
+ text: s,
20
+ isHidden: i
21
+ }) => {
22
+ var m;
23
+ const { labels: r } = p(), n = a(`productColumns.labels.${t}`, s, (m = r == null ? void 0 : r.product) == null ? void 0 : m[t]);
24
+ return /* @__PURE__ */ e("span", { className: l(i && o.srOnly), children: n });
25
+ };
26
+ export {
27
+ C as ProductColumnLabel,
28
+ j as ProductIdentity,
29
+ P as ProductThumb
30
+ };
31
+ //# sourceMappingURL=parts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"parts.js","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":";;;;;;;;AA8BO,MAAMA,IAAe,CAAC,EAAE,OAAAC,QAC7B,gBAAAC,EAAC,QAAA,EAAK,eAAW,IAAC,WAAWC,EAAO,OACjC,UAAAF,EAAA,CACH,GAIWG,IAAkB,CAAC;AAAA,EAC9B,MAAAC;AAAA,EACA,MAAAC;AAAA,EACA,WAAAC;AAAA,EACA,cAAAC,IAAe,CAAA;AACjB,MACE,gBAAAC,EAAC,QAAA,EAAK,WAAWN,EAAO,UACtB,UAAA;AAAA,EAAA,gBAAAD,EAACQ,GAAA,EAAQ,GAAGH,GAAW,MAAAD,GAAY,OAAOD,GAAM,WAAWF,EAAO,gBAC/D,UAAAE,EAAA,CACH;AAAA,EACA,gBAAAH,EAACS,GAAA,EAAgB,OAAOH,EAAA,CAAc;AAAA,EAAA,CACxC,GAQWI,IAAqB,CAAC;AAAA,EACjC,OAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AACF,MAIM;;AACJ,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAAA,GACbC,IAAQC,EAAa,yBAAyBN,CAAK,IAAIC,IAAMM,IAAAJ,KAAA,gBAAAA,EAAQ,YAAR,gBAAAI,EAAkBP,EAAM;AAE3F,SAAO,gBAAAX,EAAC,UAAK,WAAWmB,EAAGN,KAAYZ,EAAO,MAAM,GAAI,UAAAe,EAAA,CAAM;AAChE;"}
@@ -0,0 +1 @@
1
+ @layer ui{.ui-row-hRssp{display:grid;grid-template-columns:40px minmax(0,3fr) minmax(0,1fr) minmax(0,1.25fr) minmax(7rem,auto) auto;grid-template-areas:"thumb main brand stock price action";align-items:center;gap:var(--hd-space-2) var(--hd-space-4);padding:var(--hd-space-3) var(--hd-space-4);border-block-end:1px solid var(--hd-border);background-color:var(--hd-bg-surface);font-size:var(--hd-type-small-size)}.ui-row-hRssp:last-child{border-block-end:none}.ui-row__main-9U8-X{display:flex;grid-area:main;flex-direction:column;gap:2px;min-width:0}.ui-row__brand-FPANJ{grid-area:brand;color:var(--hd-text-2)}.ui-row__stock-R0vkG{grid-area:stock;min-width:0}.ui-row__price-Xc0rY{grid-area:price;justify-self:end;font-variant-numeric:tabular-nums}.ui-row__access-90GUv{grid-column:stock/price;min-width:0}.ui-row__action-BLUhd{grid-area:action;justify-self:end}@media (max-width: 640px){.ui-row-hRssp{grid-template-columns:40px minmax(0,1fr) auto;grid-template-areas:"thumb main main" "thumb stock price" "thumb action action";align-items:start}.ui-row__brand-FPANJ{display:none}.ui-row__access-90GUv{grid-column:2/-1}.ui-row__action-BLUhd{justify-self:stretch}}.ui-thumb-keewu{display:inline-flex;grid-area:thumb;align-items:center;justify-content:center;width:40px;height:40px;overflow:hidden;border-radius:var(--hd-radius-xs);background-color:var(--hd-bg-raised)}.ui-thumb-keewu>img,.ui-thumb-keewu>picture,.ui-thumb-keewu>svg{width:100%;height:100%;object-fit:contain}.ui-identity-KJkMD{display:flex;flex-direction:column;gap:var(--hd-space-1);min-width:0}.ui-identity__name-HOwle{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;display:block;color:var(--hd-text);font-weight:var(--hd-font-weight-medium);text-decoration:none;border-radius:var(--hd-radius-xs)}.ui-identity__name-HOwle:hover{color:var(--hd-primary-text);text-decoration:underline;text-underline-offset:2px}.ui-identity__name-HOwle:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, 2px)}.ui-truncate-5ux8b{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;display:block}.ui-column__image-80B8g{width:56px}.ui-column__code-WqdqI{white-space:nowrap}.ui-column__name-XArN-{width:100%;max-width:0;min-width:14rem}.ui-column__brand-kZOvm{max-width:10rem}.ui-column__stock-TFp2x,.ui-column__price-O6HlG,.ui-column__access-anXj-,.ui-column__action-v67xi{white-space:nowrap}.ui-srOnly-tMxZI{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}}
@@ -1,2 +1,2 @@
1
- "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),D=require("react"),k=require("react-bootstrap-icons"),A=require("../../helpers/class-name.helper.cjs"),b=require("../../helpers/label.helper.cjs"),B=require("../../theme/context.cjs"),c={default:{"stepper":"ui-stepper-8s5Ih","stepper__input":"ui-stepper__input-OQh5v","stepper__button":"ui-stepper__button-h6g7d","stepper--sm":"ui-stepper--sm-RvrBP","stepper--md":"ui-stepper--md-Cnjei"}},E=({value:r,onChange:i,label:M,decreaseLabel:S,increaseLabel:j,min:n=1,max:a=99,isDisabled:p,isReadOnly:u,size:x="md",id:L,required:N,"aria-describedby":w,"aria-invalid":P,className:Q,testId:v})=>{var m,h,q;const{labels:t}=B.useUi(),f=b.resolveLabel("QuantityStepper.label",M,(m=t==null?void 0:t.quantity)==null?void 0:m.label),[U,s]=D.useState(null),d=e=>Math.min(Math.max(e,n),a),y=Number.isFinite(a)?String(Math.floor(Math.abs(a))).length:15,g=e=>{if(s(null),u)return;const o=e.replace(/\D/g,"");o!==""&&i(d(Number(o)))};return l.jsxs("div",{className:A.cx(c.default.stepper,c.default[`stepper--${x}`],Q),role:"group","aria-label":f,"data-testid":v,children:[l.jsx("button",{type:"button",className:c.default.stepper__button,onClick:()=>i(Math.max(r-1,n)),disabled:p||u||r<=n,"aria-label":b.resolveLabel("QuantityStepper.decreaseLabel",S,(h=t==null?void 0:t.quantity)==null?void 0:h.decrease),children:l.jsx(k.DashLg,{"aria-hidden":!0})}),l.jsx("input",{id:L,className:c.default.stepper__input,value:U??String(r),onChange:e=>s(e.target.value.replace(/\D/g,"").slice(0,y)),style:{"--ui-stepper-digits":y},onBlur:e=>g(e.target.value),onKeyDown:e=>{if(u)return;const o=e.key==="ArrowUp"?1:e.key==="ArrowDown"?-1:0;if(o!==0){e.preventDefault(),s(null),i(d(r+o));return}const _=e.key==="PageUp"?10:e.key==="PageDown"?-10:0;if(_!==0){e.preventDefault(),s(null),i(d(r+_));return}if(e.key==="Home"||e.key==="End"){e.preventDefault(),s(null),i(e.key==="Home"?n:a);return}e.key==="Enter"&&(e.preventDefault(),g(e.target.value))},inputMode:"numeric",disabled:p,readOnly:u,"aria-readonly":u||void 0,"aria-required":N||void 0,"aria-invalid":P||void 0,"aria-describedby":w,role:"spinbutton","aria-valuenow":r,"aria-valuemin":n,"aria-valuemax":a,"aria-label":f}),l.jsx("button",{type:"button",className:c.default.stepper__button,onClick:()=>i(Math.min(r+1,a)),disabled:p||u||r>=a,"aria-label":b.resolveLabel("QuantityStepper.increaseLabel",j,(q=t==null?void 0:t.quantity)==null?void 0:q.increase),children:l.jsx(k.PlusLg,{"aria-hidden":!0})})]})},H=D.memo(E);exports.default=H;
1
+ "use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),S=require("react"),k=require("react-bootstrap-icons"),A=require("../../helpers/class-name.helper.cjs"),b=require("../../helpers/label.helper.cjs"),B=require("../../theme/context.cjs"),c={default:{"stepper":"ui-stepper-8s5Ih","stepper__input":"ui-stepper__input-OQh5v","stepper__button":"ui-stepper__button-h6g7d","stepper--sm":"ui-stepper--sm-RvrBP","stepper--md":"ui-stepper--md-Cnjei"}},E=({value:r,onChange:i,label:D,decreaseLabel:M,increaseLabel:j,min:n=1,max:a=99,isDisabled:p,isReadOnly:u,size:L="md",id:x,required:N,"aria-describedby":w,"aria-invalid":Q,className:P,testId:v})=>{var m,h,q;const{labels:t}=B.useUi(),f=b.resolveLabel("QuantityStepper.label",D,(m=t==null?void 0:t.quantity)==null?void 0:m.label),[U,s]=S.useState(null),d=e=>Math.min(Math.max(e,n),a),y=Number.isFinite(a)?String(Math.floor(Math.abs(a))).length:15,g=e=>{if(s(null),u)return;const o=e.replace(/\D/g,"");o!==""&&i(d(Number(o)))};return l.jsxs("div",{className:A.cx(c.default.stepper,c.default[`stepper--${L}`],P),role:"group","aria-label":f,"data-testid":v,children:[l.jsx("button",{type:"button",className:c.default.stepper__button,onClick:()=>i(Math.max(r-1,n)),disabled:p||u||r<=n,"aria-label":b.resolveLabel("QuantityStepper.decreaseLabel",M,(h=t==null?void 0:t.quantity)==null?void 0:h.decrease),children:l.jsx(k.DashLg,{"aria-hidden":!0})}),l.jsx("input",{id:x,className:c.default.stepper__input,value:U??String(r),onChange:e=>s(e.target.value.replace(/\D/g,"").slice(0,y)),style:{"--ui-stepper-digits":y},onBlur:e=>g(e.target.value),onKeyDown:e=>{if(u)return;const o=e.key==="ArrowUp"?1:e.key==="ArrowDown"?-1:0;if(o!==0){e.preventDefault(),s(null),i(d(r+o));return}const _=e.key==="PageUp"?10:e.key==="PageDown"?-10:0;if(_!==0){e.preventDefault(),s(null),i(d(r+_));return}if(e.key==="Home"||e.key==="End"){e.preventDefault(),s(null),i(e.key==="Home"?n:a);return}e.key==="Enter"&&(e.preventDefault(),g(e.target.value))},inputMode:"numeric",disabled:p,readOnly:u,"aria-readonly":u||void 0,"aria-required":N||void 0,"aria-invalid":Q||void 0,"aria-describedby":w,role:"spinbutton","aria-valuenow":r,"aria-valuemin":n,"aria-valuemax":a,"aria-label":f}),l.jsx("button",{type:"button",className:c.default.stepper__button,onClick:()=>i(Math.min(r+1,a)),disabled:p||u||r>=a,"aria-label":b.resolveLabel("QuantityStepper.increaseLabel",j,(q=t==null?void 0:t.quantity)==null?void 0:q.increase),children:l.jsx(k.PlusLg,{"aria-hidden":!0})})]})},H=S.memo(E);exports.default=H;
2
2
  //# sourceMappingURL=index.cjs.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sources":["../../../src/components/QuantityStepper/index.tsx"],"sourcesContent":["'use client';\n\nimport { type CSSProperties, type FC, memo, useState } from 'react';\n\nimport { DashLg, PlusLg } from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n value: number;\n onChange: (value: number) => void;\n /** Grubun ve girdinin erişilebilir adı. */\n label?: string;\n /** Verilmezse `labels.quantity.decrease`. */\n decreaseLabel?: string;\n /** Verilmezse `labels.quantity.increase`. */\n increaseLabel?: string;\n min?: number;\n max?: number;\n isDisabled?: boolean;\n /**\n * Read-only (2.2): the number stays focusable and readable (`aria-readonly`); typing, the arrow\n * keys and the two buttons do not change it.\n */\n isReadOnly?: boolean;\n size?: 'sm' | 'md';\n /**\n * The id of the number box (2.2) — the `id` of `Field`'s `FieldChildProps`, so the field's label\n * and a form's focus reach the box.\n */\n id?: string;\n /** Zorunluluk — `Field`in `FieldChildProps` sözleşmesi (2.2); `aria-required` on the box. */\n required?: boolean;\n /** On the number box (2.2), with the error and hint ids of `Field`. */\n 'aria-describedby'?: string;\n /** On the number box (2.2): `spinbutton` takes `aria-invalid`. */\n 'aria-invalid'?: boolean;\n className?: string;\n testId?: string;\n};\n\n/** Adet seçici. */\nconst QuantityStepper: FC<Props> = ({\n value,\n onChange,\n label,\n decreaseLabel,\n increaseLabel,\n min = 1,\n max = 99,\n isDisabled,\n isReadOnly,\n size = 'md',\n id,\n required,\n 'aria-describedby': describedBy,\n 'aria-invalid': isInvalid,\n className,\n testId,\n}) => {\n const { labels } = useUi();\n const groupLabel = resolveLabel('QuantityStepper.label', label, labels?.quantity?.label);\n const [draft, setDraft] = useState<string | null>(null);\n\n const clamp = (next: number) => Math.min(Math.max(next, min), max);\n\n /*\n * How many digits the box takes: those of `max` (3.5.1, PD-18). It was a fixed `slice(0, 2)` with\n * fixed widths, so `max={100000}` turned a typed 100000 into 10. An unbounded `max` takes up to 15\n * digits (a safe integer). A typed value out of range is clamped on commit, not cut while typing.\n */\n const digitCount = Number.isFinite(max) ? String(Math.floor(Math.abs(max))).length : 15;\n\n const commit = (raw: string) => {\n setDraft(null);\n if (isReadOnly) return;\n\n /*\n * Onceki bicim `if (!parsed) return;` diyordu ve `0` falsy: `min={0}` ile kurulmus bir alanda\n * (stok duzeltme formu) kullanici `0` yazip alandan…\n * ⚠ BOSLUK KONTROLU HAM DIZEDEN yapilir, sayidan DEGIL.\n */\n const digits = raw.replace(/\\D/g, '');\n if (digits === '') return;\n\n onChange(clamp(Number(digits)));\n };\n\n return (\n <div\n className={cx(styles.stepper, styles[`stepper--${size}`], className)}\n role=\"group\"\n aria-label={groupLabel}\n data-testid={testId}\n >\n <button\n type=\"button\"\n className={styles.stepper__button}\n onClick={() => onChange(Math.max(value - 1, min))}\n disabled={isDisabled || isReadOnly || value <= min}\n aria-label={resolveLabel(\n 'QuantityStepper.decreaseLabel',\n decreaseLabel,\n labels?.quantity?.decrease,\n )}\n >\n <DashLg aria-hidden />\n </button>\n\n <input\n id={id}\n className={styles.stepper__input}\n value={draft ?? String(value)}\n onChange={event => setDraft(event.target.value.replace(/\\D/g, '').slice(0, digitCount))}\n /* The box grows with the digits `max` allows (`.stepper__input`). */\n style={{ '--ui-stepper-digits': digitCount } as CSSProperties}\n onBlur={event => commit(event.target.value)}\n /* ⚠ `spinbutton` ROLU BIR SOZ VERIR: */\n onKeyDown={event => {\n if (isReadOnly) return;\n\n const step = event.key === 'ArrowUp' ? 1 : event.key === 'ArrowDown' ? -1 : 0;\n\n if (step !== 0) {\n event.preventDefault();\n setDraft(null);\n onChange(clamp(value + step));\n return;\n }\n\n const page = event.key === 'PageUp' ? 10 : event.key === 'PageDown' ? -10 : 0;\n\n if (page !== 0) {\n event.preventDefault();\n setDraft(null);\n onChange(clamp(value + page));\n return;\n }\n\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n setDraft(null);\n onChange(event.key === 'Home' ? min : max);\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n commit((event.target as HTMLInputElement).value);\n }\n }}\n inputMode=\"numeric\"\n disabled={isDisabled}\n readOnly={isReadOnly}\n aria-readonly={isReadOnly || undefined}\n aria-required={required || undefined}\n aria-invalid={isInvalid || undefined}\n aria-describedby={describedBy}\n /* ⚠ ARALIK ETIKETE GOMULMEZ, ROLE ILE BILDIRILIR. */\n role=\"spinbutton\"\n aria-valuenow={value}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-label={groupLabel}\n />\n\n <button\n type=\"button\"\n className={styles.stepper__button}\n onClick={() => onChange(Math.min(value + 1, max))}\n disabled={isDisabled || isReadOnly || value >= max}\n aria-label={resolveLabel(\n 'QuantityStepper.increaseLabel',\n increaseLabel,\n labels?.quantity?.increase,\n )}\n >\n <PlusLg aria-hidden />\n </button>\n </div>\n );\n};\n\nexport default /*#__PURE__*/ memo(QuantityStepper) as typeof QuantityStepper;\n"],"names":["QuantityStepper","value","onChange","label","decreaseLabel","increaseLabel","min","max","isDisabled","isReadOnly","size","id","required","describedBy","isInvalid","className","testId","labels","useUi","groupLabel","resolveLabel","_a","draft","setDraft","useState","clamp","next","digitCount","commit","raw","digits","jsxs","cx","styles","jsx","_b","DashLg","event","step","page","_c","PlusLg","index"],"mappings":"2XA6CMA,EAA6B,CAAC,CAClC,MAAAC,EACA,SAAAC,EACA,MAAAC,EACA,cAAAC,EACA,cAAAC,EACA,IAAAC,EAAM,EACN,IAAAC,EAAM,GACN,WAAAC,EACA,WAAAC,EACA,KAAAC,EAAO,KACP,GAAAC,EACA,SAAAC,EACA,mBAAoBC,EACpB,eAAgBC,EAChB,UAAAC,EACA,OAAAC,CACF,IAAM,WACJ,KAAM,CAAE,OAAAC,CAAA,EAAWC,QAAA,EACbC,EAAaC,EAAAA,aAAa,wBAAyBjB,GAAOkB,EAAAJ,GAAA,YAAAA,EAAQ,WAAR,YAAAI,EAAkB,KAAK,EACjF,CAACC,EAAOC,CAAQ,EAAIC,EAAAA,SAAwB,IAAI,EAEhDC,EAASC,GAAiB,KAAK,IAAI,KAAK,IAAIA,EAAMpB,CAAG,EAAGC,CAAG,EAO3DoB,EAAa,OAAO,SAASpB,CAAG,EAAI,OAAO,KAAK,MAAM,KAAK,IAAIA,CAAG,CAAC,CAAC,EAAE,OAAS,GAE/EqB,EAAUC,GAAgB,CAE9B,GADAN,EAAS,IAAI,EACTd,EAAY,OAOhB,MAAMqB,EAASD,EAAI,QAAQ,MAAO,EAAE,EAChCC,IAAW,IAEf5B,EAASuB,EAAM,OAAOK,CAAM,CAAC,CAAC,CAChC,EAEA,OACEC,EAAAA,KAAC,MAAA,CACC,UAAWC,EAAAA,GAAGC,EAAAA,QAAO,QAASA,EAAAA,QAAO,YAAYvB,CAAI,EAAE,EAAGK,CAAS,EACnE,KAAK,QACL,aAAYI,EACZ,cAAaH,EAEb,SAAA,CAAAkB,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,UAAWD,EAAAA,QAAO,gBAClB,QAAS,IAAM/B,EAAS,KAAK,IAAID,EAAQ,EAAGK,CAAG,CAAC,EAChD,SAAUE,GAAcC,GAAcR,G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,KAAK,aACL,gBAAeZ,EACf,gBAAeK,EACf,gBAAeC,EACf,aAAYY,CAAA,CAAA,EAGde,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,UAAWD,EAAAA,QAAO,gBAClB,QAAS,IAAM/B,EAAS,KAAK,IAAID,EAAQ,EAAGM,CAAG,CAAC,EAChD,SAAUC,GAAcC,GAAcR,GAASM,EAC/C,aAAYa,EAAAA,aACV,gCACAf,GACAmC,EAAAvB,GAAA,YAAAA,EAAQ,WAAR,YAAAuB,EAAkB,QAAA,EAGpB,SAAAN,EAAAA,IAACO,EAAAA,OAAA,CAAO,cAAW,EAAA,CAAC,CAAA,CAAA,CACtB,CAAA,CAAA,CAGN,EAEAC,SAAkC1C,CAAe"}
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/QuantityStepper/index.tsx"],"sourcesContent":["'use client';\n\nimport { type CSSProperties, type FC, memo, useState } from 'react';\n\nimport { DashLg, PlusLg } from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n value: number;\n onChange: (value: number) => void;\n /** Grubun ve girdinin erişilebilir adı. */\n label?: string;\n /** Verilmezse `labels.quantity.decrease`. */\n decreaseLabel?: string;\n /** Verilmezse `labels.quantity.increase`. */\n increaseLabel?: string;\n min?: number;\n max?: number;\n isDisabled?: boolean;\n /**\n * Read-only (2.2): the number stays focusable and readable (`aria-readonly`); typing, the arrow\n * keys and the two buttons do not change it.\n */\n isReadOnly?: boolean;\n size?: 'sm' | 'md';\n /**\n * The id of the number box (2.2) — the `id` of `Field`'s `FieldChildProps`, so the field's label\n * and a form's focus reach the box.\n */\n id?: string;\n /** Zorunluluk — `Field`in `FieldChildProps` sözleşmesi (2.2); `aria-required` on the box. */\n required?: boolean;\n /** On the number box (2.2), with the error and hint ids of `Field`. */\n 'aria-describedby'?: string;\n /** On the number box (2.2): `spinbutton` takes `aria-invalid`. */\n 'aria-invalid'?: boolean;\n className?: string;\n testId?: string;\n};\n\n/** Adet seçici. */\nconst QuantityStepper: FC<Props> = ({\n value,\n onChange,\n label,\n decreaseLabel,\n increaseLabel,\n min = 1,\n max = 99,\n isDisabled,\n isReadOnly,\n size = 'md',\n id,\n required,\n 'aria-describedby': describedBy,\n 'aria-invalid': isInvalid,\n className,\n testId,\n}) => {\n const { labels } = useUi();\n const groupLabel = resolveLabel('QuantityStepper.label', label, labels?.quantity?.label);\n const [draft, setDraft] = useState<string | null>(null);\n\n const clamp = (next: number) => Math.min(Math.max(next, min), max);\n\n /*\n * How many digits the box takes: those of `max` (3.5.1, PD-18). It was a fixed `slice(0, 2)` with\n * fixed widths, so `max={100000}` turned a typed 100000 into 10. An unbounded `max` takes up to 15\n * digits (a safe integer). A typed value out of range is clamped on commit, not cut while typing.\n */\n const digitCount = Number.isFinite(max) ? String(Math.floor(Math.abs(max))).length : 15;\n\n const commit = (raw: string) => {\n setDraft(null);\n if (isReadOnly) return;\n\n /*\n * Onceki bicim `if (!parsed) return;` diyordu ve `0` falsy: `min={0}` ile kurulmus bir alanda\n * (stok duzeltme formu) kullanici `0` yazip alandan…\n * ⚠ BOSLUK KONTROLU HAM DIZEDEN yapilir, sayidan DEGIL.\n */\n const digits = raw.replace(/\\D/g, '');\n if (digits === '') return;\n\n onChange(clamp(Number(digits)));\n };\n\n return (\n <div\n className={cx(styles.stepper, styles[`stepper--${size}`], className)}\n role=\"group\"\n aria-label={groupLabel}\n data-testid={testId}\n >\n <button\n type=\"button\"\n className={styles.stepper__button}\n onClick={() => onChange(Math.max(value - 1, min))}\n disabled={isDisabled || isReadOnly || value <= min}\n aria-label={resolveLabel(\n 'QuantityStepper.decreaseLabel',\n decreaseLabel,\n labels?.quantity?.decrease,\n )}\n >\n <DashLg aria-hidden />\n </button>\n\n <input\n id={id}\n className={styles.stepper__input}\n value={draft ?? String(value)}\n onChange={event => setDraft(event.target.value.replace(/\\D/g, '').slice(0, digitCount))}\n /* The box grows with the digits `max` allows (`.stepper__input`). */\n style={{ '--ui-stepper-digits': digitCount } as CSSProperties}\n onBlur={event => commit(event.target.value)}\n /* ⚠ `spinbutton` ROLU BIR SOZ VERIR: */\n onKeyDown={event => {\n if (isReadOnly) return;\n\n const step = event.key === 'ArrowUp' ? 1 : event.key === 'ArrowDown' ? -1 : 0;\n\n if (step !== 0) {\n event.preventDefault();\n setDraft(null);\n onChange(clamp(value + step));\n return;\n }\n\n const page = event.key === 'PageUp' ? 10 : event.key === 'PageDown' ? -10 : 0;\n\n if (page !== 0) {\n event.preventDefault();\n setDraft(null);\n onChange(clamp(value + page));\n return;\n }\n\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n setDraft(null);\n onChange(event.key === 'Home' ? min : max);\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n commit((event.target as HTMLInputElement).value);\n }\n }}\n inputMode=\"numeric\"\n disabled={isDisabled}\n readOnly={isReadOnly}\n aria-readonly={isReadOnly || undefined}\n aria-required={required || undefined}\n aria-invalid={isInvalid || undefined}\n aria-describedby={describedBy}\n /* ⚠ ARALIK ETIKETE GOMULMEZ, ROLE ILE BILDIRILIR. */\n role=\"spinbutton\"\n aria-valuenow={value}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-label={groupLabel}\n />\n\n <button\n type=\"button\"\n className={styles.stepper__button}\n onClick={() => onChange(Math.min(value + 1, max))}\n disabled={isDisabled || isReadOnly || value >= max}\n aria-label={resolveLabel(\n 'QuantityStepper.increaseLabel',\n increaseLabel,\n labels?.quantity?.increase,\n )}\n >\n <PlusLg aria-hidden />\n </button>\n </div>\n );\n};\n\nexport default /*#__PURE__*/ memo(QuantityStepper) as typeof QuantityStepper;\n"],"names":["QuantityStepper","value","onChange","label","decreaseLabel","increaseLabel","min","max","isDisabled","isReadOnly","size","id","required","describedBy","isInvalid","className","testId","labels","useUi","groupLabel","resolveLabel","_a","draft","setDraft","useState","clamp","next","digitCount","comm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,EACf,gBAAeC,EACf,aAAYY,CAAA,CAAA,EAGde,EAAAA,IAAC,SAAA,CACC,KAAK,SACL,UAAWD,EAAAA,QAAO,gBAClB,QAAS,IAAM/B,EAAS,KAAK,IAAID,EAAQ,EAAGM,CAAG,CAAC,EAChD,SAAUC,GAAcC,GAAcR,GAASM,EAC/C,aAAYa,EAAAA,aACV,gCACAf,GACAmC,EAAAvB,GAAA,YAAAA,EAAQ,WAAR,YAAAuB,EAAkB,QAAA,EAGpB,SAAAN,EAAAA,IAACO,EAAAA,OAAA,CAAO,cAAW,EAAA,CAAC,CAAA,CAAA,CACtB,CAAA,CAAA,CAGN,EAEAzC,SAAkCA,CAAe"}
@@ -1,16 +1,16 @@
1
1
  "use client";
2
- import { jsxs as x, jsx as l } from "react/jsx-runtime";
3
- import { memo as A, useState as E } from "react";
4
- import { DashLg as H, PlusLg as B } from "react-bootstrap-icons";
5
- import { cx as F } from "../../helpers/class-name.helper.js";
2
+ import { jsxs as A, jsx as l } from "react/jsx-runtime";
3
+ import { memo as E, useState as H } from "react";
4
+ import { DashLg as $, PlusLg as x } from "react-bootstrap-icons";
5
+ import { cx as B } from "../../helpers/class-name.helper.js";
6
6
  import { resolveLabel as m } from "../../helpers/label.helper.js";
7
- import { useUi as K } from "../../theme/context.js";
7
+ import { useUi as F } from "../../theme/context.js";
8
8
  const s = {"stepper":"ui-stepper-8s5Ih","stepper__input":"ui-stepper__input-OQh5v","stepper__button":"ui-stepper__button-h6g7d","stepper--sm":"ui-stepper--sm-RvrBP","stepper--md":"ui-stepper--md-Cnjei"};
9
- const $ = ({
9
+ const K = ({
10
10
  value: e,
11
11
  onChange: i,
12
- label: M,
13
- decreaseLabel: S,
12
+ label: S,
13
+ decreaseLabel: M,
14
14
  increaseLabel: w,
15
15
  min: u = 1,
16
16
  max: a = 99,
@@ -19,21 +19,21 @@ const $ = ({
19
19
  size: L = "md",
20
20
  id: N,
21
21
  required: _,
22
- "aria-describedby": q,
23
- "aria-invalid": Q,
22
+ "aria-describedby": Q,
23
+ "aria-invalid": q,
24
24
  className: P,
25
25
  testId: U
26
26
  }) => {
27
27
  var g, k, h;
28
- const { labels: r } = K(), f = m("QuantityStepper.label", M, (g = r == null ? void 0 : r.quantity) == null ? void 0 : g.label), [j, n] = E(null), d = (t) => Math.min(Math.max(t, u), a), b = Number.isFinite(a) ? String(Math.floor(Math.abs(a))).length : 15, y = (t) => {
29
- if (n(null), o) return;
30
- const p = t.replace(/\D/g, "");
31
- p !== "" && i(d(Number(p)));
28
+ const { labels: r } = F(), f = m("QuantityStepper.label", S, (g = r == null ? void 0 : r.quantity) == null ? void 0 : g.label), [j, p] = H(null), d = (t) => Math.min(Math.max(t, u), a), b = Number.isFinite(a) ? String(Math.floor(Math.abs(a))).length : 15, y = (t) => {
29
+ if (p(null), o) return;
30
+ const n = t.replace(/\D/g, "");
31
+ n !== "" && i(d(Number(n)));
32
32
  };
33
- return /* @__PURE__ */ x(
33
+ return /* @__PURE__ */ A(
34
34
  "div",
35
35
  {
36
- className: F(s.stepper, s[`stepper--${L}`], P),
36
+ className: B(s.stepper, s[`stepper--${L}`], P),
37
37
  role: "group",
38
38
  "aria-label": f,
39
39
  "data-testid": U,
@@ -47,10 +47,10 @@ const $ = ({
47
47
  disabled: c || o || e <= u,
48
48
  "aria-label": m(
49
49
  "QuantityStepper.decreaseLabel",
50
- S,
50
+ M,
51
51
  (k = r == null ? void 0 : r.quantity) == null ? void 0 : k.decrease
52
52
  ),
53
- children: /* @__PURE__ */ l(H, { "aria-hidden": !0 })
53
+ children: /* @__PURE__ */ l($, { "aria-hidden": !0 })
54
54
  }
55
55
  ),
56
56
  /* @__PURE__ */ l(
@@ -59,23 +59,23 @@ const $ = ({
59
59
  id: N,
60
60
  className: s.stepper__input,
61
61
  value: j ?? String(e),
62
- onChange: (t) => n(t.target.value.replace(/\D/g, "").slice(0, b)),
62
+ onChange: (t) => p(t.target.value.replace(/\D/g, "").slice(0, b)),
63
63
  style: { "--ui-stepper-digits": b },
64
64
  onBlur: (t) => y(t.target.value),
65
65
  onKeyDown: (t) => {
66
66
  if (o) return;
67
- const p = t.key === "ArrowUp" ? 1 : t.key === "ArrowDown" ? -1 : 0;
68
- if (p !== 0) {
69
- t.preventDefault(), n(null), i(d(e + p));
67
+ const n = t.key === "ArrowUp" ? 1 : t.key === "ArrowDown" ? -1 : 0;
68
+ if (n !== 0) {
69
+ t.preventDefault(), p(null), i(d(e + n));
70
70
  return;
71
71
  }
72
72
  const D = t.key === "PageUp" ? 10 : t.key === "PageDown" ? -10 : 0;
73
73
  if (D !== 0) {
74
- t.preventDefault(), n(null), i(d(e + D));
74
+ t.preventDefault(), p(null), i(d(e + D));
75
75
  return;
76
76
  }
77
77
  if (t.key === "Home" || t.key === "End") {
78
- t.preventDefault(), n(null), i(t.key === "Home" ? u : a);
78
+ t.preventDefault(), p(null), i(t.key === "Home" ? u : a);
79
79
  return;
80
80
  }
81
81
  t.key === "Enter" && (t.preventDefault(), y(t.target.value));
@@ -85,8 +85,8 @@ const $ = ({
85
85
  readOnly: o,
86
86
  "aria-readonly": o || void 0,
87
87
  "aria-required": _ || void 0,
88
- "aria-invalid": Q || void 0,
89
- "aria-describedby": q,
88
+ "aria-invalid": q || void 0,
89
+ "aria-describedby": Q,
90
90
  role: "spinbutton",
91
91
  "aria-valuenow": e,
92
92
  "aria-valuemin": u,
@@ -106,13 +106,13 @@ const $ = ({
106
106
  w,
107
107
  (h = r == null ? void 0 : r.quantity) == null ? void 0 : h.increase
108
108
  ),
109
- children: /* @__PURE__ */ l(B, { "aria-hidden": !0 })
109
+ children: /* @__PURE__ */ l(x, { "aria-hidden": !0 })
110
110
  }
111
111
  )
112
112
  ]
113
113
  }
114
114
  );
115
- }, X = /* @__PURE__ */ A($);
115
+ }, X = /* @__PURE__ */ E(K);
116
116
  export {
117
117
  X as default
118
118
  };
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":["../../../src/components/QuantityStepper/index.tsx"],"sourcesContent":["'use client';\n\nimport { type CSSProperties, type FC, memo, useState } from 'react';\n\nimport { DashLg, PlusLg } from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n value: number;\n onChange: (value: number) => void;\n /** Grubun ve girdinin erişilebilir adı. */\n label?: string;\n /** Verilmezse `labels.quantity.decrease`. */\n decreaseLabel?: string;\n /** Verilmezse `labels.quantity.increase`. */\n increaseLabel?: string;\n min?: number;\n max?: number;\n isDisabled?: boolean;\n /**\n * Read-only (2.2): the number stays focusable and readable (`aria-readonly`); typing, the arrow\n * keys and the two buttons do not change it.\n */\n isReadOnly?: boolean;\n size?: 'sm' | 'md';\n /**\n * The id of the number box (2.2) — the `id` of `Field`'s `FieldChildProps`, so the field's label\n * and a form's focus reach the box.\n */\n id?: string;\n /** Zorunluluk — `Field`in `FieldChildProps` sözleşmesi (2.2); `aria-required` on the box. */\n required?: boolean;\n /** On the number box (2.2), with the error and hint ids of `Field`. */\n 'aria-describedby'?: string;\n /** On the number box (2.2): `spinbutton` takes `aria-invalid`. */\n 'aria-invalid'?: boolean;\n className?: string;\n testId?: string;\n};\n\n/** Adet seçici. */\nconst QuantityStepper: FC<Props> = ({\n value,\n onChange,\n label,\n decreaseLabel,\n increaseLabel,\n min = 1,\n max = 99,\n isDisabled,\n isReadOnly,\n size = 'md',\n id,\n required,\n 'aria-describedby': describedBy,\n 'aria-invalid': isInvalid,\n className,\n testId,\n}) => {\n const { labels } = useUi();\n const groupLabel = resolveLabel('QuantityStepper.label', label, labels?.quantity?.label);\n const [draft, setDraft] = useState<string | null>(null);\n\n const clamp = (next: number) => Math.min(Math.max(next, min), max);\n\n /*\n * How many digits the box takes: those of `max` (3.5.1, PD-18). It was a fixed `slice(0, 2)` with\n * fixed widths, so `max={100000}` turned a typed 100000 into 10. An unbounded `max` takes up to 15\n * digits (a safe integer). A typed value out of range is clamped on commit, not cut while typing.\n */\n const digitCount = Number.isFinite(max) ? String(Math.floor(Math.abs(max))).length : 15;\n\n const commit = (raw: string) => {\n setDraft(null);\n if (isReadOnly) return;\n\n /*\n * Onceki bicim `if (!parsed) return;` diyordu ve `0` falsy: `min={0}` ile kurulmus bir alanda\n * (stok duzeltme formu) kullanici `0` yazip alandan…\n * ⚠ BOSLUK KONTROLU HAM DIZEDEN yapilir, sayidan DEGIL.\n */\n const digits = raw.replace(/\\D/g, '');\n if (digits === '') return;\n\n onChange(clamp(Number(digits)));\n };\n\n return (\n <div\n className={cx(styles.stepper, styles[`stepper--${size}`], className)}\n role=\"group\"\n aria-label={groupLabel}\n data-testid={testId}\n >\n <button\n type=\"button\"\n className={styles.stepper__button}\n onClick={() => onChange(Math.max(value - 1, min))}\n disabled={isDisabled || isReadOnly || value <= min}\n aria-label={resolveLabel(\n 'QuantityStepper.decreaseLabel',\n decreaseLabel,\n labels?.quantity?.decrease,\n )}\n >\n <DashLg aria-hidden />\n </button>\n\n <input\n id={id}\n className={styles.stepper__input}\n value={draft ?? String(value)}\n onChange={event => setDraft(event.target.value.replace(/\\D/g, '').slice(0, digitCount))}\n /* The box grows with the digits `max` allows (`.stepper__input`). */\n style={{ '--ui-stepper-digits': digitCount } as CSSProperties}\n onBlur={event => commit(event.target.value)}\n /* ⚠ `spinbutton` ROLU BIR SOZ VERIR: */\n onKeyDown={event => {\n if (isReadOnly) return;\n\n const step = event.key === 'ArrowUp' ? 1 : event.key === 'ArrowDown' ? -1 : 0;\n\n if (step !== 0) {\n event.preventDefault();\n setDraft(null);\n onChange(clamp(value + step));\n return;\n }\n\n const page = event.key === 'PageUp' ? 10 : event.key === 'PageDown' ? -10 : 0;\n\n if (page !== 0) {\n event.preventDefault();\n setDraft(null);\n onChange(clamp(value + page));\n return;\n }\n\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n setDraft(null);\n onChange(event.key === 'Home' ? min : max);\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n commit((event.target as HTMLInputElement).value);\n }\n }}\n inputMode=\"numeric\"\n disabled={isDisabled}\n readOnly={isReadOnly}\n aria-readonly={isReadOnly || undefined}\n aria-required={required || undefined}\n aria-invalid={isInvalid || undefined}\n aria-describedby={describedBy}\n /* ⚠ ARALIK ETIKETE GOMULMEZ, ROLE ILE BILDIRILIR. */\n role=\"spinbutton\"\n aria-valuenow={value}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-label={groupLabel}\n />\n\n <button\n type=\"button\"\n className={styles.stepper__button}\n onClick={() => onChange(Math.min(value + 1, max))}\n disabled={isDisabled || isReadOnly || value >= max}\n aria-label={resolveLabel(\n 'QuantityStepper.increaseLabel',\n increaseLabel,\n labels?.quantity?.increase,\n )}\n >\n <PlusLg aria-hidden />\n </button>\n </div>\n );\n};\n\nexport default /*#__PURE__*/ memo(QuantityStepper) as typeof QuantityStepper;\n"],"names":["QuantityStepper","value","onChange","label","decreaseLabel","increaseLabel","min","max","isDisabled","isReadOnly","size","id","required","describedBy","isInvalid","className","testId","labels","useUi","groupLabel","resolveLabel","_a","draft","setDraft","useState","clamp","next","digitCount","commit","raw","digits","jsxs","cx","styles","jsx","_b","DashLg","event","step","page","_c","PlusLg","index"],"mappings":";;;;;;;;AA6CA,MAAMA,IAA6B,CAAC;AAAA,EAClC,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,eAAAC;AAAA,EACA,eAAAC;AAAA,EACA,KAAAC,IAAM;AAAA,EACN,KAAAC,IAAM;AAAA,EACN,YAAAC;AAAA,EACA,YAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,IAAAC;AAAA,EACA,UAAAC;AAAA,EACA,oBAAoBC;AAAA,EACpB,gBAAgBC;AAAA,EAChB,WAAAC;AAAA,EACA,QAAAC;AACF,MAAM;;AACJ,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAAA,GACbC,IAAaC,EAAa,yBAAyBjB,IAAOkB,IAAAJ,KAAA,gBAAAA,E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,YACL,WAAWD,EAAO;AAAA,YAClB,SAAS,MAAM/B,EAAS,KAAK,IAAID,IAAQ,GAAGM,CAAG,CAAC;AAAA,YAChD,UAAUC,KAAcC,KAAcR,KAASM;AAAA,YAC/C,cAAYa;AAAA,cACV;AAAA,cACAf;AAAA,eACAmC,IAAAvB,KAAA,gBAAAA,EAAQ,aAAR,gBAAAuB,EAAkB;AAAA,YAAA;AAAA,YAGpB,UAAA,gBAAAN,EAACO,GAAA,EAAO,eAAW,GAAA,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACtB;AAAA,IAAA;AAAA,EAAA;AAGN,GAEAC,sBAAkC1C,CAAe;"}
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/QuantityStepper/index.tsx"],"sourcesContent":["'use client';\n\nimport { type CSSProperties, type FC, memo, useState } from 'react';\n\nimport { DashLg, PlusLg } from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n value: number;\n onChange: (value: number) => void;\n /** Grubun ve girdinin erişilebilir adı. */\n label?: string;\n /** Verilmezse `labels.quantity.decrease`. */\n decreaseLabel?: string;\n /** Verilmezse `labels.quantity.increase`. */\n increaseLabel?: string;\n min?: number;\n max?: number;\n isDisabled?: boolean;\n /**\n * Read-only (2.2): the number stays focusable and readable (`aria-readonly`); typing, the arrow\n * keys and the two buttons do not change it.\n */\n isReadOnly?: boolean;\n size?: 'sm' | 'md';\n /**\n * The id of the number box (2.2) — the `id` of `Field`'s `FieldChildProps`, so the field's label\n * and a form's focus reach the box.\n */\n id?: string;\n /** Zorunluluk — `Field`in `FieldChildProps` sözleşmesi (2.2); `aria-required` on the box. */\n required?: boolean;\n /** On the number box (2.2), with the error and hint ids of `Field`. */\n 'aria-describedby'?: string;\n /** On the number box (2.2): `spinbutton` takes `aria-invalid`. */\n 'aria-invalid'?: boolean;\n className?: string;\n testId?: string;\n};\n\n/** Adet seçici. */\nconst QuantityStepper: FC<Props> = ({\n value,\n onChange,\n label,\n decreaseLabel,\n increaseLabel,\n min = 1,\n max = 99,\n isDisabled,\n isReadOnly,\n size = 'md',\n id,\n required,\n 'aria-describedby': describedBy,\n 'aria-invalid': isInvalid,\n className,\n testId,\n}) => {\n const { labels } = useUi();\n const groupLabel = resolveLabel('QuantityStepper.label', label, labels?.quantity?.label);\n const [draft, setDraft] = useState<string | null>(null);\n\n const clamp = (next: number) => Math.min(Math.max(next, min), max);\n\n /*\n * How many digits the box takes: those of `max` (3.5.1, PD-18). It was a fixed `slice(0, 2)` with\n * fixed widths, so `max={100000}` turned a typed 100000 into 10. An unbounded `max` takes up to 15\n * digits (a safe integer). A typed value out of range is clamped on commit, not cut while typing.\n */\n const digitCount = Number.isFinite(max) ? String(Math.floor(Math.abs(max))).length : 15;\n\n const commit = (raw: string) => {\n setDraft(null);\n if (isReadOnly) return;\n\n /*\n * Onceki bicim `if (!parsed) return;` diyordu ve `0` falsy: `min={0}` ile kurulmus bir alanda\n * (stok duzeltme formu) kullanici `0` yazip alandan…\n * ⚠ BOSLUK KONTROLU HAM DIZEDEN yapilir, sayidan DEGIL.\n */\n const digits = raw.replace(/\\D/g, '');\n if (digits === '') return;\n\n onChange(clamp(Number(digits)));\n };\n\n return (\n <div\n className={cx(styles.stepper, styles[`stepper--${size}`], className)}\n role=\"group\"\n aria-label={groupLabel}\n data-testid={testId}\n >\n <button\n type=\"button\"\n className={styles.stepper__button}\n onClick={() => onChange(Math.max(value - 1, min))}\n disabled={isDisabled || isReadOnly || value <= min}\n aria-label={resolveLabel(\n 'QuantityStepper.decreaseLabel',\n decreaseLabel,\n labels?.quantity?.decrease,\n )}\n >\n <DashLg aria-hidden />\n </button>\n\n <input\n id={id}\n className={styles.stepper__input}\n value={draft ?? String(value)}\n onChange={event => setDraft(event.target.value.replace(/\\D/g, '').slice(0, digitCount))}\n /* The box grows with the digits `max` allows (`.stepper__input`). */\n style={{ '--ui-stepper-digits': digitCount } as CSSProperties}\n onBlur={event => commit(event.target.value)}\n /* ⚠ `spinbutton` ROLU BIR SOZ VERIR: */\n onKeyDown={event => {\n if (isReadOnly) return;\n\n const step = event.key === 'ArrowUp' ? 1 : event.key === 'ArrowDown' ? -1 : 0;\n\n if (step !== 0) {\n event.preventDefault();\n setDraft(null);\n onChange(clamp(value + step));\n return;\n }\n\n const page = event.key === 'PageUp' ? 10 : event.key === 'PageDown' ? -10 : 0;\n\n if (page !== 0) {\n event.preventDefault();\n setDraft(null);\n onChange(clamp(value + page));\n return;\n }\n\n if (event.key === 'Home' || event.key === 'End') {\n event.preventDefault();\n setDraft(null);\n onChange(event.key === 'Home' ? min : max);\n return;\n }\n\n if (event.key === 'Enter') {\n event.preventDefault();\n commit((event.target as HTMLInputElement).value);\n }\n }}\n inputMode=\"numeric\"\n disabled={isDisabled}\n readOnly={isReadOnly}\n aria-readonly={isReadOnly || undefined}\n aria-required={required || undefined}\n aria-invalid={isInvalid || undefined}\n aria-describedby={describedBy}\n /* ⚠ ARALIK ETIKETE GOMULMEZ, ROLE ILE BILDIRILIR. */\n role=\"spinbutton\"\n aria-valuenow={value}\n aria-valuemin={min}\n aria-valuemax={max}\n aria-label={groupLabel}\n />\n\n <button\n type=\"button\"\n className={styles.stepper__button}\n onClick={() => onChange(Math.min(value + 1, max))}\n disabled={isDisabled || isReadOnly || value >= max}\n aria-label={resolveLabel(\n 'QuantityStepper.increaseLabel',\n increaseLabel,\n labels?.quantity?.increase,\n )}\n >\n <PlusLg aria-hidden />\n </button>\n </div>\n );\n};\n\nexport default /*#__PURE__*/ memo(QuantityStepper) as typeof QuantityStepper;\n"],"names":["QuantityStepper","value","onChange","label","decreaseLabel","increaseLabel","min","max","isDisabled","isReadOnly","size","id","required","describedBy","isInvalid","className","testId","labels","useUi","groupLabel","resolveLabel","_a","draft","setDraft","useState","clamp","next","digitCount","commit","raw","digits","jsxs","cx","styles","jsx","_b","DashLg","event","step","page","_c","Pl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,EAASmC,EAAM,QAAQ,SAAS/B,IAAMC,CAAG;AACzC;AAAA,cACF;AAEA,cAAI8B,EAAM,QAAQ,YAChBA,EAAM,eAAA,GACNT,EAAQS,EAAM,OAA4B,KAAK;AAAA,YAEnD;AAAA,YACA,WAAU;AAAA,YACV,UAAU7B;AAAA,YACV,UAAUC;AAAA,YACV,iBAAeA,KAAc;AAAA,YAC7B,iBAAeG,KAAY;AAAA,YAC3B,gBAAcE,KAAa;AAAA,YAC3B,oBAAkBD;AAAA,YAElB,MAAK;AAAA,YACL,iBAAeZ;AAAA,YACf,iBAAeK;AAAA,YACf,iBAAeC;AAAA,YACf,cAAYY;AAAA,UAAA;AAAA,QAAA;AAAA,QAGd,gBAAAe;AAAA,UAAC;AAAA,UAAA;AAAA,YACC,MAAK;AAAA,YACL,WAAWD,EAAO;AAAA,YAClB,SAAS,MAAM/B,EAAS,KAAK,IAAID,IAAQ,GAAGM,CAAG,CAAC;AAAA,YAChD,UAAUC,KAAcC,KAAcR,KAASM;AAAA,YAC/C,cAAYa;AAAA,cACV;AAAA,cACAf;AAAA,eACAmC,IAAAvB,KAAA,gBAAAA,EAAQ,aAAR,gBAAAuB,EAAkB;AAAA,YAAA;AAAA,YAGpB,UAAA,gBAAAN,EAACO,GAAA,EAAO,eAAW,GAAA,CAAC;AAAA,UAAA;AAAA,QAAA;AAAA,MACtB;AAAA,IAAA;AAAA,EAAA;AAGN,GAEAC,sBAAkC1C,CAAe;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),d=require("react"),s=require("../../helpers/class-name.helper.cjs"),o=require("../../helpers/component.helper.cjs"),e={default:{"spec":"ui-spec-f8gOH","spec__caption":"ui-spec__caption-5uQ30","spec__row":"ui-spec__row-H1Mp5","spec__label":"ui-spec__label-PqkyV","spec__value":"ui-spec__value-3jDI7","spec__value--technical":"ui-spec__value--technical-8yySN","srOnly":"ui-srOnly-UYQ78"}},i=({items:c,caption:t,isCaptionVisible:r=!1,className:n,testId:u})=>c.length===0?null:l.jsxs("table",{className:s.cx(e.default.spec,n),"data-testid":u,children:[l.jsx("caption",{className:s.cx(e.default.spec__caption,!r&&e.default.srOnly),children:t}),l.jsx("tbody",{children:c.map(a=>l.jsxs("tr",{className:e.default.spec__row,children:[l.jsx("th",{scope:"row",className:e.default.spec__label,children:a.label}),l.jsx("td",{className:s.cx(e.default.spec__value,a.isTechnical&&e.default["spec__value--technical"]),children:a.value})]},a.label))})]}),p=d.memo(o.named(i,"SpecTable"));exports.default=p;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/SpecTable/index.tsx"],"sourcesContent":["import { memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\n\nimport styles from './index.module.scss';\n\n/** One specification: \"Gerilim\" · \"24 V\". */\nexport type SpecItem = {\n label: string;\n value: ReactNode;\n /** A code or a measured value in mono (\"H7\", \"12 V 55 W\"): tabular, breaks anywhere. */\n isTechnical?: boolean;\n};\n\ntype Props = {\n items: readonly SpecItem[];\n /** The table's name (\"Teknik özellikler\"); read by a screen reader, shown only with `isCaptionVisible`. */\n caption: string;\n isCaptionVisible?: boolean;\n className?: string;\n testId?: string;\n};\n\n/**\n * SpecTable (3.8) — key → value specifications in two aligned columns: the key in secondary text at\n * a fixed share of the width, the value in the text colour, a hairline between rows, no zebra. A\n * native table, so a screen reader reads each value with its key.\n * @example <SpecTable caption=\"Teknik özellikler\" items={[{ label: 'Gerilim', value: '24 V' }, { label: 'Ampul', value: 'H7', isTechnical: true }]} />\n */\nconst SpecTable = ({ items, caption, isCaptionVisible = false, className, testId }: Props) => {\n if (items.length === 0) return null;\n\n return (\n <table className={cx(styles.spec, className)} data-testid={testId}>\n <caption className={cx(styles.spec__caption, !isCaptionVisible && styles.srOnly)}>\n {caption}\n </caption>\n <tbody>\n {items.map(item => (\n <tr key={item.label} className={styles.spec__row}>\n <th scope=\"row\" className={styles.spec__label}>\n {item.label}\n </th>\n <td\n className={cx(\n styles.spec__value,\n item.isTechnical && styles['spec__value--technical'],\n )}\n >\n {item.value}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(SpecTable, 'SpecTable')) as typeof SpecTable;\n"],"names":["SpecTable","items","caption","isCaptionVisible","className","testId","jsxs","cx","styles","jsx","item","index","memo","named"],"mappings":"0SA8BMA,EAAY,CAAC,CAAE,MAAAC,EAAO,QAAAC,EAAS,iBAAAC,EAAmB,GAAO,UAAAC,EAAW,OAAAC,KACpEJ,EAAM,SAAW,EAAU,KAG7BK,OAAC,SAAM,UAAWC,EAAAA,GAAGC,EAAAA,QAAO,KAAMJ,CAAS,EAAG,cAAaC,EACzD,SAAA,CAAAI,EAAAA,IAAC,UAAA,CAAQ,UAAWF,EAAAA,GAAGC,EAAAA,QAAO,cAAe,CAACL,GAAoBK,EAAAA,QAAO,MAAM,EAC5E,SAAAN,CAAA,CACH,EACAO,EAAAA,IAAC,SACE,SAAAR,EAAM,OACLK,EAAAA,KAAC,KAAA,CAAoB,UAAWE,EAAAA,QAAO,UACrC,SAAA,CAAAC,EAAAA,IAAC,MAAG,MAAM,MAAM,UAAWD,EAAAA,QAAO,YAC/B,WAAK,KAAA,CACR,EACAC,EAAAA,IAAC,KAAA,CACC,UAAWF,EAAAA,GACTC,EAAAA,QAAO,YACPE,EAAK,aAAeF,EAAAA,QAAO,wBAAwB,CAAA,EAGpD,SAAAE,EAAK,KAAA,CAAA,CACR,GAXOA,EAAK,KAYd,CACD,CAAA,CACH,CAAA,EACF,EAIJC,EAA6BC,OAAmBC,EAAAA,MAAMb,EAAW,WAAW,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ /** One specification: "Gerilim" · "24 V". */
3
+ export type SpecItem = {
4
+ label: string;
5
+ value: ReactNode;
6
+ /** A code or a measured value in mono ("H7", "12 V 55 W"): tabular, breaks anywhere. */
7
+ isTechnical?: boolean;
8
+ };
9
+ type Props = {
10
+ items: readonly SpecItem[];
11
+ /** The table's name ("Teknik özellikler"); read by a screen reader, shown only with `isCaptionVisible`. */
12
+ caption: string;
13
+ isCaptionVisible?: boolean;
14
+ className?: string;
15
+ testId?: string;
16
+ };
17
+ /**
18
+ * SpecTable (3.8) — key → value specifications in two aligned columns: the key in secondary text at
19
+ * a fixed share of the width, the value in the text colour, a hairline between rows, no zebra. A
20
+ * native table, so a screen reader reads each value with its key.
21
+ * @example <SpecTable caption="Teknik özellikler" items={[{ label: 'Gerilim', value: '24 V' }, { label: 'Ampul', value: 'H7', isTechnical: true }]} />
22
+ */
23
+ declare const SpecTable: ({ items, caption, isCaptionVisible, className, testId }: Props) => import("react").JSX.Element | null;
24
+ declare const _default: typeof SpecTable;
25
+ export default _default;
@@ -0,0 +1,25 @@
1
+ import { ReactNode } from 'react';
2
+ /** One specification: "Gerilim" · "24 V". */
3
+ export type SpecItem = {
4
+ label: string;
5
+ value: ReactNode;
6
+ /** A code or a measured value in mono ("H7", "12 V 55 W"): tabular, breaks anywhere. */
7
+ isTechnical?: boolean;
8
+ };
9
+ type Props = {
10
+ items: readonly SpecItem[];
11
+ /** The table's name ("Teknik özellikler"); read by a screen reader, shown only with `isCaptionVisible`. */
12
+ caption: string;
13
+ isCaptionVisible?: boolean;
14
+ className?: string;
15
+ testId?: string;
16
+ };
17
+ /**
18
+ * SpecTable (3.8) — key → value specifications in two aligned columns: the key in secondary text at
19
+ * a fixed share of the width, the value in the text colour, a hairline between rows, no zebra. A
20
+ * native table, so a screen reader reads each value with its key.
21
+ * @example <SpecTable caption="Teknik özellikler" items={[{ label: 'Gerilim', value: '24 V' }, { label: 'Ampul', value: 'H7', isTechnical: true }]} />
22
+ */
23
+ declare const SpecTable: ({ items, caption, isCaptionVisible, className, testId }: Props) => import("react").JSX.Element | null;
24
+ declare const _default: typeof SpecTable;
25
+ export default _default;
@@ -0,0 +1,25 @@
1
+ import { jsxs as r, jsx as a } from "react/jsx-runtime";
2
+ import { memo as i } from "react";
3
+ import { cx as c } from "../../helpers/class-name.helper.js";
4
+ import { named as m } from "../../helpers/component.helper.js";
5
+ const e = {"spec":"ui-spec-f8gOH","spec__caption":"ui-spec__caption-5uQ30","spec__row":"ui-spec__row-H1Mp5","spec__label":"ui-spec__label-PqkyV","spec__value":"ui-spec__value-3jDI7","spec__value--technical":"ui-spec__value--technical-8yySN","srOnly":"ui-srOnly-UYQ78"};
6
+ const d = ({ items: s, caption: o, isCaptionVisible: t = !1, className: n, testId: p }) => s.length === 0 ? null : /* @__PURE__ */ r("table", { className: c(e.spec, n), "data-testid": p, children: [
7
+ /* @__PURE__ */ a("caption", { className: c(e.spec__caption, !t && e.srOnly), children: o }),
8
+ /* @__PURE__ */ a("tbody", { children: s.map((l) => /* @__PURE__ */ r("tr", { className: e.spec__row, children: [
9
+ /* @__PURE__ */ a("th", { scope: "row", className: e.spec__label, children: l.label }),
10
+ /* @__PURE__ */ a(
11
+ "td",
12
+ {
13
+ className: c(
14
+ e.spec__value,
15
+ l.isTechnical && e["spec__value--technical"]
16
+ ),
17
+ children: l.value
18
+ }
19
+ )
20
+ ] }, l.label)) })
21
+ ] }), x = /* @__PURE__ */ i(/* @__PURE__ */ m(d, "SpecTable"));
22
+ export {
23
+ x as default
24
+ };
25
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/SpecTable/index.tsx"],"sourcesContent":["import { memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\n\nimport styles from './index.module.scss';\n\n/** One specification: \"Gerilim\" · \"24 V\". */\nexport type SpecItem = {\n label: string;\n value: ReactNode;\n /** A code or a measured value in mono (\"H7\", \"12 V 55 W\"): tabular, breaks anywhere. */\n isTechnical?: boolean;\n};\n\ntype Props = {\n items: readonly SpecItem[];\n /** The table's name (\"Teknik özellikler\"); read by a screen reader, shown only with `isCaptionVisible`. */\n caption: string;\n isCaptionVisible?: boolean;\n className?: string;\n testId?: string;\n};\n\n/**\n * SpecTable (3.8) — key → value specifications in two aligned columns: the key in secondary text at\n * a fixed share of the width, the value in the text colour, a hairline between rows, no zebra. A\n * native table, so a screen reader reads each value with its key.\n * @example <SpecTable caption=\"Teknik özellikler\" items={[{ label: 'Gerilim', value: '24 V' }, { label: 'Ampul', value: 'H7', isTechnical: true }]} />\n */\nconst SpecTable = ({ items, caption, isCaptionVisible = false, className, testId }: Props) => {\n if (items.length === 0) return null;\n\n return (\n <table className={cx(styles.spec, className)} data-testid={testId}>\n <caption className={cx(styles.spec__caption, !isCaptionVisible && styles.srOnly)}>\n {caption}\n </caption>\n <tbody>\n {items.map(item => (\n <tr key={item.label} className={styles.spec__row}>\n <th scope=\"row\" className={styles.spec__label}>\n {item.label}\n </th>\n <td\n className={cx(\n styles.spec__value,\n item.isTechnical && styles['spec__value--technical'],\n )}\n >\n {item.value}\n </td>\n </tr>\n ))}\n </tbody>\n </table>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(SpecTable, 'SpecTable')) as typeof SpecTable;\n"],"names":["SpecTable","items","caption","isCaptionVisible","className","testId","jsxs","cx","styles","jsx","item","index","memo","named"],"mappings":";;;;;AA8BA,MAAMA,IAAY,CAAC,EAAE,OAAAC,GAAO,SAAAC,GAAS,kBAAAC,IAAmB,IAAO,WAAAC,GAAW,QAAAC,QACpEJ,EAAM,WAAW,IAAU,OAG7B,gBAAAK,EAAC,WAAM,WAAWC,EAAGC,EAAO,MAAMJ,CAAS,GAAG,eAAaC,GACzD,UAAA;AAAA,EAAA,gBAAAI,EAAC,WAAA,EAAQ,WAAWF,EAAGC,EAAO,eAAe,CAACL,KAAoBK,EAAO,MAAM,GAC5E,UAAAN,EAAA,CACH;AAAA,EACA,gBAAAO,EAAC,WACE,UAAAR,EAAM,IAAI,OACT,gBAAAK,EAAC,MAAA,EAAoB,WAAWE,EAAO,WACrC,UAAA;AAAA,IAAA,gBAAAC,EAAC,QAAG,OAAM,OAAM,WAAWD,EAAO,aAC/B,YAAK,MAAA,CACR;AAAA,IACA,gBAAAC;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWF;AAAA,UACTC,EAAO;AAAA,UACPE,EAAK,eAAeF,EAAO,wBAAwB;AAAA,QAAA;AAAA,QAGpD,UAAAE,EAAK;AAAA,MAAA;AAAA,IAAA;AAAA,EACR,KAXOA,EAAK,KAYd,CACD,EAAA,CACH;AAAA,GACF,GAIJC,IAA6B,gBAAAC,EAAmB,gBAAAC,EAAMb,GAAW,WAAW,CAAC;"}
@@ -0,0 +1 @@
1
+ @layer ui{.ui-spec-f8gOH{width:100%;border-collapse:collapse;font-size:var(--hd-type-small-size);line-height:var(--hd-type-body-line-height)}.ui-spec__caption-5uQ30{font-family:var(--hd-font-body);font-size:var(--hd-type-body-size);font-weight:var(--hd-font-weight-semibold);line-height:var(--hd-type-h4-line-height);letter-spacing:normal;color:var(--hd-text);padding-block-end:var(--hd-space-3);text-align:start}.ui-spec__row-H1Mp5{border-block-end:1px solid var(--hd-border)}.ui-spec__row-H1Mp5:last-child{border-block-end:none}.ui-spec__label-PqkyV,.ui-spec__value-3jDI7{padding:var(--hd-space-2) 0;vertical-align:top;text-align:start}.ui-spec__label-PqkyV{width:40%;min-width:9rem;padding-inline-end:var(--hd-space-4);font-weight:var(--hd-font-weight-regular);color:var(--hd-text-2)}.ui-spec__value-3jDI7{min-width:0;font-weight:var(--hd-font-weight-medium);color:var(--hd-text);overflow-wrap:anywhere;font-variant-numeric:tabular-nums}.ui-spec__value--technical-8yySN{font-family:var(--hd-font-mono);font-size:var(--hd-type-small-size);letter-spacing:.02em;font-variant-numeric:tabular-nums}@media (max-width: 640px){.ui-spec__label-PqkyV{width:45%;min-width:0}}.ui-srOnly-UYQ78{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),c=require("react"),n=require("../../helpers/class-name.helper.cjs"),i=require("../../helpers/component.helper.cjs"),u=require("../Tooltip/index.cjs"),l={default:{"cell":"ui-cell-2fptK","flag":"ui-flag-iwCGx","flag--danger":"ui-flag--danger-McGO0","flag--info":"ui-flag--info-LleFX","flag--ink":"ui-flag--ink-Yq0PB"}},d=({status:s,flags:a=[],className:o,testId:r})=>t.jsxs("span",{className:n.cx(l.default.cell,o),"data-testid":r,children:[s,a.map(e=>t.jsx(u.default,{content:e.label,children:t.jsx("span",{role:"img","aria-label":e.label,className:n.cx(l.default.flag,l.default[`flag--${e.tone??"ink"}`]),children:e.icon})},e.id))]}),m=c.memo(i.named(d,"StatusCell"));exports.default=m;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/StatusCell/index.tsx"],"sourcesContent":["import { memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport Tooltip from '../Tooltip';\n\nimport styles from './index.module.scss';\n\n/** `danger` a fault (limit exceeded) · `info` cobalt · `ink` the emphatic neutral (a warning). */\nexport type StatusFlagTone = 'danger' | 'info' | 'ink';\n\n/** A secondary state of a row: an icon with its words in a tooltip and for a screen reader. */\nexport type StatusFlag = {\n id: string;\n icon: ReactNode;\n /** \"Limit aşımı\" — the tooltip and the text a screen reader reads. */\n label: string;\n tone?: StatusFlagTone;\n};\n\ntype Props = {\n /** The one primary state, usually a `Badge` (\"Onay bekliyor\"). */\n status: ReactNode;\n /** Secondary states, as icons after it. */\n flags?: readonly StatusFlag[];\n className?: string;\n testId?: string;\n};\n\n/**\n * StatusCell (3.8) — the status rule of a table: ONE primary state per cell (a badge), any second\n * state (\"Limit aşımı\") an icon with its words in a tooltip. Two stacked badges doubled the row's\n * height and read as two equal states. One line, never wraps.\n * @example <StatusCell status={<Badge tone=\"info\">Onay bekliyor</Badge>} flags={[{ id: 'limit', icon: <ExclamationTriangle />, label: 'Limit aşımı', tone: 'danger' }]} />\n */\nconst StatusCell = ({ status, flags = [], className, testId }: Props) => (\n <span className={cx(styles.cell, className)} data-testid={testId}>\n {status}\n {flags.map(flag => (\n <Tooltip key={flag.id} content={flag.label}>\n <span\n role=\"img\"\n aria-label={flag.label}\n className={cx(styles.flag, styles[`flag--${flag.tone ?? 'ink'}`])}\n >\n {flag.icon}\n </span>\n </Tooltip>\n ))}\n </span>\n);\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(StatusCell, 'StatusCell'),\n) as typeof StatusCell;\n"],"names":["StatusCell","status","flags","className","testId","jsxs","cx","styles","flag","Tooltip","jsx","index","memo","named"],"mappings":"4UAmCMA,EAAa,CAAC,CAAE,OAAAC,EAAQ,MAAAC,EAAQ,CAAA,EAAI,UAAAC,EAAW,OAAAC,CAAA,IACnDC,OAAC,OAAA,CAAK,UAAWC,EAAAA,GAAGC,EAAAA,QAAO,KAAMJ,CAAS,EAAG,cAAaC,EACvD,SAAA,CAAAH,EACAC,EAAM,IAAIM,SACRC,EAAAA,QAAA,CAAsB,QAASD,EAAK,MACnC,SAAAE,EAAAA,IAAC,OAAA,CACC,KAAK,MACL,aAAYF,EAAK,MACjB,UAAWF,EAAAA,GAAGC,UAAO,KAAMA,EAAAA,QAAO,SAASC,EAAK,MAAQ,KAAK,EAAE,CAAC,EAE/D,SAAAA,EAAK,IAAA,CAAA,CACR,EAPYA,EAAK,EAQnB,CACD,CAAA,EACH,EAGFG,EAA6BC,EAAAA,KACbC,EAAAA,MAAMb,EAAY,YAAY,CAC9C"}
@@ -0,0 +1,28 @@
1
+ import { ReactNode } from 'react';
2
+ /** `danger` a fault (limit exceeded) · `info` cobalt · `ink` the emphatic neutral (a warning). */
3
+ export type StatusFlagTone = 'danger' | 'info' | 'ink';
4
+ /** A secondary state of a row: an icon with its words in a tooltip and for a screen reader. */
5
+ export type StatusFlag = {
6
+ id: string;
7
+ icon: ReactNode;
8
+ /** "Limit aşımı" — the tooltip and the text a screen reader reads. */
9
+ label: string;
10
+ tone?: StatusFlagTone;
11
+ };
12
+ type Props = {
13
+ /** The one primary state, usually a `Badge` ("Onay bekliyor"). */
14
+ status: ReactNode;
15
+ /** Secondary states, as icons after it. */
16
+ flags?: readonly StatusFlag[];
17
+ className?: string;
18
+ testId?: string;
19
+ };
20
+ /**
21
+ * StatusCell (3.8) — the status rule of a table: ONE primary state per cell (a badge), any second
22
+ * state ("Limit aşımı") an icon with its words in a tooltip. Two stacked badges doubled the row's
23
+ * height and read as two equal states. One line, never wraps.
24
+ * @example <StatusCell status={<Badge tone="info">Onay bekliyor</Badge>} flags={[{ id: 'limit', icon: <ExclamationTriangle />, label: 'Limit aşımı', tone: 'danger' }]} />
25
+ */
26
+ declare const StatusCell: ({ status, flags, className, testId }: Props) => import("react").JSX.Element;
27
+ declare const _default: typeof StatusCell;
28
+ export default _default;
@@ -0,0 +1,28 @@
1
+ import { ReactNode } from 'react';
2
+ /** `danger` a fault (limit exceeded) · `info` cobalt · `ink` the emphatic neutral (a warning). */
3
+ export type StatusFlagTone = 'danger' | 'info' | 'ink';
4
+ /** A secondary state of a row: an icon with its words in a tooltip and for a screen reader. */
5
+ export type StatusFlag = {
6
+ id: string;
7
+ icon: ReactNode;
8
+ /** "Limit aşımı" — the tooltip and the text a screen reader reads. */
9
+ label: string;
10
+ tone?: StatusFlagTone;
11
+ };
12
+ type Props = {
13
+ /** The one primary state, usually a `Badge` ("Onay bekliyor"). */
14
+ status: ReactNode;
15
+ /** Secondary states, as icons after it. */
16
+ flags?: readonly StatusFlag[];
17
+ className?: string;
18
+ testId?: string;
19
+ };
20
+ /**
21
+ * StatusCell (3.8) — the status rule of a table: ONE primary state per cell (a badge), any second
22
+ * state ("Limit aşımı") an icon with its words in a tooltip. Two stacked badges doubled the row's
23
+ * height and read as two equal states. One line, never wraps.
24
+ * @example <StatusCell status={<Badge tone="info">Onay bekliyor</Badge>} flags={[{ id: 'limit', icon: <ExclamationTriangle />, label: 'Limit aşımı', tone: 'danger' }]} />
25
+ */
26
+ declare const StatusCell: ({ status, flags, className, testId }: Props) => import("react").JSX.Element;
27
+ declare const _default: typeof StatusCell;
28
+ export default _default;
@@ -0,0 +1,24 @@
1
+ import { jsxs as s, jsx as e } from "react/jsx-runtime";
2
+ import { memo as n } from "react";
3
+ import { cx as l } from "../../helpers/class-name.helper.js";
4
+ import { named as c } from "../../helpers/component.helper.js";
5
+ import p from "../Tooltip/index.js";
6
+ const t = {"cell":"ui-cell-2fptK","flag":"ui-flag-iwCGx","flag--danger":"ui-flag--danger-McGO0","flag--info":"ui-flag--info-LleFX","flag--ink":"ui-flag--ink-Yq0PB"};
7
+ const d = ({ status: m, flags: r = [], className: a, testId: i }) => /* @__PURE__ */ s("span", { className: l(t.cell, a), "data-testid": i, children: [
8
+ m,
9
+ r.map((o) => /* @__PURE__ */ e(p, { content: o.label, children: /* @__PURE__ */ e(
10
+ "span",
11
+ {
12
+ role: "img",
13
+ "aria-label": o.label,
14
+ className: l(t.flag, t[`flag--${o.tone ?? "ink"}`]),
15
+ children: o.icon
16
+ }
17
+ ) }, o.id))
18
+ ] }), C = /* @__PURE__ */ n(
19
+ /* @__PURE__ */ c(d, "StatusCell")
20
+ );
21
+ export {
22
+ C as default
23
+ };
24
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sources":["../../../src/components/StatusCell/index.tsx"],"sourcesContent":["import { memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport Tooltip from '../Tooltip';\n\nimport styles from './index.module.scss';\n\n/** `danger` a fault (limit exceeded) · `info` cobalt · `ink` the emphatic neutral (a warning). */\nexport type StatusFlagTone = 'danger' | 'info' | 'ink';\n\n/** A secondary state of a row: an icon with its words in a tooltip and for a screen reader. */\nexport type StatusFlag = {\n id: string;\n icon: ReactNode;\n /** \"Limit aşımı\" — the tooltip and the text a screen reader reads. */\n label: string;\n tone?: StatusFlagTone;\n};\n\ntype Props = {\n /** The one primary state, usually a `Badge` (\"Onay bekliyor\"). */\n status: ReactNode;\n /** Secondary states, as icons after it. */\n flags?: readonly StatusFlag[];\n className?: string;\n testId?: string;\n};\n\n/**\n * StatusCell (3.8) — the status rule of a table: ONE primary state per cell (a badge), any second\n * state (\"Limit aşımı\") an icon with its words in a tooltip. Two stacked badges doubled the row's\n * height and read as two equal states. One line, never wraps.\n * @example <StatusCell status={<Badge tone=\"info\">Onay bekliyor</Badge>} flags={[{ id: 'limit', icon: <ExclamationTriangle />, label: 'Limit aşımı', tone: 'danger' }]} />\n */\nconst StatusCell = ({ status, flags = [], className, testId }: Props) => (\n <span className={cx(styles.cell, className)} data-testid={testId}>\n {status}\n {flags.map(flag => (\n <Tooltip key={flag.id} content={flag.label}>\n <span\n role=\"img\"\n aria-label={flag.label}\n className={cx(styles.flag, styles[`flag--${flag.tone ?? 'ink'}`])}\n >\n {flag.icon}\n </span>\n </Tooltip>\n ))}\n </span>\n);\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(StatusCell, 'StatusCell'),\n) as typeof StatusCell;\n"],"names":["StatusCell","status","flags","className","testId","jsxs","cx","styles","flag","Tooltip","jsx","index","memo","named"],"mappings":";;;;;;AAmCA,MAAMA,IAAa,CAAC,EAAE,QAAAC,GAAQ,OAAAC,IAAQ,CAAA,GAAI,WAAAC,GAAW,QAAAC,EAAA,MACnD,gBAAAC,EAAC,QAAA,EAAK,WAAWC,EAAGC,EAAO,MAAMJ,CAAS,GAAG,eAAaC,GACvD,UAAA;AAAA,EAAAH;AAAA,EACAC,EAAM,IAAI,CAAAM,wBACRC,GAAA,EAAsB,SAASD,EAAK,OACnC,UAAA,gBAAAE;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,MAAK;AAAA,MACL,cAAYF,EAAK;AAAA,MACjB,WAAWF,EAAGC,EAAO,MAAMA,EAAO,SAASC,EAAK,QAAQ,KAAK,EAAE,CAAC;AAAA,MAE/D,UAAAA,EAAK;AAAA,IAAA;AAAA,EAAA,EACR,GAPYA,EAAK,EAQnB,CACD;AAAA,GACH,GAGFG,IAA6B,gBAAAC;AAAA,EACb,gBAAAC,EAAMb,GAAY,YAAY;AAC9C;"}
@@ -0,0 +1 @@
1
+ @layer ui{.ui-cell-2fptK{display:inline-flex;align-items:center;gap:var(--hd-space-2);max-width:100%;white-space:nowrap}.ui-flag-iwCGx{display:inline-flex;flex-shrink:0;font-size:16px}.ui-flag-iwCGx>svg{display:block}.ui-flag--danger-McGO0{color:var(--hd-danger-fg)}.ui-flag--info-LleFX{color:var(--hd-info-fg)}.ui-flag--ink-Yq0PB{color:var(--hd-text-2)}}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react"),i=require("../../helpers/class-name.helper.cjs"),_=require("../../helpers/component.helper.cjs"),m=require("../Tooltip/index.cjs"),s={default:{"stock":"ui-stock-5lVkX","stock__dot":"ui-stock__dot-UjW-T","stock__label":"ui-stock__label-TQ5Ci","stock--available":"ui-stock--available-7dfJO","stock--limited":"ui-stock--limited-ZN9v8","stock--unavailable":"ui-stock--unavailable-8qF7O","breakdown":"ui-breakdown-q7J66","breakdown__row":"ui-breakdown__row-TlBme","breakdown__value":"ui-breakdown__value-jKf9J"}},p=({tone:r,label:a,breakdown:n=[],className:o,testId:d})=>{const l=n.length>0,c=e.jsxs("span",{className:i.cx(s.default.stock,s.default[`stock--${r}`],o),title:l?void 0:a,"data-testid":d,children:[e.jsx("span",{"aria-hidden":!0,className:s.default.stock__dot}),e.jsx("span",{className:s.default.stock__label,children:a})]});return l?e.jsx(m.default,{content:e.jsx("span",{className:s.default.breakdown,children:n.map(t=>e.jsxs("span",{className:s.default.breakdown__row,children:[e.jsx("span",{children:t.label}),e.jsx("span",{className:s.default.breakdown__value,children:t.value})]},t.label))}),children:c}):c},x=u.memo(_.named(p,"StockStatus"));exports.default=x;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.cjs","sources":["../../../src/components/StockStatus/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 Tooltip from '../Tooltip';\n\nimport styles from './index.module.scss';\n\n/**\n * `available` in stock (cobalt, a filled dot) · `limited` low or on supply (ink, a ring) ·\n * `unavailable` out of stock (red, a filled dot). The shape and the words carry it as well.\n */\nexport type StockTone = 'available' | 'limited' | 'unavailable';\n\n/** One line of the warehouse breakdown: \"İstanbul\" · \"24\". */\nexport type StockBreakdownItem = { label: string; value: ReactNode };\n\ntype Props = {\n tone: StockTone;\n /** The words: \"Stokta (24)\", \"Son 3 adet\", \"2 günde tedarik\", \"Stokta yok\". */\n label: string;\n /** Per-warehouse stock, shown in a tooltip on the status (hover, focus, long press). */\n breakdown?: StockBreakdownItem[];\n className?: string;\n testId?: string;\n};\n\n/**\n * StockStatus (3.8) — a stock state in colour, shape AND words, on one line: a dot and the label,\n * with the warehouse breakdown in a tooltip. The same in a card, a table row and a product page.\n * @example <StockStatus tone=\"available\" label=\"Stokta (24)\" breakdown={[{ label: 'İstanbul', value: 20 }, { label: 'Ankara', value: 4 }]} />\n */\nconst StockStatus: FC<Props> = ({ tone, label, breakdown = [], className, testId }) => {\n const hasBreakdown = breakdown.length > 0;\n const status = (\n <span\n className={cx(styles.stock, styles[`stock--${tone}`], className)}\n title={hasBreakdown ? undefined : label}\n data-testid={testId}\n >\n <span aria-hidden className={styles.stock__dot} />\n <span className={styles.stock__label}>{label}</span>\n </span>\n );\n\n if (!hasBreakdown) return status;\n\n return (\n <Tooltip\n content={\n <span className={styles.breakdown}>\n {breakdown.map(item => (\n <span key={item.label} className={styles.breakdown__row}>\n <span>{item.label}</span>\n <span className={styles.breakdown__value}>{item.value}</span>\n </span>\n ))}\n </span>\n }\n >\n {status}\n </Tooltip>\n );\n};\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(StockStatus, 'StockStatus'),\n) as typeof StockStatus;\n"],"names":["StockStatus","tone","label","breakdown","className","testId","hasBreakdown","status","jsxs","cx","styles","jsx","Tooltip","item","index","memo","named"],"mappings":"4UAgCMA,EAAyB,CAAC,CAAE,KAAAC,EAAM,MAAAC,EAAO,UAAAC,EAAY,GAAI,UAAAC,EAAW,OAAAC,KAAa,CACrF,MAAMC,EAAeH,EAAU,OAAS,EAClCI,EACJC,EAAAA,KAAC,OAAA,CACC,UAAWC,EAAAA,GAAGC,EAAAA,QAAO,MAAOA,EAAAA,QAAO,UAAUT,CAAI,EAAE,EAAGG,CAAS,EAC/D,MAAOE,EAAe,OAAYJ,EAClC,cAAaG,EAEb,SAAA,CAAAM,EAAAA,IAAC,OAAA,CAAK,cAAW,GAAC,UAAWD,EAAAA,QAAO,WAAY,EAChDC,EAAAA,IAAC,OAAA,CAAK,UAAWD,EAAAA,QAAO,aAAe,SAAAR,CAAA,CAAM,CAAA,CAAA,CAAA,EAIjD,OAAKI,EAGHK,EAAAA,IAACC,EAAAA,QAAA,CACC,QACED,EAAAA,IAAC,OAAA,CAAK,UAAWD,UAAO,UACrB,SAAAP,EAAU,IAAIU,GACbL,EAAAA,KAAC,OAAA,CAAsB,UAAWE,EAAAA,QAAO,eACvC,SAAA,CAAAC,EAAAA,IAAC,OAAA,CAAM,WAAK,KAAA,CAAM,QACjB,OAAA,CAAK,UAAWD,EAAAA,QAAO,iBAAmB,WAAK,KAAA,CAAM,CAAA,CAAA,EAF7CG,EAAK,KAGhB,CACD,EACH,EAGD,SAAAN,CAAA,CAAA,EAfqBA,CAkB5B,EAEAO,EAA6BC,EAAAA,KACbC,EAAAA,MAAMhB,EAAa,aAAa,CAChD"}
@@ -0,0 +1,28 @@
1
+ import { FC, ReactNode } from 'react';
2
+ /**
3
+ * `available` in stock (cobalt, a filled dot) · `limited` low or on supply (ink, a ring) ·
4
+ * `unavailable` out of stock (red, a filled dot). The shape and the words carry it as well.
5
+ */
6
+ export type StockTone = 'available' | 'limited' | 'unavailable';
7
+ /** One line of the warehouse breakdown: "İstanbul" · "24". */
8
+ export type StockBreakdownItem = {
9
+ label: string;
10
+ value: ReactNode;
11
+ };
12
+ type Props = {
13
+ tone: StockTone;
14
+ /** The words: "Stokta (24)", "Son 3 adet", "2 günde tedarik", "Stokta yok". */
15
+ label: string;
16
+ /** Per-warehouse stock, shown in a tooltip on the status (hover, focus, long press). */
17
+ breakdown?: StockBreakdownItem[];
18
+ className?: string;
19
+ testId?: string;
20
+ };
21
+ /**
22
+ * StockStatus (3.8) — a stock state in colour, shape AND words, on one line: a dot and the label,
23
+ * with the warehouse breakdown in a tooltip. The same in a card, a table row and a product page.
24
+ * @example <StockStatus tone="available" label="Stokta (24)" breakdown={[{ label: 'İstanbul', value: 20 }, { label: 'Ankara', value: 4 }]} />
25
+ */
26
+ declare const StockStatus: FC<Props>;
27
+ declare const _default: typeof StockStatus;
28
+ export default _default;
@@ -0,0 +1,28 @@
1
+ import { FC, ReactNode } from 'react';
2
+ /**
3
+ * `available` in stock (cobalt, a filled dot) · `limited` low or on supply (ink, a ring) ·
4
+ * `unavailable` out of stock (red, a filled dot). The shape and the words carry it as well.
5
+ */
6
+ export type StockTone = 'available' | 'limited' | 'unavailable';
7
+ /** One line of the warehouse breakdown: "İstanbul" · "24". */
8
+ export type StockBreakdownItem = {
9
+ label: string;
10
+ value: ReactNode;
11
+ };
12
+ type Props = {
13
+ tone: StockTone;
14
+ /** The words: "Stokta (24)", "Son 3 adet", "2 günde tedarik", "Stokta yok". */
15
+ label: string;
16
+ /** Per-warehouse stock, shown in a tooltip on the status (hover, focus, long press). */
17
+ breakdown?: StockBreakdownItem[];
18
+ className?: string;
19
+ testId?: string;
20
+ };
21
+ /**
22
+ * StockStatus (3.8) — a stock state in colour, shape AND words, on one line: a dot and the label,
23
+ * with the warehouse breakdown in a tooltip. The same in a card, a table row and a product page.
24
+ * @example <StockStatus tone="available" label="Stokta (24)" breakdown={[{ label: 'İstanbul', value: 20 }, { label: 'Ankara', value: 4 }]} />
25
+ */
26
+ declare const StockStatus: FC<Props>;
27
+ declare const _default: typeof StockStatus;
28
+ export default _default;