uistiti 0.1.0 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: be75c25b3458c1725fc90ee1ae2a269d0a893b99cec73a2f959f8254a3c010e9
4
- data.tar.gz: 8ad751062c1aa899d4dc99297a74539d930c552a3127cf5203322313a7c3c05e
3
+ metadata.gz: 155ff6df2e902fd9da022f3b8b46e7a0b5d6ff5ba68fd98766beea271f214d9a
4
+ data.tar.gz: 5418a7b8f51140f6cb0a0dce3a50edd29afcececfb0f93bc13d0e6663dbbf9ce
5
5
  SHA512:
6
- metadata.gz: da74b0ddbdb339df8763626723d26be39d76f6b3be157cd04f65ee34bd3e20b403b4dad8c4620e6a7163688d191d3b694982f07fb8c18a26ed05a220a824203c
7
- data.tar.gz: 9494628a2c341348d1d22720c1e19b268e781500c0dfe417c604348150ee00797e1d3ddffa8c5a01fb55cd311978cf6d624d6de8a41e781c8b541afe031dd5c6
6
+ metadata.gz: 1fd1fb301c61c5f2dd44fac7595bf261d81e7085556360fd421232258a0c00774b9028a78146108e7c41aa24f34494d787bfb54a4c2203fd41a046b2c38dcc70
7
+ data.tar.gz: 0c142f19d729edd179dae85047ccb0a07d4443d42c8eb4ce556e3fcdf0b027213b9cca0bacd060d26afc2fe84d4e7867a045eceea8720e94d8dc1608285b1f7d
data/README.md CHANGED
@@ -1,8 +1,13 @@
1
- # Uistiti
2
- Short description and motivation.
1
+ # Uistiti UI kit for Rails
2
+ This gem holds everything you need (UI speaking) to create nice User interface.
3
+ It comes with CSS style (customisable for sure) and Javascript out of the bout.
4
+ For productivity enhancement i also published a [VsCode extension](https://marketplace.visualstudio.com/items?itemName=UistitiUiKit.uistitirails) wich give you snippets for all the component of the library.
5
+
6
+ ![uistiti_extension](https://github.com/rails-hackathon/team-173/assets/75135824/afdcacc9-81b7-4ec1-9eb2-69e01a21af12)
7
+
3
8
 
4
9
  ## Usage
5
- How to use my plugin.
10
+ How to use the plug in :
6
11
 
7
12
  ## Installation
8
13
  Add this line to your application's Gemfile:
@@ -16,11 +21,33 @@ And then execute:
16
21
  $ bundle
17
22
  ```
18
23
 
19
- Or install it yourself as:
20
- ```bash
21
- $ gem install uistiti
24
+ Now in your views you can use Uistiti components just as normal ViewComponents :
25
+ ```ruby
26
+ <%= render Uistiti::Alpha::Flex.new(direction: :column, justify_content: :space_between) do %>
27
+ <%= items %>
28
+ <% end %>
29
+ ```
30
+
31
+ For the CSS & style :
32
+ All the CSS files relies on a set of [variables](https://github.com/rails-hackathon/team-173/blob/development/app/assets/stylesheets/uistiti/config/_variables.scss), if you want to start using styled component you can import them in you application.scss file
33
+
34
+ ```css
35
+ //app/assets/stylesheets/aplication.scss
36
+ @import 'uistiti/config/variables';
37
+ ```
38
+ If you want to update the colors and the different design tokens, you can dowload the file and modify the values you want and import the local file instead of the one from the gem.
39
+
40
+ Then, for each component you use you can import the related css
41
+ ```css
42
+ //app/assets/stylesheets/aplication.scss
43
+ @import 'uistiti/config/variables';
44
+ @import 'uistiti/components/alpha/flex';
22
45
  ```
23
46
 
47
+ For Component with javascript behavior, there is nothing to do, the controllers are automatically registered through the asset pipe line and import-map.
48
+
49
+
50
+
24
51
  ## Contributing
25
52
  Contribution directions go here.
26
53
 
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus";
2
+
3
+ // this stimulus controller can be registered with identifier : uistiti--alpha--button
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log("Hello, from button stimulus controller !", this.element);
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus";
2
+
3
+ // this stimulus controller can be registered with identifier : uistiti--alpha--container
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log("Hello, from container stimulus controller !", this.element);
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus";
2
+
3
+ // this stimulus controller can be registered with identifier : uistiti--alpha--form-input-group
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log("Hello, from form_input_group stimulus controller !", this.element);
7
+ }
8
+ }
@@ -0,0 +1,8 @@
1
+ import { Controller } from "@hotwired/stimulus";
2
+
3
+ // this stimulus controller can be registered with identifier : uistiti--alpha--form-submit
4
+ export default class extends Controller {
5
+ connect() {
6
+ console.log("Hello, from form_submit stimulus controller !", this.element);
7
+ }
8
+ }
@@ -0,0 +1,63 @@
1
+ /* CSS for Button */
2
+
3
+ .Button {
4
+ display: inline-block;
5
+ padding: $size-space-small $size-space-small;
6
+ background-origin: border-box; // Invisible borders with linear gradients
7
+ background-color: transparent;
8
+ border: solid 2px transparent;
9
+ border-radius: $radii-base-sm;
10
+ font-weight: bold;
11
+ text-decoration: none;
12
+ cursor: pointer;
13
+ outline: none;
14
+ transition: filter 400ms, color 200ms;
15
+
16
+ &:hover,
17
+ &:focus,
18
+ &:focus-within,
19
+ &:active {
20
+ transition: filter 250ms, color 200ms;
21
+ }
22
+
23
+ &--primary {
24
+ color: $color-base-white;
25
+ // background-image: linear-gradient(to right, var(--color-primary), var(--color-primary-rotate));
26
+ background-image: linear-gradient(to right, $color-background-button-primary-base, $color-background-button-primary-base);
27
+
28
+ &:hover,
29
+ &:focus,
30
+ &:focus-within,
31
+ &:active {
32
+ color: $color-base-white;
33
+ filter: saturate(1.4) brightness(115%);
34
+ }
35
+ }
36
+ &--secondary {
37
+ color: $color-base-white;
38
+ // background-image: linear-gradient(to right, var(--color-primary), var(--color-primary-rotate));
39
+ background-image: linear-gradient(to right, $color-background-button-secondary-base, $color-background-button-secondary-base);
40
+
41
+ &:hover,
42
+ &:focus,
43
+ &:focus-within,
44
+ &:active {
45
+ color: $color-base-white;
46
+ filter: saturate(1.4) brightness(115%);
47
+ }
48
+ }
49
+ &--danger {
50
+ color: $color-base-white;
51
+ // background-image: linear-gradient(to right, var(--color-primary), var(--color-primary-rotate));
52
+ background-image: linear-gradient(to right, $color-background-button-error-base, $color-background-button-error-base);
53
+
54
+ &:hover,
55
+ &:focus,
56
+ &:focus-within,
57
+ &:active {
58
+ color: $color-base-white;
59
+ filter: saturate(1.4) brightness(115%);
60
+ }
61
+ }
62
+
63
+ }
@@ -0,0 +1,9 @@
1
+ /* CSS for Container */
2
+
3
+ .Container {
4
+ padding-inline: $size-space-medium;
5
+
6
+ @media (min-width: $breakpoint-medium) {
7
+ padding-inline: $size-space-xxl;
8
+ }
9
+ }
@@ -0,0 +1,5 @@
1
+ /* CSS for FormInputGroup */
2
+
3
+ .FormInputGroup {
4
+
5
+ }
@@ -0,0 +1,3 @@
1
+ /* CSS for FormSubmit */
2
+ @import "components/alpha/form_submit";
3
+ .FormSubmit {}
@@ -296,6 +296,7 @@ $color-background-button-primary-active: #00796b;
296
296
  $color-background-button-secondary-base: #3f51b5;
297
297
  $color-background-button-secondary-disabled: #7986cb;
298
298
  $color-background-button-secondary-active: #303f9f;
299
+ $color-background-button-error-base: $color-background-error;
299
300
  //############### BACKGROUND OVERLAY ###############
300
301
  $color-background-overlay-light: rgba(255, 255, 255, 0.8);
301
302
  $color-background-overlay-dark: rgba(0, 0, 0, 0.27);
@@ -388,3 +389,10 @@ $size-space-large: 1.5rem;
388
389
  $size-space-xl: 2rem;
389
390
  $size-space-xxl: 3rem;
390
391
  $size-space-base: 1rem;
392
+ //##################################################
393
+ //################## BREAKPOINTS ###################
394
+ //##################################################
395
+ $breakpoint-small: 544px;
396
+ $breakpoint-medium: 768px;
397
+ $breakpoint-large: 1012px;
398
+ $breakpoint-xl: 1280px;
@@ -18,3 +18,7 @@
18
18
  @import "components/alpha/flex";
19
19
  @import "components/alpha/navbar";
20
20
  @import "components/alpha/image";
21
+ @import "components/alpha/container";
22
+ @import "components/alpha/button";
23
+ @import "components/alpha/form_submit";
24
+ @import "components/alpha/form_input_group";
@@ -0,0 +1,3 @@
1
+ <%= content_tag :div, class: classes do -%>
2
+ <%= content %>
3
+ <% end -%>
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Uistiti
4
+ module Alpha
5
+ class Button < ViewComponent::Base
6
+ def initialize(color:)
7
+ super()
8
+
9
+ @color = color
10
+ end
11
+
12
+ private
13
+
14
+ def classes
15
+ [
16
+ "Button",
17
+ "Button--#{@color}"
18
+ ]
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,3 @@
1
+ <%= content_tag :div, class: 'Container' do -%>
2
+ <%= content %>
3
+ <% end -%>
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Uistiti
4
+ module Alpha
5
+ class Container < ViewComponent::Base
6
+ def initialize()
7
+ super()
8
+
9
+ end
10
+ end
11
+ end
12
+ end
@@ -0,0 +1,4 @@
1
+ <%= render Uistiti::Alpha::Flex.new(direction: @direction) do %>
2
+ <label for="<%= @field %>"><%= @label %></label>
3
+ <%= @form.send(@type, @field, required: @required )%>
4
+ <% end %>
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Uistiti
4
+ module Alpha
5
+ class FormInputGroup < ViewComponent::Base
6
+ def initialize(form:, type:, field: ,label: , required: false, direction: :column)
7
+ super()
8
+
9
+ @form = form
10
+ @type = type
11
+ @field = field
12
+ @label= label
13
+ @required = required
14
+ @direction = direction
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1 @@
1
+ <%= @form.submit @text, class: classes %>
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Uistiti
4
+ module Alpha
5
+ class FormSubmit < ViewComponent::Base
6
+ def initialize(form: ,text: ,color:)
7
+ super()
8
+
9
+ @form = form
10
+ @text = text
11
+ @color = color
12
+ end
13
+
14
+ def classes
15
+ [
16
+ "FormSubmit",
17
+ "Button",
18
+ "Button--#{@color}"
19
+ ]
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ <!DOCTYPE html>
2
+ <html>
3
+ <head>
4
+ <title>Dummy</title>
5
+ <meta name="viewport" content="width=device-width,initial-scale=1">
6
+ <%= csrf_meta_tags %>
7
+ <%= csp_meta_tag %>
8
+ <style>
9
+ body {
10
+ background: beige;
11
+ }
12
+ </style>
13
+ <%= stylesheet_link_tag "application" %>
14
+ </head>
15
+
16
+ <body>
17
+ <%= yield %>
18
+ </body>
19
+ </html>
@@ -6,7 +6,10 @@ module Uistiti
6
6
  isolate_namespace Uistiti
7
7
 
8
8
  #Show to lookbook where it can find the previews
9
- Lookbook.config.preview_paths = [File.join(root, 'test/components/previews')]
10
- Lookbook.config.preview_layout = "component_preview"
9
+ puts '*'*80
10
+ puts File.join(Uistiti::Engine.root, 'test/components/previews')
11
+ puts '*'*80
12
+ Lookbook.config.preview_paths = [File.join(Uistiti::Engine.root, 'test/components/previews')]
13
+ Lookbook.config.preview_layout = "uistiti/component_preview"
11
14
  end
12
15
  end
@@ -1,3 +1,3 @@
1
1
  module Uistiti
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uistiti
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Ecrepont
@@ -70,20 +70,36 @@ files:
70
70
  - README.md
71
71
  - Rakefile
72
72
  - app/assets/config/uistiti_manifest.js
73
+ - app/assets/javascript/controllers/uistiti/alpha/button/button_controller.js
74
+ - app/assets/javascript/controllers/uistiti/alpha/container/container_controller.js
73
75
  - app/assets/javascript/controllers/uistiti/alpha/flex/flex_controller.js
76
+ - app/assets/javascript/controllers/uistiti/alpha/form_input_group/form_input_group_controller.js
77
+ - app/assets/javascript/controllers/uistiti/alpha/form_submit/form_submit_controller.js
74
78
  - app/assets/javascript/controllers/uistiti/alpha/image/image_controller.js
75
79
  - app/assets/javascript/controllers/uistiti/alpha/link/link_controller.js
76
80
  - app/assets/javascript/controllers/uistiti/alpha/main_layout/main_layout_controller.js
77
81
  - app/assets/javascript/controllers/uistiti/alpha/navbar/navbar_controller.js
82
+ - app/assets/stylesheets/uistiti/components/alpha/button.scss
83
+ - app/assets/stylesheets/uistiti/components/alpha/container.scss
78
84
  - app/assets/stylesheets/uistiti/components/alpha/flex.scss
85
+ - app/assets/stylesheets/uistiti/components/alpha/form_input_group.scss
86
+ - app/assets/stylesheets/uistiti/components/alpha/form_submit.scss
79
87
  - app/assets/stylesheets/uistiti/components/alpha/image.scss
80
88
  - app/assets/stylesheets/uistiti/components/alpha/link.scss
81
89
  - app/assets/stylesheets/uistiti/components/alpha/main_layout.scss
82
90
  - app/assets/stylesheets/uistiti/components/alpha/navbar.scss
83
91
  - app/assets/stylesheets/uistiti/config/_variables.scss
84
92
  - app/assets/stylesheets/uistiti/uistiti.scss
93
+ - app/components/uistiti/alpha/button.html.erb
94
+ - app/components/uistiti/alpha/button.rb
95
+ - app/components/uistiti/alpha/container.html.erb
96
+ - app/components/uistiti/alpha/container.rb
85
97
  - app/components/uistiti/alpha/flex.html.erb
86
98
  - app/components/uistiti/alpha/flex.rb
99
+ - app/components/uistiti/alpha/form_input_group.html.erb
100
+ - app/components/uistiti/alpha/form_input_group.rb
101
+ - app/components/uistiti/alpha/form_submit.html.erb
102
+ - app/components/uistiti/alpha/form_submit.rb
87
103
  - app/components/uistiti/alpha/image.html.erb
88
104
  - app/components/uistiti/alpha/image.rb
89
105
  - app/components/uistiti/alpha/link.html.erb
@@ -98,6 +114,7 @@ files:
98
114
  - app/mailers/uistiti/application_mailer.rb
99
115
  - app/models/uistiti/application_record.rb
100
116
  - app/views/layouts/uistiti/application.html.erb
117
+ - app/views/layouts/uistiti/component_preview.html.erb
101
118
  - config/routes.rb
102
119
  - lib/generators/uistiti/component_generator.rb
103
120
  - lib/generators/uistiti/templates/component.html.tt