playbook_ui 16.8.0.pre.alpha.PLAY2965datepickerconsoleerrors16591 → 16.8.0.pre.alpha.PLAY2966draggablemobile16518

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 (35) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/Components/RegularTableView.tsx +0 -2
  3. data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +0 -2
  4. data/app/pb_kits/playbook/pb_advanced_table/Components/VirtualizedTableView.tsx +1 -5
  5. data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +0 -24
  6. data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +0 -144
  7. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.jsx +0 -1
  8. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling.md +0 -6
  9. data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.json +2 -5
  10. data/app/pb_kits/playbook/pb_advanced_table/docs/_playground.overrides.json +1 -1
  11. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_column_definitions_styling.json +1 -4
  12. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -1
  13. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -1
  14. data/app/pb_kits/playbook/pb_currency/_currency.tsx +6 -9
  15. data/app/pb_kits/playbook/pb_currency/currency.rb +10 -5
  16. data/app/pb_kits/playbook/pb_currency/currency.test.js +1 -44
  17. data/app/pb_kits/playbook/pb_date_picker/date_picker.html.erb +21 -36
  18. data/app/pb_kits/playbook/pb_date_picker/docs/_date_picker_dialog_submission.jsx +2 -2
  19. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_rails.md +0 -2
  20. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_cards_react.md +0 -1
  21. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_rails.md +1 -1
  22. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_list_react.md +1 -1
  23. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_rails.md +1 -3
  24. data/app/pb_kits/playbook/pb_draggable/docs/_draggable_with_selectable_list_react.md +1 -3
  25. data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.html.erb +1 -0
  26. data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.jsx +21 -0
  27. data/app/pb_kits/playbook/pb_icon/docs/_icon_fa_kit.md +7 -0
  28. data/app/pb_kits/playbook/pb_icon/docs/example.yml +2 -0
  29. data/app/pb_kits/playbook/pb_icon/docs/index.js +1 -0
  30. data/dist/chunks/vendor.js +1 -1
  31. data/lib/playbook/version.rb +1 -1
  32. metadata +5 -5
  33. data/app/pb_kits/playbook/pb_advanced_table/Utilities/ColumnLayoutHelper.ts +0 -138
  34. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.jsx +0 -57
  35. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_column_styling_width.md +0 -66
