@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,49 @@
|
|
|
1
|
+
import { FC, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The role of a text: `body` 15px · `small` 13px (dense interface text, tables) · `caption` 12px
|
|
4
|
+
* (help text, meta) · `label` 13px medium (the name of a value, a form label; never capitals) ·
|
|
5
|
+
* `numeric` 15px tabular figures (amounts, quantities) · `code` 13px mono (part numbers, stock
|
|
6
|
+
* codes, order numbers — and nothing else).
|
|
7
|
+
*/
|
|
8
|
+
export type TextVariant = 'body' | 'small' | 'caption' | 'label' | 'numeric' | 'code';
|
|
9
|
+
export type TextWeight = 'regular' | 'medium' | 'semibold';
|
|
10
|
+
/**
|
|
11
|
+
* `default` the text colour · `secondary` / `tertiary` the two quieter steps · `success` and
|
|
12
|
+
* `danger` a state carried by the words as well (a success is cobalt, 3.0) · `inherit` the
|
|
13
|
+
* colour of the parent (inside an alert or a link).
|
|
14
|
+
*/
|
|
15
|
+
export type TextTone = 'default' | 'secondary' | 'tertiary' | 'success' | 'danger' | 'inherit';
|
|
16
|
+
type Props = {
|
|
17
|
+
children: ReactNode;
|
|
18
|
+
variant?: TextVariant;
|
|
19
|
+
/** Default: `medium` for `label`, `regular` otherwise. */
|
|
20
|
+
weight?: TextWeight;
|
|
21
|
+
/** Default: `secondary` for `label`, `default` otherwise. */
|
|
22
|
+
tone?: TextTone;
|
|
23
|
+
/** The element. Default: `<p>` for `body` and `small`, `<span>` for the rest. */
|
|
24
|
+
as?: 'p' | 'span' | 'div' | 'strong' | 'em' | 'small' | 'label' | 'dt' | 'dd' | 'li' | 'time';
|
|
25
|
+
/** Tabular, lining figures for any variant (a 13px amount in a table row). */
|
|
26
|
+
isNumeric?: boolean;
|
|
27
|
+
/**
|
|
28
|
+
* Cut after this many lines with an ellipsis; a string is shown in full in `title`. Cells,
|
|
29
|
+
* chips and labels beside a value use `1`.
|
|
30
|
+
*/
|
|
31
|
+
maxLines?: 1 | 2 | 3;
|
|
32
|
+
/** The full text for the tooltip when `children` is not a string. */
|
|
33
|
+
title?: string;
|
|
34
|
+
/** `label` only: the control the label names. */
|
|
35
|
+
htmlFor?: string;
|
|
36
|
+
/** `time` only: the machine-readable date. */
|
|
37
|
+
dateTime?: string;
|
|
38
|
+
id?: string;
|
|
39
|
+
className?: string;
|
|
40
|
+
testId?: string;
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* Text (3.7) — every running text, label and figure of an interface from one scale: a variant
|
|
44
|
+
* (size and family), a weight and a tone. A page does not size a `<p>` or a `<span>` itself.
|
|
45
|
+
* @example <Text variant="label">Satış birimi</Text> <Text variant="numeric">1.250</Text>
|
|
46
|
+
*/
|
|
47
|
+
declare const Text: FC<Props>;
|
|
48
|
+
declare const _default: typeof Text;
|
|
49
|
+
export default _default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { jsx as b } from "react/jsx-runtime";
|
|
2
|
+
import { memo as g } from "react";
|
|
3
|
+
import { cx as y } from "../../helpers/class-name.helper.js";
|
|
4
|
+
import { named as $ } from "../../helpers/component.helper.js";
|
|
5
|
+
import { clampTitle as v } from "../../helpers/text.helper.js";
|
|
6
|
+
const t = {"text":"ui-text-lnbTM","text--body":"ui-text--body-j5Omo","text--small":"ui-text--small-FiKGg","text--caption":"ui-text--caption-1DPQ5","text--label":"ui-text--label-pjuq8","text--numeric":"ui-text--numeric-z9Wa-","text--code":"ui-text--code-aNi-H","text--numeric-figures":"ui-text--numeric-figures-9e2Rp","text--regular":"ui-text--regular-fv-mD","text--medium":"ui-text--medium-uP0Ps","text--semibold":"ui-text--semibold-Gl8LR","text--tone-default":"ui-text--tone-default-5haOG","text--tone-secondary":"ui-text--tone-secondary-CzT6B","text--tone-tertiary":"ui-text--tone-tertiary-UxMd-","text--tone-success":"ui-text--tone-success-u9Brd","text--tone-danger":"ui-text--tone-danger-POFzB","text--tone-inherit":"ui-text--tone-inherit-CE226","text--clamp-1":"ui-text--clamp-1-A0SJ-","text--clamp-2":"ui-text--clamp-2-Q6p-M","text--clamp-3":"ui-text--clamp-3-jpwOy"};
|
|
7
|
+
const h = /* @__PURE__ */ new Set(["body", "small"]), A = ({
|
|
8
|
+
children: l,
|
|
9
|
+
variant: e = "body",
|
|
10
|
+
weight: s,
|
|
11
|
+
tone: d,
|
|
12
|
+
as: a,
|
|
13
|
+
isNumeric: i = !1,
|
|
14
|
+
maxLines: o,
|
|
15
|
+
title: r,
|
|
16
|
+
htmlFor: c,
|
|
17
|
+
dateTime: p,
|
|
18
|
+
id: f,
|
|
19
|
+
className: x,
|
|
20
|
+
testId: n
|
|
21
|
+
}) => {
|
|
22
|
+
const m = a ?? (h.has(e) ? "p" : "span"), u = s ?? (e === "label" ? "medium" : "regular"), T = d ?? (e === "label" ? "secondary" : "default");
|
|
23
|
+
return /* @__PURE__ */ b(
|
|
24
|
+
m,
|
|
25
|
+
{
|
|
26
|
+
id: f,
|
|
27
|
+
htmlFor: m === "label" ? c : void 0,
|
|
28
|
+
dateTime: m === "time" ? p : void 0,
|
|
29
|
+
className: y(
|
|
30
|
+
t.text,
|
|
31
|
+
t[`text--${e}`],
|
|
32
|
+
t[`text--${u}`],
|
|
33
|
+
t[`text--tone-${T}`],
|
|
34
|
+
i && t["text--numeric-figures"],
|
|
35
|
+
o !== void 0 && t[`text--clamp-${o}`],
|
|
36
|
+
x
|
|
37
|
+
),
|
|
38
|
+
title: o === void 0 ? r : v(l, r),
|
|
39
|
+
"data-testid": n,
|
|
40
|
+
children: l
|
|
41
|
+
}
|
|
42
|
+
);
|
|
43
|
+
}, F = /* @__PURE__ */ g(/* @__PURE__ */ $(A, "Text"));
|
|
44
|
+
export {
|
|
45
|
+
F as default
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Text/index.tsx"],"sourcesContent":["import { type FC, memo, type ReactNode } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { clampTitle } from '../../helpers/text.helper';\n\nimport styles from './index.module.scss';\n\n/**\n * The role of a text: `body` 15px · `small` 13px (dense interface text, tables) · `caption` 12px\n * (help text, meta) · `label` 13px medium (the name of a value, a form label; never capitals) ·\n * `numeric` 15px tabular figures (amounts, quantities) · `code` 13px mono (part numbers, stock\n * codes, order numbers — and nothing else).\n */\nexport type TextVariant = 'body' | 'small' | 'caption' | 'label' | 'numeric' | 'code';\n\nexport type TextWeight = 'regular' | 'medium' | 'semibold';\n\n/**\n * `default` the text colour · `secondary` / `tertiary` the two quieter steps · `success` and\n * `danger` a state carried by the words as well (a success is cobalt, 3.0) · `inherit` the\n * colour of the parent (inside an alert or a link).\n */\nexport type TextTone = 'default' | 'secondary' | 'tertiary' | 'success' | 'danger' | 'inherit';\n\ntype Props = {\n children: ReactNode;\n variant?: TextVariant;\n /** Default: `medium` for `label`, `regular` otherwise. */\n weight?: TextWeight;\n /** Default: `secondary` for `label`, `default` otherwise. */\n tone?: TextTone;\n /** The element. Default: `<p>` for `body` and `small`, `<span>` for the rest. */\n as?: 'p' | 'span' | 'div' | 'strong' | 'em' | 'small' | 'label' | 'dt' | 'dd' | 'li' | 'time';\n /** Tabular, lining figures for any variant (a 13px amount in a table row). */\n isNumeric?: boolean;\n /**\n * Cut after this many lines with an ellipsis; a string is shown in full in `title`. Cells,\n * chips and labels beside a value use `1`.\n */\n maxLines?: 1 | 2 | 3;\n /** The full text for the tooltip when `children` is not a string. */\n title?: string;\n /** `label` only: the control the label names. */\n htmlFor?: string;\n /** `time` only: the machine-readable date. */\n dateTime?: string;\n id?: string;\n className?: string;\n testId?: string;\n};\n\nconst BLOCK_VARIANTS = new Set<TextVariant>(['body', 'small']);\n\n/**\n * Text (3.7) — every running text, label and figure of an interface from one scale: a variant\n * (size and family), a weight and a tone. A page does not size a `<p>` or a `<span>` itself.\n * @example <Text variant=\"label\">Satış birimi</Text> <Text variant=\"numeric\">1.250</Text>\n */\nconst Text: FC<Props> = ({\n children,\n variant = 'body',\n weight,\n tone,\n as,\n isNumeric = false,\n maxLines,\n title,\n htmlFor,\n dateTime,\n id,\n className,\n testId,\n}) => {\n const Tag = as ?? (BLOCK_VARIANTS.has(variant) ? 'p' : 'span');\n const resolvedWeight = weight ?? (variant === 'label' ? 'medium' : 'regular');\n const resolvedTone = tone ?? (variant === 'label' ? 'secondary' : 'default');\n\n return (\n <Tag\n id={id}\n htmlFor={Tag === 'label' ? htmlFor : undefined}\n dateTime={Tag === 'time' ? dateTime : undefined}\n className={cx(\n styles.text,\n styles[`text--${variant}`],\n styles[`text--${resolvedWeight}`],\n styles[`text--tone-${resolvedTone}`],\n isNumeric && styles['text--numeric-figures'],\n maxLines !== undefined && styles[`text--clamp-${maxLines}`],\n className,\n )}\n title={maxLines === undefined ? title : clampTitle(children, title)}\n data-testid={testId}\n >\n {children}\n </Tag>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Text, 'Text')) as typeof Text;\n"],"names":["BLOCK_VARIANTS","Text","children","variant","weight","tone","as","isNumeric","maxLines","title","htmlFor","dateTime","id","className","testId","Tag","resolvedWeight","resolvedTone","jsx","cx","styles","clampTitle","index","memo","named"],"mappings":";;;;;;AAoDA,MAAMA,IAAiB,oBAAI,IAAiB,CAAC,QAAQ,OAAO,CAAC,GAOvDC,IAAkB,CAAC;AAAA,EACvB,UAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,QAAAC;AAAA,EACA,MAAAC;AAAA,EACA,IAAAC;AAAA,EACA,WAAAC,IAAY;AAAA,EACZ,UAAAC;AAAA,EACA,OAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,IAAAC;AAAA,EACA,WAAAC;AAAA,EACA,QAAAC;AACF,MAAM;AACJ,QAAMC,IAAMT,MAAON,EAAe,IAAIG,CAAO,IAAI,MAAM,SACjDa,IAAiBZ,MAAWD,MAAY,UAAU,WAAW,YAC7Dc,IAAeZ,MAASF,MAAY,UAAU,cAAc;AAElE,SACE,gBAAAe;AAAA,IAACH;AAAA,IAAA;AAAA,MACC,IAAAH;AAAA,MACA,SAASG,MAAQ,UAAUL,IAAU;AAAA,MACrC,UAAUK,MAAQ,SAASJ,IAAW;AAAA,MACtC,WAAWQ;AAAA,QACTC,EAAO;AAAA,QACPA,EAAO,SAASjB,CAAO,EAAE;AAAA,QACzBiB,EAAO,SAASJ,CAAc,EAAE;AAAA,QAChCI,EAAO,cAAcH,CAAY,EAAE;AAAA,QACnCV,KAAaa,EAAO,uBAAuB;AAAA,QAC3CZ,MAAa,UAAaY,EAAO,eAAeZ,CAAQ,EAAE;AAAA,QAC1DK;AAAA,MAAA;AAAA,MAEF,OAAOL,MAAa,SAAYC,IAAQY,EAAWnB,GAAUO,CAAK;AAAA,MAClE,eAAaK;AAAA,MAEZ,UAAAZ;AAAA,IAAA;AAAA,EAAA;AAGP,GAEAoB,IAA6B,gBAAAC,EAAmB,gBAAAC,EAAMvB,GAAM,MAAM,CAAC;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer ui{.ui-text-lnbTM{margin:0;min-width:0;overflow-wrap:break-word}.ui-text--body-j5Omo{font-family:var(--hd-font-body);font-size:var(--hd-type-body-size);font-weight:var(--hd-type-body-weight);font-stretch:var(--hd-type-body-stretch);line-height:var(--hd-type-body-line-height);letter-spacing:var(--hd-type-body-letter-spacing)}.ui-text--small-FiKGg{font-family:var(--hd-font-body);font-size:var(--hd-type-small-size);font-weight:var(--hd-type-small-weight);font-stretch:var(--hd-type-small-stretch);line-height:var(--hd-type-small-line-height);letter-spacing:var(--hd-type-small-letter-spacing)}.ui-text--caption-1DPQ5{font-family:var(--hd-font-body);font-size:var(--hd-type-caption-size);font-weight:var(--hd-type-caption-weight);font-stretch:var(--hd-type-caption-stretch);line-height:var(--hd-type-caption-line-height);letter-spacing:var(--hd-type-caption-letter-spacing)}.ui-text--label-pjuq8{font-family:var(--hd-font-body);font-size:var(--hd-type-small-size);font-weight:var(--hd-type-small-weight);font-stretch:var(--hd-type-small-stretch);line-height:var(--hd-type-small-line-height);letter-spacing:var(--hd-type-small-letter-spacing);line-height:var(--hd-type-h4-line-height)}.ui-text--numeric-z9Wa-{font-family:var(--hd-font-body);font-size:var(--hd-type-body-size);font-weight:var(--hd-type-body-weight);font-stretch:var(--hd-type-body-stretch);line-height:var(--hd-type-body-line-height);letter-spacing:var(--hd-type-body-letter-spacing);white-space:nowrap;font-variant-numeric:tabular-nums lining-nums}.ui-text--code-aNi-H{font-family:var(--hd-font-mono);font-size:var(--hd-type-code-size);letter-spacing:.02em;font-variant-numeric:tabular-nums;overflow-wrap:anywhere}.ui-text--numeric-figures-9e2Rp{font-variant-numeric:tabular-nums lining-nums}.ui-text--regular-fv-mD{font-weight:var(--hd-font-weight-regular)}.ui-text--medium-uP0Ps{font-weight:var(--hd-font-weight-medium)}.ui-text--semibold-Gl8LR{font-weight:var(--hd-font-weight-semibold)}.ui-text--tone-default-5haOG{color:var(--hd-text)}.ui-text--tone-secondary-CzT6B{color:var(--hd-text-2)}.ui-text--tone-tertiary-UxMd-{color:var(--hd-text-3)}.ui-text--tone-success-u9Brd{color:var(--hd-info-fg)}.ui-text--tone-danger-POFzB{color:var(--hd-danger-fg)}.ui-text--tone-inherit-CE226{color:inherit}.ui-text--clamp-1-A0SJ-{overflow:hidden;text-overflow:ellipsis;white-space:nowrap;min-width:0;display:block}.ui-text--clamp-2-Q6p-M{display:-webkit-box;min-width:0;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:2;line-clamp:2;overflow-wrap:anywhere}.ui-text--clamp-3-jpwOy{display:-webkit-box;min-width:0;overflow:hidden;-webkit-box-orient:vertical;-webkit-line-clamp:3;line-clamp:3;overflow-wrap:anywhere}}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),t=require("react"),O=require("react-dom"),
|
|
1
|
+
"use client";"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("react/jsx-runtime"),t=require("react"),O=require("react-dom"),y=require("../../helpers/class-name.helper.cjs"),j=require("../../helpers/component.helper.cjs"),F=require("../../hooks/useDismissOnEscape.cjs"),k=require("../../hooks/usePortalSurface.cjs"),I=require("../../hooks/usePositioning.cjs"),f={default:{"tooltip":"ui-tooltip-RG1g1","tooltip__trigger":"ui-tooltip__trigger-nWZtO","bubble":"ui-bubble-bcBNk","bubble--top":"ui-bubble--top-uWSZy","bubble--bottom":"ui-bubble--bottom-jKokL","bubble--left":"ui-bubble--left-WK4EM","bubble--right":"ui-bubble--right-EQjUT"}},M=120,A=500,Y=300,B=({content:E,children:s,side:v,position:g,openDelay:D=Y,className:_})=>{const[n,p]=t.useState(!1),P=t.useId(),h=v??g??"top",c=t.useRef(null),b=t.useRef(null),a=t.useRef(0),o=t.useRef(0),q=t.useMemo(()=>{if(!t.isValidElement(s))return!1;const e=s.type,u=s.props;return u.tabIndex!==void 0?!0:u.disabled===!0||typeof e!="string"?!1:e==="a"?u.href!==void 0:["button","input","select","textarea"].includes(e)},[s]),[R,S]=t.useState(!1);t.useEffect(()=>{const e=c.current;e&&S(!!e.querySelector('a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'))},[s]);const C=q||R,m=I.default(c,b,{side:h,align:"center",isOpen:n}),d=k.default(n,c,b),r=t.useCallback(()=>{a.current&&window.clearTimeout(a.current),a.current=0},[]),T=t.useCallback(e=>{r(),a.current=window.setTimeout(()=>p(!0),e)},[r]),i=t.useCallback((e=M)=>{r(),a.current=window.setTimeout(()=>p(!1),e)},[r]);t.useEffect(()=>r,[r]),t.useEffect(()=>()=>{o.current&&window.clearTimeout(o.current)},[]);const L=t.useCallback(()=>i(0),[i]);F.default(n,L,{isTransient:!0}),t.useEffect(()=>{if(!n)return;const e=u=>{var x;u.pointerType!=="mouse"&&((x=c.current)!=null&&x.contains(u.target)||i(0))};return document.addEventListener("pointerdown",e),()=>document.removeEventListener("pointerdown",e)},[n,i]);const w=()=>{o.current&&window.clearTimeout(o.current),o.current=0},N=e=>{e.pointerType!=="mouse"&&(o.current=window.setTimeout(()=>p(!0),A))};return l.jsxs(l.Fragment,{children:[l.jsx("span",{ref:c,className:y.cx(f.default.tooltip,_),tabIndex:C?void 0:0,onPointerEnter:e=>e.pointerType==="mouse"&&T(D),onPointerLeave:e=>{w(),e.pointerType==="mouse"&&i()},onPointerDown:N,onPointerUp:w,onPointerCancel:w,onFocus:()=>T(0),onBlur:()=>i(0),onContextMenu:e=>{(n||o.current)&&e.preventDefault()},children:l.jsx("span",{"aria-describedby":n?P:void 0,className:f.default.tooltip__trigger,children:s})}),n&&d.container&&O.createPortal(l.jsx("span",{ref:b,...d.attributes,id:P,role:"tooltip",className:y.cx(f.default.bubble,f.default[`bubble--${m.side}`]),style:{...m.style,...d.style,visibility:m.isPositioned?"visible":"hidden"},children:E}),d.container)]})},$=t.memo(j.named(B,"Tooltip"));exports.default=$;
|
|
2
2
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","sources":["../../../src/components/Tooltip/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n isValidElement,\n memo,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport useDismissOnEscape from '../../hooks/useDismissOnEscape';\nimport usePortalSurface from '../../hooks/usePortalSurface';\nimport usePositioning from '../../hooks/usePositioning';\n\nimport styles from './index.module.scss';\nimport type { PositionSide } from '@/types/positioning.type';\n\ntype Props = {\n /** Balonda gösterilecek açıklama. */\n content: ReactNode;\n /** Açıklamanın bağlandığı öğe — düğme, ikon, etiket. */\n children: ReactNode;\n /** Tercih edilen kenar. */\n side?: PositionSide;\n /** Açılma gecikmesi (ms). */\n openDelay?: number;\n /**\n * Ad değişti çünkü davranış değişti: `position` SABİT bir kenar yazıyordu ve balon oraya\n * sığmadığında görünüm alanının dışına taşıyordu. `side`…\n * @deprecated `side` kullanın.\n */\n position?: 'top' | 'bottom';\n className?: string;\n};\n\n/** Balonun kapanmadan önce beklediği süre — imlecin balona ulaşması için. */\nconst CLOSE_DELAY = 120;\n\n/** Dokunmatikte balonu açan basma süresi. */\nconst LONG_PRESS_DELAY = 500;\n\n/** İmleç öğenin üzerinde beklemeden balon açılmaz. */\nconst OPEN_DELAY = 300;\n\n/** İpucu balonu. */\nconst Tooltip = ({\n content,\n children,\n side,\n position,\n openDelay = OPEN_DELAY,\n className,\n}: Props) => {\n const [isOpen, setIsOpen] = useState(false);\n const id = useId();\n\n /* Eski prop bir surum boyunca calisir; `side` verilmisse o kazanir. */\n const resolvedSide: PositionSide = side ?? position ?? 'top';\n\n const anchorRef = useRef<HTMLSpanElement>(null);\n const bubbleRef = useRef<HTMLSpanElement>(null);\n const timerRef = useRef(0);\n const longPressRef = useRef(0);\n\n /*\n * Cocuk kendi basina odak alabiliyor mu — capaya `tabIndex` verilip verilmeyecegini bu belirler.\n */\n const staticallyFocusableChild = useMemo(() => {\n if (!isValidElement(children)) return false;\n const type = children.type;\n const props = children.props as { href?: unknown; tabIndex?: unknown; disabled?: unknown };\n\n if (props.tabIndex !== undefined) return true;\n if (props.disabled === true) return false;\n if (typeof type !== 'string') return false;\n if (type === 'a') return props.href !== undefined;\n\n return ['button', 'input', 'select', 'textarea'].includes(type);\n }, [children]);\n\n /*\n * `typeof type!== 'string'` her BILESENI \"odaklanamaz\" sayiyor; ui'nin her bileseni bir `memo`\n * NESNESI, yani `<Tooltip><Button/></Tooltip>` icin…\n * ⚠ STATIK KONTROL TEK BASINA YANLIS CEVAP VERIYORDU.\n */\n const [hasFocusableDescendant, setHasFocusableDescendant] = useState(false);\n\n useEffect(() => {\n const node = anchorRef.current;\n if (!node) return;\n\n setHasFocusableDescendant(\n Boolean(\n node.querySelector(\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])',\n ),\n ),\n );\n }, [children]);\n\n const hasFocusableChild = staticallyFocusableChild || hasFocusableDescendant;\n\n const positioning = usePositioning(anchorRef, bubbleRef, {\n side: resolvedSide,\n align: 'center',\n isOpen,\n });\n\n const portal = usePortalSurface(isOpen, anchorRef, bubbleRef);\n\n const clearTimer = useCallback(() => {\n if (timerRef.current) window.clearTimeout(timerRef.current);\n timerRef.current = 0;\n }, []);\n\n const open = useCallback(\n (delay: number) => {\n clearTimer();\n timerRef.current = window.setTimeout(() => setIsOpen(true), delay);\n },\n [clearTimer],\n );\n\n const close = useCallback(\n (delay: number = CLOSE_DELAY) => {\n clearTimer();\n timerRef.current = window.setTimeout(() => setIsOpen(false), delay);\n },\n [clearTimer],\n );\n\n useEffect(() => clearTimer, [clearTimer]);\n\n /*\n * ⚠ UZUN BASMA zamanlayıcısı AYRI temizlenir. `clearTimer` yalnızca açılış/ kapanış gecikmesini\n * iptal ediyor\n */\n useEffect(\n () => () => {\n if (longPressRef.current) window.clearTimeout(longPressRef.current);\n },\n [],\n );\n\n /*\n * Escape ANINDA kapatir: gecikme, ipucunu kapatmak icin bastigi tusun islemedigi izlenimi\n * veriyordu.\n */\n const closeNow = useCallback(() => close(0), [close]);\n /* Geçici: ipucu klavyeyi almaz, açıkken ⌘K ve kısayollar çalışır (`hasOpenSurface`). */\n useDismissOnEscape(isOpen, closeNow, { isTransient: true });\n\n /*\n * Dokunmatikte ekranin herhangi bir yerine dokunmak kapatir: balonun kendi kapatma yolu yok ve\n * `pointer-events: none` oldugu icin ona da dokunulamiyor.\n */\n useEffect(() => {\n if (!isOpen) return;\n\n const handlePointerDown = (event: globalThis.PointerEvent) => {\n if (event.pointerType === 'mouse') return;\n if (anchorRef.current?.contains(event.target as Node)) return;\n close(0);\n };\n\n document.addEventListener('pointerdown', handlePointerDown);\n return () => document.removeEventListener('pointerdown', handlePointerDown);\n }, [isOpen, close]);\n\n const cancelLongPress = () => {\n if (longPressRef.current) window.clearTimeout(longPressRef.current);\n longPressRef.current = 0;\n };\n\n const handlePointerDown = (event: ReactPointerEvent) => {\n if (event.pointerType === 'mouse') return;\n longPressRef.current = window.setTimeout(() => setIsOpen(true), LONG_PRESS_DELAY);\n };\n\n return (\n <>\n <span\n ref={anchorRef}\n className={cx(styles.tooltip, className)}\n /*\n * ⚠ CAPA ODAKLANABILIR OLMAK ZORUNDA. `onFocus`/`onBlur` zaten bagli ama ` ` varsayilan\n * olarak odak almiyor: cocuk kendisi odaklanabilir…\n * ⚠ Cocuk zaten odaklanabiliyorsa (dugme, baglanti) `tabIndex` KONULMAZ: aksi halde ayni\n * ipucu icin sekmede IKI durak olusur.\n */\n tabIndex={hasFocusableChild ? undefined : 0}\n onPointerEnter={event => event.pointerType === 'mouse' && open(openDelay)}\n onPointerLeave={event => {\n cancelLongPress();\n if (event.pointerType === 'mouse') close();\n }}\n onPointerDown={handlePointerDown}\n onPointerUp={cancelLongPress}\n onPointerCancel={cancelLongPress}\n onFocus={() => open(0)}\n onBlur={() => close(0)}\n onContextMenu={event => {\n if (isOpen || longPressRef.current) event.preventDefault();\n }}\n >\n <span aria-describedby={isOpen ? id : undefined} className={styles.tooltip__trigger}>\n {children}\n </span>\n </span>\n\n {/*\n Balon DOM'da yalnizca ACIKKEN: kapaliyken de birakip gizlemek, ekran\n okuyucunun onu `aria-describedby` olmadan da bulup okumasina yol\n aciyordu.\n */}\n {isOpen &&\n portal.container &&\n createPortal(\n <span\n ref={bubbleRef}\n /* ⚠ Modal içinden açıldığında üst katman ZORUNLU — `portal.helper`. */\n {...portal.attributes}\n id={id}\n role=\"tooltip\"\n className={cx(styles.bubble, styles[`bubble--${positioning.side}`])}\n style={{\n ...positioning.style,\n ...portal.style,\n /* Olculmeden cizilen balon bir kare boyunca sol ust kosede parliyordu. */\n visibility: positioning.isPositioned ? 'visible' : 'hidden',\n }}\n >\n {content}\n </span>,\n portal.container,\n )}\n </>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Tooltip, 'Tooltip')) as typeof Tooltip;\n"],"names":["CLOSE_DELAY","LONG_PRESS_DELAY","OPEN_DELAY","Tooltip","content","children","side","position","openDelay","className","isOpen","setIsOpen","useState","id","useId","resolvedSide","anchorRef","useRef","bubbleRef","timerRef","longPressRef","staticallyFocusableChild","useMemo","isValidElement","type","props","hasFocusableDescendant","setHasFocusableDescendant","useEffect","node","hasFocusableChild","positioning","usePositioning","portal","usePortalSurface","clearTimer","useCallback","open","delay","close","closeNow","useDismissOnEscape","handlePointerDown","event","_a","cancelLongPress","jsxs","Fragment","jsx","cx","styles","createPortal","index","memo","named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AA,GAAGC,UAAO,QAASzC,CAAS,EAOvC,SAAUqB,EAAoB,OAAY,EAC1C,eAAgBa,GAASA,EAAM,cAAgB,SAAWN,EAAK7B,CAAS,EACxE,eAAgBmC,GAAS,CACvBE,EAAA,EACIF,EAAM,cAAgB,SAASJ,EAAA,CACrC,EACA,cAAeG,EACf,YAAaG,EACb,gBAAiBA,EACjB,QAAS,IAAMR,EAAK,CAAC,EACrB,OAAQ,IAAME,EAAM,CAAC,EACrB,cAAeI,GAAS,EAClBjC,GAAUU,EAAa,UAASuB,EAAM,eAAA,CAC5C,EAEA,SAAAK,EAAAA,IAAC,QAAK,mBAAkBtC,EAASG,EAAK,OAAW,UAAWqC,UAAO,iBAChE,SAAA7C,CAAA,CACH,CAAA,CAAA,EAQDK,GACCuB,EAAO,WACPkB,EAAAA,aACEH,EAAAA,IAAC,OAAA,CACC,IAAK9B,EAEJ,GAAGe,EAAO,WACX,GAAApB,EACA,KAAK,UACL,UAAWoC,EAAAA,GAAGC,EAAAA,QAAO,OAAQA,EAAAA,QAAO,WAAWnB,EAAY,IAAI,EAAE,CAAC,EAClE,MAAO,CACL,GAAGA,EAAY,MACf,GAAGE,EAAO,MAEV,WAAYF,EAAY,aAAe,UAAY,QAAA,EAGpD,SAAA3B,CAAA,CAAA,EAEH6B,EAAO,SAAA,CACT,EACJ,CAEJ,EAEAmB,EAA6BC,OAAmBC,EAAAA,MAAMnD,EAAS,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/Tooltip/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n isValidElement,\n memo,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport useDismissOnEscape from '../../hooks/useDismissOnEscape';\nimport usePortalSurface from '../../hooks/usePortalSurface';\nimport usePositioning from '../../hooks/usePositioning';\n\nimport styles from './index.module.scss';\nimport type { PositionSide } from '@/types/positioning.type';\n\ntype Props = {\n /** Balonda gösterilecek açıklama. */\n content: ReactNode;\n /** Açıklamanın bağlandığı öğe — düğme, ikon, etiket. */\n children: ReactNode;\n /** Tercih edilen kenar. */\n side?: PositionSide;\n /** Açılma gecikmesi (ms). */\n openDelay?: number;\n /**\n * Ad değişti çünkü davranış değişti: `position` SABİT bir kenar yazıyordu ve balon oraya\n * sığmadığında görünüm alanının dışına taşıyordu. `side`…\n * @deprecated `side` kullanın.\n */\n position?: 'top' | 'bottom';\n className?: string;\n};\n\n/** Balonun kapanmadan önce beklediği süre — imlecin balona ulaşması için. */\nconst CLOSE_DELAY = 120;\n\n/** Dokunmatikte balonu açan basma süresi. */\nconst LONG_PRESS_DELAY = 500;\n\n/** İmleç öğenin üzerinde beklemeden balon açılmaz. */\nconst OPEN_DELAY = 300;\n\n/** İpucu balonu. */\nconst Tooltip = ({\n content,\n children,\n side,\n position,\n openDelay = OPEN_DELAY,\n className,\n}: Props) => {\n const [isOpen, setIsOpen] = useState(false);\n const id = useId();\n\n /* Eski prop bir surum boyunca calisir; `side` verilmisse o kazanir. */\n const resolvedSide: PositionSide = side ?? position ?? 'top';\n\n const anchorRef = useRef<HTMLSpanElement>(null);\n const bubbleRef = useRef<HTMLSpanElement>(null);\n const timerRef = useRef(0);\n const longPressRef = useRef(0);\n\n /*\n * Cocuk kendi basina odak alabiliyor mu — capaya `tabIndex` verilip verilmeyecegini bu belirler.\n */\n const staticallyFocusableChild = useMemo(() => {\n if (!isValidElement(children)) return false;\n const type = children.type;\n const props = children.props as { href?: unknown; tabIndex?: unknown; disabled?: unknown };\n\n if (props.tabIndex !== undefined) return true;\n if (props.disabled === true) return false;\n if (typeof type !== 'string') return false;\n if (type === 'a') return props.href !== undefined;\n\n return ['button', 'input', 'select', 'textarea'].includes(type);\n }, [children]);\n\n /*\n * `typeof type!== 'string'` her BILESENI \"odaklanamaz\" sayiyor; ui'nin her bileseni bir `memo`\n * NESNESI, yani `<Tooltip><Button/></Tooltip>` icin…\n * ⚠ STATIK KONTROL TEK BASINA YANLIS CEVAP VERIYORDU.\n */\n const [hasFocusableDescendant, setHasFocusableDescendant] = useState(false);\n\n useEffect(() => {\n const node = anchorRef.current;\n if (!node) return;\n\n setHasFocusableDescendant(\n Boolean(\n node.querySelector(\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])',\n ),\n ),\n );\n }, [children]);\n\n const hasFocusableChild = staticallyFocusableChild || hasFocusableDescendant;\n\n const positioning = usePositioning(anchorRef, bubbleRef, {\n side: resolvedSide,\n align: 'center',\n isOpen,\n });\n\n const portal = usePortalSurface(isOpen, anchorRef, bubbleRef);\n\n const clearTimer = useCallback(() => {\n if (timerRef.current) window.clearTimeout(timerRef.current);\n timerRef.current = 0;\n }, []);\n\n const open = useCallback(\n (delay: number) => {\n clearTimer();\n timerRef.current = window.setTimeout(() => setIsOpen(true), delay);\n },\n [clearTimer],\n );\n\n const close = useCallback(\n (delay: number = CLOSE_DELAY) => {\n clearTimer();\n timerRef.current = window.setTimeout(() => setIsOpen(false), delay);\n },\n [clearTimer],\n );\n\n useEffect(() => clearTimer, [clearTimer]);\n\n /*\n * ⚠ UZUN BASMA zamanlayıcısı AYRI temizlenir. `clearTimer` yalnızca açılış/ kapanış gecikmesini\n * iptal ediyor\n */\n useEffect(\n () => () => {\n if (longPressRef.current) window.clearTimeout(longPressRef.current);\n },\n [],\n );\n\n /*\n * Escape ANINDA kapatir: gecikme, ipucunu kapatmak icin bastigi tusun islemedigi izlenimi\n * veriyordu.\n */\n const closeNow = useCallback(() => close(0), [close]);\n /* Geçici: ipucu klavyeyi almaz, açıkken ⌘K ve kısayollar çalışır (`hasOpenSurface`). */\n useDismissOnEscape(isOpen, closeNow, { isTransient: true });\n\n /*\n * Dokunmatikte ekranin herhangi bir yerine dokunmak kapatir: balonun kendi kapatma yolu yok ve\n * `pointer-events: none` oldugu icin ona da dokunulamiyor.\n */\n useEffect(() => {\n if (!isOpen) return;\n\n const handlePointerDown = (event: globalThis.PointerEvent) => {\n if (event.pointerType === 'mouse') return;\n if (anchorRef.current?.contains(event.target as Node)) return;\n close(0);\n };\n\n document.addEventListener('pointerdown', handlePointerDown);\n return () => document.removeEventListener('pointerdown', handlePointerDown);\n }, [isOpen, close]);\n\n const cancelLongPress = () => {\n if (longPressRef.current) window.clearTimeout(longPressRef.current);\n longPressRef.current = 0;\n };\n\n const handlePointerDown = (event: ReactPointerEvent) => {\n if (event.pointerType === 'mouse') return;\n longPressRef.current = window.setTimeout(() => setIsOpen(true), LONG_PRESS_DELAY);\n };\n\n return (\n <>\n <span\n ref={anchorRef}\n className={cx(styles.tooltip, className)}\n /*\n * ⚠ CAPA ODAKLANABILIR OLMAK ZORUNDA. `onFocus`/`onBlur` zaten bagli ama ` ` varsayilan\n * olarak odak almiyor: cocuk kendisi odaklanabilir…\n * ⚠ Cocuk zaten odaklanabiliyorsa (dugme, baglanti) `tabIndex` KONULMAZ: aksi halde ayni\n * ipucu icin sekmede IKI durak olusur.\n */\n tabIndex={hasFocusableChild ? undefined : 0}\n onPointerEnter={event => event.pointerType === 'mouse' && open(openDelay)}\n onPointerLeave={event => {\n cancelLongPress();\n if (event.pointerType === 'mouse') close();\n }}\n onPointerDown={handlePointerDown}\n onPointerUp={cancelLongPress}\n onPointerCancel={cancelLongPress}\n onFocus={() => open(0)}\n onBlur={() => close(0)}\n onContextMenu={event => {\n if (isOpen || longPressRef.current) event.preventDefault();\n }}\n >\n <span aria-describedby={isOpen ? id : undefined} className={styles.tooltip__trigger}>\n {children}\n </span>\n </span>\n\n {/*\n Balon DOM'da yalnizca ACIKKEN: kapaliyken de birakip gizlemek, ekran\n okuyucunun onu `aria-describedby` olmadan da bulup okumasina yol\n aciyordu.\n */}\n {isOpen &&\n portal.container &&\n createPortal(\n <span\n ref={bubbleRef}\n /* ⚠ Modal içinden açıldığında üst katman ZORUNLU — `portal.helper`. */\n {...portal.attributes}\n id={id}\n role=\"tooltip\"\n className={cx(styles.bubble, styles[`bubble--${positioning.side}`])}\n style={{\n ...positioning.style,\n ...portal.style,\n /* Olculmeden cizilen balon bir kare boyunca sol ust kosede parliyordu. */\n visibility: positioning.isPositioned ? 'visible' : 'hidden',\n }}\n >\n {content}\n </span>,\n portal.container,\n )}\n </>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Tooltip, 'Tooltip')) as typeof Tooltip;\n"],"names":["CLOSE_DELAY","LONG_PRESS_DELAY","OPEN_DELAY","Tooltip","content","children","side","position","openDelay","className","isOpen","setIsOpen","useState","id","useId","resolvedSide","anchorRef","useRef","bubbleRef","timerRef","longPressRef","staticallyFocusableChild","useMemo","isValidElement","type","props","hasFocusableDescendant","setHasFocusableDescendant","useEffect","node","hasFocusableChild","positioning","usePositioning","portal","usePortalSurface","clearTimer","useCallback","open","delay","close","closeNow","useDismissOnEscape","handlePointerDown","event","_a","cancelLongPress","jsxs","Fragment","jsx","cx","styles","createPortal","memo","named"],"mappings":"wdA2CMA,EAAc,IAGdC,EAAmB,IAGnBC,EAAa,IAGbC,EAAU,CAAC,CACf,QAAAC,EACA,SAAAC,EACA,KAAAC,EACA,SAAAC,EACA,UAAAC,EAAYN,EACZ,UAAAO,CACF,IAAa,CACX,KAAM,CAACC,EAAQC,CAAS,EAAIC,EAAAA,SAAS,EAAK,EACpCC,EAAKC,EAAAA,MAAA,EAGLC,EAA6BT,GAAQC,GAAY,MAEjDS,EAAYC,EAAAA,OAAwB,IAAI,EACxCC,EAAYD,EAAAA,OAAwB,IAAI,EACxCE,EAAWF,EAAAA,OAAO,CAAC,EACnBG,EAAeH,EAAAA,OAAO,CAAC,EAKvBI,EAA2BC,EAAAA,QAAQ,IAAM,CAC7C,GAAI,CAACC,EAAAA,eAAelB,CAAQ,EAAG,MAAO,GACtC,MAAMmB,EAAOnB,EAAS,KAChBoB,EAA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EJ,GAAGe,EAAO,WACX,GAAApB,EACA,KAAK,UACL,UAAWoC,EAAAA,GAAGC,EAAAA,QAAO,OAAQA,EAAAA,QAAO,WAAWnB,EAAY,IAAI,EAAE,CAAC,EAClE,MAAO,CACL,GAAGA,EAAY,MACf,GAAGE,EAAO,MAEV,WAAYF,EAAY,aAAe,UAAY,QAAA,EAGpD,SAAA3B,CAAA,CAAA,EAEH6B,EAAO,SAAA,CACT,EACJ,CAEJ,EAEA9B,EAA6BiD,OAAmBC,EAAAA,MAAMlD,EAAS,SAAS,CAAC"}
|
|
@@ -1,26 +1,26 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsxs as Y, Fragment as j, jsx as P } from "react/jsx-runtime";
|
|
3
|
-
import { memo as B, useState as
|
|
4
|
-
import { createPortal as
|
|
3
|
+
import { memo as B, useState as x, useId as M, useRef as l, useMemo as $, isValidElement as k, useEffect as d, useCallback as p } from "react";
|
|
4
|
+
import { createPortal as q } from "react-dom";
|
|
5
5
|
import { cx as g } from "../../helpers/class-name.helper.js";
|
|
6
|
-
import { named as
|
|
7
|
-
import
|
|
8
|
-
import
|
|
9
|
-
import
|
|
6
|
+
import { named as G } from "../../helpers/component.helper.js";
|
|
7
|
+
import H from "../../hooks/useDismissOnEscape.js";
|
|
8
|
+
import U from "../../hooks/usePortalSurface.js";
|
|
9
|
+
import V from "../../hooks/usePositioning.js";
|
|
10
10
|
const f = {"tooltip":"ui-tooltip-RG1g1","tooltip__trigger":"ui-tooltip__trigger-nWZtO","bubble":"ui-bubble-bcBNk","bubble--top":"ui-bubble--top-uWSZy","bubble--bottom":"ui-bubble--bottom-jKokL","bubble--left":"ui-bubble--left-WK4EM","bubble--right":"ui-bubble--right-EQjUT"};
|
|
11
11
|
const z = 120, J = 500, K = 300, Q = ({
|
|
12
12
|
content: D,
|
|
13
|
-
children:
|
|
13
|
+
children: n,
|
|
14
14
|
side: L,
|
|
15
15
|
position: h,
|
|
16
16
|
openDelay: S = K,
|
|
17
17
|
className: C
|
|
18
18
|
}) => {
|
|
19
|
-
const [t, m] =
|
|
20
|
-
if (!
|
|
21
|
-
const e =
|
|
19
|
+
const [t, m] = x(!1), T = M(), F = L ?? h ?? "top", c = l(null), b = l(null), a = l(0), o = l(0), N = $(() => {
|
|
20
|
+
if (!k(n)) return !1;
|
|
21
|
+
const e = n.type, i = n.props;
|
|
22
22
|
return i.tabIndex !== void 0 ? !0 : i.disabled === !0 || typeof e != "string" ? !1 : e === "a" ? i.href !== void 0 : ["button", "input", "select", "textarea"].includes(e);
|
|
23
|
-
}, [
|
|
23
|
+
}, [n]), [O, R] = x(!1);
|
|
24
24
|
d(() => {
|
|
25
25
|
const e = c.current;
|
|
26
26
|
e && R(
|
|
@@ -28,14 +28,14 @@ const z = 120, J = 500, K = 300, Q = ({
|
|
|
28
28
|
'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
29
29
|
)
|
|
30
30
|
);
|
|
31
|
-
}, [
|
|
32
|
-
const _ = N || O, w =
|
|
31
|
+
}, [n]);
|
|
32
|
+
const _ = N || O, w = V(c, b, {
|
|
33
33
|
side: F,
|
|
34
34
|
align: "center",
|
|
35
35
|
isOpen: t
|
|
36
|
-
}), u =
|
|
36
|
+
}), u = U(t, c, b), r = p(() => {
|
|
37
37
|
a.current && window.clearTimeout(a.current), a.current = 0;
|
|
38
|
-
}, []),
|
|
38
|
+
}, []), E = p(
|
|
39
39
|
(e) => {
|
|
40
40
|
r(), a.current = window.setTimeout(() => m(!0), e);
|
|
41
41
|
},
|
|
@@ -48,23 +48,23 @@ const z = 120, J = 500, K = 300, Q = ({
|
|
|
48
48
|
);
|
|
49
49
|
d(() => r, [r]), d(
|
|
50
50
|
() => () => {
|
|
51
|
-
|
|
51
|
+
o.current && window.clearTimeout(o.current);
|
|
52
52
|
},
|
|
53
53
|
[]
|
|
54
54
|
);
|
|
55
55
|
const I = p(() => s(0), [s]);
|
|
56
|
-
|
|
56
|
+
H(t, I, { isTransient: !0 }), d(() => {
|
|
57
57
|
if (!t) return;
|
|
58
58
|
const e = (i) => {
|
|
59
|
-
var
|
|
60
|
-
i.pointerType !== "mouse" && ((
|
|
59
|
+
var v;
|
|
60
|
+
i.pointerType !== "mouse" && ((v = c.current) != null && v.contains(i.target) || s(0));
|
|
61
61
|
};
|
|
62
62
|
return document.addEventListener("pointerdown", e), () => document.removeEventListener("pointerdown", e);
|
|
63
63
|
}, [t, s]);
|
|
64
64
|
const y = () => {
|
|
65
|
-
|
|
65
|
+
o.current && window.clearTimeout(o.current), o.current = 0;
|
|
66
66
|
}, A = (e) => {
|
|
67
|
-
e.pointerType !== "mouse" && (
|
|
67
|
+
e.pointerType !== "mouse" && (o.current = window.setTimeout(() => m(!0), J));
|
|
68
68
|
};
|
|
69
69
|
return /* @__PURE__ */ Y(j, { children: [
|
|
70
70
|
/* @__PURE__ */ P(
|
|
@@ -73,22 +73,22 @@ const z = 120, J = 500, K = 300, Q = ({
|
|
|
73
73
|
ref: c,
|
|
74
74
|
className: g(f.tooltip, C),
|
|
75
75
|
tabIndex: _ ? void 0 : 0,
|
|
76
|
-
onPointerEnter: (e) => e.pointerType === "mouse" &&
|
|
76
|
+
onPointerEnter: (e) => e.pointerType === "mouse" && E(S),
|
|
77
77
|
onPointerLeave: (e) => {
|
|
78
78
|
y(), e.pointerType === "mouse" && s();
|
|
79
79
|
},
|
|
80
80
|
onPointerDown: A,
|
|
81
81
|
onPointerUp: y,
|
|
82
82
|
onPointerCancel: y,
|
|
83
|
-
onFocus: () =>
|
|
83
|
+
onFocus: () => E(0),
|
|
84
84
|
onBlur: () => s(0),
|
|
85
85
|
onContextMenu: (e) => {
|
|
86
|
-
(t ||
|
|
86
|
+
(t || o.current) && e.preventDefault();
|
|
87
87
|
},
|
|
88
|
-
children: /* @__PURE__ */ P("span", { "aria-describedby": t ? T : void 0, className: f.tooltip__trigger, children:
|
|
88
|
+
children: /* @__PURE__ */ P("span", { "aria-describedby": t ? T : void 0, className: f.tooltip__trigger, children: n })
|
|
89
89
|
}
|
|
90
90
|
),
|
|
91
|
-
t && u.container &&
|
|
91
|
+
t && u.container && q(
|
|
92
92
|
/* @__PURE__ */ P(
|
|
93
93
|
"span",
|
|
94
94
|
{
|
|
@@ -109,7 +109,7 @@ const z = 120, J = 500, K = 300, Q = ({
|
|
|
109
109
|
u.container
|
|
110
110
|
)
|
|
111
111
|
] });
|
|
112
|
-
}, ie = /* @__PURE__ */ B(/* @__PURE__ */
|
|
112
|
+
}, ie = /* @__PURE__ */ B(/* @__PURE__ */ G(Q, "Tooltip"));
|
|
113
113
|
export {
|
|
114
114
|
ie as default
|
|
115
115
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../src/components/Tooltip/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n isValidElement,\n memo,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport useDismissOnEscape from '../../hooks/useDismissOnEscape';\nimport usePortalSurface from '../../hooks/usePortalSurface';\nimport usePositioning from '../../hooks/usePositioning';\n\nimport styles from './index.module.scss';\nimport type { PositionSide } from '@/types/positioning.type';\n\ntype Props = {\n /** Balonda gösterilecek açıklama. */\n content: ReactNode;\n /** Açıklamanın bağlandığı öğe — düğme, ikon, etiket. */\n children: ReactNode;\n /** Tercih edilen kenar. */\n side?: PositionSide;\n /** Açılma gecikmesi (ms). */\n openDelay?: number;\n /**\n * Ad değişti çünkü davranış değişti: `position` SABİT bir kenar yazıyordu ve balon oraya\n * sığmadığında görünüm alanının dışına taşıyordu. `side`…\n * @deprecated `side` kullanın.\n */\n position?: 'top' | 'bottom';\n className?: string;\n};\n\n/** Balonun kapanmadan önce beklediği süre — imlecin balona ulaşması için. */\nconst CLOSE_DELAY = 120;\n\n/** Dokunmatikte balonu açan basma süresi. */\nconst LONG_PRESS_DELAY = 500;\n\n/** İmleç öğenin üzerinde beklemeden balon açılmaz. */\nconst OPEN_DELAY = 300;\n\n/** İpucu balonu. */\nconst Tooltip = ({\n content,\n children,\n side,\n position,\n openDelay = OPEN_DELAY,\n className,\n}: Props) => {\n const [isOpen, setIsOpen] = useState(false);\n const id = useId();\n\n /* Eski prop bir surum boyunca calisir; `side` verilmisse o kazanir. */\n const resolvedSide: PositionSide = side ?? position ?? 'top';\n\n const anchorRef = useRef<HTMLSpanElement>(null);\n const bubbleRef = useRef<HTMLSpanElement>(null);\n const timerRef = useRef(0);\n const longPressRef = useRef(0);\n\n /*\n * Cocuk kendi basina odak alabiliyor mu — capaya `tabIndex` verilip verilmeyecegini bu belirler.\n */\n const staticallyFocusableChild = useMemo(() => {\n if (!isValidElement(children)) return false;\n const type = children.type;\n const props = children.props as { href?: unknown; tabIndex?: unknown; disabled?: unknown };\n\n if (props.tabIndex !== undefined) return true;\n if (props.disabled === true) return false;\n if (typeof type !== 'string') return false;\n if (type === 'a') return props.href !== undefined;\n\n return ['button', 'input', 'select', 'textarea'].includes(type);\n }, [children]);\n\n /*\n * `typeof type!== 'string'` her BILESENI \"odaklanamaz\" sayiyor; ui'nin her bileseni bir `memo`\n * NESNESI, yani `<Tooltip><Button/></Tooltip>` icin…\n * ⚠ STATIK KONTROL TEK BASINA YANLIS CEVAP VERIYORDU.\n */\n const [hasFocusableDescendant, setHasFocusableDescendant] = useState(false);\n\n useEffect(() => {\n const node = anchorRef.current;\n if (!node) return;\n\n setHasFocusableDescendant(\n Boolean(\n node.querySelector(\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])',\n ),\n ),\n );\n }, [children]);\n\n const hasFocusableChild = staticallyFocusableChild || hasFocusableDescendant;\n\n const positioning = usePositioning(anchorRef, bubbleRef, {\n side: resolvedSide,\n align: 'center',\n isOpen,\n });\n\n const portal = usePortalSurface(isOpen, anchorRef, bubbleRef);\n\n const clearTimer = useCallback(() => {\n if (timerRef.current) window.clearTimeout(timerRef.current);\n timerRef.current = 0;\n }, []);\n\n const open = useCallback(\n (delay: number) => {\n clearTimer();\n timerRef.current = window.setTimeout(() => setIsOpen(true), delay);\n },\n [clearTimer],\n );\n\n const close = useCallback(\n (delay: number = CLOSE_DELAY) => {\n clearTimer();\n timerRef.current = window.setTimeout(() => setIsOpen(false), delay);\n },\n [clearTimer],\n );\n\n useEffect(() => clearTimer, [clearTimer]);\n\n /*\n * ⚠ UZUN BASMA zamanlayıcısı AYRI temizlenir. `clearTimer` yalnızca açılış/ kapanış gecikmesini\n * iptal ediyor\n */\n useEffect(\n () => () => {\n if (longPressRef.current) window.clearTimeout(longPressRef.current);\n },\n [],\n );\n\n /*\n * Escape ANINDA kapatir: gecikme, ipucunu kapatmak icin bastigi tusun islemedigi izlenimi\n * veriyordu.\n */\n const closeNow = useCallback(() => close(0), [close]);\n /* Geçici: ipucu klavyeyi almaz, açıkken ⌘K ve kısayollar çalışır (`hasOpenSurface`). */\n useDismissOnEscape(isOpen, closeNow, { isTransient: true });\n\n /*\n * Dokunmatikte ekranin herhangi bir yerine dokunmak kapatir: balonun kendi kapatma yolu yok ve\n * `pointer-events: none` oldugu icin ona da dokunulamiyor.\n */\n useEffect(() => {\n if (!isOpen) return;\n\n const handlePointerDown = (event: globalThis.PointerEvent) => {\n if (event.pointerType === 'mouse') return;\n if (anchorRef.current?.contains(event.target as Node)) return;\n close(0);\n };\n\n document.addEventListener('pointerdown', handlePointerDown);\n return () => document.removeEventListener('pointerdown', handlePointerDown);\n }, [isOpen, close]);\n\n const cancelLongPress = () => {\n if (longPressRef.current) window.clearTimeout(longPressRef.current);\n longPressRef.current = 0;\n };\n\n const handlePointerDown = (event: ReactPointerEvent) => {\n if (event.pointerType === 'mouse') return;\n longPressRef.current = window.setTimeout(() => setIsOpen(true), LONG_PRESS_DELAY);\n };\n\n return (\n <>\n <span\n ref={anchorRef}\n className={cx(styles.tooltip, className)}\n /*\n * ⚠ CAPA ODAKLANABILIR OLMAK ZORUNDA. `onFocus`/`onBlur` zaten bagli ama ` ` varsayilan\n * olarak odak almiyor: cocuk kendisi odaklanabilir…\n * ⚠ Cocuk zaten odaklanabiliyorsa (dugme, baglanti) `tabIndex` KONULMAZ: aksi halde ayni\n * ipucu icin sekmede IKI durak olusur.\n */\n tabIndex={hasFocusableChild ? undefined : 0}\n onPointerEnter={event => event.pointerType === 'mouse' && open(openDelay)}\n onPointerLeave={event => {\n cancelLongPress();\n if (event.pointerType === 'mouse') close();\n }}\n onPointerDown={handlePointerDown}\n onPointerUp={cancelLongPress}\n onPointerCancel={cancelLongPress}\n onFocus={() => open(0)}\n onBlur={() => close(0)}\n onContextMenu={event => {\n if (isOpen || longPressRef.current) event.preventDefault();\n }}\n >\n <span aria-describedby={isOpen ? id : undefined} className={styles.tooltip__trigger}>\n {children}\n </span>\n </span>\n\n {/*\n Balon DOM'da yalnizca ACIKKEN: kapaliyken de birakip gizlemek, ekran\n okuyucunun onu `aria-describedby` olmadan da bulup okumasina yol\n aciyordu.\n */}\n {isOpen &&\n portal.container &&\n createPortal(\n <span\n ref={bubbleRef}\n /* ⚠ Modal içinden açıldığında üst katman ZORUNLU — `portal.helper`. */\n {...portal.attributes}\n id={id}\n role=\"tooltip\"\n className={cx(styles.bubble, styles[`bubble--${positioning.side}`])}\n style={{\n ...positioning.style,\n ...portal.style,\n /* Olculmeden cizilen balon bir kare boyunca sol ust kosede parliyordu. */\n visibility: positioning.isPositioned ? 'visible' : 'hidden',\n }}\n >\n {content}\n </span>,\n portal.container,\n )}\n </>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Tooltip, 'Tooltip')) as typeof Tooltip;\n"],"names":["CLOSE_DELAY","LONG_PRESS_DELAY","OPEN_DELAY","Tooltip","content","children","side","position","openDelay","className","isOpen","setIsOpen","useState","id","useId","resolvedSide","anchorRef","useRef","bubbleRef","timerRef","longPressRef","staticallyFocusableChild","useMemo","isValidElement","type","props","hasFocusableDescendant","setHasFocusableDescendant","useEffect","node","hasFocusableChild","positioning","usePositioning","portal","usePortalSurface","clearTimer","useCallback","open","delay","close","closeNow","useDismissOnEscape","handlePointerDown","event","_a","cancelLongPress","jsxs","Fragment","jsx","cx","styles","createPortal","index","memo","named"],"mappings":";;;;;;;;;;AA2CA,MAAMA,IAAc,KAGdC,IAAmB,KAGnBC,IAAa,KAGbC,IAAU,CAAC;AAAA,EACf,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAYN;AAAA,EACZ,WAAAO;AACF,MAAa;AACX,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpCC,IAAKC,EAAA,GAGLC,IAA6BT,KAAQC,KAAY,OAEjDS,IAAYC,EAAwB,IAAI,GACxCC,IAAYD,EAAwB,IAAI,GACxCE,IAAWF,EAAO,CAAC,GACnBG,IAAeH,EAAO,CAAC,GAKvBI,IAA2BC,EAAQ,MAAM;AAC7C,QAAI,CAACC,EAAelB,CAAQ,EAAG,QAAO;AACtC,UAAMmB,IAAOnB,EAAS,MAChBoB,IAAQpB,EAAS;AAEvB,WAAIoB,EAAM,aAAa,SAAkB,KACrCA,EAAM,aAAa,MACnB,OAAOD,KAAS,WAAiB,KACjCA,MAAS,MAAYC,EAAM,SAAS,SAEjC,CAAC,UAAU,SAAS,UAAU,UAAU,EAAE,SAASD,CAAI;AAAA,EAChE,GAAG,CAACnB,CAAQ,CAAC,GAOP,CAACqB,GAAwBC,CAAyB,IAAIf,EAAS,EAAK;AAE1E,EAAAgB,EAAU,MAAM;AACd,UAAMC,IAAOb,EAAU;AACvB,IAAKa,KAELF;AAAA,MACE,EACEE,EAAK;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AAAA,EAEJ,GAAG,CAACxB,CAAQ,CAAC;AAEb,QAAMyB,IA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E,CAAC;AAAA,UAClE,OAAO;AAAA,YACL,GAAGA,EAAY;AAAA,YACf,GAAGE,EAAO;AAAA;AAAA,YAEV,YAAYF,EAAY,eAAe,YAAY;AAAA,UAAA;AAAA,UAGpD,UAAA3B;AAAA,QAAA;AAAA,MAAA;AAAA,MAEH6B,EAAO;AAAA,IAAA;AAAA,EACT,GACJ;AAEJ,GAEAmB,KAA6B,gBAAAC,EAAmB,gBAAAC,EAAMnD,GAAS,SAAS,CAAC;"}
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/Tooltip/index.tsx"],"sourcesContent":["'use client';\n\nimport {\n isValidElement,\n memo,\n type PointerEvent as ReactPointerEvent,\n type ReactNode,\n useCallback,\n useEffect,\n useId,\n useMemo,\n useRef,\n useState,\n} from 'react';\nimport { createPortal } from 'react-dom';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport useDismissOnEscape from '../../hooks/useDismissOnEscape';\nimport usePortalSurface from '../../hooks/usePortalSurface';\nimport usePositioning from '../../hooks/usePositioning';\n\nimport styles from './index.module.scss';\nimport type { PositionSide } from '@/types/positioning.type';\n\ntype Props = {\n /** Balonda gösterilecek açıklama. */\n content: ReactNode;\n /** Açıklamanın bağlandığı öğe — düğme, ikon, etiket. */\n children: ReactNode;\n /** Tercih edilen kenar. */\n side?: PositionSide;\n /** Açılma gecikmesi (ms). */\n openDelay?: number;\n /**\n * Ad değişti çünkü davranış değişti: `position` SABİT bir kenar yazıyordu ve balon oraya\n * sığmadığında görünüm alanının dışına taşıyordu. `side`…\n * @deprecated `side` kullanın.\n */\n position?: 'top' | 'bottom';\n className?: string;\n};\n\n/** Balonun kapanmadan önce beklediği süre — imlecin balona ulaşması için. */\nconst CLOSE_DELAY = 120;\n\n/** Dokunmatikte balonu açan basma süresi. */\nconst LONG_PRESS_DELAY = 500;\n\n/** İmleç öğenin üzerinde beklemeden balon açılmaz. */\nconst OPEN_DELAY = 300;\n\n/** İpucu balonu. */\nconst Tooltip = ({\n content,\n children,\n side,\n position,\n openDelay = OPEN_DELAY,\n className,\n}: Props) => {\n const [isOpen, setIsOpen] = useState(false);\n const id = useId();\n\n /* Eski prop bir surum boyunca calisir; `side` verilmisse o kazanir. */\n const resolvedSide: PositionSide = side ?? position ?? 'top';\n\n const anchorRef = useRef<HTMLSpanElement>(null);\n const bubbleRef = useRef<HTMLSpanElement>(null);\n const timerRef = useRef(0);\n const longPressRef = useRef(0);\n\n /*\n * Cocuk kendi basina odak alabiliyor mu — capaya `tabIndex` verilip verilmeyecegini bu belirler.\n */\n const staticallyFocusableChild = useMemo(() => {\n if (!isValidElement(children)) return false;\n const type = children.type;\n const props = children.props as { href?: unknown; tabIndex?: unknown; disabled?: unknown };\n\n if (props.tabIndex !== undefined) return true;\n if (props.disabled === true) return false;\n if (typeof type !== 'string') return false;\n if (type === 'a') return props.href !== undefined;\n\n return ['button', 'input', 'select', 'textarea'].includes(type);\n }, [children]);\n\n /*\n * `typeof type!== 'string'` her BILESENI \"odaklanamaz\" sayiyor; ui'nin her bileseni bir `memo`\n * NESNESI, yani `<Tooltip><Button/></Tooltip>` icin…\n * ⚠ STATIK KONTROL TEK BASINA YANLIS CEVAP VERIYORDU.\n */\n const [hasFocusableDescendant, setHasFocusableDescendant] = useState(false);\n\n useEffect(() => {\n const node = anchorRef.current;\n if (!node) return;\n\n setHasFocusableDescendant(\n Boolean(\n node.querySelector(\n 'a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex=\"-1\"])',\n ),\n ),\n );\n }, [children]);\n\n const hasFocusableChild = staticallyFocusableChild || hasFocusableDescendant;\n\n const positioning = usePositioning(anchorRef, bubbleRef, {\n side: resolvedSide,\n align: 'center',\n isOpen,\n });\n\n const portal = usePortalSurface(isOpen, anchorRef, bubbleRef);\n\n const clearTimer = useCallback(() => {\n if (timerRef.current) window.clearTimeout(timerRef.current);\n timerRef.current = 0;\n }, []);\n\n const open = useCallback(\n (delay: number) => {\n clearTimer();\n timerRef.current = window.setTimeout(() => setIsOpen(true), delay);\n },\n [clearTimer],\n );\n\n const close = useCallback(\n (delay: number = CLOSE_DELAY) => {\n clearTimer();\n timerRef.current = window.setTimeout(() => setIsOpen(false), delay);\n },\n [clearTimer],\n );\n\n useEffect(() => clearTimer, [clearTimer]);\n\n /*\n * ⚠ UZUN BASMA zamanlayıcısı AYRI temizlenir. `clearTimer` yalnızca açılış/ kapanış gecikmesini\n * iptal ediyor\n */\n useEffect(\n () => () => {\n if (longPressRef.current) window.clearTimeout(longPressRef.current);\n },\n [],\n );\n\n /*\n * Escape ANINDA kapatir: gecikme, ipucunu kapatmak icin bastigi tusun islemedigi izlenimi\n * veriyordu.\n */\n const closeNow = useCallback(() => close(0), [close]);\n /* Geçici: ipucu klavyeyi almaz, açıkken ⌘K ve kısayollar çalışır (`hasOpenSurface`). */\n useDismissOnEscape(isOpen, closeNow, { isTransient: true });\n\n /*\n * Dokunmatikte ekranin herhangi bir yerine dokunmak kapatir: balonun kendi kapatma yolu yok ve\n * `pointer-events: none` oldugu icin ona da dokunulamiyor.\n */\n useEffect(() => {\n if (!isOpen) return;\n\n const handlePointerDown = (event: globalThis.PointerEvent) => {\n if (event.pointerType === 'mouse') return;\n if (anchorRef.current?.contains(event.target as Node)) return;\n close(0);\n };\n\n document.addEventListener('pointerdown', handlePointerDown);\n return () => document.removeEventListener('pointerdown', handlePointerDown);\n }, [isOpen, close]);\n\n const cancelLongPress = () => {\n if (longPressRef.current) window.clearTimeout(longPressRef.current);\n longPressRef.current = 0;\n };\n\n const handlePointerDown = (event: ReactPointerEvent) => {\n if (event.pointerType === 'mouse') return;\n longPressRef.current = window.setTimeout(() => setIsOpen(true), LONG_PRESS_DELAY);\n };\n\n return (\n <>\n <span\n ref={anchorRef}\n className={cx(styles.tooltip, className)}\n /*\n * ⚠ CAPA ODAKLANABILIR OLMAK ZORUNDA. `onFocus`/`onBlur` zaten bagli ama ` ` varsayilan\n * olarak odak almiyor: cocuk kendisi odaklanabilir…\n * ⚠ Cocuk zaten odaklanabiliyorsa (dugme, baglanti) `tabIndex` KONULMAZ: aksi halde ayni\n * ipucu icin sekmede IKI durak olusur.\n */\n tabIndex={hasFocusableChild ? undefined : 0}\n onPointerEnter={event => event.pointerType === 'mouse' && open(openDelay)}\n onPointerLeave={event => {\n cancelLongPress();\n if (event.pointerType === 'mouse') close();\n }}\n onPointerDown={handlePointerDown}\n onPointerUp={cancelLongPress}\n onPointerCancel={cancelLongPress}\n onFocus={() => open(0)}\n onBlur={() => close(0)}\n onContextMenu={event => {\n if (isOpen || longPressRef.current) event.preventDefault();\n }}\n >\n <span aria-describedby={isOpen ? id : undefined} className={styles.tooltip__trigger}>\n {children}\n </span>\n </span>\n\n {/*\n Balon DOM'da yalnizca ACIKKEN: kapaliyken de birakip gizlemek, ekran\n okuyucunun onu `aria-describedby` olmadan da bulup okumasina yol\n aciyordu.\n */}\n {isOpen &&\n portal.container &&\n createPortal(\n <span\n ref={bubbleRef}\n /* ⚠ Modal içinden açıldığında üst katman ZORUNLU — `portal.helper`. */\n {...portal.attributes}\n id={id}\n role=\"tooltip\"\n className={cx(styles.bubble, styles[`bubble--${positioning.side}`])}\n style={{\n ...positioning.style,\n ...portal.style,\n /* Olculmeden cizilen balon bir kare boyunca sol ust kosede parliyordu. */\n visibility: positioning.isPositioned ? 'visible' : 'hidden',\n }}\n >\n {content}\n </span>,\n portal.container,\n )}\n </>\n );\n};\n\nexport default /*#__PURE__*/ memo(/*#__PURE__*/ named(Tooltip, 'Tooltip')) as typeof Tooltip;\n"],"names":["CLOSE_DELAY","LONG_PRESS_DELAY","OPEN_DELAY","Tooltip","content","children","side","position","openDelay","className","isOpen","setIsOpen","useState","id","useId","resolvedSide","anchorRef","useRef","bubbleRef","timerRef","longPressRef","staticallyFocusableChild","useMemo","isValidElement","type","props","hasFocusableDescendant","setHasFocusableDescendant","useEffect","node","hasFocusableChild","positioning","usePositioning","portal","usePortalSurface","clearTimer","useCallback","open","delay","close","closeNow","useDismissOnEscape","handlePointerDown","event","_a","cancelLongPress","jsxs","Fragment","jsx","cx","styles","createPortal","Tooltip$1","memo","named"],"mappings":";;;;;;;;;;AA2CA,MAAMA,IAAc,KAGdC,IAAmB,KAGnBC,IAAa,KAGbC,IAAU,CAAC;AAAA,EACf,SAAAC;AAAA,EACA,UAAAC;AAAA,EACA,MAAAC;AAAA,EACA,UAAAC;AAAA,EACA,WAAAC,IAAYN;AAAA,EACZ,WAAAO;AACF,MAAa;AACX,QAAM,CAACC,GAAQC,CAAS,IAAIC,EAAS,EAAK,GACpCC,IAAKC,EAAA,GAGLC,IAA6BT,KAAQC,KAAY,OAEjDS,IAAYC,EAAwB,IAAI,GACxCC,IAAYD,EAAwB,IAAI,GACxCE,IAAWF,EAAO,CAAC,GACnBG,IAAeH,EAAO,CAAC,GAKvBI,IAA2BC,EAAQ,MAAM;AAC7C,QAAI,CAACC,EAAelB,CAAQ,EAAG,QAAO;AACtC,UAAMmB,IAAOnB,EAAS,MAChBoB,IAAQpB,EAAS;AAEvB,WAAIoB,EAAM,aAAa,SAAkB,KACrCA,EAAM,aAAa,MACnB,OAAOD,KAAS,WAAiB,KACjCA,MAAS,MAAYC,EAAM,SAAS,SAEjC,CAAC,UAAU,SAAS,UAAU,UAAU,EAAE,SAASD,CAAI;AAAA,EAChE,GAAG,CAACnB,CAAQ,CAAC,GAOP,CAACqB,GAAwBC,CAAyB,IAAIf,EAAS,EAAK;AAE1E,EAAAgB,EAAU,MAAM;AACd,UAAMC,IAAOb,EAAU;AACvB,IAAKa,KAELF;AAAA,MACE,EACEE,EAAK;AAAA,QACH;AAAA,MAAA;AAAA,IAEJ;AAAA,EAEJ,GAAG,CAACxB,CAAQ,CAAC;AAEb,QAAMyB,IAAoBT,KAA4BK,GAEhDK,IAAcC,EAAehB,GAAWE,GAAW;AAAA,IACvD,MAAMH;AAAA,IACN,OAAO;AAAA,IACP,QAAAL;AAAA,EAAA,CACD,GAEKuB,IAASC,EA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GpD,UAAA3B;AAAA,QAAA;AAAA,MAAA;AAAA,MAEH6B,EAAO;AAAA,IAAA;AAAA,EACT,GACJ;AAEJ,GAEAmB,KAA6B,gBAAAC,EAAmB,gBAAAC,EAAMnD,GAAS,SAAS,CAAC;"}
|
|
@@ -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"),m=require("react"),p=require("../../helpers/class-name.helper.cjs"),_=require("../../helpers/component.helper.cjs"),a=require("../../helpers/label.helper.cjs"),y=require("../../theme/context.cjs"),l={default:{"types":"ui-types-fVVpN","types__item":"ui-types__item-qDL9n","types__more":"ui-types__more-sAfCv","types__srOnly":"ui-types__srOnly-rd9R5"}},x=({types:t,max:u=2,className:d,testId:h})=>{var c,n;const{labels:e}=y.useUi();if(t.length===0)return null;const i=t.slice(0,u),r=t.length-i.length;return s.jsxs("ul",{role:"list",className:p.cx(l.default.types,d),"aria-label":a.resolveLabel("VehicleTypeList.label",void 0,(c=e==null?void 0:e.product)==null?void 0:c.vehicleTypes),title:t.join(", "),"data-testid":h,children:[i.map(o=>s.jsx("li",{className:l.default.types__item,children:o},o)),r>0&&s.jsxs("li",{className:l.default.types__more,children:[s.jsxs("span",{"aria-hidden":!0,children:["+",r]}),s.jsx("span",{className:l.default.types__srOnly,children:a.resolveFormatter("VehicleTypeList.labels.moreVehicleTypes",(n=e==null?void 0:e.product)==null?void 0:n.moreVehicleTypes,r)})]})]})},T=m.memo(_.named(x,"VehicleTypeList"));exports.default=T;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.cjs","sources":["../../../src/components/VehicleTypeList/index.tsx"],"sourcesContent":["'use client';\n\nimport { memo } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveFormatter, resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n /** The type names, most relevant first (\"Daily Şasi\", \"Daily Panelvan\"). */\n types: readonly string[];\n /** Types written before \"+N\"; default 2. */\n max?: number;\n className?: string;\n testId?: string;\n};\n\n/**\n * VehicleTypeList (3.8) — the compatible vehicle types of a product on ONE line: the first `max`,\n * then \"+N\" with the full list in the line's tooltip and the count read as words. The same in a\n * `ProductCard`, a `ProductRow` and a product table.\n * @example <VehicleTypeList types={['Daily Şasi', 'Daily Panelvan', 'Eurocargo']} />\n */\nconst VehicleTypeList = ({ types, max = 2, className, testId }: Props) => {\n const { labels } = useUi();\n if (types.length === 0) return null;\n\n const shown = types.slice(0, max);\n const rest = types.length - shown.length;\n\n return (\n /* `role=\"list\"`: Safari drops the semantics of a `ul` without markers. */\n <ul\n role=\"list\"\n className={cx(styles.types, className)}\n aria-label={resolveLabel('VehicleTypeList.label', undefined, labels?.product?.vehicleTypes)}\n title={types.join(', ')}\n data-testid={testId}\n >\n {shown.map(type => (\n <li key={type} className={styles.types__item}>\n {type}\n </li>\n ))}\n {rest > 0 && (\n <li className={styles.types__more}>\n <span aria-hidden>+{rest}</span>\n <span className={styles.types__srOnly}>\n {resolveFormatter(\n 'VehicleTypeList.labels.moreVehicleTypes',\n labels?.product?.moreVehicleTypes,\n rest,\n )}\n </span>\n </li>\n )}\n </ul>\n );\n};\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(VehicleTypeList, 'VehicleTypeList'),\n) as typeof VehicleTypeList;\n"],"names":["VehicleTypeList","types","max","className","testId","labels","useUi","shown","rest","jsxs","cx","styles","resolveLabel","_a","jsx","type","resolveFormatter","_b","memo","named"],"mappings":"wYAyBMA,EAAkB,CAAC,CAAE,MAAAC,EAAO,IAAAC,EAAM,EAAG,UAAAC,EAAW,OAAAC,KAAoB,SACxE,KAAM,CAAE,OAAAC,CAAA,EAAWC,QAAA,EACnB,GAAIL,EAAM,SAAW,EAAG,OAAO,KAE/B,MAAMM,EAAQN,EAAM,MAAM,EAAGC,CAAG,EAC1BM,EAAOP,EAAM,OAASM,EAAM,OAElC,OAEEE,EAAAA,KAAC,KAAA,CACC,KAAK,OACL,UAAWC,EAAAA,GAAGC,UAAO,MAAOR,CAAS,EACrC,aAAYS,EAAAA,aAAa,wBAAyB,QAAWC,EAAAR,GAAA,YAAAA,EAAQ,UAAR,YAAAQ,EAAiB,YAAY,EAC1F,MAAOZ,EAAM,KAAK,IAAI,EACtB,cAAaG,EAEZ,SAAA,CAAAG,EAAM,OACLO,EAAAA,IAAC,KAAA,CAAc,UAAWH,EAAAA,QAAO,YAC9B,SAAAI,CAAA,EADMA,CAET,CACD,EACAP,EAAO,GACNC,EAAAA,KAAC,KAAA,CAAG,UAAWE,EAAAA,QAAO,YACpB,SAAA,CAAAF,EAAAA,KAAC,OAAA,CAAK,cAAW,GAAC,SAAA,CAAA,IAAED,CAAA,EAAK,EACzBM,EAAAA,IAAC,OAAA,CAAK,UAAWH,EAAAA,QAAO,cACrB,SAAAK,EAAAA,iBACC,2CACAC,EAAAZ,GAAA,YAAAA,EAAQ,UAAR,YAAAY,EAAiB,iBACjBT,CAAA,CACF,CACF,CAAA,CAAA,CACF,CAAA,CAAA,CAAA,CAIR,EAEAR,EAA6BkB,EAAAA,KACbC,EAAAA,MAAMnB,EAAiB,iBAAiB,CACxD"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
/** The type names, most relevant first ("Daily Şasi", "Daily Panelvan"). */
|
|
3
|
+
types: readonly string[];
|
|
4
|
+
/** Types written before "+N"; default 2. */
|
|
5
|
+
max?: number;
|
|
6
|
+
className?: string;
|
|
7
|
+
testId?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* VehicleTypeList (3.8) — the compatible vehicle types of a product on ONE line: the first `max`,
|
|
11
|
+
* then "+N" with the full list in the line's tooltip and the count read as words. The same in a
|
|
12
|
+
* `ProductCard`, a `ProductRow` and a product table.
|
|
13
|
+
* @example <VehicleTypeList types={['Daily Şasi', 'Daily Panelvan', 'Eurocargo']} />
|
|
14
|
+
*/
|
|
15
|
+
declare const VehicleTypeList: ({ types, max, className, testId }: Props) => import("react").JSX.Element | null;
|
|
16
|
+
declare const _default: typeof VehicleTypeList;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
type Props = {
|
|
2
|
+
/** The type names, most relevant first ("Daily Şasi", "Daily Panelvan"). */
|
|
3
|
+
types: readonly string[];
|
|
4
|
+
/** Types written before "+N"; default 2. */
|
|
5
|
+
max?: number;
|
|
6
|
+
className?: string;
|
|
7
|
+
testId?: string;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* VehicleTypeList (3.8) — the compatible vehicle types of a product on ONE line: the first `max`,
|
|
11
|
+
* then "+N" with the full list in the line's tooltip and the count read as words. The same in a
|
|
12
|
+
* `ProductCard`, a `ProductRow` and a product table.
|
|
13
|
+
* @example <VehicleTypeList types={['Daily Şasi', 'Daily Panelvan', 'Eurocargo']} />
|
|
14
|
+
*/
|
|
15
|
+
declare const VehicleTypeList: ({ types, max, className, testId }: Props) => import("react").JSX.Element | null;
|
|
16
|
+
declare const _default: typeof VehicleTypeList;
|
|
17
|
+
export default _default;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsxs as s, jsx as n } from "react/jsx-runtime";
|
|
3
|
+
import { memo as d } from "react";
|
|
4
|
+
import { cx as u } from "../../helpers/class-name.helper.js";
|
|
5
|
+
import { named as y } from "../../helpers/component.helper.js";
|
|
6
|
+
import { resolveFormatter as f, resolveLabel as T } from "../../helpers/label.helper.js";
|
|
7
|
+
import { useUi as V } from "../../theme/context.js";
|
|
8
|
+
const r = {"types":"ui-types-fVVpN","types__item":"ui-types__item-qDL9n","types__more":"ui-types__more-sAfCv","types__srOnly":"ui-types__srOnly-rd9R5"};
|
|
9
|
+
const L = ({ types: i, max: a = 2, className: p, testId: h }) => {
|
|
10
|
+
var o, c;
|
|
11
|
+
const { labels: e } = V();
|
|
12
|
+
if (i.length === 0) return null;
|
|
13
|
+
const l = i.slice(0, a), t = i.length - l.length;
|
|
14
|
+
return (
|
|
15
|
+
/* `role="list"`: Safari drops the semantics of a `ul` without markers. */
|
|
16
|
+
/* @__PURE__ */ s(
|
|
17
|
+
"ul",
|
|
18
|
+
{
|
|
19
|
+
role: "list",
|
|
20
|
+
className: u(r.types, p),
|
|
21
|
+
"aria-label": T("VehicleTypeList.label", void 0, (o = e == null ? void 0 : e.product) == null ? void 0 : o.vehicleTypes),
|
|
22
|
+
title: i.join(", "),
|
|
23
|
+
"data-testid": h,
|
|
24
|
+
children: [
|
|
25
|
+
l.map((m) => /* @__PURE__ */ n("li", { className: r.types__item, children: m }, m)),
|
|
26
|
+
t > 0 && /* @__PURE__ */ s("li", { className: r.types__more, children: [
|
|
27
|
+
/* @__PURE__ */ s("span", { "aria-hidden": !0, children: [
|
|
28
|
+
"+",
|
|
29
|
+
t
|
|
30
|
+
] }),
|
|
31
|
+
/* @__PURE__ */ n("span", { className: r.types__srOnly, children: f(
|
|
32
|
+
"VehicleTypeList.labels.moreVehicleTypes",
|
|
33
|
+
(c = e == null ? void 0 : e.product) == null ? void 0 : c.moreVehicleTypes,
|
|
34
|
+
t
|
|
35
|
+
) })
|
|
36
|
+
] })
|
|
37
|
+
]
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
);
|
|
41
|
+
}, w = /* @__PURE__ */ d(
|
|
42
|
+
/* @__PURE__ */ y(L, "VehicleTypeList")
|
|
43
|
+
);
|
|
44
|
+
export {
|
|
45
|
+
w as default
|
|
46
|
+
};
|
|
47
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../src/components/VehicleTypeList/index.tsx"],"sourcesContent":["'use client';\n\nimport { memo } from 'react';\n\nimport { cx } from '../../helpers/class-name.helper';\nimport { named } from '../../helpers/component.helper';\nimport { resolveFormatter, resolveLabel } from '../../helpers/label.helper';\nimport { useUi } from '../../theme/context';\n\nimport styles from './index.module.scss';\n\ntype Props = {\n /** The type names, most relevant first (\"Daily Şasi\", \"Daily Panelvan\"). */\n types: readonly string[];\n /** Types written before \"+N\"; default 2. */\n max?: number;\n className?: string;\n testId?: string;\n};\n\n/**\n * VehicleTypeList (3.8) — the compatible vehicle types of a product on ONE line: the first `max`,\n * then \"+N\" with the full list in the line's tooltip and the count read as words. The same in a\n * `ProductCard`, a `ProductRow` and a product table.\n * @example <VehicleTypeList types={['Daily Şasi', 'Daily Panelvan', 'Eurocargo']} />\n */\nconst VehicleTypeList = ({ types, max = 2, className, testId }: Props) => {\n const { labels } = useUi();\n if (types.length === 0) return null;\n\n const shown = types.slice(0, max);\n const rest = types.length - shown.length;\n\n return (\n /* `role=\"list\"`: Safari drops the semantics of a `ul` without markers. */\n <ul\n role=\"list\"\n className={cx(styles.types, className)}\n aria-label={resolveLabel('VehicleTypeList.label', undefined, labels?.product?.vehicleTypes)}\n title={types.join(', ')}\n data-testid={testId}\n >\n {shown.map(type => (\n <li key={type} className={styles.types__item}>\n {type}\n </li>\n ))}\n {rest > 0 && (\n <li className={styles.types__more}>\n <span aria-hidden>+{rest}</span>\n <span className={styles.types__srOnly}>\n {resolveFormatter(\n 'VehicleTypeList.labels.moreVehicleTypes',\n labels?.product?.moreVehicleTypes,\n rest,\n )}\n </span>\n </li>\n )}\n </ul>\n );\n};\n\nexport default /*#__PURE__*/ memo(\n /*#__PURE__*/ named(VehicleTypeList, 'VehicleTypeList'),\n) as typeof VehicleTypeList;\n"],"names":["VehicleTypeList","types","max","className","testId","labels","useUi","shown","rest","jsxs","cx","styles","resolveLabel","_a","jsx","type","resolveFormatter","_b","VehicleTypeList$1","memo","named"],"mappings":";;;;;;;;AAyBA,MAAMA,IAAkB,CAAC,EAAE,OAAAC,GAAO,KAAAC,IAAM,GAAG,WAAAC,GAAW,QAAAC,QAAoB;;AACxE,QAAM,EAAE,QAAAC,EAAA,IAAWC,EAAA;AACnB,MAAIL,EAAM,WAAW,EAAG,QAAO;AAE/B,QAAMM,IAAQN,EAAM,MAAM,GAAGC,CAAG,GAC1BM,IAAOP,EAAM,SAASM,EAAM;AAElC;AAAA;AAAA,IAEE,gBAAAE;AAAA,MAAC;AAAA,MAAA;AAAA,QACC,MAAK;AAAA,QACL,WAAWC,EAAGC,EAAO,OAAOR,CAAS;AAAA,QACrC,cAAYS,EAAa,yBAAyB,SAAWC,IAAAR,KAAA,gBAAAA,EAAQ,YAAR,gBAAAQ,EAAiB,YAAY;AAAA,QAC1F,OAAOZ,EAAM,KAAK,IAAI;AAAA,QACtB,eAAaG;AAAA,QAEZ,UAAA;AAAA,UAAAG,EAAM,IAAI,OACT,gBAAAO,EAAC,MAAA,EAAc,WAAWH,EAAO,aAC9B,UAAAI,EAAA,GADMA,CAET,CACD;AAAA,UACAP,IAAO,KACN,gBAAAC,EAAC,MAAA,EAAG,WAAWE,EAAO,aACpB,UAAA;AAAA,YAAA,gBAAAF,EAAC,QAAA,EAAK,eAAW,IAAC,UAAA;AAAA,cAAA;AAAA,cAAED;AAAA,YAAA,GAAK;AAAA,YACzB,gBAAAM,EAAC,QAAA,EAAK,WAAWH,EAAO,eACrB,UAAAK;AAAA,cACC;AAAA,eACAC,IAAAZ,KAAA,gBAAAA,EAAQ,YAAR,gBAAAY,EAAiB;AAAA,cACjBT;AAAA,YAAA,EACF,CACF;AAAA,UAAA,EAAA,CACF;AAAA,QAAA;AAAA,MAAA;AAAA,IAAA;AAAA;AAIR,GAEAU,IAA6B,gBAAAC;AAAA,EACb,gBAAAC,EAAMpB,GAAiB,iBAAiB;AACxD;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
@layer ui{.ui-types-fVVpN{display:flex;align-items:center;gap:var(--hd-space-1);min-width:0;margin:0;padding:0;overflow:hidden;list-style:none}.ui-types__item-qDL9n,.ui-types__more-sAfCv{flex-shrink:1;min-width:0;padding:2px var(--hd-space-2);border-radius:var(--hd-radius-xs);background-color:var(--hd-bg-raised);color:var(--hd-text-2);font-size:var(--hd-type-caption-size);font-weight:var(--hd-font-weight-medium);line-height:var(--hd-type-h4-line-height);white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.ui-types__more-sAfCv{flex-shrink:0;font-variant-numeric:tabular-nums}.ui-types__srOnly-rd9R5{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip-path:inset(50%);white-space:nowrap;border:0}}
|
package/build/design/index.cjs
CHANGED
|
@@ -596,7 +596,7 @@ const THEME_STORAGE_KEY = 'hd-theme';
|
|
|
596
596
|
|
|
597
597
|
var themes = {
|
|
598
598
|
"light": {
|
|
599
|
-
"bg-page": "#
|
|
599
|
+
"bg-page": "#eef2f9",
|
|
600
600
|
"bg-surface": "#ffffff",
|
|
601
601
|
"bg-raised": "#f4f6fb",
|
|
602
602
|
"bg-inset": "#ecf0f6",
|
|
@@ -607,7 +607,7 @@ var themes = {
|
|
|
607
607
|
"border-control": "#80899b",
|
|
608
608
|
"text": "#091122",
|
|
609
609
|
"text-2": "#515b6e",
|
|
610
|
-
"text-3": "#
|
|
610
|
+
"text-3": "#626c7f",
|
|
611
611
|
"text-disabled": "#a1a9ba",
|
|
612
612
|
"primary": "#2661fa",
|
|
613
613
|
"primary-hover": "#053dea",
|
|
@@ -696,7 +696,12 @@ var themes = {
|
|
|
696
696
|
/**
|
|
697
697
|
* The type scale. Sizes are CSS pixels at a 16px root (body is 15px); headings are set in
|
|
698
698
|
* the display family, slightly wide (`stretch` above 100) and tight.
|
|
699
|
+
*
|
|
700
|
+
* `title-1` … `title-5` (3.7) are the headings of an interface — a portal, a panel, a product
|
|
701
|
+
* page: the display family at its normal width and one weight, 600, from 32 down to 15px. The
|
|
702
|
+
* wide 650–700 roles above read as a poster next to 13–15px data and stay for marketing pages.
|
|
699
703
|
*/
|
|
704
|
+
const title = (size, lineHeight, letterSpacing) => ({ font: 'display', size, lineHeight, weight: 600, letterSpacing, stretch: 100 });
|
|
700
705
|
const typography = {
|
|
701
706
|
display: {
|
|
702
707
|
font: 'display',
|
|
@@ -738,6 +743,11 @@ const typography = {
|
|
|
738
743
|
letterSpacing: -0.01,
|
|
739
744
|
stretch: 108,
|
|
740
745
|
},
|
|
746
|
+
'title-1': title(32, 1.2, -0.015),
|
|
747
|
+
'title-2': title(28, 1.25, -0.012),
|
|
748
|
+
'title-3': title(22, 1.3, -8e-3),
|
|
749
|
+
'title-4': title(18, 1.35, -4e-3),
|
|
750
|
+
'title-5': title(15, 1.4, 0),
|
|
741
751
|
lead: {
|
|
742
752
|
font: 'body',
|
|
743
753
|
size: 17,
|