playbook_ui 11.16.0.pre.alpha.pagination.rails1 → 11.16.0.pre.alpha.reactupgrade1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d1c2dd6e15de3851fa13af4d58c06b78448261e4dc2a973718ae53f518324638
4
- data.tar.gz: 896cb320d58e4be679254fafdda40d7269f53161bcb1b417c6c5e2c725173de4
3
+ metadata.gz: d042b0ab3d8b097bd1fcf548916bcf509dbe7d2ba6992997d581dcc37b52f6fd
4
+ data.tar.gz: 569c342ad86165547fcd18928e2c17c493492f1f32a9dca6644ad60c6ee259f9
5
5
  SHA512:
6
- metadata.gz: 25c4283002f9b516e41e3f4a66e13fa1ddc71935c245001141357df87637500d5d9e87361bc35ccf6feee206ad0d8982701ea1d80390d5a937502657a8bc12d4
7
- data.tar.gz: a87f20dc862b0f749fd3950a950596e97c8712a4ec130bf2856d3bd6f854fa41fcc3d3cedae27d043e3771d3d5c29a1b07f096831cac746f7d86ef1e220deadc
6
+ metadata.gz: f767315ad846a1277a8226a025c64c30bf24743657314979117872662eee3c24b9647edd3e7ffb4d4dad6655a748f9832206c08745e62417084e1462863e1a9d
7
+ data.tar.gz: 3694adfc7dc8c7b49911b8935b308ca67daeb9de57a6b30a45ce806e97c64449cd3d5896a7b10d54c801899cb1bd98863170a269ebe187588ca81aad8052ace2
@@ -103,5 +103,3 @@
103
103
  @import './utilities/line_height';
104
104
  @import './utilities/display';
105
105
  @import './utilities/flexbox';
106
-
107
- @import 'pb_pagination/pagination';
@@ -104,4 +104,3 @@ kits:
104
104
  - title_detail
105
105
  - user_badge
106
106
  - walkthrough
107
- - pagination
@@ -53,9 +53,9 @@ export { default as LabelPill } from './pb_label_pill/_label_pill'
53
53
  export { default as LabelValue } from './pb_label_value/_label_value'
54
54
  export { default as Layout } from './pb_layout/_layout'
55
55
  export { default as Legend } from './pb_legend/_legend'
56
- export { default as Lightbox } from './pb_lightbox/_lightbox'
57
56
  export { default as LineGraph } from './pb_line_graph/_line_graph'
58
57
  export { default as List } from './pb_list/_list'
58
+ export { default as Lightbox } from './pb_lightbox/_lightbox'
59
59
  export { default as ListItem } from './pb_list/_list_item'
60
60
  export { default as LoadingInline } from './pb_loading_inline/_loading_inline'
61
61
  export { default as Message } from './pb_message/_message'
@@ -64,7 +64,6 @@ export { default as MultipleUsersStacked } from './pb_multiple_users_stacked/_mu
64
64
  export { default as Nav } from './pb_nav/_nav'
65
65
  export { default as NavItem } from './pb_nav/_item'
66
66
  export { default as OnlineStatus } from './pb_online_status/_online_status'
67
- export { default as Pagination} from './pb_pagination/_pagination'
68
67
  export { default as Passphrase } from './pb_passphrase/_passphrase'
69
68
  export { default as PbReactPopover } from './pb_popover/_popover'
70
69
  export { default as Person } from './pb_person/_person'
@@ -1,19 +1,25 @@
1
+ /* eslint-disable react/no-multi-comp */
1
2
  // @flow
2
3
 
3
- import React from 'react'
4
- import ReactDOM from 'react-dom'
4
+ import React, {useEffect} from "react";
5
+ import ReactDOM from "react-dom";
5
6
 
6
7
  import {
7
8
  Popper,
8
9
  Manager as PopperManager,
9
10
  PopperProps,
10
11
  Reference as PopperReference,
11
- } from 'react-popper'
12
+ } from "react-popper";
12
13
 
13
- import { buildAriaProps, buildCss, buildDataProps, noop } from '../utilities/props'
14
+ import {
15
+ buildAriaProps,
16
+ buildCss,
17
+ buildDataProps,
18
+ noop,
19
+ } from "../utilities/props";
14
20
 
15
- import classnames from 'classnames'
16
- import { globalProps } from '../utilities/globalProps'
21
+ import classnames from "classnames";
22
+ import { globalProps } from "../utilities/globalProps";
17
23
 
