playbook_ui 15.3.0.pre.alpha.PLAY2565formkitsubmitfix11681 → 15.3.0.pre.alpha.PLAY260211773
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 +4 -4
- data/app/pb_kits/playbook/pb_advanced_table/Components/TableHeaderCell.tsx +3 -1
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableActions.ts +18 -3
- data/app/pb_kits/playbook/pb_advanced_table/Hooks/useTableState.ts +72 -14
- data/app/pb_kits/playbook/pb_advanced_table/SubKits/TableHeader.tsx +3 -0
- data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +12 -3
- data/app/pb_kits/playbook/pb_advanced_table/advanced_table.test.jsx +59 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.jsx +28 -0
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_inline_row_loading.md +11 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +4 -1
- data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +3 -2
- data/app/pb_kits/playbook/pb_advanced_table/docs/_mock_data_inline_loading_empty_children.js +42 -0
- data/app/pb_kits/playbook/pb_date_picker/sass_partials/_quick_pick_styles.scss +11 -30
- data/dist/chunks/{_line_graph-h5H-imfn.js → _line_graph-DdZxz7Mk.js} +1 -1
- data/dist/chunks/{_typeahead-U8AjZIIW.js → _typeahead-KEbTTXol.js} +1 -1
- data/dist/chunks/{_weekday_stacked-CbCUYuuZ.js → _weekday_stacked-uS4ALvGc.js} +2 -2
- data/dist/chunks/vendor.js +1 -1
- data/dist/playbook-doc.js +1 -1
- data/dist/playbook-rails-react-bindings.js +1 -1
- data/dist/playbook-rails.js +1 -1
- data/dist/playbook.css +1 -1
- data/lib/playbook/version.rb +1 -1
- metadata +6 -5
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 726cf539b5bde924b845f08e1881a6f9f4fa5e3c7688be607e88166f35dc9974
         | 
| 4 | 
            +
              data.tar.gz: a1b68b3ff4c39332a3a6eee2833863211675a1de5faf892e440f35fb23b54eba
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: 2f050d36d6fe2270f6cc72c74cfdfef0756e3bf82fa27f029c7d2ed39517868ed41ca17deef93e00236963c8432e4c878ff2e8a3bba4ca3e20998cc93b05ee82
         | 
| 7 | 
            +
              data.tar.gz: 1bc4774947204bcd9162c3ab12fc7254ccb90c5592b1c094175bb7b2f6ea26b52fefef39d65fa63ee68d8e966e8378a6cfa53ebaedee0239949ad5ee7dc02b95
         | 
| @@ -30,6 +30,7 @@ type TableHeaderCellProps = { | |
| 30 30 | 
             
              headerChildren?: React.ReactNode | React.ReactNode[]
         | 
| 31 31 | 
             
              isPinnedLeft?: boolean
         | 
| 32 32 | 
             
              loading?: boolean
         | 
| 33 | 
            +
              persistToggleExpansionButton?: boolean
         | 
| 33 34 | 
             
              sortIcon?: string | string[]
         | 
| 34 35 | 
             
              table?: Table<GenericObject>
         | 
| 35 36 | 
             
            } & GlobalProps
         | 
| @@ -58,6 +59,7 @@ export const TableHeaderCell = ({ | |
| 58 59 | 
             
                selectableRows,
         | 
| 59 60 | 
             
                hasAnySubRows,
         | 
| 60 61 | 
             
                showActionsBar,
         | 
| 62 | 
            +
                persistToggleExpansionButton,
         | 
| 61 63 | 
             
                stickyLeftColumn,
         | 
| 62 64 | 
             
                inlineRowLoading,
         | 
| 63 65 | 
             
                isActionBarVisible,
         | 
| @@ -220,7 +222,7 @@ const isToggleExpansionEnabled = | |
| 220 222 | 
             
                          />
         | 
| 221 223 | 
             
                        )
         | 
| 222 224 | 
             
                      }
         | 
