playbook_ui 15.3.0 → 15.4.0.pre.rc.0
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 +56 -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/_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/app/pb_kits/playbook/pb_form/docs/_form_form_with_loading.html.erb +1 -1
- data/app/pb_kits/playbook/pb_form/formHelper.js +1 -1
- data/dist/chunks/{_line_graph-0IiTB9gA.js → _line_graph-h5H-imfn.js} +1 -1
- data/dist/chunks/_typeahead-U8AjZIIW.js +6 -0
- data/dist/chunks/{_weekday_stacked-BZ7z8ukT.js → _weekday_stacked-c6_R08J-.js} +2 -2
- data/dist/chunks/{lib-izYrkvOQ.js → lib-CGxXTQ75.js} +2 -2
- data/dist/chunks/{pb_form_validation-Cah5Z5J3.js → pb_form_validation-DebqlUKZ.js} +1 -1
- 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 +2 -2
- metadata +8 -7
- data/dist/chunks/_typeahead-BvV7a9cR.js +0 -6
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA256:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: ffa062a1dee192ded6eb85e82b07ea7ded408162b2607216f8ca4efaf2025c01
         | 
| 4 | 
            +
              data.tar.gz: 8baba08f216168f75043aa15d1d44b7cfe5a4a7a3ede98d966a75fd586aa8c83
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: c95c2c0458e574f14a5bddb1ff5c3f487b52670718248b4f92c9ed49c1d00d5ca5075b9531d0d45ec2b3ca0b96023138cc24d01fbe1950d883d62bf748232f87
         | 
| 7 | 
            +
              data.tar.gz: 96dd7aa86bb80b87139d8625d2d1fafc4432064977bd86bcc07ffcd90d1c697c1fc3530ec688d0001a289810d1e92219111483d079fc1ad61d8fc942417a1113
         | 