18
24
  type PbPopoverProps = {
19
25
  aria?: object,
@@ -25,7 +31,7 @@ type PbPopoverProps = {
25
31
  reference: PopperReference,
26
32
  show?: boolean,
27
33
  shouldClosePopover?: () => boolean,
28
- } & PopperProps
34
+ } & PopperProps;
29
35
 
30
36
  // Prop enabled default modifiers here
31
37
  // https://popper.js.org/docs/v2/modifiers
@@ -34,17 +40,17 @@ const POPOVER_MODIFIERS = {
34
40
  offset: {
35
41
  //https://popper.js.org/docs/v2/modifiers/offset/
36
42
  enabled: true,
37
- name: 'offset',
43
+ name: "offset",
38
44
  options: {
39
45
  offset: [0, 20],
40
46
  },
41
- phase: 'main',
47
+ phase: "main",
42
48
  },
43
- }
49
+ };
44
50
 
45
51
  const popoverModifiers = ({ modifiers, offset }) => {
46
- return offset ? modifiers.concat([POPOVER_MODIFIERS.offset]) : modifiers
47
- }
52
+ return offset ? modifiers.concat([POPOVER_MODIFIERS.offset]) : modifiers;
53
+ };
48
54
 
49
55
  const Popover = (props: PbPopoverProps) => {
50
56
  const {
@@ -62,11 +68,14 @@ const Popover = (props: PbPopoverProps) => {
62
68
  maxWidth,
63
69
  minHeight,
64
70
  minWidth,
65
- } = props
66
-
67
- const popoverSpacing = globalProps(props).includes('dark') || !globalProps(props) ? 'p_sm' : globalProps(props)
68
- const overflowHandling = maxHeight || maxWidth ? 'overflow_handling' : ''
69
- const zIndexStyle = zIndex ? { zIndex: zIndex } : {}
71
+ } = props;
72
+
73
+ const popoverSpacing =
74
+ globalProps(props).includes("dark") || !globalProps(props)
75
+ ? "p_sm"
76
+ : globalProps(props);
77
+ const overflowHandling = maxHeight || maxWidth ? "overflow_handling" : "";
78
+ const zIndexStyle = zIndex ? { zIndex: zIndex } : {};
70
79
  const widthHeightStyles = () => {
71
80
  return Object.assign(
72
81
  {},
@@ -74,15 +83,15 @@ const Popover = (props: PbPopoverProps) => {
74
83
  maxWidth ? { maxWidth: maxWidth } : {},
75
84
  minHeight ? { minHeight: minHeight } : {},
76
85
  minWidth ? { minWidth: minWidth } : {}
77
- )
78
- }
79
- const ariaProps = buildAriaProps(aria)
80
- const dataProps = buildDataProps(data)
86
+ );
87
+ };
88
+ const ariaProps = buildAriaProps(aria);
89
+ const dataProps = buildDataProps(data);
81
90
  const classes = classnames(
82
- buildCss('pb_popover_kit'),
91
+ buildCss("pb_popover_kit"),
83
92
  globalProps(props),
84
93
  className
85
- )
94
+ );
86
95
 
87
96
  return (
88
97
  <Popper
@@ -99,20 +108,14 @@ const Popover = (props: PbPopoverProps) => {
99
108
  data-placement={placement}
100
109
  id={id}
101
110
  ref={ref}
102
- style={Object.assign(
103
- {},
104
- style,
105
- zIndexStyle
106
- )}
111
+ style={Object.assign({}, style, zIndexStyle)}
107
112
  >
108
113
  <div
109
- className={classnames(
110
- `${buildCss('pb_popover_tooltip')} show`
111
- )}
114
+ className={classnames(`${buildCss("pb_popover_tooltip")} show`)}
112
115
  >
113
116
  <div
114
117
  className={classnames(
115
- 'pb_popover_body',
118
+ "pb_popover_body",
116
119
  popoverSpacing,
117
120
  overflowHandling
118
121
  )}
@@ -122,25 +125,33 @@ const Popover = (props: PbPopoverProps) => {
122
125
  </div>
123
126
  </div>
124
127
  </div>
125
- )
128
+ );
126
129
  }}
127
130
  </Popper>
