playbook_ui 14.3.0.pre.rc.6 → 14.3.0.pre.rc.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/pb_kits/playbook/pb_dialog/dialog.html.erb +4 -1
- data/app/pb_kits/playbook/pb_dialog/dialog.rb +3 -0
- data/app/pb_kits/playbook/pb_dialog/dialogHelper.js +21 -0
- data/app/pb_kits/playbook/pb_dialog/dialog_footer.html.erb +4 -2
- data/app/pb_kits/playbook/pb_dialog/dialog_footer.rb +10 -1
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.html.erb +13 -0
- data/app/pb_kits/playbook/pb_dialog/docs/_dialog_loading.md +3 -0
- data/app/pb_kits/playbook/pb_dialog/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_pagination/_pagination.scss +3 -1
- data/app/pb_kits/playbook/pb_star_rating/docs/_star_rating_default_value.html.erb +1 -0
- data/app/pb_kits/playbook/pb_star_rating/docs/example.yml +1 -0
- data/app/pb_kits/playbook/pb_star_rating/index.js +11 -1
- data/app/pb_kits/playbook/pb_star_rating/star_rating.rb +3 -1
- data/dist/chunks/{_typeahead-LJmEV1CI.js → _typeahead-BWUFVlae.js} +1 -1
- data/dist/chunks/{_weekday_stacked-mN_WkUcx.js → _weekday_stacked-8iXUzsvg.js} +1 -1
- data/dist/chunks/{lib-DErGXNy3.js → lib-D9uVVKnh.js} +1 -1
- data/dist/chunks/{pb_form_validation-BC6kh7Hu.js → pb_form_validation-u2wnZ3oe.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 +1 -1
- metadata +8 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 87f159ff1ca1720cfe5d67393dee393d6ba2c8ba9cc5265c0c90803bf06298ab
|
4
|
+
data.tar.gz: 19e3c47ccac8485a2a65965817a9ab4c0035bf22c0eaaffc0f5eaaa7d0a35905
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6d517ea8d227655b4ce33b0ef06f9f85e53820cc58f4048e24ba9fc8ab8a38e82ee3b09553e9ec3a44782f97da429f441891cebe400313aeb975eb26cdf56926
|
7
|
+
data.tar.gz: d99e3d9ae1b4317a1bfb97e91488d4ec3fb4c92c90376e6093e67097663974b6f81c446ec4e0c34d42a93db70ee2f6a4a07feb0b4716d96df56325bc00cee910
|
@@ -22,8 +22,11 @@
|
|
22
22
|
<% if object.cancel_button && object.confirm_button %>
|
23
23
|
<%= pb_rails("dialog/dialog_footer", props: {
|
24
24
|
cancel_button: object.cancel_button,
|
25
|
+
cancel_button_id: object.cancel_button_id,
|
25
26
|
confirm_button: object.confirm_button,
|
26
|
-
|
27
|
+
confirm_button_id: object.confirm_button_id,
|
28
|
+
id: object.id,
|
29
|
+
loading: object.loading
|
27
30
|
}) %>
|
28
31
|
<% end %>
|
29
32
|
|
@@ -13,8 +13,11 @@ module Playbook
|
|
13
13
|
prop :should_close_on_overlay_click, type: Playbook::Props::Boolean, default: true
|
14
14
|
prop :title
|
15
15
|
prop :text
|
16
|
+
prop :loading
|
16
17
|
prop :confirm_button
|
18
|
+
prop :confirm_button_id
|
17
19
|
prop :cancel_button
|
20
|
+
prop :cancel_button_id
|
18
21
|
prop :status, type: Playbook::Props::Enum,
|
19
22
|
values: ["info", "caution", "delete", "error", "success", "default", ""],
|
20
23
|
default: ""
|
@@ -3,6 +3,27 @@ const dialogHelper = () => {
|
|
3
3
|
const closeTrigger = document.querySelectorAll("[data-close-dialog]");
|
4
4
|
const dialogs = document.querySelectorAll(".pb_dialog_rails")
|
5
5
|
|
6
|
+
const loadingButton = document.querySelector('[data-disable-with="Loading"]');
|
7
|
+
if (loadingButton) {
|
8
|
+
loadingButton.addEventListener("click", function() {
|
9
|
+
const okayLoadingButton = document.querySelector('[data-disable-with="Loading"]');
|
10
|
+
const cancelButton = document.querySelector('[data-disable-cancel-with="Loading"]');
|
11
|
+
let currentClass = okayLoadingButton.className;
|
12
|
+
let cancelClass = cancelButton ? cancelButton.className : "";
|
13
|
+
|
14
|
+
let newClass = currentClass.replace("_enabled", "_disabled_loading");
|
15
|
+
let newCancelClass = cancelClass.replace("_enabled", "_disabled");
|
16
|
+
|
17
|
+
// Disable the buttons
|
18
|
+
okayLoadingButton.disabled = true;
|
19
|
+
if (cancelButton) cancelButton.disabled = true;
|
20
|
+
|
21
|
+
okayLoadingButton.className = newClass;
|
22
|
+
if (cancelButton) cancelButton.className = newCancelClass;
|
23
|
+
});
|
24
|
+
}
|
25
|
+
|
26
|
+
|
6
27
|
openTrigger.forEach((open) => {
|
7
28
|
open.addEventListener("click", () => {
|
8
29
|
var openTriggerData = open.dataset.openDialog;
|
@@ -3,10 +3,12 @@
|
|
3
3
|
<% if object.confirm_button && object.cancel_button %>
|
4
4
|
<div class="dialog-pseudo-footer"></div>
|
5
5
|
<%= pb_rails("flex", props: { classname:object.classname, spacing:"between", padding_x:"sm", padding:"sm", padding_bottom:"sm" }) do %>
|
6
|
-
|
6
|
+
|
7
|
+
<%= pb_rails("button", props: { type: "submit", id: object.confirm_button_id, data: loading_data,
|
8
|
+
}) do %>
|
7
9
|
<%= object.confirm_button %>
|
8
10
|
<% end %>
|
9
|
-
<%= pb_rails("button", props: { type: "button", data: {"close-dialog": "#{object.id}" }, id: object.cancel_button_id, variant: "link"}) do %>
|
11
|
+
<%= pb_rails("button", props: { type: "button", data: {"close-dialog": "#{object.id}", "disable_cancel_with": cancel_loading }, id: object.cancel_button_id, variant: "link" }) do %>
|
10
12
|
<%= object.cancel_button %>
|
11
13
|
<% end %>
|
12
14
|
<% end %>
|
@@ -4,13 +4,22 @@ module Playbook
|
|
4
4
|
module PbDialog
|
5
5
|
class DialogFooter < Playbook::KitBase
|
6
6
|
prop :cancel_button
|
7
|
+
prop :cancel_button_id
|
7
8
|
prop :confirm_button
|
8
9
|
prop :confirm_button_id
|
9
|
-
prop :
|
10
|
+
prop :loading
|
10
11
|
|
11
12
|
def classname
|
12
13
|
generate_classname("dialog_footer")
|
13
14
|
end
|
15
|
+
|
16
|
+
def cancel_loading
|
17
|
+
loading ? "Loading" : ""
|
18
|
+
end
|
19
|
+
|
20
|
+
def loading_data
|
21
|
+
loading ? { disable_with: "Loading" } : {}
|
22
|
+
end
|
14
23
|
end
|
15
24
|
end
|
16
25
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
<%= pb_rails("button", props: { text: "Open Dialog", data: {"open-dialog": "dialog-loading"} }) %>
|
2
|
+
|
3
|
+
<%= pb_rails("dialog", props: {
|
4
|
+
id:"dialog-loading",
|
5
|
+
size: "sm",
|
6
|
+
title: "Loading Exmaple",
|
7
|
+
text: "Make a loading request?",
|
8
|
+
cancel_button: "Cancel Button",
|
9
|
+
cancel_button_id: "cancel-button-loading",
|
10
|
+
confirm_button: "Okay",
|
11
|
+
confirm_button_id: "confirm-button-loading",
|
12
|
+
loading: true,
|
13
|
+
}) %>
|
@@ -33,6 +33,7 @@ $top_bottom_radius: 0px;
|
|
33
33
|
border-top-right-radius: $top_bottom_radius;
|
34
34
|
border-bottom-right-radius: $top_bottom_radius;
|
35
35
|
cursor: pointer;
|
36
|
+
transition: background-color $transition_default ease-out, color $transition_default ease-out;
|
36
37
|
}
|
37
38
|
li:last-child > a, li:last-child > span, .pagination-number, .pagination-right {
|
38
39
|
padding: $pagination_padding;
|
@@ -40,13 +41,14 @@ $top_bottom_radius: 0px;
|
|
40
41
|
z-index: 2;
|
41
42
|
border-top-left-radius: $top_bottom_radius;
|
42
43
|
border-bottom-left-radius: $top_bottom_radius;
|
44
|
+
transition: background-color $transition_default ease-out, color $transition_default ease-out;
|
43
45
|
}
|
44
46
|
a, .pagination-number {
|
45
47
|
color: $text_lt_default;
|
46
48
|
font-size: $text_small;
|
47
49
|
font-weight: $regular;
|
48
50
|
border: none;
|
49
|
-
transition:
|
51
|
+
transition: background-color $transition_default ease-out, color $transition_default ease-out, border-color $transition_default ease-out;
|
50
52
|
|
51
53
|
&:hover {
|
52
54
|
@include hover-state;
|
@@ -0,0 +1 @@
|
|
1
|
+
<%= pb_rails("star_rating", props: { default_value: "2", padding_bottom: "xs", variant: "interactive" }) %>
|
@@ -12,6 +12,7 @@ export default class PbStarRating extends PbEnhancedElement {
|
|
12
12
|
connect() {
|
13
13
|
this.addEventListeners()
|
14
14
|
this.handleFormReset()
|
15
|
+
this.setDefaultValue()
|
15
16
|
}
|
16
17
|
|
17
18
|
addEventListeners() {
|
@@ -128,7 +129,7 @@ export default class PbStarRating extends PbEnhancedElement {
|
|
128
129
|
const form = this.element.closest("form")
|
129
130
|
if (form) {
|
130
131
|
form.addEventListener("reset", () => {
|
131
|
-
this.
|
132
|
+
this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR)?.setAttribute("value","")
|
132
133
|
this.resetStarRatingValues()
|
133
134
|
})
|
134
135
|
}
|
@@ -153,4 +154,13 @@ export default class PbStarRating extends PbEnhancedElement {
|
|
153
154
|
}
|
154
155
|
}
|
155
156
|
}
|
157
|
+
|
158
|
+
setDefaultValue() {
|
159
|
+
const hiddenInput = this.element.querySelector(STAR_RATING_INPUT_DATA_SELECTOR)
|
160
|
+
const defaultValue = hiddenInput.value
|
161
|
+
|
162
|
+
if (defaultValue) {
|
163
|
+
this.updateStarColors(defaultValue)
|
164
|
+
}
|
165
|
+
}
|
156
166
|
}
|
@@ -34,6 +34,7 @@ module Playbook
|
|
34
34
|
default: false
|
35
35
|
prop :input_options, type: Playbook::Props::HashProp,
|
36
36
|
default: {}
|
37
|
+
prop :default_value
|
37
38
|
|
38
39
|
def one_decimal_rating
|
39
40
|
rating.to_f.round(1)
|
@@ -120,7 +121,8 @@ module Playbook
|
|
120
121
|
data: { "pb-star-rating-input": true },
|
121
122
|
name: name,
|
122
123
|
required: required,
|
123
|
-
style: "display: none"
|
124
|
+
style: "display: none",
|
125
|
+
value: default_value || ""
|
124
126
|
)
|
125
127
|
end
|
126
128
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{jsx as jsx$1,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useReducer,useEffect,useMemo,useContext,createElement,useState,useRef,forwardRef,isValidElement,useCallback,useImperativeHandle,useLayoutEffect,Component,Fragment as Fragment$1}from"react";import{l as getDefaultExportFromCjs,t as filter,v as omit,w as get,k as commonjsGlobal,s as colors$1,q as highchartsTheme,x as merge,n as highchartsDarkTheme,y as useCollapsible,z as getAugmentedNamespace,A as createPopper,B as uniqueId,C as typography,E as cloneDeep,F as isString}from"./lib-
|
1
|
+
import{jsx as jsx$1,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{createContext,useReducer,useEffect,useMemo,useContext,createElement,useState,useRef,forwardRef,isValidElement,useCallback,useImperativeHandle,useLayoutEffect,Component,Fragment as Fragment$1}from"react";import{l as getDefaultExportFromCjs,t as filter,v as omit,w as get,k as commonjsGlobal,s as colors$1,q as highchartsTheme,x as merge,n as highchartsDarkTheme,y as useCollapsible,z as getAugmentedNamespace,A as createPopper,B as uniqueId,C as typography,E as cloneDeep,F as isString}from"./lib-D9uVVKnh.js";import*as ReactDOM from"react-dom";import ReactDOM__default,{createPortal}from"react-dom";import{TrixEditor}from"react-trix";import Trix from"trix";import require$$0 from"react-is";const initialState={items:[],dragData:{id:"",initialGroup:""},isDragging:"",activeContainer:""};const reducer=(state,action)=>{switch(action.type){case"SET_ITEMS":return Object.assign(Object.assign({},state),{items:action.payload});case"SET_DRAG_DATA":return Object.assign(Object.assign({},state),{dragData:action.payload});case"SET_IS_DRAGGING":return Object.assign(Object.assign({},state),{isDragging:action.payload});case"SET_ACTIVE_CONTAINER":return Object.assign(Object.assign({},state),{activeContainer:action.payload});case"CHANGE_CATEGORY":return Object.assign(Object.assign({},state),{items:state.items.map((item=>item.id===action.payload.itemId?Object.assign(Object.assign({},item),{container:action.payload.container}):item))});case"REORDER_ITEMS":{const{dragId:dragId,targetId:targetId}=action.payload;const newItems=[...state.items];const draggedItem=newItems.find((item=>item.id===dragId));const draggedIndex=newItems.indexOf(draggedItem);const targetIndex=newItems.findIndex((item=>item.id===targetId));newItems.splice(draggedIndex,1);newItems.splice(targetIndex,0,draggedItem);return Object.assign(Object.assign({},state),{items:newItems})}default:return state}};const DragContext=createContext({});const DraggableContext=()=>useContext(DragContext);const DraggableProvider=({children:children,initialItems:initialItems,onReorder:onReorder,onDragStart:onDragStart,onDragEnter:onDragEnter,onDragEnd:onDragEnd,onDrop:onDrop,onDragOver:onDragOver})=>{const[state,dispatch]=useReducer(reducer,initialState);useEffect((()=>{dispatch({type:"SET_ITEMS",payload:initialItems})}),[initialItems]);useEffect((()=>{onReorder(state.items)}),[state.items]);const handleDragStart=(id,container)=>{dispatch({type:"SET_DRAG_DATA",payload:{id:id,initialGroup:container}});dispatch({type:"SET_IS_DRAGGING",payload:id});if(onDragStart)onDragStart(id,container)};const handleDragEnter=(id,container)=>{if(state.dragData.id!==id){dispatch({type:"REORDER_ITEMS",payload:{dragId:state.dragData.id,targetId:id}});dispatch({type:"SET_DRAG_DATA",payload:{id:state.dragData.id,initialGroup:container}})}if(onDragEnter)onDragEnter(id,container)};const handleDragEnd=()=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});if(onDragEnd)onDragEnd()};const changeCategory=(itemId,container)=>{dispatch({type:"CHANGE_CATEGORY",payload:{itemId:itemId,container:container}})};const handleDrop=container=>{dispatch({type:"SET_IS_DRAGGING",payload:""});dispatch({type:"SET_ACTIVE_CONTAINER",payload:""});changeCategory(state.dragData.id,container);if(onDrop)onDrop(container)};const handleDragOver=(e2,container)=>{e2.preventDefault();dispatch({type:"SET_ACTIVE_CONTAINER",payload:container});if(onDragOver)onDragOver(e2,container)};const contextValue=useMemo((()=>({items:state.items,dragData:state.dragData,isDragging:state.isDragging,activeContainer:state.activeContainer,handleDragStart:handleDragStart,handleDragEnter:handleDragEnter,handleDragEnd:handleDragEnd,handleDrop:handleDrop,handleDragOver:handleDragOver})),[state]);return jsx$1(DragContext.Provider,Object.assign({value:contextValue},{children:children}),void 0)};var classnames$1={exports:{}};
|
2
2
|
/*!
|
3
3
|
Copyright (c) 2018 Jed Watson.
|
4
4
|
Licensed under the MIT License (MIT), see
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import{r as requireLazysizes}from"./lazysizes-B7xYodB-.js";import{jsx,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{useEffect,createContext,useContext,useState,useCallback,createElement,useRef,forwardRef,useImperativeHandle,Fragment as Fragment$1,useReducer,useMemo,useLayoutEffect,isValidElement}from"react";import{h as buildAriaProps,i as buildDataProps,j as buildHtmlProps,k as classnames,l as globalProps,m as buildCss,F as Flex,I as Icon,n as FlexItem,o as Body$1,p as Caption,A as Avatar,q as domSafeProps,r as Title,s as getAllIcons,S as SectionSeparator,t as Draggable,u as TextInput,v as PropTypes,w as Card,x as noop$3,y as PbReactPopover,z as CircleIconButton,E as Button,H as HighchartsReact,J as Badge,K as joinPresent,N as titleize,O as IconCircle,Q as Image,U as Checkbox,V as Radio}from"./_typeahead-
|
1
|
+
import{r as requireLazysizes}from"./lazysizes-B7xYodB-.js";import{jsx,Fragment,jsxs}from"react/jsx-runtime";import*as React from"react";import React__default,{useEffect,createContext,useContext,useState,useCallback,createElement,useRef,forwardRef,useImperativeHandle,Fragment as Fragment$1,useReducer,useMemo,useLayoutEffect,isValidElement}from"react";import{h as buildAriaProps,i as buildDataProps,j as buildHtmlProps,k as classnames,l as globalProps,m as buildCss,F as Flex,I as Icon,n as FlexItem,o as Body$1,p as Caption,A as Avatar,q as domSafeProps,r as Title,s as getAllIcons,S as SectionSeparator,t as Draggable,u as TextInput,v as PropTypes,w as Card,x as noop$3,y as PbReactPopover,z as CircleIconButton,E as Button,H as HighchartsReact,J as Badge,K as joinPresent,N as titleize,O as IconCircle,Q as Image,U as Checkbox,V as Radio}from"./_typeahead-BWUFVlae.js";import{g as PbTable,D as DateTime$1,a as datePickerHelper,u as useDropdown,o as omitBy,i as isEmpty,m as map,p as partial,j as find$1,k as commonjsGlobal,l as getDefaultExportFromCjs,n as highchartsDarkTheme,q as highchartsTheme,r as noop$4,s as colors,h as PbTextarea}from"./lib-D9uVVKnh.js";import*as ReactDOM from"react-dom";import ReactDOM__default,{createPortal}from"react-dom";var ls_attrchange={exports:{}};(function(module){(function(window2,factory){if(!window2){return}var globalInstall=function(){factory(window2.lazySizes);window2.removeEventListener("lazyunveilread",globalInstall,true)};factory=factory.bind(null,window2,window2.document);if(module.exports){factory(requireLazysizes())}else if(window2.lazySizes){globalInstall()}else{window2.addEventListener("lazyunveilread",globalInstall,true)}})(typeof window!="undefined"?window:0,(function(window2,document2,lazySizes){var addObserver=function(){var connect,disconnect,observer,connected;var lsCfg=lazySizes.cfg;var attributes={"data-bgset":1,"data-include":1,"data-poster":1,"data-bg":1,"data-script":1};var regClassTest="(\\s|^)("+lsCfg.loadedClass;var docElem=document2.documentElement;var setClass=function(target){lazySizes.rAF((function(){lazySizes.rC(target,lsCfg.loadedClass);if(lsCfg.unloadedClass){lazySizes.rC(target,lsCfg.unloadedClass)}lazySizes.aC(target,lsCfg.lazyClass);if(target.style.display=="none"||target.parentNode&&target.parentNode.style.display=="none"){setTimeout((function(){lazySizes.loader.unveil(target)}),0)}}))};var onMutation=function(mutations){var i,len,mutation,target;for(i=0,len=mutations.length;i<len;i++){mutation=mutations[i];target=mutation.target;if(!target.getAttribute(mutation.attributeName)){continue}if(target.localName=="source"&&target.parentNode){target=target.parentNode.querySelector("img")}if(target&®ClassTest.test(target.className)){setClass(target)}}};if(lsCfg.unloadedClass){regClassTest+="|"+lsCfg.unloadedClass}regClassTest+="|"+lsCfg.loadingClass+")(\\s|$)";regClassTest=new RegExp(regClassTest);attributes[lsCfg.srcAttr]=1;attributes[lsCfg.srcsetAttr]=1;if(window2.MutationObserver){observer=new MutationObserver(onMutation);connect=function(){if(!connected){connected=true;observer.observe(docElem,{subtree:true,attributes:true,attributeFilter:Object.keys(attributes)})}};disconnect=function(){if(connected){connected=false;observer.disconnect()}}}else{docElem.addEventListener("DOMAttrModified",function(){var runs;var modifications=[];var callMutations=function(){onMutation(modifications);modifications=[];runs=false};return function(e){if(connected&&attributes[e.attrName]&&e.newValue){modifications.push({target:e.target,attributeName:e.attrName});if(!runs){setTimeout(callMutations);runs=true}}}}(),true);connect=function(){connected=true};disconnect=function(){connected=false}}addEventListener("lazybeforeunveil",disconnect,true);addEventListener("lazybeforeunveil",connect);addEventListener("lazybeforesizes",disconnect,true);addEventListener("lazybeforesizes",connect);connect();removeEventListener("lazybeforeunveil",addObserver)};addEventListener("lazybeforeunveil",addObserver)}))})(ls_attrchange);
|
2
2
|
/**
|
3
3
|
* table-core
|
4
4
|
*
|