@draftbit/core 46.11.1-d7a8f7.2 → 46.11.1-e9ee84.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.
Files changed (67) hide show
  1. package/lib/commonjs/components/Accordion/AccordionItem.js +4 -22
  2. package/lib/commonjs/components/DeckSwiper/DeckSwiper.js +1 -1
  3. package/lib/commonjs/components/DeckSwiper/DeckSwiper.js.map +1 -1
  4. package/lib/commonjs/components/DeckSwiper/DeckSwiperCard.js +0 -1
  5. package/lib/commonjs/components/DeckSwiper/DeckSwiperCard.js.map +1 -1
  6. package/lib/commonjs/components/Picker/Picker.js +13 -4
  7. package/lib/commonjs/components/Picker/Picker.js.map +1 -1
  8. package/lib/commonjs/components/Shadow.js +11 -2
  9. package/lib/commonjs/components/Shadow.js.map +1 -1
  10. package/lib/commonjs/components/TabView/TabView.js +1 -1
  11. package/lib/commonjs/components/TabView/TabView.js.map +1 -1
  12. package/lib/commonjs/mappings/DeckSwiper.js +2 -2
  13. package/lib/commonjs/mappings/DeckSwiper.js.map +1 -1
  14. package/lib/commonjs/mappings/DeckSwiperCard.js +1 -2
  15. package/lib/commonjs/mappings/DeckSwiperCard.js.map +1 -1
  16. package/lib/commonjs/mappings/Shadow.js +2 -2
  17. package/lib/commonjs/mappings/Shadow.js.map +1 -1
  18. package/lib/commonjs/utilities.js +9 -1
  19. package/lib/commonjs/utilities.js.map +1 -1
  20. package/lib/module/components/Accordion/AccordionGroup.js.map +1 -1
  21. package/lib/module/components/DeckSwiper/DeckSwiper.js +1 -1
  22. package/lib/module/components/DeckSwiper/DeckSwiper.js.map +1 -1
  23. package/lib/module/components/DeckSwiper/DeckSwiperCard.js +0 -1
  24. package/lib/module/components/DeckSwiper/DeckSwiperCard.js.map +1 -1
  25. package/lib/module/components/Picker/Picker.js +13 -4
  26. package/lib/module/components/Picker/Picker.js.map +1 -1
  27. package/lib/module/components/Shadow.js +11 -2
  28. package/lib/module/components/Shadow.js.map +1 -1
  29. package/lib/module/components/TabView/TabView.js +1 -1
  30. package/lib/module/components/TabView/TabView.js.map +1 -1
  31. package/lib/module/mappings/DeckSwiper.js +3 -3
  32. package/lib/module/mappings/DeckSwiper.js.map +1 -1
  33. package/lib/module/mappings/DeckSwiperCard.js +2 -3
  34. package/lib/module/mappings/DeckSwiperCard.js.map +1 -1
  35. package/lib/module/mappings/Shadow.js +3 -3
  36. package/lib/module/mappings/Shadow.js.map +1 -1
  37. package/lib/module/utilities.js +6 -0
  38. package/lib/module/utilities.js.map +1 -1
  39. package/lib/typescript/src/components/DeckSwiper/DeckSwiperCard.d.ts.map +1 -1
  40. package/lib/typescript/src/components/Picker/Picker.d.ts.map +1 -1
  41. package/lib/typescript/src/components/Shadow.d.ts.map +1 -1
  42. package/lib/typescript/src/mappings/DeckSwiper.d.ts +1 -1
  43. package/lib/typescript/src/mappings/DeckSwiper.d.ts.map +1 -1
  44. package/lib/typescript/src/mappings/DeckSwiperCard.d.ts +0 -1
  45. package/lib/typescript/src/mappings/DeckSwiperCard.d.ts.map +1 -1
  46. package/lib/typescript/src/mappings/Shadow.d.ts.map +1 -1
  47. package/lib/typescript/src/utilities.d.ts +2 -0
  48. package/lib/typescript/src/utilities.d.ts.map +1 -1
  49. package/package.json +3 -3
  50. package/src/components/DeckSwiper/DeckSwiper.js +1 -1
  51. package/src/components/DeckSwiper/DeckSwiper.tsx +1 -1
  52. package/src/components/DeckSwiper/DeckSwiperCard.js +0 -1
  53. package/src/components/DeckSwiper/DeckSwiperCard.tsx +0 -1
  54. package/src/components/Picker/Picker.js +16 -4
  55. package/src/components/Picker/Picker.tsx +25 -5
  56. package/src/components/Shadow.js +11 -2
  57. package/src/components/Shadow.tsx +15 -3
  58. package/src/components/TabView/TabView.js +1 -1
  59. package/src/components/TabView/TabView.tsx +1 -1
  60. package/src/mappings/DeckSwiper.js +7 -3
  61. package/src/mappings/DeckSwiper.ts +7 -3
  62. package/src/mappings/DeckSwiperCard.js +10 -3
  63. package/src/mappings/DeckSwiperCard.ts +10 -6
  64. package/src/mappings/Shadow.js +9 -3
  65. package/src/mappings/Shadow.ts +9 -3
  66. package/src/utilities.js +9 -0
  67. package/src/utilities.ts +19 -0
@@ -1,16 +1,20 @@
1
- import {
2
- COMPONENT_TYPES,
3
- CONTAINER_COMPONENT_STYLES_SECTIONS,
4
- } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, StylesPanelSections } from "@draftbit/types";
5
2
 
