jfs-components 0.1.28 → 0.1.30

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.
Files changed (26) hide show
  1. package/CHANGELOG.md +15 -2
  2. package/lib/commonjs/components/CompareTable/CompareTable.js +191 -25
  3. package/lib/commonjs/components/ContentSheet/ContentSheet.js +66 -6
  4. package/lib/commonjs/components/MoneyValue/MoneyValue.js +179 -54
  5. package/lib/commonjs/components/PdpCcCard/PdpCcCard.js +7 -1
  6. package/lib/commonjs/components/Table/Table.js +27 -7
  7. package/lib/commonjs/icons/registry.js +1 -1
  8. package/lib/module/components/CompareTable/CompareTable.js +191 -26
  9. package/lib/module/components/ContentSheet/ContentSheet.js +69 -9
  10. package/lib/module/components/MoneyValue/MoneyValue.js +182 -57
  11. package/lib/module/components/PdpCcCard/PdpCcCard.js +7 -1
  12. package/lib/module/components/Table/Table.js +27 -7
  13. package/lib/module/icons/registry.js +1 -1
  14. package/lib/typescript/src/components/CompareTable/CompareTable.d.ts +21 -1
  15. package/lib/typescript/src/components/ContentSheet/ContentSheet.d.ts +14 -1
  16. package/lib/typescript/src/components/MoneyValue/MoneyValue.d.ts +10 -1
  17. package/lib/typescript/src/components/PdpCcCard/PdpCcCard.d.ts +25 -1
  18. package/lib/typescript/src/components/Table/Table.d.ts +9 -1
  19. package/lib/typescript/src/icons/registry.d.ts +1 -1
  20. package/package.json +1 -1
  21. package/src/components/CompareTable/CompareTable.tsx +224 -30
  22. package/src/components/ContentSheet/ContentSheet.tsx +88 -8
  23. package/src/components/MoneyValue/MoneyValue.tsx +216 -65
  24. package/src/components/PdpCcCard/PdpCcCard.tsx +36 -1
  25. package/src/components/Table/Table.tsx +29 -4
  26. package/src/icons/registry.ts +1 -1
@@ -39,6 +39,9 @@ function PdpCcCard({
39
39
  media,
40
40
  title = 'Title',
41
41
  subtitle = 'Subtitle',
42
+ numberOfLines,
43
+ disableTruncation,
44
+ singleLine,
42
45
  metrics = DEFAULT_METRICS,
43
46
  buttonLabel = 'button',
44
47
  buttonIcon = 'ic_add_circle',
@@ -90,7 +93,10 @@ function PdpCcCard({
90
93
  title: title,
91
94
  subtitle: subtitle,
92
95
  textAlign: "Center",
93
- modes: modes
96
+ modes: modes,
97
+ numberOfLines: numberOfLines,
98
+ disableTruncation: disableTruncation,
99
+ singleLine: singleLine
94
100
  }), metrics.length > 0 ? /*#__PURE__*/_jsx(View, {
95
101
  style: styles.metricsRow,
96
102
  children: metrics.map((metric, index) => /*#__PURE__*/_jsxs(React.Fragment, {
@@ -1,16 +1,26 @@
1
1
  "use strict";
2
2
 
3
- import React from 'react';
3
+ import React, { createContext, useContext } from 'react';
4
4
  import { View, Text, Pressable, ScrollView, Platform } from 'react-native';
5
5
  import { getVariableByName } from '../../design-tokens/figma-variables-resolver';
6
6
  import { EMPTY_MODES, cloneChildrenWithModes } from '../../utils/react-utils';
7
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
8
+ /**
9
+ * Carries the root `Table`'s `columnWidth` down to every cell so that, when it
10
+ * is set, all columns (header + body, data-driven or composed) share the same
11
+ * fixed width without each cell having to repeat the prop. Cells still honour
12
+ * an explicit `width` prop over this context value. `undefined` (the default,
13
+ * when no `Table` ancestor is present, or `columnWidth` is unset) leaves cells
14
+ * to flex — preserving the original behaviour.
15
+ */
16
+ const TableContext = /*#__PURE__*/createContext(undefined);
7
17
 
8
18
  /* -------------------------------------------------------------------------------------------------
9
19
  * Shared types & token resolution
10
20
  * -----------------------------------------------------------------------------------------------*/
11
21
 
12
22
  /** Resolved styling for a header cell and a body cell, derived from design tokens. */
13
- import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
23
+
14
24
  const toWeight = w => typeof w === 'number' ? `${w}` : w;
15
25
 
16
26
  /**
@@ -88,6 +98,10 @@ function TableCell({
88
98
  style
89
99
  }) {
90
100
  const t = resolveTableTokens(modes);
101
+ // A cell's width resolves in priority order: an explicit `width` prop, then
102
+ // the root Table's `columnWidth` (via context), then fall back to flex.
103
+ const ctxColumnWidth = useContext(TableContext);
104
+ const effectiveWidth = width ?? ctxColumnWidth;
91
105
  return /*#__PURE__*/_jsx(View, {
92
106
  style: [{
93
107
  backgroundColor: t.cellBg,
@@ -99,8 +113,8 @@ function TableCell({
99
113
  borderColor: t.borderColor,
100
114
  borderBottomWidth: isLastRow ? 0 : t.borderSize,
101
115
  borderRightWidth: isLastColumn ? 0 : t.borderSize,
102
- ...(width != null ? {
103
- width
116
+ ...(effectiveWidth != null ? {
117
+ width: effectiveWidth
104
118
  } : {
105
119
  flex,
106
120
  minWidth: 0
@@ -128,6 +142,8 @@ function TableHeaderCell({
128
142
  style
129
143
  }) {
130
144
  const t = resolveTableTokens(modes);
145
+ const ctxColumnWidth = useContext(TableContext);
146
+ const effectiveWidth = width ?? ctxColumnWidth;
131
147
  return /*#__PURE__*/_jsx(View, {
132
148
  style: [{
133
149
  backgroundColor: t.headerBg,
@@ -136,8 +152,8 @@ function TableHeaderCell({
136
152
  justifyContent: alignToJustify(align),
137
153
  paddingHorizontal: t.headerPaddingH,
138
154
  paddingVertical: t.headerPaddingV,
139
- ...(width != null ? {
140
- width
155
+ ...(effectiveWidth != null ? {
156
+ width: effectiveWidth
141
157
  } : {
142
158
  flex,
143
159
  minWidth: 0
@@ -252,6 +268,7 @@ function Table({
252
268
  getRowKey,
253
269
  onRowPress,
254
270
  scrollable = false,
271
+ columnWidth,
255
272
  accessibilityLabel,
256
273
  modes = EMPTY_MODES,
257
274
  style
@@ -295,7 +312,10 @@ function Table({
295
312
  }, !scrollable && {
296
313
  width: '100%'
297
314
  }, style],
298
- children: body
315
+ children: /*#__PURE__*/_jsx(TableContext.Provider, {
316
+ value: columnWidth,
317
+ children: body
318
+ })
299
319
  });
300
320
  if (scrollable) {
301
321
  return /*#__PURE__*/_jsx(ScrollView, {