@handijitcom/ui 3.2.0 → 3.3.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 +111 -4
- package/build/components/Accordion/index.cjs +1 -1
- package/build/components/AppShell/Nav.cjs +1 -1
- package/build/components/AppShell/Nav.js +1 -1
- package/build/components/AppShell/context.js +2 -2
- package/build/components/AppShell/index.cjs +1 -1
- package/build/components/AppShell/index.cjs.map +1 -1
- package/build/components/AppShell/index.js +62 -55
- package/build/components/AppShell/index.js.map +1 -1
- package/build/components/AppShell/style.css +1 -1
- package/build/components/BottomSheet/index.cjs +1 -1
- package/build/components/BottomSheet/style.css +1 -1
- package/build/components/Breadcrumb/index.cjs +1 -1
- package/build/components/Breadcrumb/index.cjs.map +1 -1
- package/build/components/Breadcrumb/index.d.cts +11 -1
- package/build/components/Breadcrumb/index.d.ts +11 -1
- package/build/components/Breadcrumb/index.js +70 -22
- package/build/components/Breadcrumb/index.js.map +1 -1
- package/build/components/Breadcrumb/style.css +1 -1
- package/build/components/BulkPasteInput/index.cjs +1 -1
- package/build/components/Button/index.cjs +1 -1
- package/build/components/Carousel/index.cjs +1 -1
- package/build/components/ChipGroup/index.cjs +1 -1
- package/build/components/Combobox/index.cjs +1 -1
- package/build/components/CommandPalette/index.cjs +1 -1
- package/build/components/ConfirmDialog/index.cjs +1 -1
- package/build/components/DataTable/index.cjs +1 -1
- package/build/components/DataTable/index.cjs.map +1 -1
- package/build/components/DataTable/index.js +68 -67
- package/build/components/DataTable/index.js.map +1 -1
- package/build/components/DataTable/style.css +1 -1
- package/build/components/DataTableColumnMenu/index.cjs +1 -1
- package/build/components/DateField/index.js +1 -1
- package/build/components/Directory/index.js +1 -1
- package/build/components/Drawer/index.cjs +1 -1
- package/build/components/Drawer/style.css +1 -1
- package/build/components/Eyebrow/index.cjs +1 -1
- package/build/components/Eyebrow/index.cjs.map +1 -1
- package/build/components/Eyebrow/index.d.cts +6 -1
- package/build/components/Eyebrow/index.d.ts +6 -1
- package/build/components/Eyebrow/index.js +25 -6
- package/build/components/Eyebrow/index.js.map +1 -1
- package/build/components/Eyebrow/style.css +1 -1
- package/build/components/FileUpload/index.cjs +1 -1
- package/build/components/FilterBar/index.js +1 -1
- package/build/components/Gallery/index.cjs +1 -1
- package/build/components/Gallery/index.cjs.map +1 -1
- package/build/components/Gallery/index.js +28 -28
- package/build/components/Gallery/index.js.map +1 -1
- package/build/components/Gallery/style.css +1 -1
- package/build/components/Modal/index.cjs +1 -1
- package/build/components/Modal/style.css +1 -1
- package/build/components/MoneyInput/index.cjs +1 -1
- package/build/components/NotificationCenter/index.cjs +1 -1
- package/build/components/PageHeader/index.cjs +1 -1
- package/build/components/PageHeader/index.cjs.map +1 -1
- package/build/components/PageHeader/index.d.cts +5 -0
- package/build/components/PageHeader/index.d.ts +5 -0
- package/build/components/PageHeader/index.js +38 -28
- package/build/components/PageHeader/index.js.map +1 -1
- package/build/components/PageHeader/style.css +1 -1
- package/build/components/Pagination/index.cjs +1 -1
- package/build/components/Panel/index.js +1 -1
- package/build/components/PasswordInput/index.cjs +1 -1
- package/build/components/PercentInput/index.cjs +1 -1
- package/build/components/Popover/style.css +1 -1
- package/build/components/Price/index.cjs +1 -1
- package/build/components/Price/index.cjs.map +1 -1
- package/build/components/Price/index.d.cts +8 -0
- package/build/components/Price/index.d.ts +8 -0
- package/build/components/Price/index.js +44 -35
- package/build/components/Price/index.js.map +1 -1
- package/build/components/Price/style.css +1 -1
- package/build/components/PromptDialog/index.cjs +1 -1
- package/build/components/QuantityInput/index.cjs +1 -1
- package/build/components/RateInput/index.cjs +1 -1
- package/build/components/ScaledInput/index.cjs +1 -1
- package/build/components/SectionHeader/index.cjs +1 -1
- package/build/components/SectionHeader/index.cjs.map +1 -1
- package/build/components/SectionHeader/index.d.cts +2 -0
- package/build/components/SectionHeader/index.d.ts +2 -0
- package/build/components/SectionHeader/index.js +25 -15
- package/build/components/SectionHeader/index.js.map +1 -1
- package/build/components/SectionHeader/style.css +1 -1
- package/build/components/Select/index.cjs +1 -1
- package/build/components/Switch/index.js +4 -4
- 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.js +120 -80
- package/build/components/Tabs/index.js.map +1 -1
- package/build/components/Tabs/style.css +1 -1
- package/build/components/Toast/index.cjs +1 -1
- package/build/components/Toast/style.css +1 -1
- package/build/components/ToastPortal/index.cjs +1 -1
- package/build/components/TotalsList/index.cjs +2 -0
- package/build/components/TotalsList/index.cjs.map +1 -0
- package/build/components/TotalsList/index.d.cts +26 -0
- package/build/components/TotalsList/index.d.ts +26 -0
- package/build/components/TotalsList/index.js +22 -0
- package/build/components/TotalsList/index.js.map +1 -0
- package/build/components/TotalsList/style.css +1 -0
- package/build/components/TreeSelect/index.cjs +1 -1
- package/build/components/UserMenu/index.cjs +1 -1
- package/build/constants/breakpoint.constants.cjs +1 -1
- package/build/constants/breakpoint.constants.cjs.map +1 -1
- package/build/constants/breakpoint.constants.d.cts +2 -0
- package/build/constants/breakpoint.constants.d.ts +2 -0
- package/build/constants/breakpoint.constants.js +5 -4
- package/build/constants/breakpoint.constants.js.map +1 -1
- package/build/helpers/scroll.helper.cjs +1 -1
- package/build/helpers/scroll.helper.cjs.map +1 -1
- package/build/helpers/scroll.helper.d.cts +6 -0
- package/build/helpers/scroll.helper.d.ts +6 -0
- package/build/helpers/scroll.helper.js +10 -5
- package/build/helpers/scroll.helper.js.map +1 -1
- package/build/hooks/usePrinting.cjs +2 -0
- package/build/hooks/usePrinting.cjs.map +1 -0
- package/build/hooks/usePrinting.d.cts +8 -0
- package/build/hooks/usePrinting.d.ts +8 -0
- package/build/hooks/usePrinting.js +18 -0
- package/build/hooks/usePrinting.js.map +1 -0
- package/build/index.cjs +1 -1
- package/build/index.d.cts +2 -1
- package/build/index.d.ts +2 -1
- package/build/index.js +88 -86
- package/build/index.js.map +1 -1
- package/build/scss/_mixins.scss +8 -0
- package/build/styles.css +18 -16
- package/build/theme/context.js +2 -2
- package/build/types/theme.type.d.cts +5 -0
- package/build/types/theme.type.d.ts +5 -0
- package/build/types/types/theme.type.d.cts +5 -0
- package/build/types/types/theme.type.d.ts +5 -0
- package/package.json +11 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { jsx as a, jsxs as d } from "react/jsx-runtime";
|
|
2
2
|
import { memo as c } from "react";
|
|
3
3
|
import { cx as m } from "../../helpers/class-name.helper.js";
|
|
4
4
|
import { named as _ } from "../../helpers/component.helper.js";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),a=require("react"),r=require("react-bootstrap-icons"),_=require("../../helpers/component.helper.cjs"),n=require("../../helpers/label.helper.cjs"),w=require("../../theme/context.cjs"),x=require("../IconButton/index.cjs"),h=require("../Input/index.cjs"),o={default:{"password":"ui-password-viMea","password__field":"ui-password__field-WI1h1","password__toggle":"ui-password__toggle-O6R2a"}},f=({className:i,showLabel:l,hideLabel:u,...d})=>{const{labels:e}=w.useUi(),[t,c]=a.useState(!1),p=t?n.resolveLabel("PasswordInput.hideLabel",u,e==null?void 0:e.passwordHide):n.resolveLabel("PasswordInput.showLabel",l,e==null?void 0:e.passwordShow);return s.jsxs("span",{className:o.default.password,children:[s.jsx(h.default,{...d,className:`${o.default.password__field} ${i??""}`.trim(),type:t?"text":"password"}),s.jsx(x.default,{className:o.default.password__toggle,icon:t?s.jsx(r.EyeSlashFill,{"aria-hidden":!0}):s.jsx(r.EyeFill,{"aria-hidden":!0}),label:p,variant:"ghost",size:"sm",onClick:()=>c(m=>!m)})]})},q=a.memo(_.named(f,"PasswordInput"));exports.default=q;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const o=require("react/jsx-runtime"),e=require("react"),s=require("../../constants/scale.constants.cjs"),c=require("../../helpers/component.helper.cjs"),u=require("../ScaledInput/index.cjs"),i=e.forwardRef(({prefix:t="%",...n},r)=>o.jsx(u.default,{ref:r,...n,prefix:t,scaleDigits:s.PCT2_DIGITS})),a=e.memo(c.named(i,"PercentInput"));exports.default=a;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer ui{.ui-popover-VxgiK{z-index:var(--hd-z-popover);min-width:200px;max-width:min(360px,100vw - var(--hd-space-6));padding:var(--hd-space-3);border-radius:var(--hd-radius-md);background-color:var(--hd-bg-overlay);border:1px solid var(--hd-border);box-shadow:var(--hd-shadow-2);color:var(--hd-text);font-size:var(--hd-type-small-size);line-height:var(--hd-type-body-line-height);text-align:start}.ui-popover--top-OUYwo{animation:var(--ui-anim-fade-in-up) var(--hd-duration-fast) var(--hd-ease-standard)}.ui-popover--bottom-Q1K4X{animation:var(--ui-anim-fade-in-down) var(--hd-duration-fast) var(--hd-ease-standard)}.ui-popover--left-9Rsjx,.ui-popover--right-0TJeo{animation:var(--ui-anim-fade-in) var(--hd-duration-fast) var(--hd-ease-standard)}@media (prefers-reduced-motion: reduce){.ui-popover-VxgiK{animation:none}}@media (forced-colors: active){.ui-popover-VxgiK{border-color:CanvasText}}}
|
|
1
|
+
@layer ui{.ui-popover-VxgiK{z-index:var(--hd-z-popover);min-width:200px;max-width:min(360px,100vw - var(--hd-space-6));padding:var(--hd-space-3);border-radius:var(--hd-radius-md);background-color:var(--hd-bg-overlay);border:1px solid var(--hd-border);box-shadow:var(--hd-shadow-2);color:var(--hd-text);font-size:var(--hd-type-small-size);line-height:var(--hd-type-body-line-height);text-align:start}.ui-popover--top-OUYwo{animation:var(--ui-anim-fade-in-up) var(--hd-duration-fast) var(--hd-ease-standard)}.ui-popover--bottom-Q1K4X{animation:var(--ui-anim-fade-in-down) var(--hd-duration-fast) var(--hd-ease-standard)}.ui-popover--left-9Rsjx,.ui-popover--right-0TJeo{animation:var(--ui-anim-fade-in) var(--hd-duration-fast) var(--hd-ease-standard)}@media (prefers-reduced-motion: reduce){.ui-popover-VxgiK{animation:none}}@media (forced-colors: active){.ui-popover-VxgiK{border-color:CanvasText}}@media print{.ui-popover-VxgiK{display:none}}}
|
|
@@ -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"),b=require("react"),d=require("../../helpers/class-name.helper.cjs"),q=require("../../helpers/label.helper.cjs"),v=require("../../theme/context.cjs"),t={default:{"price":"ui-price-Oc5Nr","price__current":"ui-price__current-2Xup2","price__currency":"ui-price__currency-32NLN","price__currency--prefix":"ui-price__currency--prefix-dlva8","price__list":"ui-price__list-MlQgT","price__discount":"ui-price__discount-5Yc6W","price--sm":"ui-price--sm-Hd8Oe","price--md":"ui-price--md-JMxlK","price--lg":"ui-price--lg-TFqIF","price--xl":"ui-price--xl-EJBYq"}},F="₺",I=/^[-\u2212]/,S=({value:m,currency:f,currencyPosition:p,listValue:u,discountPercent:n,formatDiscount:x=r=>`%${r}`,isFormatted:_,size:h="md",className:N,testId:j})=>{const{labels:r}=v.useUi(),i=q.resolveLabel("Price.currency",f,r==null?void 0:r.currency),g=(p??(i===F?"prefix":"suffix"))==="prefix",y=c=>{if(!_||!(r!=null&&r.locale)||!/\d/.test(c))return c;const s=Number(c.replace(/[^\d.,-]/g,"").replace(/\.(?=\d{3}\b)/g,"").replace(",","."));if(!Number.isFinite(s))return c;try{return new Intl.NumberFormat(r.locale).format(s)}catch{return c}},l=c=>{var o;const s=y(c);if(!g)return e.jsxs(e.Fragment,{children:[s,e.jsx("span",{className:t.default.price__currency,children:i})]});const a=((o=I.exec(s))==null?void 0:o[0])??"";return e.jsxs(e.Fragment,{children:[a,e.jsx("span",{className:d.cx(t.default.price__currency,t.default["price__currency--prefix"]),children:i}),s.slice(a.length)]})};return e.jsxs("span",{className:d.cx(t.default.price,t.default[`price--${h}`],N),"data-testid":j,children:[e.jsx("span",{className:t.default.price__current,children:l(m)}),u&&e.jsx("s",{className:t.default.price__list,children:l(u)}),n!==void 0&&n>0&&e.jsx("span",{className:t.default.price__discount,children:x(n)})]})},G=b.memo(S);exports.default=G;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/Price/index.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, memo } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n /** BİÇİMLENMİŞ tutar: \"1.299,90\". */\n value: string;\n /** Para birimi simgesi ya da kodu. */\n currency?: string;\n /** Değeri `Intl.NumberFormat` ile biçimlendirir. */\n isFormatted?: boolean;\n /** Üstü çizili liste fiyatı; indirim varsa verilir (biçimlenmiş). */\n listValue?: string;\n /** İndirim oranı (tam sayı yüzde). */\n discountPercent?: number;\n /** İndirim rozetinin metnini üretir (\"%20\", \"-20%\"). */\n formatDiscount?: (percent: number) => string;\n size?: 'sm' | 'md' | 'lg' | 'xl';\n className?: string;\n testId?: string;\n};\n\n/** Tutar gösterimi. */\nconst Price: FC<Props> = ({\n value,\n currency,\n listValue,\n discountPercent,\n formatDiscount = percent => `%${percent}`,\n isFormatted,\n size = 'md',\n className,\n testId,\n}) => {\n const { labels } = useUi();\n const symbol = resolveLabel('Price.currency', currency, labels?.currency);\n\n /* BICIMLENDIRME OPSIYONEL ve yerel ayara BAGLI. */\n const format = (raw: string): string => {\n if (!isFormatted || !labels?.locale) return raw;\n\n /* RAKAM ICERMEYEN deger biciMLENDIRILMEZ. */\n if (!/\\d/.test(raw)) return raw;\n\n const numeric = Number(\n raw\n .replace(/[^\\d.,-]/g, '')\n .replace(/\\.(?=\\d{3}\\b)/g, '')\n .replace(',', '.'),\n );\n if (!Number.isFinite(numeric)) return raw;\n\n try {\n return new Intl.NumberFormat(labels.locale).format(numeric);\n } catch {\n return raw;\n }\n };\n\n return (\n <span className={cx(styles.price, styles[`price--${size}`], className)} data-testid={testId}>\n <span className={styles.price__current}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/Price/index.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\n/** `prefix`: \"₺2.649,57\". `suffix`: \"2.649,57₺\". */\nexport type PriceCurrencyPosition = 'prefix' | 'suffix';\n\ntype Props = {\n /** BİÇİMLENMİŞ tutar: \"1.299,90\". */\n value: string;\n /** Para birimi simgesi ya da kodu. */\n currency?: string;\n /**\n * Where the symbol sits. Default: `prefix` for \"₺\" — the ecosystem's lira format, as\n * `@handijitcom/tr` `formatLira` writes it (\"₺2.649,57\", \"-₺0,05\", no space) — and `suffix` for any\n * other symbol or code (\"2.649,57 TL\" style, as before 3.2.1).\n */\n currencyPosition?: PriceCurrencyPosition;\n /** Değeri `Intl.NumberFormat` ile biçimlendirir. */\n isFormatted?: boolean;\n /** Üstü çizili liste fiyatı; indirim varsa verilir (biçimlenmiş). */\n listValue?: string;\n /** İndirim oranı (tam sayı yüzde). */\n discountPercent?: number;\n /** İndirim rozetinin metnini üretir (\"%20\", \"-20%\"). */\n formatDiscount?: (percent: number) => string;\n size?: 'sm' | 'md' | 'lg' | 'xl';\n className?: string;\n testId?: string;\n};\n\n/** The lira sign: written before the amount by default (3.2.1). */\nconst LIRA_SIGN = '₺';\n/* A leading minus (ASCII or U+2212) stays in front of a prefixed symbol: \"-₺0,05\". */\nconst SIGN = /^[-\\u2212]/;\n\n/** Tutar gösterimi. */\nconst Price: FC<Props> = ({\n value,\n currency,\n currencyPosition,\n listValue,\n discountPercent,\n formatDiscount = percent => `%${percent}`,\n isFormatted,\n size = 'md',\n className,\n testId,\n}) => {\n const { labels } = useUi();\n const symbol = resolveLabel('Price.currency', currency, labels?.currency);\n const isPrefix = (currencyPosition ?? (symbol === LIRA_SIGN ? 'prefix' : 'suffix')) === 'prefix';\n\n /* BICIMLENDIRME OPSIYONEL ve yerel ayara BAGLI. */\n const format = (raw: string): string => {\n if (!isFormatted || !labels?.locale) return raw;\n\n /* RAKAM ICERMEYEN deger biciMLENDIRILMEZ. */\n if (!/\\d/.test(raw)) return raw;\n\n const numeric = Number(\n raw\n .replace(/[^\\d.,-]/g, '')\n .replace(/\\.(?=\\d{3}\\b)/g, '')\n .replace(',', '.'),\n );\n if (!Number.isFinite(numeric)) return raw;\n\n try {\n return new Intl.NumberFormat(labels.locale).format(numeric);\n } catch {\n return raw;\n }\n };\n\n const amount = (raw: string): ReactNode => {\n const text = format(raw);\n if (!isPrefix) {\n return (\n <>\n {text}\n <span className={styles.price__currency}>{symbol}</span>\n </>\n );\n }\n\n const sign = SIGN.exec(text)?.[0] ?? '';\n return (\n <>\n {sign}\n <span className={cx(styles.price__currency, styles['price__currency--prefix'])}>\n {symbol}\n </span>\n {text.slice(sign.length)}\n </>\n );\n };\n\n return (\n <span className={cx(styles.price, styles[`price--${size}`], className)} data-testid={testId}>\n <span className={styles.price__current}>{amount(value)}</span>\n\n {listValue && <s className={styles.price__list}>{amount(listValue)}</s>}\n\n {/* `isDefined` DEGIL acik karsilastirma: handy-utils'in koruyucusu\n `Exclude<any, …>` donuyor ve TypeScript'te daraltma uretmiyor. */}\n {discountPercent !== undefined && discountPercent > 0 && (\n <span className={styles.price__discount}>{formatDiscount(discountPercent)}</span>\n )}\n </span>\n );\n};\n\nexport default /*#__PURE__*/ memo(Price) as typeof Price;\n"],"names":["LIRA_SIGN","SIGN","Price","value","currency","currencyPosition","listValue","discountPercent","formatDiscount","percent","isFormatted","size","className","testId","labels","useUi","symbol","resolveLabel","isPrefix","format","raw","numeric","amount","text","jsxs","Fragment","jsx","styles","sign","_a","cx","index"],"mappings":"wVAqCMA,EAAY,IAEZC,EAAO,aAGPC,EAAmB,CAAC,CACxB,MAAAC,EACA,SAAAC,EACA,iBAAAC,EACA,UAAAC,EACA,gBAAAC,EACA,eAAAC,EAAiBC,GAAW,IAAIA,CAAO,GACvC,YAAAC,EACA,KAAAC,EAAO,KACP,UAAAC,EACA,OAAAC,CACF,IAAM,CACJ,KAAM,CAAE,OAAAC,CAAA,EAAWC,QAAA,EACbC,EAASC,EAAAA,aAAa,iBAAkBb,EAAUU,GAAA,YAAAA,EAAQ,QAAQ,EAClEI,GAAYb,IAAqBW,IAAWhB,EAAY,SAAW,aAAe,SAGlFmB,EAAUC,GAAwB,CAItC,GAHI,CAACV,GAAe,EAACI,GAAA,MAAAA,EAAQ,SAGzB,CAAC,KAAK,KAAKM,CAAG,EAAG,OAAOA,EAE5B,MAAMC,EAAU,OACdD,EACG,QAAQ,YAAa,EAAE,EACvB,QAAQ,iBAAkB,EAAE,EAC5B,QAAQ,IAAK,GAAG,CAAA,EAErB,GAAI,CAAC,OAAO,SAASC,CAAO,EAAG,OAAOD,EAEtC,GAAI,CACF,OAAO,IAAI,KAAK,aAAaN,EAAO,MAAM,EAAE,OAAOO,CAAO,CAC5D,MAAQ,CACN,OAAOD,CACT,CACF,EAEME,EAAUF,GAA2B,OACzC,MAAMG,EAAOJ,EAAOC,CAAG,EACvB,GAAI,CAACF,EACH,OACEM,EAAAA,KAAAC,WAAA,CACG,SAAA,CAAAF,EACDG,EAAAA,IAAC,OAAA,CAAK,UAAWC,EAAAA,QAAO,gBAAkB,SAAAX,CAAA,CAAO,CAAA,EACnD,EAIJ,MAAMY,IAAOC,EAAA5B,EAAK,KAAKsB,CAAI,IAAd,YAAAM,EAAkB,KAAM,GACrC,OACEL,EAAAA,KAAAC,WAAA,CACG,SAAA,CAAAG,EACDF,EAAAA,IAAC,OAAA,CAAK,UAAWI,EAAAA,GAAGH,EAAAA,QAAO,gBAAiBA,EAAAA,QAAO,yBAAyB,CAAC,EAC1E,SAAAX,CAAA,CACH,EACCO,EAAK,MAAMK,EAAK,MAAM,CAAA,EACzB,CAEJ,EAEA,OACEJ,EAAAA,KAAC,OAAA,CAAK,UAAWM,EAAAA,GAAGH,EAAAA,QAAO,MAAOA,EAAAA,QAAO,UAAUhB,CAAI,EAAE,EAAGC,CAAS,EAAG,cAAaC,EACnF,SAAA,CAAAa,MAAC,QAAK,UAAWC,EAAAA,QAAO,eAAiB,SAAAL,EAAOnB,CAAK,EAAE,EAEtDG,SAAc,IAAA,CAAE,UAAWqB,EAAAA,QAAO,YAAc,SAAAL,EAAOhB,CAAS,EAAE,EAIlEC,IAAoB,QAAaA,EAAkB,GAClDmB,EAAAA,IAAC,OAAA,CAAK,UAAWC,EAAAA,QAAO,gBAAkB,SAAAnB,EAAeD,CAAe,CAAA,CAAE,CAAA,EAE9E,CAEJ,EAEAwB,SAAkC7B,CAAK"}
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
/** `prefix`: "₺2.649,57". `suffix`: "2.649,57₺". */
|
|
3
|
+
export type PriceCurrencyPosition = 'prefix' | 'suffix';
|
|
2
4
|
type Props = {
|
|
3
5
|
/** BİÇİMLENMİŞ tutar: "1.299,90". */
|
|
4
6
|
value: string;
|
|
5
7
|
/** Para birimi simgesi ya da kodu. */
|
|
6
8
|
currency?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Where the symbol sits. Default: `prefix` for "₺" — the ecosystem's lira format, as
|
|
11
|
+
* `@handijitcom/tr` `formatLira` writes it ("₺2.649,57", "-₺0,05", no space) — and `suffix` for any
|
|
12
|
+
* other symbol or code ("2.649,57 TL" style, as before 3.2.1).
|
|
13
|
+
*/
|
|
14
|
+
currencyPosition?: PriceCurrencyPosition;
|
|
7
15
|
/** Değeri `Intl.NumberFormat` ile biçimlendirir. */
|
|
8
16
|
isFormatted?: boolean;
|
|
9
17
|
/** Üstü çizili liste fiyatı; indirim varsa verilir (biçimlenmiş). */
|
|
@@ -1,9 +1,17 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
/** `prefix`: "₺2.649,57". `suffix`: "2.649,57₺". */
|
|
3
|
+
export type PriceCurrencyPosition = 'prefix' | 'suffix';
|
|
2
4
|
type Props = {
|
|
3
5
|
/** BİÇİMLENMİŞ tutar: "1.299,90". */
|
|
4
6
|
value: string;
|
|
5
7
|
/** Para birimi simgesi ya da kodu. */
|
|
6
8
|
currency?: string;
|
|
9
|
+
/**
|
|
10
|
+
* Where the symbol sits. Default: `prefix` for "₺" — the ecosystem's lira format, as
|
|
11
|
+
* `@handijitcom/tr` `formatLira` writes it ("₺2.649,57", "-₺0,05", no space) — and `suffix` for any
|
|
12
|
+
* other symbol or code ("2.649,57 TL" style, as before 3.2.1).
|
|
13
|
+
*/
|
|
14
|
+
currencyPosition?: PriceCurrencyPosition;
|
|
7
15
|
/** Değeri `Intl.NumberFormat` ile biçimlendirir. */
|
|
8
16
|
isFormatted?: boolean;
|
|
9
17
|
/** Üstü çizili liste fiyatı; indirim varsa verilir (biçimlenmiş). */
|
|
@@ -1,46 +1,55 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { jsxs as
|
|
3
|
-
import { memo as
|
|
4
|
-
import { cx as
|
|
5
|
-
import { resolveLabel as
|
|
6
|
-
import { useUi as
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
value:
|
|
10
|
-
currency:
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
2
|
+
import { jsxs as o, jsx as t, Fragment as u } from "react/jsx-runtime";
|
|
3
|
+
import { memo as j } from "react";
|
|
4
|
+
import { cx as f } from "../../helpers/class-name.helper.js";
|
|
5
|
+
import { resolveLabel as v } from "../../helpers/label.helper.js";
|
|
6
|
+
import { useUi as G } from "../../theme/context.js";
|
|
7
|
+
const c = {"price":"ui-price-Oc5Nr","price__current":"ui-price__current-2Xup2","price__currency":"ui-price__currency-32NLN","price__currency--prefix":"ui-price__currency--prefix-dlva8","price__list":"ui-price__list-MlQgT","price__discount":"ui-price__discount-5Yc6W","price--sm":"ui-price--sm-Hd8Oe","price--md":"ui-price--md-JMxlK","price--lg":"ui-price--lg-TFqIF","price--xl":"ui-price--xl-EJBYq"};
|
|
8
|
+
const L = "₺", S = /^[-\u2212]/, $ = ({
|
|
9
|
+
value: d,
|
|
10
|
+
currency: _,
|
|
11
|
+
currencyPosition: x,
|
|
12
|
+
listValue: m,
|
|
13
|
+
discountPercent: i,
|
|
14
|
+
formatDiscount: N = (r) => `%${r}`,
|
|
15
|
+
isFormatted: h,
|
|
16
|
+
size: y = "md",
|
|
17
|
+
className: g,
|
|
18
|
+
testId: I
|
|
18
19
|
}) => {
|
|
19
|
-
const { labels: r } =
|
|
20
|
-
if (!
|
|
21
|
-
const
|
|
22
|
-
|
|
20
|
+
const { labels: r } = G(), s = v("Price.currency", _, r == null ? void 0 : r.currency), b = (x ?? (s === L ? "prefix" : "suffix")) === "prefix", F = (e) => {
|
|
21
|
+
if (!h || !(r != null && r.locale) || !/\d/.test(e)) return e;
|
|
22
|
+
const n = Number(
|
|
23
|
+
e.replace(/[^\d.,-]/g, "").replace(/\.(?=\d{3}\b)/g, "").replace(",", ".")
|
|
23
24
|
);
|
|
24
|
-
if (!Number.isFinite(
|
|
25
|
+
if (!Number.isFinite(n)) return e;
|
|
25
26
|
try {
|
|
26
|
-
return new Intl.NumberFormat(r.locale).format(
|
|
27
|
+
return new Intl.NumberFormat(r.locale).format(n);
|
|
27
28
|
} catch {
|
|
28
|
-
return
|
|
29
|
+
return e;
|
|
29
30
|
}
|
|
31
|
+
}, p = (e) => {
|
|
32
|
+
var l;
|
|
33
|
+
const n = F(e);
|
|
34
|
+
if (!b)
|
|
35
|
+
return /* @__PURE__ */ o(u, { children: [
|
|
36
|
+
n,
|
|
37
|
+
/* @__PURE__ */ t("span", { className: c.price__currency, children: s })
|
|
38
|
+
] });
|
|
39
|
+
const a = ((l = S.exec(n)) == null ? void 0 : l[0]) ?? "";
|
|
40
|
+
return /* @__PURE__ */ o(u, { children: [
|
|
41
|
+
a,
|
|
42
|
+
/* @__PURE__ */ t("span", { className: f(c.price__currency, c["price__currency--prefix"]), children: s }),
|
|
43
|
+
n.slice(a.length)
|
|
44
|
+
] });
|
|
30
45
|
};
|
|
31
|
-
return /* @__PURE__ */
|
|
32
|
-
/* @__PURE__ */
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
] }),
|
|
36
|
-
n && /* @__PURE__ */ i("s", { className: e.price__list, children: [
|
|
37
|
-
o(n),
|
|
38
|
-
/* @__PURE__ */ t("span", { className: e.price__currency, children: m })
|
|
39
|
-
] }),
|
|
40
|
-
s !== void 0 && s > 0 && /* @__PURE__ */ t("span", { className: e.price__discount, children: u(s) })
|
|
46
|
+
return /* @__PURE__ */ o("span", { className: f(c.price, c[`price--${y}`], g), "data-testid": I, children: [
|
|
47
|
+
/* @__PURE__ */ t("span", { className: c.price__current, children: p(d) }),
|
|
48
|
+
m && /* @__PURE__ */ t("s", { className: c.price__list, children: p(m) }),
|
|
49
|
+
i !== void 0 && i > 0 && /* @__PURE__ */ t("span", { className: c.price__discount, children: N(i) })
|
|
41
50
|
] });
|
|
42
|
-
},
|
|
51
|
+
}, z = /* @__PURE__ */ j($);
|
|
43
52
|
export {
|
|
44
|
-
|
|
53
|
+
z as default
|
|
45
54
|
};
|
|
46
55
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Price/index.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, memo } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n /** BİÇİMLENMİŞ tutar: \"1.299,90\". */\n value: string;\n /** Para birimi simgesi ya da kodu. */\n currency?: string;\n /** Değeri `Intl.NumberFormat` ile biçimlendirir. */\n isFormatted?: boolean;\n /** Üstü çizili liste fiyatı; indirim varsa verilir (biçimlenmiş). */\n listValue?: string;\n /** İndirim oranı (tam sayı yüzde). */\n discountPercent?: number;\n /** İndirim rozetinin metnini üretir (\"%20\", \"-20%\"). */\n formatDiscount?: (percent: number) => string;\n size?: 'sm' | 'md' | 'lg' | 'xl';\n className?: string;\n testId?: string;\n};\n\n/** Tutar gösterimi. */\nconst Price: FC<Props> = ({\n value,\n currency,\n listValue,\n discountPercent,\n formatDiscount = percent => `%${percent}`,\n isFormatted,\n size = 'md',\n className,\n testId,\n}) => {\n const { labels } = useUi();\n const symbol = resolveLabel('Price.currency', currency, labels?.currency);\n\n /* BICIMLENDIRME OPSIYONEL ve yerel ayara BAGLI. */\n const format = (raw: string): string => {\n if (!isFormatted || !labels?.locale) return raw;\n\n /* RAKAM ICERMEYEN deger biciMLENDIRILMEZ. */\n if (!/\\d/.test(raw)) return raw;\n\n const numeric = Number(\n raw\n .replace(/[^\\d.,-]/g, '')\n .replace(/\\.(?=\\d{3}\\b)/g, '')\n .replace(',', '.'),\n );\n if (!Number.isFinite(numeric)) return raw;\n\n try {\n return new Intl.NumberFormat(labels.locale).format(numeric);\n } catch {\n return raw;\n }\n };\n\n return (\n <span className={cx(styles.price, styles[`price--${size}`], className)} data-testid={testId}>\n <span className={styles.price__current}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Price/index.tsx"],"sourcesContent":["'use client';\n\nimport { type FC, memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\n/** `prefix`: \"₺2.649,57\". `suffix`: \"2.649,57₺\". */\nexport type PriceCurrencyPosition = 'prefix' | 'suffix';\n\ntype Props = {\n /** BİÇİMLENMİŞ tutar: \"1.299,90\". */\n value: string;\n /** Para birimi simgesi ya da kodu. */\n currency?: string;\n /**\n * Where the symbol sits. Default: `prefix` for \"₺\" — the ecosystem's lira format, as\n * `@handijitcom/tr` `formatLira` writes it (\"₺2.649,57\", \"-₺0,05\", no space) — and `suffix` for any\n * other symbol or code (\"2.649,57 TL\" style, as before 3.2.1).\n */\n currencyPosition?: PriceCurrencyPosition;\n /** Değeri `Intl.NumberFormat` ile biçimlendirir. */\n isFormatted?: boolean;\n /** Üstü çizili liste fiyatı; indirim varsa verilir (biçimlenmiş). */\n listValue?: string;\n /** İndirim oranı (tam sayı yüzde). */\n discountPercent?: number;\n /** İndirim rozetinin metnini üretir (\"%20\", \"-20%\"). */\n formatDiscount?: (percent: number) => string;\n size?: 'sm' | 'md' | 'lg' | 'xl';\n className?: string;\n testId?: string;\n};\n\n/** The lira sign: written before the amount by default (3.2.1). */\nconst LIRA_SIGN = '₺';\n/* A leading minus (ASCII or U+2212) stays in front of a prefixed symbol: \"-₺0,05\". */\nconst SIGN = /^[-\\u2212]/;\n\n/** Tutar gösterimi. */\nconst Price: FC<Props> = ({\n value,\n currency,\n currencyPosition,\n listValue,\n discountPercent,\n formatDiscount = percent => `%${percent}`,\n isFormatted,\n size = 'md',\n className,\n testId,\n}) => {\n const { labels } = useUi();\n const symbol = resolveLabel('Price.currency', currency, labels?.currency);\n const isPrefix = (currencyPosition ?? (symbol === LIRA_SIGN ? 'prefix' : 'suffix')) === 'prefix';\n\n /* BICIMLENDIRME OPSIYONEL ve yerel ayara BAGLI. */\n const format = (raw: string): string => {\n if (!isFormatted || !labels?.locale) return raw;\n\n /* RAKAM ICERMEYEN deger biciMLENDIRILMEZ. */\n if (!/\\d/.test(raw)) return raw;\n\n const numeric = Number(\n raw\n .replace(/[^\\d.,-]/g, '')\n .replace(/\\.(?=\\d{3}\\b)/g, '')\n .replace(',', '.'),\n );\n if (!Number.isFinite(numeric)) return raw;\n\n try {\n return new Intl.NumberFormat(labels.locale).format(numeric);\n } catch {\n return raw;\n }\n };\n\n const amount = (raw: string): ReactNode => {\n const text = format(raw);\n if (!isPrefix) {\n return (\n <>\n {text}\n <span className={styles.price__currency}>{symbol}</span>\n </>\n );\n }\n\n const sign = SIGN.exec(text)?.[0] ?? '';\n return (\n <>\n {sign}\n <span className={cx(styles.price__currency, styles['price__currency--prefix'])}>\n {symbol}\n </span>\n {text.slice(sign.length)}\n </>\n );\n };\n\n return (\n <span className={cx(styles.price, styles[`price--${size}`], className)} data-testid={testId}>\n <span className={styles.price__current}>{amount(value)}</span>\n\n {listValue && <s className={styles.price__list}>{amount(listValue)}</s>}\n\n {/* `isDefined` DEGIL acik karsilastirma: handy-utils'in koruyucusu\n `Exclude<any, …>` donuyor ve TypeScript'te daraltma uretmiyor. */}\n {discountPercent !== undefined && discountPercent > 0 && (\n <span className={styles.price__discount}>{formatDiscount(discountPercent)}</span>\n )}\n </span>\n );\n};\n\nexport default /*#__PURE__*/ memo(Price) as typeof Price;\n"],"names":["LIRA_SIGN","SIGN","Price","value","currency","currencyPosition","listValue","discountPercent","formatDiscount","percent","isFormatted","size","className","testId","labels","useUi","symbol","resolveLabel","isPrefix","format","raw","numeric","amount","text","jsxs","Fragment","jsx","styles","sign","_a","cx","index"],"mappings":";;;;;;;AAqCA,MAAMA,IAAY,KAEZC,IAAO,cAGPC,IAAmB,CAAC;AAAA,EACxB,OAAAC;AAAA,EACA,UAAAC;AAAA,EACA,kBAAAC;AAAA,EACA,WAAAC;AAAA,EACA,iBAAAC;AAAA,EACA,gBAAAC,IAAiB,CAAAC,MAAW,IAAIA,CAAO;AAAA,EACvC,aAAAC;AAAA,EACA,MAAAC,IAAO;AAAA,EACP,WAAAC;AAAA,EACA,QAAAC;AACF,MAAM;AACJ,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAAA,GACbC,IAASC,EAAa,kBAAkBb,GAAUU,KAAA,gBAAAA,EAAQ,QAAQ,GAClEI,KAAYb,MAAqBW,MAAWhB,IAAY,WAAW,eAAe,UAGlFmB,IAAS,CAACC,MAAwB;AAItC,QAHI,CAACV,KAAe,EAACI,KAAA,QAAAA,EAAQ,WAGzB,CAAC,KAAK,KAAKM,CAAG,EAAG,QAAOA;AAE5B,UAAMC,IAAU;AAAA,MACdD,EACG,QAAQ,aAAa,EAAE,EACvB,QAAQ,kBAAkB,EAAE,EAC5B,QAAQ,KAAK,GAAG;AAAA,IAAA;AAErB,QAAI,CAAC,OAAO,SAASC,CAAO,EAAG,QAAOD;AAEtC,QAAI;AACF,aAAO,IAAI,KAAK,aAAaN,EAAO,MAAM,EAAE,OAAOO,CAAO;AAAA,IAC5D,QAAQ;AACN,aAAOD;AAAA,IACT;AAAA,EACF,GAEME,IAAS,CAACF,MAA2B;;AACzC,UAAMG,IAAOJ,EAAOC,CAAG;AACvB,QAAI,CAACF;AACH,aACE,gBAAAM,EAAAC,GAAA,EACG,UAAA;AAAA,QAAAF;AAAA,QACD,gBAAAG,EAAC,QAAA,EAAK,WAAWC,EAAO,iBAAkB,UAAAX,EAAA,CAAO;AAAA,MAAA,GACnD;AAIJ,UAAMY,MAAOC,IAAA5B,EAAK,KAAKsB,CAAI,MAAd,gBAAAM,EAAkB,OAAM;AACrC,WACE,gBAAAL,EAAAC,GAAA,EACG,UAAA;AAAA,MAAAG;AAAA,MACD,gBAAAF,EAAC,QAAA,EAAK,WAAWI,EAAGH,EAAO,iBAAiBA,EAAO,yBAAyB,CAAC,GAC1E,UAAAX,EAAA,CACH;AAAA,MACCO,EAAK,MAAMK,EAAK,MAAM;AAAA,IAAA,GACzB;AAAA,EAEJ;AAEA,SACE,gBAAAJ,EAAC,QAAA,EAAK,WAAWM,EAAGH,EAAO,OAAOA,EAAO,UAAUhB,CAAI,EAAE,GAAGC,CAAS,GAAG,eAAaC,GACnF,UAAA;AAAA,IAAA,gBAAAa,EAAC,UAAK,WAAWC,EAAO,gBAAiB,UAAAL,EAAOnB,CAAK,GAAE;AAAA,IAEtDG,uBAAc,KAAA,EAAE,WAAWqB,EAAO,aAAc,UAAAL,EAAOhB,CAAS,GAAE;AAAA,IAIlEC,MAAoB,UAAaA,IAAkB,KAClD,gBAAAmB,EAAC,QAAA,EAAK,WAAWC,EAAO,iBAAkB,UAAAnB,EAAeD,CAAe,EAAA,CAAE;AAAA,EAAA,GAE9E;AAEJ,GAEAwB,sBAAkC7B,CAAK;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer ui{.ui-price-Oc5Nr{display:inline-flex;align-items:baseline;flex-wrap:wrap;gap:var(--hd-space-2)}.ui-price__current-2Xup2{font-family:var(--hd-font-display);font-size:var(--hd-type-h4-size);font-weight:var(--hd-font-weight-bold);font-variant-numeric:tabular-nums;letter-spacing:var(--hd-type-h2-letter-spacing);white-space:nowrap;color:var(--hd-text)}.ui-price__currency-32NLN{font-size:.75em;font-weight:var(--hd-font-weight-semibold);margin-inline-start:2px}.ui-price__list-MlQgT{font-size:var(--hd-type-small-size);color:var(--hd-text-3);font-variant-numeric:tabular-nums;text-decoration-thickness:1px}.ui-price__discount-5Yc6W{font-size:var(--hd-type-caption-size);font-weight:var(--hd-font-weight-bold);color:var(--hd-danger-on-solid);background-color:var(--hd-danger-solid);border-radius:var(--hd-radius-xs);padding:2px var(--hd-space-1);line-height:1}.ui-price--sm-Hd8Oe .ui-price__current-2Xup2{font-size:var(--hd-type-body-size)}.ui-price--md-JMxlK .ui-price__current-2Xup2{font-size:var(--hd-type-h4-size)}.ui-price--lg-TFqIF .ui-price__current-2Xup2,.ui-price--xl-EJBYq .ui-price__current-2Xup2{font-size:var(--hd-type-h2-size)}}
|
|
1
|
+
@layer ui{.ui-price-Oc5Nr{display:inline-flex;align-items:baseline;flex-wrap:wrap;gap:var(--hd-space-2)}.ui-price__current-2Xup2{font-family:var(--hd-font-display);font-size:var(--hd-type-h4-size);font-weight:var(--hd-font-weight-bold);font-variant-numeric:tabular-nums;letter-spacing:var(--hd-type-h2-letter-spacing);white-space:nowrap;color:var(--hd-text)}.ui-price__currency-32NLN{font-size:.75em;font-weight:var(--hd-font-weight-semibold);margin-inline-start:2px}.ui-price__currency--prefix-dlva8{margin-inline:0}.ui-price__list-MlQgT{font-size:var(--hd-type-small-size);color:var(--hd-text-3);font-variant-numeric:tabular-nums;text-decoration-thickness:1px}.ui-price__discount-5Yc6W{font-size:var(--hd-type-caption-size);font-weight:var(--hd-font-weight-bold);color:var(--hd-danger-on-solid);background-color:var(--hd-danger-solid);border-radius:var(--hd-radius-xs);padding:2px var(--hd-space-1);line-height:1}.ui-price--sm-Hd8Oe .ui-price__current-2Xup2{font-size:var(--hd-type-body-size)}.ui-price--md-JMxlK .ui-price__current-2Xup2{font-size:var(--hd-type-h4-size)}.ui-price--lg-TFqIF .ui-price__current-2Xup2,.ui-price--xl-EJBYq .ui-price__current-2Xup2{font-size:var(--hd-type-h2-size)}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const t=require("react/jsx-runtime"),n=require("react"),v=require("../../helpers/label.helper.cjs"),w=require("../../theme/context.cjs"),h=require("../../enums/ui-size.enum.cjs"),D=require("../../enums/ui-variant.enum.cjs"),S=require("../Button/index.cjs"),A=require("../Field/index.cjs"),F=require("../Input/index.cjs"),N=require("../Modal/index.cjs"),T=require("../Textarea/index.cjs"),Y={default:{"form":"ui-form-zpZn4"}},k=({isOpen:s,onClose:o,onSubmit:p,title:y,label:I,submitLabel:M,cancelLabel:L,closeLabel:P,description:R,hint:z,placeholder:d,defaultValue:u="",isRequired:m,requiredLabel:B,inputMode:f="text",maxLength:x,rows:E=4})=>{const{labels:e}=w.useUi(),_=n.useId(),[a,c]=n.useState(u),[r,b]=n.useState(!1),q=n.useRef(!1);n.useEffect(()=>{s&&!q.current&&c(u),q.current=s},[s,u]);const g=a.trim(),j=!!m&&g==="",C=i=>f==="multiline"?t.jsx(T.default,{...i,value:a,onChange:l=>c(l.target.value),placeholder:d,maxLength:x,rows:E}):t.jsx(F.default,{...i,type:f==="number"?"number":"text",value:a,onChange:l=>c(l.target.value),placeholder:d,maxLength:x}),U=async()=>{if(!(j||r)){b(!0);try{await p(g),o()}catch{}finally{b(!1)}}};return t.jsx(N.default,{isOpen:s,onClose:o,title:y,closeLabel:P??(e==null?void 0:e.close),description:R,size:"sm",isDismissable:!r,footer:t.jsxs(t.Fragment,{children:[t.jsx(S.default,{variant:D.default.SECONDARY,size:h.default.MEDIUM,onClick:o,disabled:r,children:v.resolveLabel("PromptDialog.cancelLabel",L,e==null?void 0:e.cancel)}),t.jsx(S.default,{type:"submit",form:_,variant:D.default.PRIMARY,size:h.default.MEDIUM,disabled:j,isLoading:r,children:v.resolveLabel("PromptDialog.submitLabel",M,e==null?void 0:e.submit)})]}),children:t.jsx("form",{id:_,className:Y.default.form,onSubmit:i=>{i.preventDefault(),U()},children:t.jsx(A.default,{label:I,hint:z,isRequired:m,requiredLabel:B,children:C})})})},G=n.memo(k);exports.default=G;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),t=require("react"),e=require("../../constants/scale.constants.cjs"),u=require("../../helpers/component.helper.cjs"),a=require("../ScaledInput/index.cjs"),c=t.forwardRef(({unitDigits:n,unit:i,...s},o)=>r.jsx(a.default,{ref:o,...s,scaleDigits:e.QTY4_DIGITS,maxFractionDigits:Math.min(n,e.QTY4_DIGITS),suffix:i})),l=t.memo(u.named(c,"QuantityInput"));exports.default=l;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const r=require("react/jsx-runtime"),t=require("react"),e=require("../../constants/scale.constants.cjs"),s=require("../../helpers/component.helper.cjs"),i=require("../ScaledInput/index.cjs"),c=t.forwardRef((n,o)=>r.jsx(i.default,{ref:o,...n,scaleDigits:e.RATE6_DIGITS,minFractionDigits:e.RATE_MIN_SHOWN_DIGITS})),u=t.memo(s.named(c,"RateInput"));exports.default=u;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("react/jsx-runtime"),r=require("react"),A=require("../../helpers/class-name.helper.cjs"),U=require("../../helpers/component.helper.cjs"),G=require("../../helpers/ref.helper.cjs"),s=require("../../helpers/scaled-number.helper.cjs"),O=require("../Input/index.cjs"),P={default:{"scaled":"ui-scaled-5yp41"}},V=r.forwardRef(({value:
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const k=require("react/jsx-runtime"),r=require("react"),A=require("../../helpers/class-name.helper.cjs"),U=require("../../helpers/component.helper.cjs"),G=require("../../helpers/ref.helper.cjs"),s=require("../../helpers/scaled-number.helper.cjs"),O=require("../Input/index.cjs"),P={default:{"scaled":"ui-scaled-5yp41"}},V=r.forwardRef(({value:n,onChange:S,scaleDigits:c,maxFractionDigits:_=c,minFractionDigits:b=0,min:f=0,max:E=Number.MAX_SAFE_INTEGER,className:I,onFocus:i,onBlur:d,onKeyDown:o,"aria-invalid":N,...h},x)=>{const[t,m]=r.useState(null),[u,v]=r.useState(!1),q=r.useRef(null),M=r.useCallback(e=>{q.current=e,G.assignRef(x,e)},[x]);r.useEffect(()=>{var e;u&&((e=q.current)==null||e.select())},[u]);const T=(e,l)=>e===null||!Number.isSafeInteger(e)?"":s.formatScaledValue(e,{scaleDigits:c,minFractionDigits:b,isGrouped:l}),p=t!==null&&t.value===n,j=p?t.text:T(n,!u),C=!u&&p&&t.value===null&&t.text!=="",g=e=>s.readScaledText(e,{scaleDigits:c,maxFractionDigits:_,min:f,max:E}),R=()=>{if(p){if(t.value!==null&&t.value<f){S(f),m(null);return}(t.value!==null||t.text==="")&&m(null)}};return k.jsx(O.default,{ref:M,...h,className:A.cx(P.default.scaled,I),value:j,inputMode:_>0?"decimal":"numeric",autoComplete:"off","aria-invalid":C||N,onChange:e=>{const l=s.cleanScaledText(e.target.value),a=g(l);a!==s.REFUSED&&(m({text:l,value:a}),a!==n&&S(a))},onFocus:e=>{v(!0),i==null||i(e)},onBlur:e=>{v(!1),R(),d==null||d(e)},onKeyDown:e=>{e.key==="Enter"&&R(),o==null||o(e)}})}),X=r.memo(U.named(V,"ScaledInput"));exports.default=X;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const a=require("react/jsx-runtime"),_=require("react"),r=require("../../helpers/class-name.helper.cjs"),e={default:{"header":"ui-header-a08Jh","header__text":"ui-header__text-ArJkA","header__overline":"ui-header__overline-X5Epo","header__overline--as-written":"ui-header__overline--as-written-gc4XJ","header__title":"ui-header__title-nQQQJ","header__description":"ui-header__description-08oCr","header__action":"ui-header__action-xsxQF","header--sm":"ui-header--sm-mIJWZ","header--lg":"ui-header--lg-QBLIz"}},o=({title:l,description:s,overline:d,isOverlineUppercase:c=!0,action:t,as:i="h2",size:u="md",className:n,testId:h})=>a.jsxs("header",{className:r.cx(e.default.header,e.default[`header--${u}`],n),"data-testid":h,children:[a.jsxs("div",{className:e.default.header__text,children:[d&&a.jsx("span",{className:r.cx(e.default.header__overline,!c&&e.default["header__overline--as-written"]),children:d}),a.jsx(i,{className:e.default.header__title,children:l}),s&&a.jsx("p",{className:e.default.header__description,children:s})]}),t&&a.jsx("div",{className:e.default.header__action,children:t})]}),m=_.memo(o);exports.default=m;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/SectionHeader/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n title: string;\n description?: string;\n /** Üstte gösterilen küçük büyük-harf etiket. */\n overline?: string;\n /** Sağda gösterilen eylem (\"Tümünü gör\"). */\n action?: ReactNode;\n as?: 'h1' | 'h2' | 'h3';\n size?: 'sm' | 'md' | 'lg';\n className?: string;\n testId?: string;\n};\n\n/** Bölüm başlığı. */\nconst SectionHeader: FC<Props> = ({\n title,\n description,\n overline,\n action,\n as: Heading = 'h2',\n size = 'md',\n className,\n testId,\n}) => (\n <header className={cx(styles.header, styles[`header--${size}`], className)} data-testid={testId}>\n <div className={styles.header__text}>\n {overline && <span
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/SectionHeader/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n title: string;\n description?: string;\n /** Üstte gösterilen küçük büyük-harf etiket. */\n overline?: string;\n /** The overline in capitals by CSS (default); `false` keeps a brand or proper name as written (3.2.1). */\n isOverlineUppercase?: boolean;\n /** Sağda gösterilen eylem (\"Tümünü gör\"). */\n action?: ReactNode;\n as?: 'h1' | 'h2' | 'h3';\n size?: 'sm' | 'md' | 'lg';\n className?: string;\n testId?: string;\n};\n\n/** Bölüm başlığı. */\nconst SectionHeader: FC<Props> = ({\n title,\n description,\n overline,\n isOverlineUppercase = true,\n action,\n as: Heading = 'h2',\n size = 'md',\n className,\n testId,\n}) => (\n <header className={cx(styles.header, styles[`header--${size}`], className)} data-testid={testId}>\n <div className={styles.header__text}>\n {overline && (\n <span\n className={cx(\n styles.header__overline,\n !isOverlineUppercase && styles['header__overline--as-written'],\n )}\n >\n {overline}\n </span>\n )}\n <Heading className={styles.header__title}>{title}</Heading>\n {description && <p className={styles.header__description}>{description}</p>}\n </div>\n\n {action && <div className={styles.header__action}>{action}</div>}\n </header>\n);\n\nexport default /*#__PURE__*/ memo(SectionHeader) as typeof SectionHeader;\n"],"names":["SectionHeader","title","description","overline","isOverlineUppercase","action","Heading","size","className","testId","jsxs","cx","styles","jsx","index"],"mappings":"0PAsBMA,EAA2B,CAAC,CAChC,MAAAC,EACA,YAAAC,EACA,SAAAC,EACA,oBAAAC,EAAsB,GACtB,OAAAC,EACA,GAAIC,EAAU,KACd,KAAAC,EAAO,KACP,UAAAC,EACA,OAAAC,CACF,IACEC,EAAAA,KAAC,SAAA,CAAO,UAAWC,EAAAA,GAAGC,EAAAA,QAAO,OAAQA,EAAAA,QAAO,WAAWL,CAAI,EAAE,EAAGC,CAAS,EAAG,cAAaC,EACvF,SAAA,CAAAC,EAAAA,KAAC,MAAA,CAAI,UAAWE,EAAAA,QAAO,aACpB,SAAA,CAAAT,GACCU,EAAAA,IAAC,OAAA,CACC,UAAWF,EAAAA,GACTC,EAAAA,QAAO,iBACP,CAACR,GAAuBQ,EAAAA,QAAO,8BAA8B,CAAA,EAG9D,SAAAT,CAAA,CAAA,EAGLU,EAAAA,IAACP,EAAA,CAAQ,UAAWM,EAAAA,QAAO,cAAgB,SAAAX,EAAM,EAChDC,GAAeW,EAAAA,IAAC,IAAA,CAAE,UAAWD,EAAAA,QAAO,oBAAsB,SAAAV,CAAA,CAAY,CAAA,EACzE,EAECG,GAAUQ,EAAAA,IAAC,MAAA,CAAI,UAAWD,EAAAA,QAAO,eAAiB,SAAAP,CAAA,CAAO,CAAA,EAC5D,EAGFS,SAAkCd,CAAa"}
|
|
@@ -4,6 +4,8 @@ type Props = {
|
|
|
4
4
|
description?: string;
|
|
5
5
|
/** Üstte gösterilen küçük büyük-harf etiket. */
|
|
6
6
|
overline?: string;
|
|
7
|
+
/** The overline in capitals by CSS (default); `false` keeps a brand or proper name as written (3.2.1). */
|
|
8
|
+
isOverlineUppercase?: boolean;
|
|
7
9
|
/** Sağda gösterilen eylem ("Tümünü gör"). */
|
|
8
10
|
action?: ReactNode;
|
|
9
11
|
as?: 'h1' | 'h2' | 'h3';
|
|
@@ -4,6 +4,8 @@ type Props = {
|
|
|
4
4
|
description?: string;
|
|
5
5
|
/** Üstte gösterilen küçük büyük-harf etiket. */
|
|
6
6
|
overline?: string;
|
|
7
|
+
/** The overline in capitals by CSS (default); `false` keeps a brand or proper name as written (3.2.1). */
|
|
8
|
+
isOverlineUppercase?: boolean;
|
|
7
9
|
/** Sağda gösterilen eylem ("Tümünü gör"). */
|
|
8
10
|
action?: ReactNode;
|
|
9
11
|
as?: 'h1' | 'h2' | 'h3';
|
|
@@ -1,24 +1,34 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { memo as
|
|
3
|
-
import { cx as
|
|
4
|
-
const e = {"header":"ui-header-a08Jh","header__text":"ui-header__text-ArJkA","header__overline":"ui-header__overline-X5Epo","header__title":"ui-header__title-nQQQJ","header__description":"ui-header__description-08oCr","header__action":"ui-header__action-xsxQF","header--sm":"ui-header--sm-mIJWZ","header--lg":"ui-header--lg-QBLIz"};
|
|
5
|
-
const
|
|
6
|
-
title:
|
|
1
|
+
import { jsxs as t, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { memo as _ } from "react";
|
|
3
|
+
import { cx as i } from "../../helpers/class-name.helper.js";
|
|
4
|
+
const e = {"header":"ui-header-a08Jh","header__text":"ui-header__text-ArJkA","header__overline":"ui-header__overline-X5Epo","header__overline--as-written":"ui-header__overline--as-written-gc4XJ","header__title":"ui-header__title-nQQQJ","header__description":"ui-header__description-08oCr","header__action":"ui-header__action-xsxQF","header--sm":"ui-header--sm-mIJWZ","header--lg":"ui-header--lg-QBLIz"};
|
|
5
|
+
const p = ({
|
|
6
|
+
title: m,
|
|
7
7
|
description: r,
|
|
8
8
|
overline: s,
|
|
9
|
+
isOverlineUppercase: c = !0,
|
|
9
10
|
action: d,
|
|
10
|
-
as:
|
|
11
|
-
size:
|
|
12
|
-
className:
|
|
13
|
-
testId:
|
|
14
|
-
}) => /* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
16
|
-
s && /* @__PURE__ */ a(
|
|
17
|
-
|
|
11
|
+
as: h = "h2",
|
|
12
|
+
size: l = "md",
|
|
13
|
+
className: o,
|
|
14
|
+
testId: n
|
|
15
|
+
}) => /* @__PURE__ */ t("header", { className: i(e.header, e[`header--${l}`], o), "data-testid": n, children: [
|
|
16
|
+
/* @__PURE__ */ t("div", { className: e.header__text, children: [
|
|
17
|
+
s && /* @__PURE__ */ a(
|
|
18
|
+
"span",
|
|
19
|
+
{
|
|
20
|
+
className: i(
|
|
21
|
+
e.header__overline,
|
|
22
|
+
!c && e["header__overline--as-written"]
|
|
23
|
+
),
|
|
24
|
+
children: s
|
|
25
|
+
}
|
|
26
|
+
),
|
|
27
|
+
/* @__PURE__ */ a(h, { className: e.header__title, children: m }),
|
|
18
28
|
r && /* @__PURE__ */ a("p", { className: e.header__description, children: r })
|
|
19
29
|
] }),
|
|
20
30
|
d && /* @__PURE__ */ a("div", { className: e.header__action, children: d })
|
|
21
|
-
] }), j = /* @__PURE__ */
|
|
31
|
+
] }), j = /* @__PURE__ */ _(p);
|
|
22
32
|
export {
|
|
23
33
|
j as default
|
|
24
34
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/SectionHeader/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n title: string;\n description?: string;\n /** Üstte gösterilen küçük büyük-harf etiket. */\n overline?: string;\n /** Sağda gösterilen eylem (\"Tümünü gör\"). */\n action?: ReactNode;\n as?: 'h1' | 'h2' | 'h3';\n size?: 'sm' | 'md' | 'lg';\n className?: string;\n testId?: string;\n};\n\n/** Bölüm başlığı. */\nconst SectionHeader: FC<Props> = ({\n title,\n description,\n overline,\n action,\n as: Heading = 'h2',\n size = 'md',\n className,\n testId,\n}) => (\n <header className={cx(styles.header, styles[`header--${size}`], className)} data-testid={testId}>\n <div className={styles.header__text}>\n {overline && <span
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/SectionHeader/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n title: string;\n description?: string;\n /** Üstte gösterilen küçük büyük-harf etiket. */\n overline?: string;\n /** The overline in capitals by CSS (default); `false` keeps a brand or proper name as written (3.2.1). */\n isOverlineUppercase?: boolean;\n /** Sağda gösterilen eylem (\"Tümünü gör\"). */\n action?: ReactNode;\n as?: 'h1' | 'h2' | 'h3';\n size?: 'sm' | 'md' | 'lg';\n className?: string;\n testId?: string;\n};\n\n/** Bölüm başlığı. */\nconst SectionHeader: FC<Props> = ({\n title,\n description,\n overline,\n isOverlineUppercase = true,\n action,\n as: Heading = 'h2',\n size = 'md',\n className,\n testId,\n}) => (\n <header className={cx(styles.header, styles[`header--${size}`], className)} data-testid={testId}>\n <div className={styles.header__text}>\n {overline && (\n <span\n className={cx(\n styles.header__overline,\n !isOverlineUppercase && styles['header__overline--as-written'],\n )}\n >\n {overline}\n </span>\n )}\n <Heading className={styles.header__title}>{title}</Heading>\n {description && <p className={styles.header__description}>{description}</p>}\n </div>\n\n {action && <div className={styles.header__action}>{action}</div>}\n </header>\n);\n\nexport default /*#__PURE__*/ memo(SectionHeader) as typeof SectionHeader;\n"],"names":["SectionHeader","title","description","overline","isOverlineUppercase","action","Heading","size","className","testId","jsxs","cx","styles","jsx","index"],"mappings":";;;;AAsBA,MAAMA,IAA2B,CAAC;AAAA,EAChC,OAAAC;AAAA,EACA,aAAAC;AAAA,EACA,UAAAC;AAAA,EACA,qBAAAC,IAAsB;AAAA,EACtB,QAAAC;AAAA,EACA,IAAIC,IAAU;AAAA,EACd,MAAAC,IAAO;AAAA,EACP,WAAAC;AAAA,EACA,QAAAC;AACF,MACE,gBAAAC,EAAC,UAAA,EAAO,WAAWC,EAAGC,EAAO,QAAQA,EAAO,WAAWL,CAAI,EAAE,GAAGC,CAAS,GAAG,eAAaC,GACvF,UAAA;AAAA,EAAA,gBAAAC,EAAC,OAAA,EAAI,WAAWE,EAAO,cACpB,UAAA;AAAA,IAAAT,KACC,gBAAAU;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,WAAWF;AAAA,UACTC,EAAO;AAAA,UACP,CAACR,KAAuBQ,EAAO,8BAA8B;AAAA,QAAA;AAAA,QAG9D,UAAAT;AAAA,MAAA;AAAA,IAAA;AAAA,IAGL,gBAAAU,EAACP,GAAA,EAAQ,WAAWM,EAAO,eAAgB,UAAAX,GAAM;AAAA,IAChDC,KAAe,gBAAAW,EAAC,KAAA,EAAE,WAAWD,EAAO,qBAAsB,UAAAV,EAAA,CAAY;AAAA,EAAA,GACzE;AAAA,EAECG,KAAU,gBAAAQ,EAAC,OAAA,EAAI,WAAWD,EAAO,gBAAiB,UAAAP,EAAA,CAAO;AAAA,GAC5D,GAGFS,sBAAkCd,CAAa;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer ui{.ui-header-a08Jh{display:flex;align-items:flex-end;justify-content:space-between;gap:var(--hd-space-4);flex-wrap:wrap}.ui-header__text-ArJkA{display:flex;flex-direction:column;gap:var(--hd-space-1);min-width:0}.ui-header__overline-X5Epo{font-family: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)}.ui-header__title-nQQQJ{font-family:var(--hd-font-display);font-size:var(--hd-type-h3-size);font-weight:var(--hd-type-h3-weight);font-stretch:var(--hd-type-h3-stretch);line-height:var(--hd-type-h3-line-height);letter-spacing:var(--hd-type-h3-letter-spacing);color:var(--hd-text);margin:0}.ui-header__description-08oCr{font-size:var(--hd-type-small-size);color:var(--hd-text-2);line-height:var(--hd-type-body-line-height);max-width:68ch;margin:0}.ui-header__action-xsxQF{flex-shrink:0}.ui-header--sm-mIJWZ .ui-header__title-nQQQJ{font-size:var(--hd-type-h4-size)}.ui-header--lg-QBLIz .ui-header__title-nQQQJ{font-size:var(--hd-type-h2-size)}}
|
|
1
|
+
@layer ui{.ui-header-a08Jh{display:flex;align-items:flex-end;justify-content:space-between;gap:var(--hd-space-4);flex-wrap:wrap}.ui-header__text-ArJkA{display:flex;flex-direction:column;gap:var(--hd-space-1);min-width:0}.ui-header__overline-X5Epo{font-family: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)}.ui-header__overline--as-written-gc4XJ{letter-spacing:normal;text-transform:none}.ui-header__title-nQQQJ{font-family:var(--hd-font-display);font-size:var(--hd-type-h3-size);font-weight:var(--hd-type-h3-weight);font-stretch:var(--hd-type-h3-stretch);line-height:var(--hd-type-h3-line-height);letter-spacing:var(--hd-type-h3-letter-spacing);color:var(--hd-text);margin:0}.ui-header__description-08oCr{font-size:var(--hd-type-small-size);color:var(--hd-text-2);line-height:var(--hd-type-body-line-height);max-width:68ch;margin:0}.ui-header__action-xsxQF{flex-shrink:0}.ui-header--sm-mIJWZ .ui-header__title-nQQQJ{font-size:var(--hd-type-h4-size)}.ui-header--lg-QBLIz .ui-header__title-nQQQJ{font-size:var(--hd-type-h2-size)}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),n=require("react"),ae=require("react-dom"),U=require("react-bootstrap-icons"),se=require("../../hooks/useListboxNavigation.cjs"),oe=require("../../hooks/usePortalSurface.cjs"),ie=require("../../hooks/usePositioning.cjs"),le=require("../../constants/breakpoint.constants.cjs"),v=require("../../helpers/class-name.helper.cjs"),ce=require("../../helpers/component.helper.cjs"),de=require("../../helpers/ref.helper.cjs"),ue=require("../../helpers/label.helper.cjs"),fe=require("../../theme/context.cjs"),pe=require("../BottomSheet/index.cjs"),t={default:{"select":"ui-select-tiiPL","trigger":"ui-trigger-rHQJz","trigger--empty":"ui-trigger--empty-cuinb","trigger--open":"ui-trigger--open-1nsvu","trigger--invalid":"ui-trigger--invalid-NtP0W","trigger--readOnly":"ui-trigger--readOnly-E6YX-","trigger--sm":"ui-trigger--sm-Xnu1C","trigger__icon":"ui-trigger__icon-apCcx","trigger__srName":"ui-trigger__srName-XLCxt","trigger__value":"ui-trigger__value-ioH7K","trigger__chevron":"ui-trigger__chevron-FtsIZ","trigger__chevron--open":"ui-trigger__chevron--open-1P2P-","panel":"ui-panel-rGOOd","list":"ui-list-SOKf8","list--sheet":"ui-list--sheet-BIjCb","option":"ui-option-ZDPef","option--active":"ui-option--active-R4lLF","option--selected":"ui-option--selected-glQMj","option--disabled":"ui-option--disabled-h4rdd","option__label":"ui-option__label-SsoYB","option__check":"ui-option__check-8CPSG"}},ge=({options:l,value:E,onChange:O,onBlur:R,label:q,placeholder:W,closeLabel:F,icon:C,size:H="md",align:Q="start",isDisabled:N,isReadOnly:p,id:Y,className:z,testId:G,required:J,"aria-describedby":V,"aria-invalid":D}
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const s=require("react/jsx-runtime"),n=require("react"),ae=require("react-dom"),U=require("react-bootstrap-icons"),se=require("../../hooks/useListboxNavigation.cjs"),oe=require("../../hooks/usePortalSurface.cjs"),ie=require("../../hooks/usePositioning.cjs"),le=require("../../constants/breakpoint.constants.cjs"),v=require("../../helpers/class-name.helper.cjs"),ce=require("../../helpers/component.helper.cjs"),de=require("../../helpers/ref.helper.cjs"),ue=require("../../helpers/label.helper.cjs"),fe=require("../../theme/context.cjs"),pe=require("../BottomSheet/index.cjs"),t={default:{"select":"ui-select-tiiPL","trigger":"ui-trigger-rHQJz","trigger--empty":"ui-trigger--empty-cuinb","trigger--open":"ui-trigger--open-1nsvu","trigger--invalid":"ui-trigger--invalid-NtP0W","trigger--readOnly":"ui-trigger--readOnly-E6YX-","trigger--sm":"ui-trigger--sm-Xnu1C","trigger__icon":"ui-trigger__icon-apCcx","trigger__srName":"ui-trigger__srName-XLCxt","trigger__value":"ui-trigger__value-ioH7K","trigger__chevron":"ui-trigger__chevron-FtsIZ","trigger__chevron--open":"ui-trigger__chevron--open-1P2P-","panel":"ui-panel-rGOOd","list":"ui-list-SOKf8","list--sheet":"ui-list--sheet-BIjCb","option":"ui-option-ZDPef","option--active":"ui-option--active-R4lLF","option--selected":"ui-option--selected-glQMj","option--disabled":"ui-option--disabled-h4rdd","option__label":"ui-option__label-SsoYB","option__check":"ui-option__check-8CPSG"}},ge=({options:l,value:E,onChange:O,onBlur:R,label:q,placeholder:W,closeLabel:F,icon:C,size:H="md",align:Q="start",isDisabled:N,isReadOnly:p,id:Y,className:z,testId:G,required:J,"aria-describedby":V,"aria-invalid":D},k)=>{const{labels:u}=fe.useUi(),X=ue.resolveLabel("Select.placeholder",W,u==null?void 0:u.selectPlaceholder),Z=n.useId(),d=Y??Z,S=`${d}-listbox`,j=e=>`${d}-option-${e}`,w=n.useRef(null),x=n.useRef(null),g=n.useRef(null),ee=n.useCallback(e=>{x.current=e,de.assignRef(k,e)},[k]),[a,$]=n.useState(null),y=ie.default(x,g,{side:"bottom",align:Q,isOpen:a==="popover"}),b=oe.default(a==="popover",x,g),o=a!==null,_=l.findIndex(e=>e.value===E),h=_>=0?l[_]:null,f=n.useCallback(()=>$(null),[]),M=n.useCallback(()=>{N||p||l.length===0||$(window.matchMedia(le.SHEET_MEDIA_QUERY).matches?"sheet":"popover")},[N,p,l.length]),L=e=>{e.isDisabled||(O(e.value),f())},P=n.useRef(!1);n.useEffect(()=>{var e;P.current&&!o&&((e=x.current)==null||e.focus()),P.current=o},[o]),n.useEffect(()=>{if(a!=="popover")return;const e=r=>{var c,K;const i=r.target;(c=w.current)!=null&&c.contains(i)||(K=g.current)!=null&&K.contains(i)||f()};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[a,f]);const{activeIndex:m,setActiveIndex:te,listRef:I,handleKeyDown:re}=se.default({count:l.length,isOpen:o,initialIndex:_>=0?_:0,onSelect:e=>{const r=l[e];r&&L(r)},onClose:f});n.useEffect(()=>{var e;a==="sheet"&&((e=I.current)==null||e.focus({preventScroll:!0}))},[a,I]);const T=n.useRef(a);T.current=a;const ne=e=>{var i,c;if(!R||T.current==="sheet")return;const r=e.relatedTarget;r instanceof Node&&((i=w.current)!=null&&i.contains(r)||(c=g.current)!=null&&c.contains(r))||R(e)},A=e=>{if(!o){["ArrowDown","ArrowUp","Enter"," "].includes(e.key)&&(e.preventDefault(),M());return}re(e)},B=e=>s.jsx("ul",{ref:I,id:S,role:"listbox","aria-label":q,"aria-activedescendant":e&&l[m]?j(m):void 0,tabIndex:e?0:-1,className:v.cx(t.default.list,e&&t.default["list--sheet"]),onKeyDown:e?A:void 0,children:l.map((r,i)=>{const c=r.value===E;return s.jsxs("li",{id:j(i),role:"option","data-index":i,"aria-selected":c,"aria-disabled":r.isDisabled,className:v.cx(t.default.option,i===m&&t.default["option--active"],c&&t.default["option--selected"],r.isDisabled&&t.default["option--disabled"]),onMouseEnter:()=>te(i),onClick:()=>L(r),children:[s.jsx("span",{className:t.default.option__label,children:r.label}),c&&s.jsx(U.CheckLg,{"aria-hidden":!0,className:t.default.option__check})]},r.value)})});return s.jsxs("span",{ref:w,className:v.cx(t.default.select,z),"data-testid":G,onBlur:ne,children:[s.jsxs("button",{ref:ee,id:d,type:"button",role:"combobox",className:v.cx(t.default.trigger,t.default[`trigger--${H}`],!h&&t.default["trigger--empty"],o&&t.default["trigger--open"],D&&t.default["trigger--invalid"],p&&t.default["trigger--readOnly"]),disabled:N,"aria-haspopup":"listbox","aria-expanded":o,"aria-controls":o?S:void 0,"aria-activedescendant":a==="popover"&&l[m]?j(m):void 0,"aria-labelledby":h?`${d}-name ${d}-value`:`${d}-name`,"aria-describedby":V,"aria-invalid":D,"aria-required":J||void 0,"aria-readonly":p||void 0,onClick:()=>o?f():M(),onKeyDown:A,children:[C&&s.jsx("span",{className:t.default.trigger__icon,"aria-hidden":!0,children:C}),s.jsx("span",{id:`${d}-name`,className:t.default.trigger__srName,children:q}),s.jsx("span",{id:`${d}-value`,className:t.default.trigger__value,children:(h==null?void 0:h.label)??X}),!p&&s.jsx(U.CaretDownFill,{"aria-hidden":!0,className:v.cx(t.default.trigger__chevron,o&&t.default["trigger__chevron--open"])})]}),a==="popover"&&b.container&&ae.createPortal(s.jsx("div",{ref:g,className:t.default.panel,...b.attributes,style:{...y.style,...b.style,minWidth:y.anchorWidth||void 0,visibility:y.isPositioned?void 0:"hidden"},children:B(!1)}),b.container),a==="sheet"&&s.jsx(pe.default,{title:q,closeLabel:F??(u==null?void 0:u.close),onClose:f,children:B(!0)})]})},he=n.forwardRef(ge),me=n.memo(ce.named(he,"Select"));exports.default=me;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as r, jsx as i } from "react/jsx-runtime";
|
|
3
|
-
import {
|
|
3
|
+
import { forwardRef as x, useId as N, memo as I } from "react";
|
|
4
4
|
import { ExclamationCircleFill as y } from "react-bootstrap-icons";
|
|
5
5
|
import { idList as $ } from "../../helpers/aria.helper.js";
|
|
6
6
|
import { cx as j } from "../../helpers/class-name.helper.js";
|
|
7
7
|
import { named as k } from "../../helpers/component.helper.js";
|
|
8
8
|
const a = {"switch":"ui-switch-KLH29","switch__input":"ui-switch__input-Q2UQ4","switch--labelFirst":"ui-switch--labelFirst-Grirk","switch__label":"ui-switch__label-gPZuO","switch__hint":"ui-switch__hint-NRuzC","switch__track":"ui-switch__track-3417m","switch__thumb":"ui-switch__thumb-1LHta","switch__text":"ui-switch__text-32uMY","switch__error":"ui-switch__error-wAjE1"};
|
|
9
|
-
const v =
|
|
9
|
+
const v = x(
|
|
10
10
|
({
|
|
11
11
|
label: n,
|
|
12
12
|
hint: t,
|
|
@@ -19,7 +19,7 @@ const v = N(
|
|
|
19
19
|
"aria-invalid": _,
|
|
20
20
|
...w
|
|
21
21
|
}, f) => {
|
|
22
|
-
const u =
|
|
22
|
+
const u = N(), s = h ?? u, c = `${s}-label`, l = `${s}-hint`, d = `${s}-error`;
|
|
23
23
|
return /* @__PURE__ */ r(
|
|
24
24
|
"label",
|
|
25
25
|
{
|
|
@@ -53,7 +53,7 @@ const v = N(
|
|
|
53
53
|
}
|
|
54
54
|
);
|
|
55
55
|
}
|
|
56
|
-
), q = /* @__PURE__ */
|
|
56
|
+
), q = /* @__PURE__ */ I(/* @__PURE__ */ k(v, "Switch"));
|
|
57
57
|
export {
|
|
58
58
|
q as default
|
|
59
59
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
@layer ui{.ui-scroller-EtDmS{position:relative;overflow:auto;min-width:0;align-self:stretch;scrollbar-width:thin;scrollbar-color:var(--hd-border-strong) transparent}.ui-scroller-EtDmS::-webkit-scrollbar{width:8px;height:8px}.ui-scroller-EtDmS::-webkit-scrollbar-track{background:transparent}.ui-scroller-EtDmS::-webkit-scrollbar-thumb{background-color:var(--hd-border-strong);border-radius:var(--hd-radius-pill);border:2px solid transparent;background-clip:content-box}.ui-scroller-EtDmS::-webkit-scrollbar-thumb:hover{background-color:var(--hd-text-3)}.ui-scroller--frame-84zz6{border:1px solid var(--hd-border);border-radius:var(--hd-radius-md);background-color:var(--hd-bg-surface)}.ui-table-uCv4q{width:100%;border-collapse:collapse;font-size:var(--hd-type-small-size)}.ui-table-uCv4q th,.ui-table-uCv4q td{text-align:start;border-bottom:1px solid var(--hd-border)}.ui-table-uCv4q tbody tr:last-child>*{border-bottom:none}.ui-table--compact-4KCVl th,.ui-table--compact-4KCVl td{padding:var(--hd-space-2) var(--hd-space-3)}.ui-table--regular-hsA3- th,.ui-table--regular-hsA3- td{padding:var(--hd-space-3)}.ui-table--spacious-BBUX- th,.ui-table--spacious-BBUX- td{padding:var(--hd-space-3) var(--hd-space-4)}.ui-table--sticky-head-FO2L4 thead th{position:sticky;top:0;z-index:var(--hd-z-raised);background-color:var(--hd-bg-raised);font-family:var(--hd-font-body);font-size:var(--hd-type-caption-size);font-weight:var(--hd-font-weight-semibold);text-transform:uppercase;letter-spacing:.045em;color:var(--hd-text-2);white-space:nowrap}.ui-table--row-hover--MAoe tbody tr:hover>td{background-color:var(--hd-bg-raised)}}
|
|
1
|
+
@layer ui{.ui-scroller-EtDmS{position:relative;overflow:auto;min-width:0;align-self:stretch;scrollbar-width:thin;scrollbar-color:var(--hd-border-strong) transparent}.ui-scroller-EtDmS::-webkit-scrollbar{width:8px;height:8px}.ui-scroller-EtDmS::-webkit-scrollbar-track{background:transparent}.ui-scroller-EtDmS::-webkit-scrollbar-thumb{background-color:var(--hd-border-strong);border-radius:var(--hd-radius-pill);border:2px solid transparent;background-clip:content-box}.ui-scroller-EtDmS::-webkit-scrollbar-thumb:hover{background-color:var(--hd-text-3)}.ui-scroller--frame-84zz6{border:1px solid var(--hd-border);border-radius:var(--hd-radius-md);background-color:var(--hd-bg-surface)}.ui-table-uCv4q{width:100%;border-collapse:collapse;font-size:var(--hd-type-small-size)}.ui-table-uCv4q th,.ui-table-uCv4q td{text-align:start;border-bottom:1px solid var(--hd-border)}.ui-table-uCv4q tbody tr:last-child>*{border-bottom:none}.ui-table--compact-4KCVl th,.ui-table--compact-4KCVl td{padding:var(--hd-space-2) var(--hd-space-3)}.ui-table--regular-hsA3- th,.ui-table--regular-hsA3- td{padding:var(--hd-space-3)}.ui-table--spacious-BBUX- th,.ui-table--spacious-BBUX- td{padding:var(--hd-space-3) var(--hd-space-4)}.ui-table--sticky-head-FO2L4 thead th{position:sticky;top:0;z-index:var(--hd-z-raised);background-color:var(--hd-bg-raised);font-family:var(--hd-font-body);font-size:var(--hd-type-caption-size);font-weight:var(--hd-font-weight-semibold);text-transform:uppercase;letter-spacing:.045em;color:var(--hd-text-2);white-space:nowrap}.ui-table--row-hover--MAoe tbody tr:hover>td{background-color:var(--hd-bg-raised)}@media print{.ui-scroller-EtDmS{overflow:visible}.ui-table--sticky-head-FO2L4 thead th{position:static}.ui-table-uCv4q thead{display:table-header-group}.ui-table-uCv4q tr{break-inside:avoid}}}
|
|
@@ -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 l=require("react/jsx-runtime"),c=require("react"),v=require("@handijitcom/utils"),k=require("react-bootstrap-icons"),E=require("../../helpers/class-name.helper.cjs"),K=require("../../helpers/scroll.helper.cjs"),M=require("../IconButton/index.cjs"),a={default:{"tabs":"ui-tabs-l4dFE","tabs__bar":"ui-tabs__bar-acfKk","tabs__list":"ui-tabs__list-HJvR8","tabs__scroll":"ui-tabs__scroll-FW47o","tabs__scroll--start":"ui-tabs__scroll--start-dso-7","tabs__scroll--end":"ui-tabs__scroll--end-dudGA","tabs__scrollIcon":"ui-tabs__scrollIcon-7Jw46","tabs__tab":"ui-tabs__tab-7gDW7","tabs__tab--active":"ui-tabs__tab--active-riqNp","tabs__count":"ui-tabs__count-8JX8s","tabs__panel":"ui-tabs__panel-CPklY"}},P=24,T=({items:n,defaultTabId:w,activeId:j,onChange:x,ariaLabel:L,isManualActivation:f,className:B,testId:m})=>{var R;const o=c.useId(),[z,F]=c.useState(w??((R=n[0])==null?void 0:R.id)),$=v.isDefined(j),N=$?j:z,d=n.findIndex(e=>e.id===N),[h,q]=c.useState(d<0?0:d),b=c.useRef(null),r=n[d]??n[0],I=h>=0&&h<n.length?h:Math.max(d,0);c.useEffect(()=>{q(d<0?0:d)},[d]),c.useEffect(()=>{const e=b.current;K.scrollIntoInlineView(e,e==null?void 0:e.querySelector('[aria-selected="true"]'),P)},[N]);const[_,O]=c.useState({start:!1,end:!1});c.useEffect(()=>{const e=b.current;if(!e)return;const t=()=>{const u=Math.abs(e.scrollLeft),i=u>1,S=u+e.clientWidth<e.scrollWidth-1;O(y=>y.start===i&&y.end===S?y:{start:i,end:S})};t(),e.addEventListener("scroll",t,{passive:!0});const s=typeof ResizeObserver>"u"?null:new ResizeObserver(t);return s==null||s.observe(e),()=>{e.removeEventListener("scroll",t),s==null||s.disconnect()}},[n]);const W=e=>{const t=b.current;if(!t)return;const s=getComputedStyle(t).direction==="rtl";t.scrollLeft+=e*(s?-1:1)*Math.round(t.clientWidth*2/3)},p=e=>{$||F(e),x==null||x(e)},C=e=>{var u;if(f&&(e.key==="Enter"||e.key===" ")){e.preventDefault();const i=n[I];i&&p(i.id);return}const t=e.key==="ArrowRight"?1:e.key==="ArrowLeft"?-1:0;if(t===0)return;e.preventDefault();const s=((f?I:d)+t+n.length)%n.length;q(s),f||p(n[s].id),(u=document.getElementById(`${o}-tab-${n[s].id}`))==null||u.focus()};if(n.length===0)return null;const D=v.isDefined(r==null?void 0:r.content),g=e=>l.jsx(M.default,{icon:e<0?l.jsx(k.ChevronLeft,{"aria-hidden":!0,className:a.default.tabs__scrollIcon}):l.jsx(k.ChevronRight,{"aria-hidden":!0,className:a.default.tabs__scrollIcon}),label:"",size:"sm",variant:"secondary",shape:"round",tabIndex:-1,"aria-hidden":!0,className:E.cx(a.default.tabs__scroll,a.default[`tabs__scroll--${e<0?"start":"end"}`]),onClick:()=>W(e)});return l.jsxs("div",{className:E.cx(a.default.tabs,B),"data-testid":m,children:[l.jsxs("div",{className:a.default.tabs__bar,"data-fade-start":_.start?"":void 0,"data-fade-end":_.end?"":void 0,children:[l.jsx("div",{ref:b,className:a.default.tabs__list,role:"tablist","aria-label":L,onKeyDown:C,children:n.map(e=>{var s;const t=e.id===r.id;return l.jsxs("button",{id:`${o}-tab-${e.id}`,type:"button",role:"tab","aria-selected":t,"aria-controls":t&&D?`${o}-panel-${e.id}`:void 0,tabIndex:(f?((s=n[I])==null?void 0:s.id)===e.id:t)?0:-1,className:E.cx(a.default.tabs__tab,t&&a.default["tabs__tab--active"]),onClick:()=>p(e.id),children:[e.label,v.isDefined(e.count)&&l.jsx("span",{className:a.default.tabs__count,children:e.count})]},e.id)})}),_.start&&g(-1),_.end&&g(1)]}),D&&l.jsx("div",{id:`${o}-panel-${r.id}`,role:"tabpanel","aria-labelledby":`${o}-tab-${r.id}`,className:a.default.tabs__panel,tabIndex:0,children:r.content})]})},A=c.memo(T);exports.default=A;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|