oolib 2.225.10 → 2.226.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.
@@ -29,14 +29,15 @@ var ListItem_1 = require("../../../v2/components/List/comps/ListItem");
29
29
  var dropdownOptions_1 = require("./Dropdown/dropdownOptions");
30
30
  var availableColors = __spreadArray([undefined], Object.keys(__1.colors2).sort(), true);
31
31
  var availableIcons = __spreadArray([undefined], Object.keys(__1.icons).sort(), true);
32
+ var longText = "If music be the food of love, play on;\n Give me excess of it, that, surfeiting,\n The appetite may sicken, and so die.\n That strain again! it had a dying fall:\n O, it came o'er my ear like the sweet sound,\n That breathes upon a bank of violets,\n Stealing and giving odour! Enough; no more:\n 'Tis not so sweet now as it was before.\n O spirit of love! how quick and fresh art thou,\n That, notwithstanding thy capacity\n Receiveth as the sea, nought enters there,\n Of what validity and pitch soe'er,\n But falls into abatement and low price,\n Even in a minute: so full of shapes is fancy\n That it alone is high fantastical.";
32
33
  var dropdownOptions = [
33
34
  {
34
- display: "Option with a slightly longer name",
35
+ display: longText,
35
36
  value: "india",
36
37
  color: themes_1.colors.lightRed,
37
38
  // image: "xyz",
38
39
  icon: "CirclesFour",
39
- desc: "There is this one very annoying bug in the list component. basically the options ka description na, I was trying to put a 3 line line clamp on it. but for that to work, the outer wrapper of both the display and description cannot have ellipsis. but if I remove that ellipsis horizontal scroll comes. its a complete brain fry\u2026 could you check it out? in case you have a quick solution for it?",
40
+ desc: longText,
40
41
  // desc: "This is a story about schnil-tu, a.k.a tubito senpai. Tubito senpai loves to say bhai-god. Lol.",
41
42
  },
42
43
  {
@@ -0,0 +1,7 @@
1
+ /**
2
+ * Calculates the color contrast ratio between two colors according to WCAG 2.1
3
+ * @param color1 - First color (any CSS color format: hex, rgb, oklch, oklab, color())
4
+ * @param color2 - Second color (any CSS color format: hex, rgb, oklch, oklab, color())
5
+ * @returns Contrast ratio between 1 and 21
6
+ */
7
+ export declare const getColorContrast: (color1: string, color2: string) => number;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getColorContrast = void 0;
4
+ var color_1 = require("@texel/color");
5
+ /**
6
+ * Calculates the relative luminance of a color according to WCAG 2.1
7
+ * @param r - Red component (0-1)
8
+ * @param g - Green component (0-1)
9
+ * @param b - Blue component (0-1)
10
+ * @returns Relative luminance value
11
+ */
12
+ var getRelativeLuminance = function (r, g, b) {
13
+ var _a = [r, g, b].map(function (c) {
14
+ return c <= 0.03928 ? c / 12.92 : Math.pow((c + 0.055) / 1.055, 2.4);
15
+ }), rs = _a[0], gs = _a[1], bs = _a[2];
16
+ return 0.2126 * rs + 0.7152 * gs + 0.0722 * bs;
17
+ };
18
+ /**
19
+ * Calculates the color contrast ratio between two colors according to WCAG 2.1
20
+ * @param color1 - First color (any CSS color format: hex, rgb, oklch, oklab, color())
21
+ * @param color2 - Second color (any CSS color format: hex, rgb, oklch, oklab, color())
22
+ * @returns Contrast ratio between 1 and 21
23
+ */
24
+ var getColorContrast = function (color1, color2) {
25
+ // Parse colors and convert to sRGB (returns [r, g, b] in 0-1 range)
26
+ var rgb1 = (0, color_1.parse)(color1, color_1.sRGB);
27
+ var rgb2 = (0, color_1.parse)(color2, color_1.sRGB);
28
+ if (!rgb1 || !rgb2) {
29
+ throw new Error("Invalid color format provided");
30
+ }
31
+ // Get luminance values (rgb values are in 0-1 range)
32
+ var l1 = getRelativeLuminance(rgb1[0], rgb1[1], rgb1[2]);
33
+ var l2 = getRelativeLuminance(rgb2[0], rgb2[1], rgb2[2]);
34
+ // Calculate contrast ratio (lighter color + 0.05) / (darker color + 0.05)
35
+ var lighter = Math.max(l1, l2);
36
+ var darker = Math.min(l1, l2);
37
+ return (lighter + 0.05) / (darker + 0.05);
38
+ };
39
+ exports.getColorContrast = getColorContrast;
@@ -96,7 +96,8 @@ var ListItem = function (_a) {
96
96
  marginTop: "0.1rem",
97
97
  display: "flex",
98
98
  alignItems: "center",
99
- gap: "0.5rem"
99
+ gap: "0.5rem",
100
+ flex: "none"
100
101
  } },
101
102
  alignCheckbox === "left" && renderCheckBox(),
102
103
  icon &&
@@ -13,6 +13,8 @@ var themes_1 = require("../../../themes");
13
13
  var getDynamicColors_1 = require("../../../themes/utils/getDynamicColors");
14
14
  var mixins_1 = require("../../../../themes/mixins");
15
15
  var grey10 = themes_1.colors.grey10;
16
+ var textLineClamp = 2;
17
+ var descriptionLineClamp = 3;
16
18
  exports.StyledListItemWrapper = styled_components_1.default.li(templateObject_1 || (templateObject_1 = __makeTemplateObject(["\n display: flex;\n align-items: center;\n /* padding: ", "; */\n padding: 0.8rem;\n border-radius: 0.4rem;\n gap: 1rem;\n\n justify-content: space-between;\n\n background-color: ", ";\n\n .OKE-Dropdown__optionText {\n color: ", ";\n }\n\n .OKE-Dropdown__optionIcon {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &:first-of-type {\n /* margin-top: 0.4rem; */\n }\n\n &:last-of-type {\n /* margin-bottom: 0.4rem; */\n }\n\n .OKE-Dropdown__optionDesc {\n ", "\n white-space: normal;\n }\n\n .OKE-Dropdown__optionImg {\n flex: 0 0 auto;\n }\n\n .OKE-Dropdown__checkboxClickArea {\n position: absolute;\n width: 2rem;\n height: 2rem;\n }\n .OKE-Dropdown__checkboxClickArea-box {\n margin-top: 0.2rem;\n flex-shrink: 0;\n }\n"], ["\n display: flex;\n align-items: center;\n /* padding: ", "; */\n padding: 0.8rem;\n border-radius: 0.4rem;\n gap: 1rem;\n\n justify-content: space-between;\n\n background-color: ", ";\n\n .OKE-Dropdown__optionText {\n color: ", ";\n }\n\n .OKE-Dropdown__optionIcon {\n color: ", ";\n }\n\n &:hover {\n background-color: ", ";\n }\n\n &:first-of-type {\n /* margin-top: 0.4rem; */\n }\n\n &:last-of-type {\n /* margin-bottom: 0.4rem; */\n }\n\n .OKE-Dropdown__optionDesc {\n ", "\n white-space: normal;\n }\n\n .OKE-Dropdown__optionImg {\n flex: 0 0 auto;\n }\n\n .OKE-Dropdown__checkboxClickArea {\n position: absolute;\n width: 2rem;\n height: 2rem;\n }\n .OKE-Dropdown__checkboxClickArea-box {\n margin-top: 0.2rem;\n flex-shrink: 0;\n }\n"])), function (_a) {
17
19
  var S = _a.S;
18
20
  return (S ? "0.8rem" : "0.6rem 0.8rem");
@@ -28,7 +30,7 @@ exports.StyledListItemWrapper = styled_components_1.default.li(templateObject_1
28
30
  }, themes_1.colors.grey80, themes_1.colors.grey80, function (_a) {
29
31
  var theme = _a.theme;
30
32
  return "".concat(grey10);
31
- }, (0, mixins_1.clampText)(3));
33
+ }, (0, mixins_1.clampText)(descriptionLineClamp));
32
34
  exports.StyledRightSection = styled_components_1.default.div(templateObject_2 || (templateObject_2 = __makeTemplateObject(["\n margin-top: 0.1rem;\n display: flex;\n gap: 0.5rem;\n align-self: flex-start;\n justify-content: space-between;\n"], ["\n margin-top: 0.1rem;\n display: flex;\n gap: 0.5rem;\n align-self: flex-start;\n justify-content: space-between;\n"])));
