@frontify/fondue 12.0.0-beta.141 → 12.0.0-beta.142
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/dist/components/InputLabel/InputLabel.es.js +23 -30
- package/dist/components/InputLabel/InputLabel.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/dist/styles.css +1 -1
- package/package.json +1 -1
|
@@ -1,64 +1,57 @@
|
|
|
1
1
|
import { TooltipIcon as f } from "../TooltipIcon/TooltipIcon.es.js";
|
|
2
|
-
import { IconSize as
|
|
3
|
-
import { merge as
|
|
2
|
+
import { IconSize as u } from "../../foundation/Icon/IconSize.es.js";
|
|
3
|
+
import { merge as o } from "../../utilities/merge.es.js";
|
|
4
4
|
import t from "react";
|
|
5
|
-
const
|
|
5
|
+
const v = ({
|
|
6
6
|
children: e,
|
|
7
|
-
htmlFor:
|
|
8
|
-
required:
|
|
9
|
-
disabled:
|
|
10
|
-
clickable:
|
|
7
|
+
htmlFor: r,
|
|
8
|
+
required: s = !1,
|
|
9
|
+
disabled: n = !1,
|
|
10
|
+
clickable: w = !1,
|
|
11
11
|
tooltip: a = [],
|
|
12
|
-
bold:
|
|
12
|
+
bold: m
|
|
13
13
|
}) => {
|
|
14
|
-
const
|
|
14
|
+
const p = (Array.isArray(a) ? a : [a]).map((i, l) => ({
|
|
15
15
|
key: l,
|
|
16
|
-
...
|
|
16
|
+
...i
|
|
17
17
|
}));
|
|
18
18
|
return /* @__PURE__ */ t.createElement(
|
|
19
19
|
"div",
|
|
20
20
|
{
|
|
21
|
-
className:
|
|
21
|
+
className: o([
|
|
22
22
|
"tw-inline-flex tw-leading-4 tw-items-center tw-gap-1 tw-font-sans tw-text-s tw-max-w-full tw-min-w-0 tw-flex-initial",
|
|
23
|
-
|
|
23
|
+
n ? "tw-text-disabled" : "tw-text-text-weak"
|
|
24
24
|
]),
|
|
25
25
|
"data-test-id": "input-label-container"
|
|
26
26
|
},
|
|
27
27
|
/* @__PURE__ */ t.createElement("div", { className: "tw-flex-1 tw-overflow-hidden tw-text-ellipsis tw-whitespace-nowrap" }, /* @__PURE__ */ t.createElement(
|
|
28
28
|
"label",
|
|
29
29
|
{
|
|
30
|
-
htmlFor:
|
|
31
|
-
className:
|
|
30
|
+
htmlFor: r,
|
|
31
|
+
className: o([
|
|
32
32
|
"tw-select-none",
|
|
33
|
-
|
|
34
|
-
|
|
33
|
+
m && "tw-font-medium",
|
|
34
|
+
n || !w ? "hover:tw-cursor-not-allowed tw-pointer-events-none" : "hover:tw-cursor-pointer hover:tw-text-text group-hover:tw-text-text"
|
|
35
35
|
]),
|
|
36
36
|
"data-test-id": "input-label",
|
|
37
37
|
title: typeof e == "string" ? e : ""
|
|
38
38
|
},
|
|
39
39
|
e
|
|
40
40
|
)),
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
{
|
|
44
|
-
"data-test-id": "input-label-required",
|
|
45
|
-
className: "tw-h-4 tw-text-m tw-text-red-60 dark:tw-text-red-50"
|
|
46
|
-
},
|
|
47
|
-
"*"
|
|
48
|
-
),
|
|
49
|
-
m.map(({ key: r, triggerIcon: l, triggerStyle: p, hoverDelay: d = 100, ...x }) => /* @__PURE__ */ t.createElement("div", { key: r, className: "tw-leading-3" }, /* @__PURE__ */ t.createElement(
|
|
41
|
+
s && /* @__PURE__ */ t.createElement("span", { "data-test-id": "input-label-required", className: "tw-h-4 tw-text-m tw-text-text-negative" }, "*"),
|
|
42
|
+
p.map(({ key: i, triggerIcon: l, triggerStyle: c, hoverDelay: x = 100, ...d }) => /* @__PURE__ */ t.createElement("div", { key: i, className: "tw-leading-3" }, /* @__PURE__ */ t.createElement(
|
|
50
43
|
f,
|
|
51
44
|
{
|
|
52
|
-
tooltip: { ...
|
|
53
|
-
iconSize:
|
|
45
|
+
tooltip: { ...d, hoverDelay: x },
|
|
46
|
+
iconSize: u.Size16,
|
|
54
47
|
triggerIcon: l,
|
|
55
|
-
triggerStyle:
|
|
48
|
+
triggerStyle: c
|
|
56
49
|
}
|
|
57
50
|
)))
|
|
58
51
|
);
|
|
59
52
|
};
|
|
60
|
-
|
|
53
|
+
v.displayName = "FondueInputLabel";
|
|
61
54
|
export {
|
|
62
|
-
|
|
55
|
+
v as InputLabel
|
|
63
56
|
};
|
|
64
57
|
//# sourceMappingURL=InputLabel.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InputLabel.es.js","sources":["../../../src/components/InputLabel/InputLabel.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TooltipProps } from '@components/Tooltip/Tooltip';\nimport { TooltipIcon, TooltipIconProps } from '@components/TooltipIcon/TooltipIcon';\nimport { IconSize } from '@foundation/Icon/IconSize';\nimport { merge } from '@utilities/merge';\nimport React, { FC, PropsWithChildren } from 'react';\n\nexport type InputLabelTooltipProps =\n | (TooltipProps & Pick<TooltipIconProps, 'triggerStyle' | 'triggerIcon'>)\n | (TooltipProps & Pick<TooltipIconProps, 'triggerStyle' | 'triggerIcon'>)[];\n\nexport type InputLabelProps = PropsWithChildren<{\n htmlFor: string;\n required?: boolean;\n disabled?: boolean;\n clickable?: boolean;\n tooltip?: InputLabelTooltipProps;\n bold?: boolean;\n}>;\n\nexport const InputLabel: FC<InputLabelProps> = ({\n children,\n htmlFor,\n required = false,\n disabled = false,\n clickable = false,\n tooltip = [],\n bold,\n}) => {\n const tooltips = Array.isArray(tooltip) ? tooltip : [tooltip];\n\n const tooltipsWithKeys = tooltips.map((tooltip, index) => ({\n key: index,\n ...tooltip,\n }));\n\n return (\n <div\n className={merge([\n 'tw-inline-flex tw-leading-4 tw-items-center tw-gap-1 tw-font-sans tw-text-s tw-max-w-full tw-min-w-0 tw-flex-initial',\n disabled
|
|
1
|
+
{"version":3,"file":"InputLabel.es.js","sources":["../../../src/components/InputLabel/InputLabel.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { TooltipProps } from '@components/Tooltip/Tooltip';\nimport { TooltipIcon, TooltipIconProps } from '@components/TooltipIcon/TooltipIcon';\nimport { IconSize } from '@foundation/Icon/IconSize';\nimport { merge } from '@utilities/merge';\nimport React, { FC, PropsWithChildren } from 'react';\n\nexport type InputLabelTooltipProps =\n | (TooltipProps & Pick<TooltipIconProps, 'triggerStyle' | 'triggerIcon'>)\n | (TooltipProps & Pick<TooltipIconProps, 'triggerStyle' | 'triggerIcon'>)[];\n\nexport type InputLabelProps = PropsWithChildren<{\n htmlFor: string;\n required?: boolean;\n disabled?: boolean;\n clickable?: boolean;\n tooltip?: InputLabelTooltipProps;\n bold?: boolean;\n}>;\n\nexport const InputLabel: FC<InputLabelProps> = ({\n children,\n htmlFor,\n required = false,\n disabled = false,\n clickable = false,\n tooltip = [],\n bold,\n}) => {\n const tooltips = Array.isArray(tooltip) ? tooltip : [tooltip];\n\n const tooltipsWithKeys = tooltips.map((tooltip, index) => ({\n key: index,\n ...tooltip,\n }));\n\n return (\n <div\n className={merge([\n 'tw-inline-flex tw-leading-4 tw-items-center tw-gap-1 tw-font-sans tw-text-s tw-max-w-full tw-min-w-0 tw-flex-initial',\n disabled ? 'tw-text-disabled' : 'tw-text-text-weak',\n ])}\n data-test-id=\"input-label-container\"\n >\n <div className=\"tw-flex-1 tw-overflow-hidden tw-text-ellipsis tw-whitespace-nowrap\">\n <label\n htmlFor={htmlFor}\n className={merge([\n 'tw-select-none',\n bold && 'tw-font-medium',\n disabled || !clickable\n ? 'hover:tw-cursor-not-allowed tw-pointer-events-none'\n : 'hover:tw-cursor-pointer hover:tw-text-text group-hover:tw-text-text',\n ])}\n data-test-id=\"input-label\"\n title={typeof children === 'string' ? children : ''}\n >\n {children}\n </label>\n </div>\n\n {required && (\n <span data-test-id=\"input-label-required\" className=\"tw-h-4 tw-text-m tw-text-text-negative\">\n *\n </span>\n )}\n {tooltipsWithKeys.map(({ key, triggerIcon, triggerStyle, hoverDelay = 100, ...tooltipProps }) => (\n <div key={key} className=\"tw-leading-3\">\n <TooltipIcon\n tooltip={{ ...tooltipProps, hoverDelay }}\n iconSize={IconSize.Size16}\n triggerIcon={triggerIcon}\n triggerStyle={triggerStyle}\n />\n </div>\n ))}\n </div>\n );\n};\nInputLabel.displayName = 'FondueInputLabel';\n"],"names":["InputLabel","children","htmlFor","required","disabled","clickable","tooltip","bold","tooltipsWithKeys","index","React","merge","key","triggerIcon","triggerStyle","hoverDelay","tooltipProps","TooltipIcon","IconSize"],"mappings":";;;;AAqBO,MAAMA,IAAkC,CAAC;AAAA,EAC5C,UAAAC;AAAA,EACA,SAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,UAAAC,IAAW;AAAA,EACX,WAAAC,IAAY;AAAA,EACZ,SAAAC,IAAU,CAAC;AAAA,EACX,MAAAC;AACJ,MAAM;AAGF,QAAMC,KAFW,MAAM,QAAQF,CAAO,IAAIA,IAAU,CAACA,CAAO,GAE1B,IAAI,CAACA,GAASG,OAAW;AAAA,IACvD,KAAKA;AAAA,IACL,GAAGH;AAAAA,EACL,EAAA;AAGE,SAAA,gBAAAI,EAAA;AAAA,IAAC;AAAA,IAAA;AAAA,MACG,WAAWC,EAAM;AAAA,QACb;AAAA,QACAP,IAAW,qBAAqB;AAAA,MAAA,CACnC;AAAA,MACD,gBAAa;AAAA,IAAA;AAAA,IAEb,gBAAAM,EAAA,cAAC,OAAI,EAAA,WAAU,qEACX,GAAA,gBAAAA,EAAA;AAAA,MAAC;AAAA,MAAA;AAAA,QACG,SAAAR;AAAA,QACA,WAAWS,EAAM;AAAA,UACb;AAAA,UACAJ,KAAQ;AAAA,UACRH,KAAY,CAACC,IACP,uDACA;AAAA,QAAA,CACT;AAAA,QACD,gBAAa;AAAA,QACb,OAAO,OAAOJ,KAAa,WAAWA,IAAW;AAAA,MAAA;AAAA,MAEhDA;AAAA,IAAA,CAET;AAAA,IAECE,KACI,gBAAAO,EAAA,cAAA,QAAA,EAAK,gBAAa,wBAAuB,WAAU,4CAAyC,GAE7F;AAAA,IAEHF,EAAiB,IAAI,CAAC,EAAE,KAAAI,GAAK,aAAAC,GAAa,cAAAC,GAAc,YAAAC,IAAa,KAAK,GAAGC,EAC1E,MAAA,gBAAAN,EAAA,cAAC,OAAI,EAAA,KAAAE,GAAU,WAAU,eACrB,GAAA,gBAAAF,EAAA;AAAA,MAACO;AAAA,MAAA;AAAA,QACG,SAAS,EAAE,GAAGD,GAAc,YAAAD,EAAW;AAAA,QACvC,UAAUG,EAAS;AAAA,QACnB,aAAAL;AAAA,QACA,cAAAC;AAAA,MAAA;AAAA,IAAA,CAER,CACH;AAAA,EAAA;AAGb;AACAd,EAAW,cAAc;"}
|