playbook_ui 13.34.1.pre.alpha.pbntr258paginationkitforreact3413 → 13.34.1.pre.alpha.play1447addrequiredicons3451

Sign up to get free protection for your applications and to get access to all the features.
Files changed (36) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_badge/_badge.tsx +5 -1
  3. data/app/pb_kits/playbook/pb_button/_button.tsx +5 -1
  4. data/app/pb_kits/playbook/pb_button/button.html.erb +1 -1
  5. data/app/pb_kits/playbook/pb_button/button.rb +4 -0
  6. data/app/pb_kits/playbook/pb_date_time/dateTime.test.js +2 -2
  7. data/app/pb_kits/playbook/pb_dialog/_close_icon.tsx +6 -1
  8. data/app/pb_kits/playbook/pb_dialog/dialog_header.html.erb +1 -1
  9. data/app/pb_kits/playbook/pb_dialog/dialog_header.rb +4 -0
  10. data/app/pb_kits/playbook/pb_pagination/_pagination.scss +8 -23
  11. data/app/pb_kits/playbook/pb_pagination/docs/example.yml +1 -3
  12. data/app/pb_kits/playbook/pb_time/_time.tsx +16 -10
  13. data/app/pb_kits/playbook/pb_time/time.html.erb +3 -3
  14. data/app/pb_kits/playbook/pb_time/time.rb +4 -0
  15. data/app/pb_kits/playbook/utilities/icons/allicons.tsx +59 -0
  16. data/app/pb_kits/playbook/utilities/icons/clock.svg +9 -0
  17. data/app/pb_kits/playbook/utilities/icons/spinner.svg +3 -0
  18. data/app/pb_kits/playbook/utilities/icons/times.svg +3 -0
  19. data/dist/chunks/_typeahead-zwiADeyt.js +22 -0
  20. data/dist/chunks/_weekday_stacked-B98BDKdo.js +45 -0
  21. data/dist/chunks/vendor.js +1 -1
  22. data/dist/playbook-doc.js +1 -1
  23. data/dist/playbook-rails-react-bindings.js +1 -1
  24. data/dist/playbook-rails.js +1 -1
  25. data/dist/playbook.css +1 -1
  26. data/lib/playbook/version.rb +1 -1
  27. metadata +9 -11
  28. data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +0 -134
  29. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx +0 -19
  30. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx +0 -62
  31. data/app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md +0 -1
  32. data/app/pb_kits/playbook/pb_pagination/docs/data.js +0 -23
  33. data/app/pb_kits/playbook/pb_pagination/docs/index.js +0 -2
  34. data/dist/chunks/_typeahead-COUJ88EA.js +0 -22
  35. data/dist/chunks/_weekday_stacked-Im-AfPJB.js +0 -45
  36. /data/app/pb_kits/playbook/pb_pagination/docs/{_pagination_default_rails.md → _pagination_default.md} +0 -0
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "13.34.1"
5
- VERSION = "13.34.1.pre.alpha.pbntr258paginationkitforreact3413"
5
+ VERSION = "13.34.1.pre.alpha.play1447addrequiredicons3451"
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playbook_ui
3
3
  version: !ruby/object:Gem::Version
4
- version: 13.34.1.pre.alpha.pbntr258paginationkitforreact3413
4
+ version: 13.34.1.pre.alpha.play1447addrequiredicons3451
5
5
  platform: ruby
6
6
  authors:
7
7
  - Power UX
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2024-08-08 00:00:00.000000000 Z
12
+ date: 2024-08-12 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -1919,15 +1919,9 @@ files:
1919
1919
  - app/pb_kits/playbook/pb_overlay/subcomponents/_overlay_percentage.tsx
1920
1920
  - app/pb_kits/playbook/pb_overlay/subcomponents/_overlay_token.tsx
1921
1921
  - app/pb_kits/playbook/pb_pagination/_pagination.scss
1922
- - app/pb_kits/playbook/pb_pagination/_pagination.tsx
1923
1922
  - app/pb_kits/playbook/pb_pagination/docs/_pagination_default.html.erb
1924
- - app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx
1925
- - app/pb_kits/playbook/pb_pagination/docs/_pagination_default_rails.md
1926
- - app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change.jsx
1927
- - app/pb_kits/playbook/pb_pagination/docs/_pagination_page_change_react.md
1928
- - app/pb_kits/playbook/pb_pagination/docs/data.js
1923
+ - app/pb_kits/playbook/pb_pagination/docs/_pagination_default.md
1929
1924
  - app/pb_kits/playbook/pb_pagination/docs/example.yml
1930
- - app/pb_kits/playbook/pb_pagination/docs/index.js
1931
1925
  - app/pb_kits/playbook/pb_pagination/pagination.html.erb
1932
1926
  - app/pb_kits/playbook/pb_pagination/pagination.rb
1933
1927
  - app/pb_kits/playbook/pb_passphrase/_passphrase.scss
@@ -2979,6 +2973,10 @@ files:
2979
2973
  - app/pb_kits/playbook/utilities/flexbox_global_props/_order.scss