33
- exports.StyledWrapper = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n overflow: hidden;\n min-width: 0;\n flex: 1;\n \n /* Ensure direct child divs can shrink below content width */\n > div {\n min-width: 0;\n }\n \n .OKE-Dropdown__optionText {\n ", "\n }\n"], ["\n overflow: hidden;\n min-width: 0;\n flex: 1;\n \n /* Ensure direct child divs can shrink below content width */\n > div {\n min-width: 0;\n }\n \n .OKE-Dropdown__optionText {\n ", "\n }\n"])), mixins_1.ellipsis);
35
+ exports.StyledWrapper = styled_components_1.default.div(templateObject_3 || (templateObject_3 = __makeTemplateObject(["\n overflow: hidden;\n min-width: 0;\n flex: 1;\n \n /* Ensure direct child divs can shrink below content width */\n > div {\n min-width: 0;\n }\n \n .OKE-Dropdown__optionText {\n ", "\n white-space: normal;\n }\n"], ["\n overflow: hidden;\n min-width: 0;\n flex: 1;\n \n /* Ensure direct child divs can shrink below content width */\n > div {\n min-width: 0;\n }\n \n .OKE-Dropdown__optionText {\n ", "\n white-space: normal;\n }\n"])), (0, mixins_1.clampText)(textLineClamp));
34
36
  var templateObject_1, templateObject_2, templateObject_3;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oolib",
3
- "version": "2.225.10",
3
+ "version": "2.226.0",
4
4
  "description": " OKE Component Library",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -96,6 +96,7 @@
96
96
  "@material/material-color-utilities": "^0.3.0",
97
97
  "@phosphor-icons/react": "^2.1.10",
98
98
  "@react-hook/resize-observer": "^1.2.6",
99
+ "@texel/color": "^1.1.10",
99
100
  "babel-polyfill": "^6.26.0",
100
101
  "d3": "^7.8.5",
101
102
  "d3-collection": "^1.0.7",