playbook_ui 15.6.0.pre.alpha.play2552collapsibleiconrefactor12903 → 15.6.0.pre.alpha.play265012910

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b56117c9b815041948a7dc894ebad0caebf095ff1da7801e06ed7fec18da7eeb
4
- data.tar.gz: 8e9f82470ea23ae8863567c8df94451dd927cdcbbaa7cf9d174a5fcd2ee627b7
3
+ metadata.gz: e093a237701012d80b9c37c5be72e74df5c14e15a001d45a812b6cec3ffe341d
4
+ data.tar.gz: 410e0352979d11d39b3d43111e0403641a33c8e42a3e3002ab70eda18b9bbb71
5
5
  SHA512:
6
- metadata.gz: 58c7104cca8322ba83b49875a68bc2a0a49ed6334337bf4a0e00bfa6d8c062bc45b8aadbe2644592a9dc358348cd972b47fef79efb89fbf32135c2f345f6bbd0
7
- data.tar.gz: 1c1933805f799e9aeca540a29d3ac0861de4c8c8900ecfb62c7e1ea5eb1800e0df5d7dd4164afffb92788d84d19ed486921d7a572afcf4cf5823c5eeb64d5784
6
+ metadata.gz: 8b8a92fec8ea139d05795845db08d04c0d82163ba45d3eb3504a10c34df8918ae96f95a24225e3823b450e36143051c49668d71605bc811395d2dc29f595fc78
7
+ data.tar.gz: 9e3d30a64b3e8700789c63334252114f7070eaac866af69f183a40d89d8e456ffc413d9bd3fc66cb0177b6fa5515e6b4131e1ee92020012950c5371e55121015
@@ -1,6 +1,7 @@
1
1
  import React, { useState, useEffect } from "react";
2
2
  import { globalProps } from "../utilities/globalProps";
3
3
  import { buildAriaProps, buildDataProps, buildHtmlProps } from "../utilities/props";
4
+ import { deprecatedKitWarning } from "../utilities/deprecated";
4
5
 
5
6
  import HighchartsReact from "highcharts-react-official";
6
7
  import Highcharts from "highcharts";