2980
2974
  - app/pb_kits/playbook/utilities/globalPropNames.mjs
2981
2975
  - app/pb_kits/playbook/utilities/globalProps.ts
2976
+ - app/pb_kits/playbook/utilities/icons/allicons.tsx
2977
+ - app/pb_kits/playbook/utilities/icons/clock.svg
2978
+ - app/pb_kits/playbook/utilities/icons/spinner.svg
2979
+ - app/pb_kits/playbook/utilities/icons/times.svg
2982
2980
  - app/pb_kits/playbook/utilities/object.ts
2983
2981
  - app/pb_kits/playbook/utilities/props.ts
2984
2982
  - app/pb_kits/playbook/utilities/test-utils.js
@@ -2997,8 +2995,8 @@ files:
2997
2995
  - app/pb_kits/playbook/utilities/test/globalProps/truncate.test.js
2998
2996
  - app/pb_kits/playbook/utilities/text.ts
2999
2997
  - app/pb_kits/playbook/utilities/validEmojiChecker.ts
3000
- - dist/chunks/_typeahead-COUJ88EA.js
3001
- - dist/chunks/_weekday_stacked-Im-AfPJB.js
2998
+ - dist/chunks/_typeahead-zwiADeyt.js
2999
+ - dist/chunks/_weekday_stacked-B98BDKdo.js
3002
3000
  - dist/chunks/lazysizes-B7xYodB-.js
3003
3001
  - dist/chunks/lib-Bf_E03gc.js
3004
3002
  - dist/chunks/pb_form_validation-D0dhqeN2.js