6
3
  export const SEED_DATA = {
7
4
  name: "Deck Swiper Card",
8
5
  tag: "DeckSwiperCard",
9
6
  description: "Single Deck Swiper Card item to be used in DeckSwiper",
10
7
  category: COMPONENT_TYPES.swiper,
11
- stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
8
+ stylesPanelSections: [
9
+ StylesPanelSections.LayoutFlexItems,
10
+ StylesPanelSections.LayoutContent,
11
+ StylesPanelSections.Background,
12
+ StylesPanelSections.Size,
13
+ StylesPanelSections.MarginsAndPaddings,
14
+ StylesPanelSections.Borders,
15
+ StylesPanelSections.Effects,
16
+ ],
12
17
  layout: {
13
- flex: 1,
14
18
  alignItems: "center",
15
19
  justifyContent: "center",
16
20
  padding: 20,
@@ -1,10 +1,16 @@
1
- import { COMPONENT_TYPES, CONTAINER_COMPONENT_STYLES_SECTIONS, createColorProp, createStaticNumberProp, createStaticBoolProp, createDisabledProp, GROUPS, } from "@draftbit/types";
1
+ import { COMPONENT_TYPES, createColorProp, createStaticNumberProp, createStaticBoolProp, createDisabledProp, GROUPS, StylesPanelSections, } from "@draftbit/types";
2
2
  export const SEED_DATA = {
3
3
  name: "Shadow",
4
4
  tag: "Shadow",
5
5
  description: "A cross-platform, universal shadow.",
6
6
  category: COMPONENT_TYPES.view,
7
- stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
7
+ stylesPanelSections: [
8
+ StylesPanelSections.Size,
9
+ StylesPanelSections.Margins,
10
+ StylesPanelSections.Position,
11
+ StylesPanelSections.Borders,
12
+ StylesPanelSections.Effects,
13
+ ],
8
14
  props: {
9
15
  disabled: createDisabledProp({
10
16
  description: "Disables the shadow.",
@@ -26,7 +32,7 @@ export const SEED_DATA = {
26
32
  paintInside: createStaticBoolProp({
27
33
  label: "Paint Inside",
28
34
  description: "Apply the shadow below/inside the content.",
29
- defaultValue: false,
35
+ defaultValue: true,
30
36
  }),
31
37
  stretch: createStaticBoolProp({
32
38
  label: "Stretch",
@@ -1,11 +1,11 @@
1
1
  import {
2
2
  COMPONENT_TYPES,
3
- CONTAINER_COMPONENT_STYLES_SECTIONS,
4
3
  createColorProp,
5
4
  createStaticNumberProp,
6
5
  createStaticBoolProp,
7
6
  createDisabledProp,
8
7
  GROUPS,
8
+ StylesPanelSections,
9
9
  } from "@draftbit/types";
10
10
 
11
11
  export const SEED_DATA = {
@@ -13,7 +13,13 @@ export const SEED_DATA = {
13
13
  tag: "Shadow",
14
14
  description: "A cross-platform, universal shadow.",
15
15
  category: COMPONENT_TYPES.view,
16
- stylesPanelSections: CONTAINER_COMPONENT_STYLES_SECTIONS,
16
+ stylesPanelSections: [
17
+ StylesPanelSections.Size,
18
+ StylesPanelSections.Margins,
19
+ StylesPanelSections.Position,
20
+ StylesPanelSections.Borders,
21
+ StylesPanelSections.Effects,
22
+ ],
17
23
  props: {
18
24
  disabled: createDisabledProp({
19
25
  description: "Disables the shadow.",
@@ -35,7 +41,7 @@ export const SEED_DATA = {
35
41
  paintInside: createStaticBoolProp({
36
42
  label: "Paint Inside",
37
43
  description: "Apply the shadow below/inside the content.",
38
- defaultValue: false,
44
+ defaultValue: true,
39
45
  }),
40
46
  stretch: createStaticBoolProp({
41
47
  label: "Stretch",
package/src/utilities.js CHANGED
@@ -65,6 +65,15 @@ export function extractBorderAndMarginStyles(style, additionalBorderStyles, addi
65
65
  ]), identity);
66
66
  return { borderStyles, marginStyles };
67
67
  }
68
+ export const sizeStyleNames = ["width", "height"];
69
+ export function extractSizeStyles(style, additionalSizeStyles) {
70
+ const flatStyle = StyleSheet.flatten(style || {});
71
+ const sizeStyles = pickBy(pick(flatStyle, [
72
+ ...sizeStyleNames,
73
+ ...(additionalSizeStyles ? additionalSizeStyles : []),
74
+ ]), identity);
75
+ return sizeStyles;
76
+ }
68
77
  /**
69
78
  * Merges a style object on top of another style object. In React Native,
70
79
  * keys with undefined values in a style object will still override styles
package/src/utilities.ts CHANGED
@@ -98,6 +98,25 @@ export function extractBorderAndMarginStyles(
98
98
  return { borderStyles, marginStyles };
99
99
  }
100
100
 
101
+ export const sizeStyleNames = ["width", "height"];
102
+
103
+ export function extractSizeStyles(
104
+ style: StyleProp<any>,
105
+ additionalSizeStyles?: string[]
106
+ ) {
107
+ const flatStyle = StyleSheet.flatten(style || {});
108
+
109
+ const sizeStyles = pickBy(
110
+ pick(flatStyle, [
111
+ ...sizeStyleNames,
112
+ ...(additionalSizeStyles ? additionalSizeStyles : []),
113
+ ]),
114
+ identity
115
+ );
116
+
117
+ return sizeStyles;
118
+ }
119
+
101
120
  /**
102
121
  * Merges a style object on top of another style object. In React Native,
103
122
  * keys with undefined values in a style object will still override styles