oolib 3.1.2 → 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.
@@ -2,6 +2,17 @@ export const dropdownOptions: ({
2
2
  display: string;
3
3
  value: string;
4
4
  color: string;
5
+ iconAfter?: undefined;
6
+ iconAfterColor?: undefined;
7
+ desc?: undefined;
8
+ icon?: undefined;
9
+ image?: undefined;
10
+ } | {
11
+ display: string;
12
+ value: string;
13
+ color: string;
14
+ iconAfter: string;
15
+ iconAfterColor: string;
5
16
  desc?: undefined;
6
17
  icon?: undefined;
7
18
  image?: undefined;
@@ -10,6 +21,8 @@ export const dropdownOptions: ({
10
21
  value: string;
11
22
  color: string;
12
23
  desc: string;
24
+ iconAfter?: undefined;
25
+ iconAfterColor?: undefined;
13
26
  icon?: undefined;
14
27
  image?: undefined;
15
28
  } | {
@@ -17,6 +30,8 @@ export const dropdownOptions: ({
17
30
  value: string;
18
31
  color: string;
19
32
  icon: string;
33
+ iconAfter?: undefined;
34
+ iconAfterColor?: undefined;
20
35
  desc?: undefined;
21
36
  image?: undefined;
22
37
  } | {
@@ -24,6 +39,8 @@ export const dropdownOptions: ({
24
39
  value: string;
25
40
  color: string;
26
41
  image: string;
42
+ iconAfter?: undefined;
43
+ iconAfterColor?: undefined;
27
44
  desc?: undefined;
28
45
  icon?: undefined;
29
46
  } | {
@@ -33,14 +50,23 @@ export const dropdownOptions: ({
33
50
  image: string;
34
51
  icon: string;
35
52
  desc: string;
53
+ iconAfter?: undefined;
54
+ iconAfterColor?: undefined;
36
55
  })[];
37
56
  export const dropdownOptionsGroup: {
38
57
  display: string;
39
58
  value: string;
40
- options: {
59
+ options: ({
41
60
  display: string;
42
61
  value: string;
43
62
  color: string;
44
63
  desc: string;
45
- }[];
64
+ iconAfter?: undefined;
65
+ } | {
66
+ display: string;
67
+ value: string;
68
+ desc: string;
69
+ color: string;
70
+ iconAfter: string;
71
+ })[];
46
72
  }[];
@@ -17,6 +17,9 @@ exports.dropdownOptions = [
17
17
  color: themes_1.colors.invertRed,
18
18
  // image: "xyz",
19
19
  // icon: "Trash",
20
+ iconAfter: "WarningDiamond",
21
+ // Per-option colour too; omit it and the icon stays the default grey.
22
+ iconAfterColor: themes_1.colors.red,
20
23
  // desc: "This is a story about schnil-tu, a.k.a tubito senpai. Tubito senpai loves to say bhai-god. Lol.",
21
24
  },
22
25
  {
@@ -1889,7 +1892,10 @@ exports.dropdownOptionsGroup = [
1889
1892
  display: "Mumbai",
1890
1893
  value: "mumbai",
1891
1894
  desc: "Mumbai is India's financial center and largest city with a population of over 20 million people.",
1892
- color: themes_1.colors.lightBlue
1895
+ color: themes_1.colors.lightBlue,
1896
+ // Same per-option marker, but inside a GROUP — covers the ListGroup path,
1897
+ // which is what grouped consumers (e.g. the field-type dropdown) hit.
1898
+ iconAfter: "WarningDiamond"
1893
1899
  }
1894
1900
  ],
1895
1901
  },
@@ -46,6 +46,7 @@ var dropdownOptions = [
46
46
  color: themes_1.colors.invertRed,
47
47
  // image: "xyz",
48
48
  icon: "Trash",
49
+ iconAfter: "WarningDiamond",
49
50
  desc: "This is a story about schnil-tu, a.k.a tubito senpai. Tubito senpai loves to say bhai-god. Lol.",
50
51
  },
51
52
  {
@@ -7,5 +7,6 @@ declare namespace _default {
7
7
  }
8
8
  export default _default;
9
9
  export function Tag_Display(args: any): React.JSX.Element;
10
+ export function Text_Wrap_Max_Lines(): React.JSX.Element;
10
11
  export function playground(args: any): React.JSX.Element;
11
12
  import React from "react";
@@ -14,7 +14,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
14
14
  return (mod && mod.__esModule) ? mod : { "default": mod };
15
15
  };
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
- exports.playground = exports.Tag_Display = void 0;
17
+ exports.playground = exports.Text_Wrap_Max_Lines = exports.Tag_Display = void 0;
18
18
  var react_1 = __importDefault(require("react"));
19
19
  var Tags_1 = require("../../../../v2/components/Tags");
20
20
  var tagArgTypes_1 = require("./utils/tagArgTypes");
@@ -65,6 +65,29 @@ var Tag_Display = function (args) {
65
65
  react_1.default.createElement(Tags_1.TagDisplay, __assign({ display: "Tag Display" }, args))));
66
66
  };
67
67
  exports.Tag_Display = Tag_Display;
68
+ // textWrapMaxLines showcase — long labels in a narrow container: default
69
+ // single-line ellipsis vs wrap-to-N-lines (pill grows vertically, then
70
+ // ellipsizes).
71
+ var Text_Wrap_Max_Lines = function () {
72
+ var long = "Outcome-driven product evaluation with a deliberately long tail so the label overflows a narrow card";
73
+ return (react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "2rem", padding: "2rem", width: "220px", border: "1px dashed #ccc" } },
74
+ react_1.default.createElement("div", null,
75
+ react_1.default.createElement(Typo2_1.UI_TAG, { style: { display: "block", marginBottom: "0.4rem" } }, "Default (1 line + ellipsis)"),
76
+ react_1.default.createElement(Tags_1.TagDisplay, { display: long })),
77
+ react_1.default.createElement("div", null,
78
+ react_1.default.createElement(Typo2_1.UI_TAG, { style: { display: "block", marginBottom: "0.4rem" } }, "textWrapMaxLines = 2"),
79
+ react_1.default.createElement(Tags_1.TagDisplay, { display: long, textWrapMaxLines: 2 })),
80
+ react_1.default.createElement("div", null,
81
+ react_1.default.createElement(Typo2_1.UI_TAG, { style: { display: "block", marginBottom: "0.4rem" } }, "textWrapMaxLines = 3"),
82
+ react_1.default.createElement(Tags_1.TagDisplay, { display: long, textWrapMaxLines: 3 })),
83
+ react_1.default.createElement("div", null,
84
+ react_1.default.createElement(Typo2_1.UI_TAG, { style: { display: "block", marginBottom: "0.4rem" } }, "Short label, textWrapMaxLines = 2 (no visual change)"),
85
+ react_1.default.createElement(Tags_1.TagDisplay, { display: "Pain Points", textWrapMaxLines: 2 })),
86
+ react_1.default.createElement("div", null,
87
+ react_1.default.createElement(Typo2_1.UI_TAG, { style: { display: "block", marginBottom: "0.4rem" } }, "Unbroken token, textWrapMaxLines = 2"),
88
+ react_1.default.createElement(Tags_1.TagDisplay, { display: "Supercalifragilisticexpialidocious-annotation-topic", textWrapMaxLines: 2 }))));
89
+ };
90
+ exports.Text_Wrap_Max_Lines = Text_Wrap_Max_Lines;
68
91
  var playground = function (args) {
69
92
  return (react_1.default.createElement("div", { style: { display: "flex", flexDirection: "column", gap: "3rem", padding: "1rem" } },
70
93
  react_1.default.createElement("div", { style: { display: "flex", gap: "1rem" } },
@@ -1,4 +1,4 @@
1
- export function ListItem({ id, option, isSelected, isFocussed, scrollFocussedOpIntoView, onChange: parentOnChange, setSearchString, optionsClassName, S, observerRef, isTagsStyle, isMulti, value, index, alignCheckbox, iconAfter }: {
1
+ export function ListItem({ id, option, isSelected, isFocussed, scrollFocussedOpIntoView, onChange: parentOnChange, setSearchString, optionsClassName, S, observerRef, isTagsStyle, isMulti, value, index, alignCheckbox, iconAfter: allOptionsIconAfter }: {
2
2
  id: any;
3
3
  option: any;
4
4
  isSelected: any;
@@ -62,10 +62,12 @@ var styled_1 = require("./styled");
62
62
  var Tooltip_1 = __importDefault(require("../../Tooltip"));
63
63
  var grey40 = themes_1.colors.grey40, grey80 = themes_1.colors.grey80, grey60 = themes_1.colors.grey60;
64
64
  var ListItem = function (_a) {
65
- var id = _a.id, option = _a.option, isSelected = _a.isSelected, isFocussed = _a.isFocussed, scrollFocussedOpIntoView = _a.scrollFocussedOpIntoView, parentOnChange = _a.onChange, setSearchString = _a.setSearchString, optionsClassName = _a.optionsClassName, S = _a.S, observerRef = _a.observerRef, isTagsStyle = _a.isTagsStyle, isMulti = _a.isMulti, value = _a.value, index = _a.index, _b = _a.alignCheckbox, alignCheckbox = _b === void 0 ? "left" : _b, iconAfter = _a.iconAfter;
65
+ var id = _a.id, option = _a.option, isSelected = _a.isSelected, isFocussed = _a.isFocussed, scrollFocussedOpIntoView = _a.scrollFocussedOpIntoView, parentOnChange = _a.onChange, setSearchString = _a.setSearchString, optionsClassName = _a.optionsClassName, S = _a.S, observerRef = _a.observerRef, isTagsStyle = _a.isTagsStyle, isMulti = _a.isMulti, value = _a.value, index = _a.index, _b = _a.alignCheckbox, alignCheckbox = _b === void 0 ? "left" : _b, allOptionsIconAfter = _a.iconAfter // might not be used anywhere keeping it here just in case
66
+ ;
66
67
  var theme = (0, styled_components_1.useTheme)();
67
68
  var TypoComp = S ? Typo2_1.UI_BODY_SM_DF : Typo2_1.UI_BODY_SM_DF;
68
- var image = option.image, display = option.display, icon = option.icon, desc = option.desc, color = option.color, loading = option.loading, disabled = option.disabled, tooltip = option.tooltip;
69
+ var image = option.image, display = option.display, icon = option.icon, desc = option.desc, color = option.color, loading = option.loading, disabled = option.disabled, tooltip = option.tooltip, optionIconAfter = option.iconAfter, iconAfterColor = option.iconAfterColor;
70
+ var iconAfter = allOptionsIconAfter || optionIconAfter;
69
71
  var handleClick = function () {
70
72
  if (!loading) {
71
73
  parentOnChange(id, option);
@@ -117,7 +119,8 @@ var ListItem = function (_a) {
117
119
  icon: iconAfter,
118
120
  S: S,
119
121
  className: "OKE-Dropdown__optionIcon",
120
- disabled: disabled
122
+ disabled: disabled,
123
+ color: iconAfterColor
121
124
  }))));
122
125
  if (tooltip) {
123
126
  var tooltipProps = typeof tooltip === 'string' ? { text: tooltip } : tooltip;
@@ -10,5 +10,8 @@ export interface TagDisplayInterface extends Omit<TagInterface, 'variant'> {
10
10
  icon?: string;
11
11
  weight?: "bold" | "light" | "default";
12
12
  colorPreset?: 'positive' | 'inProgress' | 'warning' | 'negative' | 'special' | "default";
13
+ /** Wrap the label up to this many lines before ellipsizing (the pill grows
14
+ * vertically to fit). Unset = existing single-line ellipsis behaviour. */
15
+ textWrapMaxLines?: number;
13
16
  }
14
17
  export declare const TagDisplay: React.FunctionComponent<TagDisplayInterface>;
@@ -27,10 +27,33 @@ var getTagDisplayStyles_1 = require("./getTagDisplayStyles");
27
27
  var styled_components_1 = __importDefault(require("styled-components"));
28
28
  var mixins_1 = require("../../../../../themes/mixins");
29
29
  var white = themes_1.colors.white;
30
- var STYLED_UI_TAG_DF = (0, styled_components_1.default)(Typo2_1.UI_TAG_DF)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"])), mixins_1.ellipsis);
30
+ var STYLED_UI_TAG_DF = (0, styled_components_1.default)(Typo2_1.UI_TAG_DF)(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n ", "\n"], ["\n ", "\n"
31
+ // textWrapMaxLines variants — text wraps up to N lines, then ellipsis
32
+ // (clampText), and the pill grows vertically to fit. white-space: normal
33
+ // overrides both the ellipsis mixin's nowrap and StyledTag's container-level
34
+ // nowrap; overflow-wrap catches single unbroken tokens longer than the pill.
35
+ // One styled component per distinct line count, cached — a fresh styled()
36
+ // per render would remount the text node and churn generated classes.
37
+ ])), mixins_1.ellipsis);
38
+ // textWrapMaxLines variants — text wraps up to N lines, then ellipsis
39
+ // (clampText), and the pill grows vertically to fit. white-space: normal
40
+ // overrides both the ellipsis mixin's nowrap and StyledTag's container-level
41
+ // nowrap; overflow-wrap catches single unbroken tokens longer than the pill.
42
+ // One styled component per distinct line count, cached — a fresh styled()
43
+ // per render would remount the text node and churn generated classes.
44
+ var wrapTypoByLines = {};
45
+ var getWrapTypo = function (lines) {
46
+ if (!wrapTypoByLines[lines]) {
47
+ wrapTypoByLines[lines] = (0, styled_components_1.default)(Typo2_1.UI_TAG_DF)(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n ", "\n white-space: normal;\n overflow-wrap: anywhere;\n "], ["\n ", "\n white-space: normal;\n overflow-wrap: anywhere;\n "])), (0, mixins_1.clampText)(lines));
48
+ }
49
+ return wrapTypoByLines[lines];
50
+ };
31
51
  var TagDisplay = function (_a) {
32
- var id = _a.id, display = _a.display, size = _a.size, tagColor = _a.tagColor, textColor = _a.textColor, fill = _a.fill, icon = _a.icon, badgeColor = _a.badgeColor, _b = _a.colorPreset, colorPreset = _b === void 0 ? 'default' : _b, weight = _a.weight;
33
- return (react_1.default.createElement(Tag_1.Tag, { weight: weight, id: id, display: display, icon: icon, badgeColor: badgeColor, size: size, fill: fill, style: __assign(__assign(__assign({ padding: "0.25rem 0.5rem", borderRadius: "4px", color: white }, (0, getTagDisplayStyles_1.getTagDisplayStyles)({ colorPreset: colorPreset })), (tagColor ? { backgroundColor: tagColor } : {})), (textColor ? { color: textColor } : {})), typo: STYLED_UI_TAG_DF }));
52
+ var id = _a.id, display = _a.display, size = _a.size, tagColor = _a.tagColor, textColor = _a.textColor, fill = _a.fill, icon = _a.icon, badgeColor = _a.badgeColor, _b = _a.colorPreset, colorPreset = _b === void 0 ? 'default' : _b, weight = _a.weight, textWrapMaxLines = _a.textWrapMaxLines;
53
+ var typo = textWrapMaxLines && textWrapMaxLines > 0
54
+ ? getWrapTypo(Math.floor(textWrapMaxLines))
55
+ : STYLED_UI_TAG_DF;
56
+ return (react_1.default.createElement(Tag_1.Tag, { weight: weight, id: id, display: display, icon: icon, badgeColor: badgeColor, size: size, fill: fill, style: __assign(__assign(__assign({ padding: "0.25rem 0.5rem", borderRadius: "4px", color: white }, (0, getTagDisplayStyles_1.getTagDisplayStyles)({ colorPreset: colorPreset })), (tagColor ? { backgroundColor: tagColor } : {})), (textColor ? { color: textColor } : {})), typo: typo }));
34
57
  };
35
58
  exports.TagDisplay = TagDisplay;
36
- var templateObject_1;
59
+ var templateObject_1, templateObject_2;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "3.1.2",
3
+ "version": "3.3.0",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",