ar-design 0.3.2 → 0.3.3

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.
@@ -1,7 +1,7 @@
1
1
  /* #region BLUE */
2
2
  .borderless:not(.disabled) {
3
3
  &.blue {
4
- color: var(--blue-500-500);
4
+ color: var(--blue-500);
5
5
 
6
6
  &.active {
7
7
  animation: clicked-blue ease-in-out 750ms 0s 1 normal both;
@@ -34,7 +34,7 @@ button.borderless:not(.disabled) {
34
34
  /* #region PURPLE */
35
35
  .borderless:not(.disabled) {
36
36
  &.purple {
37
- color: var(--purple-500-500);
37
+ color: var(--purple-500);
38
38
 
39
39
  &.active {
40
40
  animation: clicked-purple ease-in-out 750ms 0s 1 normal both;
@@ -67,7 +67,7 @@ button.borderless:not(.disabled) {
67
67
  /* #region PINK */
68
68
  .borderless:not(.disabled) {
69
69
  &.pink {
70
- color: var(--pink-500-500);
70
+ color: var(--pink-500);
71
71
 
72
72
  &.active {
73
73
  animation: clicked-pink ease-in-out 750ms 0s 1 normal both;
@@ -100,7 +100,7 @@ button.borderless:not(.disabled) {
100
100
  /* #region RED */
101
101
  .borderless:not(.disabled) {
102
102
  &.red {
103
- color: var(--red-500-500);
103
+ color: var(--red-500);
104
104
 
105
105
  &.active {
106
106
  animation: clicked-red ease-in-out 750ms 0s 1 normal both;
@@ -133,7 +133,7 @@ button.borderless:not(.disabled) {
133
133
  /* #region ORANGE */
134
134
  .borderless:not(.disabled) {
135
135
  &.orange {
136
- color: var(--orange-500-500);
136
+ color: var(--orange-500);
137
137
 
138
138
  &.active {
139
139
  animation: clicked-orange ease-in-out 750ms 0s 1 normal both;
@@ -166,7 +166,7 @@ button.borderless:not(.disabled) {
166
166
  /* #region YELLOW */
167
167
  .borderless:not(.disabled) {
168
168
  &.yellow {
169
- color: var(--yellow-500-500);
169
+ color: var(--yellow-500);
170
170
 
171
171
  &.active {
172
172
  animation: clicked-yellow ease-in-out 750ms 0s 1 normal both;
@@ -199,7 +199,7 @@ button.borderless:not(.disabled) {
199
199
  /* #region GREEN */
200
200
  .borderless:not(.disabled) {
201
201
  &.green {
202
- color: var(--green-500-500);
202
+ color: var(--green-500);
203
203
 
204
204
  &.active {
205
205
  animation: clicked-green ease-in-out 750ms 0s 1 normal both;
@@ -232,7 +232,7 @@ button.borderless:not(.disabled) {
232
232
  /* #region TEAL */
233
233
  .borderless:not(.disabled) {
234
234
  &.teal {
235
- color: var(--teal-500-500);
235
+ color: var(--teal-500);
236
236
 
237
237
  &.active {
238
238
  animation: clicked-teal ease-in-out 750ms 0s 1 normal both;
@@ -265,7 +265,7 @@ button.borderless:not(.disabled) {
265
265
  /* #region CYAN */
266
266
  .borderless:not(.disabled) {
267
267
  &.cyan {
268
- color: var(--cyan-500-500);
268
+ color: var(--cyan-500);
269
269
 
270
270
  &.active {
271
271
  animation: clicked-cyan ease-in-out 750ms 0s 1 normal both;
@@ -298,7 +298,7 @@ button.borderless:not(.disabled) {
298
298
  /* #region GRAY */
299
299
  .borderless:not(.disabled) {
300
300
  &.gray {
301
- color: var(--gray-500-500);
301
+ color: var(--gray-500);
302
302
 
303
303
  &.active {
304
304
  animation: clicked-gray ease-in-out 750ms 0s 1 normal both;
@@ -3,6 +3,7 @@ import React, { useEffect, useMemo, useRef, useState } from "react";
3
3
  import Input from "../input";
4
4
  const InputNumber = ({ ...attributes }) => {
5
5
  // refs
6
+ const _firstLoad = useRef(false);
6
7
  const _input = useRef(null);
7
8
  const _caretPosition = useRef(null);
8
9
  const _isInputTouch = useRef(false);
@@ -61,10 +62,16 @@ const InputNumber = ({ ...attributes }) => {
61
62
  }, []);
62
63
  // useEffects
63
64
  useEffect(() => {
64
- if (attributes.value !== undefined)
65
- setValue(attributes.value ?? "");
65
+ if (_firstLoad.current)
66
+ return;
67
+ if (attributes.value !== undefined && attributes.value !== "") {
68
+ const isDecimals = String(attributes.value).includes(",");
69
+ let formatted = formatter(isDecimals).format(parseFloat(String(attributes.value)));
70
+ setValue(formatted == "NaN" ? "" : formatted);
71
+ _firstLoad.current = true;
72
+ }
66
73
  }, [attributes.value]);
67
- return (React.createElement(Input, { ref: _input, ...attributes, value: value ?? attributes.value, onChange: (event) => {
74
+ return (React.createElement(Input, { ref: _input, ...attributes, value: value ?? attributes.value ?? "", onChange: (event) => {
68
75
  // Disabled gelmesi durumunda işlem yapmasına izin verme...
69
76
  if (attributes.disabled)
70
77
  return;
@@ -1,13 +1,11 @@
1
1
  declare class Api {
2
2
  private _host?;
3
3
  private _core?;
4
- private _token?;
5
4
  private _init?;
6
5
  private _url;
7
6
  constructor(values: {
8
7
  host?: string;
9
8
  core?: string;
10
- token?: string;
11
9
  init?: RequestInit;
12
10
  });
13
11
  Get(values: {
@@ -40,7 +38,6 @@ declare class Api {
40
38
  init?: RequestInit;
41
39
  }): Promise<Response>;
42
40
  private HeaderProperties;
43
- private Cookies;
44
41
  /**
45
42
  * Burada bir fetch işlemi gerçekleştirilmekte fakat farklı olarak burayı `interceptor` olarak kullanmaktayız.
46
43
  * @param input
@@ -1,13 +1,11 @@
1
1
  class Api {
2
2
  _host;
3
3
  _core;
4
- _token;
5
4
  _init;
6
5
  _url;
7
6
  constructor(values) {
8
7
  this._host = values.host || (typeof window !== "undefined" ? window.location.origin : "");
9
8
  this._core = values.core || "";
10
- this._token = values.token;
11
9
  this._init = values.init;
12
10
  // Url
13
11
  this._url = `${this._host}/${this._core ? this._core + "/" : ""}`;
@@ -93,20 +91,8 @@ class Api {
93
91
  return {
94
92
  Accept: "application/json",
95
93
  "Content-Type": "application/json",
96
- ...(this._token && { Authorization: `Bearer ${this.Cookies(this._token)}` }),
97
94
  };
98
95
  };
99
- Cookies = (name) => {
100
- if (typeof window === "undefined")
101
- return undefined;
102
- const cookies = document.cookie.split("; ");
103
- const cookieObject = [];
104
- cookies.forEach((cookie) => {
105
- const [key, value] = cookie.split("=");
106
- cookieObject.push({ key: key, value: value });
107
- });
108
- return decodeURIComponent(cookieObject.find((x) => x.key === name)?.value ?? "");
109
- };
110
96
  /**
111
97
  * Burada bir fetch işlemi gerçekleştirilmekte fakat farklı olarak burayı `interceptor` olarak kullanmaktayız.
112
98
  * @param input
@@ -12,7 +12,6 @@ declare class Service {
12
12
  host?: string;
13
13
  core?: string;
14
14
  endPoint?: string;
15
- token?: string;
16
15
  init?: RequestInit;
17
16
  });
18
17
  Get<TResponse>(values?: {
@@ -3,7 +3,7 @@ class Service {
3
3
  _api;
4
4
  _endPoint;
5
5
  constructor(values) {
6
- this._api = new Api({ host: values.host, core: values.core, token: values.token, init: values.init });
6
+ this._api = new Api({ host: values.host, core: values.core, init: values.init });
7
7
  this._endPoint = values.endPoint;
8
8
  }
9
9
  async Get(values) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ar-design",
3
- "version": "0.3.2",
3
+ "version": "0.3.3",
4
4
  "main": "./dist/index.js",
5
5
  "module": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",