128
- )
129
- }
130
-
131
- export default class PbReactPopover extends React.Component<PbPopoverProps> {
132
- static defaultProps = {
133
- modifiers: [],
134
- offset: false,
135
- placement: 'left',
136
- portal: 'body',
137
- show: false,
138
- shouldClosePopover: noop,
139
- usePortal: true,
140
- }
141
-
142
- componentDidMount() {
143
- const { closeOnClick, shouldClosePopover } = this.props
131
+ );
132
+ };
133
+
134
+ const PbReactPopover = (props: PbPopoverProps) => {
135
+ const {
136
+ className,
137
+ children,
138
+ modifiers = [],
139
+ offset = false,
140
+ placement = "left",
141
+ portal = "body",
142
+ reference,
143
+ referenceElement,
144
+ show = false,
145
+ usePortal = true,
146
+ zIndex,
147
+ maxHeight,
148
+ maxWidth,
149
+ minHeight,
150
+ minWidth,
151
+ } = props;
152
+
153
+ useEffect(() => {
154
+ const { closeOnClick, shouldClosePopover = noop } = props
144
155
 
145
156
  if (!closeOnClick) return
146
157
 
@@ -151,87 +162,66 @@ export default class PbReactPopover extends React.Component<PbPopoverProps> {
151
162
  target.closest('.pb_popover_reference_wrapper') !== null
152
163
 
153
164
  switch (closeOnClick) {
154
- case 'outside':
155
- if (!targetIsPopover || targetIsReference) {
156
- shouldClosePopover(true)
157
- }
158
- break
159
- case 'inside':
160
- if (targetIsPopover || targetIsReference) {
165
+ case 'outside':
166
+ if (!targetIsPopover || targetIsReference) {
167
+ shouldClosePopover(true)
168
+ }
169
+ break
170
+ case 'inside':
171
+ if (targetIsPopover || targetIsReference) {
172
+ shouldClosePopover(true)
173
+ }
174
+ break
175
+ case 'any':
161
176
  shouldClosePopover(true)
162
- }
163
- break
164
- case 'any':
165
- shouldClosePopover(true)
166
- break
177
+ break
167
178
  }
168
- })
169
- }
170
-
171
- props: PbPopoverProps
172
-
173
- render() {
174
- const {
175
- className,
176
- children,
177
- modifiers,
178
- offset,
179
- placement,
180
- portal,
181
- reference,
182
- referenceElement,
183
- show,
184
- usePortal,
185
- zIndex,
186
- maxHeight,
187
- maxWidth,
188
- minHeight,
189
- minWidth,
190
- } = this.props
191
-
192
- const popoverComponent = (
193
- <Popover
194
- {...this.props}
195
- className={className}
196
- maxHeight={maxHeight}
197
- maxWidth={maxWidth}
198
- minHeight={minHeight}
199
- minWidth={minWidth}
200
- modifiers={modifiers}
201
- offset={offset}
202
- placement={placement}
203
- referenceElement={referenceElement}
204
- zIndex={zIndex}
205
- >
206
- {children}
207
- </Popover>
208
- )
209
-
210
- return (
211
- <PopperManager>
212
- <If condition={reference && !referenceElement}>
213
- <PopperReference>
214
- {({ ref }) => (
215
- <span
216
- className="pb_popover_reference_wrapper"
217
- ref={ref}
218
- >
219
- <reference.type {...reference.props} />
220
- </span>
221
- )}
222
- </PopperReference>
223
- </If>
224
- <If condition={show}>
225
- <If condition={usePortal}>
226
- {ReactDOM.createPortal(
227
- popoverComponent,
228
- document.querySelector(portal)
229
- )}
230
- <Else />
231
- {popoverComponent}
232
- </If>
179
+ }, { capture: true })
180
+ }, [])
181
+
182
+ const popoverComponent = (
183
+ <Popover
184
+ className={className}
185
+ maxHeight={maxHeight}
186
+ maxWidth={maxWidth}
187
+ minHeight={minHeight}
188
+ minWidth={minWidth}
189
+ modifiers={modifiers}
190
+ offset={offset}
191
+ placement={placement}
192
+ referenceElement={referenceElement}
193
+ zIndex={zIndex}
194
+ {...props}
195
+ >
196
+ {children}
197
+ </Popover>
198
+ );
199
+
200
+ return (
201
+ <PopperManager>
202
+ <If condition={reference && !referenceElement}>
203
+ <PopperReference>
204
+ {({ ref }) => (
205
+ <span className="pb_popover_reference_wrapper"
206
+ ref={ref}
207
+ >
208
+ <reference.type {...reference.props} />
209
+ </span>
210
+ )}
211
+ </PopperReference>
212
+ </If>
213
+ <If condition={show}>
214
+ <If condition={usePortal}>
215
+ {ReactDOM.createPortal(
216
+ popoverComponent,
217
+ document.querySelector(portal)
218
+ )}
219
+ <Else />
220
+ {popoverComponent}
233
221
  </If>
234
- </PopperManager>
235
- )
236
- }
237
- }
222
+ </If>
223
+ </PopperManager>
224
+ );
225
+ };
226
+
227
+ export default PbReactPopover;
@@ -31,7 +31,7 @@ const PopoverClose = (props) => {
31
31
  }
