bard-attachment_field 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/.nvmrc +1 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Appraisals +17 -0
- data/CHANGELOG.md +15 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +39 -0
- data/Rakefile +10 -0
- data/app/assets/javascripts/input-attachment.js +6021 -0
- data/app/controllers/bard/attachment_field/blobs_controller.rb +11 -0
- data/bard-attachment_field.gemspec +56 -0
- data/config/cucumber.yml +1 -0
- data/config/routes.rb +6 -0
- data/gemfiles/rails_7.1.gemfile +7 -0
- data/gemfiles/rails_7.2.gemfile +7 -0
- data/gemfiles/rails_8.0.gemfile +7 -0
- data/gemfiles/rails_8.1.gemfile +7 -0
- data/input-attachment/.editorconfig +15 -0
- data/input-attachment/.github/workflows/test.yml +21 -0
- data/input-attachment/.gitignore +27 -0
- data/input-attachment/.prettierrc.json +13 -0
- data/input-attachment/CLAUDE.md +63 -0
- data/input-attachment/LICENSE +21 -0
- data/input-attachment/README.md +288 -0
- data/input-attachment/bin/log +2 -0
- data/input-attachment/bin/server +1 -0
- data/input-attachment/bin/setup +4 -0
- data/input-attachment/bun.lockb +0 -0
- data/input-attachment/bundle.js +3 -0
- data/input-attachment/jest-setup.js +24 -0
- data/input-attachment/package.json +56 -0
- data/input-attachment/src/components/attachment-file/accepts.ts +32 -0
- data/input-attachment/src/components/attachment-file/attachment-file.css +89 -0
- data/input-attachment/src/components/attachment-file/attachment-file.e2e.ts +11 -0
- data/input-attachment/src/components/attachment-file/attachment-file.spec.tsx +20 -0
- data/input-attachment/src/components/attachment-file/attachment-file.tsx +157 -0
- data/input-attachment/src/components/attachment-file/direct-upload-controller.tsx +100 -0
- data/input-attachment/src/components/attachment-file/extensions.ts +13 -0
- data/input-attachment/src/components/attachment-file/max.ts +46 -0
- data/input-attachment/src/components/attachment-file/readme.md +55 -0
- data/input-attachment/src/components/attachment-preview/attachment-preview.css +8 -0
- data/input-attachment/src/components/attachment-preview/attachment-preview.e2e.ts +11 -0
- data/input-attachment/src/components/attachment-preview/attachment-preview.spec.tsx +19 -0
- data/input-attachment/src/components/attachment-preview/attachment-preview.tsx +42 -0
- data/input-attachment/src/components/attachment-preview/readme.md +31 -0
- data/input-attachment/src/components/input-attachment/form-controller.tsx +146 -0
- data/input-attachment/src/components/input-attachment/input-attachment.css +100 -0
- data/input-attachment/src/components/input-attachment/input-attachment.e2e.ts +11 -0
- data/input-attachment/src/components/input-attachment/input-attachment.spec.tsx +37 -0
- data/input-attachment/src/components/input-attachment/input-attachment.tsx +353 -0
- data/input-attachment/src/components/input-attachment/readme.md +45 -0
- data/input-attachment/src/components.d.ts +175 -0
- data/input-attachment/src/global.d.ts +3 -0
- data/input-attachment/src/images/example.jpg +0 -0
- data/input-attachment/src/index.html +36 -0
- data/input-attachment/src/index.ts +1 -0
- data/input-attachment/src/utils/utils.spec.ts +19 -0
- data/input-attachment/src/utils/utils.ts +14 -0
- data/input-attachment/stencil.config.ts +43 -0
- data/input-attachment/test-mocks/file-drop.cjs +7 -0
- data/input-attachment/test-mocks/progress-bar.cjs +9 -0
- data/input-attachment/tsconfig.json +32 -0
- data/lib/bard/attachment_field/cucumber.rb +277 -0
- data/lib/bard/attachment_field/field.rb +33 -0
- data/lib/bard/attachment_field/form_builder.rb +12 -0
- data/lib/bard/attachment_field/version.rb +7 -0
- data/lib/bard/attachment_field.rb +20 -0
- data/lib/bard-attachment_field.rb +1 -0
- metadata +409 -0
checksums.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
---
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 4231d75f98a1affd65c85e91421526be46fd90a969e70909e89a34a515f43727
|
|
4
|
+
data.tar.gz: 2653d547bdaa5dc5177b0eacfb1a7918ce4f22398e5df62ce2ce052db4632947
|
|
5
|
+
SHA512:
|
|
6
|
+
metadata.gz: 634da0a3393a99090235047810cfbbda78325036b2b84dd288327121e194c9035fe560938153d8614c90014be66603ec47b7eb061473d9924a41e2dc19824215
|
|
7
|
+
data.tar.gz: d744c1ee748c6444dc1bf8beae7bdc8d7bf355a4ced26227be0e06b8107d155e06d36b41f14f72e1d74ca0af938e78827db4a3486dbba160d9d85521d86030f9
|
data/.nvmrc
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
v14.17.6
|
data/.ruby-gemset
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
bard-file_field
|
data/.ruby-version
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
ruby-3.3.4
|
data/Appraisals
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
appraise "rails-7.1" do
|
|
4
|
+
gem "rails", "~> 7.1.0"
|
|
5
|
+
end
|
|
6
|
+
|
|
7
|
+
appraise "rails-7.2" do
|
|
8
|
+
gem "rails", "~> 7.2.0"
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
appraise "rails-8.0" do
|
|
12
|
+
gem "rails", "~> 8.0.0"
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
appraise "rails-8.1" do
|
|
16
|
+
gem "rails", "~> 8.1.0"
|
|
17
|
+
end
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.1.0] - 2026-01-03
|
|
4
|
+
|
|
5
|
+
Initial release of bard-attachment_field, a rewrite of bard-file_field.
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- Drag-and-drop file uploads
|
|
10
|
+
- Image and video previews
|
|
11
|
+
- Direct uploads to ActiveStorage
|
|
12
|
+
- Multiple file support
|
|
13
|
+
- Form validation (required, accept, size limits)
|
|
14
|
+
- Persists attachments through validation errors
|
|
15
|
+
- Support for Rails 7.1, 7.2, 8.0, and 8.1
|
data/Gemfile
ADDED
data/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) Micah Geisel
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
# Bard Attachment Field
|
|
2
|
+
|
|
3
|
+
An enhanced file upload field for Rails forms, powered by web components. Provides drag-and-drop uploads, image previews, and seamless ActiveStorage integration.
|
|
4
|
+
|
|
5
|
+
## Features
|
|
6
|
+
|
|
7
|
+
- Drag-and-drop file uploads
|
|
8
|
+
- Image and video previews
|
|
9
|
+
- Direct uploads to ActiveStorage
|
|
10
|
+
- Multiple file support
|
|
11
|
+
- Form validation (required, accept, size limits)
|
|
12
|
+
- Persists attachments through validation errors
|
|
13
|
+
|
|
14
|
+
## Installation
|
|
15
|
+
|
|
16
|
+
Add to your Gemfile:
|
|
17
|
+
|
|
18
|
+
gem "bard-attachment_field"
|
|
19
|
+
|
|
20
|
+
## Usage
|
|
21
|
+
|
|
22
|
+
In your form:
|
|
23
|
+
|
|
24
|
+
```erb
|
|
25
|
+
<%= form.attachment_field :avatar %>
|
|
26
|
+
<%= form.attachment_field :documents, multiple: true %>
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
### Options
|
|
30
|
+
|
|
31
|
+
- `multiple: true` - Allow multiple file uploads
|
|
32
|
+
- `accept: "image/*"` - Restrict file types
|
|
33
|
+
- `required: true` - Make field required
|
|
34
|
+
- `preview: false` - Disable image previews
|
|
35
|
+
- `disabled: true` - Disable the field
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
MIT
|