rails-active-ui 0.1.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 +7 -0
- data/Rakefile +6 -0
- data/app/assets/stylesheets.css +73555 -0
- data/app/components/accordion_component.rb +34 -0
- data/app/components/ad_component.rb +28 -0
- data/app/components/api_component.rb +24 -0
- data/app/components/breadcrumb_component.rb +26 -0
- data/app/components/button_component.rb +49 -0
- data/app/components/calendar_component.rb +34 -0
- data/app/components/card_component.rb +56 -0
- data/app/components/checkbox_component.rb +41 -0
- data/app/components/column_component.rb +62 -0
- data/app/components/comment_component.rb +45 -0
- data/app/components/concerns/alignable.rb +21 -0
- data/app/components/concerns/attachable.rb +16 -0
- data/app/components/concerns/orientable.rb +21 -0
- data/app/components/concerns/positionable.rb +21 -0
- data/app/components/concerns/sizeable.rb +18 -0
- data/app/components/container_component.rb +23 -0
- data/app/components/dimmer_component.rb +30 -0
- data/app/components/divider_component.rb +30 -0
- data/app/components/dropdown_component.rb +63 -0
- data/app/components/embed_component.rb +32 -0
- data/app/components/emoji_component.rb +15 -0
- data/app/components/feed_component.rb +22 -0
- data/app/components/flag_component.rb +15 -0
- data/app/components/flyout_component.rb +41 -0
- data/app/components/form_component.rb +39 -0
- data/app/components/grid_component.rb +85 -0
- data/app/components/h_stack_component.rb +67 -0
- data/app/components/header_component.rb +60 -0
- data/app/components/icon_component.rb +41 -0
- data/app/components/image_component.rb +46 -0
- data/app/components/input_component.rb +52 -0
- data/app/components/item_component.rb +39 -0
- data/app/components/item_group_component.rb +30 -0
- data/app/components/label_component.rb +49 -0
- data/app/components/link_component.rb +23 -0
- data/app/components/list_component.rb +39 -0
- data/app/components/loader_component.rb +33 -0
- data/app/components/menu_component.rb +64 -0
- data/app/components/menu_item_component.rb +52 -0
- data/app/components/message_component.rb +54 -0
- data/app/components/modal_component.rb +50 -0
- data/app/components/nag_component.rb +25 -0
- data/app/components/overlay_component.rb +16 -0
- data/app/components/placeholder_component.rb +39 -0
- data/app/components/popup_component.rb +31 -0
- data/app/components/progress_component.rb +48 -0
- data/app/components/pusher_component.rb +18 -0
- data/app/components/rail_component.rb +31 -0
- data/app/components/rating_component.rb +41 -0
- data/app/components/reset_component.rb +12 -0
- data/app/components/reveal_component.rb +39 -0
- data/app/components/row_component.rb +39 -0
- data/app/components/search_component.rb +44 -0
- data/app/components/segment_component.rb +57 -0
- data/app/components/segment_group_component.rb +36 -0
- data/app/components/shape_component.rb +25 -0
- data/app/components/sidebar_component.rb +33 -0
- data/app/components/site_component.rb +12 -0
- data/app/components/slider_component.rb +46 -0
- data/app/components/state_component.rb +25 -0
- data/app/components/statistic_component.rb +43 -0
- data/app/components/step_component.rb +56 -0
- data/app/components/step_group_component.rb +38 -0
- data/app/components/sticky_component.rb +22 -0
- data/app/components/sub_header_component.rb +15 -0
- data/app/components/sub_menu_component.rb +24 -0
- data/app/components/tab_component.rb +24 -0
- data/app/components/table_cell_component.rb +60 -0
- data/app/components/table_component.rb +160 -0
- data/app/components/table_row_component.rb +43 -0
- data/app/components/text_component.rb +73 -0
- data/app/components/toast_component.rb +36 -0
- data/app/components/transition_component.rb +32 -0
- data/app/components/v_stack_component.rb +31 -0
- data/app/components/visibility_component.rb +22 -0
- data/app/helpers/component_helper.rb +109 -0
- data/app/helpers/fui_helper.rb +53 -0
- data/app/javascript/accordion.js +547 -0
- data/app/javascript/accordion.min.js +11 -0
- data/app/javascript/api.js +1112 -0
- data/app/javascript/api.min.js +11 -0
- data/app/javascript/calendar.js +1960 -0
- data/app/javascript/calendar.min.js +11 -0
- data/app/javascript/checkbox.js +819 -0
- data/app/javascript/checkbox.min.js +11 -0
- data/app/javascript/dimmer.js +686 -0
- data/app/javascript/dimmer.min.js +11 -0
- data/app/javascript/dropdown.js +4019 -0
- data/app/javascript/dropdown.min.js +11 -0
- data/app/javascript/embed.js +646 -0
- data/app/javascript/embed.min.js +11 -0
- data/app/javascript/flyout.js +1405 -0
- data/app/javascript/flyout.min.js +11 -0
- data/app/javascript/form.js +2070 -0
- data/app/javascript/form.min.js +11 -0
- data/app/javascript/jquery.js +10716 -0
- data/app/javascript/jquery.min.js +2 -0
- data/app/javascript/modal.js +1507 -0
- data/app/javascript/modal.min.js +11 -0
- data/app/javascript/nag.js +522 -0
- data/app/javascript/nag.min.js +11 -0
- data/app/javascript/popup.js +1457 -0
- data/app/javascript/popup.min.js +11 -0
- data/app/javascript/progress.js +922 -0
- data/app/javascript/progress.min.js +11 -0
- data/app/javascript/rating.js +496 -0
- data/app/javascript/rating.min.js +11 -0
- data/app/javascript/search.js +1519 -0
- data/app/javascript/search.min.js +11 -0
- data/app/javascript/shape.js +721 -0
- data/app/javascript/shape.min.js +11 -0
- data/app/javascript/sidebar.js +952 -0
- data/app/javascript/sidebar.min.js +11 -0
- data/app/javascript/site.js +415 -0
- data/app/javascript/site.min.js +11 -0
- data/app/javascript/slider.js +1449 -0
- data/app/javascript/slider.min.js +11 -0
- data/app/javascript/state.js +653 -0
- data/app/javascript/state.min.js +11 -0
- data/app/javascript/sticky.js +852 -0
- data/app/javascript/sticky.min.js +11 -0
- data/app/javascript/tab.js +867 -0
- data/app/javascript/tab.min.js +11 -0
- data/app/javascript/toast.js +916 -0
- data/app/javascript/toast.min.js +11 -0
- data/app/javascript/transition.js +955 -0
- data/app/javascript/transition.min.js +11 -0
- data/app/javascript/ui/controllers/fui_accordion_controller.js +45 -0
- data/app/javascript/ui/controllers/fui_api_controller.js +80 -0
- data/app/javascript/ui/controllers/fui_calendar_controller.js +66 -0
- data/app/javascript/ui/controllers/fui_checkbox_controller.js +48 -0
- data/app/javascript/ui/controllers/fui_dimmer_controller.js +45 -0
- data/app/javascript/ui/controllers/fui_dropdown_controller.js +68 -0
- data/app/javascript/ui/controllers/fui_embed_controller.js +49 -0
- data/app/javascript/ui/controllers/fui_flyout_controller.js +49 -0
- data/app/javascript/ui/controllers/fui_form_controller.js +62 -0
- data/app/javascript/ui/controllers/fui_modal_controller.js +61 -0
- data/app/javascript/ui/controllers/fui_nag_controller.js +52 -0
- data/app/javascript/ui/controllers/fui_popup_controller.js +58 -0
- data/app/javascript/ui/controllers/fui_progress_controller.js +60 -0
- data/app/javascript/ui/controllers/fui_rating_controller.js +49 -0
- data/app/javascript/ui/controllers/fui_search_controller.js +76 -0
- data/app/javascript/ui/controllers/fui_shape_controller.js +45 -0
- data/app/javascript/ui/controllers/fui_sidebar_controller.js +48 -0
- data/app/javascript/ui/controllers/fui_site_controller.js +29 -0
- data/app/javascript/ui/controllers/fui_slider_controller.js +53 -0
- data/app/javascript/ui/controllers/fui_state_controller.js +63 -0
- data/app/javascript/ui/controllers/fui_sticky_controller.js +50 -0
- data/app/javascript/ui/controllers/fui_tab_controller.js +57 -0
- data/app/javascript/ui/controllers/fui_toast_controller.js +60 -0
- data/app/javascript/ui/controllers/fui_transition_controller.js +60 -0
- data/app/javascript/ui/controllers/fui_visibility_controller.js +55 -0
- data/app/javascript/ui/index.js +114 -0
- data/app/javascript/visibility.js +1196 -0
- data/app/javascript/visibility.min.js +11 -0
- data/app/lib/component.rb +63 -0
- data/config/importmap.rb +27 -0
- data/config/initializers/ruby_template_handler.rb +31 -0
- data/config/routes.rb +2 -0
- data/lib/tasks/ui_tasks.rake +4 -0
- data/lib/ui/engine.rb +27 -0
- data/lib/ui/version.rb +3 -0
- data/lib/ui.rb +6 -0
- metadata +220 -0
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* # Fomantic UI - 2.9.4
|
|
3
|
+
* https://github.com/fomantic/Fomantic-UI
|
|
4
|
+
* https://fomantic-ui.com/
|
|
5
|
+
*
|
|
6
|
+
* Copyright 2026 Contributors
|
|
7
|
+
* Released under the MIT license
|
|
8
|
+
* https://opensource.org/licenses/MIT
|
|
9
|
+
*
|
|
10
|
+
*/
|
|
11
|
+
!function(h,n){"use strict";n=void 0!==n&&n.Math===Math?n:globalThis,h.fn.transition=function(...n){const o=h(this);let r=Date.now(),s=[];const p=n,g=n[0],v=n.slice(1);let b="string"==typeof g,y;return o.each(function(i){const l=h(this),d=this;let c,u,e,m,t,n,a;const f={initialize:function(){c=f.get.settings(...p),m=c.className,e=c.error,t=c.metadata,a="."+c.namespace,n="module-"+c.namespace,u=l.data(n)||f,!1===(b=b&&f.invoke(g))&&(f.verbose("Converted arguments into settings object",c),c.interval?f.delay(c.interval):f.animate(),f.instantiate())},instantiate:function(){f.verbose("Storing instance of module",f),u=f,l.data(n,u)},destroy:function(){f.verbose("Destroying previous module for",d),l.removeData(n)},refresh:function(){f.verbose("Refreshing display type on next animation"),delete f.displayType},forceRepaint:function(){f.verbose("Forcing element repaint");var n=l.parent(),e=l.next();0===e.length?l.detach().appendTo(n):l.detach().insertBefore(e)},repaint:function(){f.verbose("Repainting element");d.offsetWidth},delay:function(n=c.interval){let e=f.get.animationDirection();e=e||(f.can.transition()?f.get.direction():"static");n="auto"===c.reverse&&e===m.outward||!0===c.reverse?(o.length-i)*n:i*n;f.debug("Delaying animation by",n),setTimeout(function(){f.animate()},n)},animate:function(n=c){if(c=n,f.debug("Preparing animation",c.animation),f.is.animating()){if(c.queue)return!c.allowRepeats&&f.has.direction()&&f.is.occurring()&&!0!==f.queuing?f.debug("Animation is currently occurring, preventing queueing same animation",c.animation):f.queue(c.animation),!1;if(!c.allowRepeats&&f.is.occurring())return f.debug("Animation is already occurring, will not execute repeated animation",c.animation),!1;f.debug("New animation started, completing previous early",c.animation),u.complete()}f.can.animate()?f.set.animating(c.animation):f.error(e.noAnimation,c.animation,d)},reset:function(){f.debug("Resetting animation to beginning conditions"),f.remove.animationCallbacks(),f.restore.conditions(),f.remove.animating()},queue:function(n){f.debug("Queueing animation of",n),f.queuing=!0,l.one("animationend.queue"+a,function(){f.queuing=!1,f.repaint(),f.animate.call(this,c)})},complete:function(n){n&&n.target===d&&n.stopPropagation(),f.debug("Animation complete",c.animation),f.remove.completeCallback(),f.remove.failSafe(),f.is.looping()||(f.is.outward()?(f.verbose("Animation is outward, hiding element"),f.restore.conditions(),f.hide()):f.is.inward()?(f.verbose("Animation is inward, showing element"),f.restore.conditions(),f.show()):(f.verbose("Static animation completed"),f.restore.conditions(),c.onComplete.call(d)))},force:{visible:function(){var n=l.attr("style"),n=f.get.userStyle(n),e=f.get.displayType(),n=n+"display: "+e+" !important;",i=l[0].style.display;return!e||"none"===i&&c.skipInlineHidden||l[0].tagName.match(/(script|link|style)/i)?(f.remove.transition(),!1):(f.verbose("Overriding default display to show element",e),l.attr("style",n),!0)},hidden:function(){var n=l.attr("style"),n=void 0===n||""===n;"none"===l.css("display")||f.is.hidden()?n&&l.removeAttr("style"):(f.verbose("Overriding default display to hide element"),l.css("display","none"))}},has:{direction:function(n){let i=!1;return"string"==typeof(n=n||c.animation)&&(n=n.split(" "),h.each(n,function(n,e){e!==m.inward&&e!==m.outward||(i=!0)})),i},inlineDisplay:function(){const n=l.attr("style")||"";return Array.isArray(n.match(/display.*?;/,""))}},set:{animating:function(n){f.remove.completeCallback(),n=n||c.animation;n=f.get.animationClass(n);f.save.animation(n),f.force.visible()&&(f.remove.hidden(),f.remove.direction(),f.start.animation(n))},duration:function(n=c.duration){!(n="number"==typeof n?n+"ms":n)&&0!==n||(f.verbose("Setting animation duration",n),l.css({"animation-duration":n}))},direction:function(n=f.get.direction()){n===m.inward?f.set.inward():f.set.outward()},looping:function(){f.debug("Transition set to loop"),l.addClass(m.looping)},hidden:function(){l.addClass(m.transition).addClass(m.hidden)},inward:function(){f.debug("Setting direction to inward"),l.removeClass(m.outward).addClass(m.inward)},outward:function(){f.debug("Setting direction to outward"),l.removeClass(m.inward).addClass(m.outward)},visible:function(){l.addClass(m.transition).addClass(m.visible)}},start:{animation:function(n=f.get.animationClass()){f.debug("Starting tween",n),l.addClass(n).one("animationend.complete"+a,f.complete),c.useFailSafe&&f.add.failSafe(),f.set.duration(c.duration),c.onStart.call(d)}},save:{animation:function(n){f.cache||(f.cache={}),f.cache.animation=n},displayType:function(n){"none"!==n&&l.data(t.displayType,n)},transitionExists:function(n,e){h.fn.transition.exists[n]=e,f.verbose("Saving existence of transition",n,e)}},restore:{conditions:function(){var n=f.get.currentAnimation();n&&(l.removeClass(n),f.verbose("Removing animation class",f.cache)),f.remove.duration()}},add:{failSafe:function(){var n=f.get.duration();f.timer=setTimeout(function(){l.triggerHandler("animationend")},n+c.failSafeDelay),f.verbose("Adding fail safe timer",f.timer)}},remove:{animating:function(){l.removeClass(m.animating)},animationCallbacks:function(){f.remove.queueCallback(),f.remove.completeCallback()},queueCallback:function(){l.off(".queue"+a)},completeCallback:function(){l.off(".complete"+a)},display:function(){l.css("display","")},direction:function(){l.removeClass(m.inward).removeClass(m.outward)},duration:function(){l.css("animation-duration","")},failSafe:function(){f.verbose("Removing fail safe timer",f.timer),f.timer&&clearTimeout(f.timer)},hidden:function(){l.removeClass(m.hidden)},visible:function(){l.removeClass(m.visible)},looping:function(){f.debug("Transitions are no longer looping"),f.is.looping()&&(f.reset(),l.removeClass(m.looping))},transition:function(){l.removeClass(m.transition).removeClass(m.visible).removeClass(m.hidden)}},get:{settings:function(n,e,i){return"object"==typeof n?h.extend(!0,{},h.fn.transition.settings,n):"function"==typeof i?h.extend({},h.fn.transition.settings,{animation:n,onComplete:i,duration:e}):"string"==typeof e||"number"==typeof e?h.extend({},h.fn.transition.settings,{animation:n,duration:e}):"object"==typeof e?h.extend({},h.fn.transition.settings,e,{animation:n}):"function"==typeof e?h.extend({},h.fn.transition.settings,{animation:n,onComplete:e}):h.extend({},h.fn.transition.settings,{animation:n})},animationClass:function(n=c.animation){var e=f.can.transition()&&!f.has.direction()?f.get.direction()+" ":"";return m.animating+" "+m.transition+" "+e+n},currentAnimation:function(){return!(!f.cache||void 0===f.cache.animation)&&f.cache.animation},currentDirection:function(){return f.is.inward()?m.inward:m.outward},direction:function(){return f.is.hidden()||!f.is.visible()?m.inward:m.outward},animationDirection:function(n=c.animation){let i;return"string"==typeof n&&(n=n.split(" "),h.each(n,function(n,e){e===m.inward?i=m.inward:e===m.outward&&(i=m.outward)})),i||!1},duration:function(n=c.duration){return"string"==typeof(n=!1===n?l.css("animation-duration")||0:n)?n.includes("ms")?Number.parseFloat(n):1e3*Number.parseFloat(n):n},displayType:function(n=!0){return c.displayType||(n&&void 0===l.data(t.displayType)&&(""===(n=l.css("display"))||"none"===n?f.can.transition(!0):f.save.displayType(n)),l.data(t.displayType))},userStyle:function(n){return(n=n||l.attr("style")||"").replace(/display.*?;/,"")},transitionExists:function(n){return h.fn.transition.exists[n]}},can:{transition:function(n){var e,i,t=c.animation,a=f.get.transitionExists(t);let o=f.get.displayType(!1),r,s;if(void 0===a||n){if(f.verbose("Determining whether animation exists"),n=l.attr("class"),e=l.prop("tagName"),e=(r=h("<"+e+" />").addClass(n).insertAfter(l)).addClass(t).removeClass(m.inward).removeClass(m.outward).addClass(m.animating).addClass(m.transition).css("animationName"),r.detach().insertAfter(l),i=r.addClass(m.inward).css("animationName"),o||(r.detach().insertAfter(l),o=r.attr("class",n).removeAttr("style").removeClass(m.hidden).removeClass(m.visible).show().css("display"),f.verbose("Determining final display state",o),f.save.displayType(o)),r.remove(),e!==i)f.debug("Direction exists for animation",t),s=!0;else{if("none"===e||!e)return void f.debug("No animation defined in css",t);f.debug("Static animation found",t,o),s=!1}f.save.transitionExists(t,s)}return void 0!==a?a:s},animate:function(){return void 0!==f.can.transition()}},is:{animating:function(){return l.hasClass(m.animating)},inward:function(){return l.hasClass(m.inward)},outward:function(){return l.hasClass(m.outward)},looping:function(){return l.hasClass(m.looping)},occurring:function(n=c.animation){return n="."+n.replace(" ","."),0<l.filter(n).length},visible:function(){return l.is(":visible")},hidden:function(){return"hidden"===l.css("visibility")},supported:function(){return!0}},hide:function(){if(!1===c.onHide.call(d))return f.verbose("Hide callback returned false cancelling hide"),!1;f.verbose("Hiding element"),f.is.animating()&&f.reset(),d.blur(),f.remove.display(),f.remove.visible(),c.onBeforeHide.call(d,f.hideNow)},hideNow:function(){f.set.hidden(),f.force.hidden(),c.onHidden.call(d),c.onComplete.call(d)},show:function(n){f.force.visible()&&!1!==c.onShow.call(d)&&(f.verbose("Showing element",n),f.remove.hidden(),c.onBeforeShow.call(d,f.showNow))},showNow:function(){f.set.visible(),c.onVisible.call(d),c.onComplete.call(d)},toggle:function(){f.is.visible()?f.hide():f.show()},stop:function(){f.debug("Stopping current animation"),l.triggerHandler("animationend")},stopAll:function(){f.debug("Stopping all animation"),f.remove.queueCallback(),l.triggerHandler("animationend")},clear:{queue:function(){f.debug("Clearing animation queue"),f.remove.queueCallback()}},enable:function(){f.verbose("Starting animation"),l.removeClass(m.disabled)},disable:function(){f.debug("Stopping animation"),l.addClass(m.disabled)},setting:function(n,e){if(f.debug("Changing setting",n,e),h.isPlainObject(n))h.extend(!0,c,n);else{if(void 0===e)return c[n];h.isPlainObject(c[n])?h.extend(!0,c[n],e):c[n]=e}},internal:function(n,e){if(h.isPlainObject(n))h.extend(!0,f,n);else{if(void 0===e)return f[n];f[n]=e}},debug:function(...n){!c.silent&&c.debug&&(c.performance?f.performance.log(n):(f.debug=Function.prototype.bind.call(console.info,console,c.name+":"),f.debug.apply(console,n)))},verbose:function(...n){!c.silent&&c.verbose&&c.debug&&(c.performance?f.performance.log(n):(f.verbose=Function.prototype.bind.call(console.info,console,c.name+":"),f.verbose.apply(console,n)))},error:function(...n){c.silent||(f.error=Function.prototype.bind.call(console.error,console,c.name+":"),f.error.apply(console,n))},performance:{log:function(n){var e,i;c.performance&&(i=(e=Date.now())-(r||e),r=e,s.push({Name:n[0],Arguments:n.slice(1),Element:d,"Execution Time":i})),clearTimeout(f.performance.timer),f.performance.timer=setTimeout(function(){f.performance.display()},500)},display:function(){let n=c.name+":",i=0;r=!1,clearTimeout(f.performance.timer),h.each(s,function(n,e){i+=e["Execution Time"]}),n+=" "+i+"ms",1<o.length&&(n+=" ("+o.length+")"),0<s.length&&(console.groupCollapsed(n),console.table(s),console.groupEnd()),s=[]}},invoke:function(t,n=v,e=d){let a=u,o,r,i;var s;return"string"==typeof t&&void 0!==a&&(t=t.split(/[ .]/),o=t.length-1,h.each(t,function(n,e){var i=n!==o?e+t[n+1].charAt(0).toUpperCase()+t[n+1].slice(1):t;if(h.isPlainObject(a[i])&&n!==o)a=a[i];else{if(void 0!==a[i])return r=a[i],!1;{if(!h.isPlainObject(a[e])||n===o)return void 0!==a[e]&&(r=a[e]),!1;a=a[e]}}})),"function"==typeof(s=r)&&"number"!=typeof s.nodeType?i=r.apply(e,n):void 0!==r&&(i=r),Array.isArray(y)?y.push(i):void 0!==y?y=[y,i]:void 0!==i&&(y=i),void 0!==r&&r}};f.initialize()}),void 0!==y?y:this},h.fn.transition.exists={},h.fn.transition.settings={name:"Transition",silent:!1,debug:!1,verbose:!1,performance:!0,namespace:"transition",interval:0,reverse:"auto",onStart:function(){},onComplete:function(){},onShow:function(){},onBeforeShow:function(n){n.call(this)},onVisible:function(){},onHide:function(){},onHidden:function(){},onBeforeHide:function(n){n.call(this)},useFailSafe:!0,failSafeDelay:100,allowRepeats:!1,displayType:!1,animation:"fade",duration:!1,queue:!0,skipInlineHidden:!1,metadata:{displayType:"display"},className:{animating:"animating",disabled:"disabled",hidden:"hidden",inward:"in",loading:"loading",looping:"looping",outward:"out",transition:"transition",visible:"visible"},error:{noAnimation:"Element is no longer attached to DOM. Unable to animate. Use silent setting to suppress this warning in production."}}}(jQuery,window,document);
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
// Fomantic-UI Accordion — collapsible content panels.
|
|
4
|
+
// Bridges: $.fn.accordion
|
|
5
|
+
//
|
|
6
|
+
// Usage:
|
|
7
|
+
// <div class="ui accordion" data-controller="fui-accordion">
|
|
8
|
+
// <div class="title"><i class="dropdown icon"></i> Section</div>
|
|
9
|
+
// <div class="content"><p>Panel content</p></div>
|
|
10
|
+
// </div>
|
|
11
|
+
//
|
|
12
|
+
export default class extends Controller {
|
|
13
|
+
static values = {
|
|
14
|
+
exclusive: { type: Boolean, default: true },
|
|
15
|
+
collapsible: { type: Boolean, default: true },
|
|
16
|
+
duration: { type: Number, default: 350 },
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
connect() {
|
|
20
|
+
$(this.element).accordion(this._options())
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
disconnect() {
|
|
24
|
+
$(this.element).accordion("destroy")
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
open(index) { $(this.element).accordion("open", index) }
|
|
28
|
+
close(index) { $(this.element).accordion("close", index) }
|
|
29
|
+
toggle(index){ $(this.element).accordion("toggle", index) }
|
|
30
|
+
|
|
31
|
+
// -- Private --
|
|
32
|
+
|
|
33
|
+
_options() {
|
|
34
|
+
return {
|
|
35
|
+
exclusive: this.exclusiveValue,
|
|
36
|
+
collapsible: this.collapsibleValue,
|
|
37
|
+
duration: this.durationValue,
|
|
38
|
+
onOpening: () => { this.dispatch("opening") },
|
|
39
|
+
onOpen: () => { this.dispatch("open") },
|
|
40
|
+
onClosing: () => { this.dispatch("closing") },
|
|
41
|
+
onClose: () => { this.dispatch("close") },
|
|
42
|
+
onChange: () => { this.dispatch("change") },
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
// Fomantic-UI API — AJAX request management with state toggling.
|
|
4
|
+
// Bridges: $.fn.api
|
|
5
|
+
//
|
|
6
|
+
// Usage:
|
|
7
|
+
// <button data-controller="fui-api"
|
|
8
|
+
// data-fui-api-url-value="/api/items"
|
|
9
|
+
// data-fui-api-method-value="get"
|
|
10
|
+
// data-action="click->fui-api#query">
|
|
11
|
+
// Load Items
|
|
12
|
+
// </button>
|
|
13
|
+
//
|
|
14
|
+
export default class extends Controller {
|
|
15
|
+
static values = {
|
|
16
|
+
url: { type: String, default: "" },
|
|
17
|
+
method: { type: String, default: "get" },
|
|
18
|
+
dataType: { type: String, default: "json" },
|
|
19
|
+
serializeForm: { type: Boolean, default: false },
|
|
20
|
+
cache: { type: Boolean, default: false },
|
|
21
|
+
loadingDuration: { type: Number, default: 0 },
|
|
22
|
+
errorDuration: { type: Number, default: 2000 },
|
|
23
|
+
throttle: { type: Number, default: 0 },
|
|
24
|
+
on: { type: String, default: "" },
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
connect() {
|
|
28
|
+
// Only auto-initialize if 'on' is set (e.g., "click", "now").
|
|
29
|
+
// Otherwise, API is triggered via the query() action.
|
|
30
|
+
if (this.onValue) {
|
|
31
|
+
$(this.element).api(this._options())
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
disconnect() {
|
|
36
|
+
$(this.element).api("destroy")
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
query() {
|
|
40
|
+
$(this.element).api(this._options()).api("query")
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
abort() {
|
|
44
|
+
$(this.element).api("abort")
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
// -- Private --
|
|
48
|
+
|
|
49
|
+
_options() {
|
|
50
|
+
const opts = {
|
|
51
|
+
url: this.urlValue,
|
|
52
|
+
method: this.methodValue,
|
|
53
|
+
dataType: this.dataTypeValue,
|
|
54
|
+
serializeForm: this.serializeFormValue,
|
|
55
|
+
cache: this.cacheValue,
|
|
56
|
+
loadingDuration: this.loadingDurationValue,
|
|
57
|
+
errorDuration: this.errorDurationValue,
|
|
58
|
+
throttle: this.throttleValue,
|
|
59
|
+
onSuccess: (response) => {
|
|
60
|
+
this.dispatch("success", { detail: { response } })
|
|
61
|
+
},
|
|
62
|
+
onFailure: (response) => {
|
|
63
|
+
this.dispatch("failure", { detail: { response } })
|
|
64
|
+
},
|
|
65
|
+
onComplete: (response) => {
|
|
66
|
+
this.dispatch("complete", { detail: { response } })
|
|
67
|
+
},
|
|
68
|
+
onAbort: () => {
|
|
69
|
+
this.dispatch("abort")
|
|
70
|
+
},
|
|
71
|
+
onError: (errorMessage) => {
|
|
72
|
+
this.dispatch("error", { detail: { error: errorMessage } })
|
|
73
|
+
},
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
if (this.onValue) opts.on = this.onValue
|
|
77
|
+
|
|
78
|
+
return opts
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
// Fomantic-UI Calendar — date/time picker popup.
|
|
4
|
+
// Bridges: $.fn.calendar
|
|
5
|
+
//
|
|
6
|
+
// Usage:
|
|
7
|
+
// <div class="ui calendar" data-controller="fui-calendar"
|
|
8
|
+
// data-fui-calendar-type-value="date">
|
|
9
|
+
// <div class="ui input left icon">
|
|
10
|
+
// <i class="calendar icon"></i>
|
|
11
|
+
// <input type="text" placeholder="Date">
|
|
12
|
+
// </div>
|
|
13
|
+
// </div>
|
|
14
|
+
//
|
|
15
|
+
export default class extends Controller {
|
|
16
|
+
static values = {
|
|
17
|
+
type: { type: String, default: "date" },
|
|
18
|
+
closable: { type: Boolean, default: true },
|
|
19
|
+
monthFirst: { type: Boolean, default: true },
|
|
20
|
+
firstDayOfWeek: { type: Number, default: 0 },
|
|
21
|
+
today: { type: Boolean, default: false },
|
|
22
|
+
formatInput: { type: Boolean, default: true },
|
|
23
|
+
minDate: { type: String, default: "" },
|
|
24
|
+
maxDate: { type: String, default: "" },
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
connect() {
|
|
28
|
+
$(this.element).calendar(this._options())
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
disconnect() {
|
|
32
|
+
$(this.element).calendar("destroy")
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
show() { $(this.element).calendar("popup", "show") }
|
|
36
|
+
hide() { $(this.element).calendar("popup", "hide") }
|
|
37
|
+
toggle() { $(this.element).calendar("popup", "toggle") }
|
|
38
|
+
clear() { $(this.element).calendar("clear") }
|
|
39
|
+
focus() { $(this.element).calendar("focus") }
|
|
40
|
+
|
|
41
|
+
getDate() { return $(this.element).calendar("get date") }
|
|
42
|
+
setDate(d) { $(this.element).calendar("set date", d) }
|
|
43
|
+
|
|
44
|
+
// -- Private --
|
|
45
|
+
|
|
46
|
+
_options() {
|
|
47
|
+
const opts = {
|
|
48
|
+
type: this.typeValue,
|
|
49
|
+
closable: this.closableValue,
|
|
50
|
+
monthFirst: this.monthFirstValue,
|
|
51
|
+
firstDayOfWeek: this.firstDayOfWeekValue,
|
|
52
|
+
today: this.todayValue,
|
|
53
|
+
formatInput: this.formatInputValue,
|
|
54
|
+
onChange: (date, text) => {
|
|
55
|
+
this.dispatch("change", { detail: { date, text } })
|
|
56
|
+
},
|
|
57
|
+
onShow: () => { this.dispatch("show") },
|
|
58
|
+
onHide: () => { this.dispatch("hide") },
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
if (this.minDateValue) opts.minDate = new Date(this.minDateValue)
|
|
62
|
+
if (this.maxDateValue) opts.maxDate = new Date(this.maxDateValue)
|
|
63
|
+
|
|
64
|
+
return opts
|
|
65
|
+
}
|
|
66
|
+
}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
// Fomantic-UI Checkbox — checkboxes, radios, toggles, sliders.
|
|
4
|
+
// Bridges: $.fn.checkbox
|
|
5
|
+
//
|
|
6
|
+
// Usage:
|
|
7
|
+
// <div class="ui checkbox" data-controller="fui-checkbox">
|
|
8
|
+
// <input type="checkbox">
|
|
9
|
+
// <label>Accept terms</label>
|
|
10
|
+
// </div>
|
|
11
|
+
//
|
|
12
|
+
export default class extends Controller {
|
|
13
|
+
static values = {
|
|
14
|
+
uncheckable: { type: Boolean, default: true },
|
|
15
|
+
fireOnInit: { type: Boolean, default: false },
|
|
16
|
+
enableEnterKey: { type: Boolean, default: true },
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
connect() {
|
|
20
|
+
$(this.element).checkbox(this._options())
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
disconnect() {
|
|
24
|
+
$(this.element).checkbox("destroy")
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
toggle() { $(this.element).checkbox("toggle") }
|
|
28
|
+
check() { $(this.element).checkbox("check") }
|
|
29
|
+
uncheck() { $(this.element).checkbox("uncheck") }
|
|
30
|
+
enable() { $(this.element).checkbox("enable") }
|
|
31
|
+
disable() { $(this.element).checkbox("disable") }
|
|
32
|
+
isChecked() { return $(this.element).checkbox("is checked") }
|
|
33
|
+
|
|
34
|
+
// -- Private --
|
|
35
|
+
|
|
36
|
+
_options() {
|
|
37
|
+
return {
|
|
38
|
+
uncheckable: this.uncheckableValue,
|
|
39
|
+
fireOnInit: this.fireOnInitValue,
|
|
40
|
+
enableEnterKey: this.enableEnterKeyValue,
|
|
41
|
+
onChecked: () => { this.dispatch("checked") },
|
|
42
|
+
onUnchecked: () => { this.dispatch("unchecked") },
|
|
43
|
+
onChange: () => { this.dispatch("change") },
|
|
44
|
+
onEnable: () => { this.dispatch("enable") },
|
|
45
|
+
onDisable: () => { this.dispatch("disable") },
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
// Fomantic-UI Dimmer — page/element overlay.
|
|
4
|
+
// Bridges: $.fn.dimmer
|
|
5
|
+
//
|
|
6
|
+
// Usage:
|
|
7
|
+
// <div class="dimmable" data-controller="fui-dimmer">
|
|
8
|
+
// <div class="ui dimmer">
|
|
9
|
+
// <div class="content">Dimmed content</div>
|
|
10
|
+
// </div>
|
|
11
|
+
// <p>Page content</p>
|
|
12
|
+
// </div>
|
|
13
|
+
//
|
|
14
|
+
export default class extends Controller {
|
|
15
|
+
static values = {
|
|
16
|
+
closable: { type: Boolean, default: true },
|
|
17
|
+
on: { type: String, default: "" },
|
|
18
|
+
transition: { type: String, default: "fade" },
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
connect() {
|
|
22
|
+
$(this.element).dimmer(this._options())
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
disconnect() {
|
|
26
|
+
$(this.element).dimmer("destroy")
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
show() { $(this.element).dimmer("show") }
|
|
30
|
+
hide() { $(this.element).dimmer("hide") }
|
|
31
|
+
toggle() { $(this.element).dimmer("toggle") }
|
|
32
|
+
|
|
33
|
+
// -- Private --
|
|
34
|
+
|
|
35
|
+
_options() {
|
|
36
|
+
return {
|
|
37
|
+
closable: this.closableValue,
|
|
38
|
+
on: this.onValue || false,
|
|
39
|
+
transition: this.transitionValue,
|
|
40
|
+
onShow: () => { this.dispatch("show") },
|
|
41
|
+
onHide: () => { this.dispatch("hide") },
|
|
42
|
+
onChange: () => { this.dispatch("change") },
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
// Fomantic-UI Dropdown — selection dropdowns with search support.
|
|
4
|
+
// Bridges: $.fn.dropdown
|
|
5
|
+
//
|
|
6
|
+
// Usage:
|
|
7
|
+
// <div class="ui selection dropdown" data-controller="fui-dropdown">
|
|
8
|
+
// <input type="hidden" name="field">
|
|
9
|
+
// <div class="default text">Select...</div>
|
|
10
|
+
// <i class="dropdown icon"></i>
|
|
11
|
+
// <div class="menu">
|
|
12
|
+
// <div class="item" data-value="1">Option 1</div>
|
|
13
|
+
// <div class="item" data-value="2">Option 2</div>
|
|
14
|
+
// </div>
|
|
15
|
+
// </div>
|
|
16
|
+
//
|
|
17
|
+
export default class extends Controller {
|
|
18
|
+
static values = {
|
|
19
|
+
clearable: { type: Boolean, default: false },
|
|
20
|
+
placeholder: { type: String, default: "" },
|
|
21
|
+
forceSelection: { type: Boolean, default: false },
|
|
22
|
+
fullTextSearch: { type: Boolean, default: false },
|
|
23
|
+
duration: { type: Number, default: 200 },
|
|
24
|
+
allowAdditions: { type: Boolean, default: false },
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
connect() {
|
|
28
|
+
$(this.element).dropdown(this._options())
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
disconnect() {
|
|
32
|
+
$(this.element).dropdown("destroy")
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
show() { $(this.element).dropdown("show") }
|
|
36
|
+
hide() { $(this.element).dropdown("hide") }
|
|
37
|
+
toggle() { $(this.element).dropdown("toggle") }
|
|
38
|
+
clear() { $(this.element).dropdown("clear") }
|
|
39
|
+
refresh(){ $(this.element).dropdown("refresh") }
|
|
40
|
+
|
|
41
|
+
getValue() { return $(this.element).dropdown("get value") }
|
|
42
|
+
getText() { return $(this.element).dropdown("get text") }
|
|
43
|
+
setValue(val) { $(this.element).dropdown("set selected", val) }
|
|
44
|
+
|
|
45
|
+
// -- Private --
|
|
46
|
+
|
|
47
|
+
_options() {
|
|
48
|
+
return {
|
|
49
|
+
clearable: this.clearableValue,
|
|
50
|
+
placeholder: this.placeholderValue || false,
|
|
51
|
+
forceSelection: this.forceSelectionValue,
|
|
52
|
+
fullTextSearch: this.fullTextSearchValue,
|
|
53
|
+
duration: this.durationValue,
|
|
54
|
+
allowAdditions: this.allowAdditionsValue,
|
|
55
|
+
onChange: (value, text, $choice) => {
|
|
56
|
+
this.dispatch("change", { detail: { value, text } })
|
|
57
|
+
},
|
|
58
|
+
onShow: () => { this.dispatch("show") },
|
|
59
|
+
onHide: () => { this.dispatch("hide") },
|
|
60
|
+
onAdd: (addedValue, addedText, $addedChoice) => {
|
|
61
|
+
this.dispatch("add", { detail: { value: addedValue, text: addedText } })
|
|
62
|
+
},
|
|
63
|
+
onRemove: (removedValue, removedText, $removedChoice) => {
|
|
64
|
+
this.dispatch("remove", { detail: { value: removedValue, text: removedText } })
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
// Fomantic-UI Embed — embedded video/iframe with placeholder.
|
|
4
|
+
// Bridges: $.fn.embed
|
|
5
|
+
//
|
|
6
|
+
// Usage:
|
|
7
|
+
// <div class="ui embed" data-controller="fui-embed"
|
|
8
|
+
// data-source="youtube" data-id="dQw4w9WgXcQ">
|
|
9
|
+
// </div>
|
|
10
|
+
//
|
|
11
|
+
export default class extends Controller {
|
|
12
|
+
static values = {
|
|
13
|
+
source: { type: String, default: "" },
|
|
14
|
+
id: { type: String, default: "" },
|
|
15
|
+
url: { type: String, default: "" },
|
|
16
|
+
autoplay: { type: Boolean, default: true },
|
|
17
|
+
color: { type: String, default: "#444" },
|
|
18
|
+
hd: { type: Boolean, default: true },
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
connect() {
|
|
22
|
+
$(this.element).embed(this._options())
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
disconnect() {
|
|
26
|
+
$(this.element).embed("destroy")
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
show() { $(this.element).embed("show") }
|
|
30
|
+
reset() { $(this.element).embed("reset") }
|
|
31
|
+
|
|
32
|
+
// -- Private --
|
|
33
|
+
|
|
34
|
+
_options() {
|
|
35
|
+
const opts = {
|
|
36
|
+
autoplay: this.autoplayValue,
|
|
37
|
+
color: this.colorValue,
|
|
38
|
+
hd: this.hdValue,
|
|
39
|
+
onCreate: (url) => { this.dispatch("create", { detail: { url } }) },
|
|
40
|
+
onDisplay: () => { this.dispatch("display") },
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
if (this.sourceValue) opts.source = this.sourceValue
|
|
44
|
+
if (this.idValue) opts.id = this.idValue
|
|
45
|
+
if (this.urlValue) opts.url = this.urlValue
|
|
46
|
+
|
|
47
|
+
return opts
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
// Fomantic-UI Flyout — slide-out panel from screen edge.
|
|
4
|
+
// Bridges: $.fn.flyout
|
|
5
|
+
//
|
|
6
|
+
// Usage:
|
|
7
|
+
// <div class="ui right flyout" data-controller="fui-flyout">
|
|
8
|
+
// <i class="close icon"></i>
|
|
9
|
+
// <div class="header">Title</div>
|
|
10
|
+
// <div class="content">Content here</div>
|
|
11
|
+
// <div class="actions">
|
|
12
|
+
// <button class="ui approve button">OK</button>
|
|
13
|
+
// <button class="ui deny button">Cancel</button>
|
|
14
|
+
// </div>
|
|
15
|
+
// </div>
|
|
16
|
+
//
|
|
17
|
+
export default class extends Controller {
|
|
18
|
+
static values = {
|
|
19
|
+
closable: { type: Boolean, default: true },
|
|
20
|
+
dimPage: { type: Boolean, default: true },
|
|
21
|
+
keyboardShortcuts: { type: Boolean, default: true },
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
connect() {
|
|
25
|
+
$(this.element).flyout(this._options())
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
disconnect() {
|
|
29
|
+
$(this.element).flyout("destroy")
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
show() { $(this.element).flyout("show") }
|
|
33
|
+
hide() { $(this.element).flyout("hide") }
|
|
34
|
+
toggle() { $(this.element).flyout("toggle") }
|
|
35
|
+
|
|
36
|
+
// -- Private --
|
|
37
|
+
|
|
38
|
+
_options() {
|
|
39
|
+
return {
|
|
40
|
+
closable: this.closableValue,
|
|
41
|
+
dimPage: this.dimPageValue,
|
|
42
|
+
keyboardShortcuts: this.keyboardShortcutsValue,
|
|
43
|
+
onShow: () => { this.dispatch("show") },
|
|
44
|
+
onHide: () => { this.dispatch("hide") },
|
|
45
|
+
onApprove: () => { this.dispatch("approve") },
|
|
46
|
+
onDeny: () => { this.dispatch("deny") },
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
// Fomantic-UI Form — client-side validation with inline error display.
|
|
4
|
+
// Bridges: $.fn.form
|
|
5
|
+
//
|
|
6
|
+
// Usage:
|
|
7
|
+
// <form class="ui form" data-controller="fui-form"
|
|
8
|
+
// data-fui-form-inline-value="true">
|
|
9
|
+
// <div class="field">
|
|
10
|
+
// <label>Email</label>
|
|
11
|
+
// <input type="email" name="email">
|
|
12
|
+
// </div>
|
|
13
|
+
// <div class="ui error message"></div>
|
|
14
|
+
// </form>
|
|
15
|
+
//
|
|
16
|
+
export default class extends Controller {
|
|
17
|
+
static values = {
|
|
18
|
+
inline: { type: Boolean, default: false },
|
|
19
|
+
on: { type: String, default: "submit" },
|
|
20
|
+
keyboardShortcuts: { type: Boolean, default: true },
|
|
21
|
+
revalidate: { type: Boolean, default: true },
|
|
22
|
+
rules: { type: String, default: "" },
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
connect() {
|
|
26
|
+
const opts = this._options()
|
|
27
|
+
|
|
28
|
+
if (this.rulesValue) {
|
|
29
|
+
try { opts.fields = JSON.parse(this.rulesValue) }
|
|
30
|
+
catch (e) { /* invalid JSON, skip */ }
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
$(this.element).form(opts)
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
disconnect() {
|
|
37
|
+
$(this.element).form("destroy")
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
validate() { return $(this.element).form("validate form") }
|
|
41
|
+
reset() { $(this.element).form("reset") }
|
|
42
|
+
clear() { $(this.element).form("clear") }
|
|
43
|
+
isValid() { return $(this.element).form("is valid") }
|
|
44
|
+
getValues() { return $(this.element).form("get values") }
|
|
45
|
+
|
|
46
|
+
// -- Private --
|
|
47
|
+
|
|
48
|
+
_options() {
|
|
49
|
+
return {
|
|
50
|
+
inline: this.inlineValue,
|
|
51
|
+
on: this.onValue,
|
|
52
|
+
keyboardShortcuts: this.keyboardShortcutsValue,
|
|
53
|
+
revalidate: this.revalidateValue,
|
|
54
|
+
onSuccess: () => {
|
|
55
|
+
this.dispatch("success")
|
|
56
|
+
},
|
|
57
|
+
onFailure: (formErrors, fields) => {
|
|
58
|
+
this.dispatch("failure", { detail: { errors: formErrors, fields } })
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
// Fomantic-UI Modal — dialog windows with dimmer.
|
|
4
|
+
// Bridges: $.fn.modal
|
|
5
|
+
//
|
|
6
|
+
// Usage:
|
|
7
|
+
// <div class="ui modal" data-controller="fui-modal">
|
|
8
|
+
// <i class="close icon"></i>
|
|
9
|
+
// <div class="header">Modal Title</div>
|
|
10
|
+
// <div class="content">Content here</div>
|
|
11
|
+
// <div class="actions">
|
|
12
|
+
// <button class="ui approve button">OK</button>
|
|
13
|
+
// <button class="ui deny button">Cancel</button>
|
|
14
|
+
// </div>
|
|
15
|
+
// </div>
|
|
16
|
+
//
|
|
17
|
+
export default class extends Controller {
|
|
18
|
+
static values = {
|
|
19
|
+
closable: { type: Boolean, default: true },
|
|
20
|
+
dimmerSettings: { type: Boolean, default: true },
|
|
21
|
+
blurring: { type: Boolean, default: false },
|
|
22
|
+
keyboardShortcuts: { type: Boolean, default: true },
|
|
23
|
+
duration: { type: Number, default: 500 },
|
|
24
|
+
transition: { type: String, default: "scale" },
|
|
25
|
+
autofocus: { type: Boolean, default: true },
|
|
26
|
+
allowMultiple: { type: Boolean, default: false },
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
connect() {
|
|
30
|
+
$(this.element).modal(this._options())
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
disconnect() {
|
|
34
|
+
$(this.element).modal("destroy")
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
show() { $(this.element).modal("show") }
|
|
38
|
+
hide() { $(this.element).modal("hide") }
|
|
39
|
+
toggle() { $(this.element).modal("toggle") }
|
|
40
|
+
refresh(){ $(this.element).modal("refresh") }
|
|
41
|
+
|
|
42
|
+
// -- Private --
|
|
43
|
+
|
|
44
|
+
_options() {
|
|
45
|
+
return {
|
|
46
|
+
closable: this.closableValue,
|
|
47
|
+
blurring: this.blurringValue,
|
|
48
|
+
keyboardShortcuts: this.keyboardShortcutsValue,
|
|
49
|
+
duration: this.durationValue,
|
|
50
|
+
transition: this.transitionValue,
|
|
51
|
+
autofocus: this.autofocusValue,
|
|
52
|
+
allowMultiple: this.allowMultipleValue,
|
|
53
|
+
onShow: () => { this.dispatch("show") },
|
|
54
|
+
onVisible: () => { this.dispatch("visible") },
|
|
55
|
+
onHide: () => { this.dispatch("hide") },
|
|
56
|
+
onHidden: () => { this.dispatch("hidden") },
|
|
57
|
+
onApprove: () => { this.dispatch("approve") },
|
|
58
|
+
onDeny: () => { this.dispatch("deny") },
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Controller } from "@hotwired/stimulus"
|
|
2
|
+
|
|
3
|
+
// Fomantic-UI Nag — persistent dismissible notification bar.
|
|
4
|
+
// Bridges: $.fn.nag
|
|
5
|
+
//
|
|
6
|
+
// Usage:
|
|
7
|
+
// <div class="ui nag" data-controller="fui-nag"
|
|
8
|
+
// data-fui-nag-key-value="cookie-notice">
|
|
9
|
+
// <span class="title">We use cookies.</span>
|
|
10
|
+
// <i class="close icon"></i>
|
|
11
|
+
// </div>
|
|
12
|
+
//
|
|
13
|
+
export default class extends Controller {
|
|
14
|
+
static values = {
|
|
15
|
+
key: { type: String, default: "nag" },
|
|
16
|
+
value: { type: String, default: "dismiss" },
|
|
17
|
+
storageMethod: { type: String, default: "localstorage" },
|
|
18
|
+
expires: { type: Number, default: 30 },
|
|
19
|
+
displayTime: { type: Number, default: 0 },
|
|
20
|
+
persist: { type: Boolean, default: false },
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
connect() {
|
|
24
|
+
$(this.element).nag(this._options())
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
disconnect() {
|
|
28
|
+
$(this.element).nag("destroy")
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
show() { $(this.element).nag("show") }
|
|
32
|
+
hide() { $(this.element).nag("hide") }
|
|
33
|
+
dismiss() { $(this.element).nag("dismiss") }
|
|
34
|
+
clear() { $(this.element).nag("clear") }
|
|
35
|
+
|
|
36
|
+
// -- Private --
|
|
37
|
+
|
|
38
|
+
_options() {
|
|
39
|
+
return {
|
|
40
|
+
key: this.keyValue,
|
|
41
|
+
value: this.valueValue,
|
|
42
|
+
storageMethod: this.storageMethodValue,
|
|
43
|
+
expires: this.expiresValue,
|
|
44
|
+
displayTime: this.displayTimeValue,
|
|
45
|
+
persist: this.persistValue,
|
|
46
|
+
onShow: () => { this.dispatch("show") },
|
|
47
|
+
onVisible: () => { this.dispatch("visible") },
|
|
48
|
+
onHide: () => { this.dispatch("hide") },
|
|
49
|
+
onHidden: () => { this.dispatch("hidden") },
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|