playbook_ui 14.22.0.pre.alpha.PLAY2254datepickerdefaultdatenullvalueturbo8533 → 14.22.0.pre.alpha.customheaderat8564

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: 567b391c419da9e3cf4d19032b27f7a6263ae4e1eaa405478f7d898346615a51
4
- data.tar.gz: d84820b333cf1f164fdb1b4b36b117641704faef98f4536ee6642279a9299789
3
+ metadata.gz: ae6b3ef179ba514261a9c3f24c44b3609980ad8295193eca7bf5ea78599e3f32
4
+ data.tar.gz: 59f4da05e7dc18142518d658c9dcb6e02938972abce9ca14af52a725839bf150
5
5
  SHA512:
6
- metadata.gz: e12362bbf552aca4ac900aac3ca3099977ba55ce61d3598c9a31dcb0e1e2747b8cba83ec688311b135c38ae8728d0be67c783a0d6d6f2987444cb01d7085ce18
7
- data.tar.gz: e0e3390a30724e0c4538674a071f04f15b4bbb6c0787f9efac4d71b8d09a85812dac0c298cb2db3f82eeb02af958e980da4b44fcf3b9e9a1efd7847df7d80468
6
+ metadata.gz: e891d0c03d22b2b4d0ae5faeac636fb884e54619f00b236a6cba2988a4432880f305f1d894f06005c4aa45dfefd83a440bf13395d43303cb875d129a140b6d24
7
+ data.tar.gz: 72d84a27a4f5ec1c18d7f7b1da0d093336282250ebf56351639b7da26ee64593ae9ac79caa56a8a15df148e7091642afb56f390860a9a97c095c6e964128b178
@@ -87,7 +87,7 @@ export function useTableState({
87
87
  // Handle grouped columns
88
88
  if (column.columns && column.columns.length > 0) {
89
89
  return {
90
- header: column.label || "",
90
+ header: column.header || column.label || "",
91
91
  columns: buildColumns(column.columns, false),
92
92
  };
93
93
  }
@@ -95,7 +95,7 @@ export function useTableState({
95
95
  // Define the base column structure
96
96
  const columnStructure = {
97
97
  ...columnHelper.accessor(column.accessor, {
98
- header: column.label || "",
98
+ header: column.header ?? column.label ?? "",
99
99
  }),
100
100
  };
101
101
 
@@ -189,6 +189,11 @@
189
189
  box-sizing: border-box !important;
190
190
  }
191
191
  }
192
+ // Fixes for tooltip picking up th styling from Table kit
193
+ .pb_tooltip_kit {
194
+ font-weight: unset;
195
+ text-transform: unset;
196
+ }
192
197
  }
193
198
 
194
199
  .pb_advanced_table_body {
@@ -0,0 +1,69 @@
1
+ import React from "react"
2
+ import AdvancedTable from '../../pb_advanced_table/_advanced_table'
3
+ import Icon from "../../pb_icon/_icon"
4
+ import Flex from "../../pb_flex/_flex"
5
+ import Caption from "../../pb_caption/_caption"
6
+ import Tooltip from "../../pb_tooltip/_tooltip"
7
+ import MOCK_DATA from "./advanced_table_mock_data.json"
8
+
9
+ const AdvancedTableWithCustomHeader = (props) => {
10
+ const columnDefinitions = [
11
+ {
12
+ accessor: "year",
13
+ label: "Year",
14
+ cellAccessors: ["quarter", "month", "day"],
15
+ },
16
+ {
17
+ accessor: "newEnrollments",
18
+ label: "New Enrollments",
19
+ header: () => (
20
+ <Flex alignItems="center"
21
+ justifyContent="center"
22
+ >
23
+ <Caption marginRight="xs">New Enrollments</Caption>
24
+ <Tooltip placement="top"
25
+ text="Whoa. I'm a Tooltip"
26
+ zIndex={10}
27
+ >
28
+ <Icon cursor="pointer"
29
+ icon="info"
30
+ size="xs"
31
+ />
32
+ </Tooltip>
33
+ </Flex>
34
+ ),
35
+ },
36
+ {
37
+ accessor: "scheduledMeetings",
38
+ label: "Scheduled Meetings",
39
+ },
40
+ {
41
+ accessor: "attendanceRate",
42
+ label: "Attendance Rate",
43
+ },
44
+ {
45
+ accessor: "completedClasses",
46
+ label: "Completed Classes",
47
+ },
48
+ {
49
+ accessor: "classCompletionRate",
50
+ label: "Class Completion Rate",
51
+ },
52
+ {
53
+ accessor: "graduatedStudents",
54
+ label: "Graduated Students",
55
+ },
56
+ ];
57
+
58
+ return (
59
+ <div>
60
+ <AdvancedTable
61
+ columnDefinitions={columnDefinitions}
62
+ tableData={MOCK_DATA}
63
+ {...props}
64
+ />
65
+ </div>
66
+ )
67
+ }
68
+
69
+ export default AdvancedTableWithCustomHeader
@@ -0,0 +1 @@
1
+ The optional `header` key/value pair can be used within `columnDefinitions` to render a custom header. This example shows an Icon and Tooltip being used but other kits can be used as well.
@@ -40,6 +40,7 @@ examples:
40
40
  - advanced_table_inline_row_loading: Inline Row Loading
41
41
  - advanced_table_responsive: Responsive Tables
42
42
  - advanced_table_custom_cell: Custom Components for Cells
43
+ - advanced_table_with_custom_header: Custom Header Cell
43
44
  - advanced_table_pagination: Pagination
44
45
  - advanced_table_pagination_with_props: Pagination Props
45
46
  - advanced_table_column_headers: Multi-Header Columns
@@ -38,3 +38,4 @@ export { default as AdvancedTableRowStyling } from './_advanced_table_row_stylin
38
38
  export { default as AdvancedTableColumnStyling } from './_advanced_table_column_styling.jsx'
39
39
  export { default as AdvancedTableColumnStylingColumnHeaders } from './_advanced_table_column_styling_column_headers.jsx'
40
40
  export { default as AdvancedTableInfiniteScroll} from './_advanced_table_infinite_scroll.jsx'
41
+ export {default as AdvancedTableWithCustomHeader} from './_advanced_table_with_custom_header.jsx'
@@ -275,7 +275,7 @@ const datePickerHelper = (config: DatePickerConfig, scrollContainer: string | HT
275
275
  picker.monthsDropdownContainer.value = picker.currentMonth
276
276
 
277
277
  /* Reset date picker to default value on form.reset() */
278
- if (defaultDate !== '' && defaultDate !== null && defaultDate !== undefined) {
278
+ if (defaultDate){
279
279
  picker.setDate(defaultDate)
280
280
  yearChangeHook(picker)
281
281
  }
@@ -1,4 +1,4 @@
1
- import{jsx as jsx$1,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useReducer,useEffect,useMemo,useContext,createElement,useRef,forwardRef,useState,useLayoutEffect,useCallback,useImperativeHandle,Component,Fragment as Fragment$1}from"react";import{g as getDefaultExportFromCjs,v as filter,w as omit,s as noop$2,u as useCollapsible,x as createPopper,y as uniqueId,z as get,A as flip$2,B as offset$2,C as shift$2,E as arrow$3,F as computePosition$1,G as createCoords$1,H as round$1,I as max$1,J as min$1,K as rectToClientRect$1,k as getAllIcons,t as colors$1,L as highchartsTheme,M as merge,N as highchartsDarkTheme,O as getAugmentedNamespace,Q as typography,S as cloneDeep,n as isEmpty$1,T as isString}from"./lib-BUnAetLK.js";import*as ReactDOM from"react-dom";import ReactDOM__default,{createPortal}from"react-dom";import{TrixEditor}from"react-trix";import Trix from"trix";import require$$0 from"react-is";const initialState={items:[],dragData:{id:"",initialGroup:""},isDragging:"",activeContainer:""};const reducer=(state,action)=>{switch(action.type){case"SET_ITEMS":return{...state,items:action.payload};case"SET_DRAG_DATA":return{...state,dragData:action.payload};case"SET_IS_DRAGGING":return{...state,isDragging:action.payload};case"SET_ACTIVE_CONTAINER":return{...state,activeContainer:action.payload};case"CHANGE_CATEGORY":return{...state,items:state.items.map((item=>item.id===action.payload.itemId?{...item,container:action.payload.container}:item))};case"REORDER_ITEMS":{const{dragId:dragId,targetId:targetId}=action.payload;const newItems=[...state.items];const draggedItem=newItems.find((item=>item.id===dragId));const draggedIndex=newItems.indexOf(draggedItem);const targetIndex=newItems.findIndex((item=>item.id===targetId));newItems.splice(draggedIndex,1);newItems.splice(targetIndex,0,draggedItem);return{...state,items:newItems}}default:return state}};const DragContext=createContext({});const DraggableContext=()=>useContext(DragContext);const DraggableProvider=({children:children,initialItems:initialItems,onReorder:onReorder,onDragStart:onDragStart,onDragEnter:onDragEnter,onDragEnd:onDragEnd,onDrop:onDrop,onDragOver:onDragOver,dropZone:dropZone={type:"ghost",color:"neutral",direction:"vertical"}})=>{const[state,dispatch]=useReducer(reducer,initialState);let dropZoneType="ghost";let dropZoneColor="neutral";let dropZoneDirection="vertical";if(typeof dropZone==="string"){dropZoneType=dropZone}else{dropZoneType=dropZone.type||"ghost";dropZoneColor=dropZone.type==="line"?dropZone.color||"primary":dropZone.color||"neutral";if(dropZoneType==="line"){dropZoneDirection=dropZone.direction||"vertical"}}useEffect((()=>{dispatch({type:"SET_ITEMS",payload:initialItems})}),[initialItems]);useEffect((()=>{onReorder(state.items)}),[state.items]);const handleDragStart=(id,container)=>{dispatch({type:"SET_DRAG_DATA",payload:{id:id,initialGroup:container}});dispatch({type:"SET_IS_DRAGGING",payload:id});if(onDragStart)onDragStart(id,container)};const handleDragEnter=(id,container)=>{if(state.dragData.id!==id){dispatch({type:"REORDER_ITEMS",payload:{dragId:state.dragData.id,targetId:id}});dispatch({type:"SET_DRAG_DATA",payload:{id:state.dragData.id,initialGroup:container}})}if(onDragEnter)onDragEnter(id,container)};const handleDragEnd=()=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});if(onDragEnd)onDragEnd()};const changeCategory=(itemId,container)=>{dispatch({type:"CHANGE_CATEGORY",payload:{itemId:itemId,container:container}})};const handleDrop=container=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});changeCategory(state.dragData.id,container);if(onDrop)onDrop(container)};const handleDragOver=(e,container)=>{e.preventDefault();dispatch({type:"SET_ACTIVE_CONTAINER",payload:container});if(onDragOver)onDragOver(e,container)};const contextValue=useMemo((()=>({items:state.items,dragData:state.dragData,isDragging:state.isDragging,activeContainer:state.activeContainer,dropZone:dropZoneType,dropZoneColor:dropZoneColor,...dropZoneType==="line"?{direction:dropZoneDirection}:{},handleDragStart:handleDragStart,handleDragEnter:handleDragEnter,handleDragEnd:handleDragEnd,handleDrop:handleDrop,handleDragOver:handleDragOver})),[state,dropZoneType,dropZoneColor,dropZoneDirection]);return jsx$1(DragContext.Provider,{value:contextValue,children:children})};var classnames$1={exports:{}};
1
+ import{jsx as jsx$1,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useReducer,useEffect,useMemo,useContext,createElement,useRef,forwardRef,useState,useLayoutEffect,useCallback,useImperativeHandle,Component,Fragment as Fragment$1}from"react";import{g as getDefaultExportFromCjs,v as filter,w as omit,s as noop$2,u as useCollapsible,x as createPopper,y as uniqueId,z as get,A as flip$2,B as offset$2,C as shift$2,E as arrow$3,F as computePosition$1,G as createCoords$1,H as round$1,I as max$1,J as min$1,K as rectToClientRect$1,k as getAllIcons,t as colors$1,L as highchartsTheme,M as merge,N as highchartsDarkTheme,O as getAugmentedNamespace,Q as typography,S as cloneDeep,n as isEmpty$1,T as isString}from"./lib-Carqm8Ip.js";import*as ReactDOM from"react-dom";import ReactDOM__default,{createPortal}from"react-dom";import{TrixEditor}from"react-trix";import Trix from"trix";import require$$0 from"react-is";const initialState={items:[],dragData:{id:"",initialGroup:""},isDragging:"",activeContainer:""};const reducer=(state,action)=>{switch(action.type){case"SET_ITEMS":return{...state,items:action.payload};case"SET_DRAG_DATA":return{...state,dragData:action.payload};case"SET_IS_DRAGGING":return{...state,isDragging:action.payload};case"SET_ACTIVE_CONTAINER":return{...state,activeContainer:action.payload};case"CHANGE_CATEGORY":return{...state,items:state.items.map((item=>item.id===action.payload.itemId?{...item,container:action.payload.container}:item))};case"REORDER_ITEMS":{const{dragId:dragId,targetId:targetId}=action.payload;const newItems=[...state.items];const draggedItem=newItems.find((item=>item.id===dragId));const draggedIndex=newItems.indexOf(draggedItem);const targetIndex=newItems.findIndex((item=>item.id===targetId));newItems.splice(draggedIndex,1);newItems.splice(targetIndex,0,draggedItem);return{...state,items:newItems}}default:return state}};const DragContext=createContext({});const DraggableContext=()=>useContext(DragContext);const DraggableProvider=({children:children,initialItems:initialItems,onReorder:onReorder,onDragStart:onDragStart,onDragEnter:onDragEnter,onDragEnd:onDragEnd,onDrop:onDrop,onDragOver:onDragOver,dropZone:dropZone={type:"ghost",color:"neutral",direction:"vertical"}})=>{const[state,dispatch]=useReducer(reducer,initialState);let dropZoneType="ghost";let dropZoneColor="neutral";let dropZoneDirection="vertical";if(typeof dropZone==="string"){dropZoneType=dropZone}else{dropZoneType=dropZone.type||"ghost";dropZoneColor=dropZone.type==="line"?dropZone.color||"primary":dropZone.color||"neutral";if(dropZoneType==="line"){dropZoneDirection=dropZone.direction||"vertical"}}useEffect((()=>{dispatch({type:"SET_ITEMS",payload:initialItems})}),[initialItems]);useEffect((()=>{onReorder(state.items)}),[state.items]);const handleDragStart=(id,container)=>{dispatch({type:"SET_DRAG_DATA",payload:{id:id,initialGroup:container}});dispatch({type:"SET_IS_DRAGGING",payload:id});if(onDragStart)onDragStart(id,container)};const handleDragEnter=(id,container)=>{if(state.dragData.id!==id){dispatch({type:"REORDER_ITEMS",payload:{dragId:state.dragData.id,targetId:id}});dispatch({type:"SET_DRAG_DATA",payload:{id:state.dragData.id,initialGroup:container}})}if(onDragEnter)onDragEnter(id,container)};const handleDragEnd=()=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});if(onDragEnd)onDragEnd()};const changeCategory=(itemId,container)=>{dispatch({type:"CHANGE_CATEGORY",payload:{itemId:itemId,container:container}})};const handleDrop=container=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});changeCategory(state.dragData.id,container);if(onDrop)onDrop(container)};const handleDragOver=(e,container)=>{e.preventDefault();dispatch({type:"SET_ACTIVE_CONTAINER",payload:container});if(onDragOver)onDragOver(e,container)};const contextValue=useMemo((()=>({items:state.items,dragData:state.dragData,isDragging:state.isDragging,activeContainer:state.activeContainer,dropZone:dropZoneType,dropZoneColor:dropZoneColor,...dropZoneType==="line"?{direction:dropZoneDirection}:{},handleDragStart:handleDragStart,handleDragEnter:handleDragEnter,handleDragEnd:handleDragEnd,handleDrop:handleDrop,handleDragOver:handleDragOver})),[state,dropZoneType,dropZoneColor,dropZoneDirection]);return jsx$1(DragContext.Provider,{value:contextValue,children:children})};var classnames$1={exports:{}};
2
2
  /*!
3
3
  Copyright (c) 2018 Jed Watson.
4
4
  Licensed under the MIT License (MIT), see