| @@ -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((
         | 
| @@ -35,6 +35,7 @@ interface UseTableStateProps { | |
| 35 35 | 
             
              onRowSelectionChange?: (arg: RowSelectionState) => void;
         | 
| 36 36 | 
             
              columnVisibilityControl?: GenericObject;
         | 
| 37 37 | 
             
              rowStyling?: GenericObject;
         | 
| 38 | 
            +
              inlineRowLoading?: boolean;
         | 
| 38 39 | 
             
            }
         | 
| 39 40 |  | 
| 40 41 | 
             
            export function useTableState({
         | 
| @@ -53,7 +54,8 @@ export function useTableState({ | |
| 53 54 | 
             
              tableOptions,
         | 
| 54 55 | 
             
              columnVisibilityControl,
         | 
| 55 56 | 
             
              pinnedRows,
         | 
| 56 | 
            -
              rowStyling
         | 
| 57 | 
            +
              rowStyling,
         | 
| 58 | 
            +
              inlineRowLoading = false
         | 
| 57 59 | 
             
            }: UseTableStateProps) {
         | 
| 58 60 |  | 
| 59 61 | 
             
              // Create a local state for expanded and setExpanded if expandedControl not used
         | 
| @@ -64,6 +66,12 @@ export function useTableState({ | |
| 64 66 | 
             
              const [localRowPinning, setLocalRowPinning] = useState<RowPinningState>({
         | 
| 65 67 | 
             
                top: [],
         | 
| 66 68 | 
             
              });
         | 
| 69 | 
            +
              // Manage local state to preserve current page index when inlineRowLoading is enabled so it does not boot table to page 1
         | 
| 70 | 
            +
              // We can extend this for more usecases, but for now scoping it only for inlineRowLoading
         | 
| 71 | 
            +
              const [localPagination, setLocalPagination] = useState({
         | 
| 72 | 
            +
                pageIndex: paginationProps?.pageIndex ?? 0, 
         | 
| 73 | 
            +
                pageSize: paginationProps?.pageSize ?? 20,
         | 
| 74 | 
            +
              });
         | 
| 67 75 | 
             
              // Determine whether to use the prop or the local state
         | 
| 68 76 | 
             
              const expanded = expandedControl ? expandedControl.value : localExpanded;
         | 
| 69 77 | 
             
              const setExpanded = expandedControl ? expandedControl.onChange : setLocalExpanded;
         | 
| @@ -133,6 +141,7 @@ export function useTableState({ | |
| 133 141 | 
             
                  ...(selectableRows  && { rowSelection }),
         | 
| 134 142 | 
             
                  ...(columnVisibility && { columnVisibility }),
         | 
| 135 143 | 
             
                  ...(pinnedRows && { rowPinning }),
         | 
| 144 | 
            +
                  ...(inlineRowLoading && { pagination: localPagination }),
         | 
| 136 145 | 
             
                },
         | 
| 137 146 | 
             
              }), [
         | 
| 138 147 | 
             
                expanded,
         | 
| @@ -142,23 +151,36 @@ export function useTableState({ | |
| 142 151 | 
             
                rowSelection,
         | 
| 143 152 | 
             
                columnVisibility,
         | 
| 144 153 | 
             
                rowPinning,
         | 
| 154 | 
            +
                inlineRowLoading,
         | 
| 155 | 
            +
                localPagination
         | 
| 145 156 | 
             
              ]);
         | 
| 146 157 |  | 
| 147 158 | 
             
              // Pagination configuration
         | 
| 148 159 | 
             
              const paginationInitializer = useMemo(() => {
         | 
| 149 160 | 
             
                if (!pagination) return {};
         | 
| 150 161 |  | 
| 151 | 
            -
                 | 
| 152 | 
            -
                   | 
| 153 | 
            -
                   | 
| 154 | 
            -
             | 
| 155 | 
            -
                     | 
| 156 | 
            -
             | 
| 157 | 
            -
             | 
| 162 | 
            +
                if (inlineRowLoading) {
         | 
| 163 | 
            +
                  // Use manual pagination state when inlineRowLoading is enabled (see https://tanstack.com/table/latest/docs/guide/pagination#client-side-pagination)
         | 
| 164 | 
            +
                  return {
         | 
| 165 | 
            +
                    getPaginationRowModel: getPaginationRowModel(),
         | 
| 166 | 
            +
                    paginateExpandedRows: false,
         | 
| 167 | 
            +
                    onPaginationChange: setLocalPagination,
         | 
| 168 | 
            +
                    autoResetPageIndex: false, // This is what prevent auto-reset of page index
         | 
| 169 | 
            +
                  };
         | 
| 170 | 
            +
                } else {
         | 
| 171 | 
            +
                  // Use normal pagination initialization for non- inlineRowLoading usecases
         | 
| 172 | 
            +
                  return {
         | 
| 173 | 
            +
                    getPaginationRowModel: getPaginationRowModel(),
         | 
| 174 | 
            +
                    paginateExpandedRows: false,
         | 
| 175 | 
            +
                    initialState: {
         | 
| 176 | 
            +
                      pagination: {
         | 
| 177 | 
            +
                        pageIndex: paginationProps?.pageIndex ?? 0,
         | 
| 178 | 
            +
                        pageSize: paginationProps?.pageSize ?? 20,
         | 
| 179 | 
            +
                      },
         | 
| 158 180 | 
             
                    },
         | 
| 159 | 
            -
                  } | 
| 160 | 
            -
                } | 
| 161 | 
            -
              }, [pagination, paginationProps]);
         | 
| 181 | 
            +
                  };
         | 
| 182 | 
            +
                }
         | 
| 183 | 
            +
              }, [pagination, paginationProps, inlineRowLoading]);
         | 
| 162 184 |  | 
| 163 185 | 
             
              // Initialize the table
         | 
| 164 186 | 
             
              const table = useReactTable({
         | 
| @@ -206,9 +228,27 @@ export function useTableState({ | |
| 206 228 | 
             
              // Set pagination state when pagination is enabled
         | 
| 207 229 | 
             
              useEffect(() => {
         | 
| 208 230 | 
             
                if (pagination && paginationProps?.pageSize) {
         | 
| 209 | 
            -
                   | 
| 231 | 
            +
                  if (inlineRowLoading) {
         | 
| 232 | 
            +
                    // Update local pagination state for inlineRowLoading
         | 
| 233 | 
            +
                    setLocalPagination(prev => ({
         | 
| 234 | 
            +
                      ...prev,
         | 
| 235 | 
            +
                      pageSize: paginationProps.pageSize
         | 
| 236 | 
            +
                    }));
         | 
| 237 | 
            +
                  } else {
         | 
| 238 | 
            +
                    table.setPageSize(paginationProps.pageSize);
         | 
| 239 | 
            +
                  }
         | 
| 240 | 
            +
                }
         | 
| 241 | 
            +
              }, [pagination, paginationProps?.pageSize, table, inlineRowLoading]);
         | 
| 242 | 
            +
             | 
| 243 | 
            +
              // Update local pagination when paginationProps change and inlineRowLoading is enabled
         | 
| 244 | 
            +
              useEffect(() => {
         | 
| 245 | 
            +
                if (pagination && inlineRowLoading && paginationProps) {
         | 
| 246 | 
            +
                  setLocalPagination({
         | 
| 247 | 
            +
                    pageIndex: paginationProps.pageIndex ?? localPagination.pageIndex,
         | 
| 248 | 
            +
                    pageSize: paginationProps.pageSize ?? localPagination.pageSize,
         | 
| 249 | 
            +
                  });
         | 
| 210 250 | 
             
                }
         | 
| 211 | 
            -
              }, [pagination, paginationProps?. | 
| 251 | 
            +
              }, [pagination, inlineRowLoading, paginationProps?.pageIndex, paginationProps?.pageSize]);
         | 
| 212 252 |  | 
| 213 253 | 
             
              // Check if table has any sub-rows
         | 
| 214 254 | 
             
              const hasAnySubRows = table.getRowModel().rows.some(row => row.subRows && row.subRows.length > 0);
         | 
| @@ -247,6 +287,8 @@ export function useTableState({ | |
| 247 287 | 
             
                rowSelection,
         | 
| 248 288 | 
             
                fullData,
         | 
| 249 289 | 
             
                totalFetched,
         | 
| 250 | 
            -
                isFetching
         | 
| 290 | 
            +
                isFetching,
         | 
| 291 | 
            +
                localPagination,
         | 
| 292 | 
            +
                setLocalPagination
         | 
| 251 293 | 
             
              };
         | 
| 252 294 | 
             
            }
         | 
| @@ -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`.
         | 
| @@ -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 | 
            -
            }
         | 
| @@ -18,7 +18,7 @@ | |
| 18 18 |  | 
| 19 19 | 
             
                        if (submitButton) {
         | 
| 20 20 | 
             
                            let currentClass = submitButton.className;
         | 
| 21 | 
            -
                            let newClass = currentClass.replace(" | 
| 21 | 
            +
                            let newClass = currentClass.replace("pb_button_disabled pb_button_loading", "pb_button_enabled");
         | 
| 22 22 |  | 
| 23 23 | 
             
                            let cancelClass = cancelButton ? cancelButton.className : "";
         | 
| 24 24 | 
             
                            let newCancelClass = cancelClass.replace("_disabled", "_enabled");
         | 
| @@ -7,7 +7,7 @@ const formHelper = () => { | |
| 7 7 |  | 
| 8 8 | 
             
                        if (submitButton) {
         | 
| 9 9 | 
             
                            let currentClass = submitButton.className;
         | 
| 10 | 
            -
                            let newClass = currentClass.replace(" | 
| 10 | 
            +
                            let newClass = currentClass.replace("pb_button_enabled", "pb_button_disabled pb_button_loading");
         | 
| 11 11 |  | 
| 12 12 | 
             
                            let cancelClass = cancelButton ? cancelButton.className : "";
         | 
| 13 13 | 
             
                            let newCancelClass = cancelClass.replace("_enabled", "_disabled");
         | 
| @@ -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-BvV7a9cR.js";import{c as colors,h as highchartsTheme,m as merge,a as highchartsDarkTheme,t as typography}from"./lib-izYrkvOQ.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-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};
         |