@handijitcom/ui 3.6.1 → 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.
- package/README.md +275 -36
- package/build/chat.cjs +3 -3
- package/build/chat.cjs.map +1 -1
- package/build/chat.css +1 -1
- package/build/chat.js +168 -160
- package/build/chat.js.map +1 -1
- package/build/components/AddToCart/index.cjs +2 -0
- package/build/components/AddToCart/index.cjs.map +1 -0
- package/build/components/AddToCart/index.d.cts +31 -0
- package/build/components/AddToCart/index.d.ts +31 -0
- package/build/components/AddToCart/index.js +62 -0
- package/build/components/AddToCart/index.js.map +1 -0
- package/build/components/AddToCart/style.css +1 -0
- package/build/components/Alert/index.cjs +1 -1
- package/build/components/Alert/index.cjs.map +1 -1
- package/build/components/Alert/index.d.cts +7 -0
- package/build/components/Alert/index.d.ts +7 -0
- package/build/components/Alert/index.js +32 -19
- package/build/components/Alert/index.js.map +1 -1
- package/build/components/Alert/style.css +1 -1
- package/build/components/AppShell/style.css +1 -1
- package/build/components/AppliedFilters/style.css +1 -1
- package/build/components/CodeText/index.cjs.map +1 -1
- package/build/components/CodeText/index.js +11 -11
- package/build/components/CodeText/index.js.map +1 -1
- package/build/components/CommandPalette/style.css +1 -1
- package/build/components/Directory/style.css +1 -1
- package/build/components/EmptyState/style.css +1 -1
- package/build/components/FacetSection/index.cjs +1 -1
- package/build/components/FacetSection/index.cjs.map +1 -1
- package/build/components/FacetSection/index.js +145 -138
- package/build/components/FacetSection/index.js.map +1 -1
- package/build/components/FacetSection/style.css +1 -1
- package/build/components/FacetSidebar/index.cjs +1 -1
- package/build/components/FacetSidebar/index.cjs.map +1 -1
- package/build/components/FacetSidebar/index.js +22 -29
- package/build/components/FacetSidebar/index.js.map +1 -1
- package/build/components/Heading/index.cjs +2 -0
- package/build/components/Heading/index.cjs.map +1 -0
- package/build/components/Heading/index.d.cts +34 -0
- package/build/components/Heading/index.d.ts +34 -0
- package/build/components/Heading/index.js +44 -0
- package/build/components/Heading/index.js.map +1 -0
- package/build/components/Heading/style.css +1 -0
- package/build/components/MegaMenu/index.cjs +1 -1
- package/build/components/MegaMenu/index.cjs.map +1 -1
- package/build/components/MegaMenu/index.d.cts +5 -1
- package/build/components/MegaMenu/index.d.ts +5 -1
- package/build/components/MegaMenu/index.js +131 -111
- package/build/components/MegaMenu/index.js.map +1 -1
- package/build/components/MegaMenu/style.css +1 -1
- package/build/components/Modal/style.css +1 -1
- package/build/components/NotificationCenter/style.css +1 -1
- package/build/components/PageHeader/style.css +1 -1
- package/build/components/PartNumberList/index.cjs +2 -0
- package/build/components/PartNumberList/index.cjs.map +1 -0
- package/build/components/PartNumberList/index.d.cts +30 -0
- package/build/components/PartNumberList/index.d.ts +30 -0
- package/build/components/PartNumberList/index.js +36 -0
- package/build/components/PartNumberList/index.js.map +1 -0
- package/build/components/PartNumberList/style.css +1 -0
- package/build/components/Price/index.cjs +1 -1
- package/build/components/Price/index.cjs.map +1 -1
- package/build/components/Price/index.d.cts +5 -1
- package/build/components/Price/index.d.ts +5 -1
- package/build/components/Price/index.js +31 -32
- package/build/components/Price/index.js.map +1 -1
- package/build/components/Price/style.css +1 -1
- package/build/components/ProductCard/index.cjs +2 -0
- package/build/components/ProductCard/index.cjs.map +1 -0
- package/build/components/ProductCard/index.d.cts +55 -0
- package/build/components/ProductCard/index.d.ts +55 -0
- package/build/components/ProductCard/index.js +58 -0
- package/build/components/ProductCard/index.js.map +1 -0
- package/build/components/ProductCard/style.css +1 -0
- package/build/components/ProductRow/columns.cjs +2 -0
- package/build/components/ProductRow/columns.cjs.map +1 -0
- package/build/components/ProductRow/columns.d.cts +27 -0
- package/build/components/ProductRow/columns.d.ts +27 -0
- package/build/components/ProductRow/columns.js +83 -0
- package/build/components/ProductRow/columns.js.map +1 -0
- package/build/components/ProductRow/index.cjs +2 -0
- package/build/components/ProductRow/index.cjs.map +1 -0
- package/build/components/ProductRow/index.d.cts +25 -0
- package/build/components/ProductRow/index.d.ts +25 -0
- package/build/components/ProductRow/index.js +43 -0
- package/build/components/ProductRow/index.js.map +1 -0
- package/build/components/ProductRow/parts.cjs +2 -0
- package/build/components/ProductRow/parts.cjs.map +1 -0
- package/build/components/ProductRow/parts.d.cts +32 -0
- package/build/components/ProductRow/parts.d.ts +32 -0
- package/build/components/ProductRow/parts.js +31 -0
- package/build/components/ProductRow/parts.js.map +1 -0
- package/build/components/ProductRow/style.css +1 -0
- package/build/components/QuantityStepper/index.cjs +1 -1
- package/build/components/QuantityStepper/index.cjs.map +1 -1
- package/build/components/QuantityStepper/index.js +28 -28
- package/build/components/QuantityStepper/index.js.map +1 -1
- package/build/components/Radio/style.css +1 -1
- package/build/components/SectionHeader/style.css +1 -1
- package/build/components/SpecTable/index.cjs +2 -0
- package/build/components/SpecTable/index.cjs.map +1 -0
- package/build/components/SpecTable/index.d.cts +25 -0
- package/build/components/SpecTable/index.d.ts +25 -0
- package/build/components/SpecTable/index.js +25 -0
- package/build/components/SpecTable/index.js.map +1 -0
- package/build/components/SpecTable/style.css +1 -0
- package/build/components/Stat/index.cjs +1 -1
- package/build/components/Stat/index.cjs.map +1 -1
- package/build/components/Stat/index.d.cts +7 -3
- package/build/components/Stat/index.d.ts +7 -3
- package/build/components/Stat/index.js +61 -66
- package/build/components/Stat/index.js.map +1 -1
- package/build/components/StatCard/StatDelta.cjs +2 -0
- package/build/components/StatCard/StatDelta.cjs.map +1 -0
- package/build/components/StatCard/StatDelta.d.cts +17 -0
- package/build/components/StatCard/StatDelta.d.ts +17 -0
- package/build/components/StatCard/StatDelta.js +45 -0
- package/build/components/StatCard/StatDelta.js.map +1 -0
- package/build/components/StatCard/index.cjs +2 -0
- package/build/components/StatCard/index.cjs.map +1 -0
- package/build/components/StatCard/index.d.cts +36 -0
- package/build/components/StatCard/index.d.ts +36 -0
- package/build/components/StatCard/index.js +60 -0
- package/build/components/StatCard/index.js.map +1 -0
- package/build/components/StatCard/style.css +1 -0
- package/build/components/StatusCell/index.cjs +2 -0
- package/build/components/StatusCell/index.cjs.map +1 -0
- package/build/components/StatusCell/index.d.cts +28 -0
- package/build/components/StatusCell/index.d.ts +28 -0
- package/build/components/StatusCell/index.js +24 -0
- package/build/components/StatusCell/index.js.map +1 -0
- package/build/components/StatusCell/style.css +1 -0
- package/build/components/StockStatus/index.cjs +2 -0
- package/build/components/StockStatus/index.cjs.map +1 -0
- package/build/components/StockStatus/index.d.cts +28 -0
- package/build/components/StockStatus/index.d.ts +28 -0
- package/build/components/StockStatus/index.js +36 -0
- package/build/components/StockStatus/index.js.map +1 -0
- package/build/components/StockStatus/style.css +1 -0
- package/build/components/Table/style.css +1 -1
- package/build/components/Tabs/index.cjs +1 -1
- package/build/components/Tabs/index.cjs.map +1 -1
- package/build/components/Tabs/index.d.cts +26 -1
- package/build/components/Tabs/index.d.ts +26 -1
- package/build/components/Tabs/index.js +140 -112
- package/build/components/Tabs/index.js.map +1 -1
- package/build/components/Tabs/style.css +1 -1
- package/build/components/Text/index.cjs +2 -0
- package/build/components/Text/index.cjs.map +1 -0
- package/build/components/Text/index.d.cts +49 -0
- package/build/components/Text/index.d.ts +49 -0
- package/build/components/Text/index.js +47 -0
- package/build/components/Text/index.js.map +1 -0
- package/build/components/Text/style.css +1 -0
- package/build/components/Tooltip/index.cjs +1 -1
- package/build/components/Tooltip/index.cjs.map +1 -1
- package/build/components/Tooltip/index.js +27 -27
- package/build/components/Tooltip/index.js.map +1 -1
- package/build/components/VehicleTypeList/index.cjs +2 -0
- package/build/components/VehicleTypeList/index.cjs.map +1 -0
- package/build/components/VehicleTypeList/index.d.cts +17 -0
- package/build/components/VehicleTypeList/index.d.ts +17 -0
- package/build/components/VehicleTypeList/index.js +47 -0
- package/build/components/VehicleTypeList/index.js.map +1 -0
- package/build/components/VehicleTypeList/style.css +1 -0
- package/build/design/index.cjs +12 -2
- package/build/design/index.cjs.map +1 -1
- package/build/design/index.d.cts +1 -5
- package/build/design/index.d.mts +1 -5
- package/build/design/index.mjs +12 -2
- package/build/design/index.mjs.map +1 -1
- package/build/design/index.umd.cjs +1 -1
- package/build/design/index.umd.cjs.map +1 -1
- package/build/design/tokens.css +29 -4
- package/build/design/tokens.json +42 -2
- package/build/design/tokens.scss +55 -0
- package/build/helpers/text.helper.cjs +1 -1
- package/build/helpers/text.helper.cjs.map +1 -1
- package/build/helpers/text.helper.d.cts +5 -0
- package/build/helpers/text.helper.d.ts +5 -0
- package/build/helpers/text.helper.js +3 -2
- package/build/helpers/text.helper.js.map +1 -1
- package/build/index.cjs +1 -1
- package/build/index.d.cts +13 -2
- package/build/index.d.ts +13 -2
- package/build/index.js +203 -179
- package/build/index.js.map +1 -1
- package/build/scss/_mixins.scss +101 -13
- package/build/scss/_variables.scss +5 -1
- package/build/styles.css +43 -17
- package/build/types/chat/DescriptionList/index.d.cts +6 -0
- package/build/types/chat/DescriptionList/index.d.ts +6 -0
- package/build/types/stat.type.d.cts +2 -0
- package/build/types/stat.type.d.ts +2 -0
- package/build/types/theme.type.d.cts +25 -0
- package/build/types/theme.type.d.ts +25 -0
- package/build/types/types/theme.type.d.cts +25 -0
- package/build/types/types/theme.type.d.ts +25 -0
- package/package.json +111 -1
|
@@ -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,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),u=require("react"),r=require("react-bootstrap-icons"),o=require("../../helpers/class-name.helper.cjs"),a={default:{"alert":"ui-alert-gHI-9","alert__icon":"ui-alert__icon-DhiCT","alert__body":"ui-alert__body-52-z2","alert__text":"ui-alert__text-Slmxh","alert__title":"ui-alert__title-I8BAh","alert__content":"ui-alert__content-lhBEo","alert__action":"ui-alert__action-1mTje","alert--info":"ui-alert--info-lsAVw","alert--success":"ui-alert--success-RMJR6","alert--warning":"ui-alert--warning-Rkgln","alert--danger":"ui-alert--danger-9ei0Y","alert--inline":"ui-alert--inline-QAaJc"}},x={info:e.jsx(r.InfoCircleFill,{"aria-hidden":!0}),success:e.jsx(r.CheckCircleFill,{"aria-hidden":!0}),warning:e.jsx(r.ExclamationTriangleFill,{"aria-hidden":!0}),danger:e.jsx(r.XCircleFill,{"aria-hidden":!0})},_=({children:t,tone:l="info",title:i,action:s,variant:d="box",className:n,testId:c})=>e.jsxs("div",{className:o.cx(a.default.alert,a.default[`alert--${l}`],d==="inline"&&a.default["alert--inline"],n),role:l==="danger"||l==="warning"?"alert":void 0,"data-testid":c,children:[e.jsx("span",{className:a.default.alert__icon,children:x[l]}),e.jsxs("div",{className:a.default.alert__body,children:[e.jsxs("div",{className:a.default.alert__text,children:[i&&e.jsx("strong",{className:a.default.alert__title,children:i}),e.jsx("div",{className:a.default.alert__content,children:t})]}),s&&e.jsx("div",{className:a.default.alert__action,children:s})]})]}),f=u.memo(_);exports.default=f;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/Alert/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport {\n CheckCircleFill,\n ExclamationTriangleFill,\n InfoCircleFill,\n XCircleFill,\n} from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\n\nimport styles from './index.module.scss';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\ntype Props = {\n children: ReactNode;\n tone?: AlertTone;\n title?: string;\n /** Sağda gösterilen eylem (bağlantı veya düğme). */\n action?: ReactNode;\n className?: string;\n testId?: string;\n};\n\n/** Her tona kendi ikonu; renk tek başına anlam taşımaz (WCAG 1.4.1). */\nconst ICONS: Record<AlertTone, ReactNode> = {\n info: <InfoCircleFill aria-hidden />,\n success: <CheckCircleFill aria-hidden />,\n warning: <ExclamationTriangleFill aria-hidden />,\n danger: <XCircleFill aria-hidden />,\n};\n\n/** Bilgi / uyarı kutusu. */\nconst Alert: FC<Props> = ({
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/Alert/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport {\n CheckCircleFill,\n ExclamationTriangleFill,\n InfoCircleFill,\n XCircleFill,\n} from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\n\nimport styles from './index.module.scss';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * `box` (default) a tinted, framed box on the page or in a column. `inline` (3.7) the tint without\n * its frame and with tighter padding: a note INSIDE a card or a panel, where a framed box drew a\n * border inside a border.\n */\nexport type AlertVariant = 'box' | 'inline';\n\ntype Props = {\n children: ReactNode;\n tone?: AlertTone;\n title?: string;\n /** Sağda gösterilen eylem (bağlantı veya düğme). */\n action?: ReactNode;\n variant?: AlertVariant;\n className?: string;\n testId?: string;\n};\n\n/** Her tona kendi ikonu; renk tek başına anlam taşımaz (WCAG 1.4.1). */\nconst ICONS: Record<AlertTone, ReactNode> = {\n info: <InfoCircleFill aria-hidden />,\n success: <CheckCircleFill aria-hidden />,\n warning: <ExclamationTriangleFill aria-hidden />,\n danger: <XCircleFill aria-hidden />,\n};\n\n/** Bilgi / uyarı kutusu. */\nconst Alert: FC<Props> = ({\n children,\n tone = 'info',\n title,\n action,\n variant = 'box',\n className,\n testId,\n}) => (\n <div\n className={cx(\n styles.alert,\n styles[`alert--${tone}`],\n variant === 'inline' && styles['alert--inline'],\n className,\n )}\n role={tone === 'danger' || tone === 'warning' ? 'alert' : undefined}\n data-testid={testId}\n >\n <span className={styles.alert__icon}>{ICONS[tone]}</span>\n\n {/*\n * 2.2: the action sits INSIDE the body, beside the text while there is room for both and under\n * it, aligned with the text, when there is not. As a third flex item it kept its width and\n * squeezed the text into a narrow column in a narrow container (a paywall card, a sidebar).\n */}\n <div className={styles.alert__body}>\n <div className={styles.alert__text}>\n {title && <strong className={styles.alert__title}>{title}</strong>}\n <div className={styles.alert__content}>{children}</div>\n </div>\n\n {action && <div className={styles.alert__action}>{action}</div>}\n </div>\n </div>\n);\n\nexport default /*#__PURE__*/ memo(Alert) as typeof Alert;\n"],"names":["ICONS","jsx","InfoCircleFill","CheckCircleFill","ExclamationTriangleFill","XCircleFill","Alert","children","tone","title","action","variant","className","testId","jsxs","cx","styles","index"],"mappings":"6RAkCMA,EAAsC,CAC1C,KAAMC,EAAAA,IAACC,EAAAA,eAAA,CAAe,cAAW,EAAA,CAAC,EAClC,QAASD,EAAAA,IAACE,EAAAA,gBAAA,CAAgB,cAAW,EAAA,CAAC,EACtC,QAASF,EAAAA,IAACG,EAAAA,wBAAA,CAAwB,cAAW,EAAA,CAAC,EAC9C,OAAQH,EAAAA,IAACI,EAAAA,YAAA,CAAY,cAAW,EAAA,CAAC,CACnC,EAGMC,EAAmB,CAAC,CACxB,SAAAC,EACA,KAAAC,EAAO,OACP,MAAAC,EACA,OAAAC,EACA,QAAAC,EAAU,MACV,UAAAC,EACA,OAAAC,CACF,IACEC,EAAAA,KAAC,MAAA,CACC,UAAWC,EAAAA,GACTC,EAAAA,QAAO,MACPA,EAAAA,QAAO,UAAUR,CAAI,EAAE,EACvBG,IAAY,UAAYK,EAAAA,QAAO,eAAe,EAC9CJ,CAAA,EAEF,KAAMJ,IAAS,UAAYA,IAAS,UAAY,QAAU,OAC1D,cAAaK,EAEb,SAAA,CAAAZ,MAAC,QAAK,UAAWe,EAAAA,QAAO,YAAc,SAAAhB,EAAMQ,CAAI,EAAE,EAOlDM,EAAAA,KAAC,MAAA,CAAI,UAAWE,EAAAA,QAAO,YACrB,SAAA,CAAAF,EAAAA,KAAC,MAAA,CAAI,UAAWE,EAAAA,QAAO,YACpB,SAAA,CAAAP,GAASR,EAAAA,IAAC,SAAA,CAAO,UAAWe,EAAAA,QAAO,aAAe,SAAAP,EAAM,EACzDR,EAAAA,IAAC,MAAA,CAAI,UAAWe,EAAAA,QAAO,eAAiB,SAAAT,CAAA,CAAS,CAAA,EACnD,EAECG,GAAUT,EAAAA,IAAC,MAAA,CAAI,UAAWe,EAAAA,QAAO,cAAgB,SAAAN,CAAA,CAAO,CAAA,CAAA,CAC3D,CAAA,CAAA,CACF,EAGFO,SAAkCX,CAAK"}
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
export type AlertTone = 'info' | 'success' | 'warning' | 'danger';
|
|
3
|
+
/**
|
|
4
|
+
* `box` (default) a tinted, framed box on the page or in a column. `inline` (3.7) the tint without
|
|
5
|
+
* its frame and with tighter padding: a note INSIDE a card or a panel, where a framed box drew a
|
|
6
|
+
* border inside a border.
|
|
7
|
+
*/
|
|
8
|
+
export type AlertVariant = 'box' | 'inline';
|
|
3
9
|
type Props = {
|
|
4
10
|
children: ReactNode;
|
|
5
11
|
tone?: AlertTone;
|
|
6
12
|
title?: string;
|
|
7
13
|
/** Sağda gösterilen eylem (bağlantı veya düğme). */
|
|
8
14
|
action?: ReactNode;
|
|
15
|
+
variant?: AlertVariant;
|
|
9
16
|
className?: string;
|
|
10
17
|
testId?: string;
|
|
11
18
|
};
|
|
@@ -1,11 +1,18 @@
|
|
|
1
1
|
import { FC, ReactNode } from 'react';
|
|
2
2
|
export type AlertTone = 'info' | 'success' | 'warning' | 'danger';
|
|
3
|
+
/**
|
|
4
|
+
* `box` (default) a tinted, framed box on the page or in a column. `inline` (3.7) the tint without
|
|
5
|
+
* its frame and with tighter padding: a note INSIDE a card or a panel, where a framed box drew a
|
|
6
|
+
* border inside a border.
|
|
7
|
+
*/
|
|
8
|
+
export type AlertVariant = 'box' | 'inline';
|
|
3
9
|
type Props = {
|
|
4
10
|
children: ReactNode;
|
|
5
11
|
tone?: AlertTone;
|
|
6
12
|
title?: string;
|
|
7
13
|
/** Sağda gösterilen eylem (bağlantı veya düğme). */
|
|
8
14
|
action?: ReactNode;
|
|
15
|
+
variant?: AlertVariant;
|
|
9
16
|
className?: string;
|
|
10
17
|
testId?: string;
|
|
11
18
|
};
|
|
@@ -1,32 +1,45 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { XCircleFill as
|
|
4
|
-
import { cx as
|
|
5
|
-
const e = {"alert":"ui-alert-gHI-9","alert__icon":"ui-alert__icon-DhiCT","alert__body":"ui-alert__body-52-z2","alert__text":"ui-alert__text-Slmxh","alert__title":"ui-alert__title-I8BAh","alert__content":"ui-alert__content-lhBEo","alert__action":"ui-alert__action-1mTje","alert--info":"ui-alert--info-lsAVw","alert--success":"ui-alert--success-RMJR6","alert--warning":"ui-alert--warning-Rkgln","alert--danger":"ui-alert--danger-9ei0Y"};
|
|
1
|
+
import { jsxs as a, jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { memo as o } from "react";
|
|
3
|
+
import { XCircleFill as m, ExclamationTriangleFill as _, CheckCircleFill as h, InfoCircleFill as f } from "react-bootstrap-icons";
|
|
4
|
+
import { cx as x } from "../../helpers/class-name.helper.js";
|
|
5
|
+
const e = {"alert":"ui-alert-gHI-9","alert__icon":"ui-alert__icon-DhiCT","alert__body":"ui-alert__body-52-z2","alert__text":"ui-alert__text-Slmxh","alert__title":"ui-alert__title-I8BAh","alert__content":"ui-alert__content-lhBEo","alert__action":"ui-alert__action-1mTje","alert--info":"ui-alert--info-lsAVw","alert--success":"ui-alert--success-RMJR6","alert--warning":"ui-alert--warning-Rkgln","alert--danger":"ui-alert--danger-9ei0Y","alert--inline":"ui-alert--inline-QAaJc"};
|
|
6
6
|
const N = {
|
|
7
|
-
info: /* @__PURE__ */ r(
|
|
8
|
-
success: /* @__PURE__ */ r(
|
|
9
|
-
warning: /* @__PURE__ */ r(
|
|
10
|
-
danger: /* @__PURE__ */ r(
|
|
11
|
-
}, p = ({
|
|
7
|
+
info: /* @__PURE__ */ r(f, { "aria-hidden": !0 }),
|
|
8
|
+
success: /* @__PURE__ */ r(h, { "aria-hidden": !0 }),
|
|
9
|
+
warning: /* @__PURE__ */ r(_, { "aria-hidden": !0 }),
|
|
10
|
+
danger: /* @__PURE__ */ r(m, { "aria-hidden": !0 })
|
|
11
|
+
}, p = ({
|
|
12
|
+
children: n,
|
|
13
|
+
tone: i = "info",
|
|
14
|
+
title: l,
|
|
15
|
+
action: t,
|
|
16
|
+
variant: s = "box",
|
|
17
|
+
className: d,
|
|
18
|
+
testId: c
|
|
19
|
+
}) => /* @__PURE__ */ a(
|
|
12
20
|
"div",
|
|
13
21
|
{
|
|
14
|
-
className:
|
|
15
|
-
|
|
16
|
-
|
|
22
|
+
className: x(
|
|
23
|
+
e.alert,
|
|
24
|
+
e[`alert--${i}`],
|
|
25
|
+
s === "inline" && e["alert--inline"],
|
|
26
|
+
d
|
|
27
|
+
),
|
|
28
|
+
role: i === "danger" || i === "warning" ? "alert" : void 0,
|
|
29
|
+
"data-testid": c,
|
|
17
30
|
children: [
|
|
18
|
-
/* @__PURE__ */ r("span", { className: e.alert__icon, children: N[
|
|
19
|
-
/* @__PURE__ */
|
|
20
|
-
/* @__PURE__ */
|
|
31
|
+
/* @__PURE__ */ r("span", { className: e.alert__icon, children: N[i] }),
|
|
32
|
+
/* @__PURE__ */ a("div", { className: e.alert__body, children: [
|
|
33
|
+
/* @__PURE__ */ a("div", { className: e.alert__text, children: [
|
|
21
34
|
l && /* @__PURE__ */ r("strong", { className: e.alert__title, children: l }),
|
|
22
|
-
/* @__PURE__ */ r("div", { className: e.alert__content, children:
|
|
35
|
+
/* @__PURE__ */ r("div", { className: e.alert__content, children: n })
|
|
23
36
|
] }),
|
|
24
37
|
t && /* @__PURE__ */ r("div", { className: e.alert__action, children: t })
|
|
25
38
|
] })
|
|
26
39
|
]
|
|
27
40
|
}
|
|
28
|
-
),
|
|
41
|
+
), b = /* @__PURE__ */ o(p);
|
|
29
42
|
export {
|
|
30
|
-
|
|
43
|
+
b as default
|
|
31
44
|
};
|
|
32
45
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Alert/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport {\n CheckCircleFill,\n ExclamationTriangleFill,\n InfoCircleFill,\n XCircleFill,\n} from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\n\nimport styles from './index.module.scss';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\ntype Props = {\n children: ReactNode;\n tone?: AlertTone;\n title?: string;\n /** Sağda gösterilen eylem (bağlantı veya düğme). */\n action?: ReactNode;\n className?: string;\n testId?: string;\n};\n\n/** Her tona kendi ikonu; renk tek başına anlam taşımaz (WCAG 1.4.1). */\nconst ICONS: Record<AlertTone, ReactNode> = {\n info: <InfoCircleFill aria-hidden />,\n success: <CheckCircleFill aria-hidden />,\n warning: <ExclamationTriangleFill aria-hidden />,\n danger: <XCircleFill aria-hidden />,\n};\n\n/** Bilgi / uyarı kutusu. */\nconst Alert: FC<Props> = ({
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Alert/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport {\n CheckCircleFill,\n ExclamationTriangleFill,\n InfoCircleFill,\n XCircleFill,\n} from 'react-bootstrap-icons';\n\nimport { cx } from '../../helpers/class-name.helper';\n\nimport styles from './index.module.scss';\n\nexport type AlertTone = 'info' | 'success' | 'warning' | 'danger';\n\n/**\n * `box` (default) a tinted, framed box on the page or in a column. `inline` (3.7) the tint without\n * its frame and with tighter padding: a note INSIDE a card or a panel, where a framed box drew a\n * border inside a border.\n */\nexport type AlertVariant = 'box' | 'inline';\n\ntype Props = {\n children: ReactNode;\n tone?: AlertTone;\n title?: string;\n /** Sağda gösterilen eylem (bağlantı veya düğme). */\n action?: ReactNode;\n variant?: AlertVariant;\n className?: string;\n testId?: string;\n};\n\n/** Her tona kendi ikonu; renk tek başına anlam taşımaz (WCAG 1.4.1). */\nconst ICONS: Record<AlertTone, ReactNode> = {\n info: <InfoCircleFill aria-hidden />,\n success: <CheckCircleFill aria-hidden />,\n warning: <ExclamationTriangleFill aria-hidden />,\n danger: <XCircleFill aria-hidden />,\n};\n\n/** Bilgi / uyarı kutusu. */\nconst Alert: FC<Props> = ({\n children,\n tone = 'info',\n title,\n action,\n variant = 'box',\n className,\n testId,\n}) => (\n <div\n className={cx(\n styles.alert,\n styles[`alert--${tone}`],\n variant === 'inline' && styles['alert--inline'],\n className,\n )}\n role={tone === 'danger' || tone === 'warning' ? 'alert' : undefined}\n data-testid={testId}\n >\n <span className={styles.alert__icon}>{ICONS[tone]}</span>\n\n {/*\n * 2.2: the action sits INSIDE the body, beside the text while there is room for both and under\n * it, aligned with the text, when there is not. As a third flex item it kept its width and\n * squeezed the text into a narrow column in a narrow container (a paywall card, a sidebar).\n */}\n <div className={styles.alert__body}>\n <div className={styles.alert__text}>\n {title && <strong className={styles.alert__title}>{title}</strong>}\n <div className={styles.alert__content}>{children}</div>\n </div>\n\n {action && <div className={styles.alert__action}>{action}</div>}\n </div>\n </div>\n);\n\nexport default /*#__PURE__*/ memo(Alert) as typeof Alert;\n"],"names":["ICONS","jsx","InfoCircleFill","CheckCircleFill","ExclamationTriangleFill","XCircleFill","Alert","children","tone","title","action","variant","className","testId","jsxs","cx","styles","index"],"mappings":";;;;;AAkCA,MAAMA,IAAsC;AAAA,EAC1C,MAAM,gBAAAC,EAACC,GAAA,EAAe,eAAW,GAAA,CAAC;AAAA,EAClC,SAAS,gBAAAD,EAACE,GAAA,EAAgB,eAAW,GAAA,CAAC;AAAA,EACtC,SAAS,gBAAAF,EAACG,GAAA,EAAwB,eAAW,GAAA,CAAC;AAAA,EAC9C,QAAQ,gBAAAH,EAACI,GAAA,EAAY,eAAW,GAAA,CAAC;AACnC,GAGMC,IAAmB,CAAC;AAAA,EACxB,UAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,WAAAC;AAAA,EACA,QAAAC;AACF,MACE,gBAAAC;AAAA,EAAC;AAAA,EAAA;AAAA,IACC,WAAWC;AAAA,MACTC,EAAO;AAAA,MACPA,EAAO,UAAUR,CAAI,EAAE;AAAA,MACvBG,MAAY,YAAYK,EAAO,eAAe;AAAA,MAC9CJ;AAAA,IAAA;AAAA,IAEF,MAAMJ,MAAS,YAAYA,MAAS,YAAY,UAAU;AAAA,IAC1D,eAAaK;AAAA,IAEb,UAAA;AAAA,MAAA,gBAAAZ,EAAC,UAAK,WAAWe,EAAO,aAAc,UAAAhB,EAAMQ,CAAI,GAAE;AAAA,MAOlD,gBAAAM,EAAC,OAAA,EAAI,WAAWE,EAAO,aACrB,UAAA;AAAA,QAAA,gBAAAF,EAAC,OAAA,EAAI,WAAWE,EAAO,aACpB,UAAA;AAAA,UAAAP,KAAS,gBAAAR,EAAC,UAAA,EAAO,WAAWe,EAAO,cAAe,UAAAP,GAAM;AAAA,UACzD,gBAAAR,EAAC,OAAA,EAAI,WAAWe,EAAO,gBAAiB,UAAAT,EAAA,CAAS;AAAA,QAAA,GACnD;AAAA,QAECG,KAAU,gBAAAT,EAAC,OAAA,EAAI,WAAWe,EAAO,eAAgB,UAAAN,EAAA,CAAO;AAAA,MAAA,EAAA,CAC3D;AAAA,IAAA;AAAA,EAAA;AACF,GAGFO,sBAAkCX,CAAK;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer ui{.ui-alert-gHI-9{display:flex;align-items:flex-start;gap:var(--hd-space-3);padding:var(--hd-space-4);border-radius:var(--hd-radius-sm);font-size:var(--hd-type-small-size)}.ui-alert__icon-DhiCT{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex-shrink:0;border-radius:var(--hd-radius-xs);font-size:20px}.ui-alert__body-52-z2{display:flex;flex:1;flex-wrap:wrap;align-items:flex-start;gap:var(--hd-space-2) var(--hd-space-3);min-width:0}.ui-alert__text-Slmxh{display:flex;flex-direction:column;gap:var(--hd-space-1);flex:1 1 16rem;min-width:0;padding-top:3px}.ui-alert__title-I8BAh{font-family:var(--hd-font-body);font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-semibold);color:inherit}.ui-alert__content-lhBEo{line-height:var(--hd-type-body-line-height);color:inherit;max-width:68ch}.ui-alert__content-lhBEo a{color:inherit;text-decoration:underline;text-underline-offset:2px;font-weight:var(--hd-font-weight-semibold)}.ui-alert__content-lhBEo strong{font-weight:var(--hd-font-weight-semibold)}.ui-alert__action-1mTje{flex:0 0 auto;max-width:100%}.ui-alert--info-lsAVw,.ui-alert--success-RMJR6{background-color:var(--hd-info-bg);border:1px solid var(--hd-info-line);color:var(--hd-info-fg)}.ui-alert--warning-Rkgln{background-color:var(--hd-bg-raised);border:1px solid var(--hd-border-strong);color:var(--hd-text)}.ui-alert--danger-9ei0Y{background-color:var(--hd-danger-bg);border:1px solid var(--hd-danger-line);color:var(--hd-danger-fg)}}
|
|
1
|
+
@layer ui{.ui-alert-gHI-9{display:flex;align-items:flex-start;gap:var(--hd-space-3);padding:var(--hd-space-4);border-radius:var(--hd-radius-sm);font-size:var(--hd-type-small-size)}.ui-alert__icon-DhiCT{display:inline-flex;align-items:center;justify-content:center;width:28px;height:28px;flex-shrink:0;border-radius:var(--hd-radius-xs);font-size:20px}.ui-alert__body-52-z2{display:flex;flex:1;flex-wrap:wrap;align-items:flex-start;gap:var(--hd-space-2) var(--hd-space-3);min-width:0}.ui-alert__text-Slmxh{display:flex;flex-direction:column;gap:var(--hd-space-1);flex:1 1 16rem;min-width:0;padding-top:3px}.ui-alert__title-I8BAh{font-family:var(--hd-font-body);font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-semibold);color:inherit}.ui-alert__content-lhBEo{line-height:var(--hd-type-body-line-height);color:inherit;max-width:68ch}.ui-alert__content-lhBEo a{color:inherit;text-decoration:underline;text-underline-offset:2px;font-weight:var(--hd-font-weight-semibold)}.ui-alert__content-lhBEo strong{font-weight:var(--hd-font-weight-semibold)}.ui-alert__action-1mTje{flex:0 0 auto;max-width:100%}.ui-alert--info-lsAVw,.ui-alert--success-RMJR6{background-color:var(--hd-info-bg);border:1px solid var(--hd-info-line);color:var(--hd-info-fg)}.ui-alert--warning-Rkgln{background-color:var(--hd-bg-raised);border:1px solid var(--hd-border-strong);color:var(--hd-text)}.ui-alert--danger-9ei0Y{background-color:var(--hd-danger-bg);border:1px solid var(--hd-danger-line);color:var(--hd-danger-fg)}.ui-alert--inline-QAaJc{gap:var(--hd-space-2);padding:var(--hd-space-3);border-color:transparent}.ui-alert--inline-QAaJc .ui-alert__icon-DhiCT{width:20px;height:20px;font-size:16px}.ui-alert--inline-QAaJc .ui-alert__text-Slmxh{padding-top:0}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer ui{:root:has(.ui-shell-DdJz9){--app-sidebar-width: 232px}:root:has(.ui-shell--collapsed-mBfej){--app-sidebar-width: 56px}@media (max-width: 1024px){:root:has(.ui-shell-DdJz9){--app-sidebar-width: 0px}}.ui-srOnly--wftu{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.ui-shell-DdJz9{display:grid;grid-template-columns:232px minmax(0,1fr);min-height:100dvh;background-color:var(--hd-bg-page);color:var(--hd-text);transition:grid-template-columns var(--hd-duration-base) var(--hd-ease-standard)}@media (prefers-reduced-motion: reduce){.ui-shell-DdJz9{transition:none}}@media (max-width: 1024px){.ui-shell-DdJz9{grid-template-columns:minmax(0,1fr)}}.ui-shell--collapsed-mBfej{grid-template-columns:56px minmax(0,1fr)}@media (max-width: 1024px){.ui-shell--collapsed-mBfej{grid-template-columns:minmax(0,1fr)}}.ui-shell__skip-hqzkw{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.ui-shell__skip-hqzkw:focus-visible{position:fixed;inset-block-start:var(--hd-space-2);inset-inline-start:var(--hd-space-2);z-index:var(--hd-z-tooltip);width:auto;height:auto;margin:0;padding:var(--hd-space-2) var(--hd-space-3);overflow:visible;clip-path:none;white-space:nowrap;border-radius:var(--hd-radius-sm);background-color:var(--hd-bg-raised);box-shadow:var(--hd-shadow-2);color:var(--hd-primary-text);font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-semibold);text-decoration:none;outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, 2px)}.ui-shell__sidebar-59ryl{min-width:0;border-inline-end:1px solid var(--hd-border);background-color:var(--hd-bg-surface)}@media (max-width: 1024px){.ui-shell__sidebar-59ryl{display:none}}.ui-shell__sidebar-inner-iIXhF{position:sticky;inset-block-start:0;display:flex;flex-direction:column;height:100dvh}.ui-shell__brand-Mph-k{display:flex;align-items:center;gap:var(--hd-space-2);flex-shrink:0;min-height:52px;padding-inline:var(--hd-space-4);overflow:hidden;border-block-end:1px solid var(--hd-border);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)}.ui-shell__brand-Mph-k :where(a),.ui-shell__brand-Mph-k :where(a)>:where(span){display:inline-flex;align-items:center;gap:var(--hd-space-2);min-width:0}.ui-shell__brand-Mph-k :where(svg){flex-shrink:0}.ui-shell__navigation-quAVK{position:relative;flex:1;min-height:0;overflow-y:auto;padding:var(--hd-space-3) var(--hd-space-2);scrollbar-width:thin;scrollbar-color:var(--hd-border-strong) transparent}.ui-shell__navigation-quAVK::-webkit-scrollbar{width:8px;height:8px}.ui-shell__navigation-quAVK::-webkit-scrollbar-track{background:transparent}.ui-shell__navigation-quAVK::-webkit-scrollbar-thumb{background-color:var(--hd-border-strong);border-radius:var(--hd-radius-pill);border:2px solid transparent;background-clip:content-box}.ui-shell__navigation-quAVK::-webkit-scrollbar-thumb:hover{background-color:var(--hd-text-3)}.ui-shell__footer-gGr9S{display:flex;align-items:center;gap:var(--hd-space-2);flex-shrink:0;justify-content:flex-end;padding:var(--hd-space-2);border-block-start:1px solid var(--hd-border)}.ui-shell--collapsed-mBfej .ui-shell__footer-gGr9S{flex-direction:column;justify-content:center}.ui-shell--collapsed-mBfej .ui-shell__brand-Mph-k{justify-content:center;padding-inline:var(--hd-space-2)}[dir=rtl] .ui-shell__toggle--vukn{transform:scaleX(-1)}.ui-shell__toggle--vukn{transition:rotate var(--hd-duration-base) var(--hd-ease-standard)}@media (prefers-reduced-motion: reduce){.ui-shell__toggle--vukn{transition:none}}.ui-shell--collapsed-mBfej .ui-shell__toggle--vukn{rotate:180deg}.ui-shell__frame-4Cwe2{display:flex;flex-direction:column;min-width:0}.ui-shell__topbar-HH2s0{display:flex;align-items:center;gap:var(--hd-space-3);position:sticky;inset-block-start:0;z-index:var(--hd-z-sticky);min-height:52px;padding-inline:var(--hd-space-4);border-block-end:1px solid var(--hd-border);background-color:var(--hd-bg-surface)}@media (max-width: 640px){.ui-shell__topbar-HH2s0{gap:var(--hd-space-2);padding-inline:var(--hd-space-3)}}.ui-shell__menu-button-8CeT4{display:none}@media (max-width: 1024px){.ui-shell__menu-button-8CeT4{display:inline-flex}}.ui-shell__title--Z5jA{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);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:0 1 auto;min-width:0}.ui-shell__search-4Tij9{flex:1 1 auto;min-width:0;max-width:480px}.ui-shell__actions-RU34x{display:flex;align-items:center;gap:var(--hd-space-2);flex-shrink:0;margin-inline-start:auto}.ui-shell__content-nbbhQ{flex:1;min-width:0;padding:var(--hd-space-6)}.ui-shell__content-nbbhQ:focus{outline:none}@media (max-width: 1024px){.ui-shell__content-nbbhQ{padding:var(--hd-space-4)}}.ui-shell__drawer-brand-3MgNr{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)}.ui-shell__drawer-brand-3MgNr :where(a),.ui-shell__drawer-brand-3MgNr :where(a)>:where(span){display:inline-flex;align-items:center;gap:var(--hd-space-2);min-width:0}.ui-shell__drawer-brand-3MgNr :where(svg){flex-shrink:0}.ui-shell__drawer-brand-3MgNr{margin-block-end:var(--hd-space-3)}.ui-nav-3I7Ws{display:flex;flex-direction:column;gap:var(--hd-space-4)}.ui-nav__section-label-0CMnM{font-family:var(--ui-overline-font, var(--hd-font-body));font-size:var(--hd-type-caption-size);font-weight:var(--hd-font-weight-semibold);letter-spacing:.045em;text-transform:uppercase;color:var(--hd-text-2);margin:0;padding:0 var(--hd-space-3) var(--hd-space-1);color:var(--hd-text-3)}.ui-nav__list-Wotlu,.ui-nav__sublist-8ut6O{display:flex;flex-direction:column;gap:var(--hd-space-0);margin:0;padding:0;list-style:none}.ui-nav__sublist-8ut6O{margin-inline-start:calc(var(--hd-space-3) + 18px / 2);padding-inline-start:var(--hd-space-2);border-inline-start:1px solid var(--hd-border)}.ui-nav__sublist-8ut6O[hidden]{display:none}.ui-nav__item-RvDle{display:flex;align-items:center;gap:var(--hd-space-2);background-color:transparent;transition:background-color var(--hd-duration-fast) var(--hd-ease-standard),translate var(--hd-duration-fast) var(--hd-ease-standard)}.ui-nav__item-RvDle:hover:not(:disabled):not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hd-text) 8%,transparent)}.ui-nav__item-RvDle:active:not(:disabled):not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hd-text) 14%,transparent);translate:0 1px}@media (prefers-reduced-motion: reduce){.ui-nav__item-RvDle{transition:none}.ui-nav__item-RvDle:active:not(:disabled):not([aria-disabled=true]){translate:none}}.ui-nav__item-RvDle:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -2px)}.ui-nav__item-RvDle{position:relative;width:100%;min-height:36px;padding:0 var(--hd-space-3);border:0;border-radius:var(--hd-radius-sm);color:var(--hd-text-2);font-family:var(--hd-font-body);font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-medium);line-height:var(--hd-type-h4-line-height);text-align:start;text-decoration:none;cursor:pointer}.ui-nav__item-RvDle:hover{color:var(--hd-text)}@media (hover: none) and (pointer: coarse){.ui-nav__item-RvDle{min-height:44px}}.ui-nav__item--active-Lg028{background-color:var(--hd-primary-soft);color:var(--hd-primary-text);font-weight:var(--hd-font-weight-semibold)}.ui-nav__item--active-Lg028:hover:not(:disabled){background-color:var(--hd-primary-soft-hover);color:var(--hd-primary-text)}.ui-nav__item--disabled-CcOTO{color:var(--hd-text-3)}@media (forced-colors: active){.ui-nav__item--disabled-CcOTO{color:GrayText}}.ui-nav__item--disabled-CcOTO{cursor:default}.ui-nav__item--disabled-CcOTO:hover{background-color:transparent;color:var(--hd-text-3)}.ui-nav__icon-NVN6X{display:inline-flex;flex-shrink:0;font-size:18px}.ui-nav__label-nlEMg{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.ui-nav__badge-aR8RE{flex-shrink:0;min-width:18px;height:18px;padding-inline:var(--hd-space-1);border-radius:var(--hd-radius-pill);background-color:var(--hd-primary);color:var(--hd-on-primary);font-size:var(--hd-type-caption-size);font-weight:var(--hd-font-weight-semibold);line-height:18px;text-align:center;font-variant-numeric:tabular-nums;box-sizing:border-box}@media (forced-colors: active){.ui-nav__badge-aR8RE{border:1px solid CanvasText}}.ui-nav__chevron-ZrqW9{flex-shrink:0;font-size:14px;transition:rotate var(--hd-duration-fast) var(--hd-ease-standard)}.ui-nav__chevron--open-56sZo{rotate:180deg}@media (prefers-reduced-motion: reduce){.ui-nav__chevron-ZrqW9{transition:none}}.ui-shell--collapsed-mBfej .ui-shell__sidebar-59ryl .ui-nav__section-label-0CMnM,.ui-shell--collapsed-mBfej .ui-shell__sidebar-59ryl .ui-nav__label-nlEMg{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.ui-shell--collapsed-mBfej .ui-shell__sidebar-59ryl .ui-nav__section-hkG3J+.ui-nav__section-hkG3J{padding-block-start:var(--hd-space-3);border-block-start:1px solid var(--hd-border)}.ui-shell--collapsed-mBfej .ui-shell__sidebar-59ryl .ui-nav__item-RvDle{justify-content:center;padding:0}.ui-shell--collapsed-mBfej .ui-shell__sidebar-59ryl .ui-nav__chevron-ZrqW9{display:none}.ui-shell--collapsed-mBfej .ui-shell__sidebar-59ryl .ui-nav__badge-aR8RE{position:absolute;inset-block-start:2px;inset-inline-end:2px;min-width:14px;height:14px;padding-inline:3px;font-size:10px;line-height:14px}@media print{.ui-shell-DdJz9,.ui-shell--collapsed-mBfej{display:block;min-height:0;background:none}.ui-shell__skip-hqzkw,.ui-shell__sidebar-59ryl,.ui-shell__topbar-HH2s0{display:none}.ui-shell__content-nbbhQ{padding:0}}}
|
|
1
|
+
@layer ui{:root:has(.ui-shell-DdJz9){--app-sidebar-width: 232px}:root:has(.ui-shell--collapsed-mBfej){--app-sidebar-width: 56px}@media (max-width: 1024px){:root:has(.ui-shell-DdJz9){--app-sidebar-width: 0px}}.ui-srOnly--wftu{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.ui-shell-DdJz9{display:grid;grid-template-columns:232px minmax(0,1fr);min-height:100dvh;background-color:var(--hd-bg-page);color:var(--hd-text);transition:grid-template-columns var(--hd-duration-base) var(--hd-ease-standard)}@media (prefers-reduced-motion: reduce){.ui-shell-DdJz9{transition:none}}@media (max-width: 1024px){.ui-shell-DdJz9{grid-template-columns:minmax(0,1fr)}}.ui-shell--collapsed-mBfej{grid-template-columns:56px minmax(0,1fr)}@media (max-width: 1024px){.ui-shell--collapsed-mBfej{grid-template-columns:minmax(0,1fr)}}.ui-shell__skip-hqzkw{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.ui-shell__skip-hqzkw:focus-visible{position:fixed;inset-block-start:var(--hd-space-2);inset-inline-start:var(--hd-space-2);z-index:var(--hd-z-tooltip);width:auto;height:auto;margin:0;padding:var(--hd-space-2) var(--hd-space-3);overflow:visible;clip-path:none;white-space:nowrap;border-radius:var(--hd-radius-sm);background-color:var(--hd-bg-raised);box-shadow:var(--hd-shadow-2);color:var(--hd-primary-text);font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-semibold);text-decoration:none;outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, 2px)}.ui-shell__sidebar-59ryl{min-width:0;border-inline-end:1px solid var(--hd-border);background-color:var(--hd-bg-surface)}@media (max-width: 1024px){.ui-shell__sidebar-59ryl{display:none}}.ui-shell__sidebar-inner-iIXhF{position:sticky;inset-block-start:0;display:flex;flex-direction:column;height:100dvh}.ui-shell__brand-Mph-k{display:flex;align-items:center;gap:var(--hd-space-2);flex-shrink:0;min-height:52px;padding-inline:var(--hd-space-4);overflow:hidden;border-block-end:1px solid var(--hd-border);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)}.ui-shell__brand-Mph-k :where(a),.ui-shell__brand-Mph-k :where(a)>:where(span){display:inline-flex;align-items:center;gap:var(--hd-space-2);min-width:0}.ui-shell__brand-Mph-k :where(svg){flex-shrink:0}.ui-shell__navigation-quAVK{position:relative;flex:1;min-height:0;overflow-y:auto;padding:var(--hd-space-3) var(--hd-space-2);scrollbar-width:thin;scrollbar-color:var(--hd-border-strong) transparent}.ui-shell__navigation-quAVK::-webkit-scrollbar{width:8px;height:8px}.ui-shell__navigation-quAVK::-webkit-scrollbar-track{background:transparent}.ui-shell__navigation-quAVK::-webkit-scrollbar-thumb{background-color:var(--hd-border-strong);border-radius:var(--hd-radius-pill);border:2px solid transparent;background-clip:content-box}.ui-shell__navigation-quAVK::-webkit-scrollbar-thumb:hover{background-color:var(--hd-text-3)}.ui-shell__footer-gGr9S{display:flex;align-items:center;gap:var(--hd-space-2);flex-shrink:0;justify-content:flex-end;padding:var(--hd-space-2);border-block-start:1px solid var(--hd-border)}.ui-shell--collapsed-mBfej .ui-shell__footer-gGr9S{flex-direction:column;justify-content:center}.ui-shell--collapsed-mBfej .ui-shell__brand-Mph-k{justify-content:center;padding-inline:var(--hd-space-2)}[dir=rtl] .ui-shell__toggle--vukn{transform:scaleX(-1)}.ui-shell__toggle--vukn{transition:rotate var(--hd-duration-base) var(--hd-ease-standard)}@media (prefers-reduced-motion: reduce){.ui-shell__toggle--vukn{transition:none}}.ui-shell--collapsed-mBfej .ui-shell__toggle--vukn{rotate:180deg}.ui-shell__frame-4Cwe2{display:flex;flex-direction:column;min-width:0}.ui-shell__topbar-HH2s0{display:flex;align-items:center;gap:var(--hd-space-3);position:sticky;inset-block-start:0;z-index:var(--hd-z-sticky);min-height:52px;padding-inline:var(--hd-space-4);border-block-end:1px solid var(--hd-border);background-color:var(--hd-bg-surface)}@media (max-width: 640px){.ui-shell__topbar-HH2s0{gap:var(--hd-space-2);padding-inline:var(--hd-space-3)}}.ui-shell__menu-button-8CeT4{display:none}@media (max-width: 1024px){.ui-shell__menu-button-8CeT4{display:inline-flex}}.ui-shell__title--Z5jA{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);overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:0 1 auto;min-width:0}.ui-shell__search-4Tij9{flex:1 1 auto;min-width:0;max-width:480px}.ui-shell__actions-RU34x{display:flex;align-items:center;gap:var(--hd-space-2);flex-shrink:0;margin-inline-start:auto}.ui-shell__content-nbbhQ{flex:1;min-width:0;padding:var(--hd-space-6)}.ui-shell__content-nbbhQ:focus{outline:none}@media (max-width: 1024px){.ui-shell__content-nbbhQ{padding:var(--hd-space-4)}}.ui-shell__drawer-brand-3MgNr{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)}.ui-shell__drawer-brand-3MgNr :where(a),.ui-shell__drawer-brand-3MgNr :where(a)>:where(span){display:inline-flex;align-items:center;gap:var(--hd-space-2);min-width:0}.ui-shell__drawer-brand-3MgNr :where(svg){flex-shrink:0}.ui-shell__drawer-brand-3MgNr{margin-block-end:var(--hd-space-3)}.ui-nav-3I7Ws{display:flex;flex-direction:column;gap:var(--hd-space-4)}.ui-nav__section-label-0CMnM{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);margin:0;padding:0 var(--hd-space-3) var(--hd-space-1);color:var(--hd-text-3)}.ui-nav__list-Wotlu,.ui-nav__sublist-8ut6O{display:flex;flex-direction:column;gap:var(--hd-space-0);margin:0;padding:0;list-style:none}.ui-nav__sublist-8ut6O{margin-inline-start:calc(var(--hd-space-3) + 18px / 2);padding-inline-start:var(--hd-space-2);border-inline-start:1px solid var(--hd-border)}.ui-nav__sublist-8ut6O[hidden]{display:none}.ui-nav__item-RvDle{display:flex;align-items:center;gap:var(--hd-space-2);background-color:transparent;transition:background-color var(--hd-duration-fast) var(--hd-ease-standard),translate var(--hd-duration-fast) var(--hd-ease-standard)}.ui-nav__item-RvDle:hover:not(:disabled):not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hd-text) 8%,transparent)}.ui-nav__item-RvDle:active:not(:disabled):not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hd-text) 14%,transparent);translate:0 1px}@media (prefers-reduced-motion: reduce){.ui-nav__item-RvDle{transition:none}.ui-nav__item-RvDle:active:not(:disabled):not([aria-disabled=true]){translate:none}}.ui-nav__item-RvDle:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -2px)}.ui-nav__item-RvDle{position:relative;width:100%;min-height:36px;padding:0 var(--hd-space-3);border:0;border-radius:var(--hd-radius-sm);color:var(--hd-text-2);font-family:var(--hd-font-body);font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-medium);line-height:var(--hd-type-h4-line-height);text-align:start;text-decoration:none;cursor:pointer}.ui-nav__item-RvDle:hover{color:var(--hd-text)}@media (hover: none) and (pointer: coarse){.ui-nav__item-RvDle{min-height:44px}}.ui-nav__item-RvDle:after{content:"";position:absolute;background-color:transparent;border-radius:0;pointer-events:none;transition:background-color var(--hd-duration-fast) var(--hd-ease-standard);inset-block:var(--hd-space-1);inset-inline-start:0;width:2px}.ui-nav__item--active-Lg028:after{background-color:var(--hd-primary)}@media (forced-colors: active){.ui-nav__item--active-Lg028:after{background-color:Highlight}}.ui-nav__item--active-Lg028{background-color:var(--hd-primary-soft);color:var(--hd-primary-text);font-weight:var(--hd-font-weight-semibold)}.ui-nav__item--active-Lg028:hover:not(:disabled){background-color:var(--hd-primary-soft-hover);color:var(--hd-primary-text)}.ui-nav__item--disabled-CcOTO{color:var(--hd-text-3)}@media (forced-colors: active){.ui-nav__item--disabled-CcOTO{color:GrayText}}.ui-nav__item--disabled-CcOTO{cursor:default}.ui-nav__item--disabled-CcOTO:hover{background-color:transparent;color:var(--hd-text-3)}.ui-nav__icon-NVN6X{display:inline-flex;flex-shrink:0;font-size:18px}.ui-nav__label-nlEMg{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;flex:1;min-width:0}.ui-nav__badge-aR8RE{flex-shrink:0;min-width:18px;height:18px;padding-inline:var(--hd-space-1);border-radius:var(--hd-radius-pill);background-color:var(--hd-primary);color:var(--hd-on-primary);font-size:var(--hd-type-caption-size);font-weight:var(--hd-font-weight-semibold);line-height:18px;text-align:center;font-variant-numeric:tabular-nums;box-sizing:border-box}@media (forced-colors: active){.ui-nav__badge-aR8RE{border:1px solid CanvasText}}.ui-nav__chevron-ZrqW9{flex-shrink:0;font-size:14px;transition:rotate var(--hd-duration-fast) var(--hd-ease-standard)}.ui-nav__chevron--open-56sZo{rotate:180deg}@media (prefers-reduced-motion: reduce){.ui-nav__chevron-ZrqW9{transition:none}}.ui-shell--collapsed-mBfej .ui-shell__sidebar-59ryl .ui-nav__section-label-0CMnM,.ui-shell--collapsed-mBfej .ui-shell__sidebar-59ryl .ui-nav__label-nlEMg{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}.ui-shell--collapsed-mBfej .ui-shell__sidebar-59ryl .ui-nav__section-hkG3J+.ui-nav__section-hkG3J{padding-block-start:var(--hd-space-3);border-block-start:1px solid var(--hd-border)}.ui-shell--collapsed-mBfej .ui-shell__sidebar-59ryl .ui-nav__item-RvDle{justify-content:center;padding:0}.ui-shell--collapsed-mBfej .ui-shell__sidebar-59ryl .ui-nav__chevron-ZrqW9{display:none}.ui-shell--collapsed-mBfej .ui-shell__sidebar-59ryl .ui-nav__badge-aR8RE{position:absolute;inset-block-start:2px;inset-inline-end:2px;min-width:14px;height:14px;padding-inline:3px;font-size:10px;line-height:14px}@media print{.ui-shell-DdJz9,.ui-shell--collapsed-mBfej{display:block;min-height:0;background:none}.ui-shell__skip-hqzkw,.ui-shell__sidebar-59ryl,.ui-shell__topbar-HH2s0{display:none}.ui-shell__content-nbbhQ{padding:0}}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer ui{.ui-applied-PjuWH{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hd-space-2);padding:var(--hd-space-3) var(--hd-space-4);border:1px solid var(--hd-border);border-radius:var(--hd-radius-md);background-color:var(--hd-bg-raised)}@media (max-width: 640px){.ui-applied-PjuWH{flex-direction:column;align-items:stretch;padding:var(--hd-space-3)}}.ui-applied__lead-A6FkV{font-family:var(--ui-overline-font, var(--hd-font-body));font-size:var(--hd-type-
|
|
1
|
+
@layer ui{.ui-applied-PjuWH{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hd-space-2);padding:var(--hd-space-3) var(--hd-space-4);border:1px solid var(--hd-border);border-radius:var(--hd-radius-md);background-color:var(--hd-bg-raised)}@media (max-width: 640px){.ui-applied-PjuWH{flex-direction:column;align-items:stretch;padding:var(--hd-space-3)}}.ui-applied__lead-A6FkV{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);flex-shrink:0;margin-inline-end:var(--hd-space-1)}.ui-applied__lead-A6FkV:focus{outline:none}.ui-applied__list-4APk5{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hd-space-2);flex:1;min-width:0;margin:0;padding:0;list-style:none}.ui-applied__chip-DmkZy{max-width:100%}.ui-applied__group-xPW72{margin-inline-end:var(--hd-space-1);color:var(--hd-text-2)}.ui-applied__value-1MDBf{font-weight:var(--hd-font-weight-semibold);color:var(--hd-text)}.ui-applied__extra-gCUen{font-size:var(--hd-type-caption-size);color:var(--hd-text-2);font-variant-numeric:tabular-nums}.ui-applied__clear-xaCI4{flex-shrink:0;margin-inline-start:auto}@media (max-width: 640px){.ui-applied__clear-xaCI4{align-self:flex-start;margin-inline-start:0}}}
|
|
@@ -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","
|
|
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:
|
|
14
|
-
isMuted:
|
|
15
|
-
className:
|
|
16
|
-
testId:
|
|
13
|
+
size: t,
|
|
14
|
+
isMuted: l,
|
|
15
|
+
className: n,
|
|
16
|
+
testId: r
|
|
17
17
|
}) => {
|
|
18
18
|
const s = f(
|
|
19
19
|
e.code,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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:
|
|
32
|
+
testId: r
|
|
33
33
|
}
|
|
34
|
-
) : /* @__PURE__ */ o("code", { className: s, "data-testid":
|
|
35
|
-
},
|
|
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
|
-
|
|
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","
|
|
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 +1 @@
|
|
|
1
|
-
@layer ui{.ui-palette-ag-P9{display:none;flex-direction:column;width:min(92vw,560px);max-height:min(70dvh,480px);margin:12vh auto auto;padding:0;border:1px solid var(--hd-border);border-radius:var(--hd-radius-md);background-color:var(--hd-bg-overlay);color:var(--hd-text);box-shadow:var(--hd-shadow-3);overflow:hidden}.ui-palette-ag-P9:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -2px)}.ui-palette-ag-P9{opacity:0;translate:0 6px;transition:opacity var(--hd-duration-fast) var(--hd-ease-standard),translate var(--hd-duration-fast) var(--hd-ease-standard),overlay var(--hd-duration-fast) allow-discrete,display var(--hd-duration-fast) allow-discrete}.ui-palette-ag-P9[open]{opacity:1;translate:0 0}@starting-style{.ui-palette-ag-P9[open]{opacity:0;translate:0 6px}}@media (prefers-reduced-motion: reduce){.ui-palette-ag-P9{transition:none}}.ui-palette-ag-P9::backdrop{opacity:0;transition:opacity var(--hd-duration-fast) var(--hd-ease-standard),overlay var(--hd-duration-fast) allow-discrete,display var(--hd-duration-fast) allow-discrete}.ui-palette-ag-P9[open]::backdrop{opacity:1}@starting-style{.ui-palette-ag-P9[open]::backdrop{opacity:0}}@media (prefers-reduced-motion: reduce){.ui-palette-ag-P9::backdrop{transition:none}}.ui-palette-ag-P9[open]{display:flex}.ui-palette-ag-P9::backdrop{background-color:var(--hd-scrim);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}@media (max-width: 640px){.ui-palette-ag-P9{width:94vw;margin-top:var(--hd-space-5);max-height:80dvh}}.ui-palette__search-G3aYv{display:flex;align-items:center;gap:var(--hd-space-2);padding:var(--hd-space-3) var(--hd-space-4);border-bottom:1px solid var(--hd-border);flex-shrink:0}.ui-palette__searchIcon-2UYj-{color:var(--hd-text-2);font-size:18px;flex-shrink:0}.ui-palette__input-vvLvt{flex:1;min-width:0;border:none;background:none;font-family:var(--hd-font-body);font-size:max(16px,var(--hd-type-body-size));color:var(--hd-text)}.ui-palette__input-vvLvt::placeholder{color:var(--hd-text-3)}.ui-palette__input-vvLvt:focus{outline:none}.ui-palette__list--KWiH{flex:1;min-height:0;position:relative;overflow-y:auto;margin:0;padding:var(--hd-space-1);list-style:none;scrollbar-width:thin;scrollbar-color:var(--hd-border-strong) transparent}.ui-palette__list--KWiH::-webkit-scrollbar{width:8px;height:8px}.ui-palette__list--KWiH::-webkit-scrollbar-track{background:transparent}.ui-palette__list--KWiH::-webkit-scrollbar-thumb{background-color:var(--hd-border-strong);border-radius:var(--hd-radius-pill);border:2px solid transparent;background-clip:content-box}.ui-palette__list--KWiH::-webkit-scrollbar-thumb:hover{background-color:var(--hd-text-3)}.ui-palette__group-KPj5Q{display:block;padding:var(--hd-space-2) var(--hd-space-2) var(--hd-space-1);font-size:var(--hd-type-
|
|
1
|
+
@layer ui{.ui-palette-ag-P9{display:none;flex-direction:column;width:min(92vw,560px);max-height:min(70dvh,480px);margin:12vh auto auto;padding:0;border:1px solid var(--hd-border);border-radius:var(--hd-radius-md);background-color:var(--hd-bg-overlay);color:var(--hd-text);box-shadow:var(--hd-shadow-3);overflow:hidden}.ui-palette-ag-P9:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -2px)}.ui-palette-ag-P9{opacity:0;translate:0 6px;transition:opacity var(--hd-duration-fast) var(--hd-ease-standard),translate var(--hd-duration-fast) var(--hd-ease-standard),overlay var(--hd-duration-fast) allow-discrete,display var(--hd-duration-fast) allow-discrete}.ui-palette-ag-P9[open]{opacity:1;translate:0 0}@starting-style{.ui-palette-ag-P9[open]{opacity:0;translate:0 6px}}@media (prefers-reduced-motion: reduce){.ui-palette-ag-P9{transition:none}}.ui-palette-ag-P9::backdrop{opacity:0;transition:opacity var(--hd-duration-fast) var(--hd-ease-standard),overlay var(--hd-duration-fast) allow-discrete,display var(--hd-duration-fast) allow-discrete}.ui-palette-ag-P9[open]::backdrop{opacity:1}@starting-style{.ui-palette-ag-P9[open]::backdrop{opacity:0}}@media (prefers-reduced-motion: reduce){.ui-palette-ag-P9::backdrop{transition:none}}.ui-palette-ag-P9[open]{display:flex}.ui-palette-ag-P9::backdrop{background-color:var(--hd-scrim);-webkit-backdrop-filter:blur(3px);backdrop-filter:blur(3px)}@media (max-width: 640px){.ui-palette-ag-P9{width:94vw;margin-top:var(--hd-space-5);max-height:80dvh}}.ui-palette__search-G3aYv{display:flex;align-items:center;gap:var(--hd-space-2);padding:var(--hd-space-3) var(--hd-space-4);border-bottom:1px solid var(--hd-border);flex-shrink:0}.ui-palette__searchIcon-2UYj-{color:var(--hd-text-2);font-size:18px;flex-shrink:0}.ui-palette__input-vvLvt{flex:1;min-width:0;border:none;background:none;font-family:var(--hd-font-body);font-size:max(16px,var(--hd-type-body-size));color:var(--hd-text)}.ui-palette__input-vvLvt::placeholder{color:var(--hd-text-3)}.ui-palette__input-vvLvt:focus{outline:none}.ui-palette__list--KWiH{flex:1;min-height:0;position:relative;overflow-y:auto;margin:0;padding:var(--hd-space-1);list-style:none;scrollbar-width:thin;scrollbar-color:var(--hd-border-strong) transparent}.ui-palette__list--KWiH::-webkit-scrollbar{width:8px;height:8px}.ui-palette__list--KWiH::-webkit-scrollbar-track{background:transparent}.ui-palette__list--KWiH::-webkit-scrollbar-thumb{background-color:var(--hd-border-strong);border-radius:var(--hd-radius-pill);border:2px solid transparent;background-clip:content-box}.ui-palette__list--KWiH::-webkit-scrollbar-thumb:hover{background-color:var(--hd-text-3)}.ui-palette__group-KPj5Q{display:block;padding:var(--hd-space-2) var(--hd-space-2) var(--hd-space-1);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)}.ui-palette__item-UZzkp{display:flex;align-items:center;gap:var(--hd-space-3);padding:var(--hd-space-2) var(--hd-space-3);border-radius:var(--hd-radius-xs);cursor:pointer;min-height:40px}.ui-palette__item--active-XHcka{background-color:color-mix(in srgb,var(--hd-text) 8%,transparent)}.ui-palette__icon-Fg0Lt{display:inline-flex;flex-shrink:0;font-size:18px;color:var(--hd-text-2)}.ui-palette__text-flfN9{display:flex;flex-direction:column;gap:1px;flex:1;min-width:0}.ui-palette__label-8-UHe{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--hd-type-small-size);color:var(--hd-text)}.ui-palette__description-eRlk9{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;font-size:var(--hd-type-caption-size);color:var(--hd-text-2)}.ui-palette__shortcut-DwYKX{flex-shrink:0}.ui-palette__empty-vg-I3{padding:var(--hd-space-5) var(--hd-space-3);text-align:center;font-size:var(--hd-type-small-size);color:var(--hd-text-2)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer ui{.ui-directory-badEd{display:flex;flex-direction:column;gap:var(--hd-space-6)}.ui-group-i6An9{scroll-margin-top:0}.ui-group__header-rc19c{display:flex;align-items:center;gap:var(--hd-space-3);justify-content:space-between;padding-bottom:var(--hd-space-2);margin-bottom:var(--hd-space-3);border-bottom:1px solid var(--hd-border);position:sticky;top:var(--ui-header-height, 0px);z-index:var(--hd-z-raised);background-color:var(--hd-bg-page)}.ui-group__label-vQTcs{font-family:var(--hd-font-display);font-size:var(--hd-type-
|
|
1
|
+
@layer ui{.ui-directory-badEd{display:flex;flex-direction:column;gap:var(--hd-space-6)}.ui-group-i6An9{scroll-margin-top:0}.ui-group__header-rc19c{display:flex;align-items:center;gap:var(--hd-space-3);justify-content:space-between;padding-bottom:var(--hd-space-2);margin-bottom:var(--hd-space-3);border-bottom:1px solid var(--hd-border);position:sticky;top:var(--ui-header-height, 0px);z-index:var(--hd-z-raised);background-color:var(--hd-bg-page)}.ui-group__label-vQTcs{font-family:var(--hd-font-display);font-size:var(--hd-type-title-4-size);font-weight:var(--hd-type-title-4-weight);font-stretch:var(--hd-type-title-4-stretch);line-height:var(--hd-type-title-4-line-height);letter-spacing:var(--hd-type-title-4-letter-spacing);color:var(--hd-text);margin:0;min-width:0}.ui-group__link-es5V7{color:inherit;text-decoration:none;transition:color var(--hd-duration-fast) var(--hd-ease-standard)}.ui-group__link-es5V7:hover{color:var(--hd-primary-text);text-decoration:underline;text-underline-offset:3px}@media (prefers-reduced-motion: reduce){.ui-group__link-es5V7{transition:none}}.ui-group__meta-LtC-u{font-size:var(--hd-type-caption-size);line-height:var(--hd-type-body-line-height);color:var(--hd-text-2);font-variant-numeric:tabular-nums;flex-shrink:0;white-space:nowrap}.ui-group__list-YxBCG{display:grid;grid-template-columns:repeat(auto-fill,minmax(220px,1fr));gap:var(--hd-space-1);list-style:none;margin:0;padding:0}.ui-row-3LH7X{display:flex;align-items:center;gap:var(--hd-space-3);min-height:44px;padding:calc(var(--hd-space-2) + 1px) calc(var(--hd-space-3) + 1px);border-radius:var(--hd-radius-sm);text-decoration:none;color:inherit;background-color:transparent;transition:background-color var(--hd-duration-fast) var(--hd-ease-standard),translate var(--hd-duration-fast) var(--hd-ease-standard)}.ui-row-3LH7X:hover:not(:disabled):not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hd-text) 8%,transparent)}.ui-row-3LH7X:active:not(:disabled):not([aria-disabled=true]){background-color:color-mix(in srgb,var(--hd-text) 14%,transparent);translate:0 1px}@media (prefers-reduced-motion: reduce){.ui-row-3LH7X{transition:none}.ui-row-3LH7X:active:not(:disabled):not([aria-disabled=true]){translate:none}}.ui-row-3LH7X:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, -2px)}@media (prefers-reduced-motion: reduce){.ui-row-3LH7X{transition:none}}.ui-row__media-AxZEh{display:inline-flex;align-items:center;justify-content:center;width:32px;height:32px;flex-shrink:0;border-radius:var(--hd-radius-xs);background-color:var(--hd-bg-raised);color:var(--hd-text-2);font-family:var(--hd-font-body);font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-semibold);overflow:hidden}.ui-row__media-AxZEh img{object-fit:contain;width:100%;height:100%}.ui-row__name-75Wbq{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;flex:1;font-size:var(--hd-type-small-size);color:var(--hd-text);transition:color var(--hd-duration-fast) var(--hd-ease-standard)}@media (prefers-reduced-motion: reduce){.ui-row__name-75Wbq{transition:none}}.ui-row__marker-RYHb-{display:inline-flex;align-items:center;flex-shrink:0;font-size:var(--hd-type-caption-size);color:var(--hd-text-2);font-variant-numeric:tabular-nums}.ui-jump-vpGwB{display:flex;gap:var(--hd-space-1);position:relative;overflow-x:auto;scroll-snap-type:x proximity;-webkit-overflow-scrolling:touch;padding-block:var(--hd-space-1) var(--hd-space-3);scrollbar-width:none;-ms-overflow-style:none}.ui-jump-vpGwB::-webkit-scrollbar{display:none}.ui-jump-vpGwB>*{scroll-snap-align:start;flex-shrink:0}.ui-jump-vpGwB{position:sticky;top:var(--ui-header-height, 0px);z-index:var(--hd-z-sticky);background-color:var(--hd-bg-page);border-bottom:1px solid var(--hd-border)}.ui-jump__link-rRnT6{display:inline-flex;align-items:center;justify-content:center;min-width:32px;min-height:32px;padding-inline:var(--hd-space-2);border-radius:var(--hd-radius-xs);font-family:var(--hd-font-body);font-size:var(--hd-type-small-size);font-weight:var(--hd-font-weight-semibold);color:var(--hd-text-2);text-decoration:none;transition:background-color var(--hd-duration-fast) var(--hd-ease-standard),color var(--hd-duration-fast) var(--hd-ease-standard)}.ui-jump__link-rRnT6:hover{background-color:var(--hd-bg-raised);color:var(--hd-primary-text)}.ui-jump__link-rRnT6:focus-visible{outline:var(--ui-ring-width, 2px) solid var(--ui-ring-color, var(--hd-focus));outline-offset:var(--ui-ring-offset, 2px)}@media (prefers-reduced-motion: reduce){.ui-jump__link-rRnT6{transition:none}}.ui-jump-vpGwB~.ui-directory-badEd .ui-group-i6An9{scroll-margin-top:49px}.ui-jump-vpGwB~.ui-directory-badEd .ui-group__header-rc19c{top:calc(var(--ui-header-height, 0px) + 49px)}}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer ui{.ui-empty-47qZR{display:flex;flex-direction:column;gap:var(--hd-space-3);align-items:center;text-align:center;padding:var(--hd-space-12) var(--hd-space-5)}@media (max-width: 640px){.ui-empty-47qZR{padding:var(--hd-space-10) var(--hd-space-4)}}.ui-empty__icon-okfEc{display:flex;align-items:center;justify-content:center;width:64px;height:64px;border-radius:var(--hd-radius-pill);background-color:var(--hd-bg-raised);border:1px solid var(--hd-border);color:var(--hd-text-2);font-size:var(--hd-type-h2-size);margin-bottom:var(--hd-space-1)}.ui-empty__title-Z7Dzd{font-family:var(--hd-font-display);font-size:var(--hd-type-
|
|
1
|
+
@layer ui{.ui-empty-47qZR{display:flex;flex-direction:column;gap:var(--hd-space-3);align-items:center;text-align:center;padding:var(--hd-space-12) var(--hd-space-5)}@media (max-width: 640px){.ui-empty-47qZR{padding:var(--hd-space-10) var(--hd-space-4)}}.ui-empty__icon-okfEc{display:flex;align-items:center;justify-content:center;width:64px;height:64px;border-radius:var(--hd-radius-pill);background-color:var(--hd-bg-raised);border:1px solid var(--hd-border);color:var(--hd-text-2);font-size:var(--hd-type-h2-size);margin-bottom:var(--hd-space-1)}.ui-empty__title-Z7Dzd{font-family:var(--hd-font-display);font-size:var(--hd-type-title-4-size);font-weight:var(--hd-type-title-4-weight);font-stretch:var(--hd-type-title-4-stretch);line-height:var(--hd-type-title-4-line-height);letter-spacing:var(--hd-type-title-4-letter-spacing);color:var(--hd-text);margin:0;text-wrap:balance}.ui-empty__description-6BoCk{font-size:var(--hd-type-small-size);line-height:var(--hd-type-body-line-height);color:var(--hd-text-2);margin:0;max-width:48ch;text-wrap:pretty}.ui-empty__actions-ARk-k{display:flex;flex-wrap:wrap;align-items:center;gap:var(--hd-space-2);justify-content:center;margin-top:var(--hd-space-2)}@media (max-width: 640px){.ui-empty__actions-ARk-k{width:100%;max-width:320px;flex-direction:column}.ui-empty__actions-ARk-k>*{width:100%}}.ui-empty--sm-QXaXx{padding:var(--hd-space-6) var(--hd-space-4)}.ui-empty--sm-QXaXx .ui-empty__icon-okfEc{width:48px;height:48px;font-size:24px}.ui-empty--sm-QXaXx .ui-empty__title-Z7Dzd{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)}.ui-empty--error-4BBgp .ui-empty__icon-okfEc{color:var(--hd-danger-fg);background-color:var(--hd-danger-bg)}.ui-empty--error-4BBgp .ui-empty__title-Z7Dzd{color:var(--hd-danger-fg)}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const e=require("react/jsx-runtime"),o=require("react"),ne=require("react-bootstrap-icons"),V=require("../../helpers/class-name.helper.cjs"),ce=require("../../helpers/facet.helper.cjs"),le=require("../../helpers/component.helper.cjs"),i=require("../../helpers/label.helper.cjs"),ie=require("../../helpers/text.helper.cjs"),ue=require("../../theme/context.cjs"),E=require("../Button/index.cjs"),re=require("../Checkbox/index.cjs"),de=require("../Disclosure/index.cjs"),X=require("../Field/index.cjs"),oe=require("../Input/index.cjs"),me=require("../Link/index.cjs"),p=require("../MoneyInput/index.cjs"),xe=require("../Radio/index.cjs"),O=require("../../enums/ui-variant.enum.cjs"),w=require("../../enums/ui-size.enum.cjs"),s={default:{"facet":"ui-facet-xZdJq","facet--clearable":"ui-facet--clearable-XxXO6","facet__badge":"ui-facet__badge-ucqG8","facet__body":"ui-facet__body-BDkd5","facet__more":"ui-facet__more-KNTTK","facet__clear":"ui-facet__clear-u7jSe","facet__empty":"ui-facet__empty-J3b8a","list":"ui-list-rvHMk","option":"ui-option-5Rvb-","option__control":"ui-option__control-1ufGr","option__row":"ui-option__row-d-bHC","option__label":"ui-option__label-vQmG-","option__count":"ui-option__count-STK-j","option--link":"ui-option--link-p4N1J","option--current":"ui-option--current-EnWCM","range":"ui-range-ruqV-","range__fields":"ui-range__fields-BeRrd","srOnly":"ui-srOnly-86AuY"}},he=6,fe=10,_e=({title:j,mode:u="checkbox",options:v=[],selected:m=[],onChange:x,range:r,onRangeChange:S,minorDigits:z=2,currency:A,visibleCount:I=he,searchThreshold:W=fe,onClear:T,isDefaultOpen:Y=!0,children:H,selectedCount:$,labels:a,className:J,testId:K})=>{var U,G;const{labels:l}=ue.useUi(),n=l==null?void 0:l.facets,Q=o.useId(),[R,Z]=o.useState(""),[N,b]=o.useState(!1),[F,q]=o.useState(r??{min:null,max:null}),L=(r==null?void 0:r.min)??null,M=(r==null?void 0:r.max)??null;o.useEffect(()=>q({min:L,max:M}),[L,M]);const f=$??(u==="range"?+(L!==null)+ +(M!==null):H?0:m.length),d=R.trim(),_=o.useMemo(()=>d?v.filter(t=>ie.matchesSearch(t.label,d)):v,[v,d]),y=d||N?_:ce.foldedOptions(_,m,I),C=_.length-y.length,P=!d&&_.length>I,ee=t=>x==null?void 0:x(m.includes(t)?m.filter(c=>c!==t):[...m,t]),te=t=>{t.preventDefault(),S==null||S(F)},g=t=>{const c=m.includes(t.value),h=t.isDisabled||t.count===0&&!c,D=e.jsxs("span",{className:s.default.option__row,children:[e.jsx("span",{className:s.default.option__label,children:t.label}),t.count!==void 0&&e.jsx("span",{className:s.default.option__count,children:t.count})]});return u==="link"?e.jsx("li",{children:e.jsx(me.default,{...t.linkProps,href:t.href??"#",className:V.cx(s.default.option,s.default["option--link"],c&&s.default["option--current"]),"aria-current":c?"page":void 0,children:D})},t.value):u==="radio"?e.jsx("div",{className:s.default.option,children:e.jsx(xe.default,{name:Q,label:D,checked:c,disabled:h,className:s.default.option__control,onChange:()=>x==null?void 0:x([t.value])})},t.value):e.jsx("div",{className:s.default.option,children:e.jsx(re.default,{className:s.default.option__control,label:D,checked:c,disabled:h,onChange:()=>ee(t.value)})},t.value)},ae=u==="link"?e.jsx("ul",{className:s.default.list,children:y.map(g)}):e.jsx("div",{className:s.default.list,role:u==="radio"?"radiogroup":"group","aria-label":j,children:y.map(g)}),se=e.jsxs("form",{className:s.default.range,onSubmit:te,children:[e.jsxs("div",{className:s.default.range__fields,children:[e.jsx(X.default,{label:i.resolveLabel("FacetSection.labels.min",a==null?void 0:a.min,(U=l==null?void 0:l.range)==null?void 0:U.min),children:t=>e.jsx(p.default,{...t,size:"sm",minorDigits:z,currency:A,value:F.min,onChange:c=>q(h=>({...h,min:c}))})}),e.jsx(X.default,{label:i.resolveLabel("FacetSection.labels.max",a==null?void 0:a.max,(G=l==null?void 0:l.range)==null?void 0:G.max),children:t=>e.jsx(p.default,{...t,size:"sm",minorDigits:z,currency:A,value:F.max,onChange:c=>q(h=>({...h,max:c}))})})]}),e.jsx(E.default,{type:"submit",variant:O.default.SECONDARY,size:w.default.SMALL,isFullWidth:!0,children:i.resolveLabel("FacetSection.labels.applyRange",a==null?void 0:a.applyRange,n==null?void 0:n.applyRange)})]}),k=v.length>W&&u!=="range"?i.resolveFormatter("FacetSection.labels.search",(a==null?void 0:a.search)??(n==null?void 0:n.search),j):null,B=!!T&&f>0;return e.jsxs("div",{className:V.cx(s.default.facet,B&&s.default["facet--clearable"],J),"data-testid":K,children:[e.jsx(de.default,{variant:"plain",className:s.default.facet__disclosure,isDefaultOpen:Y||f>0,summary:j,meta:f>0?e.jsxs(e.Fragment,{children:[e.jsx("span",{"aria-hidden":!0,className:s.default.facet__badge,children:f}),e.jsx("span",{className:s.default.srOnly,children:i.resolveFormatter("FacetSection.labels.selected",(a==null?void 0:a.selected)??(n==null?void 0:n.selected),f)})]}):void 0,children:e.jsx("div",{className:s.default.facet__body,children:H??e.jsxs(e.Fragment,{children:[k!==null&&e.jsx(oe.default,{type:"search",size:"sm",value:R,placeholder:k,"aria-label":k,prefix:e.jsx(ne.Search,{"aria-hidden":!0}),onChange:t=>Z(t.target.value)}),u==="range"?se:ae,d&&_.length===0&&e.jsx("p",{role:"status",className:s.default.facet__empty,children:i.resolveFormatter("FacetSection.labels.noMatch",(a==null?void 0:a.noMatch)??(n==null?void 0:n.noMatch),d)}),P&&u!=="range"&&e.jsx(E.default,{variant:O.default.GHOST,size:w.default.XSMALL,className:s.default.facet__more,"aria-expanded":N,onClick:()=>b(t=>!t),children:N?i.resolveLabel("FacetSection.labels.showLess",a==null?void 0:a.showLess,n==null?void 0:n.showLess):i.resolveFormatter("FacetSection.labels.showMore",(a==null?void 0:a.showMore)??(n==null?void 0:n.showMore),C)})]})})}),B&&e.jsx(E.default,{variant:O.default.GHOST,size:w.default.XSMALL,className:s.default.facet__clear,onClick:T,children:i.resolveLabel("FacetSection.labels.clear",a==null?void 0:a.clear,n==null?void 0:n.clear)})]})},ve=o.memo(le.named(_e,"FacetSection"));exports.default=ve;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|