frappe-ui 0.1.246 → 0.1.248

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "frappe-ui",
3
- "version": "0.1.246",
3
+ "version": "0.1.248",
4
4
  "description": "A set of components and utilities for rapid UI development",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -49,6 +49,7 @@
49
49
  "scripts",
50
50
  "vite",
51
51
  "icons",
52
+ "tailwind",
52
53
  "tsconfig.base.json"
53
54
  ],
54
55
  "repository": {
@@ -127,7 +127,7 @@
127
127
  :disabled="dateObj.disabled"
128
128
  @click="
129
129
  !dateObj.disabled &&
130
- handleDateCellClick(dateObj.date, togglePopover)
130
+ handleDateCellClick(dateObj.date, togglePopover)
131
131
  "
132
132
  >
133
133
  {{ dateObj.date.date() }}
@@ -268,7 +268,7 @@ const view = ref<ViewMode>('date')
268
268
  const currentYear = ref<number>(dayjs().year())
269
269
  const currentMonth = ref<number>(dayjs().month())
270
270
  const DATE_FORMAT = 'YYYY-MM-DD'
271
- const DATE_TIME_FORMAT = 'YYYY-MM-DD h:mm a'
271
+ const DATE_TIME_FORMAT = 'YYYY-MM-DD HH:mm:ss'
272
272
 
273
273
  const selectedDate = ref<string>('') // YYYY-MM-DD
274
274
  const timeValue = ref<string>('') // HH:mm:ss
@@ -1,4 +1,4 @@
1
- import preset from '../tailwind/preset.js'
1
+ import preset from '../../tailwind/preset.js'
2
2
  console.warn(
3
3
  '`frappe-ui/src/utils/tailwind.config.js` is deprecated. Use `frappe-ui/tailwind/preset.js` instead.',
4
4
  )
@@ -0,0 +1,131 @@
1
+ import tailwindColors from 'tailwindcss/colors'
2
+ import colorsData from './colors.json'
3
+
4
+ function generateColorPalette() {
5
+ const colorPalette = {
6
+ inherit: tailwindColors.inherit,
7
+ current: tailwindColors.current,
8
+ transparent: tailwindColors.transparent,
9
+ black: tailwindColors.black,
10
+ white: tailwindColors.white,
11
+ gray: {},
12
+ blue: {},
13
+ green: {},
14
+ red: {},
15
+ orange: {},
16
+ yellow: {},
17
+ teal: {},
18
+ violet: {},
19
+ cyan: {},
20
+ amber: {},
21
+ pink: {},
22
+ purple: {},
23
+ 'white-overlay': {},
24
+ 'black-overlay': {},
25
+ }
26
+
27
+ Object.keys(colorsData.lightMode).forEach((color) => {
28
+ colorPalette[color] = colorsData.lightMode[color]
29
+ })
30
+ Object.keys(colorsData.darkMode).forEach((color) => {
31
+ colorPalette[`dark-${color}`] = colorsData.darkMode[color]
32
+ })
33
+
34
+ Object.keys(colorsData.overlay.white).forEach((shade) => {
35
+ colorPalette['white-overlay'][shade] = colorsData.overlay.white[shade]
36
+ })
37
+
38
+ Object.keys(colorsData.overlay.black).forEach((shade) => {
39
+ colorPalette['black-overlay'][shade] = colorsData.overlay.black[shade]
40
+ })
41
+
42
+ return colorPalette
43
+ }
44
+
45
+ function resolveColorReference(reference) {
46
+ const [mode, color, shade] = reference.split('/')
47
+ if (mode === 'lightMode') {
48
+ return colorsData.lightMode[color][shade]
49
+ } else if (mode === 'darkMode') {
50
+ return colorsData.darkMode[color][shade]
51
+ } else if (mode === 'overlay') {
52
+ return colorsData.overlay[color][shade]
53
+ } else if (mode === 'neutral') {
54
+ return colorsData.neutral[color]
55
+ }
56
+ return null
57
+ }
58
+
59
+ function generateCSSVariables() {
60
+ const output = {
61
+ ':root': {},
62
+ '[data-theme="dark"]': {},
63
+ }
64
+
65
+ // Generate CSS variables for light mode
66
+ Object.keys(colorsData.themedVariables.light).forEach((category) => {
67
+ Object.keys(colorsData.themedVariables.light[category]).forEach(
68
+ (colorName) => {
69
+ const variableName = `--${category}-${colorName}`
70
+ const reference = colorsData.themedVariables.light[category][colorName]
71
+ const lightValue = resolveColorReference(reference)
72
+ output[':root'][variableName] = lightValue
73
+ },
74
+ )
75
+ })
76
+
77
+ // Generate CSS variables for dark mode
78
+ Object.keys(colorsData.themedVariables.dark).forEach((category) => {
79
+ Object.keys(colorsData.themedVariables.dark[category]).forEach(
80
+ (colorName) => {
81
+ const variableName = `--${category}-${colorName}`
82
+ const reference = colorsData.themedVariables.dark[category][colorName]
83
+ const darkValue = resolveColorReference(reference)
84
+ output['[data-theme="dark"]'][variableName] = darkValue
85
+ },
86
+ )
87
+ })
88
+
89
+ // Generate CSS variables for each color shade
90
+ Object.keys(colorsData.lightMode).forEach((color) => {
91
+ Object.keys(colorsData.lightMode[color]).forEach((shade) => {
92
+ const variableName = `--${color}-${shade}`
93
+ const value = colorsData.lightMode[color][shade]
94
+ output[':root'][variableName] = value
95
+ })
96
+ })
97
+
98
+ Object.keys(colorsData.darkMode).forEach((color) => {
99
+ Object.keys(colorsData.darkMode[color]).forEach((shade) => {
100
+ const variableName = `--dark-${color}-${shade}`
101
+ const value = colorsData.darkMode[color][shade]
102
+ output['[data-theme="dark"]'][variableName] = value
103
+ })
104
+ })
105
+
106
+ return output
107
+ }
108
+
109
+ function generateSemanticColors() {
110
+ const output = {
111
+ outline: {},
112
+ surface: {},
113
+ ink: {},
114
+ }
115
+
116
+ // Generate semantic colors
117
+ Object.keys(colorsData.themedVariables.light).forEach((category) => {
118
+ Object.keys(colorsData.themedVariables.light[category]).forEach(
119
+ (colorName) => {
120
+ const variableName = `${category}-${colorName}`
121
+ const reference = colorsData.themedVariables.light[category][colorName]
122
+ const lightValue = resolveColorReference(reference)
123
+ output[category][colorName] = `var(--${variableName}, ${lightValue})`
124
+ },
125
+ )
126
+ })
127
+
128
+ return output
129
+ }
130
+
131
+ export { generateColorPalette, generateCSSVariables, generateSemanticColors }