@@ -168,6 +169,11 @@ if (Array.isArray(axisTitle) && axisTitle.length > 1 && axisTitle[1].name) {
168
169
 
169
170
  const [options, setOptions] = useState({});
170
171
 
172
+ useEffect(() => {
173
+ // Warn about deprecated kit (only once per page load, dev mode only)
174
+ deprecatedKitWarning('BarGraph', 'Please use "PbBarGraph" instead.');
175
+ }, []);
176
+
171
177
  useEffect(() => {
172
178
  setOptions(merge(staticOptions, customOptions));
173
179
  }, [chartData]);
@@ -25,11 +25,11 @@ exports[`html structure is correct 1`] = `
25
25
  >
26
26
  <div
27
27
  class="icon_wrapper"
28
- style="vertical-align: middle;"
28
+ style="vertical-align: middle; color: rgb(193, 205, 214);"
29
29
  >
30
30
  <svg
31
31
  aria-label="chevron-down icon"
32
- class="pb_custom_icon svg-inline--fa color_text_lt_lighter svg_lg svg_fw"
32
+ class="pb_custom_icon svg-inline--fa svg_lg svg_fw"
33
33
  color="currentColor"
34
34
  fill="none"
35
35
  height="auto"
@@ -27,12 +27,12 @@ type colorMap = {
27
27
  };
28
28
 
29
29
  const colorMap = {
30
- default:"text_lt_default",
31
- light: "text_lt_light",
32
- lighter: "text_lt_lighter",
33
- link: "primary",
34
- error: "error",
35
- success: "text_dk_success_sm",
30
+ default: "#242B42",
31
+ light: "#687887",
32
+ lighter: "#C1CDD6",
33
+ link: "#0056CF",
34
+ error: "#FF2229",
35
+ success: "#00CA74",
36
36
  };
37
37
 
38
38
  const CollapsibleIcon = ({
@@ -68,10 +68,9 @@ const CollapsibleIcon = ({
68
68
  className="icon_wrapper"
69
69
  key={icon ? showIcon(icon)[0] : "chevron-down"}
70
70
  onClick={(e) => handleIconClick(e)}
71
- style={{ verticalAlign: "middle"}}
71
+ style={{ verticalAlign: "middle", color: color }}
72
72
  >
73
73
  <Icon
74
- color={color}
75
74
  icon={icon ? showIcon(icon)[0] : "chevron-down"}
76
75
  size={iconSize}
77
76
  />
@@ -81,10 +80,9 @@ const CollapsibleIcon = ({
81
80
  className="icon_wrapper"
82
81
  key={icon ? showIcon(icon)[1] : "chevron-up"}
83
82
  onClick={(e) => handleIconClick(e)}
84
- style={{ verticalAlign: "middle" }}
83
+ style={{ verticalAlign: "middle", color: color }}
85
84
  >
86
85
  <Icon
87
- color={color}
88
86
  icon={icon ? showIcon(icon)[1] : "chevron-up"}
89
87
  size={iconSize}
90
88
  />
@@ -7,6 +7,7 @@ const CollapsibleIcons = (props) => {
7
7
  <>
8
8
  <Collapsible
9
9
  icon={['plus','minus']}
10
+ iconColor='white'
10
11
  >
11
12
  <Collapsible.Main {...props}>
12
13
  <div>{'Main Section'}</div>
@@ -22,6 +22,7 @@ const CollapsibleState = (props) => {
22
22
  <Collapsible
23
23
  collapsed={isCollapsed}
24
24
  icon={["plus", "minus"]}
25
+ iconColor='white'
25
26
  padding="none"
26
27
  >
27
28
  <Collapsible.Main padding="sm"
@@ -40,6 +41,7 @@ const CollapsibleState = (props) => {
40
41
  <Collapsible
41
42
  collapsed={isCollapsed}
42
43
  icon={["plus", "minus"]}
44
+ iconColor='white'
43
45
  padding="none"
44
46
  >
45
47
  <Collapsible.Main padding="sm"
@@ -58,6 +60,7 @@ const CollapsibleState = (props) => {
58
60
  <Collapsible
59
61
  collapsed={isCollapsed}
60
62
  icon={["plus", "minus"]}
63
+ iconColor='white'
61
64
  padding="none"
62
65
  >
63
66
  <Collapsible.Main padding="sm"
@@ -1,8 +1,9 @@
1
- import React from 'react'
1
+ import React, { useEffect } from 'react'
2
2
  import classnames from 'classnames'
3
3
 
4
4
  import { buildAriaProps, buildCss, buildDataProps, buildHtmlProps } from '../utilities/props'
5
5
  import { globalProps } from '../utilities/globalProps'
6
+ import { deprecatedKitWarning } from '../utilities/deprecated'
6
7
 
7
8
  import Body from '../pb_body/_body'
8
9
  import Title from '../pb_title/_title'
@@ -32,6 +33,10 @@ const Legend = (props: LegendProps) => {
32
33
  text,
33
34
  } = props
34
35
 
36
+ useEffect(() => {
37
+ deprecatedKitWarning('Legend')
38
+ }, [])
39
+
35
40
  const ariaProps = buildAriaProps(aria)
36
41
  const dataProps = buildDataProps(data)
37
42
  const htmlProps = buildHtmlProps(htmlOptions)
@@ -1,3 +1,4 @@
1
+ <%== deprecated_kit_warning('Legend') %>
1
2
  <%= pb_content_tag do %>
2
3
  <%= pb_rails("body", props: {color: object.body_color}) do %>
3
4
  <span style="<%= object.custom_color %>" class=<%= object.custom_color_class %>></span>
@@ -1 +1 @@
1
- Error shows that the radio option must be selected or is invalid (ie when used in a form it signals a user to fix an error).
1
+ Error shows that the radio option must be selected or is invalid (i.e. when used in a form it signals a user to fix an error).
@@ -1 +1 @@
1
- Select w/ Error shows that the radio option must be selected or is invalid (ie when used in a form it signals a user to fix an error).
1
+ Select w/ Error shows that an option must be selected or is invalid (i.e. when used in a form it signals a user to fix an error).
@@ -1 +1 @@
1
- Text Input w/ Error shows that the radio option must be selected or is invalid (ie when used in a form it signals a user to fix an error).
1
+ Text Input w/ Error shows that the input must be filled out (i.e. when used in a form it signals a user to fix an error).
@@ -1 +1 @@
1
- Textarea w/ Error shows that the radio option must be selected or is invalid (ie when used in a form it signals a user to fix an error).
1
+ Textarea w/ Error shows that the input must be filled out (i.e. when used in a form it signals a user to fix an error).
@@ -139,8 +139,7 @@ $text_colors: (
139
139
  text_lt_lighter: $text_lt_lighter,
140
140
  text_dk_default: $text_dk_default,
141
141
  text_dk_light: $text_dk_light,
142
- text_dk_lighter: $text_dk_lighter,
143
- text_dk_success_sm: $text_dk_success_sm
142
+ text_dk_lighter: $text_dk_lighter
144
143
  );
145
144
 
146
145
  /* Data colors ------------------------*/
@@ -0,0 +1,73 @@
1
+ /**
2
+ * Tracks which deprecated kits have already logged warnings in this session
3
+ * to ensure we only log once per page load per kit
4
+ */
5
+ const warnedKits = new Set<string>();
6
+
7
+ /**
8
+ * Logs a deprecation warning for a Playbook kit
9
+ * - Only logs once per kit per page load (prevents spam on re-renders)
10
+ * - Only logs in development mode (not in production or test environments)
11
+ *
12
+ * @param kitName - The name of the deprecated kit (e.g., 'BarGraph', 'RichTextEditor')
13
+ * @param message - Optional custom deprecation message. If not provided, uses a default message.
14
+ *
15
+ * @example
16
+ * // In your kit component:
17
+ * useEffect(() => {
18
+ * deprecatedKitWarning('BarGraph');
19
+ * }, []);
20
+ */
21
+ export const deprecatedKitWarning = (
22
+ kitName: string,
23
+ message?: string
24
+ ): void => {
25
+ // Skip in test environments (Jest sets NODE_ENV to 'test')
26
+ if (typeof process !== 'undefined' && process.env?.NODE_ENV === 'test') {
27
+ return;
28
+ }
29
+
30
+ // In browser environments, check if we're on localhost/dev
31
+ if (typeof window !== 'undefined') {
32
+ const hostname = window.location?.hostname;
33
+ const isLocalDev = hostname === 'localhost' ||
34
+ hostname === '127.0.0.1' ||
35
+ hostname?.endsWith('.local') ||
36
+ hostname?.includes('local.') ||
37
+ !hostname; // file:// protocol
38
+
39
+ // Only show warnings in local development
40
+ if (!isLocalDev) {
41
+ return;
42
+ }
43
+ }
44
+
45
+ // Only warn once per kit per page load
46
+ if (warnedKits.has(kitName)) {
47
+ return;
48
+ }
49
+
50
+ // Mark this kit as warned
51
+ warnedKits.add(kitName);
52
+
53
+ // Build the warning message
54
+ const baseMessage = `PLAYBOOK DEPRECATION WARNING
55
+ ----------------------------
56
+ The "${kitName}" kit is deprecated and will be removed in a future version.`;
57
+
58
+ const fullMessage = message
59
+ ? `${baseMessage} ${message}`
60
+ : `${baseMessage} Please migrate to the recommended alternative
61
+
62
+ `;
63
+
64
+ console.warn(fullMessage);
65
+ };
66
+
67
+ /**
68
+ * Resets the warned kits tracker (useful for testing)
69
+ * @internal
70
+ */
71
+ export const resetDeprecationWarnings = (): void => {
72
+ warnedKits.clear();
73
+ };