playbook_ui 14.9.0.pre.alpha.PLAY16264818 → 14.9.0.pre.alpha.pbntr700newresettodefaultprop4736

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/app/pb_kits/playbook/pb_advanced_table/_advanced_table.tsx +17 -61
  3. data/app/pb_kits/playbook/pb_advanced_table/docs/example.yml +0 -2
  4. data/app/pb_kits/playbook/pb_advanced_table/docs/index.js +0 -2
  5. data/app/pb_kits/playbook/pb_date_picker/date_picker.rb +5 -0
  6. data/app/pb_kits/playbook/pb_date_picker/date_picker_helper.ts +10 -0
  7. data/app/pb_kits/playbook/pb_date_picker/docs/example.yml +1 -0
  8. data/app/pb_kits/playbook/pb_form/docs/_form_form_with.html.erb +2 -1
  9. data/app/pb_kits/playbook/pb_pagination/_pagination.tsx +2 -2
  10. data/app/pb_kits/playbook/pb_select/_select.tsx +14 -19
  11. data/app/pb_kits/playbook/pb_select/docs/example.yml +0 -1
  12. data/app/pb_kits/playbook/pb_select/docs/index.js +0 -1
  13. data/dist/chunks/{_typeahead-B8fkIeXA.js → _typeahead-DU1QgR52.js} +1 -1
  14. data/dist/chunks/{_weekday_stacked-DxlPBh55.js → _weekday_stacked-BLOmRNnB.js} +3 -3
  15. data/dist/chunks/{lib-SyD3buPZ.js → lib-Ce7MLbJk.js} +1 -1
  16. data/dist/chunks/{pb_form_validation-Dt8UJgrJ.js → pb_form_validation-kPWA1Z2g.js} +1 -1
  17. data/dist/chunks/vendor.js +1 -1
  18. data/dist/playbook-doc.js +1 -1
  19. data/dist/playbook-rails-react-bindings.js +1 -1
  20. data/dist/playbook-rails.js +1 -1
  21. data/lib/playbook/version.rb +1 -1
  22. metadata +6 -13
  23. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.jsx +0 -50
  24. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination.md +0 -1
  25. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.jsx +0 -57
  26. data/app/pb_kits/playbook/pb_advanced_table/docs/_advanced_table_pagination_with_props.md +0 -5
  27. data/app/pb_kits/playbook/pb_advanced_table/docs/advanced_table_pagination_mock_data.json +0 -5600
  28. data/app/pb_kits/playbook/pb_select/docs/_select_form.jsx +0 -108
  29. data/app/pb_kits/playbook/utilities/hookFormProps.ts +0 -16
@@ -1,108 +0,0 @@
1
- import React from 'react'
2
- import { useForm } from 'react-hook-form'
3
- import { Select, Card, Body, Button } from 'playbook-ui'
4
-
5
- const SelectForm = (props) => {
6
- const {
7
- register,
8
- handleSubmit,
9
- formState: { errors },
10
- watch,
11
- } = useForm({
12
- defaultValues: {
13
- favoriteFood: '',
14
- mealType: '',
15
- dietaryRestrictions: '',
16
- }
17
- })
18
-
19
- const onSubmit = (data) => {
20
- console.log('Form submitted:', data)
21
- }
22
-
23
- // Watch form values for real-time display
24
- const formValues = watch()
25
-
26
- const foodOptions = [
27
- { value: 'pizza', text: 'Pizza' },
28
- { value: 'burger', text: 'Burger' },
29
- { value: 'sushi', text: 'Sushi' },
30
- { value: 'salad', text: 'Salad' },
31
- ]
32
-
33
- const mealTypes = [
34
- { value: 'breakfast', text: 'Breakfast' },
35
- { value: 'lunch', text: 'Lunch' },
36
- { value: 'dinner', text: 'Dinner' },
37
- ]
38
-
39
- const dietaryOptions = [
40
- { value: 'none', text: 'No Restrictions' },
41
- { value: 'vegetarian', text: 'Vegetarian' },
42
- { value: 'vegan', text: 'Vegan' },
43
- { value: 'glutenFree', text: 'Gluten Free' },
44
- ]
45
-
46
- return (
47
- <div>
48
- <Card>
49
- <form onSubmit={handleSubmit(onSubmit)}>
50
- <Select
51
- error={errors.favoriteFood?.message}
52
- label="What's your favorite food?"
53
- name="favoriteFood"
54
- options={foodOptions}
55
- register={register}
56
- rules={{
57
- required: 'Please select your favorite food',
58
- }}
59
- {...props}
60
- />
61
- <Select
62
- blankSelection="Choose a meal type..."
63
- error={errors.mealType?.message}
64
- label="Preferred meal time"
65
- marginTop="md"
66
- name="mealType"
67
- options={mealTypes}
68
- register={register}
69
- rules={{
70
- required: 'Please select a meal type',
71
- }}
72
- {...props}
73
- />
74
- <Select
75
- label="Dietary Restrictions"
76
- marginTop="md"
77
- name="dietaryRestrictions"
78
- options={dietaryOptions}
79
- register={register}
80
- {...props}
81
- />
82
-
83
- <Button
84
- marginTop="lg"
85
- text="Submit"
86
- type="submit"
87
- variant="primary"
88
-
89
- />
90
- </form>
91
- <Card marginTop="lg">
92
- <Body
93
- text="Current Form Values:"
94
- variant="bold"
95
- />
96
- <pre style={{ marginTop: '8px', color: "white" }}>
97
- {JSON.stringify(formValues, null, 2)}
98
- </pre>
99
- </Card>
100
- </Card>
101
- </div>
102
- )
103
- }
104
-
105
- export default SelectForm
106
-
107
-
108
-
@@ -1,16 +0,0 @@
1
- import { UseFormRegister, FieldValues, RegisterOptions } from 'react-hook-form'
2
-
3
- export type HookFormProps<T extends FieldValues = FieldValues> = {
4
- register?: UseFormRegister<T>
5
- rules?: RegisterOptions
6
- name: string
7
- }
8
-
9
- export const withHookForm = <T extends FieldValues = FieldValues>(
10
- props: HookFormProps<T>
11
- ) => {
12
- const { register, name, rules } = props
13
- if (!register) return {}
14
-
15
- return register(name, rules)
16
- }