@@ -1,134 +0,0 @@
1
- import React, { useState } from "react";
2
- import Icon from '../pb_icon/_icon';
3
-
4
- type PaginationProps = {
5
- current?: number;
6
- onChange?: (pageNumber: number) => void;
7
- range?: number;
8
- total?: number;
9
- };
10
-
11
- const Pagination = ({
12
- current = 1,
13
- onChange,
14
- range = 5,
15
- total = 1,
16
- }: PaginationProps) => {
17
- const [currentPage, setCurrentPage] = useState(current);
18
-
19
- const handlePageChange = (pageNumber: number) => {
20
- if (pageNumber >= 1 && pageNumber <= total) {
21
- setCurrentPage(pageNumber);
22
- if (onChange) {
23
- onChange(pageNumber);
24
- }
25
- }
26
- };
27
-
28
- const renderPageButtons = (): JSX.Element[] => {
29
- const buttons: JSX.Element[] = [];
30
-
31
- // Calculate pagination range with let
32
- let rangeStart = Math.max(1, currentPage - Math.floor(range / 2));
33
- let rangeEnd = Math.min(total, rangeStart + range - 1);
34
-
35
- // Adjust range if it's too short to fit the range
36
- if (rangeEnd - rangeStart + 1 < range) {
37
- if (rangeStart > 1) {
38
- rangeStart = Math.max(1, rangeEnd - range + 1);
39
- } else {
40
- rangeEnd = Math.min(total, rangeStart + range - 1);
41
- }
42
- }
43
-
44
- // Always display the first page button
45
- if (rangeStart > 1) {
46
- buttons.push(
47
- <button
48
- className="pagination-number"
49
- key={1}
50
- onClick={() => handlePageChange(1)}
51
- >
52
- 1
53
- </button>
54
- );
55
- }
56
-
57
- // Always display the second page button
58
- if (rangeStart > 2) {
59
- buttons.push(
60
- <button
61
- className="pagination-number"
62
- key={2}
63
- onClick={() => handlePageChange(2)}
64
- >
65
- 2
66
- </button>
67
- );
68
- }
69
-
70
- // Display page buttons within the calculated range
71
- for (let i = rangeStart; i <= rangeEnd; i++) {
72
- buttons.push(
73
- <button
74
- className={`pagination-number ${i === currentPage ? "active" : ""}`}
75
- key={i}
76
- onClick={() => handlePageChange(i)}
77
- >
78
- {i}
79
- </button>
80
- );
81
- }
82
-
83
- // Always display the second-to-last page button
84
- if (rangeEnd < total - 1) {
85
- buttons.push(
86
- <button
87
- className={`pagination-number ${total - 1 === currentPage ? "active" : ""}`}
88
- key={total - 1}
89
- onClick={() => handlePageChange(total - 1)}
90
- >
91
- {total - 1}
92
- </button>
93
- );
94
- }
95
-
96
- // Always display the last page button
97
- if (rangeEnd < total) {
98
- buttons.push(
99
- <button
100
- className={`pagination-number ${total === currentPage ? "active" : ""}`}
101
- key={total}
102
- onClick={() => handlePageChange(total)}
103
- >
104
- {total}
105
- </button>
106
- );
107
- }
108
-
109
- return buttons;
110
- };
111
-
112
-
113
- return (
114
- <div className="pb_pagination">
115
- <button
116
- className="pagination-left"
117
- disabled={currentPage === 1}
118
- onClick={() => handlePageChange(currentPage - 1)}
119
- >
120
- <Icon icon="chevron-left" />
121
- </button>
122
- {renderPageButtons()}
123
- <button
124
- className="pagination-right"
125
- disabled={currentPage === total}
126
- onClick={() => handlePageChange(currentPage + 1)}
127
- >
128
- <Icon icon="chevron-right" />
129
- </button>
130
- </div>
131
- );
132
- };
133
-
134
- export default Pagination;
@@ -1,19 +0,0 @@
1
- import React from 'react'
2
-
3
- import Pagination from '../_pagination'
4
-
5
- const PaginationDefault = (props) => {
6
-
7
- return (
8
- <>
9
- <Pagination
10
- current={1}
11
- range={5}
12
- total={10}
13
- {...props}
14
- />
15
- </>
16
- )
17
- }
18
-
19
- export default PaginationDefault
@@ -1,62 +0,0 @@
1
- import React, { useState } from "react";
2
- import { Table, Pagination } from 'playbook-ui'
3
-
4
-
5
- import { data } from "./data";
6
-
7
- const PaginationPageChange = (props) => {
8
-
9
- const [activePage, setActivePage] = useState(1);
10
- const rowsPerPage = 3;
11
- const totalPages = Math.ceil(data.length / rowsPerPage);
12
-
13
- const onPageChange = (pageNumber) => {
14
- setActivePage(pageNumber);
15
- };
16
-
17
- const currentData = data.slice(
18
- (activePage - 1) * rowsPerPage,
19
- activePage * rowsPerPage
20
- );
21
-
22
-
23
- return (
24
- <div className="App">
25
- <Table
26
- marginBottom="xs"
27
- responsive="none"
28
- size="sm"
29
- {...props}
30
- >
31
- <Table.Head>
32
- <Table.Row>
33
- <Table.Header>{"Column 1"}</Table.Header>
34
- <Table.Header>{"Column 2"}</Table.Header>
35
- <Table.Header>{"Column 3"}</Table.Header>
36
- <Table.Header>{"Column 4"}</Table.Header>
37
- <Table.Header>{"Column 5"}</Table.Header>
38
- </Table.Row>
39
- </Table.Head>
40
- <Table.Body>
41
- {currentData.map((row, index) => (
42
- <Table.Row key={index}>
43
- {row.map((cell, cellIndex) => (
44
- <Table.Cell key={cellIndex}>{cell}</Table.Cell>
45
- ))}
46
- </Table.Row>
47
- ))}
48
- </Table.Body>
49
- </Table>
50
-
51
- <Pagination
52
- current={1}
53
- onChange={onPageChange}
54
- range={5}
55
- total={totalPages}
56
- {...props}
57
- />
58
- </div>
59
- )
60
- }
61
-
62
- export default PaginationPageChange
@@ -1 +0,0 @@
1
- You can use the `onPageChange` prop to control the data of your table. This prop is callback function that will allow you control the state.
@@ -1,23 +0,0 @@
1
- export const data = [
2
- ["Value 1", "Value 2", "Value 3", "Value 4", "Value 5"],
3
- ["Value 6", "Value 7", "Value 8", "Value 9", "Value 10"],
4
- ["Value 11", "Value 12", "Value 13", "Value 14", "Value 15"],
5
- ["Value 16", "Value 17", "Value 18", "Value 19", "Value 20"],
6
- ["Value 21", "Value 22", "Value 23", "Value 24", "Value 25"],
7
- ["Value 26", "Value 27", "Value 28", "Value 29", "Value 30"],
8
- ["Value 31", "Value 32", "Value 33", "Value 34", "Value 35"],
9
- ["Value 36", "Value 37", "Value 38", "Value 39", "Value 40"],
10
- ["Value 41", "Value 42", "Value 43", "Value 44", "Value 45"],
11
- ["Value 46", "Value 47", "Value 48", "Value 49", "Value 50"],
12
- ["Value 51", "Value 52", "Value 53", "Value 54", "Value 55"],
13
- ["Value 56", "Value 57", "Value 58", "Value 59", "Value 60"],
14
- ["Value 61", "Value 62", "Value 63", "Value 64", "Value 65"],
15
- ["Value 66", "Value 67", "Value 68", "Value 69", "Value 70"],
16
- ["Value 71", "Value 72", "Value 73", "Value 74", "Value 75"],
17
- ["Value 76", "Value 77", "Value 78", "Value 79", "Value 80"],
18
- ["Value 81", "Value 82", "Value 83", "Value 84", "Value 85"],
19
- ["Value 86", "Value 87", "Value 88", "Value 89", "Value 90"],
20
- ["Value 91", "Value 92", "Value 93", "Value 94", "Value 95"],
21
- ["Value 96", "Value 97", "Value 98", "Value 99", "Value 100"],
22
- ];
23
-
@@ -1,2 +0,0 @@
1
- export { default as PaginationDefault } from './_pagination_default.jsx'
2
- export { default as PaginationPageChange } from './_pagination_page_change.jsx'