@@ -1,138 +0,0 @@
1
- import type { CSSProperties } from "react"
2
-
3
- import { GenericObject } from "../../types"
4
-
5
- /**
6
- * Converts a Playbook column width value to a CSS length string.
7
- * Numbers are treated as pixels; strings are passed through (e.g. `"12rem"`, `"200px"`).
8
- */
9
- export function cssLength(
10
- value: number | string | undefined | null
11
- ): string | undefined {
12
- if (value === undefined || value === null || value === "") return undefined
13
- if (typeof value === "number" && Number.isFinite(value)) return `${value}px`
14
- return String(value)
15
- }
16
-
17
- const columnStylingKeys = (column: GenericObject) =>
18
- (column.columnStyling || column.column_styling || {}) as GenericObject
19
-
20
- function readStylingLength(
21
- styling: GenericObject,
22
- camel: string,
23
- snake?: string
24
- ): string | number | undefined {
25
- if (snake) return styling[camel] ?? styling[snake]
26
- return styling[camel] as string | number | undefined
27
- }
28
-
29
- /**
30
- * TanStack Table v8 `ColumnDef` sizing fields we forward from each `columnDefinitions` entry.
31
- * See AdvancedTable kit docs for precedence with `columnStyling` width keys.
32
- */
33
- export const PLAYBOOK_FORWARDED_COLUMN_DEF_SIZING_KEYS = [
34
- "size",
35
- "minSize",
36
- "maxSize",
37
- ] as const
38
-
39
- export type PlaybookForwardedColumnSizing = Partial<
40
- Record<(typeof PLAYBOOK_FORWARDED_COLUMN_DEF_SIZING_KEYS)[number], number>
41
- >
42
-
43
- export function buildTanStackSizingFromColumn(
44
- column: GenericObject
45
- ): PlaybookForwardedColumnSizing {
46
- const out: PlaybookForwardedColumnSizing = {}
47
- PLAYBOOK_FORWARDED_COLUMN_DEF_SIZING_KEYS.forEach((key) => {
48
- const v = column[key]
49
- if (typeof v === "number" && Number.isFinite(v)) out[key] = v
50
- })
51
-
52
- const styling = columnStylingKeys(column)
53
-
54
- if (out.size === undefined && readStylingLength(styling, "width") !== undefined) {
55
- const w = readStylingLength(styling, "width")
56
- if (typeof w === "number" && Number.isFinite(w)) out.size = w
57
- }
58
- if (out.minSize === undefined && readStylingLength(styling, "minWidth", "min_width") !== undefined) {
59
- const w = readStylingLength(styling, "minWidth", "min_width")
60
- if (typeof w === "number" && Number.isFinite(w)) out.minSize = w
61
- }
62
- if (out.maxSize === undefined && readStylingLength(styling, "maxWidth", "max_width") !== undefined) {
63
- const w = readStylingLength(styling, "maxWidth", "max_width")
64
- if (typeof w === "number" && Number.isFinite(w)) out.maxSize = w
65
- }
66
-
67
- // width/size only → fixed column (min and max match preferred)
68
- if (out.size !== undefined && out.minSize === undefined && out.maxSize === undefined) {
69
- out.minSize = out.size
70
- out.maxSize = out.size
71
- }
72
-
73
- return out
74
- }
75
-
76
- /**
77
- * Inline width styles for `<th>` / `<td>` so `table-layout: fixed` tables keep stable
78
- * columns when row content changes (e.g. expand/collapse). Values mirror TanStack sizing
79
- * and/or `columnStyling` width keys; string values in `columnStyling` win over numeric
80
- * TanStack fields when both describe the same axis.
81
- */
82
- export function buildPlaybookColumnLayoutStyles(
83
- column: GenericObject,
84
- tanStackSizing: PlaybookForwardedColumnSizing
85
- ): CSSProperties {
86
- const styling = columnStylingKeys(column)
87
- const styles: CSSProperties = {}
88
-
89
- const stylingWidth = readStylingLength(styling, "width")
90
- const stylingMin = readStylingLength(styling, "minWidth", "min_width")
91
- const stylingMax = readStylingLength(styling, "maxWidth", "max_width")
92
-
93
- const hasStylingWidth = stylingWidth !== undefined && stylingWidth !== ""
94
- const hasStylingMin = stylingMin !== undefined && stylingMin !== ""
95
- const hasStylingMax = stylingMax !== undefined && stylingMax !== ""
96
-
97
- let widthValue: string | number | undefined = hasStylingWidth
98
- ? stylingWidth
99
- : tanStackSizing.size
100
- let minValue: string | number | undefined = hasStylingMin
101
- ? stylingMin
102
- : tanStackSizing.minSize
103
- let maxValue: string | number | undefined = hasStylingMax
104
- ? stylingMax
105
- : tanStackSizing.maxSize
106
-
107
- const preferredForLock = hasStylingWidth ? stylingWidth : tanStackSizing.size
108
- const explicitMin = hasStylingMin || tanStackSizing.minSize !== undefined
109
- const explicitMax = hasStylingMax || tanStackSizing.maxSize !== undefined
110
-
111
- if (
112
- preferredForLock !== undefined &&
113
- preferredForLock !== "" &&
114
- !explicitMin &&
115
- !explicitMax
116
- ) {
117
- minValue = preferredForLock
118
- maxValue = preferredForLock
119
- widthValue = preferredForLock
120
- }
121
-
122
- const widthCss = cssLength(widthValue)
123
- const minCss = cssLength(minValue)
124
- const maxCss = cssLength(maxValue)
125
-
126
- if (widthCss !== undefined) styles.width = widthCss
127
- if (minCss !== undefined) styles.minWidth = minCss
128
- if (maxCss !== undefined) styles.maxWidth = maxCss
129
-
130
- return styles
131
- }
132
-
133
- export function playbookColumnLayoutStylesFromMeta(
134
- columnDef: GenericObject | undefined
135
- ): CSSProperties {
136
- const meta = columnDef?.meta as GenericObject | undefined
137
- return (meta?.playbookColumnLayoutStyles || {}) as CSSProperties
138
- }
@@ -1,57 +0,0 @@
1
- import React from "react"
2
- import AdvancedTable from "../_advanced_table"
3
- import MOCK_DATA from "./advanced_table_mock_data.json"
4
-
5
- /**
6
- * Kit doc: compares fixed width, floor-only, TanStack band, and min/preferred/max band.
7
- */
8
- const AdvancedTableColumnStylingWidth = (props) => {
9
- const columnDefinitions = [
10
- {
11
- accessor: "year",
12
- label: "Year (fixed)",
13
- cellAccessors: ["quarter", "month", "day"],
14
- // width alone locks min + max to the same value (128px).
15
- columnStyling: { width: 128 },
16
- },
17
- {
18
- accessor: "newEnrollments",
19
- label: "Enrollments (floor)",
20
- columnStyling: { minWidth: 160 },
21
- },
22
- {
23
- accessor: "scheduledMeetings",
24
- label: "Meetings (TanStack band)",
25
- size: 200,
26
- minSize: 160,
27
- maxSize: 240,
28
- },
29
- {
30
- accessor: "attendanceRate",
31
- label: "Attendance (min / pref / max)",
32
- columnStyling: { minWidth: 108, width: 124, maxWidth: 168 },
33
- },
34
- {
35
- accessor: "completedClasses",
36
- label: "Completed",
37
- },
38
- {
39
- accessor: "classCompletionRate",
40
- label: "Completion %",
41
- },
42
- {
43
- accessor: "graduatedStudents",
44
- label: "Graduated",
45
- },
46
- ]
47
-
48
- return (
49
- <AdvancedTable
50
- columnDefinitions={columnDefinitions}
51
- tableData={MOCK_DATA}
52
- {...props}
53
- />
54
- )
55
- }
56
-
57
- export default AdvancedTableColumnStylingWidth
@@ -1,66 +0,0 @@
1
- AdvancedTable column width is controlled in two equivalent places on each leaf `columnDefinitions` entry. Playbook maps them to inline styles on header and body cells (and forwards numeric values into TanStack Table’s column model).
2
-
3
- 1) Playbook `columnStyling` and TanStack `ColumnDef` use the same three ideas:
4
-
5
- - Preferred / target width: `columnStyling` `width` maps to TanStack `size` on the same column object.
6
- - Minimum width (floor): `columnStyling` `minWidth` maps to TanStack `minSize`.
7
- - Maximum width (ceiling): `columnStyling` `maxWidth` maps to TanStack `maxSize`.
8
-
9
- Numbers are pixels. You can also pass CSS length strings on `columnStyling` (e.g. `"12rem"`, `"200px"`). TanStack fields accept numbers only.
10
-
11
- If both APIs set the same axis, `columnStyling` wins for that axis when Playbook builds cell styles.
12
-
13
- 2) Fixed width: set `width` only
14
-
15
- If you pass only `width` (or only `size`) and do not set `minWidth` / `maxWidth` (or `minSize` / `maxSize`), Playbook treats that as a fixed column: it sets all three to the same value under the hood so you do not have to repeat yourself.
16
-
17
- ```jsx
18
- columnStyling: { width: 128 }
19
- // Applied as width, minWidth, and maxWidth: 128px
20
- ```
21
-
22
- ```jsx
23
- size: 200
24
- // Forwarded as size, minSize, and maxSize: 200
25
- ```
26
-
27
- Use this when the column should stay one width (e.g. a hierarchy column with expand controls).
28
-
29
- 3) Floor only: `minWidth` / `minSize`
30
-
31
- Set only a minimum when the column may grow with the table or content but must not shrink below a baseline (common fix for horizontal “jump” when rows expand):
32
-
33
- ```jsx
34
- columnStyling: { minWidth: 160 }
35
- ```
36
-
37
- 4) Flexible band: min + preferred + max
38
-
39
- Set two or three values when you want a range. CSS uses preferred `width` clamped between `minWidth` and `maxWidth`:
40
-
41
- - `minWidth`: won’t shrink below this.
42
- - `width`: preferred size when space allows.
43
- - `maxWidth`: won’t grow above this.
44
-
45
- Example from the table below (Attendance): `minWidth: 108`, `width: 124`, `maxWidth: 168` → preferred 124px, allowed between 108 and 168.
46
-
47
- You only need all three when you want that band. If min and max are omitted, `width` alone is enough for a fixed column.
48
-
49
- 5) TanStack band without `columnStyling`
50
-
51
- The Meetings column uses only TanStack fields:
52
-
53
- ```jsx
54
- { accessor: "scheduledMeetings", size: 200, minSize: 160, maxSize: 240 }
55
- ```
56
-
57
- Playbook applies the same min / preferred / max idea to cell styles. Setting only `size: 200` would lock all three to 200, same as `width: 200` in `columnStyling`.
58
-
59
- 6) What the example table shows
60
-
61
- - Year (fixed): `columnStyling: { width: 128 }` — locked to 128px.
62
- - Enrollments (floor): `columnStyling: { minWidth: 160 }` — at least 160px; can grow.
63
- - Meetings (TanStack band): `size` / `minSize` / `maxSize` — preferred 200px, between 160–240.
64
- - Attendance (min / pref / max): all three in `columnStyling` — preferred 124px, between 108–168.
65
-
66
- Grouped columns: put width options on leaf definitions (columns with an `accessor`), not on parent group headers.