| 223 | 
            -
                      {isToggleExpansionEnabled && | 
| 225 | 
            +
                      {isToggleExpansionEnabled &&  ((hasAnySubRows) || (inlineRowLoading && persistToggleExpansionButton)) && !expandByDepth && (
         | 
| 224 226 | 
             
                          <ToggleIconButton onClick={handleExpandOrCollapse} />
         | 
| 225 227 | 
             
                        )}
         | 
| 226 228 | 
             
                      {isToggleExpansionEnabled && hasAnySubRows && expandByDepth && (
         | 
| @@ -9,6 +9,9 @@ interface UseTableActionsProps { | |
| 9 9 | 
             
              setExpanded: (expanded: GenericObject) => void;
         | 
| 10 10 | 
             
              onToggleExpansionClick?: (arg: Row<GenericObject>) => void;
         | 
| 11 11 | 
             
              onRowSelectionChange?: (rowSelection: any) => void;
         | 
| 12 | 
            +
              inlineRowLoading?: boolean;
         | 
| 13 | 
            +
              localPagination?: { pageIndex: number; pageSize: number };
         | 
| 14 | 
            +
              setLocalPagination?: (pagination: { pageIndex: number; pageSize: number }) => void;
         | 
| 12 15 | 
             
            }
         | 
| 13 16 |  | 
| 14 17 | 
             
            export function useTableActions({
         | 
| @@ -16,7 +19,10 @@ export function useTableActions({ | |
| 16 19 | 
             
              expanded,
         | 
| 17 20 | 
             
              setExpanded,
         | 
| 18 21 | 
             
              onToggleExpansionClick,
         | 
| 19 | 
            -
              onRowSelectionChange
         | 
| 22 | 
            +
              onRowSelectionChange,
         | 
| 23 | 
            +
              inlineRowLoading = false,
         | 
| 24 | 
            +
              localPagination,
         | 
| 25 | 
            +
              setLocalPagination
         | 
| 20 26 | 
             
            }: UseTableActionsProps) {
         | 
| 21 27 |  | 
| 22 28 | 
             
              // State to achieve 1 second delay before fetching more rows
         | 
| @@ -38,8 +44,17 @@ export function useTableActions({ | |
| 38 44 |  | 
| 39 45 | 
             
              // Handle pagination
         | 
| 40 46 | 
             
              const onPageChange = useCallback((page: number) => {
         | 
| 41 | 
            -
                 | 
| 42 | 
            -
             | 
| 47 | 
            +
                if (inlineRowLoading && setLocalPagination && localPagination) {
         | 
| 48 | 
            +
                  // Use manual pagination state for inlineRowLoading
         | 
| 49 | 
            +
                  setLocalPagination({
         | 
| 50 | 
            +
                    ...localPagination,
         | 
| 51 | 
            +
                    pageIndex: page - 1
         | 
| 52 | 
            +
                  });
         | 
| 53 | 
            +
                } else {
         | 
| 54 | 
            +
                  // Use tanstack's built-in pagination
         | 
| 55 | 
            +
                  table.setPageIndex(page - 1);
         | 
| 56 | 
            +
                }
         | 
| 57 | 
            +
              }, [table, inlineRowLoading, setLocalPagination, localPagination]);
         | 
| 43 58 |  | 
| 44 59 | 
             
              // Handle scroll detection for infinite scroll/virtualization
         | 
| 45 60 | 
             
              const fetchMoreOnBottomReached = useCallback((
         | 
| @@ -12,6 +12,7 @@ import { | |
| 12 12 | 
             
            import { GenericObject } from "../../types";
         | 
| 13 13 | 
             
            import { createColumnHelper } from "@tanstack/react-table";
         | 
| 14 14 | 
             
            import { createCellFunction } from "../Utilities/CellRendererUtils";
         | 
| 15 | 
            +
            import { inline } from '@floating-ui/react';
         | 
| 15 16 |  | 
| 16 17 | 
             
            interface UseTableStateProps {
         | 
| 17 18 | 
             
              tableData: GenericObject[];
         | 
| @@ -35,6 +36,7 @@ interface UseTableStateProps { | |
| 35 36 | 
             
              onRowSelectionChange?: (arg: RowSelectionState) => void;
         | 
| 36 37 | 
             
              columnVisibilityControl?: GenericObject;
         | 
| 37 38 | 
             
              rowStyling?: GenericObject;
         | 
| 39 | 
            +
              inlineRowLoading?: boolean;
         | 
| 38 40 | 
             
            }
         | 
| 39 41 |  | 
| 40 42 | 
             
            export function useTableState({
         | 
| @@ -53,7 +55,8 @@ export function useTableState({ | |
| 53 55 | 
             
              tableOptions,
         | 
| 54 56 | 
             
              columnVisibilityControl,
         | 
| 55 57 | 
             
              pinnedRows,
         | 
| 56 | 
            -
              rowStyling
         | 
| 58 | 
            +
              rowStyling,
         | 
| 59 | 
            +
              inlineRowLoading = false
         | 
| 57 60 | 
             
            }: UseTableStateProps) {
         | 
| 58 61 |  | 
| 59 62 | 
             
              // Create a local state for expanded and setExpanded if expandedControl not used
         | 
| @@ -64,6 +67,12 @@ export function useTableState({ | |
| 64 67 | 
             
              const [localRowPinning, setLocalRowPinning] = useState<RowPinningState>({
         | 
| 65 68 | 
             
                top: [],
         | 
| 66 69 | 
             
              });
         | 
| 70 | 
            +
              // Manage local state to preserve current page index when inlineRowLoading is enabled so it does not boot table to page 1
         | 
| 71 | 
            +
              // We can extend this for more usecases, but for now scoping it only for inlineRowLoading
         | 
| 72 | 
            +
              const [localPagination, setLocalPagination] = useState({
         | 
| 73 | 
            +
                pageIndex: paginationProps?.pageIndex ?? 0, 
         | 
| 74 | 
            +
                pageSize: paginationProps?.pageSize ?? 20,
         | 
| 75 | 
            +
              });
         | 
| 67 76 | 
             
              // Determine whether to use the prop or the local state
         | 
| 68 77 | 
             
              const expanded = expandedControl ? expandedControl.value : localExpanded;
         | 
| 69 78 | 
             
              const setExpanded = expandedControl ? expandedControl.onChange : setLocalExpanded;
         | 
| @@ -133,6 +142,7 @@ export function useTableState({ | |
| 133 142 | 
             
                  ...(selectableRows  && { rowSelection }),
         | 
| 134 143 | 
             
                  ...(columnVisibility && { columnVisibility }),
         | 
| 135 144 | 
             
                  ...(pinnedRows && { rowPinning }),
         | 
| 145 | 
            +
                  ...(inlineRowLoading && { pagination: localPagination }),
         | 
| 136 146 | 
             
                },
         | 
| 137 147 | 
             
              }), [
         | 
| 138 148 | 
             
                expanded,
         | 
| @@ -142,23 +152,36 @@ export function useTableState({ | |
| 142 152 | 
             
                rowSelection,
         | 
| 143 153 | 
             
                columnVisibility,
         | 
| 144 154 | 
             
                rowPinning,
         | 
| 155 | 
            +
                inlineRowLoading,
         | 
| 156 | 
            +
                localPagination
         | 
| 145 157 | 
             
              ]);
         | 
| 146 158 |  | 
| 147 159 | 
             
              // Pagination configuration
         | 
| 148 160 | 
             
              const paginationInitializer = useMemo(() => {
         | 
| 149 161 | 
             
                if (!pagination) return {};
         | 
| 150 162 |  | 
| 151 | 
            -
                 | 
| 152 | 
            -
                   | 
| 153 | 
            -
                   | 
| 154 | 
            -
             | 
| 155 | 
            -
                     | 
| 156 | 
            -
             | 
| 157 | 
            -
             | 
| 163 | 
            +
                if (inlineRowLoading) {
         | 
| 164 | 
            +
                  // Use manual pagination state when inlineRowLoading is enabled (see https://tanstack.com/table/latest/docs/guide/pagination#client-side-pagination)
         | 
| 165 | 
            +
                  return {
         | 
| 166 | 
            +
                    getPaginationRowModel: getPaginationRowModel(),
         | 
| 167 | 
            +
                    paginateExpandedRows: false,
         | 
| 168 | 
            +
                    onPaginationChange: setLocalPagination,
         | 
| 169 | 
            +
                    autoResetPageIndex: false, // This is what prevent auto-reset of page index
         | 
| 170 | 
            +
                  };
         | 
| 171 | 
            +
                } else {
         | 
| 172 | 
            +
                  // Use normal pagination initialization for non- inlineRowLoading usecases
         | 
| 173 | 
            +
                  return {
         | 
| 174 | 
            +
                    getPaginationRowModel: getPaginationRowModel(),
         | 
| 175 | 
            +
                    paginateExpandedRows: false,
         | 
| 176 | 
            +
                    initialState: {
         | 
| 177 | 
            +
                      pagination: {
         | 
| 178 | 
            +
                        pageIndex: paginationProps?.pageIndex ?? 0,
         | 
| 179 | 
            +
                        pageSize: paginationProps?.pageSize ?? 20,
         | 
| 180 | 
            +
                      },
         | 
| 158 181 | 
             
                    },
         | 
| 159 | 
            -
                  } | 
| 160 | 
            -
                } | 
| 161 | 
            -
              }, [pagination, paginationProps]);
         | 
| 182 | 
            +
                  };
         | 
| 183 | 
            +
                }
         | 
| 184 | 
            +
              }, [pagination, paginationProps, inlineRowLoading]);
         | 
| 162 185 |  | 
| 163 186 | 
             
              // Initialize the table
         | 
| 164 187 | 
             
              const table = useReactTable({
         | 
| @@ -206,9 +229,42 @@ export function useTableState({ | |
| 206 229 | 
             
              // Set pagination state when pagination is enabled
         | 
| 207 230 | 
             
              useEffect(() => {
         | 
| 208 231 | 
             
                if (pagination && paginationProps?.pageSize) {
         | 
| 209 | 
            -
                   | 
| 232 | 
            +
                  if (inlineRowLoading) {
         | 
| 233 | 
            +
                    // Update local pagination state for inlineRowLoading
         | 
| 234 | 
            +
                    setLocalPagination(prev => ({
         | 
| 235 | 
            +
                      ...prev,
         | 
| 236 | 
            +
                      pageSize: paginationProps.pageSize
         | 
| 237 | 
            +
                    }));
         | 
| 238 | 
            +
                  } else {
         | 
| 239 | 
            +
                    table.setPageSize(paginationProps.pageSize);
         | 
| 240 | 
            +
                  }
         | 
| 241 | 
            +
                }
         | 
| 242 | 
            +
              }, [pagination, paginationProps?.pageSize, table, inlineRowLoading]);
         | 
| 243 | 
            +
             | 
| 244 | 
            +
              // Update local pagination when paginationProps change and inlineRowLoading is enabled
         | 
| 245 | 
            +
              useEffect(() => {
         | 
| 246 | 
            +
                if (pagination && inlineRowLoading && paginationProps) {
         | 
| 247 | 
            +
                  setLocalPagination({
         | 
| 248 | 
            +
                    pageIndex: paginationProps.pageIndex ?? localPagination.pageIndex,
         | 
| 249 | 
            +
                    pageSize: paginationProps.pageSize ?? localPagination.pageSize,
         | 
| 250 | 
            +
                  });
         | 
| 251 | 
            +
                }
         | 
| 252 | 
            +
              }, [pagination, inlineRowLoading, paginationProps?.pageIndex, paginationProps?.pageSize]);
         | 
| 253 | 
            +
             | 
| 254 | 
            +
              // Call the callback with the new page index when localPagination.pageIndex changes (for inlineRowLoading)
         | 
| 255 | 
            +
              useEffect(() => {
         | 
| 256 | 
            +
                if (pagination && inlineRowLoading && paginationProps) {
         | 
| 257 | 
            +
                  paginationProps.onPageChange(localPagination.pageIndex);
         | 
| 258 | 
            +
                }
         | 
| 259 | 
            +
              }, [localPagination.pageIndex, pagination, inlineRowLoading, paginationProps]);
         | 
| 260 | 
            +
             | 
| 261 | 
            +
              // Call the callback with the new page index when table pagination state changes (for default pagination)
         | 
| 262 | 
            +
              useEffect(() => {
         | 
| 263 | 
            +
                if (pagination && !inlineRowLoading && paginationProps) {
         | 
| 264 | 
            +
                  const currentPageIndex = table.getState().pagination.pageIndex;
         | 
| 265 | 
            +
                  paginationProps.onPageChange(currentPageIndex);
         | 
| 210 266 | 
             
                }
         | 
| 211 | 
            -
              }, [pagination,  | 
| 267 | 
            +
              }, [table.getState().pagination.pageIndex, pagination, inlineRowLoading, paginationProps]);
         | 
| 212 268 |  | 
| 213 269 | 
             
              // Check if table has any sub-rows
         | 
| 214 270 | 
             
              const hasAnySubRows = table.getRowModel().rows.some(row => row.subRows && row.subRows.length > 0);
         | 
| @@ -247,6 +303,8 @@ export function useTableState({ | |
| 247 303 | 
             
                rowSelection,
         | 
| 248 304 | 
             
                fullData,
         | 
| 249 305 | 
             
                totalFetched,
         | 
| 250 | 
            -
                isFetching
         | 
| 306 | 
            +
                isFetching,
         | 
| 307 | 
            +
                localPagination,
         | 
| 308 | 
            +
                setLocalPagination
         | 
| 251 309 | 
             
              };
         | 
| 252 310 | 
             
            }
         | 
| @@ -39,6 +39,7 @@ export const TableHeader = ({ | |
| 39 39 | 
             
                hasAnySubRows,
         | 
| 40 40 | 
             
                showActionsBar,
         | 
| 41 41 | 
             
                selectableRows,
         | 
| 42 | 
            +
                persistToggleExpansionButton,
         | 
| 42 43 | 
             
                responsive,
         | 
| 43 44 | 
             
                headerRef,
         | 
| 44 45 | 
             
                virtualizedRows,
         | 
| @@ -92,6 +93,7 @@ export const TableHeader = ({ | |
| 92 93 | 
             
                              isPinnedLeft={isPinnedLeft}
         | 
| 93 94 | 
             
                              key={`${header.id}-header`}
         | 
| 94 95 | 
             
                              loading={loading}
         | 
| 96 | 
            +
                              persistToggleExpansionButton={persistToggleExpansionButton}
         | 
| 95 97 | 
             
                              sortIcon={sortIcon}
         | 
| 96 98 | 
             
                              table={table}
         | 
| 97 99 | 
             
                          />
         | 
| @@ -136,6 +138,7 @@ export const TableHeader = ({ | |
| 136 138 | 
             
                              isVirtualized
         | 
| 137 139 | 
             
                              key={`${header.id}-header-virtualized`}
         | 
| 138 140 | 
             
                              loading={loading}
         | 
| 141 | 
            +
                              persistToggleExpansionButton={persistToggleExpansionButton}
         | 
| 139 142 | 
             
                              sortIcon={sortIcon}
         | 
| 140 143 | 
             
                              table={table}
         | 
| 141 144 | 
             
                          />
         | 
| @@ -63,6 +63,7 @@ type AdvancedTableProps = { | |
| 63 63 | 
             
              scrollBarNone?: boolean,
         | 
| 64 64 | 
             
              selectableRows?: boolean,
         | 
| 65 65 | 
             
              showActionsBar?: boolean,
         | 
| 66 | 
            +
              persistToggleExpansionButton?: boolean,
         | 
| 66 67 | 
             
              sortControl?: GenericObject
         | 
| 67 68 | 
             
              tableData: GenericObject[]
         | 
| 68 69 | 
             
              tableOptions?: GenericObject
         | 
| @@ -109,6 +110,7 @@ const AdvancedTable = (props: AdvancedTableProps) => { | |
| 109 110 | 
             
                scrollBarNone= false,
         | 
| 110 111 | 
             
                showActionsBar = true,
         | 
| 111 112 | 
             
                selectableRows,
         | 
| 113 | 
            +
                persistToggleExpansionButton = false,
         | 
| 112 114 | 
             
                sortControl,
         | 
| 113 115 | 
             
                stickyLeftColumn,
         | 
| 114 116 | 
             
                tableData,
         | 
| @@ -134,7 +136,9 @@ const AdvancedTable = (props: AdvancedTableProps) => { | |
| 134 136 | 
             
                updateLoadingStateRowCount,
         | 
| 135 137 | 
             
                fullData,
         | 
| 136 138 | 
             
                totalFetched,
         | 
| 137 | 
            -
                isFetching
         | 
| 139 | 
            +
                isFetching,
         | 
| 140 | 
            +
                localPagination,
         | 
| 141 | 
            +
                setLocalPagination
         | 
| 138 142 | 
             
              } = useTableState({
         | 
| 139 143 | 
             
                tableData,
         | 
| 140 144 | 
             
                columnDefinitions,
         | 
| @@ -152,7 +156,8 @@ const AdvancedTable = (props: AdvancedTableProps) => { | |
| 152 156 | 
             
                onRowSelectionChange,
         | 
| 153 157 | 
             
                columnVisibilityControl,
         | 
| 154 158 | 
             
                pinnedRows,
         | 
| 155 | 
            -
                rowStyling
         | 
| 159 | 
            +
                rowStyling,
         | 
| 160 | 
            +
                inlineRowLoading
         | 
| 156 161 | 
             
              });
         | 
| 157 162 |  | 
| 158 163 | 
             
              // Initialize table actions
         | 
| @@ -165,7 +170,10 @@ const AdvancedTable = (props: AdvancedTableProps) => { | |
| 165 170 | 
             
                expanded,
         | 
| 166 171 | 
             
                setExpanded,
         | 
| 167 172 | 
             
                onToggleExpansionClick,
         | 
| 168 | 
            -
                onRowSelectionChange
         | 
| 173 | 
            +
                onRowSelectionChange,
         | 
| 174 | 
            +
                inlineRowLoading,
         | 
| 175 | 
            +
                localPagination,
         | 
| 176 | 
            +
                setLocalPagination
         | 
| 169 177 | 
             
              });
         | 
| 170 178 |  | 
| 171 179 | 
             
              // Set table row count for loading state
         | 
| @@ -349,6 +357,7 @@ const AdvancedTable = (props: AdvancedTableProps) => { | |
| 349 357 | 
             
                        loading={loading}
         | 
| 350 358 | 
             
                        onCustomSortClick={onCustomSortClick}
         | 
| 351 359 | 
             
                        onExpandByDepthClick={onExpandByDepthClick}
         | 
| 360 | 
            +
                        persistToggleExpansionButton={persistToggleExpansionButton}
         | 
| 352 361 | 
             
                        pinnedRows={pinnedRows}
         | 
| 353 362 | 
             
                        responsive={responsive}
         | 
| 354 363 | 
             
                        rowStyling={rowStyling}
         | 
| @@ -108,6 +108,48 @@ const MOCK_DATA_WITH_ID = [ | |
| 108 108 | 
             
              },
         | 
| 109 109 | 
             
            ]
         | 
| 110 110 |  | 
| 111 | 
            +
            const MOCK_DATA_NO_SUBROWS = [
         | 
| 112 | 
            +
              {
         | 
| 113 | 
            +
                year: "2021",
         | 
| 114 | 
            +
                quarter: null,
         | 
| 115 | 
            +
                month: null,
         | 
| 116 | 
            +
                day: null,
         | 
| 117 | 
            +
                newEnrollments: "20",
         | 
| 118 | 
            +
                scheduledMeetings: "10",
         | 
| 119 | 
            +
                attendanceRate: "51%",
         | 
| 120 | 
            +
                completedClasses: "3",
         | 
| 121 | 
            +
                classCompletionRate: "33%",
         | 
| 122 | 
            +
                graduatedStudents: "19",
         | 
| 123 | 
            +
                children: [],
         | 
| 124 | 
            +
              },
         | 
| 125 | 
            +
              {
         | 
| 126 | 
            +
                year: "2022",
         | 
| 127 | 
            +
                quarter: null,
         | 
| 128 | 
            +
                month: null,
         | 
| 129 | 
            +
                day: null,
         | 
| 130 | 
            +
                newEnrollments: "25",
         | 
| 131 | 
            +
                scheduledMeetings: "17",
         | 
| 132 | 
            +
                attendanceRate: "75%",
         | 
| 133 | 
            +
                completedClasses: "5",
         | 
| 134 | 
            +
                classCompletionRate: "45%",
         | 
| 135 | 
            +
                graduatedStudents: "32",
         | 
| 136 | 
            +
                children: [],
         | 
| 137 | 
            +
              },
         | 
| 138 | 
            +
              {
         | 
| 139 | 
            +
                year: "2023",
         | 
| 140 | 
            +
                quarter: null,
         | 
| 141 | 
            +
                month: null,
         | 
| 142 | 
            +
                day: null,
         | 
| 143 | 
            +
                newEnrollments: "30",
         | 
| 144 | 
            +
                scheduledMeetings: "22",
         | 
| 145 | 
            +
                attendanceRate: "80%",
         | 
| 146 | 
            +
                completedClasses: "7",
         | 
| 147 | 
            +
                classCompletionRate: "55%",
         | 
| 148 | 
            +
                graduatedStudents: "45",
         | 
| 149 | 
            +
                children: [],
         | 
| 150 | 
            +
              },
         | 
| 151 | 
            +
            ]
         | 
| 152 | 
            +
             | 
| 111 153 | 
             
            const columnDefinitions = [
         | 
| 112 154 | 
             
              {
         | 
| 113 155 | 
             
                accessor: "year",
         | 
| @@ -509,6 +551,23 @@ test("inlineRowLoading prop renders inline loading if true", () => { | |
| 509 551 | 
             
              expect(inlineLoading).toBeInTheDocument()
         | 
| 510 552 | 
             
            })
         | 
| 511 553 |  | 
| 554 | 
            +
            test("persistToggleExpansionButton prop shows header toggle when inlineRowLoading is true", () => {
         | 
| 555 | 
            +
              render(
         | 
| 556 | 
            +
                <AdvancedTable
         | 
| 557 | 
            +
                    columnDefinitions={columnDefinitions}
         | 
| 558 | 
            +
                    data={{ testid: testId }}
         | 
| 559 | 
            +
                    enableToggleExpansion="all"
         | 
| 560 | 
            +
                    inlineRowLoading
         | 
| 561 | 
            +
                    persistToggleExpansionButton
         | 
| 562 | 
            +
                    tableData={MOCK_DATA_NO_SUBROWS}
         | 
| 563 | 
            +
                />
         | 
| 564 | 
            +
              )
         | 
| 565 | 
            +
             | 
| 566 | 
            +
              const kit = screen.getByTestId(testId)
         | 
| 567 | 
            +
              const headerToggleButton = kit.querySelector(".gray-icon.toggle-all-icon")
         | 
| 568 | 
            +
              expect(headerToggleButton).toBeInTheDocument()
         | 
| 569 | 
            +
            })
         | 
| 570 | 
            +
             | 
| 512 571 | 
             
            test("responsive prop functions as expected", () => {
         | 
| 513 572 | 
             
              render(
         | 
| 514 573 | 
             
                <AdvancedTable
         | 
| @@ -1,6 +1,8 @@ | |
| 1 1 | 
             
            import React from "react"
         | 
| 2 2 | 
             
            import AdvancedTable from '../../pb_advanced_table/_advanced_table'
         | 
| 3 | 
            +
            import Caption from '../../pb_caption/_caption'
         | 
| 3 4 | 
             
            import { MOCK_DATA_INLINE_LOADING } from "./_mock_data_inline_loading"
         | 
| 5 | 
            +
            import { MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN } from "./_mock_data_inline_loading_empty_children"
         | 
| 4 6 |  | 
| 5 7 | 
             
            const AdvancedTableInlineRowLoading = (props) => {
         | 
| 6 8 | 
             
              const columnDefinitions = [
         | 
| @@ -41,16 +43,42 @@ const AdvancedTableInlineRowLoading = (props) => { | |
| 41 43 |  | 
| 42 44 | 
             
              return (
         | 
| 43 45 | 
             
                <div>
         | 
| 46 | 
            +
                  <Caption text="Inline Row Loading - Demonstrated in Row 1 (Rows 2 and 3 have data)" />
         | 
| 44 47 | 
             
                  <AdvancedTable
         | 
| 45 48 | 
             
                      columnDefinitions={columnDefinitions}
         | 
| 46 49 | 
             
                      enableToggleExpansion="all"
         | 
| 47 50 | 
             
                      inlineRowLoading
         | 
| 51 | 
            +
                      marginBottom="md"
         | 
| 48 52 | 
             
                      tableData={MOCK_DATA_INLINE_LOADING}
         | 
| 49 53 | 
             
                      {...props}
         | 
| 50 54 | 
             
                  >
         | 
| 51 55 | 
             
                    <AdvancedTable.Header />
         | 
| 52 56 | 
             
                    <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
         | 
| 53 57 | 
             
                  </AdvancedTable>
         | 
| 58 | 
            +
                  <Caption text="Inline Row Loading with No Subrow Data - All Rows Display Inline Row Loading and the Toggle All Button is not rendered" />
         | 
| 59 | 
            +
                  <AdvancedTable
         | 
| 60 | 
            +
                      columnDefinitions={columnDefinitions}
         | 
| 61 | 
            +
                      enableToggleExpansion="all"
         | 
| 62 | 
            +
                      inlineRowLoading
         | 
| 63 | 
            +
                      marginBottom="md"
         | 
| 64 | 
            +
                      tableData={MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN}
         | 
| 65 | 
            +
                      {...props}
         | 
| 66 | 
            +
                  >
         | 
| 67 | 
            +
                    <AdvancedTable.Header />
         | 
| 68 | 
            +
                    <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
         | 
| 69 | 
            +
                  </AdvancedTable>
         | 
| 70 | 
            +
                  <Caption text="Inline Row Loading and Persist Toggle Expansion Button with No Subrow Data - All Rows Display Inline Row Loading and the Toggle All Button is rendered" />
         | 
| 71 | 
            +
                  <AdvancedTable
         | 
| 72 | 
            +
                      columnDefinitions={columnDefinitions}
         | 
| 73 | 
            +
                      enableToggleExpansion="all"
         | 
| 74 | 
            +
                      inlineRowLoading
         | 
| 75 | 
            +
                      persistToggleExpansionButton
         | 
| 76 | 
            +
                      tableData={MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN}
         | 
| 77 | 
            +
                      {...props}
         | 
| 78 | 
            +
                  >
         | 
| 79 | 
            +
                    <AdvancedTable.Header />
         | 
| 80 | 
            +
                    <AdvancedTable.Body subRowHeaders={subRowHeaders}/>
         | 
| 81 | 
            +
                  </AdvancedTable>
         | 
| 54 82 | 
             
                </div>
         | 
| 55 83 | 
             
              )
         | 
| 56 84 | 
             
            }
         | 
| @@ -1,5 +1,14 @@ | |
| 1 | 
            +
            ### inlineRowLoading
         | 
| 1 2 | 
             
            As a default, the kit assumes that the initial dataset is complete, and it renders all expansion buttons/controls based on that data; if no children are present, no expansion controls are rendered. If, however, you want to change the initial dataset to omit some or all of its children (to improve load times of a complex dataset, perhaps), and you implement a querying logic that loads children only when its parent is expanded, then you must use the `inlineRowLoading` prop to ensure your expansion controls are rendered even though your child data is not yet loaded. You must also pass an empty `children` array to any node that will have children to ensure its parent maintains its ability to expand. If this prop is called AND your data contains empty `children` arrays, the kit will render expansion controls on any row with empty children, and then add an inline loading state within the expanded subrow until those child row(s) are returned to the page [by your query logic].
         | 
| 2 3 |  | 
| 3 | 
            -
            In this code example, 2021 has an empty children array. Toggle it open to see the inline loading state. Once the correct data loads, this state will be replaced with the correct data rows. 
         | 
| 4 | 
            +
            In the first Advanced Table in this code example, 2021 has an empty children array. Toggle it open to see the inline loading state. Once the correct data loads, this state will be replaced with the correct data rows. 
         | 
| 4 5 |  | 
| 5 | 
            -
            This prop is set to `false` by default. 
         | 
| 6 | 
            +
            This prop is set to `false` by default. 
         | 
| 7 | 
            +
             | 
| 8 | 
            +
             | 
| 9 | 
            +
            ### persistToggleExpansion
         | 
| 10 | 
            +
            The `persistToggleExpansionButton` is a boolean prop that renders the toggle-all icon in the top left header cell for complex datasets with empty `children` arrays and advanced querying logic explained in the preceeding doc example. Your logic may require an additional query helper file to update data specifically from requerying via toggle all buttons.
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            In the second and third Advanced Tables in this code example, all 3 rows have empty children arrays. The second Advanced Table demonstrates that the toggle all button does not render (prior to an initial row expansion) without `persistToggleExpansionButton` in place. The third Advanced Table shows the toggle all button due to `persistToggleExpansionButton`. 
         | 
| 13 | 
            +
             | 
| 14 | 
            +
            This prop is set to false by default and should only be used in conjunction with `inlineRowLoading`.
         | 
| @@ -1,5 +1,6 @@ | |
| 1 | 
            -
            `paginationProps` is an optional prop that can be used to further customize pagination for the AdvancedTable. This prop is an object with  | 
| 1 | 
            +
            `paginationProps` is an optional prop that can be used to further customize pagination for the AdvancedTable. This prop is an object with the following optional items:
         | 
| 2 2 |  | 
| 3 3 | 
             
            - `pageIndex`: An optional prop to set which page is set to open on initial load. Default is '0'
         | 
| 4 4 | 
             
            - `pageSize`: An optional prop to set total number of rows for each page before the Table paginates. Default is '20'
         | 
| 5 | 
            -
            - `range`: The range prop determines how many pages to display in the Pagination component. Regardless of this value, the first two and last two pages are always visible to facilitate navigation to the beginning and end of the pagination. If these always-visible pages fall within the specified range, they are included in the display. If they fall outside the range, the pagination will show additional pages up to the number defined by the range prop. See [here for more details](https://playbook.powerapp.cloud/kits/pagination/react#default). Default is set to '5'
         | 
| 5 | 
            +
            - `range`: The range prop determines how many pages to display in the Pagination component. Regardless of this value, the first two and last two pages are always visible to facilitate navigation to the beginning and end of the pagination. If these always-visible pages fall within the specified range, they are included in the display. If they fall outside the range, the pagination will show additional pages up to the number defined by the range prop. See [here for more details](https://playbook.powerapp.cloud/kits/pagination/react#default). Default is set to '5'
         | 
| 6 | 
            +
            - `onPageChange`: A callback function that gives to access to the current page index.
         | 
| @@ -0,0 +1,42 @@ | |
| 1 | 
            +
            export const MOCK_DATA_INLINE_LOADING_EMPTY_CHILDREN = [
         | 
| 2 | 
            +
                {
         | 
| 3 | 
            +
                  year: "2021",
         | 
| 4 | 
            +
                  quarter: null,
         | 
| 5 | 
            +
                  month: null,
         | 
| 6 | 
            +
                  day: null,
         | 
| 7 | 
            +
                  newEnrollments: "20",
         | 
| 8 | 
            +
                  scheduledMeetings: "10",
         | 
| 9 | 
            +
                  attendanceRate: "51%",
         | 
| 10 | 
            +
                  completedClasses: "3",
         | 
| 11 | 
            +
                  classCompletionRate: "33%",
         | 
| 12 | 
            +
                  graduatedStudents: "19",
         | 
| 13 | 
            +
                  children: [],
         | 
| 14 | 
            +
                },
         | 
| 15 | 
            +
                {
         | 
| 16 | 
            +
                  year: "2022",
         | 
| 17 | 
            +
                  quarter: null,
         | 
| 18 | 
            +
                  month: null,
         | 
| 19 | 
            +
                  day: null,
         | 
| 20 | 
            +
                  newEnrollments: "25",
         | 
| 21 | 
            +
                  scheduledMeetings: "17",
         | 
| 22 | 
            +
                  attendanceRate: "75%",
         | 
| 23 | 
            +
                  completedClasses: "5",
         | 
| 24 | 
            +
                  classCompletionRate: "45%",
         | 
| 25 | 
            +
                  graduatedStudents: "32",
         | 
| 26 | 
            +
                  children: [],
         | 
| 27 | 
            +
                },
         | 
| 28 | 
            +
                {
         | 
| 29 | 
            +
                  year: "2023",
         | 
| 30 | 
            +
                  quarter: null,
         | 
| 31 | 
            +
                  month: null,
         | 
| 32 | 
            +
                  day: null,
         | 
| 33 | 
            +
                  newEnrollments: "10",
         | 
| 34 | 
            +
                  scheduledMeetings: "15",
         | 
| 35 | 
            +
                  attendanceRate: "65%",
         | 
| 36 | 
            +
                  completedClasses: "4",
         | 
| 37 | 
            +
                  classCompletionRate: "49%",
         | 
| 38 | 
            +
                  graduatedStudents: "29",
         | 
| 39 | 
            +
                  children: [],
         | 
| 40 | 
            +
                },
         | 
| 41 | 
            +
              ]
         | 
| 42 | 
            +
              
         | 
| @@ -9,29 +9,20 @@ $pb_card_border_radius: $border_rad_heavier; | |
| 9 9 |  | 
| 10 10 | 
             
            // used to display dropdown on the left of the calender
         | 
| 11 11 | 
             
            .quick-pick-drop-down {
         | 
| 12 | 
            -
              width:  | 
| 13 | 
            -
              display: grid;
         | 
| 12 | 
            +
              width: 100%;
         | 
| 14 13 | 
             
            }
         | 
| 15 14 |  | 
| 16 15 | 
             
            .quick-pick-ul {
         | 
| 17 | 
            -
              padding: $space_xs 0px;
         | 
| 18 16 | 
             
              margin: 0;
         | 
| 19 17 | 
             
              list-style: none;
         | 
| 20 18 | 
             
            }
         | 
| 21 19 |  | 
| 22 20 | 
             
            .nav-item {
         | 
| 23 21 | 
             
              list-style: none;
         | 
| 24 | 
            -
              border-radius: 6px;
         | 
| 25 | 
            -
              border-bottom: 0;
         | 
| 26 | 
            -
              margin: $space_xs $space_sm;
         | 
| 27 22 | 
             
            }
         | 
| 28 23 |  | 
| 29 24 | 
             
            .nav-item-link {
         | 
| 30 25 | 
             
              text-decoration: none;
         | 
| 31 | 
            -
              border-width: $pb_card_border_width;
         | 
| 32 | 
            -
              border-style: solid;
         | 
| 33 | 
            -
              border-color: $border_light;
         | 
| 34 | 
            -
              border-radius: $pb_card_border_radius;
         | 
| 35 26 | 
             
              padding: $space_xs 14px;
         | 
| 36 27 | 
             
              transition-property: color, background-color;
         | 
| 37 28 | 
             
              transition-duration: 0.15s;
         | 
| @@ -40,15 +31,21 @@ $pb_card_border_radius: $border_rad_heavier; | |
| 40 31 | 
             
              color: $charcoal;
         | 
| 41 32 | 
             
              font-size: $font_default;
         | 
| 42 33 | 
             
              font-weight: $regular;
         | 
| 34 | 
            +
              text-align: left;
         | 
| 35 | 
            +
              border-bottom: 1px solid $border_light;
         | 
| 43 36 | 
             
              &.active {
         | 
| 44 | 
            -
                 | 
| 45 | 
            -
                 | 
| 37 | 
            +
                color: $white;
         | 
| 38 | 
            +
                background-color: $primary;
         | 
| 39 | 
            +
                &:hover {
         | 
| 40 | 
            +
                  background-color: $product_1_background;
         | 
| 41 | 
            +
                  color: $white;
         | 
| 42 | 
            +
                }
         | 
| 46 43 | 
             
              }
         | 
| 47 44 | 
             
              @media (hover:hover) {
         | 
| 48 45 | 
             
                &:hover {
         | 
| 49 46 | 
             
                  cursor: pointer;
         | 
| 50 | 
            -
                   | 
| 51 | 
            -
                   | 
| 47 | 
            +
                  background-color: $bg_light;
         | 
| 48 | 
            +
                  color: $primary;
         | 
| 52 49 | 
             
                }
         | 
| 53 50 | 
             
              }
         | 
| 54 51 | 
             
            }
         | 
| @@ -57,19 +54,3 @@ $pb_card_border_radius: $border_rad_heavier; | |
| 57 54 | 
             
            .quick-pick-drop-down > .flatpickr-months, .quick-pick-drop-down > .flatpickr-innerContainer {
         | 
| 58 55 | 
             
              display: none;
         | 
| 59 56 | 
             
            }
         | 
| 60 | 
            -
             | 
| 61 | 
            -
            @media only screen and (max-width: 767px) {
         | 
| 62 | 
            -
              .quick-pick-ul {
         | 
| 63 | 
            -
                padding: $space_xs $space_xs;
         | 
| 64 | 
            -
                display: grid;
         | 
| 65 | 
            -
                grid-template-columns: 1fr 1fr;
         | 
| 66 | 
            -
              }
         | 
| 67 | 
            -
             | 
| 68 | 
            -
              .nav-item {
         | 
| 69 | 
            -
                margin: $space_xxs $space_xs;
         | 
| 70 | 
            -
              }
         | 
| 71 | 
            -
             | 
| 72 | 
            -
              .nav-item-link {
         | 
| 73 | 
            -
                padding: $space_xs $space_xxs;
         | 
| 74 | 
            -
              }
         | 
| 75 | 
            -
            }
         | 
| @@ -1 +1 @@ | |
| 1 | 
            -
            import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{f as buildAriaProps,g as buildDataProps,h as buildHtmlProps,H as HighchartsReact,i as Highcharts,j as classnames,k as globalProps,l as HighchartsMore,S as SolidGauge,m as buildCss}from"./_typeahead-U8AjZIIW.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-CGxXTQ75.js";const mapColors=array=>{const regex=/(data)\-[1-8]/;const newArray=array.map((item=>regex.test(item)?`${colors[`data_${item[item.length-1]}`]}`:item));return newArray};const BarGraph=({aria:aria={},data:data={},align:align="center",axisTitle:axisTitle,dark:dark=false,chartData:chartData,className:className="pb_bar_graph",colors:colors2,htmlOptions:htmlOptions={},customOptions:customOptions={},axisFormat:axisFormat,id:id,pointStart:pointStart,stacking:stacking,subTitle:subTitle,type:type="column",title:title="Title",xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,legend:legend=false,toggleLegendClick:toggleLegendClick=true,height:height,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:[{labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat&&axisFormat[0]?axisFormat[0].format:""},min:yAxisMin,max:yAxisMax,opposite:false,title:{text:Array.isArray(axisTitle)?axisTitle.length>0?axisTitle[0].name:null:axisTitle},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]}],xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{stacking:stacking,pointStart:pointStart,borderWidth:stacking?0:"",events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(Array.isArray(axisTitle)&&axisTitle.length>1&&axisTitle[1].name){staticOptions.yAxis.push({labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat[1].format},min:yAxisMin,max:yAxisMax,opposite:true,title:{text:axisTitle[1].name},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]})}if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const alignBlockElement=event=>{const itemToMove=document.querySelector(`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`);const chartContainer=document.querySelector(`#${event.target.renderTo.id}`);if(itemToMove!==null&&chartContainer!==null){itemToMove.style.height=`${event.target.chartHeight}px`;itemToMove.style.width=`${event.target.chartWidth}px`;if(chartContainer.firstChild!==null){chartContainer.firstChild.before(itemToMove)}}};const CircleChart=({align:align="center",aria:aria={},rounded:rounded=false,borderColor:borderColor=(rounded?null:""),borderWidth:borderWidth=(rounded?20:null),chartData:chartData,children:children,className:className,colors:colors2=[],customOptions:customOptions={},dark:dark=false,data:data={},dataLabelHtml:dataLabelHtml="<div>{point.name}</div>",dataLabels:dataLabels=false,height:height,htmlOptions:htmlOptions={},id:id,innerSize:innerSize="md",legend:legend=false,maxPointSize:maxPointSize=null,minPointSize:minPointSize=null,startAngle:startAngle=null,style:style="pie",title:title,tooltipHtml:tooltipHtml,useHtml:useHtml=false,zMin:zMin=null,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{headerFormat:null,pointFormat:tooltipHtml?tooltipHtml:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',useHTML:useHtml}});const innerSizes={sm:"35%",md:"50%",lg:"85%",none:"0%"};const innerSizeFormat=size=>innerSizes[size];const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={title:{text:title},chart:{height:height,type:style,events:{render:event=>alignBlockElement(event),redraw:event=>alignBlockElement(event)}},legend:{align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},plotOptions:{pie:{colors:colors2.length>0?mapColors(colors2):highchartsTheme.colors,dataLabels:{enabled:dataLabels,connectorShape:"straight",connectorWidth:3,format:dataLabelHtml},showInLegend:legend}},series:[{minPointSize:minPointSize,maxPointSize:maxPointSize,innerSize:borderWidth==20?"100%":innerSizeFormat(innerSize),data:formattedChartData,zMin:zMin,startAngle:startAngle,borderWidth:borderWidth,borderColor:borderColor}],credits:false};setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(Fragment,{children:children?jsxs("div",{id:`wrapper-circle-chart-${id}`,children:[jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options}),jsx("div",{className:"pb-circle-chart-block",children:children})]}):jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})})};const Gauge=({aria:aria={},chartData:chartData,customOptions:customOptions={},dark:dark=false,data:data={},disableAnimation:disableAnimation=false,fullCircle:fullCircle=false,height:height=null,htmlOptions:htmlOptions={},id:id,max:max=100,min:min=0,prefix:prefix="",showLabels:showLabels=false,style:style="solidgauge",suffix:suffix="",title:title="",tooltipHtml:tooltipHtml='<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',colors:colors$1=[],minorTickInterval:minorTickInterval=null,circumference:circumference=(fullCircle?[0,360]:[-100,100]),...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);SolidGauge(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{pointFormat:tooltipHtml,followPointer:true}});const css=buildCss({pb_gauge_kit:true});const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={chart:{events:{load(){setTimeout(this.reflow.bind(this),0)}},type:style,height:height},title:{text:title},yAxis:{min:min,max:max,lineWidth:0,tickWidth:0,minorTickInterval:minorTickInterval,tickAmount:2,tickPositions:[min,max],labels:{y:26,enabled:showLabels}},credits:false,series:[{data:formattedChartData}],pane:{center:["50%","50%"],size:"90%",startAngle:circumference[0],endAngle:circumference[1],background:{borderWidth:20,innerRadius:"90%",outerRadius:"90%",shape:"arc",className:"gauge-pane"}},colors:colors$1!==void 0&&colors$1.length>0?mapColors(colors$1):highchartsTheme.colors,plotOptions:{series:{animation:!disableAnimation},solidgauge:{borderColor:colors$1!==void 0&&colors$1.length===1?mapColors(colors$1).join():highchartsTheme.colors[0],borderWidth:20,radius:90,innerRadius:"90%",dataLabels:{borderWidth:0,color:colors.text_lt_default,enabled:true,format:`<span class="prefix${dark?" dark":""}">${prefix}</span><span class="fix${dark?" dark":""}">{y:,f}</span><span class="suffix${dark?" dark":""}">${suffix}</span>`,style:{fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_2},y:-26}}}};setOptions(merge(staticOptions,customOptions));if(document.querySelector(".prefix")){document.querySelectorAll(".prefix").forEach((prefix2=>{prefix2.setAttribute("y","28")}));document.querySelectorAll(".fix").forEach((fix=>fix.setAttribute("y","38")))}}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(css,globalProps(props)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const LineGraph=({aria:aria={},data:data={},align:align="center",className:className="pb_bar_graph",customOptions:customOptions={},dark:dark=false,gradient:gradient=false,type:type="line",htmlOptions:htmlOptions={},id:id,legend:legend=false,toggleLegendClick:toggleLegendClick=true,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,axisTitle:axisTitle,xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,chartData:chartData,pointStart:pointStart,subTitle:subTitle,title:title,height:height,colors:colors2=[],...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:{min:yAxisMin,max:yAxisMax,title:{text:axisTitle}},xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{pointStart:pointStart,events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};export{BarGraph as B,CircleChart as C,Gauge as G,LineGraph as L};
         | 
| 1 | 
            +
            import{jsx,Fragment,jsxs}from"react/jsx-runtime";import{useState,useEffect}from"react";import{f as buildAriaProps,g as buildDataProps,h as buildHtmlProps,H as HighchartsReact,i as Highcharts,j as classnames,k as globalProps,l as HighchartsMore,S as SolidGauge,m as buildCss}from"./_typeahead-KEbTTXol.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-CGxXTQ75.js";const mapColors=array=>{const regex=/(data)\-[1-8]/;const newArray=array.map((item=>regex.test(item)?`${colors[`data_${item[item.length-1]}`]}`:item));return newArray};const BarGraph=({aria:aria={},data:data={},align:align="center",axisTitle:axisTitle,dark:dark=false,chartData:chartData,className:className="pb_bar_graph",colors:colors2,htmlOptions:htmlOptions={},customOptions:customOptions={},axisFormat:axisFormat,id:id,pointStart:pointStart,stacking:stacking,subTitle:subTitle,type:type="column",title:title="Title",xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,legend:legend=false,toggleLegendClick:toggleLegendClick=true,height:height,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:[{labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat&&axisFormat[0]?axisFormat[0].format:""},min:yAxisMin,max:yAxisMax,opposite:false,title:{text:Array.isArray(axisTitle)?axisTitle.length>0?axisTitle[0].name:null:axisTitle},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]}],xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{stacking:stacking,pointStart:pointStart,borderWidth:stacking?0:"",events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(Array.isArray(axisTitle)&&axisTitle.length>1&&axisTitle[1].name){staticOptions.yAxis.push({labels:{format:typeof axisFormat==="string"?axisFormat:axisFormat[1].format},min:yAxisMin,max:yAxisMax,opposite:true,title:{text:axisTitle[1].name},plotLines:typeof yAxisMin!=="undefined"&&yAxisMin!==null?[]:[{value:0,zIndex:10,color:"#E4E8F0"}]})}if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const alignBlockElement=event=>{const itemToMove=document.querySelector(`#wrapper-circle-chart-${event.target.renderTo.id} .pb-circle-chart-block`);const chartContainer=document.querySelector(`#${event.target.renderTo.id}`);if(itemToMove!==null&&chartContainer!==null){itemToMove.style.height=`${event.target.chartHeight}px`;itemToMove.style.width=`${event.target.chartWidth}px`;if(chartContainer.firstChild!==null){chartContainer.firstChild.before(itemToMove)}}};const CircleChart=({align:align="center",aria:aria={},rounded:rounded=false,borderColor:borderColor=(rounded?null:""),borderWidth:borderWidth=(rounded?20:null),chartData:chartData,children:children,className:className,colors:colors2=[],customOptions:customOptions={},dark:dark=false,data:data={},dataLabelHtml:dataLabelHtml="<div>{point.name}</div>",dataLabels:dataLabels=false,height:height,htmlOptions:htmlOptions={},id:id,innerSize:innerSize="md",legend:legend=false,maxPointSize:maxPointSize=null,minPointSize:minPointSize=null,startAngle:startAngle=null,style:style="pie",title:title,tooltipHtml:tooltipHtml,useHtml:useHtml=false,zMin:zMin=null,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{headerFormat:null,pointFormat:tooltipHtml?tooltipHtml:'<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',useHTML:useHtml}});const innerSizes={sm:"35%",md:"50%",lg:"85%",none:"0%"};const innerSizeFormat=size=>innerSizes[size];const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={title:{text:title},chart:{height:height,type:style,events:{render:event=>alignBlockElement(event),redraw:event=>alignBlockElement(event)}},legend:{align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},plotOptions:{pie:{colors:colors2.length>0?mapColors(colors2):highchartsTheme.colors,dataLabels:{enabled:dataLabels,connectorShape:"straight",connectorWidth:3,format:dataLabelHtml},showInLegend:legend}},series:[{minPointSize:minPointSize,maxPointSize:maxPointSize,innerSize:borderWidth==20?"100%":innerSizeFormat(innerSize),data:formattedChartData,zMin:zMin,startAngle:startAngle,borderWidth:borderWidth,borderColor:borderColor}],credits:false};setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(Fragment,{children:children?jsxs("div",{id:`wrapper-circle-chart-${id}`,children:[jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options}),jsx("div",{className:"pb-circle-chart-block",children:children})]}):jsx(HighchartsReact,{containerProps:{className:classnames("pb_circle_chart",globalProps(filteredProps)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})})};const Gauge=({aria:aria={},chartData:chartData,customOptions:customOptions={},dark:dark=false,data:data={},disableAnimation:disableAnimation=false,fullCircle:fullCircle=false,height:height=null,htmlOptions:htmlOptions={},id:id,max:max=100,min:min=0,prefix:prefix="",showLabels:showLabels=false,style:style="solidgauge",suffix:suffix="",title:title="",tooltipHtml:tooltipHtml='<span style="font-weight: bold; color:{point.color};">●</span>{point.name}: <b>{point.y}</b>',colors:colors$1=[],minorTickInterval:minorTickInterval=null,circumference:circumference=(fullCircle?[0,360]:[-100,100]),...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);HighchartsMore(Highcharts);SolidGauge(Highcharts);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();Highcharts.setOptions({tooltip:{pointFormat:tooltipHtml,followPointer:true}});const css=buildCss({pb_gauge_kit:true});const[options,setOptions]=useState({});useEffect((()=>{const formattedChartData=chartData.map((obj=>{obj.y=obj.value;delete obj.value;return obj}));const staticOptions={chart:{events:{load(){setTimeout(this.reflow.bind(this),0)}},type:style,height:height},title:{text:title},yAxis:{min:min,max:max,lineWidth:0,tickWidth:0,minorTickInterval:minorTickInterval,tickAmount:2,tickPositions:[min,max],labels:{y:26,enabled:showLabels}},credits:false,series:[{data:formattedChartData}],pane:{center:["50%","50%"],size:"90%",startAngle:circumference[0],endAngle:circumference[1],background:{borderWidth:20,innerRadius:"90%",outerRadius:"90%",shape:"arc",className:"gauge-pane"}},colors:colors$1!==void 0&&colors$1.length>0?mapColors(colors$1):highchartsTheme.colors,plotOptions:{series:{animation:!disableAnimation},solidgauge:{borderColor:colors$1!==void 0&&colors$1.length===1?mapColors(colors$1).join():highchartsTheme.colors[0],borderWidth:20,radius:90,innerRadius:"90%",dataLabels:{borderWidth:0,color:colors.text_lt_default,enabled:true,format:`<span class="prefix${dark?" dark":""}">${prefix}</span><span class="fix${dark?" dark":""}">{y:,f}</span><span class="suffix${dark?" dark":""}">${suffix}</span>`,style:{fontFamily:typography.font_family_base,fontWeight:typography.regular,fontSize:typography.heading_2},y:-26}}}};setOptions(merge(staticOptions,customOptions));if(document.querySelector(".prefix")){document.querySelectorAll(".prefix").forEach((prefix2=>{prefix2.setAttribute("y","28")}));document.querySelectorAll(".fix").forEach((fix=>fix.setAttribute("y","38")))}}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(css,globalProps(props)),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};const LineGraph=({aria:aria={},data:data={},align:align="center",className:className="pb_bar_graph",customOptions:customOptions={},dark:dark=false,gradient:gradient=false,type:type="line",htmlOptions:htmlOptions={},id:id,legend:legend=false,toggleLegendClick:toggleLegendClick=true,layout:layout="horizontal",verticalAlign:verticalAlign="bottom",x:x=0,y:y=0,axisTitle:axisTitle,xAxisCategories:xAxisCategories,yAxisMin:yAxisMin,yAxisMax:yAxisMax,chartData:chartData,pointStart:pointStart,subTitle:subTitle,title:title,height:height,colors:colors2=[],...props})=>{const ariaProps=buildAriaProps(aria);const dataProps=buildDataProps(data);const htmlProps=buildHtmlProps(htmlOptions);const setupTheme=()=>{dark?Highcharts.setOptions(highchartsDarkTheme):Highcharts.setOptions(highchartsTheme)};setupTheme();const staticOptions={title:{text:title},chart:{height:height,type:type},subtitle:{text:subTitle},yAxis:{min:yAxisMin,max:yAxisMax,title:{text:axisTitle}},xAxis:{categories:xAxisCategories},legend:{enabled:legend,align:align,verticalAlign:verticalAlign,layout:layout,x:x,y:y},colors:colors2!==void 0&&colors2.length>0?mapColors(colors2):highchartsTheme.colors,plotOptions:{series:{pointStart:pointStart,events:{},dataLabels:{enabled:false}}},series:chartData,credits:false};if(!toggleLegendClick){staticOptions.plotOptions.series.events={legendItemClick:()=>false}}const filteredProps={...props};delete filteredProps.verticalAlign;const[options,setOptions]=useState({});useEffect((()=>{setOptions(merge(staticOptions,customOptions))}),[chartData]);return jsx(HighchartsReact,{containerProps:{className:classnames(globalProps(filteredProps),className),id:id,...ariaProps,...dataProps,...htmlProps},highcharts:Highcharts,options:options})};export{BarGraph as B,CircleChart as C,Gauge as G,LineGraph as L};
         |