32
32
 
33
33
  const handleAnyTogglePopover = () => {
34
- setAnyShowPopover(!showOutsidePopover)
34
+ setAnyShowPopover(!showAnyPopover)
35
35
  }
36
36
 
37
37
  const insidePopoverTrigger = (
@@ -60,7 +60,6 @@ import * as MultipleUsers from 'pb_multiple_users/docs'
60
60
  import * as MultipleUsersStacked from 'pb_multiple_users_stacked/docs'
61
61
  import * as Nav from 'pb_nav/docs'
62
62
  import * as OnlineStatus from 'pb_online_status/docs'
63
- import * as Pagination from 'pb_pagination/docs'
64
63
  import * as Passphrase from 'pb_passphrase/docs'
65
64
  import * as PbReactPopover from 'pb_popover/docs'
66
65
  import * as Person from 'pb_person/docs'
@@ -158,7 +157,6 @@ WebpackerReact.setup({
158
157
  ...MultipleUsersStacked,
159
158
  ...Nav,
160
159
  ...OnlineStatus,
161
- ...Pagination,
162
160
  ...Passphrase,
163
161
  ...PbReactPopover,
164
162
  ...Person,
@@ -19,7 +19,6 @@ require "playbook/flex"
19
19
  require "playbook/flex_grow"
20
20
  require "playbook/flex_shrink"
21
21
  require "playbook/order"
22
- require "playbook/pagination_renderer"
23
22
 
24
23
  module Playbook
25
24
  class KitBase < ViewComponent::Base
@@ -44,7 +43,6 @@ module Playbook
44
43
  include Playbook::FlexGrow
45
44
  include Playbook::FlexShrink
46
45
  include Playbook::Order
47
- include Playbook::Pagination
48
46
 
49
47
  prop :id
50
48
  prop :data, type: Playbook::Props::Hash, default: {}
@@ -2,5 +2,5 @@
2
2
 
3
3
  module Playbook
4
4
  PREVIOUS_VERSION = "11.15.0"
5
- VERSION = "11.16.0.pre.alpha.pagination.rails1"
5
+ VERSION = "11.16.0.pre.alpha.reactupgrade1"
6
6
  end
data/lib/playbook.rb CHANGED
@@ -12,7 +12,6 @@ require "playbook/pb_doc_helper"
12
12
  require "playbook/kit_base"
13
13
  require "playbook/kit_resolver"
14
14
  require "playbook/markdown"
15
- require "playbook/pagination_renderer"
16
15
 
17
16
  module Playbook
18
17
  ROOT_PATH = Pathname.new(File.join(__dir__, ".."))
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: 11.16.0.pre.alpha.pagination.rails1
4
+ version: 11.16.0.pre.alpha.reactupgrade1
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: 2022-12-19 00:00:00.000000000 Z
12
+ date: 2023-01-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: actionpack
@@ -269,20 +269,6 @@ dependencies:
269
269
  - - '='
270
270
  - !ruby/object:Gem::Version
271
271
  version: 1.2018.9
272
- - !ruby/object:Gem::Dependency
273
- name: will_paginate
274
- requirement: !ruby/object:Gem::Requirement
275
- requirements:
276
- - - "~>"
277
- - !ruby/object:Gem::Version
278
- version: '3.3'
279
- type: :development
280
- prerelease: false
281
- version_requirements: !ruby/object:Gem::Requirement
282
- requirements:
283
- - - "~>"
284
- - !ruby/object:Gem::Version
285
- version: '3.3'
286
272
  description: Playbook Design System. Built for Nitro, but powering all.
287
273
  email:
288
274
  - nitroux@powerhrg.com
@@ -1474,15 +1460,6 @@ files:
1474
1460
  - app/pb_kits/playbook/pb_online_status/docs/index.js
1475
1461
  - app/pb_kits/playbook/pb_online_status/online_status.html.erb
1476
1462
  - app/pb_kits/playbook/pb_online_status/online_status.rb
1477
- - app/pb_kits/playbook/pb_pagination/_pagination.scss
1478
- - app/pb_kits/playbook/pb_pagination/_pagination.tsx
1479
- - app/pb_kits/playbook/pb_pagination/docs/_pagination_default.html.erb
1480
- - app/pb_kits/playbook/pb_pagination/docs/_pagination_default.jsx
1481
- - app/pb_kits/playbook/pb_pagination/docs/example.yml
1482
- - app/pb_kits/playbook/pb_pagination/docs/index.js
1483
- - app/pb_kits/playbook/pb_pagination/pagination.html.erb
1484
- - app/pb_kits/playbook/pb_pagination/pagination.rb
1485
- - app/pb_kits/playbook/pb_pagination/pagination.test.jsx
1486
1463
  - app/pb_kits/playbook/pb_passphrase/_passphrase.jsx
1487
1464
  - app/pb_kits/playbook/pb_passphrase/_passphrase.scss
1488
1465
  - app/pb_kits/playbook/pb_passphrase/docs/_passphrase_breached.html.erb
@@ -2344,7 +2321,6 @@ files:
2344
2321
  - lib/playbook/markdown/template_handler.rb
2345
2322
  - lib/playbook/number_spacing.rb
2346
2323
  - lib/playbook/order.rb
2347
- - lib/playbook/pagination_renderer.rb
2348
2324
  - lib/playbook/pb_doc_helper.rb
2349
2325
  - lib/playbook/pb_forms_helper.rb
2350
2326
  - lib/playbook/pb_kit_helper.rb
@@ -1,68 +0,0 @@
1
- @import "tokens/colors";
2
- @import "tokens/typography";
3
- @import "tokens/border_radius";
4
- @import "tokens/shadows";
5
-
6
- .pb_pagination {
7
- display: inline-block;
8
- border-radius: $border_rad_light;
9
- border: 1px solid $border_light;
10
- background-color: $white;
11
- padding: 3px 0px 3.6px 0px;
12
- li {
13
- display: inline;
14
- > a, li > span {
15
- padding: 7px 13px;
16
- text-decoration: none;
17
- margin-left: -1px;
18
- border: 0 !important;
19
- }}
20
- li:first-child > a, li:first-child > span {
21
- padding: 7px 13px;
22
- margin-left: .5px;
23
- border-right: 1px solid $border_light !important;
24
- z-index: 2;
25
- }
26
- li:last-child > a, li:last-child > span {
27
- padding: 7px 13px;
28
- margin-right: .5px;
29
- border-left: 1px solid $border_light !important;
30
- z-index: 2;
31
- }
32
- a {
33
- color: $text_lt_default !important;
34
- font-size: $text_small;
35
- font-weight: $regular;
36
- border: none;
37
-
38
- &:hover {
39
- background-color: $active_light;
40
- color: $primary !important;
41
- border-radius: $border_rad_light;
42
- }
43
-
44
- &:focus {
45
- outline: 1px solid $primary !important;
46
- border-radius: $border_rad_light;
47
- outline-offset: -1px;
48
- }
49
- }
50
- .active > span {
51
- background-color: $primary !important;
52
- border-radius: $border_rad_light;
53
- color: #fff;
54
- padding: 7px 10px;
55
- border: 0 !important;
56
- text-decoration: none;
57
- font-weight: $bold;
58
- font-size: $text_small;
59
-
60
- &:hover {
61
- box-shadow: $shadow_deeper;
62
- }
63
- }
64
- .disabled > span {
65
- padding: 7px 10px;
66
- font-size: $text_small;
67
- }
68
- }
@@ -1,41 +0,0 @@
1
-
2
-
3
- /* @flow */
4
-
5
- import React from 'react'
6
- import classnames from 'classnames'
7
- import { buildAriaProps, buildCss, buildDataProps } from '../utilities/props'
8
- import { globalProps } from '../utilities/globalProps'
9
-
10
- type PaginationProps = {
11
- aria?: { [key: string]: string },
12
- className?: string,
13
- data?: { [key: string]: string },
14
- id?: string,
15
- }
16
-
17
- const Pagination = (props: PaginationProps) => {
18
- const {
19
- aria = {},
20
- className,
21
- data = {},
22
- id,
23
- } = props
24
-
25
- const ariaProps = buildAriaProps(aria)
26
- const dataProps = buildDataProps(data)
27
- const classes = classnames(buildCss('pb_pagination'), globalProps(props), className)
28
-
29
- return (
30
- <div
31
- {...ariaProps}
32
- {...dataProps}
33
- className={classes}
34
- id={id}
35
- >
36
- {className}
37
- </div>
38
- )
39
- }
40
-
41
- export default Pagination
@@ -1,28 +0,0 @@
1
- <% @data = [{
2
- first_name: 'Jon',
3
- last_name: 'Ron',
4
- email: "jon@mail.com",
5
- id: 1,
6
- }, {
7
- first_name: 'Sam',
8
- last_name: 'Bob',
9
- email: "sam@mail.com",
10
- id: 2,
11
- }, {
12
- first_name: 'Nick',
13
- last_name: 'Jack',
14
- email: "nick@mail.com",
15
- id: 3,
16
- }, {
17
- first_name: 'Jake',
18
- last_name: 'Wade',
19
- email: "jon@mail.com",
20
- id: 4,
21
- }, {
22
- first_name: 'Blake',
23
- last_name: 'Chad',
24
- email: "jon@mail.com",
25
- id: 5,
26
- }] %>
27
-
28
- <%= pb_rails("pagination", props: { data: @data}) %>
@@ -1,12 +0,0 @@
1
- import React from 'react'
2
- import Pagination from '../_pagination'
3
-
4
- const PaginationDefault = (props) => (
5
- <div>
6
- <Pagination
7
- {...props}
8
- />
9
- </div>
10
- )
11
-
12
- export default PaginationDefault
@@ -1,9 +0,0 @@
1
- examples:
2
-
3
- rails:
4
- - pagination_default: Default
5
-
6
-
7
- # react:
8
- # - pagination_default: Default
9
-
@@ -1 +0,0 @@
1
- export { default as PaginationDefault } from './_pagination_default.jsx'
@@ -1,7 +0,0 @@
1
- <%= content_tag(:div,
2
- aria: object.aria,
3
- class: object.classname,
4
- data: object.data,
5
- id: object.id) do %>
6
- <%= will_paginate object.page_data, renderer: Playbook::Pagination::Rails %>
7
- <% end %>
@@ -1,14 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "will_paginate/array"
4
- module Playbook
5
- module PbPagination
6
- class Pagination < ::Playbook::KitBase
7
- prop :data, type: Playbook::Props::Array,
8
- default: []
9
- def page_data
10
- data.paginate(page: params[:page], per_page: 1)
11
- end
12
- end
13
- end
14
- end
@@ -1,17 +0,0 @@
1
- import { renderKit } from '../utilities/test-utils'
2
-
3
- import { Pagination } from '../'
4
-
5
- /* See these resources for more testing info:
6
- - https://github.com/testing-library/jest-dom#usage for useage and examples
7
- - https://jestjs.io/docs/en/using-matchers
8
- */
9
-
10
- test('generated scaffold test - update me', () => {
11
- const props = {
12
- data: { testid: 'default' }
13
- }
14
-
15
- const kit = renderKit(Pagination , props)
16
- expect(kit).toBeInTheDocument()
17
- })
@@ -1,43 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require "will_paginate/view_helpers/action_view"
4
-
5
- module Playbook
6
- module Pagination
7
- class Rails < WillPaginate::ActionView::LinkRenderer
8
- def container_attributes
9
- { class: "pb_pagination pagination" }
10
- end
11
-
12
- def page_number(page)
13
- if page == current_page
14
- tag("li", tag("span", page), class: "active")
15
- else
16
- tag("li", link(page, page, rel: rel_value(page)))
17
- end
18
- end
19
-
20
- def previous_or_next_page(page, text, classname)
21
- if page
22
- tag("li", link(text, page), class: classname)
23
- else
24
- tag("li", tag("span", text), class: "%s disabled")
25
- end
26
- end
27
-
28
- def gap
29
- tag("li", tag("span", "&hellip;"), class: "disabled")
30
- end
31
-
32
- def previous_page
33
- num = @collection.current_page > 1 && @collection.current_page - 1
34
- previous_or_next_page(num, "<i class='far fa-chevron-left fa-xs'></i>", "prev")
35
- end
36
-
37
- def next_page
38
- num = @collection.current_page < @collection.total_pages && @collection.current_page + 1
39
- previous_or_next_page(num, "<i class='far fa-chevron-right fa-xs'></i>", "next")
40
- end
41
- end
42
- end
43
- end